[iOS] Rename some WebKit-internal functions and variables that reference "data intera...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS] Rename some WebKit-internal functions and variables that reference "data interaction"
4         https://bugs.webkit.org/show_bug.cgi?id=193829
5
6         Reviewed by Tim Horton.
7
8         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
9         (WebKit::WebPageProxy::setDragCaretRect):
10         * UIProcess/PageClient.h:
11         * UIProcess/WebPageProxy.h:
12         * UIProcess/WebPageProxy.messages.in:
13         * UIProcess/ios/PageClientImplIOS.h:
14         * UIProcess/ios/PageClientImplIOS.mm:
15         (WebKit::PageClientImpl::didHandleDragStartRequest):
16         (WebKit::PageClientImpl::didConcludeEditDrag):
17         (WebKit::PageClientImpl::didChangeDragCaretRect):
18         (WebKit::PageClientImpl::didHandleStartDataInteractionRequest): Deleted.
19         (WebKit::PageClientImpl::didConcludeEditDataInteraction): Deleted.
20         (WebKit::PageClientImpl::didChangeDataInteractionCaretRect): Deleted.
21         * UIProcess/ios/WKContentViewInteraction.h:
22         * UIProcess/ios/WKContentViewInteraction.mm:
23         (-[WKContentView setupInteraction]):
24         (-[WKContentView cleanupInteraction]):
25         (-[WKContentView setupDragAndDropInteractions]):
26         (-[WKContentView teardownDragAndDropInteractions]):
27         (-[WKContentView _didHandleDragStartRequest:]):
28         (-[WKContentView _didConcludeEditDrag:]):
29         (-[WKContentView _didChangeDragCaretRect:currentRect:]):
30         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
31         (-[WKContentView setupDataInteractionDelegates]): Deleted.
32         (-[WKContentView teardownDataInteractionDelegates]): Deleted.
33         (-[WKContentView _didHandleStartDataInteractionRequest:]): Deleted.
34         (-[WKContentView _didConcludeEditDataInteraction:]): Deleted.
35         (-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]): Deleted.
36         * UIProcess/ios/WebPageProxyIOS.mm:
37         (WebKit::WebPageProxy::didHandleDragStartRequest):
38         (WebKit::WebPageProxy::requestDragStart):
39         (WebKit::WebPageProxy::didConcludeEditDrag):
40         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest): Deleted.
41         (WebKit::WebPageProxy::requestStartDataInteraction): Deleted.
42         (WebKit::WebPageProxy::didConcludeEditDataInteraction): Deleted.
43         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
44         (WebKit::WebDragClient::didConcludeEditDrag):
45         * WebProcess/WebPage/WebPage.h:
46         * WebProcess/WebPage/WebPage.messages.in:
47         * WebProcess/WebPage/ios/WebPageIOS.mm:
48         (WebKit::WebPage::requestDragStart):
49         (WebKit::WebPage::requestAdditionalItemsForDragSession):
50         (WebKit::WebPage::didConcludeEditDrag):
51         (WebKit::WebPage::requestStartDataInteraction): Deleted.
52         (WebKit::WebPage::didConcludeEditDataInteraction): Deleted.
53
54 2019-01-25  Alex Christensen  <achristensen@webkit.org>
55
56         WKWebView.goBack should reload if there is a safe browsing warning
57         https://bugs.webkit.org/show_bug.cgi?id=193805
58         <rdar://problem/46908216>
59
60         Reviewed by Geoff Garen.
61
62         If a WKWebView is showing a safe browsing warning and the user clicks a back button
63         in the app which calls WKWebView.goBack, the WKWebView is in a state where it has not navigated yet,
64         so actually going back will appear to the user to go back twice.  We can't just do nothing because the
65         app is in a state where it is expecting a navigation to happen.  Reloading achieves what the user expects
66         and makes the app work like the app expects.
67
68         * UIProcess/API/C/WKPage.cpp:
69         (WKPageGoBack):
70         * UIProcess/API/Cocoa/WKWebView.mm:
71         (-[WKWebView goBack]):
72         * UIProcess/PageClient.h:
73         (WebKit::PageClient::hasSafeBrowsingWarning const):
74         * UIProcess/mac/PageClientImplMac.h:
75         * UIProcess/mac/PageClientImplMac.mm:
76         (WebKit::PageClientImpl::hasSafeBrowsingWarning const):
77
78 2019-01-25  Chris Dumez  <cdumez@apple.com>
79
80         Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started
81         https://bugs.webkit.org/show_bug.cgi?id=193788
82         <rdar://problem/47531231>
83
84         Reviewed by Alex Christensen.
85
86         When the page starts a new provisional load, make sure we cancel any pending one in the provisional
87         process, as it would have happened in the first provisional load happened in the same process.
88         Without this, we could have 2 parallel loads happening, one in the committed process and another
89         in the provisional one, leading to assertion failures in debug.
90
91         * UIProcess/WebPageProxy.cpp:
92         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
93
94 2019-01-25  Chris Dumez  <cdumez@apple.com>
95
96         Drop WebKit::WebKitPolicyAction type as it is no longer needed
97         https://bugs.webkit.org/show_bug.cgi?id=193827
98
99         Reviewed by Antti Koivisto.
100
101         Drop WebKit::WebKitPolicyAction type as it is no longer needed. It is now identical to
102         WebCore::PolicyAction.
103
104         * Shared/WebPolicyAction.h: Removed.
105         * UIProcess/WebFramePolicyListenerProxy.cpp:
106         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
107         (WebKit::WebFramePolicyListenerProxy::use):
108         (WebKit::WebFramePolicyListenerProxy::download):
109         (WebKit::WebFramePolicyListenerProxy::ignore):
110         * UIProcess/WebFramePolicyListenerProxy.h:
111         * UIProcess/WebFrameProxy.cpp:
112         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
113         * UIProcess/WebFrameProxy.h:
114         * UIProcess/WebPageProxy.cpp:
115         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
116         (WebKit::WebPageProxy::receivedPolicyDecision):
117         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
118         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
119         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
120         (WebKit::WebPageProxy::decidePolicyForResponseShared):
121         * UIProcess/WebPageProxy.h:
122         * WebKit.xcodeproj/project.pbxproj:
123         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
124         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
125         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
126         * WebProcess/WebPage/WebFrame.cpp:
127         (WebKit::WebFrame::didReceivePolicyDecision):
128         (WebKit::toPolicyAction): Deleted.
129         * WebProcess/WebPage/WebFrame.h:
130         * WebProcess/WebPage/WebPage.cpp:
131         (WebKit::WebPage::didReceivePolicyDecision):
132         * WebProcess/WebPage/WebPage.h:
133
134 2019-01-25  Per Arne Vollan  <pvollan@apple.com>
135
136         [iOS] Add logging of calls
137         https://bugs.webkit.org/show_bug.cgi?id=193784
138
139         Reviewed by Brent Fulgham.
140
141         Add permissive logging of calls on iOS.
142
143         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
144
145 2019-01-25  Chris Dumez  <cdumez@apple.com>
146
147         Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction()
148         https://bugs.webkit.org/show_bug.cgi?id=193779
149         <rdar://problem/46170903>
150
151         Reviewed by Antti Koivisto.
152
153         * UIProcess/Cocoa/NavigationState.mm:
154         (WebKit::tryAppLink):
155         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
156         We were crashing when trying to get the URL of the main frame, which was sad because we never
157         ended up using the main frame URL. Therefore, this patch drops the code in question.
158
159         * UIProcess/ProvisionalPageProxy.cpp:
160         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
161         Add assertion to make sure that the DecidePolicyForNavigationActionAsync IPC it is getting
162         from the process is related to its main frame.
163
164 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
165
166         Need a way for JavaScript (or bundle) code to participate in undo
167         https://bugs.webkit.org/show_bug.cgi?id=190009
168         <rdar://problem/44807048>
169
170         Reviewed by Ryosuke Niwa.
171
172         Invalidate undo steps when removing them from WebPage. Invalidation is a no-op for editing actions that come
173         from the UA, but for custom undo steps backed by an UndoItem, we clear out the custom undo step's pointer to its
174         UndoItem and additionally disconnect the UndoItem from its UndoManager.
175
176         * WebProcess/WebPage/WebPage.cpp:
177         (WebKit::WebPage::addWebUndoStep):
178         (WebKit::WebPage::removeWebEditCommand):
179         * WebProcess/WebPage/WebUndoStep.h:
180         (WebKit::WebUndoStep::invalidate):
181
182 2019-01-25  Patrick Griffis  <pgriffis@igalia.com>
183
184         [GTK][WPE] Add API to add paths to sandbox
185         https://bugs.webkit.org/show_bug.cgi?id=193571
186
187         This allows applications to add paths to the web process
188         if required by web extensions.
189
190         Reviewed by Michael Catanzaro.
191
192         * UIProcess/API/glib/WebKitWebContext.cpp:
193         (webkit_web_context_add_path_to_sandbox):
194         * UIProcess/API/gtk/WebKitWebContext.h:
195         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
196         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
197         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
198         (WebKit::bubblewrapSpawn):
199         * UIProcess/WebProcessPool.h:
200         * UIProcess/glib/WebProcessProxyGLib.cpp:
201         (WebKit::WebProcessProxy::platformGetLaunchOptions):
202
203 2019-01-24  Ryosuke Niwa  <rniwa@webkit.org>
204
205         iOS: Split keyboard should not shrink visualViewport.height
206         https://bugs.webkit.org/show_bug.cgi?id=193798
207
208         Reviewed by Tim Horton.
209
210         Treat a split keyboard like a floating keyboard and don't consider its input view bounds in computing the visible content rects.
211
212         No new tests since while it's possible to transition between split and merged keyboard using some SPI,
213         there isn't a reliable mechanism to reset the keyboard state. e.g. we need to wait for a hard-coded amount of time.
214
215         * Platform/spi/ios/UIKitSPI.h:
216         * UIProcess/API/Cocoa/WKWebView.mm:
217         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
218
219 2019-01-24  Eric Carlson  <eric.carlson@apple.com>
220
221         [iOS] Silence MediaPlayer compile warnings
222         https://bugs.webkit.org/show_bug.cgi?id=193780
223         <rdar://problem/47518428>
224
225         Reviewed by Jer Noble.
226
227         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
228
229 2019-01-24  Truitt Savell  <tsavell@apple.com>
230
231         Unreviewed, rolling out r240446.
232
233         Casued 5 API failures
234
235         Reverted changeset:
236
237         "Activate the WebResourceLoadStatisticsStore in the
238         NetworkProcess and deactivate it in the UIProcess."
239         https://bugs.webkit.org/show_bug.cgi?id=193297
240         https://trac.webkit.org/changeset/240446
241
242 2019-01-24  Brent Fulgham  <bfulgham@apple.com>
243
244         Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
245         https://bugs.webkit.org/show_bug.cgi?id=193297
246         <rdar://problem/47158841>
247
248         Reviewed by Alex Christensen.
249
250         This patch activates the ResourceLoadStatistics code in the NetworkProcess, and turns
251         it off in the UIProcess. It also updates test infrastructure to work with this change
252         in architecture.
253
254         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
255         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading): Added.
256         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect): Added.
257         (WebKit::ResourceLoadStatisticsMemoryStore::logWebSocketLoading): Added.
258         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
259         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Added.
260         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Added.
261         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Added.
262         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
263         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
264         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources): Deleted.
265         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
266         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
267         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading): Added.
268         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect): Added.
269         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading): Added.
270         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
271         * NetworkProcess/NetworkSession.cpp:
272         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
273         * UIProcess/WebProcessPool.cpp:
274         (WebKit::WebProcessPool::ensureNetworkProcess):
275         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
276         (WebKit::WebsiteDataStore::parameters):
277         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
278         (WebKit::WebsiteDataStore::removeData):
279         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
280         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
281         * Webprocess/WebProcess.cpp:
282         (WebKit::WebProcess::initializeWebProcess): Register new ResourceLoadObserver callbacks.
283
284 2019-01-24  John Wilander  <wilander@apple.com>
285
286         Add Ad Click Attribution as an internal/experimental feature
287         https://bugs.webkit.org/show_bug.cgi?id=193685
288         <rdar://problem/47450399>
289
290         Reviewed by Brent Fulgham.
291
292         * Shared/WebPreferences.yaml:
293             Added AdClickAttributionEnabled as a runtime enabled feature, off by default.
294
295 2019-01-24  Antti Koivisto  <antti@apple.com>
296
297         [PSON] Flash on back navigation on Mac
298         https://bugs.webkit.org/show_bug.cgi?id=193716
299         <rdar://problem/47148458>
300
301         Reviewed by Chris Dumez.
302
303         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
304
305         * UIProcess/SuspendedPageProxy.cpp:
306         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
307         (WebKit::SuspendedPageProxy::close):
308
309         Track closed state so we don't send the message twice, causing unhandled message errors in web process.
310
311         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
312
313         Close the suspended page if the suspension fails.
314         Skip this if we are using web process side compositing on Mac.
315
316         * UIProcess/SuspendedPageProxy.h:
317         * UIProcess/WebPageProxy.cpp:
318         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
319
320         On Mac, close the failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
321
322         * UIProcess/WebProcessPool.cpp:
323         (WebKit::WebProcessPool::closeFailedSuspendedPagesForPage):
324         * UIProcess/WebProcessPool.h:
325         * WebProcess/WebPage/WebPage.cpp:
326         (WebKit::WebPage::suspendForProcessSwap):
327
328         Don't close the page on suspension failure. This is now managed by the UI process.
329
330 2019-01-24  Chris Dumez  <cdumez@apple.com>
331
332         Regression(PSON) Back/Forward list items' URL sometimes gets replaced with the URL of a subframe
333         https://bugs.webkit.org/show_bug.cgi?id=193761
334         <rdar://problem/47456405>
335
336         Reviewed by Alex Christensen.
337
338         When doing a history navigation cross-process, the UIProcess would first send the back/forward list items
339         to the destination WebProcess via WebPage::updateBackForwardListForReattach(), then ask the process to
340         navigate to the expected back/forward list item.
341
342         WebPage::updateBackForwardListForReattach() would call restoreSessionInternal(), which would call
343         toHistoryItem() on each BackForwardListItem. This may end up creating more than one HistoryItem for each
344         BackForwardListItem because HistoryItems are part of a tree (each frame has its own list of history items).
345
346         Note that BackForwardListItems and HistoryItem share a BackForwardItemIdentifier which is a
347         (processIdentifier, itemIdentifier) pair. We normally generate the HistoryItem's identifier from inside
348         its constructor like so:
349         `{ Process::identifier(), generateObjectIdentifier<BackForwardItemIdentifier::ItemIdentifierType>() }`
350
351         However, when calling updateBackForwardListForReattach() and constructing children HistoryItem,
352         applyFrameState() would generate the identifier by itself and passing it to the HistoryItem constructor.
353         Its genegates the ID the exact same way so this would in theory not be a problem. Unfortunately, both
354         calls to generateObjectIdentifier() get inlined and both call sites end up with their own static counter
355         to generate ids. As a result, we may end up with conflicts as HistoryItems for child frames (restored
356         by restoreSessionInternal()) can end up with the same identifier as HistoryItems for top frames.
357
358         This confusion would lead to the WebContent process sending the UIProcess bad information and the URL
359         of subframes could end up as the WebBackForwardListItem's mainframe URL.
360
361         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
362         (WebKit::applyFrameState):
363         Stop calling generateObjectIdentifier() explicitly and let the HistoryItem constructor take care of it.
364         Calling generateObjectIdentifier() for the same type from different places is not safe due to inlining.
365
366 2019-01-24  Ross Kirsling  <ross.kirsling@sony.com>
367
368         Move FileSystem to WTF
369         https://bugs.webkit.org/show_bug.cgi?id=193602
370
371         Reviewed by Yusuke Suzuki.
372
373         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
374         * NetworkProcess/NetworkDataTaskBlob.h:
375         * NetworkProcess/NetworkProcess.cpp:
376         * NetworkProcess/cache/CacheStorageEngine.cpp:
377         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
378         * NetworkProcess/cache/NetworkCache.cpp:
379         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
380         * NetworkProcess/cache/NetworkCacheData.cpp:
381         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
382         * NetworkProcess/cache/NetworkCacheFileSystem.h:
383         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
384         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
385         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
386         * NetworkProcess/cache/NetworkCacheStorage.cpp:
387         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
388         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
389         * NetworkProcess/mac/NetworkProcessMac.mm:
390         * NetworkProcess/soup/NetworkProcessSoup.cpp:
391         * PluginProcess/unix/PluginProcessMainUnix.cpp:
392         * Shared/PersistencyUtils.cpp:
393         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
394         * Shared/Plugins/unix/PluginSearchPath.cpp:
395         * Shared/WebMemorySampler.h:
396         * Shared/glib/ProcessExecutablePathGLib.cpp:
397         * Shared/ios/ChildProcessIOS.mm:
398         * Shared/mac/ChildProcessMac.mm:
399         * Shared/mac/SandboxExtensionMac.mm:
400         * UIProcess/API/APIContentRuleListStore.cpp:
401         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
402         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
403         * UIProcess/API/glib/IconDatabase.cpp:
404         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
405         * UIProcess/API/glib/WebKitFileChooserRequest.cpp:
406         * UIProcess/API/glib/WebKitWebContext.cpp:
407         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
408         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
409         * UIProcess/Automation/WebAutomationSession.cpp:
410         * UIProcess/Cocoa/DownloadClient.mm:
411         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
412         * UIProcess/Cocoa/WebViewImpl.mm:
413         * UIProcess/DeviceIdHashSaltStorage.cpp:
414         * UIProcess/Downloads/DownloadProxy.cpp:
415         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
416         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
417         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
418         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
419         * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
420         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
421         * UIProcess/ServiceWorkerProcessProxy.cpp:
422         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
423         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
424         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
425         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
426         * UIProcess/glib/WebProcessProxyGLib.cpp:
427         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
428         * UIProcess/gtk/WebProcessPoolGtk.cpp:
429         * UIProcess/ios/WKContentViewInteraction.mm:
430         * UIProcess/ios/forms/WKFileUploadPanel.mm:
431         * UIProcess/mac/WebPageProxyMac.mm:
432         * UIProcess/win/WebProcessPoolWin.cpp:
433         * UIProcess/win/WebView.cpp:
434         * UIProcess/wpe/WebProcessPoolWPE.cpp:
435         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp:
436         * WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp:
437         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
438         * WebProcess/Plugins/Netscape/NetscapePluginStream.h:
439         * WebProcess/Plugins/PluginProcessConnection.cpp:
440         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
441         * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp:
442         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
443         * WebProcess/cocoa/WebProcessCocoa.mm:
444
445 2019-01-23  Simon Fraser  <simon.fraser@apple.com>
446
447         Create "frame hosting" nodes for the scrolling tree
448         https://bugs.webkit.org/show_bug.cgi?id=193753
449
450         Reviewed by Antti Koivisto.
451
452         When the scrolling tree crosses frame boundaries, mutations in the parent frame currently
453         require the iframe's scrolling node to get reparented in a new ancestor, which requires
454         a layer tree walk of the parent frame. This is error-prone, and not very future-proof.
455
456         Fix this by introducing "frame hosting" scrolling tree nodes. These are mostly inert
457         nodes that are owned by the RenderIFrame's layer backing in the parent frame, and exist
458         to provide a consistent parent node for the subframe's scrolling node.
459
460         This patch adds the node types, but does not instantiate them yet.
461
462         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
463         (ArgumentCoder<ScrollingStateFrameHostingNode>::encode):
464         (ArgumentCoder<ScrollingStateFrameHostingNode>::decode):
465         (WebKit::encodeNodeAndDescendants):
466         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
467         (WebKit::dump):
468         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
469         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
470         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
471         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
472         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
473         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
474
475 2019-01-23  Ross Kirsling  <ross.kirsling@sony.com>
476
477         [Curl] Unreviewed build fix for r240292 and friends.
478
479         WinCairo test stability must be restored in subsequent patch.
480
481         * NetworkProcess/curl/NetworkProcessCurl.cpp:
482         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
483         (WebKit::NetworkProcess::setNetworkProxySettings):
484
485 2019-01-23  Commit Queue  <commit-queue@webkit.org>
486
487         Unreviewed, rolling out r240403.
488         https://bugs.webkit.org/show_bug.cgi?id=193757
489
490         "Causes multiple crashes on macOS port (probably used wrong
491         ENABLE macro)" (Requested by ddkilzer on #webkit).
492
493         Reverted changeset:
494
495         "[Curl] Unreviewed build fix for r240292 and friends."
496         https://trac.webkit.org/changeset/240403
497
498 2019-01-23  Ross Kirsling  <ross.kirsling@sony.com>
499
500         [Curl] Unreviewed build fix for r240292 and friends.
501
502         WinCairo test stability must be restored in subsequent patch.
503
504         * NetworkProcess/curl/NetworkProcessCurl.cpp:
505         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
506         (WebKit::NetworkProcess::setNetworkProxySettings):
507
508 2019-01-23  Alex Christensen  <achristensen@webkit.org>
509
510         Stop using NetworkProcess::singleton
511         https://bugs.webkit.org/show_bug.cgi?id=193700
512
513         Reviewed by Don Olmstead.
514
515         This replaces it with a NeverDestroyed<NetworkProcess> and paves the way for more interesting things.
516
517         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
518         * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
519         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
520         * NetworkProcess/NetworkProcess.cpp:
521         (WebKit::NetworkProcess::NetworkProcess):
522         (WebKit::NetworkProcess::singleton): Deleted.
523         * NetworkProcess/NetworkProcess.h:
524         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
525         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
526         * NetworkProcess/win/NetworkProcessMainWin.cpp:
527         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
528         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
529         (WebKit::initializeChildProcess):
530         (WebKit::XPCServiceInitializer):
531
532 2019-01-23  Ryan Haddad  <ryanhaddad@apple.com>
533
534         Unreviewed, rolling out r240343.
535
536         Caused 4 PSON API test failures.
537
538         Reverted changeset:
539
540         "[PSON] Flash on back navigation on Mac"
541         https://bugs.webkit.org/show_bug.cgi?id=193716
542         https://trac.webkit.org/changeset/240343
543
544 2019-01-23  Chris Dumez  <cdumez@apple.com>
545
546         Deprecate API to limit the maximum number of WebProcesses
547         https://bugs.webkit.org/show_bug.cgi?id=193725
548         <rdar://problem/47464879>
549
550         Reviewed by Geoff Garen.
551
552         Deprecate API to limit the maximum number of WebProcesses and make it a no-op. It adds
553         complexity and is not safe (conflicts with PSON).
554
555         Add a new usesSingleWebProcess SPI to _WKProcessPoolConfiguration to be used by
556         Minibrowser / Safari in order to disable process per tab (can be useful for debugging).
557         Note that enabling the single WebProcess mode will disable PSON and process prewarming.
558
559         * UIProcess/API/APIProcessPoolConfiguration.cpp:
560         (API::ProcessPoolConfiguration::createWithLegacyOptions):
561         (API::ProcessPoolConfiguration::copy):
562         * UIProcess/API/APIProcessPoolConfiguration.h:
563         * UIProcess/API/C/WKContext.cpp:
564         (WKContextSetMaximumNumberOfProcesses):
565         (WKContextGetMaximumNumberOfProcesses):
566         * UIProcess/API/C/WKContext.h:
567         * UIProcess/API/Cocoa/WKProcessPool.mm:
568         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
569         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
570         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
571         (-[_WKProcessPoolConfiguration maximumProcessCount]):
572         (-[_WKProcessPoolConfiguration setMaximumProcessCount:]):
573         (-[_WKProcessPoolConfiguration usesSingleWebProcess]):
574         (-[_WKProcessPoolConfiguration setUsesSingleWebProcess:]):
575         (-[_WKProcessPoolConfiguration description]):
576         * UIProcess/API/glib/WebKitWebContext.cpp:
577         (webkitWebContextConstructed):
578         (webkit_web_context_set_process_model):
579         (webkit_web_context_set_web_process_count_limit):
580         * UIProcess/WebProcessPool.cpp:
581         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
582         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
583         (WebKit::WebProcessPool::processForNavigationInternal):
584         * UIProcess/WebProcessPool.h:
585
586 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
587
588         Switch NetworkStorageSession portions of ResourceLoadStatistics to Async message passing style
589         https://bugs.webkit.org/show_bug.cgi?id=193659
590         <rdar://problem/47433290>
591
592         Reviewed by Alex Christensen.
593
594         Change the implementations of ResourceLoadStatistics code in NetworkStorageSession to use the
595         'sendWithAsyncReply' so that more of the code is autogenerated. This should make test runs more
596         consistent, and should reduce the possibility of bookkeeping errors in the message handling
597         implementations.
598
599         Fix the implementation of NetworkProcessProxy::clearCallbackStates to remove the manually constructed
600         (and incomplete) message callbacks. These errors are a big reason to move to the auto-generated
601         'sendWithAsyncReply' implementatoin. Ditto for NetworkProcessProxy::didClose.
602
603         This patch also moves an initializaton call (WebsiteDataStore::didCreateNetworkProcess) from
604         'ensureNetworkProcess' to 'processDidFinishLaunching'. In current code, the call happens before
605         a connection is established to the network process, causing initialization messages to get dropped
606         leading to test system flakiness.
607
608         Finally: The WK API test code was updated to ensure that completion handlers are always called, even
609         when built without ENABLE_RESOURCE_LOAD_STATISTICS defined.
610
611         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
612         * NetworkProcess/Classifier/ShouldGrandfatherStatistics.h: Added.
613         * NetworkProcess/Classifier/StorageAccessStatus.h: Added.
614         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
615         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
616         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
617         * NetworkProcess/NetworkProcess.cpp:
618         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
619         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
620         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
621         (WebKit::NetworkProcess::hasStorageAccessForFrame):
622         (WebKit::NetworkProcess::requestStorageAccess):
623         (WebKit::NetworkProcess::grantStorageAccess):
624         (WebKit::NetworkProcess::removeAllStorageAccess):
625         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
626         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
627         (WebKit::NetworkProcess::deleteWebsiteData):
628         * NetworkProcess/NetworkProcess.h:
629         * NetworkProcess/NetworkProcess.messages.in:
630         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
631         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
632         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
633         (WKWebsiteDataStoreStatisticsResetToConsistentState):
634         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
635         * UIProcess/Network/NetworkProcessProxy.cpp:
636         (WebKit::NetworkProcessProxy::clearCallbackStates): Remove incomplete clean-up code that
637         is now autogenerated.
638         (WebKit::NetworkProcessProxy::didClose): Ditto.
639         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
640         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
641         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
642         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
643         (WebKit::NetworkProcessProxy::requestStorageAccess):
644         (WebKit::NetworkProcessProxy::grantStorageAccess):
645         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
646         (WebKit::NetworkProcessProxy::setCacheMaxAgeCapForPrevalentResources):
647         (WebKit::NetworkProcessProxy::setCacheMaxAgeCap):
648         (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources):
649         (WebKit::NetworkProcessProxy::didUpdateBlockCookies): Deleted.
650         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies): Deleted.
651         (WebKit::NetworkProcessProxy::didUpdateRuntimeSettings): Deleted.
652         (WebKit::NetworkProcessProxy::storageAccessRequestResult): Deleted.
653         (WebKit::NetworkProcessProxy::storageAccessOperationResult): Deleted.
654         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess): Deleted.
655         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources): Deleted.
656         * UIProcess/Network/NetworkProcessProxy.h:
657         * UIProcess/Network/NetworkProcessProxy.messages.in:
658         * UIProcess/WebPageProxy.cpp:
659         * UIProcess/WebProcessPool.cpp:
660         (WebKit::WebProcessPool::ensureNetworkProcess): Move WebsiteDataStore 'didCreateNetworkProcess'
661         to 'processDidFinishLaunching'. Currently the call happens before a connection is established,
662         causing initialization messages to get dropped.
663         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
664         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
665         (WebKit::WebsiteDataStore::removeData):
666         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
667         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
668         (WebKit::WebsiteDataStore::setGrandfatheringTime):
669         (WebKit::WebsiteDataStore::setCacheMaxAgeCap):
670         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
671         (WebKit::WebsiteDataStore::setPrevalentResource):
672         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
673         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
674         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
675         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
676         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
677         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
678         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
679         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
680         * UIProcess/WebsiteData/WebsiteDataStore.h:
681         * WebKit.xcodeproj/project.pbxproj:
682
683 2019-01-23  Sihui Liu  <sihui_liu@apple.com>
684
685         Clean up IndexedDB files between tests
686         https://bugs.webkit.org/show_bug.cgi?id=192796
687         <rdar://problem/46824999>
688
689         Reviewed by Geoffrey Garen.
690
691         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
692         (WKWebsiteDataStoreRemoveAllIndexedDatabases):
693         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
694
695 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
696
697         [iOS] fast/events/touch/ios/hover-when-style-change-is-async.html times out
698         https://bugs.webkit.org/show_bug.cgi?id=193182
699         <rdar://problem/47452154>
700
701         Reviewed by Tim Horton.
702
703         Fix an existing bug where blurring an element doesn't always un-suppress text interactions.
704
705         * UIProcess/ios/WKContentViewInteraction.mm:
706         (-[WKContentView _elementDidBlur]):
707
708 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
709
710         Minor improvements to NetworkProcess
711         https://bugs.webkit.org/show_bug.cgi?id=193708
712
713         Reviewed by Alex Christensen.
714
715         * NetworkProcess/NetworkProcess.cpp:
716         (WebKit::NetworkProcess::switchToNewTestingSession): Fix a spelling error.
717         (WebKit::NetworkProcess::ensureSession): Add useful assertion.
718         (WebKit::NetworkProcess::defaultStorageSession const): Split into platform functions.
719         (WebKit::NetworkProcess::destroySession): Add useful assertion.
720         * NetworkProcess/NetworkProcess.h:
721         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
722         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
723         * NetworkProcess/curl/NetworkProcessCurl.cpp:
724         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
725         * NetworkProcess/soup/NetworkProcessSoup.cpp:
726         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
727
728 2019-01-23  Daniel Bates  <dabates@apple.com>
729
730         Fix the Apple Internal build. See <rdar://problem/47486758>.
731
732         * UIProcess/ios/WKContentViewInteraction.mm:
733         (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):
734
735 2019-01-23  Per Arne Vollan  <pvollan@apple.com>
736
737         [macOS] Sandbox fails to compile
738         https://bugs.webkit.org/show_bug.cgi?id=193727
739         <rdar://problem/47476903>
740
741         Reviewed by Brent Fulgham.
742
743         Use '(with send-signal SIGKILL)' instead of '(with termination)'.
744
745         * WebProcess/com.apple.WebProcess.sb.in:
746
747 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
748
749         REGRESSION (r240243): CrashTracer: WebKitTestRunnerApp at com.apple.WebKit: WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const + 32
750         https://bugs.webkit.org/show_bug.cgi?id=193723
751         <rdar://problem/47476802>
752
753         Reviewed by David Kilzer.
754
755         The new code added in r240243 could attempt to submit telemetry after the relevant
756         WebResourceLoadStatisticsStore was destroyed. We should guard against this possibility.
757
758         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
759         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
760
761 2019-01-23  Antti Koivisto  <antti@apple.com>
762
763         [PSON] Flash on back navigation on Mac
764         https://bugs.webkit.org/show_bug.cgi?id=193716
765         <rdar://problem/47148458>
766
767         Reviewed by Chris Dumez.
768
769         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
770
771         * UIProcess/SuspendedPageProxy.cpp:
772         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
773
774         Remove the suspended page (so closing it on web process side) if the suspension fails.
775         Skip this if we are using web process side compositing on Mac.
776
777         * UIProcess/WebPageProxy.cpp:
778         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
779
780         On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
781
782         * UIProcess/WebProcessPool.cpp:
783         (WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):
784         * UIProcess/WebProcessPool.h:
785         * WebProcess/WebPage/WebPage.cpp:
786         (WebKit::WebPage::suspendForProcessSwap):
787
788         Don't close the page on suspension failure.
789
790 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
791
792         Introduce UndoStep::label() and adopt it in WebKitLegacy and WebKit
793         https://bugs.webkit.org/show_bug.cgi?id=193706
794         <rdar://problem/44807048>
795
796         Reviewed by Ryosuke Niwa.
797
798         * UIProcess/Cocoa/WebViewImpl.mm:
799         (WebKit::WebViewImpl::registerEditCommand):
800         * UIProcess/WebEditCommandProxy.cpp:
801         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
802         * UIProcess/WebEditCommandProxy.h:
803
804         Drive-by tweak: make WebEditCommandProxy's backpointer to its WebPageProxy a WeakPtr instead of a raw pointer.
805         Additionally, call clear() instead of setting m_page to 0 upon invalidation. Also, turn the WebPageProxy*
806         argument into a WebPageProxy&, since the WebPageProxy must exist when it creates a new WebEditCommandProxy.
807
808         (WebKit::WebEditCommandProxy::create):
809         (WebKit::WebEditCommandProxy::label const):
810         (WebKit::WebEditCommandProxy::invalidate):
811         (WebKit::WebEditCommandProxy::editAction const): Deleted.
812
813         Adjust UI-side logic to just handle the undo/redo label, rather than map the edit action to a localized string.
814
815         * UIProcess/WebPageProxy.cpp:
816         (WebKit::WebPageProxy::registerEditCommandForUndo):
817         (WebKit::WebPageProxy::resetState):
818
819         Tweak this to use std::exchange instead of copying all the WebEditCommandProxy RefPtrs into a separate Vector
820         and then iterating over the Vector.
821
822         * UIProcess/WebPageProxy.h:
823         * UIProcess/WebPageProxy.messages.in:
824
825         Adjust this so that we only send the undo/redo label over IPC, rather than the edit action type.
826
827         * UIProcess/ios/PageClientImplIOS.mm:
828         (WebKit::PageClientImpl::registerEditCommand):
829         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
830         (WebKit::WebEditorClient::registerUndoStep):
831
832 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
833
834         [SOUP] Remove libsoup cruft from WebProcess
835         https://bugs.webkit.org/show_bug.cgi?id=193710
836
837         Reviewed by Carlos Garcia Campos.
838
839         SoupNetworkSession is no longer accessible from the web process because it's owned
840         (indirectly) by NetworkProcess after r240292. It doesn't make sense to have any libsoup
841         code under WebProcess anymore. The current libsoup code consists of (a) unused stuff to be
842         removed, (b) stuff unrelated to libsoup, which should move to a WebProcessGLib.cpp, and (c)
843         WebKitSoupRequestInputStream, which is only used by NetworkProcess and should move there
844
845         * NetworkProcess/soup/WebKitSoupRequestInputStream.cpp: Renamed from Source/WebKit/WebProcess/soup/WebKitSoupRequestInputStream.cpp.
846         (AsyncReadData::AsyncReadData):
847         (webkitSoupRequestInputStreamReadAsyncResultComplete):
848         (webkitSoupRequestInputStreamPendingReadAsyncComplete):
849         (webkitSoupRequestInputStreamHasDataToRead):
850         (webkitSoupRequestInputStreamIsWaitingForData):
851         (webkitSoupRequestInputStreamReadAsync):
852         (webkitSoupRequestInputStreamReadFinish):
853         (webkitSoupRequestInputStreamFinalize):
854         (webkit_soup_request_input_stream_init):
855         (webkit_soup_request_input_stream_class_init):
856         (webkitSoupRequestInputStreamNew):
857         (webkitSoupRequestInputStreamAddData):
858         (webkitSoupRequestInputStreamDidFailWithError):
859         (webkitSoupRequestInputStreamFinished):
860         * NetworkProcess/soup/WebKitSoupRequestInputStream.h: Renamed from Source/WebKit/WebProcess/soup/WebKitSoupRequestInputStream.h.
861         * SourcesGTK.txt:
862         * SourcesWPE.txt:
863         * UIProcess/soup/WebProcessPoolSoup.cpp:
864         (WebKit::WebProcessPool::setNetworkProxySettings): Don't send message to web processes.
865         * WebProcess/WebProcess.h:
866         * WebProcess/WebProcess.messages.in:
867         * WebProcess/glib/WebProcessGLib.cpp: Renamed from Source/WebKit/WebProcess/soup/WebProcessSoup.cpp.
868         (WebKit::WebProcess::platformSetCacheModel):
869         (WebKit::WebProcess::platformInitializeWebProcess):
870         (WebKit::WebProcess::platformTerminate):
871
872 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
873
874         [SOUP] Clean up NetworkStorageSession
875         https://bugs.webkit.org/show_bug.cgi?id=193707
876
877         Reviewed by Carlos Garcia Campos.
878
879         Restore an important call to clearSoupNetworkSession that was removed in r240292. Also,
880         adapt to NetworkStorageSessions API changes.
881
882         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
883         (WebKit::LegacyCustomProtocolManager::registerScheme):
884         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
885         * NetworkProcess/soup/NetworkProcessSoup.cpp:
886         (WebKit::NetworkProcess::userPreferredLanguagesChanged):
887         (WebKit::NetworkProcess::setNetworkProxySettings):
888         * NetworkProcess/soup/NetworkSessionSoup.cpp:
889         (WebKit::NetworkSessionSoup::soupSession const):
890
891 2019-01-23  Philippe Normand  <pnormand@igalia.com>
892
893         [GTK] Crash when browsing inspector:// uri without port set
894         https://bugs.webkit.org/show_bug.cgi?id=193721
895
896         Reviewed by Michael Catanzaro.
897
898         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
899         (WebKit::RemoteInspectorProtocolHandler::handleRequest): Return
900         back to caller after setting the error, if no port was provided
901         along with the inspector URL.
902
903 2019-01-23  David Kilzer  <ddkilzer@apple.com>
904
905         Switch remaining CoreMedia soft-linking in WebKit over to CoreMediaSoftLink.{cpp,h}
906         <https://webkit.org/b/193694>
907         <rdar://problem/47464025>
908
909         Reviewed by Tim Horton.
910
911         * Shared/ios/WebIconUtilities.mm:
912         - Switch to using CoreMediaSoftLink.{h,mm} in PAL.
913
914 2019-01-22  Chris Dumez  <cdumez@apple.com>
915
916         Regression(r240178) Some API tests are crashing
917         https://bugs.webkit.org/show_bug.cgi?id=193680
918
919         Reviewed by Alex Christensen.
920
921         r240178 made sure that userScripts / scriptMessageHandlers / contentExtensions are always
922         properly populated in the WebPageCreationParameters. This was needed in case we need to
923         reconstruct the WebUserContentController on the WebProcess side. However, this caused a
924         regression in the case we reuse a process where the WebUserContentController still exists
925         (because it was kept alive, e.g. by the WebPageGroup). In that case, we would add duplicate
926         entries to the existing WebUserContentController instance because its "add" methods did not
927         have duplicate checks. To address the issue, this patch adds duplicate checks to the
928         WebUserContentController "add" methods.
929
930         * WebProcess/UserContent/WebUserContentController.cpp:
931         (WebKit::WebUserContentController::addUserScriptMessageHandlerInternal):
932         (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal):
933         (WebKit::WebUserContentController::addUserScriptInternal):
934         (WebKit::WebUserContentController::removeUserScriptInternal):
935         (WebKit::WebUserContentController::addUserStyleSheetInternal):
936         (WebKit::WebUserContentController::removeUserStyleSheetInternal):
937         (WebKit::WebUserContentController::forEachUserMessageHandler const):
938         * WebProcess/UserContent/WebUserContentController.h:
939
940 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
941
942         Unreviewed attempt to fix GTK/WPE bots
943         https://bugs.webkit.org/show_bug.cgi?id=193580
944         <rdar://problem/47457742>
945
946         Doesn't make sense to clear the storage session right after creating it. This should fix
947         network process crash on startup under G_DEBUG=fatal-criticals due to the storage session
948         not having a cookie jar.
949
950         * NetworkProcess/NetworkProcess.cpp:
951         (WebKit::NetworkProcess::NetworkProcess):
952
953 2019-01-22  Megan Gardner  <megan_gardner@apple.com>
954
955         Cancel Web Touches Properly so that long presses on YouTube links do not incorrectly trigger a load
956         https://bugs.webkit.org/show_bug.cgi?id=193687
957         <rdar://problem/47056717>
958
959         Reviewed by Tim Horton.
960
961         Cancel web gestures when a long press is recognized.
962
963         * Platform/spi/ios/UIKitSPI.h:
964         * UIProcess/ios/WKContentViewInteraction.mm:
965         (-[WKContentView _cancelWebGestureRecognizer]):
966         (-[WKContentView _longPressRecognized:]):
967
968 2019-01-22  Alex Christensen  <achristensen@webkit.org>
969
970         Fix an internal build failure after r240292
971         https://bugs.webkit.org/show_bug.cgi?id=193580
972
973         Rubber-stamped by Wenson Hsieh.
974
975         * SourcesCocoa.txt:
976         * UIProcess/mac/WebContextMenuProxyMac.mm:
977         (-[WKMenuTarget forwardContextMenuAction:]):
978         * WebKit.xcodeproj/project.pbxproj:
979         It was apparently unclear to the compiler sometimes which "state" selector to use, and this apparently mattered.
980         Tell the compiler to use the NSMenuItem selector, but at runtime it doesn't matter.
981
982 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
983
984         Unreviewed, fix -Wunused-but-set-variable warning
985         https://bugs.webkit.org/show_bug.cgi?id=193660
986         <rdar://problem/47433602>
987
988         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
989         (WebKit::WebsiteDataStore::removeData):
990
991 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
992
993         Unreviewed, further build fixes after r240292
994         https://bugs.webkit.org/show_bug.cgi?id=193580
995         <rdar://problem/47457742>
996
997         Oops.
998
999         * NetworkProcess/NetworkProcess.cpp:
1000         (WebKit::NetworkProcess::defaultStorageSession const):
1001
1002 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1003
1004         Unreviewed, further build fixes after r240292
1005         https://bugs.webkit.org/show_bug.cgi?id=193580
1006         <rdar://problem/47457742>
1007
1008         This builds for libsoup. Doesn't work, but at least builds.
1009
1010         Also, speculative fixes for curl.
1011
1012         * NetworkProcess/NetworkProcess.cpp:
1013         (WebKit::NetworkProcess::defaultStorageSession const):
1014
1015 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1016
1017         Unreviewed, further build fixes after r240292
1018         https://bugs.webkit.org/show_bug.cgi?id=193580
1019         <rdar://problem/47457742>
1020
1021         Still not working yet.
1022
1023         * NetworkProcess/NetworkProcess.cpp:
1024         (WebKit::NetworkProcess::NetworkProcess):
1025         * UIProcess/API/APIHTTPCookieStore.h:
1026
1027 2019-01-22  Antti Koivisto  <antti@apple.com>
1028
1029         [iOS] Flash when swiping back to Google search result page
1030         https://bugs.webkit.org/show_bug.cgi?id=193668
1031         <rdar://problem/47071684>
1032
1033         Reviewed by Simon Fraser.
1034
1035         If the google page is scrolled, there is sometimes a short flash.
1036
1037         When restoring the page state we also restore exposedContentRect which is used to determine
1038         which part of the page to create layers for. Scroll position is restored by the UI process
1039         later so we rely on this to get the right layers for the initial view update.
1040
1041         A viewport configuration update may sometimes trample over the restored exposedContentRect,
1042         moving it to top left. In this case the initial layer tree unfreeze commit may not have
1043         layers to cover the actual visible view position.
1044
1045         * WebProcess/WebPage/WebPage.cpp:
1046         (WebKit::WebPage::didCommitLoad):
1047         * WebProcess/WebPage/WebPage.h:
1048         * WebProcess/WebPage/ios/WebPageIOS.mm:
1049         (WebKit::WebPage::restorePageState):
1050
1051         Set a bit to indicate we have already restored the exposedContentRect.
1052
1053         (WebKit::WebPage::viewportConfigurationChanged):
1054
1055         Only reset exposedContentRect if wasn't already set by restorePageState.
1056
1057 2019-01-22  Alex Christensen  <achristensen@webkit.org>
1058
1059         Fix more builds.
1060
1061         * SourcesCocoa.txt:
1062         * WebKit.xcodeproj/project.pbxproj:
1063
1064 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1065
1066         Another build fix after r240292
1067         https://bugs.webkit.org/show_bug.cgi?id=193580
1068         <rdar://problem/47457742>
1069
1070         Unreviewed, still not enough to fix soup builds, but closer.
1071
1072         * UIProcess/API/APIHTTPCookieStore.h:
1073
1074 2019-01-22  Alex Christensen  <achristensen@webkit.org>
1075
1076         Fix some builds after r240292
1077         https://bugs.webkit.org/show_bug.cgi?id=193580
1078
1079         * NetworkProcess/NetworkProcess.cpp:
1080         (WebKit::NetworkProcess::switchToNewTestingSession):
1081         * NetworkProcess/cache/NetworkCache.cpp:
1082         (WebKit::NetworkCache::Cache::retrieve):
1083
1084 2019-01-22  Brian Burg  <bburg@apple.com>
1085
1086         Automation.computeElementLayout should return visual viewport-aware coordinates
1087         https://bugs.webkit.org/show_bug.cgi?id=193598
1088         <rdar://problem/35325644>
1089
1090         Unreviewed, restore a mistakenly-deleted line whose absence causes hangs.
1091
1092         * Shared/CoordinateSystem.h:
1093
1094 2019-01-22  Alex Christensen  <achristensen@webkit.org>
1095
1096         Move NetworkStorageSession ownership to NetworkProcess
1097         https://bugs.webkit.org/show_bug.cgi?id=193580
1098
1099         Reviewed by Geoff Garen.
1100
1101         * NetworkProcess/Cookies/WebCookieManager.cpp:
1102         (WebKit::WebCookieManager::WebCookieManager):
1103         (WebKit::WebCookieManager::getHostnamesWithCookies):
1104         (WebKit::WebCookieManager::deleteCookiesForHostname):
1105         (WebKit::WebCookieManager::deleteAllCookies):
1106         (WebKit::WebCookieManager::deleteCookie):
1107         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
1108         (WebKit::WebCookieManager::getAllCookies):
1109         (WebKit::WebCookieManager::getCookies):
1110         (WebKit::WebCookieManager::setCookie):
1111         (WebKit::WebCookieManager::setCookies):
1112         (WebKit::WebCookieManager::startObservingCookieChanges):
1113         (WebKit::WebCookieManager::stopObservingCookieChanges):
1114         * NetworkProcess/Cookies/WebCookieManager.h:
1115         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
1116         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1117         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1118         (WebKit::storageSession):
1119         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1120         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
1121         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
1122         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
1123         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
1124         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
1125         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
1126         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
1127         * NetworkProcess/NetworkProcess.cpp:
1128         (WebKit::NetworkProcess::initializeNetworkProcess):
1129         (WebKit::NetworkProcess::clearCachedCredentials):
1130         (WebKit::NetworkProcess::switchToNewTestingSession):
1131         (WebKit::NetworkProcess::ensureSession):
1132         (WebKit::NetworkProcess::storageSession const):
1133         (WebKit::NetworkProcess::defaultStorageSession const):
1134         (WebKit::NetworkProcess::forEachNetworkStorageSession):
1135         (WebKit::NetworkProcess::destroySession):
1136         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
1137         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
1138         (WebKit::NetworkProcess::hasStorageAccessForFrame):
1139         (WebKit::NetworkProcess::getAllStorageAccessEntries):
1140         (WebKit::NetworkProcess::grantStorageAccess):
1141         (WebKit::NetworkProcess::removeAllStorageAccess):
1142         (WebKit::NetworkProcess::removePrevalentDomains):
1143         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
1144         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
1145         (WebKit::NetworkProcess::fetchWebsiteData):
1146         (WebKit::NetworkProcess::deleteWebsiteData):
1147         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1148         * NetworkProcess/NetworkProcess.h:
1149         * NetworkProcess/NetworkResourceLoader.cpp:
1150         (WebKit::NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation):
1151         (WebKit::NetworkResourceLoader::logCookieInformation const):
1152         * NetworkProcess/NetworkSession.cpp:
1153         (WebKit::NetworkSession::networkStorageSession const):
1154         * NetworkProcess/NetworkStorageSessionProvider.h:
1155         * NetworkProcess/cache/NetworkCache.cpp:
1156         (WebKit::NetworkCache::makeUseDecision):
1157         (WebKit::NetworkCache::Cache::retrieve):
1158         (WebKit::NetworkCache::Cache::makeEntry):
1159         (WebKit::NetworkCache::Cache::makeRedirectEntry):
1160         (WebKit::NetworkCache::Cache::update):
1161         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1162         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
1163         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1164         (WebKit::NetworkProcess::platformSyncAllCookies):
1165         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1166         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1167         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1168         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1169         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1170         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1171         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1172         * SourcesCocoa.txt:
1173         * UIProcess/API/APIHTTPCookieStore.cpp:
1174         (API::HTTPCookieStore::~HTTPCookieStore):
1175         (API::HTTPCookieStore::cookies):
1176         (API::HTTPCookieStore::setCookie):
1177         (API::HTTPCookieStore::deleteCookie):
1178         (API::HTTPCookieStore::registerObserver):
1179         (API::HTTPCookieStore::unregisterObserver):
1180         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
1181         (API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
1182         (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
1183         (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
1184         (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
1185         (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
1186         (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
1187         * UIProcess/API/APIHTTPCookieStore.h:
1188         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: Added.
1189         (API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
1190         (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
1191         (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
1192         (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
1193         (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
1194         (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
1195         * UIProcess/WebProcessPool.cpp:
1196         (WebKit::WebProcessPool::clearCachedCredentials):
1197         * WebKit.xcodeproj/project.pbxproj:
1198         * WebProcess/Plugins/PluginView.cpp:
1199         (WebKit::PluginView::getAuthenticationInfo):
1200         * WebProcess/WebProcess.cpp:
1201         (WebKit::WebProcess::deleteWebsiteData):
1202         (WebKit::WebProcess::clearCachedCredentials): Deleted.
1203         * WebProcess/WebProcess.h:
1204         * WebProcess/WebProcess.messages.in:
1205
1206 2019-01-22  Per Arne Vollan  <pvollan@apple.com>
1207
1208         [macOS] Adjust logging policy in WebKit's sandbox
1209         https://bugs.webkit.org/show_bug.cgi?id=193454
1210
1211         Reviewed by Brent Fulgham.
1212
1213         Add a rule to initially deny all calls, since the default is to allow every call.
1214         Later rules allow syscalls that we determined are needed for proper WebKit function.
1215         This reduces the API surface available to attackers.
1216
1217         * WebProcess/com.apple.WebProcess.sb.in:
1218
1219 2019-01-22  Daniel Bates  <dabates@apple.com>
1220
1221         [iOS] WebKit should handle shift state changes when using the software keyboard
1222         https://bugs.webkit.org/show_bug.cgi?id=191475
1223         <rdar://problem/45949246>
1224
1225         Reviewed by Brent Fulgham.
1226
1227         Implement UIKit SPI to be notified of shift state changes to the software keyboard
1228         and dispatch a synthetic keydown or keyup event for either the Shift key or Caps Lock
1229         key.
1230
1231         A side benefit of this change is that we now show and hide the caps lock indicator
1232         in a focused password field when caps lock is enabled or disabled using the software
1233         keyboard, respectively.
1234
1235         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
1236         * SourcesCocoa.txt:
1237         * UIProcess/ios/WKContentViewInteraction.mm:
1238         (-[WKContentView modifierFlagsDidChangeFrom:to:]): Create a synthetic flags changed
1239         web event based on the state change and dispatch it.
1240         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Early return if the event
1241         was a synethic flags change event so that we do not notify UIKit about this event
1242         as it does not know anything about such synthetic events.
1243         * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h: Added.
1244         * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm: Added.
1245         (-[WKSyntheticFlagsChangedWebEvent initWithKeyCode:modifiers:keyDown:]):
1246         (-[WKSyntheticFlagsChangedWebEvent initWithCapsLockState:]):
1247         (-[WKSyntheticFlagsChangedWebEvent initWithShiftState:]):
1248         * WebKit.xcodeproj/project.pbxproj:
1249
1250 2019-01-22  Daniel Bates  <dabates@apple.com>
1251
1252         [iOS] Interpret text key commands on keydown and app key commands on keypress
1253         https://bugs.webkit.org/show_bug.cgi?id=192897
1254         <rdar://problem/46857378>
1255
1256         Reviewed by Brent Fulgham.
1257
1258         Adopt SPI to interpret text key commands and app key commands independently on keydown (isCharEvent
1259         is false) and keypress (isCharEvent is true), respectively.
1260
1261         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
1262         * UIProcess/ios/WKContentViewInteraction.mm:
1263         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
1264
1265 2019-01-22  David Kilzer  <ddkilzer@apple.com>
1266
1267         C strings in ClientCertificateAuthenticationXPCConstants.h are duplicated
1268         <https://webkit.org/b/193607>
1269         <rdar://problem/47334613>
1270
1271         Reviewed by Alex Christensen.
1272
1273         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
1274         (WebKit::AuthenticationManager::initializeConnection):
1275         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
1276         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
1277         - Update name of constants.
1278
1279         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.cpp: Copied from Source/WebKit/Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h.
1280         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h:
1281         - Put constant values in a namespace, and move values to
1282           ClientCertificateAuthenticationXPCConstants.cpp.
1283
1284         * SourcesCocoa.txt:
1285         * UnifiedSources-input.xcfilelist:
1286         * WebKit.xcodeproj/project.pbxproj:
1287         - Add ClientCertificateAuthenticationXPCConstants.cpp.
1288
1289 2019-01-22  David Kilzer  <ddkilzer@apple.com>
1290
1291         Switch remaining QuickLook soft-linking in WebCore, WebKit over to QuickLookSoftLink.{cpp,h}
1292         <https://webkit.org/b/193654>
1293         <rdar://problem/47430290>
1294
1295         Reviewed by Alex Christensen.
1296
1297         - Moves QuickLookSoftLink.{h,mm} to PAL.
1298         - Adds soft-link to 3 classes to consolidate QuickLook.framework
1299           soft-linking.
1300         - Updates existing source to work with above changes.
1301
1302         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1303         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1304         (WebKit::SystemPreviewController::start):
1305         * UIProcess/ios/WKSystemPreviewView.mm:
1306         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
1307         - Switch to using QuickLookSoftLink.{h,mm} in PAL.
1308
1309 2019-01-22  Oriol Brufau  <obrufau@igalia.com>
1310
1311         [css-logical] Implement flow-relative margin, padding and border shorthands
1312         https://bugs.webkit.org/show_bug.cgi?id=188697
1313
1314         Reviewed by Simon Fraser and Antti Koivisto.
1315
1316         Add a CSSLogicalEnabled runtime flag.
1317
1318         * Shared/WebPreferences.yaml:
1319
1320 2019-01-22  Frederic Wang  <fwang@igalia.com>
1321
1322         Enable CSSOMViewScrollingAPI
1323         https://bugs.webkit.org/show_bug.cgi?id=189472
1324
1325         Reviewed by Simon Fraser.
1326
1327         This patch enables the CSSOMViewScrollingAPI option by default. This feature has already been
1328         enabled in tests since r235855. Basically, this change fixes an old compatibility issue
1329         regarding which scrolling element correspond to the viewport in standard mode (WebKit uses
1330         document.body while Gecko/Edge/Chromium use document.documentElement as described in the
1331         CSSOM View specification). WebKit developers writing tests can use document.scrollingElement
1332         for that purpose, so that they work independently of whether the option is enabled.
1333
1334         [1] https://lists.webkit.org/pipermail/webkit-dev/2018-January/029857.html
1335
1336         * Shared/WebPreferences.yaml: Enable by default and remove "experimental" category in
1337         accordance with the new policy. Instead, keep an internal flag only for developers.
1338
1339 2019-01-21  Antti Koivisto  <antti@apple.com>
1340
1341         [iOS] Handle hit testing for subframes
1342         https://bugs.webkit.org/show_bug.cgi?id=192303
1343
1344         Reviewed by Frédéric Wang.
1345
1346         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1347         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1348
1349         Only set delegatesScrolling for the main frame.
1350
1351 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
1352
1353         Unreviewed test fix after r240243
1354         Nhttps://bugs.webkit.org/show_bug.cgi?id=193660
1355         <rdar://problem/47433602>
1356
1357         The new ResourceLoadStatistics section of 'removeData' was incrementing the
1358         pending callback count before deciding whether to send a message to delete
1359         data. This left the count out-of-balance leading to the operation never
1360         completing.
1361
1362         This patch also prevents sending a second message to the NetworkProcess
1363         requesting data be deleted if the message was already sent in an earlier
1364         section of the method (e.g., as typically happens when all website data
1365         is being deleted).
1366
1367         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1368         (WebKit::WebsiteDataStore::removeData):
1369
1370 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
1371
1372         Implement message handlers for NetworkProcess-based ResourceLoadStatistics
1373         https://bugs.webkit.org/show_bug.cgi?id=193556
1374         <rdar://problem/47368501>
1375
1376         Reviewed by Alex Christensen.
1377
1378         This patch adds a number of sibling methods for tracking ResourceLoadStatistics when the
1379         observations are being handled in the NetworkProcess, rather than the UIProcess. The
1380         original versions of these methods will be removed as part of Bug 193303.
1381
1382         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1383         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
1384         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
1385         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
1386         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1387         (WebKit::ResourceLoadStatisticsMemoryStore::store const):
1388         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1389         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
1390         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenTelemetryWasCaptured):
1391         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1392         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
1393         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
1394         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1395         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
1396         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1397         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1398         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
1399         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
1400         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
1401         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
1402         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
1403         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
1404         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
1405         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
1406         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
1407         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
1408         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
1409         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
1410         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
1411         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
1412         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
1413         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
1414         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
1415         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
1416         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
1417         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1418         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
1419         (WebKit::WebResourceLoadStatisticsStore::notifyResourceLoadStatisticsProcessed):
1420         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
1421         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData):
1422         (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const):
1423         (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const):
1424         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1425         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
1426         (WebKit::submitTopList):
1427         (WebKit::submitTopLists):
1428         (WebKit::notifyPages):
1429         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1430         (WebKit::nonEphemeralWebPageProxy): Deleted.
1431         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1432         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
1433         * NetworkProcess/NetworkConnectionToWebProcess.h:
1434         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1435         * NetworkProcess/NetworkProcess.cpp:
1436         (WebKit::NetworkProcess::dumpResourceLoadStatistics):
1437         (WebKit::NetworkProcess::isGrandfathered):
1438         (WebKit::NetworkProcess::isPrevalentResource):
1439         (WebKit::NetworkProcess::isVeryPrevalentResource):
1440         (WebKit::NetworkProcess::setGrandfathered):
1441         (WebKit::NetworkProcess::setPrevalentResource):
1442         (WebKit::NetworkProcess::setPrevalentResourceForDebugMode):
1443         (WebKit::NetworkProcess::setVeryPrevalentResource):
1444         (WebKit::NetworkProcess::clearPrevalentResource):
1445         (WebKit::NetworkProcess::submitTelemetry):
1446         (WebKit::NetworkProcess::scheduleCookieBlockingUpdate):
1447         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
1448         (WebKit::NetworkProcess::resetParametersToDefaultValues):
1449         (WebKit::NetworkProcess::scheduleStatisticsAndDataRecordsProcessing):
1450         (WebKit::NetworkProcess::setNotifyPagesWhenDataRecordsWereScanned):
1451         (WebKit::NetworkProcess::setNotifyPagesWhenTelemetryWasCaptured):
1452         (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin):
1453         (WebKit::NetworkProcess::isRegisteredAsRedirectingTo):
1454         (WebKit::NetworkProcess::isRegisteredAsSubFrameUnder):
1455         (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin):
1456         (WebKit::NetworkProcess::setSubresourceUniqueRedirectTo):
1457         (WebKit::NetworkProcess::setSubresourceUniqueRedirectFrom):
1458         (WebKit::NetworkProcess::isRegisteredAsSubresourceUnder):
1459         (WebKit::NetworkProcess::setTopFrameUniqueRedirectTo):
1460         (WebKit::NetworkProcess::setTopFrameUniqueRedirectFrom):
1461         (WebKit::NetworkProcess::setLastSeen):
1462         (WebKit::NetworkProcess::hasStorageAccess):
1463         (WebKit::NetworkProcess::requestStorageAccess):
1464         (WebKit::NetworkProcess::grantStorageAccess):
1465         (WebKit::NetworkProcess::logUserInteraction):
1466         (WebKit::NetworkProcess::hadUserInteraction):
1467         (WebKit::NetworkProcess::clearUserInteraction):
1468         (WebKit::NetworkProcess::setGrandfatheringTime):
1469         (WebKit::NetworkProcess::setMaxStatisticsEntries):
1470         (WebKit::NetworkProcess::setMinimumTimeBetweenDataRecordsRemoval):
1471         (WebKit::NetworkProcess::setPruneEntriesDownTo):
1472         (WebKit::NetworkProcess::setTimeToLiveUserInteraction):
1473         (WebKit::NetworkProcess::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1474         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
1475         (WebKit::NetworkProcess::setResourceLoadStatisticsDebugMode):
1476         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
1477         (WebKit::NetworkProcess::deleteWebsiteData):
1478         (WebKit::filterForTopLevelDomains):
1479         (WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
1480         (WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData):
1481         * NetworkProcess/NetworkProcess.h:
1482         * NetworkProcess/NetworkProcess.messages.in:
1483         * NetworkProcess/NetworkSession.cpp:
1484         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
1485         (WebKit::NetworkSession::notifyResourceLoadStatisticsProcessed):
1486         (WebKit::NetworkSession::logDiagnosticMessageWithValue):
1487         (WebKit::NetworkSession::notifyPageStatisticsTelemetryFinished):
1488         (WebKit::NetworkSession::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
1489         (WebKit::NetworkSession::topPrivatelyControlledDomainsWithWebsiteData):
1490         (WebKit::NetworkSession::enableResourceLoadStatistics): Deleted.
1491         * NetworkProcess/NetworkSession.h:
1492         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1493         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1494         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1495         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
1496         (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
1497         (WKWebsiteDataStoreSetStatisticsLastSeen):
1498         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
1499         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
1500         (WKWebsiteDataStoreDumpResourceLoadStatistics):
1501         (WKWebsiteDataStoreIsStatisticsPrevalentResource):
1502         (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
1503         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
1504         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder):
1505         (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo):
1506         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
1507         (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction):
1508         (WKWebsiteDataStoreSetStatisticsGrandfathered):
1509         (WKWebsiteDataStoreIsStatisticsGrandfathered):
1510         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
1511         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
1512         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo):
1513         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom):
1514         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo):
1515         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom):
1516         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
1517         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
1518         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
1519         (WKWebsiteDataStoreStatisticsSubmitTelemetry):
1520         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned):
1521         (WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval):
1522         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured):
1523         (WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval):
1524         (WKWebsiteDataStoreSetStatisticsGrandfatheringTime):
1525         (WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries):
1526         (WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo):
1527         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
1528         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
1529         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1530         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1531         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
1532         * UIProcess/Network/NetworkProcessProxy.cpp:
1533         (WebKit::NetworkProcessProxy::clearCallbackStates):
1534         (WebKit::NetworkProcessProxy::didClose):
1535         (WebKit::nonEphemeralWebPageProxy):
1536         (WebKit::NetworkProcessProxy::logGlobalDiagnosticMessageWithValue):
1537         (WebKit::NetworkProcessProxy::dumpResourceLoadStatistics):
1538         (WebKit::NetworkProcessProxy::didDumpResourceLoadStatistics):
1539         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
1540         (WebKit::NetworkProcessProxy::didUpdateBlockCookies):
1541         (WebKit::NetworkProcessProxy::isPrevalentResource):
1542         (WebKit::NetworkProcessProxy::isPrevalentResourceResult):
1543         (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
1544         (WebKit::NetworkProcessProxy::setPrevalentResource):
1545         (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
1546         (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
1547         (WebKit::NetworkProcessProxy::didSetResourceLoadStatisticData):
1548         (WebKit::NetworkProcessProxy::setLastSeen):
1549         (WebKit::NetworkProcessProxy::clearPrevalentResource):
1550         (WebKit::NetworkProcessProxy::scheduleCookieBlockingUpdate):
1551         (WebKit::NetworkProcessProxy::didScheduleCookieBlockingUpdate):
1552         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
1553         (WebKit::NetworkProcessProxy::didScheduleStatisticsProcessing):
1554         (WebKit::NetworkProcessProxy::scheduleStatisticsAndDataRecordsProcessing):
1555         (WebKit::NetworkProcessProxy::logUserInteraction):
1556         (WebKit::NetworkProcessProxy::hasHadUserInteraction):
1557         (WebKit::NetworkProcessProxy::didHaveUserInteraction):
1558         (WebKit::NetworkProcessProxy::clearUserInteraction):
1559         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
1560         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies):
1561         (WebKit::NetworkProcessProxy::setTimeToLiveUserInteraction):
1562         (WebKit::NetworkProcessProxy::didUpdateRuntimeSettings):
1563         (WebKit::NetworkProcessProxy::setNotifyPagesWhenTelemetryWasCaptured):
1564         (WebKit::NetworkProcessProxy::setNotifyPagesWhenDataRecordsWereScanned):
1565         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin):
1566         (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
1567         (WebKit::NetworkProcessProxy::didIsRegisteredAsRedirectingTo):
1568         (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
1569         (WebKit::NetworkProcessProxy::didIsRegisteredAsSubFrameUnder):
1570         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin):
1571         (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
1572         (WebKit::NetworkProcessProxy::didIsRegisteredAsSubresourceUnder):
1573         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
1574         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
1575         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
1576         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
1577         (WebKit::NetworkProcessProxy::isGrandfathered):
1578         (WebKit::NetworkProcessProxy::didIsGrandfathered):
1579         (WebKit::NetworkProcessProxy::setGrandfathered):
1580         (WebKit::NetworkProcessProxy::hasStorageAccess):
1581         (WebKit::NetworkProcessProxy::requestStorageAccess):
1582         (WebKit::NetworkProcessProxy::grantStorageAccess):
1583         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
1584         (WebKit::NetworkProcessProxy::storageAccessOperationResult):
1585         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess):
1586         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources):
1587         (WebKit::NetworkProcessProxy::setCacheMaxAgeCap):
1588         (WebKit::NetworkProcessProxy::setGrandfatheringTime):
1589         (WebKit::NetworkProcessProxy::setMaxStatisticsEntries):
1590         (WebKit::NetworkProcessProxy::setMinimumTimeBetweenDataRecordsRemoval):
1591         (WebKit::NetworkProcessProxy::setPruneEntriesDownTo):
1592         (WebKit::NetworkProcessProxy::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1593         (WebKit::NetworkProcessProxy::setResourceLoadStatisticsDebugMode):
1594         (WebKit::NetworkProcessProxy::resetParametersToDefaultValues):
1595         (WebKit::NetworkProcessProxy::submitTelemetry):
1596         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsProcessed):
1597         (WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished):
1598         (WebKit::NetworkProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished):
1599         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsTelemetryFinished):
1600         (WebKit::NetworkProcessProxy::didLogUserInteraction): Deleted.
1601         (WebKit::NetworkProcessProxy::didResetCacheMaxAgeCapForPrevalentResources): Deleted.
1602         * UIProcess/Network/NetworkProcessProxy.h:
1603         * UIProcess/Network/NetworkProcessProxy.messages.in:
1604         * UIProcess/WebPageProxy.cpp:
1605         (WebKit::WebPageProxy::nonEphemeralWebPageProxy):
1606         * UIProcess/WebPageProxy.h:
1607         * UIProcess/WebProcessPool.cpp:
1608         (WebKit::WebProcessPool::ensureNetworkProcess):
1609         * UIProcess/WebProcessProxy.cpp:
1610         (WebKit::WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished):
1611         (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished):
1612         * UIProcess/WebProcessProxy.h:
1613         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1614         (WebKit::WebsiteDataStore::parameters):
1615         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1616         (WebKit::WebsiteDataStore::removeData):
1617         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
1618         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
1619         (WebKit::WebsiteDataStore::setGrandfatheringTime):
1620         (WebKit::WebsiteDataStore::setCacheMaxAgeCap):
1621         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
1622         (WebKit::WebsiteDataStore::dumpResourceLoadStatistics):
1623         (WebKit::WebsiteDataStore::isPrevalentResource):
1624         (WebKit::WebsiteDataStore::setPrevalentResource):
1625         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
1626         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
1627         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
1628         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1629         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
1630         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
1631         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
1632         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
1633         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
1634         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
1635         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
1636         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
1637         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
1638         (WebKit::WebsiteDataStore::clearPrevalentResource):
1639         (WebKit::WebsiteDataStore::resetParametersToDefaultValues):
1640         (WebKit::WebsiteDataStore::submitTelemetry):
1641         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
1642         (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate):
1643         (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing):
1644         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
1645         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
1646         (WebKit::WebsiteDataStore::setLastSeen):
1647         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
1648         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
1649         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
1650         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
1651         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
1652         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
1653         (WebKit::WebsiteDataStore::removePrevalentDomains):
1654         (WebKit::WebsiteDataStore::hasStorageAccess):
1655         (WebKit::WebsiteDataStore::requestStorageAccess):
1656         (WebKit::WebsiteDataStore::grantStorageAccess):
1657         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
1658         (WebKit::WebsiteDataStore::logUserInteraction):
1659         (WebKit::WebsiteDataStore::hasHadUserInteraction):
1660         (WebKit::WebsiteDataStore::clearUserInteraction):
1661         (WebKit::WebsiteDataStore::isGrandfathered):
1662         (WebKit::WebsiteDataStore::setGrandfathered):
1663         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
1664         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
1665         (WebKit::WebsiteDataStore::webPageWasAdded):
1666         (WebKit::WebsiteDataStore::webPageWasInvalidated):
1667         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
1668         (WebKit::WebsiteDataStore::webPageWillOpenConnection):
1669         (WebKit::WebsiteDataStore::webPageDidCloseConnection):
1670         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
1671         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
1672         (WebKit::WebsiteDataStore::processPools const):
1673         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled const):
1674         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
1675         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
1676         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1677         (WebKit::WebsiteDataStore::logTestingEvent):
1678         * UIProcess/WebsiteData/WebsiteDataStore.h:
1679         (WebKit::WebsiteDataStore::setStatisticsTestingCallback):
1680         * WebProcess/WebProcess.cpp:
1681         (WebKit::WebProcess::initializeWebProcess):
1682
1683 2019-01-15  Darin Adler  <darin@apple.com>
1684
1685         Use references rather than pointers for register/unregister functions, and more
1686         https://bugs.webkit.org/show_bug.cgi?id=175028
1687
1688         Reviewed by Daniel Bates.
1689
1690         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1691         (WebKit::WebFullScreenManager::willEnterFullScreen): Update for change to the
1692         functions in Document; pass a reference.
1693         (WebKit::WebFullScreenManager::didEnterFullScreen): Ditto, don't pass the element.
1694         (WebKit::WebFullScreenManager::willExitFullScreen): Ditto.
1695         (WebKit::WebFullScreenManager::didExitFullScreen): Ditto.
1696
1697         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1698         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): Pass a reference.
1699         (WebKit::UserMediaPermissionRequestManager::mediaCanStart): Ditto.
1700         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps): Ditto.
1701         * WebProcess/Plugins/PluginView.cpp:
1702         (WebKit::PluginView::~PluginView): Ditto.
1703         (WebKit::PluginView::initializePlugin): Ditto.
1704
1705 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1706
1707         Unreviewed, fix -Wreturn-type warning
1708         https://bugs.webkit.org/show_bug.cgi?id=193333
1709         <rdar://problem/45649489>
1710
1711         * UIProcess/Automation/WebAutomationSession.cpp:
1712         (WebKit::toProtocol):
1713
1714 2019-01-20  chris fleizach  <cfleizach@apple.com>
1715
1716         AX: Support returning relative frames for accessibility
1717         https://bugs.webkit.org/show_bug.cgi?id=193414
1718         <rdar://problem/47268501>
1719
1720         Reviewed by Zalan Bujtas.
1721
1722         * UIProcess/API/Cocoa/WKWebView.mm:
1723         (-[WKWebView accessibilityAttributeValue:forParameter:]):
1724         (-[WKWebView IGNORE_WARNINGS_END]):
1725         * UIProcess/API/mac/WKView.mm:
1726         (-[WKView accessibilityAttributeValue:forParameter:]):
1727         (-[WKView IGNORE_WARNINGS_END]):
1728         * UIProcess/Cocoa/WebViewImpl.h:
1729         * UIProcess/Cocoa/WebViewImpl.mm:
1730         (WebKit::WebViewImpl::accessibilityAttributeValue):
1731         * UIProcess/ios/WKContentView.mm:
1732         (-[WKContentView accessibilityConvertRelativeFrameFromPage:]):
1733
1734 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1735
1736         Unreviewed, rolling out r240209.
1737
1738         Broke GTK/WPE injected bundle
1739
1740         Reverted changeset:
1741
1742         "AX: Support returning relative frames for accessibility"
1743         https://bugs.webkit.org/show_bug.cgi?id=193414
1744         https://trac.webkit.org/changeset/240209
1745
1746 2019-01-12  Dan Bernstein  <mitz@apple.com>
1747
1748         [Cocoa] Avoid importing directly from subumbrella frameworks
1749         https://bugs.webkit.org/show_bug.cgi?id=186016
1750         <rdar://problem/40591038>
1751
1752         Reviewed by Sam Weinig.
1753
1754         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
1755           OTHER_CPLUSPLUSFLAGS.
1756         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
1757           HIToolbox header.
1758         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
1759         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
1760         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
1761           header.
1762         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
1763           PDFKit header.
1764         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
1765         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
1766         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
1767         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
1768         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
1769         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
1770         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
1771
1772 2019-01-20  chris fleizach  <cfleizach@apple.com>
1773
1774         AX: Support returning relative frames for accessibility
1775         https://bugs.webkit.org/show_bug.cgi?id=193414
1776         <rdar://problem/47268501>
1777
1778         Reviewed by Zalan Bujtas.
1779
1780         * UIProcess/API/Cocoa/WKWebView.mm:
1781         (-[WKWebView accessibilityAttributeValue:forParameter:]):
1782         (-[WKWebView IGNORE_WARNINGS_END]):
1783         * UIProcess/API/mac/WKView.mm:
1784         (-[WKView accessibilityAttributeValue:forParameter:]):
1785         (-[WKView IGNORE_WARNINGS_END]):
1786         * UIProcess/Cocoa/WebViewImpl.h:
1787         * UIProcess/Cocoa/WebViewImpl.mm:
1788         (WebKit::WebViewImpl::accessibilityAttributeValue):
1789         * UIProcess/ios/WKContentView.mm:
1790         (-[WKContentView accessibilityConvertRelativeFrameFromPage:]):
1791
1792 2019-01-20  Antoine Quint  <graouts@apple.com>
1793
1794         Add a POINTER_EVENTS feature flag
1795         https://bugs.webkit.org/show_bug.cgi?id=193577
1796         <rdar://problem/47408511>
1797
1798         Unreviewed. Also enable Pointer Events for iosmac.
1799
1800         * Configurations/FeatureDefines.xcconfig:
1801
1802 2019-01-19  David Kilzer  <ddkilzer@apple.com>
1803
1804         Follow-up: iOS: Updating input mode should update the software keyboard
1805         <https://bugs.webkit.org/show_bug.cgi?id=193565>
1806         <rdar://problem/47376334>
1807
1808         * WebProcess/WebPage/WebPage.cpp:
1809         (WebKit::WebPage::focusedElementDidChangeInputMode): Fix iOS
1810         Debug builds after r240199 by downcasting `element` to
1811         `HTMLElement` before calling canonicalInputMode().
1812
1813 2019-01-19  David Kilzer  <ddkilzer@apple.com>
1814
1815         Sort WebKit Xcode project file
1816
1817         * WebKit.xcodeproj/project.pbxproj:
1818
1819 2019-01-19  Antoine Quint  <graouts@apple.com>
1820
1821         Add a POINTER_EVENTS feature flag
1822         https://bugs.webkit.org/show_bug.cgi?id=193577
1823
1824         Reviewed by Dean Jackson.
1825
1826         * Configurations/FeatureDefines.xcconfig:
1827
1828 2019-01-18  Ryosuke Niwa  <rniwa@webkit.org>
1829
1830         iOS: Updating input mode should update the software keyboard
1831         https://bugs.webkit.org/show_bug.cgi?id=193565
1832         <rdar://problem/47376334>
1833
1834         Reviewed by Wenson Hsieh.
1835
1836         Update the software keyboard when the inputmode content attribute on the focused element had been mutated.
1837
1838         * Scripts/webkit/messages.py:
1839         * Shared/WebCoreArgumentCoders.h:
1840         * UIProcess/PageClient.h:
1841         * UIProcess/WebPageProxy.h:
1842         * UIProcess/WebPageProxy.messages.in:
1843         * UIProcess/ios/PageClientImplIOS.h:
1844         * UIProcess/ios/PageClientImplIOS.mm:
1845         (WebKit::PageClientImpl::focusedElementDidChangeInputMode):
1846         * UIProcess/ios/WKContentViewInteraction.h:
1847         * UIProcess/ios/WKContentViewInteraction.mm:
1848         (-[WKContentView _didUpdateInputMode:]):
1849         * UIProcess/ios/WebPageProxyIOS.mm:
1850         (WebKit::WebPageProxy::focusedElementDidChangeInputMode):
1851         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1852         (WebKit::WebChromeClient::focusedElementDidChangeInputMode):
1853         * WebProcess/WebCoreSupport/WebChromeClient.h:
1854         * WebProcess/WebPage/WebPage.cpp:
1855         (WebKit::WebPage::focusedElementDidChangeInputMode):
1856         * WebProcess/WebPage/WebPage.h:
1857
1858 2019-01-18  Tim Horton  <timothy_horton@apple.com>
1859
1860         Adjust WKDrawingView protocol method name
1861         https://bugs.webkit.org/show_bug.cgi?id=193604
1862
1863         Reviewed by Wenson Hsieh.
1864
1865         * UIProcess/ios/WKDrawingView.mm:
1866         (-[WKDrawingView canvasViewDrawingDidChange:]):
1867         (-[WKDrawingView drawingDidChange:]): Deleted.
1868
1869 2019-01-18  David Kilzer  <ddkilzer@apple.com>
1870
1871         [WebKit] Change Xcode folders to map to folders on disk
1872
1873         * WebKit.xcodeproj/project.pbxproj: Update these folders:
1874         - Shared/Authentication
1875         - Shared/Authentication/cocoa
1876
1877 2019-01-18  Brian Burg  <bburg@apple.com>
1878
1879         Automation.computeElementLayout should return visual viewport-aware coordinates
1880         https://bugs.webkit.org/show_bug.cgi?id=193598
1881         <rdar://problem/35325644>
1882
1883         Reviewed by Simon Fraser.
1884
1885         Previously I added CoordinateSystem::VisualViewport to stub out this for iOS.
1886         But I think that it's a mistake for safaridriver to care about VisualViewport
1887         being enabled or not, because it is a runtime-switchable setting.
1888
1889         This patch removes CoordinateSystem::VisualViewport. Make the existing
1890         CoordinateSystem::LayoutViewport use visual viewport semantics if needed.
1891
1892         This is tested by WebDriver element clicking tests. There should not be any
1893         difference in behavior until it is possible to zoom with gestures via WebDriver.
1894
1895         * Shared/CoordinateSystem.h:
1896         * UIProcess/Automation/Automation.json:
1897         * UIProcess/Automation/WebAutomationSession.cpp:
1898         (WebKit::protocolStringToCoordinateSystem):
1899         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1900         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1901
1902 2019-01-18  Daniel Bates  <dabates@apple.com>
1903
1904         Fix some build issues.
1905
1906         Include missing header WKDrawingCoordinator.
1907
1908         * UIProcess/ios/WKInkPickerView.mm:
1909
1910 2019-01-18  Tim Horton  <timothy_horton@apple.com>
1911
1912         Get rid of ADVANCED_SPELL_CHECKING
1913         https://bugs.webkit.org/show_bug.cgi?id=193592
1914
1915         Reviewed by Wenson Hsieh.
1916
1917         * UIProcess/Cocoa/WebViewImpl.mm:
1918         (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
1919         (WebKit::WebViewImpl::insertText):
1920         * UIProcess/mac/TextCheckerMac.mm:
1921         (WebKit::TextChecker::checkTextOfParagraph):
1922         (WebKit::TextChecker::getGuessesForWord):
1923
1924 2019-01-18  Chris Dumez  <cdumez@apple.com>
1925
1926         Regression(PSON) Content blockers are sometimes lost on back navigation cross-site
1927         https://bugs.webkit.org/show_bug.cgi?id=193588
1928         <rdar://problem/47131566>
1929
1930         Reviewed by Alex Christensen.
1931
1932         When the WebPageProxy needs to create initialization parameters for its WebPage in the
1933         WebContent process, it calls WebProcessProxy::addWebUserContentControllerProxy()
1934         which calls WebUserContentControllerProxy::addProcess(). This last call is supposed to
1935         register the WebProcessProxy with the WebUserContentControllerProxy and adding the
1936         contentRuleLists to the WebPageCreationParameters. The issue is that if the
1937         WebUserContentControllerProxy already knows about this WebProcessProxy, it would return
1938         early and not populate the WebPageCreationParameters.
1939
1940         In PSON world, when navigating back to a page that failed to enter page cache, we reuse
1941         the process where we previously loaded the page but re-create a new WebPage on the
1942         WebContent process site. When this happens, WebUserContentControllerProxy would not
1943         add the contentRuleLists to the WebPageCreationParameters and the new WebPage in the
1944         previously-suspended process would be missing them.
1945
1946         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1947         (WebKit::WebUserContentControllerProxy::addProcess):
1948
1949 2019-01-18  Jer Noble  <jer.noble@apple.com>
1950
1951         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
1952         https://bugs.webkit.org/show_bug.cgi?id=189553
1953
1954         Reviewed by Tim Horton.
1955
1956         * Configurations/Base.xcconfig:
1957         * Configurations/BaseTarget.xcconfig:
1958         * Configurations/SDKVariant.xcconfig: Added.
1959
1960 2019-01-18  Antti Koivisto  <antti@apple.com>
1961
1962         Implement asynchronous frame scrolling for iOS
1963         https://bugs.webkit.org/show_bug.cgi?id=193539
1964         <rdar://problem/47379873>
1965
1966         Reviewed by Simon Fraser.
1967
1968         Add a scrolling node type that can handle UIScrollView backed frames.
1969         It basically just instantiates and forwards to the existing ScrollingTreeScrollingNodeDelegateIOS.
1970
1971         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1972         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1973         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1974         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1975         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h: Added.
1976         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: Added.
1977         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::create):
1978         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::ScrollingTreeFrameScrollingNodeRemoteIOS):
1979         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::~ScrollingTreeFrameScrollingNodeRemoteIOS):
1980         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
1981         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
1982         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange):
1983         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const):
1984         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition):
1985         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll):
1986         * WebKit.xcodeproj/project.pbxproj:
1987
1988 2019-01-18  Chris Dumez  <cdumez@apple.com>
1989
1990         Regression(PSON) Scroll position is not always restored properly when navigating back
1991         https://bugs.webkit.org/show_bug.cgi?id=193578
1992         <rdar://problem/47386331>
1993
1994         Reviewed by Tim Horton.
1995
1996         Fix issues causing the scroll position to not be restored at all (or incorrectly) when
1997         navigating back cross-site with PSON enabled. Also make sure that the swipe gesture
1998         snapshot really stays up until we've restored the scroll position.
1999
2000         Note that even after those changes, I can still sometimes reproduce a white flash when
2001         swiping back to Google search results (scroll position being correct now). This is
2002         tracked by <rdar://problem/47071684> and happens even if I disable PSON entirely.
2003
2004         * Shared/SessionState.cpp:
2005         (WebKit::FrameState::encode const):
2006         (WebKit::FrameState::decode):
2007         * Shared/SessionState.h:
2008         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2009         (WebKit::toFrameState):
2010         (WebKit::applyFrameState):
2011         obscuredInsets is present on the HistoryItem in the WebProcess but was never passed to
2012         or stored by the UIProcess on the WebBackForwardListItem. obscuredInsets is needed to
2013         properly restore the scrollPosition (position was 70px off on my iPad without this).
2014         With PSON enabled, if you swipe back cross-process and the previous page was not put
2015         into PageCache, then the HistoryItem is gone on the WebProcess side. What happens is
2016         that the UIProcess sends its WebBackForwardListItem to the WebProcess, which restores
2017         the HistoryItem there, and then asks it to load it. The obscuredInsets was getting lost
2018         in the process since the UIProcess never knew about it.
2019
2020         * UIProcess/Cocoa/ViewGestureController.cpp:
2021         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
2022         Drop logic that was causing the ViewGestureController to not wait for the scroll position
2023         to be restored before taking down the snapshot, when UI-side compositing is enabled.
2024         If you look at the comment above the code, you'll see that the code in question was meant
2025         to impact only the non-UI side compositing code path. As a matter of fact, when the code
2026         was reviewed at https://bugs.webkit.org/show_bug.cgi?id=151224, it was protected by a
2027         #if PLATFORM(MAC), before getting modified the wrong way before landing. In practice, we
2028         would have often restored the scroll position by the time the load is finished so it would
2029         not cause a flash in most cases. However, with PSON enabled and the layer tree freezing we
2030         do on process-swap, the first post-scroll restoration layer tree commit may now occur a
2031         little bit later and we would lose the race more often.
2032
2033         * UIProcess/WebProcessProxy.cpp:
2034         (WebKit::WebProcessProxy::updateBackForwardItem):
2035         * UIProcess/WebProcessProxy.h:
2036         When adding PageCache support to PSON, we used to navigate the "suspended" page to
2037         about:blank. This would lead to unwanted WebProcessProxy::updateBackForwardItem()
2038         calls from the WebProcess which we wanted to ignore. We thus added logic to ignore
2039         updateBackForwardItem() IPC from the old WebProcess after a swap. The issue with this
2040         is that we sometimes miss/ignore legit updates to the HistoryItem from the old process,
2041         in particular with regards to the scroll position and the pageScaleFactor. So if you
2042         swiped and then quickly enough did a cross-site navigation, the UIProcess'
2043         WebBackForwardList would not get updated with the latest scroll position and we would
2044         thus fail to restore it later on. To address the issue, we now stop ignoring updates
2045         from the old WebProcess after a swap. This logic is no longer needed since we no longer
2046         navigate the old page to about:blank after a swap, we merely suspend it "in place".
2047
2048 2019-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2049
2050         Remove some last vestiges of assisted node terminology in WebKit
2051         https://bugs.webkit.org/show_bug.cgi?id=193572
2052
2053         Reviewed by Tim Horton.
2054
2055         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
2056         * UIProcess/ios/WKContentViewInteraction.mm:
2057         (-[WKContentView gestureRecognizerShouldBegin:]):
2058         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2059         (-[WKContentView _showKeyboard]):
2060         (-[WKContentView _hideKeyboard]):
2061
2062         Add a FIXME about invoking `-reloadInputViews` on watchOS when the focused element is blurred.
2063
2064         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2065         (-[WKContentView _elementDidBlur]):
2066         (-[WKContentView updateCurrentFocusedElementInformation:]):
2067         (-[WKContentView _startAssistingKeyboard]): Deleted.
2068         (-[WKContentView _stopAssistingKeyboard]): Deleted.
2069         * WebProcess/WebPage/ios/WebPageIOS.mm:
2070         (WebKit::WebPage::getFocusedElementInformation):
2071
2072 2019-01-18  Youenn Fablet  <youenn@apple.com>
2073
2074         Add a new SPI to request for cache storage quota increase
2075         https://bugs.webkit.org/show_bug.cgi?id=193323
2076
2077         Reviewed by Alex Christensen.
2078
2079         Add a delegate on the WebSiteDataStore for WebKit to ask for quota update.
2080         The current SPI is currently CacheStorage specific but future work should
2081         make it so that other storage like IDB use the same mechanism.
2082         By default, quota remains unchanged if delegate is not implemented.
2083
2084         * NetworkProcess/NetworkProcess.cpp:
2085         * UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h: Added.
2086         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2087         (WebsiteDataStoreQuotaManager::WebsiteDataStoreQuotaManager):
2088         (-[WKWebsiteDataStore _quotaDelegate]):
2089         (-[WKWebsiteDataStore set_quotaDelegate:]):
2090         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
2091         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2092         * UIProcess/Network/NetworkProcessProxy.cpp:
2093         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
2094         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2095         (WebKit::WebsiteDataStore::WebsiteDataStore):
2096         * UIProcess/WebsiteData/WebsiteDataStore.h:
2097         (WebKit::WebsiteDataStore::quotaManager):
2098         (WebKit::WebsiteDataStore::setQuotaManager):
2099         * UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h: Added.
2100         (WebKit::WebsiteDataStoreQuotaManager::~WebsiteDataStoreQuotaManager):
2101         (WebKit::WebsiteDataStoreQuotaManager::requestCacheStorageSpace):
2102         * WebKit.xcodeproj/project.pbxproj:
2103
2104 2019-01-18  Philippe Normand  <pnormand@igalia.com>
2105
2106         [WPE] Add Qt extension
2107         https://bugs.webkit.org/show_bug.cgi?id=191464
2108
2109         Reviewed by Carlos Garcia Campos.
2110
2111         This new extension is a QML plugin embedding a WPE ViewBackend
2112         implementation. It provides a public API very similar to Qt's
2113         WebView module. It comes with a simple mini-browser implemented in
2114         QML.
2115
2116         QtWPE is known to work with the Wayland-EGL (in GNOME and Weston
2117         compositors) and EGLFS QPAs.
2118
2119         * PlatformWPE.cmake:
2120         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp: Added.
2121         (WPEQmlExtensionPlugin::registerTypes):
2122         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.h: Added.
2123         * UIProcess/API/wpe/qt/WPEQtView.cpp: Added.
2124         (WPEQtView::WPEQtView):
2125         (WPEQtView::~WPEQtView):
2126         (WPEQtView::geometryChanged):
2127         (WPEQtView::configureWindow):
2128         (WPEQtView::createOffscreen):
2129         (WPEQtView::backendCreated):
2130         (WPEQtView::notifyUrlChangedCallback):
2131         (WPEQtView::notifyTitleChangedCallback):
2132         (WPEQtView::notifyLoadProgressCallback):
2133         (WPEQtView::notifyLoadChangedCallback):
2134         (WPEQtView::notifyLoadFailedCallback):
2135         (WPEQtView::updatePaintNode):
2136         (WPEQtView::url const):
2137         (WPEQtView::setUrl):
2138         (WPEQtView::loadProgress const):
2139         (WPEQtView::title const):
2140         (WPEQtView::canGoBack const):
2141         (WPEQtView::isLoading const):
2142         (WPEQtView::canGoForward const):
2143         (WPEQtView::goBack):
2144         (WPEQtView::goForward):
2145         (WPEQtView::reload):
2146         (WPEQtView::stop):
2147         (WPEQtView::loadHtml):
2148         (WPEQtView::jsAsyncReadyCallback):
2149         (WPEQtView::handleJsResult):
2150         (WPEQtView::runJavaScript):
2151         (WPEQtView::mousePressEvent):
2152         (WPEQtView::mouseReleaseEvent):
2153         (WPEQtView::hoverEnterEvent):
2154         (WPEQtView::hoverLeaveEvent):
2155         (WPEQtView::hoverMoveEvent):
2156         (WPEQtView::wheelEvent):
2157         (WPEQtView::keyPressEvent):
2158         (WPEQtView::keyReleaseEvent):
2159         (WPEQtView::touchEvent):
2160         * UIProcess/API/wpe/qt/WPEQtView.h: Added.
2161         * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp: Added.
2162         (configureCallback):
2163         (WPEQtViewBackend::WPEQtViewBackend):
2164         (WPEQtViewBackend::~WPEQtViewBackend):
2165         (WPEQtViewBackend::configureGlibEglDisplay):
2166         (WPEQtViewBackend::configureEglDisplay):
2167         (WPEQtViewBackend::initialize):
2168         (WPEQtViewBackend::backend const):
2169         (WPEQtViewBackend::resize):
2170         (WPEQtViewBackend::getTexture):
2171         (WPEQtViewBackend::initSurface):
2172         (WPEQtViewBackend::displayImage):
2173         (WPEQtViewBackend::modifiers const):
2174         (WPEQtViewBackend::dispatchHoverEnterEvent):
2175         (WPEQtViewBackend::dispatchHoverLeaveEvent):
2176         (WPEQtViewBackend::dispatchHoverMoveEvent):
2177         (WPEQtViewBackend::dispatchMousePressEvent):
2178         (WPEQtViewBackend::dispatchMouseReleaseEvent):
2179         (WPEQtViewBackend::dispatchWheelEvent):
2180         (WPEQtViewBackend::dispatchKeyEvent):
2181         (WPEQtViewBackend::dispatchTouchEvent):
2182         * UIProcess/API/wpe/qt/WPEQtViewBackend.h: Added.
2183         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp: Added.
2184         (WPEQtViewLoadRequest::WPEQtViewLoadRequest):
2185         (WPEQtViewLoadRequest::~WPEQtViewLoadRequest):
2186         (WPEQtViewLoadRequest::url const):
2187         (WPEQtViewLoadRequest::status const):
2188         (WPEQtViewLoadRequest::errorString const):
2189         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h: Added.
2190         * UIProcess/API/wpe/qt/WPEQtViewLoadRequestPrivate.h: Added.
2191         (WPEQtViewLoadRequestPrivate::WPEQtViewLoadRequestPrivate):
2192         (WPEQtViewLoadRequestPrivate::~WPEQtViewLoadRequestPrivate):
2193         * UIProcess/API/wpe/qt/qmldir: Added.
2194
2195 2019-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2196
2197         [iOS] Content offset jumps erratically when autoscrolling near scroll view content inset areas
2198         https://bugs.webkit.org/show_bug.cgi?id=193494
2199         <rdar://problem/46859627>
2200
2201         Reviewed by Simon Fraser and Tim Horton.
2202
2203         Adds `contentInsets` to `VisibleContentRectUpdateInfo`. This keeps track of the visible content insets
2204         surrounding the unobscured content rect. See WebCore ChangeLog for more details.
2205
2206         * Shared/VisibleContentRectUpdateInfo.cpp:
2207         (WebKit::VisibleContentRectUpdateInfo::encode const):
2208         (WebKit::VisibleContentRectUpdateInfo::decode):
2209         (WebKit::operator<<):
2210         * Shared/VisibleContentRectUpdateInfo.h:
2211         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
2212         (WebKit::VisibleContentRectUpdateInfo::contentInsets const):
2213         (WebKit::operator==):
2214         * UIProcess/API/Cocoa/WKWebView.mm:
2215         (-[WKWebView _computedObscuredInset]):
2216         (-[WKWebView _computedContentInset]):
2217         (-[WKWebView _computedUnobscuredSafeAreaInset]):
2218
2219         We don't care about source compatibility with iOS 10 and below anymore, so we should change these >= iOS 11
2220         target checks to simply `PLATFORM(IOS)`.
2221
2222         (-[WKWebView _updateVisibleContentRects]):
2223
2224         Compute the visible content insets on all sides of the unobscured content rect. These insets are scaled to
2225         content coordinates.
2226
2227         * UIProcess/ios/WKContentView.h:
2228         * UIProcess/ios/WKContentView.mm:
2229         (floatBoxExtent):
2230
2231         Add a helper to convert `UIEdgeInsets` to `WebCore::FloatBoxExtent`, and use it in a few places below.
2232
2233         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2234         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
2235         * WebProcess/WebPage/ios/WebPageIOS.mm:
2236         (WebKit::WebPage::updateVisibleContentRects):
2237
2238         Update the Page's content insets.
2239
2240 2019-01-17  Truitt Savell  <tsavell@apple.com>
2241
2242         Unreviewed, rolling out r240124.
2243
2244         This commit broke an internal build.
2245
2246         Reverted changeset:
2247
2248         "SDK_VARIANT build destinations should be separate from non-
2249         SDK_VARIANT builds"
2250         https://bugs.webkit.org/show_bug.cgi?id=189553
2251         https://trac.webkit.org/changeset/240124
2252
2253 2019-01-17  John Wilander  <wilander@apple.com>
2254
2255         Add infrastructure to enable/disable ITP Debug Mode through Preferences
2256         https://bugs.webkit.org/show_bug.cgi?id=193510
2257         <rdar://problem/47330969>
2258
2259         Reviewed by Dean Jackson.
2260
2261         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2262         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
2263         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
2264         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
2265             These functions are now suited for runtime switching of ITP Debug Mode.
2266         * Shared/WebPreferences.yaml:
2267             Changed name from ResourceLoadStatisticsDebugMode to ItpDebugModeEnabled.
2268         * UIProcess/API/Cocoa/WKPreferences.mm:
2269         (-[WKPreferences _setItpDebugModeEnabled:]):
2270         (-[WKPreferences _itpDebugModeEnabled]):
2271             New private preferences functions.
2272         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2273         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
2274         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
2275             Removed support for old experimental user default. Added a new one that's
2276             not connected to any UI, i.e. merely for command line debugging where
2277             ITP Debug Mode needs to be on all the time.
2278
2279 2019-01-17  Tim Horton  <timothy_horton@apple.com>
2280
2281         Adopt NSTextCheckingSuppressInitialCapitalizationKey
2282         https://bugs.webkit.org/show_bug.cgi?id=193545
2283
2284         Reviewed by Dean Jackson.
2285
2286         * UIProcess/mac/TextCheckerMac.mm:
2287         (WebKit::TextChecker::checkTextOfParagraph):
2288         (WebKit::TextChecker::getGuessesForWord):
2289
2290 2019-01-17  Jer Noble  <jer.noble@apple.com>
2291
2292         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
2293         https://bugs.webkit.org/show_bug.cgi?id=189553
2294
2295         Reviewed by Tim Horton.
2296
2297         * Configurations/Base.xcconfig:
2298         * Configurations/BaseTarget.xcconfig:
2299         * Configurations/SDKVariant.xcconfig: Added.
2300
2301 2019-01-16  Dean Jackson  <dino@apple.com>
2302
2303         (iPad) Link tapping is sluggish on many sites
2304         https://bugs.webkit.org/show_bug.cgi?id=193522
2305         <rdar://problem/47102987>
2306
2307         Reviewed by Wenson Hsieh.
2308
2309         Some WKWebView clients might set the initial zoom scale of the page to
2310         something other than 1, which disables the "fast tap" behaviour.
2311         The fix is very simple -- just check against the initial scale rather
2312         than 1.
2313
2314         The most likely regression from this would be pages designed for desktop,
2315         but provide a viewport tag saying width=device-width and initial-scale.
2316         They might stop allowing double-tap-to-zoom.
2317
2318         * UIProcess/API/Cocoa/WKWebView.mm:
2319         (-[WKWebView _allowsDoubleTapGestures]): Check against initial page scale.
2320
2321 2019-01-17  Alex Christensen  <achristensen@webkit.org>
2322
2323         Stop using NetworkStorageSession::storageSession in WebCore
2324         https://bugs.webkit.org/show_bug.cgi?id=193529
2325
2326         Reviewed by Tim Horton.
2327
2328         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2329         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
2330         * NetworkProcess/NetworkProcess.h:
2331         * NetworkProcess/NetworkSocketStream.cpp:
2332         (WebKit::NetworkSocketStream::create):
2333         (WebKit::NetworkSocketStream::NetworkSocketStream):
2334         * NetworkProcess/NetworkSocketStream.h:
2335         * NetworkProcess/NetworkStorageSessionProvider.h: Added.
2336         * WebKit.xcodeproj/project.pbxproj:
2337         * WebProcess/Network/WebSocketProvider.cpp:
2338         (WebKit::WebSocketProvider::createSocketStreamHandle):
2339         * WebProcess/Network/WebSocketProvider.h:
2340         * WebProcess/WebPage/WebCookieJar.cpp:
2341         (WebKit::WebCookieJar::WebCookieJar):
2342         * WebProcess/WebPage/WebCookieJar.h:
2343
2344 2019-01-16  Youenn Fablet  <youenn@apple.com>
2345
2346         Add a new SPI for controlling getUserMedia
2347         https://bugs.webkit.org/show_bug.cgi?id=192793
2348
2349         Reviewed by Eric Carlson.
2350
2351         Some weaknesses of the current getUserMedia/enumerateDevices SPI were found.
2352         In particular:
2353         - The hash salt should be handled by WebKit not by apps using WebKit.
2354         - No need to expose the frame URL, only the top level origin is needed.
2355         - The names of the callback are changed to improve the intent of these callbacks.
2356         Addressed these by creating a new SPI which will replace the current one.
2357         The current SPI will be removed later on.
2358
2359         Did some refactoring by making the callbacks not return false.
2360         Instead, implement the default behavior inside the request objects as deny methods.
2361         Some further refactoring will be done as a follow-up to better align the C API with the Cocoa API.
2362
2363         * UIProcess/API/APIUIClient.h:
2364         (API::UIClient::decidePolicyForUserMediaPermissionRequest):
2365         (API::UIClient::checkUserMediaPermissionForOrigin):
2366         * UIProcess/API/C/WKPage.cpp:
2367         (WKPageSetPageUIClient):
2368         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2369         * UIProcess/API/Cocoa/WKWebView.mm:
2370         (-[WKWebView _mediaCaptureState]):
2371         (-[WKWebView _setMediaCaptureMuted:]):
2372         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2373         * UIProcess/API/glib/WebKitUIClient.cpp:
2374         * UIProcess/Cocoa/MediaCaptureUtilities.h: Added.
2375         * UIProcess/Cocoa/MediaCaptureUtilities.mm: Added.
2376         * UIProcess/Cocoa/UIDelegate.h:
2377         * UIProcess/Cocoa/UIDelegate.mm:
2378         (WebKit::UIDelegate::setDelegate):
2379         (WebKit::requestUserMediaAuthorizationForFrame):
2380         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2381         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
2382         (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
2383         * UIProcess/UserMediaPermissionCheckProxy.h:
2384         (WebKit::UserMediaPermissionCheckProxy::deny):
2385         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2386         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2387         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
2388         * UIProcess/UserMediaPermissionRequestProxy.h:
2389
2390 2019-01-16  Youenn Fablet  <youenn@apple.com>
2391
2392         Pipe cache quota request from Network Process to UIProcess
2393         https://bugs.webkit.org/show_bug.cgi?id=193296
2394
2395         Reviewed by Alex Christensen.
2396
2397         When cache storage hits quota for a given origin, pipe the request back to NetworkProcess.
2398         No record will be put until the quota request is answered.
2399         The request is sent from CacheStorage::Caches to CacheStorage::Engine and to NetworkProcess.
2400         NetworkProcess then sends it to NetworkProcessProxy.
2401         Currently NetworkProcessProxy just answers by keeping the quota as it is.
2402         In the future, NetworkProcessProxy should make a delegate call to let the app using WebKit
2403         make a decision on the quota. This will allow prompting user to bump it as done for other data.
2404
2405         * NetworkProcess/NetworkProcess.cpp:
2406         (WebKit::NetworkProcess::requestCacheStorageSpace):
2407         * NetworkProcess/NetworkProcess.h:
2408         * NetworkProcess/cache/CacheStorageEngine.cpp:
2409         (WebKit::CacheStorage::Engine::~Engine):
2410         (WebKit::CacheStorage::Engine::from):
2411         (WebKit::CacheStorage::Engine::Engine):
2412         (WebKit::CacheStorage::Engine::requestSpace):
2413         (WebKit::CacheStorage::Engine::requestSpaceCompleted):
2414         * NetworkProcess/cache/CacheStorageEngine.h:
2415         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2416         (WebKit::CacheStorage::Cache::put):
2417         (WebKit::CacheStorage::Cache::retryPuttingPendingRecords):
2418         * NetworkProcess/cache/CacheStorageEngineCache.h:
2419         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2420         (WebKit::CacheStorage::Caches::requestSpace):
2421         (WebKit::CacheStorage::Caches::notifyCachesOfRequestSpaceEnd):
2422         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2423         (WebKit::CacheStorage::Caches::isRequestingSpace const):
2424         * UIProcess/Network/NetworkProcessProxy.cpp:
2425         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
2426         * UIProcess/Network/NetworkProcessProxy.h:
2427         * UIProcess/Network/NetworkProcessProxy.messages.in:
2428
2429 2019-01-16  Alex Christensen  <achristensen@webkit.org>
2430
2431         sendBeacon to previously-unvisited https domain always fails
2432         https://bugs.webkit.org/show_bug.cgi?id=193508
2433
2434         Reviewed by Geoffrey Garen.
2435
2436         * NetworkProcess/PingLoad.cpp:
2437         (WebKit::PingLoad::didReceiveChallenge):
2438         If a ping load is doing a TLS handshake, continue if the server has good certificates.
2439
2440 2019-01-16  Youenn Fablet  <youenn@apple.com>
2441
2442         ASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics
2443         https://bugs.webkit.org/show_bug.cgi?id=189097
2444         <rdar://problem/43856423>
2445
2446         Reviewed by Alex Christensen.
2447
2448         In case where the inspector is launched, it will instruct the NetworkConnectionToWebProcess to start capturing network metrics.
2449         If this happens in the middle of a load, addNetworkLoadInformationMetrics might fail since addNetworkLoadInformation will not be called.
2450         To fix this issue, store whether to capture metrics at NetworkResourceLoader level.
2451
2452         To ensure that the case of switching back and forth capture of metrics, disable loader capture of metrics whenver NetworkConnectionToWebProcess is asked to.
2453
2454         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2455         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
2456         * NetworkProcess/NetworkConnectionToWebProcess.h:
2457         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
2458         * NetworkProcess/NetworkResourceLoader.cpp:
2459         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
2460         (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics const):
2461         * NetworkProcess/NetworkResourceLoader.h:
2462
2463 2019-01-16  Alex Christensen  <achristensen@webkit.org>
2464
2465         Revert r239938
2466         https://bugs.webkit.org/show_bug.cgi?id=193267
2467         <rdar://problem/47297304>
2468
2469         * Configurations/WebContent-iOS.entitlements:
2470
2471 2019-01-16  Chris Dumez  <cdumez@apple.com>
2472
2473         Regression(r240046) Several API tests are crashing
2474         https://bugs.webkit.org/show_bug.cgi?id=193509
2475
2476         Reviewed by Geoffrey Garen.
2477
2478         The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but
2479         then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate
2480         our process reference.
2481
2482         To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling
2483         loadRequestShared(). Also, update *Shared() methods to take a Ref<WebProcessProxy>&& instead
2484         of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure
2485         our process stays alive.
2486
2487         * UIProcess/ProvisionalPageProxy.cpp:
2488         (WebKit::ProvisionalPageProxy::loadData):
2489         (WebKit::ProvisionalPageProxy::loadRequest):
2490         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
2491         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
2492         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
2493         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
2494         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
2495         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
2496         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
2497         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
2498         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
2499         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
2500         * UIProcess/WebPageProxy.cpp:
2501         (WebKit::WebPageProxy::loadRequest):
2502         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2503         (WebKit::WebPageProxy::loadData):
2504         (WebKit::WebPageProxy::loadDataWithNavigationShared):
2505         (WebKit::WebPageProxy::didPerformDragControllerAction):
2506         (WebKit::WebPageProxy::findPlugin):
2507         (WebKit::WebPageProxy::didCreateMainFrame):
2508         (WebKit::WebPageProxy::didCreateSubframe):
2509         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2510         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
2511         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2512         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
2513         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
2514         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
2515         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
2516         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
2517         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2518         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
2519         (WebKit::WebPageProxy::didCommitLoadForFrame):
2520         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2521         (WebKit::WebPageProxy::didFinishLoadForFrame):
2522         (WebKit::WebPageProxy::didFailLoadForFrame):
2523         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
2524         (WebKit::WebPageProxy::didReceiveTitleForFrame):
2525         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
2526         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
2527         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
2528         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
2529         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2530         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
2531         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2532         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2533         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2534         (WebKit::WebPageProxy::decidePolicyForResponse):
2535         (WebKit::WebPageProxy::decidePolicyForResponseShared):
2536         (WebKit::WebPageProxy::unableToImplementPolicy):
2537         (WebKit::WebPageProxy::willSubmitForm):
2538         (WebKit::WebPageProxy::didNavigateWithNavigationData):
2539         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
2540         (WebKit::WebPageProxy::didPerformClientRedirect):
2541         (WebKit::WebPageProxy::didPerformClientRedirectShared):
2542         (WebKit::WebPageProxy::didPerformServerRedirect):
2543         (WebKit::WebPageProxy::didUpdateHistoryTitle):
2544         (WebKit::WebPageProxy::createNewPage):
2545         (WebKit::WebPageProxy::runJavaScriptAlert):
2546         (WebKit::WebPageProxy::runJavaScriptConfirm):
2547         (WebKit::WebPageProxy::runJavaScriptPrompt):
2548         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
2549         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
2550         (WebKit::WebPageProxy::runOpenPanel):
2551         (WebKit::WebPageProxy::printFrame):
2552         (WebKit::WebPageProxy::backForwardGoToItem):
2553         (WebKit::WebPageProxy::backForwardGoToItemShared):
2554         (WebKit::WebPageProxy::learnWord):
2555         (WebKit::WebPageProxy::ignoreWord):
2556         (WebKit::WebPageProxy::didReceiveEvent):
2557         (WebKit::WebPageProxy::editingRangeCallback):
2558         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
2559         (WebKit::WebPageProxy::focusedFrameChanged):
2560         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
2561         (WebKit::WebPageProxy::exceededDatabaseQuota):
2562         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
2563         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
2564         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
2565         (WebKit::WebPageProxy::startURLSchemeTask):
2566         (WebKit::WebPageProxy::startURLSchemeTaskShared):
2567         (WebKit::WebPageProxy::stopURLSchemeTask):
2568         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
2569         * UIProcess/WebPageProxy.h:
2570
2571 2019-01-16  Chris Dumez  <cdumez@apple.com>
2572
2573         Regression(PSON) View becomes blank after click a cross-site download link
2574         https://bugs.webkit.org/show_bug.cgi?id=193361
2575         <rdar://problem/47099573>
2576
2577         Reviewed by Geoffrey Garen.
2578
2579         The issue tracked by rdar://problem/47099573 is that a provisional load may get
2580         canceled (or converted into a download) *after* we've decided to process-swap.
2581         In such cases, the view should keep displaying the current site and it should
2582         still be interactive. However, with the previous PSON model, the view (pageProxy)
2583         would have already swapped to the new process and would end up displaying the
2584         initially empty document.
2585
2586         To address the issue, this patch introduces the concept of a provisional load
2587         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
2588         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
2589         provisional page until after the load was committed in the new process. This means
2590         that the view / WebPageProxy keeps using the old process and displays the current
2591         content until a load has committed in the provisional page. If no load commits
2592         in the provisional process (e.g. because the load is cancelled or converted into
2593         a download), then we merely destroy the ProvisionalPageProxy and terminate its
2594         process, without impacting the WebPageProxy.
2595
2596         * Shared/WebPageCreationParameters.cpp:
2597         (WebKit::WebPageCreationParameters::encode const):
2598         (WebKit::WebPageCreationParameters::decode):
2599         * Shared/WebPageCreationParameters.h:
2600         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
2601         delay attaching the drawing area in case of a process-swap, no matter what
2602         now that the previous process is kept alive until the provisional load is
2603         committed in the new process.
2604
2605         * Shared/WebPolicyAction.h:
2606         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
2607         process-swap, we now tell the previous process to simply ignore the load, while
2608         we create a ProvisionalPageProxy to do the new load in a new process.
2609         Suspension of the previous page in the old process, happens later, when a load
2610         is actually committed in the new process.
2611
2612         * Sources.txt:
2613         Add new ProvisionalPageProxy file.
2614
2615         * UIProcess/API/Cocoa/WKWebView.mm:
2616         (-[WKWebView _killWebContentProcessAndResetState]):
2617         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
2618         process and the provisional one, to maintain previous behavior in our API tests.
2619
2620         * UIProcess/API/gtk/PageClientImpl.cpp:
2621         (WebKit::PageClientImpl::createDrawingAreaProxy):
2622         * UIProcess/API/gtk/PageClientImpl.h:
2623         * UIProcess/API/wpe/PageClientImpl.cpp:
2624         (WebKit::PageClientImpl::createDrawingAreaProxy):
2625         * UIProcess/API/wpe/PageClientImpl.h:
2626         * UIProcess/AcceleratedDrawingAreaProxy.cpp:
2627         (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy):
2628         (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState):
2629         (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
2630         (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
2631         (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
2632         (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
2633         * UIProcess/AcceleratedDrawingAreaProxy.h:
2634         * UIProcess/Cocoa/WebViewImpl.h:
2635         * UIProcess/Cocoa/WebViewImpl.mm:
2636         (WebKit::WebViewImpl::createDrawingAreaProxy):
2637         * UIProcess/DrawingAreaProxy.cpp:
2638         (WebKit::DrawingAreaProxy::DrawingAreaProxy):
2639         (WebKit::DrawingAreaProxy::~DrawingAreaProxy):
2640         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
2641         * UIProcess/DrawingAreaProxy.h:
2642         (WebKit::DrawingAreaProxy::process):
2643         * UIProcess/DrawingAreaProxyImpl.cpp:
2644         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
2645         (WebKit::DrawingAreaProxyImpl::update):
2646         * UIProcess/DrawingAreaProxyImpl.h:
2647         * UIProcess/PageClient.h:
2648         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
2649         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2650         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
2651         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
2652         (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange):
2653         (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
2654         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
2655         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd):
2656         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
2657         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
2658         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
2659         * UIProcess/ios/PageClientImplIOS.h:
2660         * UIProcess/ios/PageClientImplIOS.mm:
2661         (WebKit::PageClientImpl::createDrawingAreaProxy):
2662         * UIProcess/ios/WKContentView.h:
2663         * UIProcess/ios/WKContentView.mm:
2664         (-[WKContentView _createDrawingAreaProxy:]):
2665         * UIProcess/mac/PageClientImplMac.h:
2666         * UIProcess/mac/PageClientImplMac.mm:
2667         (WebKit::PageClientImpl::createDrawingAreaProxy):
2668         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2669         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2670         (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy):
2671         (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange):
2672         (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange):
2673         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
2674         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
2675         (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry):
2676         (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom):
2677         (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom):
2678         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
2679         * UIProcess/mac/WebPageProxyMac.mm:
2680         * UIProcess/win/PageClientImpl.cpp:
2681         (WebKit::PageClientImpl::createDrawingAreaProxy):
2682         * UIProcess/win/PageClientImpl.h:
2683         * UIProcess/win/PageClientImpl.cpp:
2684         (WebKit::PageClientImpl::createDrawingAreaProxy):
2685         * UIProcess/win/PageClientImpl.h:
2686         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2687         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2688         Pass the drawing area's associated process when constructing it and store it as a member
2689         in addition to the page. This is necessary now that a page can be associated with 2
2690         WebProcesses at a time, each having its own drawing area.
2691
2692         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2693         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
2694         Pass the process.
2695
2696         * UIProcess/ProvisionalPageProxy.cpp: Added.
2697         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2698         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2699         (WebKit::ProvisionalPageProxy::processDidTerminate):
2700         (WebKit::ProvisionalPageProxy::takeDrawingArea):
2701         (WebKit::ProvisionalPageProxy::cancel):
2702         (WebKit::ProvisionalPageProxy::processDidFinishLaunching):
2703         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch):
2704         (WebKit::ProvisionalPageProxy::initializeWebPage):
2705         (WebKit::ProvisionalPageProxy::loadData):
2706         (WebKit::ProvisionalPageProxy::loadRequest):
2707         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
2708         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
2709         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
2710         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
2711         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
2712         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
2713         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
2714         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
2715         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
2716         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
2717         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
2718         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
2719         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2720         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
2721         * UIProcess/ProvisionalPageProxy.h: Added.
2722         (WebKit::ProvisionalPageProxy::page):
2723         (WebKit::ProvisionalPageProxy::mainFrame const):
2724         (WebKit::ProvisionalPageProxy::process):
2725         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
2726         (WebKit::ProvisionalPageProxy::navigationID const):
2727         (WebKit::ProvisionalPageProxy::drawingArea const):
2728         New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from
2729         the provisional process.
2730
2731         * UIProcess/SuspendedPageProxy.cpp:
2732         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2733         (WebKit::SuspendedPageProxy::unsuspend):
2734         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
2735         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
2736         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
2737         which tries to register itself as an IPC message receiver for the same pageID when
2738         a process-swap occurs and we're switching to a suspended page.
2739
2740         * UIProcess/WebFrameProxy.cpp:
2741         (WebKit::WebFrameProxy::isMainFrame const):
2742         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
2743         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
2744         m_mainFrame to maintain previous behavior.
2745
2746         * UIProcess/WebPageProxy.cpp:
2747         (WebKit::WebPageProxy::provisionalDrawingArea const):
2748         Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but
2749         the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot.
2750
2751         (WebKit::WebPageProxy::swapToWebProcess):
2752         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
2753         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
2754         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
2755         the ProvisionalPageProxy which started the provisional load.
2756
2757         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2758         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
2759         committed in the provisional process.
2760
2761         (WebKit::WebPageProxy::setDrawingArea):
2762         (WebKit::WebPageProxy::initializeWebPage):
2763         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
2764           committed in the provisional process.
2765         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
2766
2767         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2768         (WebKit::WebPageProxy::loadRequest):
2769         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2770         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
2771         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
2772
2773         (WebKit::WebPageProxy::loadData):
2774         (WebKit::WebPageProxy::loadDataWithNavigationShared):
2775         (WebKit::WebPageProxy::stopLoading):
2776         (WebKit::WebPageProxy::reload):
2777         (WebKit::WebPageProxy::didPerformDragControllerAction):
2778         (WebKit::WebPageProxy::findPlugin):
2779         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2780         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
2781         Suspension now happens later, only if we end up committing the provisional load in the new process.
2782         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
2783         to happen a bit later but it is clearer if we do this as early as possible I think.
2784
2785         (WebKit::WebPageProxy::commitProvisionalPage):
2786         When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
2787         - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
2788         - Suspending the current page.
2789         - Letting the client know the load is comitted
2790         - Destroy the ProvisionalPageProxy.
2791         This work used to happen earlier in continueNavigationInNewProcess().
2792
2793         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2794         Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
2795         without actually having the WebPageProxy switch to the new process yet.
2796
2797         (WebKit::WebPageProxy::didCreateMainFrame):
2798         (WebKit::WebPageProxy::didCreateSubframe):
2799         (WebKit::WebPageProxy::didCreateWindow):
2800         Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.
2801
2802         (WebKit::WebPageProxy::didDestroyNavigation):
2803         On process-swap, when telling the previous process to ignore the load and starting the new load in a new
2804         ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
2805         the call since the navigation is merely taken over by the ProvisionalPageProxy.
2806
2807         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2808         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
2809         Moved some PSON logic to the ProvisionalPageProxy instead.
2810
2811         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2812         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
2813         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
2814         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
2815         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
2816         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
2817
2818         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2819         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
2820         When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.
2821
2822         (WebKit::WebPageProxy::didCommitLoadForFrame):
2823         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2824         (WebKit::WebPageProxy::didFinishLoadForFrame):
2825         (WebKit::WebPageProxy::didFailLoadForFrame):
2826         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
2827         (WebKit::WebPageProxy::didReceiveTitleForFrame):
2828         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
2829         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
2830         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
2831         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
2832         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2833         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
2834         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2835         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2836         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2837         (WebKit::WebPageProxy::decidePolicyForResponse):
2838         (WebKit::WebPageProxy::decidePolicyForResponseShared):
2839         (WebKit::WebPageProxy::unableToImplementPolicy):
2840         (WebKit::WebPageProxy::willSubmitForm):
2841         (WebKit::WebPageProxy::didNavigateWithNavigationData):
2842         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
2843         (WebKit::WebPageProxy::didPerformClientRedirect):
2844         (WebKit::WebPageProxy::didPerformClientRedirectShared):
2845         (WebKit::WebPageProxy::didPerformServerRedirect):
2846         (WebKit::WebPageProxy::didUpdateHistoryTitle):
2847         (WebKit::WebPageProxy::createNewPage):
2848         (WebKit::WebPageProxy::runJavaScriptAlert):
2849         (WebKit::WebPageProxy::runJavaScriptConfirm):
2850         (WebKit::WebPageProxy::runJavaScriptPrompt):
2851         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
2852         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
2853         (WebKit::WebPageProxy::runOpenPanel):
2854         (WebKit::WebPageProxy::printFrame):
2855         (WebKit::WebPageProxy::backForwardGoToItem):
2856         (WebKit::WebPageProxy::backForwardGoToItemShared):
2857         (WebKit::WebPageProxy::learnWord):
2858         (WebKit::WebPageProxy::ignoreWord):
2859         (WebKit::WebPageProxy::didReceiveEvent):
2860         (WebKit::WebPageProxy::editingRangeCallback):
2861         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
2862         (WebKit::WebPageProxy::focusedFrameChanged):
2863         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
2864
2865         (WebKit::WebPageProxy::provisionalProcessDidTerminate):
2866         Cancel the provisiona load and destroy the ProvisionalPageProxy if
2867         the provisional process crashes.
2868
2869         (WebKit::WebPageProxy::resetState):
2870         Drop some code that is no longer needed.
2871
2872         (WebKit::WebPageProxy::creationParameters):
2873         - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
2874         more than one call site. This was just some bad factoring.
2875         - Take the process in parameter now that we page can be associated with several processes at a time.
2876
2877         (WebKit::WebPageProxy::exceededDatabaseQuota):
2878         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
2879         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
2880         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
2881         (WebKit::WebPageProxy::startURLSchemeTask):
2882         (WebKit::WebPageProxy::startURLSchemeTaskShared):
2883         (WebKit::WebPageProxy::stopURLSchemeTask):
2884         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
2885         (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess):
2886         (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension):
2887         * UIProcess/WebPageProxy.h:
2888         (WebKit::WebPageProxy::visitedLinkStore):
2889         (WebKit::WebPageProxy::provisionalPageProxy const):
2890
2891         * UIProcess/WebProcessProxy.cpp:
2892         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
2893         (WebKit::WebProcessProxy::updateBackForwardItem):
2894         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
2895         (WebKit::WebProcessProxy::didFinishLaunching):
2896         (WebKit::WebProcessProxy::canTerminateChildProcess):
2897         * UIProcess/WebProcessProxy.h:
2898         (WebKit::WebProcessProxy::addProvisionalPageProxy):
2899         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
2900         Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
2901         item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
2902         associated with this process yet, because it is still a ProvisionalPageProxy.        
2903
2904         * UIProcess/WebURLSchemeHandler.cpp:
2905         (WebKit::WebURLSchemeHandler::startTask):
2906         * UIProcess/WebURLSchemeHandler.h:
2907         * UIProcess/WebURLSchemeTask.cpp:
2908         (WebKit::WebURLSchemeTask::create):
2909         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
2910         (WebKit::WebURLSchemeTask::didPerformRedirection):
2911         (WebKit::WebURLSchemeTask::didReceiveResponse):
2912         (WebKit::WebURLSchemeTask::didReceiveData):
2913         (WebKit::WebURLSchemeTask::didComplete):
2914         (WebKit::WebURLSchemeTask::pageDestroyed):
2915         * UIProcess/WebURLSchemeTask.h:
2916         Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to
2917         the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses.
2918
2919         * UIProcess/ios/ViewGestureControllerIOS.mm:
2920         (WebKit::ViewGestureController::endSwipeGesture):
2921         Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently
2922         associated with the page in case of process swap.
2923
2924         * WebKit.xcodeproj/project.pbxproj:
2925         Add ProvisionalPageProxy class.
2926
2927         * WebProcess/WebPage/WebFrame.cpp:
2928         (WebKit::toPolicyAction):
2929         (WebKit::WebFrame::didReceivePolicyDecision):
2930         * WebProcess/WebPage/WebPage.cpp:
2931         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2932         (WebKit::WebPage::reinitializeWebPage):
2933         (WebKit::WebPage::didReceivePolicyDecision):
2934         Stop dealing with WebPolicyAction::Suspend as it no longer exists.
2935
2936         (WebKit::WebPage::didCompletePageTransition):
2937
2938         (WebKit::WebPage::setIsSuspended):
2939         Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
2940         setIsSuspended(true) IPC is sent when we actually commit the provisional page.
2941
2942         * WebProcess/WebPage/WebPage.h:
2943
2944 2019-01-16  Tim Horton  <timothy_horton@apple.com>
2945
2946         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
2947         https://bugs.webkit.org/show_bug.cgi?id=193468
2948         <rdar://problem/38645869>
2949
2950         Reviewed by Zalan Bujtas.
2951
2952         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2953         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
2954         Adjust the null-check a bit; Zalan pointed out that the layout could
2955         be responsible for the Frame/RenderView going away, so we should bail
2956         *after* layout, not before.
2957
2958 2019-01-15  Fujii Hironori  <Hironori.Fujii@sony.com>
2959
2960         Unreviewed WinCairo build fix.
2961
2962         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
2963         (WebKit::WebPageInspectorTargetController::connectInspector): Use 'auto' instead of unprefixed InspectorTarget.
2964         (WebKit::WebPageInspectorTargetController::disconnectInspector): Ditto.
2965         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend): Ditto.
2966
2967 2019-01-15  Alex Christensen  <achristensen@webkit.org>
2968
2969         Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
2970         https://bugs.webkit.org/show_bug.cgi?id=193368
2971
2972         Reviewed by Geoff Garen.
2973
2974         * WebProcess/Plugins/PluginView.cpp:
2975         (WebKit::PluginView::getAuthenticationInfo):
2976
2977 2019-01-15  Alex Christensen  <achristensen@webkit.org>
2978
2979         Remove more NetworkProcess::singleton use
2980         https://bugs.webkit.org/show_bug.cgi?id=193484
2981
2982         Reviewed by Geoffrey Garen.
2983
2984         This removes the use of NetworkProcess::singleton in the LegacyCustomProtocolManager.
2985         This is the kind of awful duct tape code that keeps me awake at night, but it's necessary
2986         because we can't quite remove LegacyCustomProtocolManager yet but we need to allow more than
2987         one NetworkProcess object.  To make it work well enough until we remove LegacyCustomProtocolManager,
2988         use the last NetworkProcess object that has been created.
2989
2990         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
2991         (newestNetworkProcess):
2992         (LegacyCustomProtocolManager::networkProcessCreated):
2993         (+[WKCustomProtocol canInitWithRequest:]):
2994         (-[WKCustomProtocol initWithRequest:cachedResponse:client:]):
2995         (-[WKCustomProtocol startLoading]):
2996         (-[WKCustomProtocol stopLoading]):
2997         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
2998         (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
2999         (WebKit::LegacyCustomProtocolManager::startLoading):
3000         (WebKit::LegacyCustomProtocolManager::stopLoading):
3001         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
3002         * NetworkProcess/NetworkProcess.cpp:
3003         (WebKit::NetworkProcess::NetworkProcess):
3004
3005 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3006
3007         Fix WinCairo build after r240014
3008         https://bugs.webkit.org/show_bug.cgi?id=161106
3009
3010         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3011
3012 2019-01-15  Ryosuke Niwa  <rniwa@webkit.org>
3013
3014         VisualViewport API should be updated upon opening of keyboard
3015         https://bugs.webkit.org/show_bug.cgi?id=193475
3016
3017         Reviewed by Simon Fraser.
3018
3019         The bug was caused by the changes to unobscuredContentRectRespectingInputViewBounds not updating the visual viewport
3020         unless it caused a layout to happen. Added a code to update the visual viewport in WebPage::updateVisibleContentRects.
3021
3022         Also fixed the bug that VisibleContentRectUpdateInfo::operator== was not checking differences in
3023         unobscuredContentRectRespectingInputViewBounds which resulted in the visual viewport override not getting updated
3024         while the keyboard is getting brought up.
3025
3026         * Shared/VisibleContentRectUpdateInfo.h:
3027         (WebKit::operator==):
3028         * WebProcess/WebPage/ios/WebPageIOS.mm:
3029         (WebKit::WebPage::updateVisibleContentRects):
3030
3031 2019-01-15  Megan Gardner  <megan_gardner@apple.com>
3032
3033         Add Reveal support in iOSMac
3034         https://bugs.webkit.org/show_bug.cgi?id=193408
3035         <rdar://problem/47300699>
3036
3037         Reviewed by Tim Horton.
3038
3039         Add calls to DictionaryLookup from the appropriate places.
3040
3041         * UIProcess/PageClient.h:
3042         * UIProcess/ios/PageClientImplIOS.h:
3043         * UIProcess/ios/PageClientImplIOS.mm:
3044         (WebKit::PageClientImpl::didPerformDictionaryLookup):
3045         * UIProcess/ios/WebPageProxyIOS.mm:
3046         (WebKit::WebPageProxy::didPerformDictionaryLookup):
3047         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3048         (WebKit::WebPage::dictionaryPopupInfoForRange):
3049
3050 2019-01-15  Claudio Saavedra  <csaavedra@igalia.com>
3051
3052         [SOUP] Remove usage of NetworkProcess::singleton()
3053         https://bugs.webkit.org/show_bug.cgi?id=193444
3054
3055         Reviewed by Michael Catanzaro.
3056
3057         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3058         (WebKit::NetworkDataTaskSoup::download):
3059         (WebKit::NetworkDataTaskSoup::didWriteDownload):
3060         (WebKit::NetworkDataTaskSoup::didFinishDownload):
3061         (WebKit::NetworkDataTaskSoup::didFailDownload):
3062         * NetworkProcess/soup/NetworkSessionSoup.cpp:
3063         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
3064
3065 2019-01-15  Eric Carlson  <eric.carlson@apple.com>
3066
3067         Fix incorrect ASSERT added in r239840
3068         https://bugs.webkit.org/show_bug.cgi?id=193466
3069         <rdar://problem/47095142>
3070
3071         Reviewed by Youenn Fablet.
3072
3073         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3074         (WebKit::UserMediaCaptureManager::Source::Source):
3075
3076 2019-01-15  Tim Horton  <timothy_horton@apple.com>
3077
3078         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
3079         https://bugs.webkit.org/show_bug.cgi?id=193468
3080         <rdar://problem/38645869>
3081
3082         Reviewed by Beth Dakin.
3083
3084         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3085         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
3086         I'm not sure why this got *worse*, but we should null-check RenderView.
3087         It's OK to bail from scaleViewToFitDocumentIfNeeded, we'll re-do it
3088         the next time we paint (which will surely happen if we gain a RenderView).
3089
3090 2019-01-15  Chris Dumez  <cdumez@apple.com>
3091
3092         Unreviewed, rolling out r239993, r239995, r239997, and
3093         r239999.
3094
3095         Caused assertions under
3096         ViewGestureController::disconnectFromProcess()
3097
3098         Reverted changesets:
3099
3100         "Regression(PSON) View becomes blank after click a cross-site
3101         download link"
3102         https://bugs.webkit.org/show_bug.cgi?id=193361
3103         https://trac.webkit.org/changeset/239993
3104
3105         "Unreviewed iOS build fix after r239993."
3106         https://trac.webkit.org/changeset/239995
3107
3108         "Fix iOS build after r239993"
3109         https://bugs.webkit.org/show_bug.cgi?id=193361
3110         https://trac.webkit.org/changeset/239997
3111
3112         "Unreviewed, revert part of r239997 as it is not needed to fix
3113         the build."
3114         https://trac.webkit.org/changeset/239999
3115
3116 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3117
3118         Stop using CookiesStrategy
3119         https://bugs.webkit.org/show_bug.cgi?id=161106
3120
3121         Reviewed by Don Olmstead and Antti Koivisto.
3122
3123         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
3124         (WebKit::NetworkProcessPlatformStrategies::createCookiesStrategy): Deleted.
3125         * NetworkProcess/NetworkProcessPlatformStrategies.h:
3126         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3127         * Scripts/webkit/messages.py:
3128         * Sources.txt:
3129         * WebKit.xcodeproj/project.pbxproj:
3130         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3131         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
3132         (WebKit::WebAutomationSessionProxy::deleteCookie):
3133         * WebProcess/Plugins/PluginView.cpp:
3134         (WebKit::PluginView::cookiesForURL):
3135         (WebKit::PluginView::setCookiesForURL):
3136         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3137         (WebKit::WebPlatformStrategies::createCookiesStrategy): Deleted.
3138         (WebKit::WebPlatformStrategies::cookiesForDOM): Deleted.
3139         (WebKit::WebPlatformStrategies::setCookiesFromDOM): Deleted.
3140         (WebKit::WebPlatformStrategies::cookiesEnabled): Deleted.
3141         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted.
3142         (WebKit::WebPlatformStrategies::getRawCookies): Deleted.
3143         (WebKit::WebPlatformStrategies::deleteCookie): Deleted.
3144         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3145         * WebProcess/WebPage/WebCookieJar.cpp: Added.
3146         (WebKit::WebCookieJar::cookies const):
3147         (WebKit::WebCookieJar::setCookies):
3148         (WebKit::WebCookieJar::cookiesEnabled const):
3149         (WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
3150         (WebKit::WebCookieJar::getRawCookies const):
3151         (WebKit::WebCookieJar::deleteCookie):
3152         * WebProcess/WebPage/WebCookieJar.h: Added.
3153         * WebProcess/WebPage/WebPage.cpp:
3154         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
3155
3156 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
3157
3158         Remove reporting for iOS mach lookups confirmed in-use
3159         https://bugs.webkit.org/show_bug.cgi?id=193455
3160         <rdar://problem/47259551>
3161
3162         Reviewed by Brent Fulgham.
3163
3164         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3165
3166 2019-01-15  Tim Horton  <timothy_horton@apple.com>
3167
3168         Cannot tab out of WKWebView on macOS
3169         https://bugs.webkit.org/show_bug.cgi?id=161448
3170         <rdar://problem/28100085>
3171
3172         Reviewed by Dean Jackson.
3173
3174         * UIProcess/WebPageProxy.cpp:
3175         (WebKit::WebPageProxy::takeFocus):
3176         If the UIDelegate doesn't implement takeFocus, provide a simple default
3177         implementation that just uses AppKit's key view loop to move the focus.
3178
3179         * UIProcess/API/APIUIClient.h:
3180         (API::UIClient::takeFocus):
3181         * UIProcess/API/C/WKPage.cpp:
3182         (WKPageSetPageUIClient):
3183         * UIProcess/Cocoa/UIDelegate.h:
3184         * UIProcess/Cocoa/UIDelegate.mm:
3185         (WebKit::UIDelegate::UIClient::takeFocus):
3186         Make API::UIClient's takeFocus return a bool indicating whether the
3187         client implements it or not.
3188
3189         * UIProcess/PageClient.h:
3190         * UIProcess/mac/PageClientImplMac.h:
3191         * UIProcess/mac/PageClientImplMac.mm:
3192         (WebKit::PageClientImpl::takeFocus):
3193         Plumb takeFocus to WebViewImpl.
3194
3195         * UIProcess/Cocoa/WebViewImpl.h:
3196         * UIProcess/Cocoa/WebViewImpl.mm:
3197         (WebKit::WebViewImpl::takeFocus):
3198         Borrow the relevant portion of WebKitLegacy's implementation of takeFocus,
3199         shifting focus to the next/previous key view in the window.
3200
3201 2019-01-15  Youenn Fablet  <youenn@apple.com>
3202
3203         Remove the specific handling of ephemeral sessions from CacheStorage::Engine::from
3204         https://bugs.webkit.org/show_bug.cgi?id=193400
3205
3206         Reviewed by Alex Christensen.
3207
3208         It is no longer needed as we correctly handle ephemeral sessions removal.
3209
3210         * NetworkProcess/cache/CacheStorageEngine.cpp:
3211         (WebKit::CacheStorage::Engine::from):
3212
3213 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3214
3215         Fix iOS build after r239993
3216         https://bugs.webkit.org/show_bug.cgi?id=193361
3217
3218         * UIProcess/ProvisionalPageProxy.h:
3219         * UIProcess/SuspendedPageProxy.h:
3220
3221 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
3222
3223         [macOS] Adjust logging policy in WebKit's sandbox
3224         https://bugs.webkit.org/show_bug.cgi?id=193454
3225         <rdar://problem/47256325>
3226
3227         Reviewed by Brent Fulgham.
3228
3229         * WebProcess/com.apple.WebProcess.sb.in:
3230
3231 2019-01-15  Chris Dumez  <cdumez@apple.com>
3232
3233         Unreviewed iOS build fix after r239993.
3234
3235         * UIProcess/SuspendedPageProxy.h:
3236
3237 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
3238
3239         Add allow directive for MTLCompilerService.xpc to PluginProcess and WebContent
3240         https://bugs.webkit.org/show_bug.cgi?id=193453
3241         <rdar://problem/47268166>
3242
3243         Reviewed by Brent Fulgham.
3244
3245         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3246         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3247         * WebProcess/com.apple.WebProcess.sb.in:
3248
3249 2019-01-15  Chris Dumez  <cdumez@apple.com>
3250
3251         Regression(PSON) View becomes blank after click a cross-site download link
3252         https://bugs.webkit.org/show_bug.cgi?id=193361
3253         <rdar://problem/47099573>
3254
3255         Reviewed by Geoff Garen.
3256
3257         The issue tracked by rdar://problem/47099573 is that a provisional load may get
3258         canceled (or converted into a download) *after* we've decided to process-swap.
3259         In such cases, the view should keep displaying the current site and it should
3260         still be interactive. However, with the previous PSON model, the view (pageProxy)
3261         would have already swapped to the new process and would end up displaying the
3262         initially empty document.
3263
3264         To address the issue, this patch introduces the concept of a provisional load
3265         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
3266         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
3267         provisional page until after the load was committed in the new process. This means
3268         that the view / WebPageProxy keeps using the old process and displays the current
3269         content until a load has committed in the provisional page. If no load commits
3270         in the provisional process (e.g. because the load is cancelled or converted into
3271         a download), then we merely destroy the ProvisionalPageProxy and terminate its
3272         process, without impacting the WebPageProxy.
3273
3274         * Shared/WebPageCreationParameters.cpp:
3275         (WebKit::WebPageCreationParameters::encode const):
3276         (WebKit::WebPageCreationParameters::decode):
3277         * Shared/WebPageCreationParameters.h:
3278         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
3279         delay attaching the drawing area in case of a process-swap, no matter what
3280         now that the previous process is kept alive until the provisional load is
3281         committed in the new process.
3282
3283         * Shared/WebPolicyAction.h:
3284         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
3285         process-swap, we now tell the previous process to simply ignore the load, while
3286         we create a ProvisionalPageProxy to do the new load in a new process.
3287         Suspension of the previous page in the old process, happens later, when a load
3288         is actually committed in the new process.
3289
3290         * Sources.txt:
3291         Add new ProvisionalPageProxy file.
3292
3293         * UIProcess/API/Cocoa/WKWebView.mm:
3294         (-[WKWebView _killWebContentProcessAndResetState]):
3295         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
3296         process and the provisional one, to maintain previous behavior in our API tests.
3297
3298         * UIProcess/PageClient.h:
3299         Tiny build fix.
3300
3301         * UIProcess/ProvisionalPageProxy.cpp: Added.
3302         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3303         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3304         (WebKit::ProvisionalPageProxy::takeDrawingArea):
3305         (WebKit::ProvisionalPageProxy::cancel):
3306         (WebKit::ProvisionalPageProxy::initializeWebPage):
3307         (WebKit::ProvisionalPageProxy::loadDataWithNavigation):
3308         (WebKit::ProvisionalPageProxy::loadRequestWithNavigation):
3309         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
3310         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
3311         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
3312         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
3313         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
3314         (WebKit::ProvisionalPageProxy::didReceiveMessage):
3315         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
3316         * UIProcess/ProvisionalPageProxy.h: Added.
3317         (WebKit::ProvisionalPageProxy::page):
3318         (WebKit::ProvisionalPageProxy::mainFrame const):
3319         (WebKit::ProvisionalPageProxy::process):
3320         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
3321         (WebKit::ProvisionalPageProxy::navigationID const):
3322         Add new ProvisionalPageProxy class to wrap the provisional load in the new process
3323         after a swap. The provisional page is owned by the WebPageProxy and we only commit
3324         the provisional page when the load is committed. Until then, the WebPageProxy keeps
3325         using the old process and displaying the current content.
3326
3327         * UIProcess/SuspendedPageProxy.cpp:
3328         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3329         (WebKit::SuspendedPageProxy::unsuspend):
3330         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3331         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
3332         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
3333         which tries to register itself as an IPC message receiver for the same pageID when
3334         a process-swap occurs and we're switching to a suspended page.
3335
3336         * UIProcess/WebFrameProxy.cpp:
3337         (WebKit::WebFrameProxy::isMainFrame const):
3338         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
3339         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
3340         m_mainFrame to maintain previous behavior.
3341
3342         * UIProcess/WebPageProxy.cpp:
3343         (WebKit::WebPageProxy::swapToWebProcess):
3344         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
3345         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
3346         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
3347         the ProvisionalPageProxy which started the provisional load.
3348
3349         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3350         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
3351         committed in the provisional process.
3352
3353         (WebKit::WebPageProxy::initializeWebPage):
3354         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
3355           committed in the provisional process.
3356         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
3357
3358         (WebKit::WebPageProxy::loadRequestWithNavigation):
3359         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
3360         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
3361
3362         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3363         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
3364         Suspension now happens later, only if we end up committing the provisional load in the new process.
3365         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
3366         to happen a bit later but it is clearer if we do this as early as possible I think.
3367
3368         (WebKit::WebPageProxy::commitProvisionalPage):
3369         When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
3370         - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
3371         - Suspending the current page.
3372         - Letting the client know the load is comitted
3373         - Destroy the ProvisionalPageProxy.
3374         This work used to happen earlier in continueNavigationInNewProcess().
3375
3376         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3377         Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
3378         without actually having the WebPageProxy switch to the new process yet.
3379
3380         (WebKit::WebPageProxy::didCreateMainFrame):
3381         (WebKit::WebPageProxy::didCreateWindow):
3382         Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.
3383
3384         (WebKit::WebPageProxy::didDestroyNavigation):
3385         On process-swap, when telling the previous process to ignore the load and starting the new load in a new
3386         ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
3387         the call since the navigation is merely taken over by the ProvisionalPageProxy.
3388
3389         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3390         Moved some PSON logic to the ProvisionalPageProxy instead.
3391