26efc63679ae9fb1f73737822e5edda4997e33b1
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-08-17  Sam Weinig  <weinig@apple.com>
2
3         Rename StringBuilder::flexibleAppend(...) to StringBuilder::append(...)
4         https://bugs.webkit.org/show_bug.cgi?id=200756
5
6         Reviewed by Darin Adler.
7
8         Update call sites for rename from StringBuilder::flexibleAppend(...) to 
9         StringBuilder::append(...).
10
11         * WebProcess/WebPage/WebPage.cpp:
12         (WebKit::dumpHistoryItem):
13         We have to explicitly access the underlying String of the URL rather than
14         relying on the implicit conversion since it is now ambiguous which append(...)
15         overload should be used.
16
17 2019-08-17  Devin Rousso  <drousso@apple.com>
18
19         Web Inspector: make the initial height bigger when attached
20         https://bugs.webkit.org/show_bug.cgi?id=200855
21
22         Reviewed by Joseph Pecoraro.
23
24         * Shared/WebPreferences.yaml:
25         Increase the default attached height from `300px` to `500px`, which is close to the same
26         amount of area given a 15" MacBook Pro's aspect ratio (default attached width is `750px`).
27
28 2019-08-17  Simon Fraser  <simon.fraser@apple.com>
29
30         [iOS WK2] Scroll indicators disappear sometimes
31         https://bugs.webkit.org/show_bug.cgi?id=200791
32
33         Reviewed by Tim Horton.
34         
35         _web_setSubviews: replaces all of the views subviews with the supplied array, but this blows
36         away views not managed by WebKit, including UIScrollViews scroll indicators. Fix by having
37         WebKit-managed views implement the WKWebKitControlled protocol, and only removing views
38         implementing that protocol.
39
40         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
41         (-[UIView _web_setSubviews:]):
42         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
43
44 2019-08-17  Antti Koivisto  <antti@apple.com>
45
46         Content in <iframe> should override "touch-action" set in embedding document
47         https://bugs.webkit.org/show_bug.cgi?id=200204
48         <rdar://problem/54355249>
49
50         Reviewed by Antoine Quint.
51
52         Subframes where content doesn't use any touch-action properties won't generate event region for their main layer.
53         As a result the touch-action property gets computed in UI process to the parent frames touch-action (instead of 'auto').
54
55         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
56         (WebKit::touchActionsForPoint):
57
58         If the topmost layer hit is a WKChildScrollView we know its content layer didn't have an event region.
59         This means we should return the default value 'auto'.
60
61 2019-08-16  Chris Dumez  <cdumez@apple.com>
62
63         Use strongly typed identifiers for StorageArea / StorageAreaImpl
64         https://bugs.webkit.org/show_bug.cgi?id=200835
65
66         Reviewed by Alex Christensen.
67
68         Use strongly typed identifiers for StorageArea / StorageAreaImpl. They currently both use uint64_t
69         and are used in the same code, it is therefore very easy to confused the 2 types of identifiers.
70
71         * NetworkProcess/WebStorage/StorageArea.cpp:
72         (WebKit::StorageArea::StorageArea):
73         (WebKit::StorageArea::setItem):
74         (WebKit::StorageArea::removeItem):
75         (WebKit::StorageArea::clear):
76         (WebKit::StorageArea::dispatchEvents const):
77         * NetworkProcess/WebStorage/StorageArea.h:
78         (WebKit::StorageArea::identifier):
79         * NetworkProcess/WebStorage/StorageAreaIdentifier.h: Copied from Source/WebKit/WebProcess/WebStorage/StorageAreaImpl.h.
80         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
81         (WebKit::StorageManagerSet::connectToLocalStorageArea):
82         (WebKit::StorageManagerSet::connectToTransientLocalStorageArea):
83         (WebKit::StorageManagerSet::connectToSessionStorageArea):
84         (WebKit::StorageManagerSet::disconnectFromStorageArea):
85         (WebKit::StorageManagerSet::getValues):
86         (WebKit::StorageManagerSet::setItem):
87         (WebKit::StorageManagerSet::removeItem):
88         (WebKit::StorageManagerSet::clear):
89         * NetworkProcess/WebStorage/StorageManagerSet.h:
90         * NetworkProcess/WebStorage/StorageManagerSet.messages.in:
91         * Scripts/webkit/messages.py:
92         * WebKit.xcodeproj/project.pbxproj:
93         * WebProcess/Network/NetworkProcessConnection.cpp:
94         (WebKit::NetworkProcessConnection::didReceiveMessage):
95         * WebProcess/WebProcess.cpp:
96         (WebKit::WebProcess::registerStorageAreaMap):
97         (WebKit::WebProcess::unregisterStorageAreaMap):
98         (WebKit::WebProcess::storageAreaMap const):
99         * WebProcess/WebProcess.h:
100         * WebProcess/WebStorage/StorageAreaImpl.cpp:
101         (WebKit::StorageAreaImpl::StorageAreaImpl):
102         * WebProcess/WebStorage/StorageAreaImpl.h:
103         * WebProcess/WebStorage/StorageAreaImplIdentifier.h: Copied from Source/WebKit/WebProcess/WebStorage/StorageAreaImpl.h.
104         * WebProcess/WebStorage/StorageAreaMap.cpp:
105         (WebKit::StorageAreaMap::StorageAreaMap):
106         (WebKit::StorageAreaMap::setItem):
107         (WebKit::StorageAreaMap::removeItem):
108         (WebKit::StorageAreaMap::clear):
109         (WebKit::StorageAreaMap::loadValuesIfNeeded):
110         (WebKit::StorageAreaMap::dispatchStorageEvent):
111         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
112         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
113         (WebKit::StorageAreaMap::disconnect):
114         * WebProcess/WebStorage/StorageAreaMap.h:
115         (WebKit::StorageAreaMap::identifier const):
116         * WebProcess/WebStorage/StorageAreaMap.messages.in:
117
118 2019-08-16  Chris Dumez  <cdumez@apple.com>
119
120         Drop StorageArea::setWorkQueue() member function
121         https://bugs.webkit.org/show_bug.cgi?id=200832
122
123         Reviewed by Alex Christensen.
124
125         Drop StorageArea::setWorkQueue() member function and pass the WorkQueue to the StorageArea constructor instead.
126         The WorkQueue can never get updated so an explicit setter is not necessary. It also makes it clearer that the
127         m_queue data member can never be null.
128
129         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
130         (WebKit::LocalStorageNamespace::getOrCreateStorageArea):
131         * NetworkProcess/WebStorage/LocalStorageNamespace.h:
132         * NetworkProcess/WebStorage/SessionStorageNamespace.cpp:
133         (WebKit::SessionStorageNamespace::getOrCreateStorageArea):
134         * NetworkProcess/WebStorage/SessionStorageNamespace.h:
135         * NetworkProcess/WebStorage/StorageArea.cpp:
136         (WebKit::StorageArea::StorageArea):
137         (WebKit::StorageArea::clone const):
138         (WebKit::StorageArea::openDatabaseAndImportItemsIfNeeded const):
139         * NetworkProcess/WebStorage/StorageArea.h:
140         (WebKit::StorageArea::setWorkQueue): Deleted.
141         * NetworkProcess/WebStorage/StorageManager.cpp:
142         (WebKit::StorageManager::createLocalStorageArea):
143         (WebKit::StorageManager::createTransientLocalStorageArea):
144         (WebKit::StorageManager::createSessionStorageArea):
145         * NetworkProcess/WebStorage/StorageManager.h:
146         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
147         (WebKit::StorageManagerSet::connectToLocalStorageArea):
148         (WebKit::StorageManagerSet::connectToTransientLocalStorageArea):
149         (WebKit::StorageManagerSet::connectToSessionStorageArea):
150         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp:
151         (WebKit::TransientLocalStorageNamespace::getOrCreateStorageArea):
152         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.h:
153
154 2019-08-16  Chris Dumez  <cdumez@apple.com>
155
156         LocalStorageDatabaseTracker does not need to subclass ThreadSafeRefCounted
157         https://bugs.webkit.org/show_bug.cgi?id=200825
158
159         Reviewed by Alex Christensen.
160
161         LocalStorageDatabaseTracker does not need to subclass ThreadSafeRefCounted. It is currently always
162         ref'd / deref'd from the com.apple.WebKit.WebStorage serial WorkQueue, save from inside
163         LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() on iOS. However, it is probably
164         not a good idea to set FileSystem metadata from the main thread in platformMaybeExcludeFromBackup()
165         anyway.
166
167         Note that I had to get rid of an old linked-on-after check since those are currently only safe
168         to do on the main thread. I cleared this with Brady. It has been a while since we've shipped this
169         behavior now and apps have had a chance to update.
170
171         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
172         (WebKit::LocalStorageDatabaseTracker::databasePath const):
173         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
174         * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
175         (WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const):
176         * UIProcess/Cocoa/VersionChecks.h:
177
178 2019-08-16  Chris Dumez  <cdumez@apple.com>
179
180         LocalStorageDatabase should use inline initialization for its data members
181         https://bugs.webkit.org/show_bug.cgi?id=200828
182
183         Reviewed by John Wilander.
184
185         * NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
186         (WebKit::LocalStorageDatabase::LocalStorageDatabase):
187         * NetworkProcess/WebStorage/LocalStorageDatabase.h:
188
189 2019-08-16  Kate Cheney  <katherine_cheney@apple.com>
190
191         Functions with no parameters in WebKit/Shared/API/c and WebKit/UIProcess/API/C are
192         missing a "void" specifier in their argument list
193         https://bugs.webkit.org/show_bug.cgi?id=200826
194
195         Reviewed by Chris Dumez.
196
197         Added void to indicate functions with no arguments to satisfy compiler errors.
198         This error came to light when fixing another patch.
199
200         * Shared/API/c/WKArray.h:
201         * Shared/API/c/WKConnectionRef.h:
202         * Shared/API/c/WKContextMenuItem.h:
203         * Shared/API/c/WKData.h:
204         * Shared/API/c/WKDictionary.h:
205         * Shared/API/c/WKErrorRef.h:
206         * Shared/API/c/WKMutableArray.h:
207         * Shared/API/c/WKMutableDictionary.h:
208         * Shared/API/c/WKNumber.h:
209         * Shared/API/c/WKPluginInformation.h:
210         * Shared/API/c/WKRenderLayer.h:
211         * Shared/API/c/WKRenderObject.h:
212         * Shared/API/c/WKSecurityOriginRef.h:
213         * Shared/API/c/WKSerializedScriptValue.h:
214         * Shared/API/c/WKString.h:
215         * Shared/API/c/WKURL.h:
216         * Shared/API/c/WKURLRequest.h:
217         * Shared/API/c/WKURLResponse.h:
218         * Shared/API/c/WKUserContentURLPattern.h:
219         * UIProcess/API/C/WKBackForwardListItemRef.h:
220         * UIProcess/API/C/WKBackForwardListRef.h:
221         * UIProcess/API/C/WKContext.h:
222         * UIProcess/API/C/WKFormSubmissionListener.h:
223         * UIProcess/API/C/WKFrame.h:
224         * UIProcess/API/C/WKFramePolicyListener.h:
225         * UIProcess/API/C/WKGeolocationManager.h:
226         * UIProcess/API/C/WKGeolocationPermissionRequest.h:
227         * UIProcess/API/C/WKGeolocationPosition.h:
228         * UIProcess/API/C/WKHitTestResult.h:
229         * UIProcess/API/C/WKNavigationDataRef.h:
230         * UIProcess/API/C/WKOpenPanelParametersRef.h:
231         * UIProcess/API/C/WKOpenPanelResultListener.h:
232         * UIProcess/API/C/WKPage.h:
233         * UIProcess/API/C/WKPageConfigurationRef.h:
234         * UIProcess/API/C/WKPageGroup.h:
235         * UIProcess/API/C/WKPageUIClient.h:
236         * UIProcess/API/C/WKPreferencesRef.h:
237         * UIProcess/API/C/WKUserContentControllerRef.h:
238         * UIProcess/API/C/WKUserMediaPermissionRequest.h:
239         * UIProcess/API/C/WKUserScriptRef.h:
240
241 2019-08-16  Chris Dumez  <cdumez@apple.com>
242
243         LocalStorageDatabase does not need to subclass ThreadSafeRefCounted
244         https://bugs.webkit.org/show_bug.cgi?id=200822
245
246         Reviewed by Geoff Garen.
247
248         LocalStorageDatabase does not need to subclass ThreadSafeRefCounted, it is only ref'd / deref'd by the StorageArea
249         on the com.apple.WebKit.WebStorage serial WorkQueue, and in LocalStorageDatabase::scheduleDatabaseUpdate() on the
250         same WorkQueue.
251
252         * NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
253         (WebKit::LocalStorageDatabase::LocalStorageDatabase):
254         (WebKit::LocalStorageDatabase::~LocalStorageDatabase):
255         * NetworkProcess/WebStorage/LocalStorageDatabase.h:
256
257 2019-08-16  Chris Dumez  <cdumez@apple.com>
258
259         Many WebStorage classes do not need to subclass ThreadSafeRefCounted
260         https://bugs.webkit.org/show_bug.cgi?id=200821
261
262         Reviewed by Geoffrey Garen.
263
264         Many WebStorage classes do not need to subclass ThreadSafeRefCounted. They never get ref'd or deref'd.
265
266         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
267         (WebKit::LocalStorageNamespace::getOrCreateStorageArea):
268         (WebKit::LocalStorageNamespace::clearAllStorageAreas):
269         * NetworkProcess/WebStorage/LocalStorageNamespace.h:
270         * NetworkProcess/WebStorage/SessionStorageNamespace.cpp:
271         (WebKit::SessionStorageNamespace::getOrCreateStorageArea):
272         * NetworkProcess/WebStorage/SessionStorageNamespace.h:
273         * NetworkProcess/WebStorage/StorageArea.cpp:
274         (WebKit::StorageArea::clone const):
275         * NetworkProcess/WebStorage/StorageArea.h:
276         * NetworkProcess/WebStorage/StorageManager.cpp:
277         (WebKit::StorageManager::createSessionStorageNamespace):
278         (WebKit::StorageManager::createLocalStorageArea):
279         (WebKit::StorageManager::createTransientLocalStorageArea):
280         (WebKit::StorageManager::createSessionStorageArea):
281         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
282         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
283         (WebKit::StorageManager::getOrCreateSessionStorageNamespace):
284         * NetworkProcess/WebStorage/StorageManager.h:
285         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp:
286         (WebKit::TransientLocalStorageNamespace::getOrCreateStorageArea):
287         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.h:
288
289 2019-08-16  Dean Jackson  <dino@apple.com>
290
291         Long pressing images with transparent backgrounds in dark mode causes a black background to appear around the image content
292         https://bugs.webkit.org/show_bug.cgi?id=200827
293         <rdar://53933379>
294
295         Reviewed by Tim Horton.
296
297         Set a clear color when there is no provided background.
298
299         * UIProcess/ios/WKContentViewInteraction.mm:
300         (createTargetedPreview):
301
302 2019-08-16  Ryosuke Niwa  <rniwa@webkit.org>
303
304         Split tabIndex computation for DOM and the rest of WebCore
305         https://bugs.webkit.org/show_bug.cgi?id=200806
306
307         Reviewed by Chris Dumez.
308
309         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
310         (webkit_dom_html_element_get_tab_index):
311         (webkit_dom_html_element_set_tab_index):
312
313 2019-08-16  Ross Kirsling  <ross.kirsling@sony.com>
314
315         Unreviewed restabilization of non-unified build.
316
317         * NetworkProcess/NetworkCORSPreflightChecker.h:
318         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
319         (WebKit::StorageManagerSet::StorageManagerSet):
320         * Shared/FrameInfoData.cpp:
321         (WebKit::FrameInfoData::decode):
322         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
323         * WebProcess/WebStorage/StorageNamespaceImpl.h:
324
325 2019-08-16  Chris Dumez  <cdumez@apple.com>
326
327         StorageManager does not need to subclass RefCounted
328         https://bugs.webkit.org/show_bug.cgi?id=200818
329
330         Reviewed by Geoffrey Garen.
331
332         StorageManager does not need to subclass RefCounted. It is owned by the StorageManagerSet
333         and is never ref'd / deref'd.
334
335         * NetworkProcess/WebStorage/StorageManager.h:
336         (WebKit::StorageManager::create): Deleted.
337         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
338         (WebKit::StorageManagerSet::add):
339         * NetworkProcess/WebStorage/StorageManagerSet.h:
340
341 2019-08-16  Chris Dumez  <cdumez@apple.com>
342
343         Clarify StorageManagerSet / StorageManager threading model after r248734
344         https://bugs.webkit.org/show_bug.cgi?id=200817
345
346         Reviewed by Geoffrey Garen.
347
348         Clarify StorageManagerSet / StorageManager threading model after r248734. StorageManager is now
349         a background thread object but it still calls its completion handlers on the main thread, which
350         is very error prone. The pattern in WebKit for thread safety is that methods should always call
351         their completion handler of the thread / queue they were called on themselves. Doing differently
352         has caused so many thread-safety bugs in the past.
353
354         * NetworkProcess/WebStorage/StorageManager.cpp:
355         (WebKit::StorageManager::getSessionStorageOrigins const):
356         (WebKit::StorageManager::deleteSessionStorageOrigins):
357         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
358         (WebKit::StorageManager::getLocalStorageOrigins const):
359         (WebKit::StorageManager::getLocalStorageOriginDetails const):
360         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
361         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
362         (WebKit::StorageManager::getSessionStorageOrigins): Deleted.
363         (WebKit::StorageManager::getLocalStorageOrigins): Deleted.
364         (WebKit::StorageManager::getLocalStorageOriginDetails): Deleted.
365         * NetworkProcess/WebStorage/StorageManager.h:
366         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
367         (WebKit::StorageManagerSet::getSessionStorageOrigins):
368         (WebKit::StorageManagerSet::deleteSessionStorage):
369         (WebKit::StorageManagerSet::deleteSessionStorageForOrigins):
370         (WebKit::StorageManagerSet::getLocalStorageOrigins):
371         (WebKit::StorageManagerSet::deleteLocalStorageModifiedSince):
372         (WebKit::StorageManagerSet::deleteLocalStorageForOrigins):
373         (WebKit::StorageManagerSet::getLocalStorageOriginDetails):
374
375 2019-08-16  Chris Dumez  <cdumez@apple.com>
376
377         StorageManagerSet constructor should not be public
378         https://bugs.webkit.org/show_bug.cgi?id=200816
379
380         Reviewed by Geoffrey Garen.
381
382         StorageManagerSet constructor should not be public since it subclasses ThreadSafeRefCounted and
383         has a factory method.
384
385         * NetworkProcess/WebStorage/StorageManagerSet.h:
386
387 2019-08-16  Timothy Hatcher  <timothy@apple.com>
388
389         REGRESSION (r248436): WKWebView doesn’t respect isOpaque setting in NIB.
390         https://bugs.webkit.org/show_bug.cgi?id=200802
391         rdar://problem/54357818
392
393         Reviewed by Tim Horton.
394
395         Tests: WKWebView.IsOpaqueDefault, WKWebView.SetOpaqueYes, WKWebView.SetOpaqueNo, WKWebView.IsOpaqueYesSubclassOverridden,
396         WKWebView.IsOpaqueNoSubclassOverridden, WKWebView.IsOpaqueYesDecodedFromArchive, WKWebView.IsOpaqueNoDecodedFromArchive,
397         WKWebView.IsOpaqueDrawsBackgroundYesConfiguration, WKWebView.IsOpaqueDrawsBackgroundNoConfiguration.
398
399         * UIProcess/API/Cocoa/WKWebView.mm:
400         (-[WKWebView _initializeWithConfiguration:]): Call _setOpaqueInternal:NO instead of self.opaque = NO.
401         (-[WKWebView _setOpaqueInternal:]): Added. Moved code from setOpaque:.
402         (-[WKWebView setOpaque:]): Call _setOpaqueInternal:.
403
404 2019-08-15  Yusuke Suzuki  <ysuzuki@apple.com>
405
406         [WTF] Add makeUnique<T>, which ensures T is fast-allocated, WTF_MAKE_FAST_ALLOCATED annotation part
407         https://bugs.webkit.org/show_bug.cgi?id=200620
408
409         Reviewed by Geoffrey Garen.
410
411         * NetworkProcess/AdClickAttributionManager.h:
412         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
413         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
414         * NetworkProcess/Cookies/WebCookieManager.h:
415         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
416         * NetworkProcess/NetworkHTTPSUpgradeChecker.h:
417         * NetworkProcess/NetworkProcess.cpp:
418         * NetworkProcess/NetworkSession.h:
419         * NetworkProcess/NetworkSocketChannel.h:
420         * NetworkProcess/WebSocketTask.h:
421         * NetworkProcess/cache/PrefetchCache.h:
422         * NetworkProcess/cocoa/WebSocketTaskCocoa.h:
423         * NetworkProcess/soup/WebKitSoupRequestInputStream.cpp:
424         * NetworkProcess/soup/WebSocketTaskSoup.h:
425         * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
426         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
427         * Platform/Module.h:
428         * PluginProcess/PluginControllerProxy.h:
429         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
430         * Shared/Authentication/AuthenticationManager.h:
431         * Shared/Cocoa/SandboxExtensionCocoa.mm:
432         * Shared/Plugins/NPObjectMessageReceiver.h:
433         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
434         * UIProcess/API/APIAutomationClient.h:
435         * UIProcess/API/APIAutomationSessionClient.h:
436         * UIProcess/API/APIContextMenuClient.h:
437         * UIProcess/API/APICustomProtocolManagerClient.h:
438         * UIProcess/API/APIDiagnosticLoggingClient.h:
439         * UIProcess/API/APIDownloadClient.h:
440         * UIProcess/API/APIFindClient.h:
441         * UIProcess/API/APIFindMatchesClient.h:
442         * UIProcess/API/APIFormClient.h:
443         * UIProcess/API/APIFullscreenClient.h:
444         * UIProcess/API/APIGeolocationProvider.h:
445         * UIProcess/API/APIHistoryClient.h:
446         * UIProcess/API/APIIconDatabaseClient.h:
447         * UIProcess/API/APIIconLoadingClient.h:
448         * UIProcess/API/APIInjectedBundleClient.h:
449         * UIProcess/API/APILegacyContextHistoryClient.h:
450         * UIProcess/API/APILoaderClient.h:
451         * UIProcess/API/APINavigationClient.h:
452         * UIProcess/API/APIPolicyClient.h:
453         * UIProcess/API/APIUIClient.h:
454         * UIProcess/API/C/WKPage.cpp:
455         (WKPageSetPageStateClient):
456         * UIProcess/API/Cocoa/WKUserContentController.mm:
457         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
458         * UIProcess/API/glib/IconDatabase.h:
459         * UIProcess/API/glib/WebKitAutomationSession.cpp:
460         * UIProcess/API/glib/WebKitIconLoadingClient.cpp:
461         * UIProcess/API/glib/WebKitNotificationProvider.h:
462         * UIProcess/API/glib/WebKitUserContentManager.cpp:
463         * UIProcess/API/glib/WebKitWebContext.cpp:
464         * UIProcess/API/glib/WebKitWebView.cpp:
465         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
466         * UIProcess/API/gtk/WebKitWebInspector.cpp:
467         * UIProcess/API/mac/WKView.mm:
468         (-[WKView maybeInstallIconLoadingClient]):
469         * UIProcess/API/wpe/APIViewClient.h:
470         * UIProcess/API/wpe/ScrollGestureController.h:
471         * UIProcess/ApplicationStateTracker.h:
472         * UIProcess/Cocoa/AutomationSessionClient.h:
473         * UIProcess/Cocoa/IconLoadingDelegate.h:
474         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
475         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
476         * UIProcess/DrawingAreaProxy.h:
477         * UIProcess/HighPerformanceGraphicsUsageSampler.h:
478         * UIProcess/Network/NetworkProcessProxy.h:
479         * UIProcess/PageClient.h:
480         * UIProcess/PerActivityStateCPUUsageSampler.h:
481         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.h:
482         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
483         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
484         * UIProcess/SystemPreviewController.h:
485         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
486         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
487         * UIProcess/WebNavigationState.h:
488         * UIProcess/WebPageInjectedBundleClient.h:
489         * UIProcess/WebPageProxy.h:
490         * UIProcess/WebsiteData/WebsiteDataStoreClient.h:
491         * UIProcess/gtk/DragAndDropHandler.h:
492         * UIProcess/ios/EditableImageController.h:
493         * UIProcess/ios/InputViewUpdateDeferrer.h:
494         * UIProcess/ios/SmartMagnificationController.h:
495         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
496         * UIProcess/mac/WKFullScreenWindowController.mm:
497         * UIProcess/mac/WKTextFinderClient.mm:
498         * WebProcess/ApplePay/WebPaymentCoordinator.h:
499         * WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
500         * WebProcess/Geolocation/WebGeolocationManager.h:
501         * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
502         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm:
503         * WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.cpp:
504         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
505         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
506         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
507         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
508         * WebProcess/Network/webrtc/LibWebRTCResolver.h:
509         * WebProcess/Notifications/WebNotificationManager.h:
510         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
511         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
512         * WebProcess/Plugins/PluginController.h:
513         * WebProcess/Storage/WebSWOriginTable.h:
514         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
515         * WebProcess/WebCoreSupport/WebChromeClient.h:
516         * WebProcess/WebCoreSupport/WebContextMenuClient.h:
517         * WebProcess/WebCoreSupport/WebDragClient.h:
518         * WebProcess/WebCoreSupport/WebEditorClient.h:
519         * WebProcess/WebCoreSupport/WebGeolocationClient.h:
520         * WebProcess/WebCoreSupport/WebInspectorClient.h:
521         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h:
522         * WebProcess/WebCoreSupport/WebNotificationClient.h:
523         * WebProcess/WebCoreSupport/WebPlugInClient.h:
524         * WebProcess/WebCoreSupport/WebProgressTrackerClient.h:
525         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.h:
526         * WebProcess/WebCoreSupport/WebUserMediaClient.h:
527         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
528         * WebProcess/WebPage/FindController.h:
529         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
530         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
531         * WebProcess/WebPage/ios/FindIndicatorOverlayClientIOS.h:
532         * WebProcess/WebProcess.h:
533         * WebProcess/cocoa/UserMediaCaptureManager.h:
534
535 2019-08-15  Brent Fulgham  <bfulgham@apple.com>
536
537         [FTW] Enable CoreFoundation use if building for Apple target
538         https://bugs.webkit.org/show_bug.cgi?id=200799
539
540         Reviewed by Alex Christensen.
541
542         Fix the build and remove an unused method.
543
544         * PlatformFTW.cmake:
545         * Shared/ShareableBitmap.h:
546         * Shared/win/ShareableBitmapDirect2D.cpp:
547         (WebKit::ShareableBitmap::createDirect2DSurface):
548         (WebKit::ShareableBitmap::releaseSurfaceData): Deleted.
549
550 2019-08-15  Sihui Liu  <sihui_liu@apple.com>
551
552         Some improvements on web storage
553         https://bugs.webkit.org/show_bug.cgi?id=200373
554
555         Reviewed by Geoffrey Garen.
556
557         Fix some issues in web storage architecture. For example, sessionStorageNameSpace for web page is prepared and 
558         destroyed in the network process when the page comes and goes, even though the page may not use sessionStorage 
559         at all. The messages about page state sent from web process to network process can be waste.
560
561         Here are some general ideas of this patch:
562         1. Network process owns the web storage, and web process keeps a small local copy (based on session and 
563         origins that are visited). There is a virtual connection from the local copy in the web process to the original
564         copy in the network process. The connection is created by web process when some page asks for web storage.
565         2. If connection is lost because network process is gone, storage in memory will be lost. The local copy in web
566         processs will be discarded.
567         3. (SessionID, StorageNamespaceID, SecurityOrigin) is used to identify a storage area. If session is changed in
568         web process (like enabling private browsing in layout test now), a re-connection with different sessionID would 
569         suffice to load another copy of storage.
570         4. localStorage in ephemeral session has the same behavior as localStorage instead of sessionStorage, which
571         means different pages in the same ephemeral session share the same localStorage.
572
573         Also, this patch introduces StorageManagerSet to network process. It handles web storage stuff, including
574         receiving storage messages from web process, on one background thread. Previously each session has its own
575         StorageManager and each StorageManager has its own WorkQueue.
576
577         * CMakeLists.txt:
578         * DerivedSources-input.xcfilelist:
579         * DerivedSources-output.xcfilelist:
580         * DerivedSources.make:
581
582         * NetworkProcess/NetworkConnectionToWebProcess.cpp: remove message handlers that are no longer needed. Network
583         process no longer needs to know page states from web process.
584         (WebKit::NetworkConnectionToWebProcess::didClose):
585         (WebKit::NetworkConnectionToWebProcess::webPageWasAdded): Deleted.
586         (WebKit::NetworkConnectionToWebProcess::webPageWasRemoved): Deleted.
587         (WebKit::NetworkConnectionToWebProcess::webProcessSessionChanged): Deleted.
588         * NetworkProcess/NetworkConnectionToWebProcess.h:
589         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
590
591         * NetworkProcess/NetworkProcess.cpp: NetworkProcess uses StorageManagerSet instead of StorageManager from 
592         different sessions to deal with web storage.
593         (WebKit::NetworkProcess::NetworkProcess):
594         (WebKit::NetworkProcess::initializeNetworkProcess):
595         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): StorageManagerSet starts handling 
596         StorageManagerSet messages from the new connection.
597         (WebKit::NetworkProcess::addWebsiteDataStore):
598         (WebKit::NetworkProcess::destroySession):
599         (WebKit::NetworkProcess::hasLocalStorage):
600         (WebKit::NetworkProcess::fetchWebsiteData):
601         (WebKit::NetworkProcess::deleteWebsiteData):
602         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
603         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
604         (WebKit::NetworkProcess::actualPrepareToSuspend):
605         (WebKit::NetworkProcess::resume):
606         (WebKit::NetworkProcess::syncLocalStorage):
607         (WebKit::NetworkProcess::clearLegacyPrivateBrowsingLocalStorage): added for clearing in-memory ephemeral
608         localStorage.
609         (WebKit::NetworkProcess::getLocalStorageOriginDetails):
610         (WebKit::NetworkProcess::connectionToWebProcessClosed):
611         (WebKit::NetworkProcess::webPageWasAdded): Deleted.
612         (WebKit::NetworkProcess::webPageWasRemoved): Deleted.
613         (WebKit::NetworkProcess::webProcessWasDisconnected): Deleted.
614         (WebKit::NetworkProcess::webProcessSessionChanged): Deleted.
615         * NetworkProcess/NetworkProcess.h:
616         * NetworkProcess/NetworkProcess.messages.in:
617
618         * NetworkProcess/NetworkSession.cpp: StorageManager is moved out of NetworkSession. It is now managed by 
619         StorageManagerSet.
620         (WebKit::NetworkSession::NetworkSession):
621         (WebKit::NetworkSession::~NetworkSession):
622         * NetworkProcess/NetworkSession.h:
623         (WebKit::NetworkSession::storageManager): Deleted.
624
625         * NetworkProcess/NetworkSessionCreationParameters.cpp: creation parameters of StorageManager is moved out of
626         NetworkSessionCreationParameters.
627         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
628         (WebKit::NetworkSessionCreationParameters::encode const):
629         (WebKit::NetworkSessionCreationParameters::decode):
630         * NetworkProcess/NetworkSessionCreationParameters.h:
631
632         * NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
633         (WebKit::LocalStorageDatabase::updateDatabase): remove an assertion that is no longer true as we can force an
634         update with syncLocalStorage now.
635         * NetworkProcess/WebStorage/LocalStorageDatabase.h: make updateDatabase public for syncLocalStorage.
636
637         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp: LocalStorageDatabaseTracker is created on the
638         background thread now, so it does not hold WorkQueue to do the file operation.
639         (WebKit::LocalStorageDatabaseTracker::create):
640         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
641         (WebKit::LocalStorageDatabaseTracker::~LocalStorageDatabaseTracker):
642         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
643         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
644         (WebKit::LocalStorageNamespace::getOrCreateStorageArea):
645         (WebKit::LocalStorageNamespace::cloneTo): Deleted.
646         * NetworkProcess/WebStorage/LocalStorageNamespace.h:
647         * NetworkProcess/WebStorage/SessionStorageNamespace.cpp:
648         (WebKit::SessionStorageNamespace::getOrCreateStorageArea):
649         (WebKit::SessionStorageNamespace::addAllowedConnection): Deleted.
650         (WebKit::SessionStorageNamespace::removeAllowedConnection): Deleted.
651         * NetworkProcess/WebStorage/SessionStorageNamespace.h:
652         (WebKit::SessionStorageNamespace::allowedConnections const): Deleted.
653
654         * NetworkProcess/WebStorage/StorageArea.cpp:
655         (WebKit::generateStorageAreaIdentifier): each StorageArea has an identifier. StorageAreaMap in web process uses
656         this identifier to indicate which StorageArea it is connecting to.
657         (WebKit::StorageArea::StorageArea):
658         (WebKit::StorageArea::~StorageArea): StorageArea may still have listeners because StorageArea should be 
659         destroyed by requests from UI process, and listeners are connections to web processses.
660         (WebKit::StorageArea::addListener): load localStorageDatabase in advance if there is some connection to this 
661         LocalStorage area.
662         (WebKit::StorageArea::removeListener):
663         (WebKit::StorageArea::hasListener const):
664         (WebKit::StorageArea::clear):
665         (WebKit::StorageArea::openDatabaseAndImportItemsIfNeeded const):
666         (WebKit::StorageArea::dispatchEvents const):
667         (WebKit::StorageArea::syncToDatabase):
668         (WebKit::StorageArea::setItems): Deleted. Stop syncing from web process to network process after network process
669         is relaunched.
670         * NetworkProcess/WebStorage/StorageArea.h:
671         (WebKit::StorageArea::identifier):
672         (WebKit::StorageArea::setWorkQueue):
673
674         * NetworkProcess/WebStorage/StorageManager.cpp: StorageManager should be accessed by only background thread now.
675         (WebKit::StorageManager::StorageManager):
676         (WebKit::StorageManager::~StorageManager):
677         (WebKit::StorageManager::createSessionStorageNamespace):
678         (WebKit::StorageManager::destroySessionStorageNamespace): this is not used now but keep it for future 
679         improvement to remove in-memory sessionStorage in network process if we know some web page is gone forever.
680         (WebKit::StorageManager::cloneSessionStorageNamespace): previously each page had its own ephemeral 
681         localStorageNamespace and now all pages in the same session share one localStorage, so we don't need to clone
682         localStorageNamespace.
683         (WebKit::StorageManager::getSessionStorageOrigins):
684         (WebKit::StorageManager::deleteSessionStorageOrigins):
685         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
686         (WebKit::StorageManager::getLocalStorageOrigins):
687         (WebKit::StorageManager::getLocalStorageOriginDetails):
688         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
689         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
690         (WebKit::StorageManager::createLocalStorageArea):
691         (WebKit::StorageManager::createTransientLocalStorageArea):
692         (WebKit::StorageManager::createSessionStorageArea):
693         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
694         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
695         (WebKit::StorageManager::getOrCreateSessionStorageNamespace):
696         (WebKit::StorageManager::clearStorageNamespaces):
697         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection): Deleted.
698         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection): Deleted.
699         (WebKit::StorageManager::processDidCloseConnection): Deleted.
700         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin): Deleted.
701         (WebKit::StorageManager::createLocalStorageMap): Deleted.
702         (WebKit::StorageManager::createTransientLocalStorageMap): Deleted.
703         (WebKit::StorageManager::createSessionStorageMap): Deleted.
704         (WebKit::StorageManager::destroyStorageMap): Deleted.
705         (WebKit::StorageManager::prewarm): Deleted.
706         (WebKit::StorageManager::getValues): Deleted.
707         (WebKit::StorageManager::setItem): Deleted.
708         (WebKit::StorageManager::setItems): Deleted.
709         (WebKit::StorageManager::removeItem): Deleted.
710         (WebKit::StorageManager::clear): Deleted.
711         (WebKit::StorageManager::waitUntilTasksFinished): Deleted.
712         (WebKit::StorageManager::suspend): Deleted.
713         (WebKit::StorageManager::resume): Deleted.
714         (WebKit::StorageManager::findStorageArea const): Deleted.
715         * NetworkProcess/WebStorage/StorageManager.h:
716         (WebKit::StorageManager::workQueue const): Deleted.
717         (): Deleted.
718
719         * NetworkProcess/WebStorage/StorageManager.messages.in: Removed. Moved to StorageManagerSet.messages.in.
720
721         * NetworkProcess/WebStorage/StorageManagerSet.cpp: Added.
722         (WebKit::StorageManagerSet::create):
723         (WebKit::StorageManagerSet::StorageManagerSet):
724         (WebKit::StorageManagerSet::~StorageManagerSet):
725         (WebKit::StorageManagerSet::add):
726         (WebKit::StorageManagerSet::remove):
727         (WebKit::StorageManagerSet::contains):
728         (WebKit::StorageManagerSet::addConnection):
729         (WebKit::StorageManagerSet::removeConnection):
730         (WebKit::StorageManagerSet::waitUntilTasksFinished):
731         (WebKit::StorageManagerSet::waitUntilSyncingLocalStorageFinished):
732         (WebKit::StorageManagerSet::suspend):
733         (WebKit::StorageManagerSet::resume):
734         (WebKit::StorageManagerSet::getSessionStorageOrigins):
735         (WebKit::StorageManagerSet::deleteSessionStorage):
736         (WebKit::StorageManagerSet::deleteSessionStorageForOrigins):
737         (WebKit::StorageManagerSet::getLocalStorageOrigins):
738         (WebKit::StorageManagerSet::deleteLocalStorageModifiedSince):
739         (WebKit::StorageManagerSet::deleteLocalStorageForOrigins):
740         (WebKit::StorageManagerSet::getLocalStorageOriginDetails):
741         (WebKit::StorageManagerSet::connectToLocalStorageArea):
742         (WebKit::StorageManagerSet::connectToTransientLocalStorageArea):
743         (WebKit::StorageManagerSet::connectToSessionStorageArea):
744         (WebKit::StorageManagerSet::disconnectFromStorageArea):
745         (WebKit::StorageManagerSet::getValues):
746         (WebKit::StorageManagerSet::setItem):
747         (WebKit::StorageManagerSet::removeItem):
748         (WebKit::StorageManagerSet::clear):
749         (WebKit::StorageManagerSet::cloneSessionStorageNamespace):
750         * NetworkProcess/WebStorage/StorageManagerSet.h: Added.
751         * NetworkProcess/WebStorage/StorageManagerSet.messages.in: Added.
752
753         * Shared/WebsiteDataStoreParameters.cpp: creation parameters of StorageManager are moved to 
754         WebsiteDataStoreParameters.
755         (WebKit::WebsiteDataStoreParameters::encode const):
756         (WebKit::WebsiteDataStoreParameters::decode):
757         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
758         * Shared/WebsiteDataStoreParameters.h:
759         * Sources.txt:
760
761         * UIProcess/API/C/WKContext.cpp: add SPI for tests.
762         (WKContextSyncLocalStorage):
763         (WKContextClearLegacyPrivateBrowsingLocalStorage):
764         * UIProcess/API/C/WKContextPrivate.h:
765         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
766         (WKWebsiteDataStoreRemoveLocalStorage):
767         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
768         * UIProcess/WebProcessPool.cpp:
769         (WebKit::WebProcessPool::ensureNetworkProcess):
770         (WebKit::WebProcessPool::syncLocalStorage):
771         (WebKit::WebProcessPool::clearLegacyPrivateBrowsingLocalStorage):
772         * UIProcess/WebProcessPool.h:
773         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
774         (WebKit::WebsiteDataStore::parameters):
775         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
776         (WebKit::WebsiteDataStore::parameters):
777         * WebKit.xcodeproj/project.pbxproj:
778
779         * WebProcess/InjectedBundle/InjectedBundle.cpp: session change of web storage is done via 
780         WebStorageNamespaceProvider instead of WebProcess now.
781         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
782         * WebProcess/WebProcess.cpp: web process no longer sends messsages about page state to network process.
783         (WebKit::WebProcess::createWebPage):
784         (WebKit::WebProcess::removeWebPage):
785         (WebKit::WebProcess::ensureNetworkProcessConnection):
786         (WebKit::WebProcess::networkProcessConnectionClosed):
787         (WebKit::WebProcess::storageAreaMap const):
788         (WebKit::WebProcess::enablePrivateBrowsingForTesting): Deleted. This was used for changing session via 
789         WebProcess.
790         * WebProcess/WebProcess.h:
791         * WebProcess/WebStorage/StorageAreaImpl.cpp:
792         (WebKit::StorageAreaImpl::StorageAreaImpl):
793         (WebKit::StorageAreaImpl::length):
794         (WebKit::StorageAreaImpl::key):
795         (WebKit::StorageAreaImpl::item):
796         (WebKit::StorageAreaImpl::setItem):
797         (WebKit::StorageAreaImpl::removeItem):
798         (WebKit::StorageAreaImpl::clear):
799         (WebKit::StorageAreaImpl::contains):
800         (WebKit::StorageAreaImpl::storageType const):
801         (WebKit::StorageAreaImpl::incrementAccessCount):
802         (WebKit::StorageAreaImpl::decrementAccessCount):
803         (WebKit::StorageAreaImpl::prewarm): Deleted.
804         (WebKit::StorageAreaImpl::securityOrigin const): Deleted.
805
806         * WebProcess/WebStorage/StorageAreaImpl.h: make StorageAreaImpl hold a weak reference to StorageAreaMap and 
807         StorageNamespaceImpl hold a strong reference. In this way lifeime of localStorage StorageAreraMap stays align 
808         with StorageNameSpaceProvider and Page.
809
810         * WebProcess/WebStorage/StorageAreaMap.cpp: identifier of StorageAreaMap is the same as identifier of 
811         StorageArea it connects to. If the identifier is 0, it means the StorageAreaMap is disconnected.
812         (WebKit::StorageAreaMap::StorageAreaMap):
813         (WebKit::StorageAreaMap::~StorageAreaMap):
814         (WebKit::StorageAreaMap::setItem):
815         (WebKit::StorageAreaMap::removeItem):
816         (WebKit::StorageAreaMap::clear):
817         (WebKit::StorageAreaMap::resetValues):
818         (WebKit::StorageAreaMap::loadValuesIfNeeded):
819         (WebKit::StorageAreaMap::applyChange):
820         (WebKit::StorageAreaMap::dispatchStorageEvent):
821         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
822         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
823         (WebKit::StorageAreaMap::connect):
824         (WebKit::StorageAreaMap::disconnect):
825         (WebKit::generateStorageMapID): Deleted.
826         (WebKit::StorageAreaMap::prewarm): Deleted.
827         (WebKit::StorageAreaMap::didGetValues): Deleted. This is useless as GetValues is a synchronous operation.
828         * WebProcess/WebStorage/StorageAreaMap.h:
829         (): Deleted.
830
831         * WebProcess/WebStorage/StorageAreaMap.messages.in: there are two synchronous messages, one for connection and 
832         one for getting values. We may merge them into one in future improvement.
833         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
834         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
835         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
836         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
837         (WebKit::StorageNamespaceImpl::StorageNamespaceImpl):
838         (WebKit::StorageNamespaceImpl::storageArea):
839         (WebKit::StorageNamespaceImpl::copy):
840         (WebKit::StorageNamespaceImpl::setSessionIDForTesting):
841         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace): Deleted.
842         * WebProcess/WebStorage/StorageNamespaceImpl.h:
843         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
844         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
845         (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):
846         (WebKit::WebStorageNamespaceProvider::createTransientLocalStorageNamespace):
847         (WebKit::WebStorageNamespaceProvider::createEphemeralLocalStorageNamespace): Deleted.
848         * WebProcess/WebStorage/WebStorageNamespaceProvider.h:
849
850 2019-08-15  Wenson Hsieh  <wenson_hsieh@apple.com>
851
852         Occasional hang under -[UIKeyboardTaskQueue lockWhenReadyForMainThread] when long-pressing non-editable text
853         https://bugs.webkit.org/show_bug.cgi?id=200731
854         <rdar://problem/54315371>
855
856         Reviewed by Tim Horton.
857
858         When handling a single tap in non-editable content, keyboards logic in UIKit may attempt to wait for all
859         pending tasks in UIKeyboardTaskQueue to finish executing (e.g. by calling -waitUntilAllTasksAreFinished]). If
860         the task queue has a pending task at this moment - for example, a text selection update that is waiting for a
861         response from the web process - this will result in a permanent deadlock, since the main thread will be blocked,
862         and therefore cannot receive any IPC communication from the web process.
863
864         One way to trigger this is to activate both the loupe gesture and non-editable text tap gesture simultaneously,
865         by tapping in a non-editable part of the web page, while an ongoing loupe gesture is driving selection updates
866         (see the layout test for more details).
867
868         To avoid getting into this scenario, prevent the text tap gesture recognizer from firing in a few edge cases
869         that could lead to hangs under keyboard code in UIKit. See comments below.
870
871         Test: editing/selection/ios/tap-during-loupe-gesture.html
872
873         * UIProcess/ios/WKContentViewInteraction.h:
874         * UIProcess/ios/WKContentViewInteraction.mm:
875         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
876
877         Don't allow the text tap gesture recognizer to fire if the user is actively modifying the text selection using
878         the loupe gesture, or if there's other pending selection change updates that are pending responses from the web
879         content process.
880
881         (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
882         (-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]):
883
884         Increment and decrement _suppressNonEditableSingleTapTextInteractionCount while handling these selection
885         updates.
886
887 2019-08-15  Commit Queue  <commit-queue@webkit.org>
888
889         Unreviewed, rolling out r248440.
890         https://bugs.webkit.org/show_bug.cgi?id=200772
891
892         Introduced regressions related to loading of local files.
893         (Requested by perarne on #webkit).
894
895         Reverted changeset:
896
897         "[Mac] Use the PID of the WebContent process when issuing
898         local file read sandbox extensions"
899         https://bugs.webkit.org/show_bug.cgi?id=200543
900         https://trac.webkit.org/changeset/248440
901
902 2019-08-15  Alex Christensen  <achristensen@webkit.org>
903
904         WKUIDelegate's webView:contextMenuDidEndForElement: should be called when context menus end
905         https://bugs.webkit.org/show_bug.cgi?id=200750
906         <rdar://problem/54232261> and <rdar://problem/52355829>
907
908         Reviewed by Tim Horton.
909
910         * UIProcess/ios/WKContentViewInteraction.mm:
911         (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
912
913 2019-08-14  Brian Burg  <bburg@apple.com>
914
915         Web Automation: mouse buttons are not correctly printed in SimulatedInputDispatcher log spew
916         https://bugs.webkit.org/show_bug.cgi?id=200729
917
918         Reviewed by Devin Rousso.
919
920         This was printing out gibberish because it was trying to decode a WebMouseEvent button
921         as an Automation protocol button. The logging was less useful because of it.
922
923         To fix this, push usage of Automation protocol-based MouseButton type alias all the way
924         to the platform-specific methods. The mouse buttons are the same for WebMouseEvent::Button
925         and the Automation protocol type, except the automation type has an auto-generated toString.
926
927         * UIProcess/Automation/SimulatedInputDispatcher.h:
928         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
929         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
930         (WebKit::SimulatedInputDispatcher::run):
931         Fix types.
932
933         * UIProcess/Automation/WebAutomationSession.h:
934         * UIProcess/Automation/WebAutomationSession.cpp:
935         (WebKit::WebAutomationSession::simulateMouseInteraction):
936         (WebKit::WebAutomationSession::performMouseInteraction):
937         (WebKit::WebAutomationSession::performInteractionSequence):
938         (WebKit::protocolMouseButtonToWebMouseEventButton): Deleted.
939         Fix types.
940
941         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
942         (WebKit::automationMouseButtonToPlatformMouseButton):
943         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
944         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
945         (WebKit::mouseButtonToGdkButton):
946         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
947         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp:
948         (WebKit::mouseButtonToWPEButton):
949         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
950         Move translation between MouseButton and native button values to platform methods.
951
952 2019-08-15  Simon Fraser  <simon.fraser@apple.com>
953
954         Use ObjectIdentifier<FrameIdentifierType> for frameIDs
955         https://bugs.webkit.org/show_bug.cgi?id=199986
956
957         Reviewed by Ryosuke Niwa.
958
959         Use the strongly-typed FrameIdentifier instead of uint64_t as frame identifiers everywhere.
960
961         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
962         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
963         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
964         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
965         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
966         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
967         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
968         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
969         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
970         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
971         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
972         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
973         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
974         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
975         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
976         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
977         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
978         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
979         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
980         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
981         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
982         * NetworkProcess/NetworkCORSPreflightChecker.h:
983         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
984         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
985         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
986         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
987         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
988         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
989         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
990         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
991         * NetworkProcess/NetworkConnectionToWebProcess.h:
992         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
993         * NetworkProcess/NetworkLoadChecker.cpp:
994         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
995         * NetworkProcess/NetworkLoadChecker.h:
996         * NetworkProcess/NetworkLoadParameters.h:
997         * NetworkProcess/NetworkProcess.h:
998         * NetworkProcess/NetworkResourceLoader.cpp:
999         (WebKit::NetworkResourceLoader::start):
1000         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1001         (WebKit::NetworkResourceLoader::startNetworkLoad):
1002         (WebKit::NetworkResourceLoader::convertToDownload):
1003         (WebKit::NetworkResourceLoader::abort):
1004         (WebKit::NetworkResourceLoader::didReceiveResponse):
1005         (WebKit::NetworkResourceLoader::didReceiveBuffer):
1006         (WebKit::NetworkResourceLoader::didFinishLoading):
1007         (WebKit::NetworkResourceLoader::didFailLoading):
1008         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1009         (WebKit::escapeIDForJSON):
1010         (WebKit::logBlockedCookieInformation):
1011         (WebKit::logCookieInformationInternal):
1012         (WebKit::NetworkResourceLoader::logCookieInformation):
1013         * NetworkProcess/NetworkResourceLoader.h:
1014         * NetworkProcess/cache/NetworkCache.h:
1015         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1016         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1017         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1018         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1019         * Scripts/webkit/messages.py:
1020         * Shared/API/APIFrameHandle.cpp:
1021         (API::FrameHandle::create):
1022         (API::FrameHandle::createAutoconverting):
1023         (API::FrameHandle::FrameHandle):
1024         (API::FrameHandle::decode):
1025         * Shared/API/APIFrameHandle.h:
1026         (API::FrameHandle::frameID const):
1027         * Shared/API/Cocoa/_WKFrameHandle.mm:
1028         (-[_WKFrameHandle hash]):
1029         (-[_WKFrameHandle _frameID]):
1030         (-[_WKFrameHandle initWithCoder:]):
1031         (-[_WKFrameHandle encodeWithCoder:]):
1032         * Shared/Authentication/AuthenticationManager.cpp:
1033         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
1034         * Shared/Authentication/AuthenticationManager.h:
1035         * Shared/FrameInfoData.h:
1036         * UIProcess/API/C/WKFrameHandleRef.cpp:
1037         (WKFrameHandleGetFrameID):
1038         * UIProcess/API/Cocoa/WKWebView.mm:
1039         (-[WKWebView _printOperationWithPrintInfo:forFrame:]):
1040         (-[WKWebView _canChangeFrameLayout:]):
1041         * UIProcess/API/Cocoa/_WKInspector.mm:
1042         (-[_WKInspector showMainResourceForFrame:]):
1043         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1044         (WebKit::SimulatedInputDispatcher::run):
1045         * UIProcess/Automation/SimulatedInputDispatcher.h:
1046         * UIProcess/Automation/WebAutomationSession.cpp:
1047         (WebKit::WebAutomationSession::webFrameIDForHandle):
1048         (WebKit::WebAutomationSession::handleForWebFrameID):
1049         (WebKit::WebAutomationSession::switchToBrowsingContext):
1050         (WebKit::WebAutomationSession::waitForNavigationToComplete):
1051         (WebKit::findPageForFrameID):
1052         (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout):
1053         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
1054         (WebKit::WebAutomationSession::resolveChildFrameHandle):
1055         (WebKit::WebAutomationSession::resolveParentFrameHandle):
1056         (WebKit::WebAutomationSession::computeElementLayout):
1057         (WebKit::WebAutomationSession::selectOptionElement):
1058         (WebKit::WebAutomationSession::getAllCookies):
1059         (WebKit::WebAutomationSession::deleteSingleCookie):
1060         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
1061         (WebKit::WebAutomationSession::takeScreenshot):
1062         * UIProcess/Automation/WebAutomationSession.h:
1063         * UIProcess/Cocoa/UIDelegate.mm:
1064         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
1065         * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
1066         (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]):
1067         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1068         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame):
1069         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrameShared):
1070         * UIProcess/Network/NetworkProcessProxy.cpp:
1071         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
1072         (WebKit::NetworkProcessProxy::requestStorageAccessConfirm):
1073         * UIProcess/Network/NetworkProcessProxy.h:
1074         * UIProcess/Network/NetworkProcessProxy.messages.in:
1075         * UIProcess/ProvisionalPageProxy.cpp:
1076         (WebKit::ProvisionalPageProxy::validateInput):
1077         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
1078         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
1079         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
1080         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1081         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
1082         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
1083         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
1084         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
1085         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
1086         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
1087         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1088         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
1089         (WebKit::ProvisionalPageProxy::contentFilterDidBlockLoadForFrame):
1090         * UIProcess/ProvisionalPageProxy.h:
1091         * UIProcess/ServiceWorkerProcessProxy.cpp:
1092         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
1093         * UIProcess/ServiceWorkerProcessProxy.h:
1094         * UIProcess/SuspendedPageProxy.cpp:
1095         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1096         * UIProcess/SuspendedPageProxy.h:
1097         * UIProcess/UserMediaPermissionCheckProxy.cpp:
1098         (WebKit::UserMediaPermissionCheckProxy::UserMediaPermissionCheckProxy):
1099         * UIProcess/UserMediaPermissionCheckProxy.h:
1100         (WebKit::UserMediaPermissionCheckProxy::create):
1101         (WebKit::UserMediaPermissionCheckProxy::frameID const):
1102         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1103         (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess):
1104         (WebKit::UserMediaPermissionRequestManagerProxy::searchForGrantedRequest const):
1105         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied):
1106         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1107         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
1108         (WebKit::UserMediaPermissionRequestManagerProxy::wasGrantedVideoOrAudioAccess):
1109         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1110         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1111         * UIProcess/UserMediaPermissionRequestProxy.cpp:
1112         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
1113         * UIProcess/UserMediaPermissionRequestProxy.h:
1114         (WebKit::UserMediaPermissionRequestProxy::create):
1115         (WebKit::UserMediaPermissionRequestProxy::mainFrameID const):
1116         (WebKit::UserMediaPermissionRequestProxy::frameID const):
1117         * UIProcess/WebFrameProxy.cpp:
1118         (WebKit::WebFrameProxy::WebFrameProxy):
1119         * UIProcess/WebFrameProxy.h:
1120         (WebKit::WebFrameProxy::create):
1121         (WebKit::WebFrameProxy::frameID const):
1122         * UIProcess/WebPageProxy.cpp:
1123         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1124         (WebKit::WebPageProxy::commitProvisionalPage):
1125         (WebKit::WebPageProxy::runJavaScriptInFrame):
1126         (WebKit::WebPageProxy::didCreateMainFrame):
1127         (WebKit::WebPageProxy::didCreateSubframe):
1128         (WebKit::WebPageProxy::didCreateWindow):
1129         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1130         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
1131         (WebKit::WebPageProxy::didExplicitOpenForFrame):
1132         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1133         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
1134         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
1135         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
1136         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
1137         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
1138         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1139         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
1140         (WebKit::WebPageProxy::didCommitLoadForFrame):
1141         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
1142         (WebKit::WebPageProxy::didFinishLoadForFrame):
1143         (WebKit::WebPageProxy::didFailLoadForFrame):
1144         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
1145         (WebKit::WebPageProxy::didChangeMainDocument):
1146         (WebKit::WebPageProxy::didReceiveTitleForFrame):
1147         (WebKit::WebPageProxy::didFirstLayoutForFrame):
1148         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
1149         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
1150         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
1151         (WebKit::WebPageProxy::didDetectXSSForFrame):
1152         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
1153         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
1154         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
1155         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1156         (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared):
1157         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1158         (WebKit::WebPageProxy::decidePolicyForResponse):
1159         (WebKit::WebPageProxy::decidePolicyForResponseShared):
1160         (WebKit::WebPageProxy::unableToImplementPolicy):
1161         (WebKit::WebPageProxy::willSubmitForm):
1162         (WebKit::WebPageProxy::didNavigateWithNavigationData):
1163         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
1164         (WebKit::WebPageProxy::didPerformClientRedirect):
1165         (WebKit::WebPageProxy::didPerformClientRedirectShared):
1166         (WebKit::WebPageProxy::didPerformServerRedirect):
1167         (WebKit::WebPageProxy::didPerformServerRedirectShared):
1168         (WebKit::WebPageProxy::didUpdateHistoryTitle):
1169         (WebKit::WebPageProxy::runJavaScriptAlert):
1170         (WebKit::WebPageProxy::runJavaScriptConfirm):
1171         (WebKit::WebPageProxy::runJavaScriptPrompt):
1172         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
1173         (WebKit::WebPageProxy::runOpenPanel):
1174         (WebKit::WebPageProxy::printFrame):
1175         (WebKit::WebPageProxy::focusedFrameChanged):
1176         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
1177         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
1178         (WebKit::WebPageProxy::exceededDatabaseQuota):
1179         (WebKit::WebPageProxy::requestStorageSpace):
1180         (WebKit::WebPageProxy::makeStorageSpaceRequest):
1181         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
1182         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
1183         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
1184         (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess):
1185         (WebKit::WebPageProxy::requestStorageAccessConfirm):
1186         * UIProcess/WebPageProxy.h:
1187         * UIProcess/WebPageProxy.messages.in:
1188         * UIProcess/WebProcessProxy.cpp:
1189         (WebKit::WebProcessProxy::webFrame const):
1190         (WebKit::WebProcessProxy::canCreateFrame const):
1191         (WebKit::WebProcessProxy::frameCreated):
1192         (WebKit::WebProcessProxy::didDestroyFrame):
1193         * UIProcess/WebProcessProxy.h:
1194         * UIProcess/WebProcessProxy.messages.in:
1195         * UIProcess/ios/WKContentView.mm:
1196         (-[WKContentView _wk_pageCountForPrintFormatter:]):
1197         * UIProcess/ios/WebPageProxyIOS.mm:
1198         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
1199         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1200         (WebKit::evaluateJavaScriptCallback):
1201         (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame):
1202         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
1203         (WebKit::WebAutomationSessionProxy::didEvaluateJavaScriptFunction):
1204         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
1205         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
1206         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
1207         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
1208         (WebKit::WebAutomationSessionProxy::focusFrame):
1209         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1210         (WebKit::WebAutomationSessionProxy::selectOptionElement):
1211         (WebKit::WebAutomationSessionProxy::takeScreenshot):
1212         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
1213         (WebKit::WebAutomationSessionProxy::deleteCookie):
1214         * WebProcess/Automation/WebAutomationSessionProxy.h:
1215         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
1216         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
1217         (+[WKWebProcessPlugInFrame lookUpFrameFromHandle:]):
1218         * WebProcess/Network/WebLoaderStrategy.cpp:
1219         (WebKit::WebLoaderStrategy::scheduleLoad):
1220         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1221         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1222         * WebProcess/Network/WebResourceLoader.cpp:
1223         (WebKit::WebResourceLoader::willSendRequest):
1224         (WebKit::WebResourceLoader::didReceiveResponse):
1225         (WebKit::WebResourceLoader::didReceiveData):
1226         (WebKit::WebResourceLoader::didFinishResourceLoad):
1227         (WebKit::WebResourceLoader::didFailResourceLoad):
1228         (WebKit::WebResourceLoader::didBlockAuthenticationChallenge):
1229         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
1230         (WebKit::WebResourceLoader::didReceiveResource):
1231         * WebProcess/Network/WebResourceLoader.h:
1232         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1233         (WebKit::WebSWContextManagerConnection::installServiceWorker):
1234         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1235         (WebKit::WebChromeClient::focusedFrameChanged):
1236         (WebKit::WebChromeClient::contentsSizeChanged const):
1237         (WebKit::WebChromeClient::hasStorageAccess):
1238         (WebKit::WebChromeClient::requestStorageAccess):
1239         * WebProcess/WebCoreSupport/WebChromeClient.h:
1240         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1241         (WebKit::WebFrameLoaderClient::frameID const):
1242         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1243         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
1244         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1245         * WebProcess/WebPage/WebCookieJar.cpp:
1246         (WebKit::WebCookieJar::cookies const):
1247         (WebKit::WebCookieJar::setCookies):
1248         (WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
1249         (WebKit::WebCookieJar::getRawCookies const):
1250         * WebProcess/WebPage/WebCookieJar.h:
1251         * WebProcess/WebPage/WebFrame.cpp:
1252         (WebKit::WebFrame::WebFrame):
1253         (WebKit::generateFrameID): Deleted.
1254         * WebProcess/WebPage/WebFrame.h:
1255         (WebKit::WebFrame::frameID const):
1256         * WebProcess/WebPage/WebInspector.cpp:
1257         (WebKit::WebInspector::showMainResourceForFrame):
1258         * WebProcess/WebPage/WebInspector.h:
1259         * WebProcess/WebPage/WebInspector.messages.in:
1260         * WebProcess/WebPage/WebPage.cpp:
1261         (WebKit::WebPage::loadURLInFrame):
1262         (WebKit::WebPage::loadDataInFrame):
1263         (WebKit::WebPage::stopLoadingFrame):
1264         (WebKit::WebPage::didReceivePolicyDecision):
1265         (WebKit::WebPage::continueWillSubmitForm):
1266         (WebKit::WebPage::runJavaScriptInFrame):
1267         (WebKit::WebPage::getSourceForFrame):
1268         (WebKit::WebPage::getMainResourceDataOfFrame):
1269         (WebKit::WebPage::getResourceDataFromFrame):
1270         (WebKit::WebPage::getWebArchiveOfFrame):
1271         (WebKit::WebPage::addConsoleMessage):
1272         (WebKit::WebPage::sendCSPViolationReport):
1273         (WebKit::WebPage::enqueueSecurityPolicyViolationEvent):
1274         (WebKit::WebPage::beginPrinting):
1275         (WebKit::WebPage::computePagesForPrinting):
1276         (WebKit::WebPage::computePagesForPrintingImpl):
1277         (WebKit::WebPage::drawRectToImage):
1278         (WebKit::WebPage::drawPagesToPDF):
1279         (WebKit::WebPage::drawPagesToPDFImpl):
1280         (WebKit::WebPage::drawPagesForPrinting):
1281         (WebKit::WebPage::frameBecameRemote):
1282         (WebKit::WebPage::hasStorageAccess):
1283         (WebKit::WebPage::requestStorageAccess):
1284         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
1285         * WebProcess/WebPage/WebPage.h:
1286         * WebProcess/WebPage/WebPage.messages.in:
1287         * WebProcess/WebPage/ios/WebPageIOS.mm:
1288         (WebKit::WebPage::computePagesForPrintingPDFDocument):
1289         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1290         * WebProcess/WebPage/mac/WebPageMac.mm:
1291         (WebKit::WebPage::computePagesForPrintingPDFDocument):
1292         * WebProcess/WebProcess.cpp:
1293         (WebKit::WebProcess::webFrame const):
1294         (WebKit::WebProcess::addWebFrame):
1295         (WebKit::WebProcess::removeWebFrame):
1296         * WebProcess/WebProcess.h:
1297
1298 2019-08-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1299
1300         Remove m_blockRectForTextSelection (along with related code)
1301         https://bugs.webkit.org/show_bug.cgi?id=200695
1302
1303         Reviewed by Megan Gardner.
1304
1305         This member variable was consulted by block selection codepaths which no longer exist.
1306         No change in behavior.
1307
1308         * WebProcess/WebPage/WebPage.h:
1309         * WebProcess/WebPage/ios/WebPageIOS.mm:
1310         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1311         (WebKit::selectionBoxForRange): Deleted.
1312
1313 2019-08-14  Ryan Haddad  <ryanhaddad@apple.com>
1314
1315         Unreviewed, rolling out r248526.
1316
1317         Caused two IndexedDB perf tests to fail
1318
1319         Reverted changeset:
1320
1321         "Remove IDB-specific quota"
1322         https://bugs.webkit.org/show_bug.cgi?id=196545
1323         https://trac.webkit.org/changeset/248526
1324
1325 2019-08-14  Andy Estes  <aestes@apple.com>
1326
1327         Fix the build when ENABLE(APPLE_PAY) is false.
1328
1329         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1330
1331 2019-08-14  Keith Rollin  <krollin@apple.com>
1332
1333         Remove support for macOS < 10.13
1334         https://bugs.webkit.org/show_bug.cgi?id=200694
1335         <rdar://problem/54278851>
1336
1337         Reviewed by Youenn Fablet.
1338
1339         Update conditionals that reference __MAC_OS_X_VERSION_MIN_REQUIRED and
1340         __MAC_OS_X_VERSION_MAX_ALLOWED, assuming that they both have values >=
1341         101300. This means that expressions like
1342         "__MAC_OS_X_VERSION_MIN_REQUIRED < 101300" are always False and
1343         "__MAC_OS_X_VERSION_MIN_REQUIRED >= 101300" are always True.
1344
1345         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm:
1346         (-[WKDownloadProgress initWithDownloadTask:download:URL:sandboxExtension:]):
1347         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1348         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1349         * Shared/WebPreferencesDefaultValues.cpp:
1350         (WebKit::defaultCustomPasteboardDataEnabled):
1351         * Shared/WebPreferencesDefaultValues.h:
1352         * Shared/mac/AuxiliaryProcessMac.mm:
1353         * UIProcess/Cocoa/WebViewImpl.h:
1354         * UIProcess/Cocoa/WebViewImpl.mm:
1355         (-[WKTextTouchBarItemController itemForIdentifier:]):
1356         (WebKit::WebViewImpl::mediaPlaybackControlsView const):
1357         (WebKit::WebViewImpl::updateMediaTouchBar):
1358         * UIProcess/mac/WebColorPickerMac.mm:
1359         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
1360         * WebProcess/Plugins/PDF/PDFPlugin.h:
1361         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1362         (-[WKPDFPluginAccessibilityObject setPdfLayerController:]):
1363         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
1364         (-[WKPDFPluginAccessibilityObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1365         (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]):
1366         (-[WKPDFPluginAccessibilityObject accessibilityAssociatedControlForAnnotation:]):
1367         (-[WKPDFPluginAccessibilityObject accessibilityHitTest:]):
1368         (WebKit::PDFPlugin::pdfDocumentDidLoad):
1369         (WebKit::PDFPlugin::handleMouseEvent):
1370         (WebKit::PDFPlugin::handleMouseEnterEvent):
1371         (WebKit::PDFPlugin::handleContextMenuEvent):
1372         (WebKit::PDFPlugin::pluginHandlesContentOffsetForAccessibilityHitTest const):
1373         (WebKit::PDFPlugin::accessibilityAssociatedPluginParentForElement const):
1374         (WebKit::PDFPlugin::updateCursor): Deleted.
1375         * WebProcess/WebProcess.cpp:
1376         (WebKit::WebProcess::initializeWebProcess):
1377
1378 2019-08-14  Brian Burg  <bburg@apple.com>
1379
1380         REGRESSION(r245320): Web Automation: Perform Actions hangs when pointerdown happens near top of page
1381         https://bugs.webkit.org/show_bug.cgi?id=200728
1382         <rdar://problem/54260518>
1383
1384         Reviewed by Devin Rousso.
1385
1386         In the last major refactoring for this code, it seems that the argument to
1387         platformSimulateMouseInteraction was not unified to use viewport coordinates
1388         in all code paths. This patch fixes both callers to *not* add in topContentInset,
1389         and instead this is added back in when doing platform-specific event simulation.
1390
1391         This has no effect on iOS since it's guarded by ENABLE(WEBDRIVER_MOUSE_INTERACTIONS),
1392         which is only built on macOS.
1393
1394         * UIProcess/Automation/WebAutomationSession.h:
1395         * UIProcess/Automation/WebAutomationSession.cpp:
1396         (WebKit::WebAutomationSession::performMouseInteraction):
1397         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1398         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
1399
1400 2019-08-14  Andy Estes  <aestes@apple.com>
1401
1402         [Cocoa] Add some WKA extension points
1403         https://bugs.webkit.org/show_bug.cgi?id=200506
1404         <rdar://problem/51682474>
1405
1406         Reviewed by Tim Horton.
1407
1408         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1409         (WebKit::finishCreating):
1410         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest):
1411         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1412         (IPC::finishDecoding):
1413         (IPC::finishEncoding):
1414         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode):
1415         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode):
1416         * Shared/WebCoreArgumentCoders.h:
1417
1418 2019-08-14  Luming Yin  <luming_yin@apple.com>
1419
1420         v3: CrashTracer: Regression : MobileSafari at UIKitCore: -[UITargetedPreview initWithView:parameters:]
1421         https://bugs.webkit.org/show_bug.cgi?id=200634
1422
1423         Reviewed by Simon Fraser.
1424
1425         Under rare race conditions, the WKContentView may no longer have an associated window. However, 
1426         UIContextMenuInteraction may still attempt initialize a UITargetedPreview with the orphaned 
1427         WKContentView. Speculative fix for crashes under such scenarios, so that we can continue without 
1428         a context menu configuration to prevent the UIKit exception.
1429
1430         * UIProcess/ios/WKContentViewInteraction.mm:
1431         (-[WKContentView continueContextMenuInteraction:]):
1432
1433 2019-08-14  Zalan Bujtas  <zalan@apple.com>
1434
1435         [ContentChangeObserver] Stop content change observation explicitly.
1436         https://bugs.webkit.org/show_bug.cgi?id=200689
1437         <rdar://problem/54274887>
1438
1439         Reviewed by Simon Fraser.
1440
1441         * WebProcess/WebPage/ios/WebPageIOS.mm:
1442         (WebKit::WebPage::handleSyntheticClick):
1443
1444 2019-08-14  Youenn Fablet  <youenn@apple.com>
1445
1446         Remove use of emptySessionID from NetworkLoadParameters
1447         https://bugs.webkit.org/show_bug.cgi?id=200712
1448
1449         Reviewed by Alex Christensen.
1450
1451         Make NetworkLoadParameters constructor take a session ID.
1452         Update call sites accordingly.
1453
1454         * NetworkProcess/AdClickAttributionManager.cpp:
1455         (WebKit::AdClickAttributionManager::fireConversionRequest):
1456         * NetworkProcess/Downloads/DownloadManager.cpp:
1457         (WebKit::DownloadManager::startDownload):
1458         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1459         (WebKit::NetworkCORSPreflightChecker::startPreflight):
1460         * NetworkProcess/NetworkLoadParameters.h:
1461         (WebKit::NetworkLoadParameters::NetworkLoadParameters):
1462         * NetworkProcess/NetworkProcess.cpp:
1463         (WebKit::NetworkProcess::preconnectTo):
1464         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1465         (WebKit::NetworkResourceLoadParameters::encode const):
1466         (WebKit::NetworkResourceLoadParameters::decode):
1467         * NetworkProcess/NetworkResourceLoadParameters.h:
1468         (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
1469         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1470         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
1471         * WebProcess/Network/WebLoaderStrategy.cpp:
1472         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1473         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1474         (WebKit::WebLoaderStrategy::startPingLoad):
1475         (WebKit::WebLoaderStrategy::preconnectTo):
1476
1477 2019-08-14  Youenn Fablet  <youenn@apple.com>
1478
1479         Remove use of emptySessionID from WebPageCreationParameters
1480         https://bugs.webkit.org/show_bug.cgi?id=200708
1481
1482         Reviewed by Alex Christensen.
1483
1484         Make WebPageCreationParameters constructor take a SessionID.
1485         Update constructor call sites.
1486
1487         * Shared/WebPageCreationParameters.cpp:
1488         (WebKit::WebPageCreationParameters::decode):
1489         * Shared/WebPageCreationParameters.h:
1490         (WebKit::WebPageCreationParameters::WebPageCreationParameters):
1491         * UIProcess/WebPageProxy.cpp:
1492         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
1493
1494 2019-08-14  Youenn Fablet  <youenn@apple.com>
1495
1496         Remove API::PageConfiguration::m_sessionID
1497         https://bugs.webkit.org/show_bug.cgi?id=200670
1498
1499         Reviewed by Alex Christensen.
1500
1501         We can remove this member since it is only accessed for a debug assertion that can be removed without any harm.
1502
1503         * UIProcess/API/APIPageConfiguration.cpp:
1504         (API::PageConfiguration::PageConfiguration):
1505         (API::PageConfiguration::copy const):
1506         (API::PageConfiguration::setWebsiteDataStore):
1507         * UIProcess/API/APIPageConfiguration.h:
1508         * UIProcess/API/glib/WebKitWebContext.cpp:
1509         (webkitWebContextCreatePageForWebView):
1510         * UIProcess/WebProcessPool.cpp:
1511         (WebKit::WebProcessPool::createWebPage):
1512
1513 2019-08-14  Youenn Fablet  <youenn@apple.com>
1514
1515         ThreadableBlobRegistry::blobSize should take a SessionID as parameter
1516         https://bugs.webkit.org/show_bug.cgi?id=200671
1517
1518         Reviewed by Alex Christensen.
1519
1520         Update WebCacheStorageConnection to implement sessionID getter.
1521         Update NetworkConnectionToWebProcess to get a sessionID as parameter to blobSize computation.
1522
1523         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1524         (WebKit::NetworkDataTaskCurl::createCurlRequest):
1525         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1526         (WebKit::NetworkConnectionToWebProcess::blobSize):
1527         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1528         * NetworkProcess/NetworkConnectionToWebProcess.h:
1529         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1530         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
1531         (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
1532         * WebProcess/Cache/WebCacheStorageConnection.h:
1533         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
1534         (WebKit::BlobRegistryProxy::blobSize):
1535         * WebProcess/FileAPI/BlobRegistryProxy.h:
1536
1537 2019-08-14  Youenn Fablet  <youenn@apple.com>
1538
1539         Remove SessionID default constructor
1540         https://bugs.webkit.org/show_bug.cgi?id=200669
1541
1542         Reviewed by Alex Christensen.
1543
1544         Update IPC decoder to use an Optional<SessionID>.
1545         Update PageConfiguration to use emptySessionID instead of default constructor.
1546
1547         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1548         (WebKit::NetworkSessionCreationParameters::decode):
1549         * Shared/WebPageCreationParameters.h:
1550         * UIProcess/API/APIPageConfiguration.cpp:
1551         (API::PageConfiguration::PageConfiguration):
1552         (API::PageConfiguration::sessionID): Deleted.
1553         (API::PageConfiguration::setSessionID): Deleted.
1554
1555 2019-08-14  Youenn Fablet  <youenn@apple.com>
1556
1557         Make WebSWOriginStore::m_webSWServerConnections a WeakHashSet
1558         https://bugs.webkit.org/show_bug.cgi?id=200661
1559
1560         Reviewed by Alex Christensen.
1561
1562         * NetworkProcess/ServiceWorker/WebSWOriginStore.cpp:
1563         (WebKit::WebSWOriginStore::importComplete):
1564         (WebKit::WebSWOriginStore::registerSWServerConnection):
1565         (WebKit::WebSWOriginStore::unregisterSWServerConnection):
1566         (WebKit::WebSWOriginStore::didInvalidateSharedMemory):
1567         * NetworkProcess/ServiceWorker/WebSWOriginStore.h:
1568
1569 2019-08-14  Youenn Fablet  <youenn@apple.com>
1570
1571         NetworkProcess::m_swServerConnections should use WeakPtr
1572         https://bugs.webkit.org/show_bug.cgi?id=200660
1573
1574         Reviewed by Geoffrey Garen.
1575
1576         Use WeakPtr for SWServer connections as an extra safety measure.
1577
1578         * NetworkProcess/NetworkProcess.cpp:
1579         (WebKit::NetworkProcess::postMessageToServiceWorkerClient):
1580         (WebKit::NetworkProcess::postMessageToServiceWorker):
1581         (WebKit::NetworkProcess::registerSWServerConnection):
1582         (WebKit::NetworkProcess::unregisterSWServerConnection):
1583         * NetworkProcess/NetworkProcess.h:
1584
1585 2019-08-14  Youenn Fablet  <youenn@apple.com>
1586
1587         Move some WebRTC runtime flags from experimental to internal
1588         https://bugs.webkit.org/show_bug.cgi?id=200672
1589
1590         Reviewed by Eric Carlson.
1591
1592         * Shared/WebPreferences.yaml:
1593
1594 2019-08-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1595
1596         shouldRespectImageOrientation should be a value in ImageOrientation
1597         https://bugs.webkit.org/show_bug.cgi?id=200553
1598
1599         Reviewed by Simon Fraser.
1600
1601         * WebProcess/WebPage/ios/WebPageIOS.mm:
1602         (WebKit::imagePositionInformation):
1603
1604 2019-08-13  John Wilander  <wilander@apple.com>
1605
1606         Resource Load Statistics: Switch NSURLSession on top navigation to prevalent resource with user interaction
1607         https://bugs.webkit.org/show_bug.cgi?id=200642
1608         <rdar://problem/53962073>
1609
1610         Reviewed by Alex Christensen.
1611
1612         Since prevalent resources with user interaction get to keep their cookies and website
1613         data, we should use a different NSURLSessions for when they are first-party websites
1614         and have access to that data. This patch achieves that.
1615
1616         The WebKit::NetworkDataTaskCocoa constructor now checks with the network storage session
1617         if the first party for this load should be isolated. The category for which this is true
1618         is checked in the new function
1619         WebCore:NetworkStorageSession::shouldBlockThirdPartyCookiesButKeepFirstPartyCookiesFor()
1620         which in turn is backed by a new split of m_registrableDomainsToBlockCookieFor into:
1621         - m_registrableDomainsToBlockAndDeleteCookiesFor
1622         - m_registrableDomainsToBlockButKeepCookiesFor
1623         ... in WebCore:NetworkStorageSession.
1624
1625         Non-isolated sessions are now picked up through the convenience function
1626         WebKit::NetworkSessionCocoa::session() whereas isolated sessions are created lazily and
1627         picked up through WebKit::NetworkSessionCocoa::isolatedSession().
1628
1629         The number of isolated NSURLSessions in memory is capped to 10. When the cap is hit,
1630         the session that's been unused the longest is aged out.
1631
1632         The C API changes are test infrastructure.
1633
1634         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1635         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):
1636         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlockAndDeleteCookiesFor const):
1637         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlockButKeepCookiesFor const):
1638         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
1639         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlock const): Deleted.
1640         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1641         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1642         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
1643         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
1644         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1645         (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains):
1646         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
1647         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1648         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1649         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
1650         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains): Deleted.
1651         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains): Deleted.
1652             Dead code.
1653         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1654         (WebKit::RegistrableDomainsToBlockCookiesFor::isolatedCopy const):
1655         * NetworkProcess/NetworkProcess.cpp:
1656         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
1657         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
1658         (WebKit::NetworkProcess::hasIsolatedSession const):
1659         * NetworkProcess/NetworkProcess.h:
1660         * NetworkProcess/NetworkProcess.messages.in:
1661         * NetworkProcess/NetworkSession.h:
1662         (WebKit::NetworkSession::shouldIsolateSessionsForPrevalentTopFrames const):
1663         (WebKit::NetworkSession::hasIsolatedSession const):
1664         (WebKit::NetworkSession::clearIsolatedSessions):
1665         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1666         (WebKit::NetworkSessionCreationParameters::encode const):
1667         (WebKit::NetworkSessionCreationParameters::decode):
1668         * NetworkProcess/NetworkSessionCreationParameters.h:
1669         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1670         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1671         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1672         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1673         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1674         (WebKit::NetworkSessionCocoa::session):
1675         (WebKit::NetworkSessionCocoa::isolatedSession):
1676         (WebKit::NetworkSessionCocoa::hasIsolatedSession const):
1677         (WebKit::NetworkSessionCocoa::clearIsolatedSessions):
1678         (WebKit::NetworkSessionCocoa::invalidateAndCancel):
1679         (WebKit::NetworkSessionCocoa::clearCredentials):
1680         * Shared/WebPreferences.yaml:
1681         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1682         (WKWebsiteDataStoreStatisticsHasIsolatedSession):
1683         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1684         * UIProcess/Network/NetworkProcessProxy.cpp:
1685         (WebKit::NetworkProcessProxy::hasIsolatedSession):
1686         * UIProcess/Network/NetworkProcessProxy.h:
1687         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1688         (WebKit::WebsiteDataStore::parameters):
1689         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1690         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
1691         (WebKit::WebsiteDataStore::hasIsolatedSessionForTesting const):
1692         * UIProcess/WebsiteData/WebsiteDataStore.h:
1693
1694 2019-08-13  Chris Dumez  <cdumez@apple.com>
1695
1696         Fix potential thread safety issue under WebResourceLoadStatisticsStore::hasHadUserInteraction()
1697         https://bugs.webkit.org/show_bug.cgi?id=200688
1698
1699         Reviewed by Alex Christensen.
1700
1701         Fix potential thread safety issue under WebResourceLoadStatisticsStore::hasHadUserInteraction().
1702         It passes a RegistrableDomain to another thread without isolated copying it.
1703
1704         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1705         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
1706
1707 2019-08-13  Chris Dumez  <cdumez@apple.com>
1708
1709         Fix potential thread safety issue under StorageManager::getSessionStorageOrigins()
1710         https://bugs.webkit.org/show_bug.cgi?id=200684
1711
1712         Reviewed by Geoffrey Garen.
1713
1714         Fix potential thread safety issue under StorageManager::getSessionStorageOrigins(). The origins are being
1715         passed from the background queue to the main thread without isolated copy.
1716
1717         * NetworkProcess/WebStorage/StorageManager.cpp:
1718         (WebKit::StorageManager::getSessionStorageOrigins):
1719
1720 2019-08-12  Jiewen Tan  <jiewen_tan@apple.com>
1721
1722         [WebAuthn] Make CtapHidAuthenticator/U2fHidAuthenticator to CtapAuthenticator/U2fAuthenticator
1723         https://bugs.webkit.org/show_bug.cgi?id=191527
1724         <rdar://problem/54237146>
1725
1726         Reviewed by Chris Dumez.
1727
1728         This patch makes an ABC CtapDriver, which services as an abstract interface for CtapAuthenticator/U2fAuthenticator to talk to
1729         the actual object that implement the specific CTAP protocol that mananges communications over different transports, for example,
1730         CtapHidDriver, such that CtapAuthenticator/U2fAuthenticator can be shared across different transports.
1731
1732         This patch also renames CtapHidAuthenticator/U2fHidAuthenticator to CtapAuthenticator/U2fAuthenticator correspondingly.
1733
1734         * Sources.txt:
1735         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
1736         (WebKit::HidService::continueAddDeviceAfterGetInfo):
1737         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp.
1738         (WebKit::CtapAuthenticator::CtapAuthenticator):
1739         (WebKit::CtapAuthenticator::makeCredential):
1740         (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived const):
1741         (WebKit::CtapAuthenticator::getAssertion):
1742         (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived):
1743         (WebKit::CtapAuthenticator::tryDowngrade):
1744         * UIProcess/WebAuthentication/fido/CtapAuthenticator.h: Copied from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h.
1745         * UIProcess/WebAuthentication/fido/CtapDriver.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h.
1746         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
1747         (WebKit::CtapHidDriver::setProtocol):
1748         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp.
1749         (WebKit::U2fAuthenticator::U2fAuthenticator):
1750         (WebKit::U2fAuthenticator::makeCredential):
1751         (WebKit::U2fAuthenticator::checkExcludeList):
1752         (WebKit::U2fAuthenticator::issueRegisterCommand):
1753         (WebKit::U2fAuthenticator::getAssertion):
1754         (WebKit::U2fAuthenticator::issueSignCommand):
1755         (WebKit::U2fAuthenticator::issueNewCommand):
1756         (WebKit::U2fAuthenticator::issueCommand):
1757         (WebKit::U2fAuthenticator::responseReceived):
1758         (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
1759         (WebKit::U2fAuthenticator::continueCheckOnlyCommandAfterResponseReceived):
1760         (WebKit::U2fAuthenticator::continueBogusCommandAfterResponseReceived):
1761         (WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived):
1762         * UIProcess/WebAuthentication/fido/U2fAuthenticator.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h.
1763         * WebKit.xcodeproj/project.pbxproj:
1764
1765 2019-08-13  Chris Dumez  <cdumez@apple.com>
1766
1767         Crash under IPC::Connection::markCurrentlyDispatchedMessageAsInvalid()
1768         https://bugs.webkit.org/show_bug.cgi?id=200674
1769         <rdar://problem/50692748>
1770
1771         Reviewed by Geoff Garen.
1772
1773         When the client terminates a provisional process (e.g. via the [WKWebView _killWebContentProcessAndResetState]
1774         SPI), the WebProcessProxy would notify its associated WebPageProxy objects that it had terminated but would fail
1775         to notify its associated ProvisionalPageProxy objects. As a result, those objects would not get destroyed and
1776         would still think that they were in the middle of a provisional load the next time a load started. This inconsistent
1777         state would lead to crashes such as the one in the radar.
1778
1779         * UIProcess/ProvisionalPageProxy.cpp:
1780         (WebKit::ProvisionalPageProxy::cancel):
1781         * UIProcess/WebProcessProxy.cpp:
1782         (WebKit::WebProcessProxy::requestTermination):
1783
1784 2019-08-13  Youenn Fablet  <youenn@apple.com>
1785
1786         Blob registries should be keyed by session IDs
1787         https://bugs.webkit.org/show_bug.cgi?id=200567
1788         <rdar://problem/54120212>
1789
1790         Reviewed by Alex Christensen.
1791
1792         Move blob registry to NetworkSession so that it is partitioned by session ID.
1793         In case session ID is not given through IPC, use the connection as key to get the network session.
1794         This is used for blobSize.
1795
1796         * NetworkProcess/Downloads/DownloadManager.cpp:
1797         (WebKit::DownloadManager::startDownload):
1798         * NetworkProcess/Downloads/DownloadManager.h:
1799         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
1800         * NetworkProcess/FileAPI/NetworkBlobRegistry.h: Removed.
1801         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1802         (WebKit::NetworkConnectionToWebProcess::didClose):
1803         (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
1804         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
1805         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
1806         (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
1807         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
1808         (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
1809         (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
1810         (WebKit::NetworkConnectionToWebProcess::blobSize):
1811         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1812         (WebKit::NetworkConnectionToWebProcess::filesInBlob):
1813         * NetworkProcess/NetworkConnectionToWebProcess.h:
1814         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1815         * NetworkProcess/NetworkProcess.cpp:
1816         (WebKit::NetworkProcess::blobRegistry):
1817         * NetworkProcess/NetworkProcess.h:
1818         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
1819         (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
1820         * NetworkProcess/NetworkResourceLoader.cpp:
1821         (WebKit::NetworkResourceLoader::startNetworkLoad):
1822         * NetworkProcess/NetworkSession.h:
1823         (WebKit::NetworkSession::blobRegistry):
1824         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1825         (WebKit::NetworkDataTaskSoup::createRequest):
1826         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1827         (WebKit::NetworkSessionSoup::createWebSocketTask):
1828         * Sources.txt:
1829         * WebKit.xcodeproj/project.pbxproj:
1830         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
1831         (WebKit::BlobRegistryProxy::registerFileBlobURL):
1832         (WebKit::BlobRegistryProxy::registerBlobURL):
1833         (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
1834         (WebKit::BlobRegistryProxy::unregisterBlobURL):
1835         (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
1836         (WebKit::BlobRegistryProxy::writeBlobsToTemporaryFiles):
1837         * WebProcess/FileAPI/BlobRegistryProxy.h:
1838         * WebProcess/Network/NetworkProcessConnection.cpp:
1839         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
1840         * WebProcess/Network/NetworkProcessConnection.h:
1841
1842 2019-08-13  Youenn Fablet  <youenn@apple.com>
1843
1844         User Agent and SessionID should be given to NetworkRTCProvider to set up the correct proxy information
1845         https://bugs.webkit.org/show_bug.cgi?id=200583
1846
1847         Reviewed by Eric Carlson.
1848
1849         Pass session id and user agent whenever creating a TCP client socket.
1850         Use this information to get the proxy information from NetworkSession and pass it to libwebrtc socket creation.
1851
1852         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1853         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1854         (WebKit::NetworkRTCProvider::proxyInfoFromSession):
1855         (WebKit::NetworkRTCProvider::createClientTCPSocket):
1856         * NetworkProcess/webrtc/NetworkRTCProvider.h:
1857         * NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
1858         * WebKit.xcodeproj/project.pbxproj:
1859         * NetworkProcess/webrtc/NetworkRTCProvider.mm: Added.
1860         (WebKit::NetworkRTCProvider::proxyInfoFromSession):
1861         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
1862         (WebKit::LibWebRTCProvider::createPeerConnection):
1863         (WebKit::LibWebRTCProvider::createSocketFactory):
1864         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
1865         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
1866         (WebKit::LibWebRTCSocketFactory::createServerTcpSocket):
1867         (WebKit::LibWebRTCSocketFactory::createUdpSocket):
1868         (WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
1869         (WebKit::LibWebRTCSocketFactory::createAsyncResolver):
1870         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
1871
1872 2019-08-12  Chris Dumez  <cdumez@apple.com>
1873
1874         Fix bad RELEASE_LOG_ERROR under ProvisionalPageProxy::ProvisionalPageProxy()
1875         https://bugs.webkit.org/show_bug.cgi?id=200646
1876
1877         Reviewed by Alex Christensen.
1878
1879         Fix bad RELEASE_LOG_ERROR under ProvisionalPageProxy::ProvisionalPageProxy(). Should be a
1880         simple RELEASE_LOG() as this is not an error.
1881
1882         * UIProcess/ProvisionalPageProxy.cpp:
1883         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
1884
1885 2019-08-12  Sam Weinig  <weinig@apple.com>
1886
1887         Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation
1888         https://bugs.webkit.org/show_bug.cgi?id=200614
1889
1890         Reviewed by Darin Adler.
1891
1892         Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and 
1893         StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...).
1894         
1895         Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to 
1896         StringBuilder::appendSubstring(...).
1897
1898         * Shared/mac/AuxiliaryProcessMac.mm:
1899         (WebKit::setAndSerializeSandboxParameters):
1900         * UIProcess/WebProcessPool.cpp:
1901         (WebKit::WebProcessPool::didReceiveInvalidMessage):
1902         Update for renames.
1903
1904 2019-08-12  Dean Jackson  <dino@apple.com>
1905
1906         Contextual menu Hide and Show Link Previews should not have a symbol
1907         https://bugs.webkit.org/show_bug.cgi?id=200645
1908         <rdar://problem/54129647>
1909
1910         Reviewed by Wenson Hsieh.
1911
1912         Don't use an image on the UIMenuItem.
1913
1914         * UIProcess/API/Cocoa/_WKElementAction.mm:
1915         (+[_WKElementAction imageForElementActionType:]): Return nil for Show/Hide Link Previews.
1916
1917 2019-08-12  Chris Dumez  <cdumez@apple.com>
1918
1919         Unreviewed, add missing WTF::initializeMainThread() call to fix some crashes on the bots after r248533.
1920
1921         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
1922         (WebKit::XPCServiceMain):
1923
1924 2019-08-12  Megan Gardner  <megan_gardner@apple.com>
1925
1926         Fix Crash in Mail Search
1927         https://bugs.webkit.org/show_bug.cgi?id=200589
1928         <rdar://problem/53666720>
1929
1930         Reviewed by Tim Horton.
1931
1932         If we search in Mail backwards first, for AppKit reasons 
1933         we get a -1 for the index of the found item.
1934         Do not try and insert data in this case.
1935
1936         * UIProcess/mac/WKTextFinderClient.mm:
1937
1938 2019-08-12  Adrian Perez de Castro  <aperez@igalia.com>
1939
1940         [WPE][GTK] Fix building without unified sources
1941         https://bugs.webkit.org/show_bug.cgi?id=200641
1942
1943         Reviewed by Žan Doberšek.
1944
1945         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: Add missing inclusions for headers
1946         WebCore/GtkUtilities.h (for convertWidgetPointToScreenPoint), WebCore/IntPoint.h, and
1947         WebPageProxy.h (the two latter to avoid usage of undefined types).
1948         (WebKit::WebDataListSuggestionsDropdownGtk::show): Add namespace prefix to use
1949         WebCore::IntPoint.
1950
1951 2019-08-12  Sihui Liu  <sihui_liu@apple.com>
1952
1953         Clear m_sessionStorageNamespaces on the background thread
1954         https://bugs.webkit.org/show_bug.cgi?id=200631
1955         <rdar://problem/54149638>
1956
1957         Reviewed by Chris Dumez.
1958
1959         Network process receives messages about web page state from web process and destroys sessionStorageNamespace if 
1960         needed. It also receives messages about session state from UI process and destroys StorageManager, which owns 
1961         SessionStorageNamespaces, if needed. Because of the race in receiving the messages from different processes, 
1962         network process may decide to destroy StorageManager before destroying all SessionStorageNamespaces, and 
1963         SessionStorageNamespaces are destroyed with StorageManager on the main thread.
1964
1965         * NetworkProcess/WebStorage/StorageManager.cpp:
1966         (WebKit::StorageManager::waitUntilTasksFinished):
1967
1968 2019-08-12  Sihui Liu  <sihui_liu@apple.com>
1969
1970         Remove an assertion in ~StorageArea()
1971         https://bugs.webkit.org/show_bug.cgi?id=200630
1972         <rdar://problem/54097722>
1973
1974         Reviewed by Chris Dumez.
1975
1976         In r247370, we clear the LocalStorageNamespace before the destructor of LocalStorageNamespace is invoked, to 
1977         make sure StorageArea gets destroyed on the background thread. 
1978         StorageArea can get destroyed before LocalStorageNamespace, so the assertion in ~StorageArea() is not true any 
1979         more.
1980
1981         * NetworkProcess/WebStorage/StorageArea.cpp:
1982         (WebKit::StorageArea::~StorageArea):
1983
1984 2019-08-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1985
1986         [iPadOS] Web pages sometimes load at half width in Safari
1987         https://bugs.webkit.org/show_bug.cgi?id=200624
1988         <rdar://problem/52694257>
1989
1990         Reviewed by Simon Fraser.
1991
1992         Whenever WKWebView's size changes, it normally notifies the web content process by calling into WebPageProxy::
1993         setViewportConfigurationViewLayoutSize, which remembers this view layout size using a member variable,
1994         m_viewportConfigurationViewLayoutSize. Later, m_viewportConfigurationViewLayoutSize is consulted as a part of
1995         constructing the creation parameters used to set up a new page.
1996
1997         However, during animated resize, WKWebView avoids these calls to setViewportConfigurationViewLayoutSize via the
1998         dynamic viewport update mode check in -[WKWebView _frameOrBoundsChanged]. Instead, the new view layout size is
1999         pushed to the web process by calling WebPageProxy::dynamicViewportSizeUpdate.
2000
2001         Since dynamicViewportSizeUpdate doesn't update m_viewportConfigurationViewLayoutSize, the next
2002         WebPageCreationParameters that are created with this WebPageProxy (e.g. after a process swap, or after
2003         reloading, if the process was terminated) will use the size of the WKWebView prior to the most recent animated
2004         resize.
2005
2006         To fix the bug, we simply make sure that m_viewportConfigurationViewLayoutSize is updated in the dynamic
2007         viewport size update (i.e. animated resize) case as well.
2008
2009         Test: WebKit.CreateWebPageAfterAnimatedResize
2010
2011         * UIProcess/ios/WebPageProxyIOS.mm:
2012         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
2013
2014 2019-08-12  Chris Dumez  <cdumez@apple.com>
2015
2016         Crash under NetworkResourceLoader::start()
2017         https://bugs.webkit.org/show_bug.cgi?id=200628
2018
2019         Reviewed by Youenn Fablet.
2020
2021         Make sure the NetworkResourceLoader is still alive when the lambda passed to NetworkLoadChecker::check()
2022         gets executed.
2023
2024         * NetworkProcess/NetworkResourceLoader.cpp:
2025         (WebKit::NetworkResourceLoader::start):
2026         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2027         * NetworkProcess/NetworkResourceLoader.h:
2028
2029 2019-08-12  Jonathan Bedard  <jbedard@apple.com>
2030
2031         Tapping buttons in Data Detectors lookup previews doesn't work (Follow-up fix)
2032         https://bugs.webkit.org/show_bug.cgi?id=200579
2033         <rdar://problem/54056519>
2034
2035         Reviewed by Megan Gardner.
2036
2037         * Platform/spi/ios/UIKitSPI.h: Add _UIContextMenuStyle SPI.
2038
2039 2019-08-12  Chris Dumez  <cdumez@apple.com>
2040
2041         Add threading assertions to RefCounted
2042         https://bugs.webkit.org/show_bug.cgi?id=200507
2043
2044         Reviewed by Ryosuke Niwa.
2045
2046         Enable new RefCounted threading assertions for WebKit2
2047         (UIProcess + auxiliary processes).
2048
2049         * Shared/AuxiliaryProcess.cpp:
2050         (WebKit::AuxiliaryProcess::initialize):
2051         * Shared/Cocoa/WebKit2InitializeCocoa.mm:
2052         (WebKit::runInitializationCode):
2053         * Shared/WebKit2Initialize.cpp:
2054         (WebKit::InitializeWebKit2):
2055
2056 2019-08-12  Chris Dumez  <cdumez@apple.com>
2057
2058         Unreviewed, rolling out r248525.
2059
2060         Revert new threading assertions while I work on fixing the
2061         issues they exposed
2062
2063         Reverted changeset:
2064
2065         "Add threading assertions to RefCounted"
2066         https://bugs.webkit.org/show_bug.cgi?id=200507
2067         https://trac.webkit.org/changeset/248525
2068
2069 2019-08-12  Youenn Fablet  <youenn@apple.com>
2070
2071         Remove IDB-specific quota
2072         https://bugs.webkit.org/show_bug.cgi?id=196545
2073
2074         Reviewed by Alex Christensen.
2075
2076         * NetworkProcess/NetworkProcess.cpp:
2077         (WebKit::NetworkProcess::createIDBServer):
2078         (WebKit::NetworkProcess::addIndexedDatabaseSession):
2079         (WebKit::NetworkProcess::setIDBPerOriginQuota): Deleted.
2080         * NetworkProcess/NetworkProcess.h:
2081         * NetworkProcess/NetworkProcess.messages.in:
2082         * UIProcess/API/C/WKContext.cpp:
2083         (WKContextSetIDBPerOriginQuota): Deleted.
2084         * UIProcess/API/C/WKContextPrivate.h:
2085         * UIProcess/WebProcessPool.cpp:
2086         (WebKit::WebProcessPool::setIDBPerOriginQuota): Deleted.
2087         * UIProcess/WebProcessPool.h:
2088
2089 2019-08-11  Chris Dumez  <cdumez@apple.com>
2090
2091         Add threading assertions to RefCounted
2092         https://bugs.webkit.org/show_bug.cgi?id=200507
2093
2094         Reviewed by Ryosuke Niwa.
2095
2096         Enable new RefCounted threading assertions for WebKit2
2097         (UIProcess + auxiliary processes).
2098
2099         * Shared/AuxiliaryProcess.cpp:
2100         (WebKit::AuxiliaryProcess::initialize):
2101         * Shared/Cocoa/WebKit2InitializeCocoa.mm:
2102         (WebKit::runInitializationCode):
2103         * Shared/WebKit2Initialize.cpp:
2104         (WebKit::InitializeWebKit2):
2105
2106 2019-08-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2107
2108         WebPage and ViewportConfiguration have differing notions of viewLayoutSize
2109         https://bugs.webkit.org/show_bug.cgi?id=200619
2110
2111         Reviewed by Tim Horton.
2112
2113         The notion of a "view layout size" exists on WebPage and WebPageProxy for the purpose of specifying an intrinsic
2114         content size for the entire web view on macOS. However, it also exists in ViewportConfiguration (as
2115         viewLayoutSize) and WebPageProxy (under the name m_viewportConfigurationViewLayoutSize) for the purposes of
2116         specifying the minimum layout size of the page's viewport.
2117
2118         This is especially confusing in WebPageProxy, which has both m_viewportConfigurationViewLayoutSize and
2119         m_viewLayoutSize. To remedy this, rename "*viewLayoutSize" for the purposes of specifying an intrinsic web view
2120         size to "*minimumSizeForAutoLayout" instead, which is consistent with the corresponding SPI property name on
2121         WKView.
2122
2123         No change in behavior.
2124
2125         * Shared/WebPageCreationParameters.cpp:
2126         (WebKit::WebPageCreationParameters::encode const):
2127         (WebKit::WebPageCreationParameters::decode):
2128         * Shared/WebPageCreationParameters.h:
2129         * UIProcess/API/Cocoa/WKWebView.mm:
2130         (-[WKWebView _minimumLayoutWidth]):
2131         (-[WKWebView _setMinimumLayoutWidth:]):
2132         * UIProcess/Cocoa/WebViewImpl.mm:
2133         (WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
2134         (WebKit::WebViewImpl::minimumSizeForAutoLayout const):
2135         (WebKit::WebViewImpl::setIntrinsicContentSize):
2136         * UIProcess/DrawingAreaProxy.h:
2137         (WebKit::DrawingAreaProxy::minimumSizeForAutoLayoutDidChange):
2138         (WebKit::DrawingAreaProxy::viewLayoutSizeDidChange): Deleted.
2139         * UIProcess/WebPageProxy.cpp:
2140         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2141         * UIProcess/WebPageProxy.h:
2142         (WebKit::WebPageProxy::minimumSizeForAutoLayout const):
2143         (WebKit::WebPageProxy::viewLayoutSize const): Deleted.
2144         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2145         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2146         (WebKit::TiledCoreAnimationDrawingAreaProxy::minimumSizeForAutoLayoutDidChange):
2147         (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry):
2148         (WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry):
2149         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange): Deleted.
2150         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2151         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
2152         * WebProcess/WebPage/WebPage.cpp:
2153         (WebKit::m_textAutoSizingAdjustmentTimer):
2154         (WebKit::WebPage::reinitializeWebPage):
2155         (WebKit::WebPage::setMinimumSizeForAutoLayout):
2156         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
2157         (WebKit::WebPage::setViewLayoutSize): Deleted.
2158         * WebProcess/WebPage/WebPage.h:
2159         (WebKit::WebPage::minimumSizeForAutoLayout const):
2160         (WebKit::WebPage::viewLayoutSize const): Deleted.
2161         * WebProcess/WebPage/WebPage.messages.in:
2162         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2163         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
2164
2165 2019-08-10  Alex Christensen  <achristensen@webkit.org>
2166
2167         Disable ContentChangeObserver TouchEvent adjustment on youtube.com on iOS in mobile browsing mode
2168         https://bugs.webkit.org/show_bug.cgi?id=200609
2169         <rdar://problem/54015403>
2170
2171         Reviewed by Maciej Stachowiak.
2172
2173         * Shared/WebsitePoliciesData.cpp:
2174         (WebKit::WebsitePoliciesData::encode const):
2175         (WebKit::WebsitePoliciesData::decode):
2176         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2177         * Shared/WebsitePoliciesData.h:
2178         * UIProcess/API/APIWebsitePolicies.cpp:
2179         (API::WebsitePolicies::copy const):
2180         (API::WebsitePolicies::data):
2181         * UIProcess/API/APIWebsitePolicies.h:
2182         * UIProcess/ios/WebPageProxyIOS.mm:
2183         (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
2184
2185 2019-08-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
2186
2187         [iOS] Add a quirk for gmail.com messages on iPhone iOS13
2188         https://bugs.webkit.org/show_bug.cgi?id=200605
2189
2190         Reviewed by Maciej Stachowiak.
2191
2192         Use WebPage::platformUserAgent() to add the gmail.com quirk.
2193
2194         * UIProcess/ios/WebPageProxyIOS.mm:
2195         (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
2196         * WebProcess/WebPage/ios/WebPageIOS.mm:
2197         (WebKit::WebPage::platformUserAgent const):
2198
2199 2019-08-10  Tim Horton  <timothy_horton@apple.com>
2200
2201         Remove some more unused 32-bit code
2202         https://bugs.webkit.org/show_bug.cgi?id=200607
2203
2204         Reviewed by Alexey Proskuryakov.
2205
2206         * Modules/OSX.modulemap:
2207
2208 2019-08-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2209
2210         [iOS 13] Google Docs/Slides/Sheets: paste often doesn't work and sometimes produces an error
2211         https://bugs.webkit.org/show_bug.cgi?id=200591
2212         <rdar://problem/54102238>
2213
2214         Reviewed by Ryosuke Niwa and Tim Horton.
2215
2216         Adopts UIKit SPI to avoid incrementing the general pasteboard's change count whenever an editable element is
2217         focused. This is due to how, in iOS 13, UIKit temporarily writes an image to the pasteboard when showing the
2218         keyboard, to determine whether or not to show the Memojis in the input view.
2219
2220         This causes UIPasteboard's changeCount to increment twice due to adding and then removing the image, which means
2221         that the changeCount sanity checks in the web process will race against the pasteboard gaining and then losing
2222         this temporary image.
2223
2224         Instead, the new -supportsImagePaste SPI may be used to short-circuit this step, and avoid updating the
2225         changeCount when UIKeyboardImpl's delegate changes.
2226
2227         * UIProcess/ios/WKContentViewInteraction.mm:
2228         (-[WKContentView supportsImagePaste]):
2229
2230 2019-08-09  Alex Christensen  <achristensen@webkit.org>
2231
2232         Remove unused Connection::sendWithReply
2233         https://bugs.webkit.org/show_bug.cgi?id=200590
2234
2235         Reviewed by Chris Dumez.
2236
2237         This was attempted in r245151, but rolled out in r245164 because my SecItemShim code didn't work well on non-main threads.
2238         Chris found a better solution for SecItemShim in r248014, making this unused code.  Let's remove it.
2239
2240         * Platform/IPC/Connection.cpp:
2241         (IPC::Connection::invalidate):
2242         (IPC::Connection::processIncomingSyncReply):
2243         (IPC::Connection::connectionDidClose):
2244         (IPC::Connection::sendMessageWithReply): Deleted.
2245         * Platform/IPC/Connection.h:
2246         (IPC::Connection::send):
2247         (IPC::Connection::sendWithReply): Deleted.
2248
2249 2019-08-09  Simon Fraser  <simon.fraser@apple.com>
2250
2251         [iOS WK2] Remove context menu hints on navigation
2252         https://bugs.webkit.org/show_bug.cgi?id=200588
2253         rdar://problem/54061796
2254
2255         Reviewed by Tim Horton.
2256
2257         Make sure the context menu hint doesn't linger across navigations by hosting it in its
2258         own container view (shared with drag previews), and hiding that view on navigation (unparenting
2259         may have bad consequences). We remove the view when the animation ends.
2260
2261         * UIProcess/ios/WKContentViewInteraction.h:
2262         * UIProcess/ios/WKContentViewInteraction.mm:
2263         (-[WKContentView _didCommitLoadForMainFrame]):
2264         (-[WKContentView containerViewForTargetedPreviews]):
2265         (-[WKContentView _hideContextMenu]):
2266         (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
2267
2268 2019-08-09  Alex Christensen  <achristensen@webkit.org>
2269
2270         Disable CSSOM View Scrolling API for IMDb iOS app
2271         https://bugs.webkit.org/show_bug.cgi?id=200586
2272         <rdar://problem/53645833>
2273
2274         Reviewed by Simon Fraser.
2275
2276         Change the CSSOMViewScrollingAPIEnabled default value to be off for the IMDb app's WKWebViews.
2277         I manually verified this is effective in those WKWebViews but no other WKWebViews and that it fixes the radar.
2278
2279         * Shared/WebPreferences.yaml:
2280         * Shared/WebPreferencesDefaultValues.cpp:
2281         (WebKit::defaultCSSOMViewScrollingAPIEnabled):
2282         * Shared/WebPreferencesDefaultValues.h:
2283
2284 2019-08-09  Tim Horton  <timothy_horton@apple.com>
2285
2286         Tapping buttons in Data Detectors lookup previews doesn't work
2287         https://bugs.webkit.org/show_bug.cgi?id=200579
2288         <rdar://problem/54056519>
2289
2290         Reviewed by Megan Gardner.
2291
2292         * Platform/spi/ios/UIKitSPI.h:
2293         * UIProcess/ios/WKContentViewInteraction.mm:
2294         (-[WKContentView _contextMenuInteraction:styleForMenuWithConfiguration:]):
2295         If a Data Detectors context menu wants the action menu style, provide it.
2296
2297         (-[WKContentView contextMenuInteraction:willPerformPreviewActionForMenuWithConfiguration:animator:]):
2298         If a Data Detectors context menu provides a view controller to present
2299         on context menu commit, present it. We present on top of the same view
2300         controller that is currently presenting the context menu, but modally
2301         instead of inside the context menu.
2302
2303         If a Data Detectors context menu instead provides a URL to launch on
2304         context menu commit, call openURL.
2305
2306         In both cases, change the commit style to pop, since we're committing
2307         instead of dismissing.
2308
2309 2019-08-08  Dean Jackson  <dino@apple.com>
2310
2311         REGRESSION (52279987): Most of the WKUIDelegate contextMenu delegate methods are not being called
2312         https://bugs.webkit.org/show_bug.cgi?id=200557
2313         <rdar://problem/53717962>
2314
2315         Reviewed by Wenson Hsieh.
2316
2317         UIKit changed the name of delegates recently. We ignored the warning because
2318         it was still calling the old methods. However, it will only do so for applications
2319         authored by Apple, breaking 3rd parties.
2320
2321         The change here is just adopting the new methods in place of the old ones.
2322         It does not change the API that WebKit vends (they still use the older names).
2323
2324         * UIProcess/ios/WKContentViewInteraction.mm:
2325         (-[WKContentView contextMenuInteraction:willDisplayMenuForConfiguration:animator:]):
2326         (-[WKContentView contextMenuInteraction:willPerformPreviewActionForMenuWithConfiguration:animator:]):
2327         (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
2328         (-[WKContentView contextMenuInteractionWillPresent:]): Deleted.
2329         (-[WKContentView contextMenuInteraction:willCommitWithAnimator:]): Deleted.
2330         (-[WKContentView contextMenuInteractionDidEnd:]): Deleted.
2331
2332 2019-08-08  Simon Fraser  <simon.fraser@apple.com>
2333
2334         [iOS WK2] Hide previews when an inner overflow or frame scrollview scrolls
2335         https://bugs.webkit.org/show_bug.cgi?id=200552
2336         rdar://problem/54086338
2337
2338         Reviewed by Wenson Hsieh.
2339
2340         Give UITargetedPreview the UIScrollView that the target element is inside of,
2341         so it can clean up if the user starts to scroll that view.
2342
2343         * Platform/spi/ios/UIKitSPI.h:
2344         * UIProcess/ios/WKContentViewInteraction.mm:
2345         (-[WKContentView _createTargetedPreviewIfPossible]):
2346
2347 2019-08-08  Chris Dumez  <cdumez@apple.com>
2348
2349         Add threading assertions to WebStorage code
2350         https://bugs.webkit.org/show_bug.cgi?id=200550
2351
2352         Reviewed by Geoffrey Garen.
2353
2354         Add threading assertions to WebStorage code for extra safety.
2355
2356         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
2357         (WebKit::LocalStorageNamespace::LocalStorageNamespace):
2358         (WebKit::LocalStorageNamespace::~LocalStorageNamespace):
2359         (WebKit::LocalStorageNamespace::getOrCreateStorageArea):
2360         (WebKit::LocalStorageNamespace::clearStorageAreasMatchingOrigin):
2361         (WebKit::LocalStorageNamespace::clearAllStorageAreas):
2362         (WebKit::LocalStorageNamespace::ephemeralOrigins const):
2363         (WebKit::LocalStorageNamespace::cloneTo):
2364         * NetworkProcess/WebStorage/SessionStorageNamespace.cpp:
2365         (WebKit::SessionStorageNamespace::SessionStorageNamespace):
2366         (WebKit::SessionStorageNamespace::~SessionStorageNamespace):
2367         (WebKit::SessionStorageNamespace::addAllowedConnection):
2368         (WebKit::SessionStorageNamespace::removeAllowedConnection):
2369         (WebKit::SessionStorageNamespace::getOrCreateStorageArea):
2370         (WebKit::SessionStorageNamespace::cloneTo):
2371         (WebKit::SessionStorageNamespace::origins const):
2372         (WebKit::SessionStorageNamespace::clearStorageAreasMatchingOrigin):
2373         (WebKit::SessionStorageNamespace::clearAllStorageAreas):
2374         * NetworkProcess/WebStorage/StorageArea.cpp:
2375         (WebKit::StorageArea::StorageArea):
2376         (WebKit::StorageArea::~StorageArea):
2377         (WebKit::StorageArea::addListener):
2378         (WebKit::StorageArea::removeListener):
2379         (WebKit::StorageArea::hasListener const):
2380         (WebKit::StorageArea::clone const):
2381         (WebKit::StorageArea::setItem):
2382         (WebKit::StorageArea::setItems):
2383         (WebKit::StorageArea::removeItem):
2384         (WebKit::StorageArea::clear):
2385         (WebKit::StorageArea::items const):
2386         (WebKit::StorageArea::openDatabaseAndImportItemsIfNeeded const):
2387         (WebKit::StorageArea::dispatchEvents const):
2388         * NetworkProcess/WebStorage/StorageManager.cpp:
2389         (WebKit::StorageManager::createSessionStorageNamespace):
2390         (WebKit::StorageManager::destroySessionStorageNamespace):
2391         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection):
2392         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
2393         (WebKit::StorageManager::cloneSessionStorageNamespace):
2394         (WebKit::StorageManager::processDidCloseConnection):
2395         (WebKit::StorageManager::getSessionStorageOrigins):
2396         (WebKit::StorageManager::deleteSessionStorageOrigins):
2397         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
2398         (WebKit::StorageManager::getLocalStorageOrigins):
2399         (WebKit::StorageManager::getLocalStorageOriginDetails):
2400         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
2401         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
2402         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
2403         (WebKit::StorageManager::waitUntilTasksFinished):
2404         (WebKit::StorageManager::suspend):
2405         (WebKit::StorageManager::resume):
2406         (WebKit::StorageManager::findStorageArea const):
2407         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
2408         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
2409         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp:
2410         (WebKit::TransientLocalStorageNamespace::TransientLocalStorageNamespace):
2411         (WebKit::TransientLocalStorageNamespace::~TransientLocalStorageNamespace):
2412         (WebKit::TransientLocalStorageNamespace::getOrCreateStorageArea):
2413         (WebKit::TransientLocalStorageNamespace::origins const):
2414         (WebKit::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin):
2415         (WebKit::TransientLocalStorageNamespace::clearAllStorageAreas):
2416
2417 2019-08-08  Brent Fulgham  <bfulgham@apple.com>
2418
2419         [FTW] Get WebKit, WebKit2, and MiniBrowser building and executing
2420         https://bugs.webkit.org/show_bug.cgi?id=200539
2421         <rdar://problem/54082550>
2422
2423         Reviewed by Dean Jackson.
2424
2425         * PlatformFTW.cmake: Added.
2426         * Shared/ShareableBitmap.h:
2427         * Shared/win/ShareableBitmapDirect2D.cpp: Added.
2428         * UIProcess/BackingStore.cpp:
2429         * UIProcess/BackingStore.h:
2430         (WebKit::BackingStore::renderTarget):
2431         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
2432         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
2433         * UIProcess/win/BackingStoreDirect2D.cpp: Added.
2434         * UIProcess/win/WebInspectorProxyWin.cpp:
2435         (WebKit::WebInspectorProxy::inspectorPageURL):
2436         (WebKit::WebInspectorProxy::inspectorTestPageURL):
2437         (WebKit::WebInspectorProxy::inspectorBaseURL):
2438         * UIProcess/win/WebView.cpp:
2439         (WebKit::WebView::paint):
2440         * UIProcess/win/WebView.h:
2441         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2442         (WebKit::DrawingAreaCoordinatedGraphics::display):
2443         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
2444         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
2445         (WebKit::WebInspectorUI::localizedStringsURL):
2446         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
2447         * WebProcess/win/WebProcessMainWin.cpp:
2448         (WebKit::WebProcessMainWin):
2449
2450 2019-08-08  Per Arne Vollan  <pvollan@apple.com>
2451
2452         [Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions
2453         https://bugs.webkit.org/show_bug.cgi?id=200543
2454
2455         Reviewed by Brent Fulgham.
2456
2457         Adopt SPI to issue a process-specific sandbox extension for local file read, passing it the process
2458         identifier of the WebContent process.
2459
2460         * Shared/Cocoa/SandboxExtensionCocoa.mm:
2461         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
2462         (WebKit::SandboxExtension::createHandleForReadByPid):
2463         * Shared/SandboxExtension.h:
2464         * UIProcess/WebPageProxy.cpp:
2465         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2466
2467 2019-08-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2468
2469         [iOS] Position image information should respect the image orientation
2470         https://bugs.webkit.org/show_bug.cgi?id=200487
2471
2472         Reviewed by Simon Fraser.
2473
2474         imagePositionInformation() should respect the image orientation when
2475         drawing an Image to a ShareableBitmap context.
2476
2477         boundsPositionInformation() already takes care of the image orientation
2478         because it gets RenderImage::enclosingBoundingBox().
2479
2480         * WebProcess/WebPage/ios/WebPageIOS.mm:
2481         (WebKit::imagePositionInformation):
2482
2483 2019-08-08  Timothy Hatcher  <timothy@apple.com>
2484
2485         Set WKWebView opaque based on drawsBackground in PageConfiguration.
2486         https://bugs.webkit.org/show_bug.cgi?id=200528
2487
2488         Reviewed by Tim Horton.
2489
2490         * UIProcess/API/Cocoa/WKWebView.mm:
2491         (-[WKWebView _initializeWithConfiguration:]): Set self.opaque = NO when !self.opaque || !pageConfiguration->drawsBackground().
2492         It is almost impossible to have !self.opaque be NO at this point, since we are still inside initWithFrame:. A subclass could
2493         override opaque and return NO, but checking pageConfiguration's drawsBackground is a good alternative.
2494         * WebProcess/WebPage/WebPage.h: Remove unused m_drawsBackground member.
2495
2496 2019-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2497
2498         [iOS 13] Taps that interrupt momentum scrolling are recognized as clicks
2499         https://bugs.webkit.org/show_bug.cgi?id=200516
2500         <rdar://problem/53889373>
2501
2502         Reviewed by Tim Horton.
2503
2504         After <https://trac.webkit.org/r247656>, the -tracksImmediatelyWhileDecelerating property of WKScrollView and
2505         WKChildScrollView is set to NO. This means that if a user interacts with the page while the scroll view is
2506         decelerating (e.g. after momentum scrolling), the pan gesture recognizer will not be immediately recognized.
2507         This gives other gesture recognizers, such as the synthetic click (single tap) gesture a chance to instead
2508         recognize first. In this particular bug, this causes taps on the web view that are intended to only stop
2509         momentum scrolling to instead activate clickable elements beneath the touch, such as links and buttons.
2510
2511         To mitigate this, we add some logic to prevent the click gesture recognizer from firing in the case where the
2512         tap also causes the scroll view to decelerate. This heuristic is similar to the one introduced in r219310, which
2513         has the same purpose of hiding gestures that stop momentum scrolling from the page, and also consults
2514         -[UIScrollView _isInterruptingDeceleration].
2515
2516         Tests:  fast/scrolling/ios/click-events-during-momentum-scroll-in-main-frame.html
2517                 fast/scrolling/ios/click-events-during-momentum-scroll-in-overflow-after-tap-on-body.html
2518                 fast/scrolling/ios/click-events-during-momentum-scroll-in-overflow.html
2519
2520         * UIProcess/ios/WKContentViewInteraction.mm:
2521         (-[WKContentView gestureRecognizerShouldBegin:]):
2522
2523         Return NO in the case of the single tap gesture if the UIScrollView most recently touched by the single tap
2524         gesture (or one of its enclosing scroll views, up to the main WKScrollView) is being interrupted while
2525         decelerating.
2526
2527         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
2528         * UIProcess/ios/WKSyntheticTapGestureRecognizer.mm:
2529         (-[WKSyntheticTapGestureRecognizer reset]):
2530         (-[WKSyntheticTapGestureRecognizer touchesBegan:withEvent:]):
2531
2532         Teach WKSyntheticTapGestureRecognizer to keep track of the last WKScrollView that was touched, for later use in
2533         -gestureRecognizerShouldBegin:. To do this, we keep a weak reference to the first UIScrollView we find in the
2534         set of touches.
2535
2536         (-[WKSyntheticTapGestureRecognizer lastTouchedScrollView]):
2537
2538 2019-08-08  Dean Jackson  <dino@apple.com>
2539
2540         Use "safari" glyph for "Show Link Previews" contextual menu
2541         https://bugs.webkit.org/show_bug.cgi?id=200544
2542         <rdar://problem/54087842>
2543
2544         Reviewed by Tim Horton.
2545
2546         Use the system image for the compass.
2547
2548         * UIProcess/API/Cocoa/_WKElementAction.mm:
2549         (+[_WKElementAction imageForElementActionType:]):
2550
2551 2019-08-08  Chris Dumez  <cdumez@apple.com>
2552
2553         Move classes declared inside StorageManager.cpp into their own headers
2554         https://bugs.webkit.org/show_bug.cgi?id=200527
2555
2556         Reviewed by Alex Christensen.
2557
2558         Move classes declared inside StorageManager.cpp into their own headers
2559         for clarity. StorageManager.cpp was getting really big.
2560
2561         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp: Added.
2562         (WebKit::LocalStorageNamespace::LocalStorageNamespace):
2563         (WebKit::LocalStorageNamespace::~LocalStorageNamespace):
2564         (WebKit::LocalStorageNamespace::getOrCreateStorageArea):
2565         (WebKit::LocalStorageNamespace::clearStorageAreasMatchingOrigin):
2566         (WebKit::LocalStorageNamespace::clearAllStorageAreas):
2567         (WebKit::LocalStorageNamespace::ephemeralOrigins const):
2568         (WebKit::LocalStorageNamespace::cloneTo):
2569         * NetworkProcess/WebStorage/LocalStorageNamespace.h: Added.
2570         (WebKit::LocalStorageNamespace::create):
2571         (WebKit::LocalStorageNamespace::storageManager const):
2572         * NetworkProcess/WebStorage/SessionStorageNamespace.cpp: Added.
2573         (WebKit::SessionStorageNamespace::SessionStorageNamespace):
2574         (WebKit::SessionStorageNamespace::~SessionStorageNamespace):
2575         (WebKit::SessionStorageNamespace::addAllowedConnection):
2576         (WebKit::SessionStorageNamespace::removeAllowedConnection):
2577         (WebKit::SessionStorageNamespace::getOrCreateStorageArea):
2578         (WebKit::SessionStorageNamespace::cloneTo):
2579         (WebKit::SessionStorageNamespace::origins const):
2580         (WebKit::SessionStorageNamespace::clearStorageAreasMatchingOrigin):
2581         (WebKit::SessionStorageNamespace::clearAllStorageAreas):
2582         * NetworkProcess/WebStorage/SessionStorageNamespace.h: Added.
2583         (WebKit::SessionStorageNamespace::create):
2584         (WebKit::SessionStorageNamespace::isEmpty const):
2585         (WebKit::SessionStorageNamespace::allowedConnections const):
2586         * NetworkProcess/WebStorage/StorageArea.cpp: Added.
2587         (WebKit::StorageArea::StorageArea):
2588         (WebKit::StorageArea::~StorageArea):
2589         (WebKit::StorageArea::addListener):
2590         (WebKit::StorageArea::removeListener):
2591         (WebKit::StorageArea::hasListener const):
2592         (WebKit::StorageArea::clone const):
2593         (WebKit::StorageArea::setItem):
2594         (WebKit::StorageArea::setItems):
2595         (WebKit::StorageArea::removeItem):
2596         (WebKit::StorageArea::clear):
2597         (WebKit::StorageArea::items const):
2598         (WebKit::StorageArea::openDatabaseAndImportItemsIfNeeded const):
2599         (WebKit::StorageArea::dispatchEvents const):
2600         * NetworkProcess/WebStorage/StorageArea.h: Added.
2601         (WebKit::StorageArea::create):
2602         (WebKit::StorageArea::securityOrigin const):
2603         (WebKit::StorageArea::isEphemeral const):
2604         * NetworkProcess/WebStorage/StorageManager.cpp:
2605         (WebKit::StorageManager::createLocalStorageMap):
2606         (WebKit::StorageManager::findStorageArea const):
2607         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
2608         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
2609         * NetworkProcess/WebStorage/StorageManager.h:
2610         (WebKit::StorageManager::create):
2611         (WebKit::StorageManager::localStorageDatabaseTracker const):
2612         (WebKit::StorageManager::workQueue const):
2613         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp: Added.
2614         (WebKit::TransientLocalStorageNamespace::TransientLocalStorageNamespace):
2615         (WebKit::TransientLocalStorageNamespace::~TransientLocalStorageNamespace):
2616         (WebKit::TransientLocalStorageNamespace::getOrCreateStorageArea):
2617         (WebKit::TransientLocalStorageNamespace::origins const):
2618         (WebKit::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin):
2619         (WebKit::TransientLocalStorageNamespace::clearAllStorageAreas):
2620         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.h: Added.
2621         (WebKit::TransientLocalStorageNamespace::create):
2622         * NetworkProcess/cache/NetworkCache.cpp:
2623         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
2624         * Sources.txt:
2625         * WebKit.xcodeproj/project.pbxproj:
2626
2627 2019-08-08  Rob Buis  <rbuis@igalia.com>
2628
2629         Add runtime flag for lazy image loading
2630         https://bugs.webkit.org/show_bug.cgi?id=199794
2631
2632         Reviewed by Darin Adler.
2633
2634         Add LazyImageLoading preference.
2635
2636         * Shared/WebPreferences.yaml:
2637         * UIProcess/API/C/WKPreferences.cpp:
2638         (WKPreferencesSetLazyImageLoadingEnabled):
2639         (WKPreferencesGetLazyImageLoadingEnabled):
2640         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2641
2642 2019-08-07  Chris Dumez  <cdumez@apple.com>
2643
2644         Turn some ITP threading ASSERTs into RELEASE_ASSERTs
2645         https://bugs.webkit.org/show_bug.cgi?id=200521
2646
2647         Reviewed by Ryosuke Niwa.
2648
2649         Turn some ITP threading ASSERTs into RELEASE_ASSERTs to help catch more bugs.
2650
2651         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2652         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
2653         (WebKit::ResourceLoadStatisticsMemoryStore::isEmpty const):
2654         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
2655         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
2656         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage):
2657         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2658         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2659         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
2660         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2661
2662 2019-08-07  Kate Cheney  <katherine_cheney@apple.com>
2663
2664         Adopt non-deprecated CGColorSpace API
2665         https://bugs.webkit.org/show_bug.cgi?id=184358
2666
2667         Reviewed by Darin Adler.
2668
2669         * Shared/mac/ColorSpaceData.mm:
2670         (WebKit::ColorSpaceData::decode):
2671
2672         We changed the deprecated CGColorSpaceCreateWithICCProfile function to 
2673         CGColorSpaceCreateWithICCData. 
2674
2675 2019-08-07  Alex Christensen  <achristensen@webkit.org>
2676
2677         Remove speculative workaround for upload crash
2678         https://bugs.webkit.org/show_bug.cgi?id=200514
2679
2680         Reviewed by Geoffrey Garen.
2681
2682         This workaround didn't help anyways, and the crash has been resolved.  Let's clean up.
2683
2684         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2685         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
2686
2687 2019-08-07  Chris Dumez  <cdumez@apple.com>
2688
2689         Regression(r247784) ResourceLoadStatisticsMemoryStore / ResourceLoadStatisticsPersistentStorage may get destroyed on the wrong thread
2690         https://bugs.webkit.org/show_bug.cgi?id=200517
2691
2692         Reviewed by Geoffrey Garen.
2693
2694         The issue is that WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore() is null checking
2695         m_persistentStorage and m_statisticsStore on the main thread, even though those members are initialized
2696         and destroyed on the background thread. As a result, if flushAndDestroyPersistentStore() is called *before*
2697         the background task to initialize those members has had a chance to run, then we'd return early without
2698         destroying those members. Later on, the background task would then initialize those data members and we
2699         would then destroy them on the main thread when the WebResourceLoadStatisticsStore is destroyed on the
2700         main thread.
2701
2702         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2703         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2704
2705 2019-08-06  Dean Jackson  <dino@apple.com>
2706
2707         Context menu on a universal link produces a blank preview
2708         https://bugs.webkit.org/show_bug.cgi?id=200485
2709         <rdar://problem/53699620>
2710
2711         Reviewed by Tim Horton.
2712
2713         If the context menu is activated on an iTunesStore URL, pass it
2714         on to DataDetectors, who should know how to handle it.
2715
2716         Two drive-by fixes:
2717         - make it clear that early returns do not produce a value. Instead call the
2718           completion handler first, then return.
2719         - The new API DataDetectors case doesn't need to worry about hiding link previews
2720           as DataDetectors itself will handle that.
2721
2722         * UIProcess/ios/WKContentViewInteraction.mm: If the URL is an iTunesStoreURL
2723         (as defined by CoreServices), let DataDetectors handle it.
2724         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
2725         (-[WKContentView continueContextMenuInteraction:]):
2726         (-[WKContentView continueContextMenuInteractionWithDataDetectors:]): New method to
2727         use DataDetectors if possible.
2728
2729 2019-08-08  Simon Fraser  <simon.fraser@apple.com>
2730
2731         Add to InteractionInformationAtPosition information about whether the element is in a subscrollable region
2732         https://bugs.webkit.org/show_bug.cgi?id=200374
2733         rdar://problem/54095519
2734
2735         Reviewed by Tim Horton.
2736         
2737         Add InteractionInformationAtPosition.containerScrollingNodeID and initialize it in elementPositionInformation()
2738         by asking the scrolling coordinator.
2739         
2740         Also add a way to get from a ScrollingNodeID to a UIScrollView to RemoteScrollingCoordinatorProxy,
2741         which gets the scrolling node and asks the delegate for the UIView.
2742
2743         * Shared/ios/InteractionInformationAtPosition.h:
2744         * Shared/ios/InteractionInformationAtPosition.mm:
2745         (WebKit::InteractionInformationAtPosition::encode const):
2746         (WebKit::InteractionInformationAtPosition::decode):
2747         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
2748         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2749         (WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
2750         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
2751         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
2752         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollView const):
2753         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
2754         * WebProcess/WebPage/ios/WebPageIOS.mm:
2755         (WebKit::elementPositionInformation):
2756
2757 2019-08-07  Priyanka Agarwal  <pagarwal999@apple.com>
2758
2759         Allow clients to toggle a text input field between being viewable and having characters hidden while maintaining 
2760         a yellow auto-filled appearance
2761         https://bugs.webkit.org/show_bug.cgi?id=200037
2762         rdar://problem/51900961
2763
2764         Reviewed by Daniel Bates.
2765
2766         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
2767         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
2768         (-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilledAndViewable]):
2769         Accessor function for boolean which represents if the input element is autofilled and viewable.
2770
2771         (-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilledAndViewable:]):
2772         Setter function for boolean which represents if the input element is autofilled and viewable.
2773
2774         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
2775         (WKBundleNodeHandleSetHTMLInputElementAutoFilledAndViewable):
2776         Accessor function for boolean which represents if the input element is autofilled and viewable.
2777
2778        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
2779         Creating function declaration for boolean setter.
2780
2781         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
2782         Accessor function for boolean which represents if the input element is autofilled and viewable.
2783
2784         (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilledAndViewable const):
2785         Setter function for boolean which represents if the input element is autofilled and viewable.
2786
2787         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilledAndViewable):
2788         Setter function for boolean which represents if the input element is autofilled and viewable.
2789
2790         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
2791         Adding setter and getter functions for the boolean which represents if the input element is autofilled
2792         and viewable.
2793
2794 2019-08-07  Chris Dumez  <cdumez@apple.com>
2795
2796         Add more threading assertions to ITP code
2797         https://bugs.webkit.org/show_bug.cgi?id=200505
2798
2799         Reviewed by Brent Fulgham.
2800
2801         Add more threading assertions to ITP code to help catch bugs and protect against future bad usage.
2802
2803         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2804         (WebKit::ResourceLoadStatisticsMemoryStore::isEmpty const):
2805         (WebKit::ResourceLoadStatisticsMemoryStore::setPersistentStorage):
2806         (WebKit::ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains):
2807         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
2808         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded):
2809         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately):
2810         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains):
2811         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
2812         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2813         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
2814         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
2815         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2816         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
2817         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2818         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2819         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
2820         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
2821         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
2822         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
2823         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
2824         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2825         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
2826         (WebKit::WebResourceLoadStatisticsStore::networkSession):
2827         (WebKit::WebResourceLoadStatisticsStore::invalidateAndCancel):
2828         (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const):
2829         (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const):
2830
2831 2019-08-07  Ryan Haddad  <ryanhaddad@apple.com>
2832
2833         Unreviewed, rolling out r248330.
2834
2835         Breaks internal builds.
2836
2837         Reverted changeset:
2838
2839         "Context menu on a universal link produces a blank preview"
2840         https://bugs.webkit.org/show_bug.cgi?id=200485
2841         https://trac.webkit.org/changeset/248330
2842
2843 2019-08-06  Ryosuke Niwa  <rniwa@webkit.org>
2844
2845         [iPadOS] slides.google.com: tapping near cursor in a slide title focuses the speaker notes
2846         https://bugs.webkit.org/show_bug.cgi?id=200216
2847
2848         Reviewed by Wenson Hsieh.
2849
2850         The bug was caused by a race condition between Google slides removing inputmode="none" from the hidden
2851         content editable and updating the focused region upon receiving a pointerup event, which happens after
2852         the Google slides had already updated its page layout & coordinates based on new visual viewport with
2853         the software keyboard's boudning rect taken into account.
2854
2855         Delay bringing up the software keyboard for a inputmode change until all touches are released.
2856
2857         In the future, we could consider also delaying the software keyboard to be brought in general until
2858         touchend / pointerup events are dispatched but this is rather risky since that could affact random
2859         other websites while Google suites is the only major site to make use of inputmode="none".
2860
2861         This patch also reverts r243044, which was added for Google slides, since it's no longer needed and
2862         interferes with this patch by adding another way to bring up the software keyboard.
2863
2864         Note: Adjusting touchend / pointerup coordinates while the keyboard is being brought up doesn't work
2865         because the page had already updated the layout by then based on new visual viewport size.
2866
2867         Test: fast/forms/ios/inputmode-change-update-keyboard-after-pointerup.html
2868
2869         * UIProcess/WebPageProxy.cpp:
2870         (WebKit::WebPageProxy::handleTouchEventSynchronously): Call didReleaseAllTouchPoints when all
2871         touches are released.
2872         (WebKit::WebPageProxy::handleTouchEventAsynchronously): Ditto.
2873         (WebKit::WebPageProxy::handleTouchEvent): Ditto.
2874         * UIProcess/WebPageProxy.h:
2875         (WebKit::WebPageProxy::didReleaseAllTouchPoints): Added for non-iOS platforms.
2876         (WebKit::WebPageProxy::m_pendingInputModeChange): Added. Used when inputmode is changed while
2877         there is an on-going touch interaction.
2878         * UIProcess/ios/WebPageProxyIOS.mm:
2879         (WebKit::WebPageProxy::elementDidFocus): Clear m_pendingInputModeChange when a new element is focused.
2880         (WebKit::WebPageProxy::elementDidBlur): Ditto for bluring.
2881         (WebKit::WebPageProxy::focusedElementDidChangeInputMode): Don't bring up the software keyboard now if
2882         there are on-going touches by exiting early after setting m_pendingInputModeChange.
2883         (WebKit::WebPageProxy::didReleaseAllTouchPoints): Bring up the software keyboard if inputmode
2884         had changed from "none" to something else.
2885         * WebProcess/WebPage/WebPage.cpp:
2886         (WebKit::WebPage::dispatchTouchEvent): Removed the code added by r243044.
2887
2888 2019-08-06  Fujii Hironori  <Hironori.Fujii@sony.com>
2889
2890         ASSERTION FAILED: m_observers.isEmpty() if WKPageSetPageStateClient is used
2891         https://bugs.webkit.org/show_bug.cgi?id=200465
2892
2893         Reviewed by Alex Christensen.
2894
2895         PageLoadState::Observer should be removed before destructing
2896         WebPageProxy.
2897
2898         * UIProcess/WebPageProxy.cpp:
2899         (WebKit::WebPageProxy::~WebPageProxy): Call
2900         setPageLoadStateObserver with nullptr to remove
2901         PageLoadState::Observer.
2902
2903 2019-08-06  Chris Dumez  <cdumez@apple.com>
2904
2905         Add release assertions to help catch a bug in our WebProcessCache implementation
2906         https://bugs.webkit.org/show_bug.cgi?id=200483
2907
2908         Reviewed by Geoffrey Garen.
2909
2910         Add release assertions to help catch a bug in our WebProcessCache implementation. We
2911         have evidence (rdar://problem/53962494) that we have processes with a page which
2912         starts a provisional load while the process is in the WebProcessCache. This should
2913         not be possible.
2914
2915         * UIProcess/WebProcessProxy.cpp:
2916         (WebKit::WebProcessProxy::setIsInProcessCache):
2917         (WebKit::WebProcessProxy::addExistingWebPage):
2918
2919 2019-08-06  Dean Jackson  <dino@apple.com>
2920
2921         Context menu on a universal link produces a blank preview
2922         https://bugs.webkit.org/show_bug.cgi?id=200485
2923         <rdar://problem/53699620>
2924
2925         Reviewed by Dean Jackson.
2926
2927         If the context menu is activated on an iTunesStore URL, pass it
2928         on to DataDetectors, who should know how to handle it.
2929
2930         Two drive-by fixes:
2931         - make it clear that early returns do not produce a value. Instead call the
2932           completion handler first, then return.
2933         - The new API DataDetectors case doesn't need to worry about hiding link previews
2934           as DataDetectors itself will handle that.
2935
2936         * UIProcess/ios/WKContentViewInteraction.mm: If the URL is an iTunesStoreURL
2937         (as defined by CoreServices), let DataDetectors handle it.
2938         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
2939         (-[WKContentView continueContextMenuInteraction:]):
2940         (-[WKContentView continueContextMenuInteractionWithDataDetectors:]): New method to
2941         use DataDetectors if possible.
2942
2943 2019-08-06  Chris Dumez  <cdumez@apple.com>
2944
2945         Avoid unnecessary ResourceRequest copy under NetworkResourceLoader::isCrossOriginPrefetch()
2946         https://bugs.webkit.org/show_bug.cgi?id=200478
2947
2948         Reviewed by Youenn Fablet.
2949
2950         * NetworkProcess/NetworkResourceLoader.cpp:
2951         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
2952
2953 2019-08-06  Jiewen Tan  <jiewen_tan@apple.com>
2954
2955         Unreviewed, a build fix after r248319
2956
2957         Use HAVE(DATA_PROTECTION_KEYCHAIN) instead of HAVE_DATA_PROTECTION_KEYCHAIN.
2958
2959         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2960         (WebKit::LocalAuthenticator::makeCredential):
2961         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
2962         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
2963         (WebKit::LocalAuthenticator::getAssertion):
2964         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
2965
2966 2019-08-06  Jiewen Tan  <jiewen_tan@apple.com>
2967
2968         Unreviewed, a build fix after r248308
2969
2970         Use kSecUseDataProtectionKeychain for iOS 13 and macOS Catalina or newer.
2971
2972         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2973         (WebKit::LocalAuthenticator::makeCredential):
2974         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
2975         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
2976         (WebKit::LocalAuthenticator::getAssertion):
2977         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
2978
2979 2019-08-06  Chris Dumez  <cdumez@apple.com>
2980
2981         Unreviewed, fix internal iOS build after r248308.
2982
2983         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2984         (WebKit::LocalAuthenticator::makeCredential):
2985
2986 2019-08-06  Jiewen Tan  <jiewen_tan@apple.com>
2987
2988         [WebAuthN] Enable LocalAuthenticator for macOS
2989         https://bugs.webkit.org/show_bug.cgi?id=182772
2990         <rdar://problem/43347920>
2991
2992         Reviewed by Brent Fulgham.
2993
2994         This patch enables LocalAuthenticator for macOS. The majority
2995         of this patch is to tweak macOS keychain to use the modern one.
2996
2997         * Configurations/WebKit.xcconfig:
2998         * Platform/spi/Cocoa/DeviceIdentitySPI.h:
2999         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3000         (WebKit::LocalAuthenticatorInternal::toVector):
3001         (WebKit::LocalAuthenticator::makeCredential):
3002         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
3003         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
3004         (WebKit::LocalAuthenticator::getAssertion):
3005         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
3006         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
3007         (WebKit::LocalConnection::getUserConsent const):
3008         (WebKit::LocalConnection::getAttestation const):
3009         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
3010         (WebKit::LocalService::isAvailable):
3011         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3012         (WebKit::MockLocalConnection::getAttestation const):
3013         * config.h:
3014
3015 2019-08-06  Jer Noble  <jer.noble@apple.com>
3016
3017         Add test for behavior introduced in r248174
3018         https://bugs.webkit.org/show_bug.cgi?id=200446
3019
3020         Reviewed by Eric Carlson.
3021
3022         Add a new helper struct, FullscreenTouchSecheuristicParameters, and static getter,
3023         iosParameters(), to allow the settings used by WKFullScreenViewController to be tested
3024         in TestWebKitAPI. Make both of the Secheuristic classes privately exported as well.
3025
3026         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp:
3027         (WebKit::FullscreenTouchSecheuristic::scoreOfNextTouch):
3028         (WebKit::FullscreenTouchSecheuristic::reset):
3029         (WebKit::FullscreenTouchSecheuristic::distanceScore):
3030         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
3031         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h:
3032         (WebKit::FullscreenTouchSecheuristic::setParameters):
3033         (WebKit::FullscreenTouchSecheuristic::requiredScore const):
3034         (WebKit::FullscreenTouchSecheuristic::setRampUpSpeed):
3035         (WebKit::FullscreenTouchSecheuristic::setRampDownSpeed):
3036         (WebKit::FullscreenTouchSecheuristic::setXWeight):
3037         (WebKit::FullscreenTouchSecheuristic::setYWeight):
3038         (WebKit::FullscreenTouchSecheuristic::setGamma):
3039         (WebKit::FullscreenTouchSecheuristic::setGammaCutoff):
3040         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristicParameters.cpp: Copied from Source/WebKit/UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h.
3041         (WebKit::FullscreenTouchSecheuristicParameters::iosParameters):
3042         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristicParameters.h: Copied from Source/WebKit/UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h.
3043         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3044         (-[WKFullScreenViewController initWithWebView:]):
3045         (-[WKFullScreenViewController _touchDetected:]):
3046         * WebKit.xcodeproj/project.pbxproj:
3047
3048 2019-08-06  Claudio Saavedra  <csaavedra@igalia.com>
3049
3050         [GLIB] Fix documentation typo
3051
3052         Unreviewed.
3053
3054         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
3055
3056 2019-08-05  Fujii Hironori  <Hironori.Fujii@sony.com>
3057
3058         [Win][MiniBrowser][WK2] Unhandled key events should be bubbled up to the parent window
3059         https://bugs.webkit.org/show_bug.cgi?id=200464
3060
3061         Reviewed by Ross Kirsling.
3062
3063         * UIProcess/API/C/WKNativeEvent.h: Define WKNativeEventPtr for WIN32.
3064
3065 2019-08-05  Youenn Fablet  <youenn@apple.com>
3066
3067         Support RTCRtpSender.dtmf
3068         https://bugs.webkit.org/show_bug.cgi?id=200431
3069
3070         Reviewed by Eric Carlson.
3071
3072         * Shared/WebPreferences.yaml:
3073
3074 2019-08-05  Simon Fraser  <simon.fraser@apple.com>
3075
3076         iOS 13: Overflow:hidden on body prevents PDF scroll
3077         https://bugs.webkit.org/show_bug.cgi?id=200435
3078         rdar://problem/53942888
3079
3080         Reviewed by Tim Horton.
3081
3082         When we navigate from an overflow:hidden HTML page to a custom view (like PDF), we need
3083         to make sure that the scroll view is scrollable.
3084
3085         * UIProcess/API/Cocoa/WKWebView.mm:
3086         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
3087
3088 2019-08-05  John Wilander  <wilander@apple.com>
3089
3090         Resource Load Statistics: Re-introduce latch mode for subresource cookie blocking
3091         https://bugs.webkit.org/show_bug.cgi?id=200395
3092         <rdar://problem/53869611>
3093
3094         Reviewed by Darin Adler.
3095
3096         Back when we had a relaxation of cookie blocking 24 hours after first-party user
3097         interaction, we made sure cookie blocking could be turned on and off in subresource
3098         redirect chains. The 24 hour window is now long gone. This patch simplifies the
3099         cookie blocking so that once a subresource request is denied cookies, any
3100         subsequent redirect of that request will also be denied cookies, regardless of the
3101         classification status of the domains involved. I call it latch mode.
3102
3103         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3104         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3105         (WebKit::NetworkDataTaskCocoa::blockCookies):
3106         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3107         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3108         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): Deleted.
3109
3110 2019-08-05  Youenn Fablet  <youenn@apple.com>
3111
3112         Disable speculative loading if cache is not to be used for the load
3113         https://bugs.webkit.org/show_bug.cgi?id=199644
3114
3115         Reviewed by Alex Christensen.
3116
3117         When the page is reloaded, loads are instructed to not use the cache.
3118         It is therefore unneeded to do speculative revalidation.
3119         Allow speculative revalidation if the cache policy is either the default HTTP policy or
3120         if policy is to refresh all cache data.
3121         Covered by added test.
3122
3123         * NetworkProcess/cache/NetworkCache.cpp:
3124         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
3125         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
3126
3127 2019-08-04  Konstantin Tokarev  <annulen@yandex.ru>
3128
3129         Remove unused lambda capture in MemoryPressureMonitor
3130         https://bugs.webkit.org/show_bug.cgi?id=200420
3131
3132         Reviewed by Darin Adler.
3133
3134         * UIProcess/linux/MemoryPressureMonitor.cpp:
3135         (WebKit::MemoryPressureMonitor::start):
3136
3137 2019-08-03  Konstantin Tokarev  <annulen@yandex.ru>
3138
3139         Fix compilation with disabled WebGL
3140         https://bugs.webkit.org/show_bug.cgi?id=200421
3141
3142         Reviewed by Wenson Hsieh.
3143
3144         After r247452 webGLStateTracker is guarded with #if ENABLE(WEBGL)
3145
3146         * WebProcess/WebPage/WebPage.cpp:
3147         (WebKit::m_textAutoSizingAdjustmentTimer):
3148
3149 2019-08-02  Keith Rollin  <krollin@apple.com>
3150
3151         Consistently use Obj-C boolean literals
3152         https://bugs.webkit.org/show_bug.cgi?id=200405
3153         <rdar://problem/53880043>
3154
3155         Reviewed by Simon Fraser, Joseph Pecoraro.
3156
3157         There are places where we use equivalent but different expressions for
3158         Obj-C boolean objects. For example, we use both [NSNumber
3159         numberWithBool:YES] and @YES. There are places where both are used in
3160         the same function, such as -[WebPreferences initialize]. The boolean
3161         literal is in greater use and is more succinct, so standardize on
3162         that. Also, change @(YES/NO) to @YES/NO.
3163
3164         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3165         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
3166         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3167         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3168         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
3169         (WebKit::LocalConnection::getAttestation const):
3170
3171 2019-08-02  Sihui Liu  <sihui_liu@apple.com>
3172
3173         API tests using permanent credentials should clear credentials left by previous tests
3174         https://bugs.webkit.org/show_bug.cgi?id=199729
3175
3176         Reviewed by Alex Christensen.
3177
3178         Permanent password credentials currently are shared across processes, so we don't need to clear them from 
3179         network process.
3180
3181         * NetworkProcess/NetworkProcess.cpp:
3182         (WebKit::NetworkProcess::clearPermanentCredentialsForProtectionSpace): Deleted.
3183         * NetworkProcess/NetworkProcess.h:
3184         * NetworkProcess/NetworkProcess.messages.in:
3185         * UIProcess/API/Cocoa/WKProcessPool.mm:
3186         (-[WKProcessPool _clearPermanentCredentialsForProtectionSpace:]):
3187         (-[WKProcessPool _clearPermanentCredentialsForProtectionSpace:completionHandler:]): Deleted.
3188         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3189         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3190         (WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace):
3191         * UIProcess/WebProcessPool.cpp:
3192         (WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace): Deleted.
3193         * UIProcess/WebProcessPool.h:
3194
3195 2019-08-02  Devin Rousso  <drousso@apple.com>
3196
3197         Web Inspector: Timelines: Develop > Start Timeline Recording doesn't work when focused on a detached inspector window
3198         https://bugs.webkit.org/show_bug.cgi?id=200125
3199         <rdar://problem/53543008>
3200
3201         Reviewed by Brian Burg.
3202
3203         Always show the Timelines tab in Web Inspector whenever timeline recording starts/stops.
3204         Notify the UIProcess whenever the timeline recording state changes.
3205
3206         * WebProcess/WebPage/WebInspector.messages.in:
3207         * WebProcess/WebPage/WebInspector.h:
3208         * WebProcess/WebPage/WebInspector.cpp:
3209         (WebKit::WebInspector::startPageProfiling):
3210         (WebKit::WebInspector::stopPageProfiling):
3211         (WebKit::WebInspector::timelineRecordingChanged): Added.
3212         (WebKit::WebInspector::showTimelines): Deleted.
3213
3214         * WebProcess/WebPage/WebInspectorUI.messages.in:
3215         * WebProcess/WebPage/WebInspectorUI.h:
3216         * WebProcess/WebPage/WebInspectorUI.cpp:
3217         (WebKit::WebInspectorUI::showTimelines): Deleted.
3218
3219         * WebProcess/WebCoreSupport/WebInspectorClient.h:
3220         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
3221         (WebKit::WebInspectorClient::timelineRecordingChanged): Added.
3222
3223         * UIProcess/WebInspectorProxy.messages.in:
3224         * UIProcess/WebInspectorProxy.h:
3225         * UIProcess/WebInspectorProxy.cpp:
3226         (WebKit::WebInspectorProxy::togglePageProfiling):
3227         (WebKit::WebInspectorProxy::timelineRecordingChanged): Added.
3228         (WebKit::WebInspectorProxy::showTimelines): Deleted.
3229
3230         * UIProcess/API/C/WKInspector.cpp:
3231         (WKInspectorTogglePageProfiling):
3232
3233         * UIProcess/API/Cocoa/_WKInspector.h:
3234         * UIProcess/API/Cocoa/_WKInspector.mm:
3235         (-[_WKInspector showTimelines]): Deleted.
3236
3237         * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp:
3238         (WKBundleInspectorSetPageProfilingEnabled):
3239
3240 2019-08-02  Jer Noble  <jer.noble@apple.com>
3241
3242         [iPadOS] slides.google.com: Full Screen API warning is presented when swiping through slides
3243         https://bugs.webkit.org/show_bug.cgi?id=200313
3244         <rdar://problem/53777001>
3245
3246         Reviewed by Eric Carlson.
3247
3248         Only run the secheuristic scoring during UIGestureRecognizerStateEnded, rather than both
3249         UIGestureRecognizerStateEnded and UIGestureRecognizerStateBegan. The goal of the heuristic is
3250         to detect fake on-screen keyboards by detecting gestures that look like "typing". Using only
3251         UIGestureRecognizerStateEnded still allows us to do this (as typing will usually have identical
3252         geometries for both Ended and Began) without generating false-positives during swipe gestures.
3253
3254         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3255         (-[WKFullScreenViewController _touchDetected:]):
3256
3257 2019-08-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3258
3259         [macOS 10.15] Image dragged from Safari does not appear in Notes
3260         https://bugs.webkit.org/show_bug.cgi?id=188490
3261         <rdar://problem/39462717>
3262
3263         Reviewed by Andy Estes.
3264
3265         Removes some logic that clears out the cached promised drag image in the UI process when WebKit is asked to
3266         provide TIFF image data. This prevents the drop destination from asking for promised image data, if anything
3267         else (e.g. the system) also asks the web view to provide the same data. Additionally, this logic didn't
3268         previously guarantee that the promised image would be cleared anyways, since it is dependent on the drop target
3269         actually requesting the promised image in order to perform the cleanup.
3270
3271         In lieu of clearing the promised drag image when it's requested, we instead clear it out upon mainframe
3272         navigation, in PageClientImpl::didCommitLoadForMainFrame.
3273
3274         Test: DragAndDropTests.MultiplePromisedImageDataRequests
3275
3276         * UIProcess/Cocoa/WebViewImpl.h:
3277         * UIProcess/Cocoa/WebViewImpl.mm:
3278         (WebKit::WebViewImpl::clearPromisedDragImage):
3279         (WebKit::WebViewImpl::pasteboardChangedOwner):
3280         (WebKit::WebViewImpl::provideDataForPasteboard):
3281
3282         Fix the bug by not immediately clearing out the promised drag image.
3283
3284         * UIProcess/mac/PageClientImplMac.mm:
3285         (WebKit::PageClientImpl::didCommitLoadForMainFrame):
3286
3287 2019-08-02  Keith Rollin  <krollin@apple.com>
3288
3289         macCatalyst build fails the first attempt, requires a second build
3290         https://bugs.webkit.org/show_bug.cgi?id=200242
3291         <rdar://problem/53678481>
3292
3293         macCatalyst builds fail the first time with an error like:
3294
3295             Code Signing Error: The file
3296             "/Users/tim_cook/Build/Debug-maccatalyst/DerivedSources/WebKit2/WebContent-macCatalyst-no-sandbox.entitlements"
3297             could not be opened. Verify the value of the
3298             CODE_SIGN_ENTITLEMENTS build setting for target "WebContent" is
3299             correct and that the file exists on disk.
3300
3301         This problem is caused by the file referenced by
3302         CODE_SIGN_ENTITLEMENTS changing during the build process. For
3303         macCatalyst builds, we start with the iOS entitlements files and then
3304         tweak them for macCatalyst. When this occurs during a clean build,
3305         Xcode sees the entitlements file being generated and complains about
3306         it. Restarting the build does so with the file already existing, and
3307         so Xcode does not complain about it.
3308
3309         The approach of generating or tweaking entitlement files may have
3310         worked in the past, but the fact is that Xcode doesn't support it.
3311
3312         We had a similar problem with macOS builds. The entitlements files
3313         used to be generated on the fly with scripts like
3314         WebKit/Scripts/process-network-sandbox-entitlements.sh. That process
3315         was reworked to avoid the issue with Xcode not allowing the files to
3316         be generated (see r241135). In short:
3317
3318         o The various process-*-entitlements.sh scripts were consolidated into
3319           a single process-entitlements file
3320         o CODE_SIGN_ENTITLEMENTS, which contains the name of the entitlements
3321           file to use, was de-initialized so that Xcode would not try to
3322           access our generated entitlements file
3323         o CODE_SIGN_INJECT_BASE_ENTITLEMENTS (which injects some base
3324           entitlements) was set to NO. If it were left set to YES, Xcode would
3325           create its own entitlements file and use it as if it were specified
3326           in CODE_SIGN_ENTITLEMENTS
3327         o WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS was updated with an
3328           "--entitlements <generated_file>" option.
3329           WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS was then used to initialize
3330           OTHER_CODE_SIGN_FLAGS. By specifying the entitlements file this way,
3331           we avoid Xcode complaining about it.
3332
3333         This approach works well for macOS, and so we now also use it to
3334         address the issue with macCatalyst. While we're at it, convert the
3335         rest of the platforms to use the same approach and also generate their
3336         entitlements from the process-entitlements script.
3337
3338         The new process was validated by performing a build with the old
3339         process and the new process, and then comparing the entitlements of
3340         the resulting XPC services to make sure they were the same. Builds
3341         were performed for all platforms, and for Engineering and Production
3342         builds.
3343
3344         Reviewed by Brent Fulgham.
3345
3346         * Configurations/BaseXPCService.xcconfig:
3347         * Configurations/Network-iOS.entitlements: Removed.
3348         * Configurations/Network-macCatalyst.entitlements: Removed.
3349         * Configurations/NetworkService.xcconfig:
3350         * Configurations/PluginService.64.xcconfig:
3351         * Configurations/PluginService.entitlements: Removed.
3352         * Configurations/WebContent-iOS.entitlements: Removed.
3353         * Configurations/WebContent-macCatalyst.entitlements: Removed.
3354         * Configurations/WebContentService.Development.xcconfig:
3355         * Configurations/WebContentService.xcconfig:
3356         * Scripts/copy-webcontent-resources-to-private-headers.sh:
3357         * Scripts/process-entitlements.sh:
3358         * WebKit.xcodeproj/project.pbxproj:
3359
3360 2019-08-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3361
3362         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.4 release
3363
3364         * gtk/NEWS: Add release notes for 2.25.4.
3365
3366 2019-08-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3367
3368         [SOUP] WebSockets: use SOUP_WEBSOCKET_CLOSE_NO_STATUS when closing with no status
3369         https://bugs.webkit.org/show_bug.cgi?id=200338
3370
3371         Reviewed by Alex Christensen.
3372
3373         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
3374         (WebKit::WebSocketTask::close):
3375
3376 2019-08-01  Alex Christensen  <achristensen@webkit.org>
3377
3378         Do not send NetworkProcessProxy::LogTestingEvent message if we are not testing
3379         https://bugs.webkit.org/show_bug.cgi?id=200360
3380
3381         Reviewed by Tim Horton.
3382
3383         Sending this message causes instantiation of the default WebsiteDataStore in the UIProcess,
3384         which causes more memory to be used than is needed if we are browsing without the default WebsiteDataStore.
3385
3386         Covered by an API test.
3387
3388         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3389         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
3390         * NetworkProcess/NetworkSession.cpp:
3391         (WebKit::NetworkSession::NetworkSession):
3392         * NetworkProcess/NetworkSession.h:
3393         (WebKit::NetworkSession::enableResourceLoadStatisticsLogTestingEvent const):
3394         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3395         (WebKit::NetworkSessionCreationParameters::encode const):
3396         (WebKit::NetworkSessionCreationParameters::decode):
3397         * NetworkProcess/NetworkSessionCreationParameters.h:
3398         * UIProcess/WebProcessPool.cpp:
3399         (WebKit::WebProcessPool::ensureNetworkProcess):
3400         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3401         (WebKit::WebsiteDataStore::parameters):
3402         * UIProcess/WebsiteData/WebsiteDataStore.h:
3403         (WebKit::WebsiteDataStore::hasStatisticsTestingCallback const):
3404
3405 2019-08-01  Alex Christensen  <achristensen@webkit.org>
3406
3407         Move FormData zip file generation to NetworkProcess and enable it for all WebKit clients for uploading directories
3408         https://bugs.webkit.org/show_bug.cgi?id=200102
3409         <rdar://problem/53275114>
3410
3411         Reviewed by Darin Adler.
3412
3413         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3414         (WebKit::NetworkResourceLoadParameters::encode const):
3415         * Platform/IPC/FormDataReference.h:
3416         (IPC::FormDataReference::encode const):
3417         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3418         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
3419         (API::InjectedBundle::PageUIClient::shouldGenerateFileForUpload): Deleted.
3420         (API::InjectedBundle::PageUIClient::generateFileForUpload): Deleted.
3421         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
3422         (WebKit::InjectedBundlePageUIClient::shouldGenerateFileForUpload): Deleted.
3423         (WebKit::InjectedBundlePageUIClient::generateFileForUpload): Deleted.
3424         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
3425         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3426         (WebKit::WebChromeClient::shouldReplaceWithGeneratedFileForUpload): Deleted.
3427         (WebKit::WebChromeClient::generateReplacementFile): Deleted.
3428         * WebProcess/WebCoreSupport/WebChromeClient.h:
3429         * WebProcess/com.apple.WebProcess.sb.in:
3430
3431 2019-08-01  Tim Horton  <timothy_horton@apple.com>
3432
3433         REGRESSION: HSBC Personal Banking download/print dialog is usually positioned off screen on iPad
3434         https://bugs.webkit.org/show_bug.cgi?id=200356
3435         <rdar://problem/51885199>
3436
3437         Reviewed by Beth Dakin.
3438
3439         * UIProcess/ios/WebPageProxyIOS.mm:
3440         (WebKit::desktopClassBrowsingRecommendedForRequest):
3441         Add HSBC domains to the list of sites that recommend mobile mode by default.
3442
3443 2019-08-01  Chris Dumez  <cdumez@apple.com>
3444
3445         Crash under WebProcessProxy::didBecomeUnresponsive()
3446         https://bugs.webkit.org/show_bug.cgi?id=200346
3447         <rdar://problem/53795984>
3448
3449         Reviewed by Geoffrey Garen.
3450
3451         Make sure the BackgroundProcessResponsivenessTimer / ResponsivenessTimer ref their client
3452         while they call mayBecomeUnresponsive() / willChangeIsResponsive() / didChangeIsResponsive()
3453         / didBecomeUnresponsive() on their client, in case calling one of these ends up destroying
3454         the client.
3455
3456         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
3457         (WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
3458         * UIProcess/ResponsivenessTimer.cpp:
3459         (WebKit::ResponsivenessTimer::timerFired):
3460         * UIProcess/ResponsivenessTimer.h:
3461         * UIProcess/WebProcessProxy.h:
3462
3463 2019-08-01  Youenn Fablet  <youenn@apple.com>
3464
3465         UserMediaPermissionRequestManagerProxy should not use audio+video denied requests to deny audio-only or video-only requests
3466         https://bugs.webkit.org/show_bug.cgi?id=200317
3467
3468         Reviewed by Eric Carlson.
3469
3470         Only match audio+video denied requests with new audio+video requests.
3471         That will ensure that audio can still be captured if user denied access to the camera through preferences
3472         and website started with a getUserMedia({audio: true, video: true}) call.
3473         Covered by added API test.
3474
3475         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3476         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied):
3477
3478 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3479
3480         [SOUP] WebSockets: add support for extensions when using web sockets libsoup API
3481         https://bugs.webkit.org/show_bug.cgi?id=199943
3482
3483         Reviewed by Alex Christensen.
3484
3485         * NetworkProcess/NetworkSocketChannel.cpp:
3486         (WebKit::NetworkSocketChannel::didConnect): Add extensions parameter and pass it to the IPC message.
3487         * NetworkProcess/NetworkSocketChannel.h:
3488         * NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
3489         (WebKit::WebSocketTask::didConnect): Pass empty extensions string.
3490         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
3491         (WebKit::WebSocketTask::acceptedExtensions const): Build the accepted extensions string.
3492         (WebKit::WebSocketTask::didConnect): Pass accepted extensions to NetworkSocketChannel::didConnect().
3493         * NetworkProcess/soup/WebSocketTaskSoup.h:
3494         * WebProcess/Network/WebSocketChannel.cpp:
3495         (WebKit::WebSocketChannel::extensions): Return the extensions string received from the network process.
3496         (WebKit::WebSocketChannel::didConnect): Save the extensions string.
3497         * WebProcess/Network/WebSocketChannel.h:
3498         * WebProcess/Network/WebSocketChannel.messages.in:
3499
3500 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3501
3502         [SOUP] Switch to use libsoup WebSockets API
3503         https://bugs.webkit.org/show_bug.cgi?id=200162
3504
3505         Reviewed by Michael Catanzaro.
3506
3507         Remove temporary method added for old WebSockets implementation.
3508
3509         * NetworkProcess/NetworkStorageSessionProvider.h:
3510
3511 2019-07-31  Dean Jackson  <dino@apple.com>
3512
3513         WKImagePreviewViewController not being autoreleased
3514         https://bugs.webkit.org/show_bug.cgi?id=200325
3515         <rdar://problem/53788214>
3516
3517         Reviewed by Wenson Hsieh.
3518
3519         Wenson noticed I wasn't autoreleasing the WKImagePreviewViewController.
3520
3521         * UIProcess/ios/WKContentViewInteraction.mm:
3522         (-[WKContentView continueContextMenuInteraction:]):
3523
3524 2019-07-31  Chris Dumez  <cdumez@apple.com>
3525
3526         REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
3527         https://bugs.webkit.org/show_bug.cgi?id=200086
3528         <rdar://problem/53501721>
3529
3530         Reviewed by Alex Christensen.
3531
3532         The test would first send a ProcessWillSuspendImminently IPC to the NetworkProcess and then
3533         run JS in the WebContent process, which would in turn send IPC to the NetworkProcess. The
3534         test was flaky because it expected the network process to receive the IPC from the UIProcess
3535         *before* the one from the WebContent process. However, there is no guarantee about ordering
3536         from IPC messages coming from different connections.
3537
3538         To address the flakiness, this patch introduces a new ProcessWillSuspendImminentlyForTesting
3539         synchronous IPC and uses this instead. As a result, it is now guaranteed that the network
3540         process processes this IPC *before* receiving any IPC from the WebContent process that is
3541         the result of IPC from the UIProcess.
3542
3543         * NetworkProcess/NetworkProcess.cpp:
3544         (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
3545         * NetworkProcess/NetworkProcess.h:
3546         * NetworkProcess/NetworkProcess.messages.in:
3547         * UIProcess/API/Cocoa/WKProcessPool.mm:
3548         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
3549         * UIProcess/Network/NetworkProcessProxy.cpp:
3550         (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting):
3551         * UIProcess/Network/NetworkProcessProxy.h:
3552         * UIProcess/WebProcessPool.cpp:
3553         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting):
3554         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently): Deleted.
3555         * UIProcess/WebProcessPool.h:
3556
3557 2019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3558
3559         [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
3560         https://bugs.webkit.org/show_bug.cgi?id=200291
3561         <rdar://problem/53717946>
3562
3563         Reviewed by Megan Gardner.
3564
3565         Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
3566         and there is no Connection object to use when waiting for a sync IPC response.
3567
3568         Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
3569
3570         * UIProcess/ios/WKContentViewInteraction.mm:
3571         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
3572
3573 2019-07-31  Chris Fleizach  <cfleizach@apple.com>
3574
3575         AX: com.apple.WebKit.WebContent at com.apple.WebKit: -[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]
3576         https://bugs.webkit.org/show_bug.cgi?id=200277
3577         <rdar://problem/49475009>
3578
3579         Reviewed by Per Arne Vollan.
3580
3581         Verify Page is available before calling into it.
3582
3583         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3584         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
3585
3586 2019-07-31  Carlos Garcia Campos  <cgarcia@igalia.com>
3587
3588         [GTK] Datalist element support for TextFieldInputType
3589         https://bugs.webkit.org/show_bug.cgi?id=98934
3590
3591         Reviewed by Michael Catanzaro.
3592
3593         Add a WebDataListSuggestionsDropdown implementation for the GTK port using a popup window with a tree view list.
3594
3595         * Sources.txt:
3596         * SourcesGTK.txt:
3597         * UIProcess/API/gtk/PageClientImpl.cpp:
3598         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
3599         * UIProcess/API/gtk/PageClientImpl.h:
3600         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: Added.
3601         (WebKit::firstTimeItemSelectedCallback):
3602         (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk):
3603         (WebKit::WebDataListSuggestionsDropdownGtk::~WebDataListSuggestionsDropdownGtk):
3604         (WebKit::WebDataListSuggestionsDropdownGtk::treeViewRowActivatedCallback):
3605         (WebKit::WebDataListSuggestionsDropdownGtk::didSelectOption):
3606         (WebKit::WebDataListSuggestionsDropdownGtk::show):
3607         (WebKit::WebDataListSuggestionsDropdownGtk::handleKeydownWithIdentifier):
3608         (WebKit::WebDataListSuggestionsDropdownGtk::close):
3609         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h: Copied from Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h.
3610
3611 2019-07-31  Tim Horton  <timothy_horton@apple.com>
3612
3613         Remove WebKit2 Makefile guards for pre-Snow Leopard macOS
3614         https://bugs.webkit.org/show_bug.cgi?id=200294
3615
3616         Reviewed by Dan Bernstein.
3617
3618         * Makefile:
3619         It seems ... unlikely ... that anyone is trying to build
3620         trunk WebKit for Leopard or prior.
3621
3622 2019-07-30  Fujii Hironori  <Hironori.Fujii@sony.com>
3623
3624         [WebKit] Add PageLoadState::Observer C API
3625         https://bugs.webkit.org/show_bug.cgi?id=199848
3626
3627         Reviewed by Alex Christensen.
3628
3629         There is no WebKit C API to get the timing of title changed since
3630         WKPageLoaderClientV0::didReceiveTitleForFrame has been removed in
3631         r235398. Cocoa and glib WebKit API exist.
3632
3633         * PlatformWin.cmake:
3634         * UIProcess/API/C/WKPage.cpp:
3635         (WKPageSetPageStateClient):
3636         * UIProcess/API/C/WKPage.h: Added WKPageSetPageStateClient.
3637         * UIProcess/API/C/WKPageStateClient.h: Added.
3638         * UIProcess/WebPageProxy.cpp:
3639         (WebKit::WebPageProxy::setPageLoadStateObserver):
3640         * UIProcess/WebPageProxy.h:
3641         * WebKit.xcodeproj/project.pbxproj:
3642
3643 2019-07-30  Chris Dumez  <cdumez@apple.com>
3644
3645         Fix non-thread safe use of WeakPtr under sendSecItemRequest()
3646         https://bugs.webkit.org/show_bug.cgi?id=200249
3647
3648         Reviewed by Alex Christensen.
3649
3650         The function was calling globalNetworkProcess() from a background thread. This is not safe because
3651         globalNetworkProcess() deferences a WeakPtr<NetworkProcess> internally and the NetworkProcess object
3652         gets destroyed on the main thread.
3653
3654         * Shared/mac/SecItemShim.cpp:
3655         (WebKit::sendSecItemRequest):
3656
3657 2019-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3658
3659         [SOUP] Move SoupNetworkSession ownership from NetworkStorageSession to NetworkSession
3660         https://bugs.webkit.org/show_bug.cgi?id=200076
3661
3662         Reviewed by Michael Catanzaro.
3663
3664         NetworkStorageSession should only own the cookie jar, since it's the only thing it handles from the session.
3665
3666         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
3667         (WebKit::WebCookieManager::setCookiePersistentStorage): Use the network session instead of the storage session
3668         to set the peristent cookie storage.
3669         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
3670         (WebKit::LegacyCustomProtocolManager::registerScheme): Iterate network sessions instead of storage sessions to
3671         access the SoupNetworkSession.
3672         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3673         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated): Use
3674         NetworkProcess::forEachNetworkSession() to iterate network sessions.
3675         * NetworkProcess/NetworkProcess.cpp:
3676         (WebKit::NetworkProcess::lowMemoryHandler): Ditto.
3677         (WebKit::NetworkProcess::forEachNetworkSession): Added to iterate network sessions intead of exposing the map
3678         that is always used to iterate the sessions.
3679         (WebKit::NetworkProcess::switchToNewTestingSession): Use the new NetworkStorageSession constructor API.
3680         (WebKit::NetworkProcess::ensureSession): Ditto.
3681         (WebKit::NetworkProcess::destroySession): Allow to destroy the default session for soup based ports. This is
3682         only called right before process exit to ensure we don't leak network resources like the cookies database.
3683         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled): Use NetworkProcess::forEachNetworkSession() to
3684         iterate network sessions.
3685         (WebKit::NetworkProcess::fetchWebsiteData): Ditto.
3686         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): Ditto.
3687         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): Ditto.
3688         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): Ditto.
3689         (WebKit::NetworkProcess::setCacheModel): Ditto.
3690         (WebKit::NetworkProcess::actualPrepareToSuspend): Ditto.
3691         (WebKit::NetworkProcess::resume): Ditto.
3692         * NetworkProcess/NetworkProcess.h:
3693         * NetworkProcess/NetworkStorageSessionProvider.h:
3694         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3695         (WebKit::NetworkProcess::clearDiskCache): Ditto.
3696         * NetworkProcess/ios/NetworkProcessIOS.mm:
3697         (WebKit::NetworkProcess::clearCacheForAllOrigins): Ditto.
3698         * NetworkProcess/soup/NetworkProcessMainSoup.cpp: Destroy the default session before process exists.
3699         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3700         (WebKit::NetworkProcess::userPreferredLanguagesChanged): Iterate network sessions instead of storage sessions to
3701         access the SoupNetworkSession.
3702         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Use the new NetworkStorageSession constructor API.
3703         (WebKit::NetworkProcess::clearDiskCache): Use NetworkProcess::forEachNetworkSession() to iterate network sessions.
3704         (WebKit::NetworkProcess::setNetworkProxySettings): Iterate network sessions instead of storage sessions to
3705         access the SoupNetworkSession.
3706         * NetworkProcess/soup/NetworkSessionSoup.cpp:
3707         (WebKit::NetworkSessionSoup::NetworkSessionSoup): Create the SoupNetworkSession and setup cookies.
3708         (WebKit::NetworkSessionSoup::soupSession const): Return the SoupSession of SoupNetworkSession.
3709         (WebKit::NetworkSessionSoup::setCookiePersistentStorage): Setup a new cookie jar.
3710         * NetworkProcess/soup/NetworkSessionSoup.h:
3711
3712 2019-07-30  Truitt Savell  <tsavell@apple.com>
3713
3714         Unreviewed, rolling out r247932.
3715
3716         Broke 8 API tests across all platforms.
3717
3718         Reverted changeset:
3719
3720         "Fix non-thread safe use of WeakPtr under
3721         sendSecItemRequest()"
3722         https://bugs.webkit.org/show_bug.cgi?id=200249
3723         https://trac.webkit.org/changeset/247932
3724
3725 2019-07-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3726
3727         YouTube search field shows RTL text outside its border on iPadOS
3728         https://bugs.webkit.org/show_bug.cgi?id=200253
3729         <rdar://problem/53680603>
3730
3731         Reviewed by Beth Dakin.
3732
3733         Limits code added in r238939 to respect the current keyboard's writing mode to only editable web views. This
3734         behavior was only intended for Mail, and isn't generally compatible with web content.
3735
3736         While the call to -setInitialDirection is correctly gated on an web view editability check, it appears that
3737         other changes in iOS 13 now cause -setBaseWritingDirection:forRange: to be invoked directly from keyboards code.
3738         This means that -setBaseWritingDirection:forRange: should additionally be guarded with the same check.
3739
3740         * UIProcess/ios/WKContentViewInteraction.mm:
3741         (-[WKContentView setBaseWritingDirection:forRange:]):
3742
3743 2019-07-29  Sihui Liu  <sihui_liu@apple.com>
3744
3745         Try fixing crash at com.apple.WebKit.Networking: NetworkProcess::setSharedHTTPCookieStorage
3746         https://bugs.webkit.org/show_bug.cgi?id=200189
3747         <rdar://problem/41325767>
3748
3749         Reviewed by Chris Dumez.
3750
3751         The crash indicates that sharedCookieStorage is accessed before being set in network process. 
3752         sharedCookieStorage is set during the processing of InitializeNetworkProcess message, and access to 
3753         sharedCookieStorage is supposed to happen after that. Therefore, it is likely some message is received and 
3754         handled before InitializeNetworkProcess. 
3755  
3756         One possible explanation is WebKit APIs get called on different threads. Because of the race in checking and 
3757         setting m_networkProcess, some message is sent between network process gets launched (m_networkProcess is set) 
3758         and InitializeNetworkProcess message is sent. To mitigate this issue, we make sure m_networkProcess is set only
3759         in the main runloop and only after InitializeNetworkProcess is sent. 
3760
3761         * UIProcess/WebProcessPool.cpp:
3762         (WebKit::WebProcessPool::ensureNetworkProcess):
3763
3764 2019-07-29  Chris Dumez  <cdumez@apple.com>
3765
3766         Fix non-thread safe use of WeakPtr under sendSecItemRequest()
3767         https://bugs.webkit.org/show_bug.cgi?id=200249
3768
3769         Reviewed by Alex Christensen.
3770
3771         The function was calling globalNetworkProcess() from a background thread. This is not safe because
3772         globalNetworkProcess() deferences a WeakPtr<NetworkProcess> internally and the NetworkProcess object
3773         gets destroyed on the main thread.
3774
3775         * Shared/mac/SecItemShim.cpp:
3776         (WebKit::sendSecItemRequest):
3777
3778 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3779
3780         [ContentChangeObserver] didFinishContentChangeObserving should include the type of content change.
3781         https://bugs.webkit.org/show_bug.cgi?id=200247
3782         <rdar://problem/53681149>
3783
3784         Reviewed by Simon Fraser.
3785
3786         * WebProcess/WebCoreSupport/WebChromeClient.h:
3787         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3788         (WebKit::WebChromeClient::didFinishContentChangeObserving):
3789         * WebProcess/WebPage/WebPage.h:
3790         * WebProcess/WebPage/ios/WebPageIOS.mm:
3791         (WebKit::WebPage::didFinishContentChangeObserving):
3792
3793 2019-07-29  Youenn Fablet  <youenn@apple.com>
3794
3795         REGRESSION: WebSockets no longer work in Service Workers
3796         https://bugs.webkit.org/show_bug.cgi?id=199906
3797         <rdar://problem/53516732>
3798
3799         Reviewed by Geoffrey Garen.
3800
3801         Use WebSocketProvider so that network calls are done in the network process.
3802
3803         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3804         (WebKit::WebSWContextManagerConnection::installServiceWorker):
3805
3806 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3807
3808         [ContentChangeObserver] ChromeClient::observedContentChange() name is misleading
3809         https://bugs.webkit.org/show_bug.cgi?id=200238
3810         <rdar://problem/53677038>
3811
3812         Reviewed by Simon Fraser.
3813
3814         * WebProcess/WebCoreSupport/WebChromeClient.h:
3815         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3816         (WebKit::WebChromeClient::didFinishContentChangeObserving):
3817         (WebKit::WebChromeClient::observedContentChange): Deleted.
3818         * WebProcess/WebPage/WebPage.h:
3819         * WebProcess/WebPage/ios/WebPageIOS.mm:
3820         (WebKit::WebPage::didFinishContentChangeObserving):
3821         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver): Deleted.
3822
3823 2019-07-26  Ryosuke Niwa  <rniwa@webkit.org>
3824
3825         ShareableBitmap::createGraphicsContext() should return nullptr when CGBitmapContextCreateWithData returns nil
3826         https://bugs.webkit.org/show_bug.cgi?id=200185
3827
3828         Reviewed by Simon Fraser.
3829
3830         We should not be creating GraphicsContext with nil CGContextRef in ShareableBitmap::createGraphicsContext()
3831         as such a GraphicsContext is only used for specific purposes.
3832
3833         This patch adds an early return to ShareableBitmap::createGraphicsContext() when CGBitmapContextCreateWithData
3834         returns nil CGContextRef.
3835
3836         * PluginProcess/PluginControllerProxy.cpp:
3837         (WebKit::PluginControllerProxy::paint):
3838         * Shared/API/c/cg/WKImageCG.cpp:
3839         (WKImageCreateFromCGImage):
3840         * Shared/ContextMenuContextData.cpp:
3841         (WebKit::ContextMenuContextData::ContextMenuContextData):
3842         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
3843         (WebKit::RemoteLayerBackingStore::display):
3844         * Shared/WebCoreArgumentCoders.cpp:
3845         (IPC::encodeImage):
3846         * Shared/cg/ShareableBitmapCG.cpp:
3847         (WebKit::ShareableBitmap::createGraphicsContext):
3848         (WebKit::ShareableBitmap::makeCGImageCopy):
3849         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
3850         (WebKit::imageForRect):
3851         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
3852         (WebKit::InjectedBundleRangeHandle::renderedImage):
3853         * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
3854         (WebKit::InjectedBundleHitTestResult::image const):
3855         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
3856         (WebKit::NetscapePlugin::snapshot):
3857         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3858         (WebKit::PDFPlugin::snapshot):
3859         * WebProcess/Plugins/PluginProxy.cpp:
3860         (WebKit::PluginProxy::paint):
3861         (WebKit::PluginProxy::update):
3862         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3863         (WebKit::convertCGImageToBitmap):
3864         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3865         (WebKit::DrawingAreaCoordinatedGraphics::display):
3866         * WebProcess/WebPage/WebFrame.cpp:
3867         (WebKit::WebFrame::createSelectionSnapshot const):
3868         * WebProcess/WebPage/WebPage.cpp:
3869         (WebKit::WebPage::snapshotAtSize):
3870         (WebKit::WebPage::snapshotNode):
3871         (WebKit::WebPage::drawRectToImage):
3872
3873 2019-07-29  Dean Jackson  <dino@apple.com>
3874
3875         Contextual menu does not present when holding an embedded photo but works with link and attachments
3876         https://bugs.webkit.org/show_bug.cgi?id=200239
3877         <rdar://problem/53318733>
3878
3879         Reviewed by Tim Horton.
3880
3881         If the user long-pressed on an image, and the client implemented the new API but did
3882         not provide a configuration, we were not falling back to the default behaviour of
3883         giving a menu allowing the user to copy/share/save the image.
3884
3885         * UIProcess/ios/WKContentViewInteraction.mm:
3886         (-[WKContentView continueContextMenuInteraction:]): If we get through the delegates,
3887         and the element is an image, return the default configuration.
3888
3889 2019-07-29  Chris Dumez  <cdumez@apple.com>
3890
3891         Remove unnecessary null check under WebResourceLoadStatisticsStore::hasStorageAccess()
3892         https://bugs.webkit.org/show_bug.cgi?id=200229
3893
3894         Reviewed by Alex Christensen.
3895
3896         Remove unnecessary null check under WebResourceLoadStatisticsStore::hasStorageAccess().
3897         There is already a null check with an early return a few lines above.
3898
3899         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3900         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
3901
3902 2019-07-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3903
3904         UI process occasionally hangs in -[UIKeyboardTaskQueue lockWhenReadyForMainThread]
3905         https://bugs.webkit.org/show_bug.cgi?id=200215
3906         <rdar://problem/52976965>
3907
3908         Reviewed by Tim Horton.
3909
3910         To implement autocorrection on iOS, UIKit sometimes needs to request contextual information from WebKit. This is
3911         handled as a sync IPC message in WebKit, since UIKit would otherwise proceed to block the main thread after
3912         sending the request, preventing WebKit from handling any IPC responses in the UI process (potentially resulting
3913         in deadlock if any other sync IPC messages were to arrive in the UI process during this time).
3914
3915         The synchronous nature of this autocorrection request means that if any sync IPC message were to be
3916         simultaneously dispatched in the opposite direction (i.e. web to UI process), we need to immediately handle the
3917         incoming sync message in the UI process (otherwise, we'd end up deadlocking for 1 second until the
3918         autocorrection context request hits a 1-second IPC timeout).
3919
3920         One such synchronous message from the web process to the UI process is WebPageProxy::CreateNewPage, triggered as
3921         a result of synchronously opening a new window. Due to Safari changes in iOS 13 (<rdar://problem/51755088>),
3922         this message now calls into code which then causes UIKit to call *back into* -[WKContentView
3923         requestAutocorrectionContextWithCompletionHandler:] for the newly opened web view, under the scope of the call
3924         to -requestAutocorrectionContextWithCompletionHandler: in the original web view.
3925
3926         This caused a crash, which was tracked in <rdar://problem/52590170>. There was an attempt to fix this in r247345
3927         by invoking the existing handler well before storing the new one; while this avoided the crash, it didn't solve
3928         the root problem, which was that keyboard task queues would get into a bad state after this scenario; this would
3929         manifest in a UI process hang under -[UIKeyboardTaskQueue lockWhenReadyForMainThread] during the next user
3930         gesture, which is tracked by this bug (<rdar://problem/52976965>).
3931
3932         As it turns out, the keyboard task queue gets into a bad state because it is architected in such a way that
3933         tasks added to the queue under the scope of parent task must be finished executing before their parents;
3934         otherwise, the call to -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] never happens when
3935         handling the child task. This has the effect of causing the keyboard task queue to end up with a
3936         UIKeyboardTaskExecutionContext that can never return execution to its parent context, such that if the task
3937         queue is then told to wait until any future task is finished executing, it will hang forever, waiting for these
3938         stuck tasks to finish executing (which never happens, because they're all waiting to return execution to their
3939         parents which are already done executing!)
3940
3941         To fix this hang and avoid ever getting into this bad state, we need to invoke the autocorrection request
3942         handlers in this order:
3943
3944         (1) Receive outer autocorrection context request.
3945         (2) Receive inner autocorrection context request.
3946         (3) Invoke inner autocorrection context request completion handler.
3947         (4) Invoke outer autocorrection context request completion handler.
3948
3949         ...instead of swapping (3) and (4), like we do currently.
3950
3951         * UIProcess/ios/WKContentViewInteraction.mm:
3952         (-[WKContentView resignFirstResponderForWebView]):
3953
3954         Remove the hack added in r247345 to try and avoid reentrant autocorrection context requests; we don't need this
3955         anymore, since we should now be able to handle these reentrant requests in the way UIKit expects.
3956
3957         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
3958
3959         Add an early return in the case where the request is synchronous and there's already a pending autocorrection
3960         context to ensure that the completion handler for the nested request is invoked before the outer request is
3961         finished.
3962
3963 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
3964
3965         Can't scroll on yummly.co.uk recipe (scale(0) div covers the content and hit-tests)
3966         https://bugs.webkit.org/show_bug.cgi?id=200263
3967         rdar://problem/53679408
3968
3969 &n