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