0172a14409945b007a8c5d05605c47f00e6e397e
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-10-15  Andres Gonzalez  <andresg_22@apple.com>
2
3         AX: Make AXIsolatedTree compile again
4         https://bugs.webkit.org/show_bug.cgi?id=202702
5         <rdar://problem/56084968>
6
7         Reviewed by Joanmarie Diggs.
8
9         Re-submitting r251045 with a fix for internal builds.
10
11         * Platform/spi/mac/AccessibilityPrivSPI.h:
12         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
13         (-[WKAccessibilityWebPageObjectBase isolatedTreeRootObject]):
14
15 2019-10-15  Chris Dumez  <cdumez@apple.com>
16
17         Webview's drawing area may stay frozen on cross-site back/forward navigation
18         https://bugs.webkit.org/show_bug.cgi?id=203004
19
20         Reviewed by Tim Horton.
21
22         Whenever the UIScene becomes foreground / background, the WebPageProxy notifies its currently associated
23         WebPage in the committed WebProcess so that it can freeze / unfreeze its layer tree with the
24         BackgroundApplication reason. The issue is that if a WebPage gets suspended on cross-site navigation
25         (because the UIScene is in the background when the load commits), then the suspended WebPage kept its
26         a BackgroundApplication freeze. When the UIScene becomes foreground, the WebPage only notifies its
27         committed page so the suspended page keeps its BackgroundApplication freeze still. If the user now
28         navigates back, it will restore the suspended WebPage and the view will stay frozen.
29
30         To address the issue, we now have the WebPage drop its BackgroundApplication freeze reason, whenever
31         it transitions from committed to suspended.
32
33         * UIProcess/ios/WKApplicationStateTrackingView.mm:
34         (-[WKApplicationStateTrackingView didMoveToWindow]):
35         Fix logging, [self isBackground] needs to be called *after* _applicationStateTracker has been
36         initialized, or it will return YES unconditionally.
37
38         * WebProcess/WebPage/WebPage.cpp:
39         (WebKit::WebPage::setIsSuspended):
40
41 2019-10-15  Peng Liu  <peng.liu6@apple.com>
42
43         [Picture-in-Picture Web API] Implement HTMLVideoElement.requestPictureInPicture() / Document.exitPictureInPicture()
44         https://bugs.webkit.org/show_bug.cgi?id=201024
45
46         Reviewed by Eric Carlson.
47
48         Add configurations for Picture-in-Picture API and add a preference option for it.
49
50         * Configurations/FeatureDefines.xcconfig:
51         * Shared/WebPreferences.yaml:
52
53 2019-10-15  youenn fablet  <youenn@apple.com>
54
55         Move headers to keep from a HTTPHeaderNameSet to an OptionSet
56         https://bugs.webkit.org/show_bug.cgi?id=202977
57
58         Reviewed by Anders Carlsson.
59
60         * NetworkProcess/NetworkResourceLoadParameters.cpp:
61         (WebKit::NetworkResourceLoadParameters::decode):
62         * NetworkProcess/NetworkResourceLoadParameters.h:
63
64 2019-10-15  Jiewen Tan  <jiewen_tan@apple.com>
65
66         [WebAuthn] Rename -[WKUIDelegatePrivate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:] to -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
67         https://bugs.webkit.org/show_bug.cgi?id=202564
68         <rdar://problem/55974027>
69
70         Reviewed by Brent Fulgham.
71
72         Rename the SPI to a proper SPI style.
73
74         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
75         * UIProcess/Cocoa/UIDelegate.mm:
76         (WebKit::UIDelegate::setDelegate):
77         (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
78
79 2019-10-15  youenn fablet  <youenn@apple.com>
80
81         Scheduling a service worker job in server should wait for finishing the registration import
82         https://bugs.webkit.org/show_bug.cgi?id=202975
83
84         Reviewed by Chris Dumez.
85
86         * WebProcess/Storage/WebSWClientConnection.cpp:
87         (WebKit::WebSWClientConnection::scheduleJobInServer):
88         We should not schedule a job until the registrations are fully imported.
89         Covered by ServiceWorkerBasic API test flakily hitting debug asserts.
90
91 2019-10-15  Alex Christensen  <achristensen@webkit.org>
92
93         Unreviewed, rolling out r251138.
94
95         Broke API tests
96
97         Reverted changeset:
98
99         "Pass CORS-enabled schemes through WebProcess instead of
100         having them NetworkProcess-global"
101         https://bugs.webkit.org/show_bug.cgi?id=202891
102         https://trac.webkit.org/changeset/251138
103
104 2019-10-15  Chris Dumez  <cdumez@apple.com>
105
106         Stop using inheritance for WebBackForwardCacheEntry
107         https://bugs.webkit.org/show_bug.cgi?id=202989
108
109         Reviewed by Alex Christensen.
110
111         Stop using inheritance for WebBackForwardCacheEntry. This simplifies the code a bit.
112
113         * Sources.txt:
114         * UIProcess/WebBackForwardCache.cpp:
115         (WebKit::WebBackForwardCache::addEntry):
116         (): Deleted.
117         * UIProcess/WebBackForwardCacheEntry.cpp: Copied from Source/WebKit/UIProcess/WebBackForwardCacheEntry.h.
118         (WebKit::WebBackForwardCacheEntry::WebBackForwardCacheEntry):
119         (WebKit::WebBackForwardCacheEntry::~WebBackForwardCacheEntry):
120         (WebKit::WebBackForwardCacheEntry::takeSuspendedPage):
121         (WebKit::WebBackForwardCacheEntry::process const):
122         * UIProcess/WebBackForwardCacheEntry.h:
123         (WebKit::WebBackForwardCacheEntry::suspendedPage const):
124         (WebKit::WebBackForwardCacheEntry::processIdentifier const):
125         (WebKit::WebBackForwardCacheEntry::WebBackForwardCacheEntry): Deleted.
126         * WebKit.xcodeproj/project.pbxproj:
127
128 2019-10-15  Alex Christensen  <achristensen@webkit.org>
129
130         Pass CORS-enabled schemes through WebProcess instead of having them NetworkProcess-global
131         https://bugs.webkit.org/show_bug.cgi?id=202891
132
133         Reviewed by Youenn Fablet.
134
135         No change in behavior.  Now the LegacySchemeRegistry is not used as much in the NetworkProcess, a step towards no use at all.
136         This functionality is currently only available through the glib API webkit_security_manager_register_uri_scheme_as_cors_enabled
137         but it has been requested in bug 201180 and bug 199064.
138
139         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
140         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
141         (WebKit::NetworkConnectionToWebProcess::loadPing):
142         (WebKit::NetworkConnectionToWebProcess::registerURLSchemesAsCORSEnabled):
143         * NetworkProcess/NetworkConnectionToWebProcess.h:
144         (WebKit::NetworkConnectionToWebProcess::schemeRegistry):
145         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
146         * NetworkProcess/NetworkLoadChecker.cpp:
147         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
148         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
149         * NetworkProcess/NetworkLoadChecker.h:
150         * NetworkProcess/NetworkProcess.cpp:
151         (WebKit::NetworkProcess::initializeNetworkProcess):
152         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const): Deleted.
153         * NetworkProcess/NetworkProcess.messages.in:
154         * NetworkProcess/NetworkProcessCreationParameters.cpp:
155         (WebKit::NetworkProcessCreationParameters::encode const):
156         (WebKit::NetworkProcessCreationParameters::decode):
157         * NetworkProcess/NetworkProcessCreationParameters.h:
158         * NetworkProcess/NetworkResourceLoader.cpp:
159         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
160         * NetworkProcess/NetworkSchemeRegistry.cpp: Added.
161         (WebKit::NetworkSchemeRegistry::registerURLSchemeAsCORSEnabled):
162         (WebKit::NetworkSchemeRegistry::shouldTreatURLSchemeAsCORSEnabled):
163         * NetworkProcess/NetworkSchemeRegistry.h: Added.
164         (WebKit::NetworkSchemeRegistry::create):
165         * NetworkProcess/PingLoad.cpp:
166         (WebKit::PingLoad::PingLoad):
167         Use nullptr, indicating that the PingLoad constructor that is used in ad click attribution should not check the custom scheme registry.
168         This is Ok because ad click attribution is only used for HTTP family schemes.
169         (WebKit::m_blobFiles):
170         * NetworkProcess/PingLoad.h:
171         * Sources.txt:
172         * UIProcess/WebProcessPool.cpp:
173         (WebKit::WebProcessPool::ensureNetworkProcess):
174         (WebKit::WebProcessPool::registerURLSchemeAsCORSEnabled):
175         * WebKit.xcodeproj/project.pbxproj:
176         * WebProcess/WebProcess.cpp:
177         (WebKit::WebProcess::initializeWebProcess):
178         (WebKit::WebProcess::registerURLSchemeAsCORSEnabled):
179         (WebKit::WebProcess::ensureNetworkProcessConnection):
180         (WebKit::WebProcess::registerURLSchemeAsCORSEnabled const): Deleted.
181         * WebProcess/WebProcess.h:
182
183 2019-10-15  Carlos Garcia Campos  <cgarcia@igalia.com>
184
185         Unreviewed. Fix several GTK tests in /WebKit2Gtk/TestUIClient crashing since r241988
186
187         Show a warning message and return nullptr from WebKitWebView::create if the new web view is not related to the
188         given one. Also make it clear in the documentation that the new web view should be related to the given one.
189
190         * UIProcess/API/glib/WebKitWebView.cpp:
191         (webkit_web_view_class_init):
192         (webkitWebViewCreateNewPage):
193
194 2019-10-15  Carlos Garcia Campos  <cgarcia@igalia.com>
195
196         Unreviewed. Fix GTK test /webkit/Authentication/authentication-storage after r249962
197
198         * UIProcess/API/glib/WebKitWebView.cpp:
199         (webkitWebViewHandleAuthenticationChallenge): Do not use webkit_settings_get_enable_private_browsing().
200
201 2019-10-15  Carlos Garcia Campos  <cgarcia@igalia.com>
202
203         Unreviewed. Fix GTK test /webkit/WebKitSettings/webkit-settings after r249962.
204
205         Legacy private browsing was removed in r249962, so webkit_settings_set_enable_private_browsing() is now no-op.
206
207         * UIProcess/API/glib/WebKitSettings.cpp:
208         (webKitSettingsSetProperty): Only call webkit_settings_set_enable_private_browsing() when trying to enable it.
209         (webkit_settings_set_enable_private_browsing): Show a warning to let users know that it does nothing now.
210
211 2019-10-15  Carlos Garcia Campos  <cgarcia@igalia.com>
212
213         [GTK][WPE] WebKitWebContext should identify web views by their WebPageProxy identifier
214         https://bugs.webkit.org/show_bug.cgi?id=202924
215
216         Reviewed by Adrian Perez de Castro.
217
218         Instead of the WebPage identifier, since it maps WebPageProxy to WebKitWebView.
219
220         * UIProcess/API/glib/WebKitWebContext.cpp:
221         (webkitWebContextCreatePageForWebView):
222         (webkitWebContextWebViewDestroyed):
223         (webkitWebContextGetWebViewForPage):
224
225 2019-10-15  youenn fablet  <youenn@apple.com>
226
227         Handle service worker loads through NetworkResourceLoader
228         https://bugs.webkit.org/show_bug.cgi?id=202309
229
230         Unreviewed.
231         Fix !ENABLE(SERVICE_WORKER) builds.
232
233         * NetworkProcess/NetworkResourceLoader.cpp:
234         (WebKit::NetworkResourceLoader::continueWillSendRequest):
235         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
236         (WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle):
237
238 2019-10-14  Youenn Fablet  <youenn@apple.com>
239
240         Handle service worker loads through NetworkResourceLoader
241         https://bugs.webkit.org/show_bug.cgi?id=202309
242
243         Reviewed by Alex Christensen.
244
245         Remove ServiceWorkerFetchClient.
246         Instead we use the normal NetworkResourceLoader/WebResourceLoader communication channel.
247         We pass additional parameters, in particular service worker mode and registration identifier.
248
249         Based on that information, network process will decide whether to load from service worker or network.
250         The first advantage is that in case of service worker not handling the load, going to the network is faster.
251         This will also allow us to do the registration matching in network process when receiving a navigation request.
252
253         ServiceWorkerFetchTask is now beefed up to do the link between service worker and NetworkResourceLoader/WebResourceLoader.
254         To support the same console logging, we add a new message called DidFailServiceWorkerLoad.
255
256         To support API tests, we continue to go to the service worker before trying to go to URL scheme handlers.
257         This adds some burden as we need to go to network process/service worker process and, in case load is not handled
258         by service worker, we go back to the web process to do the load through URL scheme handlers.
259         For that purpose we use ServiceWorkersMode::Only.
260
261         * CMakeLists.txt:
262         * DerivedSources-input.xcfilelist:
263         * DerivedSources-output.xcfilelist:
264         * DerivedSources.make:
265         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
266         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
267         * NetworkProcess/NetworkResourceLoadParameters.cpp:
268         (WebKit::NetworkResourceLoadParameters::encode const):
269         (WebKit::NetworkResourceLoadParameters::decode):
270         * NetworkProcess/NetworkResourceLoadParameters.h:
271         * NetworkProcess/NetworkResourceLoader.cpp:
272         (WebKit::NetworkResourceLoader::abort):
273         (WebKit::NetworkResourceLoader::didFailLoading):
274         (WebKit::NetworkResourceLoader::continueWillSendRequest):
275         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
276         (WebKit::NetworkResourceLoader::startWithServiceWorker):
277         (WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle):
278         * NetworkProcess/NetworkResourceLoader.h:
279         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
280         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
281         (WebKit::ServiceWorkerFetchTask::~ServiceWorkerFetchTask):
282         (WebKit::ServiceWorkerFetchTask::sendToServiceWorker):
283         (WebKit::ServiceWorkerFetchTask::sendToClient):
284         (WebKit::ServiceWorkerFetchTask::start):
285         (WebKit::ServiceWorkerFetchTask::startFetch):
286         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
287         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
288         (WebKit::ServiceWorkerFetchTask::didReceiveData):
289         (WebKit::ServiceWorkerFetchTask::didReceiveFormData):
290         (WebKit::ServiceWorkerFetchTask::didFinish):
291         (WebKit::ServiceWorkerFetchTask::didFail):
292         (WebKit::ServiceWorkerFetchTask::didNotHandle):
293         (WebKit::ServiceWorkerFetchTask::cancelFromClient):
294         (WebKit::ServiceWorkerFetchTask::continueDidReceiveFetchResponse):
295         (WebKit::ServiceWorkerFetchTask::continueFetchTaskWith):
296         (WebKit::ServiceWorkerFetchTask::timeoutTimerFired):
297         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
298         (WebKit::ServiceWorkerFetchTask::fetchIdentifier const):
299         (WebKit::ServiceWorkerFetchTask::serviceWorkerIdentifier const):
300         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
301         (WebKit::WebSWServerConnection::cancelFetch):
302         (WebKit::WebSWServerConnection::createFetchTask):
303         (WebKit::WebSWServerConnection::startFetch):
304         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
305         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
306         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
307         (WebKit::WebSWServerToContextConnection::startFetch):
308         (WebKit::WebSWServerToContextConnection::continueDidReceiveFetchResponse):
309         (WebKit::WebSWServerToContextConnection::didReceiveFetchTaskMessage):
310         (WebKit::WebSWServerToContextConnection::registerFetch):
311         (WebKit::WebSWServerToContextConnection::unregisterFetch):
312         (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut):
313         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
314         (WebKit::WebSWServerToContextConnection::ipcConnection const):
315         * Sources.txt:
316         * WebKit.xcodeproj/project.pbxproj:
317         * WebProcess/Network/NetworkProcessConnection.cpp:
318         (WebKit::NetworkProcessConnection::didReceiveMessage):
319         * WebProcess/Network/WebLoaderStrategy.cpp:
320         (WebKit::WebLoaderStrategy::scheduleLoad):
321         * WebProcess/Network/WebResourceLoader.cpp:
322         (WebKit::WebResourceLoader::didFailServiceWorkerLoad):
323         (WebKit::WebResourceLoader::serviceWorkerDidNotHandle):
324         * WebProcess/Network/WebResourceLoader.h:
325         * WebProcess/Network/WebResourceLoader.messages.in:
326         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Removed.
327         * WebProcess/Storage/ServiceWorkerClientFetch.h: Removed.
328         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Removed.
329         * WebProcess/Storage/WebSWClientConnection.cpp:
330         * WebProcess/Storage/WebSWClientConnection.h:
331         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
332         * WebProcess/Storage/WebServiceWorkerProvider.h:
333
334 2019-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
335
336         [GTK] White pages in AC mode: Cannot get default EGL display: EGL_BAD_PARAMETER
337         https://bugs.webkit.org/show_bug.cgi?id=202362
338
339         Reviewed by Carlos Alberto Lopez Perez.
340
341         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
342         (WebKit::DrawingAreaCoordinatedGraphics::updatePreferences): Disable accelerated compositing mode when we failed
343         to reate the shared display for compositing.
344         * WebProcess/glib/WebProcessGLib.cpp:
345         (WebKit::WebProcess::platformInitializeWebProcess): Destroy the wpe display when initialization fails.
346
347 2019-10-14  Chris Dumez  <cdumez@apple.com>
348
349         [WK2] Have WebBackForwardCache class coordinate page caching in all WebProcesses
350         https://bugs.webkit.org/show_bug.cgi?id=202929
351         <rdar://problem/56250421>
352
353         Reviewed by Alex Christensen.
354
355         Have WebBackForwardCache class coordinate page caching in all WebProcesses. To achieve this, the
356         following changes were made:
357         1. Whenever HistoryItem::m_cachedPage changes in WebCore, we notify the client that the HistoryItem
358            has changed. I added a "hasCachedPage" boolean to the item info being passed the the UIProcess
359            that is set based on whether or not HistoryItem::m_cachedPage is null.
360         2. The WebBackForwardCache now contains WebBackForwardCacheEntry objects instead of SuspendedPage
361            objects. A WebBackForwardCacheEntry may have a SuspendedPage or not. As a result, we can now
362            add the the back/forward cache CachedPage entries from the WebContent process, which do not have
363            a SuspendedPageProxy in the UIProcess.
364         3. Now that WebBackForwardCache is aware of all CachedPages, it can properly enforce a cache capacity
365            across call processes. Whenever a WebBackForwardCacheEntry is pruned from the cache and this entry
366            does not have a SuspendedPageProxy, we send an IPC to the WebContent process to remove this
367            cached page from the PageCache in WebCore.
368
369         Previously, as soon as we would cache a page in the WebContent process, we would send an IPC to the
370         UIProcess so that it would clear the PageCache in any previous WebContent process. This was a stop-gap
371         measure to avoid blowing up memory in a multi-process model by keeping a PageCache around in all
372         WebContent process. This would make sure only one process could have a PageCache at any point in time.
373         This logic is now dropped since the WebBackForwardCache can keep track of all cached pages across all
374         processes and enforce a cross-process limit on the number of cached pages. This means we can now have
375         PageCache entries across several WebContent processes, as long as we do not exceed the maximum number
376         of cached pages.
377
378         * Platform/Logging.h:
379         Add new BackForwardCache logging channel.
380
381         * Shared/SessionState.cpp:
382         (WebKit::BackForwardListItemState::encode const):
383         (WebKit::BackForwardListItemState::decode):
384         * Shared/SessionState.h:
385         Add new bit to BackForwardListItemState to indicate whether a HistoryItem has an associated
386         CachedPage or not.
387
388         * Shared/WebBackForwardListItem.cpp:
389         (WebKit::WebBackForwardListItem::~WebBackForwardListItem):
390         (WebKit::WebBackForwardListItem::wasRemovedFromBackForwardList):
391         (WebKit::WebBackForwardListItem::removeFromBackForwardCache):
392         (WebKit::WebBackForwardListItem::setBackForwardCacheEntry):
393         (WebKit::WebBackForwardListItem::suspendedPage const):
394         (WebKit::WebBackForwardListItem::loggingString):
395         * Shared/WebBackForwardListItem.h:
396         (WebKit::WebBackForwardListItem::backForwardCacheEntry const):
397         WebBackForwardListItem now own a WebBackForwardCacheEntry instead of simply a
398         SuspendedPage. The WebBackForwardCacheEntry may have a SuspendedPage or not.
399         Now, whenever a HistoryItem has a CachedPage in WebCore, its corresponding
400         WebBackForwardListItem in the UIProcess has an associated WebBackForwardCacheEntry
401         whether we have a SuspendedPageProxy for it in the UIProcess or not.
402
403         * Shared/WebProcessCreationParameters.cpp:
404         (WebKit::WebProcessCreationParameters::encode const):
405         (WebKit::WebProcessCreationParameters::decode):
406         * Shared/WebProcessCreationParameters.h:
407         Pass the PageCache capacity to the WebContent process on creation, so that it matches the
408         capacity of the WebBackForwardCache in the UIProcess.
409
410         * UIProcess/ProvisionalPageProxy.cpp:
411         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
412         * UIProcess/SuspendedPageProxy.cpp:
413         (WebKit::messageNamesToIgnoreWhileSuspended):
414         (WebKit::SuspendedPageProxy::suspensionTimedOut):
415         * UIProcess/SuspendedPageProxy.h:
416         Stop storing the WebBackForwardListItem on the SuspendedPageProxy. This avoids having to
417         keep this pointer up to date. We do not really need it as we can now ask the WebBackForwardCache
418         to clear an entry by giving it a SuspendedPageProxy to match. Given how many entries we have at
419         most in the cache (2), iterating over them to find the one with a given suspended page is cheap.
420
421         * UIProcess/WebBackForwardCache.cpp:
422         (WebKit::WebBackForwardCache::WebBackForwardCache):
423         (WebKit::WebBackForwardCache::~WebBackForwardCache):
424
425         (WebKit::WebBackForwardCache::setCapacity):
426         Send an IPC of each WebProcess whenever the capacity of the WebBackForwardCache changes, in order
427         to update the capacity of the PageCache in those processes.
428
429         (WebKit::WebBackForwardCache::addEntry):
430         (WebKit::WebBackForwardCache::removeEntry):
431         (WebKit::WebBackForwardCache::takeSuspendedPage):
432         (WebKit::WebBackForwardCache::removeEntriesForProcess):
433         (WebKit::WebBackForwardCache::removeEntriesForSession):
434         (WebKit::WebBackForwardCache::removeEntriesMatching):
435         (WebKit::WebBackForwardCache::clear):
436
437         * UIProcess/WebBackForwardCache.h:
438         Use a Vector instead of a ListHashSet to store the entries. Given that we have at most 2 entries, using
439         a Vector will likely be more efficient and definitely use less memory.
440
441         * UIProcess/WebBackForwardCacheEntry.h: Added.
442         (WebKit::WebBackForwardCacheEntry::backForwardCache const):
443         (WebKit::WebBackForwardCacheEntry::WebBackForwardCacheEntry):
444         Add new WebBackForwardCacheEntry abstraction to match the concept of WebCore::CachedPage in the UIProcess.
445         A WebBackForwardCacheEntry may have a SuspendedPageProxy associated with it in the UIProcess or not.
446
447         * UIProcess/WebPageProxy.cpp:
448         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
449         * UIProcess/WebPageProxy.h:
450         * UIProcess/WebPageProxy.messages.in:
451         Drop didSaveToPageCache as it is no longer necessary.
452
453         * UIProcess/WebProcessPool.cpp:
454         (WebKit::WebProcessPool::initializeNewWebProcess):
455         (WebKit::WebProcessPool::disconnectProcess):
456         * UIProcess/WebProcessPool.h:
457
458         * UIProcess/WebProcessProxy.cpp:
459         (WebKit::WebProcessProxy::updateBackForwardItem):
460         Whenever we get a BackForwardItem from the WebContent process, we now check it now has
461         an associated CachedPage or not. If it does, we make sure we add a corresponding
462         entry in the WebBackForwardCache so that the UIProcess knows about it. If it no longer
463         has a CachedPage and we don't have a SuspendedPageProxy for this item in the UIProcess,
464         then we remove the corresponding entry from the back/forward cache. Note that we don't
465         drop SuspendedPageProxy objects in the UIProcess simply because their corresponding
466         CachedPage in the WebProcess is gone, to maintain previous behavior. This is an
467         optimization that is useful on iOS, where we do not have a WebProcessCache, since we
468         can reuse processes from SuspendedPageProxies on navigation.
469
470         * UIProcess/WebProcessProxy.h:
471         * WebKit.xcodeproj/project.pbxproj:
472         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
473         (WebKit::toBackForwardListItemState):
474         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
475         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
476         * WebProcess/WebProcess.cpp:
477         (WebKit::WebProcess::initializeWebProcess):
478         (WebKit::WebProcess::setBackForwardCacheCapacity):
479         (WebKit::WebProcess::clearCachedPage):
480         * WebProcess/WebProcess.h:
481         * WebProcess/WebProcess.messages.in:
482
483 2019-10-14  Wenson Hsieh  <wenson_hsieh@apple.com>
484
485         [Clipboard API] Refactor custom pasteboard writing codepaths to handle multiple items
486         https://bugs.webkit.org/show_bug.cgi?id=202916
487
488         Reviewed by Tim Horton.
489
490         Change more function and method signatures from `const PasteboardCustomData&` to
491         `const Vector<PasteboardCustomData>&`.
492
493         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
494         (WebKit::WebPasteboardProxy::writeCustomData):
495         * UIProcess/WebPasteboardProxy.cpp:
496         (WebKit::WebPasteboardProxy::writeCustomData):
497         * UIProcess/WebPasteboardProxy.h:
498         * UIProcess/WebPasteboardProxy.messages.in:
499         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
500         (WebKit::WebPlatformStrategies::writeCustomData):
501         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
502
503 2019-10-14  Per Arne Vollan  <pvollan@apple.com>
504
505         REGRESSION(251087): Several API tests are failing
506         https://bugs.webkit.org/show_bug.cgi?id=202961
507
508         Reviewed by Brent Fulgham.
509
510         WebPageProxy::maybeInitializeSandboxExtensionHandle returns early if the WebContent process is currently launching,
511         since the audit token is needed to create the sandbox extension. The audit token will not be available until the
512         process has finished launching. In the same way, the method should return early if the WebContent process has
513         terminated.
514
515         * UIProcess/WebPageProxy.cpp:
516         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
517
518 2019-10-14  Matt Mokary  <mmokary@apple.com>
519
520         FindController::findString always updates foundStringMatchIndex even if match is the same as before
521         https://bugs.webkit.org/show_bug.cgi?id=201775
522         <rdar://problem/55352425>
523
524         Reviewed by Tim Horton.
525
526         Allow an update to a find string without changing current match index, as is often the desired behavior when
527         modifying a query rather than moving forward or backward through a match set.
528
529         * Shared/WebFindOptions.h:
530         * UIProcess/API/Cocoa/WKWebView.mm:
531         (toFindOptions):
532         * UIProcess/API/Cocoa/_WKFindOptions.h:
533         * WebProcess/WebPage/FindController.cpp:
534         (WebKit::FindController::findString):
535         Do not change match index if NoIndexChange bit is set. Otherwise, no change in behavior.
536
537 2019-10-14  David Quesada  <david_quesada@apple.com>
538
539         Remove WebCore::IOSApplication::isWebApp()
540         https://bugs.webkit.org/show_bug.cgi?id=181259
541
542         Reviewed by Alex Christensen.
543
544         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
545         (WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
546             Remove the wording "this is not supported as of right now", as it seems to be supported
547             since r247686, which added SPI on _WKWebsiteDataStoreConfiguration to set the application
548             cache directory.
549
550 2019-10-14  Wenson Hsieh  <wenson_hsieh@apple.com>
551
552         [Clipboard API] Support writing multiple PasteboardCustomData with SharedBuffers to the pasteboard
553         https://bugs.webkit.org/show_bug.cgi?id=202851
554
555         Reviewed by Darin Adler.
556
557         See WebCore ChangeLog for more details.
558
559         * Shared/WebCoreArgumentCoders.cpp:
560         (IPC::ArgumentCoder<PasteboardCustomData::Entry>::encode):
561         (IPC::ArgumentCoder<PasteboardCustomData::Entry>::decode):
562
563         Add helpers to encode and decode PasteboardCustomData::Entry.
564
565         (IPC::ArgumentCoder<PasteboardCustomData>::encode):
566         (IPC::ArgumentCoder<PasteboardCustomData>::decode):
567         * Shared/WebCoreArgumentCoders.h:
568
569         Add support for encoding and decoding PasteboardCustomData by encoding and decoding each of its items (see
570         above).
571
572         * UIProcess/Cocoa/WebViewImpl.mm:
573         (WebKit::WebViewImpl::requestDOMPasteAccess):
574         * UIProcess/WebPasteboardProxy.h:
575         * UIProcess/WebPasteboardProxy.messages.in:
576         * UIProcess/ios/WKContentViewInteraction.mm:
577         (-[WKContentView canPerformActionForWebView:withSender:]):
578         (allPasteboardItemOriginsMatchOrigin):
579         (-[WKContentView _didHandleAdditionalDragItemsRequest:]):
580
581         Tweak several methods to use the new methods on PasteboardCustomData instead of accessing the member variables
582         directly.
583
584         (-[WKContentView cleanUpDragSourceSessionState]):
585         (-[WKContentView _prepareToDragPromisedAttachment:]):
586         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationLists:stagedDragSource:]):
587         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
588         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]): Deleted.
589
590         Adjust these methods to handle multiple staged item providers (for now, it remains that iOS drag and drop
591         codepaths will still only write a single item to the pasteboard).
592
593 2019-10-14  Per Arne Vollan  <pvollan@apple.com>
594
595         [macOS] Sandbox extensions should be created with audit tokens, not PIDs
596         https://bugs.webkit.org/show_bug.cgi?id=201828
597
598         Reviewed by Brent Fulgham.
599
600         Stop issuing mach/read sandbox extensions by PID in the UI process, and use audit tokens instead.
601         The audit tokens for the WebContent processes are retrieved from the IPC connection to the process.
602
603         * Shared/Cocoa/SandboxExtensionCocoa.mm:
604         (WebKit::SandboxExtensionImpl::create):
605         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
606         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
607         (WebKit::SandboxExtension::createHandleForMachLookupByAuditToken):
608         (WebKit::SandboxExtension::createHandleForReadByAuditToken):
609         (WebKit::SandboxExtension::createHandleForMachLookupByPid): Deleted.
610         (WebKit::SandboxExtension::createHandleForReadByPid): Deleted.
611         * Shared/SandboxExtension.h:
612         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
613         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
614         * UIProcess/WebPageProxy.cpp:
615         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
616         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
617         (WebKit::WebPageProxy::loadFile):
618         * UIProcess/WebProcessProxy.cpp:
619         (WebKit::WebProcessProxy::shouldSendPendingMessage):
620         (WebKit::WebProcessProxy::didFinishLaunching):
621         * UIProcess/ios/WebProcessProxyIOS.mm:
622         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
623
624 2019-10-14  Myles C. Maxfield  <mmaxfield@apple.com>
625
626         [Cocoa] REGRESSION (r245672): Contenteditable with optical sizing freezes Safari
627         https://bugs.webkit.org/show_bug.cgi?id=202262
628
629         Reviewed by Tim Horton.
630
631         r250640 didn't go far enough. We need to apply the same fix everywhere [NSFontDescriptor fontDescriptorWithFontAttributes:] is called.
632
633         * Shared/Cocoa/ArgumentCodersCocoa.mm:
634         (IPC::decodeFontInternal):
635         * Shared/Cocoa/CoreTextHelpers.h: Added.
636         * Shared/Cocoa/CoreTextHelpers.mm: Added.
637         (fontDescriptorWithFontAttributes):
638         * SourcesCocoa.txt:
639         * UIProcess/Cocoa/WebViewImpl.mm:
640         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
641         * UIProcess/mac/WebPopupMenuProxyMac.mm:
642         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
643         * WebKit.xcodeproj/project.pbxproj:
644
645 2019-10-14  Truitt Savell  <tsavell@apple.com>
646
647         Unreviewed, rolling out r251045.
648
649         Broke internal builds
650
651         Reverted changeset:
652
653         "AX: Make AXIsolatedTree compile again"
654         https://bugs.webkit.org/show_bug.cgi?id=202702
655         https://trac.webkit.org/changeset/251045
656
657 2019-10-14  youenn fablet  <youenn@apple.com>
658
659         Reuse existing web processes for running service workers
660         https://bugs.webkit.org/show_bug.cgi?id=202195
661
662         Unreviewed.
663
664         * UIProcess/WebProcessProxy.cpp:
665         (WebKit::WebProcessProxy::disableServiceWorkers):
666         (WebKit::WebProcessProxy::enableServiceWorkers):
667         Fix case where ENABLE_SERVICE_WORKER is not defined.
668
669 2019-10-14  Philippe Normand  <pnormand@igalia.com>
670
671         [GTK][WebInspector] Support for saving data
672         https://bugs.webkit.org/show_bug.cgi?id=202894
673
674         Reviewed by Carlos Garcia Campos.
675
676         Implement the WebInspectorProxy::platformSave() method. This
677         allows users to save the inspector performance measurements, for
678         instance.
679
680         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
681         (WebKit::WebInspectorProxy::platformSave):
682         * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp:
683         (WebKit::WebInspectorUI::canSave):
684
685 2019-10-14  youenn fablet  <youenn@apple.com>
686
687         Reuse existing web processes for running service workers
688         https://bugs.webkit.org/show_bug.cgi?id=202195
689
690         Reviewed by Chris Dumez.
691
692         When network process asks for a service worker context connection,
693         we now iterate through existing web processes and reuse one if both session
694         and registrable domain match.
695         We then ask the web process to create a context connection to the network process.
696
697         When network process no longer needs the connection, it instructs the UIProcess
698         that will update its state so that the web process is no longer considered as running
699         service workers.
700         UIProcess then instructs the web process to stop its service workers and its connection.
701
702         Later on, the same web process may be reused for running service workers in which case
703         a new connection will replace the stopped connection.
704
705         Similarly, on network process crash, all web process running service workers are updated
706         so that they are no longer considered as running service workers.
707
708         Add a boolean state to WebProcessPool to control whether creating a separate service worker process.
709
710         We no longer terminate the web process when stopping service workers or when network process crash.
711         We use the enableTermination/disableTermination at context connection start/stop time.
712         We consider that the context connection is similar to running a page in the process and creating/removing a page
713         calls disableTermination/enableTermination.
714
715         NetworkProcess is handling the management of service worker processes by checking for clients.
716         In case there is no client, the process is terminated.
717         This removes the need for the WebProcessPool service worker process timer.
718         This patch removes this timer.
719
720         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
721         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
722         (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection):
723         (WebKit::NetworkConnectionToWebProcess::closeSWContextConnection):
724         (WebKit::NetworkConnectionToWebProcess::serverToContextConnectionNoLongerNeeded):
725         * NetworkProcess/NetworkConnectionToWebProcess.h:
726         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
727         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
728         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
729         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
730         (WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection):
731         (WebKit::WebSWServerToContextConnection::messageSenderConnection const):
732         (WebKit::WebSWServerToContextConnection::connectionIsNoLongerNeeded):
733         (WebKit::WebSWServerToContextConnection::startFetch):
734         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
735         * UIProcess/API/C/WKContext.cpp:
736         (WKContextSetUseSeparateServiceWorkerProcess):
737         * UIProcess/API/C/WKContextPrivate.h:
738         * UIProcess/API/Cocoa/WKProcessPool.mm:
739         (-[WKProcessPool _setUseSeparateServiceWorkerProcess:]):
740         (-[WKProcessPool _webPageContentProcessCount]):
741         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
742         * UIProcess/Network/NetworkProcessProxy.cpp:
743         (WebKit::NetworkProcessProxy::workerContextConnectionNoLongerNeeded):
744         * UIProcess/Network/NetworkProcessProxy.h:
745         * UIProcess/Network/NetworkProcessProxy.messages.in:
746         * UIProcess/WebProcessPool.cpp:
747         (WebKit::WebProcessPool::networkProcessCrashed):
748         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
749         (WebKit::WebProcessPool::removeFromServiceWorkerProcesses):
750         (WebKit::WebProcessPool::disconnectProcess):
751         (WebKit::WebProcessPool::createWebPage):
752         (WebKit::WebProcessPool::terminateNetworkProcess):
753         (WebKit::WebProcessPool::setUseSeparateServiceWorkerProcess):
754         * UIProcess/WebProcessPool.h:
755         * UIProcess/WebProcessProxy.cpp:
756         (WebKit::WebProcessProxy::createForServiceWorkers):
757         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
758         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
759         (WebKit::WebProcessProxy::disableServiceWorkers):
760         (WebKit::WebProcessProxy::enableServiceWorkers):
761         * UIProcess/WebProcessProxy.h:
762         (WebKit::WebProcessProxy::isMatchingRegistrableDomain const):
763         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
764         (WebKit::m_userAgent):
765         (WebKit::WebSWContextManagerConnection::terminateWorker):
766         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
767         (WebKit::WebSWContextManagerConnection::close):
768         * WebProcess/Storage/WebSWContextManagerConnection.h:
769         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
770         * WebProcess/WebProcess.cpp:
771         (WebKit::WebProcess::networkProcessConnectionClosed):
772         (WebKit::WebProcess::registerServiceWorkerClients):
773
774 2019-10-12  Chris Dumez  <cdumez@apple.com>
775
776         Back/Forward cache does not work after doing a favorite navigation
777         https://bugs.webkit.org/show_bug.cgi?id=202762
778         <rdar://problem/56126911>
779
780         Reviewed by Antti Koivisto.
781
782         When a process-swap was forced by the client, we would always close the page in the previous
783         process after navigating. This would prevent leveraging the back/forward cache when navigating
784         back after such a process-swap. The reason we were doing this is that other pages may have
785         opener link to this page and closing the page was an easy way to break this opener link.
786
787         To address the issue, we no longer close the previous page when a process-swap is forced by the
788         client. Instead, we make sure to disconnect the frames' openees from their opener then the opener
789         enters the page cache.
790
791         * UIProcess/WebPageProxy.cpp:
792         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
793         * WebProcess/WebPage/WebPage.cpp:
794         (WebKit::WebPage::suspendForProcessSwap):
795
796 2019-10-12  Chris Dumez  <cdumez@apple.com>
797
798         Clearing Website data for a given session should not shut down cached processes for other sessions
799         https://bugs.webkit.org/show_bug.cgi?id=202865
800         <rdar://problem/56202912>
801
802         Reviewed by Antti Koivisto.
803
804         When clearing Website data for a given data store, we now only clear cached processes
805         (either if BackForwardCache or WebProcessCache) if they are associated with this
806         particular data store. It is very wasteful otherwise.
807
808         * UIProcess/ProvisionalPageProxy.cpp:
809         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
810         * UIProcess/SuspendedPageProxy.cpp:
811         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
812         ProvisionalPageProxy & SuspendedPageProxy's destructors no longer call
813         WebProcessProxy::maybeShutdown() asynchronously. We now call maybeShutdown()
814         synchronously in WebProcessProxy::decrementSuspendedPageCount() and
815         WebProcessProxy::removeProvisionalPageProxy() instead. This makes things a
816         lot more predictable.
817
818         * UIProcess/WebBackForwardCache.cpp:
819         (WebKit::WebBackForwardCache::removeEntriesForSession):
820         Add new removeEntriesForSession() method to clear only back / forward cache
821         entries associated with a particular session.
822
823         (WebKit::WebBackForwardCache::clear):
824         Stop taking a parameter indicating if we allow the processes to enter the
825         process cache. Now that we call maybeShutdown() synchronously when destroying
826         a SuspendedPageProxy, we can simply allow the processes to enter the process
827         cache unconditionally. If the caller does not want this processes in the page
828         cache, they can clear the process cache afterwards.
829
830         * UIProcess/WebBackForwardCache.h:
831         * UIProcess/WebPageProxy.cpp:
832         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
833         Now that destroying a SuspendedPageProxy or a ProvisionalPageProxy may shutdown
834         their process synchronously, add a scope here to prevent shutdown of the process
835         for the duration of this scope, since we're about to use it for a navigation and
836         we don't want it to get shutdown, even if there is no longer anything using it.
837
838         (WebKit::WebPageProxy::continueNavigationInNewProcess):
839         Add new assertion and rename parameter for consistency.
840
841         * UIProcess/WebProcessPool.cpp:
842         (WebKit::WebProcessPool::handleMemoryPressureWarning):
843
844         * UIProcess/WebProcessProxy.cpp:
845         (WebKit::WebProcessProxy::addProvisionalPageProxy):
846         Add new assertion.
847
848         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
849         Call maybeShutDown() if this was the last provisional page.
850
851         (WebKit::WebProcessProxy::maybeShutDown):
852         Drop parameter indicating if we want to allow the process to enter the process
853         cache and allow caching unconditionally.
854
855         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
856         Prevent termination if there is a ScopePreventingShutdown.
857
858         (WebKit::WebProcessProxy::decrementSuspendedPageCount):
859         Call maybeShutDown() if this was the last suspended page.
860
861         * UIProcess/WebProcessProxy.h:
862         (WebKit::WebProcessProxy::ScopePreventingShutdown::ScopePreventingShutdown):
863         (WebKit::WebProcessProxy::ScopePreventingShutdown::~ScopePreventingShutdown):
864         (WebKit::WebProcessProxy::makeScopePreventingShutdown):
865         Add new facility to prevent shutdown of a process for the duration of the scope.
866
867         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
868         (WebKit::WebsiteDataStore::removeData):
869         When removing website data, only clear cached processes if they are associated with
870         the current data store.
871
872 2019-10-12  Chris Fleizach  <cfleizach@apple.com>
873
874         AX: Make AXIsolatedTree compile again
875         https://bugs.webkit.org/show_bug.cgi?id=202702
876         <rdar://problem/56084968>
877
878         Reviewed by Joanmarie Diggs.
879
880         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
881         (-[WKAccessibilityWebPageObjectBase isolatedTreeRootObject]):
882
883 2019-10-11  Rob Buis  <rbuis@igalia.com>
884
885         Cleanup RuntimeEnabledFeatures includes
886         https://bugs.webkit.org/show_bug.cgi?id=202857
887
888         Reviewed by Eric Carlson.
889
890         These classes must have had made use of runtime flags before
891         but are not using them anymore.
892
893         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
894         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
895         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
896         * UIProcess/WebProcessPool.cpp:
897
898 2019-10-11  Chris Dumez  <cdumez@apple.com>
899
900         Move SuspendedPage logic from WebProcessPool to new WebBackForwardCache class
901         https://bugs.webkit.org/show_bug.cgi?id=202660
902
903         Reviewed by Antti Koivisto.
904
905         Move SuspendedPage logic from WebProcessPool to new WebBackForwardCache class. This is
906         a first step towards implementing back / forward cache handling in the UIProcess.
907
908         The following changes were made:
909         1. SuspendedPageProxy objects are now normally owned by their associated WebBackForwardListItem
910            (Similarly to CachedPage objects being owned by their HistoryItem in WebCore) instead of the
911            WebProcessPool.
912         2. A new WebBackForwardCache class is introduced to cap the number of cached pages and clear
913            them (similary to the PageCache in WebCore).
914
915         * Shared/WebBackForwardListItem.cpp:
916         (WebKit::WebBackForwardListItem::~WebBackForwardListItem):
917         (WebKit::WebBackForwardListItem::wasRemovedFromBackForwardList):
918         (WebKit::WebBackForwardListItem::setSuspendedPage):
919         (WebKit::WebBackForwardListItem::takeSuspendedPage):
920         (WebKit::WebBackForwardListItem::suspendedPage const):
921         * Shared/WebBackForwardListItem.h:
922         * Sources.txt:
923         * UIProcess/API/Cocoa/WKProcessPool.mm:
924         (-[WKProcessPool _maximumSuspendedPageCount]):
925         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp:
926         * UIProcess/SuspendedPageProxy.cpp:
927         (WebKit::SuspendedPageProxy::findReusableSuspendedPageProcess):
928         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
929         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
930         (WebKit::SuspendedPageProxy::setBackForwardListItem):
931         (WebKit::SuspendedPageProxy::clearBackForwardListItem):
932         (WebKit::SuspendedPageProxy::backForwardCache const):
933         (WebKit::SuspendedPageProxy::suspensionTimedOut):
934         * UIProcess/SuspendedPageProxy.h:
935         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
936         * UIProcess/WebAuthentication/Mock/MockHidService.h:
937         * UIProcess/WebBackForwardCache.cpp: Added.
938         (WebKit::WebBackForwardCache::removeOldestEntry):
939         (WebKit::WebBackForwardCache::setCapacity):
940         (WebKit::WebBackForwardCache::addEntry):
941         (WebKit::WebBackForwardCache::removeEntry):
942         (WebKit::WebBackForwardCache::takeEntry):
943         (WebKit::WebBackForwardCache::removeEntriesForProcess):
944         (WebKit::WebBackForwardCache::removeEntriesForPage):
945         (WebKit::WebBackForwardCache::removeEntriesMatching):
946         (WebKit::WebBackForwardCache::clear):
947         * UIProcess/WebBackForwardCache.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.h.
948         (WebKit::WebBackForwardCache::capacity const):
949         (WebKit::WebBackForwardCache::size const):
950         * UIProcess/WebBackForwardList.cpp:
951         (WebKit::WebBackForwardList::didRemoveItem):
952         * UIProcess/WebPageProxy.cpp:
953         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
954         (WebKit::WebPageProxy::backForwardCache const):
955         (WebKit::WebPageProxy::shouldUseBackForwardCache const):
956         (WebKit::WebPageProxy::close):
957         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
958         (WebKit::WebPageProxy::resetState):
959         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
960         * UIProcess/WebPageProxy.h:
961         (WebKit::WebPageProxy::process const):
962         * UIProcess/WebProcessPool.cpp:
963         (WebKit::m_webProcessCache):
964         (WebKit::WebProcessPool::disconnectProcess):
965         (WebKit::WebProcessPool::processForRegistrableDomain):
966         (WebKit::WebProcessPool::handleMemoryPressureWarning):
967         (WebKit::WebProcessPool::updateBackForwardCacheCapacity):
968         (WebKit::WebProcessPool::setCacheModel):
969         * UIProcess/WebProcessPool.h:
970         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
971         (WebKit::WebsiteDataStore::removeData):
972         (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
973         * WebKit.xcodeproj/project.pbxproj:
974
975 2019-10-11  Alex Christensen  <achristensen@webkit.org>
976
977         Only use CFNetwork SPI for metrics where needed
978         https://bugs.webkit.org/show_bug.cgi?id=202825
979
980         Reviewed by Joseph Pecoraro.
981
982         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
983         (stringForSSLProtocolVersion):
984         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
985
986 2019-10-11  Kate Cheney  <katherine_cheney@apple.com>
987
988         Get StorageAccess API features working on SQLite database implementation (195422)
989         https://bugs.webkit.org/show_bug.cgi?id=195422
990         <rdar://problem/54213519>
991
992         Reviewed by Brent Fulgham.
993
994         This patch migrates the http/tests/storageAccess/ Layout tests to
995         use the ITP database and uncovered 3 bugs in the process.
996
997         1. It was previously blocking cookies to a third party domain which
998         was not marked as prevalent. Now it ensures that the user is prompted
999         using the storage acess API regarding that third party domain.
1000
1001         2. It was not requesting storage access if cookies had previously been
1002         blocked. Now it will only return early from
1003         ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener
1004         if cookie access is allowed, and request storage access otherwise.
1005
1006         3. hasUserGrantedStorageAccessThroughPrompt was returning true even
1007         if the result was not previously granted storage access.
1008
1009         All of these fixes match behavior in
1010         ResourceLoadStatisticsMemoryStore.
1011
1012         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1013         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1014         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
1015         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt):
1016
1017 2019-10-11  Dean Jackson  <dino@apple.com>
1018
1019         REGRESSION: fast/events/touch/ios/long-press-on-image.html is failing
1020         https://bugs.webkit.org/show_bug.cgi?id=202845
1021
1022         Reviewed by Antoine Quint.
1023
1024         Update _contentsOfUserInterfaceItem so that it returns more information
1025         on a context menu.
1026
1027         * UIProcess/ios/WKContentViewInteraction.mm:
1028         (-[WKContentView _contentsOfUserInterfaceItem:]):
1029
1030 2019-10-11  Alex Christensen  <achristensen@webkit.org>
1031
1032         Use sendWithAsyncReply for cookie getting/clearing functions
1033         https://bugs.webkit.org/show_bug.cgi?id=202841
1034
1035         Reviewed by Carlos Garcia Campos.
1036
1037         No change in behavior.  This just simplifies the message sending a bit.
1038
1039         * NetworkProcess/Cookies/WebCookieManager.cpp:
1040         (WebKit::WebCookieManager::getHostnamesWithCookies):
1041         (WebKit::WebCookieManager::deleteAllCookies):
1042         (WebKit::WebCookieManager::deleteCookie):
1043         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
1044         (WebKit::WebCookieManager::getAllCookies):
1045         (WebKit::WebCookieManager::getCookies):
1046         (WebKit::WebCookieManager::setCookie):
1047         (WebKit::WebCookieManager::setCookies):
1048         (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
1049         (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
1050         * NetworkProcess/Cookies/WebCookieManager.h:
1051         * NetworkProcess/Cookies/WebCookieManager.messages.in:
1052         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
1053         * UIProcess/API/APIHTTPCookieStore.cpp:
1054         (API::HTTPCookieStore::cookies):
1055         (API::HTTPCookieStore::setCookies):
1056         (API::HTTPCookieStore::deleteCookie):
1057         (API::HTTPCookieStore::setHTTPCookieAcceptPolicy):
1058         * UIProcess/API/Cocoa/WKProcessPool.mm:
1059         (-[WKProcessPool _setCookieAcceptPolicy:]):
1060         * UIProcess/API/glib/WebKitCookieManager.cpp:
1061         (webkit_cookie_manager_set_accept_policy):
1062         (webkit_cookie_manager_get_accept_policy):
1063         (webkit_cookie_manager_add_cookie):
1064         (webkit_cookie_manager_get_cookies):
1065         (webkit_cookie_manager_delete_cookie):
1066         * UIProcess/Automation/WebAutomationSession.cpp:
1067         (WebKit::WebAutomationSession::addSingleCookie):
1068         * UIProcess/AuxiliaryProcessProxy.h:
1069         (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply):
1070         * UIProcess/WebCookieManagerProxy.cpp:
1071         (WebKit::WebCookieManagerProxy::processPoolDestroyed):
1072         (WebKit::WebCookieManagerProxy::processDidClose):
1073         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
1074         (WebKit::WebCookieManagerProxy::deleteCookie):
1075         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
1076         (WebKit::WebCookieManagerProxy::setCookies):
1077         (WebKit::WebCookieManagerProxy::getAllCookies):
1078         (WebKit::WebCookieManagerProxy::getCookies):
1079         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
1080         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
1081         (WebKit::WebCookieManagerProxy::didGetHostnamesWithCookies): Deleted.
1082         (WebKit::WebCookieManagerProxy::didSetCookies): Deleted.
1083         (WebKit::WebCookieManagerProxy::didGetCookies): Deleted.
1084         (WebKit::WebCookieManagerProxy::didDeleteCookies): Deleted.
1085         (WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy): Deleted.
1086         (WebKit::WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy): Deleted.
1087         * UIProcess/WebCookieManagerProxy.h:
1088         * UIProcess/WebCookieManagerProxy.messages.in:
1089
1090 2019-10-10  Alex Christensen  <achristensen@webkit.org>
1091
1092         Remove unused WebProcessPool::requestNetworkingStatistics
1093         https://bugs.webkit.org/show_bug.cgi?id=202818
1094
1095         Reviewed by Chris Dumez.
1096
1097         Its only use was removed in rdar://problem/56160996
1098
1099         * NetworkProcess/Downloads/DownloadManager.h:
1100         (WebKit::DownloadManager::isDownloading const):
1101         (WebKit::DownloadManager::activeDownloadCount const): Deleted.
1102         * NetworkProcess/NetworkProcess.cpp:
1103         (WebKit::NetworkProcess::getNetworkProcessStatistics): Deleted.
1104         * NetworkProcess/NetworkProcess.h:
1105         * NetworkProcess/NetworkProcess.messages.in:
1106         * Shared/Authentication/AuthenticationManager.h:
1107         (WebKit::AuthenticationManager::outstandingAuthenticationChallengeCount const): Deleted.
1108         * UIProcess/Network/NetworkProcessProxy.cpp:
1109         (WebKit::NetworkProcessProxy::didReceiveMessage):
1110         * UIProcess/WebProcessPool.cpp:
1111         (WebKit::WebProcessPool::getStatistics):
1112         (WebKit::WebProcessPool::requestNetworkingStatistics): Deleted.
1113         * UIProcess/WebProcessPool.h:
1114
1115 2019-10-10  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1116
1117         [WinCairo] Move remote communication handling from RemoteInspectorServer to RemoteInspector.
1118         https://bugs.webkit.org/show_bug.cgi?id=202763
1119
1120         Reviewed by Ross Kirsling.
1121
1122         Remove deleted method invocations.
1123
1124         * UIProcess/win/WebProcessPoolWin.cpp:
1125         (WebKit::initializeRemoteInspectorServer):
1126         (WebKit::WebProcessPool::platformInitialize):
1127
1128 2019-10-10  Youenn Fablet  <youenn@apple.com>
1129
1130         Do not timeout a load intercepted by service worker that receives a response
1131         https://bugs.webkit.org/show_bug.cgi?id=202787
1132
1133         Reviewed by Chris Dumez.
1134
1135         Stop making ServiceWorkerFetchTask ref counted since it is not needed and
1136         can potentially make ServiceWorkerFetchTask oulive its WebSWServerToContextConnection member.
1137
1138         Stop the ServiceWorkerFetchTask timeout timer whenever receiving a response so that the load will not timeout in that case.
1139         This ensures that a load that is starting in a service worker will not be failing.
1140         Instead the load will go to network process.
1141
1142         Removed m_didReachTerminalState which is not needed as WebSWServerToContextConnection unregisters the ServiceWorkerFetchTask
1143         as an IPC listener for all terminating messages.
1144
1145         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
1146         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
1147         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
1148         (WebKit::ServiceWorkerFetchTask::didReceiveData):
1149         (WebKit::ServiceWorkerFetchTask::didReceiveFormData):
1150         (WebKit::ServiceWorkerFetchTask::didFinish):
1151         (WebKit::ServiceWorkerFetchTask::didFail):
1152         (WebKit::ServiceWorkerFetchTask::didNotHandle):
1153         (WebKit::ServiceWorkerFetchTask::timeoutTimerFired):
1154         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
1155         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1156         (WebKit::WebSWServerToContextConnection::startFetch):
1157         (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut):
1158         Use a Vector instead of a HasSet for performance reasons.
1159         Update according fetch map using unique_ptr instead of Ref<>.
1160         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1161
1162 2019-10-10  Rob Buis  <rbuis@igalia.com>
1163
1164         SpeculativeLoad should use CompletionHandler
1165         https://bugs.webkit.org/show_bug.cgi?id=202795
1166
1167         Reviewed by Chris Dumez.
1168
1169         SpeculativeLoad should use CompletionHandler, as remarked in
1170         Bug 201641 review.
1171
1172         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
1173
1174 2019-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1175
1176         Support programmatic paste requests on macOS
1177         https://bugs.webkit.org/show_bug.cgi?id=202773
1178         <rdar://problem/48957166>
1179
1180         Reviewed by Tim Horton.
1181
1182         Adds support for programmatic paste requests on macOS, as well as some testing SPI in WKWebView to allow
1183         WebKitTestRunner to grab the NSMenu used for the DOM paste request. This patch adopts the same strategy taken to
1184         allow programmatic paste on iOS, by allowing programmatic pastes coming from the page to show platform UI which
1185         the user must then interact with in order to proceed with the paste. See below for more details.
1186
1187         * Shared/WebPreferencesDefaultValues.h:
1188
1189         Make this available on both iOS and macOS (iOS family is omitted for now, since callout bar UI is not generally
1190         present on non-iOS iOS-family platforms such as Apple Watch).
1191
1192         * UIProcess/API/Cocoa/WKWebView.mm:
1193         (-[WKWebView _web_grantDOMPasteAccess]):
1194
1195         This selector is called when the user taps the Paste option in the presented NSMenu.
1196
1197         (-[WKWebView _activeMenu]):
1198
1199         Returns the currently active NSMenu. Only for testing purposes.
1200
1201         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1202         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1203         * UIProcess/API/mac/WKView.mm:
1204         (-[WKView _web_grantDOMPasteAccess]):
1205
1206         Same exercise as above, only for WKView instead of WKWebView.
1207
1208         * UIProcess/Cocoa/WebViewImpl.h:
1209         (WebKit::WebViewImpl::domPasteMenu const):
1210         * UIProcess/Cocoa/WebViewImpl.mm:
1211         (-[WKDOMPasteMenuDelegate initWithWebViewImpl:]):
1212         (-[WKDOMPasteMenuDelegate menuDidClose:]):
1213         (-[WKDOMPasteMenuDelegate numberOfItemsInMenu:]):
1214         (-[WKDOMPasteMenuDelegate confinementRectForMenu:onScreen:]):
1215
1216         Adds a new object, whose purpose is to be a delegate for the NSMenu that is presented when requesting DOM paste
1217         access. This object is used instead of WKWebView, since API clients may end up making the WKWebView the delegate
1218         for a different menu, in which case some implementations (either theirs or ours) of NSMenuDelegate methods would
1219         not be called. Avoiding this would require the client to be aware that WKWebView conforms to NSMenuDelegate,
1220         which is only declared privately.
1221
1222         (WebKit::WebViewImpl::handleProcessSwapOrExit):
1223
1224         On process swap or exit, automatically bail out of any pending DOM paste request by denying it.
1225
1226         (WebKit::WebViewImpl::requestDOMPasteAccess):
1227         (WebKit::WebViewImpl::handleDOMPasteRequestWithResult):
1228
1229         Handle the DOM paste request by showing an NSMenu near the mouse cursor with a single option to paste.
1230
1231         * UIProcess/mac/PageClientImplMac.h:
1232         * UIProcess/mac/PageClientImplMac.mm:
1233         (WebKit::PageClientImpl::requestDOMPasteAccess):
1234
1235 2019-10-10  youenn fablet  <youenn@apple.com>
1236
1237         Remove unified plan runtime flag
1238         https://bugs.webkit.org/show_bug.cgi?id=202721
1239
1240         Reviewed by Geoffrey Garen.
1241
1242         * Shared/WebPreferences.yaml:
1243         * UIProcess/API/glib/WebKitSettings.cpp:
1244         (webKitSettingsConstructed): Remove ability to disable unified plan.
1245
1246 2019-10-10  Adrian Perez de Castro  <aperez@igalia.com>
1247
1248         Remove a "The " in "The The HTTP headers of the response"
1249         https://bugs.webkit.org/show_bug.cgi?id=194851
1250
1251         Reviewed by Carlos Garcia Campos.
1252
1253         * Shared/API/glib/WebKitURIResponse.cpp:
1254         (webkit_uri_response_class_init): Fix typo in description of the WebKitURIResponse::http-headers property.
1255
1256 2019-10-10  youenn fablet  <youenn@apple.com>
1257
1258         [Mac] Allow SYS___pthread_markcancel call
1259         https://bugs.webkit.org/show_bug.cgi?id=202723
1260
1261         Reviewed by Alex Christensen.
1262
1263         Allow this pthread call as libwebrtc uses it on the Mac as well.
1264
1265         * WebProcess/com.apple.WebProcess.sb.in:
1266
1267 2019-10-09  youenn fablet  <youenn@apple.com>
1268
1269         A service worker process should not be created when enqueuing a service worker job
1270         https://bugs.webkit.org/show_bug.cgi?id=202578
1271         <rdar://problem/55979690>
1272
1273         Reviewed by Chris Dumez.
1274
1275         Remove the calls to create service worker context connection.
1276         They are now done at SWServer level when trying to either run a service worker or install one.
1277
1278         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1279         (WebKit::WebSWServerConnection::startFetch):
1280         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1281         (WebKit::WebSWServerConnection::scheduleJobInServer):
1282
1283 2019-10-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1284
1285         [Clipboard API] Refactor Pasteboard item reading functions to work on both iOS and macOS
1286         https://bugs.webkit.org/show_bug.cgi?id=202647
1287
1288         Reviewed by Tim Horton.
1289
1290         Refactor iOS-specific pasteboard functions to be platform-agnostic. See WebCore ChangeLog for more details.
1291
1292         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1293         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
1294         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
1295         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
1296         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1297         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
1298         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
1299         (WebKit::WebPasteboardProxy::writeURLToPasteboard):
1300         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
1301         (WebKit::WebPasteboardProxy::writeImageToPasteboard):
1302         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
1303         * UIProcess/WebPasteboardProxy.cpp:
1304         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
1305         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
1306         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
1307         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1308         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
1309         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
1310         * UIProcess/WebPasteboardProxy.h:
1311         * UIProcess/WebPasteboardProxy.messages.in:
1312         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
1313         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1314         (WebKit::WebPlatformStrategies::informationForItemAtIndex):
1315         (WebKit::WebPlatformStrategies::readBufferFromPasteboard):
1316         (WebKit::WebPlatformStrategies::readURLFromPasteboard):
1317         (WebKit::WebPlatformStrategies::readStringFromPasteboard):
1318         (WebKit::WebPlatformStrategies::writeToPasteboard):
1319         (WebKit::WebPlatformStrategies::updateSupportedTypeIdentifiers):
1320         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1321
1322 2019-10-09  John Wilander  <wilander@apple.com>
1323
1324         IsLoggedIn: Add as experimental feature
1325         https://bugs.webkit.org/show_bug.cgi?id=202707
1326         <rdar://problem/56095064>
1327
1328         Reviewed by Brent Fulgham and Chris Dumez.
1329
1330         IsLoggedIn was proposed to the WebAppSec WG at TPAC 2019.
1331         So far there is only an explainer posted to the mailing list:
1332         https://lists.w3.org/Archives/Public/public-webappsec/2019Sep/0004.html
1333
1334         * Shared/WebPreferences.yaml:
1335
1336 2019-10-09  Jiewen Tan  <jiewen_tan@apple.com>
1337
1338         [WebAuthn] Move the mock testing entrance to Internals
1339         https://bugs.webkit.org/show_bug.cgi?id=202560
1340         <rdar://problem/55973793>
1341
1342         Reviewed by Chris Dumez.
1343
1344         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1345         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted.
1346         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1347         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
1348         (WebKit::AuthenticatorTransportService::createMock):
1349         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
1350         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
1351         (WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
1352         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
1353         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
1354         (WebKit::MockHidConnection::send):
1355         (WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
1356         (WebKit::MockHidConnection::parseRequest):
1357         (WebKit::MockHidConnection::feedReports):
1358         (WebKit::MockHidConnection::shouldContinueFeedReports):
1359         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
1360         * UIProcess/WebAuthentication/Mock/MockHidService.cpp:
1361         (WebKit::MockHidService::MockHidService):
1362         * UIProcess/WebAuthentication/Mock/MockHidService.h:
1363         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
1364         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1365         (WebKit::MockLocalConnection::MockLocalConnection):
1366         * UIProcess/WebAuthentication/Mock/MockLocalService.h:
1367         * UIProcess/WebAuthentication/Mock/MockLocalService.mm:
1368         (WebKit::MockLocalService::MockLocalService):
1369         * UIProcess/WebAuthentication/Mock/MockNfcService.h:
1370         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
1371         (WebKit::MockNfcService::MockNfcService):
1372         (WebKit::MockNfcService::platformStartDiscovery):
1373         (WebKit::MockNfcService::detectTags const):
1374         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed.
1375         * UIProcess/WebPageProxy.cpp:
1376         (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration):
1377         * UIProcess/WebPageProxy.h:
1378         * UIProcess/WebPageProxy.messages.in:
1379         * UIProcess/WebsiteData/WebsiteDataStore.h:
1380         * WebKit.xcodeproj/project.pbxproj:
1381         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1382         (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration):
1383         * WebProcess/WebCoreSupport/WebChromeClient.h:
1384
1385 2019-10-09  Simon Fraser  <simon.fraser@apple.com>
1386
1387         Rename WheelEventTestTrigger and improve naming in related code
1388         https://bugs.webkit.org/show_bug.cgi?id=202772
1389
1390         Reviewed by Tim Horton.
1391
1392         Change the "test trigger" terminology to "monitor wheel events"; after all, tests
1393         call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering
1394         a test.
1395
1396         * UIProcess/API/C/WKPage.cpp:
1397         (WKPageClearWheelEventTestMonitor):
1398         (WKPageClearWheelEventTestTrigger): Deleted.
1399         * UIProcess/API/C/WKPage.h:
1400         * UIProcess/WebPageProxy.cpp:
1401         (WebKit::WebPageProxy::clearWheelEventTestMonitor):
1402         (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted.
1403         * UIProcess/WebPageProxy.h:
1404         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1405         (WKBundlePageStartMonitoringScrollOperations):
1406         (WKBundlePageRegisterScrollOperationCompletionCallback):
1407         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1408         (WebKit::PDFPlugin::createScrollbar):
1409         * WebProcess/WebPage/EventDispatcher.cpp:
1410         * WebProcess/WebPage/WebPage.cpp:
1411         (WebKit::WebPage::clearWheelEventTestMonitor):
1412         (WebKit::WebPage::clearWheelEventTestTrigger): Deleted.
1413         * WebProcess/WebPage/WebPage.h:
1414         * WebProcess/WebPage/WebPage.messages.in:
1415
1416 2019-10-09  Andy Estes  <aestes@apple.com>
1417
1418         [Cocoa] IPC::decode should gracefully handle a nil allowed class
1419         https://bugs.webkit.org/show_bug.cgi?id=202753
1420
1421         Reviewed by Geoffrey Garen.
1422
1423         If IPC::decode is called with a nil allowed class, an NSInvalidArgumentException will be
1424         thrown when trying to create an NSArray literal with a nil value. Depending on who calls
1425         IPC::decode, this exception might or might not be caught, leading to dropped messages or
1426         crashes.
1427
1428         One case of this happening is tracked by rdar://problem/55839467. In this case, the nil
1429         allowed class was due to a build misconfiguration, and the exception caused the UI process
1430         to not respond to a synchronous IPC message, hanging the WebContent process.
1431
1432         rdar://problem/55839467 was resolved by fixing the build misconfiguration, but this patch
1433         improves IPC::decode so that a nil allowed class results in a message decoding failure
1434         rather than a maybe-caught NSException.
1435
1436         * Shared/Cocoa/ArgumentCodersCocoa.h:
1437         (IPC::decode):
1438
1439 2019-10-09  youenn fablet  <youenn@apple.com>
1440
1441         Remove testRunner.setWebRTCUnifiedPlanEnabled
1442         https://bugs.webkit.org/show_bug.cgi?id=202700
1443
1444         Reviewed by Eric Carlson.
1445
1446         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1447         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1448
1449 2019-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1450
1451         REGRESSION(r250597): [GTK][WPE] 2.27.1 shows HTML content as text/plain in custom protocols when passing a charset in content type
1452         https://bugs.webkit.org/show_bug.cgi?id=202633
1453
1454         Reviewed by Žan Doberšek.
1455
1456         This is a regression of the switch to use the new custom protocols implementation. Before r250597, we extracted
1457         the mime type and charset from content type in the network process, but we are now sending the response directly
1458         from the UI process, so we need to do that when building our response. Rename the mime_type parameter as
1459         content_type to avoid confusion, since it's documented as the content type.
1460
1461         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
1462         (webkitURISchemeRequestReadCallback):
1463         (webkit_uri_scheme_request_finish):
1464         * UIProcess/API/gtk/WebKitURISchemeRequest.h:
1465         * UIProcess/API/wpe/WebKitURISchemeRequest.h:
1466
1467 2019-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1468
1469         [GTK][WPE] about:gpu should also show the client EGL extensions
1470         https://bugs.webkit.org/show_bug.cgi?id=202690
1471
1472         Reviewed by Carlos Alberto Lopez Perez.
1473
1474         We are showing the extensions supported by the display.
1475
1476         * UIProcess/API/glib/WebKitProtocolHandler.cpp:
1477         (WebKit::WebKitProtocolHandler::handleGPU):
1478
1479 2019-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1480
1481         CustomProtocols: convert log messages in WebURLSchemeTaskProxy to RELEASE_LOG
1482         https://bugs.webkit.org/show_bug.cgi?id=202686
1483
1484         Reviewed by Alex Christensen.
1485
1486         Instead of using WTFLogAlways, since those messages are confusing on stdout.
1487
1488         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
1489         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
1490         (WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
1491         (WebKit::WebURLSchemeTaskProxy::didReceiveData):
1492
1493 2019-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1494
1495         [WPE][GTK] WebKitSecurityManager should consider webkit:// to be a local URI scheme
1496         https://bugs.webkit.org/show_bug.cgi?id=202638
1497
1498         Reviewed by Michael Catanzaro.
1499
1500         * UIProcess/API/glib/WebKitProtocolHandler.cpp:
1501         (WebKit::WebKitProtocolHandler::WebKitProtocolHandler):
1502
1503 2019-10-08  Antti Koivisto  <antti@apple.com>
1504
1505         [CSS Shadow Parts] Enable by default
1506         https://bugs.webkit.org/show_bug.cgi?id=202644
1507
1508         Reviewed by Ryosuke Niwa.
1509
1510         * Shared/WebPreferences.yaml:
1511
1512         Flip the switch.
1513
1514 2019-10-08  Andy Estes  <aestes@apple.com>
1515
1516         [iOS] Add a fast path that avoids hit testing during context menu interactions on elements
1517         https://bugs.webkit.org/show_bug.cgi?id=202510
1518         <rdar://problem/55939313>
1519
1520         Reviewed by Tim Horton.
1521
1522         When computing position information for an element, we can store sufficient context
1523         information in InteractionInformationAtPosition such that the same element could be
1524         retrieved again without hit testing. The existing TextInputContext can already store an
1525         element's page identifier, document identifier, and element identifier, which is sufficient
1526         context for such a task.
1527
1528         This patch renames TextInputContext to ElementContext and uses it when populating new
1529         InteractionInformationAtPosition structs in elementPositionInformation(). When a context
1530         menu interaction occurs, WebPage::startInteractionWithElementContextOrPosition() uses this
1531         context to look up the interaction element by its identifier triplet, falling back to hit
1532         testing if this lookup fails.
1533
1534         * Scripts/webkit/messages.py:
1535         * Shared/DocumentEditingContext.h:
1536         * Shared/DocumentEditingContext.mm:
1537         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
1538         * Shared/ElementContext.cpp: Renamed from Source/WebKit/Shared/TextInputContext.cpp.
1539         (IPC::ArgumentCoder<WebKit::ElementContext>::encode):
1540         (IPC::ArgumentCoder<WebKit::ElementContext>::decode):
1541         * Shared/ElementContext.h: Renamed from Source/WebKit/Shared/TextInputContext.h.
1542         (WebKit::operator==):
1543         * Shared/ios/InteractionInformationAtPosition.h:
1544         * Shared/ios/InteractionInformationAtPosition.mm:
1545         (WebKit::InteractionInformationAtPosition::encode const):
1546         (WebKit::InteractionInformationAtPosition::decode):
1547         * Sources.txt:
1548         * UIProcess/API/Cocoa/WKWebView.mm:
1549         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
1550         * UIProcess/API/Cocoa/_WKTextInputContext.mm:
1551         (-[_WKTextInputContext _initWithTextInputContext:]):
1552         (-[_WKTextInputContext _textInputContext]):
1553         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
1554         * UIProcess/WebPageProxy.cpp:
1555         (WebKit::WebPageProxy::textInputContextsInRect):
1556         (WebKit::WebPageProxy::focusTextInputContext):
1557         * UIProcess/WebPageProxy.h:
1558         * UIProcess/ios/WKContentViewInteraction.mm:
1559         (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]):
1560         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
1561         (-[WKContentView continueContextMenuInteraction:]):
1562         (-[WKContentView continueContextMenuInteractionWithDataDetectors:]):
1563         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
1564         * UIProcess/ios/WebPageProxyIOS.mm:
1565         (WebKit::WebPageProxy::startInteractionWithPositionInformation):
1566         (WebKit::WebPageProxy::startInteractionWithElementAtPosition): Deleted.
1567         * WebKit.xcodeproj/project.pbxproj:
1568         * WebProcess/WebPage/WebPage.cpp:
1569         (WebKit::WebPage::textInputContextsInRect):
1570         (WebKit::WebPage::focusTextInputContext):
1571         (WebKit::WebPage::elementForContext const):
1572         (WebKit::WebPage::contextForElement const):
1573         (WebKit::WebPage::elementForTextInputContext): Deleted.
1574         * WebProcess/WebPage/WebPage.h:
1575         * WebProcess/WebPage/WebPage.messages.in:
1576         * WebProcess/WebPage/ios/WebPageIOS.mm:
1577         (WebKit::elementPositionInformation):
1578         (WebKit::WebPage::startInteractionWithElementContextOrPosition):
1579         (WebKit::WebPage::requestDocumentEditingContext):
1580         (WebKit::WebPage::startInteractionWithElementAtPosition): Deleted.
1581
1582 2019-10-08  Adrian Perez de Castro  <aperez@igalia.com>
1583
1584         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.27.1 release
1585
1586         * wpe/NEWS: Add release notes for 2.27.1
1587
1588 2019-10-08  Kate Cheney  <katherine_cheney@apple.com>
1589
1590         Implement Telemetry and Dumping Routines for SQLite backend (195088)
1591         https://bugs.webkit.org/show_bug.cgi?id=195088
1592         <rdar://problem/54213407>
1593
1594         Reviewed by John Wilander.
1595
1596         Implemented database telemetry calculating for ITP. Mimicked
1597         ResourceLoadStatisticsMemoryStore telemetry logging behavior using
1598         SQLite Queries as opposed to vector sorting/manipulation. Once fully
1599         integrated, this will simplify analysis of ITP data by transitioning
1600         ITP data storage from a plist to a SQLite database.
1601
1602         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1603         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1604         Added SQL queries to be initialized in the constructor. These queries
1605         are needed to mimic the telemetry calculations done in
1606         ResourceLoadStatisticsMemoryStore.
1607         
1608         (WebKit::resetStatement):
1609         To reduce code duplication, this function holds common code to reset
1610         a SQL query.
1611
1612         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
1613         Added SQL queries needed for telemetry calculations to be prepared.
1614         
1615         (WebKit::joinSubStatisticsForSorting):
1616         This function returns the query string for sorting resources that is
1617         shared by many queries.
1618
1619         (WebKit::ResourceLoadStatisticsDatabaseStore::getMedianOfPrevalentResourcesWithUserInteraction const):
1620         Implemented a function to take the median days since user interaction
1621         from all prevalent resources in the database with user interaction
1622         (sorted by max count of subframes, subresources and unique redirects under
1623         the top frame domain).
1624
1625         (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResources const):
1626         Executes a SQL query to get the number of prevalent resources to log as
1627         telemetry.
1628
1629         (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResourcesWithUI const):
1630         Executes a SQL query to get the number of prevalent resources with user
1631         interaction to log as telemetry.
1632
1633         (WebKit::ResourceLoadStatisticsDatabaseStore::getTopPrevelentResourceDaysSinceUI const):
1634         Prepares and executes a SQL query to get the days since user
1635         interaction from the top prevalent resource to be recorded as
1636         telemetry data.
1637
1638         (WebKit::ResourceLoadStatisticsDatabaseStore::getMedianStatisticOfPrevalentResourceWithoutUserInteraction const):
1639         Implemented a function which takes a statistic and returns the value
1640         of that statistic for the median prevalent resource without user
1641         interaction to be recorded as telemetry data.
1642
1643         (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResourcesInTopResources const):
1644         Returns the count of prevalent resources in the top x resources
1645         sorted by sum of substatistics again to be logged as telemetry.
1646
1647         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateTelemetryData const):
1648         Function which executes all functions which populate the struct with
1649         telemetry data. This struct will then be passed to
1650         WebResourceLoadStatisticsTelemetry to be logged.
1651
1652         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const):
1653         Initializes the telemetry struct and calls the function to populate
1654         it, then passes it to the WebResourceLoadStatisticsTelemetry object
1655         to be recorded.
1656
1657         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1658         Describe PrevalentResourceDatabaseTelemetry Struct to be passed and
1659         logged as telemetry data.
1660
1661         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
1662         (WebKit::databaseSubmitTopLists):
1663         Logging telemetry data by looping through 2D array of statistics for
1664         the top 1, 3, 10, 50, and 100 prevalent resources sorted by the sum
1665         of substatistics under the top frame domain. This matches the logging
1666         already done in ResourceLoadStatisticsMemoryStore.
1667
1668         (WebKit::WebResourceLoadStatisticsTelemetry::submitTelemetry):
1669         Submits data to the webPageProxy logs and plists.
1670
1671         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.h:
1672         Added new submitTopList function to accomodate database telemetry
1673         logging.
1674         
1675         * NetworkProcess/NetworkSession.cpp:
1676         (WebKit::NetworkSession::notifyPageStatisticsTelemetryFinished):
1677         * NetworkProcess/NetworkSession.h:
1678         * UIProcess/Network/NetworkProcessProxy.cpp:
1679         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsTelemetryFinished):
1680         * UIProcess/Network/NetworkProcessProxy.h:
1681         * UIProcess/Network/NetworkProcessProxy.messages.in:
1682         Updated the current testing for telemetry which only tested 3
1683         statistics. With this patch it now tests 10 statistics.
1684
1685 2019-10-08  Adrian Perez de Castro  <aperez@igalia.com>
1686
1687         [GTK][WPE] Fix non-unified builds after r250486
1688         https://bugs.webkit.org/show_bug.cgi?id=202636
1689
1690         Reviewed by Youenn Fablet.
1691
1692         * NetworkProcess/NetworkConnectionToWebProcess.cpp: Add missing inclusion of the
1693         Logging.h header.
1694
1695 2019-10-08  Brady Eidson  <beidson@apple.com>
1696
1697         Service Worker Fetch events should time out.
1698         https://bugs.webkit.org/show_bug.cgi?id=202188
1699
1700         Reviewed by Alex Christensen.
1701
1702         When we start a fetch task in the server, we also start a timeout on that fetch task.
1703         
1704         "Time out" means the fetch task must continue to make progress at the given frequency (once every 60 seconds by default)
1705
1706         If any given fetch task times out in a service worker instance, that instance loses the right to handle fetches.
1707         
1708         * NetworkProcess/NetworkProcess.cpp:
1709         (WebKit::NetworkProcess::setServiceWorkerFetchTimeoutForTesting):
1710         (WebKit::NetworkProcess::resetServiceWorkerFetchTimeoutForTesting):
1711         * NetworkProcess/NetworkProcess.h:
1712         (WebKit::NetworkProcess::serviceWorkerFetchTimeout const):
1713         * NetworkProcess/NetworkProcess.messages.in:
1714
1715         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
1716         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
1717         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse): 
1718         (WebKit::ServiceWorkerFetchTask::didReceiveResponse): 
1719         (WebKit::ServiceWorkerFetchTask::didReceiveData): 
1720         (WebKit::ServiceWorkerFetchTask::didReceiveFormData): 
1721         (WebKit::ServiceWorkerFetchTask::didFinish): 
1722         (WebKit::ServiceWorkerFetchTask::didFail): 
1723         (WebKit::ServiceWorkerFetchTask::didNotHandle): 
1724         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
1725         (WebKit::ServiceWorkerFetchTask::create):
1726         (WebKit::ServiceWorkerFetchTask::serviceWorkerIdentifier const):
1727         (WebKit::ServiceWorkerFetchTask::wasHandled const):
1728         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask): Deleted.
1729
1730         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1731         (WebKit::WebSWServerConnection::startFetch):
1732         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1733
1734         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1735         (WebKit::WebSWServerToContextConnection::startFetch):
1736         (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut):
1737         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1738
1739         * UIProcess/API/C/WKContext.cpp:
1740         (WKContextSetServiceWorkerFetchTimeoutForTesting):
1741         (WKContextResetServiceWorkerFetchTimeoutForTesting):
1742         * UIProcess/API/C/WKContext.h:
1743
1744         * UIProcess/WebProcessPool.cpp:
1745         (WebKit::WebProcessPool::setServiceWorkerTimeoutForTesting):
1746         (WebKit::WebProcessPool::resetServiceWorkerTimeoutForTesting):
1747         * UIProcess/WebProcessPool.h:
1748
1749 2019-10-08  Ross Kirsling  <ross.kirsling@sony.com>
1750
1751         Unreviewed. Restabilize non-unified build.
1752
1753         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1754
1755 2019-10-08  Dean Jackson  <dino@apple.com>
1756
1757         Sort Internal and Experimental features by human readable name
1758         https://bugs.webkit.org/show_bug.cgi?id=202667
1759
1760         Reviewed by Zalan Bujtas.
1761
1762         Sort the statically generated vectors of internal and
1763         experimental features by their human readable name, rather than
1764         the feature key, so that looking at them in the Settings app
1765         doesn't make people who like alphabetical order angry.
1766
1767         * Scripts/GeneratePreferences.rb: Add an extra sort call to the list generation.
1768
1769 2019-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1770
1771         [Clipboard API] Introduce bindings for the async Clipboard API
1772         https://bugs.webkit.org/show_bug.cgi?id=202622
1773         <rdar://problem/56038126>
1774
1775         Reviewed by Ryosuke Niwa.
1776
1777         Adds a new experimental feature flag. See WebCore ChangeLog for more details.
1778
1779         * Shared/WebPreferences.yaml:
1780
1781 2019-10-08  Alexander Mikhaylenko  <alexm@gnome.org>
1782
1783         [GTK] Navigation gesture improvements
1784         https://bugs.webkit.org/show_bug.cgi?id=202645
1785
1786         Reviewed by Carlos Garcia Campos.
1787
1788         Measure velocity threshold in pixels per second rather than distance (range [0-1])
1789         per second. The value is the same as it was on touchpads, since a fixed distance is
1790         used, but is now consistent on touchscreens, regardless of the webview width.
1791
1792         Add a threshold for cancelling gesture when the page is more than halfway
1793         through, so that it's symmetric with the first half.
1794
1795         Align the moving page to pixel grid on hidpi devices correctly. Just
1796         rounding the position doesn't work correctly, since the cairo context is
1797         pre-scaled. Multiplying by scale factor, rounding and then dividing by
1798         scale factor fixes this.
1799
1800         * UIProcess/ViewGestureController.h:
1801         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
1802         (WebKit::ViewGestureController::SwipeProgressTracker::reset):
1803         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
1804         (WebKit::ViewGestureController::SwipeProgressTracker::shouldCancel):
1805         (WebKit::ViewGestureController::draw):
1806
1807 2019-10-08  Carlos Garcia Campos  <cgarcia@igalia.com>
1808
1809         Unreviewed. Remove unused WebKitSoupRequestGeneric after r250597
1810
1811         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
1812
1813 2019-10-08  Adrian Perez de Castro  <aperez@igalia.com>
1814
1815         [WPE][GTK] Build fails with ENABLE_WEBDRIVER=OFF
1816         https://bugs.webkit.org/show_bug.cgi?id=202658
1817
1818         Reviewed by Carlos Garcia Campos.
1819
1820         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: Add missing
1821         ENABLE(WEBDRIVER_MOUSE_INTERACTIONS) and ENABLE(WEBDRIVER_KEYBOARD_INTERACTIONS)
1822         preprocessor guards.
1823         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: Ditto.
1824
1825 2019-10-07  Ryosuke Niwa  <rniwa@webkit.org>
1826
1827         Add IDL for requestIdleCallback
1828         https://bugs.webkit.org/show_bug.cgi?id=202653
1829
1830         Reviewed by Geoffrey Garen.
1831
1832         * Shared/WebPreferences.yaml:
1833
1834 2019-10-07  Kate Cheney  <katherine_cheney@apple.com>
1835
1836         Domain relationships in the ITP Database should be inserted in a single query and ignore repeat insert attempts. (202604)
1837         https://bugs.webkit.org/show_bug.cgi?id=202604
1838         <rdar://problem/55995831>
1839
1840         Reviewed by Chris Dumez. 
1841         
1842         This patch addresses two clean-ups for the ITP SQLite Database Store.
1843         First, by using INSERT OR IGNORE as opposed to INSERT, it eliminates
1844         the need to check if a relationship already exists in the database
1845         before inserting it. Second, instead of looping through domain lists
1846         and inserting each relationship as a separate query, this patch now
1847         converts lists to a string which SQLite can use to insert multiple
1848         rows into a database using a single query.
1849
1850         Some Exists queries could not be deleted because they were being
1851         used for testing.
1852
1853         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1854         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1855         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
1856         Removed old insert queries and replaced them with queries able to
1857         insert string-lists of domains in a single query. Also reorganized
1858         the queries by functionality to make them easier to find and edit.
1859
1860         (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices):
1861         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
1862         In order to properly take advantage of the INSERT OR IGNORE
1863         functionality, unique indices must be established so the SQLite table
1864         is aware of what patterns to look for when ignoring a new insert.
1865
1866         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndmakeDomainList):
1867         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
1868         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
1869         Looping through the domain list is no longer needed with the new query
1870         changes. Additionally, ensuring a domain is in the Observed Domains
1871         table of the database must be done before utilizing any inserting of 
1872         relationships because the relationship queries rely on fetching the
1873         topFrame domainID from the ObservedDomains table.
1874
1875         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
1876         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
1877         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
1878         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameDomain):
1879         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameDomain):
1880         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
1881         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
1882         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
1883         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
1884         With the ensure check being done once in the ensureAndmakeDomainList
1885         function, these functions no longer have to make that check before
1886         inserting.
1887         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1888
1889         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1890         (WebKit::WebResourceLoadStatisticsStore::mergeStatisticForTesting):
1891         (WebKit::WebResourceLoadStatisticsStore::isRelationshipOnlyInDatabaseOnce):
1892         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1893         Changes in WeResourceLoadStatisticsStore were for testing only. This
1894         patch updated the merge statistic testing to also test this change by
1895         having a topFrameDomain list with more than one domain.
1896
1897         * NetworkProcess/NetworkProcess.cpp:
1898         (WebKit::NetworkProcess::mergeStatisticForTesting):
1899         (WebKit::NetworkProcess::isRelationshipOnlyInDatabaseOnce):
1900         * NetworkProcess/NetworkProcess.h:
1901         * NetworkProcess/NetworkProcess.messages.in:
1902         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1903         (WKWebsiteDataStoreSetStatisticsMergeStatistic):
1904         (WKWebsiteDataStoreIsStatisticsOnlyInDatabaseOnce):
1905         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1906         * UIProcess/Network/NetworkProcessProxy.cpp:
1907         (WebKit::NetworkProcessProxy::mergeStatisticForTesting):
1908         (WebKit::NetworkProcessProxy::isRelationshipOnlyInDatabaseOnce):
1909         * UIProcess/Network/NetworkProcessProxy.h:
1910         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1911         (WebKit::WebsiteDataStore::mergeStatisticForTesting):
1912         (WebKit::WebsiteDataStore::isRelationshipOnlyInDatabaseOnce):
1913         * UIProcess/WebsiteData/WebsiteDataStore.h:
1914         Added a new function for testing that there are no repeat inserts
1915         into the database. Updated mergeStatistics to test the list-insert
1916         functionality.
1917
1918 2019-10-07  Yusuke Suzuki  <ysuzuki@apple.com>
1919
1920         [JSC] Change signature of HostFunction to (JSGlobalObject*, CallFrame*)
1921         https://bugs.webkit.org/show_bug.cgi?id=202569
1922
1923         Reviewed by Saam Barati.
1924
1925         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
1926         (WebKit::callMethod):
1927         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1928         (WebKit::callNPJSObject):
1929         (WebKit::constructWithConstructor):
1930         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
1931
1932 2019-10-07  Megan Gardner  <megan_gardner@apple.com>
1933
1934         Switch to WKShareSheet for WKPDFView
1935         https://bugs.webkit.org/show_bug.cgi?id=202338
1936
1937         Reviewed by Tim Horton.
1938
1939         Switch to WKShareSheet from the share sheet in UIWKSelectionAssistant, since this is the only instance
1940         of UIWKSelectionAssistant any more. This will keep all our share sheet code together, and allow
1941         us to eliminate this class that will be completely unused with this change.
1942
1943         * Platform/spi/ios/UIKitSPI.h:
1944         * UIProcess/ios/WKPDFView.h:
1945         * UIProcess/ios/WKPDFView.mm:
1946         (-[WKPDFView dealloc]):
1947         (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
1948         (-[WKPDFView shareSheetDidDismiss:]):
1949
1950 2019-10-07  Per Arne Vollan  <pvollan@apple.com>
1951
1952         [macOS] Layering violation in AuxiliaryProcessProxy::didFinishLaunching
1953         https://bugs.webkit.org/show_bug.cgi?id=201617
1954
1955         Reviewed by Brent Fulgham.
1956
1957         The commit <https://trac.webkit.org/changeset/249649> introduced a layering violation in AuxiliaryProcessProxy::didFinishLaunching
1958         where we inspect the pending message queue looking for a local file load message which needs the PID to create a sandbox extension
1959         for the WebContent process. The layering violation can be fixed by creating a virtual method in AuxiliaryProcessProxy and override
1960         the method in the WebProcessProxy to do the work needed to replace the message with a load request message containing a sandbox
1961         extension created using the PID of the WebContent process. No new tests have been created, since this is covered by existing tests.
1962
1963         * UIProcess/AuxiliaryProcessProxy.cpp:
1964         (WebKit::AuxiliaryProcessProxy::didFinishLaunching):
1965         * UIProcess/AuxiliaryProcessProxy.h:
1966         (WebKit::AuxiliaryProcessProxy::shouldSendPendingMessage):
1967         * UIProcess/WebProcessProxy.cpp:
1968         (WebKit::WebProcessProxy::shouldSendPendingMessage):
1969         * UIProcess/WebProcessProxy.h:
1970
1971 2019-10-07  Dean Jackson  <dino@apple.com>
1972
1973         Provide options for DTTZ to happen in more situations
1974         https://bugs.webkit.org/show_bug.cgi?id=202634
1975         <rdar://problem/55732762>
1976
1977         Reviewed by Antoine Quint.
1978
1979         Add two options that can be enabled to trigger double tap zooming 
1980         in more places.
1981
1982         Firstly, an option to keep listening for a double-tap-to-zoom if the
1983         first tap found a click handler on the body or document element. The
1984         tap will still be dispatched. This is probably the most common case
1985         for disabling a DTTZ.
1986
1987         Secondly, an option to always keep listening for a double-tap-to-zoom,
1988         even if there was a clickable (non-root) element under the first tap.
1989
1990         * Shared/WebPreferences.yaml: Add ZoomOnDoubleTapWhenRoot and AlwaysZoomOnDoubleTap.
1991         * UIProcess/PageClient.h: The message from the WebProcess now tells the UIProcess if
1992         the tapped element was a root-level (document or body).
1993         * UIProcess/WebPageProxy.h:
1994         * UIProcess/WebPageProxy.messages.in:
1995         * UIProcess/ios/PageClientImplIOS.h:
1996         * UIProcess/ios/PageClientImplIOS.mm:
1997         (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
1998         * UIProcess/ios/WKContentViewInteraction.h:
1999         * UIProcess/ios/WKContentViewInteraction.mm:
2000         (-[WKContentView _endPotentialTapAndEnableDoubleTapGesturesIfNecessary]):
2001         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]):
2002         Handle the two new options.
2003
2004         * UIProcess/ios/WebPageProxyIOS.mm:
2005         (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
2006         * WebProcess/WebPage/ios/WebPageIOS.mm:
2007         (WebKit::WebPage::potentialTapAtPosition): Check if the tap was on a root-level element.
2008
2009 2019-10-07  Matt Mokary  <mmokary@apple.com>
2010
2011         foundStringMatchIndex in FindController::findString gets reset on page scroll
2012         https://bugs.webkit.org/show_bug.cgi?id=201773
2013         <rdar://problem/55351892>
2014
2015         Reviewed by Tim Horton.
2016
2017         Decouple hiding of the find indicator from resetting match index, and only reset match index when there is not
2018         an active match.
2019
2020         * WebProcess/WebPage/FindController.cpp:
2021         (WebKit::FindController::updateFindUIAfterPageScroll):
2022         (WebKit::FindController::hideFindUI):
2023         (WebKit::FindController::hideFindIndicator):
2024         (WebKit::FindController::resetMatchIndex):
2025         * WebProcess/WebPage/FindController.h:
2026         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2027         (WebKit::FindController::hideFindIndicator):
2028         (WebKit::FindController::resetMatchIndex):
2029
2030 2019-10-07  youenn fablet  <youenn@apple.com>
2031
2032         WebPageProxy::updatePlayingMediaDidChange should protect from a null m_userMediaPermissionRequestManager
2033         https://bugs.webkit.org/show_bug.cgi?id=202628
2034         <rdar://problem/55935091>
2035
2036         Reviewed by Eric Carlson.
2037
2038         On process swap on navigation or process crash, m_userMediaPermissionRequestManager is made null.
2039         At the same time, the media state is set back to not playing.
2040         Future calls of updatePlayingMediaDidChange should not have any capture state change until getUserMedia/getDisplayMedia
2041         is called, which would create m_userMediaPermissionRequestManager.
2042         But this assumption is not always true given that the media state is computed as process-wide in MediaStreamTrack::captureState on iOS.
2043         The above behavior is fixed as part of https://bugs.webkit.org/show_bug.cgi?id=202627.
2044         Since the call to updatePlayingMediaDidChange is triggered straight from IPC, it should not be trusted and a null check should be added.
2045
2046         * UIProcess/WebPageProxy.cpp:
2047         (WebKit::WebPageProxy::updatePlayingMediaDidChange):
2048
2049 2019-10-04  Dean Jackson  <dino@apple.com>
2050
2051         Use a better name than allowFastClicksEverywhere
2052         https://bugs.webkit.org/show_bug.cgi?id=202607
2053         <rdar://problem/55997133>
2054
2055         Reviewed by Tim Horton.
2056
2057         This preference name is quite confusing. Change it to
2058         PreferFasterClickOverDoubleTap.
2059
2060         * Shared/WebPreferences.yaml:
2061         * Shared/WebPreferencesDefaultValues.h:
2062         * UIProcess/WebPageProxy.h:
2063         (WebKit::WebPageProxy::preferFasterClickOverDoubleTap const):
2064         (WebKit::WebPageProxy::allowsFastClicksEverywhere const): Deleted.
2065         * UIProcess/ios/WKContentViewInteraction.mm:
2066         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
2067         * UIProcess/ios/WebPageProxyIOS.mm:
2068         (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
2069
2070 2019-10-04  Ross Kirsling  <ross.kirsling@sony.com>
2071
2072         Socket-based RWI should base64-encode backend commands on client, not server
2073         https://bugs.webkit.org/show_bug.cgi?id=202605
2074
2075         Reviewed by Don Olmstead.
2076
2077         * UIProcess/socket/RemoteInspectorClient.cpp:
2078         (WebKit::RemoteInspectorClient::setBackendCommands):
2079
2080 2019-10-04  Jiewen Tan  <jiewen_tan@apple.com>
2081
2082         Unreviewed, build fix after r250729
2083
2084         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
2085         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
2086
2087 2019-10-04  Keith Rollin  <krollin@apple.com>
2088
2089         Fix determination of the top-level resource
2090         https://bugs.webkit.org/show_bug.cgi?id=202491
2091         <rdar://problem/50780648>
2092
2093         Reviewed by Youenn Fablet.
2094
2095         When loading the resources associated with a page, the Networking
2096         process needs to know the main resource for the main frame. It uses
2097         this information to keep track of page loads and the resources that
2098         are loaded in those pages. By keeping track of this information,
2099         WebKit can track and report difficult (slow or incomplete) resource
2100         loads and their impact on the overall page.
2101
2102         The initial determination of the top resource only looked at whether
2103         the resource was the "main" resource of a frame or not. However, this
2104         determination was insufficient, and would confuse the tracking
2105         mechanism when sub-frames also had main frames. Therefore, augment the
2106         test by also looking to see if the hosting frame is the main frame.
2107
2108         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2109         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
2110         * NetworkProcess/NetworkConnectionToWebProcess.h:
2111         * NetworkProcess/NetworkResourceLoader.cpp:
2112         (WebKit::NetworkResourceLoader::start):
2113
2114 2019-10-04  Ross Kirsling  <ross.kirsling@sony.com>
2115
2116         Unreviewed WinCairo build fix for r250717.
2117
2118         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
2119         (WebKit::LayerTreeHost::invalidate): Deleted.
2120
2121 2019-10-04  Alex Christensen  <achristensen@webkit.org>
2122
2123         Stop sending list of display-isolated schemes to NetworkProcess
2124         https://bugs.webkit.org/show_bug.cgi?id=202557
2125
2126         Reviewed by Youenn Fablet.
2127
2128         * NetworkProcess/NetworkProcess.cpp:
2129         (WebKit::NetworkProcess::initializeNetworkProcess):
2130         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const): Deleted.
2131         * NetworkProcess/NetworkProcess.h:
2132         * NetworkProcess/NetworkProcess.messages.in:
2133         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2134         (WebKit::NetworkProcessCreationParameters::encode const):
2135         (WebKit::NetworkProcessCreationParameters::decode):
2136         * NetworkProcess/NetworkProcessCreationParameters.h:
2137         * UIProcess/WebProcessPool.cpp:
2138         (WebKit::WebProcessPool::ensureNetworkProcess):
2139         (WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):
2140
2141 2019-10-04  Alex Christensen  <achristensen@webkit.org>
2142
2143         Rename SchemeRegistry to LegacySchemeRegistry
2144         https://bugs.webkit.org/show_bug.cgi?id=202586
2145
2146         Reviewed by Tim Horton.
2147
2148         * NetworkProcess/NetworkLoadChecker.cpp:
2149         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
2150         * NetworkProcess/NetworkProcess.cpp:
2151         (WebKit::NetworkProcess::registerURLSchemeAsSecure const):
2152         (WebKit::NetworkProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
2153         (WebKit::NetworkProcess::registerURLSchemeAsLocal const):
2154         (WebKit::NetworkProcess::registerURLSchemeAsNoAccess const):
2155         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const):
2156         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const):
2157         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
2158         * Shared/AuxiliaryProcess.cpp:
2159         (WebKit::AuxiliaryProcess::registerURLSchemeServiceWorkersCanHandle const):
2160         * UIProcess/API/Cocoa/WKWebView.mm:
2161         (+[WKWebView handlesURLScheme:]):
2162         * UIProcess/API/glib/WebKitSecurityManager.cpp:
2163         (registerSecurityPolicyForURIScheme):
2164         (checkSecurityPolicyForURIScheme):
2165         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2166         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
2167         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2168         (WebKit::WebServiceWorkerProvider::handleFetch):
2169         * WebProcess/WebPage/WebPage.cpp:
2170         (WebKit::WebPage::canHandleRequest):
2171         * WebProcess/WebProcess.cpp:
2172         (WebKit::WebProcess::registerURLSchemeAsEmptyDocument):
2173         (WebKit::WebProcess::registerURLSchemeAsSecure const):
2174         (WebKit::WebProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
2175         (WebKit::WebProcess::setDomainRelaxationForbiddenForURLScheme const):
2176         (WebKit::WebProcess::registerURLSchemeAsLocal const):
2177         (WebKit::WebProcess::registerURLSchemeAsNoAccess const):
2178         (WebKit::WebProcess::registerURLSchemeAsDisplayIsolated const):
2179         (WebKit::WebProcess::registerURLSchemeAsCORSEnabled const):
2180         (WebKit::WebProcess::registerURLSchemeAsAlwaysRevalidated const):
2181         (WebKit::WebProcess::registerURLSchemeAsCachePartitioned const):
2182         (WebKit::WebProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
2183         * WebProcess/WebStorage/StorageAreaImpl.cpp:
2184
2185 2019-10-04  Jiewen Tan  <jiewen_tan@apple.com>
2186
2187         [WebAuthn] Implement _WKWebAuthenticationPanel SPI
2188         https://bugs.webkit.org/show_bug.cgi?id=202559
2189         <rdar://problem/55932094>
2190
2191         Reviewed by Brent Fulgham.
2192
2193         This patch implements _WKWebAuthenticationPanel SPI. Here is the structure:
2194         1) API::WebAuthenticationPanel is the APIObject of _WKWebAuthenticationPanel. It is owned by AuthenticatorManager.
2195         The lifetime of _WKWebAuthenticationPanel on the other hand is managed by clients. This binding is the surface
2196         where clients could interact with WebKit's WebAuthentication implementation.
2197         2) API::WebAuthenticationPanelClient is a base class representing _WKWebAuthenticationPanelDelegate. Its subclass
2198         WebKit::WebAuthenticationPanelClient implements bridges to _WKWebAuthenticationPanelDelegate methods. It is owned by
2199         API::WebAuthenticationPanel. A weak pointer of WebKit::WebAuthenticationPanelClient is kept in _WKWebAuthenticationPanel
2200         to get the _WKWebAuthenticationPanelDelegate set by clients or nil otherwise. This binding is the surface where WebKit
2201         interacts with clients.
2202         3) WebAuthenticationPanelFlags is the mirror of enums within _WKWebAuthenticationPanel.
2203
2204         Implementation wise, this patch implements:
2205         1) -[WKUIDelegatePrivate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:], this is bridged from
2206         the regular UIDelegate route. Noted, WKFrameInfo is nil for now, a follow up on Bug 202563 will take care of it. This
2207         will be called from AuthenticatorManager::runPanel() which gates the start of discovery on the callback. For clients
2208         that don't implement the delegate, the callback will always be called with _WKWebAuthenticationPanelResultUnavailable
2209         to allow WebKit run on non-UI mode. A specific C API hack is added to always return _WKWebAuthenticationPanelResultPresented
2210         in WebKitTestRunner for layout tests.
2211         2) -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] will be implemented in Bug 200932.
2212         3) -[_WKWebAuthenticationPanelDelegate panel:dismissWebAuthenticationPanelWithResult:], this is bridged from
2213         API::WebAuthenticationPanel/API::WebAuthenticationPanelClient. This will be called whenever AuthenticatorManager::m_pendingCompletionHandler
2214         is invoked. Depending on the respond, _WKWebAuthenticationResult will be returned accordingly. To facilitate that,
2215         invokePendingCompletionHandler is crafted to bundle those two operations.
2216         4) -[_WKWebAuthenticationPanel cancel] will be implemented in Bug 191523.
2217
2218         Besides the above, this patch also silents the NFC action sheet.
2219
2220         * Platform/spi/Cocoa/NearFieldSPI.h:
2221         * Shared/API/APIObject.h:
2222         * Shared/Cocoa/APIObject.mm:
2223         (API::Object::newObject):
2224         * Sources.txt:
2225         * SourcesCocoa.txt:
2226         * UIProcess/API/APIUIClient.h:
2227         (API::UIClient::runWebAuthenticationPanel):
2228         * UIProcess/API/APIWebAuthenticationPanel.cpp: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm.
2229         (API::WebAuthenticationPanel::create):
2230         (API::WebAuthenticationPanel::WebAuthenticationPanel):
2231         (API::WebAuthenticationPanel::setClient):
2232         * UIProcess/API/APIWebAuthenticationPanel.h: Copied from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h.
2233         * UIProcess/API/APIWebAuthenticationPanelClient.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h.
2234         (API::WebAuthenticationPanelClient::dismissPanel const):
2235         * UIProcess/API/C/WKPage.cpp:
2236         (WKPageSetPageUIClient):
2237         * UIProcess/API/C/WKPageUIClient.h:
2238         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
2239         (-[_WKWebAuthenticationPanel dealloc]):
2240         (-[_WKWebAuthenticationPanel relyingPartyID]):
2241         (-[_WKWebAuthenticationPanel delegate]):
2242         (-[_WKWebAuthenticationPanel setDelegate:]):
2243         (-[_WKWebAuthenticationPanel _apiObject]):
2244         (-[_WKWebAuthenticationPanel _initWithRelayingPartyID:]): Deleted.
2245         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
2246         * UIProcess/Cocoa/UIDelegate.h:
2247         * UIProcess/Cocoa/UIDelegate.mm:
2248         (WebKit::UIDelegate::setDelegate):
2249         (WebKit::webAuthenticationPanelResult):
2250         (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
2251         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2252         (WebKit::WebCore::isFeatureEnabled):
2253         (WebKit::WebCore::getRpId):
2254         (WebKit::AuthenticatorManager::handleRequest):
2255         (WebKit::AuthenticatorManager::respondReceived):
2256         (WebKit::AuthenticatorManager::startDiscovery):
2257         (WebKit::AuthenticatorManager::initTimeOutTimer):
2258         (WebKit::AuthenticatorManager::timeOutTimerFired):
2259         (WebKit::AuthenticatorManager::runPanel):
2260         (WebKit::AuthenticatorManager::startRequest):
2261         (WebKit::AuthenticatorManager::invokePendingCompletionHandler):
2262         (WebKit::AuthenticatorManagerInternal::collectTransports): Deleted.
2263         (WebKit::AuthenticatorManagerInternal::processGoogleLegacyAppIdSupportExtension): Deleted.
2264         * UIProcess/WebAuthentication/AuthenticatorManager.h:
2265         (WebKit::AuthenticatorManager::pendingCompletionHandler): Deleted.
2266         * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
2267         (WebKit::NfcConnection::NfcConnection):
2268         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
2269         (WebKit::NfcService::platformStartDiscovery):
2270         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: Copied from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h.
2271         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp.
2272         (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
2273         (WebKit::wkWebAuthenticationResult):
2274         (WebKit::WebAuthenticationPanelClient::dismissPanel const):
2275         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
2276         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
2277         * UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h.
2278         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
2279         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
2280         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
2281         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
2282         * WebKit.xcodeproj/project.pbxproj:
2283
2284 2019-10-04  Alex Christensen  <achristensen@webkit.org>
2285
2286         Move WKProcessPool._registerURLSchemeServiceWorkersCanHandle to _WKWebsiteDataStoreConfiguration
2287         https://bugs.webkit.org/show_bug.cgi?id=202553
2288
2289         Reviewed by Youenn Fablet.
2290
2291         It was only used for testing, and all the tests that use it still pass with the new SPI.
2292
2293         * NetworkProcess/NetworkProcess.cpp:
2294         (WebKit::NetworkProcess::initializeNetworkProcess):
2295         (WebKit::NetworkProcess::addWebsiteDataStore):
2296         (WebKit::NetworkProcess::swServerForSession):
2297         (WebKit::NetworkProcess::addServiceWorkerSession):
2298         * NetworkProcess/NetworkProcess.h:
2299         * Shared/AuxiliaryProcess.cpp:
2300         (WebKit::AuxiliaryProcess::registerURLSchemeServiceWorkersCanHandle const): Deleted.
2301         * Shared/AuxiliaryProcess.h:
2302         * Shared/AuxiliaryProcess.messages.in:
2303         * Shared/WebsiteDataStoreParameters.cpp:
2304         (WebKit::WebsiteDataStoreParameters::encode const):
2305         (WebKit::WebsiteDataStoreParameters::decode):
2306         * Shared/WebsiteDataStoreParameters.h:
2307         * UIProcess/API/Cocoa/WKProcessPool.mm:
2308         (-[WKProcessPool _registerURLSchemeServiceWorkersCanHandle:]): Deleted.
2309         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2310         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2311         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2312         (-[_WKWebsiteDataStoreConfiguration registerURLSchemeServiceWorkersCanHandleForTesting:]):
2313         * UIProcess/WebProcessPool.cpp:
2314         (WebKit::WebProcessPool::ensureNetworkProcess):
2315         (WebKit::WebProcessPool::initializeNewWebProcess):
2316         (WebKit::WebProcessPool::registerURLSchemeServiceWorkersCanHandle): Deleted.
2317         * UIProcess/WebProcessPool.h:
2318         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2319         (WebKit::WebsiteDataStore::parameters):
2320         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2321         (WebKit::WebsiteDataStoreConfiguration::copy):
2322         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2323         (WebKit::WebsiteDataStoreConfiguration::serviceWorkerRegisteredSchemes const):
2324         (WebKit::WebsiteDataStoreConfiguration::registerServiceWorkerScheme):
2325         * WebProcess/WebProcess.cpp:
2326         (WebKit::WebProcess::initializeWebProcess):
2327
2328 2019-10-04  youenn fablet  <youenn@apple.com>
2329
2330         Allow to suspend RTCPeerConnection when not connected
2331         https://bugs.webkit.org/show_bug.cgi?id=202403
2332
2333         Reviewed by Chris Dumez.
2334
2335         Implement suspend/resume of sockets by doing the following:
2336         - For UDP sockets, we simulate as if being sent data is queued when being suspended.
2337         the webrtc backend will then stop sending packets until the queue is emptied.
2338         At resume time, we do as if the queue is emptied and packets sent (even though packets are not sent).
2339         For incoming traffic, we ignore it when being suspended.
2340         - For TCP sockets, we close them at suspend time. We then notify at resume time that an error happeneded
2341         for these sockets to the webrtc backend. We cannot simulate packet dropping like in the UDP case.
2342
2343         To manage resume/suspend, each socket now has a isSuspended state and a socket group.
2344         The socket group is per peer connection.
2345         A peer connection will notify the factory that it is suspended/resumed.
2346         The factory will iterate through all sockets and will suspend/resume each socket of the socket group.
2347
2348         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
2349         (WebKit::RTCSocketFactory::RTCSocketFactory):
2350         (WebKit::RTCSocketFactory::CreateUdpSocket):
2351         (WebKit::RTCSocketFactory::CreateServerTcpSocket):
2352         (WebKit::RTCSocketFactory::CreateClientTcpSocket):
2353         (WebKit::RTCSocketFactory::CreateAsyncResolver):
2354         (WebKit::RTCSocketFactory::suspend):
2355         (WebKit::RTCSocketFactory::resume):
2356         (WebKit::LibWebRTCProvider::createSocketFactory):
2357         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
2358         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
2359         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
2360         (WebKit::LibWebRTCSocket::~LibWebRTCSocket):
2361         (WebKit::LibWebRTCSocket::signalReadPacket):
2362         (WebKit::LibWebRTCSocket::signalSentPacket):
2363         (WebKit::LibWebRTCSocket::SendTo):
2364         (WebKit::LibWebRTCSocket::Close):
2365         (WebKit::LibWebRTCSocket::SetOption):
2366         (WebKit::LibWebRTCSocket::resume):
2367         (WebKit::LibWebRTCSocket::suspend):
2368         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
2369         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
2370         (WebKit::LibWebRTCSocketFactory::createServerTcpSocket):
2371         (WebKit::LibWebRTCSocketFactory::createUdpSocket):
2372         (WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
2373         (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket):
2374         (WebKit::LibWebRTCSocketFactory::addSocket):
2375         (WebKit::LibWebRTCSocketFactory::removeSocket):
2376         (WebKit::LibWebRTCSocketFactory::forSocketInGroup):
2377         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
2378
2379 2019-10-04  Alex Christensen  <achristensen@webkit.org>
2380
2381         Simplify sandbox enabling macros
2382         https://bugs.webkit.org/show_bug.cgi?id=202536
2383
2384         Reviewed by Brent Fulgham.
2385
2386         ENABLE_WEB_PROCESS_SANDBOX was always on for Cocoa platforms and only used in WebProcessCocoa.mm, so it did nothing.
2387         ENABLE_MANUAL_SANDBOXING was on for sdk=macosx* which I made more explicit in the code by using PLATFORM(MAC) || PLATFORM(MAACCATALYST)
2388         ENABLE_MANUAL_NETWORK_SANDBOXING was always off and hiding dead code we do not intend to use because iOS sandboxes are always on and never manual.
2389
2390         * Configurations/FeatureDefines.xcconfig:
2391         * NetworkProcess/ios/NetworkProcessIOS.mm:
2392         (WebKit::NetworkProcess::initializeSandbox):
2393         * Shared/ios/AuxiliaryProcessIOS.mm:
2394         (WebKit::AuxiliaryProcess::initializeSandbox):
2395         * WebProcess/cocoa/WebProcessCocoa.mm:
2396         (WebKit::WebProcess::initializeSandbox):
2397
2398 2019-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2399
2400         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.27.1 release
2401
2402         * gtk/NEWS: Add release notes for 2.27.1.
2403
2404 2019-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2405
2406         [GTK] Crash in WebChromeClient::createDisplayRefreshMonitor
2407         https://bugs.webkit.org/show_bug.cgi?id=202551
2408
2409         Reviewed by Žan Doberšek.
2410
2411         The crash happens when the drawing area is destroyed due to a page close. The layer tree host is invalidated
2412         causing a layer flush that ends up trying to create a display refresh monitor, which requires the drawing
2413         area. We need to null-check the drawing area in WebChromeClient::createDisplayRefreshMonitor() but we should
2414         also ensure that layer flush is not performed after layer tree host is destroyed.
2415
2416         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2417         (WebKit::WebChromeClient::createDisplayRefreshMonitor const): Null-check drawing area before using it.
2418         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2419         (WebKit::CompositingCoordinator::CompositingCoordinator): Receive a WebPage instead of a WebCore::Page and
2420         create the root layer here.
2421         (WebKit::CompositingCoordinator::~CompositingCoordinator): Do not purge backing stores again, invalidate should
2422         always be called right before the object is destroyed.
2423         (WebKit::CompositingCoordinator::flushPendingLayerChanges): Get WebCore::Page from WebPage.
2424         (WebKit::CompositingCoordinator::timestamp const): Ditto.
2425         (WebKit::CompositingCoordinator::syncDisplayState): Ditto.
2426         (WebKit::CompositingCoordinator::notifyFlushRequired): Do not continue if m_rootLayer is nullptr.
2427         (WebKit::CompositingCoordinator::deviceScaleFactor const): Get WebCore::Page from WebPage.
2428         (WebKit::CompositingCoordinator::pageScaleFactor const): Ditto.
2429         (WebKit::CompositingCoordinator::createGraphicsLayer): Call attachLayer() instead of duplicating the code.
2430         (WebKit::CompositingCoordinator::setVisibleContentsRect): Get WebCore::Page from WebPage.
2431         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2432         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2433         (WebKit::DrawingAreaCoordinatedGraphics::discardPreviousLayerTreeHost): Do not call LayerTreeHost::invalidate()
2434         that has been removed.
2435         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2436         (WebKit::LayerTreeHost::LayerTreeHost): Construct the coordinator after the sceneIntegration.
2437         (WebKit::LayerTreeHost::~LayerTreeHost): Invalidate everything here now. We don't really need invalidate()
2438         method since LayerTreeHost is not refcounted and we always called invalidate right before deleting the object.
2439         (WebKit::LayerTreeHost::layerFlushTimerFired): This can't happen on invalid state anymore.
2440         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
2441
2442 2019-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2443
2444         [GTK][WPE] REGRESSION(r250673): connection to network process is broken after r250673
2445         https://bugs.webkit.org/show_bug.cgi?id=202575
2446
2447         Reviewed by Carlos Alberto Lopez Perez.
2448
2449         The file descriptor is now closed when the IPC::Attachment is destroyed in NetworkProcessConnectionInfo
2450         destructor. In case of unix domain sockets we need to transfer the ownership of the fd to
2451         NetworkProcessConnection, but NetworkProcessConnectionInfo is ow keeping the ownership.
2452
2453         * WebProcess/Network/NetworkProcessConnectionInfo.h:
2454         (WebKit::NetworkProcessConnectionInfo::releaseIdentifier): Use IPC::Attachment::releaseFileDescriptor() in case
2455         of unix domain sockets.
2456         * WebProcess/WebProcess.cpp:
2457         (WebKit::WebProcess::ensureNetworkProcessConnection): Use NetworkProcessConnectionInfo::releaseIdentifier() when
2458         passing the identifier to NetworkProcessConnection.
2459
2460 2019-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2461
2462         Unreviewed. Fix GTK distcheck
2463
2464         * webkitglib-symbols.map: Remove symbols that are no longer in lib.
2465
2466 2019-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2467
2468         [GTK] WebAutomation: make setWindowRect synchronous
2469         https://bugs.webkit.org/show_bug.cgi?id=202530
2470
2471         Reviewed by Carlos Alberto Lopez Perez.
2472
2473         Move/resize window is asynchronous in GTK, but automation expects it to be synchronous so that get window rect
2474         after setting it always returns the value set. Use a nested run loop to wait for the configure events after the
2475         move/resize.
2476
2477         * UIProcess/API/glib/WebKitUIClient.cpp:
2478         (UIClient::windowConfigureEventCallback):
2479         (UIClient::setWindowFrameTimerFired):
2480
2481 2019-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2482
2483         Unreviewed. Address review comments after r250646.
2484
2485         I forgot to include the documentation improvements suggested.
2486
2487         * UIProcess/API/glib/WebKitWebContext.cpp:
2488         (webkit_web_context_class_init):
2489
2490 2019-10-03  Christopher Reid  <chris.reid@sony.com>
2491
2492         [WinCairo] Remote inspector client target list is racy
2493         https://bugs.webkit.org/show_bug.cgi?id=202169
2494
2495         Reviewed by Ross Kirsling.
2496
2497         Original patch by Basuke Suzuki.
2498
2499         Use LoaderClient to defer javascript target update calls to until after the page finished load.
2500
2501         * UIProcess/socket/RemoteInspectorProtocolHandler.cpp:
2502         * UIProcess/socket/RemoteInspectorProtocolHandler.h:
2503
2504 2019-10-03  Ross Kirsling  <ross.kirsling@sony.com>
2505
2506         Socket RWI client should acquire backend commands from server
2507         https://bugs.webkit.org/show_bug.cgi?id=202421
2508
2509         Reviewed by Devin Rousso.
2510
2511         * UIProcess/socket/RemoteInspectorClient.cpp:
2512         (WebKit::RemoteInspectorClient::dispatchMap):
2513         (WebKit::RemoteInspectorClient::setBackendCommands):
2514         * UIProcess/socket/RemoteInspectorClient.h:
2515         Receive "BackendCommands" message from server (which is already base64-encoded) and hand it over to RWIProxy.
2516
2517         * UIProcess/win/WebProcessPoolWin.cpp:
2518         (WebKit::backendCommandsPath):
2519         (WebKit::initializeRemoteInspectorServer):
2520         On Windows, initialize server with the path to InspectorBackendCommands.js from the CFBundle.
2521
2522 2019-10-03  Alex Christensen  <achristensen@webkit.org>
2523
2524         Replace _WKProcessPoolConfiguration.suppressesConnectionTerminationOnSystemChange with SPI on _WKWebsiteDataStoreConfiguration
2525         https://bugs.webkit.org/show_bug.cgi?id=202544
2526
2527         Reviewed by Tim Horton.
2528
2529         The _WKProcessPoolConfiguration SPI was originally introduced in rdar://problem/40650244
2530         Keep both working during the transition period, but we need it to not be on the process pool.
2531
2532         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2533         (WebKit::NetworkSessionCreationParameters::encode const):
2534         (WebKit::NetworkSessionCreationParameters::decode):
2535         * NetworkProcess/NetworkSessionCreationParameters.h:
2536         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2537         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2538         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2539         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2540         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2541         (-[_WKWebsiteDataStoreConfiguration suppressesConnectionTerminationOnSystemChange]):
2542         (-[_WKWebsiteDataStoreConfiguration setSuppressesConnectionTerminationOnSystemChange:]):
2543         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2544         (WebKit::WebsiteDataStore::parameters):
2545         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2546         (WebKit::WebsiteDataStoreConfiguration::copy):
2547         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2548         (WebKit::WebsiteDataStoreConfiguration::suppressesConnectionTerminationOnSystemChange const):
2549         (WebKit::WebsiteDataStoreConfiguration::setSuppressesConnectionTerminationOnSystemChange):
2550
2551 2019-10-03  Per Arne Vollan  <pvollan@apple.com>
2552
2553         REGRESSION(249649): Unable to open local files in MiniBrowser on macOS
2554         https://bugs.webkit.org/show_bug.cgi?id=201798
2555
2556         Reviewed by Brent Fulgham.
2557
2558         The commit <https://trac.webkit.org/changeset/249649> introduced a MiniBrowser regression on macOS where MiniBrowser
2559         is not able to open local files. The change set r249649 fixed a problem where the WebContent process PID was not ready
2560         to be used when creating a sandbox extension. This happened in the cases where the WebContent process had not finished
2561         launching when the load started. The WebContent process is also creating sandbox extensions for the Networking process
2562         for the files being loaded, and also needs to be passing the audit token of the Networking process when creating these.
2563         This patch implements getting the audit token for the Networking process when the WebProcess is sending a message to
2564         the UI process to establish the Networking process connection. The audit token is stored in the NetworkProcessConnection
2565         object, and passed to the NetworkLoadParameters object when the load is started. Finally, when encoding the Network
2566         resources load parameters, the audit token is used to create an extension for the Networking process.
2567
2568         API test: WKWebView.LoadFileWithLoadRequest
2569
2570         * NetworkProcess/NetworkLoadParameters.h:
2571         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2572         (WebKit::NetworkResourceLoadParameters::encode const):
2573         * Platform/IPC/ArgumentCoders.cpp:
2574         (IPC::ArgumentCoder<audit_token_t>::encode):
2575         (IPC::ArgumentCoder<audit_token_t>::decode):
2576         * Platform/IPC/ArgumentCoders.h:
2577         * Shared/Cocoa/SandboxExtensionCocoa.mm:
2578         (WebKit::SandboxExtensionImpl::create):
2579         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
2580         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
2581         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
2582         (WebKit::SandboxExtension::createHandleForReadByPid):
2583         (WebKit::SandboxExtension::createHandleForReadByAuditToken):
2584         * Shared/SandboxExtension.h:
2585         * UIProcess/Network/NetworkProcessProxy.cpp:
2586         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
2587         * UIProcess/WebProcessProxy.messages.in:
2588         * WebKit.xcodeproj/project.pbxproj:
2589         * WebProcess/Network/NetworkProcessConnection.h:
2590         (WebKit::NetworkProcessConnection::setNetworkProcessAuditToken):
2591         (WebKit::NetworkProcessConnection::networkProcessAuditToken const):
2592         * WebProcess/Network/NetworkProcessConnectionInfo.h: Added.
2593         (WebKit::NetworkProcessConnectionInfo::identifier):
2594         (WebKit::NetworkProcessConnectionInfo::encode const):
2595         (WebKit::NetworkProcessConnectionInfo::decode):
2596         * WebProcess/Network/WebLoaderStrategy.cpp:
2597         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2598         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2599         (WebKit::WebLoaderStrategy::startPingLoad):
2600         (WebKit::WebLoaderStrategy::preconnectTo):
2601         * WebProcess/WebProcess.cpp:
2602         (WebKit::getNetworkProcessConnection):
2603         (WebKit::WebProcess::ensureNetworkProcessConnection):
2604
2605 2019-10-03  Konstantin Tokarev  <annulen@yandex.ru>
2606
2607         CMake-built WebKit.framework should launch XPC services successfully
2608         https://bugs.webkit.org/show_bug.cgi?id=202490
2609
2610         Reviewed by Carlos Alberto Lopez Perez.
2611
2612         target_link_options() requires CMake 3.10, however we can avoid
2613         raising required CMake version by moving it to PlatformMac.cmake,
2614         also avoid introduction of new CMake variable.
2615
2616         * CMakeLists.txt:
2617         * PlatformMac.cmake:
2618
2619 2019-10-03  Jiewen Tan  <jiewen_tan@apple.com>
2620
2621         Support googleLegacyAppidSupport extension
2622         https://bugs.webkit.org/show_bug.cgi?id=202427
2623         <rdar://problem/55887473>
2624
2625         Reviewed by Brent Fulgham.
2626
2627         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2628         (WebKit::AuthenticatorManagerInternal::collectTransports):
2629         (WebKit::AuthenticatorManagerInternal::processGoogleLegacyAppIdSupportExtension):
2630         (WebKit::AuthenticatorManager::handleRequest):
2631         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
2632         (WebKit::CtapAuthenticator::makeCredential):
2633         (WebKit::CtapAuthenticator::processGoogleLegacyAppIdSupportExtension):
2634         * UIProcess/WebAuthentication/fido/CtapAuthenticator.h:
2635         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
2636         (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
2637
2638 2019-10-03  Jiewen Tan  <jiewen_tan@apple.com>
2639
2640         [WebAuthn] Implement dummy _WKWebAuthenticationPanel SPI
2641         https://bugs.webkit.org/show_bug.cgi?id=202507
2642         <rdar://problem/55918793>
2643
2644         Reviewed by Brent Fulgham.
2645
2646         This patch implements dummy _WKWebAuthenticationPanel SPI to unblock Safari.
2647
2648         Here are the illustrations for each SPI:
2649         1) -[WKUIDelegatePrivate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:] is used at the beginning of
2650         any WebAuthn ceremonies. A WKFrameInfo is provided for more info of the initiating frame so clients could decide either show
2651         the RP ID or the origin of the frame which may or may not be the RP ID. A callback of _WKWebAuthenticationPanelResult is
2652         provided such that clients could inform WebKit to continue the ceremony or not. Case like rate limiting of a modular dialog
2653         could result in _WKWebAuthenticationPanelResultDidNotPresent. Then WebKit will abort the operation.
2654         _WKWebAuthenticationPanelResultUnavailable tells WebKit the client has no UI implemented and therefore WebKit will operate
2655         in a non UI mode which basically will only enable HID authenticators, and is the current behavior of macOS Safari.
2656         2) -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] is primarily to instruct users to do some
2657         actionable thing to recover from some error state. However, it could be used for pure info as well. For
2658         _WKWebAuthenticationPanelInfoMultipleNFCTagPresents, users can be instructed to only hold one NFC tag to the scanner. For
2659         _WKWebAuthenticationPanelInfoNoCredentialsFound, users can potentially switch to another security key that could hit a match.
2660         3) -[_WKWebAuthenticationPanelDelegate panel:dismissWebAuthenticationPanelWithResult:] is to dismiss UI.
2661         _WKWebAuthenticationResult is provided such that client could show different animations as a hint to the user. The reasons for
2662         failure could either be timeout or InvalidStateError which will be reported to the page as well. InvalidStateError signals a
2663         credential matching an entry of the exclude list (excludeCredentials) is found on the authenticator.
2664         4) -[_WKWebAuthenticationPanel cancel] is the way clients tell WebKit a user cancel.
2665
2666         * SourcesCocoa.txt:
2667         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2668         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: Added.
2669         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: Added.
2670         (-[_WKWebAuthenticationPanel _initWithRelayingPartyID:]):
2671         (-[_WKWebAuthenticationPanel relyingPartyID]):
2672         (-[_WKWebAuthenticationPanel cancel]):
2673         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h: Added.
2674         * WebKit.xcodeproj/project.pbxproj:
2675
2676 2019-10-03  Zan Dobersek  <zdobersek@igalia.com>
2677
2678         [GTK][WPE] Enable async scrolling
2679         https://bugs.webkit.org/show_bug.cgi?id=202449
2680
2681         Reviewed by Carlos Garcia Campos.
2682
2683         For WPE, explicitly enable the threaded scrolling preference on the
2684         WebPreferences object. For GTK, the same preference is enabled in
2685         parallel with the forced-compositing preference, as the async scrolling
2686         feature depends on always-on AC mode.
2687
2688         To help with quick evaluation of potential issues around async scrolling
2689         the feature can still be disabled via the WEBKIT_DISABLE_ASYNC_SCROLLING
2690         environment variable, though this only works in DEVELOPER_MODE builds.
2691
2692         * Shared/WebPreferencesDefaultValues.h: Default-enable async frame and
2693         overflow scrolling on Nicosia-using ports.
2694         * UIProcess/API/glib/WebKitSettings.cpp:
2695         (webkit_settings_set_hardware_acceleration_policy):
2696         * UIProcess/API/wpe/WPEView.cpp:
2697         (WKWPE::m_backend):
2698         * UIProcess/gtk/WebPreferencesGtk.cpp:
2699         (WebKit::WebPreferences::platformInitializeStore):
2700         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2701         (WebKit::DrawingAreaCoordinatedGraphics::DrawingAreaCoordinatedGraphics):
2702         (WebKit::DrawingAreaCoordinatedGraphics::updatePreferences):
2703         (WebKit::DrawingAreaCoordinatedGraphics::supportsAsyncScrolling):
2704         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
2705
2706 2019-10-03  Zan Dobersek  <zdobersek@igalia.com>
2707
2708         [Nicosia] Enable runtime checks and triggers for async non-main-frame scrolling
2709         https://bugs.webkit.org/show_bug.cgi?id=202509
2710
2711         Reviewed by Carlos Garcia Campos.
2712
2713         * WebProcess/WebCoreSupport/WebChromeClient.h:
2714         Allow the non-main-frame compositing trigger for the Nicosia-using ports
2715         as well. This will enable non-main-frame compositing if the related
2716         setting is also enabled.
2717
2718 2019-10-03  Alexander Mikhaylenko  <alexm@gnome.org>
2719
2720         [GTK] Don't hardcode swipe navigation gesture style
2721         https://bugs.webkit.org/show_bug.cgi?id=202447
2722
2723         Reviewed by Carlos Garcia Campos.
2724
2725         Use GTK foreign drawing to draw swipe gesture dimming and shadow instead of
2726         hardcoded opacity and gradient values.
2727
2728         Have separate elements for dimming and shadow. Additionally, add border
2729         and outline. Dimming layer opacity always matches progress, shadow opacity
2730         is 1 except when the page is almost completely retracted. Border and outline
2731         opacity is always 1. Outline is drawn above the top page. For determining
2732         shadow, border and outline width, 'min-width' property is used.
2733
2734         Each element also has .right or .left style class depending on text direction.
2735
2736         Creating patterns is relatively expensive, so do it once a gesture
2737         starts and clear them once it ends. Style changes are currently not
2738         handled, since it's unlikely anything would change while the gesture
2739         is done. Dimming layer is created with the same width as webview and is
2740         clipped when drawing.
2741
2742         Translate existing dimming and shadow into css as is, add subtle border and
2743         outline. Since it's controlled via css, downstreams can override the style.
2744
2745         Set WebKitWebView css name to 'webkitwebview', and only apply styles for
2746         elements directly preceded by it, otherwise the selectors are too generic.
2747
2748         * PlatformGTK.cmake: Add gtk.css to gresource bundle.
2749         * Resources/gtk/gtk-theme.css: Added.
2750         (webkitwebview > dimming):
2751         (webkitwebview > shadow):
2752         (webkitwebview > shadow.right):
2753         (webkitwebview > shadow.left):
2754         (webkitwebview > border):
2755         (webkitwebview > outline):
2756         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2757         (webkit_web_view_base_class_init): Set css name to 'webkitwebview'.
2758         * UIProcess/ViewGestureController.h:
2759         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2760         (WebKit::ViewGestureController::createStyleContext):
2761         (WebKit::createElementPattern):
2762         (WebKit::elementWidth):
2763         (WebKit::ViewGestureController::beginSwipeGesture): Create helper patterns.
2764         (WebKit::ViewGestureController::draw): Rework drawing to use the patterns.
2765         (WebKit::ViewGestureController::removeSwipeSnapshot): Clear the patterns.
2766
2767 2019-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2768
2769         [GTK] Make PSON optional
2770         https://bugs.webkit.org/show_bug.cgi?id=200967
2771
2772         Reviewed by Michael Catanzaro.
2773
2774         It's not possible to enable PSON by default and keep backwards compatibility, applications might need to use new
2775         API to monitor the page ID changes in the Web view. So, this patch adds a construct only property to
2776         WebKitWebContext to enable PSON.
2777
2778         * UIProcess/API/glib/WebKitWebContext.cpp:
2779         (webkitWebContextGetProperty):
2780         (webkitWebContextSetProperty):
2781         (webkitWebContextConstructed):
2782         (webkit_web_context_class_init):
2783
2784 2019-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2785
2786         [GTK][WPE] Add WebKitWebView:page-id property
2787         https://bugs.webkit.org/show_bug.cgi?id=201642
2788
2789         Reviewed by Michael Catanzaro.
2790
2791         The page ID of a WebKitWebView can now change, so we need a way to get notified when it changes.
2792
2793         * UIProcess/API/glib/WebKitWebView.cpp:
2794         (webkitWebViewGetProperty): Add getter for page-id.
2795         (webkit_web_view_class_init): Add page-id property
2796         (webkitWebViewDidChangePageID): Emit notify::page-id.
2797         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2798         * UIProcess/API/gtk/PageClientImpl.cpp:
2799         (WebKit::PageClientImpl::didChangeWebPageID const): Call webkitWebViewDidChangePageID().
2800         * UIProcess/API/gtk/PageClientImpl.h:
2801         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
2802         * UIProcess/API/wpe/APIViewClient.h:
2803         (API::ViewClient::didChangePageID): Added virtual method.
2804         * UIProcess/API/wpe/PageClientImpl.cpp:
2805         (WebKit::PageClientImpl::didChangeWebPageID const): Call WKWPE::View::didChangePageID().
2806         * UIProcess/API/wpe/PageClientImpl.h:
2807         * UIProcess/API/wpe/WPEView.cpp:
2808         (WKWPE::View::didChangePageID): Call API::ViewClient::didChangePageID().
2809         * UIProcess/API/wpe/WPEView.h:
2810         * UIProcess/PageClient.h:
2811         (WebKit::PageClient::didChangeWebPageID const): Added virtual method.
2812         * UIProcess/WebPageProxy.cpp:
2813         (WebKit::WebPageProxy::swapToWebProcess): Call PageClient::didChangeWebPageID().
2814
2815 2019-10-02  Andy Estes  <aestes@apple.com>
2816
2817         [iOS] When hit testing for a context menu interaction, do not consider whether the element is contenteditable
2818         https://bugs.webkit.org/show_bug.cgi?id=202498
2819         <rdar://problem/54723131>
2820
2821         Reviewed by Tim Horton.
2822
2823         * WebProcess/WebPage/ios/WebPageIOS.mm:
2824         (WebKit::WebPage::startInteractionWithElementAtPosition): Changed to call
2825         WebCore::Frame::nodeRespondingToInteraction.
2826
2827 2019-10-02  Myles C. Maxfield  <mmaxfield@apple.com>
2828
2829         REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
2830         https://bugs.webkit.org/show_bug.cgi?id=202198
2831
2832         Reviewed by Tim Horton.
2833
2834         NSFont has a bug where passing "auto" to kCTFontOpticalSizeAttribute
2835         causes an exception to be thrown. We don't catch the exception, so we
2836         pop up back to the runloop, which confuses the UI process.
2837
2838         The solution is twofold: 1) Workaround the bug by passing the font size
2839         to kCTFontOpticalSizeAttribute instead, and 2) catch any exceptions that
2840         this part of the code might throw.
2841
2842         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2843         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
2844
2845 2019-10-02  Alex Christensen  <achristensen@webkit.org>
2846
2847         [CMake] Don't link WebKit.framework with SecItemShim
2848         ​https://bugs.webkit.org/show_bug.cgi?id=202490
2849
2850         * PlatformMac.cmake:
2851         Otherwise everything that uses the Security framework crashes immediately.
2852         We only need it in the NetworkProcess.
2853
2854 2019-10-02  Alex Christensen  <achristensen@webkit.org>
2855
2856         CMake-built WebKit.framework should launch XPC services successfully
2857         https://bugs.webkit.org/show_bug.cgi?id=202490
2858
2859         Rubber-stamped by Tim Horton.
2860
2861         * CMakeLists.txt:
2862         * PlatformMac.cmake:
2863
2864 2019-10-02  Kate Cheney  <katherine_cheney@apple.com>
2865
2866         Updated resource load statistics are never merged into the SQLite Database backend (202372).
2867         https://bugs.webkit.org/show_bug.cgi?id=202372
2868         <rdar://problem/55854542>
2869
2870         Reviewed by Brent Fulgham. 
2871
2872         This patch has a lot of changes to the test infrastructure to be able 
2873         to test the mergeStatistics function. Merging functionality mimics
2874         that of the ResourceLoadStatisticsMemoryStore and the merge() function in
2875         ResourceLoadStatistics.cpp.
2876
2877         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2878         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2879         Added new SQLite queries that are needed to merge new statistics.
2880
2881         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
2882         Added new prepare statements for new SQLite queries.
2883
2884         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
2885         Updated to use domainID() instead of confirmDomainDoesNotExist which 
2886         was deleted. Changed the insert bind parameters
2887         to utilize new enum of Observed Domain table indices which will help
2888         reduce errors in the future if the database schema changes.
2889
2890         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
2891         Changed {public} to {private} in logging statement to avoid leaking
2892         sensitive information when logging the query error.
2893
2894         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const): Deleted.
2895         This function essentially does the exact same thing as domainID and
2896         we can reduce code duplication by deleting it and transitioning all
2897         other functions to use domainID instead.
2898
2899         (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
2900         Changed {public} to {private} in logging statement to avoid leaking
2901         sensitive information when logging the query error.
2902         
2903         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
2904         In order to reuse this code for the merge statistics function, I added
2905         a check before each insert call to ensure the relationship does not
2906         already exist in the database. This was not needed before because it
2907         was only called on an empty database.
2908
2909         (WebKit::ResourceLoadStatisticsDatabaseStore::merge):
2910         (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic):
2911         (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics):
2912         Merges new statistic.
2913
2914         (WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
2915         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
2916         (WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
2917         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
2918         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
2919         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
2920         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
2921         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
2922         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
2923         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
2924         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
2925         (WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
2926         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
2927         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
2928         Changed {public} to {private} in logging statement to avoid leaking
2929         sensitive information when logging the query error.
2930
2931         (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
2932         Fix a bug uncovered by the new test cases.
2933         
2934         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain):
2935         (WebKit::ResourceLoadStatisticsDatabaseStore::clearDatabaseContents):
2936         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieTreatmentForOrigin const):
2937         (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions):
2938         (WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
2939         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
2940         (WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
2941         Changed {public} to {private} in logging statement to avoid leaking
2942         sensitive information when logging the query error.
2943         
2944         (WebKit::ResourceLoadStatisticsDatabaseStore::updateDataRecordsRemoved):
2945         A new function that utilizes a query needed for the merging of two
2946         statistics.
2947         
2948         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const): Deleted.
2949         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2950         
2951         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2952         (WebKit::ResourceLoadStatisticsMemoryStore::mergeStatistics):
2953         (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction const): Deleted.
2954         Removed the check for updating times accessed due to first party 
2955         interaction, which is data no longer needed in updated ITP. 
2956
2957         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2958         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2959         Added the mergeStatistics function (previously only in the memory
2960         store) to the parent class now that it is used by both stores.
2961         
2962         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2963         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2964         This function now calls mergeStatistics on the database store if
2965         enabled.
2966
2967         (WebKit::WebResourceLoadStatisticsStore::mergeStatisticForTesting):
2968         This function builds a vector from the sample data to test the
2969         mergeStatistics() function of the database store.
2970
2971         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2972         * NetworkProcess/NetworkProcess.cpp:
2973         (WebKit::NetworkProcess::mergeStatisticForTesting):
2974         * NetworkProcess/NetworkProcess.h:
2975         * NetworkProcess/NetworkProcess.messages.in:
2976         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2977         (WKWebsiteDataStoreSetStatisticsMergeStatistic):
2978         Fixed bug where isGrandfathered function in WKWebsiteDataStoreRef
2979         was calling hasHadUserInteraction by mistake.
2980
2981         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2982         * UIProcess/Network/NetworkProcessProxy.cpp:
2983         (WebKit::NetworkProcessProxy::mergeStatisticForTesting):
2984         * UIProcess/Network/NetworkProcessProxy.h:
2985         This code is for testing the mergeStatistics() function.
2986
2987         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2988         (WebKit::WebsiteDataStore::isGrandfathered):
2989         (WebKit::WebsiteDataStore::mergeStatisticForTesting):
2990         * UIProcess/WebsiteData/WebsiteDataStore.h:
2991         Added this function which contacts the networkProcess to retrieve the
2992         grandfathered value for a domain. This was not included before because
2993         of a bug in WKWebsiteDataStoreRef.
2994
2995 2019-10-02  Dean Jackson  <dino@apple.com>
2996
2997         Provide originating website URL to AR QuickLook
2998         https://bugs.webkit.org/show_bug.cgi?id=202451
2999
3000         Reviewed by Antoine Quint.
3001
3002         Declare the setAdditionalParameters method and
3003         call it with the originating page URL if available.
3004
3005         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3006
3007 2019-10-02  Keith Rollin  <krollin@apple.com>
3008
3009         Properly mark canceled resources in NetworkActivityTracker
3010         https://bugs.webkit.org/show_bug.cgi?id=202440
3011         <rdar://problem/55843651>
3012
3013         Reviewed by Brent Fulgham.
3014
3015         The nw_activity facility tracking resource loads did not originally
3016         have support for reporting resources that were canceled. It now has
3017         that support (since late MacOS 14-aligned SDKs), so add support for it
3018         in NetworkActivityTracker and use it in places where we were
3019         previously reporting the status of canceled resources as "None".
3020
3021         * NetworkProcess/NetworkActivityTracker.h:
3022         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3023         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
3024         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
3025         * NetworkProcess/NetworkResourceLoader.cpp:
3026         (WebKit::NetworkResourceLoader::cleanup):
3027         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm:
3028         (WebKit::NetworkActivityTracker::complete):
3029
3030 2019-10-02  Zan Dobersek  <zdobersek@igalia.com>
3031
3032         Unreviewed build fix for non-Mac ports after r250600.
3033
3034         * UIProcess/WebProcessPool.cpp:
3035         Make the CoreGraphicsSPI.h header include exclusive to the Mac port.
3036
3037 2019-10-02  Antoine Quint  <graouts@apple.com>
3038
3039         Unreviewed build fix for macOS, broken by r250595.
3040
3041         * UIProcess/WebProcessPool.cpp:
3042
3043 2019-10-02  youenn fablet  <youenn@apple.com>
3044
3045         Use strongly typed identifiers for webrtc sockets
3046         https://bugs.webkit.org/show_bug.cgi?id=202400
3047
3048         Reviewed by Chris Dumez.
3049
3050         Refactoring to use LibWebRTCSocketIdentifier instead of uint64_t.
3051
3052         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
3053         (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
3054         * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
3055         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
3056         (WebKit::NetworkRTCProvider::createSocket):
3057         (WebKit::NetworkRTCProvider::createUDPSocket):
3058         (WebKit::NetworkRTCProvider::createServerTCPSocket):
3059         (WebKit::NetworkRTCProvider::createClientTCPSocket):
3060         (WebKit::NetworkRTCProvider::wrapNewTCPConnection):
3061         (WebKit::NetworkRTCProvider::addSocket):
3062         (WebKit::NetworkRTCProvider::takeSocket):
3063         (WebKit::NetworkRTCProvider::newConnection):
3064         (WebKit::NetworkRTCProvider::didReceiveNetworkRTCSocketMessage):
3065         (WebKit::NetworkRTCProvider::closeListeningSockets):
3066         (WebKit::NetworkRTCProvider::callSocket):
3067         * NetworkProcess/webrtc/NetworkRTCProvider.h:
3068         * NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
3069         * NetworkProcess/webrtc/NetworkRTCSocket.cpp:
3070         (WebKit::NetworkRTCSocket::NetworkRTCSocket):
3071         * NetworkProcess/webrtc/NetworkRTCSocket.h:
3072         * Scripts/webkit/messages.py:
3073         * WebProcess/Network/NetworkProcessConnection.cpp:
3074         (WebKit::NetworkProcessConnection::didReceiveMessage):
3075         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
3076         (WebKit::LibWebRTCNetwork::socket):
3077         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
3078         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
3079         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
3080         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
3081         (WebKit::LibWebRTCSocketFactory::createServerTcpSocket):
3082         (WebKit::LibWebRTCSocketFactory::createUdpSocket):
3083         (WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
3084         (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket):
3085         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
3086         (WebKit::LibWebRTCSocketFactory::socket):
3087         (WebKit::LibWebRTCSocketFactory::resolver):
3088         (WebKit::LibWebRTCSocketFactory::takeResolver):
3089         (WebKit::LibWebRTCSocketFactory::disableNonLocalhostConnections):
3090         * WebProcess/Network/webrtc/WebRTCSocket.cpp:
3091         (WebKit::WebRTCSocket::signalOnNetworkThread):
3092         (WebKit::WebRTCSocket::WebRTCSocket):
3093         (WebKit::WebRTCSocket::signalSentPacket):
3094         (WebKit::WebRTCSocket::signalConnect):
3095         (WebKit::WebRTCSocket::signalClose):
3096         (WebKit::WebRTCSocket::signalNewConnection):
3097         * WebProcess/Network/webrtc/WebRTCSocket.h:
3098         * WebProcess/Network/webrtc/WebRTCSocket.messages.in:
3099
3100 2019-10-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3101
3102         [GTK][WPE] Stop using legacy custom protocol implementation
3103         https://bugs.webkit.org/show_bug.cgi?id=202407
3104
3105         Reviewed by Žan Doberšek.
3106
3107         Use the new approach, which is simpler and doesn't require to go to the network process to load custom
3108         protocols.
3109
3110         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp: Removed.
3111         * NetworkProcess/NetworkProcess.cpp:
3112         (WebKit::m_messagePortChannelRegistry):
3113         * NetworkProcess/soup/WebKitSoupRequestInputStream.cpp: Removed.
3114         * NetworkProcess/soup/WebKitSoupRequestInputStream.h: Removed.
3115         * PlatformGTK.cmake:
3116         * PlatformWPE.cmake:
3117         * SourcesGTK.txt:
3118         * SourcesWPE.txt:
3119         * UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp: Removed.
3120         * UIProcess/API/glib/WebKitCustomProtocolManagerClient.h: Removed.
3121         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
3122         (webkitURISchemeRequestCreate):
3123         (webkit_uri_scheme_request_get_scheme):
3124         (webkit_uri_scheme_request_get_uri):
3125         (webkit_uri_scheme_request_get_path):
3126         (webkit_uri_scheme_request_get_web_view):
3127         (webkitURISchemeRequestReadCallback):
3128         (webkit_uri_scheme_request_finish_error):
3129         * UIProcess/API/glib/WebKitURISchemeRequestPrivate.h:
3130         * UIProcess/API/glib/WebKitWebContext.cpp:
3131         (webkitWebContextConstructed):
3132         (webkitWebContextDispose):
3133         (webkit_web_context_register_uri_scheme):
3134         (webkitWebContextCreatePageForWebView):
3135         * UIProcess/API/glib/WebKitWebContextPrivate.h:
3136         * UIProcess/WebURLSchemeTask.h:
3137         (WebKit::WebURLSchemeTask::request const):
3138         * UIProcess/soup/WebProcessPoolSoup.cpp:
3139
3140 2019-10-02  Zan Dobersek  <zdobersek@igalia.com>
3141
3142         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports
3143         https://bugs.webkit.org/show_bug.cgi?id=202397
3144
3145         Reviewed by Carlos Garcia Campos.
3146
3147         * Shared/WebEvent.h:
3148         Enable WebWheelEvent phasing for WPE, as required by the
3149         ASYNC_SCROLLING code.
3150
3151 2019-10-01  Tim Horton  <timothy_horton@apple.com>
3152
3153         Clean up some includes to make the build a bit faster
3154         https://bugs.webkit.org/show_bug.cgi?id=202444
3155
3156         Reviewed by Geoff Garen.
3157
3158         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
3159
3160 2019-10-01  Alex Christensen  <achristensen@webkit.org>
3161
3162         Progress towards a functioning CMake build on Mac
3163         https://bugs.webkit.org/show_bug.cgi?id=202443
3164
3165         Rubber-stamped by Tim Horton.
3166
3167         * CMakeLists.txt:
3168         * PlatformMac.cmake:
3169
3170 2019-10-01  John Wilander  <wilander@apple.com>
3171
3172         Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
3173         https://bugs.webkit.org/show_bug.cgi?id=202435
3174         <rdar://problem/55718526>
3175
3176         Reviewed by Brent Fulgham.
3177
3178         WebKit's Storage Access API implementation has so far only looked at whether ITP is
3179         blocking cookie access or not. However, the default cookie policy is still in
3180         effect underneath ITP. document.hasStorageAccess() should return true if the
3181         third-party:
3182         a) is not classified by ITP, and
3183         b) has cookies which implies it can use cookies as third-party according to the
3184         default cookie policy.
3185
3186         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3187         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
3188         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3189         (WebKit::WebResourceLoadStatisticsStore::hasCookies):
3190         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3191         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3192         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
3193         * NetworkProcess/NetworkProcess.cpp:
3194         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
3195
3196 2019-10-01  Antti Koivisto  <antti@apple.com>
3197
3198         [CSS Shadow Parts] Parse 'part' attribute
3199         https://bugs.webkit.org/show_bug.cgi?id=202409
3200
3201         Reviewed by Ryosuke Niwa.
3202
3203         * Shared/WebPreferences.yaml:
3204
3205         Add experimental feature, default to disabled for now.
3206
3207 2019-10-01  Alex Christensen  <achristensen@webkit.org>
3208
3209         Progress towards successful CMake build on Mac
3210         https://bugs.webkit.org/show_bug.cgi?id=202426
3211
3212         Rubber-stamped by Tim Horton.
3213
3214         * Platform/cocoa/PaymentAuthorizationPresenter.h:
3215         * Platform/cocoa/PaymentAuthorizationPresenter.mm:
3216         * Platform/cocoa/PaymentAuthorizationViewController.h:
3217         * Platform/cocoa/PaymentAuthorizationViewController.mm:
3218         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
3219         * PlatformMac.cmake:
3220         * Shared/SandboxExtension.h:
3221         (WebKit::SandboxExtension::createHandleForReadByPid):
3222         * SourcesCocoa.txt:
3223         * UIProcess/API/Cocoa/WKWebView.mm:
3224         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3225         (-[WKWebsiteDataStore _hasRegisteredServiceWorker]):
3226         * UIProcess/API/mac/WKView.mm:
3227         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
3228         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
3229         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
3230         * UIProcess/Cocoa/WKShareSheet.mm:
3231         (-[WKShareSheet delegate]):
3232         (-[WKShareSheet setDelegate:]):
3233         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3234         * UIProcess/Cocoa/WebViewImpl.h:
3235         * WebKit.xcodeproj/project.pbxproj:
3236         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
3237         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h:
3238         * WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp:
3239
3240 2019-10-01  Tim Horton  <timothy_horton@apple.com>
3241
3242         Clean up some includes to make the build a bit faster
3243         https://bugs.webkit.org/show_bug.cgi?id=202417
3244
3245         Reviewed by Jer Noble.
3246
3247         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
3248         * WebProcess/Plugins/Plugin.h:
3249         Fix the build.
3250
3251 2019-10-01  Alex Christensen  <achristensen@webkit.org>
3252
3253         Fix GTK build after r250558
3254         https://bugs.webkit.org/show_bug.cgi?id=202390
3255
3256         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
3257         (webkit_dom_dom_window_confirm):
3258
3259 2019-10-01  Alex Christensen  <achristensen@webkit.org>
3260
3261         Fix an internal build.
3262
3263         Ignore some deprecation warnings.  We'll adopt new SPI soon.
3264
3265         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3266         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
3267
3268 2019-10-01  youenn fablet  <youenn@apple.com>
3269
3270         Remove races condition when validating capture sandbox extension revocation
3271         https://bugs.webkit.org/show_bug.cgi?id=202133
3272         <rdar://problem/55660905>
3273
3274         Reviewed by Eric Carlson.
3275
3276         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3277         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
3278         Explicitly ask the page to stop capture.
3279         This will make sure capture is stopped when revoking sandbox extensions.
3280
3281 2019-09-30  Alex Christensen  <achristensen@webkit.org>
3282
3283         Resurrect Mac CMake build
3284         https://bugs.webkit.org/show_bug.cgi?id=202384
3285
3286         Rubber-stamped by Tim Horton.
3287
3288         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3289         * PlatformMac.cmake:
3290         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
3291         * UIProcess/API/Cocoa/WKWebView.mm:
3292         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3293         * WebKit2Prefix.h:
3294
3295 2019-09-30  Christopher Reid  <chris.reid@sony.com>
3296
3297         [WinCairo] Move Remote Inspector Server initialization out of WebView
3298         https://bugs.webkit.org/show_bug.cgi?id=202369
3299
3300         Reviewed by Ross Kirsling.
3301         
3302         Move Remote Inspector Server initialization to Windows WebProcessPool initialization.
3303
3304         * UIProcess/win/WebProcessPoolWin.cpp:
3305         * UIProcess/win/WebView.cpp:
3306
3307 2019-09-30  Alex Christensen  <achristensen@webkit.org>
3308
3309         Move DownloadMonitor test speed multiplier from WebProcessPool to WebsiteDataStoreConfiguration
3310         https://bugs.webkit.org/show_bug.cgi?id=202339
3311
3312         Reviewed by Youenn Fablet.
3313
3314         This was only used for some unit tests, which still are accelerated so they pass in the same amount of time as before.
3315         I need this value to not be process-global in the NetworkProcess.
3316
3317         * NetworkProcess/Downloads/Download.cpp:
3318         (WebKit::Download::Download):
3319         * NetworkProcess/Downloads/Download.h:
3320         (WebKit::Download::Download):
3321         (WebKit::Download::testSpeedMultiplier const):
3322         * NetworkProcess/Downloads/DownloadManager.cpp:
3323         (WebKit::DownloadManager::resumeDownload):
3324         * NetworkProcess/Downloads/DownloadManager.h:
3325         * NetworkProcess/Downloads/DownloadMonitor.cpp:
3326         (WebKit::DownloadMonitor::applicationDidEnterBackground):
3327         (WebKit::DownloadMonitor::testSpeedMultiplier const):
3328         (WebKit::DownloadMonitor::timerFired):
3329         (WebKit::DownloadMonitor::speedMultiplier const): Deleted.
3330         * NetworkProcess/Downloads/DownloadMonitor.h:
3331         * NetworkProcess/NetworkDataTaskBlob.cpp:
3332         (WebKit::NetworkDataTaskBlob::download):
3333         * NetworkProcess/NetworkProcess.cpp:
3334         (WebKit::NetworkProcess::initializeNetworkProcess):
3335         * NetworkProcess/NetworkProcess.h:
3336         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3337         (WebKit::NetworkProcessCreationParameters::encode const):
3338         (WebKit::NetworkProcessCreationParameters::decode):
3339         * NetworkProcess/NetworkProcessCreationParameters.h:
3340         * NetworkProcess/NetworkSession.cpp:
3341         (WebKit::NetworkSession::NetworkSession):
3342         * NetworkProcess/NetworkSession.h:
3343         (WebKit::NetworkSession::testSpeedMultiplier const):
3344         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3345         (WebKit::NetworkSessionCreationParameters::encode const):
3346         (WebKit::NetworkSessionCreationParameters::decode):
3347         * NetworkProcess/NetworkSessionCreationParameters.h:
3348         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3349         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
3350         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3351         (API::ProcessPoolConfiguration::copy):
3352         * UIProcess/API/APIProcessPoolConfiguration.h:
3353         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3354         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3355         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplierForTesting]): Deleted.
3356         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplierForTesting:]): Deleted.
3357         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3358         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3359         (-[_WKWebsiteDataStoreConfiguration testSpeedMultiplier]):
3360         (-[_WKWebsiteDataStoreConfiguration setTestSpeedMultiplier:]):
3361         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3362         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3363         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3364         (WebKit::WebsiteDataStore::parameters):
3365         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3366         (WebKit::WebsiteDataStoreConfiguration::copy):
3367         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3368         (WebKit::WebsiteDataStoreConfiguration::testSpeedMultiplier const):
3369         (WebKit::WebsiteDataStoreConfiguration::setTestSpeedMultiplier):
3370
3371 2019-09-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3372
3373         [GTK] IconDatabase is not thread-safe
3374         https://bugs.webkit.org/show_bug.cgi?id=201303
3375
3376         Reviewed by Žan Doberšek.
3377
3378         Rewrite the IconDatabase implementation. Now that we are the only users of this code, we can simply it a lot and
3379         design it specifically for our API, which implementation has been simplified a lot too. There's no change in
3380         the database schema nor in behavior from the API point of view.
3381
3382         * UIProcess/API/glib/IconDatabase.cpp:
3383         (WebKit::IconDatabase::IconDatabase):
3384         (WebKit::IconDatabase::~IconDatabase):
3385         (WebKit::IconDatabase::createTablesIfNeeded):
3386         (WebKit::IconDatabase::populatePageURLToIconURLMap):
3387         (WebKit::IconDatabase::clearStatements):
3388         (WebKit::IconDatabase::pruneTimerFired):
3389         (WebKit::IconDatabase::startPruneTimer):
3390         (WebKit::IconDatabase::clearLoadedIconsTimerFired):
3391         (WebKit::IconDatabase::startClearLoadedIconsTimer):
3392         (WebKit::IconDatabase::iconIDForIconURL):
3393         (WebKit::IconDatabase::setIconIDForPageURL):
3394         (WebKit::IconDatabase::iconData):
3395         (WebKit::IconDatabase::addIcon):
3396         (WebKit::IconDatabase::updateIconTimestamp):
3397         (WebKit::IconDatabase::deleteIcon):
3398         (WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
3399         (WebKit::IconDatabase::loadIconForPageURL):
3400         (WebKit::IconDatabase::iconURLForPageURL):
3401         (WebKit::IconDatabase::setIconForPageURL):
3402         (WebKit::IconDatabase::clear):
3403         * UIProcess/API/glib/IconDatabase.h:
3404         (WebKit::IconDatabase::create):
3405         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
3406         (webkitFaviconDatabaseCreate):
3407         (webkitFaviconDatabaseIsOpen):
3408         (webkitFaviconDatabaseOpen):
3409         (webkitFaviconDatabaseClose):
3410         (webkitFaviconDatabaseGetLoadDecisionForIcon):
3411         (webkitFaviconDatabaseSetIconForPageURL):
3412         (webkitFaviconDatabaseGetFaviconInternal):
3413         (webkit_favicon_database_get_favicon):
3414         (webkit_favicon_database_get_favicon_finish):
3415         (webkit_favicon_database_get_favicon_uri):
3416         (webkit_favicon_database_clear):
3417         * UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
3418         * UIProcess/API/glib/WebKitWebContext.cpp:
3419         (webkitWebContextDispose):
3420         (webkit_web_context_set_favicon_database_directory):
3421         (webkitWebContextCreatePageForWebView):
3422         (webkitWebContextWebViewDestroyed):
3423         * UIProcess/API/glib/WebKitWebView.cpp:
3424         (webkitWebViewRequestFavicon):
3425         (webkitWebViewGetLoadDecisionForIcon):
3426         (webkitWebViewSetIcon):
3427
3428 2019-09-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3429
3430         [GTK][WPE] Add about:gpu
3431         https://bugs.webkit.org/show_bug.cgi?id=202305
3432
3433         Reviewed by Žan Doberšek.
3434
3435         A builtin protocol handler to show information about hardware acceleration. This is useful information we need
3436         from people reporting issues in accelerated compositing mode.
3437
3438         * SourcesGTK.txt:
3439         * SourcesWPE.txt:
3440         * UIProcess/API/glib/WebKitProtocolHandler.cpp: Added.
3441         (WebKit::WebKitProtocolHandler::WebKitProtocolHandler):
3442         (WebKit::WebKitProtocolHandler::handleRequest):
3443         (WebKit::webkitPortName):
3444         (WebKit::hardwareAccelerationPolicy):
3445         (WebKit::webGLEnabled):
3446         (WebKit::openGLAPI):
3447         (WebKit::nativeInterface):
3448         (WebKit::WebKitProtocolHandler::handleGPU):
3449         * UIProcess/API/glib/WebKitProtocolHandler.h: Added.
3450         * UIProcess/API/glib/WebKitWebContext.cpp:
3451         (webkitWebContextConstructed):
3452
3453 2019-09-30  Commit Queue  <commit-queue@webkit.org>
3454
3455         Unreviewed, rolling out r250291.
3456         https://bugs.webkit.org/show_bug.cgi?id=202359
3457
3458         it is failing
3459         TestWebKitAPI.ProcessSwap.GetUserMediaCaptureState (Requested
3460         by youenn on #webkit).
3461
3462         Reverted changeset:
3463
3464         "Delay capture sandbox extension revocation to after the page
3465         close message is sent"
3466         https://bugs.webkit.org/show_bug.cgi?id=202133
3467         https://trac.webkit.org/changeset/250291
3468
3469 2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
3470
3471         ScrollingTreeScrollingNode: use LayerRepresentation for scroll container, scrolled contents layers
3472         https://bugs.webkit.org/show_bug.cgi?id=202256
3473         <rdar://problem/55772092>
3474
3475         Reviewed by Simon Fraser.
3476
3477         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3478         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
3479         Use static casts to retrieve the CALayer pointers from the
3480         LayerRepresentation objects due to the explicit operators.
3481
3482 2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
3483
3484         Tighten up LayerRepresentation operators
3485         https://bugs.webkit.org/show_bug.cgi?id=202344
3486
3487         Reviewed by Simon Fraser.
3488
3489         With LayerRepresentation operators now being explicit, we require
3490         to manually specify conversion to CALayer pointers or
3491         GraphicsLayer::PlatformLayerID values.
3492
3493         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3494         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
3495         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3496         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
3497         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
3498         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
3499         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3500         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren):
3501         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
3502         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
3503         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp:
3504         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::commitStateBeforeChildren):
3505
3506 2019-09-27  Adrian Perez de Castro  <aperez@igalia.com>
3507
3508         [GTK][WPE] Fixes for non-unified builds after r249714
3509         https://bugs.webkit.org/show_bug.cgi?id=202304
3510
3511         Reviewed by Youenn Fablet.
3512
3513         * NetworkProcess/NetworkLoadChecker.h: Add missing inclusion of the pal/SessionID.h header.
3514         * NetworkProcess/NetworkResourceLoadMap.cpp: Add missing inclusion of the
3515         NetworkResourceLoader.h header.
3516         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
3517         (WKWebsiteDataStoreConfigurationCreate): Add missing namespace to usage of the
3518         WebKit::IsPersistent::Yes value.
3519         * UIProcess/WebPageProxy.cpp: Add missing inclusion of the LegacyGlobalSettings.h header.
3520
3521 2019-09-27  Tim Horton  <timothy_horton@apple.com>
3522
3523         Adopt new UIWebGeolocationPolicyDecider SPI to pass a view instead of a window
3524         https://bugs.webkit.org/show_bug.cgi?id=202329
3525         <rdar://problem/25963823>
3526
3527         Reviewed by Wenson Hsieh.
3528
3529         * Platform/spi/ios/UIKitSPI.h:
3530         * UIProcess/ios/WKGeolocationProviderIOS.mm:
3531         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
3532         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
3533         (WebKit::decidePolicyForGeolocationRequestFromOrigin):
3534         Switch to newer SPI that takes a UIView instead of a UIWindow, so that
3535         UIWebGeolocationPolicyDecider can find the correct presenting view controller.
3536
3537 2019-09-27  Zalan Bujtas  <zalan@apple.com>
3538
3539         [iPadOS] Can’t use RalphLauren.com on iPad because hover menus don’t stay up
3540         https://bugs.webkit.org/show_bug.cgi?id=202331
3541         <rdar://problem/55629493>
3542
3543         Reviewed by Tim Horton.
3544
3545         * WebProcess/WebPage/ios/WebPageIOS.mm:
3546         (WebKit::WebPage::handleSyntheticClick):
3547         (WebKit::nodeTriggersFastPath): Deleted.
3548
3549 2019-09-27  Alex Christensen  <achristensen@webkit.org>
3550
3551         Move shouldUseTestingNetworkSession from NetworkProcessCreationParameters to NetworkSessionCreationParameters
3552         https://bugs.webkit.org/show_bug.cgi?id=202327
3553
3554         Reviewed by Tim Horton.
3555
3556         * NetworkProcess/NetworkProcess.cpp:
3557         (WebKit::NetworkProcess::initializeNetworkProcess):
3558         (WebKit::NetworkProcess::ensureSession):
3559         * NetworkProcess/NetworkProcess.h:
3560         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3561         (WebKit::NetworkProcessCreationParameters::encode const):
3562         (WebKit::NetworkProcessCreationParameters::decode):
3563         * NetworkProcess/NetworkProcessCreationParameters.h:
3564         * NetworkProcess/NetworkSession.cpp:
3565         (WebKit::NetworkSession::NetworkSession):
3566         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3567         (WebKit::NetworkSessionCreationParameters::encode const):
3568         (WebKit::NetworkSessionCreationParameters::decode):
3569         * NetworkProcess/NetworkSessionCreationParameters.h:
3570         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3571         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3572         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
3573         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3574         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3575         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3576         * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
3577         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3578         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
3579         (WKWebsiteDataStoreConfigurationSetPerOriginStorageQuota):
3580         (WKWebsiteDataStoreConfigurationSetNetworkCacheSpeculativeValidationEnabled):
3581         (WKWebsiteDataStoreConfigurationGetTestingSessionEnabled):
3582         (WKWebsiteDataStoreConfigurationSetTestingSessionEnabled):
3583         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h:
3584         * UIProcess/WebProcessPool.cpp:
3585         (WebKit::WebProcessPool::ensureNetworkProcess):
3586         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3587         (WebKit::WebsiteDataStore::parameters):
3588         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3589         (WebKit::WebsiteDataStoreConfiguration::copy):
3590         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3591         (WebKit::WebsiteDataStoreConfiguration::testingSessionEnabled const):
3592         (WebKit::WebsiteDataStoreConfiguration::setTestingSessionEnabled):
3593
3594 2019-09-27  Alex Christensen  <achristensen@webkit.org>
3595
3596         Move legacy custom protocol registration from process pool to NetworkProcessProxy
3597         https://bugs.webkit.org/show_bug.cgi?id=202315
3598
3599         Reviewed by Tim Horton.
3600
3601         Legacy custom protocol registration is a global thing, which is why it's legacy and we're trying to get rid of it.
3602         In the meantime, we don't want it to be in the set of things the NetworkProcess depends on the WebProcessPool for, which should be an empty set.
3603
3604         * UIProcess/WebProcessPool.cpp:
3605         (WebKit::WebProcessPool::ensureNetworkProcess):
3606         (WebKit::WebProcessPool::registerGlobalURLSchemeAsHavingCustomProtocolHandlers):
3607         (WebKit::WebProcessPool::unregisterGlobalURLSchemeAsHavingCustomProtocolHandlers):
3608         (WebKit::WebProcessPool::registerSchemeForCustomProtocol): Deleted.
3609         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol): Deleted.
3610         * UIProcess/WebProcessPool.h:
3611
3612 2019-09-27  Alex Christensen  <achristensen@webkit.org>
3613
3614         Layout Test http/tests/cache-storage/cache-records-persistency.https.html is failing
3615         https://bugs.webkit.org/show_bug.cgi?id=202323
3616
3617         Reviewed by Tim Horton.
3618
3619         This reverts most of r250351.
3620         It turns out NetworkProcessProxy::addSession has some side effects in the UIProcess that are useful for NetworkProcess resumption after crashes.  Let's keep that.
3621
3622         * NetworkProcess/NetworkProcess.cpp:
3623         (WebKit::NetworkProcess::initializeNetworkProcess):
3624         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3625         (WebKit::NetworkProcessCreationParameters::encode const):
3626         (WebKit::NetworkProcessCreationParameters::decode):
3627         * NetworkProcess/NetworkProcessCreationParameters.h:
3628         * UIProcess/WebProcessPool.cpp:
3629         (WebKit::WebProcessPool::ensureNetworkProcess):
3630
3631 2019-09-27  Jer Noble  <jer.noble@apple.com>
3632
3633         Unreviewed build-fix: wrap the AssertionServicesSPI.h in an IOS_FAMILY check.
3634
3635         * WebProcess/cocoa/WebProcessCocoa.mm:
3636
3637 2019-09-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
3638
3639         [iOS]: When inserting a photo and then inserting auto-corrected text, the photo is removed
3640         https://bugs.webkit.org/show_bug.cgi?id=202294
3641
3642         Reviewed by Wenson Hsieh.
3643
3644         WebPage::applyAutocorrectionInternal() calls wordRangeFromPosition() to
3645         calculate the range of the word to be replaced with the auto-corrected
3646         word. But if the text of the range does not match the original text,
3647         applyAutocorrectionInternal() tries to correct the range by moving it
3648         forward such that the length of the text range matches the length of the
3649         original text.
3650
3651         Another case, which should correct the range also, is: the range does not
3652         have a text but it is not collapsed. In this case, we should set the range
3653         back to the selection range so non-text nodes is removed.
3654
3655         * WebProcess/WebPage/ios/WebPageIOS.mm:
3656         (WebKit::WebPage::applyAutocorrectionInternal):
3657
3658 2019-09-27  John Wilander  <wilander@apple.com>
3659
3660         Storage Access API: document.hasStorageAccess() should return false by default
3661         https://bugs.webkit.org/show_bug.cgi?id=202281
3662         <rdar://problem/55718526>
3663
3664         Reviewed by Alex Christensen.
3665
3666         document.hasStorageAccess() should return false by default so that it only
3667         returns true if the context has asked for and been granted storage access.
3668
3669         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3670         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
3671         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3672         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
3673
3674 2019-09-27  Jer Noble  <jer.noble@apple.com>
3675
3676         [iOS] Lock screen controls can fail to play web content
3677         https://bugs.webkit.org/show_bug.cgi?id=202279
3678
3679         Reviewed by Chris Dumez.
3680
3681         When playback is paused from the lock screen via Now Playing controls, the WebProcess,
3682         UIProcess, and Network Process will all be suspended. MediaRemote will take an assertion
3683         and wake up the WebProcess when a remote control command to "play" is sent via the Now
3684         Playing controls. However, if a synchronous message to the (suspended) Network or UIProcess
3685         is issued before the notification that the process was unexpectedly unsuspended can be
3686         issued (which will subsequently unsuspend the UIProcess and Network process), we can get
3687         into a deadlocked state where the main thread is blocked on the sync message to a suspended
3688         process.
3689
3690         To work around this problem, move all the processing from ProcessTaskStateObserver to a
3691         WorkQueue / background thread. This requires making the ProcessTaskStateObserver thread-safe,
3692         though its only current client is a Singleton (the WebProcess class), and so the risk of
3693         thread safety issues is currently minimal. Regardless, access to the Client pointer must be
3694         guarded by a Lock, and the Client itself must become ref-counted, so that the
3695         ProcessTaskStateObserver can ref its Client (the WebProcess) during callback processing.
3696
3697         Unfortunately, sendWithAsyncReply() is not thread safe, nor is ProcessAssertion, so instead
3698         just use send() and set a 5-second timeout before expiring the assertion, and just use
3699         BKSProcessStateAssertion directly.
3700
3701         * Shared/Cocoa/ProcessTaskStateObserver.h:
3702         (WebKit::ProcessTaskStateObserver::Client::ref):
3703         (WebKit::ProcessTaskStateObserver::Client::deref):
3704         (WebKit::ProcessTaskStateObserver::setClient): Deleted.
3705         (WebKit::ProcessTaskStateObserver::client): Deleted.
3706         * Shared/Cocoa/ProcessTaskStateObserver.mm:
3707         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
3708         (WebKit::ProcessTaskStateObserver::create):
3709         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
3710         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
3711         (WebKit::ProcessTaskStateObserver::invalidate):
3712         (WebKit::ProcessTaskStateObserver::client):
3713         (WebKit::ProcessTaskStateObserver::setTaskState):
3714         * WebProcess/WebProcess.cpp:
3715         (WebKit::m_taskStateObserver):
3716         * WebProcess/WebProcess.h:
3717         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3718         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
3719         * UIProcess/WebProcessProxy.h:
3720         * UIProcess/WebProcessProxy.messages.in:
3721         * WebProcess/cocoa/WebProcessCocoa.mm:
3722         (WebKit::WebProcess::processTaskStateDidChange):
3723
3724 2019-09-27  Alex Christensen  <achristensen@webkit.org>
3725
3726         Move service worker process termination delay disabling from process pool to website data store
3727         https://bugs.webkit.org/show_bug.cgi?id=202308
3728
3729         Reviewed by Chris Dumez.
3730
3731         It's only there for a test, which still works quickly.
3732
3733         * NetworkProcess/NetworkProcess.cpp:
3734         (WebKit::NetworkProcess::initializeNetworkProcess):
3735         (WebKit::NetworkProcess::addWebsiteDataStore):
3736         (WebKit::NetworkProcess::destroySession):
3737         (WebKit::NetworkProcess::fetchWebsiteData):
3738         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3739         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
3740         (WebKit::NetworkProcess::swServerForSession):
3741         (WebKit::NetworkProcess::addServiceWorkerSession):
3742         (WebKit::NetworkProcess::disableServiceWorkerProcessTerminationDelay): Deleted.
3743         * NetworkProcess/NetworkProcess.h:
3744         * NetworkProcess/NetworkProcess.messages.in:
3745         * Shared/WebsiteDataStoreParameters.cpp:
3746         (WebKit::WebsiteDataStoreParameters::encode const):
3747         (WebKit::WebsiteDataStoreParameters::decode):
3748         * Shared/WebsiteDataStoreParameters.h:
3749         * UIProcess/API/Cocoa/WKProcessPool.mm:
3750         (-[WKProcessPool _disableServiceWorkerProcessTerminationDelay]): Deleted.
3751         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3752         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3753         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3754         (-[_WKWebsiteDataStoreConfiguration serviceWorkerProcessTerminationDelayEnabled]):
3755         (-[_WKWebsiteDataStoreConfiguration setServiceWorkerProcessTerminationDelayEnabled:]):
3756         * UIProcess/WebProcessPool.cpp:
3757         (WebKit::WebProcessPool::ensureNetworkProcess):
3758         (WebKit::WebProcessPool::disableServiceWorkerProcessTerminationDelay): Deleted.
3759         * UIProcess/WebProcessPool.h:
3760         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3761         (WebKit::WebsiteDataStore::parameters):
3762         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3763         (WebKit::WebsiteDataStoreConfiguration::copy):
3764         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3765         (WebKit::WebsiteDataStoreConfiguration::serviceWorkerProcessTerminationDelayEnabled const):
3766         (WebKit::WebsiteDataStoreConfiguration::setServiceWorkerProcessTerminationDelayEnabled):
3767
3768 2019-09-27  Alex Christensen  <achristensen@webkit.org>
3769
3770         Enable and disable ResourceLoadStatistics only by session
3771         https://bugs.webkit.org/show_bug.cgi?id=202298
3772
3773         Reviewed by Chris Dumez.
3774
3775         This is needed to keep per-session things per-session and per-process-pool things per-process-pool.
3776         This was a strange case where we would take the current session's value and apply it globally.
3777         This has no change in behavior because it is globally enabled and disabled by API clients anyways.
3778
3779         * NetworkProcess/NetworkProcess.cpp:
3780         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
3781         * NetworkProcess/NetworkProcess.h:
3782         * NetworkProcess/NetworkProcess.messages.in:
3783         * UIProcess/API/Cocoa/WKWebView.mm:
3784         (-[WKWebView _initializeWithConfiguration:]):
3785         * UIProcess/WebProcessPool.cpp:
3786         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled): Deleted.
3787         * UIProcess/WebProcessPool.h:
3788         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3789         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3790
3791 2019-09-27  Alex Christensen  <achristensen@webkit.org>
3792
3793         Remove unused WebProcessPool::setCanHandleHTTPSServerTrustEvaluation
3794         https://bugs.webkit.org/show_bug.cgi?id=202285
3795
3796         Reviewed by Youenn Fablet.
3797
3798         The SPI to set this was deprecated in r250377 with a replacement that was adopted in rdar://problem/55731135
3799         I removed a layout test using the old SPI and replaced it with a more precise API test verifying the behavior of the new SPI
3800         before and after the introduction of NSURLSession's _strictTrustEvaluate:queue:completionHandler:
3801
3802         * NetworkProcess/NetworkProcess.cpp:
3803         (WebKit::NetworkProcess::initializeNetworkProcess):
3804         (WebKit::NetworkProcess::setCanHandleHTTPSServerTrustEvaluation): Deleted.
3805         * NetworkProcess/NetworkProcess.h:
3806         (WebKit::NetworkProcess::canHandleHTTPSServerTrustEvaluation const): Deleted.
3807         * NetworkProcess/NetworkProcess.messages.in:
3808         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3809         (WebKit::NetworkProcessCreationParameters::encode const):
3810         (WebKit::NetworkProcessCreationParameters::decode):
3811         * NetworkProcess/NetworkProcessCreationParameters.h:
3812         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3813         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3814         (canNSURLSessionTrustEvaluate): Deleted.
3815         * UIProcess/API/C/WKContext.cpp:
3816         (WKContextSetCanHandleHTTPSServerTrustEvaluation):
3817         * UIProcess/API/Cocoa/WKProcessPool.mm:
3818         (-[WKProcessPool _setCanHandleHTTPSServerTrustEvaluation:]):
3819         * UIProcess/WebProcessPool.cpp:
3820         (WebKit::WebProcessPool::ensureNetworkProcess):
3821         (WebKit::WebProcessPool::setCanHandleHTTPSServerTrustEvaluation): Deleted.
3822         * UIProcess/WebProcessPool.h:
3823
3824 2019-09-27  Alex Christensen  <achristensen@webkit.org>
3825
3826         Remove unused APIProcessPoolConfiguration::diskCacheSpeculativeValidationEnabled
3827         https://bugs.webkit.org/show_bug.cgi?id=202290
3828
3829         Reviewed by Carlos Garcia Campos.
3830
3831         The SPI to set this was deprecated in r250377 with a replacement that was adopted in rdar://problem/55731135
3832
3833         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3834         (WebKit::NetworkProcessCreationParameters::encode const):
3835         (WebKit::NetworkProcessCreationParameters::decode):
3836         * NetworkProcess/NetworkProcessCreationParameters.h:
3837         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3838         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3839         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3840         (API::ProcessPoolConfiguration::copy):
3841         * UIProcess/API/APIProcessPoolConfiguration.h:
3842         * UIProcess/API/C/WKContext.cpp:
3843         (WKContextSetDiskCacheSpeculativeValidationEnabled):
3844         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
3845         (WKWebsiteDataStoreConfigurationGetNetworkCacheSpeculativeValidationEnabled):
3846         (WKWebsiteDataStoreConfigurationSetNetworkCacheSpeculativeValidationEnabled):
3847         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h:
3848         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3849         (-[_WKProcessPoolConfiguration diskCacheSpeculativeValidationEnabled]):
3850         (-[_WKProcessPoolConfiguration setDiskCacheSpeculativeValidationEnabled:]):
3851         * UIProcess/WebProcessPool.cpp:
3852         (WebKit::WebProcessPool::ensureNetworkProcess):
3853
3854 2019-09-27  Zan Dobersek  <zdobersek@igalia.com>
3855
3856         [CoordinatedGraphics] support bounds origin
3857         https://bugs.webkit.org/show_bug.cgi?id=198998
3858
3859         Reviewed by Carlos Garcia Campos.
3860
3861         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3862         (WebKit::CoordinatedGraphicsScene::updateSceneState):
3863         Apply bounds origin value to the TextureMapperLayer object.
3864
3865 2019-09-27  Youenn Fablet  <youenn@apple.com>
3866
3867         Make IsNSURLSessionWebSocketEnabled an experimental flag
3868         https://bugs.webkit.org/show_bug.cgi?id=202135
3869         <rdar://problem/55694721>
3870
3871         Reviewed by Geoff Garen.
3872
3873         Add C API to switch off this feature in WTR.
3874
3875         * Shared/WebPreferences.yaml:
3876         * UIProcess/API/C/WKPreferences.cpp:
3877         (WKPreferencesSetIsNSURLSessionWebSocketEnabled):
3878         (WKPreferencesGetIsNSURLSessionWebSocketEnabled):
3879         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3880
3881 2019-09-27  Jiewen Tan  <jiewen_tan@apple.com>
3882
3883         SubFrameSOAuthorizationSession should ensure messages are posted in the right order to the parent frame
3884         https://bugs.webkit.org/show_bug.cgi?id=202061
3885         <rdar://problem/55485666>
3886
3887         Reviewed by Youenn Fablet.
3888
3889         This patch ensures messages that signal the process of SOAuthorization interception are posted in
3890         the right order to the parent frame. Before this patch, there are chances that SOAuthorizationDidCancel
3891         could be posted to the parent before SOAuthorizationDidStart. There are few causes that lead to
3892         this race condition:
3893         1) SubFrameSOAuthorizationSession::beforeStart posts SOAuthorizationDidStart in the next runloop. So
3894         extension could have the chance to invoke SubFrameSOAuthorizationSession::fallBackToWebPathInternal
3895         before SOAuthorizationDidStart is posted.
3896         2) Even if the order is right in the UI process, it is not guaranteed that Web process will strictly
3897         follow the order as the loading process is async.
3898
3899         To fix the issue:
3900         1) SubFrameSOAuthorizationSession::beforeStart now posts SOAuthorizationDidStart in the same runloop.
3901         2) Observer is introduced in FrameLoadState such that SubFrameSOAuthorizationSession could know if
3902         the loading is finished. With this new capacity, SubFrameSOAuthorizationSession can ensure it only
3903         posts next message when the previous message has been posted.
3904
3905         Implementation wise, a deque to queue requests is provided to maintain order.
3906         1) When new request is added to the deque, SubFrameSOAuthorizationSession will only load the request
3907         if it is the only element in the deque. Otherwise, it does nothing.
3908         2) When SubFrameSOAuthorizationSession receives didFinishLoad, it pops the head of the queue and loads
3909         the next request in the queue if any.
3910         The above design should guarantee all requests are loaded in sequence.
3911
3912         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h:
3913         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
3914         (WebKit::SubFrameSOAuthorizationSession::SubFrameSOAuthorizationSession):
3915         (WebKit::SubFrameSOAuthorizationSession::~SubFrameSOAuthorizationSession):
3916         (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
3917         (WebKit::SubFrameSOAuthorizationSession::completeInternal):
3918         (WebKit::SubFrameSOAuthorizationSession::beforeStart):
3919         (WebKit::SubFrameSOAuthorizationSession::didFinishLoad):
3920         (WebKit::SubFrameSOAuthorizationSession::appendRequestToLoad):
3921         (WebKit::SubFrameSOAuthorizationSession::loadRequestToFrame):
3922         (WebKit::SubFrameSOAuthorizationSession::loadDataToFrame): Deleted.
3923         (WebKit::SubFrameSOAuthorizationSession::postDidCancelMessageToParent): Deleted.
3924         * UIProcess/FrameLoadState.cpp:
3925         (WebKit::FrameLoadState::addObserver):
3926         (WebKit::FrameLoadState::removeObserver):
3927         (WebKit::FrameLoadState::didFinishLoad):
3928         * UIProcess/FrameLoadState.h:
3929
3930 2019-09-26  Kate Cheney  <katherine_cheney@apple.com>
3931
3932         Resource Load Statistics: Downgrade all third-party referrer headers
3933         https://bugs.webkit.org/show_bug.cgi?id=201353
3934         <rdar://problem/54895650>
3935         
3936         Majority of this patch was written by John Wilander <wilander@apple.com>.
3937
3938         Reviewed by Brent Fulgham. 
3939
3940         When tracking protections are enabled, we should downgrade all third-party
3941         referrers to their origins. Note that this downgrade will be specific to
3942         Cocoa so other ports will have to adopt as they see fit.
3943
3944         Cocoa already does this downgrade in ephemeral sessions (shipping).
3945
3946         The majority of these changes are test infrastructure. The functional
3947         change is in WebKit::NetworkDataTaskCocoa and WebKit::NetworkSession.
3948
3949         * NetworkProcess/NetworkProcess.cpp:
3950         (WebKit::NetworkProcess::setShouldDowngradeReferrerForTesting):
3951         * NetworkProcess/NetworkProcess.h:
3952         * NetworkProcess/NetworkProcess.messages.in:
3953         * NetworkProcess/NetworkSession.cpp:
3954         (WebKit::NetworkSession::isResourceLoadStatisticsEnabled const):
3955         (WebKit::NetworkSession::setS