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