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