[iOS] Sandbox must allow mach lookup required to compress video
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-12  Eric Carlson  <eric.carlson@apple.com>
2
3         [iOS] Sandbox must allow mach lookup required to compress video
4         https://bugs.webkit.org/show_bug.cgi?id=195627
5         <rdar://problem/48811072>
6
7         Reviewed by Youenn Fablet.
8
9         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
10
11 2019-03-12  Jennifer Moore  <jennifer.moore@apple.com>
12
13         Check whether to launch a default action instead of action sheet
14         https://bugs.webkit.org/show_bug.cgi?id=195225
15         <rdar://problem/47715544>
16
17         Reviewed by Daniel Bates and Tim Horton.
18
19         Notify DataDetectors at the start of a touch on a link, and check whether to immediately
20         launch the default action instead of an action sheet.
21
22         * UIProcess/ios/WKActionSheetAssistant.h:
23         * UIProcess/ios/WKActionSheetAssistant.mm:
24         (-[WKActionSheetAssistant interactionDidStart]):
25         (-[WKActionSheetAssistant _createSheetWithElementActions:defaultTitle:showLinkTitle:]):
26         (-[WKActionSheetAssistant showImageSheet]):
27         (-[WKActionSheetAssistant showLinkSheet]):
28         (-[WKActionSheetAssistant showDataDetectorsSheet]):
29         (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): Deleted.
30         * UIProcess/ios/WKContentViewInteraction.mm:
31         (-[WKContentView _webTouchEventsRecognized:]):
32 :
33 2019-03-12  Zalan Bujtas  <zalan@apple.com>
34
35         [Synthetic Click] Dispatch mouseout soon after mouseup
36         https://bugs.webkit.org/show_bug.cgi?id=195575
37         <rdar://problem/47093049>
38
39         Reviewed by Simon Fraser.
40
41         * WebProcess/WebPage/ios/WebPageIOS.mm:
42         (WebKit::WebPage::completeSyntheticClick):
43
44 2019-03-12  Zalan Bujtas  <zalan@apple.com>
45
46         [ContentChangeObserver] Stop content change observation when the touch event turns into long press
47         https://bugs.webkit.org/show_bug.cgi?id=195601
48         <rdar://problem/48796324>
49
50         Reviewed by Wenson Hsieh.
51
52         Add didRecognizeLongPress() message to be able to cancel content observation (started at touchStart).
53
54         * UIProcess/WebPageProxy.h:
55         * UIProcess/ios/WKContentViewInteraction.mm:
56         (-[WKContentView _longPressRecognized:]):
57         * UIProcess/ios/WebPageProxyIOS.mm:
58         (WebKit::WebPageProxy::didRecognizeLongPress):
59         * WebProcess/WebPage/WebPage.h:
60         * WebProcess/WebPage/WebPage.messages.in:
61         * WebProcess/WebPage/ios/WebPageIOS.mm:
62         (WebKit::WebPage::didRecognizeLongPress):
63
64 2019-03-11  Andy Estes  <aestes@apple.com>
65
66         [Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing
67         https://bugs.webkit.org/show_bug.cgi?id=195583
68         <rdar://problem/48420224>
69
70         Reviewed by Daniel Bates.
71
72         PassKit.framework is optionally soft-linked on Mac because it is missing from the Recovery
73         Partition. We need to check if the framework is available before calling into it.
74
75         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
76         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
77         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
78         (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
79         (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):
80         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
81         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
82
83 2019-03-12  Antti Koivisto  <antti@apple.com>
84
85         Compositing layer that renders two positioned elements should not hit test
86         https://bugs.webkit.org/show_bug.cgi?id=195371
87         <rdar://problem/48649586>
88
89         Reviewed by Simon Fraser.
90
91         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
92         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
93         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
94         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
95         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
96         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
97         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
98
99         Pass event region to UI process.
100
101         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
102         (WebKit::RemoteLayerTreeNode::layerID const):
103         (WebKit::RemoteLayerTreeNode::eventRegion const):
104         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
105         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
106         (WebKit::RemoteLayerTreeNode::~RemoteLayerTreeNode):
107         (WebKit::RemoteLayerTreeNode::setEventRegion):
108
109         Maintain event region in RemoteLayerTreeNodes.
110
111         (WebKit::RemoteLayerTreeNode::initializeLayer):
112         (WebKit::RemoteLayerTreeNode::layerID):
113         (WebKit::RemoteLayerTreeNode::forCALayer):
114
115         Move layerID to RemoteLayerTreeNode and store RemoteLayerTreeNode pointer to CALayers instead.
116         This makes it easy to find the matching RemoteLayerTreeNode from a layer, globally.
117
118         (WebKit::RemoteLayerTreeNode::setLayerID): Deleted.
119         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
120         (WebKit::collectDescendantViewsAtPoint):
121
122         If we have event region, use it for hit testing.
123
124         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
125         (collectDescendantViewsAtPoint): Deleted.
126         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
127         (WebKit::PlatformCALayerRemote::eventRegion const):
128         (WebKit::PlatformCALayerRemote::setEventRegion):
129         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
130
131 2019-03-12  Carlos Garcia Campos  <cgarcia@igalia.com>
132
133         [WPE][GTK] Load events may occur in unexpected order when JS redirects page before subresource load finishes
134         https://bugs.webkit.org/show_bug.cgi?id=194131
135
136         Reviewed by Michael Catanzaro.
137
138         Ensure we emit the load-failed and load-changed with finished event when there's still an ongoing load when a
139         new provisional load strarts. Previous load fails with cancelled error.
140
141         * UIProcess/API/glib/WebKitWebView.cpp:
142         (webkitWebViewWillStartLoad): Call webkitWebViewLoadFailed() if current page load state is not finished.
143         * UIProcess/API/glib/WebKitWebViewPrivate.h:
144         * UIProcess/API/gtk/PageClientImpl.cpp:
145         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call webkitWebViewWillStartLoad().
146         * UIProcess/API/wpe/APIViewClient.h:
147         (API::ViewClient::willStartLoad): Add willStartLoad() to API::ViewClient
148         * UIProcess/API/wpe/PageClientImpl.cpp:
149         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call WPEView::willStartLoad().
150         * UIProcess/API/wpe/PageClientImpl.h:
151         * UIProcess/API/wpe/WPEView.cpp:
152         (WKWPE::View::willStartLoad): Call API::ViewClient::willStartLoad().
153         * UIProcess/API/wpe/WPEView.h:
154         * UIProcess/PageLoadState.h:
155         (WebKit::PageLoadState::isProvisional const):
156         (WebKit::PageLoadState::isCommitted const):
157         (WebKit::PageLoadState::isFinished const):
158
159 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
160
161         Unreviewed, rolling out r242763.
162
163         Causes layout test crashes on iOS simulator
164
165         Reverted changeset:
166
167         "[Synthetic Click] Dispatch mouseout soon after mouseup"
168         https://bugs.webkit.org/show_bug.cgi?id=195575
169         https://trac.webkit.org/changeset/242763
170
171 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
172
173         Add Optional to Forward.h.
174         https://bugs.webkit.org/show_bug.cgi?id=195586
175
176         Reviewed by Darin Adler.
177
178         * Shared/RTCNetwork.cpp:
179         * Shared/RTCNetwork.h:
180         * Shared/RTCPacketOptions.cpp:
181         * Shared/RTCPacketOptions.h:
182         * UIProcess/API/APIWebsitePolicies.h:
183         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
184         Remove unnecessary includes from headers.
185
186 2019-03-11  Commit Queue  <commit-queue@webkit.org>
187
188         Unreviewed, rolling out r242745 and r242756.
189         https://bugs.webkit.org/show_bug.cgi?id=195606
190
191         Breaks internal builds (Requested by ryanhaddad on #webkit).
192
193         Reverted changesets:
194
195         "[iOS] Block access to backboardd service"
196         https://bugs.webkit.org/show_bug.cgi?id=195484
197         https://trac.webkit.org/changeset/242745
198
199         "Unreviewed build fix after r242745."
200         https://trac.webkit.org/changeset/242756
201
202 2019-03-11  Fujii Hironori  <Hironori.Fujii@sony.com>
203
204         [CoordinatedGraphics] ASSERTION FAILED: !m_state.isSuspended
205         https://bugs.webkit.org/show_bug.cgi?id=195550
206
207         Reviewed by Carlos Garcia Campos.
208
209         CompositingRunLoop::suspend() locks a mutex and stops the update
210         timer. But, the timer can be fired after the lock was acquired and
211         before the timer is stopped.
212
213         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
214         (WebKit::CompositingRunLoop::updateTimerFired): Removed the
215         assertion. Return early if m_state.isSuspended.
216
217 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
218
219         [macOS] Remove the Kerberos rules from the WebContent sandbox
220         https://bugs.webkit.org/show_bug.cgi?id=195464
221         <rdar://problem/35369230>
222
223         Reviewed by Brent Fulgham.
224
225         Kerberos auth is done in the UIProcess or NetworkProcess now.
226
227         * WebProcess/com.apple.WebProcess.sb.in:
228
229 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
230
231         [iOS] Add entitlement to enable use of graphics endpoint with limited capabilities
232         https://bugs.webkit.org/show_bug.cgi?id=195582
233         <rdar://problem/36082379>
234
235         Reviewed by Brent Fulgham.
236
237         This is a QuartzCore endpoint with a minimal set of capabilities.
238
239         * Configurations/WebContent-iOS.entitlements:
240
241 2019-03-11  John Wilander  <wilander@apple.com>
242
243         Move NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm functionality into UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
244         https://bugs.webkit.org/show_bug.cgi?id=195117
245         <rdar://problem/48448715>
246
247         Reviewed by Brent Fulgham.
248
249         Reading of user defaults on Cocoa platforms should be done in the UI process and
250         forwarded to Resource Load Statistics in the network process through the
251         WebKit::NetworkSessionCreationParameters struct.
252
253         This patch does away with some old user defaults we don't use anymore. It also
254         changes the developer-facing default name to ITPManualPrevalentResource.
255
256         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
257         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
258             Removed the call to the old registerUserDefaultsIfNeeded().
259         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
260         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
261             Removed the call to the old registerUserDefaultsIfNeeded().
262         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
263             Removed the declaration of the old registerUserDefaultsIfNeeded().
264         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Removed.
265         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
266             Added an enum class EnableResourceLoadStatisticsDebugMode.
267         * NetworkProcess/NetworkSession.cpp:
268         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
269         * NetworkProcess/NetworkSession.h:
270         * NetworkProcess/NetworkSessionCreationParameters.cpp:
271         (WebKit::NetworkSessionCreationParameters::encode const):
272         (WebKit::NetworkSessionCreationParameters::decode):
273         * NetworkProcess/NetworkSessionCreationParameters.h:
274            The struct now has two new fields:
275            - enableResourceLoadStatisticsDebugMode
276            - resourceLoadStatisticsManualPrevalentResource
277         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
278         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
279             Forwarding of the parameters.
280         * SourcesCocoa.txt:
281         * UIProcess/WebProcessPool.cpp:
282         (WebKit::WebProcessPool::ensureNetworkProcess):
283             Forwarding of the parameters.
284         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
285         (WebKit::WebsiteDataStore::parameters):
286             This is where user defaults for Resource Load Statistics are now read.
287         * WebKit.xcodeproj/project.pbxproj:
288
289 2019-03-11  Zalan Bujtas  <zalan@apple.com>
290
291         [Synthetic Click] Dispatch mouseout soon after mouseup
292         https://bugs.webkit.org/show_bug.cgi?id=195575
293         <rdar://problem/47093049>
294
295         Reviewed by Simon Fraser.
296
297         * WebProcess/WebPage/ios/WebPageIOS.mm:
298         (WebKit::WebPage::completeSyntheticClick):
299
300 2019-03-11  Tim Horton  <timothy_horton@apple.com>
301
302         API test WebKit.RequestTextInputContext fails on iOS
303         https://bugs.webkit.org/show_bug.cgi?id=195585
304
305         Reviewed by Wenson Hsieh and Simon Fraser.
306
307         * UIProcess/API/Cocoa/WKWebView.mm:
308         (-[WKWebView _convertRectFromRootViewCoordinates:]):
309         (-[WKWebView _convertRectToRootViewCoordinates:]):
310         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
311         (-[WKWebView _focusTextInputContext:completionHandler:]):
312         * WebProcess/WebPage/WebPage.cpp:
313         (WebKit::elementRectInRootViewCoordinates):
314         (WebKit::WebPage::textInputContextsInRect):
315         (WebKit::elementRectInWindowCoordinates): Deleted.
316         Text input context SPI should be in terms of WKWebView coordinates,
317         for consistency's sake. This is a bit irritating; WebPage(Proxy) continue
318         to operate in "root view" coordinates, which means different things
319         depending on if delegatesScrolling is true or not. So, WKWebView does
320         the conversion, re-creating objects as needed.
321
322 2019-03-09  Jiewen Tan  <jiewen_tan@apple.com>
323
324         Optimizing loads when creating new pages
325         https://bugs.webkit.org/show_bug.cgi?id=195516
326         <rdar://problem/48738086>
327
328         Reviewed by Darin Adler.
329
330         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
331         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
332         API::NavigationAction to the load optimizer instead of the request within.
333
334         * UIProcess/API/APINavigationAction.h:
335         * UIProcess/API/APIUIClient.h:
336         (API::UIClient::createNewPage):
337         * UIProcess/API/C/WKPage.cpp:
338         (WKPageSetPageUIClient):
339         * UIProcess/API/glib/WebKitUIClient.cpp:
340         * UIProcess/Cocoa/NavigationState.mm:
341         (WebKit::tryOptimizingLoad):
342         (WebKit::tryInterceptNavigation):
343         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
344         * UIProcess/Cocoa/UIDelegate.h:
345         * UIProcess/Cocoa/UIDelegate.mm:
346         (WebKit::UIDelegate::UIClient::createNewPage):
347         * UIProcess/WebPageProxy.cpp:
348         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
349         (WebKit::tryOptimizingLoad):
350         (WebKit::WebPageProxy::createNewPage):
351         * UIProcess/WebPageProxy.h:
352
353 2019-03-11  Dean Jackson  <dino@apple.com>
354
355         [iOS] Implement a faster click detection that intercepts double-tap-to-zoom if possible
356         https://bugs.webkit.org/show_bug.cgi?id=195473
357         <rdar://problem/48718396>
358
359         Reviewed by Wenson Hsieh (with some help from Dan Bates).
360
361         Adds a new algorithm, behind a flag FasterClicksEnabled, that can trigger a click
362         event without waiting to see if a double tap will occur. It does this by examining
363         the amount of zoom that would be triggered if it was a double tap, and if that value
364         doesn't exceed a set threshold, commits to the click event instead.
365
366         This is implemented by having the Web Process respond to the potential click with
367         some geometry information. If the UI Process receives the information before the
368         second tap in a double tap, it can decide to trigger a click.
369
370         * Shared/WebPreferences.yaml: New internal feature so this can be toggled in
371             a UI for testing.
372
373         * SourcesCocoa.txt: Renamed WKSyntheticTapGestureRecognizer.
374         * WebKit.xcodeproj/project.pbxproj: Ditto.
375
376         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
377         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
378         (-[WKSyntheticTapGestureRecognizer setGestureIdentifiedTarget:action:]):
379         (-[WKSyntheticTapGestureRecognizer setGestureFailedTarget:action:]):
380         (-[WKSyntheticTapGestureRecognizer setResetTarget:action:]):
381         (-[WKSyntheticTapGestureRecognizer setState:]):
382         (-[WKSyntheticTapGestureRecognizer reset]):  Renamed WKSyntheticClickTapGestureRecognizer to
383             WKSyntheticTapGestureRecognizer, changed the signature of the main function to be a bit
384             more clear about what it does, and added a gesture failed target.
385
386         * UIProcess/API/Cocoa/WKWebViewInternal.h:
387         * UIProcess/API/Cocoa/WKWebView.mm:
388         (-[WKWebView _initialScaleFactor]):
389         (-[WKWebView _contentZoomScale]):
390         (-[WKWebView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
391             Exposed the initial content scale, the current scale and added a declaration that
392             was missing from the .h.
393
394         * UIProcess/WebPageProxy.messages.in: Add a new message,
395             HandleSmartMagnificationInformationForPotentialTap, to
396             communicate the geometry of the clicked node to the UI Process.
397
398         * UIProcess/PageClient.h: Pure virtual function for the geometry message response.
399         * UIProcess/WebPageProxy.h: Ditto.
400
401         * UIProcess/ios/PageClientImplIOS.h: Calls into the WKContentView.
402         * UIProcess/ios/PageClientImplIOS.mm:
403         (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
404
405         * UIProcess/ios/SmartMagnificationController.h:
406         * UIProcess/ios/SmartMagnificationController.mm:
407         (WebKit::SmartMagnificationController::calculatePotentialZoomParameters): A new method that
408             asks the WKContentView to work out what the zoom factor will be for a potential double
409             tap at a location.
410         (WebKit::SmartMagnificationController::smartMagnificationTargetRectAndZoomScales): New implementation
411             of this function to avoid multiple out-arguments.
412
413         * UIProcess/ios/WKContentView.h:
414         * UIProcess/ios/WKContentView.mm:
415         (-[WKContentView _initialScaleFactor]):
416         (-[WKContentView _contentZoomScale]):
417         (-[WKContentView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
418             Exposed the initial content scale, the current scale and the target zoom scale. These
419             all just call into the WKWebView implementation.
420
421         * UIProcess/ios/WKContentViewInteraction.h:
422         * UIProcess/ios/WKContentViewInteraction.mm:
423         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]): Use a WKSyntheticTapGestureRecognizer instead
424             of a generic one, so we can capture the failure.
425         (-[WKContentView setupInteraction]):
426         (-[WKContentView cleanupInteraction]):
427         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:origin:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
428             New method that responds to the incoming Web Process message, and decides if any
429             potential zoom would be "significant".
430         (-[WKContentView _singleTapIdentified:]):
431         (-[WKContentView _doubleTapDidFail:]):
432         (-[WKContentView _didCompleteSyntheticClick]):
433         (-[WKContentView _singleTapRecognized:]):
434         (-[WKContentView _doubleTapRecognized:]):
435             Add some release logging.
436         (-[WKContentView _singleTapCommited:]): Deleted.
437
438         * UIProcess/ios/WebPageProxyIOS.mm:
439         (WebKit::WebPageProxy::potentialTapAtPosition):
440         (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
441         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
442         * WebProcess/WebPage/WebPage.h:
443         * WebProcess/WebPage/WebPage.messages.in:
444             Removed an unused parameter from the existing message.
445
446         * WebProcess/WebPage/ios/WebPageIOS.mm:
447         (WebKit::WebPage::potentialTapAtPosition): Calculates the geometry of the element
448         if requested, and sends it to the UIProcess.
449
450 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
451
452         Unreviewed build fix after r242745.
453
454         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
455         (WebKit::WebProcessPool::registerNotificationObservers):
456         (WebKit::WebProcessPool::unregisterNotificationObservers):
457
458 2019-03-11  Chris Dumez  <cdumez@apple.com>
459
460         Assert in WebPageProxy::suspendCurrentPageIfPossible()
461         https://bugs.webkit.org/show_bug.cgi?id=195506
462         <rdar://problem/48733477>
463
464         Reviewed by Alex Christensen.
465
466         The crash was caused by the top-hit preloading logic in MobileSafari which creates a new Web view that is *related*
467         to the previous one, restores the session state onto it and then triggers a load in this new Web view.
468
469         Initially, the 2 Web views use the same process as they are related. However, if the new load's URL is cross-site
470         with regards to the first view's URL, then we decide to process swap in the new view. This process swap makes
471         sense from a security standpoint. However, when we commit the load in the new process and call
472         suspendCurrentPageIfPossible() we end up in an unexpected state because we have a fromItem (due to the session
473         state having been restored on the new view) but we haven't committed any load yet in this new view.
474
475         To address the issue, suspendCurrentPageIfPossible() now returns early and does not attempt to suspend anything
476         if we have not committed any load yet.
477
478         * UIProcess/WebPageProxy.cpp:
479         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
480         Do not attempt to suspend to current page if we have not committed any provisional load yet.
481
482 2019-03-11  Chris Dumez  <cdumez@apple.com>
483
484         Update device orientation & motion permission native SPI as per latest proposal
485         https://bugs.webkit.org/show_bug.cgi?id=195567
486
487         Reviewed by Youenn Fablet.
488
489         The native SPI is now:
490         +- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)frameInfo decisionHandler:(void (^)(BOOL))decisionHandler;
491
492         * UIProcess/API/APIUIClient.h:
493         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
494         * UIProcess/API/C/WKPage.cpp:
495         (WKPageSetPageUIClient):
496         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
497         * UIProcess/Cocoa/UIDelegate.h:
498         * UIProcess/Cocoa/UIDelegate.mm:
499         (WebKit::UIDelegate::setDelegate):
500         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
501         * UIProcess/WebPageProxy.cpp:
502         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
503         * UIProcess/WebPageProxy.h:
504         * UIProcess/WebPageProxy.messages.in:
505         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
506         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
507         * WebProcess/WebCoreSupport/WebChromeClient.h:
508         * WebProcess/WebPage/WebPage.cpp:
509         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
510         * WebProcess/WebPage/WebPage.h:
511
512 2019-03-11  Andy Estes  <aestes@apple.com>
513
514         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
515         https://bugs.webkit.org/show_bug.cgi?id=195530
516         <rdar://problem/48747164>
517
518         Reviewed by Alex Christensen.
519
520         * Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'
521         entitlement and reordered the others.
522
523         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
524         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
525         WebPaymentCoordinatorProxy messages to the payment coordinator.
526         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
527         (WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.
528         * NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from
529         WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.
530
531         * NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle
532         and secondary identifiers, and CTDataConnectionServiceType on iOS.
533         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
534         (WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
535         (WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
536         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
537         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
538         m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
539         corresponding NetworkSessionCreationParameters.
540
541         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.
542         (WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
543         m_paymentCoordinator after lazily initializing it.
544         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
545         connection to the web process.
546         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
547         Returns nil.
548         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
549         Added. Returns the value from the network session identified by sessionID.
550         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
551         Ditto.
552         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
553         Ditto.
554         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
555         Returns a new PaymentAuthorizationController.
556         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
557         definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
558         messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
559         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.
560
561         * Platform/ios/PaymentAuthorizationController.h: Added. Declares a
562         PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.
563         * Platform/ios/PaymentAuthorizationController.mm: Added.
564         (-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
565         Initialized WKPaymentAuthorizationDelegate with request and presenter.
566         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
567         Forwarded call to WKPaymentAuthorizationDelegate.
568         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
569         Ditto.
570         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
571         Ditto.
572         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
573         Ditto.
574         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
575         Ditto.
576         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
577         Ditto.
578         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
579         Ditto.
580         (WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
581         Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
582         new WKPaymentAuthorizationControllerDelegate.
583         (WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
584         (WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
585         delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
586         nil.
587         (WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
588         controller, forwarding the passed-in completion handler.
589         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up
590         the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.
591
592         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
593         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
594         paymentCoordinatorAddMessageReceiver.
595         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
596         paymentCoordinatorRemoveMessageReceiver.
597         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
598         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
599         platformCanMakePaymentsWithActiveCard.
600         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
601         sessionID to platformShowPaymentUI.
602         (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
603         behavior of didCancelPaymentSession.
604         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
605         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
606         when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
607         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.
608         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
609         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed
610         CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
611         arguments.
612
613         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
614         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
615         sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
616         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
617         m_client call sites.
618
619         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
620         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
621         platformPaymentRequest.
622         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
623         before calling dismiss.
624
625         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
626         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
627         platformPaymentRequest.
628         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
629         before calling dismiss.
630
631         * Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
632
633         * SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and
634         PaymentAuthorizationController.mm.
635
636         * UIProcess/AuxiliaryProcessProxy.h:
637         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.
638
639         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
640         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
641         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
642         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
643         (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
644         (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.
645
646         * UIProcess/WebPageProxy.cpp:
647         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
648         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
649         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
650         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
651         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
652         * UIProcess/WebPageProxy.h:
653
654         * UIProcess/ios/WebPageProxyIOS.mm:
655         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
656         sessionID equals the website data store's sessionID.
657
658         * WebKit.xcodeproj/project.pbxproj:
659
660         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
661         (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
662         session if Apple Pay Remote UI is enabled and the network process connection closes.
663         (WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
664         WebPaymentCoordinator being an IPC::MessageSender.
665         (WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
666         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard): Ditto.
667         (WebKit::WebPaymentCoordinator::openPaymentSetup): Ditto.
668         (WebKit::WebPaymentCoordinator::showPaymentUI): Ditto.
669         (WebKit::WebPaymentCoordinator::completeMerchantValidation): Ditto.
670         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection): Ditto.
671         (WebKit::WebPaymentCoordinator::completeShippingContactSelection): Ditto.
672         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection): Ditto.
673         (WebKit::WebPaymentCoordinator::completePaymentSession): Ditto.
674         (WebKit::WebPaymentCoordinator::abortPaymentSession): Ditto.
675         (WebKit::WebPaymentCoordinator::cancelPaymentSession): Ditto.
676         (WebKit::WebPaymentCoordinator::messageSenderConnection const): Added. Returns a connection
677         to the network process if Apple Pay Remote UI is enabled. Otherwise, returned the web
678         process's parent connection.
679         (WebKit::WebPaymentCoordinator::messageSenderDestinationID const): Added. Returns the web
680         page's ID.
681         (WebKit::WebPaymentCoordinator::remoteUIEnabled const): Added. Calls Settings::applePayRemoteUIEnabled.
682         * WebProcess/ApplePay/WebPaymentCoordinator.h: Inherited from IPC::MessageSender.
683
684         * WebProcess/Network/NetworkProcessConnection.cpp:
685         (WebKit::NetworkProcessConnection::didReceiveMessage): Forwarded WebPaymentCoordinator
686         messages to the payment coordinator of the web page matching the decoder's destination ID.
687         (WebKit::NetworkProcessConnection::didReceiveSyncMessage): Ditto for sync messages.
688
689         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
690         (WebKit::WebPage::paymentCoordinator): Added a payment coordinator getter.
691         * WebProcess/WebPage/WebPage.h: Ditto.
692
693         * WebProcess/WebProcess.cpp:
694         (WebKit::WebProcess::networkProcessConnectionClosed): Called
695         WebPaymentCoordinator::networkProcessConnectionClosed when the network process connection
696         closes.
697
698 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
699
700         [iOS] Block access to backboardd service
701         https://bugs.webkit.org/show_bug.cgi?id=195484
702
703         Reviewed by Brent Fulgham.
704
705         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
706         backlight level in the WebContent process will initiate a connection with this service. To be able to
707         block the service, the backlight level is queried in the UI process and sent to the WebContent process
708         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
709         the method getting the backlight level is swizzled to return the value sent from the UI process.
710
711         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
712         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
713         (WebKit::WebProcessPool::displayBrightness):
714         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
715         (WebKit::WebProcessPool::registerNotificationObservers):
716         (WebKit::WebProcessPool::unregisterNotificationObservers):
717         * UIProcess/WebProcessPool.cpp:
718         (WebKit::WebProcessPool::initializeNewWebProcess):
719         * UIProcess/WebProcessPool.h:
720         * WebProcess/WebProcess.h:
721         * WebProcess/WebProcess.messages.in:
722         * WebProcess/cocoa/WebProcessCocoa.mm:
723         (WebKit::currentBacklightLevel):
724         (WebKit::WebProcess::backlightLevelDidChange):
725
726 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
727
728         Remove obsolete runtime flag for StorageAccess API Prompt
729         https://bugs.webkit.org/show_bug.cgi?id=195564
730         <rdar://problem/37279014>
731
732         Reviewed by Chris Dumez.
733
734         This bug tracks the work of removing the obsolete flag that had been used to optionally
735         prevent display of the StorageAccess API prompt. We have since shipped the final version
736         of this feature with an always-on prompt, and should have removed this runtime flag.
737
738         No test changes because this has no change in behavior. Tests already assume the prompt
739         behavior, and did not test turning the flag off.
740
741         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
742         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
743         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
744         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
745         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
746         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
747         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
748         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
749         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
750         (WebKit::ResourceLoadStatisticsStore::debugModeEnabled const):
751         (WebKit::ResourceLoadStatisticsStore::storageAccessPromptsEnabled const): Deleted.
752         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled): Deleted.
753         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
754         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
755         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
756         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
757         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
758         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
759         * NetworkProcess/NetworkConnectionToWebProcess.h:
760         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
761         * NetworkProcess/NetworkProcess.cpp:
762         (WebKit::NetworkProcess::requestStorageAccess):
763         (WebKit::NetworkProcess::requestStorageAccessGranted):
764         * NetworkProcess/NetworkProcess.h:
765         * NetworkProcess/NetworkProcess.messages.in:
766         * Shared/WebPreferences.yaml:
767         * UIProcess/API/C/WKPreferences.cpp:
768         (WKPreferencesSetStorageAccessPromptsEnabled): Deleted.
769         (WKPreferencesGetStorageAccessPromptsEnabled): Deleted.
770         * UIProcess/API/C/WKPreferencesRef.h:
771         * UIProcess/API/Cocoa/WKPreferences.mm:
772         (-[WKPreferences _storageAccessPromptsEnabled]): Deleted.
773         (-[WKPreferences _setStorageAccessPromptsEnabled:]): Deleted.
774         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
775         * UIProcess/Network/NetworkProcessProxy.cpp:
776         (WebKit::NetworkProcessProxy::requestStorageAccess):
777         * UIProcess/Network/NetworkProcessProxy.h:
778         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
779         (WebKit::WebsiteDataStore::requestStorageAccess):
780         * UIProcess/WebsiteData/WebsiteDataStore.h:
781         * WebProcess/WebPage/WebPage.cpp:
782         (WebKit::WebPage::requestStorageAccess):
783
784 2019-03-11  Alex Christensen  <achristensen@webkit.org>
785
786         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
787         https://bugs.webkit.org/show_bug.cgi?id=195511
788         <rdar://problem/44873269>
789
790         Reviewed by Darin Adler.
791
792         * NetworkProcess/NetworkContentRuleListManager.cpp:
793         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
794         * NetworkProcess/NetworkContentRuleListManager.h:
795         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
796         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
797         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
798         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
799         * NetworkProcess/cache/NetworkCacheFileSystem.h:
800         * Shared/WebCompiledContentRuleList.cpp:
801         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
802         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
803         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
804         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
805         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
806         (WebKit::WebCompiledContentRuleList::actions const):
807         * Shared/WebCompiledContentRuleList.h:
808         * Shared/WebCompiledContentRuleListData.cpp:
809         (WebKit::WebCompiledContentRuleListData::size const):
810         (WebKit::WebCompiledContentRuleListData::dataPointer const):
811         (WebKit::WebCompiledContentRuleListData::encode const):
812         (WebKit::WebCompiledContentRuleListData::decode):
813         * Shared/WebCompiledContentRuleListData.h:
814         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
815         * UIProcess/API/APIContentRuleList.cpp:
816         (API::ContentRuleList::usesCopiedMemory const):
817         * UIProcess/API/APIContentRuleList.h:
818         * UIProcess/API/APIContentRuleListStore.cpp:
819         (API::getData):
820         (API::decodeContentRuleListMetaData):
821         (API::ContentRuleListStore::readContentsOfFile):
822         (API::MappedOrCopiedData::dataPointer const):
823         (API::openAndMapOrCopyContentRuleList):
824         (API::compiledToFile):
825         (API::createExtension):
826         (API::ContentRuleListStore::lookupContentRuleList):
827         (API::ContentRuleListStore::compileContentRuleList):
828         (API::ContentRuleListStore::getContentRuleListSource):
829         (API::openAndMapContentRuleList): Deleted.
830         * UIProcess/API/APIContentRuleListStore.h:
831         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
832         (API::ContentRuleListStore::readContentsOfFile):
833         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
834         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
835         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
836         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
837         (-[_WKUserContentFilter usesCopiedMemory]):
838         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
839         * WebProcess/UserContent/WebUserContentController.cpp:
840         (WebKit::WebUserContentController::addContentRuleLists):
841         * WebProcess/UserContent/WebUserContentController.h:
842         * WebProcess/WebPage/WebPage.cpp:
843         (WebKit::m_hostFileDescriptor):
844
845 2019-03-11  Chris Dumez  <cdumez@apple.com>
846
847         Unreviewed, fix assertions in layout tests on iOS Simulator after r242666.
848
849         Log an error but do not crash if we fail to acquire a ProcessAssertion.
850
851         * UIProcess/ios/ProcessAssertionIOS.mm:
852         (WebKit::ProcessAssertion::ProcessAssertion):
853
854 2019-03-11  Chris Dumez  <cdumez@apple.com>
855
856         WebProcessCache should keep track of processes being added
857         https://bugs.webkit.org/show_bug.cgi?id=195538
858
859         Reviewed by Geoffrey Garen.
860
861         WebProcessCache should keep track of processes being added, while they are being
862         checked for responsiveness. This is useful so that:
863         - Requests to clear the cache also clear processes being added
864         - Requests to remove a given process from the cache (either because it crashed
865           or because it is being used for a history navigation) actually remove the
866           process if it is still being checked for responsiveness.
867         - The cached process eviction timer applies to such processes in case something
868           goes wrong with the code and the pending request does not get processed.
869
870         * UIProcess/WebProcessCache.cpp:
871         (WebKit::generateAddRequestIdentifier):
872         (WebKit::WebProcessCache::addProcessIfPossible):
873         (WebKit::WebProcessCache::addProcess):
874         (WebKit::WebProcessCache::clear):
875         (WebKit::WebProcessCache::clearAllProcessesForSession):
876         (WebKit::WebProcessCache::removeProcess):
877         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
878         (WebKit::WebProcessCache::evictProcess): Deleted.
879         * UIProcess/WebProcessCache.h:
880         (WebKit::WebProcessCache::size const):
881         * UIProcess/WebProcessPool.cpp:
882         (WebKit::WebProcessPool::processForNavigationInternal):
883         * UIProcess/WebProcessProxy.cpp:
884         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
885
886 2019-03-11  Alex Christensen  <achristensen@webkit.org>
887
888         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
889         https://bugs.webkit.org/show_bug.cgi?id=194523
890
891         Reviewed by Alexey Proskuryakov.
892
893         Attempt another workaround to prevent crashes.
894
895         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
896         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
897         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
898         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
899         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
900
901 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
902
903         Unreviewed, rolling out r242688, r242643, r242624.
904
905         Caused multiple layout test failures and crashes on iOS and macOS.
906
907         Reverted changeset:
908
909         "requestAnimationFrame should execute before the next frame"
910         https://bugs.webkit.org/show_bug.cgi?id=177484
911         https://trac.webkit.org/changeset/242624/webkit
912
913         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
914         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
915         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
916         (WebKit::DrawingAreaCoordinatedGraphics::display):
917         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
918         (WebKit::LayerTreeHost::layerFlushTimerFired):
919         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
920         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
921         * WebProcess/WebPage/WebPage.cpp:
922         (WebKit::WebPage::layoutIfNeeded):
923         (WebKit::WebPage::willDisplayPage):
924         (WebKit::WebPage::renderingUpdate): Deleted.
925         * WebProcess/WebPage/WebPage.h:
926         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
927         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
928
929 2019-03-11  Darin Adler  <darin@apple.com>
930
931         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
932         https://bugs.webkit.org/show_bug.cgi?id=195533
933
934         Reviewed by Brent Fulgham.
935
936         * NetworkProcess/cache/NetworkCache.cpp:
937         (WebKit::NetworkCache::Cache::dumpContentsToFile): Use appendFixedPrecisionNumber.
938         * NetworkProcess/cache/NetworkCacheEntry.cpp:
939         (WebKit::NetworkCache::Entry::asJSON const): Ditto.
940         * Shared/Gamepad/GamepadData.cpp:
941         (WebKit::GamepadData::loggingString const): Ditto.
942         * UIProcess/WebPageProxy.cpp:
943         (WebKit::WebPageProxy::logDiagnosticMessageWithValue): Use numberToStringFixedPrecision.
944
945 2019-03-11  John Wilander  <wilander@apple.com>
946
947         Resource Load Statistics: Make it possible exclude localhost from classification
948         https://bugs.webkit.org/show_bug.cgi?id=195474
949         <rdar://problem/47520577>
950
951         Reviewed by Brent Fulgham.
952
953         This patch allows for localhost to be excluded from classification and
954         treatment as a prevalent resource.
955
956         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
957         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
958         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
959             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
960         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
961             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
962         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
963             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
964         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
965             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
966         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
967             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
968         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
969         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
970         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
971         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
972             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
973         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
974             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
975         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
976             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
977         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
978             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
979         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
980             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
981         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
982         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
983         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
984             Now takes a ShouldIncludeLocalhost parameter.
985         (WebKit::ResourceLoadStatisticsStore::shouldSkip const):
986             Convenience function, currently supporting the localhost exclusion.
987         (WebKit::ResourceLoadStatisticsStore::setIsRunningTest):
988             Test infrastructure.
989         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
990         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
991         (WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
992             Test infrastructure.
993         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
994             Now takes a ShouldIncludeLocalhost parameter.
995         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
996             Defines the new ShouldIncludeLocalhost boolean enum.
997         * NetworkProcess/NetworkProcess.cpp:
998         (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
999             Test infrastructure.
1000         * NetworkProcess/NetworkProcess.h:
1001         * NetworkProcess/NetworkProcess.messages.in:
1002         * NetworkProcess/NetworkSession.cpp:
1003         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
1004             Forwards the localhost setting to the create function.
1005         * NetworkProcess/NetworkSession.h:
1006         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1007         (WebKit::NetworkSessionCreationParameters::encode const):
1008         (WebKit::NetworkSessionCreationParameters::decode):
1009         * NetworkProcess/NetworkSessionCreationParameters.h:
1010             New parameter called shouldIncludeLocalhostInResourceLoadStatistics.
1011         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1012         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1013             Picks up the localhost setting from the parameters.
1014         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1015         (WKWebsiteDataStoreSetStatisticsIsRunningTest):
1016             Test infrastructure.
1017         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1018         * UIProcess/Network/NetworkProcessProxy.cpp:
1019         (WebKit::NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest):
1020             Test infrastructure.
1021         * UIProcess/Network/NetworkProcessProxy.h:
1022         * UIProcess/WebProcessPool.cpp:
1023         (WebKit::WebProcessPool::ensureNetworkProcess):
1024             Picks up the localhost setting from the WebsiteDataStore parameters.
1025         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1026         (WebKit::WebsiteDataStore::parameters):
1027             Makes sure Safari does not exclude localhost.
1028         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1029         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
1030             Test infrastructure.
1031         * UIProcess/WebsiteData/WebsiteDataStore.h:
1032
1033 2019-03-11  Alex Christensen  <achristensen@webkit.org>
1034
1035         Unreviewed, rolling out r242698.
1036
1037         API test crashes on bots.
1038
1039         Reverted changeset:
1040
1041         "Add a WKContentRuleList variant that uses copied memory
1042         instead of mmap'd shared memory for class A containerized
1043         apps"
1044         https://bugs.webkit.org/show_bug.cgi?id=195511
1045         https://trac.webkit.org/changeset/242698
1046
1047 2019-03-11  Michael Catanzaro  <mcatanzaro@igalia.com>
1048
1049         [WPE] Enable web process sandbox
1050         https://bugs.webkit.org/show_bug.cgi?id=195169
1051
1052         Reviewed by Daniel Bates.
1053
1054         * PlatformWPE.cmake:
1055         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1056         (WebKit::bubblewrapSpawn):
1057
1058 2019-03-11  Truitt Savell  <tsavell@apple.com>
1059
1060         Unreviewed, rolling out r242697.
1061
1062         Broke internal builders.
1063
1064         Reverted changeset:
1065
1066         "Optimizing loads when creating new pages"
1067         https://bugs.webkit.org/show_bug.cgi?id=195516
1068         https://trac.webkit.org/changeset/242697
1069
1070 2019-03-10  Alex Christensen  <achristensen@webkit.org>
1071
1072         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
1073         https://bugs.webkit.org/show_bug.cgi?id=195511
1074         <rdar://problem/44873269>
1075
1076         Reviewed by Darin Adler.
1077
1078         * NetworkProcess/NetworkContentRuleListManager.cpp:
1079         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
1080         * NetworkProcess/NetworkContentRuleListManager.h:
1081         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1082         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
1083         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
1084         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
1085         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1086         * Shared/WebCompiledContentRuleList.cpp:
1087         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
1088         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
1089         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
1090         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
1091         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
1092         (WebKit::WebCompiledContentRuleList::actions const):
1093         * Shared/WebCompiledContentRuleList.h:
1094         * Shared/WebCompiledContentRuleListData.cpp:
1095         (WebKit::WebCompiledContentRuleListData::size const):
1096         (WebKit::WebCompiledContentRuleListData::dataPointer const):
1097         (WebKit::WebCompiledContentRuleListData::encode const):
1098         (WebKit::WebCompiledContentRuleListData::decode):
1099         * Shared/WebCompiledContentRuleListData.h:
1100         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
1101         * UIProcess/API/APIContentRuleList.cpp:
1102         (API::ContentRuleList::usesCopiedMemory const):
1103         * UIProcess/API/APIContentRuleList.h:
1104         * UIProcess/API/APIContentRuleListStore.cpp:
1105         (API::getData):
1106         (API::decodeContentRuleListMetaData):
1107         (API::ContentRuleListStore::readContentsOfFile):
1108         (API::MappedOrCopiedData::dataPointer const):
1109         (API::openAndMapOrCopyContentRuleList):
1110         (API::compiledToFile):
1111         (API::createExtension):
1112         (API::ContentRuleListStore::lookupContentRuleList):
1113         (API::ContentRuleListStore::compileContentRuleList):
1114         (API::ContentRuleListStore::getContentRuleListSource):
1115         (API::openAndMapContentRuleList): Deleted.
1116         * UIProcess/API/APIContentRuleListStore.h:
1117         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
1118         (API::ContentRuleListStore::readContentsOfFile):
1119         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
1120         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
1121         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
1122         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
1123         (-[_WKUserContentFilter usesCopiedMemory]):
1124         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
1125         * WebProcess/UserContent/WebUserContentController.cpp:
1126         (WebKit::WebUserContentController::addContentRuleLists):
1127         * WebProcess/UserContent/WebUserContentController.h:
1128         * WebProcess/WebPage/WebPage.cpp:
1129         (WebKit::m_hostFileDescriptor):
1130
1131 2019-03-10  Jiewen Tan  <jiewen_tan@apple.com>
1132
1133         Optimizing loads when creating new pages
1134         https://bugs.webkit.org/show_bug.cgi?id=195516
1135         <rdar://problem/48738086>
1136
1137         Reviewed by Darin Adler.
1138
1139         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
1140         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
1141         API::NavigationAction to the load optimizer instead of the request within.
1142
1143         * UIProcess/API/APINavigationAction.h:
1144         * UIProcess/API/APIUIClient.h:
1145         (API::UIClient::createNewPage):
1146         * UIProcess/API/C/WKPage.cpp:
1147         (WKPageSetPageUIClient):
1148         * UIProcess/API/glib/WebKitUIClient.cpp:
1149         * UIProcess/Cocoa/NavigationState.mm:
1150         (WebKit::tryOptimizingLoad):
1151         (WebKit::tryInterceptNavigation):
1152         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1153         * UIProcess/Cocoa/UIDelegate.h:
1154         * UIProcess/Cocoa/UIDelegate.mm:
1155         (WebKit::UIDelegate::UIClient::createNewPage):
1156         * UIProcess/WebPageProxy.cpp:
1157         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1158         (WebKit::tryOptimizingLoad):
1159         (WebKit::WebPageProxy::createNewPage):
1160         * UIProcess/WebPageProxy.h:
1161
1162 2019-03-10  Tim Horton  <timothy_horton@apple.com>
1163
1164         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
1165         https://bugs.webkit.org/show_bug.cgi?id=195499
1166
1167         Reviewed by Darin Adler.
1168
1169         * Scripts/webkit/messages.py:
1170         * Shared/TextInputContext.cpp: Added.
1171         (IPC::ArgumentCoder<WebKit::TextInputContext>::encode):
1172         (IPC::ArgumentCoder<WebKit::TextInputContext>::decode):
1173         * Shared/TextInputContext.h: Added.
1174         (WebKit::TextInputContext::operator== const):
1175         Add TextInputContext, which represents a minimal set of information
1176         about a text field.
1177
1178         * Sources.txt:
1179         * SourcesCocoa.txt:
1180         * UIProcess/API/Cocoa/WKWebView.mm:
1181         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
1182         (-[WKWebView _focusTextInputContext:completionHandler:]):
1183         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1184         Add SPI that allows clients to asynchronously request text input
1185         contexts for a given rect, and later focus a given context.
1186
1187         * UIProcess/API/Cocoa/_WKTextInputContext.h: Added.
1188         * UIProcess/API/Cocoa/_WKTextInputContext.mm: Added.
1189         (-[_WKTextInputContext _initWithTextInputContext:]):
1190         (-[_WKTextInputContext boundingRect]):
1191         (-[_WKTextInputContext _textInputContext]):
1192         (-[_WKTextInputContext isEqual:]):
1193         (-[_WKTextInputContext hash]):
1194         (-[_WKTextInputContext copyWithZone:]):
1195         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h: Added.
1196         Add an SPI object that exposes a read-only window on a TextInputContext to clients.
1197
1198         * UIProcess/WebPageProxy.cpp:
1199         (WebKit::WebPageProxy::textInputContextsInRect):
1200         (WebKit::WebPageProxy::focusTextInputContext):
1201         * UIProcess/WebPageProxy.h:
1202         Plumbing from WKWebView<->WebPage.
1203
1204         * WebKit.xcodeproj/project.pbxproj:
1205         * WebProcess/WebPage/WebPage.cpp:
1206         (WebKit::elementRectInWindowCoordinates):
1207         (WebKit::isEditableTextInputElement):
1208         (WebKit::WebPage::textInputContextsInRect):
1209         Search the DOM for text input contexts: <input type='text'> (or other
1210         form fields that fall back on text field behavior), <textarea>, and
1211         contenteditable roots. Store the WebPage, Document, and Element identifiers
1212         so that we can find the element again later.
1213
1214         (WebKit::WebPage::focusTextInputContext):
1215         Find the element for a given (web page, document, element) triple and focus it,
1216         if it's still available.
1217
1218         * WebProcess/WebPage/WebPage.h:
1219         * WebProcess/WebPage/WebPage.messages.in:
1220
1221 2019-03-10  Tim Horton  <timothy_horton@apple.com>
1222
1223         iOS: Using ⌥ to scroll horizontally is no different than arrow key
1224         https://bugs.webkit.org/show_bug.cgi?id=195268
1225         <rdar://problem/48326682>
1226
1227         Reviewed by Brent Fulgham.
1228
1229         * UIProcess/ios/WKContentViewInteraction.mm:
1230         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
1231         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted.
1232         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
1233         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1234         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
1235         (-[WKKeyboardScrollViewAnimator setDelegate:]):
1236         (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
1237         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]): Deleted.
1238         Add a direction parameter to -distanceForIncrement:, so the client
1239         can return a different page/document size based on the scrolling axis.
1240         Adopt it both in the default implementation and in WKContentViewInteraction.
1241         Make the option key scroll by page when scrolling horizontally, like it
1242         does when scrolling vertically.
1243
1244 2019-03-10  David Quesada  <david_quesada@apple.com>
1245
1246         ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
1247         https://bugs.webkit.org/show_bug.cgi?id=152480
1248
1249         Reviewed by Chris Dumez.
1250
1251         * UIProcess/Downloads/DownloadProxyMap.cpp:
1252         (WebKit::DownloadProxyMap::downloadFinished):
1253             If the DownloadProxy is holding the last reference to the process pool, then
1254             invalidating the proxy will cause the process pool, the network process proxy,
1255             and this DownloadProxyMap to deallocate. Ensure that doesn't happen until this
1256             method has done everything it wants to do to clean up.
1257
1258 2019-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1259
1260         Fix some misleading function and variable names in WKContentViewInteraction.mm
1261         https://bugs.webkit.org/show_bug.cgi?id=195536
1262
1263         Reviewed by Tim Horton.
1264
1265         * UIProcess/ios/WKContentViewInteraction.mm:
1266         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement):
1267
1268         Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
1269         function is used to determine whether we should zoom to the selection rect when revealing the focused element,
1270         and therefore affects whether we need to defer zooming until we get selection information.
1271
1272         (rectToRevealWhenZoomingToFocusedElement):
1273         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1274
1275         Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
1276         keyboard, but other UI for user input such as date and select pickers.
1277
1278         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
1279         (shouldZoomToRevealSelectionRect): Deleted.
1280
1281 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
1282
1283         ScrollingTree should have the final say on where layers go
1284         https://bugs.webkit.org/show_bug.cgi?id=195507
1285
1286         Reviewed by Antti Koivisto.
1287
1288         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1289         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1290         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1291         (WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions):
1292         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1293         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1294         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1295
1296 2019-03-09  Darin Adler  <darin@apple.com>
1297
1298         [Cocoa] Code signing fails because services are copied into XPCServices after the framework is signed
1299         https://bugs.webkit.org/show_bug.cgi?id=195523
1300
1301         Reviewed by Dan Bernstein.
1302
1303         * WebKit.xcodeproj/project.pbxproj: Make symbolic links while building the WebKit
1304         framework instead of copying in the services after the framework is built.
1305
1306 2019-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1307
1308         REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
1309         https://bugs.webkit.org/show_bug.cgi?id=195475
1310         <rdar://problem/48721153>
1311
1312         Reviewed by Chris Dumez.
1313
1314         r242551 refactored synchronous autocorrection context requests to send an async IPC message and then use
1315         waitForAndDispatchImmediately, instead of calling sendSync. However, this exposes a couple of existing issues in
1316         the implementation of waitForAndDispatchImmediately that causes sporadic IPC deadlocks when changing selection.
1317
1318         First, passing in InterruptWaitingIfSyncMessageArrives when synchronously waiting for an IPC message currently
1319         does not fulfill its intended behavior of interrupting waiting when a sync message arrives. This is because sync
1320         IPC messages, by default, may be dispatched while the receiver is waiting for a sync reply. This means that the
1321         logic in Connection::SyncMessageState::processIncomingMessage to dispatch an incoming sync message on the main
1322         thread will attempt to handle the incoming message by enqueueing it on the main thread, and then waking up the
1323         client runloop (i.e. signaling m_waitForSyncReplySemaphore). This works in the case of sendSync since the sync
1324         reply semaphore is used to block the main thread, but in the case of waitForAndDispatchImmediately, a different
1325         m_waitForMessageCondition is used instead, so SyncMessageState::processIncomingMessage will only enqueue the
1326         incoming sync message on the main thread, and not actually invoke it.
1327
1328         To fix this first issue, observe that there is pre-existing logic to enqueue the incoming message and signal
1329         m_waitForMessageCondition in Connection::processIncomingMessage. This codepath is currently not taken because we
1330         end up bailing early in the call to SyncMessageState::processIncomingMessage. Instead, we can move this early
1331         return further down in the function, such that if there is an incoming sync message and we're waiting with the
1332         InterruptWaitingIfSyncMessageArrives option, we will correctly enqueue the incoming message, wake the runloop,
1333         and proceed to handle the incoming message.
1334
1335         The second issue is more subtle; consider the scenario in which we send a sync message A from the web process to
1336         the UI process, and simultaneously, in the UI process, we schedule some work to be done on the main thread.
1337         Let's additionally suppose that this scheduled work will send an IPC message B to the web process and
1338         synchronously wait for a reply (in the case of this particular bug, this is the sync autocorrection context
1339         request). What happens upon receiving sync message A is that the IPC thread in the UI process will schedule A on
1340         the main thread; however, before the scheduled response to A is invoked, we will first invoke previously
1341         scheduled work that attempts to block synchronously until a message B is received. In summary:
1342
1343         1. (Web process)    sends sync IPC message A to UI process.
1344         2. (UI process)     schedules some main runloop task that will block synchronously on IPC message B.
1345         3. (UI process)     receives sync IPC message A and schedules A on the main runloop.
1346         4. (UI process)     carry out the task scheduled in (2) and block on B.
1347
1348         ...and then, the UI process and web process are now deadlocked because the UI process is waiting for B to
1349         arrive, but the web process can't send B because it's waiting for a reply for IPC message A! To fix this second
1350         deadlock, we first make an important observation: when using sendSync, we don't run into this problem because
1351         immediately before sending sync IPC, we will attempt to handle any incoming sync IPC messages that have been
1352         queued up. However, when calling waitForAndDispatchImmediately, we don't have this extra step, so a deadlock may
1353         occur in the manner described above. To fix this, we make waitForAndDispatchImmediately behave more like
1354         sendSync, by handling all incoming sync messages prior to blocking on an IPC response.
1355
1356         Test: editing/selection/ios/change-selection-by-tapping.html
1357
1358         * Platform/IPC/Connection.cpp:
1359         (IPC::Connection::waitForMessage):
1360         (IPC::Connection::processIncomingMessage):
1361
1362 2019-03-09  Andy Estes  <aestes@apple.com>
1363
1364         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
1365         https://bugs.webkit.org/show_bug.cgi?id=195526
1366         <rdar://problem/48745636>
1367
1368         Reviewed by Chris Dumez.
1369
1370         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
1371         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
1372         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
1373         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
1374         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1375         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1376         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
1377         (WebKit::WebPaymentCoordinator::openPaymentSetup):
1378         (WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
1379         (WebKit::generateOpenPaymentSetupReplyID): Deleted.
1380         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
1381         (WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
1382         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1383         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
1384
1385 2019-03-09  Andy Estes  <aestes@apple.com>
1386
1387         [iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
1388         https://bugs.webkit.org/show_bug.cgi?id=195527
1389
1390         Reviewed by Eric Carlson.
1391
1392         * Configurations/Network-iOS.entitlements:
1393         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1394
1395 2019-03-09  Chris Dumez  <cdumez@apple.com>
1396
1397         Use modern async IPC with reply for device orientation permission
1398         https://bugs.webkit.org/show_bug.cgi?id=195529
1399
1400         Reviewed by Ryosuke Niwa.
1401
1402         * UIProcess/WebPageProxy.cpp:
1403         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
1404         * UIProcess/WebPageProxy.h:
1405         * UIProcess/WebPageProxy.messages.in:
1406         * WebProcess/WebPage/WebPage.cpp:
1407         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
1408         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
1409         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
1410         * WebProcess/WebPage/WebPage.h:
1411         * WebProcess/WebPage/WebPage.messages.in:
1412
1413 2019-03-09  Zalan Bujtas  <zalan@apple.com>
1414
1415         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
1416         https://bugs.webkit.org/show_bug.cgi?id=195510
1417         <rdar://problem/48735695>
1418
1419         Reviewed by Simon Fraser.
1420
1421         * WebProcess/WebPage/ios/WebPageIOS.mm:
1422         (WebKit::WebPage::cancelPotentialTapInFrame):
1423
1424 2019-03-08  Chris Dumez  <cdumez@apple.com>
1425
1426         Enable ProcessAssertions on iOS Simulator
1427         https://bugs.webkit.org/show_bug.cgi?id=195479
1428
1429         Reviewed by Alexey Proskuryakov.
1430
1431         Enable ProcessAssertions on iOS Simulator. We have some layout tests timing out in the
1432         iOS Simulator due to the WebContent process suspending. Turning on ProcessAssertions in
1433         the iOS Simulator seems to make those tests pass.
1434
1435         * UIProcess/ProcessAssertion.cpp:
1436         * UIProcess/ProcessAssertion.h:
1437         * UIProcess/ios/ProcessAssertionIOS.mm:
1438
1439 2019-03-08  Chris Dumez  <cdumez@apple.com>
1440
1441         Add support for Device Orientation / Motion permission API
1442         https://bugs.webkit.org/show_bug.cgi?id=195329
1443         <rdar://problem/47645367>
1444
1445         Reviewed by Geoffrey Garen.
1446
1447         Add support for Device Orientation / Motion permission API:
1448         - https://github.com/w3c/deviceorientation/issues/57
1449
1450         This adds new SPI to WKUIDelegatePrivate, until we can make this API.
1451
1452         * Shared/WebPreferences.yaml:
1453         * UIProcess/API/APIUIClient.h:
1454         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
1455         * UIProcess/API/C/WKPage.cpp:
1456         (WKPageSetPageUIClient):
1457         * UIProcess/API/C/WKPageUIClient.h:
1458         * UIProcess/API/Cocoa/WKUIDelegate.h:
1459         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1460         * UIProcess/Cocoa/UIDelegate.h:
1461         * UIProcess/Cocoa/UIDelegate.mm:
1462         (WebKit::UIDelegate::setDelegate):
1463         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
1464         * UIProcess/WebPageProxy.cpp:
1465         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
1466         * UIProcess/WebPageProxy.h:
1467         * UIProcess/WebPageProxy.messages.in:
1468         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1469         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
1470         * WebProcess/WebCoreSupport/WebChromeClient.h:
1471         * WebProcess/WebPage/WebPage.cpp:
1472         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID):
1473         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
1474         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision):
1475         * WebProcess/WebPage/WebPage.h:
1476         * WebProcess/WebPage/WebPage.messages.in:
1477
1478 2019-03-08  Brady Eidson  <beidson@apple.com>
1479
1480         Have the UIProcess take the UnboundedNetworking assertion when downloads are in progress.
1481         https://bugs.webkit.org/show_bug.cgi?id=195468
1482
1483         Reviewed by Andy Estes.
1484
1485         * UIProcess/Downloads/DownloadProxyMap.cpp:
1486         (WebKit::DownloadProxyMap::DownloadProxyMap):
1487         (WebKit::DownloadProxyMap::createDownloadProxy): If this is the first download, and the process has the entitlement,
1488           take the assertion.
1489         (WebKit::DownloadProxyMap::downloadFinished):
1490         (WebKit::DownloadProxyMap::processDidClose):
1491         * UIProcess/Downloads/DownloadProxyMap.h:
1492
1493 2019-03-08  Chris Dumez  <cdumez@apple.com>
1494
1495         Add assertions to help debug a WebProcessCache crash
1496         https://bugs.webkit.org/show_bug.cgi?id=195469
1497
1498         Reviewed by Brady Eidson.
1499
1500         I suspect the process's registrableDomain in null when evictProcess() gets
1501         called, thus crashing when lookup it up in the HashMap. Confirm this and
1502         how this could happen via assertions.
1503
1504         * UIProcess/WebProcessCache.cpp:
1505         (WebKit::WebProcessCache::evictProcess):
1506         * UIProcess/WebProcessProxy.cpp:
1507         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
1508
1509 2019-03-08  Brady Eidson  <beidson@apple.com>
1510
1511         Rename AssertionState::Download.
1512         https://bugs.webkit.org/show_bug.cgi?id=195465
1513
1514         Reviewed by Andy Estes.
1515
1516         It's (currently) about uploads and downloads.
1517         Let's call it "UnboundedNetworking"
1518
1519         * NetworkProcess/Downloads/DownloadMap.cpp:
1520         (WebKit::DownloadMap::add):
1521
1522         * UIProcess/ProcessAssertion.h:
1523
1524         * UIProcess/WebProcessProxy.cpp:
1525         (WebKit::WebProcessProxy::didSetAssertionState):
1526
1527         * UIProcess/ios/ProcessAssertionIOS.mm:
1528         (WebKit::flagsForState):
1529         (WebKit::reasonForState):
1530
1531 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
1532
1533         [macOS UI-side compositing] Mouse handling can trigger a crash before we have a scrolling tree root
1534         https://bugs.webkit.org/show_bug.cgi?id=195467
1535
1536         Reviewed by Antti Koivisto.
1537         
1538         When launching MiniBrowser with UI-side compositing enabled in a state where the window
1539         appears under the mouse, we can hit RemoteScrollingTree::handleMouseEvent() for a mouseEnter
1540         event before we have a scrolling tree root node, so add a null check.
1541
1542         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1543         (WebKit::RemoteScrollingTree::handleMouseEvent):
1544
1545 2019-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
1546
1547         REGRESSION(r242624): [GTK] New rAF code path assumes AC mode
1548         https://bugs.webkit.org/show_bug.cgi?id=195459
1549
1550         Reviewed by Žan Doberšek.
1551
1552         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1553         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
1554         The refresh monitor now calls scheduleLayerFlush() but when AC
1555         mode is disabled this method does nothing, so setNeedsDisplay()
1556         needs to be called instead.
1557
1558 2019-03-07  Tim Horton  <timothy_horton@apple.com>
1559
1560         Crash under RemoteLayerTreePropertyApplier::applyProperties
1561         https://bugs.webkit.org/show_bug.cgi?id=195448
1562         <rdar://problem/48588226>
1563
1564         Reviewed by Simon Fraser.
1565
1566         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1567         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1568         Under some currently-unknown circumstances, the UI process is receiving
1569         commits referring to layers that it does not know about.
1570         One understood case of this was fixed in r241899, but there seem to be
1571         cases remaining that are not understood.
1572         Also, add a release log so that we can identify any downstream effects.
1573
1574 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1575
1576         [ContentChangeObserver] Introduce fixed duration content observation
1577         https://bugs.webkit.org/show_bug.cgi?id=195295
1578         <rdar://problem/48579913>
1579
1580         Reviewed by Simon Fraser.
1581
1582         * WebProcess/WebPage/ios/WebPageIOS.mm:
1583         (WebKit::WebPage::handleSyntheticClick):
1584         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1585
1586 2019-03-07  Fujii Hironori  <Hironori.Fujii@sony.com>
1587
1588         [WinCairo][WebKit] Nothing is drawn after Web process crashed
1589         https://bugs.webkit.org/show_bug.cgi?id=195399
1590
1591         Reviewed by Alex Christensen.
1592
1593         PageClientImpl::viewSize returned 0x0 size after Web process
1594         crashed. Restored the original implementation using GetClientRect
1595         (Bug 52175).
1596
1597         * UIProcess/win/PageClientImpl.cpp:
1598         (WebKit::PageClientImpl::viewSize):
1599
1600 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
1601
1602         requestAnimationFrame should execute before the next frame
1603         https://bugs.webkit.org/show_bug.cgi?id=177484
1604
1605         Reviewed by Simon Fraser.
1606
1607         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
1608         a single call to Page::renderingUpdate(). This new function implements 
1609         "Update the rendering" step of the HTML Event Loop specification
1610         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
1611
1612         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1613         (WebKit::AcceleratedDrawingArea::updateBackingStoreState):
1614         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1615         (WebKit::LayerTreeHost::layerFlushTimerFired):
1616         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1617         (WebKit::DrawingAreaImpl::display):
1618         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1619         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1620         * WebProcess/WebPage/WebPage.cpp:
1621         (WebKit::WebPage::layoutIfNeeded):
1622         (WebKit::WebPage::renderingUpdate):
1623         (WebKit::WebPage::willDisplayPage): Deleted.
1624         * WebProcess/WebPage/WebPage.h:
1625         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1626         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1627
1628 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1629
1630         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
1631         https://bugs.webkit.org/show_bug.cgi?id=195353
1632         <rdar://problem/48626394>
1633
1634         Reviewed by Simon Fraser.
1635
1636         * Shared/WebPreferences.yaml:
1637         * UIProcess/API/C/WKPreferences.cpp:
1638         (WKPreferencesSetContentChangeObserverEnabled):
1639         (WKPreferencesGetContentChangeObserverEnabled):
1640         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1641         * UIProcess/API/Cocoa/WKPreferences.mm:
1642         (-[WKPreferences _contentChangeObserverEnabled]):
1643         (-[WKPreferences _setContentChangeObserverEnabled:]):
1644         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1645         * WebProcess/WebPage/ios/WebPageIOS.mm:
1646         (WebKit::WebPage::handleSyntheticClick):
1647
1648 2019-03-07  Andy Estes  <aestes@apple.com>
1649
1650         [Apple Pay] Untangle PKPaymentAuthorizationViewController from WebPaymentCoordinatorProxy
1651         https://bugs.webkit.org/show_bug.cgi?id=195349
1652         <rdar://problem/48625510>
1653
1654         Reviewed by Alex Christensen.
1655
1656         Introduced PaymentAuthorizationPresenter and WKPaymentAuthorizationDelegate to encapsulate
1657         PKPaymentAuthorizationViewController and its delegate. Taught WebPaymentCoordinatorProxy to
1658         interact with PaymentAuthorizationPresenter rather than PKPAVC directly.
1659
1660         These changes will allow us to swap out PKPaymentAuthorizationViewController with PKPaymentAuthorizationController in a follow-on patch.
1661
1662         * Platform/cocoa/PaymentAuthorizationPresenter.h: Added. Defined the abstract interface for
1663         payment authorization presenters that use PKPA(V)C.
1664         * Platform/cocoa/PaymentAuthorizationPresenter.mm: Added.
1665         (WebKit::toPKPaymentAuthorizationStatus): Moved from WebPaymentCoordinatorProxyCocoa.mm.
1666         (WebKit::toPKPaymentErrorCode): Ditto.
1667         (WebKit::toNSError): Ditto.
1668         (WebKit::toNSErrors): Ditto.
1669         (WebKit::toPKShippingMethods): Ditto.
1670         (WebKit::PaymentAuthorizationPresenter::completeMerchantValidation): Added. Implements the
1671         logic previously in WebPaymentCoordinatorProxy::platformCompleteMerchantValidation.
1672         (WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection): Ditto for
1673         WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection.
1674         (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Ditto for 
1675         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto for
1676         WebPaymentCoordinatorProxy::platformCompletePaymentSession.
1677         (WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection): Ditto for
1678         WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection.
1679         * Platform/cocoa/PaymentAuthorizationViewController.h: Added. Defined a subclass of PaymentAuthorizationPresenter for PKPaymentAuthorizationViewController.
1680         * Platform/cocoa/PaymentAuthorizationViewController.mm: Added.
1681         (-[WKPaymentAuthorizationViewControllerDelegate initWithPresenter:]): Added a PKPAVC
1682         delegate that's a subclass of WKPaymentAuthorizationDelegate.
1683         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
1684         Called -[WKPaymentAuthorizationDelegate _didFinish].
1685         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Called
1686         -[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:].
1687         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Called
1688         -[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:].
1689         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Called
1690         -[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:].
1691         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Called
1692         -[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:].
1693         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]):
1694         Called -[WKPaymentAuthorizationDelegate _willFinishWithError:].
1695         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Called
1696         -[WKPaymentAuthorizationDelegate _didRequestMerchantSession:].
1697         * Platform/cocoa/WKPaymentAuthorizationDelegate.h: Added.
1698         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Added.
1699         (-[WKPaymentAuthorizationDelegate summaryItems]): Added a summaryItems getter.
1700         (-[WKPaymentAuthorizationDelegate shippingMethods]): Ditto for shippingMethods.
1701         (-[WKPaymentAuthorizationDelegate completeMerchantValidation:error:]): Called
1702         _didRequestMerchantSessionCompletion then set it to nil.
1703         (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): Ditto for
1704         _didSelectPaymentMethodCompletion.
1705         (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Ditto
1706         for _didAuthorizePaymentCompletion.
1707         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]):
1708         Ditto for _didSelectShippingContactCompletion.
1709         (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): Ditto for
1710         _didSelectShippingMethodCompletion.
1711         (-[WKPaymentAuthorizationDelegate invalidate]): If there's an outstanding authorization
1712         callback, called -completePaymentSession:errors:didReachFinalState: with a state of
1713         PKPaymentAuthorizationStatusFailure.
1714         (-[WKPaymentAuthorizationDelegate _initWithPresenter:]):
1715         (-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Added. Implements the
1716         logic previously in WKPaymentAuthorizationViewControllerDelegate.
1717         (-[WKPaymentAuthorizationDelegate _didFinish]): Ditto.
1718         (-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:]): Ditto.
1719         (-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:]): Ditto.
1720         (-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:]): Ditto.
1721         (toShippingMethod): Moved from WebPaymentCoordinatorProxyCocoa.mm.
1722         (-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:]): Added. Implements
1723         the logic previously in WKPaymentAuthorizationViewControllerDelegate.
1724         (-[WKPaymentAuthorizationDelegate _willFinishWithError:]): Ditto.
1725         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
1726         (WebKit::WebPaymentCoordinatorProxy::presenterWillValidateMerchant): To conform to
1727         PaymentAuthorizationPresenter::Client, renamed from validateMerchant.
1728         (WebKit::WebPaymentCoordinatorProxy::presenterDidAuthorizePayment): Renamed from
1729         didAuthorizePayment.
1730         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Moved logic here that previously
1731         existed in WKPaymentAuthorizationViewControllerDelegate.
1732         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod): Renamed from
1733         didSelectShippingMethod.
1734         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingContact): Renamed from
1735         didSelectShippingContact.
1736         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectPaymentMethod): Renamed from
1737         didSelectPaymentMethod.
1738         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Renamed to
1739         presenterWillValidateMerchant.
1740         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Renamed to
1741         presenterDidAuthorizePayment.
1742         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Renamed to
1743         presenterDidSelectShippingMethod.
1744         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Renamed to
1745         presenterDidSelectShippingContact.
1746         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Renamed to
1747         didSelectPaymentMethod.
1748         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Changed WebPaymentCoordinatorProxy to
1749         subclass PaymentAuthorizationPresenter::Client.
1750         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Removed WKPaymentAuthorizationViewControllerDelegate interface and declared some helper functions
1751         needed by PaymentAuthorizationPresenter.
1752         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1753         (WebKit::toPKPaymentSummaryItemType): Removed static keyword.
1754         (WebKit::toDecimalNumber): Ditto.
1755         (WebKit::toPKPaymentSummaryItem): Ditto.
1756         (WebKit::toPKPaymentSummaryItems): Ditto.
1757         (WebKit::toPKShippingMethod): Ditto.
1758         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Changed to call
1759         m_authorizationPresenter.
1760         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): Ditto.
1761         (WebKit::WebPaymentCoordinatorProxy::platformCompleteMerchantValidation): Ditto.
1762         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): Ditto.
1763         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): Ditto.
1764         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): Ditto.
1765         (-[WKPaymentAuthorizationViewControllerDelegate initWithPaymentCoordinatorProxy:]): Deleted.
1766         (-[WKPaymentAuthorizationViewControllerDelegate invalidate]): Deleted.
1767         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]): Deleted.
1768         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Deleted.
1769         (toShippingMethod): Deleted.
1770         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Deleted.
1771         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Deleted.
1772         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Deleted.
1773         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Deleted.
1774         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]): Deleted.
1775         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]): Deleted.
1776         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:completion:]): Deleted.
1777         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]): Deleted.
1778         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]): Deleted.
1779         (WebKit::toPKPaymentAuthorizationStatus): Moved to PaymentAuthorizationPresenter.mm.
1780         (WebKit::toPKPaymentErrorCode): Ditto.
1781         (WebKit::toNSError): Ditto.
1782         (WebKit::toNSErrors): Ditto.
1783         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
1784         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Changed to present a
1785         PaymentAuthorizationPresenter rather than a PKPAVC.
1786         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Changed to dismiss a
1787         PaymentAuthorizationPresenter rather than a PKPAVC.
1788         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1789         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
1790         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Ditto.
1791         * SourcesCocoa.txt:
1792         * UIProcess/WebPageProxy.h:
1793         * UIProcess/ios/WebPageProxyIOS.mm:
1794         (WebKit::WebPageProxy::paymentCoordinatorAuthorizationPresenter): Added. Returns a new
1795         PaymentAuthorizationViewController.
1796         * WebKit.xcodeproj/project.pbxproj:
1797
1798 2019-03-07  Chris Dumez  <cdumez@apple.com>
1799
1800         Regression(r242580) WebKit.NetworkProcessCrashWithPendingConnection API is crashing on iOS debug
1801         https://bugs.webkit.org/show_bug.cgi?id=195416
1802
1803         Reviewed by Antti Koivisto.
1804
1805         Drop ASSERT_NOT_REACHED() in WebPage::didCompletePageTransition() when the tree is still frozen due to
1806         LayerTreeFreezeReason::ProcessSuspended. As demonstrated by this API test, nothing prevents a load from
1807         completing and WebPage::didCompletePageTransition() to get called *after* WebProcess::prepareToSuspend()
1808         has been called. From the logging during the test, I can tell that WebProcess::processDidResume() gets
1809         called later on and the LayerTreeFreezeReason::ProcessSuspended freezing reason gets dropped, as expected.
1810
1811         * WebProcess/WebPage/WebPage.cpp:
1812         (WebKit::WebPage::didCompletePageTransition):
1813
1814 2019-03-07  Chris Dumez  <cdumez@apple.com>
1815
1816         Clean up / simplify ProcessAssertion code
1817         https://bugs.webkit.org/show_bug.cgi?id=195394
1818
1819         Reviewed by Geoffrey Garen.
1820
1821         Clean up / simplify ProcessAssertion code to facilitate its maintenance and make it
1822         less error-prone.
1823
1824         * Platform/IPC/mac/ConnectionMac.mm:
1825         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
1826         * UIProcess/ProcessAssertion.cpp:
1827         (WebKit::ProcessAssertion::ProcessAssertion):
1828         (WebKit::ProcessAssertion::setState):
1829         * UIProcess/ProcessAssertion.h:
1830         (WebKit::ProcessAssertion::Client::~Client):
1831         (WebKit::ProcessAssertion::setClient):
1832         (WebKit::ProcessAssertion::client):
1833         * UIProcess/ProcessThrottler.cpp:
1834         (WebKit::ProcessThrottler::didConnectToProcess):
1835         * UIProcess/ProcessThrottler.h:
1836         * UIProcess/ios/ProcessAssertionIOS.mm:
1837         (-[WKProcessAssertionBackgroundTaskManager dealloc]):
1838         (-[WKProcessAssertionBackgroundTaskManager addAssertionNeedingBackgroundTask:]):
1839         (-[WKProcessAssertionBackgroundTaskManager removeAssertionNeedingBackgroundTask:]):
1840         (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
1841         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
1842         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
1843         (WebKit::ProcessAssertion::ProcessAssertion):
1844         (WebKit::ProcessAssertion::processAssertionWasInvalidated):
1845         (WebKit::ProcessAssertion::setState):
1846         (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
1847         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
1848         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
1849         (WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated):
1850         (WebKit::ProcessAndUIAssertion::setState):
1851         (WebKit::ProcessAndUIAssertion::uiAssertionWillExpireImminently):
1852
1853 2019-03-07  Commit Queue  <commit-queue@webkit.org>
1854
1855         Unreviewed, rolling out r242297.
1856         https://bugs.webkit.org/show_bug.cgi?id=195430
1857
1858         Broke Microsoft Visio. (Requested by dydz on #webkit).
1859
1860         Reverted changeset:
1861
1862         "[iOS] Turn mouse event simulation on by default"
1863         https://bugs.webkit.org/show_bug.cgi?id=195218
1864         https://trac.webkit.org/changeset/242297
1865
1866 2019-03-07  John Wilander  <wilander@apple.com>
1867
1868         Resource Load Statistics: Log first-party navigations with link decoration
1869         https://bugs.webkit.org/show_bug.cgi?id=195301
1870         <rdar://problem/48569971>
1871
1872         Reviewed by Brent Fulgham.
1873
1874         This patch adds a call to the network process' resource load statistics to
1875         log cross-site navigations with link decoration. The logging checks if the
1876         source of the navigation is a prevalent resource and if so, sets the
1877         appropriate flag for the destination.
1878
1879         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1880         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1881         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
1882         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
1883         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
1884         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1885         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1886         (WebKit::ResourceLoadStatisticsMemoryStore::logCrossSiteLoadWithLinkDecoration):
1887         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1888         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1889         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1890         (WebKit::WebResourceLoadStatisticsStore::logCrossSiteLoadWithLinkDecoration):
1891         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1892         * NetworkProcess/NetworkProcess.cpp:
1893         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
1894             This now receives a completion handler. This is in preparation for
1895             test cases where we need to log such an event and wait for it to
1896             finish before continuing.
1897         * NetworkProcess/NetworkProcess.h:
1898         * NetworkProcess/NetworkProcess.messages.in:
1899         * UIProcess/Network/NetworkProcessProxy.cpp:
1900         (WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration):
1901         * UIProcess/Network/NetworkProcessProxy.h:
1902         * UIProcess/WebPageProxy.cpp:
1903         (WebKit::WebPageProxy::didCommitLoadForFrame):
1904         * UIProcess/WebProcessPool.cpp:
1905         (WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration):
1906         * UIProcess/WebProcessPool.h:
1907
1908 2019-03-07  Per Arne Vollan  <pvollan@apple.com>
1909
1910         [iOS] Disable permissive call logging in sandbox
1911         https://bugs.webkit.org/show_bug.cgi?id=195288
1912         <rdar://problem/47683804>
1913
1914         Reviewed by Brent Fulgham.
1915
1916         As on macOS, we should enable strict call filtering in sandbox on iOS.
1917
1918         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1919
1920 2019-03-07  Youenn Fablet  <youenn@apple.com>
1921
1922         Introduce a quota manager for Cache API/Service Worker/IDB storage
1923         https://bugs.webkit.org/show_bug.cgi?id=195283
1924
1925         Reviewed by Chris Dumez.
1926
1927         Remove quota handling from Cache API storage and use StorageQuotaManager/StorageQuotaUser.
1928         CacheStorage::Caches becomes a quota user and has a StorageQuotaManager to check for space for any cache API write task.
1929         NetworkProcess is responsible to manage the quota managers.
1930         Quota managers will go through network process to ask UIProcess for quota extension.
1931
1932         Remove pending callback handling from CacheStorage since they are queued in QuotaManager now.
1933
1934         * NetworkProcess/NetworkProcess.cpp:
1935         (WebKit::NetworkProcess::~NetworkProcess):
1936         (WebKit::NetworkProcess::destroySession):
1937         (WebKit::NetworkProcess::cacheStorageRootPath):
1938         (WebKit::NetworkProcess::setCacheStorageParameters):
1939         (WebKit::NetworkProcess::storageQuotaManager):
1940         * NetworkProcess/NetworkProcess.h:
1941         * NetworkProcess/cache/CacheStorageEngine.cpp:
1942         (WebKit::CacheStorage::Engine::from):
1943         (WebKit::CacheStorage::Engine::Engine):
1944         (WebKit::CacheStorage::Engine::readCachesFromDisk):
1945         * NetworkProcess/cache/CacheStorageEngine.h:
1946         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1947         (WebKit::CacheStorage::Cache::put):
1948         * NetworkProcess/cache/CacheStorageEngineCache.h:
1949         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1950         (WebKit::CacheStorage::Caches::Caches):
1951         (WebKit::CacheStorage::Caches::~Caches):
1952         (WebKit::CacheStorage::Caches::requestSpace):
1953         (WebKit::CacheStorage::Caches::writeRecord):
1954         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1955
1956 2019-03-07  John Wilander  <wilander@apple.com>
1957
1958         Resource Load Statistics: Make it possible to purge only script-accessible cookies
1959         https://bugs.webkit.org/show_bug.cgi?id=195383
1960         <rdar://problem/48570136>
1961
1962         Reviewed by Brent Fulgham.
1963
1964         This patch provides the ability to purge all script-accessible cookies while leaving
1965         HttpOnly cookies in place.
1966
1967         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1968         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
1969         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1970         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1971             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1972         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1973         * NetworkProcess/NetworkProcess.cpp:
1974         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1975             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1976         (WebKit::NetworkProcess::deleteCookiesForTesting):
1977             Test infrastructure.
1978         * NetworkProcess/NetworkProcess.h:
1979         * NetworkProcess/NetworkProcess.messages.in:
1980         * NetworkProcess/NetworkSession.cpp:
1981         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
1982             Support for a new boolean flag on whether or not to include HttpOnly Cookies.
1983         * NetworkProcess/NetworkSession.h:
1984         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1985         (WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
1986             Test infrastructure.
1987         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1988         * UIProcess/Network/NetworkProcessProxy.cpp:
1989         (WebKit::NetworkProcessProxy::deleteCookiesForTesting):
1990             Test infrastructure.
1991         * UIProcess/Network/NetworkProcessProxy.h:
1992         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1993         (WebKit::WebsiteDataStore::deleteCookiesForTesting):
1994             Test infrastructure.
1995         * UIProcess/WebsiteData/WebsiteDataStore.h:
1996
1997 2019-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1998
1999         REGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
2000         https://bugs.webkit.org/show_bug.cgi?id=195410
2001
2002         Reviewed by Žan Doberšek.
2003
2004         Calling CompositingRunLoop::stopUpdates() on suspend is leaving the threaded compositor in an inconsistent
2005         state, failing to resume and stopping the updates forever. This is causing timeouts in WPE layout tests. Instead
2006         of calling stopUpdates(), a new suspend() is called, that stops the update timer, without changing the current
2007         updae tha compositing state. A new method resume() is also added to schedule an update if needed.
2008
2009         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2010         (WebKit::CompositingRunLoop::suspend): Set state as suspended and stop the update timer.
2011         (WebKit::CompositingRunLoop::resume): Set state as not suspended and start the update timer if it was scheduled
2012         while suspended.
2013         (WebKit::CompositingRunLoop::scheduleUpdate): Do not start the update timer when suspended.
2014         (WebKit::CompositingRunLoop::compositionCompleted): Ditto.
2015         (WebKit::CompositingRunLoop::updateCompleted): Ditto.
2016         (WebKit::CompositingRunLoop::updateTimerFired): Add an assert to ensure the update timer is not fired while suspended.
2017         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2018         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2019         (WebKit::ThreadedCompositor::suspend): Call CompositingRunLoop::suspend() instead of stopUpdates().
2020         (WebKit::ThreadedCompositor::resume): Call CompositingRunLoop::resume().
2021
2022 2019-03-06  Mark Lam  <mark.lam@apple.com>
2023
2024         Exception is a JSCell, not a JSObject.
2025         https://bugs.webkit.org/show_bug.cgi?id=195392
2026
2027         Reviewed by Saam Barati.
2028
2029         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2030         (WebKit::JSNPObject::throwInvalidAccessError):
2031         * WebProcess/Plugins/Netscape/JSNPObject.h:
2032
2033 2019-03-07  Commit Queue  <commit-queue@webkit.org>
2034
2035         Unreviewed, rolling out r242354.
2036         https://bugs.webkit.org/show_bug.cgi?id=195402
2037
2038         breaks layout tests in all configurations (Requested by
2039         zdobersek on #webkit).
2040
2041         Reverted changeset:
2042
2043         "[WPE] Enable web process sandbox"
2044         https://bugs.webkit.org/show_bug.cgi?id=195169
2045         https://trac.webkit.org/changeset/242354
2046
2047 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
2048
2049         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
2050         https://bugs.webkit.org/show_bug.cgi?id=195346
2051
2052         Reviewed by Fujii Hironori.
2053
2054         * Platform/IPC/win/ConnectionWin.cpp:
2055         (IPC::Connection::createServerAndClientIdentifiers):
2056         * Platform/win/ModuleWin.cpp:
2057         (WebKit::Module::load):
2058         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2059         (WebKit::ProcessLauncher::launchProcess):
2060         * UIProcess/win/WebContextMenuProxyWin.cpp:
2061         (WebKit::createMenuItem):
2062         * UIProcess/win/WebView.cpp:
2063         (WebKit::WebView::setToolTip):
2064         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
2065         (WebKit::InjectedBundle::initialize):
2066         Use wchar helpers as needed.
2067
2068 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2069
2070         Crash when attempting to change input type while dismissing datalist suggestions
2071         https://bugs.webkit.org/show_bug.cgi?id=195384
2072         <rdar://problem/48563718>
2073
2074         Reviewed by Brent Fulgham.
2075
2076         See WebCore ChangeLog for more details.
2077
2078         * WebProcess/WebPage/WebPage.cpp:
2079         (WebKit::WebPage::setActiveDataListSuggestionPicker):
2080         (WebKit::WebPage::didSelectDataListOption):
2081         (WebKit::WebPage::didCloseSuggestions):
2082         * WebProcess/WebPage/WebPage.h:
2083
2084         Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
2085
2086 2019-03-06  Chris Dumez  <cdumez@apple.com>
2087
2088         [iOS] ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent
2089         https://bugs.webkit.org/show_bug.cgi?id=195382
2090         <rdar://problem/48642739>
2091
2092         Reviewed by Geoffrey Garen.
2093
2094         ProcessDidResume() IPC should be sent upon resuming when ProcessWillSuspendImminently() IPC was sent. Previously,
2095         we only send ProcessDidResume() to the WebProcess if PrepareToSuspend() was sent, not when the more urgent
2096         ProcessWillSuspendImminently() IPC was sent.
2097
2098         This mismatch has lead to bugs because the WebProcess does not know it got resumed and failed to unfreeze the
2099         layers it froze upon suspension.
2100
2101         * UIProcess/ProcessAssertion.h:
2102         (WebKit::ProcessAssertionClient::~ProcessAssertionClient):
2103
2104         * UIProcess/ProcessThrottler.cpp:
2105         (WebKit::ProcessThrottler::updateAssertion):
2106         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
2107         (WebKit::ProcessThrottler::assertionWillExpireImminently): Deleted.
2108
2109         * UIProcess/ProcessThrottler.h:
2110         * UIProcess/ios/ProcessAssertionIOS.mm:
2111         (-[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension]):
2112         (WebKit::ProcessAssertion::~ProcessAssertion):
2113         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
2114         (WebKit::ProcessAndUIAssertion::setClient):
2115
2116         * WebProcess/WebPage/WebPage.cpp:
2117         (WebKit::WebPage::didCompletePageTransition):
2118         Revert change that was landed in r242098 to work around this ProcessThrottler bug.
2119
2120         * WebProcess/WebPage/ios/WebPageIOS.mm:
2121         (WebKit::WebPage::applicationWillEnterForeground):
2122         Revert change that was landed in r242554 to work around this ProcessThrottler bug.
2123
2124 2019-03-06  Alex Christensen  <achristensen@webkit.org>
2125
2126         Add gettid to allowed syscalls on Mac
2127         https://bugs.webkit.org/show_bug.cgi?id=195386
2128         <rdar://problem/48651255>
2129
2130         Reviewed by Brent Fulgham.
2131
2132         * WebProcess/com.apple.WebProcess.sb.in:
2133
2134 2019-03-06  Per Arne Vollan  <pvollan@apple.com>
2135
2136         [macOS] Sandbox call violation causes WebContent process to crash
2137         https://bugs.webkit.org/show_bug.cgi?id=195379
2138         <rdar://problem/48647263>
2139
2140         Reviewed by Brent Fulgham.
2141
2142         A new call needs to be added to the allow list in the WebContent process' sandbox.
2143
2144         * WebProcess/com.apple.WebProcess.sb.in:
2145
2146 2019-03-06  Antti Koivisto  <antti@apple.com>
2147
2148         [iOS] Basic hit testing for content overlapping fast-scrollable overflow
2149         https://bugs.webkit.org/show_bug.cgi?id=195360
2150
2151         Reviewed by Simon Fraser.
2152
2153         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2154         (WebKit::RemoteLayerTreeHost::makeNode):
2155
2156         Use new UIView subclass for tiled layer hosting (so we know they have content even when contents property is nil).
2157
2158         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2159         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2160         (collectDescendantViewsAtPoint):
2161
2162         Factor collection step into a function.
2163         Do basic skipping of event-transparent layers.
2164
2165         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2166
2167         To handle overlap cases, find the scroll view that has the deepest non-transparent view hit as its descendant.
2168
2169         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]): Deleted.
2170
2171 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2172
2173         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
2174         https://bugs.webkit.org/show_bug.cgi?id=195300
2175
2176         Reviewed by Simon Fraser.
2177
2178         Refactor some logic to use isTransparentOrFullyClippedRespectingParentFrames on RenderLayer rather than
2179         RenderObject; introduce a helper method to ask whether the enclosing layer of a renderer is transparent or
2180         clipped.
2181
2182         * WebProcess/WebPage/ios/WebPageIOS.mm:
2183         (WebKit::enclosingLayerIsTransparentOrFullyClipped):
2184         (WebKit::WebPage::platformEditorState const):
2185         (WebKit::WebPage::requestEvasionRectsAboveSelection):
2186         (WebKit::WebPage::getFocusedElementInformation):
2187
2188 2019-03-06  Chris Dumez  <cdumez@apple.com>
2189
2190         REGRESSION (r238490): YouTube.com: Returning PiP to Safari after sleeping device loses page
2191         https://bugs.webkit.org/show_bug.cgi?id=195364
2192         <rdar://problem/48538837>
2193
2194         Reviewed by Geoffrey Garen.
2195
2196         Make sure we unset the LayerTreeFreezeReason::ProcessSuspended layer tree freeze reason
2197         when WebPage::applicationWillEnterForeground() is called. This restores pre-r238490
2198         behavior and addresses the issue with PiP on youtube.com.
2199
2200         * WebProcess/WebPage/ios/WebPageIOS.mm:
2201         (WebKit::WebPage::applicationWillEnterForeground):
2202
2203 2019-03-05  Dean Jackson  <dino@apple.com>
2204
2205         Fix WKPasswordView compilation on iOS
2206         https://bugs.webkit.org/show_bug.cgi?id=195344
2207         <rdar://problem/48620066>
2208
2209         Reviewed by Dan Bates.
2210
2211         Use WebKitAdditions.
2212
2213         * UIProcess/ios/WKPasswordView.mm:
2214         (-[WKPasswordView showInScrollView:]):
2215
2216 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2217
2218         [iOS] Frequent 1 second IPC deadlocks when showing a paste callout
2219         https://bugs.webkit.org/show_bug.cgi?id=195354
2220         <rdar://problem/48624675>
2221
2222         Reviewed by Tim Horton.
2223
2224         When triggering programmatic paste, we frequently hit deadlocks due to sync IPC going from the UI process to the
2225         web process and vice versa. What happens in this scenario is that prior to triggering programmatic paste, the
2226         page may try to move focus to a different element (e.g. a hidden editable area) before calling `execCommand`.
2227         This causes us to send an ElementDidFocus message to the UI process, followed by RequestDOMPasteAccess.
2228
2229         However, upon receiving ElementDidFocus, we reload input views and (in the process) UIKit requests the
2230         autocorrection context, which we implement in WebKit using a sync message to the web process due to
2231         <rdar://problem/16207002> and its blocking bug <rdar://problem/48383001>. This means we'll end up in a state
2232         where both the UI process and web process are blocked on each other waiting for a sync IPC response, and the UI
2233         process is hung for a second until the IPC message times out.
2234
2235         Ideally, we should fix this by addressing <rdar://problem/16207002>. However, this requires potentially large
2236         changes in UIKit (<rdar://problem/48383001>); for the time being, work around this deadlock by refactoring
2237         synchronous autocorrection context requests such that they can be resolved by an out-of-band IPC response
2238         (HandleAutocorrectionContext). Then prior to requesting DOM paste access, preemptively send a
2239         HandleAutocorrectionContext message to the UI process to unblock any pending synchronous autocorrection context
2240         requests.
2241
2242         * UIProcess/PageClient.h:
2243         * UIProcess/WebPageProxy.h:
2244         * UIProcess/WebPageProxy.messages.in:
2245         * UIProcess/ios/PageClientImplIOS.h:
2246         * UIProcess/ios/PageClientImplIOS.mm:
2247         (WebKit::PageClientImpl::handleAutocorrectionContext):
2248         * UIProcess/ios/WKContentViewInteraction.h:
2249
2250         Make it possible for WKContentView to remember its current pending autocorrection context completion handler.
2251         This is invoked and cleared out in `-_invokePendingAutocorrectionContextHandler:`.
2252
2253         * UIProcess/ios/WKContentViewInteraction.mm:
2254         (-[WKContentView _invokePendingAutocorrectionContextHandler:]):
2255         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
2256         (-[WKContentView _handleAutocorrectionContext:]):
2257
2258         Handle an autocorrection context response. This is invoked when the web process either handles an autocorrection
2259         context message, or when it preemptively sends an autocorrection context before requesting DOM paste access.
2260
2261         (+[WKAutocorrectionContext emptyAutocorrectionContext]):
2262
2263         Add a helper to create an empty autocorrection context.
2264
2265         * UIProcess/ios/WebPageProxyIOS.mm:
2266         (WebKit::WebPageProxy::requestAutocorrectionContext):
2267         (WebKit::WebPageProxy::handleAutocorrectionContext):
2268         (WebKit::WebPageProxy::autocorrectionContextSync): Deleted.
2269
2270         Removed this sync version, since we now only have requestAutocorrectionContext.
2271
2272         * WebProcess/WebPage/WebPage.cpp:
2273         (WebKit::WebPage::requestDOMPasteAccess):
2274
2275         Send WebPageProxy::HandleAutocorrectionContext, and add a FIXME referencing <rdar://problem/16207002>.
2276
2277         * WebProcess/WebPage/WebPage.h:
2278         * WebProcess/WebPage/WebPage.messages.in:
2279
2280         Split AutocorrectionContextSync into RequestAutocorrectionContext and HandleAutocorrectionContext; additionally,
2281         remove the existing RequestAutocorrectionContext message.
2282
2283         * WebProcess/WebPage/ios/WebPageIOS.mm:
2284         (WebKit::WebPage::requestAutocorrectionContext):
2285         (WebKit::WebPage::autocorrectionContextSync): Deleted.
2286
2287 2019-03-06  Rob Buis  <rbuis@igalia.com>
2288
2289         Consider supporting the `referrerpolicy` attribute.
2290         https://bugs.webkit.org/show_bug.cgi?id=179053
2291
2292         Reviewed by Darin Adler.
2293
2294         Add a runtime flag for referrerpolicy attribute.
2295
2296         * Shared/WebPreferences.yaml:
2297         * UIProcess/API/C/WKPreferences.cpp:
2298         (WKPreferencesSetReferrerPolicyAttributeEnabled):
2299         (WKPreferencesGetReferrerPolicyAttributeEnabled):
2300         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2301         * WebProcess/Network/WebLoaderStrategy.cpp:
2302         (WebKit::WebLoaderStrategy::loadResource): do not hardcode choosing
2303         the document referrer policy.
2304
2305 2019-03-06  Philippe Normand  <pnormand@igalia.com>
2306
2307         Unreviewed, WPE build fix after r242503
2308
2309         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2310         ServiceWorker messages moved from network process to another
2311         header, so it needs to be included.
2312
2313 2019-03-05  David Quesada  <david_quesada@apple.com>
2314
2315         [WK2] It should be possible to follow links with 'download' attributes
2316         https://bugs.webkit.org/show_bug.cgi?id=195145
2317         rdar://problem/48462642
2318
2319         Reviewed by Alex Christensen.
2320
2321         When a link with a 'download' attribute is clicked and the navigation client
2322         says to allow the navigation (i.e. provides PolicyAction::Use),
2323         WebPageProxy::receivedNavigationPolicyDecision() should stop overriding this
2324         decision and downloading the link instead. Instead, web view should honor the
2325         policy chosen by the navigation delegate. This supports clients that want to
2326         offer the user the ability to view, rather than download, the contents of
2327         such links, which is permitted per the HTML spec.
2328
2329         This change is only made on Cocoa platforms for now since no other ports
2330         expose an API on their navigation action to express whether the page intends
2331         to download the linked resource.
2332
2333         * UIProcess/API/APINavigation.h:
2334         (API::Navigation::shouldPerformDownload const):
2335             Rename this to be in line with APINavigationAction's shouldPerformDownload()
2336             for consistency. 'Force' seems like too strong of a word for this property
2337             considering that 'forcing' the download isn't really an attribute inherent
2338             to the navigation, but a behavior implemented by the web page proxy.
2339         (API::Navigation::shouldForceDownload const): Deleted.
2340         * UIProcess/Cocoa/VersionChecks.h:
2341         * UIProcess/WebPageProxy.cpp:
2342         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2343
2344 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
2345
2346         [Curl] Implement Cookie Accept Policy.
2347         https://bugs.webkit.org/show_bug.cgi?id=191645
2348
2349         Reviewed by Fujii Hironori.
2350
2351         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
2352         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
2353         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
2354         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2355         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
2356         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
2357         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2358
2359 2019-03-05  Youenn Fablet  <youenn@apple.com>
2360
2361         Introduce ServiceWorkerFetchTask
2362         https://bugs.webkit.org/show_bug.cgi?id=195130
2363
2364         Reviewed by Chris Dumez.
2365
2366         ServiceWorkerFetchTask is added to represent NetworkProcess side of an ongoing fetch intercepted by service worker.
2367         This patch should not change existing behavior.
2368
2369         * CMakeLists.txt:
2370         * DerivedSources-input.xcfilelist:
2371         * DerivedSources-output.xcfilelist:
2372         * DerivedSources.make:
2373         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2374         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
2375         * NetworkProcess/NetworkProcess.cpp:
2376         (WebKit::NetworkProcess::didFailFetch): Deleted.
2377         (WebKit::NetworkProcess::didNotHandleFetch): Deleted.
2378         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse): Deleted.
2379         (WebKit::NetworkProcess::didReceiveFetchResponse): Deleted.
2380         (WebKit::NetworkProcess::didReceiveFetchData): Deleted.
2381         (WebKit::NetworkProcess::didReceiveFetchFormData): Deleted.
2382         (WebKit::NetworkProcess::didFinishFetch): Deleted.
2383         * NetworkProcess/NetworkProcess.h:
2384         * NetworkProcess/NetworkProcess.messages.in:
2385         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2386         (WebKit::WebSWServerConnection::cancelFetch):
2387         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
2388         (WebKit::WebSWServerConnection::startFetch):
2389         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse): Deleted.
2390         (WebKit::WebSWServerConnection::didReceiveFetchResponse): Deleted.
2391         (WebKit::WebSWServerConnection::didReceiveFetchData): Deleted.
2392         (WebKit::WebSWServerConnection::didReceiveFetchFormData): Deleted.
2393         (WebKit::WebSWServerConnection::didFinishFetch): Deleted.
2394         (WebKit::WebSWServerConnection::didFailFetch): Deleted.
2395         (WebKit::WebSWServerConnection::didNotHandleFetch): Deleted.
2396         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2397         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2398         (WebKit::WebSWServerToContextConnection::connectionClosed):
2399         (WebKit::WebSWServerToContextConnection::startFetch):
2400         (WebKit::WebSWServerToContextConnection::cancelFetch):
2401         (WebKit::WebSWServerToContextConnection::continueDidReceiveFetchResponse):
2402         (WebKit::WebSWServerToContextConnection::didReceiveFetchTaskMessage):
2403         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
2404         * SourcesCocoa.txt:
2405         * WebKit.xcodeproj/project.pbxproj:
2406         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2407         (WebKit::WebSWContextManagerConnection::startFetch):
2408         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2409         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
2410         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
2411         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
2412         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
2413         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
2414         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
2415         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
2416         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
2417         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: Added.
2418         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
2419         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
2420         (WebKit::ServiceWorkerFetchTask::didReceiveData):
2421         (WebKit::ServiceWorkerFetchTask::didReceiveFormData):
2422         (WebKit::ServiceWorkerFetchTask::didFinish):
2423         (WebKit::ServiceWorkerFetchTask::didFail):
2424         (WebKit::ServiceWorkerFetchTask::didNotHandle):
2425         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: Added.
2426         (WebKit::ServiceWorkerFetchTask::create):
2427         (WebKit::ServiceWorkerFetchTask::Identifier::hash const):
2428         (WebKit::ServiceWorkerFetchTask::identifier const):
2429         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
2430         (WebKit::operator==):
2431         (WTF::ServiceWorkerFetchTaskIdentifierHash::hash):
2432         (WTF::ServiceWorkerFetchTaskIdentifierHash::equal):
2433         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::emptyValue):
2434         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::constructDeletedValue):
2435         (WTF::HashTraits<WebKit::ServiceWorkerFetchTask::Identifier>::isDeletedValue):
2436         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in: Added.
2437
2438 2019-03-05  Youenn Fablet  <youenn@apple.com>
2439
2440         Rename requestCacheStorageSpace to requestStorageSpace
2441         https://bugs.webkit.org/show_bug.cgi?id=195282
2442
2443         Reviewed by Chris Dumez.
2444
2445         Make the name more abstract as it might be used in the future for other storage
2446         like IDB or service worker registrations.
2447
2448         * NetworkProcess/NetworkProcess.cpp:
2449         (WebKit::NetworkProcess::requestStorageSpace):
2450         (WebKit::NetworkProcess::requestCacheStorageSpace): Deleted.
2451         * NetworkProcess/NetworkProcess.h:
2452         * NetworkProcess/cache/CacheStorageEngine.cpp:
2453         (WebKit::CacheStorage::Engine::requestSpace):
2454         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2455         (WebsiteDataStoreClient::WebsiteDataStoreClient):
2456         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
2457         * UIProcess/Network/NetworkProcessProxy.cpp:
2458         (WebKit::NetworkProcessProxy::requestStorageSpace):
2459         (WebKit::NetworkProcessProxy::requestCacheStorageSpace): Deleted.
2460         * UIProcess/Network/NetworkProcessProxy.h:
2461         * UIProcess/Network/NetworkProcessProxy.messages.in:
2462         * UIProcess/WebsiteData/WebsiteDataStoreClient.h:
2463         (WebKit::WebsiteDataStoreClient::requestStorageSpace):
2464         (WebKit::WebsiteDataStoreClient::requestCacheStorageSpace): Deleted.
2465
2466 2019-03-05  Chris Dumez  <cdumez@apple.com>
2467
2468         Drop cached WebProcesses for a given session when this session is destroyed
2469         https://bugs.webkit.org/show_bug.cgi?id=195212
2470         <rdar://problem/48301483>
2471
2472         Reviewed by Geoffrey Garen.
2473
2474         Drop cached WebProcesses for a give session when this session is destroyed. This way, when you close
2475         your private browsing window, all the processes it used get cleared and it cannot leave any state
2476         behind.
2477
2478         * UIProcess/WebProcessCache.cpp:
2479         (WebKit::WebProcessCache::canCacheProcess const):
2480         (WebKit::WebProcessCache::addProcessIfPossible):
2481         (WebKit::WebProcessCache::addProcess):
2482         (WebKit::WebProcessCache::clearAllProcessesForSession):
2483         * UIProcess/WebProcessCache.h:
2484         (WebKit::WebProcessCache::capacity const):
2485         * UIProcess/WebProcessPool.cpp:
2486         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
2487         (WebKit::WebProcessPool::hasPagesUsingWebsiteDataStore const):
2488         * UIProcess/WebProcessPool.h:
2489
2490 2019-03-05  Brady Eidson  <beidson@apple.com>
2491
2492         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
2493         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
2494
2495         Reviewed by Tim Horton.
2496
2497         * WebProcess/WebPage/WebPage.cpp:
2498         (WebKit::WebPage::SandboxExtensionTracker::shouldReuseCommittedSandboxExtension): If there is a pendingProvisionalSandboxExtension
2499           then its existence should override our willingness to reuse the existing committed extension.
2500         (WebKit::shouldReuseCommittedSandboxExtension): Deleted.
2501         * WebProcess/WebPage/WebPage.h:
2502
2503 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
2504
2505         Unreviewed, rolling out r242403.
2506
2507         Caused layout test crashes on iOS simulator.
2508
2509         Reverted changeset:
2510
2511         "[ContentChangeObserver] Introduce fixed duration content
2512         observation"
2513         https://bugs.webkit.org/show_bug.cgi?id=195295
2514         https://trac.webkit.org/changeset/242403
2515
2516 2019-03-05  Loïc Yhuel  <loic.yhuel@softathome.com>
2517
2518         [WPE] Do not create a PlatformDisplay in the Service Worker process
2519         https://bugs.webkit.org/show_bug.cgi?id=194830
2520
2521         Reviewed by Žan Doberšek.
2522
2523         It avoids opening the Wayland socket in this WPEWebProcess, which might cause issues
2524         depending on the platform, and allocates unneeded resources.
2525
2526         * Shared/WebProcessCreationParameters.cpp:
2527         (WebKit::WebProcessCreationParameters::encode const):
2528         (WebKit::WebProcessCreationParameters::decode):
2529         * Shared/WebProcessCreationParameters.h: Add new isServiceWorkerProcess parameter.
2530         * UIProcess/WebProcessPool.cpp:
2531         (WebKit::WebProcessPool::initializeNewWebProcess): Set isServiceWorkerProcess parameter.
2532         * UIProcess/glib/WebProcessPoolGLib.cpp:
2533         (WebKit::WebProcessPool::platformInitializeWebProcess): No implementationLibraryName and hostClientFileDescriptor for Service Worker.
2534         * WebProcess/glib/WebProcessGLib.cpp:
2535         (WebKit::WebProcess::platformInitializeWebProcess): No wpe_loader_init nor PlatformDisplayLibWPE for Service Worker.
2536
2537 2019-03-04  Brady Eidson  <beidson@apple.com>
2538
2539         Unreviewed, rolling out r242376.
2540
2541         Broke some tests
2542
2543         Reverted changeset:
2544
2545         "Correctly handle sandbox extensions when the same WKWebView
2546         loads multiple file:// URLs."
2547         https://bugs.webkit.org/show_bug.cgi?id=195291
2548         https://trac.webkit.org/changeset/242376
2549
2550 2019-03-04  Fujii Hironori  <Hironori.Fujii@sony.com>
2551
2552         Use a SQLite database to hold the ResourceLoadStatistics data
2553         https://bugs.webkit.org/show_bug.cgi?id=194867
2554         <rdar://problem/24240854>
2555
2556         Unreviewed build fix for WinCairo.
2557
2558         ResourceLoadStatisticsDebug and RELEASE_LOG_INFO_IF are not
2559         defined because WinCairo port defines RELEASE_LOG_DISABLED.
2560
2561         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2562         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): Enclosed RELEASE_LOG_INFO_IF with #if !RELEASE_LOG_DISABLED.
2563         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener): Ditto.
2564         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking): Ditto.
2565
2566 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2567
2568         Use a SQLite database to hold the ResourceLoadStatistics data
2569         https://bugs.webkit.org/show_bug.cgi?id=194867
2570         <rdar://problem/24240854>
2571
2572         Reviewed by Chris Dumez.
2573
2574         The ResourceLoadStatistics database plist is inefficient. It requires more memory use
2575         than it needs, and forces lots of looping and string comparisons to find information.
2576
2577         This problem has already been solved in the form of relational databases. We use them
2578         elsewhere in WebKit, and should do so for this storage as well.
2579
2580         This patch creates an optional SQLite database to handle ITP operations.
2581
2582         1. It adds a new internal experimental feature flag to activate it. It requires the user
2583            exit and restart the process to take effect.
2584         2. It populates itself from the existing plist file (if it exists).
2585         3. It stops using the plist in favor of the database.
2586         4. It does queries and other operations using the database instead of the old hash table
2587            implementation.
2588
2589         This patch refactors the exisiting ResourceLoadStatisticsMemoryStore class into a base
2590         ResourceLoadStatisticsStore class, which ResourceLoadStatisticsMemoryStore is based on.
2591         It adds a new ResourceLoadStatisticsDatabaseStore that is implemented in terms of SQL
2592         operations.
2593
2594         These code changes should not have any impact on existing operations, and when enabled
2595         should produce the same test results.
2596
2597         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Added.
2598         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2599         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
2600         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
2601         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
2602         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
2603         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationship):
2604         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const):
2605         (WebKit::ResourceLoadStatisticsDatabaseStore::domainIDFromString const):
2606         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
2607         (WebKit::ResourceLoadStatisticsDatabaseStore::databaseIsEmpty const):
2608         (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
2609         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const):
2610         (WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
2611         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
2612         (WebKit::buildList):
2613         (WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
2614         (WebKit::listToString):
2615         (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
2616         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
2617         (WebKit::ResourceLoadStatisticsDatabaseStore::classifyPrevalentResources):
2618         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageIfNeeded):
2619         (WebKit::ResourceLoadStatisticsDatabaseStore::syncStorageImmediately):
2620         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
2621         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
2622         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
2623         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
2624         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
2625         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
2626         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
2627         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
2628         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceLoading):
2629         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
2630         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
2631         (WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
2632         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
2633         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
2634         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
2635         (WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
2636         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics const):
2637         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
2638         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
2639         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
2640         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubresourceUnder const):
2641         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsSubFrameUnder const):
2642         (WebKit::ResourceLoadStatisticsDatabaseStore::isRegisteredAsRedirectingTo const):
2643         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
2644         (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
2645         (WebKit::ResourceLoadStatisticsDatabaseStore::isGrandfathered const):
2646         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameOrigin):
2647         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameOrigin):
2648         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
2649         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
2650         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
2651         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
2652         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForPrimaryDomain):
2653         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):
2654         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieTreatmentForOrigin const):
2655         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
2656         (WebKit::ResourceLoadStatisticsDatabaseStore::domainsToBlock const):
2657         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
2658         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlockingForDomains):
2659         (WebKit::ResourceLoadStatisticsDatabaseStore::clearBlockingStateForDomains):
2660         (WebKit::ResourceLoadStatisticsDatabaseStore::processStatistics const):
2661         (WebKit::ResourceLoadStatisticsDatabaseStore::prevalentDomains const):
2662         (WebKit::ResourceLoadStatisticsDatabaseStore::findExpiredUserInteractions const):
2663         (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions):
2664         (WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
2665         (WebKit::ResourceLoadStatisticsDatabaseStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
2666         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
2667         (WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
2668         (WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen):
2669         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
2670         (WebKit::ResourceLoadStatisticsDatabaseStore::removeAllStorageAccess):
2671         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: Added.
2672         (WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const):
2673         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2674         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
2675         (WebKit::ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains):
2676         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
2677         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded):
2678         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately):
2679         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains):
2680         (WebKit::domainsToString): Deleted.
2681         (WebKit::OperatingDate::fromWallTime): Deleted.
2682         (WebKit::OperatingDate::today): Deleted.
2683         (WebKit::OperatingDate::secondsSinceEpoch const): Deleted.
2684         (WebKit::OperatingDate::operator== const): Deleted.
2685         (WebKit::OperatingDate::operator< const): Deleted.
2686         (WebKit::OperatingDate::operator<= const): Deleted.
2687         (WebKit::OperatingDate::OperatingDate): Deleted.
2688         (WebKit::mergeOperatingDates): Deleted.
2689         (WebKit::computeImportance): Deleted.
2690         (WebKit::ResourceLoadStatisticsMemoryStore::~ResourceLoadStatisticsMemoryStore): Deleted.
2691         (WebKit::ResourceLoadStatisticsMemoryStore::setNotifyPagesWhenDataRecordsWereScanned): Deleted.
2692         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): Deleted.
2693         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldSubmitTelemetry): Deleted.
2694         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords): Deleted.
2695         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords): Deleted.
2696         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData): Deleted.
2697         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode): Deleted.
2698         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode): Deleted.
2699         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary): Deleted.
2700         (WebKit::ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest): Deleted.
2701         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction): Deleted.
2702         (WebKit::ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval): Deleted.
2703         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfatheringTime): Deleted.
2704         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap): Deleted.
2705         (WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap): Deleted.
2706         (WebKit::ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies): Deleted.
2707         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap): Deleted.
2708         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const): Deleted.
2709         (WebKit::ResourceLoadStatisticsMemoryStore::setDataRecordsBeingRemoved): Deleted.
2710         (WebKit::debugLogDomainsInBatches): Deleted.
2711         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary): Deleted.
2712         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const): Deleted.
2713         (WebKit::ResourceLoadStatisticsMemoryStore::setMaxStatisticsEntries): Deleted.
2714         (WebKit::ResourceLoadStatisticsMemoryStore::setPruneEntriesDownTo): Deleted.
2715         (WebKit::ResourceLoadStatisticsMemoryStore::resetParametersToDefaultValues): Deleted.
2716         (WebKit::ResourceLoadStatisticsMemoryStore::logTestingEvent): Deleted.
2717         (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess): Deleted.
2718         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2719         (WebKit::ResourceLoadStatisticsMemoryStore::data const):
2720         (WebKit::ResourceLoadStatisticsMemoryStore::isDebugModeEnabled const): Deleted.
2721         (WebKit::ResourceLoadStatisticsMemoryStore::store const): Deleted.
2722         (WebKit::ResourceLoadStatisticsMemoryStore::setStorageAccessPromptsEnabled): Deleted.
2723         (WebKit::ResourceLoadStatisticsMemoryStore::setDebugLogggingEnabled): Deleted.
2724         (): Deleted.
2725         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Added.
2726         (WebKit::domainsToString):
2727         (WebKit::OperatingDate::fromWallTime):
2728         (WebKit::OperatingDate::today):
2729         (WebKit::OperatingDate::secondsSinceEpoch const):
2730         (WebKit::OperatingDate::operator== const):
2731         (WebKit::OperatingDate::operator< const):
2732         (WebKit::OperatingDate::operator<= const):
2733         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
2734         (WebKit::ResourceLoadStatisticsStore::~ResourceLoadStatisticsStore):
2735         (WebKit::ResourceLoadStatisticsStore::calculateAndSubmitTelemetry const):
2736         (WebKit::ResourceLoadStatisticsStore::computeImportance):
2737         (WebKit::ResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2738         (WebKit::ResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2739         (WebKit::ResourceLoadStatisticsStore::setShouldSubmitTelemetry):
2740         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2741         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2742         (WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2743         (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2744         (WebKit::ResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
2745         (WebKit::ResourceLoadStatisticsStore::scheduleStatisticsProcessingRequestIfNecessary):
2746         (WebKit::ResourceLoadStatisticsStore::cancelPendingStatisticsProcessingRequest):
2747         (WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2748         (WebKit::ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2749         (WebKit::ResourceLoadStatisticsStore::setGrandfatheringTime):
2750         (WebKit::ResourceLoadStatisticsStore::setCacheMaxAgeCap):
2751         (WebKit::ResourceLoadStatisticsStore::updateCacheMaxAgeCap):
2752         (WebKit::ResourceLoadStatisticsStore::setAgeCapForClientSideCookies):
2753         (WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
2754         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
2755         (WebKit::ResourceLoadStatisticsStore::setDataRecordsBeingRemoved):
2756         (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains):
2757         (WebKit::ResourceLoadStatisticsStore::clearBlockingStateForDomains):
2758         (WebKit::ResourceLoadStatisticsStore::processStatistics const):
2759         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
2760         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
2761         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
2762         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
2763         (WebKit::ResourceLoadStatisticsStore::setMaxStatisticsEntries):
2764         (WebKit::ResourceLoadStatisticsStore::setPruneEntriesDownTo):
2765         (WebKit::ResourceLoadStatisticsStore::resetParametersToDefaultValues):
2766         (WebKit::ResourceLoadStatisticsStore::logTestingEvent):
2767         (WebKit::ResourceLoadStatisticsStore::removeAllStorageAccess):
2768         (WebKit::ResourceLoadStatisticsStore::didCreateNetworkProcess):
2769         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
2770         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: Copied from Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h.
2771         (WebKit::OperatingDate::OperatingDate):
2772         (WebKit::ResourceLoadStatisticsStore::isEmpty const):
2773         (WebKit::ResourceLoadStatisticsStore::data const):
2774         (WebKit::ResourceLoadStatisticsStore::isDebugModeEnabled const):
2775         (WebKit::ResourceLoadStatisticsStore::store const):
2776         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled):
2777         (WebKit::ResourceLoadStatisticsStore::setDebugLogggingEnabled):
2778         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Renamed from Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm.
2779         (WebKit::ResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2780         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2781         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2782         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2783         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
2784         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2785         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2786         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2787         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
2788         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
2789         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2790         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2791         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
2792         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2793         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
2794         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
2795         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
2796         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
2797         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
2798         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2799         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2800         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2801         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2802         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2803         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2804         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2805         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2806         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
2807         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
2808         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
2809         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2810         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2811         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2812         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2813         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2814         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2815         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
2816         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
2817         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
2818         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
2819         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
2820         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
2821         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2822         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2823         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
2824         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
2825         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
2826         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
2827         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
2828         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2829         * NetworkProcess/NetworkProcess.cpp:
2830         (WebKit::NetworkProcess::initializeNetworkProcess):
2831         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2832         (WebKit::NetworkProcessCreationParameters::encode const):
2833         (WebKit::NetworkProcessCreationParameters::decode):
2834         * NetworkProcess/NetworkProcessCreationParameters.h:
2835         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
2836         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
2837         * Platform/classifier/ResourceLoadStatisticsClassifier.h:
2838         * Shared/WebPreferences.yaml:
2839         * Sources.txt:
2840         * SourcesCocoa.txt:
2841         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2842         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2843         * UIProcess/WebProcessPool.cpp:
2844         * WebKit.xcodeproj/project.pbxproj:
2845
2846 2019-03-04  Zalan Bujtas  <zalan@apple.com>
2847
2848         [ContentChangeObserver] Introduce fixed duration content observation
2849         https://bugs.webkit.org/show_bug.cgi?id=195295
2850         <rdar://problem/48579913>
2851
2852         Reviewed by Simon Fraser.
2853
2854         * WebProcess/WebPage/ios/WebPageIOS.mm:
2855         (WebKit::WebPage::handleSyntheticClick):
2856
2857 2019-03-04  Truitt Savell  <tsavell@apple.com>
2858
2859         Unreviewed, rolling out r242396.
2860
2861         Found issue to be unrelated. reverting my rollout.
2862
2863         Reverted changeset:
2864
2865         "Unreviewed, rolling out r242222."
2866         https://bugs.webkit.org/show_bug.cgi?id=193683
2867         https://trac.webkit.org/changeset/242396
2868
2869 2019-03-04  Jiewen Tan  <jiewen_tan@apple.com>
2870
2871         Unreviewed, a followup after r242336
2872
2873         * UIProcess/WebPageProxy.cpp:
2874         (WebKit::WebPageProxy::webViewDidMoveToWindow):
2875         Copy the list of observers before iterating it to avoid observers modifying the list.
2876
2877 2019-03-04  Truitt Savell  <tsavell@apple.com>
2878
2879         Unreviewed, rolling out r242222.
2880
2881         Broke internal debug testing
2882
2883         Reverted changeset:
2884
2885         "[iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to
2886         the UI process."
2887         https://bugs.webkit.org/show_bug.cgi?id=193683
2888         https://trac.webkit.org/changeset/242222
2889
2890 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2891
2892         Unreviewed build fix after r242378
2893
2894         * UIProcess/ios/EditableImageController.mm:
2895         (WebKit::EditableImageController::associateWithAttachment):
2896
2897 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2898
2899         Check contextIDs when handling WebContent messages
2900         https://bugs.webkit.org/show_bug.cgi?id=195289
2901         <rdar://problem/48475870>
2902
2903         Reviewed by Alex Christensen.
2904
2905         The WebContent process is untrusted because it handles arbitrary markup and javascript from untrusted sources.
2906         We should handle its messages with suspicion, and make sure the arguments are valid and usable before honoring them.
2907
2908         This patch hardens the message passing layer by performing MESSAGE_CHECK in places that had been overlooked.
2909
2910         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2911         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
2912         (WebKit::PlaybackSessionManagerProxy::currentTimeChanged):
2913         (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged):
2914         (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged):
2915         (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged):
2916         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
2917         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
2918         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
2919         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
2920         (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
2921         (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
2922         (WebKit::PlaybackSessionManagerProxy::mutedChanged):
2923         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
2924         (WebKit::PlaybackSessionManagerProxy::durationChanged):
2925         (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged):
2926         (WebKit::PlaybackSessionManagerProxy::rateChanged):
2927         (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged):
2928         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
2929         (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const):
2930         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2931         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2932         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
2933         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
2934         (WebKit::UserMediaCaptureManagerProxy::end):
2935         (WebKit::UserMediaCaptureManagerProxy::capabilities):
2936         (WebKit::UserMediaCaptureManagerProxy::setMuted):
2937         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
2938         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2939         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
2940         (WebKit::VideoFullscreenManagerProxy::setHasVideo):
2941         (WebKit::VideoFullscreenManagerProxy::setVideoDimensions):
2942         (WebKit::VideoFullscreenManagerProxy::enterFullscreen):
2943         (WebKit::VideoFullscreenManagerProxy::exitFullscreen):
2944         (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
2945         (WebKit::VideoFullscreenManagerProxy::setInlineRect):
2946         (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer):
2947         (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen):
2948         (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline):
2949         (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
2950         * UIProcess/ios/EditableImageController.mm:
2951         (WebKit::EditableImageController::didCreateEditableImage):
2952         (WebKit::EditableImageController::didDestroyEditableImage):
2953         (WebKit::EditableImageController::associateWithAttachment):
2954
2955 2019-03-04  Alex Christensen  <achristensen@webkit.org>
2956
2957         Fix crashes when NetworkResourceLoader/NetworkLoadChecker are destroyed during HTTPS upgrade check
2958         https://bugs.webkit.org/show_bug.cgi?id=195238
2959         <rdar://problem/47598656>
2960
2961         Reviewed by Chris Dumez.
2962
2963         * NetworkProcess/NetworkLoadChecker.cpp:
2964         (WebKit::NetworkLoadChecker::checkRequest):
2965
2966 2019-03-04  Brady Eidson  <beidson@apple.com>
2967
2968         Correctly handle sandbox extensions when the same WKWebView loads multiple file:// URLs.
2969         <rdar://problem/47820581> and https://bugs.webkit.org/show_bug.cgi?id=195291
2970
2971         Reviewed by Andy Estes.
2972
2973         * WebProcess/WebPage/WebPage.cpp:
2974         (WebKit::shouldReuseCommittedSandboxExtension): Only retain the previous sandbox extension if the file URL
2975           we're currently loading is functionally equivalent to the previous one.
2976
2977 2019-03-04  Chris Dumez  <cdumez@apple.com>
2978
2979         Drop legacy userAgentForURL injected bundle SPI
2980         https://bugs.webkit.org/show_bug.cgi?id=195222
2981         <rdar://problem/46734147>
2982
2983         Reviewed by Darin Adler.
2984
2985         Drop legacy userAgentForURL injected bundle SPI. There are no longer any clients, and using
2986         WebsitePolicies.customUserAgent is the way to go nowadays.
2987
2988         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2989         (API::InjectedBundle::PageLoaderClient::willDestroyFrame):
2990         (API::InjectedBundle::PageLoaderClient::userAgentForURL const): Deleted.
2991         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
2992         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
2993         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2994         (setUpPageLoaderClient):
2995         (userAgentForURL): Deleted.
2996         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2997         (WebKit::InjectedBundlePageLoaderClient::userAgentForURL const): Deleted.
2998         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2999         * WebProcess/WebPage/WebPage.cpp:
3000         (WebKit::WebPage::userAgent const):
3001
3002 2019-03-04  Chris Dumez  <cdumez@apple.com>
3003
3004         Do not share WebProcesses between private and regular sessions
3005         https://bugs.webkit.org/show_bug.cgi?id=195189
3006         <rdar://problem/48421064>
3007
3008         Reviewed by Alex Christensen.
3009
3010         Do not share WebProcesses between private and regular sessions. There are some privacy concerns.
3011         Also, some of the WebsiteDataStore informations are passed via WebProcessCreationParameters (e.g.
3012         ApplicationCache path) and cannot be updated later.
3013
3014         There were 2 cases where this could happen and that are fixed in the patch:
3015         - A process may be prewarmed with a given website data store and then later on used for a page
3016           associated with a different data store. We now prevent this. While this is not necessary for
3017           privacy reasons, it is still useful because our code currently does not support well uses
3018           different sessions inside a single WebProcess, as mentioned above.
3019         - The client can force a WebsiteDataStore swap when responding to the decidePolicyForNavigationAction,
3020           via the WebsitePolicies. To address the issue, we now force a process swap whenever the client
3021           makes such a change.
3022
3023         As a result, WebProcessProxy::websiteDataStore() now makes sense and is always correct. It can
3024         also only contains pages whose WebPageProxy::websiteDataStore() returns the same store.
3025
3026         * UIProcess/API/C/WKContext.cpp:
3027         (WKContextWarmInitialProcess):
3028         * UIProcess/API/Cocoa/WKProcessPool.mm:
3029         (-[WKProcessPool _warmInitialProcess]):
3030         * UIProcess/ProvisionalPageProxy.cpp:
3031         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3032         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3033         * UIProcess/WebPageProxy.cpp:
3034         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
3035         (WebKit::WebPageProxy::reattachToWebProcess):
3036         (WebKit::WebPageProxy::swapToWebProcess):
3037         (WebKit::WebPageProxy::close):
3038         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3039         (WebKit::WebPageProxy::commitProvisionalPage):
3040         (WebKit::WebPageProxy::creationParameters):
3041         * UIProcess/WebPageProxy.h:
3042         (WebKit::WebPageProxy::websiteDataStore):
3043         * UIProcess/WebProcessPool.cpp:
3044         (WebKit::WebProcessPool::ensureNetworkProcess):
3045         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
3046         (WebKit::WebProcessPool::prewarmProcess):
3047         (WebKit::WebProcessPool::createWebPage):
3048         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
3049         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
3050         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3051         (WebKit::WebProcessPool::processForNavigation):
3052         (WebKit::WebProcessPool::processForNavigationInternal):
3053         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
3054         * UIProcess/WebProcessPool.h:
3055         (WebKit::WebProcessPool::sendToOneProcess):
3056         * UIProcess/WebProcessProxy.cpp:
3057         (WebKit::WebProcessProxy::createWebPage):
3058         (WebKit::WebProcessProxy::addExistingWebPage):
3059         (WebKit::WebProcessProxy::removeWebPage):
3060         * UIProcess/WebProcessProxy.h:
3061
3062 2019-03-04  Chris Dumez  <cdumez@apple.com>
3063
3064         [iOS] Improve our file picker
3065         https://bugs.webkit.org/show_bug.cgi?id=195284
3066         <rdar://problem/45655856>
3067
3068         Reviewed by Tim Horton and Wenson Hsieh.
3069
3070         Improve our file picker on iOS so that:
3071         - Accepted file extensions specified in the HTML (e.g. <input type="file"> accept=".pdf">) are now
3072           properly reflected in the file picker. Previously, we only we only supported MIME types in the
3073           accept attribute that only Image / Video ones.
3074         - If accepted types are specified in the HTML and not of them are Video or Image types, then bypass
3075           the UIDocumentMenuViewController and show the file picker directly (as if the user had tapped on
3076           "Browse..." on that menu). Other menu items such as "Take Photo or Video" and "Photo Library" do
3077           not make sense if the page only accepts PDF files for example.
3078
3079         Things that we should do but are not fixed in this patch:
3080         - Stop using UIDocumentMenuViewController entirely since it was deprecated in favor of using
3081           UIDocumentPickerViewController directly.
3082         - Add multiple selection support, which is supported both on the HTML side and in the
3083           UIDocumentPickerViewController API.
3084
3085         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3086         (arrayContainsUTIThatConformsTo):
3087         (-[WKFileUploadPanel dealloc]):
3088         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
3089         (UTIsForMIMETypes):
3090         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
3091         (-[WKFileUploadPanel _cameraButtonLabelAllowingPhoto:allowingVideo:]):
3092         (-[WKFileUploadPanel _showDocumentPickerMenu]):
3093
3094 2019-03-04  Alex Christensen  <achristensen@webkit.org>
3095
3096         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
3097         https://bugs.webkit.org/show_bug.cgi?id=194523
3098
3099         Reviewed by Ryosuke Niwa.
3100
3101         Attempt to work around a CFNetwork bug in the timing of tearing down tasks with upload streams.
3102         See rdar://problem/28233746.
3103
3104         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3105         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3106         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
3107         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3108         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
3109
3110 2019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3111
3112         [CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
3113         https://bugs.webkit.org/show_bug.cgi?id=195270
3114
3115         Reviewed by Don Olmstead.
3116
3117         Suspend the threaded compositor when the painting is paused or layer flush disabled, and resume it again when
3118         painting is resumed and layer flush enabled.
3119
3120         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3121         (WebKit::ThreadedCompositor::suspend): Increment the suspend counter and mark the scene as inactive if it was suspended.
3122         (WebKit::ThreadedCompositor::resume): Decrement the suspend counter and mark the scene as active if it's now resumed.
3123         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3124         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3125         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): Return early if layer tree state is frozen.
3126         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): Ditto.
3127         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3128         (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): Call ThreadedCompositor::suspend()/resume().
3129         (WebKit::LayerTreeHost::pauseRendering): Call ThreadedCompositor::suspend.
3130         (WebKit::LayerTreeHost::resumeRendering): Call ThreadedCompositor::resume().
3131
3132 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
3133
3134         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
3135         https://bugs.webkit.org/show_bug.cgi?id=195258
3136
3137         Reviewed by Antti Koivisto.
3138
3139         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
3140         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
3141         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
3142         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
3143
3144         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
3145         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
3146         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
3147         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
3148         references to GraphicsLayers before that becomes safe).
3149         
3150         The actual fix that allows overflow scrollbars to show is the change in
3151         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
3152         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
3153
3154         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
3155         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
3156         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
3157         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
3158         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
3159         * SourcesCocoa.txt:
3160         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3161         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
3162         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
3163         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
3164         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
3165         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
3166         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers):
3167         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
3168         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: Copied from Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp.
3169         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::create):
3170         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::ScrollingTreeOverflowScrollingNodeRemoteMac):
3171         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::~ScrollingTreeOverflowScrollingNodeRemoteMac):
3172         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::commitStateBeforeChildren):
3173         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::repositionRelatedLayers):
3174         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent):
3175         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleMouseEvent):
3176         * WebKit.xcodeproj/project.pbxproj:
3177
3178 2019-03-04  Andy Estes  <aestes@apple.com>
3179
3180         [Apple Pay] Move WebPaymentCoordinatorProxy from Source/WebKit/UIProcess to Source/WebKit/Shared
3181         https://bugs.webkit.org/show_bug.cgi?id=195080
3182         <rdar://problem/48421558>
3183
3184         Reviewed by Antti Koivisto.
3185
3186         * CMakeLists.txt:
3187         * DerivedSources-input.xcfilelist:
3188         * DerivedSources.make:
3189         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp.
3190         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h.
3191         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Renamed from Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in.
3192         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Renamed from Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h.
3193         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Renamed from Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm.
3194         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Renamed from Source/WebKit/UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm.
3195         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Renamed from Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm.
3196         * Shared/mac/WebHitTestResultData.mm:
3197         * SourcesCocoa.txt:
3198         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
3199         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
3200         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
3201         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3202         * WebKit.xcodeproj/project.pbxproj:
3203
3204 2019-03-04  Jer Noble  <jer.noble@apple.com>
3205
3206         [iOS] Fullscreen "stay in page" option breaks video playback
3207         https://bugs.webkit.org/show_bug.cgi?id=195277
3208         <rdar://problem/48537317>
3209
3210         Reviewed by Eric Carlson.
3211
3212         Make sure we resume media playback when the user chooses "stay in page" from the deceptive
3213         website warning dialog.
3214
3215         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3216         (-[WKFullScreenViewController _showPhishingAlert]):
3217
3218 2019-03-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3219
3220         [WPE] Enable web process sandbox
3221         https://bugs.webkit.org/show_bug.cgi?id=195169
3222
3223         Reviewed by Daniel Bates.
3224
3225         * PlatformWPE.cmake:
3226         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3227         (WebKit::bubblewrapSpawn):
3228         * UIProcess/glib/WebProcessPoolGLib.cpp:
3229         (WebKit::WebProcessPool::platformInitialize):
3230
3231 2019-03-04  Adrian Perez de Castro  <aperez@igalia.com>
3232
3233         [GTK][WPE] Wrong license header in WebKit{,WebExtension}Autocleanups.h
3234         https://bugs.webkit.org/show_bug.cgi?id=195245
3235
3236         Reviewed by Carlos Garcia Campos.
3237
3238         Changed license headers to contain the LGPL, which is the correct one for the GTK
3239         and WPE ports. The change was agreed by the contributors to the files involved.
3240
3241         * UIProcess/API/gtk/WebKitAutocleanups.h:
3242         * UIProcess/API/wpe/WebKitAutocleanups.h:
3243         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h:
3244         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h:
3245
3246 2019-03-04  Commit Queue  <commit-queue@webkit.org>
3247
3248         Unreviewed, rolling out r242045.
3249         https://bugs.webkit.org/show_bug.cgi?id=195273
3250
3251         WE not ready to enable PSON yet (Requested by KaL on #webkit).
3252
3253         Reverted changeset:
3254
3255         "[GTK] Enable PSON"
3256         https://bugs.webkit.org/show_bug.cgi?id=194979
3257         https://trac.webkit.org/changeset/242045
3258
3259 2019-03-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3260
3261         [CoordinatedGraphics] Unify DrawingArea classes
3262         https://bugs.webkit.org/show_bug.cgi?id=195167
3263
3264         Reviewed by Žan Doberšek.
3265
3266         Add DrawingAreaProxyCoordinatedGraphics and DrawingAreaCoordinatedGraphics.
3267
3268         * PlatformGTK.cmake:
3269         * PlatformWPE.cmake:
3270         * PlatformWin.cmake:
3271         * Shared/DrawingAreaInfo.h:
3272         * SourcesGTK.txt:
3273         * SourcesWPE.txt:
3274         * UIProcess/API/gtk/PageClientImpl.cpp:
3275         (WebKit::PageClientImpl::createDrawingAreaProxy):
3276         (WebKit::PageClientImpl::viewSize):
3277         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3278         (webkitWebViewBaseRealize):
3279         (webkitWebViewBaseUnrealize):
3280         (webkitWebViewBaseDraw):
3281         (webkitWebViewBaseSizeAllocate):
3282         (webkitWebViewBaseDidRelaunchWebProcess):
3283         (webkitWebViewBasePageClosed):
3284         * UIProcess/API/wpe/PageClientImpl.cpp:
3285         (WebKit::PageClientImpl::createDrawingAreaProxy):
3286         * UIProcess/AcceleratedDrawingAreaProxy.cpp: Removed.
3287         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: Added.
3288         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingAreaProxyCoordinatedGraphics):
3289         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics):
3290         (WebKit::DrawingAreaProxyCoordinatedGraphics::paint):
3291         (WebKit::DrawingAreaProxyCoordinatedGraphics::sizeDidChange):
3292         (WebKit::DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange):
3293         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForBackingStoreUpdateOnNextPaint):
3294         (WebKit::DrawingAreaProxyCoordinatedGraphics::setBackingStoreIsDiscardable):
3295         (WebKit::DrawingAreaProxyCoordinatedGraphics::update):
3296         (WebKit::DrawingAreaProxyCoordinatedGraphics::didUpdateBackingStoreState):
3297         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode):
3298         (WebKit::DrawingAreaProxyCoordinatedGraphics::exitAcceleratedCompositingMode):
3299         (WebKit::DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode):
3300         (WebKit::DrawingAreaProxyCoordinatedGraphics::incorporateUpdate):
3301         (WebKit::DrawingAreaProxyCoordinatedGraphics::alwaysUseCompositing const):
3302         (WebKit::DrawingAreaProxyCoordinatedGraphics::backingStoreStateDidChange):
3303         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
3304         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
3305         (WebKit::DrawingAreaProxyCoordinatedGraphics::discardBackingStoreSoon):
3306         (WebKit::DrawingAreaProxyCoordinatedGraphics::discardBackingStore):
3307         (WebKit::DrawingAreaProxyCoordinatedGraphics::setNativeSurfaceHandleForCompositing):
3308         (WebKit::DrawingAreaProxyCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing):
3309         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::DrawingMonitor):
3310         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::~DrawingMonitor):
3311         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::webViewDrawCallback):
3312         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::start):
3313         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::stop):
3314         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::didDraw):
3315         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
3316         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Renamed from Source/WebKit/UIProcess/AcceleratedDrawingAreaProxy.h.
3317         * UIProcess/DrawingAreaProxyImpl.cpp: Removed.
3318         * UIProcess/DrawingAreaProxyImpl.h: Removed.
3319         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
3320         (WebKit::AcceleratedBackingStoreX11::update):
3321         * UIProcess/win/PageClientImpl.cpp:
3322         (WebKit::PageClientImpl::createDrawingAreaProxy):
3323         * UIProcess/win/WebView.cpp:
3324         (WebKit::WebView::paint):
3325         * WebProcess/WebPage/AcceleratedDrawingArea.cpp: Removed.
3326         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: Added.
3327         (WebKit::DrawingAreaCoordinatedGraphics::DrawingAreaCoordinatedGraphics):
3328         (WebKit::DrawingAreaCoordinatedGraphics::~DrawingAreaCoordinatedGraphics):
3329         (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplay):
3330         (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect):
3331         (WebKit::DrawingAreaCoordinatedGraphics::scroll):
3332         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint):
3333         (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync):
3334         (WebKit::DrawingAreaCoordinatedGraphics::setLayerTreeStateIsFrozen):
3335         (WebKit::DrawingAreaCoordinatedGraphics::updatePreferences):
3336         (WebKit::DrawingAreaCoordinatedGraphics::mainFrameContentSizeChanged):
3337         (WebKit::DrawingAreaCoordinatedGraphics::deviceOrPageScaleFactorChanged):
3338         (WebKit::DrawingAreaCoordinatedGraphics::didChangeViewportAttributes):
3339         (WebKit::DrawingAreaCoordinatedGraphics::graphicsLayerFactory):
3340         (WebKit::DrawingAreaCoordinatedGraphics::setRootCompositingLayer):
3341         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
3342         (WebKit::DrawingAreaCoordinatedGraphics::layerHostDidFlushLayers):
3343         (WebKit::DrawingAreaCoordinatedGraphics::createDisplayRefreshMonitor):
3344         (WebKit::DrawingAreaCoordinatedGraphics::setNativeSurfaceHandleForCompositing):
3345         (WebKit::DrawingAreaCoordinatedGraphics::destroyNativeSurfaceHandleForCompositing):
3346         (WebKit::DrawingAreaCoordinatedGraphics::activityStateDidChange):
3347         (WebKit::DrawingAreaCoordinatedGraphics::attachViewOverlayGraphicsLayer):
3348         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
3349         (WebKit::DrawingAreaCoordinatedGraphics::didUpdate):
3350         (WebKit::DrawingAreaCoordinatedGraphics::sendDidUpdateBackingStoreState):
3351         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingModeSoon):
3352         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingModeNow):
3353         (WebKit::DrawingAreaCoordinatedGraphics::discardPreviousLayerTreeHost):
3354         (WebKit::DrawingAreaCoordinatedGraphics::suspendPainting):
3355         (WebKit::DrawingAreaCoordinatedGraphics::resumePainting):
3356         (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode):
3357         (WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode):
3358         (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay):
3359         (WebKit::DrawingAreaCoordinatedGraphics::displayTimerFired):
3360         (WebKit::DrawingAreaCoordinatedGraphics::display):
3361         (WebKit::shouldPaintBoundsRect):
3362         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: Renamed from Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h.
3363         * WebProcess/WebPage/DrawingArea.cpp:
3364         (WebKit::DrawingArea::create):
3365         * WebProcess/WebPage/DrawingArea.h:
3366         (WebKit::DrawingArea::layerFlushThrottlingIsActive const):
3367         * WebProcess/WebPage/DrawingAreaImpl.cpp: Removed.
3368         * WebProcess/WebPage/DrawingAreaImpl.h: Removed.
3369
3370 2019-03-03  Zalan Bujtas  <zalan@apple.com>
3371
3372         [ContentChangeObserver] Content observation should be limited to the current document.
3373         https://bugs.webkit.org/show_bug.cgi?id=195256
3374         <rdar://problem/48544402>
3375
3376         Reviewed by Simon Fraser.
3377
3378         * WebProcess/WebPage/WebPage.h:
3379         * WebProcess/WebPage/ios/WebPageIOS.mm:
3380         (WebKit::WebPage::handleSyntheticClick):
3381         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
3382         (WebKit::WebPage::completeSyntheticClick):
3383         (WebKit::WebPage::handleTap):
3384         (WebKit::WebPage::handleTwoFingerTapAtPoint):
3385         (WebKit::WebPage::commitPotentialTap):
3386
3387 2019-03-03  Tim Horton  <timothy_horton@apple.com>
3388
3389         Rid the world of WK_API_ENABLED
3390         https://bugs.webkit.org/show_bug.cgi?id=195263
3391
3392         Reviewed by Dan Bernstein.
3393
3394         List of changed files elided because it's useless.
3395
3396 2019-03-03  Jiewen Tan  <jiewen_tan@apple.com>
3397
3398         Add a WebViewDidMoveToWindowObserver for WKWebView
3399         https://bugs.webkit.org/show_bug.cgi?id=195223
3400         <rdar://problem/48520161>
3401
3402         Reviewed by Darin Adler.
3403
3404         The load optimizer would only allow itself to optimize loads whenever the web view
3405         who owns the page is (visible && focused), otherwises it will wait until the web view
3406         becomes (visible && focused). Therefore, we need a way to notify the load optimizer
3407         changes of statuses.
3408
3409         * UIProcess/API/Cocoa/WKWebView.mm:
3410         (-[WKWebView didMoveToWindow]):
3411         * UIProcess/Cocoa/WebViewImpl.mm:
3412         (WebKit::WebViewImpl::viewDidMoveToWindow):
3413         * UIProcess/WebPageProxy.cpp:
3414         (WebKit::WebPageProxy::addWebViewDidMoveToWindowObserver):
3415         (WebKit::WebPageProxy::removeWebViewDidMoveToWindowObserver):
3416         (WebKit::WebPageProxy::webViewDidMoveToWindow):
3417         * UIProcess/WebPageProxy.h:
3418         * UIProcess/WebViewDidMoveToWindowObserver.h: Added.
3419         * WebKit.xcodeproj/project.pbxproj:
3420
3421 2019-03-03  Andy Estes  <aestes@apple.com>
3422
3423         [Apple Pay] Untangle WebPageProxy and WebPaymentCoordinatorProxy
3424         https://bugs.webkit.org/show_bug.cgi?id=195219
3425         <rdar://problem/48518082>
3426
3427         Reviewed by Darin Adler.
3428
3429         Rather than having WebPaymentCoordinatorProxy know about WebPageProxy, give
3430         WebPaymentCoordinatorProxy a client interface that WebPageProxy conforms to.
3431
3432         In a follow-on patch, WebPaymentCoordinatorProxy will have a non-WebPageProxy client.
3433
3434         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
3435         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Replaced use of
3436         m_webPageProxy with m_client.
3437         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Ditto.
3438         (WebKit::WebPaymentCoordinatorProxy::messageSenderConnection const): Implemented
3439         IPC::MessageSender via m_client.
3440         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Ditto.
3441         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Replaced use of
3442         m_webPageProxy with m_client.
3443         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup): Ditto.
3444         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Called our own
3445         MessageSender::send rather than going through m_webPageProxy.
3446         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Ditto.
3447         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Ditto.
3448         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Ditto.
3449         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Ditto.
3450         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Ditto.
3451         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h: Defined the Client abstract class and
3452         changed m_webPageProxy to m_client.
3453         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
3454         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3455         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Replaced use of
3456         m_webPageProxy with m_client.
3457         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Renamed from toPKPaymentRequest.
3458         (WebKit::toPKPaymentRequest): Renamed to WebPaymentCoordinatorProxy::platformPaymentRequest.
3459         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3460         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Replaced use of m_webPageProxy
3461         with m_client.
3462         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3463         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
3464         * UIProcess/AuxiliaryProcessProxy.h:
3465         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Added.
3466         * UIProcess/WebPageProxy.cpp:
3467         (WebKit::WebPageProxy::paymentCoordinatorConnection): Implemented WebPaymentCoordinatorProxy::Client.
3468         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
3469         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
3470         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
3471         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
3472         * UIProcess/WebPageProxy.h: Made WebPageProxy derive from WebPaymentCoordinatorProxy::Client.
3473         * UIProcess/ios/WebPageProxyIOS.mm:
3474         (WebKit::WebPageProxy::paymentCoordinatorPresentingViewController): Implemented WebPaymentCoordinatorProxy::Client.
3475         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Ditto.
3476         * UIProcess/mac/WebPageProxyMac.mm:
3477         (WebKit::WebPageProxy::paymentCoordinatorPresentingWindow): Ditto.
3478         * WebKit.xcodeproj/project.pbxproj:
3479
3480 2019-03-03  Tim Horton  <timothy_horton@apple.com>
3481
3482         Remove some more unused 32-bit code
3483         https://bugs.webkit.org/show_bug.cgi?id=195255
3484
3485         Reviewed by Darin Adler.
3486
3487         * Platform/Module.cpp:
3488         (WebKit::Module::Module):
3489         * Platform/Module.h:
3490         * Platform/cf/ModuleCF.cpp:
3491         (WebKit::Module::unload):
3492         (WebKit::Module::bundleResourceMap): Deleted.
3493         * PluginProcess/mac/PluginProcessMac.mm:
3494         (WebKit::initializeShim):
3495         (WebKit::PluginProcess::platformInitializeProcess):
3496         (WebKit::shouldCallRealDebugger): Deleted.
3497         (WebKit::isWindowActive): Deleted.
3498         (WebKit::getCurrentEventButtonState): Deleted.
3499         (WebKit::carbonWindowShown): Deleted.
3500         (WebKit::carbonWindowHidden): Deleted.
3501         (WebKit::openCFURLRef): Deleted.
3502         (WebKit::isMallocTinyMemoryTag): Deleted.
3503         (WebKit::shouldMapMemoryExecutable): Deleted.
3504         * PluginProcess/mac/PluginProcessShim.h:
3505         * PluginProcess/mac/PluginProcessShim.mm:
3506         (WebKit::shimDebugger): Deleted.
3507         (WebKit::shimGetCurrentEventButtonState): Deleted.
3508         (WebKit::shimIsWindowActive): Deleted.
3509         (WebKit::shimModalDialog): Deleted.
3510         (WebKit::shimAlert): Deleted.
3511         (WebKit::shimShowWindow): Deleted.
3512         (WebKit::shimHideWindow): Deleted.
3513         (WebKit::shimLSOpenCFURLRef): Deleted.
3514         (WebKit::shimMachVMMap): Deleted.
3515         * Shared/API/Cocoa/WKFoundation.h:
3516         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
3517         (WebKit::XPCServiceMain):
3518         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
3519         (WebKit::NetscapePluginModule::tryLoad):
3520         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
3521         (WebKit::getPluginArchitecture):
3522         (WebKit::NetscapePluginModule::determineQuirks):
3523         * Shared/Plugins/PluginQuirks.h:
3524         * Shared/cf/ArgumentCodersCF.cpp:
3525         (IPC::sizeForNumberType):
3526         * Shared/mac/WebEventFactory.mm:
3527         (WebKit::mouseButtonForEvent):
3528         (WebKit::globalPointForEvent):
3529         (WebKit::pointForEvent):
3530         (WebKit::WebEventFactory::createWebMouseEvent):
3531         * UIProcess/API/C/mac/WKPagePrivateMac.h:
3532         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
3533         (WKPageLoadFileReturningNavigation):
3534         * UIProcess/Cocoa/WebViewImpl.mm:
3535         (WebKit::WebViewImpl::pressureChangeWithEvent):
3536         * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
3537         (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
3538         * UIProcess/mac/ServicesController.mm:
3539         (WebKit::ServicesController::ServicesController):
3540         * UIProcess/mac/WebContextMenuProxyMac.mm:
3541         (WebKit::WebContextMenuProxyMac::setupServicesMenu):
3542         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
3543         (WebKit::NPN_GetValue):
3544         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
3545         (WebKit::NetscapePlugin::NetscapePlugin):
3546         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
3547         (WebKit::NetscapePlugin::isWindowActive const): Deleted.
3548         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
3549         (WebKit::NetscapePlugin::setDrawingModel):
3550         (WebKit::NetscapePlugin::setEventModel):
3551         (WebKit::NetscapePlugin::platformPostInitialize):
3552         (WebKit::NetscapePlugin::platformDestroy):
3553         (WebKit::NetscapePlugin::platformGeometryDidChange):
3554         (WebKit::NetscapePlugin::platformPaint):
3555         (WebKit::NetscapePlugin::platformHandleMouseEvent):
3556         (WebKit::NetscapePlugin::platformHandleWheelEvent):
3557         (WebKit::NetscapePlugin::platformHandleMouseEnterEvent):
3558         (WebKit::NetscapePlugin::platformHandleMouseLeaveEvent):
3559         (WebKit::NetscapePlugin::platformHandleKeyboardEvent):
3560         (WebKit::NetscapePlugin::platformSetFocus):
3561         (WebKit::NetscapePlugin::windowFocusChanged):
3562         (WebKit::NetscapePlugin::windowAndViewFramesChanged):
3563         (WebKit::NetscapePlugin::sendComplexTextInput):
3564         (): Deleted.
3565         (WebKit::windowMap): Deleted.
3566         (WebKit::NetscapePlugin::netscapePluginFromWindow): Deleted.
3567         (WebKit::NetscapePlugin::windowRef const): Deleted.
3568         (WebKit::NetscapePlugin::updateFakeWindowBounds): Deleted.
3569         (WebKit::NetscapePlugin::buttonState): Deleted.
3570         (WebKit::initializeEventRecord): Deleted.
3571         (WebKit::anyMouseButtonIsDown): Deleted.
3572         (WebKit::rightMouseButtonIsDown): Deleted.
3573         (WebKit::modifiersForEvent): Deleted.
3574         (WebKit::convertStringToKeyCodes): Deleted.
3575         (WebKit::scriptCodeFromCurrentKeyboardInputSource): Deleted.
3576         (WebKit::NetscapePlugin::nullEventTimerFired): Deleted.
3577
3578 2019-03-02  Zalan Bujtas  <zalan@apple.com>
3579
3580         [ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
3581         https://bugs.webkit.org/show_bug.cgi?id=195252
3582         <rdar://problem/48539446>
3583
3584         Reviewed by Simon Fraser.
3585
3586         * WebProcess/WebPage/ios/WebPageIOS.mm:
3587         (WebKit::WebPage::handleSyntheticClick):
3588
3589 2019-03-02  Tim Horton  <timothy_horton@apple.com>
3590
3591         Move EditingRange <-> Range methods to EditingRange instead of WebPage
3592         https://bugs.webkit.org/show_bug.cgi?id=195201
3593
3594         Reviewed by Sam Weinig.
3595
3596         * Shared/EditingRange.h:
3597         * Shared/EditingRange.cpp:
3598         Also, modernize the coders.
3599
3600         * Sources.txt:
3601         * WebKit.xcodeproj/project.pbxproj:
3602         * WebProcess/WebPage/WebPage.cpp:
3603         (WebKit::WebPage::insertTextAsync):
3604         (WebKit::WebPage::getMarkedRangeAsync):
3605         (WebKit::WebPage::getSelectedRangeAsync):
3606         (WebKit::WebPage::characterIndexForPointAsync):
3607         (WebKit::WebPage::firstRectForCharacterRangeAsync):
3608         (WebKit::WebPage::setCompositionAsync):
3609         (WebKit::WebPage::rangeFromEditingRange): Deleted.
3610         * WebProcess/WebPage/mac/WebPageMac.mm:
3611         (WebKit::WebPage::insertDictatedTextAsync):
3612         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
3613
3614 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3615
3616         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
3617         https://bugs.webkit.org/show_bug.cgi?id=195053
3618         <rdar://problem/48134710>
3619
3620         Reviewed by Ryosuke Niwa.
3621
3622         Add support for automatically granting programmatic pasteboard access when the pasteboard identifier of the
3623         document requesting programmatic paste matches the identifier in the custom pasteboard data blob in the
3624         UIPasteboard. To do this, we send the pasteboard identifier of the document requesting the DOM paste to the UI
3625         process, and check this against the pasteboard identifiers for each item on the platform pasteboard. If all
3626         items in the platform pasteboard match the given pasteboard identifier (since we don't support writing multiple
3627         pasteboard items via bindings, this should only be a single item), we skip showing the paste callout and
3628         immediately invoke the programmatic paste handler.
3629
3630         * Scripts/webkit/messages.py:
3631         * UIProcess/API/gtk/PageClientImpl.cpp:
3632         (WebKit::PageClientImpl::requestDOMPasteAccess):
3633         * UIProcess/API/gtk/PageClientImpl.h:
3634         * UIProcess/API/wpe/PageClientImpl.cpp:
3635         (WebKit::PageClientImpl::requestDOMPasteAccess):
3636         * UIProcess/API/wpe/PageClientImpl.h:
3637         * UIProcess/PageClient.h:
3638         * UIProcess/WebPageProxy.cpp:
3639         (WebKit::WebPageProxy::requestDOMPasteAccess):
3640         * UIProcess/WebPageProxy.h:
3641         * UIProcess/WebPageProxy.messages.in:
3642
3643         Add plumbing to deliver the pasteboard identifier to the client when requesting DOM paste.
3644
3645         * UIProcess/ios/PageClientImplIOS.h:
3646         * UIProcess/ios/PageClientImplIOS.mm:
3647         (WebKit::PageClientImpl::requestDOMPasteAccess):
3648         * UIProcess/ios/WKContentViewInteraction.h:
3649         * UIProcess/ios/WKContentViewInteraction.mm:
3650         (-[WKContentView cleanupInteraction]):
3651         (-[WKContentView resignFirstResponderForWebView]):
3652         (-[WKContentView _webTouchEventsRecognized:]):
3653         (-[WKContentView _willHideMenu:]):
3654         (-[WKContentView pasteForWebView:]):
3655         (-[WKContentView _handleDOMPasteRequestWithResult:]):
3656         (-[WKContentView _willPerformAction:sender:]):
3657         (-[WKContentView _didPerformAction:sender:]):
3658         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
3659         (allPasteboardItemOriginsMatchOrigin):
3660         (-[WKContentView _requestDOMPasteAccessWithElementRect:originIdentifier:completionHandler:]):
3661         (-[WKContentView _requestDOMPasteAccessWithElementRect:completionHandler:]): Deleted.
3662
3663         Bail early in the case where all items' pasteboard identifiers (read via custom pasteboard data) match. When
3664         this happens, we only grant access for the current paste command, rather than granting access for the user
3665         gesture token.
3666
3667         * UIProcess/mac/PageClientImplMac.h:
3668         * UIProcess/win/PageClientImpl.cpp:
3669         (WebKit::PageClientImpl::requestDOMPasteAccess):
3670         * UIProcess/win/PageClientImpl.h:
3671         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3672         (WebKit::WebEditorClient::requestDOMPasteAccess):
3673         * WebProcess/WebCoreSupport/WebEditorClient.h:
3674         * WebProcess/WebPage/WebPage.cpp:
3675         (WebKit::WebPage::requestDOMPasteAccess):
3676         * WebProcess/WebPage/WebPage.h:
3677
3678 2019-02-27  Darin Adler  <darin@apple.com>
3679
3680         Fixed makeString(float) to do shortest-form serialization without first converting to double
3681         https://bugs.webkit.org/show_bug.cgi?id=195142
3682
3683         Reviewed by Daniel Bates.
3684
3685         * UIProcess/PerActivityStateCPUUsageSampler.cpp: Removed unneeded include of DecimalNumber.h.
3686
3687 2019-03-02  Adrian Perez de Castro  <aperez@igalia.com>
3688
3689         [WPE] Public API headers are missing autocleanup definitions
3690         https://bugs.webkit.org/show_bug.cgi?id=195211
3691
3692         Reviewed by Philippe Normand.
3693
3694         * PlatformWPE.cmake: List new API headers as installable.
3695         * UIProcess/API/wpe/WebKitAutocleanups.h: Added. This is a copy of the header from the GTK
3696         port, adapted to fit the WPE port.
3697         * UIProcess/API/wpe/webkit.h: Add inclusion of WebKitAutocleanups.h
3698         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h: Added. Also adapted
3699         from the equivalent header of the GTK port.
3700         * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h: Add inclusion of
3701         WebKitWebExtensionAutocleanups.h
3702
3703 2019-03-02  Michael Catanzaro  <mcatanzaro@igalia.com>
3704
3705         Remove unused WebPageProxy::m_navigationID
3706         https://bugs.webkit.org/show_bug.cgi?id=195209
3707
3708         Reviewed by Darin Adler.
3709
3710         WebPageProxy::m_navigationID is never assigned to and is only used once by mistake in a
3711         debug LOG(). It must be a refactoring mistake.
3712
3713         * UIProcess/WebPageProxy.cpp:
3714         (WebKit::WebPageProxy::didCommitLoadForFrame):
3715         * UIProcess/WebPageProxy.h:
3716
3717 2019-03-01  Darin Adler  <darin@apple.com>
3718
3719         Finish removing String::format
3720         https://bugs.webkit.org/show_bug.cgi?id=194893
3721
3722         Reviewed by Daniel Bates.
3723
3724         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3725         (WebKit::LocalAuthenticator::getAssertion): Use makeString, attempting to fix
3726         a problem where we passed an NSData * to format with a "%s"."
3727
3728 2019-03-01  Chris Dumez  <cdumez@apple.com>
3729
3730         Unreviewed Windows build fix after r242302.
3731
3732         * UIProcess/WebProcessPool.cpp:
3733         (WebKit::WebProcessPool::ensureNetworkProcess):
3734
3735 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3736
3737         NetworkDataTask redirection should not keep alive its NetworkSession
3738         https://bugs.webkit.org/show_bug.cgi?id=194927
3739
3740         Reviewed by Darin Adler.
3741
3742         This should fix rdar://problem/47580502
3743
3744         * NetworkProcess/NetworkDataTask.h:
3745         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3746         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3747
3748 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3749
3750         Revert r241223, r241235, and r241287
3751         https://bugs.webkit.org/show_bug.cgi?id=194427
3752         <rdar://48045861>
3753
3754         This caused crashes, and feature design has evolved away from needing the daemon in this form.
3755
3756         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
3757         (WebKit::DaemonMain):
3758         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
3759         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
3760         (WebKit::XPCServiceEventHandler):
3761         (WebKit::XPCServiceMain):
3762         (WebKit::XPCEventHandler): Deleted.
3763         (WebKit::XPCInitializationHandler): Deleted.
3764         * UIProcess/API/APIProcessPoolConfiguration.h:
3765         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3766         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3767         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]): Deleted.
3768         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]): Deleted.
3769         * UIProcess/AuxiliaryProcessProxy.cpp:
3770         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
3771         * UIProcess/Launcher/ProcessLauncher.h:
3772         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3773         (WebKit::serviceName):
3774         (WebKit::ProcessLauncher::launchProcess):
3775         * UIProcess/Network/NetworkProcessProxy.cpp:
3776         (WebKit::NetworkProcessProxy::getLaunchOptions):
3777         * UIProcess/WebProcessPool.cpp:
3778         (WebKit::WebProcessPool::usesNetworkingDaemon const): Deleted.
3779         * UIProcess/WebProcessPool.h:
3780
3781 2019-03-01  Alex Christensen  <achristensen@webkit.org>
3782
3783         Add setters on WKWebsiteDataStore for sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
3784         https://bugs.webkit.org/show_bug.cgi?id=195229
3785         <rdar://problem/48520362>
3786
3787         Reviewed by Chris Dumez.
3788
3789         Just like _setBoundInterfaceIdentifier, we need a way to set these properties after instantiation of a WKWebsiteDataStore,
3790         but we need to make sure we don't set it after the parameters have been copied to the NetworkProcess.
3791
3792         Functionality verified by manual testing.  See radar.
3793         Added an API test that verifies the setter restrictions work as expected.
3794
3795         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3796         (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
3797         (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
3798         (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
3799         (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
3800         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3801         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3802         (WebKit::toPKPaymentRequest):
3803         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3804         (WebKit::WebsiteDataStore::parameters):
3805         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3806         (WebKit::WebsiteDataStore::WebsiteDataStore):
3807         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
3808         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
3809         * UIProcess/WebsiteData/WebsiteDataStore.h:
3810         (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier):
3811         (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier):
3812
3813 2019-03-01  Antoine Quint  <graouts@apple.com>
3814
3815         [iOS] Turn mouse event simulation on by default
3816         https://bugs.webkit.org/show_bug.cgi?id=195218
3817         <rdar://problem/48516794>
3818
3819         Reviewed by Dean Jackson.
3820
3821         * Shared/WebPreferences.yaml:
3822
3823 2019-03-01  Ross Kirsling  <ross.kirsling@sony.com>
3824
3825         EnvironmentUtilities::stripValuesEndingWithString isn't thread-safe
3826         https://bugs.webkit.org/show_bug.cgi?id=194612
3827
3828         Reviewed by Alex Christensen.
3829
3830         This API test really shouldn't be verifying that the actual environment was successfully modified.
3831
3832         At its core, stripValuesEndingWithString is really just split-filter-join. By replacing it with a pair of
3833         simple functions -- one for string processing, one for environment processing -- the API test only needs to
3834         worry about the former.
3835
3836         * Platform/unix/EnvironmentUtilities.cpp:
3837         (WebKit::EnvironmentUtilities::stripEntriesEndingWith):
3838         (WebKit::EnvironmentUtilities::removeValuesEndingWith):
3839         (WebKit::EnvironmentUtilities::stripValuesEndingWithString): Deleted.
3840         * Platform/unix/EnvironmentUtilities.h:
3841         Replace old function with a pair of simpler ones.
3842
3843         * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm:
3844         (NetworkServiceInitializer):
3845         * PluginProcess/EntryPoint/Cocoa/XPCService/PluginServiceEntryPoint.mm:
3846         (PluginServiceInitializer):
3847         * WebProcess/EntryPoint/Cocoa/XPCService/WebContentServiceEntryPoint.mm:
3848         (WebContentServiceInitializer):
3849         Update function name.
3850
3851 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
3852
3853         Unify WebsiteDataStore::defaultDataStoreConfiguration across ports
3854         https://bugs.webkit.org/show_bug.cgi?id=194844
3855
3856         Reviewed by Youenn Fablet.
3857
3858         Move the Cocoa implementation into APIWebsiteDataStore.cpp as the source of truth and
3859         append configuration for Glib's DeviceIdHashSalts storage directory. This also fixes
3860         a crash in Windows when running a Service Worker.
3861
3862         * UIProcess/API/APIWebsiteDataStore.cpp:
3863         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
3864         (API::WebsiteDataStore::defaultDataStoreConfiguration):
3865         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3866         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): Deleted.
3867         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
3868         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
3869         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
3870         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
3871         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): Deleted.
3872         (API::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
3873
3874 2019-03-01  John Wilander  <wilander@apple.com>
3875
3876         Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
3877         https://bugs.webkit.org/show_bug.cgi?id=195196
3878         <rdar://problem/48006419>
3879
3880         Reviewed by Brent Fulgham.
3881
3882         Trackers abuse link query parameters to transport user identifiers cross-site.
3883         This patch detects such navigations and applies further restrictions to
3884         client-site cookies on the destination page.
3885
3886         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3887         (WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics):
3888         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): Deleted.
3889             Renamed NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics().
3890         * NetworkProcess/NetworkConnectionToWebProcess.h:
3891         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3892         * NetworkProcess/NetworkProcess.cpp:
3893         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
3894             Reporting IPC message when a link decorated cross-site navigation happens.
3895         (WebKit::NetworkProcess::resetCrossSiteLoadsWithLinkDecorationForTesting):
3896         * NetworkProcess/NetworkProcess.h:
3897         * NetworkProcess/NetworkProcess.messages.in:
3898         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3899         (WKWebsiteDataStoreStatisticsResetToConsistentState):
3900             Added clearing of the new state between test runs.