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