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