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