2b7cbd9fa656e9290c1331ee7e93944b861afffb
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-09-17  Chris Dumez  <cdumez@apple.com>
2
3         REGRESSION (iOS 13): rAF stops firing when navigating away cross-origin and then back
4         https://bugs.webkit.org/show_bug.cgi?id=201767
5         <rdar://problem/55350854>
6
7         Reviewed by Geoffrey Garen.
8
9         When navigating back and restoring a SuspendedPage, WebPage::reinitializeWebPage() ends up
10         reconstructing a new DrawingArea to match the identifier of the DrawingAreaProxy that the
11         UIProcess created. The issue is that when reconstructing the DrawingArea, we were losing
12         the DisplayRefreshMonitors that had been registered on the previous drawing area. To
13         address the issue, we now make sure to transfer the DisplayRefreshMonitors over from the
14         old to the new drawing area. This patch is kept as small as possible to faciliate cherry
15         picking to a branch. However, I think we should consider refactoring the code so that
16         we no longer need to re-create the DrawingArea in the WebProcess in this case.
17
18         * WebProcess/WebPage/DrawingArea.h:
19         (WebKit::DrawingArea::adoptDisplayRefreshMonitorsFromDrawingArea):
20         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
21         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
22         (WebKit::RemoteLayerTreeDrawingArea::adoptDisplayRefreshMonitorsFromDrawingArea):
23         * WebProcess/WebPage/WebPage.cpp:
24         (WebKit::WebPage::reinitializeWebPage):
25
26 2019-09-17  Truitt Savell  <tsavell@apple.com>
27
28         Unreviewed, rolling out r249950.
29
30         Broke the iOS build.
31
32         Reverted changeset:
33
34         "Remove the "Show Link Previews" and "Hide Link Previews"
35         action menus in the preview platter"
36         https://bugs.webkit.org/show_bug.cgi?id=201864
37         https://trac.webkit.org/changeset/249950
38
39 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
40
41         [GTK] Initial view loading is slow
42         https://bugs.webkit.org/show_bug.cgi?id=201451
43
44         Reviewed by Sergio Villar Senin.
45
46         The problem is that now we are always calling DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() after a
47         new process is launched and we used to do that only when launching a new process after a crash. This makes
48         m_hasReceivedFirstUpdate useless, because it's always set to true right after a process is launched. Then, we
49         wait up to half a second (which is usually the case for the initial load) until the first update. We only want
50         to do that when recovering from a crash or when swapping processes to avoid flashing effect.
51
52         * UIProcess/WebPageProxy.cpp:
53         (WebKit::WebPageProxy::launchProcess): Add ProcessLaunchReason parameter and pass it to
54         finishAttachingToWebProcess instead of IsProcessSwap.
55         (WebKit::WebPageProxy::swapToWebProcess): Pass ProcessLaunchReason::ProcessSwap to
56         finishAttachingToWebProcess().
57         (WebKit::WebPageProxy::finishAttachingToWebProcess): Do not call
58         DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() when process launch reason is ProcessLaunchReason::InitialProcess.
59         (WebKit::WebPageProxy::launchProcessForReload): Pass ProcessLaunchReason::Reload to launchProcess().
60         * UIProcess/WebPageProxy.h: Remove IsProcessSwap and add ProcessLaunchReason instead that is passed to
61         launchProcess and finishAttachingToWebProcess.
62
63 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
64
65         REGRESSION(r249275): [GTK][WPE] WebPage injected bundle messages no longer work
66         https://bugs.webkit.org/show_bug.cgi?id=201865
67
68         Reviewed by Žan Doberšek.
69
70         We use them to implement the web resources API. This is another regression of r249275 because we are using the
71         page proxy identifier when we really want to the web page identifier.
72
73         * UIProcess/API/glib/WebKitWebContext.cpp:
74         (webkitWebContextGetWebViewForPage): Use WebPageProxy::webPageID() instead of WebPageProxy::identifier().
75
76 2019-09-17  Dean Jackson  <dino@apple.com>
77
78         Remove the "Show Link Previews" and "Hide Link Previews" action menus in the preview platter
79         https://bugs.webkit.org/show_bug.cgi?id=201864
80         <rdar://55190038>
81
82         Reviewed by Simon Fraser.
83
84         * UIProcess/ios/WKActionSheetAssistant.mm: Remove the toggle action from the
85         default values.
86         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
87         * UIProcess/ios/WKContentViewInteraction.mm: No longer try to add a toggle when
88         it isn't there.
89         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
90         (menuWithShowLinkPreviewAction): Deleted.
91
92 2019-09-17  Jiewen Tan  <jiewen_tan@apple.com>
93
94         [WebAuthn] Use WebPreferences instead of RuntimeEnabledFeatures in UIProcess
95         https://bugs.webkit.org/show_bug.cgi?id=198176
96         <rdar://problem/55285709>
97
98         Reviewed by Youenn Fablet.
99
100         This patch does the following two things:
101         1) It merges WebAuthenticationRequestData::creationOptions and requestOptions into a variant, and therefore
102         merges code paths that involve WebAuthenticationRequestData.
103         2) It teaches WebAuthenticationRequestData to store a WebPreferences such that AuthenticatorManager could utilize
104         runtime feature flags to turn features on or off.
105
106         * UIProcess/WebAuthentication/Authenticator.cpp:
107         (WebKit::Authenticator::handleRequest):
108         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
109         (WebKit::AuthenticatorManager::handleRequest):
110         (WebKit::AuthenticatorManager::clearState):
111         (WebKit::AuthenticatorManager::authenticatorAdded):
112         (WebKit::AuthenticatorManager::startDiscovery):
113         (WebKit::AuthenticatorManager::makeCredential): Deleted.
114         (WebKit::AuthenticatorManager::getAssertion): Deleted.
115         * UIProcess/WebAuthentication/AuthenticatorManager.h:
116         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
117         (WebKit::LocalAuthenticator::makeCredential):
118         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
119         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
120         (WebKit::LocalAuthenticator::getAssertion):
121         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
122         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
123         (WebKit::LocalService::isAvailable):
124         Don't check RuntimeEnabledFeatures given it is for WebCore.
125         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
126         (): Deleted.
127         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
128         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
129         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
130         (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
131         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
132         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
133         (WebKit::CtapAuthenticator::makeCredential):
134         (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived const):
135         (WebKit::CtapAuthenticator::getAssertion):
136         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
137         (WebKit::U2fAuthenticator::makeCredential):
138         (WebKit::U2fAuthenticator::checkExcludeList):
139         (WebKit::U2fAuthenticator::issueRegisterCommand):
140         (WebKit::U2fAuthenticator::getAssertion):
141         (WebKit::U2fAuthenticator::issueSignCommand):
142         (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
143         (WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived):
144
145 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
146
147         Keeps running obsolete WebProcess-es for too long
148         https://bugs.webkit.org/show_bug.cgi?id=201492
149
150         Reviewed by Chris Dumez.
151
152         That's how the web process cache is expected to work, but it's true that it probably only makes sense to use it
153         when cache model is primary web browser.
154
155         * UIProcess/WebProcessCache.cpp:
156         (WebKit::WebProcessCache::updateCapacity): Disable the web process cache when cache model is not primary web browser.
157
158 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
159
160         [GTK] Crash closing web view while hardware acceleration is enabled
161         https://bugs.webkit.org/show_bug.cgi?id=200856
162
163         Reviewed by Michael Catanzaro.
164
165         The crash happens when destroying the WaylandCompositor::Surface because the web view GL context is used to
166         release the texture, but the GL context is no longer valid after web view
167         unrealize. AcceleratedBackingStoreWayland should handle the web view unrealize to destroy the GL context. It
168         will be created on demand again after the web view is realized.
169
170         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
171         (webkitWebViewBaseRealize): Notify AcceleratedBackingStore.
172         (webkitWebViewBaseUnrealize): Ditto.
173         * UIProcess/gtk/AcceleratedBackingStore.h:
174         (WebKit::AcceleratedBackingStore::realize): Added.
175         (WebKit::AcceleratedBackingStore::unrealize): Added.
176         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
177         (WebKit::AcceleratedBackingStoreWayland::realize): In case of using WaylandCompositor, call
178         WaylandCompositor::bindWebPage() to bind the WebPageProxy to the Wayland surface.
179         (WebKit::AcceleratedBackingStoreWayland::unrealize): Destroy GL resources and the GL context.
180         (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext): Do not try to create the GL context if the web
181         view is not realized.
182         (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Remove the code to initialize the texture.
183         (WebKit::AcceleratedBackingStoreWayland::paint): And add it here.
184         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
185         * UIProcess/gtk/WaylandCompositor.cpp:
186         (WebKit::WaylandCompositor::Surface::setWebPage): Return early if given page is the current one already.
187         (WebKit::WaylandCompositor::bindWebPage): Set the surface WebPageProxy.
188         (WebKit::WaylandCompositor::unbindWebPage): Unset the surface WebPageProxy.
189         * UIProcess/gtk/WaylandCompositor.h:
190         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
191         (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): When restoring a previous layer tree
192         host, always call resumeRendering() to balance the suspendRendering() called in exitAcceleratedCompositingMode().
193
194 2019-09-16  Ryan Haddad  <ryanhaddad@apple.com>
195
196         Unreviewed, rolling out r249910.
197
198         Caused layout test failures and timeouts on Catalina
199
200         Reverted changeset:
201
202         "REGRESSION(249649): Unable to open local files in MiniBrowser
203         on macOS"
204         https://bugs.webkit.org/show_bug.cgi?id=201798
205         https://trac.webkit.org/changeset/249910
206
207 2019-09-16  Chris Dumez  <cdumez@apple.com>
208
209         Drop sessionID / websiteDataStoreID from WebPageCreationParameters
210         https://bugs.webkit.org/show_bug.cgi?id=201847
211
212         Reviewed by Youenn Fablet.
213
214         Drop sessionID / websiteDataStoreID from WebPageCreationParameters now that we have
215         one session per WebProcess.
216
217         * Shared/WebPageCreationParameters.cpp:
218         (WebKit::WebPageCreationParameters::encode const):
219         (WebKit::WebPageCreationParameters::decode):
220         * Shared/WebPageCreationParameters.h:
221         (WebKit::WebPageCreationParameters::WebPageCreationParameters): Deleted.
222         * UIProcess/WebPageProxy.cpp:
223         (WebKit::WebPageProxy::creationParameters):
224         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
225         (WebKit::WebChromeClient::createWindow):
226         * WebProcess/WebPage/WebPage.cpp:
227         (WebKit::m_textAutoSizingAdjustmentTimer):
228         * WebProcess/WebProcess.cpp:
229         (WebKit::WebProcess::createWebPage):
230
231 2019-09-16  Dean Jackson  <dino@apple.com>
232
233         Provide a prototype for AR QuickLook to trigger processing in the originating page
234         https://bugs.webkit.org/show_bug.cgi?id=201371
235
236         Hopefully fix the public iOS 13 build.
237
238         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
239
240 2019-09-16  David Kilzer  <ddkilzer@apple.com>
241
242         [WebAuthn] Name instance variables consistently in WKMockNFTag
243         <https://webkit.org/b/201845>
244
245         Reviewed by Jiewen Tan.
246
247         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
248         Make all @synthesize instance variables use a leading underscore
249         for their name.
250
251 2019-09-16  Dean Jackson  <dino@apple.com>
252
253         REGRESSION: iPad: Safari becomes unresponsive after context menu on 1-800-MY-APPLE phone number, tapping 'Add to Contacts'
254         https://bugs.webkit.org/show_bug.cgi?id=201816
255         <rdar://55105827>
256
257         Reviewed by Darin Adler.
258
259         When generating the DataDetectorsContext for a position, we should
260         also provide the source rectangle for the link in root view coordinates.
261         This allows DataDetectors to show any modal dialogs in the right
262         position.
263
264         * UIProcess/ios/WKContentViewInteraction.mm: Use either the bounds of the positionInformation
265         or the text bounding rectangle.
266         (-[WKContentView dataDetectionContextForPositionInformation:]):
267
268 2019-09-16  Chris Dumez  <cdumez@apple.com>
269
270         NetworkProcessConnection does not need HashMaps of sessionIDs for Service Workers and IDB
271         https://bugs.webkit.org/show_bug.cgi?id=201830
272
273         Reviewed by Geoffrey Garen.
274
275         NetworkProcessConnection does not need HashMaps of sessionIDs for Service Workers and IDB, since
276         we now have one sessionID per WebContent process.
277
278         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
279         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
280         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
281         (WebKit::WebIDBConnectionToServer::create):
282         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
283         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
284         * WebProcess/Databases/WebDatabaseProvider.cpp:
285         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
286         * WebProcess/Network/NetworkProcessConnection.cpp:
287         (WebKit::NetworkProcessConnection::didReceiveMessage):
288         (WebKit::NetworkProcessConnection::didClose):
289         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
290         (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession):
291         * WebProcess/Network/NetworkProcessConnection.h:
292         (WebKit::NetworkProcessConnection::existingIDBConnectionToServer const):
293         (WebKit::NetworkProcessConnection::existingServiceWorkerConnectionForSession):
294         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
295         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
296         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession):
297         (WebKit::WebServiceWorkerProvider::handleFetch):
298         * WebProcess/WebProcess.cpp:
299         (WebKit::WebProcess::networkProcessConnectionClosed):
300
301 2019-09-16  Brent Fulgham  <bfulgham@apple.com>
302
303         [FTW] Correct lifespan of other SharedBitmaps
304         https://bugs.webkit.org/show_bug.cgi?id=201800
305
306         Reviewed by Dean Jackson.
307
308         The pop-up menu code creates its own SharedBitmap in the WebContent process,
309         which needs to release its handle before destruction, otherwise the UIProcess
310         will be unable to access the GPU texture (since it will have been cleaned up).
311
312         Since WebPopupMenuProxyWin has its own HWND and WinProc, it needs its own
313         swapChain to handle syncing of content to the screen.
314
315         This patch also audits other uses of SharedBitmap to make sure a similar
316         problem doesn't exist elsewhere.
317
318         * Shared/ShareableBitmap.h:
319         * Shared/win/ShareableBitmapDirect2D.cpp:
320         (WebKit::ShareableBitmap::paint):
321         (WebKit::ShareableBitmap::createDirect2DSurface):
322         * UIProcess/win/WebPopupMenuProxyWin.cpp:
323         (WebKit::WebPopupMenuProxyWin::showPopupMenu): Add Direct2D code paths.
324         (WebKit::WebPopupMenuProxyWin::paint): Update for Direct2D.
325         (WebKit::WebPopupMenuProxyWin::setupSwapChain): Added.
326         (WebKit::WebPopupMenuProxyWin::configureBackingStore): Added.
327         * UIProcess/win/WebPopupMenuProxyWin.h:
328         * UIProcess/win/WebView.cpp:
329         (WebKit::WebView::setupSwapChain): Move some implementation code to the
330         Direct2DUtilities file.
331         * UIProcess/win/WebView.h:
332         (WebKit::WebView::d3dDevice const):
333         (WebKit::WebView::d3dImmediateContext const):
334         (WebKit::WebView::d3dDevice): Deleted.
335         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
336         (WebKit::WebPopupMenu::show):
337         * WebProcess/WebPage/FindController.cpp:
338         (WebKit::FindController::getImageForFindMatch): Prevent WebContent process from
339         destroying SharedBitmap before the UIProcess can receive it.
340
341 2019-09-16  Chris Dumez  <cdumez@apple.com>
342
343         Simplify WebResourceLoadObserver now that we have one WebProcess per session
344         https://bugs.webkit.org/show_bug.cgi?id=201821
345
346         Reviewed by Brent Fulgham.
347
348         Simplify WebResourceLoadObserver now that we have one WebProcess per session.
349         No need to pass sessionIDs around or store statistics per sessionID.
350         Also, only initialize the WebResourceLoadObserver if both ITP is enabled and
351         we're not in a WebContent process used for an ephemeral session.
352
353         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
354         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
355         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
356         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
357         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
358         * NetworkProcess/NetworkConnectionToWebProcess.h:
359         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
360         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
361         (WebKit::WebResourceLoadObserver::requestStorageAccessUnderOpener):
362         (WebKit::WebResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
363         (WebKit::WebResourceLoadObserver::scheduleNotificationIfNeeded):
364         (WebKit::WebResourceLoadObserver::statisticsForURL):
365         (WebKit::WebResourceLoadObserver::takeStatistics):
366         (WebKit::WebResourceLoadObserver::clearState):
367         (WebKit::WebResourceLoadObserver::logFontLoad):
368         (WebKit::WebResourceLoadObserver::logCanvasRead):
369         (WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure):
370         (WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed):
371         (WebKit::WebResourceLoadObserver::logScreenAPIAccessed):
372         (WebKit::WebResourceLoadObserver::logSubresourceLoading):
373         (WebKit::WebResourceLoadObserver::logWebSocketLoading):
374         (WebKit::WebResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
375         * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
376         * WebProcess/WebProcess.cpp:
377         (WebKit::WebProcess::setWebsiteDataStoreParameters):
378
379 2019-09-16  David Kilzer  <ddkilzer@apple.com>
380
381         Fix build failure in MockNfcService.mm
382         <https://webkit.org/b/201839>
383
384         Reviewed by Brady Eidson.
385
386         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
387         Specify instance variable names for @synthesized variables that
388         need to be manually released in -dealloc under MRR.
389
390 2019-09-16  Per Arne Vollan  <pvollan@apple.com>
391
392         REGRESSION(249649): Unable to open local files in MiniBrowser on macOS
393         https://bugs.webkit.org/show_bug.cgi?id=201798
394
395         Reviewed by Brent Fulgham.
396
397         The commit <https://trac.webkit.org/changeset/249649> introduced a MiniBrowser regression on macOS where
398         MiniBrowser is not able to open local files. The change set r249649 fixed a problem where the WebContent
399         process PID was not ready to be used when creating a sandbox extension. This happened in the cases where
400         the WebContent process had not finished launching when the load started. The WebContent process is also
401         creating sandbox extensions for the Networking process for the files being loaded, and also needs to be
402         passing the PID of the Networking process when creating these. This patch is addressing this by getting
403         the PID of the Networking process when the WebContent process is initially getting the connection to the
404         Networking process. The PID is then stored in the NetworkProcessConnection class, from where it is passed
405         to the NetworkLoadParameters, and used when creating the sandbox extension for the Networking process.
406
407         * NetworkProcess/NetworkLoadParameters.h:
408         * NetworkProcess/NetworkResourceLoadParameters.cpp:
409         (WebKit::NetworkResourceLoadParameters::encode const):
410         * UIProcess/Network/NetworkProcessProxy.cpp:
411         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
412         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
413         (WebKit::NetworkProcessProxy::networkProcessCrashed):
414         (WebKit::NetworkProcessProxy::didFinishLaunching):
415         * UIProcess/WebPageProxy.cpp:
416         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
417         * UIProcess/WebProcessProxy.messages.in:
418         * WebProcess/Network/NetworkProcessConnection.cpp:
419         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
420         * WebProcess/Network/NetworkProcessConnection.h:
421         (WebKit::NetworkProcessConnection::create):
422         (WebKit::NetworkProcessConnection::networkProcessPID const):
423         * WebProcess/Network/WebLoaderStrategy.cpp:
424         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
425         * WebProcess/WebProcess.cpp:
426         (WebKit::getNetworkProcessConnection):
427         (WebKit::WebProcess::ensureNetworkProcessConnection):
428
429 2019-09-16  David Kilzer  <ddkilzer@apple.com>
430
431         [WebAuthn] REGRESSION (r249059): Leak of WKMockNFTag objects and WKMockNFTag instance variables
432         <https://webkit.org/b/201813>
433
434         Reviewed by Darin Adler.
435
436         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
437         (-[WKMockNFTag dealloc]): Add method and release instance
438         variables to fix leaks.
439         (WebKit::MockNfcService::detectTags const): Use adoptNS() to fix
440         leaks of WKMockNFTag objects.
441
442 2019-09-16  David Kilzer  <ddkilzer@apple.com>
443
444         REGRESSION (r243113): Leak of multiple instance variable blocks when deallocating _WKAttributedStringNavigationDelegate
445         <https://webkit.org/b/201812>
446
447         Reviewed by Timothy Hatcher.
448
449         * UIProcess/API/Cocoa/NSAttributedString.mm:
450         (-[_WKAttributedStringNavigationDelegate dealloc]): Add method
451         to release instance variable blocks to fix potential leaks.
452
453 2019-09-16  Adrian Perez de Castro  <aperez@igalia.com>
454
455         Unreviewed build fix.
456
457         * NetworkProcess/NetworkConnectionToWebProcess.h: Add missing forward
458         declaration of the NetworkSession class.
459
460 2019-09-16  Chris Dumez  <cdumez@apple.com>
461
462         Store sessionID on the NetworkConnectionToWebProcess now that there is one session per WebProcess
463         https://bugs.webkit.org/show_bug.cgi?id=201789
464
465         Reviewed by Alex Christensen.
466
467         Store sessionID on the NetworkConnectionToWebProcess now that there is one session per WebProcess.
468         As a result, we no longer need to pass the sessionID in each IPC from the WebProcess to the
469         NetworkProcess.
470
471         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
472         (WebKit::NetworkConnectionToWebProcess::create):
473         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
474         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
475         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
476         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
477         (WebKit::NetworkConnectionToWebProcess::didClose):
478         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
479         (WebKit::NetworkConnectionToWebProcess::createSocketChannel):
480         (WebKit::NetworkConnectionToWebProcess::networkSession):
481         (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
482         (WebKit::NetworkConnectionToWebProcess::storageSession):
483         (WebKit::NetworkConnectionToWebProcess::startDownload):
484         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
485         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
486         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
487         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
488         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
489         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
490         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
491         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
492         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
493         (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
494         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
495         (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
496         (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
497         (WebKit::NetworkConnectionToWebProcess::blobSize):
498         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
499         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
500         (WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics):
501         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
502         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
503         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
504         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
505         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
506         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
507         (WebKit::NetworkConnectionToWebProcess::unregisterSWConnection):
508         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
509         (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection):
510         * NetworkProcess/NetworkConnectionToWebProcess.h:
511         (WebKit::NetworkConnectionToWebProcess::sessionID const):
512         (WebKit::NetworkConnectionToWebProcess::startDownload):
513         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
514         * NetworkProcess/NetworkProcess.cpp:
515         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
516         * NetworkProcess/NetworkProcess.h:
517         * NetworkProcess/NetworkProcess.messages.in:
518         * NetworkProcess/NetworkResourceLoader.cpp:
519         (WebKit::NetworkResourceLoader::start):
520         * UIProcess/Network/NetworkProcessProxy.cpp:
521         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
522         * UIProcess/WebProcessProxy.cpp:
523         (WebKit::WebProcessProxy::sessionID const):
524         * UIProcess/WebProcessProxy.h:
525         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
526         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
527         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
528         (WebKit::BlobRegistryProxy::registerFileBlobURL):
529         (WebKit::BlobRegistryProxy::registerBlobURL):
530         (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
531         (WebKit::BlobRegistryProxy::unregisterBlobURL):
532         (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
533         (WebKit::BlobRegistryProxy::blobSize):
534         * WebProcess/Network/NetworkProcessConnection.cpp:
535         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
536         * WebProcess/Network/WebSocketChannel.cpp:
537         (WebKit::WebSocketChannel::connect):
538         * WebProcess/Network/WebSocketStream.cpp:
539         (WebKit::WebSocketStream::WebSocketStream):
540         * WebProcess/Storage/WebSWClientConnection.cpp:
541         (WebKit::WebSWClientConnection::WebSWClientConnection):
542         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
543         (WebKit::m_userAgent):
544         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
545         (WebKit::WebFrameLoaderClient::detachedFromParent2):
546         (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
547         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
548         (WebKit::WebResourceLoadObserver::requestStorageAccessUnderOpener):
549         (WebKit::WebResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
550         * WebProcess/WebPage/WebCookieJar.cpp:
551         (WebKit::WebCookieJar::cookies const):
552         (WebKit::WebCookieJar::setCookies):
553         (WebKit::WebCookieJar::cookiesEnabled const):
554         (WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
555         (WebKit::WebCookieJar::getRawCookies const):
556         (WebKit::WebCookieJar::deleteCookie):
557         * WebProcess/WebPage/WebFrame.cpp:
558         (WebKit::WebFrame::startDownload):
559         (WebKit::WebFrame::convertMainResourceLoadToDownload):
560         * WebProcess/WebPage/WebPage.cpp:
561         (WebKit::WebPage::close):
562         (WebKit::WebPage::hasStorageAccess):
563         (WebKit::WebPage::requestStorageAccess):
564         * WebProcess/WebProcess.cpp:
565         (WebKit::WebProcess::createWebPage):
566         (WebKit::WebProcess::removeWebPage):
567         * WebProcess/WebProcess.h:
568         (WebKit::WebProcess::sessionID const):
569
570 2019-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
571
572         REGRESSION(r249142): [GTK] Epiphany delayed page loads continue indefinitely
573         https://bugs.webkit.org/show_bug.cgi?id=201544
574
575         Reviewed by Michael Catanzaro.
576
577         WebPageProxy::loadAlternateHTML() is an exception, because it's an API request but always sets the navigationID
578         to 0. We always want to reset the pending API request URL when alternate HTML load starts.
579
580         * UIProcess/WebPageProxy.cpp:
581         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): Check also that it's an API alternate HTML load
582         to reset the pending API request URL.
583
584 2019-09-15  David Kilzer  <ddkilzer@apple.com>
585
586         REGRESSION (r248592): Leak of CFDictionaryRef in WebKit::NetworkRTCProvider::proxyInfoFromSession()
587         <https://webkit.org/b/201811>
588
589         Reviewed by Youenn Fablet.
590
591         * NetworkProcess/webrtc/NetworkRTCProvider.mm:
592         (WebKit::NetworkRTCProvider::proxyInfoFromSession): Use
593         RetainPtr<> to fix the leak.
594
595 2019-09-14  Adrian Perez de Castro  <aperez@igalia.com>
596
597         [GTK][WPE] Check for a Snap sandbox a bit harder
598         https://bugs.webkit.org/show_bug.cgi?id=201793
599
600         Reviewed by Michael Catanzaro.
601
602         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
603         (WebKit::isInsideSnap): Check whether the SNAP_NAME and SNAP_REVISION
604         environment variables are defined as well.
605
606 2019-09-14  Youenn Fablet  <youenn@apple.com>
607
608         Add release logging in WebLoaderStrategy to check that a load is going through service worker
609         https://bugs.webkit.org/show_bug.cgi?id=201761
610
611         Reviewed by Chris Dumez.
612
613         This allows identifying whether a load remains pending on the service worker fetch path.
614
615         * WebProcess/Network/WebLoaderStrategy.cpp:
616         (WebKit::WebLoaderStrategy::scheduleLoad):
617
618 2019-09-13  Youenn Fablet  <youenn@apple.com>
619
620         [MacOS/iOS] imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-abort.https.html is sometimes crashing in Debug
621         https://bugs.webkit.org/show_bug.cgi?id=201686
622
623         Reviewed by Alexey Proskuryakov.
624
625         A load might be cancelled shortly after being started in network process.
626         In that case, NetworkDataTaskCocoa might be destroyed, thus removed from the ID to task map
627         but some handlers might still be called until the NSURLSessionTask is finished cancelling.
628         This happens for authentication challenges.
629         In case where the NSURLSessionTask is cancelling, return early instead of processing the challenge.
630
631         Covered by LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-abort.https.html and LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-abort.https.html no longer crashing in debug.
632
633         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
634         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
635
636 2019-09-11  Dean Jackson  <dino@apple.com>
637
638         Provide a prototype for AR QuickLook to trigger processing in the originating page
639         https://bugs.webkit.org/show_bug.cgi?id=201371
640         <rdar://54904781>
641
642         Reviewed by Simon Fraser.
643
644         Provide a way for a Web page to know if an action in the AR scene
645         was performed, if and only if the system AR library calls a delegate with
646         particular parameters. Post a message to the originating frame so
647         the page can detect the action.
648
649         * Scripts/webkit/messages.py: Include the right header for SystemPreviewInfo.
650
651         * Shared/WebCoreArgumentCoders.cpp: Use SystemPreviewInfo.
652         (IPC::ArgumentCoder<ResourceRequest>::encode):
653         (IPC::ArgumentCoder<ResourceRequest>::decode):
654
655         * UIProcess/API/Cocoa/WKWebView.mm:
656         (-[WKWebView _triggerSystemPreviewActionOnFrame:page:]): New helper/test function
657         to trigger the system preview action.
658         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
659
660         * UIProcess/Cocoa/DownloadClient.mm: Use new type.
661         (WebKit::DownloadClient::didStart):
662
663         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Implement the delegate so that
664         we can detect an action. When it happens, tell the WebPageProxy to send a message.
665
666         * UIProcess/Downloads/DownloadProxy.h: Use SystemPreviewInfo type.
667         (WebKit::DownloadProxy::systemPreviewDownloadInfo const):
668         (WebKit::DownloadProxy::systemPreviewDownloadRect const): Deleted.
669
670         * UIProcess/SystemPreviewController.h:
671         (WebKit::SystemPreviewController::previewInfo const):
672
673         * UIProcess/WebPageProxy.cpp: Send it over to the Web Process.
674         (WebKit::WebPageProxy::systemPreviewActionTriggered const):
675         * UIProcess/WebPageProxy.h:
676
677         * WebProcess/WebPage/WebPage.cpp: Check the destination still exists, and then talk
678         to the Document.
679         (WebKit::WebPage::systemPreviewActionTriggered):
680         * WebProcess/WebPage/WebPage.h:
681         * WebProcess/WebPage/WebPage.messages.in:
682
683 2019-09-13  Youenn Fablet  <youenn@apple.com>
684
685         Partition processes running service workers by session ID
686         https://bugs.webkit.org/show_bug.cgi?id=201643
687
688         Reviewed by Chris Dumez.
689
690         Remove the management of server context connections from NetworkProcess.
691         The WebProcessPool service worker process map is now keyed by both registrable domain and sessionID.
692         Update WebProcessPool to only expose the number of service worker processes instead of the full map.
693
694         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
695         (WebKit::NetworkConnectionToWebProcess::didClose):
696         (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection):
697         * NetworkProcess/NetworkConnectionToWebProcess.h:
698         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
699         * NetworkProcess/NetworkProcess.cpp:
700         (WebKit::NetworkProcess::swServerForSession):
701         * NetworkProcess/NetworkProcess.h:
702         (WebKit::NetworkProcess::swServerForSessionIfExists):
703         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
704         (WebKit::WebSWServerConnection::startFetch):
705         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
706         (WebKit::WebSWServerConnection::scheduleJobInServer):
707         (WebKit::WebSWServerConnection::updateThrottleState):
708         (WebKit::WebSWServerConnection::contextConnectionCreated):
709         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
710         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
711         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
712         (WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection):
713         (WebKit::WebSWServerToContextConnection::connectionIsNoLongerNeeded):
714         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
715         * UIProcess/API/Cocoa/WKProcessPool.mm:
716         (-[WKProcessPool _webPageContentProcessCount]):
717         (-[WKProcessPool _serviceWorkerProcessCount]):
718         * UIProcess/WebProcessPool.cpp:
719         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
720         (WebKit::WebProcessPool::disconnectProcess):
721         * UIProcess/WebProcessPool.h:
722         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
723         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
724         (WebKit::m_userAgent):
725         * WebProcess/Storage/WebSWContextManagerConnection.h:
726         * WebProcess/WebProcess.cpp:
727         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
728
729 2019-09-13  Alex Christensen  <achristensen@webkit.org>
730
731         AuxiliaryProcessProxy::sendWithAsyncReply should queue up messages if sent while the process is starting like it does messages without replies
732         https://bugs.webkit.org/show_bug.cgi?id=201746
733
734         Reviewed by Youenn Fablet.
735
736         * UIProcess/AuxiliaryProcessProxy.cpp:
737         (WebKit::AuxiliaryProcessProxy::sendMessage):
738         (WebKit::AuxiliaryProcessProxy::didFinishLaunching):
739         * UIProcess/AuxiliaryProcessProxy.h:
740         (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply):
741
742 2019-09-13  Youenn Fablet  <youenn@apple.com>
743
744         Use WebProcess processIdentifier to identify Service Worker connections
745         https://bugs.webkit.org/show_bug.cgi?id=201459
746
747         Reviewed by Chris Dumez.
748
749         Make WebSWServerConnection be stored in NetworkConnectionToWebProcess.
750         They are now keyed by session IDs hence why WebSWClientConnection is using the session ID as message connection ID.
751         Creation no longer requires a sync IPC since the connection is uniquely identified by its session ID and its process ID.
752         These IDs are stable over network process crash.
753         Within NetworkProcess, a server connection is managed by a SWServer which is session ID specific.
754         In that case, the process identifier uniquely identifies the connection.
755
756         Move WebSWServerToContextConnection be owned by NetworkConnectionToWebProcess.
757         Instead of creating it when webprocess is connecting to network process, use a dedicated IPC message.
758         This is similar to WebSWServerConnection once WebProcess asks to create it.
759         This will allow existing WebProcess, in cache or running pages, to run service workers as well.
760         A context connection map is kept in Network Process to reuse context connections since these connections are not sessionID specific.
761
762         Migrate from a single boolean to a HashSet to track whether some connections are in the process of being created.
763         Previously if two requests to create connections were done shortly one after the other on different registrable
764         domains, the second request would not be processed.
765
766         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
767         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
768         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
769         (WebKit::NetworkConnectionToWebProcess::didClose):
770         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
771         (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection):
772         * NetworkProcess/NetworkConnectionToWebProcess.h:
773         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
774         * NetworkProcess/NetworkProcess.cpp:
775         (WebKit::NetworkProcess::didReceiveMessage):
776         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
777         (WebKit::NetworkProcess::forEachSWServer):
778         (WebKit::NetworkProcess::needsServerToContextConnectionForRegistrableDomain const):
779         (WebKit::NetworkProcess::createServerToContextConnection):
780         (WebKit::NetworkProcess::postMessageToServiceWorkerClient):
781         (WebKit::NetworkProcess::registerSWServerConnection):
782         (WebKit::NetworkProcess::unregisterSWServerConnection):
783         (WebKit::NetworkProcess::registerSWContextConnection):
784         (WebKit::NetworkProcess::unregisterSWContextConnection):
785         * NetworkProcess/NetworkProcess.h:
786         * NetworkProcess/NetworkProcess.messages.in:
787         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
788         (WebKit::WebSWServerConnection::WebSWServerConnection):
789         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
790         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
791         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
792         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
793         (WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection):
794         (WebKit::WebSWServerToContextConnection::postMessageToServiceWorkerClient):
795         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
796         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
797         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
798         * UIProcess/Network/NetworkProcessProxy.cpp:
799         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
800         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
801         * UIProcess/Network/NetworkProcessProxy.h:
802         * UIProcess/Network/NetworkProcessProxy.messages.in:
803         * UIProcess/WebProcessPool.cpp:
804         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
805         * UIProcess/WebProcessPool.h:
806         * UIProcess/WebProcessProxy.cpp:
807         (WebKit::WebProcessProxy::establishServiceWorkerContext):
808         * UIProcess/WebProcessProxy.h:
809         * WebProcess/Network/NetworkProcessConnection.cpp:
810         (WebKit::NetworkProcessConnection::didReceiveMessage):
811         (WebKit::NetworkProcessConnection::didClose):
812         (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession):
813         * WebProcess/Network/NetworkProcessConnection.h:
814         * WebProcess/Storage/WebSWClientConnection.cpp:
815         (WebKit::WebSWClientConnection::WebSWClientConnection):
816         (WebKit::WebSWClientConnection::~WebSWClientConnection):
817         (WebKit::WebSWClientConnection::messageSenderConnection const):
818         (WebKit::WebSWClientConnection::scheduleJobInServer):
819         (WebKit::WebSWClientConnection::finishFetchingScriptInServer):
820         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
821         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
822         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
823         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
824         (WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
825         (WebKit::WebSWClientConnection::didResolveRegistrationPromise):
826         (WebKit::WebSWClientConnection::matchRegistration):
827         (WebKit::WebSWClientConnection::runOrDelayTaskForImport):
828         (WebKit::WebSWClientConnection::whenRegistrationReady):
829         (WebKit::WebSWClientConnection::getRegistrations):
830         (WebKit::WebSWClientConnection::startFetch):
831         (WebKit::WebSWClientConnection::cancelFetch):
832         (WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
833         (WebKit::WebSWClientConnection::connectionToServerLost):
834         (WebKit::WebSWClientConnection::clear):
835         (WebKit::WebSWClientConnection::syncTerminateWorker):
836         (WebKit::WebSWClientConnection::updateThrottleState):
837         (WebKit::WebSWClientConnection::storeRegistrationsOnDiskForTesting):
838         * WebProcess/Storage/WebSWClientConnection.h:
839         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
840         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
841         (WebKit::m_userAgent):
842         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
843         * WebProcess/Storage/WebSWContextManagerConnection.h:
844         * WebProcess/WebProcess.cpp:
845         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
846         * WebProcess/WebProcess.h:
847         * WebProcess/WebProcess.messages.in:
848
849 2019-09-12  Ryan Haddad  <ryanhaddad@apple.com>
850
851         Unreviewed, rolling out r249801.
852
853         Caused two servier worker layout tests to become flaky.
854
855         Reverted changeset:
856
857         "Use WebProcess processIdentifier to identify Service Worker
858         connections"
859         https://bugs.webkit.org/show_bug.cgi?id=201459
860         https://trac.webkit.org/changeset/249801
861
862 2019-09-12  Chris Dumez  <cdumez@apple.com>
863
864         Pass sessionID to WebProcess with other WebProcessDataStoreParameters
865         https://bugs.webkit.org/show_bug.cgi?id=201730
866
867         Reviewed by Alex Christensen.
868
869         Pass sessionID to WebProcess with other WebProcessDataStoreParameters and store
870         it on the WebProcess object. In follow-up patches, I will use this sessionID
871         more and leverage the fact that we have one sessionID per Webprocess to simplify
872         the WebKit2-layer code.
873
874         * Shared/WebProcessCreationParameters.cpp:
875         (WebKit::WebProcessCreationParameters::encode const):
876         (WebKit::WebProcessCreationParameters::decode):
877         * Shared/WebProcessCreationParameters.h:
878         * Shared/WebProcessDataStoreParameters.h:
879         (WebKit::WebProcessDataStoreParameters::encode const):
880         (WebKit::WebProcessDataStoreParameters::decode):
881         * UIProcess/WebProcessPool.cpp:
882         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
883         (WebKit::WebProcessPool::webProcessDataStoreParameters):
884         (WebKit::WebProcessPool::initializeNewWebProcess):
885         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters): Deleted.
886         * UIProcess/WebProcessPool.h:
887         * UIProcess/WebProcessProxy.cpp:
888         (WebKit::WebProcessProxy::setWebsiteDataStore):
889         * WebProcess/WebProcess.cpp:
890         (WebKit::WebProcess::initializeWebProcess):
891         (WebKit::WebProcess::setWebsiteDataStoreParameters):
892         * WebProcess/WebProcess.h:
893         (WebKit::WebProcess::sessionID const):
894
895 2019-09-12  Chris Dumez  <cdumez@apple.com>
896
897         [WKTR] Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED()
898         https://bugs.webkit.org/show_bug.cgi?id=201546
899
900         Reviewed by Alex Christensen.
901
902         Drop TestRunner.setPrivateBrowsingEnabled_DEPRECATED() from WebKitTestRunner as it does not do
903         the right thing for WebKit2 and tests have been rewritten to not use it.
904
905         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
906         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession): Deleted.
907         * NetworkProcess/NetworkConnectionToWebProcess.h:
908         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
909         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
910         (WKBundleSetPrivateBrowsingEnabled): Deleted.
911         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
912         * WebProcess/InjectedBundle/InjectedBundle.cpp:
913         (WebKit::InjectedBundle::setPrivateBrowsingEnabled): Deleted.
914         * WebProcess/InjectedBundle/InjectedBundle.h:
915         * WebProcess/WebProcess.cpp:
916         (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess): Deleted.
917         * WebProcess/WebProcess.h:
918         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
919         (WebKit::StorageNamespaceImpl::setSessionIDForTesting):
920
921 2019-09-12  Adrian Perez de Castro  <aperez@igalia.com>
922
923         [GTK][WPE] webkit_settings_set_user_agent() allows content forbidden in HTTP headers
924         https://bugs.webkit.org/show_bug.cgi?id=201077
925
926         Reviewed by Carlos Garcia Campos.
927
928         * UIProcess/API/glib/WebKitSettings.cpp:
929         (webkit_settings_set_user_agent): Check the passed string using the new
930         WebCore::isValidUserAgentHeaderValue() function, and return early without
931         changing the setting if the string is not usable in the User-Agent HTTP
932         header.
933
934 2019-09-12  Mark Lam  <mark.lam@apple.com>
935
936         Harden JSC against the abuse of runtime options.
937         https://bugs.webkit.org/show_bug.cgi?id=201597
938         <rdar://problem/55167068>
939
940         Reviewed by Filip Pizlo.
941
942         Linux parts contributed by Carlos Garcia Campos <cgarcia@igalia.com>.
943
944         1. Add plumbing to allow WK2 tests to configureJSCForTesting().
945         2. Removed the call enable Options::useBigInt in WebInspectorUI.
946            WebInspectorUI doesn't really need it for now.
947
948         * PluginProcess/unix/PluginProcessMainUnix.cpp:
949         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
950         (WebKit::XPCServiceInitializer):
951         * Shared/unix/AuxiliaryProcessMain.cpp:
952         (WebKit::AuxiliaryProcessMainBase::parseCommandLine):
953         * Shared/unix/AuxiliaryProcessMain.h:
954         (WebKit::AuxiliaryProcessMain):
955         * UIProcess/API/APIProcessPoolConfiguration.cpp:
956         (API::ProcessPoolConfiguration::copy):
957         * UIProcess/API/APIProcessPoolConfiguration.h:
958         * UIProcess/API/C/WKContextConfigurationRef.cpp:
959         (WKContextConfigurationSetShouldConfigureJSCForTesting):
960         * UIProcess/API/C/WKContextConfigurationRef.h:
961         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
962         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
963         (-[_WKProcessPoolConfiguration configureJSCForTesting]):
964         (-[_WKProcessPoolConfiguration setConfigureJSCForTesting:]):
965         * UIProcess/Launcher/ProcessLauncher.h:
966         (WebKit::ProcessLauncher::Client::shouldConfigureJSCForTesting const):
967         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
968         (WebKit::ProcessLauncher::launchProcess):
969         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
970         (WebKit::ProcessLauncher::launchProcess):
971         * UIProcess/WebProcessProxy.cpp:
972         (WebKit::WebProcessProxy::shouldConfigureJSCForTesting const):
973         * UIProcess/WebProcessProxy.h:
974         * WebProcess/WebPage/WebInspectorUI.cpp:
975         (WebKit::WebInspectorUI::WebInspectorUI):
976
977 2019-09-12  Michael Catanzaro  <mcatanzaro@igalia.com>
978
979         Fix accidental copies in NetworkLoadChecker.cpp
980         https://bugs.webkit.org/show_bug.cgi?id=199528
981
982         Reviewed by Youenn Fablet.
983
984         Coverity noticed that we are copying a ResourceRequest and a ContentExtensionResultOrError
985         in NetworkLoadChecker::checkRequest by mistake, when the intent was to move them as rvalue
986         references.
987
988         * NetworkProcess/NetworkLoadChecker.cpp:
989         (WebKit::NetworkLoadChecker::checkRequest):
990         * NetworkProcess/NetworkLoadChecker.h:
991
992 2019-09-12  Joseph Pecoraro  <pecoraro@apple.com>
993
994         Web Inspector: Crashes when intercept response continues with original content
995         https://bugs.webkit.org/show_bug.cgi?id=201707
996         <rdar://problem/55261857>
997
998         Reviewed by David Kilzer.
999
1000         * WebProcess/Network/WebResourceLoader.cpp:
1001         (WebKit::WebResourceLoader::didReceiveData):
1002         Copy the data for the callback since the deferral may run it much later.
1003
1004 2019-09-12  Youenn Fablet  <youenn@apple.com>
1005
1006         Use typed identifiers for IDB connection identifiers
1007         https://bugs.webkit.org/show_bug.cgi?id=201682
1008
1009         Reviewed by Chris Dumez.
1010
1011         Remove no longer needed conversion from process identifier to idb connection identifier.
1012
1013         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
1014         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1015         (WebKit::WebIDBConnectionToServer::identifier const):
1016         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1017
1018 2019-09-12  Charlie Turner  <cturner@igalia.com>
1019
1020         [GTK] Allow CacheStore::destroyEngine to destroy default engine for soup.
1021         https://bugs.webkit.org/show_bug.cgi?id=201690
1022
1023         Reviewed by Carlos Garcia Campos.
1024
1025         * NetworkProcess/cache/CacheStorageEngine.cpp:
1026         (WebKit::CacheStorage::Engine::destroyEngine): As we do for
1027         NetworkProcess::destroySession, also allow destroying the engine
1028         for the default session for the same reason.
1029
1030 2019-09-12  Youenn Fablet  <youenn@apple.com>
1031
1032         Use WebProcess processIdentifier to identify Service Worker connections
1033         https://bugs.webkit.org/show_bug.cgi?id=201459
1034
1035         Reviewed by Chris Dumez.
1036
1037         Make WebSWServerConnection be stored in NetworkConnectionToWebProcess.
1038         They are now keyed by session IDs hence why WebSWClientConnection is using the session ID as message connection ID.
1039         Creation no longer requires a sync IPC since the connection is uniquely identified by its session ID and its process ID.
1040         These IDs are stable over network process crash.
1041         Within NetworkProcess, a server connection is managed by a SWServer which is session ID specific.
1042         In that case, the process identifier uniquely identifies the connection.
1043
1044         Move WebSWServerToContextConnection be owned by NetworkConnectionToWebProcess.
1045         Instead of creating it when webprocess is connecting to network process, use a dedicated IPC message.
1046         This is similar to WebSWServerConnection once WebProcess asks to create it.
1047         This will allow existing WebProcess, in cache or running pages, to run service workers as well.
1048         A context connection map is kept in Network Process to reuse context connections since these connections are not sessionID specific.
1049
1050         Migrate from a single boolean to a HashSet to track whether some connections are in the process of being created.
1051         Previously if two requests to create connections were done shortly one after the other on different registrable
1052         domains, the second request would not be processed.
1053
1054         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1055         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1056         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
1057         (WebKit::NetworkConnectionToWebProcess::didClose):
1058         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
1059         (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection):
1060         * NetworkProcess/NetworkConnectionToWebProcess.h:
1061         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1062         * NetworkProcess/NetworkProcess.cpp:
1063         (WebKit::NetworkProcess::didReceiveMessage):
1064         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
1065         (WebKit::NetworkProcess::forEachSWServer):
1066         (WebKit::NetworkProcess::needsServerToContextConnectionForRegistrableDomain const):
1067         (WebKit::NetworkProcess::createServerToContextConnection):
1068         (WebKit::NetworkProcess::postMessageToServiceWorkerClient):
1069         (WebKit::NetworkProcess::registerSWServerConnection):
1070         (WebKit::NetworkProcess::unregisterSWServerConnection):
1071         (WebKit::NetworkProcess::registerSWContextConnection):
1072         (WebKit::NetworkProcess::unregisterSWContextConnection):
1073         * NetworkProcess/NetworkProcess.h:
1074         * NetworkProcess/NetworkProcess.messages.in:
1075         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1076         (WebKit::WebSWServerConnection::WebSWServerConnection):
1077         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
1078         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1079         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1080         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
1081         (WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection):
1082         (WebKit::WebSWServerToContextConnection::postMessageToServiceWorkerClient):
1083         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
1084         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1085         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
1086         * UIProcess/Network/NetworkProcessProxy.cpp:
1087         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
1088         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
1089         * UIProcess/Network/NetworkProcessProxy.h:
1090         * UIProcess/Network/NetworkProcessProxy.messages.in:
1091         * UIProcess/WebProcessPool.cpp:
1092         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1093         * UIProcess/WebProcessPool.h:
1094         * UIProcess/WebProcessProxy.cpp:
1095         (WebKit::WebProcessProxy::establishServiceWorkerContext):
1096         * UIProcess/WebProcessProxy.h:
1097         * WebProcess/Network/NetworkProcessConnection.cpp:
1098         (WebKit::NetworkProcessConnection::didReceiveMessage):
1099         (WebKit::NetworkProcessConnection::didClose):
1100         (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession):
1101         * WebProcess/Network/NetworkProcessConnection.h:
1102         * WebProcess/Storage/WebSWClientConnection.cpp:
1103         (WebKit::WebSWClientConnection::WebSWClientConnection):
1104         (WebKit::WebSWClientConnection::~WebSWClientConnection):
1105         (WebKit::WebSWClientConnection::messageSenderConnection const):
1106         (WebKit::WebSWClientConnection::scheduleJobInServer):
1107         (WebKit::WebSWClientConnection::finishFetchingScriptInServer):
1108         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
1109         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
1110         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
1111         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1112         (WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
1113         (WebKit::WebSWClientConnection::didResolveRegistrationPromise):
1114         (WebKit::WebSWClientConnection::matchRegistration):
1115         (WebKit::WebSWClientConnection::runOrDelayTaskForImport):
1116         (WebKit::WebSWClientConnection::whenRegistrationReady):
1117         (WebKit::WebSWClientConnection::getRegistrations):
1118         (WebKit::WebSWClientConnection::startFetch):
1119         (WebKit::WebSWClientConnection::cancelFetch):
1120         (WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
1121         (WebKit::WebSWClientConnection::connectionToServerLost):
1122         (WebKit::WebSWClientConnection::clear):
1123         (WebKit::WebSWClientConnection::syncTerminateWorker):
1124         (WebKit::WebSWClientConnection::updateThrottleState):
1125         (WebKit::WebSWClientConnection::storeRegistrationsOnDiskForTesting):
1126         * WebProcess/Storage/WebSWClientConnection.h:
1127         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1128         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
1129         (WebKit::m_userAgent):
1130         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
1131         * WebProcess/Storage/WebSWContextManagerConnection.h:
1132         * WebProcess/WebProcess.cpp:
1133         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
1134         * WebProcess/WebProcess.h:
1135         * WebProcess/WebProcess.messages.in:
1136
1137 2019-09-11  Keith Rollin  <krollin@apple.com>
1138
1139         Log timeoutValue passed on to CFNetwork
1140         https://bugs.webkit.org/show_bug.cgi?id=201701
1141         <rdar://problem/55279683>
1142
1143         Reviewed by Chris Dumez.
1144
1145         We occasionally see cases where resource-loads into CFNetwork take a
1146         long time. Rather than timing out after the default of 60s, they stay
1147         pending for many minutes. To better understand why this is happening,
1148         log the timeoutValue we pass to CFNetwork when loading resources.
1149
1150         * NetworkProcess/NetworkResourceLoader.cpp:
1151         (WebKit::NetworkResourceLoader::startNetworkLoad):
1152
1153 2019-09-11  Youenn Fablet  <youenn@apple.com>
1154
1155         Protect UserMediaRequest when stopping it
1156         https://bugs.webkit.org/show_bug.cgi?id=201687
1157         <rdar://problem/55241215>
1158
1159         Reviewed by Eric Carlson.
1160
1161         By removing the request from the map, we may destroy the request.
1162         To make sure it stays alive, take the request from the map.
1163
1164         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1165         (WebKit::UserMediaPermissionRequestManager::cancelUserMediaRequest):
1166
1167 2019-09-11  Ryan Haddad  <ryanhaddad@apple.com>
1168
1169         Unreviewed, rolling out r249768.
1170
1171         Caused 4 API tests to assert, perf test failures, and layout
1172         test crashes under ASan
1173
1174         Reverted changeset:
1175
1176         "Remove unnecessary abstractions around WebsiteDataStore"
1177         https://bugs.webkit.org/show_bug.cgi?id=201655
1178         https://trac.webkit.org/changeset/249768
1179
1180 2019-09-11  Simon Fraser  <simon.fraser@apple.com>
1181
1182         REGRESSION (iOS 13): Top fixed element on apple.com flickers in size while pinching in
1183         https://bugs.webkit.org/show_bug.cgi?id=201668
1184         rdar://problem/51934041
1185
1186         Reviewed by Frédéric Wang.
1187
1188         The UI process can have transient state that pushes scrolling-tree-managed layers into custom
1189         locations while pinch-zooming. We have to apply this state both when the visible rects
1190         in the UI process change (existing code in -[WKContentView didUpdateVisibleRect:...]) and when
1191         we get new layers from the web process (added in RemoteLayerTreeDrawingAreaProxy::commitLayerTree()
1192         in this patch).
1193
1194         Move some code into WebPageProxy to create functions that we can call from both places.
1195
1196         For manual testing, visit a page with fixed banners, pinch in slightly, then pinch out and,
1197         while keeping your fingers down, move the contents around.
1198
1199         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1200         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1201         * UIProcess/WebPageProxy.h:
1202         * UIProcess/ios/WKContentView.mm:
1203         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1204         * UIProcess/ios/WebPageProxyIOS.mm:
1205         (WebKit::WebPageProxy::unconstrainedLayoutViewportRect const):
1206         (WebKit::WebPageProxy::adjustLayersForLayoutViewport):
1207
1208 2019-09-11  Antti Koivisto  <antti@apple.com>
1209
1210         REGRESSION (245006): can't scroll in "read more" view in Eventbrite app
1211         https://bugs.webkit.org/show_bug.cgi?id=201683
1212         <rdar://problem/54582602>
1213
1214         Reviewed by Simon Fraser.
1215
1216         Content <body> has 'overflow:hidden'.
1217
1218         * UIProcess/Cocoa/VersionChecks.h:
1219         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1220         (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const):
1221
1222         Fix by adding an app specific LinkedOnOrAfter quirk that always allows main frame scrolling.
1223
1224 2019-09-11  Alex Christensen  <achristensen@webkit.org>
1225
1226         Remove unnecessary abstractions around WebsiteDataStore
1227         https://bugs.webkit.org/show_bug.cgi?id=201655
1228
1229         Reviewed by Chris Dumez.
1230
1231         This patch does four things to simplify WebsiteDataStore code:
1232         1. It removes API::WebsiteDataStore, which was just an unnecessary wrapper around WebKit::WebsiteDataStore.
1233         2. It deprecates the unused aliases of WebsiteDataStore, WKApplicationCacheManagerRef and WKKeyValueStorageManagerRef
1234         3. It removes the unused APIProcessPoolConfiguration properties that have been moved to WebsiteDataStore.
1235         4. It makes WKWebsiteDataStore._delegate weak instead of strong, as already annotated in WKWebsiteDataStorePrivate.h
1236         There should be no change in behavior from this patch.
1237
1238         * PlatformFTW.cmake:
1239         * PlatformWin.cmake:
1240         * Sources.txt:
1241         * SourcesCocoa.txt:
1242         * SourcesGTK.txt:
1243         * SourcesWPE.txt:
1244         * UIProcess/API/APIHTTPCookieStore.cpp:
1245         * UIProcess/API/APIHTTPCookieStore.h:
1246         * UIProcess/API/APIPageConfiguration.cpp:
1247         (API::PageConfiguration::websiteDataStore):
1248         (API::PageConfiguration::setWebsiteDataStore):
1249         * UIProcess/API/APIPageConfiguration.h:
1250         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1251         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
1252         (API::ProcessPoolConfiguration::copy):
1253         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration): Deleted.
1254         * UIProcess/API/APIProcessPoolConfiguration.h:
1255         * UIProcess/API/APIWebsiteDataStore.cpp: Removed.
1256         * UIProcess/API/APIWebsiteDataStore.h: Removed.
1257         * UIProcess/API/APIWebsitePolicies.cpp:
1258         (API::WebsitePolicies::data):
1259         * UIProcess/API/APIWebsitePolicies.h:
1260         * UIProcess/API/C/WKAPICast.h:
1261         * UIProcess/API/C/WKApplicationCacheManager.cpp:
1262         (WKApplicationCacheManagerGetTypeID):
1263         (WKApplicationCacheManagerGetApplicationCacheOrigins):
1264         (WKApplicationCacheManagerDeleteEntriesForOrigin):
1265         (WKApplicationCacheManagerDeleteAllEntries):
1266         * UIProcess/API/C/WKApplicationCacheManager.h:
1267         * UIProcess/API/C/WKFramePolicyListener.cpp:
1268         (useWithPolicies):
1269         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
1270         (WKKeyValueStorageManagerGetTypeID):
1271         (WKKeyValueStorageManagerGetOriginKey):
1272         (WKKeyValueStorageManagerGetCreationTimeKey):
1273         (WKKeyValueStorageManagerGetModificationTimeKey):
1274         (WKKeyValueStorageManagerGetKeyValueStorageOrigins):
1275         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
1276         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
1277         (WKKeyValueStorageManagerDeleteAllEntries):
1278         * UIProcess/API/C/WKKeyValueStorageManager.h:
1279         * UIProcess/API/C/WKResourceCacheManager.cpp:
1280         (WKResourceCacheManagerGetTypeID):
1281         (WKResourceCacheManagerGetCacheOrigins):
1282         (WKResourceCacheManagerClearCacheForOrigin):
1283         (WKResourceCacheManagerClearCacheForAllOrigins):
1284         (toWebsiteDataTypes): Deleted.
1285         * UIProcess/API/C/WKResourceCacheManager.h:
1286         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1287         (WKWebsiteDataStoreGetTypeID):
1288         (WKWebsiteDataStoreGetDefaultDataStore):
1289         (WKWebsiteDataStoreCreateNonPersistentDataStore):
1290         (WKWebsiteDataStoreCreateWithConfiguration):
1291         (WKWebsiteDataStoreGetHTTPCookieStore):
1292         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
1293         (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
1294         (WKWebsiteDataStoreSetStatisticsLastSeen):
1295         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
1296         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
1297         (WKWebsiteDataStoreDumpResourceLoadStatistics):
1298         (WKWebsiteDataStoreIsStatisticsPrevalentResource):
1299         (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
1300         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
1301         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder):
1302         (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo):
1303         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
1304         (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction):
1305         (WKWebsiteDataStoreSetStatisticsGrandfathered):
1306         (WKWebsiteDataStoreIsStatisticsGrandfathered):
1307         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
1308         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
1309         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo):
1310         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom):
1311         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo):
1312         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom):
1313         (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
1314         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
1315         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
1316         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
1317         (WKWebsiteDataStoreStatisticsSubmitTelemetry):
1318         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned):
1319         (WKWebsiteDataStoreSetStatisticsIsRunningTest):
1320         (WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval):
1321         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured):
1322         (WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval):
1323         (WKWebsiteDataStoreSetStatisticsGrandfatheringTime):
1324         (WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries):
1325         (WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo):
1326         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
1327         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
1328         (WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval):
1329         (WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
1330         (WKWebsiteDataStoreStatisticsHasLocalStorage):
1331         (WKWebsiteDataStoreSetStatisticsCacheMaxAgeCap):
1332         (WKWebsiteDataStoreStatisticsHasIsolatedSession):
1333         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1334         (WKWebsiteDataStoreRemoveAllFetchCaches):
1335         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
1336         (WKWebsiteDataStoreRemoveAllIndexedDatabases):
1337         (WKWebsiteDataStoreRemoveLocalStorage):
1338         (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations):
1339         (WKWebsiteDataStoreGetFetchCacheOrigins):
1340         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
1341         (WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
1342         (WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
1343         (WKWebsiteDataStoreSetPerOriginStorageQuota):
1344         (WKWebsiteDataStoreClearAllDeviceOrientationPermissions):
1345         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
1346         (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
1347         * UIProcess/API/C/WKWebsitePolicies.cpp:
1348         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: Removed.
1349         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1350         (+[WKWebsiteDataStore defaultDataStore]):
1351         (+[WKWebsiteDataStore nonPersistentDataStore]):
1352         (-[WKWebsiteDataStore dealloc]):
1353         (-[WKWebsiteDataStore httpCookieStore]):
1354         (-[WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:]):
1355         (-[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:]):
1356         (+[WKWebsiteDataStore _defaultDataStoreExists]):
1357         (+[WKWebsiteDataStore _deleteDefaultDataStoreForTesting]):
1358         (-[WKWebsiteDataStore _initWithConfiguration:]):
1359         (-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
1360         (-[WKWebsiteDataStore _resourceLoadStatisticsEnabled]):
1361         (-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]):
1362         (-[WKWebsiteDataStore _resourceLoadStatisticsDebugMode]):
1363         (-[WKWebsiteDataStore _setResourceLoadStatisticsDebugMode:]):
1364         (-[WKWebsiteDataStore _perOriginStorageQuota]):
1365         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
1366         (-[WKWebsiteDataStore _cacheStorageDirectory]):
1367         (-[WKWebsiteDataStore _setCacheStorageDirectory:]):
1368         (-[WKWebsiteDataStore _serviceWorkerRegistrationDirectory]):
1369         (-[WKWebsiteDataStore _setServiceWorkerRegistrationDirectory:]):
1370         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]):
1371         (-[WKWebsiteDataStore _boundInterfaceIdentifier]):
1372         (-[WKWebsiteDataStore _setAllowsCellularAccess:]):
1373         (-[WKWebsiteDataStore _allowsCellularAccess]):
1374         (-[WKWebsiteDataStore _setProxyConfiguration:]):
1375         (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
1376         (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
1377         (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
1378         (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
1379         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
1380         (-[WKWebsiteDataStore _allowsTLSFallback]):
1381         (-[WKWebsiteDataStore _proxyConfiguration]):
1382         (-[WKWebsiteDataStore _indexedDBDatabaseDirectory]):
1383         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:]):
1384         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
1385         (-[WKWebsiteDataStore _getAllStorageAccessEntriesFor:completionHandler:]):
1386         (-[WKWebsiteDataStore _scheduleCookieBlockingUpdate:]):
1387         (-[WKWebsiteDataStore _setPrevalentDomain:completionHandler:]):
1388         (-[WKWebsiteDataStore _getIsPrevalentDomain:completionHandler:]):
1389         (-[WKWebsiteDataStore _clearPrevalentDomain:completionHandler:]):
1390         (-[WKWebsiteDataStore _processStatisticsAndDataRecords:]):
1391         (-[WKWebsiteDataStore _hasRegisteredServiceWorker]):
1392         (-[WKWebsiteDataStore _delegate]):
1393         (-[WKWebsiteDataStore set_delegate:]):
1394         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
1395         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: Removed.
1396         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
1397         (API::WebsiteDataStore::defaultApplicationCacheDirectory): Deleted.
1398         (API::WebsiteDataStore::defaultCacheStorageDirectory): Deleted.
1399         (API::WebsiteDataStore::defaultNetworkCacheDirectory): Deleted.
1400         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory): Deleted.
1401         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): Deleted.
1402         (API::WebsiteDataStore::defaultLocalStorageDirectory): Deleted.
1403         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory): Deleted.
1404         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory): Deleted.
1405         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Deleted.
1406         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation): Deleted.
1407         (API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation): Deleted.
1408         * UIProcess/Automation/WebAutomationSession.cpp:
1409         (WebKit::WebAutomationSession::addSingleCookie):
1410         (WebKit::WebAutomationSession::deleteAllCookies):
1411         * UIProcess/Cocoa/NavigationState.mm:
1412         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1413         * UIProcess/Network/NetworkProcessProxy.cpp:
1414         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
1415         (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID):
1416         * UIProcess/Network/NetworkProcessProxy.h:
1417         * UIProcess/WebFramePolicyListenerProxy.cpp:
1418         * UIProcess/WebPageProxy.cpp:
1419         (WebKit::WebPageProxy::WebPageProxy):
1420         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1421         * UIProcess/WebProcessPool.cpp:
1422         (WebKit::m_webProcessCache):
1423         (WebKit::WebProcessPool::ensureNetworkProcess):
1424         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1425         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions):
1426         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1427         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
1428         (WebKit::WebProcessPool::processDidFinishLaunching):
1429         (WebKit::WebProcessPool::processForRegistrableDomain):
1430         (WebKit::WebProcessPool::createWebPage):
1431         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
1432         * UIProcess/WebProcessPool.h:
1433         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1434         (WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
1435         (WebKit::WebsiteDataStore::defaultCacheStorageDirectory):
1436         (WebKit::WebsiteDataStore::defaultNetworkCacheDirectory):
1437         (WebKit::WebsiteDataStore::defaultMediaCacheDirectory):
1438         (WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
1439         (WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
1440         (WebKit::WebsiteDataStore::defaultLocalStorageDirectory):
1441         (WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory):
1442         (WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
1443         (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
1444         (WebKit::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
1445         (WebKit::WebsiteDataStore::tempDirectoryFileSystemRepresentation):
1446         (WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
1447         (WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
1448         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1449         (WebKit::globalDefaultDataStore):
1450         (WebKit::WebsiteDataStore::defaultDataStore):
1451         (WebKit::WebsiteDataStore::deleteDefaultDataStoreForTesting):
1452         (WebKit::WebsiteDataStore::defaultDataStoreExists):
1453         (WebKit::WebsiteDataStore::defaultDataStoreConfiguration):
1454         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
1455         (WebKit::WebsiteDataStore::processPools const):
1456         (WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
1457         * UIProcess/WebsiteData/WebsiteDataStore.h:
1458         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1459         (WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
1460         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
1461         (WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
1462         (WebKit::WebsiteDataStore::defaultCacheStorageDirectory):
1463         (WebKit::WebsiteDataStore::defaultNetworkCacheDirectory):
1464         (WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
1465         (WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
1466         (WebKit::WebsiteDataStore::defaultLocalStorageDirectory):
1467         (WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory):
1468         (WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
1469         (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
1470         (WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
1471         (WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
1472         * UIProcess/glib/WebsiteDataStoreGLib.cpp: Copied from Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp.
1473         (API::WebsiteDataStore::defaultApplicationCacheDirectory): Deleted.
1474         (API::WebsiteDataStore::defaultNetworkCacheDirectory): Deleted.
1475         (API::WebsiteDataStore::defaultCacheStorageDirectory): Deleted.
1476         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory): Deleted.
1477         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): Deleted.
1478         (API::WebsiteDataStore::defaultLocalStorageDirectory): Deleted.
1479         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory): Deleted.
1480         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): Deleted.
1481         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory): Deleted.
1482         (API::WebsiteDataStore::defaultHSTSDirectory): Deleted.
1483         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Deleted.
1484         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation): Deleted.
1485         (API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation): Deleted.
1486         * WebKit.xcodeproj/project.pbxproj:
1487
1488 2019-09-11  Antoine Quint  <graouts@apple.com>
1489
1490         REGRESSION: Scrubbing on ted.com does not work well
1491         https://bugs.webkit.org/show_bug.cgi?id=201635
1492         <rdar://problem/51463649>
1493
1494         Reviewed by Dean Jackson.
1495
1496         This website uses custom media controls that simply don't work well on iOS when the User-Agent string is the desktop one, so we default to the mobile UA.
1497
1498         * UIProcess/ios/WebPageProxyIOS.mm:
1499         (WebKit::desktopClassBrowsingRecommendedForRequest):
1500
1501 2019-09-10  Tim Horton  <timothy_horton@apple.com>
1502
1503         REGRESSION (r233780): After swiping to navigate back, pinching to zoom in on webcontent snaps back to zoomed out when letting go
1504         https://bugs.webkit.org/show_bug.cgi?id=201671
1505         <rdar://problem/50488372>
1506
1507         Reviewed by Simon Fraser.
1508
1509         * WebProcess/WebPage/WebPage.cpp:
1510         (WebKit::WebPage::didCommitLoad):
1511         Reset m_lastTransactionIDWithScaleChange, since it is not guaranteed
1512         to only march forward. Otherwise, we can get stuck with a very large
1513         m_lastTransactionIDWithScaleChange, and will not allow stable-state
1514         user-driven zooms until the current transactionID exceeds it.
1515
1516 2019-09-10  Chris Dumez  <cdumez@apple.com>
1517
1518         Nullptr crash in Page::sessionID() via WebKit::WebFrameLoaderClient::detachedFromParent2()
1519         https://bugs.webkit.org/show_bug.cgi?id=201625
1520
1521         Reviewed by Ryosuke Niwa.
1522
1523         This is based on a patch from Ryosuke Niwa.
1524
1525         The crash was caused by WebFrameLoaderClient::sessionID() calling WebPage::sessionID() without
1526         checking the nullity of WebPage::m_page which can be null. Added a null check.
1527
1528         Because passing a wrong session to RemoveStorageAccessForFrame could result in a leak, this patch
1529         also replaces m_hasFrameSpecificStorageAccess boolean with an optioanl struct which stores
1530         session ID, frame ID, and page ID even after WebCore::Frame or WebCore::Page had been cleared
1531         or before WebFrameLoaderClient::m_frame is set.
1532
1533         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1534         (WebKit::WebFrameLoaderClient::sessionID const):
1535         (WebKit::WebFrameLoaderClient::setHasFrameSpecificStorageAccess):
1536         (WebKit::WebFrameLoaderClient::detachedFromParent2):
1537         (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
1538         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1539         * WebProcess/WebPage/WebFrame.h:
1540         (WebKit::WebFrame::frameLoaderClient const):
1541         * WebProcess/WebPage/WebPage.cpp:
1542         (WebKit::WebPage::requestStorageAccess):
1543
1544 2019-09-10  Brady Eidson  <beidson@apple.com>
1545
1546         Add SPI to save a PDF from the contents of a WKWebView.
1547         <rdar://problem/48955900> and https://bugs.webkit.org/show_bug.cgi?id=195765
1548
1549         Reviewed by Tim Horton.
1550
1551         This is refactoring a combination of "snapshotFirstPage" PDF printing code and the
1552         "takeSnapshot" API code to capture the on-screen visible page to a PDF at full fidelity.
1553
1554         * UIProcess/API/Cocoa/WKWebView.mm:
1555         (-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]):
1556         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1557
1558         * UIProcess/WebPageProxy.cpp:
1559         (WebKit::WebPageProxy::drawToPDF):
1560         (WebKit::WebPageProxy::drawToPDFCallback):
1561         * UIProcess/WebPageProxy.h:
1562         * UIProcess/WebPageProxy.messages.in:
1563
1564         * UIProcess/ios/WKContentView.mm:
1565         (-[WKContentView _wk_pageCountForPrintFormatter:]):
1566
1567         * UIProcess/ios/WebPageProxyIOS.mm:
1568         (WebKit::WebPageProxy::drawToPDFCallback): Move to cross platform WebPageProxy.
1569
1570         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1571         (WebKit::WebPage::pdfSnapshotAtSize):
1572
1573         * WebProcess/WebPage/WebPage.cpp:
1574         (WebKit::WebPage::pdfSnapshotAtSize): Instead of assuming 1 page capped at 200 inches,
1575           paginate every 200 inches.
1576         (WebKit::WebPage::drawToPDF):
1577         (WebKit::paintSnapshotAtSize): Deleted.
1578         (WebKit::WebPage::pdfSnapshotAtSize): Deleted.
1579         * WebProcess/WebPage/WebPage.h:
1580         * WebProcess/WebPage/WebPage.messages.in:
1581
1582 2019-09-10  Chris Dumez  <cdumez@apple.com>
1583
1584         Hangs on Swiss.com due to the web process being blocked on StorageAreaMap::LoadValuesIfNeeded
1585         https://bugs.webkit.org/show_bug.cgi?id=201644
1586         <rdar://problem/54942761>
1587
1588         Reviewed by Geoffrey Garen.
1589
1590         Mark the StorageManagerSet::GetValues sync IPC from the WebContent process to the Network
1591         process with a UnboundedSynchronousIPCScope so that it will process critical sync IPC
1592         from the UIProcess (such as WebPage::GetPositionInformation) while waiting for a reply.
1593
1594         * WebProcess/WebStorage/StorageAreaMap.cpp:
1595         (WebKit::StorageAreaMap::loadValuesIfNeeded):
1596
1597 2019-09-10  David Quesada  <david_quesada@apple.com>
1598
1599         Remove a leftover reference to the StorageProcess
1600         https://bugs.webkit.org/show_bug.cgi?id=192759
1601
1602         Reviewed by Alex Christensen.
1603
1604         * WebKit.xcodeproj/project.pbxproj:
1605             Remove com.apple.WebKit.Storage.sb as an input file to the "Copy iOS Sandbox Profiles
1606             for Manual Sandboxing" build phase. The file no longer exists.
1607
1608 2019-09-10  Adrian Perez de Castro  <aperez@igalia.com>
1609
1610         [GTK][WPE] Fixes for non-unified builds after r249022
1611         https://bugs.webkit.org/show_bug.cgi?id=201610
1612
1613         Reviewed by Joseph Pecoraro.
1614
1615         * NetworkProcess/NetworkCORSPreflightChecker.h: Add missing inclusion of the WebPageProxyIdentifier.h header.
1616         * NetworkProcess/NetworkLoadChecker.h: Add missing inclusion of the WebPageProxyIdentifier.h header.
1617
1618 2019-09-10  Youenn Fablet  <youenn@apple.com>
1619
1620         UserMediaProcessManager is revoking sandbox extensions too aggressively
1621         https://bugs.webkit.org/show_bug.cgi?id=201638
1622
1623         Reviewed by Eric Carlson.
1624
1625         Sandbox revocation was sometimes happening when a page is being closed while another page from the same process is starting capture.
1626         In that case, revocation might happen while it should not.
1627         To prevent this, we do not revoke sandbox extensions if there are pending captures for a page of the process.
1628         Whenever a page does not have any pending capture, sandbox extensions may be revoked.
1629
1630         Covered by OnDeviceChangeCrash API test in debug mode.
1631
1632         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1633         (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
1634         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1635         (WebKit::UserMediaPermissionRequestManagerProxy::hasPendingCapture const):
1636         * UIProcess/UserMediaProcessManager.cpp:
1637         (WebKit::UserMediaProcessManager::revokeSandboxExtensionsIfNeeded):
1638
1639 2019-09-09  Chris Dumez  <cdumez@apple.com>
1640
1641         [iOS] We sometimes attempt to use a terminated prewarmed WebContent process
1642         https://bugs.webkit.org/show_bug.cgi?id=201614
1643         <rdar://problem/54714507>
1644
1645         Reviewed by Geoffrey Garen.
1646
1647         On iOS, it is possible for our processes to get terminated (e.g. jetsammed) while the UIProcess
1648         is suspended. Upon resuming, it takes a little while for the UIProcess to get the notification
1649         that the mac connection to its child process has been severed and the UIProcess may try to use
1650         it for a load. This is especially problematic for prewarmed process because the client will end
1651         up showing a crash banner and reloading when we could have used a new process rather the prewarmed
1652         one if we had known it was dead.
1653
1654         This patch makes 2 improvements:
1655         1. It makes AuxiliaryProcessProxy::state() return Terminated if we still have a connection but
1656            the PID is not the PID of a running process. I also added a check in tryTakePrewarmedProcess()
1657            to not use the prewarmed process if it state() is Terminated.
1658         2. When the UIProcess is about to get suspended, have the process pools terminate their non-critical
1659            processes (i.e. prewarmed + the ones used for PageCache). This makes WebKit friendlier with
1660            other apps on the system when suspended with regards to memory. Also, it makes it less likely
1661            useful WebContent processes will get jetsammed.
1662
1663         * UIProcess/AuxiliaryProcessProxy.cpp:
1664         (WebKit::AuxiliaryProcessProxy::state const):
1665         (WebKit::AuxiliaryProcessProxy::isRunningProcessPID):
1666         * UIProcess/AuxiliaryProcessProxy.h:
1667         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1668         (WebKit::WebProcessPool::applicationIsAboutToSuspend):
1669         * UIProcess/WebProcessPool.cpp:
1670         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1671         * UIProcess/WebProcessPool.h:
1672         * UIProcess/ios/ProcessAssertionIOS.mm:
1673         (-[WKProcessAssertionBackgroundTaskManager init]):
1674         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
1675
1676 2019-09-09  Chris Dumez  <cdumez@apple.com>
1677
1678         REGRESSION: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html is frequently timing out on iOS EWS bots
1679         https://bugs.webkit.org/show_bug.cgi?id=201550
1680
1681         Reviewed by Alex Christensen.
1682
1683         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1684         (WKBundleResourceLoadStatisticsNotifyObserver):
1685         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
1686
1687 2019-09-09  Alex Christensen  <achristensen@webkit.org>
1688
1689         Disable TLS 1.0 and 1.1 in WebSockets
1690         https://bugs.webkit.org/show_bug.cgi?id=201573
1691
1692         Reviewed by Youenn Fablet.
1693
1694         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1695         (WebKit::NetworkProcessCreationParameters::encode const):
1696         (WebKit::NetworkProcessCreationParameters::decode):
1697         * NetworkProcess/NetworkProcessCreationParameters.h:
1698         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1699         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1700         * UIProcess/API/Cocoa/WKProcessPool.mm:
1701         (-[WKProcessPool _allowAnyTLSCertificateForWebSocketTesting]):
1702         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1703         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1704         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1705
1706 2019-09-09  Tim Horton  <timothy_horton@apple.com>
1707
1708         Clarify some macCatalyst feature flags
1709         https://bugs.webkit.org/show_bug.cgi?id=201619
1710         <rdar://problem/54615618>
1711
1712         Reviewed by Megan Gardner.
1713
1714         * UIProcess/ios/WKContentViewInteraction.h:
1715         * UIProcess/ios/WKContentViewInteraction.mm:
1716         (-[WKContentView setupInteraction]):
1717         (-[WKContentView cleanupInteraction]):
1718         (-[WKContentView _removeDefaultGestureRecognizers]):
1719         (-[WKContentView _addDefaultGestureRecognizers]):
1720         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1721         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
1722         We prefer specific flags over platform checks.
1723
1724 2019-09-09  Chris Dumez  <cdumez@apple.com>
1725
1726         Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/adClickAttribution/conversion-disabled-in-ephemeral-session.html
1727         https://bugs.webkit.org/show_bug.cgi?id=201596
1728
1729         Reviewed by Alex Christensen.
1730
1731         Allow WKFramePolicyListenerUseWithPolicies() C API to switch to a persistent non-default session.
1732         This is important since WebKitTestRunner is not using the default session anymore and I need to
1733         be able to switch it back to its normal session after going to an ephemeral one.
1734
1735         * UIProcess/API/C/WKFramePolicyListener.cpp:
1736         (useWithPolicies):
1737
1738 2019-09-09  Alex Christensen  <achristensen@webkit.org>
1739
1740         Deprecate unused SPI to preconnect to a server
1741         https://bugs.webkit.org/show_bug.cgi?id=201558
1742
1743         Reviewed by Youenn Fablet.
1744
1745         * NetworkProcess/NetworkProcess.cpp:
1746         (WebKit::NetworkProcess::preconnectTo): Deleted.
1747         * NetworkProcess/NetworkProcess.h:
1748         * NetworkProcess/NetworkProcess.messages.in:
1749         * UIProcess/API/C/WKContext.cpp:
1750         (WKContextPreconnectToServer):
1751         * UIProcess/API/C/WKContextPrivate.h:
1752         * UIProcess/API/Cocoa/WKProcessPool.mm:
1753         (-[WKProcessPool _preconnectToServer:]):
1754         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1755         * UIProcess/WebProcessPool.cpp:
1756         (WebKit::WebProcessPool::preconnectToServer): Deleted.
1757         * UIProcess/WebProcessPool.h:
1758
1759 2019-09-09  Per Arne Vollan  <pvollan@apple.com>
1760
1761         Unreviewed Windows build fix.
1762
1763         * WebProcess/WebPage/WebPage.h:
1764
1765 2019-09-09  Per Arne Vollan  <pvollan@apple.com>
1766
1767         [macOS] Pid is sometimes invalid when creating sandbox extensions by pid.
1768         https://bugs.webkit.org/show_bug.cgi?id=201543
1769         <rdar://problem/54733465>
1770
1771         Reviewed by Brent Fulgham.
1772
1773         There is a race condition when starting a load of a local file, where the WebContent process has not finished
1774         launching yet, and its pid is not available. When we try to create a sandbox extension by using the pid of the
1775         WebContent process, it is not available in the cases where the WebContent process has just launched and has not
1776         finished launching yet. This patch creates a new dummy Web page message, 'LoadRequestWaitingForPID', which will
1777         be sent instead of a normal 'LoadRequest' message, and only when the WebContent process has not finished
1778         launching. When the WebContent process has finished launching, and we are about to actually send the pending
1779         messages, we can detect that a 'LoadRequestWaitingForPID' has been appended for sending, and replace it with a
1780         normal 'LoadReqest' message where we have created the sandbox extension issue with a valid pid. The message
1781         'LoadRequestWaitingForPID' is never intended to reach the WebContent process, it is just there to replace with
1782         a normal 'LoadRequest' message with a new sandbox extension. In the implementation of the message handler on
1783         the WebContent process side, we assert that the method is never called. This patch makes sure the ordering of
1784         the Web page messages are the same, even when we modify the message.
1785
1786         * UIProcess/AuxiliaryProcessProxy.cpp:
1787         (WebKit::AuxiliaryProcessProxy::didFinishLaunching):
1788         * UIProcess/WebPageProxy.cpp:
1789         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
1790         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
1791         (WebKit::WebPageProxy::loadFile):
1792         * WebProcess/WebPage/WebPage.cpp:
1793         (WebKit::WebPage::fileLoadRequest):
1794         * WebProcess/WebPage/WebPage.h:
1795         * WebProcess/WebPage/WebPage.messages.in:
1796
1797 2019-09-09  Youenn Fablet  <youenn@apple.com>
1798
1799         Remove ServiceWorkerProcessProxy
1800         https://bugs.webkit.org/show_bug.cgi?id=201506
1801
1802         Reviewed by Chris Dumez.
1803
1804         Instead of using a specific ServiceWorkerProcessProxy, move the logic directly in WebProcessProxy.
1805         This will allow us in the future to run a service worker in a process that already runs a web page,
1806         thus saving the need to spin off a new process.
1807
1808         This patch adds a new WebProcessProxy::createForServiceWorkers method instead of creating a
1809         ServiceWorkerProcessProxy. The behavior is then similar: a process running a service worker cannot run a page.
1810
1811         * Sources.txt:
1812         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1813         (-[WKWebsiteDataStore _hasRegisteredServiceWorker]):
1814         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
1815         (WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive const):
1816         * UIProcess/Network/NetworkProcessProxy.cpp:
1817         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
1818         * UIProcess/ServiceWorkerProcessProxy.cpp: Removed.
1819         * UIProcess/ServiceWorkerProcessProxy.h: Removed.
1820         * UIProcess/WebProcessPool.cpp:
1821         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1822         (WebKit::WebProcessPool::disconnectProcess):
1823         (WebKit::WebProcessPool::processForRegistrableDomain):
1824         (WebKit::WebProcessPool::createWebPage):
1825         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
1826         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
1827         (WebKit::WebProcessPool::updateProcessAssertions):
1828         (WebKit::WebProcessPool::isServiceWorkerPageID const):
1829         * UIProcess/WebProcessPool.h:
1830         * UIProcess/WebProcessProxy.cpp:
1831         (WebKit::WebProcessProxy::createForServiceWorkers):
1832         (WebKit::WebProcessProxy::getLaunchOptions):
1833         (WebKit::WebProcessProxy::didBecomeUnresponsive):
1834         (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
1835         (WebKit::WebProcessProxy::didSetAssertionState):
1836         (WebKit::WebProcessProxy::didExceedCPULimit):
1837         (WebKit::WebProcessProxy::establishServiceWorkerContext):
1838         (WebKit::WebProcessProxy::setServiceWorkerUserAgent):
1839         (WebKit::WebProcessProxy::updateServiceWorkerPreferencesStore):
1840         * UIProcess/WebProcessProxy.h:
1841         (WebKit::WebProcessProxy::isRunningServiceWorkers const):
1842         (WebKit::WebProcessProxy::hasServiceWorkerPageProxy):
1843         * UIProcess/glib/WebProcessPoolGLib.cpp:
1844         (WebKit::WebProcessPool::platformInitializeWebProcess):
1845         * WebKit.xcodeproj/project.pbxproj:
1846
1847 2019-09-09  Youenn Fablet  <youenn@apple.com>
1848
1849         Use WebProcess processIdentifier to identify IDB connections between WebProcess and NetworkProcess
1850         https://bugs.webkit.org/show_bug.cgi?id=201419
1851
1852         Reviewed by Alex Christensen.
1853
1854         We change from an identifier generated by NetworkProcess to WebProcess identifier.
1855         A WebProcess identifier is unique globally and is stable even in case of NetworkProcess crash.
1856         This removes the need for a sync IPC and makes things more easy to handle in case of NetworkProcess crash.
1857
1858         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1859         (WebKit::WebIDBConnectionToClient::create):
1860         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
1861         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
1862         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
1863         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
1864         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1865         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1866         * NetworkProcess/NetworkConnectionToWebProcess.h:
1867         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1868         * WebKit.xcodeproj/project.pbxproj:
1869         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1870         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
1871         (WebKit::WebIDBConnectionToServer::identifier const):
1872         (WebKit::WebIDBConnectionToServer::coreConnectionToServer):
1873         (WebKit::WebIDBConnectionToServer::getAllDatabaseNames):
1874         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1875         * WebProcess/Network/NetworkProcessConnection.cpp:
1876         (WebKit::NetworkProcessConnection::didReceiveMessage):
1877         (WebKit::NetworkProcessConnection::didClose):
1878         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
1879         * WebProcess/Network/NetworkProcessConnection.h:
1880         (WebKit::NetworkProcessConnection::existingIDBConnectionToServer const):
1881         * WebProcess/WebProcess.cpp:
1882         (WebKit::WebProcess::networkProcessConnectionClosed):
1883
1884 2019-09-09  Youenn Fablet  <youenn@apple.com>
1885
1886         Move checkProcessLocalPortForActivity from provider to registry
1887         https://bugs.webkit.org/show_bug.cgi?id=201400
1888
1889         Reviewed by Alex Christensen.
1890
1891         Implement registry callback at NetworkProcess level.
1892         Remove NetworkMessagePortChannelProvider since only a registry is now needed.
1893
1894         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1895         * NetworkProcess/NetworkMessagePortChannelProvider.cpp: Removed.
1896         * NetworkProcess/NetworkMessagePortChannelProvider.h: Removed.
1897         * NetworkProcess/NetworkProcess.cpp:
1898         (WebKit::createMessagePortChannelRegistry):
1899         (WebKit::m_messagePortChannelRegistry):
1900         (WebKit::m_messagePortChannelProvider): Deleted.
1901         * NetworkProcess/NetworkProcess.h:
1902         (WebKit::NetworkProcess::messagePortChannelRegistry):
1903         * Sources.txt:
1904         * WebKit.xcodeproj/project.pbxproj:
1905         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
1906         (WebKit::WebMessagePortChannelProvider::checkProcessLocalPortForActivity): Deleted.
1907         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h:
1908
1909 2019-09-08  David Quesada  <david_quesada@apple.com>
1910
1911         Remove some unused constants in VersionChecks.h
1912         https://bugs.webkit.org/show_bug.cgi?id=201599
1913
1914         Reviewed by Youenn Fablet.
1915
1916         * UIProcess/Cocoa/VersionChecks.h:
1917             Remove two macros that are unused as of r244512.
1918
1919 2019-09-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1920
1921         [macCatalyst] The last typed character in password fields shouldn't be echoed
1922         https://bugs.webkit.org/show_bug.cgi?id=201595
1923         <rdar://problem/55166367>
1924
1925         Reviewed by Tim Horton.
1926
1927         Disable password echoing on macCatalyst, to better match behavior on macOS.
1928
1929         * Shared/WebPreferencesDefaultValues.h:
1930
1931 2019-09-07  Chris Dumez  <cdumez@apple.com>
1932
1933         Rewrite http/tests/workers/service/serviceworker-private-browsing.https.html as an API test
1934         https://bugs.webkit.org/show_bug.cgi?id=201574
1935
1936         Reviewed by Alex Christensen.
1937
1938         Update Service Workers so that they obey the "secureContextChecksEnabled" preference.
1939         This was needed to allow my service worker to access self.caches in my API test.
1940
1941         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1942         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
1943
1944 2019-09-07  Tim Horton  <timothy_horton@apple.com>
1945
1946         Marking up a note on iOS results in a PDF with no contents
1947         https://bugs.webkit.org/show_bug.cgi?id=201530
1948         <rdar://problem/53686019>
1949
1950         Unreviewed follow-up.
1951
1952         * UIProcess/ios/WKContentView.mm:
1953         (-[WKContentView _waitForDrawToPDFCallback]):
1954         Remove an ASSERT_NOT_REACHED that fires if the synchronous wait for printing
1955         times out. This is a totally legitimite situation that can occur if the process
1956         crashes; there's no need for an assert there.
1957
1958 2019-09-07  Alex Christensen  <achristensen@webkit.org>
1959
1960         Null check m_client in NetworkDataTask::didReceiveResponse
1961         https://bugs.webkit.org/show_bug.cgi?id=201587
1962         <rdar://problem/54743444>
1963
1964         Reviewed by Chris Dumez.
1965
1966         clearClient can be called at any time.  We null check it everyhere else we use it,
1967         and we are seeing crashes at this call site.  Let's not crash.
1968
1969         * NetworkProcess/NetworkDataTask.cpp:
1970         (WebKit::NetworkDataTask::didReceiveResponse):
1971
1972 2019-09-07  Alex Christensen  <achristensen@webkit.org>
1973
1974         Remove WebsiteDataStore::legacyDefaultDataStoreConfiguration
1975         https://bugs.webkit.org/show_bug.cgi?id=200054
1976
1977         Reviewed by Carlos Garcia Campos.
1978
1979         Its last needed use was removed in rdar://problem/47030981
1980         This changes WKContextConfigurationCreateWithLegacyOptions to be equal to WKContextConfigurationCreate,
1981         but it has no remaining clients so it is only being retained for binary compabibility.
1982         This also changes WKContextCreateWithInjectedBundlePath and WKContextCreate to be equal to WKContextCreateWithConfiguration,
1983         and after rdar://problem/47030981 there are no meaningful clients of those functions, also.
1984         There is one existing client of WKContextCreateWithInjectedBundlePath in rdar://problem/50323967 but our current implementation
1985         is compatible enough for them because it uses their injected bundle still.
1986
1987         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1988         (API::ProcessPoolConfiguration::copy):
1989         (API::ProcessPoolConfiguration::createWithLegacyOptions): Deleted.
1990         * UIProcess/API/APIProcessPoolConfiguration.h:
1991         * UIProcess/API/APIWebsiteDataStore.cpp:
1992         (API::WebsiteDataStore::createLegacy): Deleted.
1993         (API::WebsiteDataStore::legacyDefaultDataStoreConfiguration): Deleted.
1994         * UIProcess/API/APIWebsiteDataStore.h:
1995         * UIProcess/API/C/WKContext.cpp:
1996         (WKContextCreate):
1997         (WKContextCreateWithInjectedBundlePath):
1998         (WKContextGetWebsiteDataStore):
1999         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2000         (WKContextConfigurationCreate):
2001         (WKContextConfigurationCreateWithLegacyOptions):
2002         * UIProcess/API/C/WKContextConfigurationRef.h:
2003         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2004         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory): Deleted.
2005         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory): Deleted.
2006         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory): Deleted.
2007         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory): Deleted.
2008         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory): Deleted.
2009         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory): Deleted.
2010         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory): Deleted.
2011         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory): Deleted.
2012         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory): Deleted.
2013         * UIProcess/API/Cocoa/WKProcessGroup.mm:
2014         (-[WKProcessGroup initWithInjectedBundleURL:]):
2015         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
2016         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory): Deleted.
2017         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory): Deleted.
2018         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory): Deleted.
2019         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory): Deleted.
2020         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory): Deleted.
2021         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory): Deleted.
2022         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory): Deleted.
2023         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory): Deleted.
2024         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory): Deleted.
2025         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
2026         (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory): Deleted.
2027         (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory): Deleted.
2028         (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory): Deleted.
2029         (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory): Deleted.
2030         (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory): Deleted.
2031         (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory): Deleted.
2032         (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory): Deleted.
2033         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory): Deleted.
2034         (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory): Deleted.
2035         * UIProcess/WebInspectorUtilities.cpp:
2036         (WebKit::inspectorProcessPool):
2037         * UIProcess/WebProcessPool.cpp:
2038         (WebKit::m_webProcessCache):
2039         (WebKit::legacyWebsiteDataStoreConfiguration): Deleted.
2040         * UIProcess/WebProcessPool.h:
2041
2042 2019-09-07  Alex Christensen  <achristensen@webkit.org>
2043
2044         Fix Windows build
2045         https://bugs.webkit.org/show_bug.cgi?id=201517
2046
2047         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
2048
2049 2019-09-07  Alex Christensen  <achristensen@webkit.org>
2050
2051         Remove calls to WKContextGetWebsiteDataStore missed in r249614
2052         https://bugs.webkit.org/show_bug.cgi?id=200050
2053
2054         It turns out I didn't need to introduce another way of clearing all cookies between tests.
2055         I just needed to make the call to WKHTTPCookieStoreDeleteAllCookies use the right WebsiteDataStore.
2056
2057         * NetworkProcess/NetworkProcess.cpp:
2058         (WebKit::NetworkProcess::clearCachedCredentials):
2059         * NetworkProcess/NetworkSession.h:
2060         (WebKit::NetworkSession::clearCredentials):
2061         (WebKit::NetworkSession::clearCookies): Deleted.
2062         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2063         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2064         (WebKit::NetworkSessionCocoa::clearCookies): Deleted.
2065
2066 2019-09-07  Alex Christensen  <achristensen@webkit.org>
2067
2068         Fix Windows build.
2069         https://bugs.webkit.org/show_bug.cgi?id=200050
2070
2071         * PlatformWin.cmake:
2072
2073 2019-09-07  Alex Christensen  <achristensen@webkit.org>
2074
2075         Fix Windows build.
2076         https://bugs.webkit.org/show_bug.cgi?id=201517
2077
2078         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
2079
2080 2019-09-07  Alex Christensen  <achristensen@webkit.org>
2081
2082         Deprecate WKContextGetWebsiteDataStore
2083         https://bugs.webkit.org/show_bug.cgi?id=200050
2084
2085         Reviewed by Geoff Garen.
2086
2087         The last use of it was removed in rdar://problem/47030981
2088         In order to remove its use in WebKitTestRunner, I needed to make WKWebsiteDataStoreConfigurationRef
2089         to replace the WKContextConfigurationRef members that should've been associated with the WebsiteDataStore the whole time.
2090         There is one use of WKContextGetWebsiteDataStore in TestWebKitAPI still I'll investigate later.
2091
2092         * Shared/API/c/WKBase.h:
2093         * Sources.txt:
2094         * UIProcess/API/APIWebsiteDataStore.cpp:
2095         (API::WebsiteDataStore::create):
2096         * UIProcess/API/APIWebsiteDataStore.h:
2097         * UIProcess/API/C/WKAPICast.h:
2098         * UIProcess/API/C/WKContext.cpp:
2099         (WKContextGetApplicationCacheManager):
2100         (WKContextGetKeyValueStorageManager):
2101         (WKContextGetResourceCacheManager):
2102         * UIProcess/API/C/WKContext.h:
2103         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2104         (WKContextConfigurationCopyDiskCacheDirectory):
2105         (WKContextConfigurationSetDiskCacheDirectory):
2106         (WKContextConfigurationCopyApplicationCacheDirectory):
2107         (WKContextConfigurationSetApplicationCacheDirectory):
2108         (WKContextConfigurationCopyIndexedDBDatabaseDirectory):
2109         (WKContextConfigurationSetIndexedDBDatabaseDirectory):
2110         (WKContextConfigurationCopyLocalStorageDirectory):
2111         (WKContextConfigurationSetLocalStorageDirectory):
2112         (WKContextConfigurationCopyWebSQLDatabaseDirectory):
2113         (WKContextConfigurationSetWebSQLDatabaseDirectory):
2114         (WKContextConfigurationCopyMediaKeysStorageDirectory):
2115         (WKContextConfigurationSetMediaKeysStorageDirectory):
2116         (WKContextConfigurationCopyResourceLoadStatisticsDirectory):
2117         (WKContextConfigurationSetResourceLoadStatisticsDirectory):
2118         * UIProcess/API/C/WKContextConfigurationRef.h:
2119         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp: Added.
2120         (WKWebsiteDataStoreConfigurationGetTypeID):
2121         (WKWebsiteDataStoreConfigurationCreate):
2122         (WKWebsiteDataStoreConfigurationCopyApplicationCacheDirectory):
2123         (WKWebsiteDataStoreConfigurationSetApplicationCacheDirectory):
2124         (WKWebsiteDataStoreConfigurationCopyNetworkCacheDirectory):
2125         (WKWebsiteDataStoreConfigurationSetNetworkCacheDirectory):
2126         (WKWebsiteDataStoreConfigurationCopyIndexedDBDatabaseDirectory):
2127         (WKWebsiteDataStoreConfigurationSetIndexedDBDatabaseDirectory):
2128         (WKWebsiteDataStoreConfigurationCopyLocalStorageDirectory):
2129         (WKWebsiteDataStoreConfigurationSetLocalStorageDirectory):
2130         (WKWebsiteDataStoreConfigurationCopyWebSQLDatabaseDirectory):
2131         (WKWebsiteDataStoreConfigurationSetWebSQLDatabaseDirectory):
2132         (WKWebsiteDataStoreConfigurationCopyMediaKeysStorageDirectory):
2133         (WKWebsiteDataStoreConfigurationSetMediaKeysStorageDirectory):
2134         (WKWebsiteDataStoreConfigurationCopyResourceLoadStatisticsDirectory):
2135         (WKWebsiteDataStoreConfigurationSetResourceLoadStatisticsDirectory):
2136         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h: Added.
2137         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2138         (WKWebsiteDataStoreCreateWithConfiguration):
2139         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2140         * WebKit.xcodeproj/project.pbxproj:
2141
2142 2019-09-06  Mark Lam  <mark.lam@apple.com>
2143
2144         Harden protection of the Gigacage Config parameters.
2145         https://bugs.webkit.org/show_bug.cgi?id=201570
2146         <rdar://problem/55134229>
2147
2148         Reviewed by Saam Barati.
2149
2150         Just renaming a function name here.
2151
2152         * WebProcess/WebProcess.cpp:
2153
2154 2019-09-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2155
2156         Incorrect selection rect revealed after pasting images in a contenteditable element
2157         https://bugs.webkit.org/show_bug.cgi?id=201549
2158         <rdar://problem/50956429>
2159
2160         Reviewed by Simon Fraser.
2161
2162         Tweak some existing logic to use the new visibleImageElementsInRangeWithNonLoadedImages helper function. See
2163         WebCore for more details.
2164
2165         * WebProcess/WebPage/ios/WebPageIOS.mm:
2166         (WebKit::WebPage::didConcludeEditDrag):
2167
2168 2019-09-06  Chris Dumez  <cdumez@apple.com>
2169
2170         Move the ResourceLoadObserver logic to WebKit2
2171         https://bugs.webkit.org/show_bug.cgi?id=201517
2172
2173         Reviewed by Brent Fulgham.
2174
2175         Move the ResourceLoadObserver logic to WebKit2 since it is not used by WebKit1. This allows us to simplify
2176         code.
2177
2178         In a follow-up patch, I will simplify the code even further by leveraging the fact that a WebContent process
2179         is always associated with a single WebsiteDataStore / sessionID:
2180         - No need for a HashMap of sessionIDs
2181         - No need to even allocate the ResourceLoadObserver if the WebProcess is associated with an ephemeral session.
2182
2183         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2184         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
2185         * NetworkProcess/NetworkConnectionToWebProcess.h:
2186         * Sources.txt:
2187         * WebKit.xcodeproj/project.pbxproj:
2188         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: Copied from Source/WebCore/loader/ResourceLoadObserver.cpp.
2189         (WebKit::is3xxRedirect):
2190         (WebKit::WebResourceLoadObserver::WebResourceLoadObserver):
2191         (WebKit::WebResourceLoadObserver::shouldLog const):
2192         (WebKit::WebResourceLoadObserver::requestStorageAccessUnderOpener):
2193         (WebKit::WebResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
2194         (WebKit::WebResourceLoadObserver::scheduleNotificationIfNeeded):
2195         (WebKit::WebResourceLoadObserver::updateCentralStatisticsStore):
2196         (WebKit::WebResourceLoadObserver::statisticsForURL):
2197         (WebKit::WebResourceLoadObserver::takeStatistics):
2198         (WebKit::WebResourceLoadObserver::clearState):
2199         (WebKit::WebResourceLoadObserver::nonNullOwnerURL const):
2200         (WebKit::WebResourceLoadObserver::logFontLoad):
2201         (WebKit::WebResourceLoadObserver::logCanvasRead):
2202         (WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure):
2203         (WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed):
2204         (WebKit::WebResourceLoadObserver::logScreenAPIAccessed):
2205         (WebKit::WebResourceLoadObserver::logSubresourceLoading):
2206         (WebKit::WebResourceLoadObserver::logWebSocketLoading):
2207         (WebKit::WebResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2208         * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: Added.
2209         * WebProcess/WebProcess.cpp:
2210
2211 2019-09-06  Jiewen Tan  <jiewen_tan@apple.com>
2212
2213         [WebAuthn] Make WebAuthn default off and let clients turn it on at will
2214         https://bugs.webkit.org/show_bug.cgi?id=201439
2215         <rdar://problem/54998154>
2216
2217         Reviewed by Youenn Fablet.
2218
2219         This patch makes WebAuthn default off such that clients that have the right entitlements
2220         could turn it on and we don't risk at turning on a Web API that does nothing by default.
2221
2222         This patch doesn't add any SPI to turn the feature on as it is currently doable via
2223         - [WKPreferencesPrivate _setEnabled:forExperimentalFeature:].
2224
2225         * Shared/WebPreferences.yaml:
2226         * Shared/WebPreferencesDefaultValues.cpp:
2227         (WebKit::defaultWebAuthenticationEnabled): Deleted.
2228         * Shared/WebPreferencesDefaultValues.h:
2229
2230 2019-09-06  Alex Christensen  <achristensen@webkit.org>
2231
2232         Deprecate all WKCookieManagerRef functions
2233         https://bugs.webkit.org/show_bug.cgi?id=201473
2234
2235         Reviewed by Chris Dumez.
2236
2237         Their use was removed in rdar://problem/55039275
2238         Created replacement C API that more closely resembles the public ObjC API for WebKitTestRunner.
2239
2240         * Shared/API/c/WKBase.h:
2241         * Sources.txt:
2242         * UIProcess/API/APIHTTPCookieStore.cpp:
2243         (API::HTTPCookieStore::deleteAllCookies):
2244         (API::HTTPCookieStore::setHTTPCookieAcceptPolicy):
2245         (API::HTTPCookieStore::deleteCookiesInDefaultUIProcessCookieStore):
2246         (API::HTTPCookieStore::setHTTPCookieAcceptPolicyInDefaultUIProcessCookieStore):
2247         * UIProcess/API/APIHTTPCookieStore.h:
2248         * UIProcess/API/C/WKAPICast.h:
2249         * UIProcess/API/C/WKContext.cpp:
2250         (WKContextSetStorageAccessAPIEnabled):
2251         * UIProcess/API/C/WKContext.h:
2252         * UIProcess/API/C/WKCookieManager.cpp:
2253         (WKCookieManagerGetTypeID):
2254         (WKCookieManagerSetClient):
2255         (WKCookieManagerGetHostnamesWithCookies):
2256         (WKCookieManagerDeleteCookiesForHostname):
2257         (WKCookieManagerDeleteAllCookies):
2258         (WKCookieManagerDeleteAllCookiesModifiedAfterDate):
2259         (WKCookieManagerSetHTTPCookieAcceptPolicy):
2260         (WKCookieManagerGetHTTPCookieAcceptPolicy):
2261         (WKCookieManagerSetStorageAccessAPIEnabled):
2262         (WKCookieManagerStartObservingCookieChanges):
2263         (WKCookieManagerStopObservingCookieChanges):
2264         * UIProcess/API/C/WKCookieManager.h:
2265         * UIProcess/API/C/WKHTTPCookieStoreRef.cpp: Added.
2266         (WKHTTPCookieStoreGetTypeID):
2267         (WKHTTPCookieStoreDeleteAllCookies):
2268         (WKHTTPCookieStoreSetHTTPCookieAcceptPolicy):
2269         * UIProcess/API/C/WKHTTPCookieStoreRef.h: Added.
2270         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2271         (WKWebsiteDataStoreGetHTTPCookieStore):
2272         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2273         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm:
2274         (API::HTTPCookieStore::deleteCookiesInDefaultUIProcessCookieStore):
2275         (API::toNSHTTPCookieAcceptPolicy):
2276         (API::HTTPCookieStore::setHTTPCookieAcceptPolicyInDefaultUIProcessCookieStore):
2277         * UIProcess/WebCookieManagerProxy.cpp:
2278         (WebKit::WebCookieManagerProxy::setStorageAccessAPIEnabled): Deleted.
2279         * UIProcess/WebCookieManagerProxy.h:
2280         * WebKit.xcodeproj/project.pbxproj:
2281
2282 2019-09-06  Darryl Pogue  <darryl@dpogue.ca>
2283
2284         REGRESSION(iOS 12): Keyboard dismissal leaves WKWebView viewport-fit=cover content offscreen
2285         https://bugs.webkit.org/show_bug.cgi?id=192564
2286
2287         Reviewed by Tim Horton.
2288
2289         The new keyboard height was being read into a variable after the scrollview had already been
2290         adjusted. This worked when the keyboard was opening, because the scrollview is adjusted with
2291         the correct value a second time when the keyboard animation has finished. However, when the
2292         keyboard is closed, the adjustment was being made before the correct height was stored,
2293         leading to the scrollview being positioned as if the keyboard were still open.
2294
2295         * UIProcess/ios/WKScrollView.mm:
2296         (-[WKScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:]):
2297
2298 2019-09-06  Tim Horton  <timothy_horton@apple.com>
2299
2300         Marking up a note on iOS results in a PDF with no contents
2301         https://bugs.webkit.org/show_bug.cgi?id=201530
2302         <rdar://problem/53686019>
2303
2304         Reviewed by Andy Estes.
2305
2306         * Platform/IPC/Connection.cpp:
2307         (IPC::Connection::Connection):
2308         (IPC::Connection::waitForMessage):
2309         (IPC::Connection::connectionDidClose):
2310         * Platform/IPC/Connection.h:
2311         If the main thread is blocked when the Web Content process dies, and
2312         something eventually calls waitForAndDispatchImmediately without
2313         returning control to the main run loop, we will wait for the full timeout,
2314         because a) the code to mark the connection invalid is dispatched
2315         to the main thread, and b) the secondary thread that is informed of
2316         the Web Content process dying did not yet have a "waiting for" message
2317         to mark as interrupted (because it wasn't waiting yet).
2318
2319         Fix this race by adding a bit that is set under the waitForMessage lock
2320         on the secondary thread when the connection is invalidated, identically
2321         to m_shouldWaitForSyncReplies, which solves the same problem for sync
2322         messages.
2323
2324         Read the new bit when we are about to start waiting, and bail if it is set.
2325         It's OK to not read it inside the loop because we are guaranteed to have
2326         waitForMessage set at that point, so the normal interruption bit will work.
2327
2328         * UIProcess/ios/WKContentView.mm:
2329         (-[WKContentView _processDidExit]):
2330         Reset _isPrintingToPDF; the Web Content process is never going to get
2331         back to us if it crashes.
2332
2333         (-[WKContentView _wk_pageCountForPrintFormatter:]):
2334         Do not bail from starting a printing operation if one is already occurring.
2335         This fixes the original bug, because Markup ends up invalidating the page
2336         count at least one extra time before asking for the printed document.
2337         Instead of maintaining the fragile requirement that you cannot recompute
2338         the page count while printing, just let it happen. In order to make this
2339         work safely, synchronously wait for the previous printed result before
2340         continuing with the next print.
2341
2342         We could do more coalescing here if need be, but calls to -_recalcPageCount
2343         are not high in volume.
2344
2345 2019-09-06  Alex Christensen  <achristensen@webkit.org>
2346
2347         Fix unused argument warning from GCC.
2348
2349         * Platform/IPC/ArgumentCoders.h:
2350         (IPC::TupleDecoder<0>::decode):
2351         There was indeed an unused argument.
2352
2353 2019-09-06  Alex Christensen  <achristensen@webkit.org>
2354
2355         When disabling legacy private browsing for testing, change the SessionID back to what it was, not the defaultSessionID
2356         https://bugs.webkit.org/show_bug.cgi?id=201480
2357
2358         Reviewed by Youenn Fablet.
2359
2360         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2361         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
2362         * WebProcess/InjectedBundle/InjectedBundle.h:
2363
2364 2019-09-06  Patrick Griffis  <pgriffis@igalia.com>
2365
2366         [GTK][WPE] Do not enable the sandbox in Snap
2367         https://bugs.webkit.org/show_bug.cgi?id=201486
2368
2369         Reviewed by Carlos Garcia Campos.
2370
2371         Running inside of Snap adds its own complications and is simply
2372         not supported for now.
2373
2374         Also update isInsideFlatpak() for consistency.
2375
2376         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2377         (WebKit::isInsideFlatpak):
2378         (WebKit::isInsideSnap):
2379         (WebKit::ProcessLauncher::launchProcess):
2380
2381 2019-09-05  Joseph Pecoraro  <pecoraro@apple.com>
2382
2383         Web Inspector: Crashes when intercept response is a 404
2384         https://bugs.webkit.org/show_bug.cgi?id=201514
2385
2386         Reviewed by Alex Christensen.
2387
2388         * WebProcess/Network/WebResourceLoader.cpp:
2389         (WebKit::WebResourceLoader::didReceiveResponse):
2390         Ensure the WebResourceLoader stays around during intercepts.
2391
2392         (WebKit::WebResourceLoader::didReceiveData):
2393         (WebKit::WebResourceLoader::didFinishResourceLoad):
2394         (WebKit::WebResourceLoader::didFailResourceLoad):
2395         Only perform the work if the m_coreLoader is still alive.
2396
2397 2019-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2398
2399         [Win] Add support for MouseEvent.buttons
2400         https://bugs.webkit.org/show_bug.cgi?id=201445
2401
2402         Reviewed by Brent Fulgham.
2403
2404         * Shared/win/WebEventFactory.cpp:
2405         (WebKit::WebEventFactory::createWebMouseEvent):
2406         Set m_buttons.
2407
2408 2019-09-05  Chris Dumez  <cdumez@apple.com>
2409
2410         REGRESSION: http/tests/adClickAttribution/second-attribution-converted-with-higher-priority.html and http/tests/adClickAttribution/second-attribution-converted-with-lower-priority.html are flaky timeouts
2411         https://bugs.webkit.org/show_bug.cgi?id=201440
2412         <rdar://problem/54998427>
2413
2414         Reviewed by Alex Christensen.
2415
2416         Add private WKBundlePage API to query if the WebPage is currently suspended or not.
2417
2418         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2419         (WKBundlePageIsSuspended):
2420         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2421
2422 2019-09-05  Sihui Liu  <sihui_liu@apple.com>
2423
2424         Remove StorageArea pointers in StorageManagerSet when removing StorageManagers that own them
2425         https://bugs.webkit.org/show_bug.cgi?id=201324
2426
2427         Reviewed by Alex Christensen.
2428
2429         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
2430         (WebKit::LocalStorageNamespace::storageAreaIdentifiers const):
2431         * NetworkProcess/WebStorage/LocalStorageNamespace.h:
2432         * NetworkProcess/WebStorage/SessionStorageNamespace.cpp:
2433         (WebKit::SessionStorageNamespace::storageAreaIdentifiers const):
2434         * NetworkProcess/WebStorage/SessionStorageNamespace.h:
2435         * NetworkProcess/WebStorage/StorageManager.cpp:
2436         (WebKit::StorageManager::allStorageAreaIdentifiers const):
2437         * NetworkProcess/WebStorage/StorageManager.h:
2438         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
2439         (WebKit::StorageManagerSet::remove):
2440         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp:
2441         (WebKit::TransientLocalStorageNamespace::storageAreaIdentifiers const):
2442         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.h:
2443
2444 2019-09-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2445
2446         REGRESSION(r249275): [GTK][WPE] wrong page ID returned by webkit_web_view_get_page_id()
2447         https://bugs.webkit.org/show_bug.cgi?id=201504
2448
2449         Reviewed by Michael Catanzaro.
2450
2451         We want to return the page identifier not the web page proxy id.
2452
2453         * UIProcess/API/glib/WebKitWebView.cpp:
2454         (webkit_web_view_get_page_id):
2455
2456 2019-09-05  Pablo Saavedra  <psaavedra@igalia.com>
2457
2458         Build failure after r249501 for ports with SERVICE_WORKER set OFF
2459         https://bugs.webkit.org/show_bug.cgi?id=201503
2460
2461         Reviewed by Youenn Fablet.
2462
2463         * WebProcess/Network/WebLoaderStrategy.cpp:
2464         (WebKit::WebLoaderStrategy::scheduleLoad):
2465
2466 2019-09-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2467
2468         MobileSafari may crash when invoking the C++ lambda in -[WKContentView _shareForWebView:]
2469         https://bugs.webkit.org/show_bug.cgi?id=201479
2470         <rdar://problem/51511834>
2471
2472         Reviewed by Tim Horton.
2473
2474         Fix the crash by making -_shareForWebView: robust in the case where there are no selection rects
2475         known in the UI process when -[WKContentView _share:] is invoked.
2476
2477         * UIProcess/ios/WKContentViewInteraction.mm:
2478         (-[WKContentView _shareForWebView:]):
2479
2480 2019-09-04  Ryosuke Niwa  <rniwa@webkit.org>
2481
2482         Replace defaultCustomPasteboardDataEnabled by an equivalent macro
2483         https://bugs.webkit.org/show_bug.cgi?id=201477
2484
2485         Reviewed by Wenson Hsieh.
2486
2487         r227282 introduced defaultCustomPasteboardDataEnabled() to disable the custom pasteboard data on
2488         apps linked against old SDKs. However, this had a bug that the check inside WebContent process
2489         would always return true because WebContent process is always linked against the latest SDKs.
2490         Because WebPreferences values aren't propagated from UI process to WebContent process unless
2491         there is a value change, it meant that custom pasteboard data is always enabled.
2492
2493         This patch replaces this function with a simple macro which always enables the custom pasteboard
2494         data on iOS family and macOS as it has always been the case before and after r227282.
2495
2496         * Shared/WebPreferences.yaml:
2497         * Shared/WebPreferencesDefaultValues.cpp:
2498         (WebKit::defaultCustomPasteboardDataEnabled): Deleted.
2499         * Shared/WebPreferencesDefaultValues.h:
2500
2501 2019-09-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2502
2503         -[WKContentView selectedText] returns an empty string when selecting more than 200 characters
2504         https://bugs.webkit.org/show_bug.cgi?id=201471
2505         <rdar://problem/55039227>
2506
2507         Reviewed by Tim Horton.
2508
2509         The fix for <rdar://problem/54308019> is contingent on -[WKContentView selectedText] returning a non-empty
2510         result in the case where text is selected. However, in WebKit, if more than 200 characters are selected,
2511         -selectedText ends up returning nothing.
2512
2513         This is due to logic added in trac.webkit.org/r167624 that was intended to return the selected text in
2514         PostLayoutData's wordAtSelection, up to a maximum of 200 characters, likely for performance and/or security
2515         reasons. However, instead of truncating at 200 characters, the change simply drops wordAtSelection altogether.
2516         This patch fixes this issue by taking the first 200 characters of the selected text.
2517
2518         Test: EditorStateTests.SelectedText
2519
2520         * WebProcess/WebPage/ios/WebPageIOS.mm:
2521         (WebKit::WebPage::platformEditorState const):
2522
2523 2019-09-04  Joseph Pecoraro  <pecoraro@apple.com>
2524
2525         Web Inspector: Local Overrides - Provide substitution content for resource loads (URL based)
2526         https://bugs.webkit.org/show_bug.cgi?id=201262
2527         <rdar://problem/13108764>
2528
2529         Reviewed by Devin Rousso.
2530
2531         * Sources.txt:
2532         * WebKit.xcodeproj/project.pbxproj:
2533         New sources.
2534
2535         * WebProcess/Network/WebResourceLoader.h:
2536         * WebProcess/Network/WebResourceLoader.cpp:
2537         (WebKit::WebResourceLoader::didReceiveResponse):
2538         (WebKit::WebResourceLoader::didReceiveData):
2539         (WebKit::WebResourceLoader::didFinishResourceLoad):
2540         (WebKit::WebResourceLoader::didFailResourceLoad):
2541         On receiving a response, check with the inspector if an active
2542         frontend will override the response content.
2543
2544         * WebProcess/Network/WebResourceInterceptController.h:
2545         * WebProcess/Network/WebResourceInterceptController.cpp:
2546         (WebKit::WebResourceInterceptController::isIntercepting const):
2547         (WebKit::WebResourceInterceptController::beginInterceptingResponse):
2548         (WebKit::WebResourceInterceptController::continueResponse):
2549         (WebKit::WebResourceInterceptController::interceptedResponse):
2550         (WebKit::WebResourceInterceptController::defer):
2551         Buffer networking callbacks for an ongoing intercept.
2552
2553         * WebProcess/Network/WebLoaderStrategy.cpp:
2554         (WebKit::WebLoaderStrategy::havePerformedSecurityChecks const):
2555         Handle new response source.
2556
2557 2019-09-04  Chris Dumez  <cdumez@apple.com>
2558
2559         Unreviewed minor follow-up fix after r249501 to address crashes in debug.
2560
2561         * NetworkProcess/cache/NetworkCache.h:
2562         (WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::constructDeletedValue):
2563         (WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::isDeletedValue):
2564
2565 2019-09-04  Chris Dumez  <cdumez@apple.com>
2566
2567         Expose WebPageProxy identifier to the Network Process
2568         https://bugs.webkit.org/show_bug.cgi?id=201467
2569
2570         Reviewed by Geoffrey Garen.
2571
2572         Expose WebPageProxy identifier to the Network Process (similarly to WebPage / WebFrame identifiers)
2573         so that it can use it whenever it IPCs the UIProcess. The IPCs from the network process were the
2574         last one requiring the UIProcess to lookup a WebPageProxy object from a WebPageIdentifier (rather
2575         than a WebPageProxyIdentifier).
2576
2577         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2578         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2579         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2580         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2581         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
2582         * NetworkProcess/NetworkCORSPreflightChecker.h:
2583         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2584         (WebKit::NetworkConnectionToWebProcess::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2585         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
2586         * NetworkProcess/NetworkConnectionToWebProcess.h:
2587         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2588         * NetworkProcess/NetworkLoad.cpp:
2589         (WebKit::NetworkLoad::didReceiveChallenge):
2590         * NetworkProcess/NetworkLoadChecker.cpp:
2591         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2592         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2593         * NetworkProcess/NetworkLoadChecker.h:
2594         * NetworkProcess/NetworkLoadParameters.h:
2595         * NetworkProcess/NetworkProcess.cpp:
2596         (WebKit::NetworkProcess::didCommitCrossSiteLoadWithDataTransfer):
2597         (WebKit::NetworkProcess::logDiagnosticMessage):
2598         (WebKit::NetworkProcess::logDiagnosticMessageWithResult):
2599         (WebKit::NetworkProcess::logDiagnosticMessageWithValue):
2600         * NetworkProcess/NetworkProcess.h:
2601         * NetworkProcess/NetworkProcess.messages.in:
2602         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2603         (WebKit::NetworkResourceLoadParameters::encode const):
2604         (WebKit::NetworkResourceLoadParameters::decode):
2605         * NetworkProcess/NetworkResourceLoader.cpp:
2606         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
2607         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2608         (WebKit::NetworkResourceLoader::startNetworkLoad):
2609         (WebKit::NetworkResourceLoader::didReceiveResponse):
2610         * NetworkProcess/NetworkResourceLoader.h:
2611         * NetworkProcess/PingLoad.cpp:
2612         (WebKit::PingLoad::PingLoad):
2613         (WebKit::PingLoad::didReceiveChallenge):
2614         * NetworkProcess/cache/NetworkCache.h:
2615         (WebKit::NetworkCache::GlobalFrameID::hash const):
2616         (WebKit::NetworkCache::operator==):
2617         (WTF::GlobalFrameIDHash::hash):
2618         (WTF::GlobalFrameIDHash::equal):
2619         (WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::emptyValue):
2620         (WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::constructDeletedValue):
2621         (WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::isDeletedValue):
2622         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2623         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
2624         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2625         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
2626         * Shared/Authentication/AuthenticationManager.cpp:
2627         (WebKit::AuthenticationManager::shouldCoalesceChallenge const):
2628         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
2629         * Shared/Authentication/AuthenticationManager.h:
2630         * UIProcess/Network/NetworkProcessProxy.cpp:
2631         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
2632         (WebKit::NetworkProcessProxy::logDiagnosticMessage):
2633         (WebKit::NetworkProcessProxy::logDiagnosticMessageWithResult):
2634         (WebKit::NetworkProcessProxy::logDiagnosticMessageWithValue):
2635         (WebKit::NetworkProcessProxy::requestStorageAccessConfirm):
2636         (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransfer):
2637         (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
2638         (WebKit::NetworkProcessProxy::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2639         * UIProcess/Network/NetworkProcessProxy.h:
2640         * UIProcess/Network/NetworkProcessProxy.messages.in:
2641         * UIProcess/ServiceWorkerProcessProxy.cpp:
2642         (WebKit::ServiceWorkerProcessProxy::start):
2643         * UIProcess/ServiceWorkerProcessProxy.h:
2644         * UIProcess/WebPageProxy.cpp:
2645         (WebKit::WebPageProxy::didCommitLoadForFrame):
2646         * UIProcess/WebProcessPool.cpp:
2647         (WebKit::WebProcessPool::isServiceWorkerPageID const):
2648         (WebKit::WebProcessPool::didCommitCrossSiteLoadWithDataTransfer):
2649         * UIProcess/WebProcessPool.h:
2650         * UIProcess/WebProcessProxy.cpp:
2651         * UIProcess/WebProcessProxy.h:
2652         * WebProcess/Network/WebLoaderStrategy.cpp:
2653         (WebKit::WebLoaderStrategy::scheduleLoad):
2654         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2655         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2656         (WebKit::WebLoaderStrategy::preconnectTo):
2657         * WebProcess/Network/WebResourceLoader.h:
2658         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2659         (WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient):
2660         (WebKit::ServiceWorkerFrameLoaderClient::createDocumentLoader):
2661         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
2662         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2663         * WebProcess/Storage/WebSWContextManagerConnection.h:
2664         (isType):
2665         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2666         (WebKit::WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2667         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2668         (WebKit::WebFrameLoaderClient::webPageProxyID const):
2669         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2670         * WebProcess/WebPage/WebPage.cpp:
2671         (WebKit::WebPage::requestStorageAccess):
2672         * WebProcess/WebProcess.cpp:
2673         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
2674         * WebProcess/WebProcess.h:
2675         * WebProcess/WebProcess.messages.in:
2676
2677 2019-09-04  Tim Horton  <timothy_horton@apple.com>
2678
2679         macCatalyst: Re-enable iOS WKWebView printing API
2680         https://bugs.webkit.org/show_bug.cgi?id=201392
2681         <rdar://problem/54690252>
2682
2683         Reviewed by Wenson Hsieh.
2684
2685         * UIProcess/API/Cocoa/WKWebView.mm:
2686         (-[WKWebView _webViewPrintFormatter]):
2687         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2688         * UIProcess/_WKWebViewPrintFormatter.mm:
2689         * UIProcess/_WKWebViewPrintFormatterInternal.h:
2690         * UIProcess/ios/WKContentView.mm:
2691         _WKWwebViewPrintFormatter was disabled during bringup because requisite
2692         UIKit bits were missing, but they are not anymore (and have not been for
2693         quite some time), so remove these unnecessary platform ifdefs.
2694
2695 2019-09-04  Patrick Griffis  <pgriffis@igalia.com>
2696
2697         [WPE][GTK] Fix sandbox parsing DISPLAY on X11
2698         https://bugs.webkit.org/show_bug.cgi?id=201462
2699
2700         Reviewed by Michael Catanzaro.
2701
2702         On some setups the DISPLAY env var was incorrectly parsed.
2703
2704         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2705         (WebKit::bindX11):
2706
2707 2019-09-04  Brian Burg  <bburg@apple.com>
2708
2709         Selenium test 'interactions_tests.py::testContextClick' is hanging
2710         https://bugs.webkit.org/show_bug.cgi?id=201161
2711         <rdar://problem/54728541>
2712
2713         Reviewed by Chris Dumez.
2714
2715         A web page should not show native context menus if user interactions are being simulated for WebDriver.
2716         Showing a native context menu spawns a nested run loop. Since there's no way to interact
2717         with native UI via WebDriver, the test will hang until the context menu is manually dismissed.
2718
2719         To fix this, pretend to show the context menu in UIProcess and dismiss it immediately.
2720         This is necessary to trigger oncontextmenu events appropriately and resume handling mouse events.
2721
2722         * UIProcess/WebPageProxy.cpp:
2723         (WebKit::WebPageProxy::showContextMenu): Hook into isControlledByAutomation here.
2724         We could short circuit this on the WebProcess side, but the check would be more crude
2725         and suppress context menus even if user interaction isn't being simulated. This would be
2726         problematic for a user who wants to interrupt their test session and interact with it.
2727         The main use case for this is right clicking on the test page and choose "Inspect".
2728
2729 2019-09-04  Youenn Fablet  <youenn@apple.com>
2730
2731         Abstract out WebSocketChannel message queue
2732         https://bugs.webkit.org/show_bug.cgi?id=201359
2733
2734         Reviewed by Alex Christensen.
2735
2736         Make use of newly added NetworkSendQueue.
2737
2738         * WebProcess/Network/WebSocketChannel.cpp:
2739         (WebKit::WebSocketChannel::createMessageQueue):
2740         (WebKit::WebSocketChannel::WebSocketChannel):
2741         (WebKit::WebSocketChannel::send):
2742         (WebKit::WebSocketChannel::disconnect):
2743         * WebProcess/Network/WebSocketChannel.h:
2744
2745 2019-09-04  Youenn Fablet  <youenn@apple.com>
2746
2747         Move MessageRegistry to NetworkProcess
2748         https://bugs.webkit.org/show_bug.cgi?id=201299
2749
2750         Reviewed by Alex Christensen.
2751
2752         Move message registry to NetworkProcess.
2753         Take benefit of this move to use async reply IPC as much as possible.
2754         This also allows to remove the IPC message to UIProcess when doing postMessage with service workers.
2755
2756         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2757         (WebKit::NetworkConnectionToWebProcess::createNewMessagePortChannel):
2758         (WebKit::NetworkConnectionToWebProcess::entangleLocalPortInThisProcessToRemote):
2759         (WebKit::NetworkConnectionToWebProcess::messagePortDisentangled):
2760         (WebKit::NetworkConnectionToWebProcess::messagePortClosed):
2761         (WebKit::NetworkConnectionToWebProcess::nextMessageBatchIdentifier):
2762         (WebKit::NetworkConnectionToWebProcess::takeAllMessagesForPort):
2763         (WebKit::NetworkConnectionToWebProcess::didDeliverMessagePortMessages):
2764         (WebKit::NetworkConnectionToWebProcess::postMessageToRemote):
2765         (WebKit::NetworkConnectionToWebProcess::checkRemotePortForActivity):
2766         (WebKit::NetworkConnectionToWebProcess::checkProcessLocalPortForActivity):
2767         * NetworkProcess/NetworkConnectionToWebProcess.h:
2768         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2769         * NetworkProcess/NetworkMessagePortChannelProvider.cpp: Added.
2770         (WebKit::NetworkMessagePortChannelProvider::NetworkMessagePortChannelProvider):
2771         (WebKit::NetworkMessagePortChannelProvider::createNewMessagePortChannel):
2772         (WebKit::NetworkMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote):
2773         (WebKit::NetworkMessagePortChannelProvider::messagePortDisentangled):
2774         (WebKit::NetworkMessagePortChannelProvider::messagePortClosed):
2775         (WebKit::NetworkMessagePortChannelProvider::takeAllMessagesForPort):
2776         (WebKit::NetworkMessagePortChannelProvider::postMessageToRemote):
2777         (WebKit::NetworkMessagePortChannelProvider::checkRemotePortForActivity):
2778         (WebKit::NetworkMessagePortChannelProvider::checkProcessLocalPortForActivity):
2779         * NetworkProcess/NetworkMessagePortChannelProvider.h: Added.
2780         * NetworkProcess/NetworkProcess.cpp:
2781         (WebKit::m_messagePortChannelProvider):
2782         (WebKit::NetworkProcess::webProcessConnection const):
2783         * NetworkProcess/NetworkProcess.h:
2784         (WebKit::NetworkProcess::messagePortChannelRegistry):
2785         * Sources.txt:
2786         * UIProcess/Downloads/DownloadProxyMap.cpp:
2787         * UIProcess/WebPageProxy.cpp:
2788         * UIProcess/WebProcessPool.cpp:
2789         * UIProcess/WebProcessPool.h:
2790         * UIProcess/WebProcessPool.messages.in:
2791         * UIProcess/WebProcessProxy.cpp:
2792         (WebKit::WebProcessProxy::~WebProcessProxy):
2793         (WebKit::WebProcessProxy::shutDown):
2794         * UIProcess/WebProcessProxy.h:
2795         * UIProcess/WebProcessProxy.messages.in:
2796         * WebKit.xcodeproj/project.pbxproj:
2797         * WebProcess/Network/NetworkProcessConnection.cpp:
2798         (WebKit::NetworkProcessConnection::initializeSWClientConnection):
2799         (WebKit::NetworkProcessConnection::messagesAvailableForPort):
2800         (WebKit::NetworkProcessConnection::checkProcessLocalPortForActivity):
2801         * WebProcess/Network/NetworkProcessConnection.h:
2802         * WebProcess/Network/NetworkProcessConnection.messages.in:
2803         * WebProcess/Storage/WebSWClientConnection.cpp:
2804         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
2805         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2806         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
2807         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
2808         (WebKit::networkProcessConnection):
2809         (WebKit::WebMessagePortChannelProvider::createNewMessagePortChannel):
2810         (WebKit::WebMessagePortChannelProvider::entangleLocalPortInThisProcessToRemote):
2811         (WebKit::WebMessagePortChannelProvider::messagePortDisentangled):
2812         (WebKit::WebMessagePortChannelProvider::messagePortClosed):
2813         (WebKit::WebMessagePortChannelProvider::takeAllMessagesForPort):
2814         (WebKit::WebMessagePortChannelProvider::postMessageToRemote):
2815         (WebKit::WebMessagePortChannelProvider::checkRemotePortForActivity):
2816         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h:
2817         * WebProcess/WebProcess.cpp:
2818         * WebProcess/WebProcess.h:
2819         * WebProcess/WebProcess.messages.in:
2820
2821 2019-09-03  Per Arne Vollan  <pvollan@apple.com>
2822
2823         [macOS] Unable to open local file from favorites bar
2824         https://bugs.webkit.org/show_bug.cgi?id=201444
2825
2826         Reviewed by Brent Fulgham.
2827
2828         The sandbox extension handle should be created providing the pid of the receiving process.
2829
2830         * UIProcess/WebPageProxy.cpp:
2831         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2832
2833 2019-09-03  Chris Dumez  <cdumez@apple.com>
2834
2835         FrameLoader::FrameProgressTracker::progressCompleted() does not need a pageID
2836         https://bugs.webkit.org/show_bug.cgi?id=201431
2837
2838         Reviewed by Antti Koivisto.
2839
2840         * WebProcess/Network/WebLoaderStrategy.cpp:
2841         (WebKit::WebLoaderStrategy::pageLoadCompleted):
2842         * WebProcess/Network/WebLoaderStrategy.h:
2843
2844 2019-09-03  Tim Horton  <timothy_horton@apple.com>
2845
2846         Null deref under -[WKWebView _addUpdateVisibleContentRectPreCommitHandler]'s handler block
2847         https://bugs.webkit.org/show_bug.cgi?id=201436
2848         <rdar://problem/40640475>
2849
2850         Reviewed by Simon Fraser.
2851
2852         * UIProcess/API/Cocoa/WKWebView.mm:
2853         (-[WKWebView dealloc]):
2854         (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]):
2855         We crash sending a message to a deallocated WKWebView inside the handler block
2856         passed to +[CATransaction addCommitHandler:]. This seems impossible, because
2857         we carefully retain it, but it's possible that it could be the result of
2858         the handler block being installed under -dealloc (in which case retaining
2859         the WKWebView wouldn't actually extend its lifetime). -[WKWebView dealloc]
2860         is fairly sizable, and it's hard to follow all paths from it, so instead
2861         add a RELEASE_LOG_FAULT, so we'll get simulated crash logs, and bail,
2862         so we'll stop actually crashing (if this is the cause).
2863
2864         This is just a speculative fix, but a hopeful one, since intentionally calling
2865         -_addUpdateVisibleContentRectPreCommitHandler: from dealloc yields a similar-looking
2866         crash under the handler block.
2867
2868 2019-09-03  Jiewen Tan  <jiewen_tan@apple.com>
2869
2870         [WebAuthn] Enable WebAuthn by default for MobileSafari and SafariViewService
2871         https://bugs.webkit.org/show_bug.cgi?id=201369
2872         <rdar://problem/54903724>
2873
2874         Reviewed by Brent Fulgham.
2875
2876         Communications to security keys require entitlements, which are not guaranteed to be present in third party
2877         WKWebView clients. Therefore, only enable WebAuthn by default for MobileSafari and SafariViewService.
2878
2879         * Shared/WebPreferences.yaml:
2880         * Shared/WebPreferencesDefaultValues.cpp:
2881         (WebKit::defaultWebAuthenticationEnabled):
2882         * Shared/WebPreferencesDefaultValues.h:
2883
2884 2019-09-03  Chris Dumez  <cdumez@apple.com>
2885
2886         Rename WebPage::pageID() to WebPage::identifier()
2887         https://bugs.webkit.org/show_bug.cgi?id=201428
2888
2889         Reviewed by Antti Koivisto.
2890
2891         * Shared/API/Cocoa/WKBrowsingContextHandle.mm:
2892         (-[WKBrowsingContextHandle _initWithPage:]):
2893         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2894         (WebKit::WebPaymentCoordinator::WebPaymentCoordinator):
2895         (WebKit::WebPaymentCoordinator::showPaymentUI):
2896         (WebKit::WebPaymentCoordinator::messageSenderDestinationID const):
2897         * WebProcess/Network/WebLoaderStrategy.cpp:
2898         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2899         (WebKit::WebLoaderStrategy::preconnectTo):
2900         * WebProcess/Notifications/WebNotificationManager.cpp:
2901         (WebKit::WebNotificationManager::show):
2902         (WebKit::WebNotificationManager::cancel):
2903         (WebKit::WebNotificationManager::clearNotifications):
2904         (WebKit::WebNotificationManager::didDestroyNotification):
2905         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
2906         (WebKit::WebAuthenticatorCoordinator::WebAuthenticatorCoordinator):
2907         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2908         (WebKit::WebChromeClient::windowRect):
2909         (WebKit::WebChromeClient::focusedFrameChanged):
2910         (WebKit::WebChromeClient::createWindow):
2911         (WebKit::WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2912         (WebKit::WebChromeClient::toolbarsVisible):
2913         (WebKit::WebChromeClient::statusbarVisible):
2914         (WebKit::WebChromeClient::menubarVisible):
2915         (WebKit::WebChromeClient::wrapCryptoKey const):
2916         (WebKit::WebChromeClient::unwrapCryptoKey const):
2917         (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const):
2918         * WebProcess/WebCoreSupport/WebColorChooser.cpp:
2919         (WebKit::WebColorChooser::WebColorChooser):
2920         (WebKit::WebColorChooser::reattachColorChooser):
2921         (WebKit::WebColorChooser::setSelectedColor):
2922         (WebKit::WebColorChooser::endChooser):
2923         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:
2924         (WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier):
2925         (WebKit::WebDataListSuggestionPicker::close):
2926         (WebKit::WebDataListSuggestionPicker::displayWithActivationType):
2927         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2928         (WebKit::WebFrameLoaderClient::pageID const):
2929         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
2930         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
2931         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
2932         (WebKit::WebPopupMenu::show):
2933         (WebKit::WebPopupMenu::hide):
2934         * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp:
2935         (WebKit::WebSearchPopupMenu::saveRecentSearches):
2936         (WebKit::WebSearchPopupMenu::loadRecentSearches):
2937         * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
2938         (WebKit::WebFrameLoaderClient::createPreviewLoaderClient):
2939         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
2940         (WebKit::TextCheckingControllerProxy::TextCheckingControllerProxy):
2941         (WebKit::TextCheckingControllerProxy::~TextCheckingControllerProxy):
2942         * WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp:
2943         (WebKit::WebRemoteObjectRegistry::WebRemoteObjectRegistry):
2944         (WebKit::WebRemoteObjectRegistry::close):
2945         * WebProcess/WebPage/EventDispatcher.cpp:
2946         (WebKit::EventDispatcher::addScrollingTreeForPage):
2947         (WebKit::EventDispatcher::removeScrollingTreeForPage):
2948         (WebKit::EventDispatcher::clearQueuedTouchEventsForPage):
2949         (WebKit::EventDispatcher::getQueuedTouchEventsForPage):
2950         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2951         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
2952         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2953         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
2954         (WebKit::RemoteScrollingCoordinator::RemoteScrollingCoordinator):
2955         (WebKit::RemoteScrollingCoordinator::~RemoteScrollingCoordinator):
2956         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
2957         (WebKit::RemoteWebInspectorUI::sendMessageToBackend):
2958         (WebKit::RemoteWebInspectorUI::changeSheetRect):
2959         (WebKit::RemoteWebInspectorUI::startWindowDrag):
2960         (WebKit::RemoteWebInspectorUI::bringToFront):
2961         (WebKit::RemoteWebInspectorUI::closeWindow):
2962         (WebKit::RemoteWebInspectorUI::reopen):
2963         (WebKit::RemoteWebInspectorUI::resetState):
2964         (WebKit::RemoteWebInspectorUI::openInNewTab):
2965         (WebKit::RemoteWebInspectorUI::save):
2966         (WebKit::RemoteWebInspectorUI::append):
2967         (WebKit::RemoteWebInspectorUI::showCertificate):
2968         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2969         (WebKit::ViewGestureGeometryCollector::ViewGestureGeometryCollector):
2970         (WebKit::ViewGestureGeometryCollector::~ViewGestureGeometryCollector):
2971         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
2972         (WebKit::WebBackForwardListProxy::itemAtIndex):
2973         (WebKit::WebBackForwardListProxy::backListCount const):
2974         (WebKit::WebBackForwardListProxy::forwardListCount const):
2975         * WebProcess/WebPage/WebInspector.cpp:
2976         (WebKit::WebInspector::openLocalInspectorFrontend):
2977         (WebKit::WebInspector::closeFrontendConnection):
2978         (WebKit::WebInspector::bringToFront):
2979         (WebKit::WebInspector::elementSelectionChanged):
2980         (WebKit::WebInspector::timelineRecordingChanged):
2981         (WebKit::WebInspector::setMockCaptureDevicesEnabledOverride):
2982         (WebKit::WebInspector::updateDockingAvailability):
2983         * WebProcess/WebPage/WebPage.cpp:
2984         (WebKit::WebPage::WebPage):
2985         (WebKit::m_textAutoSizingAdjustmentTimer):
2986         (WebKit::WebPage::messageSenderDestinationID const):
2987         (WebKit::WebPage::close):
2988         (WebKit::WebPage::goToBackForwardItem):
2989         (WebKit::WebPage::setFixedLayoutSize):
2990         (WebKit::WebPage::freezeLayerTree):
2991         (WebKit::WebPage::unfreezeLayerTree):
2992         (WebKit::WebPage::restoreSessionInternal):
2993         (WebKit::WebPage::setCurrentHistoryItemForReattach):
2994         (WebKit::WebPage::updateIsInWindow):
2995         (WebKit::WebPage::setActivityState):
2996         (WebKit::WebPage::mainFrameDidLayout):
2997         (WebKit::WebPage::didCommitLoad):
2998         (WebKit::WebPage::hasStorageAccess):
2999         (WebKit::WebPage::requestStorageAccess):
3000         (WebKit::WebPage::textInputContextsInRect):
3001         (WebKit::WebPage::elementForTextInputContext):
3002         * WebProcess/WebPage/WebPage.h:
3003         (WebKit::WebPage::identifier const):
3004         (WebKit::WebPage::pageID const): Deleted.
3005         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
3006         (WebKit::WebPageInspectorTarget::identifier const):
3007         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
3008         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
3009         * WebProcess/WebPage/mac/WebPageMac.mm:
3010         (WebKit::WebPage::executeKeypressCommandsInternal):
3011         * WebProcess/WebProcess.cpp:
3012         (WebKit::WebProcess::transformObjectsToHandles):
3013         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
3014         (WebKit::StorageNamespaceImpl::copy):
3015         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
3016         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
3017         * WebProcess/cocoa/PlaybackSessionManager.mm:
3018         (WebKit::PlaybackSessionManager::PlaybackSessionManager):
3019         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
3020         (WebKit::PlaybackSessionManager::invalidate):
3021         * WebProcess/cocoa/VideoFullscreenManager.mm:
3022         (WebKit::VideoFullscreenManager::VideoFullscreenManager):
3023         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
3024         (WebKit::VideoFullscreenManager::invalidate):
3025
3026 2019-09-03  Antoine Quint  <graouts@apple.com>
3027
3028         [iOS] Treat a two-finger single tap as if the user tapped with the Cmd key pressed
3029         https://bugs.webkit.org/show_bug.cgi?id=201420
3030         <rdar://problem/53207786>
3031
3032         Reviewed by Simon Fraser.
3033
3034         Set the metaKey modifier to true when generating a click event based on a two-finger single tap. This is important so that sites like Google and DuckDuckGo
3035         correctly open links in their search results page in a new tab in Safari on iOS. This currently doesn't work because those sites will call preventDefault()
3036         if the metaKey flag isn't set on a "click" event, and if it is set, they let the browser handle the navigation themselves.
3037
3038         * UIProcess/ios/WKContentViewInteraction.mm:
3039         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
3040
3041 2019-08-28  Brent Fulgham  <bfulgham@apple.com>
3042
3043         [macOS] Correct sandbox violation in Flash plugin
3044         https://bugs.webkit.org/show_bug.cgi?id=201228
3045         <rdar://problem/54347503>
3046
3047         Reviewed by Alex Christensen.
3048
3049         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3050
3051 2019-09-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3052
3053         [WPE][GTK] Deprecate nonfunctional process limit APIs
3054         https://bugs.webkit.org/show_bug.cgi?id=193749
3055
3056         Reviewed by Žan Doberšek.
3057
3058         * UIProcess/API/glib/WebKitWebContext.cpp:
3059         (webkitWebContextConstructed):
3060         (webkit_web_context_set_process_model):
3061         (webkit_web_context_get_process_model):
3062         (webkit_web_context_set_web_process_count_limit):
3063         (webkit_web_context_get_web_process_count_limit):
3064         * UIProcess/API/gtk/WebKitWebContext.h:
3065         * UIProcess/API/wpe/WebKitWebContext.h:
3066
3067 2019-09-02  Youenn Fablet  <youenn@apple.com>
3068
3069         Make NetworkConnectionToWebProcess keyed by their WebProcess identifier
3070         https://bugs.webkit.org/show_bug.cgi?id=201300
3071
3072         Reviewed by Alex Christensen.
3073
3074         Make sure to create each NetworkConnectionToWebProcess for a given WebProcess.
3075         Pass the process identifier at creation time.
3076         This will allow to have the message registry be moved to NetworkProcess
3077         so as to check port activity between processes.
3078         This identifier might also be used in the future for other connections like
3079         service worker context/client/server identifiers.
3080
3081         No observable change of behavior.
3082
3083         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3084         (WebKit::NetworkConnectionToWebProcess::create):
3085         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3086         * NetworkProcess/NetworkConnectionToWebProcess.h:
3087         (WebKit::NetworkConnectionToWebProcess::webProcessIdentifier const):
3088         * NetworkProcess/NetworkProcess.cpp:
3089         (WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
3090         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
3091         (WebKit::NetworkProcess::actualPrepareToSuspend):
3092         (WebKit::NetworkProcess::resume):
3093         * NetworkProcess/NetworkProcess.h:
3094         * NetworkProcess/NetworkProcess.messages.in:
3095         * Platform/IPC/Connection.h:
3096         (IPC::Connection::sendWithAsyncReply):
3097         Allow to pass send options.
3098         * UIProcess/Network/NetworkProcessProxy.cpp:
3099         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
3100         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
3101         Make use of async reply to simplify the handling of lambdas.
3102         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
3103         (WebKit::NetworkProcessProxy::didFinishLaunching):
3104         * UIProcess/Network/NetworkProcessProxy.h:
3105         * UIProcess/Network/NetworkProcessProxy.messages.in:
3106
3107 2019-09-02  Youenn Fablet  <youenn@apple.com>
3108
3109         Introduce WorkerMessagePortChannelRegistry
3110         https://bugs.webkit.org/show_bug.cgi?id=201333
3111
3112         Reviewed by Alex Christensen.
3113
3114         By introducing WorkerMessagePortChannelRegistry, we are making
3115         sure UIMessagePortChannelProvider is only called from the main thread.
3116         This will help when moving the registry to network process.
3117
3118         * UIProcess/UIMessagePortChannelProvider.cpp:
3119         (WebKit::UIMessagePortChannelProvider::takeAllMessagesForPort):
3120         (WebKit::UIMessagePortChannelProvider::checkRemotePortForActivity):
3121         * UIProcess/UIMessagePortChannelProvider.h:
3122         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
3123         (WebKit::WebMessagePortChannelProvider::takeAllMessagesForPort):
3124         (WebKit::WebMessagePortChannelProvider::didTakeAllMessagesForPort):
3125         (WebKit::WebMessagePortChannelProvider::didCheckRemotePortForActivity):
3126         (WebKit::WebMessagePortChannelProvider::checkRemotePortForActivity):
3127         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h:
3128
3129 2019-09-01  Youenn Fablet  <youenn@apple.com>
3130
3131         Abstract out LibWebRTCSocketClient so that rtc sockets can be implemented without libwebrtc sockets
3132         https://bugs.webkit.org/show_bug.cgi?id=201302
3133
3134         Reviewed by Alex Christensen.
3135
3136         Introduce NetworkRTCProvider::Socket to be able to implement RTC socket support with non libwebrtc API
3137
3138         * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
3139         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
3140         (WebKit::NetworkRTCProvider::createSocket):
3141         (WebKit::NetworkRTCProvider::createUDPSocket):
3142         (WebKit::NetworkRTCProvider::createServerTCPSocket):
3143         (WebKit::NetworkRTCProvider::proxyInfoFromSession):
3144         (WebKit::NetworkRTCProvider::createClientTCPSocket):
3145         (WebKit::NetworkRTCProvider::wrapNewTCPConnection):
3146         (WebKit::NetworkRTCProvider::addSocket):
3147         (WebKit::NetworkRTCProvider::takeSocket):
3148         (WebKit::NetworkRTCProvider::newConnection):
3149         (WebKit::NetworkRTCProvider::closeListeningSockets):
3150         (WebKit::NetworkRTCProvider::callSocket):
3151         * NetworkProcess/webrtc/NetworkRTCProvider.h:
3152         * NetworkProcess/webrtc/NetworkRTCProvider.mm:
3153         (WebKit::NetworkRTCProvider::createClientTCPSocket):
3154         * NetworkProcess/webrtc/NetworkRTCSocket.cpp:
3155         (WebKit::NetworkRTCSocket::sendTo):
3156         (WebKit::NetworkRTCSocket::close):
3157         (WebKit::NetworkRTCSocket::setOption):
3158
3159 2019-09-01  Fujii Hironori  <Hironori.Fujii@sony.com>
3160
3161         [Cairo] out-of-bounds read in ShareableBitmap::paint if a fractional device scale factor is used
3162         https://bugs.webkit.org/show_bug.cgi?id=196340
3163
3164         Reviewed by Brent Fulgham.
3165
3166         In ShareableBitmap::paint, srcRectScaled can be out-of-bounds of
3167         the surface if a fractional device scale factor is used.
3168
3169         * Shared/cairo/ShareableBitmapCairo.cpp:
3170         (WebKit::ShareableBitmap::paint): Use cairoSurfaceSetDeviceScale
3171         to set a device scale factor to the surface instead of multiplying
3172         srcRect with a device scale factor.
3173
3174 2019-09-01  Fujii Hironori  <Hironori.Fujii@sony.com>
3175
3176         Unreviewed, rolling out r249366.
3177
3178         WinCairo WebKit2 crashes in some websites and the device scale
3179         factor is not correct in high DPI.
3180
3181         Reverted changeset:
3182
3183         "[WinCairo, FTW] Properly handle device scale factor"
3184         https://bugs.webkit.org/show_bug.cgi?id=201361
3185         https://trac.webkit.org/changeset/249366
3186
3187 2019-09-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3188
3189         Long presses that interrupt accelerated scrolling dispatch clicks on apps linked against iOS 12 or earlier
3190         https://bugs.webkit.org/show_bug.cgi?id=201346
3191         <rdar://problem/54885784>
3192
3193         Reviewed by Dean Jackson.
3194
3195         For apps that are linked on or after iOS 13, we add a context menu interaction to the content view, which
3196         requires us to disable (or avoid adding) the highlight long press gesture recognizer. However, for apps that are
3197         linked on the iOS 12 SDK or prior, this gesture is still present, and fires when long pressing for (roughly) up
3198         to 0.75 seconds if a tap gesture was not recognized instead. Firing this gesture sends a click event to the
3199         page; this brings back some form of <rdar://problem/53889373>, but only when holding for slightly longer than a
3200         normal tap, and also only in apps linked on iOS 12 or earlier. To fix this, we apply a similar solution as in
3201         r248433 and detect whether a long press gesture interrupted scroll view deceleration in
3202         -gestureRecognizerShouldBegin:. If so, we return NO to avoid clicking. See per-method comments below for more
3203         details.
3204
3205         Testing this bug as-is was tricky, since there's no way in layout tests to simulate being linked on or before a
3206         given SDK version. Luckily, recall that:
3207         1. This bug occurs when the highlight gesture recognizer is enabled and added to the content view.
3208         2. The highlight gesture recognizer only needs to be disabled or removed when context menu interaction is added.
3209         As such, we should be able to restore the highlight gesture recognizer by suppressing the context menu
3210         interaction in an app linked-on-or-after iOS 13, by setting allowsLinkPreview to NO. Unfortunately, this doesn't
3211         quite work, since we currently always avoid adding the highlight gesture recognizer if the app is linked on
3212         iOS 13 or later.
3213
3214         However, this means that the highlight gesture recognizer is absent from the content view in apps linked against
3215         iOS 13 that disable link previews, even though its absence is not required. This means that long pressing a
3216         clickable element in a web view that disables link previews does not show a tap highlight on iOS 13, whereas it
3217         would on iOS 12; this is a regression, albeit a very subtle one. To fix this subtle issue and make it possible
3218         to write a test for this bug, we refactor some logic for creating and configuring the highlight long press
3219         gesture, such that we now unconditionally add the highlight gesture, but only enable it in apps linked on or
3220         after iOS 13 if link previews (i.e. context menu interaction) are not allowed.
3221
3222         Test: fast/scrolling/ios/click-events-after-long-press-during-momentum-scroll-in-overflow.html
3223
3224         * SourcesCocoa.txt:
3225         * UIProcess/API/Cocoa/WKWebView.mm:
3226         (-[WKWebView setAllowsLinkPreview:]):
3227         * UIProcess/ios/WKContentViewInteraction.h:
3228         * UIProcess/ios/WKContentViewInteraction.mm:
3229         (-[WKContentView setupInteraction]):
3230
3231         Refactor our gesture setup logic to always create and add the long press and highlight long press gestures, but
3232         conditionally disable them based on whether or not (1) the context menu is available, and (2) WKWebView's
3233         allowsLinkPreview property.
3234
3235         (-[WKContentView _didChangeLinkPreviewAvailability]):
3236         (-[WKContentView _updateLongPressAndHighlightLongPressGestures]):
3237
3238         Add a new helper to update the enabled state of the long press and highlight long press gestures, by consulting
3239         -_shouldUseContextMenu and -allowsLinkPreview. This is called when setting up the gestures, as well as whenever
3240         -allowsLinkPreview changes.
3241
3242         (-[WKContentView gestureRecognizerShouldBegin:]):
3243
3244         Factor out logic to ascend the view hierarchy in search of a UIScrollView that was interrupted while
3245         decelerating into a local lambda function; use this for both the highlight gesture and the single tap gesture,
3246         to determine whether they should begin.
3247
3248         * UIProcess/ios/WKHighlightLongPressGestureRecognizer.h: Added.
3249         * UIProcess/ios/WKHighlightLongPressGestureRecognizer.mm: Added.
3250
3251         In order to remember the UIScrollView (if any) tracked by the highlight long press gesture, we subclass
3252         _UIWebHighlightLongPressGestureRecognizer. While UILongPressGestureRecognizer does have SPI to ask for a list of
3253         UITouches, by the time the gesture has been recognized and the gesture delegates are invoked, these UITouches
3254         no longer correspond to UIViews. As such, the only time we have access to the list of UITouches with their
3255         UIViews is during the touches* subclass hooks.
3256
3257         (-[WKHighlightLongPressGestureRecognizer reset]):
3258
3259         Clear out the tracked UIScrollView here, when the gesture is reset (i.e. after ending, or being canceled).
3260
3261         (-[WKHighlightLongPressGestureRecognizer touchesBegan:withEvent:]):
3262
3263         Remember the last touched UIScrollView here.
3264
3265         (-[WKHighlightLongPressGestureRecognizer lastTouchedScrollView]):
3266         * WebKit.xcodeproj/project.pbxproj:
3267
3268 2019-08-30  Brent Fulgham  <bfulgham@apple.com>
3269
3270         [WinCairo, FTW] Properly handle device scale factor
3271         https://bugs.webkit.org/show_bug.cgi?id=201361
3272
3273         Reviewed by Don Olmstead.
3274
3275         Update the WebView and WebProcess to correctly handle
3276         the device scale factor.
3277
3278         * UIProcess/win/WebView.cpp:
3279         (WebKit::WebView::WebView): Tell the page the current device scale factor.
3280         * WebProcess/win/WebProcessMainWin.cpp:
3281         (WebKit::WebProcessMainWin): Tell the process to be aware of device scale.
3282
3283 2019-08-31  Chris Dumez  <cdumez@apple.com>
3284
3285         DocumentStorageAccess::hasStorageAccess() / requestStorageAccess() don't need to know about pageID / frameID
3286         https://bugs.webkit.org/show_bug.cgi?id=201364
3287
3288         Reviewed by John Wilander.
3289
3290         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3291         (WebKit::WebChromeClient::hasStorageAccess):
3292         (WebKit::WebChromeClient::requestStorageAccess):
3293         * WebProcess/WebCoreSupport/WebChromeClient.h:
3294         * WebProcess/WebPage/WebPage.cpp:
3295         (WebKit::WebPage::hasStorageAccess):
3296         (WebKit::WebPage::requestStorageAccess):
3297         * WebProcess/WebPage/WebPage.h:
3298
3299 2019-08-30  Chris Dumez  <cdumez@apple.com>
3300
3301         WebPage::fromCorePage() to take and return a C++ reference
3302         https://bugs.webkit.org/show_bug.cgi?id=201367
3303
3304         Reviewed by Antti Koivisto.
3305
3306         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3307         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3308         * WebProcess/WebPage/VisitedLinkTableController.cpp:
3309         (WebKit::VisitedLinkTableController::addVisitedLink):
3310         * WebProcess/WebPage/WebFrame.cpp:
3311         (WebKit::WebFrame::page const):
3312         * WebProcess/WebPage/WebPage.cpp:
3313         (WebKit::WebPage::fromCorePage):
3314         * WebProcess/WebPage/WebPage.h:
3315         * WebProcess/WebPage/WebPageOverlay.cpp:
3316         (WebKit::WebPageOverlay::willMoveToPage):
3317         (WebKit::WebPageOverlay::didMoveToPage):
3318         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
3319         (WebKit::StorageNamespaceImpl::copy):
3320         * WebProcess/WebStorage/StorageNamespaceImpl.h:
3321         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
3322         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
3323
3324 2019-08-30  Chris Dumez  <cdumez@apple.com>
3325
3326         [PSON] We no longer need to throw away suspended pages in a process before using it for a navigation
3327         https://bugs.webkit.org/show_bug.cgi?id=201344
3328
3329         Reviewed by Antti Koivisto.
3330
3331         We no longer need to throw away suspended pages in a process before using it for a navigation, now that
3332         Bug 201225 has been fixed. WebPage objects (suspended or live) in the process now have distinct
3333         identifiers and can coexist.
3334
3335         * Shared/API/Cocoa/RemoteObjectRegistry.h:
3336         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
3337         (WebKit::RemoteObjectRegistry::RemoteObjectRegistry):
3338         * UIProcess/Cocoa/UIRemoteObjectRegistry.cpp:
3339         (WebKit::UIRemoteObjectRegistry::UIRemoteObjectRegistry):
3340         * WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp:
3341         (WebKit::WebRemoteObjectRegistry::WebRemoteObjectRegistry):
3342         (WebKit::WebRemoteObjectRegistry::close):
3343
3344 2019-08-30  Chris Dumez  <cdumez@apple.com>
3345
3346         Assertion hit when saving to PDF from printing dialog
3347         https://bugs.webkit.org/show_bug.cgi?id=201351
3348
3349         Reviewed by Tim Horton.
3350
3351         [WKPrintingView knowsPageRange:] may get called from a background thread and ends up calling
3352         WeakPtr::get() which asserts because it is generally unsafe to get the raw pointer from a
3353         WeakPtr to an object owned by another thread. However, the methods here merely want to null
3354         check it so add a thread-safe method (pageIsClosed()) to WebFrameProxy for it.
3355
3356         * UIProcess/WebFrameProxy.h:
3357         (WebKit::WebFrameProxy::pageIsClosed const):
3358         * UIProcess/mac/WKPrintingView.mm:
3359         (-[WKPrintingView knowsPageRange:]):
3360
3361 2019-08-30  Alex Christensen  <achristensen@webkit.org>
3362
3363         Remove HAVE_CFNETWORK_WITH_AUTO_ADDED_HTTP_HEADER_SUPPRESSION_SUPPORT conditional
3364         https://bugs.webkit.org/show_bug.cgi?id=201280
3365
3366         Reviewed by Youenn Fablet.
3367
3368         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3369         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3370
3371 2019-08-30  Alex Christensen  <achristensen@webkit.org>
3372
3373         Remove HAVE_CFNETWORK_WITH_IGNORE_HSTS conditional
3374         https://bugs.webkit.org/show_bug.cgi?id=201279
3375
3376         Reviewed by Darin Adler.
3377
3378         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3379         (ignoreHSTS):
3380         (updateIgnoreStrictTransportSecuritySettingIfNecessary):
3381         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3382         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
3383
3384 2019-08-30  Alex Christensen  <achristensen@webkit.org>
3385
3386         Allow process cache to cache processes when using a non-default persistent WebsiteDataStore
3387         https://bugs.webkit.org/show_bug.cgi?id=201329
3388
3389         Reviewed by Chris Dumez.
3390
3391         Treat all persistent sessions the same when deciding whether to clear all cached web processes using a particular website data store.
3392         This removes a huge performance regression on warm plt when switching to using a non-default persistent session.
3393         I also removed a call to removeSession which is redundant with the one in the WebsiteDataStore destructor, which is where it should be.
3394
3395         * UIProcess/WebProcessCache.cpp:
3396         (WebKit::WebProcessCache::canCacheProcess const):
3397         * UIProcess/WebProcessPool.cpp:
3398         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
3399         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
3400
3401 2019-08-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3402
3403         Caret does not appear in text field inside a transformed, overflow: hidden container
3404         https://bugs.webkit.org/show_bug.cgi?id=201317
3405         <rdar://problem/54859264>
3406
3407         Reviewed by Simon Fraser.
3408
3409         Adjust isTransparentOrFullyClipped to use the new methods in RenderLayer and RenderObject. See WebCore ChangeLog
3410         for more details.
3411
3412         * WebProcess/WebPage/ios/WebPageIOS.mm:
3413         (WebKit::WebPage::isTransparentOrFullyClipped const):
3414
3415 2019-08-30  Simon Fraser  <simon.fraser@apple.com>
3416
3417         Add system tracing points for compositing updates, and touch-event dispatching
3418         https://bugs.webkit.org/show_bug.cgi?id=201327
3419
3420         Reviewed by Alex Christensen.
3421         
3422         TraceScope in EventDispatcher::dispatchTouchEvents().
3423
3424         * WebProcess/WebPage/EventDispatcher.cpp:
3425         (WebKit::EventDispatcher::dispatchTouchEvents):
3426
3427 2019-08-30  Brent Fulgham  <bfulgham@apple.com>
3428
3429         [FTW] Use DirectX SharedResource as basis for SharedBitmap
3430         https://bugs.webkit.org/show_bug.cgi?id=201157
3431
3432         Reviewed by Alex Christensen.
3433
3434         Currently an ID2D1Bitmap is used as the backing store for the SharedBitmap that is the
3435         base type for sharing data between the WebContent Process and the UIProcess. However, this
3436         involves moving GPU memory to local memory, copying that memory into the SharedMemory member
3437         of the SharedBitmap, then building a new GPU bitmap on the UIProcess side from that SharedMemory.
3438
3439         Profiling indicates that this is the single largest place FTW WebKit spends its time.
3440
3441         Instead, we should use Direct2D's ability to render to an IDXGISurface, which can be shared
3442         between multiple processes. This should avoid the GPU->CPU copy, the Direct2D-allocated
3443         CPU->Shared Memory copy, and the shared memory to GPU copy.
3444
3445         Reviewed by Alex Christensen.
3446
3447         * Platform/SharedMemory.h:
3448         * Platform/win/SharedMemoryWin.cpp:
3449         (WebKit::SharedMemory::Handle::encodeHandle): Added.
3450         (WebKit::SharedMemory::Handle::encode const): Use new helper function.
3451         (WebKit::SharedMemory::Handle::decodeHandle): Added.
3452         (WebKit::SharedMemory::Handle::decode): Use new helper function.
3453         * PlatformFTW.cmake: Add D3X11 libraries.
3454         * Shared/ShareableBitmap.cpp:
3455         (WebKit::ShareableBitmap::Configuration::encode const): Encode shared resource handle for DX texture.
3456         (WebKit::ShareableBitmap::Configuration::decode): Ditto (but decode).
3457         (WebKit::ShareableBitmap::ShareableBitmap): Create SharedResource (if needed).
3458         (WebKit::ShareableBitmap::~ShareableBitmap): Add cleanup code for SharedResoure.
3459         (WebKit::ShareableBitmap::numBytesForSize): Only allocate a small memory store when using GPU textures.
3460         * Shared/ShareableBitmap.h:
3461         (WebKit::ShareableBitmap::dxSurface):
3462         * Shared/win/ShareableBitmapDirect2D.cpp:
3463         (WebKit::ShareableBitmap::createSharedResource): Added.
3464         (WebKit::ShareableBitmap::disposeSharedResource): Added.
3465         (WebKit::ShareableBitmap::leakSharedResource): Added.
3466         (WebKit::ShareableBitmap::createGraphicsContext): Update for new data types.
3467         (WebKit::ShareableBitmap::paint): Ditto.
3468         (WebKit::ShareableBitmap::createDirect2DSurface): Update for new data types.
3469         (WebKit::ShareableBitmap::createImage): Ditto.
3470         (WebKit::createSurfaceFromData): Deleted.
3471         (WebKit::ShareableBitmap::sync): Deleted.
3472         * UIProcess/BackingStore.cpp:
3473         * UIProcess/BackingStore.h:
3474         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
3475         * UIProcess/WebPageProxy.cpp:
3476         * UIProcess/WebPageProxy.h:
3477         * UIProcess/win/BackingStoreDirect2D.cpp:
3478         (WebKit::BackingStore::createBackend):
3479         (WebKit::BackingStore::paint):
3480         (WebKit::BackingStore::incorporateUpdate):
3481         * UIProcess/win/PageClientImpl.cpp:
3482         * UIProcess/win/WebPageProxyWin.cpp:
3483         (WebKit::WebPageProxy::device const):
3484         (WebKit::WebPageProxy::setDevice):
3485         * UIProcess/win/WebView.cpp:
3486         (WebKit::WebView::WebView): Initialize DirectX stuff.
3487         (WebKit::WebView::paint): Use new DiretX drawing logic.
3488         (WebKit::WebView::onSizeEvent): Update SwapChain's buffer sizes when resizing.
3489         (WebKit::WebView::setupSwapChain): Added.
3490         (WebKit::WebView::configureBackingStore): Added.
3491         * UIProcess/win/WebView.h:
3492         (WebKit::WebView::d3dDevice):
3493         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3494         (WebKit::DrawingAreaCoordinatedGraphics::display):
3495
3496 2019-08-30  Chris Dumez  <cdumez@apple.com>
3497
3498         [PSON] Bump the WebPage's identifier every time we process-swap
3499         https://bugs.webkit.org/show_bug.cgi?id=201225
3500
3501         Reviewed by Alex Christensen.
3502
3503         Every time we create a new WebPage object in a provisional process, we now assign it a new
3504         identifier, instead of using the identifier of the WebPage in the committed process. This
3505         will address issues with IPC when navigating back and forth between processes since we will
3506         no longer be confused as to which WebPage the IPC is coming from. Also, this will allow
3507         suspended WebPages to keep living in the process, even if we use the process for a new load
3508         (will be done in a follow-up patch) since we will no longer have an identifier conflict.
3509
3510         * Scripts/webkit/messages.py:
3511         * Shared/API/APIPageHandle.cpp:
3512         (API::PageHandle::create):
3513         (API::PageHandle::createAutoconverting):
3514         (API::PageHandle::PageHandle):
3515         (API::PageHandle::encode const):
3516         (API::PageHandle::decode):
3517         * Shared/API/APIPageHandle.h:
3518         (API::PageHandle::pageProxyID const):
3519         (API::PageHandle::webPageID const):
3520         * Shared/API/Cocoa/WKBrowsingContextHandle.mm:
3521         (-[WKBrowsingContextHandle _initWithPageProxy:]):
3522         (-[WKBrowsingContextHandle _initWithPage:]):
3523         (-[WKBrowsingContextHandle _initWithPageProxyID:andWebPageID:]):
3524         (-[WKBrowsingContextHandle hash]):
3525         (-[WKBrowsingContextHandle isEqual:]):
3526         (-[WKBrowsingContextHandle encodeWithCoder:]):
3527         (-[WKBrowsingContextHandle initWithCoder:]):
3528         * Shared/API/Cocoa/WKBrowsingContextHandleInternal.h:
3529         * Shared/WebPageCreationParameters.cpp:
3530         (WebKit::WebPageCreationParameters::encode const):
3531         (WebKit::WebPageCreationParameters::decode):
3532         * Shared/WebPageCreationParameters.h:
3533         * Shared/mac/ObjCObjectGraph.mm:
3534         (WebKit::ObjCObjectGraph::encode):
3535         (WebKit::ObjCObjectGraph::decode):
3536         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
3537         (-[WKBrowsingContextController handle]):
3538         * UIProcess/API/Cocoa/WKWebView.mm:
3539         (-[WKWebView dealloc]):
3540         (-[WKWebView _remoteObjectRegistry]):
3541         (-[WKWebView _handle]):
3542         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
3543         (webkitURISchemeRequestCreate):
3544         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3545         (WebKit::WebProcessProxy::transformHandlesToObjects):
3546         * UIProcess/Cocoa/WebViewImpl.mm:
3547         (WebKit::WebViewImpl::~WebViewImpl):
3548         (WebKit::WebViewImpl::remoteObjectRegistry):
3549         * UIProcess/Network/NetworkProcessProxy.cpp:
3550         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
3551         (WebKit::NetworkProcessProxy::logDiagnosticMessage):
3552         (WebKit::NetworkProcessProxy::logDiagnosticMessageWithResult):
3553         (WebKit::NetworkProcessProxy::logDiagnosticMessageWithValue):
3554         (WebKit::NetworkProcessProxy::requestStorageAccessConfirm):
3555         (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
3556         (WebKit::NetworkProcessProxy::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
3557         * UIProcess/ProvisionalPageProxy.cpp:
3558         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3559         (WebKit::ProvisionalPageProxy::loadData):
3560         (WebKit::ProvisionalPageProxy::loadRequest):
3561         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
3562         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3563         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
3564         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
3565         * UIProcess/ProvisionalPageProxy.h:
3566         (WebKit::ProvisionalPageProxy::webPageID const):
3567         * UIProcess/SuspendedPageProxy.h:
3568         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
3569         (WebKit::WebUserContentControllerProxy::didPostMessage):
3570         * UIProcess/UserContent/WebUserContentControllerProxy.h:
3571         * UIProcess/UserContent/WebUserContentControllerProxy.messages.in:
3572         * UIProcess/VisitedLinkStore.cpp:
3573         (WebKit::VisitedLinkStore::addVisitedLinkHashFromPage):
3574         * UIProcess/VisitedLinkStore.h:
3575         * UIProcess/VisitedLinkStore.messages.in:
3576         * UIProcess/WebInspectorProxy.cpp:
3577         (WebKit::WebInspectorProxy::createFrontendPage):
3578         (WebKit::WebInspectorProxy::openLocalInspectorFrontend):
3579         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
3580         * UIProcess/WebPageProxy.cpp:
3581         (WebKit::WebPageProxy::swapToWebProcess):
3582         (WebKit::WebPageProxy::loadRequest):
3583         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
3584         (WebKit::WebPageProxy::loadData):
3585         (WebKit::WebPageProxy::loadDataWithNavigationShared):
3586         (WebKit::WebPageProxy::commitProvisionalPage):
3587         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3588         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
3589         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
3590         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3591         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3592         (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared):
3593         (WebKit::WebPageProxy::decidePolicyForResponse):
3594         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3595         (WebKit::WebPageProxy::createNewPage):
3596         (WebKit::WebPageProxy::creationParameters):
3597         (WebKit::WebPageProxy::startURLSchemeTask):
3598         (WebKit::WebPageProxy::startURLSchemeTaskShared):
3599         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
3600         * UIProcess/WebPageProxy.h:
3601         * UIProcess/WebPageProxy.messages.in:
3602         * UIProcess/WebProcessProxy.cpp:
3603         (WebKit::WebProcessProxy::webPageFromCorePageIdentifier):
3604         (WebKit::WebProcessProxy::didReceiveMessage):
3605         (WebKit::WebProcessProxy::transformHandlesToObjects):
3606         (WebKit::WebProcessProxy::transformObjectsToHandles):
3607         * UIProcess/WebProcessProxy.h:
3608         * UIProcess/WebURLSchemeHandler.cpp:
3609         (WebKit::WebURLSchemeHandler::startTask):
3610         (WebKit::WebURLSchemeHandler::taskCompleted):
3611         * UIProcess/WebURLSchemeHandler.h:
3612         * UIProcess/WebURLSchemeTask.cpp:
3613         (WebKit::WebURLSchemeTask::create):
3614         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
3615         (WebKit::WebURLSchemeTask::didPerformRedirection):
3616         (WebKit::WebURLSchemeTask::didReceiveResponse):
3617         (WebKit::WebURLSchemeTask::didReceiveData):
3618         (WebKit::WebURLSchemeTask::didComplete):
3619         (WebKit::WebURLSchemeTask::pageDestroyed):
3620         * UIProcess/WebURLSchemeTask.h:
3621         (WebKit::WebURLSchemeTask::pageProxyID const):
3622         (WebKit::WebURLSchemeTask::webPageID const):
3623         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3624         (-[WKWebProcessPlugInBrowserContextController handle]):
3625         (+[WKWebProcessPlugInBrowserContextController lookUpBrowsingContextFromHandle:]):
3626         * WebProcess/UserContent/WebUserContentController.cpp:
3627         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3628         (WebKit::WebChromeClient::createWindow):
3629         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3630         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3631         * WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp:
3632         (WebKit::WebRemoteObjectRegistry::WebRemoteObjectRegistry):
3633         (WebKit::WebRemoteObjectRegistry::close):
3634         * WebProcess/WebPage/VisitedLinkTableController.cpp:
3635         (WebKit::VisitedLinkTableController::addVisitedLink):
3636         * WebProcess/WebPage/WebInspectorUI.cpp:
3637         (WebKit::WebInspectorUI::establishConnection):
3638         * WebProcess/WebPage/WebInspectorUI.h:
3639         * WebProcess/WebPage/WebInspectorUI.messages.in:
3640         * WebProcess/WebPage/WebPage.cpp:
3641         * WebProcess/WebPage/WebPage.h:
3642         (WebKit::WebPage::sessionStorageNamespaceIdentifier const):
3643         (WebKit::WebPage::webPageProxyIdentifier const):
3644         * WebProcess/WebProcess.cpp:
3645         (WebKit::WebProcess::didReceiveMessage):
3646         (WebKit::WebProcess::transformHandlesToObjects):
3647         (WebKit::WebProcess::transformObjectsToHandles):
3648         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
3649         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
3650         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
3651         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
3652         (WebKit::StorageNamespaceImpl::StorageNamespaceImpl):
3653         (WebKit::StorageNamespaceImpl::copy):
3654         (WebKit::StorageNamespaceImpl::sessionStoragePageID const):
3655         * WebProcess/WebStorage/StorageNamespaceImpl.h:
3656         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
3657         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
3658         * WebProcess/cocoa/WebProcessCocoa.mm:
3659         (WebKit::WebProcess::transformHandlesToObjects):
3660
3661 2019-08-30  Keith Rollin  <krollin@apple.com>
3662
3663         Remove AppKitCompatibilityDeclarations.h
3664         https://bugs.webkit.org/show_bug.cgi?id=201283
3665         <rdar://problem/54822042>
3666
3667         Reviewed by Alexey Proskuryakov.
3668
3669         The two copies of these files -- on in WTF, one in MiniBrowser -- are
3670         empty and can be removed.
3671
3672         * WebKit2Prefix.h:
3673
3674 2019-08-30  Adrian Perez de Castro  <aperez@igalia.com>
3675
3676         [WPE][GTK] New API to remove a filter from an user content manager given its identifier
3677         https://bugs.webkit.org/show_bug.cgi?id=200479
3678
3679         Reviewed by Carlos Garcia Campos.
3680
3681         * UIProcess/API/glib/WebKitUserContentManager.cpp:
3682         (webkit_user_content_manager_remove_filter_by_id): Add new public API function.
3683         * UIProcess/API/gtk/WebKitUserContentManager.h: Add declaration for
3684         webkit_user_content_manager_remove_filter_by_id().
3685         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: List new function.
3686         * UIProcess/API/wpe/WebKitUserContentManager.h: Add declaration for
3687         webkit_user_content_manager_remove_filter_by_id().
3688         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: List new function.
3689
3690 2019-08-30  Pablo Saavedra  <psaavedra@igalia.com>
3691
3692         [GTK] Build failure in Debian Stable and Ubuntu LTS bots
3693         https://bugs.webkit.org/show_bug.cgi?id=201337
3694
3695         Reviewed by Carlos Garcia Campos.
3696
3697         * UIProcess/gtk/WaylandCompositor.cpp:
3698         (WebKit::WaylandCompositor::bindSurfaceToWebPage):
3699
3700 2019-08-30  Philippe Normand  <pnormand@igalia.com>
3701
3702         [WPE][Qt] loadingChanged signal parameter is unusable
3703         https://bugs.webkit.org/show_bug.cgi?id=201301
3704
3705         Reviewed by Carlos Garcia Campos.
3706
3707         * UIProcess/API/wpe/qt/WPEQtView.h: Explicitely name signal
3708         parameter. It is a runtime requirement for QML.
3709
3710 2019-08-29  Keith Rollin  <krollin@apple.com>
3711
3712         Remove HAVE_PASSKIT_GRANULAR_ERRORS conditional
3713         https://bugs.webkit.org/show_bug.cgi?id=201278
3714         <rdar://problem/54821052>
3715
3716         Reviewed by Alex Christensen.
3717
3718         HAVE_PASSKIT_GRANULAR_ERRORS is always True, so remove the conditional
3719         tests, keeping the True branches and removing the False branches.
3720
3721         * Platform/cocoa/PaymentAuthorizationPresenter.mm:
3722         (WebKit::PaymentAuthorizationPresenter::completePaymentSession):
3723         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection):
3724         * Platform/cocoa/PaymentAuthorizationViewController.mm:
3725         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]): Deleted.
3726         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]): Deleted.
3727         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]): Deleted.
3728         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:completion:]): Deleted.
3729         * Platform/cocoa/WKPaymentAuthorizationDelegate.h:
3730         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
3731         (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]):
3732         (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]):
3733         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]):
3734         (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]):
3735         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3736         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
3737         (WebKit::toPKContactFields):
3738         (WebKit::toNSSet):
3739         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest):
3740         (WebKit::toPKAddressField): Deleted.
3741
3742 2019-08-29  Chris Dumez  <cdumez@apple.com>
3743
3744         Add "IsolatedCopy" in the name of String getters that call isolatedCopy() on the string
3745         https://bugs.webkit.org/show_bug.cgi?id=201318
3746
3747         Reviewed by Alex Christensen.
3748
3749         Add "IsolatedCopy" in the name of String getters that call isolatedCopy() on the string, for clarity.
3750
3751         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
3752         (WebKit::ResourceLoadStatisticsPersistentStorage::storageDirectoryPathIsolatedCopy const):
3753         (WebKit::ResourceLoadStatisticsPersistentStorage::resourceLogFilePath const):
3754         (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
3755         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
3756         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
3757         (WebKit::NetworkCache::BlobStorage::blobDirectoryPathIsolatedCopy const):
3758         (WebKit::NetworkCache::BlobStorage::synchronize):
3759         (WebKit::NetworkCache::BlobStorage::blobPathForHash const):
3760         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
3761         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3762         (WebKit::NetworkCache::Storage::basePathIsolatedCopy const):
3763         (WebKit::NetworkCache::Storage::versionPath const):
3764         (WebKit::NetworkCache::Storage::recordsPathIsolatedCopy const):
3765         (WebKit::NetworkCache::Storage::synchronize):
3766         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey const):
3767         (WebKit::NetworkCache::Storage::traverse):
3768         (WebKit::NetworkCache::Storage::clear):
3769         (WebKit::NetworkCache::Storage::shrink):
3770         (WebKit::NetworkCache::Storage::deleteOldVersions):
3771         * NetworkProcess/cache/NetworkCacheStorage.h:
3772
3773 2019-08-29  Keith Rollin  <krollin@apple.com>
3774
3775         Update .xcconfig symbols to reflect the current set of past and future product versions.
3776         https://bugs.webkit.org/show_bug.cgi?id=200720
3777         <rdar://problem/54305032>
3778
3779         Reviewed by Alex Christensen.
3780
3781         Remove version symbols related to old OS's we no longer support,
3782         ensure that version symbols are defined for OS's we do support.
3783
3784         * Configurations/Base.xcconfig:
3785         * Configurations/DebugRelease.xcconfig:
3786         * Configurations/Version.xcconfig:
3787
3788 2019-08-29  Keith Rollin  <krollin@apple.com>
3789
3790         Invalid XPCServices symlinks are being created
3791         https://bugs.webkit.org/show_bug.cgi?id=201320
3792         <rdar://problem/54719612>
3793
3794         Reviewed by Dan Bernstein.
3795
3796         When performing incremental builds, errant XPCServices symlinks can be
3797         created. For example, in the following, the second symlink is the
3798         correct one. The first symlink gets created when the build process
3799         tries to create the symlink and it already exists. When it already
3800         exists, the command to create the symlink actually follows the
3801         existing symlink and creates the (second) symlink at the location
3802         where the first symlink points.
3803
3804             WebKit.framework/Versions/A/XPCServices/XPCServices@ -> Versions/Current/XPCServices
3805             WebKit.framework/XPCServices@ -> Versions/Current/XPCServices
3806
3807         Address this by specifying -h to the `ln` command, which will cause it
3808         to not follow symlinks if they already exist at the target.
3809
3810         Also, fix a benign issue where the Xcode build variable WRAPPER_NAME
3811         was being referenced in a context where it wasn't defined.
3812
3813         * WebKit.xcodeproj/project.pbxproj:
3814
3815 2019-08-29  Alex Christensen  <achristensen@webkit.org>
3816
3817         Speculative loads should use the NetworkSession owning their Cache
3818         https://bugs.webkit.org/show_bug.cgi?id=201314
3819
3820         Reviewed by Chris Dumez.
3821
3822         This provides a performance improvement when using non-default persistent WKWebsiteDataStores.
3823
3824         * NetworkProcess/NetworkSession.cpp:
3825         (WebKit::NetworkSession::NetworkSession):
3826         * NetworkProcess/cache/NetworkCache.cpp:
3827         (WebKit::NetworkCache::Cache::open):
3828         (WebKit::NetworkCache::Cache::Cache):
3829         * NetworkProcess/cache/NetworkCache.h:
3830         (WebKit::NetworkCache::Cache::sessionID const):
3831         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
3832         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
3833
3834 2019-08-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3835
3836         [iOS 13] Caret does not appear in text field if the body element is translated completely out of the viewport
3837         https://bugs.webkit.org/show_bug.cgi?id=201287
3838         <rdar://problem/54780864>
3839
3840         Reviewed by Tim Horton.
3841
3842         During EditorState computation, we use the hidden editable element heuristic to determine whether we should
3843         begin suppressing selection gestures and UI. Currently, we use the editable root of the selection range to
3844         determine where in the layer tree we should start our ascent, in search of a completely transparent or
3845         completely clipped container.
3846
3847         However, in the case where the selection is inside a focused text field, this causes us to walk up the layer
3848         tree starting at the RenderLayer corresponding to the text field's inner contenteditable div, which is different
3849         than the text field's enclosing RenderLayer in the case where the containing block is transformed, such that no
3850         part of it is within the visible viewport. This scenario is exercised by the below test case, in which the caret
3851         after transforming the body horizontally by -100vw is hidden due to a false positive in the hidden editable area
3852         heuristic.
3853
3854         Fix this by starting the layer tree ascent from the enclosing layer of the text form control if applicable,
3855         instead of the inner editable area under the shadow root of the form control.
3856
3857         Test: editing/selection/ios/show-selection-in-transformed-container.html
3858
3859         * WebProcess/WebPage/ios/WebPageIOS.mm:
3860         (WebKit::WebPage::platformEditorState const):
3861
3862 2019-08-29  Youenn Fablet  <youenn@apple.com>
3863
3864         Skip fetch event dispatching if no fetch event handler is added at script evaluation time
3865         https://bugs.webkit.org/show_bug.cgi?id=201174
3866
3867         Reviewed by Chris Dumez.
3868
3869         Store whether a fetch event handler is set at script evaluation time.
3870         If not, we skip the fetch event entirely so that the network load can start sooner.
3871         If fetch event is skipped, we trigger soft update, as defined in
3872         https://w3c.github.io/ServiceWorker/#handle-fetch step 16.
3873
3874         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3875         (WebKit::WebSWServerConnection::startFetch):
3876         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
3877         (WebKit::WebSWServerToContextConnection::softUpdate):
3878         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
3879         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
3880         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3881         (WebKit::WebSWContextManagerConnection::serviceWorkerStarted):
3882         (WebKit::WebSWContextManagerConnection::serviceWorkerFailedToStart):
3883         (WebKit::WebSWContextManagerConnection::softUpdate):
3884         * WebProcess/Storage/WebSWContextManagerConnection.h:
3885         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
3886
3887 2019-08-29  Keith Rollin  <krollin@apple.com>
3888
3889         Remove support for macOS < 10.13 (part 3)
3890         https://bugs.webkit.org/show_bug.cgi?id=201224
3891         <rdar://problem/54795934>
3892
3893         Reviewed by Darin Adler.
3894
3895         Remove symbols in WebKitTargetConditionals.xcconfig related to macOS
3896         10.13, including WK_MACOS_1013 and WK_MACOS_BEFORE_1013, and suffixes
3897         like _MACOS_SINCE_1013.
3898
3899         * Configurations/WebKitTargetConditionals.xcconfig:
3900
3901 2019-08-29  Youenn Fablet  <youenn@apple.com>
3902
3903         Use WebPageProxy callbacks in case of authentication challenge received from Service Worker
3904         https://bugs.webkit.org/show_bug.cgi?id=201177
3905
3906         Reviewed by Alex Christensen.
3907
3908         Send topOrigin for every possible load to NetworkProcess.
3909         Send topOrigin as part of authentication challenge to UIProcess.
3910
3911         If there is no corresponding page for the pageID, try getting a page
3912         related to the service worker using the topOrigin and send the challenge to it.
3913
3914         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
3915         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
3916         * NetworkProcess/NetworkCORSPreflightChecker.h:
3917         * NetworkProcess/NetworkLoad.cpp:
3918         (WebKit::NetworkLoad::didReceiveChallenge):
3919         * NetworkProcess/NetworkLoadChecker.cpp:
3920         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3921         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
3922         * NetworkProcess/NetworkLoadChecker.h:
3923         * NetworkProcess/NetworkLoadParameters.h:
3924         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3925         (WebKit::NetworkResourceLoadParameters::encode const):
3926         (WebKit::NetworkResourceLoadParameters::decode):
3927         * NetworkProcess/NetworkResourceLoadParameters.h:
3928         * NetworkProcess/NetworkResourceLoader.cpp:
3929         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
3930         * NetworkProcess/PingLoad.cpp:
3931         (WebKit::PingLoad::PingLoad):
3932         (WebKit::PingLoad::didReceiveChallenge):
3933         * Shared/Authentication/AuthenticationManager.cpp:
3934         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
3935         * Shared/Authentication/AuthenticationManager.h:
3936         * UIProcess/Network/NetworkProcessProxy.cpp:
3937         (WebKit::NetworkProcessProxy::processAuthenticationChallenge):
3938         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
3939         * UIProcess/Network/NetworkProcessProxy.h:
3940         * UIProcess/Network/NetworkProcessProxy.messages.in:
3941         * UIProcess/WebPageProxy.cpp:
3942         (WebKit::WebPageProxy: