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