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