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