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