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