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