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