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