Remove duplicate WebsiteDataStoreConfiguration copying code
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-09-25  Alex Christensen  <achristensen@webkit.org>
2
3         Remove duplicate WebsiteDataStoreConfiguration copying code
4         https://bugs.webkit.org/show_bug.cgi?id=202215
5
6         Reviewed by Tim Horton.
7
8         WKWebsiteDataStore's _initWithConfiguration was duplicating the functionality of WebsiteDataStoreConfiguration::copy.
9         The former should just call the latter.
10         This move has the side effect of making _WKWebsiteDataStoreConfiguration's paths readable, which I think is desirable so I added a unit test verifying it is so.
11
12         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
13         (WKWebsiteDataStoreConfigurationCreate):
14         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
15         (-[WKWebsiteDataStore _initWithConfiguration:]):
16         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
17         (-[_WKWebsiteDataStoreConfiguration init]):
18         (-[_WKWebsiteDataStoreConfiguration initNonPersistentConfiguration]):
19         * UIProcess/WebProcessPool.cpp:
20         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
21         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
22         (WebKit::WebsiteDataStore::createNonPersistent):
23         (WebKit::WebsiteDataStore::defaultDataStore):
24         (WebKit::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
25         * UIProcess/WebsiteData/WebsiteDataStore.h:
26         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
27         (WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
28         (WebKit::WebsiteDataStoreConfiguration::copy):
29         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
30         (WebKit::WebsiteDataStoreConfiguration::create):
31         (WebKit::WebsiteDataStoreConfiguration::isPersistent const):
32         (WebKit::WebsiteDataStoreConfiguration::setPersistent): Deleted.
33
34 2019-09-25  Alex Christensen  <achristensen@webkit.org>
35
36         Replace WebsiteDataStoreParameters::privateSessionParameters with re-initializing all sessions immediately upon NetworkProcess resumption
37         https://bugs.webkit.org/show_bug.cgi?id=202211
38
39         Reviewed by Tim Horton.
40
41         Re-adding an ephemeral session after a NetworkProcess crash based on guessing that all its parameters are empty was added in r227590 with a test.
42         That test passes even when that re-adding code is removed because we re-add all sessions with parameters from the UIProcess when we restart a NetworkProcess.
43         I move the addition of non-default sessions to the initialization message instead of messages after the initialization message to remove race conditions that
44         might cause loads to happen before the NetworkProcess has received its second message from the UIProcess.  I also add a unit test to verify that session
45         resumption also works with non-default persistent WebsiteDataStores.
46
47         * NetworkProcess/NetworkProcess.cpp:
48         (WebKit::NetworkProcess::initializeNetworkProcess):
49         * NetworkProcess/NetworkProcessCreationParameters.cpp:
50         (WebKit::NetworkProcessCreationParameters::encode const):
51         (WebKit::NetworkProcessCreationParameters::decode):
52         * NetworkProcess/NetworkProcessCreationParameters.h:
53         * NetworkProcess/NetworkResourceLoader.cpp:
54         (WebKit::NetworkResourceLoader::startNetworkLoad):
55         * NetworkProcess/NetworkSessionCreationParameters.cpp:
56         (WebKit::NetworkSessionCreationParameters::privateSessionParameters): Deleted.
57         * NetworkProcess/NetworkSessionCreationParameters.h:
58         * Shared/WebsiteDataStoreParameters.cpp:
59         (WebKit::WebsiteDataStoreParameters::privateSessionParameters): Deleted.
60         * Shared/WebsiteDataStoreParameters.h:
61         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters): Deleted.
62         * UIProcess/WebProcessPool.cpp:
63         (WebKit::WebProcessPool::ensureNetworkProcess):
64
65 2019-09-25  Alex Christensen  <achristensen@webkit.org>
66
67         Replace _WKProcessPoolConfiguration.CTDataConnectionServiceType with _WKWebsiteDataStoreConfiguration.dataConnectionServiceType
68         https://bugs.webkit.org/show_bug.cgi?id=202174
69
70         Reviewed by Tim Horton.
71
72         _WKProcessPoolConfiguration.CTDataConnectionServiceType is used in one place and needs a replacement so we can
73         start a NetworkProcess without a WKProcessPool.  Since this SPI only does something in the low-level networking code,
74         I verified that the new SPI sets the String the way the old one does, and the old one keeps working in the interim.
75
76         * NetworkProcess/NetworkSessionCreationParameters.cpp:
77         (WebKit::NetworkSessionCreationParameters::encode const):
78         (WebKit::NetworkSessionCreationParameters::decode):
79         * NetworkProcess/NetworkSessionCreationParameters.h:
80         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
81         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
82         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
83         (-[WKWebsiteDataStore _initWithConfiguration:]):
84         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
85         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
86         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
87         (-[_WKWebsiteDataStoreConfiguration dataConnectionServiceType]):
88         (-[_WKWebsiteDataStoreConfiguration setDataConnectionServiceType:]):
89         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
90         (WebKit::WebsiteDataStore::parameters):
91         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
92         (WebKit::WebsiteDataStoreConfiguration::copy):
93         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
94         (WebKit::WebsiteDataStoreConfiguration::dataConnectionServiceType const):
95         (WebKit::WebsiteDataStoreConfiguration::setDataConnectionServiceType):
96
97 2019-09-25  Commit Queue  <commit-queue@webkit.org>
98
99         Unreviewed, rolling out r250336.
100         https://bugs.webkit.org/show_bug.cgi?id=202210
101
102         it is creating failures on iOS bots (Requested by youenn on
103         #webkit).
104
105         Reverted changeset:
106
107         "Make IsNSURLSessionWebSocketEnabled an experimental flag"
108         https://bugs.webkit.org/show_bug.cgi?id=202135
109         https://trac.webkit.org/changeset/250336
110
111 2019-09-25  Youenn Fablet  <youenn@apple.com>
112
113         Creation of a service worker connection for a service worker job should be based on the job scope
114         https://bugs.webkit.org/show_bug.cgi?id=202185
115
116         Reviewed by Alex Christensen.
117
118         * NetworkProcess/NetworkProcess.cpp:
119         (WebKit::NetworkProcess::swServerForSession):
120         Assert that registrable domain is not empty.
121         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
122         (WebKit::WebSWServerConnection::scheduleJobInServer):
123         Use the scope URL instead of the script URL which may be empty in case of an unregister job.
124
125 2019-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
126
127         [iPadOS] [DataActivation] Focus moves away after focusing input fields on www.att.com
128         https://bugs.webkit.org/show_bug.cgi?id=202167
129         <rdar://problem/55185021>
130
131         Reviewed by Tim Horton.
132
133         When using the data activation page on www.att.com, one of the sections on the page contains several select
134         elements; in the case where the user agent:
135
136         1. contains the string "iPad", and
137         2. does not contain the string "Safari"
138
139         ...www.att.com's data activation page will opt into a mode where it adds blur event listeners to the select
140         elements; in this blur event listener, www.att.com proceeds to programmatically focus a non-editable div element
141         after a 1 second timeout. The reasons for this behavior remain unclear to me, though it's worth noting that the
142         blur event handler name is "screenReaderFocus", which suggests that this is in place to ensure compatibility
143         with screen readers.
144
145         In iOS 12, dismissing the popover would blur the focused select menu with an animation. Since the animation
146         would take a slightly less than 1 second, www.att.com's logic would have the effect of moving focus to the div
147         element shortly after dismissing the select menu. However, after r243808, we no longer attempt to blur the
148         focused select element when dismissing the popover. This means that the select element is only blurred the next
149         time the user activates another focused element, such as one of the input fields on the page, or a different
150         select element. Consequently, the logic to move focus into a div element now occurs only after a different
151         element has already been focused; this results in focus moving away from newly focused elements after 1 second
152         in the case where a select element has previously focused.
153
154         To mitigate this, restore iOS 12 behavior behind a site- and app-specific quirk. See comments below for more
155         details.
156
157         * Shared/FocusedElementInformation.cpp:
158         (WebKit::FocusedElementInformation::encode const):
159         (WebKit::FocusedElementInformation::decode):
160         * Shared/FocusedElementInformation.h:
161
162         Add a new behavioral quirk flag to FocusedElementInformation to determine whether we should use "legacy" select
163         popover dismissal behavior (i.e. blurring the focused select element when dismissing the select popover, as well
164         as dismissing the popover with animation).
165
166         * Shared/WebPreferences.yaml:
167
168         Enable site-specific quirks by default in WKWebView. With regards to this bug, this change allows for
169         site-specific hacks (namely, legacy select popover dismissal) in DataActivation. However, this also fixes
170         various known bugs that are otherwise addressed in Safari only, via site-specific quirks.
171
172         * UIProcess/API/Cocoa/WKWebView.mm:
173         (-[WKWebView _initializeWithConfiguration:]):
174
175         For apps linked on or before iOS 13 and macOS 10.15, revert the default of value of NeedsSiteSpecificQuirks to
176         false. This is done here instead of in a default value function in WebPreferencesDefaultValues to prevent the
177         default values of NeedsSiteSpecificQuirks in the web process and UI process from going out of sync, since the
178         web process is not necessarily linked against the same SDK as the application.
179
180         * UIProcess/Cocoa/VersionChecks.h:
181
182         Add a new DYLD version check for the first version of iOS and macOS where site-specific quirks are enabled by
183         default.
184
185         * UIProcess/ios/WKContentViewInteraction.h:
186         * UIProcess/ios/WKContentViewInteraction.mm:
187         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]):
188         (-[WKContentView _elementDidBlur]):
189         (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]):
190
191         We only use "legacy" select popover dismissal behavior in the case where the site-specific quirk flag is on, a
192         select popover is used (i.e. the device is an iPad and a select element is focused), and the application bundle
193         is "com.apple.DataActivation".
194
195         * UIProcess/ios/forms/WKFormSelectPopover.mm:
196         (-[WKSelectTableViewController shouldDismissWithAnimation]):
197
198         Keyed off of _shouldUseLegacySelectPopoverDismissalBehavior.
199
200         (-[WKSelectPopover controlEndEditing]):
201         * WebProcess/WebPage/ios/WebPageIOS.mm:
202         (WebKit::WebPage::getFocusedElementInformation):
203
204 2019-09-25  Jonathan Bedard  <jbedard@apple.com>
205
206         Unreviewed, rolling out r250324.
207
208         Broke many mac wk2 layout tests
209
210         Reverted changeset:
211
212         "Enable LayoutTests using ResourceLoadStatistics SQLite
213         backend (195420)"
214         https://bugs.webkit.org/show_bug.cgi?id=195420
215         https://trac.webkit.org/changeset/250324
216
217 2019-09-25  Youenn Fablet  <youenn@apple.com>
218
219         Make IsNSURLSessionWebSocketEnabled an experimental flag
220         https://bugs.webkit.org/show_bug.cgi?id=202135
221
222         Reviewed by Geoffrey Garen.
223
224         * Shared/WebPreferences.yaml:
225
226 2019-09-24  Chris Dumez  <cdumez@apple.com>
227
228         [iOS] Regression(r249703) frequent 'kill() returned unexpected error' log messages
229         https://bugs.webkit.org/show_bug.cgi?id=202173
230
231         Reviewed by Geoffrey Garen.
232
233         The kill(pid, 0) command actually fails with an EPERM error when there is a process
234         running with the given pid, and this is causing us to log a lot of errors. The good
235         news is that we merely want to know that there is no process with the given PID and
236         we correctly get a ESRCH error in this case. I renamed the function from
237         isRunningProcessPID() to wasTerminated() and only check for ESRCH error now. I no
238         longer log any error otherwise since this is expected.
239
240         Also, for performance reason, I no longer call kill(pid, 0) from inside
241         AuxiliaryProcessProxy::state() as it gets called a lot. I instead only call it from
242         AuxiliaryProcessProxy::wasTerminated() and call it from
243         WebProcessPool::tryTakePrewarmedProcess().
244
245         * UIProcess/AuxiliaryProcessProxy.cpp:
246         (WebKit::AuxiliaryProcessProxy::state const):
247         (WebKit::AuxiliaryProcessProxy::wasTerminated const):
248         (WebKit::AuxiliaryProcessProxy::isRunningProcessPID): Deleted.
249         * UIProcess/AuxiliaryProcessProxy.h:
250         * UIProcess/WebProcessPool.cpp:
251         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
252
253 2019-09-24  Christopher Reid  <chris.reid@sony.com>
254
255         [WinCairo] Start RemoteInspectorServer
256         https://bugs.webkit.org/show_bug.cgi?id=199938
257         <rdar://problem/53323048>
258
259         Reviewed by Fujii Hironori.
260
261         Enable the remote inspector client on WinCairo.
262         The inspector server will run if the WEBKIT_INSPECTOR_SERVER environment variable is set.
263         WEBKIT_INSPECTOR_SERVER needs to be set in the form of <ip>:port e.g. WEBKIT_INSPECTOR_SERVER=127.0.0.1:1234.
264
265         Updated the protocol handler to update the target list with DOM manipulation.
266
267         * UIProcess/socket/RemoteInspectorClient.cpp:
268         * UIProcess/socket/RemoteInspectorClient.h:
269         * UIProcess/socket/RemoteInspectorProtocolHandler.cpp:
270         * UIProcess/socket/RemoteInspectorProtocolHandler.h:
271         * UIProcess/win/WebView.cpp:
272
273 2019-09-24  Kate Cheney  <katherine_cheney@apple.com>
274
275         Enable LayoutTests using ResourceLoadStatistics SQLite backend (195420)
276         https://bugs.webkit.org/show_bug.cgi?id=195420
277         <rdar://problem/54213551>
278
279         Reviewed by Brent Fulgham.
280
281         Changed all RELEASE_LOG_ERROR() calls involving domain strings to
282         RELEASE_LOG_ERROR_IF_ALLOWED() to prevent leaking information about
283         the domain strings only if sessionID.isAlwaysOnLoggingAllowed().
284
285         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
286         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
287         Added autovacuuming to the constructor to avoid manually calling
288         runVacuumCommand(). Changed constructor to take in sessionID so it
289         can use RELEASE_LOG_ERROR_IF_ALLOWED which requires the sessionID.
290
291         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
292         Added 2 statements that were not being prepared.
293
294         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
295         Corrected incorrect capitalization. Added check for nullopt in case
296         domainID is for a domain not in the database yet.
297
298         (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
299         Changed return value to Optional<unsigned>. Some tests were directly
300         checking for subframes under top frame domains on domains that had
301         not been inserted yet. Now, domainID() won't crash but will return
302         a nullopt value which can be checked to know that the tests failed.
303
304         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
305         Added a check to assure domainID exists and updated the domainID
306         interactions to work as Optionals.
307
308         (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
309         Moved the prepareStatements() call after the vacuum command in the case
310         where the database is empty. Otherwise called it before returning.
311
312         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
313         Added a space to the SQL commands to correct the syntax.
314
315         (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
316         Corrected a bug in the SQL command for querying
317         subframeUnderTopFrameDomain. The old query was asking for subresource.
318
319         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
320         Spelling fix.
321
322         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
323         Changed string concatenation to binding.
324
325         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
326         The grandfathering.html test was failing because domains were being
327         "set" to grandfathered in the database before being inserted. This fix
328         ensures all domains before setting the grandfathering flag.
329
330         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
331         Multiple tests were failing because the query to insert the relationship
332         for the source domain relies on the target domain being in the
333         ObservedDomains table. This patch ensures all domains are added before
334         performing the query.
335
336         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
337         Added a != SQLITE_OK check to make sure an error is logged if the
338         statement fails to bind.
339
340         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
341         Changed string concatenation to binding.
342
343         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):   
344         The SQL statement was being bound to a value and not being reset. This
345         patch resets the statement after binding. Additionally, the step()
346         function was being compared to SQLITE_DONE instead of SQLITE_ROW,
347         causing an error if the query returned results. The
348         ASSERT_NOT_REACHED() was causing null searches to crash instead of
349         returning false (i.e. if a domain is not in the database it should
350         return that it has no user interaction instead of crashing).
351
352         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource): 
353         Updated domainID call to act as an Optional. 
354         
355         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
356         The SQL statement was being bound to a value and not being reset. This
357         patch resets the statement after binding. SQLITE_DONE changed to
358         SQLITE_ROW to return non-empty query results. ASSERT_NOT_REACHED()
359         removed for the same reasons as above. 
360
361         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain):
362         Fixed the release log statement which was logging the wrong function 
363         name.
364
365         (WebKit::ResourceLoadStatisticsDatabaseStore::clearDatabaseContents): 
366         Clears the database and rebuilds the tables on a clear command to
367         match the functionality in the Memory Store.
368
369         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):                   
370         Call the clearDatabaseContents function to match the functionality 
371         in the Memory Store. 
372
373         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const):
374         Updated domainID call to act as an Optional. 
375
376         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUnexpiredRecentUserInteraction):
377         Tests were failing because shouldRemoveAllWebsiteDataFor() was not 
378         checking for expired user interaction. Matched functionality in the
379         Memory Store.
380
381         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor):
382         Tests were failing because shouldRemoveAllWebsiteDataFor() was not 
383         checking for expired user interaction. Matched functionality in the
384         Memory Store. 
385
386         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
387         Spelling fix. 
388
389         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded): 
390         Last seen should be sorted in ascending order because you want to 
391         prune the older statistics first, which will have a lower lastSeen
392         field (secondsSinceEpoch() will be lower for older values).
393
394         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const): Deleted.
395         Deleted const specifier because the function needs to clear the
396         database. 
397
398         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:      
399         Declared new functions. Updated spelling error (registerable --> 
400         registrable). Updated constructor to take sessionID. 
401
402         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 
403         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
404         ITP database flag now is stored in the NetworkProcess.
405         * NetworkProcess/NetworkProcess.cpp: 
406
407         (WebKit::NetworkProcess::initializeNetworkProcess): 
408         Set the ITP database flag which is now stored in the Network Process. 
409
410         (WebKit::NetworkProcess::addWebsiteDataStore):
411         SandboxExtension::consumePermanently was not getting called on the 
412         WebKitTestRunner resourceLoadStatistics path. This was preventing
413         the database file from opening. 
414
415         (WebKit::NetworkProcess::setUseITPDatabase): 
416         * NetworkProcess/NetworkProcess.h:
417         (WebKit::NetworkProcess::isITPDatabaseEnabled const):
418         * NetworkProcess/NetworkProcess.messages.in:
419         Passed the setUseITPDatabase flag to the initialization function 
420         of the statistics store to enable the database backend.
421
422         * NetworkProcess/NetworkSession.cpp:
423         (WebKit::NetworkSession::recreateResourceLoadStatisticStore):
424         Destroy old WebResourceLoadStatisticsStore and create a new one using
425         the ITP database.
426
427         * NetworkProcess/NetworkSession.h:
428         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
429         (WKWebsiteDataStoreSetUseITPDatabase):
430         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
431         * UIProcess/Network/NetworkProcessProxy.cpp:
432         (WebKit::NetworkProcessProxy::setUseITPDatabase):
433         * UIProcess/Network/NetworkProcessProxy.h:
434         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
435         (WebKit::WebsiteDataStore::setUseITPDatabase):
436         * UIProcess/WebsiteData/WebsiteDataStore.h:
437         Passed the setUseITPDatabase flag to the initialization function
438         of the statistics store to enable the database backend. 
439
440 2019-09-24  Alex Christensen  <achristensen@webkit.org>
441
442         Make iOS WebProcessPool directory getters static
443         https://bugs.webkit.org/show_bug.cgi?id=202157
444
445         Reviewed by Tim Horton.
446
447         No change in behavior.  This just cuts another dependency the NetworkProcessProxy has on its owning WebProcessPool.
448
449         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
450         (WebKit::WebProcessPool::cookieStorageDirectory):
451         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
452         (WebKit::WebProcessPool::parentBundleDirectory):
453         (WebKit::WebProcessPool::networkingCachesDirectory):
454         (WebKit::WebProcessPool::webContentCachesDirectory):
455         (WebKit::WebProcessPool::containerTemporaryDirectory):
456         (WebKit::WebProcessPool::cookieStorageDirectory const): Deleted.
457         (WebKit::WebProcessPool::parentBundleDirectory const): Deleted.
458         (WebKit::WebProcessPool::networkingCachesDirectory const): Deleted.
459         (WebKit::WebProcessPool::webContentCachesDirectory const): Deleted.
460         (WebKit::WebProcessPool::containerTemporaryDirectory const): Deleted.
461         * UIProcess/WebProcessPool.cpp:
462         (WebKit::WebProcessPool::ensureNetworkProcess):
463         * UIProcess/WebProcessPool.h:
464
465 2019-09-24  Patrick Griffis  <pgriffis@igalia.com>
466
467         [GTK][WPE] Minor code cleanup in BubblewrapLauncher
468         https://bugs.webkit.org/show_bug.cgi?id=201906
469
470         This just cleans up string handling and some
471         whitespace fixes.
472
473         Reviewed by Carlos Garcia Campos.
474
475         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
476         (WebKit::XDGDBusProxyLauncher::setAddress):
477         (WebKit::XDGDBusProxyLauncher::launch):
478         (WebKit::XDGDBusProxyLauncher::makeProxyPath):
479         (WebKit::XDGDBusProxyLauncher::dbusAddressToPath):
480
481 2019-09-24  Zalan Bujtas  <zalan@apple.com>
482
483         [iPadOs] The second click event is missing on double tap when dblclick handler is not present
484         https://bugs.webkit.org/show_bug.cgi?id=202006
485         <rdar://problem/51706828>
486
487         Reviewed by Wenson Hsieh.
488
489         While double tapping,
490         1. the first tap triggers a click event through the normal _singleTapIdentified/_singleTapRecognized codepath.
491         2. and the second tap should trigger either
492           a second single click event or
493           a second single click followed by a dblclick event when dblclick handler is present.
494         However the second click is dropped on the floor when the node under the cursor does not have a dblclick handler (see handleDoubleTapForDoubleClickAtPoint()) -so we end up sending one click event.
495
496         This patch fixes this case by sending the second tap through the normal single tap flow when the dblclick handler is not present.
497
498         * Shared/ios/InteractionInformationAtPosition.h:
499         * Shared/ios/InteractionInformationAtPosition.mm:
500         (WebKit::InteractionInformationAtPosition::encode const):
501         (WebKit::InteractionInformationAtPosition::decode):
502         * UIProcess/ios/WKContentViewInteraction.h:
503         * UIProcess/ios/WKContentViewInteraction.mm:
504         (-[WKContentView setupInteraction]):
505         (-[WKContentView gestureRecognizerShouldBegin:]):
506         (WebKit::WebPage::positionInformation):
507         (WebKit::WebPage::requestPositionInformation):
508
509 2019-09-24  Alex Christensen  <achristensen@webkit.org>
510
511         Move HSTS storage directory to LegacyGlobalSettings
512         https://bugs.webkit.org/show_bug.cgi?id=202059
513
514         Reviewed by Tim Horton.
515
516         I continue my lamentation begun in r245075.
517         Remove the glib setting of it on the WebKitWebContext because they use it on the WebsiteDataStore.  We should do that too when we can.
518
519         * UIProcess/API/APIProcessPoolConfiguration.cpp:
520         (API::ProcessPoolConfiguration::copy):
521         * UIProcess/API/APIProcessPoolConfiguration.h:
522         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
523         (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]):
524         (-[_WKProcessPoolConfiguration hstsStorageDirectory]):
525         * UIProcess/LegacyGlobalSettings.h:
526         (WebKit::LegacyGlobalSettings::setHSTSStorageDirectory):
527         (WebKit::LegacyGlobalSettings::hstsStorageDirectory const):
528         * UIProcess/WebProcessPool.cpp:
529         (WebKit::WebProcessPool::ensureNetworkProcess):
530
531 2019-09-24  Keith Rollin  <krollin@apple.com>
532
533         Coalesce or remove PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
534         https://bugs.webkit.org/show_bug.cgi?id=202119
535         <rdar://problem/55638792>
536
537         Reviewed by Alex Christensen.
538
539         After refactoring and other code evolution, some platform checks have
540         ended up looking like PLATFORM(MAC) || PLATFORM(IOS_FAMILY) (or
541         vice-versa). These can be converted into the equivalent
542         PLATFORM(COCOA). Where the instance occurs in a Cocoa-only file, the
543         check can be removed altogether (along with any "#else" branches).
544
545         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
546         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
547         * WebProcess/WebCoreSupport/WebChromeClient.h:
548
549 2019-09-24  Wenson Hsieh  <wenson_hsieh@apple.com>
550
551         FocusPreservationTests.ChangingFocusedNodeResetsFocusPreservationState triggers a debug assertion
552         https://bugs.webkit.org/show_bug.cgi?id=202145
553         <rdar://problem/51273128>
554
555         Reviewed by Tim Horton.
556
557         Fixes an assertion in -tableView:cellForRowAtIndexPath: to only require the cell to have a non-zero
558         width in the case where the table view itself has a non-empty width. When run under TestWebKitAPI,
559         this assertion currently fires because the view controller used to show the popover isn't actually
560         presented, so the view controller's view (i.e. the UITableView) ends up being empty. This causes all
561         of its table view cells to subsequently become empty upon reuse.
562
563         * UIProcess/ios/forms/WKFormSelectPopover.mm:
564         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
565
566 2019-09-24  Alex Christensen  <achristensen@webkit.org>
567
568         Require a WebsiteDataStore when creating or resuming downloads
569         https://bugs.webkit.org/show_bug.cgi?id=202081
570
571         Reviewed by Youenn Fablet.
572
573         No change in behavior, but I'll have to move Safari to the new SPI.
574         This makes it so there are no cases where we guess we need to use the default session,
575         and it allows downloads to function correctly once there is a NetworkProcess singleton.
576         Removing the unused WebProcessPool& in the callbacks will allow us to eventually have
577         downloads only associated with a WebsiteDataStore and not a WebProcessPool.
578
579         * UIProcess/API/APIDownloadClient.h:
580         (API::DownloadClient::didStart):
581         (API::DownloadClient::didReceiveAuthenticationChallenge):
582         (API::DownloadClient::didReceiveResponse):
583         (API::DownloadClient::didReceiveData):
584         (API::DownloadClient::decideDestinationWithSuggestedFilename):
585         (API::DownloadClient::didCreateDestination):
586         (API::DownloadClient::didFinish):
587         (API::DownloadClient::didFail):
588         (API::DownloadClient::didCancel):
589         (API::DownloadClient::processDidCrash):
590         (API::DownloadClient::willSendRequest):
591         * UIProcess/API/C/WKContext.cpp:
592         (WKContextSetDownloadClient):
593         (WKContextDownloadURLRequest):
594         (WKContextResumeDownload):
595         * UIProcess/API/C/WKContext.h:
596         * UIProcess/API/Cocoa/WKProcessPool.mm:
597         (-[WKProcessPool _setDownloadDelegate:]):
598         (-[WKProcessPool _downloadURLRequest:originatingWebView:]):
599         (-[WKProcessPool _resumeDownloadFromData:path:originatingWebView:]):
600         (-[WKProcessPool _downloadURLRequest:websiteDataStore:originatingWebView:]):
601         (-[WKProcessPool _resumeDownloadFromData:websiteDataStore:path:originatingWebView:]):
602         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
603         * UIProcess/API/glib/WebKitDownloadClient.cpp:
604         * UIProcess/API/glib/WebKitWebContext.cpp:
605         (webkitWebContextDispose):
606         (webkitWebContextStartDownload):
607         * UIProcess/Cocoa/DownloadClient.h:
608         * UIProcess/Cocoa/DownloadClient.mm:
609         (WebKit::DownloadClient::didStart):
610         (WebKit::DownloadClient::didReceiveResponse):
611         (WebKit::DownloadClient::didReceiveData):
612         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
613         (WebKit::DownloadClient::didCreateDestination):
614         (WebKit::DownloadClient::processDidCrash):
615         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
616         (WebKit::DownloadClient::didFinish):
617         (WebKit::DownloadClient::didFail):
618         (WebKit::DownloadClient::didCancel):
619         (WebKit::DownloadClient::willSendRequest):
620         * UIProcess/Downloads/DownloadProxy.cpp:
621         (WebKit::DownloadProxy::create):
622         (WebKit::DownloadProxy::DownloadProxy):
623         (WebKit::DownloadProxy::invalidate):
624         (WebKit::DownloadProxy::processDidClose):
625         (WebKit::DownloadProxy::didStart):
626         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
627         (WebKit::DownloadProxy::willSendRequest):
628         (WebKit::DownloadProxy::didReceiveResponse):
629         (WebKit::DownloadProxy::didReceiveData):
630         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
631         (WebKit::DownloadProxy::didCreateDestination):
632         (WebKit::DownloadProxy::didFinish):
633         (WebKit::DownloadProxy::didFail):
634         (WebKit::DownloadProxy::didCancel):
635         * UIProcess/Downloads/DownloadProxy.h:
636         * UIProcess/Downloads/DownloadProxyMap.cpp:
637         (WebKit::DownloadProxyMap::createDownloadProxy):
638         * UIProcess/Downloads/DownloadProxyMap.h:
639         * UIProcess/Network/NetworkProcessProxy.cpp:
640         (WebKit::NetworkProcessProxy::createDownloadProxy):
641         * UIProcess/Network/NetworkProcessProxy.h:
642         * UIProcess/WebPageProxy.cpp:
643         (WebKit::WebPageProxy::receivedPolicyDecision):
644         (WebKit::WebPageProxy::contextMenuItemSelected):
645         * UIProcess/WebProcessPool.cpp:
646         (WebKit::WebProcessPool::WebProcessPool):
647         (WebKit::WebProcessPool::setDownloadClient):
648         (WebKit::WebProcessPool::download):
649         (WebKit::WebProcessPool::resumeDownload):
650         (WebKit::WebProcessPool::createDownloadProxy):
651         * UIProcess/WebProcessPool.h:
652
653 2019-09-24  Youenn Fablet  <youenn@apple.com>
654
655         Delay capture sandbox extension revocation to after the page close message is sent
656         https://bugs.webkit.org/show_bug.cgi?id=202133
657
658         Reviewed by Eric Carlson.
659
660         This ensures that the sandbox extension is removed once no longer useful
661         and makes our WebProcess assertions fine.
662
663         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
664         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
665
666 2019-09-23  Chris Dumez  <cdumez@apple.com>
667
668         Drop unnecessary SessionID.h header includes
669         https://bugs.webkit.org/show_bug.cgi?id=202129
670
671         Reviewed by Alex Christensen.
672
673         * NetworkProcess/AdClickAttributionManager.h:
674         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
675         * NetworkProcess/NetworkLoadParameters.h:
676         * NetworkProcess/RemoteNetworkingContext.h:
677         * NetworkProcess/cache/CacheStorageEngine.cpp:
678         * NetworkProcess/cache/CacheStorageEngine.h:
679         * NetworkProcess/cache/NetworkCache.h:
680         * NetworkProcess/webrtc/NetworkRTCProvider.h:
681         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
682         * Shared/Authentication/AuthenticationManager.h:
683         * Shared/WebCoreArgumentCoders.cpp:
684         * Shared/WebProcessCreationParameters.h:
685         * UIProcess/API/APIPageConfiguration.h:
686         * WebProcess/Cache/WebCacheStorageProvider.h:
687         * WebProcess/Databases/WebDatabaseProvider.cpp:
688         * WebProcess/InjectedBundle/InjectedBundle.cpp:
689         * WebProcess/InjectedBundle/InjectedBundle.h:
690         * WebProcess/Network/WebSocketChannel.h:
691         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
692         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
693         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
694         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
695         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h:
696         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
697         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
698         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
699         * WebProcess/WebPage/WebFrame.h:
700
701 2019-09-23  Chris Dumez  <cdumez@apple.com>
702
703         PlugInClient::didStartFromOrigin() does not need a sessionID
704         https://bugs.webkit.org/show_bug.cgi?id=202127
705
706         Reviewed by Geoffrey Garen.
707
708         * WebProcess/WebCoreSupport/WebPlugInClient.cpp:
709         (WebKit::WebPlugInClient::didStartFromOrigin):
710         * WebProcess/WebCoreSupport/WebPlugInClient.h:
711
712 2019-09-23  Chris Dumez  <cdumez@apple.com>
713
714         FrameSpecificStorageAccessIdentifier does not need a sessionID
715         https://bugs.webkit.org/show_bug.cgi?id=202093
716
717         Reviewed by Geoffrey Garen.
718
719         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
720         * WebProcess/WebPage/WebPage.cpp:
721         (WebKit::WebPage::requestStorageAccess):
722
723 2019-09-23  Tim Horton  <timothy_horton@apple.com>
724
725         macOS: <datalist> dropdown shadow is cropped, looks nothing like NSComboBox
726         https://bugs.webkit.org/show_bug.cgi?id=199350
727
728         Reviewed by Wenson Hsieh.
729
730         Improve the appearance of the macOS <datalist> dropdown, adopting the
731         roundly-cornered and backdrop-ful appearance of the current NSComboBox style.
732
733         Use the proper window shadow instead of our own inside the window, both
734         so that we match the system and so that it doesn't get clipped.
735
736         Allow vertical rubber-banding, because NSComboBox does.
737
738         Don't highlight on hover, because NSComboBox doesn't. Do use NSTableView's
739         selection mechanism instead of rolling our own for highlights driven by
740         keyboard-based navigation.
741
742         Make use of NSTableCellView, since it has some smarts around pixel alignment
743         that we don't need to duplicate (and things are blurry on 1x displays without).
744
745         Also rename some classes to make it a bit more clear what's going on:
746         WKDataListSuggestionCell -> WKDataListSuggestionView (it's a NSView, not an NSCell)
747         WKDataListSuggestionsView -> WKDataListSuggestionsController (it's not a view at all)
748
749         * Platform/spi/mac/AppKitSPI.h:
750         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
751         (WebKit::WebDataListSuggestionsDropdownMac::show):
752         (-[WKDataListSuggestionWindow initWithContentRect:styleMask:backing:defer:]):
753         (-[WKDataListSuggestionWindow canBecomeKeyWindow]):
754         (-[WKDataListSuggestionWindow hasKeyAppearance]):
755         (-[WKDataListSuggestionWindow shadowOptions]):
756         (-[WKDataListSuggestionView initWithFrame:]):
757         (-[WKDataListSuggestionView setText:]):
758         (-[WKDataListSuggestionView setBackgroundStyle:]):
759         (-[WKDataListSuggestionTableRowView drawSelectionInRect:]):
760         (-[WKDataListSuggestionTableView initWithElementRect:]):
761         (-[WKDataListSuggestionTableView layout]):
762         (-[WKDataListSuggestionTableView reload]):
763         (-[WKDataListSuggestionsController initWithInformation:inView:]):
764         (-[WKDataListSuggestionsController currentSelectedString]):
765         (-[WKDataListSuggestionsController updateWithInformation:]):
766         (-[WKDataListSuggestionsController moveSelectionByDirection:]):
767         (-[WKDataListSuggestionsController invalidate]):
768         (-[WKDataListSuggestionsController dropdownRectForElementRect:]):
769         (-[WKDataListSuggestionsController showSuggestionsDropdown:]):
770         (-[WKDataListSuggestionsController tableView:rowViewForRow:]):
771         (-[WKDataListSuggestionsController tableView:viewForTableColumn:row:]):
772         (-[WKDataListSuggestionCell initWithFrame:]): Deleted.
773         (-[WKDataListSuggestionCell setText:]): Deleted.
774         (-[WKDataListSuggestionCell setActive:]): Deleted.
775         (-[WKDataListSuggestionCell drawRect:]): Deleted.
776         (-[WKDataListSuggestionCell mouseEntered:]): Deleted.
777         (-[WKDataListSuggestionCell mouseExited:]): Deleted.
778         (-[WKDataListSuggestionCell acceptsFirstResponder]): Deleted.
779         (-[WKDataListSuggestionTable initWithElementRect:]): Deleted.
780         (-[WKDataListSuggestionTable setVisibleRect:]): Deleted.
781         (-[WKDataListSuggestionTable currentActiveRow]): Deleted.
782         (-[WKDataListSuggestionTable setActiveRow:]): Deleted.
783         (-[WKDataListSuggestionTable reload]): Deleted.
784         (-[WKDataListSuggestionTable acceptsFirstResponder]): Deleted.
785         (-[WKDataListSuggestionTable enclosingScrollView]): Deleted.
786         (-[WKDataListSuggestionTable removeFromSuperviewWithoutNeedingDisplay]): Deleted.
787         (-[WKDataListSuggestionsView initWithInformation:inView:]): Deleted.
788         (-[WKDataListSuggestionsView currentSelectedString]): Deleted.
789         (-[WKDataListSuggestionsView updateWithInformation:]): Deleted.
790         (-[WKDataListSuggestionsView moveSelectionByDirection:]): Deleted.
791         (-[WKDataListSuggestionsView invalidate]): Deleted.
792         (-[WKDataListSuggestionsView dropdownRectForElementRect:]): Deleted.
793         (-[WKDataListSuggestionsView showSuggestionsDropdown:]): Deleted.
794         (-[WKDataListSuggestionsView selectedRow:]): Deleted.
795         (-[WKDataListSuggestionsView numberOfRowsInTableView:]): Deleted.
796         (-[WKDataListSuggestionsView tableView:heightOfRow:]): Deleted.
797         (-[WKDataListSuggestionsView tableView:viewForTableColumn:row:]): Deleted.
798
799 2019-09-23  Wenson Hsieh  <wenson_hsieh@apple.com>
800
801         [iOS] Drop animation when dragging images from Photos to WebKit2 Mail compose is incorrect
802         https://bugs.webkit.org/show_bug.cgi?id=201674
803         <rdar://problem/51250952>
804
805         Reviewed by Tim Horton.
806
807         Our current logic for handling dropped content in editable elements on iOS works like this in the ideal case:
808
809         (1)     UIKit asks us for a targeted preview for each UIDragItem. We don't know (and can't determine this
810                 synchronously without blocking on the web process) so we simply retarget the preview to animate to the
811                 last known caret location.
812
813         (2)     Soonafter, UIKit hands us a drop preview update block, which may be used to retarget the drop preview
814                 once, as long as the drop animation is less than 90% complete. We stash these update blocks for now.
815
816         (3)     -dropInteraction:performDrop: is then called, and we start loading item provider data right away.
817
818         (4)     When the data has finished loading, we perform the drop in the web process. After any inserted images
819                 have finished loading, we take snapshots (of the dropped content as well as surrounding web content
820                 minus the dropped content), and deliver these images to the UI process via TextIndicatorData.
821
822         (5)     Upon receiving the TextIndicatorData sent in (4), we use the image data to create updated targeted drag
823                 previews, and use these to invoke the preview update blocks we stored earlier in (2). We also obscure
824                 the entire web view with a snapshot of the view minus any dropped content, such that the updated drop
825                 previews may animate into place without also showing the final content.
826
827         (6)     When the drop animation ends, we remove the unselected content snapshot view added in (5) simultaneously
828                 as the targeted previews disappear, revealing the actual dropped content on the page. The drop is now
829                 complete.
830
831         However, note that the drag update block we invoke in (5) doesn't work if the drop animation is already more
832         than 90% complete. Since the lifecycle of the drop animation is distinct from that of item provider loading, if
833         the delay between (3) and (4) exceeds 90% of the total drop animation time, we'll fail to update the targeted
834         previews, such that the user only sees the initial drag preview fly on top of the caret and disappear. While we
835         typically win this race for data dragged from other WebKit apps, we almost always lose when dragging from Photos
836         and end up with a janky drop animation. This is especially true for any images that aren't locally available,
837         and need to be fetched from iCloud. An additional problem is that in step (5), we use the same final snapshot to
838         update the drop preview of every item, since we don't have a snapshot for the fragment corresponding to each
839         individual dropped item.
840
841         To address these issues for Mail in the case where the user drops images with known sizes (i.e. -[NSItemProvider
842         preferredPresentationSize] is specified), we introduce an alternate codepath for handling dropped images that
843         performs the drop immediately upon receiving -dropInteraction:performDrop: in the UI process. Since the data has
844         yet to arrive, we instead handle the drop by inserting placeholder image elements at the drag caret position,
845         which initially have no source but are sized to fit their expected final image sizes. After doing so, we
846         snapshot the page (minus the dropped content range, as usual) and deliver this snapshot to the UI process, along
847         with the rects (in root view coordinates) of each placeholder image that was inserted. In the UI process, we
848         then take this snapshot and obscure the content view with it, and also use each of the placeholder rects to
849         provide an updated target for each drag preview, such that the drop previews now animate to their final
850         locations on the page.
851
852         When the data eventually arrives, we handle the drop by detecting the placeholder elements we inserted earlier,
853         and using the dropped data to update the source attribute and attachment backing for each of these placeholder
854         elements instead of attempting to insert new content.
855
856         Note that this codepath is currently only enabled for SPI clients that set -[WKWebView _editable] to YES, since
857         it involves us performing the editing action for the drop (thus changing the DOM) prior to the preventable drop
858         event, and prior to us having any data at all. However, the drop event can't come before the editing action,
859         since we need to have already loaded data from the item providers to expose it via the dataTransfer of the drop
860         event. This contradiction means that this image placeholder hack is only for _editable SPI clients that, at the
861         very least, will not require preventing default behavior when dropping only images with predetermined sizes.
862
863         Covered by 2 new API tests. See comments below for more detail.
864
865         * UIProcess/WebPageProxy.h:
866         * UIProcess/ios/DragDropInteractionState.h:
867         * UIProcess/ios/DragDropInteractionState.mm:
868         (WebKit::DragDropInteractionState::setDefaultDropPreview):
869
870         Add a way to keep track of default drop previews that we observed during each call to
871         -dropInteraction:previewForDroppingItem:withDefault:. In the image placeholder drop scenario, we use these
872         default drop previews later on to create retargeted drop previews after the placeholders have been inserted.
873
874         (WebKit::DragDropInteractionState::defaultDropPreview const):
875         (WebKit::DragDropInteractionState::deliverDelayedDropPreview):
876
877         Add an alternate version of deliverDelayedDropPreview that is used when inserting image placeholders. Rather
878         than use text indicator data of the final dropped content on the page, use the root-view-coordinate rects of
879         each of the placeholder elements to reposition the default drop previews.
880
881         There's additional logic here to handle the case where the final image is taller than the height of the
882         unobscured content rect, in which case we clip the drop preview using UIDragPreviewParameter's visiblePath to
883         prevent the drop preview from being shown outside of the bounds of the web view.
884
885         * UIProcess/ios/WKContentViewInteraction.h:
886         * UIProcess/ios/WKContentViewInteraction.mm:
887         (-[WKContentView _deliverDelayedDropPreviewIfPossible:]):
888         (sizesOfPlaceholderElementsToInsertWhenDroppingItems):
889
890         Collects the list of expected image sizes for the dropped item providers, or an empty list in the case where
891         any of the item providers may not be represented as inline images or do not have predetermined sizes.
892
893         (-[WKContentView _handleDropByInsertingImagePlaceholders:session:]):
894
895         If possible, handles the drop by inserting image placeholders instead of waiting for the data to finish loading
896         before dropping. Returns whether or not we decided to proceed with the image placeholder drop.
897
898         (-[WKContentView dropInteraction:performDrop:]):
899         (-[WKContentView dropInteraction:item:willAnimateDropWithAnimator:]):
900
901         Fixes a bug where the unselected content snapshot view could linger around on the web view forever after a drop
902         where the data doesn't load in time for the drop to finish by keeping track of whether there is an actively
903         animating drag item, and only applying the unselected content snapshot if so.
904
905         (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):
906
907         Stash the default drop preview away here.
908
909         * UIProcess/ios/WebPageProxyIOS.mm:
910         (WebKit::WebPageProxy::insertDroppedImagePlaceholders):
911         * WebProcess/WebPage/WebPage.h:
912         * WebProcess/WebPage/WebPage.messages.in:
913         * WebProcess/WebPage/ios/WebPageIOS.mm:
914         (WebKit::WebPage::insertDroppedImagePlaceholders):
915
916         See WebCore ChangeLog for more information.
917
918         (WebKit::WebPage::didFinishLoadingImageForElement):
919
920         If the image that finished loading is a dropped image placeholder, allow DragController to "finalize" it by
921         stripping away some styles that were temporarily added.
922
923 2019-09-23  Alex Christensen  <achristensen@webkit.org>
924
925         REGRESSION(250143) Disk cache should be enabled for Safari
926         https://bugs.webkit.org/show_bug.cgi?id=202117
927
928         Reviewed by Brady Eidson.
929
930         r250143 made it so in Safari, when setCacheModel is called for the first time in NetworkProcess::initializeNetworkProcess,
931         it didn't have a path to check available disk space.  This resulted in disabling the disk cache in Safari, which caused a
932         huge performance regression.
933
934         * NetworkProcess/NetworkProcess.cpp:
935         (WebKit::NetworkProcess::initializeNetworkProcess):
936         (WebKit::NetworkProcess::setCacheModel):
937         * NetworkProcess/NetworkProcess.h:
938         (WebKit::NetworkProcess::setCacheModel):
939         * NetworkProcess/NetworkProcess.messages.in:
940         * UIProcess/WebProcessPool.cpp:
941         (WebKit::WebProcessPool::ensureNetworkProcess):
942         (WebKit::WebProcessPool::setCacheModel):
943
944 2019-09-16  Jiewen Tan  <jiewen_tan@apple.com>
945
946         [WebAuthn] LocalAuthenticator tests are failing on internal bots
947         https://bugs.webkit.org/show_bug.cgi?id=201844
948         <rdar://problem/54278693>
949
950         Reviewed by Brent Fulgham.
951
952         This patch adds a way for mock tests to select a credential in getAssertion
953         ceremonies such that a test can ensure it always uses the credential it manages.
954         Credentials managed by other test could be deleted at anytime.
955
956         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
957         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
958         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
959         (WebKit::LocalAuthenticator::getAssertion):
960         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
961         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
962         (WebKit::LocalConnection::selectCredential const):
963         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
964         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
965         (WebKit::MockLocalConnection::selectCredential const):
966         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
967
968 2019-09-23  David Quesada  <david_quesada@apple.com>
969
970         [iOS] REGRESSION(r250151): Occasional assertion failures in ShareableBitmap::~ShareableBitmap()
971         https://bugs.webkit.org/show_bug.cgi?id=202112
972         rdar://problem/55624598
973
974         Reviewed by Chris Dumez.
975
976         * Shared/cg/ShareableBitmapCG.cpp:
977         (WebKit::ShareableBitmap::releaseDataProviderData):
978         It is possible and valid for a UIImage created from a ShareableBitmap's CGImage representation
979         to be deallocated on a background thread. When this happens, releaseDataProviderData() should
980         ensure it's running on the main thread before deref'ing the ShareableBitmap. Otherwise the
981         bitmap can be deallocated on the background thread, violating an assertion added in r250151.
982
983 2019-09-23  Joseph Pecoraro  <pecoraro@apple.com>
984
985         Web Inspector: Improve the Uncaught Exception View file a bug link
986         https://bugs.webkit.org/show_bug.cgi?id=201717
987
988         Reviewed by Devin Rousso.
989
990         * UIProcess/WebInspectorProxy.cpp:
991         (WebKit::WebInspectorProxy::bringInspectedPageToFront):
992         * UIProcess/WebInspectorProxy.h:
993         * UIProcess/WebInspectorProxy.messages.in:
994         Provide a way to bring the inspected page to the foreground.
995
996         * WebProcess/WebPage/WebInspectorUI.cpp:
997         (WebKit::WebInspectorUI::openInNewTab):
998         Use it when opening a new tab beside the inspected page.
999
1000 2019-09-23  Brent Fulgham  <bfulgham@apple.com>
1001
1002         Unreviewed build fix after r250169 and r250236.
1003
1004         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1005         (WebKit::NetworkDataTaskCurl::createCurlRequest):
1006         * UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.cpp:
1007         (WKWebsiteDataStoreEnableDefaultNetworkProxySettings):
1008         (WKWebsiteDataStoreEnableCustomNetworkProxySettings):
1009         (WKWebsiteDataStoreDisableNetworkProxySettings):
1010
1011 2019-09-23  David Kilzer  <ddkilzer@apple.com>
1012
1013         clang-tidy: Fix unnecessary copy/ref churn of for loop variables in WebKit
1014         <https://webkit.org/b/202096>
1015
1016         Reviewed by Darin Adler.
1017
1018         Fix unwanted copying/ref churn of loop variables by making them
1019         const references.
1020
1021         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1022         (WebKit::domainsToString):
1023         * UIProcess/ios/WKActionSheetAssistant.mm:
1024         (-[WKActionSheetAssistant presentationRectForElementUsingClosestIndicatedRect]):
1025         * UIProcess/ios/WKContentViewInteraction.mm:
1026         (-[WKContentView _singleTapDidReset:]):
1027         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
1028         (-[WKDataListSuggestionsControl textSuggestions]):
1029
1030 2019-09-23  Chris Dumez  <cdumez@apple.com>
1031
1032         WebPage::sessionID() does not need to get the sessionID from there WebCore Page
1033         https://bugs.webkit.org/show_bug.cgi?id=202094
1034
1035         Reviewed by Youenn Fablet.
1036
1037         WebPage::sessionID() does not need to get the sessionID from there WebCore Page, it can
1038         simply get the sessionID from the WebProcess singleton, now that we have a single session
1039         per WebProcess. This will avoid potential crashes trying to dereference m_page to get the
1040         sessionID, since m_page can be null.
1041
1042         * WebProcess/WebPage/WebPage.cpp:
1043         (WebKit::WebPage::sessionID const):
1044         * WebProcess/WebPage/WebPage.h:
1045         (WebKit::WebPage::sessionID const): Deleted.
1046
1047 2019-09-23  Youenn Fablet  <youenn@apple.com>
1048
1049         Simplify UserMediaPermissionRequestManager management of UserMediaRequest
1050         https://bugs.webkit.org/show_bug.cgi?id=201688
1051
1052         Reviewed by Eric Carlson.
1053
1054         Instead of having two maps to go from ID to request and request to ID,
1055         Make request own its ID and keep a single ID to request map.
1056         Rename it to m_ongoingUserMediaRequests.
1057
1058         Rename requests that are not processed because the document cannot start media as m_pendingUserMediaRequests.
1059         In case the request is cancelled following the stopping of active dom objects, we just remove it from m_pendingUserMediaRequests
1060         instead of denying the request. This matches Chrome and Firefox behavior.
1061
1062         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1063         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest):
1064         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
1065         (WebKit::UserMediaPermissionRequestManager::cancelUserMediaRequest):
1066         (WebKit::UserMediaPermissionRequestManager::mediaCanStart):
1067         (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted):
1068         (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasDenied):
1069         (WebKit::UserMediaPermissionRequestManager::addDeviceChangeObserver):
1070         (WebKit::generateRequestID): Deleted.
1071         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps): Deleted.
1072         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1073
1074 2019-09-23  Patrick Griffis  <pgriffis@igalia.com>
1075
1076         [GTK][WPE] Don't use prgname in dbus-proxy socket path
1077         https://bugs.webkit.org/show_bug.cgi?id=201979
1078
1079         The path length for the socket is limited to 108 bytes so it is easy for a long
1080         prgname to cause it to get truncated and fail. Since we only allow the socket
1081         path into the sandbox the unique directory isn't necessary.
1082
1083         Reviewed by Michael Catanzaro.
1084
1085         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1086         (WebKit::XDGDBusProxyLauncher::setAddress):
1087
1088 2019-09-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1089
1090         [SOUP] Stop setting G_TLS_GNUTLS_PRIORITY
1091         https://bugs.webkit.org/show_bug.cgi?id=172154
1092
1093         Reviewed by Carlos Garcia Campos.
1094
1095         Nowadays, I maintain glib-networking. WebKit doesn't need to override its defaults to be
1096         secure anymore. By overriding glib-networking's default priority, WebKit is force-reenabling
1097         TLS 1.0 and TLS 1.1 even when glib-networking has disabled them.
1098
1099         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
1100         (main):
1101         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
1102         (main):
1103
1104 2019-09-21  Dan Bernstein  <mitz@apple.com>
1105
1106         Fix an assertion failure introduced in r250186.
1107
1108         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1109         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): Corrected the
1110           assertion.
1111
1112 2019-09-21  Chris Dumez  <cdumez@apple.com>
1113
1114         Reduce use of SessionID::defaultSessionID() in WebKit
1115         https://bugs.webkit.org/show_bug.cgi?id=202080
1116
1117         Reviewed by Alex Christensen.
1118
1119         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1120         (WebKit::WebFrameLoaderClient::convertMainResourceLoadToDownload):
1121         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1122         * WebProcess/WebPage/WebFrame.cpp:
1123         (WebKit::WebFrame::convertMainResourceLoadToDownload):
1124         * WebProcess/WebPage/WebFrame.h:
1125
1126 2019-09-21  Chris Dumez  <cdumez@apple.com>
1127
1128         Drop unnecessary NetworkProcess::m_sessionByConnection
1129         https://bugs.webkit.org/show_bug.cgi?id=202088
1130
1131         Reviewed by Alex Christensen.
1132
1133         * NetworkProcess/NetworkProcess.cpp:
1134         * NetworkProcess/NetworkProcess.h:
1135
1136 2019-09-21  Chris Dumez  <cdumez@apple.com>
1137
1138         WebIDBConnectionToClient does not need to be RefCounted or a SessionID
1139         https://bugs.webkit.org/show_bug.cgi?id=202089
1140
1141         Reviewed by Alex Christensen.
1142
1143         WebIDBConnectionToClient does not need to be RefCounted, the ref() / deref() virtual function
1144         it implemented from its interface were dead code. We now stop subclassing RefCounted and have
1145         the NetworkConnectionToWebProcess fully own the WebIDBConnectionToClient. Instead of the
1146         WebIDBConnectionToClient having 3 data members for the NetworkProcess, the sessionID and the IPC
1147         connection, use a single data member to its NetworkConnectionToWebProcess parent. It can get
1148         everything it needs from its parent.
1149
1150         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1151         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
1152         (WebKit::WebIDBConnectionToClient::idbServer):
1153         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
1154         (WebKit::WebIDBConnectionToClient::messageSenderConnection const):
1155         (WebKit::WebIDBConnectionToClient::connectionToClient):
1156         (WebKit::WebIDBConnectionToClient::deleteDatabase):
1157         (WebKit::WebIDBConnectionToClient::openDatabase):
1158         (WebKit::WebIDBConnectionToClient::abortTransaction):
1159         (WebKit::WebIDBConnectionToClient::commitTransaction):
1160         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
1161         (WebKit::WebIDBConnectionToClient::createObjectStore):
1162         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
1163         (WebKit::WebIDBConnectionToClient::renameObjectStore):
1164         (WebKit::WebIDBConnectionToClient::clearObjectStore):
1165         (WebKit::WebIDBConnectionToClient::createIndex):
1166         (WebKit::WebIDBConnectionToClient::deleteIndex):
1167         (WebKit::WebIDBConnectionToClient::renameIndex):
1168         (WebKit::WebIDBConnectionToClient::putOrAdd):
1169         (WebKit::WebIDBConnectionToClient::getRecord):
1170         (WebKit::WebIDBConnectionToClient::getAllRecords):
1171         (WebKit::WebIDBConnectionToClient::getCount):
1172         (WebKit::WebIDBConnectionToClient::deleteRecord):
1173         (WebKit::WebIDBConnectionToClient::openCursor):
1174         (WebKit::WebIDBConnectionToClient::iterateCursor):
1175         (WebKit::WebIDBConnectionToClient::establishTransaction):
1176         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
1177         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
1178         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
1179         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
1180         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
1181         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
1182         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
1183         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
1184         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1185         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1186         * NetworkProcess/NetworkConnectionToWebProcess.h:
1187
1188 2019-09-21  Chris Dumez  <cdumez@apple.com>
1189
1190         Regression(iOS 13) web views do not deal properly with their window's UIScene changing
1191         https://bugs.webkit.org/show_bug.cgi?id=202070
1192         <rdar://problem/55580699>
1193
1194         Reviewed by Tim Horton.
1195
1196         Web views do not deal properly with their window's UIScene changing. If a Safari window is in the
1197         background for 1 minute, its UIScene will be detached and the window will get a new UIScene if
1198         the user later switches to this window. Our web views listen to UIScene notifications to determine
1199         their visibility and currently stop receiving visibility updates once the window’s UIScene has
1200         changed. This causes view freezes because our WebContent process does not know its view is visible
1201         and keeps its layer tree frozen.
1202
1203         Previously, when our view would be added to a window, we would get this window's UIScene and listen
1204         for UISceneDidEnterBackgroundNotification / UISceneWillEnterForegroundNotification for this UIScene
1205         object. Instead, we now listen to these notifications for ALL the application's UIScenes. Our handler
1206         then checks if the notification's UIScene object matches the current window's UIScene before
1207         forwarding the notification to the rest of WebKit.
1208
1209         * UIProcess/ApplicationStateTracker.mm:
1210         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1211         (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
1212
1213 2019-09-21  Dan Bernstein  <mitz@apple.com>
1214
1215         Safari 13 may launch leftover 32-bit plug-in process from Safari 12’s WebKit, which crashes
1216         https://bugs.webkit.org/show_bug.cgi?id=202077
1217         <rdar://problem/55547063>
1218
1219         Reviewed by Sam Weinig.
1220
1221         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
1222         (WebKit::getPluginArchitecture): Removed support for i386 plug-ins.
1223
1224         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1225         (WebKit::serviceName): Assert that the requested process type is not Plugin32.
1226
1227         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1228         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): Assert that the
1229           plug-in architecture is x86_64.
1230
1231 2019-09-21  Antoine Quint  <graouts@apple.com>
1232
1233         [Pointer Events] touch-action set to pan-x or pan-y alone should disable scrolling altogether if the intial gesture is in the disallowed direction
1234         https://bugs.webkit.org/show_bug.cgi?id=202053
1235         <rdar://problem/54542190>
1236
1237         Reviewed by Tim Horton.
1238
1239         Although the Pointer Events specification does not specify this clearly (see https://github.com/w3c/pointerevents/issues/303), setting "touch-action" to a value
1240         that only allows scrolling a specific direction ("pan-x" or "pan-y") should disable scrolling in the specified direction if the panning gesture initially is directed
1241         in the opposite direction. In practice, this means that setting "touch-action: pan-y" on an element should disable scrolling if the user initially pans horizontally,
1242         even if later on in the gesture the user pans vertically. This allows for sites that want to offer a programmatic horizontal scroller to disable vertical scrolling
1243         if the user pans horizontally.
1244
1245         In order to support this, we add four UISwipeGestureRecognizers, one for each direction, and we selectively allows touches to be recognizer for them based on the
1246         "touch-action" value specified at the initial touch location for a given gesture. In the case of "touch-action: pan-y" we only allow the left and right swipe recognizers
1247         to be enabled, and in the case of "touch-action: pan-x" we only allow the up and down swipe recognizers to be enabled. If any of those gesture recognizers is recognized,
1248         scrolling will be disabled for the duration of this gesture. If a UIScrollView panning gesture recognizer is recognized prior to a swipe, they won't have a chance to be
1249         recognized.
1250
1251         * UIProcess/ios/WKContentViewInteraction.h:
1252         * UIProcess/ios/WKContentViewInteraction.mm:
1253         (-[WKContentView setupInteraction]):
1254         (-[WKContentView cleanupInteraction]):
1255         (-[WKContentView _removeDefaultGestureRecognizers]):
1256         (-[WKContentView _addDefaultGestureRecognizers]):
1257         (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
1258
1259 2019-09-19  Andy Estes  <aestes@apple.com>
1260
1261         [Apple Pay] Clean up handling of summary items and payment method updates
1262         https://bugs.webkit.org/show_bug.cgi?id=202018
1263         <rdar://problem/55470632>
1264
1265         Reviewed by Tim Horton.
1266
1267         Now that PaymentMethodUpdate knows how to convert itself to a
1268         PKPaymentRequestPaymentMethodUpdate, PaymentAuthorizationPresenter can merely pass the
1269         converted update directly to the platform delegate rather than passing the individual
1270         components and relying on the delegate to instantiate the platform update itself. Added
1271         FIXMEs for applying a similar treatment to ShippingContactUpdate and ShippingMethodUpdate.
1272
1273         * Platform/cocoa/PaymentAuthorizationPresenter.h:
1274         * Platform/cocoa/PaymentAuthorizationPresenter.mm:
1275         (WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection):
1276         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection):
1277         (WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection):
1278         * Platform/cocoa/WKPaymentAuthorizationDelegate.h:
1279         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
1280         (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]):
1281         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:]):
1282         (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]):
1283         (-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:]):
1284         (-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:]):
1285         (-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:]):
1286         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]): Deleted.
1287         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
1288         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
1289         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1290         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest):
1291         (WebKit::toPKPaymentSummaryItemType): Deleted.
1292         (WebKit::toPKPaymentSummaryItem): Deleted.
1293         (WebKit::toPKPaymentSummaryItems): Deleted.
1294         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1295         (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::encode):
1296         (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::decode):
1297
1298 2019-09-20  Keith Rollin  <krollin@apple.com>
1299
1300         Remove some support for < iOS 13
1301         https://bugs.webkit.org/show_bug.cgi?id=202027
1302         <rdar://problem/55547109>
1303
1304         Reviewed by Alex Christensen.
1305
1306         Remove some support for iOS versions less than 13.0.
1307
1308         Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
1309         and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
1310         values >= 130000. This means that expressions like
1311         "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
1312         "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
1313
1314         After version checks have been removed, there are some cases where the
1315         preprocessor conditional looks like "#if PLATFORM(MAC) ||
1316         PLATFORM(IOS_FAMILY)". These can be collapsed into "#if
1317         PLATFORM(COCOA)". This additional cleanup will be performed in a
1318         subsequent patch.
1319
1320         This removal is part of a series of patches effecting the removal of
1321         dead code for old versions of iOS. This particular pass involves
1322         changes in which Joe Pecoraro was involved. These changes are isolated
1323         from other similar changes in order to facilitate the reviewing
1324         process.
1325
1326         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1327         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1328
1329 2019-09-20  Alex Christensen  <achristensen@webkit.org>
1330
1331         Remove unnecessary abstractions around WebsiteDataStore
1332         https://bugs.webkit.org/show_bug.cgi?id=201655
1333
1334         Reviewed by Chris Dumez.
1335
1336         * PlatformFTW.cmake:
1337         * PlatformWin.cmake:
1338         * Sources.txt:
1339         * SourcesCocoa.txt:
1340         * SourcesGTK.txt:
1341         * SourcesWPE.txt:
1342         * UIProcess/API/APIHTTPCookieStore.cpp:
1343         * UIProcess/API/APIHTTPCookieStore.h:
1344         * UIProcess/API/APIPageConfiguration.cpp:
1345         (API::PageConfiguration::websiteDataStore):
1346         (API::PageConfiguration::setWebsiteDataStore):
1347         * UIProcess/API/APIPageConfiguration.h:
1348         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1349         * UIProcess/API/APIWebsiteDataStore.cpp: Removed.
1350         * UIProcess/API/APIWebsiteDataStore.h: Removed.
1351         * UIProcess/API/APIWebsitePolicies.cpp:
1352         (API::WebsitePolicies::WebsitePolicies):
1353         (API::WebsitePolicies::setWebsiteDataStore):
1354         (API::WebsitePolicies::data):
1355         * UIProcess/API/APIWebsitePolicies.h:
1356         * UIProcess/API/C/WKAPICast.h:
1357         * UIProcess/API/C/WKContext.cpp:
1358         (WKContextSetCacheModel):
1359         (WKContextGetCacheModel):
1360         * UIProcess/API/C/WKFramePolicyListener.cpp:
1361         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1362         (WKWebsiteDataStoreGetTypeID):
1363         (WKWebsiteDataStoreGetDefaultDataStore):
1364         (WKWebsiteDataStoreCreateNonPersistentDataStore):
1365         (WKWebsiteDataStoreCreateWithConfiguration):
1366         (WKWebsiteDataStoreGetHTTPCookieStore):
1367         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
1368         (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
1369         (WKWebsiteDataStoreSetStatisticsLastSeen):
1370         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
1371         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
1372         (WKWebsiteDataStoreDumpResourceLoadStatistics):
1373         (WKWebsiteDataStoreIsStatisticsPrevalentResource):
1374         (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
1375         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
1376         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder):
1377         (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo):
1378         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
1379         (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction):
1380         (WKWebsiteDataStoreSetStatisticsGrandfathered):
1381         (WKWebsiteDataStoreIsStatisticsGrandfathered):
1382         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
1383         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
1384         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo):
1385         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom):
1386         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo):
1387         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom):
1388         (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
1389         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
1390         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
1391         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
1392         (WKWebsiteDataStoreStatisticsSubmitTelemetry):
1393         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned):
1394         (WKWebsiteDataStoreSetStatisticsIsRunningTest):
1395         (WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval):
1396         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured):
1397         (WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval):
1398         (WKWebsiteDataStoreSetStatisticsGrandfatheringTime):
1399         (WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries):
1400         (WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo):
1401         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
1402         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
1403         (WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval):
1404         (WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
1405         (WKWebsiteDataStoreStatisticsHasLocalStorage):
1406         (WKWebsiteDataStoreSetStatisticsCacheMaxAgeCap):
1407         (WKWebsiteDataStoreStatisticsHasIsolatedSession):
1408         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1409         (WKWebsiteDataStoreRemoveAllFetchCaches):
1410         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
1411         (WKWebsiteDataStoreRemoveAllIndexedDatabases):
1412         (WKWebsiteDataStoreRemoveLocalStorage):
1413         (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations):
1414         (WKWebsiteDataStoreGetFetchCacheOrigins):
1415         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
1416         (WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
1417         (WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
1418         (WKWebsiteDataStoreClearAllDeviceOrientationPermissions):
1419         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
1420         (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
1421         * UIProcess/API/C/WKWebsitePolicies.cpp:
1422         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: Removed.
1423         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1424         (+[WKWebsiteDataStore defaultDataStore]):
1425         (+[WKWebsiteDataStore nonPersistentDataStore]):
1426         (-[WKWebsiteDataStore dealloc]):
1427         (-[WKWebsiteDataStore httpCookieStore]):
1428         (-[WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:]):
1429         (-[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:]):
1430         (+[WKWebsiteDataStore _defaultDataStoreExists]):
1431         (+[WKWebsiteDataStore _deleteDefaultDataStoreForTesting]):
1432         (-[WKWebsiteDataStore _initWithConfiguration:]):
1433         (-[WKWebsiteDataStore _fetchDataRecordsOfTypes:withOptions:completionHandler:]):
1434         (-[WKWebsiteDataStore _resourceLoadStatisticsEnabled]):
1435         (-[WKWebsiteDataStore _setResourceLoadStatisticsEnabled:]):
1436         (-[WKWebsiteDataStore _resourceLoadStatisticsDebugMode]):
1437         (-[WKWebsiteDataStore _setResourceLoadStatisticsDebugMode:]):
1438         (-[WKWebsiteDataStore _cacheStorageDirectory]):
1439         (-[WKWebsiteDataStore _setCacheStorageDirectory:]):
1440         (-[WKWebsiteDataStore _serviceWorkerRegistrationDirectory]):
1441         (-[WKWebsiteDataStore _setServiceWorkerRegistrationDirectory:]):
1442         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]):
1443         (-[WKWebsiteDataStore _boundInterfaceIdentifier]):
1444         (-[WKWebsiteDataStore _setAllowsCellularAccess:]):
1445         (-[WKWebsiteDataStore _allowsCellularAccess]):
1446         (-[WKWebsiteDataStore _setProxyConfiguration:]):
1447         (-[WKWebsiteDataStore _sourceApplicationBundleIdentifier]):
1448         (-[WKWebsiteDataStore _setSourceApplicationBundleIdentifier:]):
1449         (-[WKWebsiteDataStore _sourceApplicationSecondaryIdentifier]):
1450         (-[WKWebsiteDataStore _setSourceApplicationSecondaryIdentifier:]):
1451         (-[WKWebsiteDataStore _proxyConfiguration]):
1452         (-[WKWebsiteDataStore _indexedDBDatabaseDirectory]):
1453         (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:]):
1454         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
1455         (-[WKWebsiteDataStore _getAllStorageAccessEntriesFor:completionHandler:]):
1456         (-[WKWebsiteDataStore _scheduleCookieBlockingUpdate:]):
1457         (-[WKWebsiteDataStore _setPrevalentDomain:completionHandler:]):
1458         (-[WKWebsiteDataStore _getIsPrevalentDomain:completionHandler:]):
1459         (-[WKWebsiteDataStore _clearPrevalentDomain:completionHandler:]):
1460         (-[WKWebsiteDataStore _processStatisticsAndDataRecords:]):
1461         (-[WKWebsiteDataStore _hasRegisteredServiceWorker]):
1462         (-[WKWebsiteDataStore _delegate]):
1463         (-[WKWebsiteDataStore set_delegate:]):
1464         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
1465         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: Removed.
1466         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
1467         (webkitWebsiteDataManagerSetProperty):
1468         (webkitWebsiteDataManagerGetDataStore):
1469         (webkit_website_data_manager_get_local_storage_directory):
1470         (webkit_website_data_manager_get_disk_cache_directory):
1471         (webkit_website_data_manager_get_offline_application_cache_directory):
1472         (webkit_website_data_manager_get_indexeddb_directory):
1473         (webkit_website_data_manager_get_websql_directory):
1474         (webkit_website_data_manager_get_hsts_cache_directory):
1475         (webkit_website_data_manager_fetch):
1476         (webkit_website_data_manager_remove):
1477         (webkit_website_data_manager_clear):
1478         (webkitWebsiteDataManagerCreate): Deleted.
1479         * UIProcess/API/glib/WebKitWebsiteDataManagerPrivate.h:
1480         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Removed.
1481         * UIProcess/Cocoa/NavigationState.mm:
1482         * UIProcess/Network/NetworkProcessProxy.cpp:
1483         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
1484         (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID):
1485         * UIProcess/Network/NetworkProcessProxy.h:
1486         * UIProcess/WebFramePolicyListenerProxy.cpp:
1487         * UIProcess/WebPageProxy.cpp:
1488         (WebKit::WebPageProxy::WebPageProxy):
1489         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1490         * UIProcess/WebProcessPool.cpp:
1491         (WebKit::m_webProcessCache):
1492         (WebKit::WebProcessPool::ensureNetworkProcess):
1493         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1494         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1495         (WebKit::WebProcessPool::processDidFinishLaunching):
1496         (WebKit::WebProcessPool::processForRegistrableDomain):
1497         (WebKit::WebProcessPool::createWebPage):
1498         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
1499         * UIProcess/WebProcessPool.h:
1500         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1501         (WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
1502         (WebKit::WebsiteDataStore::defaultCacheStorageDirectory):
1503         (WebKit::WebsiteDataStore::defaultNetworkCacheDirectory):
1504         (WebKit::WebsiteDataStore::defaultMediaCacheDirectory):
1505         (WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
1506         (WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
1507         (WebKit::WebsiteDataStore::defaultLocalStorageDirectory):
1508         (WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory):
1509         (WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
1510         (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
1511         (WebKit::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
1512         (WebKit::WebsiteDataStore::tempDirectoryFileSystemRepresentation):
1513         (WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
1514         (WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
1515         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1516         (WebKit::globalDefaultDataStore):
1517         (WebKit::WebsiteDataStore::defaultDataStore):
1518         (WebKit::WebsiteDataStore::deleteDefaultDataStoreForTesting):
1519         (WebKit::WebsiteDataStore::defaultDataStoreExists):
1520         (WebKit::WebsiteDataStore::defaultDataStoreConfiguration):
1521         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
1522         (WebKit::WebsiteDataStore::defaultMediaCacheDirectory):
1523         (WebKit::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
1524         (WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
1525         * UIProcess/WebsiteData/WebsiteDataStore.h:
1526         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1527         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
1528         (WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
1529         (WebKit::WebsiteDataStore::defaultCacheStorageDirectory):
1530         (WebKit::WebsiteDataStore::defaultNetworkCacheDirectory):
1531         (WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
1532         (WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
1533         (WebKit::WebsiteDataStore::defaultLocalStorageDirectory):
1534         (WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory):
1535         (WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
1536         (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
1537         (WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
1538         (WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
1539         * UIProcess/glib/WebProcessProxyGLib.cpp:
1540         (WebKit::WebProcessProxy::platformGetLaunchOptions):
1541         * UIProcess/glib/WebsiteDataStoreGLib.cpp: Copied from Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp.
1542         (API::WebsiteDataStore::defaultApplicationCacheDirectory): Deleted.
1543         (API::WebsiteDataStore::defaultNetworkCacheDirectory): Deleted.
1544         (API::WebsiteDataStore::defaultCacheStorageDirectory): Deleted.
1545         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory): Deleted.
1546         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): Deleted.
1547         (API::WebsiteDataStore::defaultLocalStorageDirectory): Deleted.
1548         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory): Deleted.
1549         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): Deleted.
1550         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory): Deleted.
1551         (API::WebsiteDataStore::defaultHSTSDirectory): Deleted.
1552         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Deleted.
1553         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation): Deleted.
1554         (API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation): Deleted.
1555         * WebKit.xcodeproj/project.pbxproj:
1556         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
1557         (WebKit::WebMediaKeyStorageManager::setWebsiteDataStore):
1558
1559 2019-09-20  Chris Dumez  <cdumez@apple.com>
1560
1561         REGRESSION (iOS 13): rAF stops firing when navigating away cross-origin and then back
1562         https://bugs.webkit.org/show_bug.cgi?id=201767
1563         <rdar://problem/55350854>
1564
1565         Reviewed by Tim Horton.
1566
1567         This is a follow-up to r249961 to address crashes when navigating back cross-origin to a page
1568         that uses requestAnimationFrame. r249961 took care of moving RemoteLayerTreeDisplayRefreshMonitor
1569         objects from one RemoteLayerTreeDrawingArea to another but failed to tell those monitors
1570         about their new drawingArea. As a result, RemoteLayerTreeDrawingArea::willDestroyDisplayRefreshMonitor()
1571         would not get called on the new drawing area when it should have.
1572
1573         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
1574         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
1575         (WebKit::RemoteLayerTreeDisplayRefreshMonitor::updateDrawingArea):
1576         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1577         (WebKit::RemoteLayerTreeDrawingArea::adoptDisplayRefreshMonitorsFromDrawingArea):
1578
1579 2019-09-20  Keith Rollin  <krollin@apple.com>
1580
1581         Remove some support for < iOS 13
1582         https://bugs.webkit.org/show_bug.cgi?id=201967
1583         <rdar://problem/55504738>
1584
1585         Reviewed by Andy Estes.
1586
1587         Remove some support for iOS versions less than 13.0.
1588
1589         Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
1590         and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
1591         values >= 130000. This means that expressions like
1592         "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
1593         "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
1594
1595         After version checks have been removed, there are some cases where the
1596         preprocessor conditional looks like "#if PLATFORM(MAC) ||
1597         PLATFORM(IOS_FAMILY)". These can be collapsed into "#if
1598         PLATFORM(COCOA)". This additional cleanup will be performed in a
1599         subsequent patch.
1600
1601         This removal is part of a series of patches effecting the removal of
1602         dead code for old versions of iOS. This particular pass involves
1603         changes in which Andy Estes was involved. These changes are isolated
1604         from other similar changes in order to facilitate the reviewing
1605         process.
1606
1607         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1608         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1609         * UIProcess/ios/WKContentViewInteraction.mm:
1610         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
1611         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1612         (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
1613
1614 2019-09-20  Tim Horton  <timothy_horton@apple.com>
1615
1616         Sanitize suggested filenames used for saving PDFs
1617         https://bugs.webkit.org/show_bug.cgi?id=202034
1618         <rdar://problem/53183075>
1619
1620         Reviewed by Chris Dumez.
1621
1622         * UIProcess/WebPageProxy.cpp:
1623         (WebKit::WebPageProxy::didFinishLoadingDataForCustomContentProvider):
1624         (WebKit::WebPageProxy::saveDataToFileInDownloadsFolder):
1625         (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder):
1626         * UIProcess/WebPageProxy.h:
1627         * UIProcess/ios/WebPageProxyIOS.mm:
1628         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw): Deleted.
1629         * UIProcess/mac/WebPageProxyMac.mm:
1630         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
1631         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw): Deleted.
1632         Sanitize suggested filenames to ensure that they comprise only one path component
1633         when concatenated with their destination directory.
1634
1635 2019-09-20  Chris Dumez  <cdumez@apple.com>
1636
1637         Add release logging for when a view is added / removed from a window
1638         https://bugs.webkit.org/show_bug.cgi?id=202050
1639
1640         Reviewed by Tim Horton.
1641
1642         Add release logging for when a view is added / removed from a window to help determine the
1643         view's visibility in the logs.
1644
1645         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1646         (-[WKApplicationStateTrackingView willMoveToWindow:]):
1647         (-[WKApplicationStateTrackingView didMoveToWindow]):
1648
1649 2019-09-20  Chris Dumez  <cdumez@apple.com>
1650
1651         ApplicationStateTracker::m_isBackground initialization does not account for UIScenes
1652         https://bugs.webkit.org/show_bug.cgi?id=202048
1653
1654         Reviewed by Geoffrey Garen.
1655
1656         ApplicationStateTracker::m_isBackground initialization does not account for UIScenes, it merely checks
1657         the visibility state of the whole app. It should instead check the visibility state of the window's
1658         UIScene.
1659
1660         This patch also refactors the code a little bit to reduce #ifdef'ing.
1661
1662         * UIProcess/ApplicationStateTracker.mm:
1663         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1664
1665 2019-09-20  Chris Dumez  <cdumez@apple.com>
1666
1667         Document no longer needs to store a SessionID
1668         https://bugs.webkit.org/show_bug.cgi?id=202024
1669
1670         Reviewed by Geoffrey Garen.
1671
1672         Document no longer needs to store a SessionID, now that we have a single
1673         session per WebProcess. It can simply get its sessionID from its Page.
1674
1675         * WebProcess/WebPage/WebCookieJar.cpp:
1676         (WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
1677         * WebProcess/WebPage/WebCookieJar.h:
1678
1679 2019-09-20  Chris Dumez  <cdumez@apple.com>
1680
1681         [iOS] ASSERTION FAILED: Unsafe to ref/deref of ShareableBitmap from different threads
1682         https://bugs.webkit.org/show_bug.cgi?id=201712
1683         <rdar://problem/55289916>
1684
1685         Reviewed by Tim Horton.
1686
1687         Make sure ShareableBitmap objects are always ref'd / deref'd on the main thread by dispatching to
1688         the main thread in ShareableBitmap::releaseBitmapContextData() before calling deref().
1689
1690         * Shared/ShareableBitmap.cpp:
1691         (WebKit::ShareableBitmap::ShareableBitmap):
1692         (WebKit::ShareableBitmap::~ShareableBitmap):
1693         * Shared/cg/ShareableBitmapCG.cpp:
1694         (WebKit::ShareableBitmap::createGraphicsContext):
1695         (WebKit::ShareableBitmap::releaseBitmapContextData):
1696
1697 2019-09-20  Alex Christensen  <achristensen@webkit.org>
1698
1699         Begin moving WebsiteDataStore setters to WebsiteDataStoreConfiguration
1700         https://bugs.webkit.org/show_bug.cgi?id=202025
1701
1702         Reviewed by Chris Dumez.
1703
1704         Most of these were only needed before initNonPersistentConfiguration existed.
1705
1706         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
1707         (WKWebsiteDataStoreConfigurationGetPerOriginStorageQuota):
1708         (WKWebsiteDataStoreConfigurationSetPerOriginStorageQuota):
1709         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h:
1710         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1711         (WKWebsiteDataStoreSetPerOriginStorageQuota):
1712         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1713         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1714         (-[WKWebsiteDataStore _initWithConfiguration:]):
1715         (-[WKWebsiteDataStore _perOriginStorageQuota]):
1716         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
1717         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1718         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1719         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1720         (-[_WKWebsiteDataStoreConfiguration perOriginStorageQuota]):
1721         (-[_WKWebsiteDataStoreConfiguration setPerOriginStorageQuota:]):
1722         (-[_WKWebsiteDataStoreConfiguration boundInterfaceIdentifier]):
1723         (-[_WKWebsiteDataStoreConfiguration setBoundInterfaceIdentifier:]):
1724         (-[_WKWebsiteDataStoreConfiguration allowsCellularAccess]):
1725         (-[_WKWebsiteDataStoreConfiguration setAllowsCellularAccess:]):
1726         (-[_WKWebsiteDataStoreConfiguration proxyConfiguration]):
1727         (-[_WKWebsiteDataStoreConfiguration setProxyConfiguration:]):
1728         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1729         (WebKit::WebsiteDataStore::parameters):
1730         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1731         (WebKit::WebsiteDataStore::WebsiteDataStore):
1732         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
1733         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
1734         * UIProcess/WebsiteData/WebsiteDataStore.h:
1735         (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier):
1736         (WebKit::WebsiteDataStore::boundInterfaceIdentifier):
1737         (WebKit::WebsiteDataStore::sourceApplicationBundleIdentifier const):
1738         (WebKit::WebsiteDataStore::sourceApplicationSecondaryIdentifier const):
1739         (WebKit::WebsiteDataStore::setAllowsCellularAccess):
1740         (WebKit::WebsiteDataStore::allowsCellularAccess):
1741         (WebKit::WebsiteDataStore::setProxyConfiguration):
1742         (WebKit::WebsiteDataStore::proxyConfiguration):
1743         (WebKit::WebsiteDataStore::setPerOriginStorageQuota): Deleted.
1744         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1745         (WebKit::WebsiteDataStoreConfiguration::copy):
1746         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1747         (WebKit::WebsiteDataStoreConfiguration::boundInterfaceIdentifier const):
1748         (WebKit::WebsiteDataStoreConfiguration::setBoundInterfaceIdentifier):
1749         (WebKit::WebsiteDataStoreConfiguration::allowsCellularAccess const):
1750         (WebKit::WebsiteDataStoreConfiguration::setAllowsCellularAccess):
1751         (WebKit::WebsiteDataStoreConfiguration::proxyConfiguration const):
1752         (WebKit::WebsiteDataStoreConfiguration::setProxyConfiguration):
1753
1754 2019-09-20  Alex Christensen  <achristensen@webkit.org>
1755
1756         Introduce LegacyGlobalSettings for settings the NetworkProcess needs from a WebProcessPool
1757         https://bugs.webkit.org/show_bug.cgi?id=201970
1758
1759         Reviewed by Geoff Garen.
1760
1761         I'm starting by moving the cache model to this new abstraction.
1762         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.
1763         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.
1764         I need this so I can make a NetworkProcess not depend on anything from a WebProcessPool when starting.
1765
1766         * Sources.txt:
1767         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1768         (API::ProcessPoolConfiguration::copy):
1769         * UIProcess/API/APIProcessPoolConfiguration.h:
1770         * UIProcess/API/C/WKContext.cpp:
1771         (WKContextSetCacheModel):
1772         (WKContextGetCacheModel):
1773         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1774         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
1775         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
1776         * UIProcess/LegacyGlobalSettings.cpp: Added.
1777         (WebKit::LegacyGlobalSettings::singleton):
1778         (WebKit::LegacyGlobalSettings::setCacheModel):
1779         * UIProcess/LegacyGlobalSettings.h: Added.
1780         (WebKit::LegacyGlobalSettings::cacheModel const):
1781         * UIProcess/WebProcessCache.cpp:
1782         (WebKit::WebProcessCache::updateCapacity):
1783         * UIProcess/WebProcessPool.cpp:
1784         (WebKit::WebProcessPool::ensureNetworkProcess):
1785         (WebKit::WebProcessPool::initializeNewWebProcess):
1786         (WebKit::WebProcessPool::updateMaxSuspendedPageCount):
1787         (WebKit::WebProcessPool::setCacheModel):
1788         * UIProcess/WebProcessPool.h:
1789         * WebKit.xcodeproj/project.pbxproj:
1790
1791 2019-09-20  Alex Christensen  <achristensen@webkit.org>
1792
1793         Deprecate unused C API aliases for WebsiteDataStore
1794         https://bugs.webkit.org/show_bug.cgi?id=202029
1795
1796         Reviewed by Chris Dumez.
1797
1798         This is a piece of r249768.
1799
1800         * UIProcess/API/C/WKApplicationCacheManager.cpp:
1801         (WKApplicationCacheManagerGetTypeID):
1802         (WKApplicationCacheManagerGetApplicationCacheOrigins):
1803         (WKApplicationCacheManagerDeleteEntriesForOrigin):
1804         (WKApplicationCacheManagerDeleteAllEntries):
1805         * UIProcess/API/C/WKApplicationCacheManager.h:
1806         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
1807         (WKKeyValueStorageManagerGetTypeID):
1808         (WKKeyValueStorageManagerGetOriginKey):
1809         (WKKeyValueStorageManagerGetCreationTimeKey):
1810         (WKKeyValueStorageManagerGetModificationTimeKey):
1811         (WKKeyValueStorageManagerGetKeyValueStorageOrigins):
1812         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
1813         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
1814         (WKKeyValueStorageManagerDeleteAllEntries):
1815         * UIProcess/API/C/WKKeyValueStorageManager.h:
1816         * UIProcess/API/C/WKResourceCacheManager.cpp:
1817         (WKResourceCacheManagerGetTypeID):
1818         (WKResourceCacheManagerGetCacheOrigins):
1819         (WKResourceCacheManagerClearCacheForOrigin):
1820         (WKResourceCacheManagerClearCacheForAllOrigins):
1821         (toWebsiteDataTypes): Deleted.
1822         * UIProcess/API/C/WKResourceCacheManager.h:
1823
1824 2019-09-20  Alex Christensen  <achristensen@webkit.org>
1825
1826         Remove functionality to disable TLS fallback
1827         https://bugs.webkit.org/show_bug.cgi?id=201998
1828
1829         Reviewed by Geoff Garen.
1830
1831         Since r249019 it is not used.  It was a useful experiment and I'm glad we didn't see any regressions.
1832
1833         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1834         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
1835         (WebKit::NetworkSessionCreationParameters::encode const):
1836         (WebKit::NetworkSessionCreationParameters::decode):
1837         * NetworkProcess/NetworkSessionCreationParameters.h:
1838         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1839         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1840         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1841         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
1842         (-[WKWebsiteDataStore _allowsTLSFallback]):
1843         * UIProcess/WebProcessPool.cpp:
1844         (WebKit::WebProcessPool::ensureNetworkProcess):
1845         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1846         (WebKit::WebsiteDataStore::parameters):
1847         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1848         (WebKit::WebsiteDataStore::setAllowsTLSFallback): Deleted.
1849         * UIProcess/WebsiteData/WebsiteDataStore.h:
1850         (WebKit::WebsiteDataStore::allowsTLSFallback const): Deleted.
1851
1852 2019-09-20  Alex Christensen  <achristensen@webkit.org>
1853
1854         Remove unused storage paths on APIProcessPoolConfiguration
1855         https://bugs.webkit.org/show_bug.cgi?id=202028
1856
1857         Reviewed by Chris Dumez.
1858
1859         This is a piece of r249768.
1860         There is no way to set these paths and they have been replaced by WebsiteDataStore paths.
1861         There was one remaining use of the global disk cache directory in NetworkProcess::setCacheModel,
1862         which I replaced with the default session's disk cache directory, which is equivalent.
1863
1864         * NetworkProcess/NetworkProcess.cpp:
1865         (WebKit::NetworkProcess::setCacheModel):
1866         * NetworkProcess/NetworkProcess.h:
1867         (WebKit::NetworkProcess::diskCacheDirectory const): Deleted.
1868         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1869         (WebKit::NetworkProcessCreationParameters::encode const):
1870         (WebKit::NetworkProcessCreationParameters::decode):
1871         (WebKit::NetworkProcessCreationParameters::NetworkProcessCreationParameters): Deleted.
1872         * NetworkProcess/NetworkProcessCreationParameters.h:
1873         * NetworkProcess/NetworkSession.cpp:
1874         (WebKit::NetworkSession::NetworkSession):
1875         * NetworkProcess/cache/NetworkCache.cpp:
1876         (WebKit::NetworkCache::Cache::open):
1877         (WebKit::NetworkCache::Cache::Cache):
1878         * NetworkProcess/cache/NetworkCache.h:
1879         (WebKit::NetworkCache::Cache::storageDirectory):
1880         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1881         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1882         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1883         (API::ProcessPoolConfiguration::copy):
1884         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration): Deleted.
1885         (API::ProcessPoolConfiguration::ProcessPoolConfiguration): Deleted.
1886         (API::ProcessPoolConfiguration::~ProcessPoolConfiguration): Deleted.
1887         * UIProcess/API/APIProcessPoolConfiguration.h:
1888         * UIProcess/API/glib/WebKitWebContext.cpp:
1889         (webkitWebContextConstructed):
1890         (webkit_web_context_set_disk_cache_directory):
1891         (websiteDataStoreConfigurationForWebProcessPoolConfiguration): Deleted.
1892         * UIProcess/WebProcessPool.cpp:
1893         (WebKit::WebProcessPool::ensureNetworkProcess):
1894         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions):
1895         (WebKit::WebProcessPool::webProcessDataStoreParameters):
1896         * UIProcess/WebProcessPool.h:
1897         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1898         (WebKit::WebsiteDataStore::processPools const):
1899         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1900
1901 2019-09-20  Keith Rollin  <krollin@apple.com>
1902
1903         Remove some support for < iOS 13
1904         https://bugs.webkit.org/show_bug.cgi?id=202032
1905         <rdar://problem/55548468>
1906
1907         Reviewed by Alex Christensen.
1908
1909         Remove some support for iOS versions less than 13.0.
1910
1911         Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
1912         and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
1913         values >= 130000. This means that expressions like
1914         "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
1915         "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
1916
1917         This removal is part of a series of patches effecting the removal of
1918         dead code for old versions of iOS. This particular pass involves
1919         changes in which Dan Bates was involved. These changes are isolated
1920         from other similar changes in order to facilitate the reviewing
1921         process.
1922
1923         * UIProcess/ios/WKContentViewInteraction.mm:
1924         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
1925
1926 2019-09-20  Keith Rollin  <krollin@apple.com>
1927
1928         Remove some support for < iOS 13
1929         https://bugs.webkit.org/show_bug.cgi?id=201973
1930         <rdar://problem/55506966>
1931
1932         Reviewed by Alex Christensen.
1933
1934         Remove some support for iOS versions less than 13.0.
1935
1936         Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
1937         and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
1938         values >= 130000. This means that expressions like
1939         "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
1940         "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
1941
1942         This removal is part of a series of patches effecting the removal of
1943         dead code for old versions of iOS. This particular pass involves
1944         changes in which Chris Dumez was involved. These changes are isolated
1945         from other similar changes in order to facilitate the reviewing
1946         process.
1947
1948         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
1949         (WebKit::Download::resume):
1950
1951 2019-09-20  Chris Dumez  <cdumez@apple.com>
1952
1953         Unreviewed, fix confusing release logging under WebPageProxy::loadRequestWithNavigationShared().
1954
1955         * UIProcess/WebPageProxy.cpp:
1956         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
1957
1958 2019-09-20  Chris Dumez  <cdumez@apple.com>
1959
1960         Regression(r248832): Unable to quicklook HTML files in Mail
1961         https://bugs.webkit.org/show_bug.cgi?id=202012
1962         <rdar://problem/55285295>
1963
1964         Reviewed by Per Arne Vollan.
1965
1966         Follow-up to fix bug in r250110. Now that loadFile() calls
1967         maybeInitializeSandboxExtensionHandle(), it no longer needs to
1968         call assumeReadAccessToBaseURL(). This is because maybeInitializeSandboxExtensionHandle()
1969         already take care of it.
1970
1971         * UIProcess/WebPageProxy.cpp:
1972         (WebKit::WebPageProxy::loadFile):
1973
1974 2019-09-20  Joonghun Park  <pjh0718@gmail.com>
1975
1976         Unreviewed. Remove duplicated HashMap iteration since r248734.
1977
1978         ASSERT statement already exists for |storageNamespaceID|,
1979         so |HashMap.get| for the parameter is not needed.
1980
1981         * NetworkProcess/WebStorage/StorageManager.cpp:
1982         (WebKit::StorageManager::destroySessionStorageNamespace):
1983
1984 2019-09-20  Joonghun Park  <pjh0718@gmail.com>
1985
1986         Unreviewed. Fix Build warning below since r248734.
1987
1988         warning: unused variable ‘foo’ [-Wunused-variable]
1989
1990         * NetworkProcess/WebStorage/StorageManager.cpp:
1991         (WebKit::StorageManager::destroySessionStorageNamespace):
1992         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
1993         (WebKit::StorageManagerSet::add):
1994         (WebKit::StorageManagerSet::waitUntilTasksFinished):
1995
1996 2019-09-19  Brent Fulgham  <bfulgham@apple.com>
1997
1998         [FTW, WinCairo] Support running tests in Release mode
1999         https://bugs.webkit.org/show_bug.cgi?id=202021
2000
2001         Reviewed by Don Olmstead.
2002
2003         In Bug 201597, we added new features to better lock down JSC features in the
2004         potentially untrusted WebContent process.
2005
2006         Unfortunately, this change included XPC Dictionary items used at startup to
2007         lock down JSC features before entering the main execution of the process. These
2008         changes were not done for the WinCairo or FTW ports.
2009
2010         We need to pass the state of the JIT and whether to enable certain JSC features
2011         at process launch. Since the XPC mechanisms we use on macOS and iOS do not exist
2012         on Windows, I am implementing them as command-line flags.
2013
2014             -configure-jsc-for-testing: Sets the JSC in testing mode.
2015             -disable-jit: Disables the JIT.
2016
2017         See r249808 for the equivalent changes on macOS and iOS.
2018
2019         * PlatformFTW.cmake: Add some missing header files needed when building tests.
2020         * Shared/win/AuxiliaryProcessMainWin.cpp:
2021         (WebKit::AuxiliaryProcessMainBase::parseCommandLine):
2022         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2023         (WebKit::ProcessLauncher::launchProcess):
2024
2025 2019-09-19  Chris Dumez  <cdumez@apple.com>
2026
2027         Add better logging for when the view visibility state changes
2028         https://bugs.webkit.org/show_bug.cgi?id=202008
2029
2030         Reviewed by Geoffrey Garen.
2031
2032         * UIProcess/ApplicationStateTracker.mm:
2033         * UIProcess/WebPageProxy.cpp:
2034         (WebKit::WebPageProxy::updateActivityState):
2035         * UIProcess/ios/WebPageProxyIOS.mm:
2036         (WebKit::WebPageProxy::applicationDidEnterBackground):
2037         (WebKit::WebPageProxy::applicationWillEnterForeground):
2038
2039 2019-09-19  Chris Dumez  <cdumez@apple.com>
2040
2041         Regression(r248832): Unable to quicklook HTML files in Mail
2042         https://bugs.webkit.org/show_bug.cgi?id=202012
2043         <rdar://problem/55285295>
2044
2045         Reviewed by Geoff Garen and Brent Fulgham.
2046
2047         r248832 inadvertently reverted the fix for Mail that landed in r247400 by not using
2048         the same logic to initialize the sandbox extension if the process had already
2049         finished launching or not. In particular, the new code path that happens on process
2050         launch unconditionally used '/' as resource directory for the sandbox extension if
2051         the client did not provide one. The logic in maybeInitializeSandboxExtensionHandle()
2052         would use the file URL's base URL as resource directory when creating a sandbox
2053         extension for '/' would fail (which it often does).
2054
2055         To address the issue, have the logic that runs on process launch call
2056         maybeInitializeSandboxExtensionHandle() so avoid duplicating code and make sure
2057         both cases now have the Mail fix.
2058
2059         * UIProcess/AuxiliaryProcessProxy.cpp:
2060         (WebKit::AuxiliaryProcessProxy::didFinishLaunching):
2061         * UIProcess/AuxiliaryProcessProxy.h:
2062         (WebKit::AuxiliaryProcessProxy::isLaunching const):
2063         * UIProcess/WebPageProxy.cpp:
2064         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2065         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2066         (WebKit::WebPageProxy::loadFile):
2067         * UIProcess/WebPageProxy.h:
2068         * WebProcess/WebPage/WebPage.messages.in:
2069
2070 2019-09-19  Tim Horton  <timothy_horton@apple.com>
2071
2072         macCatalyst apps crash under TextCheckingControllerProxy::replaceRelativeToSelection when spell checking
2073         https://bugs.webkit.org/show_bug.cgi?id=202010
2074         <rdar://problem/54974971>
2075
2076         Reviewed by Beth Dakin.
2077
2078         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
2079         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
2080         relativeReplacementRange is in the coordinate space of the document's text,
2081         not the replacement string. We need to adjust into replacement string
2082         coordinates before slicing the replacement, or we'll throw an exception
2083         trying to read past the end of the string, in the case where the
2084         replacement string is shorter than the replaced string (by more than 2 characters).
2085
2086 2019-09-19  Yury Semikhatsky  <yurys@chromium.org>
2087
2088         WebStorageNamespaceProvider / StorageNamespaceImpl no longer need SessionIDs
2089         https://bugs.webkit.org/show_bug.cgi?id=201922
2090         <rdar://problem/55505906>
2091
2092         Reviewed by Chris Dumez.
2093
2094         Fix GTK Debug compilation after https://trac.webkit.org/changeset/250083:
2095         ../../Source/WebKit/WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:75:55: error: no member named 'singleton' in namespace 'WebCore::Process'
2096         ASSERT_UNUSED(sessionID, sessionID == WebProcess::singleton().sessionID());
2097                                           ~~~~~~~~~~~~^
2098
2099         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
2100
2101 2019-09-19  Chris Dumez  <cdumez@apple.com>
2102
2103         WorkerGlobalScope does not need a SessionID
2104         https://bugs.webkit.org/show_bug.cgi?id=201991
2105
2106         Reviewed by Alex Christensen.
2107
2108         WorkerGlobalScope does not need a SessionID, now that we have a single session
2109         per WebProcess.
2110
2111         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2112         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2113         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2114         (WebKit::WebServiceWorkerProvider::serviceWorkerConnection):
2115         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnection):
2116         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession): Deleted.
2117         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession): Deleted.
2118         * WebProcess/Storage/WebServiceWorkerProvider.h:
2119         * WebProcess/WebPage/WebPage.cpp:
2120         (WebKit::WebPage::updateThrottleState):
2121
2122 2019-09-19  Brent Fulgham  <bfulgham@apple.com>
2123
2124         Create InjectedBundle SPI to better support NSSecureCoding
2125         https://bugs.webkit.org/show_bug.cgi?id=201810
2126         <rdar://problem/55265713>
2127
2128         The encoding/decoding routines used by WebKit’s InjectedBundles are based on NSCoding.
2129         While we have changed WebKit internals to use NSSecureCoding, there are a number of
2130         injected bundles that need to serialize custom classes between the InjectedBundle and
2131         the relevant WebKit UIProcess.
2132
2133         We need to lock down this communications channel by enforcing NSSecureCoding.
2134
2135         This patch creates new SPI to allow the UIProcess to specify classes that it will accept
2136         in messages from the WebContet Process (and Injected Bundle).
2137
2138         It adds the following property to the WKProcessPoolConfiguration:
2139
2140             @property (nonatomic, copy) NSSet<Class> *customClassesForParameterCoder;
2141
2142         If no custom classes are specified, the standard serialization primitives are supported:
2143             NSArray, NSData, NSDate, NSDictionary, NSNull, NSNumber, NSSet, NSString,
2144             NSTimeZone, NSURL, and NSUUID.
2145
2146         Reviewed by Brady Eidson.
2147
2148         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2149         (API::ProcessPoolConfiguration::copy): Copy any custom classes.
2150         * UIProcess/API/APIProcessPoolConfiguration.h:
2151         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2152         (WKContextConfigurationCopyCustomClassesForParameterCoder): Added.
2153         (WKContextConfigurationSetCustomClassesForParameterCoder): Added.
2154         * UIProcess/API/C/WKContextConfigurationRef.h:
2155         * UIProcess/API/Cocoa/WKProcessGroup.h:
2156         * UIProcess/API/Cocoa/WKProcessGroup.mm:
2157         (toStringVector): Added.
2158         (-[WKProcessGroup initWithInjectedBundleURL:andCustomClassesForParameterCoder:]):
2159         * UIProcess/API/Cocoa/WKWebView.mm:
2160         (-[WKWebView _setInputDelegate:]): Restrict serialization to allowed classes.
2161         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2162         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2163         (-[_WKProcessPoolConfiguration customClassesForParameterCoder]): Added.
2164         (-[_WKProcessPoolConfiguration setCustomClassesForParameterCoder:]): Added.
2165         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2166         (WebKit::WebProcessPool::platformInitialize): Register any custom classes
2167         provided in the configuraton.
2168         (WebKit::WebProcessPool::initializeClassesForParameterCoding): Added.
2169         (WebKit::WebProcessPool::allowedClassesForParameterCoding const): Added.
2170         * UIProcess/WebProcessPool.h:
2171         * UIProcess/ios/PageClientImplIOS.mm:
2172         (WebKit::PageClientImpl::elementDidFocus): Restrict serialization to allowed
2173         classes only.
2174
2175 2019-09-18  Chris Dumez  <cdumez@apple.com>
2176
2177         AddPlugInAutoStartOriginHash / PlugInDidReceiveUserInteraction IPC should not need to pass a SessionID
2178         https://bugs.webkit.org/show_bug.cgi?id=201962
2179
2180         Reviewed by Geoffrey Garen.
2181
2182         AddPlugInAutoStartOriginHash / PlugInDidReceiveUserInteraction IPC from the WebProcess to the UIProcess
2183         should not need to pass a SessionID, since the UIProcess already knows the SessionID of a given WebProcess.
2184
2185         * UIProcess/WebProcessPool.cpp:
2186         (WebKit::WebProcessPool::addPlugInAutoStartOriginHash): Deleted.
2187         (WebKit::WebProcessPool::plugInDidReceiveUserInteraction): Deleted.
2188         * UIProcess/WebProcessPool.h:
2189         * UIProcess/WebProcessPool.messages.in:
2190         * UIProcess/WebProcessProxy.cpp:
2191         (WebKit::WebProcessProxy::addPlugInAutoStartOriginHash):
2192         (WebKit::WebProcessProxy::plugInDidReceiveUserInteraction):
2193         * UIProcess/WebProcessProxy.h:
2194         * UIProcess/WebProcessProxy.messages.in:
2195         * WebProcess/WebProcess.cpp:
2196         (WebKit::WebProcess::plugInDidStartFromOrigin):
2197         (WebKit::WebProcess::plugInDidReceiveUserInteraction):
2198
2199 2019-09-18  Chris Dumez  <cdumez@apple.com>
2200
2201         WebStorageNamespaceProvider / StorageNamespaceImpl no longer need SessionIDs
2202         https://bugs.webkit.org/show_bug.cgi?id=201922
2203
2204         Reviewed by Geoffrey Garen.
2205
2206         WebStorageNamespaceProvider / StorageNamespaceImpl no longer need SessionIDs, now that
2207         we have a single session per WebProcess.
2208
2209         * WebProcess/WebStorage/StorageAreaMap.cpp:
2210         (WebKit::StorageAreaMap::connect):
2211         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
2212         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
2213         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
2214         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
2215         (WebKit::StorageNamespaceImpl::StorageNamespaceImpl):
2216         (WebKit::StorageNamespaceImpl::sessionID const):
2217         (WebKit::StorageNamespaceImpl::copy):
2218         * WebProcess/WebStorage/StorageNamespaceImpl.h:
2219         (): Deleted.
2220         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
2221         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
2222         (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):
2223         (WebKit::WebStorageNamespaceProvider::createTransientLocalStorageNamespace):
2224
2225 2019-09-18  Chris Dumez  <cdumez@apple.com>
2226
2227         Decrease use of sessionID in WebLoaderStrategy
2228         https://bugs.webkit.org/show_bug.cgi?id=201961
2229
2230         Reviewed by Geoffrey Garen.
2231
2232         * WebProcess/Network/WebLoaderStrategy.cpp:
2233         (WebKit::WebLoaderStrategy::loadResource):
2234         (WebKit::WebLoaderStrategy::scheduleLoad):
2235         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
2236         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2237         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2238         * WebProcess/Network/WebLoaderStrategy.h:
2239
2240 2019-09-18  Chris Dumez  <cdumez@apple.com>
2241
2242         WebSocketStream does not need a SessionID
2243         https://bugs.webkit.org/show_bug.cgi?id=201960
2244
2245         Reviewed by Geoffrey Garen.
2246
2247         WebSocketStream does not need a SessionID, now that we have a single session per WebProcess.
2248
2249         * WebProcess/Network/WebSocketProvider.cpp:
2250         (WebKit::WebSocketProvider::createSocketStreamHandle):
2251         * WebProcess/Network/WebSocketStream.cpp:
2252         (WebKit::WebSocketStream::create):
2253         (WebKit::WebSocketStream::WebSocketStream):
2254         * WebProcess/Network/WebSocketStream.h:
2255
2256 2019-09-18  Chris Dumez  <cdumez@apple.com>
2257
2258         LibWebRTCProvider does not need sessionIDs anymore
2259         https://bugs.webkit.org/show_bug.cgi?id=201959
2260
2261         Reviewed by Geoffrey Garen.
2262
2263         LibWebRTCProvider does not need sessionIDs anymore, now that we have a single session per WebProcess.
2264
2265         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
2266         (WebKit::LibWebRTCProvider::registerMDNSName):
2267         (WebKit::LibWebRTCProvider::createSocketFactory):
2268         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
2269
2270 2019-09-18  Yury Semikhatsky  <yurys@chromium.org>
2271
2272         [GTK] Compilation errors when GL is disabled
2273         https://bugs.webkit.org/show_bug.cgi?id=200223
2274
2275         Fix following compilation error when building with ENABLE_OPENGL=OFF
2276         ../../Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp:123:51: error: use of undeclared identifier 'WaylandCompositor'
2277         parameters.waylandCompositorDisplayName = WaylandCompositor::singleton().displayName();
2278                                                   ^
2279         Reviewed by Philippe Normand.
2280
2281         * UIProcess/glib/WebProcessPoolGLib.cpp:
2282         (WebKit::WebProcessPool::platformInitializeWebProcess): only make a call when using EGL, this matches
2283         guards in WaylandCompositor.h. The condition was changed in r245807.
2284
2285 2019-09-18  Timothy Hatcher  <timothy@apple.com>
2286
2287         Eagerly create and add the m_layerHostingView to WKWebView.
2288         https://bugs.webkit.org/show_bug.cgi?id=201942
2289
2290         Reviewed by Tim Horton.
2291
2292         Some apps will add subviews to WKWebView, and by the time we add our m_layerHostingView view we might be
2293         adding it behind a view that should have been added behind our layer hosting view subview. This affected
2294         the Spark email app, due to changes in order of loading delegate calls and when compositing is enabled.
2295         Instead of delayed creation of m_layerHostingView, always create it and add it to to the WKWebView.
2296         This ensures proper ordering of subviews when clients add a view behind all existing subviews.
2297
2298         * UIProcess/Cocoa/WebViewImpl.mm:
2299         (WebKit::WebViewImpl::WebViewImpl): Create and add m_layerHostingView here.
2300         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): Remove creation and removal of m_layerHostingView.
2301         Just set the sublayers of m_layerHostingView's layer here.
2302
2303 2019-09-18  Joseph Pecoraro  <pecoraro@apple.com>
2304
2305         Web Inspector: Can't drag undocked Inspector window by its title text
2306         https://bugs.webkit.org/show_bug.cgi?id=190886
2307         <rdar://problem/44574547>
2308
2309         Reviewed by Tim Horton.
2310
2311         * UIProcess/mac/WKInspectorWKWebView.mm:
2312         (-[WKInspectorWKWebView _opaqueRectForWindowMoveWhenInTitlebar]):
2313         Legendary.
2314
2315 2019-09-18  Chris Dumez  <cdumez@apple.com>
2316
2317         BlobRegistry no longer needs SessionIDs
2318         https://bugs.webkit.org/show_bug.cgi?id=201936
2319
2320         Reviewed by Geoffrey Garen.
2321
2322         BlobRegistry no longer needs SessionIDs, now that we have a single session per WebProcess.
2323
2324         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
2325         (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
2326         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
2327         (WebKit::BlobRegistryProxy::registerFileBlobURL):
2328         (WebKit::BlobRegistryProxy::registerBlobURL):
2329         (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
2330         (WebKit::BlobRegistryProxy::unregisterBlobURL):
2331         (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
2332         (WebKit::BlobRegistryProxy::writeBlobsToTemporaryFiles):
2333         * WebProcess/FileAPI/BlobRegistryProxy.h:
2334
2335 2019-09-18  Benjamin Nham  <nham@apple.com>
2336
2337         NetworkLoadParameters shouldn't store sessionID
2338         https://bugs.webkit.org/show_bug.cgi?id=201921
2339
2340         Reviewed by Chris Dumez.
2341
2342         Now that there's a single session id per WebProcess, we don't need to
2343         store the session id in NetworkLoadParameters anymore. Clients can just
2344         directly ask NetworkConnectionToWebProcess for the WebProcess's session
2345         ID instead.
2346
2347         * NetworkProcess/AdClickAttributionManager.cpp:
2348         (WebKit::AdClickAttributionManager::fireConversionRequest):
2349         * NetworkProcess/Downloads/DownloadManager.cpp:
2350         (WebKit::DownloadManager::startDownload):
2351         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2352         (WebKit::NetworkCORSPreflightChecker::startPreflight):
2353         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2354         (WebKit::NetworkConnectionToWebProcess::preconnectTo):
2355         * NetworkProcess/NetworkLoadParameters.h:
2356         * NetworkProcess/NetworkResourceLoadMap.h:
2357         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2358         (WebKit::NetworkResourceLoadParameters::encode const):
2359         (WebKit::NetworkResourceLoadParameters::decode):
2360         * NetworkProcess/NetworkResourceLoadParameters.h:
2361         * NetworkProcess/NetworkResourceLoader.cpp:
2362         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
2363         (WebKit::NetworkResourceLoader::startNetworkLoad):
2364         (WebKit::NetworkResourceLoader::convertToDownload):
2365         * NetworkProcess/NetworkResourceLoader.h:
2366         * NetworkProcess/NetworkSession.cpp:
2367         (WebKit::NetworkSession::NetworkSession):
2368         * NetworkProcess/PingLoad.cpp:
2369         (WebKit::PingLoad::PingLoad):
2370         (WebKit::PingLoad::loadRequest):
2371         (WebKit::PingLoad::didReceiveChallenge):
2372         * NetworkProcess/PingLoad.h:
2373         * NetworkProcess/PreconnectTask.cpp:
2374         (WebKit::PreconnectTask::PreconnectTask):
2375         * NetworkProcess/PreconnectTask.h:
2376         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2377         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
2378         * WebProcess/Network/WebLoaderStrategy.cpp:
2379         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2380         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2381         (WebKit::WebLoaderStrategy::startPingLoad):
2382         (WebKit::WebLoaderStrategy::preconnectTo):
2383
2384 2019-09-18  Andy Estes  <aestes@apple.com>
2385
2386         [Apple Pay] Tell websites why a session was cancelled
2387         https://bugs.webkit.org/show_bug.cgi?id=201912
2388         <rdar://problem/55469706>
2389
2390         Reviewed by Brady Eidson.
2391
2392         Remembered the error passed to -[WKPaymentAuthorizationDelegate _willFinishWithError:] and
2393         sent it to the WebContent process in Messages::WebPaymentCoordinator::DidCancelPaymentSession.
2394
2395         * Platform/cocoa/PaymentAuthorizationPresenter.h:
2396         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
2397         (-[WKPaymentAuthorizationDelegate _didFinish]):
2398         (-[WKPaymentAuthorizationDelegate _willFinishWithError:]):
2399         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
2400         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
2401         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish):
2402         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
2403         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
2404         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
2405         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2406         (IPC::ArgumentCoder<WebCore::PaymentSessionError>::encode):
2407         (IPC::ArgumentCoder<WebCore::PaymentSessionError>::decode):
2408         * Shared/WebCoreArgumentCoders.h:
2409         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2410         (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed):
2411         (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
2412         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2413         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
2414
2415 2019-09-18  Chris Dumez  <cdumez@apple.com>
2416
2417         WebSWContextManagerConnection::installServiceWorker IPC no longer need a sessionID
2418         https://bugs.webkit.org/show_bug.cgi?id=201882
2419
2420         Reviewed by Geoffrey Garen.
2421
2422         WebSWContextManagerConnection::installServiceWorker IPC no longer need a sessionID now that we have a single
2423         sessionID per WebProcess.
2424
2425         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2426         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
2427         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
2428         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2429         (WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient):
2430         (WebKit::ServiceWorkerFrameLoaderClient::sessionID const):
2431         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
2432         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2433         * WebProcess/Storage/WebSWContextManagerConnection.h:
2434         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2435         * WebProcess/WebProcess.cpp:
2436         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
2437
2438 2019-09-18  Chris Dumez  <cdumez@apple.com>
2439
2440         Stop passing sessionIDs to NetworkProcessConnection methods
2441         https://bugs.webkit.org/show_bug.cgi?id=201886
2442
2443         Reviewed by Geoffrey Garen.
2444
2445         Stop passing sessionIDs to NetworkProcessConnection methods. This is no longer
2446         necessary now that we have a single session per WebProcess.
2447
2448         * NetworkProcess/NetworkResourceLoader.cpp:
2449         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
2450         * WebProcess/Databases/WebDatabaseProvider.cpp:
2451         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
2452         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
2453         (WebKit::BlobRegistryProxy::writeBlobsToTemporaryFiles):
2454         * WebProcess/Network/NetworkProcessConnection.cpp:
2455         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
2456         (WebKit::NetworkProcessConnection::didCacheResource):
2457         (WebKit::NetworkProcessConnection::idbConnectionToServer):
2458         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession): Deleted.
2459         * WebProcess/Network/NetworkProcessConnection.h:
2460         * WebProcess/Network/NetworkProcessConnection.messages.in:
2461
2462 2019-09-18  Chris Dumez  <cdumez@apple.com>
2463
2464         CacheStorageProvider::createCacheStorageConnection() does not need to take in a SessionID
2465         https://bugs.webkit.org/show_bug.cgi?id=201920
2466
2467         Reviewed by Geoffrey Garen.
2468
2469         CacheStorageProvider::createCacheStorageConnection() does not need to take in a SessionID.
2470         This sessionID is no longer used now that we have a session per WebProcess.
2471
2472         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
2473         (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
2474         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2475         (WebKit::WebCacheStorageConnection::sessionID const): Deleted.
2476         * WebProcess/Cache/WebCacheStorageConnection.h:
2477         * WebProcess/Cache/WebCacheStorageProvider.cpp:
2478         (WebKit::WebCacheStorageProvider::createCacheStorageConnection):
2479         * WebProcess/Cache/WebCacheStorageProvider.h:
2480         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
2481         (WebKit::BlobRegistryProxy::blobSize):
2482         * WebProcess/FileAPI/BlobRegistryProxy.h:
2483
2484 2019-09-18  Chris Dumez  <cdumez@apple.com>
2485
2486         Drop FrameLoaderClient::sessionID()
2487         https://bugs.webkit.org/show_bug.cgi?id=201916
2488
2489         Reviewed by Geoffrey Garen.
2490
2491         Drop FrameLoaderClient::sessionID(). The Frame can get the sessionID from its page (Which is
2492         what the FrameLoaderClient::sessionID() ended up doing) and other call sites at WebKit2 layer
2493         can get the sessionID from the WebProcess singleton.
2494
2495         * WebProcess/Network/WebLoaderStrategy.cpp:
2496         (WebKit::WebLoaderStrategy::scheduleLoad):
2497         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2498         (WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient):
2499         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2500         * WebProcess/Storage/WebSWContextManagerConnection.h:
2501         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2502         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2503
2504 2019-09-18  Chris Dumez  <cdumez@apple.com>
2505
2506         WebServiceWorkerProvider::handleFetch() does not need to take in a sessionID
2507         https://bugs.webkit.org/show_bug.cgi?id=201917
2508
2509         Reviewed by Geoffrey Garen.
2510
2511         * WebProcess/Network/WebLoaderStrategy.cpp:
2512         (WebKit::WebLoaderStrategy::scheduleLoad):
2513         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2514         (WebKit::WebServiceWorkerProvider::handleFetch):
2515         * WebProcess/Storage/WebServiceWorkerProvider.h:
2516
2517 2019-09-18  Chris Dumez  <cdumez@apple.com>
2518
2519         WebSWServerToContextConnection::PostMessageToServiceWorkerClient IPC no longer needs to take a sessionID
2520         https://bugs.webkit.org/show_bug.cgi?id=201883
2521
2522         Reviewed by Geoffrey Garen.
2523
2524         WebSWServerToContextConnection::PostMessageToServiceWorkerClient IPC no longer needs to take a sessionID,
2525         now that we have a single session per WebProcess.
2526
2527         * NetworkProcess/NetworkProcess.cpp:
2528         * NetworkProcess/NetworkProcess.h:
2529         * NetworkProcess/NetworkProcess.messages.in:
2530         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2531         (WebKit::WebSWServerToContextConnection::postMessageToServiceWorkerClient):
2532         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
2533         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
2534         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2535         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
2536         * WebProcess/Storage/WebSWContextManagerConnection.h:
2537
2538 2019-09-18  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2539
2540         [GTK][WPE] bubblewrap sandbox should be disabled when running inside docker
2541         https://bugs.webkit.org/show_bug.cgi?id=201914
2542
2543         Reviewed by Michael Catanzaro.
2544
2545         Detect if running inside Docker by checking the file /.dockerenv
2546         In that case, disable the sandbox.
2547
2548         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2549         (WebKit::isInsideDocker):
2550         (WebKit::ProcessLauncher::launchProcess):
2551
2552 2019-09-17  Ross Kirsling  <ross.kirsling@sony.com>
2553
2554         Unreviewed WinCairo build fix following r249985.
2555
2556         * Shared/WebProcessDataStoreParameters.h:
2557
2558 2019-09-17  Dean Jackson  <dino@apple.com>
2559
2560         Remove the "Show Link Previews" and "Hide Link Previews" action menus in the preview platter
2561         https://bugs.webkit.org/show_bug.cgi?id=201864
2562         <rdar://55190038>
2563
2564         Reviewed by Simon Fraser.
2565
2566         * UIProcess/ios/WKActionSheetAssistant.mm: Remove the toggle action from the
2567         default values.
2568         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
2569         * UIProcess/ios/WKContentViewInteraction.mm: No longer try to add a toggle when
2570         it isn't there.
2571         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
2572         (menuWithShowLinkPreviewAction): Deleted.
2573
2574 2019-09-17  Chris Dumez  <cdumez@apple.com>
2575
2576         Stop calling Page::setSessionID() from WebKit2
2577         https://bugs.webkit.org/show_bug.cgi?id=201888
2578
2579         Reviewed by Alex Christensen.
2580
2581         Stop calling Page::setSessionID() from WebKit2 since Page's sessionID can never change when
2582         using WebKit2 (We process-swap and create a new Page in a new process when changing data
2583         store). Instead, we now pass the sessionID ID when constructing the Page, as part of the
2584         PageConfiguration structure.
2585
2586         * Shared/WebsitePoliciesData.cpp:
2587         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2588         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2589         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2590         * WebProcess/WebPage/WebPage.cpp:
2591         (WebKit::m_textAutoSizingAdjustmentTimer):
2592         (WebKit::WebPage::setSessionID): Deleted.
2593         * WebProcess/WebPage/WebPage.h:
2594
2595 2019-09-17  Mark Lam  <mark.lam@apple.com>
2596
2597         Use constexpr instead of const in symbol definitions that are obviously constexpr.
2598         https://bugs.webkit.org/show_bug.cgi?id=201879
2599
2600         Rubber-stamped by Joseph Pecoraro.
2601
2602         * WebProcess/Plugins/Netscape/JSNPObject.h:
2603
2604 2019-09-17  Ross Kirsling  <ross.kirsling@sony.com>
2605
2606         Unreviewed restabilization of non-unified build.
2607
2608         * UIProcess/WebProcessProxy.cpp:
2609         * WebProcess/Network/WebLoaderStrategy.cpp:
2610         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
2611
2612 2019-09-17  Chris Dumez  <cdumez@apple.com>
2613
2614         WebProcess class methods should not need to take a sessionID
2615         https://bugs.webkit.org/show_bug.cgi?id=201881
2616
2617         Reviewed by Geoffrey Garen.
2618
2619         WebProcess class methods should not need to take a sessionID given that we have a single
2620         session per WebProcess now.
2621
2622         * Shared/WebProcessCreationParameters.cpp:
2623         (WebKit::WebProcessCreationParameters::encode const):
2624         (WebKit::WebProcessCreationParameters::decode):
2625         * Shared/WebProcessCreationParameters.h:
2626         * Shared/WebProcessDataStoreParameters.h:
2627         (WebKit::WebProcessDataStoreParameters::encode const):
2628         (WebKit::WebProcessDataStoreParameters::decode):
2629         * UIProcess/Plugins/PlugInAutoStartProvider.cpp:
2630         (WebKit::PlugInAutoStartProvider::addAutoStartOriginHash):
2631         (WebKit::PlugInAutoStartProvider::autoStartOriginHashesCopy const):
2632         (WebKit::PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest):
2633         (WebKit::PlugInAutoStartProvider::didReceiveUserInteraction):
2634         * UIProcess/Plugins/PlugInAutoStartProvider.h:
2635         * UIProcess/WebProcessPool.cpp:
2636         (WebKit::WebProcessPool::webProcessDataStoreParameters):
2637         (WebKit::WebProcessPool::initializeNewWebProcess):
2638         * UIProcess/WebProcessPool.h:
2639         (WebKit::WebProcessPool::sendToAllProcesses):
2640         (WebKit::WebProcessPool::sendToAllProcessesForSession):
2641         * UIProcess/WebProcessProxy.cpp:
2642         (WebKit::WebProcessProxy::fetchWebsiteData):
2643         (WebKit::WebProcessProxy::deleteWebsiteData):
2644         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2645         (WebKit::WebProcessProxy::establishServiceWorkerContext):
2646         * WebProcess/Plugins/PluginView.cpp:
2647         (WebKit::PluginView::pluginDidReceiveUserInteraction):
2648         * WebProcess/WebCoreSupport/WebPlugInClient.cpp:
2649         (WebKit::WebPlugInClient::didStartFromOrigin):
2650         * WebProcess/WebPage/WebPage.cpp:
2651         (WebKit::WebPage::close):
2652         * WebProcess/WebProcess.cpp:
2653         (WebKit::WebProcess::initializeWebProcess):
2654         (WebKit::WebProcess::setWebsiteDataStoreParameters):
2655         (WebKit::WebProcess::removeWebPage):
2656         (WebKit::WebProcess::isPlugInAutoStartOriginHash):
2657         (WebKit::WebProcess::shouldPlugInAutoStartFromOrigin):
2658         (WebKit::WebProcess::plugInDidStartFromOrigin):
2659         (WebKit::WebProcess::didAddPlugInAutoStartOriginHash):
2660         (WebKit::WebProcess::resetPlugInAutoStartOriginHashes):
2661         (WebKit::WebProcess::plugInDidReceiveUserInteraction):
2662         (WebKit::WebProcess::fetchWebsiteData):
2663         (WebKit::WebProcess::deleteWebsiteData):
2664         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
2665         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
2666         * WebProcess/WebProcess.h:
2667         * WebProcess/WebProcess.messages.in:
2668
2669 2019-09-17  Chris Dumez  <cdumez@apple.com>
2670
2671         WebMDNSRegister no longer needs to be provided sessionIDs
2672         https://bugs.webkit.org/show_bug.cgi?id=201876
2673
2674         Reviewed by Geoffrey Garen.
2675
2676         WebMDNSRegister no longer needs to be provided sessionIDs, now that we
2677         have one session per WebProcess.
2678
2679         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
2680         (WebKit::NetworkMDNSRegister::registerMDNSName):
2681         (WebKit::NetworkMDNSRegister::sessionID const):
2682         * NetworkProcess/webrtc/NetworkMDNSRegister.h:
2683         * NetworkProcess/webrtc/NetworkMDNSRegister.messages.in:
2684         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
2685         (WebKit::LibWebRTCProvider::registerMDNSName):
2686         (WebKit::LibWebRTCProvider::createSocketFactory):
2687         * WebProcess/Network/webrtc/WebMDNSRegister.cpp:
2688         (WebKit::WebMDNSRegister::registerMDNSName):
2689         * WebProcess/Network/webrtc/WebMDNSRegister.h:
2690
2691 2019-09-17  Chris Dumez  <cdumez@apple.com>
2692
2693         WebSWServerConnection does not need to store a sessionID
2694         https://bugs.webkit.org/show_bug.cgi?id=201878
2695
2696         Reviewed by Geoffrey Garen.
2697
2698         WebSWServerConnection does not need to store a sessionID, it can simply get it from its SWServer.
2699
2700         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2701         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
2702         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2703         (WebKit::WebSWServerConnection::WebSWServerConnection):
2704         (WebKit::WebSWServerConnection::startFetch):
2705         (WebKit::WebSWServerConnection::sessionID const):
2706         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2707
2708 2019-09-17  Chris Dumez  <cdumez@apple.com>
2709
2710         WebPaymentCoordinatorProxy does not need sessionIDs
2711         https://bugs.webkit.org/show_bug.cgi?id=201875
2712
2713         Reviewed by Geoffrey Garen.
2714
2715         WebPaymentCoordinatorProxy does not need sessionIDs so let's stop passing them around.
2716
2717         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
2718         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
2719         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
2720         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
2721         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
2722         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2723         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
2724         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest):
2725         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
2726         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
2727         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2728         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
2729         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2730         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
2731         (WebKit::WebPaymentCoordinator::showPaymentUI):
2732
2733 2019-09-17  Chris Dumez  <cdumez@apple.com>
2734
2735         There should be a single CacheStorageConnection per WebProcess
2736         https://bugs.webkit.org/show_bug.cgi?id=201874
2737
2738         Reviewed by Geoffrey Garen.
2739
2740         There should be a single CacheStorageConnection per WebProcess now that we have a single session
2741         per WebProcess. This invariant allows us to simplify the code.
2742
2743         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2744         (WebKit::CacheStorageEngineConnection::~CacheStorageEngineConnection):
2745         (WebKit::CacheStorageEngineConnection::open):
2746         (WebKit::CacheStorageEngineConnection::remove):
2747         (WebKit::CacheStorageEngineConnection::caches):
2748         (WebKit::CacheStorageEngineConnection::retrieveRecords):
2749         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
2750         (WebKit::CacheStorageEngineConnection::putRecords):
2751         (WebKit::CacheStorageEngineConnection::reference):
2752         (WebKit::CacheStorageEngineConnection::dereference):
2753         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
2754         (WebKit::CacheStorageEngineConnection::engineRepresentation):
2755         (WebKit::CacheStorageEngineConnection::sessionID const):
2756         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2757         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
2758         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2759         (WebKit::WebCacheStorageConnection::WebCacheStorageConnection):
2760         (WebKit::WebCacheStorageConnection::open):
2761         (WebKit::WebCacheStorageConnection::remove):
2762         (WebKit::WebCacheStorageConnection::retrieveCaches):
2763         (WebKit::WebCacheStorageConnection::retrieveRecords):
2764         (WebKit::WebCacheStorageConnection::batchDeleteOperation):
2765         (WebKit::WebCacheStorageConnection::batchPutOperation):
2766         (WebKit::WebCacheStorageConnection::reference):
2767         (WebKit::WebCacheStorageConnection::dereference):
2768         (WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
2769         (WebKit::WebCacheStorageConnection::engineRepresentation):
2770         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
2771         (WebKit::WebCacheStorageConnection::sessionID const):
2772         * WebProcess/Cache/WebCacheStorageConnection.h:
2773         * WebProcess/Cache/WebCacheStorageProvider.cpp:
2774         (WebKit::WebCacheStorageProvider::createCacheStorageConnection):
2775         * WebProcess/Cache/WebCacheStorageProvider.h:
2776
2777 2019-09-17  Chris Dumez  <cdumez@apple.com>
2778
2779         Unreviewed attempt to fix internal build after r249962.
2780
2781         * UIProcess/API/C/WKPreferencesRef.h:
2782
2783 2019-09-17  Chris Dumez  <cdumez@apple.com>
2784
2785         REGRESSION (r249923): ASSERTION FAILED: sessionID == WebProcess::singleton().sessionID() in WebCore::SWClientConnection *WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession(PAL::SessionID)
2786         https://bugs.webkit.org/show_bug.cgi?id=201859
2787         <rdar://problem/55426742>
2788
2789         Reviewed by Alex Christensen.
2790
2791         Drop support for the WKPreferencesSetPrivateBrowsingEnabled() C API (Mark as deprecated and make it a no-op) as it
2792         was changing a WebContent process's sessionID, which is no longer supported. This was also using the legacy private
2793         browsing session, which we're trying to get rid of. There is suitable C API to do private browsing (WKWebsiteDataStoreRef).
2794
2795         * Shared/WebPreferences.yaml:
2796         * UIProcess/API/C/WKPreferences.cpp:
2797         (WKPreferencesSetPrivateBrowsingEnabled):
2798         (WKPreferencesGetPrivateBrowsingEnabled):
2799         * UIProcess/API/C/WKPreferencesRef.h:
2800         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2801         (WKPageIsURLKnownHSTSHost):
2802         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2803         (WebKit::WebProcessPool::isURLKnownHSTSHost const):
2804         * UIProcess/WebPreferences.cpp:
2805         (WebKit::WebPreferences::addPage):
2806         (WebKit::WebPreferences::removePage):
2807         (WebKit::WebPreferences::updateBoolValueForKey):
2808         * UIProcess/WebPreferences.h:
2809         * UIProcess/WebProcessPool.cpp:
2810         (WebKit::WebProcessPool::ensureNetworkProcess):
2811         * UIProcess/WebProcessPool.h:
2812         * WebProcess/WebPage/WebPage.cpp:
2813         (WebKit::WebPage::updatePreferences):
2814
2815 2019-09-17  Chris Dumez  <cdumez@apple.com>
2816
2817         REGRESSION (iOS 13): rAF stops firing when navigating away cross-origin and then back
2818         https://bugs.webkit.org/show_bug.cgi?id=201767
2819         <rdar://problem/55350854>
2820
2821         Reviewed by Geoffrey Garen.
2822
2823         When navigating back and restoring a SuspendedPage, WebPage::reinitializeWebPage() ends up
2824         reconstructing a new DrawingArea to match the identifier of the DrawingAreaProxy that the
2825         UIProcess created. The issue is that when reconstructing the DrawingArea, we were losing
2826         the DisplayRefreshMonitors that had been registered on the previous drawing area. To
2827         address the issue, we now make sure to transfer the DisplayRefreshMonitors over from the
2828         old to the new drawing area. This patch is kept as small as possible to faciliate cherry
2829         picking to a branch. However, I think we should consider refactoring the code so that
2830         we no longer need to re-create the DrawingArea in the WebProcess in this case.
2831
2832         * WebProcess/WebPage/DrawingArea.h:
2833         (WebKit::DrawingArea::adoptDisplayRefreshMonitorsFromDrawingArea):
2834         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2835         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2836         (WebKit::RemoteLayerTreeDrawingArea::adoptDisplayRefreshMonitorsFromDrawingArea):
2837         * WebProcess/WebPage/WebPage.cpp:
2838         (WebKit::WebPage::reinitializeWebPage):
2839
2840 2019-09-17  Truitt Savell  <tsavell@apple.com>
2841
2842         Unreviewed, rolling out r249950.
2843
2844         Broke the iOS build.
2845
2846         Reverted changeset:
2847
2848         "Remove the "Show Link Previews" and "Hide Link Previews"
2849         action menus in the preview platter"
2850         https://bugs.webkit.org/show_bug.cgi?id=201864
2851         https://trac.webkit.org/changeset/249950
2852
2853 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2854
2855         [GTK] Initial view loading is slow
2856         https://bugs.webkit.org/show_bug.cgi?id=201451
2857
2858         Reviewed by Sergio Villar Senin.
2859
2860         The problem is that now we are always calling DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() after a
2861         new process is launched and we used to do that only when launching a new process after a crash. This makes
2862         m_hasReceivedFirstUpdate useless, because it's always set to true right after a process is launched. Then, we
2863         wait up to half a second (which is usually the case for the initial load) until the first update. We only want
2864         to do that when recovering from a crash or when swapping processes to avoid flashing effect.
2865
2866         * UIProcess/WebPageProxy.cpp:
2867         (WebKit::WebPageProxy::launchProcess): Add ProcessLaunchReason parameter and pass it to
2868         finishAttachingToWebProcess instead of IsProcessSwap.
2869         (WebKit::WebPageProxy::swapToWebProcess): Pass ProcessLaunchReason::ProcessSwap to
2870         finishAttachingToWebProcess().
2871         (WebKit::WebPageProxy::finishAttachingToWebProcess): Do not call
2872         DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() when process launch reason is ProcessLaunchReason::InitialProcess.
2873         (WebKit::WebPageProxy::launchProcessForReload): Pass ProcessLaunchReason::Reload to launchProcess().
2874         * UIProcess/WebPageProxy.h: Remove IsProcessSwap and add ProcessLaunchReason instead that is passed to
2875         launchProcess and finishAttachingToWebProcess.
2876
2877 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2878
2879         REGRESSION(r249275): [GTK][WPE] WebPage injected bundle messages no longer work
2880         https://bugs.webkit.org/show_bug.cgi?id=201865
2881
2882         Reviewed by Žan Doberšek.
2883
2884         We use them to implement the web resources API. This is another regression of r249275 because we are using the
2885         page proxy identifier when we really want to the web page identifier.
2886
2887         * UIProcess/API/glib/WebKitWebContext.cpp:
2888         (webkitWebContextGetWebViewForPage): Use WebPageProxy::webPageID() instead of WebPageProxy::identifier().
2889
2890 2019-09-17  Dean Jackson  <dino@apple.com>
2891
2892         Remove the "Show Link Previews" and "Hide Link Previews" action menus in the preview platter
2893         https://bugs.webkit.org/show_bug.cgi?id=201864
2894         <rdar://55190038>
2895
2896         Reviewed by Simon Fraser.
2897
2898         * UIProcess/ios/WKActionSheetAssistant.mm: Remove the toggle action from the
2899         default values.
2900         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
2901         * UIProcess/ios/WKContentViewInteraction.mm: No longer try to add a toggle when
2902         it isn't there.
2903         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
2904         (menuWithShowLinkPreviewAction): Deleted.
2905
2906 2019-09-17  Jiewen Tan  <jiewen_tan@apple.com>
2907
2908         [WebAuthn] Use WebPreferences instead of RuntimeEnabledFeatures in UIProcess
2909         https://bugs.webkit.org/show_bug.cgi?id=198176
2910         <rdar://problem/55285709>
2911
2912         Reviewed by Youenn Fablet.
2913
2914         This patch does the following two things:
2915         1) It merges WebAuthenticationRequestData::creationOptions and requestOptions into a variant, and therefore
2916         merges code paths that involve WebAuthenticationRequestData.
2917         2) It teaches WebAuthenticationRequestData to store a WebPreferences such that AuthenticatorManager could utilize
2918         runtime feature flags to turn features on or off.
2919
2920         * UIProcess/WebAuthentication/Authenticator.cpp:
2921         (WebKit::Authenticator::handleRequest):
2922         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2923         (WebKit::AuthenticatorManager::handleRequest):
2924         (WebKit::AuthenticatorManager::clearState):
2925         (WebKit::AuthenticatorManager::authenticatorAdded):
2926         (WebKit::AuthenticatorManager::startDiscovery):
2927         (WebKit::AuthenticatorManager::makeCredential): Deleted.
2928         (WebKit::AuthenticatorManager::getAssertion): Deleted.
2929         * UIProcess/WebAuthentication/AuthenticatorManager.h:
2930         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2931         (WebKit::LocalAuthenticator::makeCredential):
2932         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
2933         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
2934         (WebKit::LocalAuthenticator::getAssertion):
2935         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
2936         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
2937         (WebKit::LocalService::isAvailable):
2938         Don't check RuntimeEnabledFeatures given it is for WebCore.
2939         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
2940         (): Deleted.
2941         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
2942         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
2943         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
2944         (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
2945         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
2946         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
2947         (WebKit::CtapAuthenticator::makeCredential):
2948         (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived const):
2949         (WebKit::CtapAuthenticator::getAssertion):
2950         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
2951         (WebKit::U2fAuthenticator::makeCredential):
2952         (WebKit::U2fAuthenticator::checkExcludeList):
2953         (WebKit::U2fAuthenticator::issueRegisterCommand):
2954         (WebKit::U2fAuthenticator::getAssertion):
2955         (WebKit::U2fAuthenticator::issueSignCommand):
2956         (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
2957         (WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived):
2958
2959 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2960
2961         Keeps running obsolete WebProcess-es for too long
2962         https://bugs.webkit.org/show_bug.cgi?id=201492
2963
2964         Reviewed by Chris Dumez.
2965
2966         That's how the web process cache is expected to work, but it's true that it probably only makes sense to use it
2967         when cache model is primary web browser.
2968
2969         * UIProcess/WebProcessCache.cpp:
2970         (WebKit::WebProcessCache::updateCapacity): Disable the web process cache when cache model is not primary web browser.
2971
2972 2019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2973
2974         [GTK] Crash closing web view while hardware acceleration is enabled
2975         https://bugs.webkit.org/show_bug.cgi?id=200856
2976
2977         Reviewed by Michael Catanzaro.
2978
2979         The crash happens when destroying the WaylandCompositor::Surface because the web view GL context is used to
2980         release the texture, but the GL context is no longer valid after web view
2981         unrealize. AcceleratedBackingStoreWayland should handle the web view unrealize to destroy the GL context. It
2982         will be created on demand again after the web view is realized.
2983
2984         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2985         (webkitWebViewBaseRealize): Notify AcceleratedBackingStore.
2986         (webkitWebViewBaseUnrealize): Ditto.
2987         * UIProcess/gtk/AcceleratedBackingStore.h:
2988         (WebKit::AcceleratedBackingStore::realize): Added.
2989         (WebKit::AcceleratedBackingStore::unrealize): Added.
2990         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
2991         (WebKit::AcceleratedBackingStoreWayland::realize): In case of using WaylandCompositor, call
2992         WaylandCompositor::bindWebPage() to bind the WebPageProxy to the Wayland surface.
2993         (WebKit::AcceleratedBackingStoreWayland::unrealize): Destroy GL resources and the GL context.
2994         (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext): Do not try to create the GL context if the web
2995         view is not realized.
2996         (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Remove the code to initialize the texture.
2997         (WebKit::AcceleratedBackingStoreWayland::paint): And add it here.
2998         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
2999         * UIProcess/gtk/WaylandCompositor.cpp:
3000         (WebKit::WaylandCompositor::Surface::setWebPage): Return early if given page is the current one already.
3001         (WebKit::WaylandCompositor::bindWebPage): Set the surface WebPageProxy.
3002         (WebKit::WaylandCompositor::unbindWebPage): Unset the surface WebPageProxy.
3003         * UIProcess/gtk/WaylandCompositor.h:
3004         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3005         (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): When restoring a previous layer tree
3006         host, always call resumeRendering() to balance the suspendRendering() called in exitAcceleratedCompositingMode().
3007
3008 2019-09-16  Ryan Haddad  <ryanhaddad@apple.com>
3009
3010         Unreviewed, rolling out r249910.
3011
3012         Caused layout test failures and timeouts on Catalina
3013
3014         Reverted changeset:
3015
3016         "REGRESSION(249649): Unable to open local files in MiniBrowser
3017         on macOS"
3018         https://bugs.webkit.org/show_bug.cgi?id=201798
3019         https://trac.webkit.org/changeset/249910
3020
3021 2019-09-16  Chris Dumez  <cdumez@apple.com>
3022
3023         Drop sessionID / websiteDataStoreID from WebPageCreationParameters
3024         https://bugs.webkit.org/show_bug.cgi?id=201847
3025
3026         Reviewed by Youenn Fablet.
3027
3028         Drop sessionID / websiteDataStoreID from WebPageCreationParameters now that we have
3029         one session per WebProcess.
3030
3031         * Shared/WebPageCreationParameters.cpp:
3032         (WebKit::WebPageCreationParameters::encode const):
3033         (WebKit::WebPageCreationParameters::decode):
3034         * Shared/WebPageCreationParameters.h:
3035         (WebKit::WebPageCreationParameters::WebPageCreationParameters): Deleted.
3036         * UIProcess/WebPageProxy.cpp:
3037         (WebKit::WebPageProxy::creationParameters):
3038         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3039         (WebKit::WebChromeClient::createWindow):
3040         * WebProcess/WebPage/WebPage.cpp:
3041         (WebKit::m_textAutoSizingAdjustmentTimer):
3042         * WebProcess/WebProcess.cpp:
3043         (WebKit::WebProcess::createWebPage):
3044
3045 2019-09-16  Dean Jackson  <dino@apple.com>
3046
3047         Provide a prototype for AR QuickLook to trigger processing in the originating page
3048         https://bugs.webkit.org/show_bug.cgi?id=201371
3049
3050         Hopefully fix the public iOS 13 build.
3051
3052         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3053
3054 2019-09-16  David Kilzer  <ddkilzer@apple.com>
3055
3056         [WebAuthn] Name instance variables consistently in WKMockNFTag
3057         <https://webkit.org/b/201845>
3058
3059         Reviewed by Jiewen Tan.
3060
3061         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
3062         Make all @synthesize instance variables use a leading underscore
3063         for their name.
3064
3065 2019-09-16  Dean Jackson  <dino@apple.com>
3066
3067         REGRESSION: iPad: Safari becomes unresponsive after context menu on 1-800-MY-APPLE phone number, tapping 'Add to Contacts'
3068         https://bugs.webkit.org/show_bug.cgi?id=201816
3069         <rdar://55105827>
3070
3071         Reviewed by Darin Adler.
3072
3073         When generating the DataDetectorsContext for a position, we should
3074         also provide the source rectangle for the link in root view coordinates.
3075         This allows DataDetectors to show any modal dialogs in the right
3076         position.
3077
3078         * UIProcess/ios/WKContentViewInteraction.mm: Use either the bounds of the positionInformation
3079         or the text bounding rectangle.
3080         (-[WKContentView dataDetectionContextForPositionInformation:]):
3081
3082 2019-09-16  Chris Dumez  <cdumez@apple.com>
3083
3084         NetworkProcessConnection does not need HashMaps of sessionIDs for Service Workers and IDB
3085         https://bugs.webkit.org/show_bug.cgi?id=201830
3086
3087         Reviewed by Geoffrey Garen.
3088
3089         NetworkProcessConnection does not need HashMaps of sessionIDs for Service Workers and IDB, since
3090         we now have one sessionID per WebContent process.
3091
3092         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
3093         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
3094         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3095         (WebKit::WebIDBConnectionToServer::create):
3096         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
3097         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
3098         * WebProcess/Databases/WebDatabaseProvider.cpp:
3099         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
3100         * WebProcess/Network/NetworkProcessConnection.cpp:
3101         (WebKit::NetworkProcessConnection::didReceiveMessage):
3102         (WebKit::NetworkProcessConnection::didClose):
3103         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
3104         (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession):
3105         * WebProcess/Network/NetworkProcessConnection.h:
3106         (WebKit::NetworkProcessConnection::existingIDBConnectionToServer const):
3107         (WebKit::NetworkProcessConnection::existingServiceWorkerConnectionForSession):
3108         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3109         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
3110         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession):
3111         (WebKit::WebServiceWorkerProvider::handleFetch):
3112         * WebProcess/WebProcess.cpp:
3113         (WebKit::WebProcess::networkProcessConnectionClosed):
3114
3115 2019-09-16  Brent Fulgham  <bfulgham@apple.com>
3116
3117         [FTW] Correct lifespan of other SharedBitmaps
3118         https://bugs.webkit.org/show_bug.cgi?id=201800
3119
3120         Reviewed by Dean Jackson.
3121
3122         The pop-up menu code creates its own SharedBitmap in the WebContent process,
3123         which needs to release its handle before destruction, otherwise the UIProcess
3124         will be unable to access the GPU texture (since it will have been cleaned up).
3125
3126         Since WebPopupMenuProxyWin has its own HWND and WinProc, it needs its own
3127         swapChain to handle syncing of content to the screen.
3128
3129         This patch also audits other uses of SharedBitmap to make sure a similar
3130         problem doesn't exist elsewhere.
3131
3132         * Shared/ShareableBitmap.h:
3133         * Shared/win/ShareableBitmapDirect2D.cpp:
3134         (WebKit::ShareableBitmap::paint):
3135         (WebKit::ShareableBitmap::createDirect2DSurface):
3136         * UIProcess/win/WebPopupMenuProxyWin.cpp:
3137         (WebKit::WebPopupMenuProxyWin::showPopupMenu): Add Direct2D code paths.
3138         (WebKit::WebPopupMenuProxyWin::paint): Update for Direct2D.
3139         (WebKit::WebPopupMenuProxyWin::setupSwapChain): Added.
3140         (WebKit::WebPopupMenuProxyWin::configureBackingStore): Added.
3141         * UIProcess/win/WebPopupMenuProxyWin.h:
3142         * UIProcess/win/WebView.cpp:
3143         (WebKit::WebView::setupSwapChain): Move some implementation code to the
3144         Direct2DUtilities file.
3145         * UIProcess/win/WebView.h:
3146         (WebKit::WebView::d3dDevice const):
3147         (WebKit::WebView::d3dImmediateContext const):
3148         (WebKit::WebView::d3dDevice): Deleted.
3149         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
3150         (WebKit::WebPopupMenu::show):
3151         * WebProcess/WebPage/FindController.cpp:
3152         (WebKit::FindController::getImageForFindMatch): Prevent WebContent process from
3153         destroying SharedBitmap before the UIProcess can receive it.
3154
3155 2019-09-16  Chris Dumez  <cdumez@apple.com>
3156
3157         Simplify WebResourceLoadObserver now that we have one WebProcess per session
3158         https://bugs.webkit.org/show_bug.cgi?id=201821
3159
3160         Reviewed by Brent Fulgham.
3161
3162         Simplify WebResourceLoadObserver now that we have one WebProcess per session.
3163         No need to pass sessionIDs around or store statistics per sessionID.
3164         Also, only initialize the WebResourceLoadObserver if both ITP is enabled and
3165         we're not in a WebContent process used for an ephemeral session.
3166
3167         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3168         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
3169         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3170         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3171         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
3172         * NetworkProcess/NetworkConnectionToWebProcess.h:
3173         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3174         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
3175         (WebKit::WebResourceLoadObserver::requestStorageAccessUnderOpener):
3176         (WebKit::WebResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
3177         (WebKit::WebResourceLoadObserver::scheduleNotificationIfNeeded):
3178         (WebKit::WebResourceLoadObserver::statisticsForURL):
3179         (WebKit::WebResourceLoadObserver::takeStatistics):
3180         (WebKit::WebResourceLoadObserver::clearState):
3181         (WebKit::WebResourceLoadObserver::logFontLoad):
3182         (WebKit::WebResourceLoadObserver::logCanvasRead):
3183         (WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure):
3184         (WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed):
3185         (WebKit::WebResourceLoadObserver::logScreenAPIAccessed):
3186         (WebKit::WebResourceLoadObserver::logSubresourceLoading):
3187         (WebKit::WebResourceLoadObserver::logWebSocketLoading):
3188         (WebKit::WebResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3189         * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
3190         * WebProcess/WebProcess.cpp:
3191         (WebKit::WebProcess::setWebsiteDataStoreParameters):
3192
3193 2019-09-16  David Kilzer  <ddkilzer@apple.com>
3194
3195         Fix build failure in MockNfcService.mm
3196         <https://webkit.org/b/201839>
3197
3198         Reviewed by Brady Eidson.
3199
3200         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
3201         Specify instance variable names for @synthesized variables that
3202         need to be manually released in -dealloc under MRR.
3203
3204 2019-09-16  Per Arne Vollan  <pvollan@apple.com>
3205
3206         REGRESSION(249649): Unable to open local files in MiniBrowser on macOS
3207         https://bugs.webkit.org/show_bug.cgi?id=201798
3208
3209         Reviewed by Brent Fulgham.
3210
3211         The commit <https://trac.webkit.org/changeset/249649> introduced a MiniBrowser regression on macOS where
3212         MiniBrowser is not able to open local files. The change set r249649 fixed a problem where the WebContent
3213         process PID was not ready to be used when creating a sandbox extension. This happened in the cases where
3214         the WebContent process had not finished launching when the load started. The WebContent process is also
3215         creating sandbox extensions for the Networking process for the files being loaded, and also needs to be
3216         passing the PID of the Networking process when creating these. This patch is addressing this by getting
3217         the PID of the Networking process when the WebContent process is initially getting the connection to the
3218         Networking process. The PID is then stored in the NetworkProcessConnection class, from where it is passed
3219         to the NetworkLoadParameters, and used when creating the sandbox extension for the Networking process.
3220
3221         * NetworkProcess/NetworkLoadParameters.h:
3222         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3223         (WebKit::NetworkResourceLoadParameters::encode const):
3224         * UIProcess/Network/NetworkProcessProxy.cpp:
3225         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
3226         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
3227         (WebKit::NetworkProcessProxy::networkProcessCrashed):
3228         (WebKit::NetworkProcessProxy::didFinishLaunching):
3229         * UIProcess/WebPageProxy.cpp:
3230         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
3231         * UIProcess/WebProcessProxy.messages.in:
3232         * WebProcess/Network/NetworkProcessConnection.cpp:
3233         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
3234         * WebProcess/Network/NetworkProcessConnection.h:
3235         (WebKit::NetworkProcessConnection::create):
3236         (WebKit::NetworkProcessConnection::networkProcessPID const):
3237         * WebProcess/Network/WebLoaderStrategy.cpp:
3238         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3239         * WebProcess/WebProcess.cpp:
3240         (WebKit::getNetworkProcessConnection):
3241         (WebKit::WebProcess::ensureNetworkProcessConnection):
3242
3243 2019-09-16  David Kilzer  <ddkilzer@apple.com>
3244
3245         [WebAuthn] REGRESSION (r249059): Leak of WKMockNFTag objects and WKMockNFTag instance variables
3246         <https://webkit.org/b/201813>
3247
3248         Reviewed by Darin Adler.
3249
3250         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
3251         (-[WKMockNFTag dealloc]): Add method and release instance
3252         variables to fix leaks.
3253         (WebKit::MockNfcService::detectTags const): Use adoptNS() to fix
3254         leaks of WKMockNFTag objects.
3255
3256 2019-09-16  David Kilzer  <ddkilzer@apple.com>
3257
3258         REGRESSION (r243113): Leak of multiple instance variable blocks when deallocating _WKAttributedStringNavigationDelegate
3259         <https://webkit.org/b/201812>
3260
3261         Reviewed by Timothy Hatcher.
3262
3263         * UIProcess/API/Cocoa/NSAttributedString.mm:
3264         (-[_WKAttributedStringNavigationDelegate dealloc]): Add method
3265         to release instance variable blocks to fix potential leaks.
3266
3267 2019-09-16  Adrian Perez de Castro  <aperez@igalia.com>
3268
3269         Unreviewed build fix.
3270
3271         * NetworkProcess/NetworkConnectionToWebProcess.h: Add missing forward
3272         declaration of the NetworkSession class.
3273
3274 2019-09-16  Chris Dumez  <cdumez@apple.com>
3275
3276         Store sessionID on the NetworkConnectionToWebProcess now that there is one session per WebProcess
3277         https://bugs.webkit.org/show_bug.cgi?id=201789
3278
3279         Reviewed by Alex Christensen.
3280
3281         Store sessionID on the NetworkConnectionToWebProcess now that there is one session per WebProcess.
3282         As a result, we no longer need to pass the sessionID in each IPC from the WebProcess to the
3283         NetworkProcess.
3284
3285         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3286         (WebKit::NetworkConnectionToWebProcess::create):
3287         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3288         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
3289         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3290         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
3291         (WebKit::NetworkConnectionToWebProcess::didClose):
3292         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
3293         (WebKit::NetworkConnectionToWebProcess::createSocketChannel):
3294         (WebKit::NetworkConnectionToWebProcess::networkSession):
3295         (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
3296         (WebKit::NetworkConnectionToWebProcess::storageSession):
3297         (WebKit::NetworkConnectionToWebProcess::startDownload):
3298         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
3299         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3300         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3301         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
3302         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
3303         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
3304         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
3305         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
3306         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
3307         (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
3308         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
3309         (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
3310         (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
3311         (WebKit::NetworkConnectionToWebProcess::blobSize):
3312         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
3313         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
3314         (WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics):
3315         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
3316         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
3317         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
3318         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
3319         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
3320         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
3321         (WebKit::NetworkConnectionToWebProcess::unregisterSWConnection):
3322         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
3323         (WebKit::NetworkConnectionToWebProcess::establishSWContextConnection):
3324         * NetworkProcess/NetworkConnectionToWebProcess.h:
3325         (WebKit::NetworkConnectionToWebProcess::sessionID const):
3326         (WebKit::NetworkConnectionToWebProcess::startDownload):
3327         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3328         * NetworkProcess/NetworkProcess.cpp:
3329         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
3330         * NetworkProcess/NetworkProcess.h:
3331         * NetworkProcess/NetworkProcess.messages.in:
3332         * NetworkProcess/NetworkResourceLoader.cpp:
3333         (WebKit::NetworkResourceLoader::start):
3334         * UIProcess/Network/NetworkProcessProxy.cpp:
3335         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
3336         * UIProcess/WebProcessProxy.cpp:
3337         (WebKit::WebProcessProxy::sessionID const):
3338         * UIProcess/WebProcessProxy.h:
3339         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3340         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
3341         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
3342         (WebKit::BlobRegistryProxy::registerFileBlobURL):
3343         (WebKit::BlobRegistryProxy::registerBlobURL):
3344         (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
3345         (WebKit::BlobRegistryProxy::unregisterBlobURL):
3346         (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
3347         (WebKit::BlobRegistryProxy::blobSize):
3348         * WebProcess/Network/NetworkProcessConnection.cpp:
3349         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
3350         * WebProcess/Network/WebSocketChannel.cpp:
3351         (WebKit::WebSocketChannel::connect):
3352         * WebProcess/Network/WebSocketStream.cpp:
3353         (WebKit::WebSocketStream::WebSocketStream):
3354         * WebProcess/Storage/WebSWClientConnection.cpp:
3355         (WebKit::WebSWClientConnection::WebSWClientConnection):
3356         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3357         (WebKit::m_userAgent):
3358         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3359         (WebKit::WebFrameLoaderClient::detachedFromParent2):
3360         (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
3361         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: