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