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