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