[WebAuthn] Move the mock testing entrance to Internals
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-10-09  Jiewen Tan  <jiewen_tan@apple.com>
2
3         [WebAuthn] Move the mock testing entrance to Internals
4         https://bugs.webkit.org/show_bug.cgi?id=202560
5         <rdar://problem/55973793>
6
7         Reviewed by Chris Dumez.
8
9         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
10         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted.
11         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
12         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
13         (WebKit::AuthenticatorTransportService::createMock):
14         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
15         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
16         (WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
17         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
18         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
19         (WebKit::MockHidConnection::send):
20         (WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
21         (WebKit::MockHidConnection::parseRequest):
22         (WebKit::MockHidConnection::feedReports):
23         (WebKit::MockHidConnection::shouldContinueFeedReports):
24         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
25         * UIProcess/WebAuthentication/Mock/MockHidService.cpp:
26         (WebKit::MockHidService::MockHidService):
27         * UIProcess/WebAuthentication/Mock/MockHidService.h:
28         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
29         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
30         (WebKit::MockLocalConnection::MockLocalConnection):
31         * UIProcess/WebAuthentication/Mock/MockLocalService.h:
32         * UIProcess/WebAuthentication/Mock/MockLocalService.mm:
33         (WebKit::MockLocalService::MockLocalService):
34         * UIProcess/WebAuthentication/Mock/MockNfcService.h:
35         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
36         (WebKit::MockNfcService::MockNfcService):
37         (WebKit::MockNfcService::platformStartDiscovery):
38         (WebKit::MockNfcService::detectTags const):
39         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed.
40         * UIProcess/WebPageProxy.cpp:
41         (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration):
42         * UIProcess/WebPageProxy.h:
43         * UIProcess/WebPageProxy.messages.in:
44         * UIProcess/WebsiteData/WebsiteDataStore.h:
45         * WebKit.xcodeproj/project.pbxproj:
46         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
47         (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration):
48         * WebProcess/WebCoreSupport/WebChromeClient.h:
49
50 2019-10-09  Andy Estes  <aestes@apple.com>
51
52         [Cocoa] IPC::decode should gracefully handle a nil allowed class
53         https://bugs.webkit.org/show_bug.cgi?id=202753
54
55         Reviewed by Geoffrey Garen.
56
57         If IPC::decode is called with a nil allowed class, an NSInvalidArgumentException will be
58         thrown when trying to create an NSArray literal with a nil value. Depending on who calls
59         IPC::decode, this exception might or might not be caught, leading to dropped messages or
60         crashes.
61
62         One case of this happening is tracked by rdar://problem/55839467. In this case, the nil
63         allowed class was due to a build misconfiguration, and the exception caused the UI process
64         to not respond to a synchronous IPC message, hanging the WebContent process.
65
66         rdar://problem/55839467 was resolved by fixing the build misconfiguration, but this patch
67         improves IPC::decode so that a nil allowed class results in a message decoding failure
68         rather than a maybe-caught NSException.
69
70         * Shared/Cocoa/ArgumentCodersCocoa.h:
71         (IPC::decode):
72
73 2019-10-09  youenn fablet  <youenn@apple.com>
74
75         Remove testRunner.setWebRTCUnifiedPlanEnabled
76         https://bugs.webkit.org/show_bug.cgi?id=202700
77
78         Reviewed by Eric Carlson.
79
80         * WebProcess/InjectedBundle/InjectedBundle.cpp:
81         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
82
83 2019-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
84
85         REGRESSION(r250597): [GTK][WPE] 2.27.1 shows HTML content as text/plain in custom protocols when passing a charset in content type
86         https://bugs.webkit.org/show_bug.cgi?id=202633
87
88         Reviewed by Žan Doberšek.
89
90         This is a regression of the switch to use the new custom protocols implementation. Before r250597, we extracted
91         the mime type and charset from content type in the network process, but we are now sending the response directly
92         from the UI process, so we need to do that when building our response. Rename the mime_type parameter as
93         content_type to avoid confusion, since it's documented as the content type.
94
95         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
96         (webkitURISchemeRequestReadCallback):
97         (webkit_uri_scheme_request_finish):
98         * UIProcess/API/gtk/WebKitURISchemeRequest.h:
99         * UIProcess/API/wpe/WebKitURISchemeRequest.h:
100
101 2019-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
102
103         [GTK][WPE] about:gpu should also show the client EGL extensions
104         https://bugs.webkit.org/show_bug.cgi?id=202690
105
106         Reviewed by Carlos Alberto Lopez Perez.
107
108         We are showing the extensions supported by the display.
109
110         * UIProcess/API/glib/WebKitProtocolHandler.cpp:
111         (WebKit::WebKitProtocolHandler::handleGPU):
112
113 2019-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
114
115         CustomProtocols: convert log messages in WebURLSchemeTaskProxy to RELEASE_LOG
116         https://bugs.webkit.org/show_bug.cgi?id=202686
117
118         Reviewed by Alex Christensen.
119
120         Instead of using WTFLogAlways, since those messages are confusing on stdout.
121
122         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
123         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
124         (WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
125         (WebKit::WebURLSchemeTaskProxy::didReceiveData):
126
127 2019-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
128
129         [WPE][GTK] WebKitSecurityManager should consider webkit:// to be a local URI scheme
130         https://bugs.webkit.org/show_bug.cgi?id=202638
131
132         Reviewed by Michael Catanzaro.
133
134         * UIProcess/API/glib/WebKitProtocolHandler.cpp:
135         (WebKit::WebKitProtocolHandler::WebKitProtocolHandler):
136
137 2019-10-08  Antti Koivisto  <antti@apple.com>
138
139         [CSS Shadow Parts] Enable by default
140         https://bugs.webkit.org/show_bug.cgi?id=202644
141
142         Reviewed by Ryosuke Niwa.
143
144         * Shared/WebPreferences.yaml:
145
146         Flip the switch.
147
148 2019-10-08  Andy Estes  <aestes@apple.com>
149
150         [iOS] Add a fast path that avoids hit testing during context menu interactions on elements
151         https://bugs.webkit.org/show_bug.cgi?id=202510
152         <rdar://problem/55939313>
153
154         Reviewed by Tim Horton.
155
156         When computing position information for an element, we can store sufficient context
157         information in InteractionInformationAtPosition such that the same element could be
158         retrieved again without hit testing. The existing TextInputContext can already store an
159         element's page identifier, document identifier, and element identifier, which is sufficient
160         context for such a task.
161
162         This patch renames TextInputContext to ElementContext and uses it when populating new
163         InteractionInformationAtPosition structs in elementPositionInformation(). When a context
164         menu interaction occurs, WebPage::startInteractionWithElementContextOrPosition() uses this
165         context to look up the interaction element by its identifier triplet, falling back to hit
166         testing if this lookup fails.
167
168         * Scripts/webkit/messages.py:
169         * Shared/DocumentEditingContext.h:
170         * Shared/DocumentEditingContext.mm:
171         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
172         * Shared/ElementContext.cpp: Renamed from Source/WebKit/Shared/TextInputContext.cpp.
173         (IPC::ArgumentCoder<WebKit::ElementContext>::encode):
174         (IPC::ArgumentCoder<WebKit::ElementContext>::decode):
175         * Shared/ElementContext.h: Renamed from Source/WebKit/Shared/TextInputContext.h.
176         (WebKit::operator==):
177         * Shared/ios/InteractionInformationAtPosition.h:
178         * Shared/ios/InteractionInformationAtPosition.mm:
179         (WebKit::InteractionInformationAtPosition::encode const):
180         (WebKit::InteractionInformationAtPosition::decode):
181         * Sources.txt:
182         * UIProcess/API/Cocoa/WKWebView.mm:
183         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
184         * UIProcess/API/Cocoa/_WKTextInputContext.mm:
185         (-[_WKTextInputContext _initWithTextInputContext:]):
186         (-[_WKTextInputContext _textInputContext]):
187         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
188         * UIProcess/WebPageProxy.cpp:
189         (WebKit::WebPageProxy::textInputContextsInRect):
190         (WebKit::WebPageProxy::focusTextInputContext):
191         * UIProcess/WebPageProxy.h:
192         * UIProcess/ios/WKContentViewInteraction.mm:
193         (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]):
194         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
195         (-[WKContentView continueContextMenuInteraction:]):
196         (-[WKContentView continueContextMenuInteractionWithDataDetectors:]):
197         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
198         * UIProcess/ios/WebPageProxyIOS.mm:
199         (WebKit::WebPageProxy::startInteractionWithPositionInformation):
200         (WebKit::WebPageProxy::startInteractionWithElementAtPosition): Deleted.
201         * WebKit.xcodeproj/project.pbxproj:
202         * WebProcess/WebPage/WebPage.cpp:
203         (WebKit::WebPage::textInputContextsInRect):
204         (WebKit::WebPage::focusTextInputContext):
205         (WebKit::WebPage::elementForContext const):
206         (WebKit::WebPage::contextForElement const):
207         (WebKit::WebPage::elementForTextInputContext): Deleted.
208         * WebProcess/WebPage/WebPage.h:
209         * WebProcess/WebPage/WebPage.messages.in:
210         * WebProcess/WebPage/ios/WebPageIOS.mm:
211         (WebKit::elementPositionInformation):
212         (WebKit::WebPage::startInteractionWithElementContextOrPosition):
213         (WebKit::WebPage::requestDocumentEditingContext):
214         (WebKit::WebPage::startInteractionWithElementAtPosition): Deleted.
215
216 2019-10-08  Adrian Perez de Castro  <aperez@igalia.com>
217
218         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.27.1 release
219
220         * wpe/NEWS: Add release notes for 2.27.1
221
222 2019-10-08  Kate Cheney  <katherine_cheney@apple.com>
223
224         Implement Telemetry and Dumping Routines for SQLite backend (195088)
225         https://bugs.webkit.org/show_bug.cgi?id=195088
226         <rdar://problem/54213407>
227
228         Reviewed by John Wilander.
229
230         Implemented database telemetry calculating for ITP. Mimicked
231         ResourceLoadStatisticsMemoryStore telemetry logging behavior using
232         SQLite Queries as opposed to vector sorting/manipulation. Once fully
233         integrated, this will simplify analysis of ITP data by transitioning
234         ITP data storage from a plist to a SQLite database.
235
236         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
237         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
238         Added SQL queries to be initialized in the constructor. These queries
239         are needed to mimic the telemetry calculations done in
240         ResourceLoadStatisticsMemoryStore.
241         
242         (WebKit::resetStatement):
243         To reduce code duplication, this function holds common code to reset
244         a SQL query.
245
246         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
247         Added SQL queries needed for telemetry calculations to be prepared.
248         
249         (WebKit::joinSubStatisticsForSorting):
250         This function returns the query string for sorting resources that is
251         shared by many queries.
252
253         (WebKit::ResourceLoadStatisticsDatabaseStore::getMedianOfPrevalentResourcesWithUserInteraction const):
254         Implemented a function to take the median days since user interaction
255         from all prevalent resources in the database with user interaction
256         (sorted by max count of subframes, subresources and unique redirects under
257         the top frame domain).
258
259         (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResources const):
260         Executes a SQL query to get the number of prevalent resources to log as
261         telemetry.
262
263         (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResourcesWithUI const):
264         Executes a SQL query to get the number of prevalent resources with user
265         interaction to log as telemetry.
266
267         (WebKit::ResourceLoadStatisticsDatabaseStore::getTopPrevelentResourceDaysSinceUI const):
268         Prepares and executes a SQL query to get the days since user
269         interaction from the top prevalent resource to be recorded as
270         telemetry data.
271
272         (WebKit::ResourceLoadStatisticsDatabaseStore::getMedianStatisticOfPrevalentResourceWithoutUserInteraction const):
273         Implemented a function which takes a statistic and returns the value
274         of that statistic for the median prevalent resource without user
275         interaction to be recorded as telemetry data.
276
277         (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResourcesInTopResources const):
278         Returns the count of prevalent resources in the top x resources
279         sorted by sum of substatistics again to be logged as telemetry.
280
281         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateTelemetryData const):
282         Function which executes all functions which populate the struct with
283         telemetry data. This struct will then be passed to
284         WebResourceLoadStatisticsTelemetry to be logged.
285
286         (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const):
287         Initializes the telemetry struct and calls the function to populate
288         it, then passes it to the WebResourceLoadStatisticsTelemetry object
289         to be recorded.
290
291         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
292         Describe PrevalentResourceDatabaseTelemetry Struct to be passed and
293         logged as telemetry data.
294
295         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
296         (WebKit::databaseSubmitTopLists):
297         Logging telemetry data by looping through 2D array of statistics for
298         the top 1, 3, 10, 50, and 100 prevalent resources sorted by the sum
299         of substatistics under the top frame domain. This matches the logging
300         already done in ResourceLoadStatisticsMemoryStore.
301
302         (WebKit::WebResourceLoadStatisticsTelemetry::submitTelemetry):
303         Submits data to the webPageProxy logs and plists.
304
305         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.h:
306         Added new submitTopList function to accomodate database telemetry
307         logging.
308         
309         * NetworkProcess/NetworkSession.cpp:
310         (WebKit::NetworkSession::notifyPageStatisticsTelemetryFinished):
311         * NetworkProcess/NetworkSession.h:
312         * UIProcess/Network/NetworkProcessProxy.cpp:
313         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsTelemetryFinished):
314         * UIProcess/Network/NetworkProcessProxy.h:
315         * UIProcess/Network/NetworkProcessProxy.messages.in:
316         Updated the current testing for telemetry which only tested 3
317         statistics. With this patch it now tests 10 statistics.
318
319 2019-10-08  Adrian Perez de Castro  <aperez@igalia.com>
320
321         [GTK][WPE] Fix non-unified builds after r250486
322         https://bugs.webkit.org/show_bug.cgi?id=202636
323
324         Reviewed by Youenn Fablet.
325
326         * NetworkProcess/NetworkConnectionToWebProcess.cpp: Add missing inclusion of the
327         Logging.h header.
328
329 2019-10-08  Brady Eidson  <beidson@apple.com>
330
331         Service Worker Fetch events should time out.
332         https://bugs.webkit.org/show_bug.cgi?id=202188
333
334         Reviewed by Alex Christensen.
335
336         When we start a fetch task in the server, we also start a timeout on that fetch task.
337         
338         "Time out" means the fetch task must continue to make progress at the given frequency (once every 60 seconds by default)
339
340         If any given fetch task times out in a service worker instance, that instance loses the right to handle fetches.
341         
342         * NetworkProcess/NetworkProcess.cpp:
343         (WebKit::NetworkProcess::setServiceWorkerFetchTimeoutForTesting):
344         (WebKit::NetworkProcess::resetServiceWorkerFetchTimeoutForTesting):
345         * NetworkProcess/NetworkProcess.h:
346         (WebKit::NetworkProcess::serviceWorkerFetchTimeout const):
347         * NetworkProcess/NetworkProcess.messages.in:
348
349         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
350         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
351         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse): 
352         (WebKit::ServiceWorkerFetchTask::didReceiveResponse): 
353         (WebKit::ServiceWorkerFetchTask::didReceiveData): 
354         (WebKit::ServiceWorkerFetchTask::didReceiveFormData): 
355         (WebKit::ServiceWorkerFetchTask::didFinish): 
356         (WebKit::ServiceWorkerFetchTask::didFail): 
357         (WebKit::ServiceWorkerFetchTask::didNotHandle): 
358         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
359         (WebKit::ServiceWorkerFetchTask::create):
360         (WebKit::ServiceWorkerFetchTask::serviceWorkerIdentifier const):
361         (WebKit::ServiceWorkerFetchTask::wasHandled const):
362         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask): Deleted.
363
364         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
365         (WebKit::WebSWServerConnection::startFetch):
366         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
367
368         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
369         (WebKit::WebSWServerToContextConnection::startFetch):
370         (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut):
371         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
372
373         * UIProcess/API/C/WKContext.cpp:
374         (WKContextSetServiceWorkerFetchTimeoutForTesting):
375         (WKContextResetServiceWorkerFetchTimeoutForTesting):
376         * UIProcess/API/C/WKContext.h:
377
378         * UIProcess/WebProcessPool.cpp:
379         (WebKit::WebProcessPool::setServiceWorkerTimeoutForTesting):
380         (WebKit::WebProcessPool::resetServiceWorkerTimeoutForTesting):
381         * UIProcess/WebProcessPool.h:
382
383 2019-10-08  Ross Kirsling  <ross.kirsling@sony.com>
384
385         Unreviewed. Restabilize non-unified build.
386
387         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
388
389 2019-10-08  Dean Jackson  <dino@apple.com>
390
391         Sort Internal and Experimental features by human readable name
392         https://bugs.webkit.org/show_bug.cgi?id=202667
393
394         Reviewed by Zalan Bujtas.
395
396         Sort the statically generated vectors of internal and
397         experimental features by their human readable name, rather than
398         the feature key, so that looking at them in the Settings app
399         doesn't make people who like alphabetical order angry.
400
401         * Scripts/GeneratePreferences.rb: Add an extra sort call to the list generation.
402
403 2019-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
404
405         [Clipboard API] Introduce bindings for the async Clipboard API
406         https://bugs.webkit.org/show_bug.cgi?id=202622
407         <rdar://problem/56038126>
408
409         Reviewed by Ryosuke Niwa.
410
411         Adds a new experimental feature flag. See WebCore ChangeLog for more details.
412
413         * Shared/WebPreferences.yaml:
414
415 2019-10-08  Alexander Mikhaylenko  <alexm@gnome.org>
416
417         [GTK] Navigation gesture improvements
418         https://bugs.webkit.org/show_bug.cgi?id=202645
419
420         Reviewed by Carlos Garcia Campos.
421
422         Measure velocity threshold in pixels per second rather than distance (range [0-1])
423         per second. The value is the same as it was on touchpads, since a fixed distance is
424         used, but is now consistent on touchscreens, regardless of the webview width.
425
426         Add a threshold for cancelling gesture when the page is more than halfway
427         through, so that it's symmetric with the first half.
428
429         Align the moving page to pixel grid on hidpi devices correctly. Just
430         rounding the position doesn't work correctly, since the cairo context is
431         pre-scaled. Multiplying by scale factor, rounding and then dividing by
432         scale factor fixes this.
433
434         * UIProcess/ViewGestureController.h:
435         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
436         (WebKit::ViewGestureController::SwipeProgressTracker::reset):
437         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
438         (WebKit::ViewGestureController::SwipeProgressTracker::shouldCancel):
439         (WebKit::ViewGestureController::draw):
440
441 2019-10-08  Carlos Garcia Campos  <cgarcia@igalia.com>
442
443         Unreviewed. Remove unused WebKitSoupRequestGeneric after r250597
444
445         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
446
447 2019-10-08  Adrian Perez de Castro  <aperez@igalia.com>
448
449         [WPE][GTK] Build fails with ENABLE_WEBDRIVER=OFF
450         https://bugs.webkit.org/show_bug.cgi?id=202658
451
452         Reviewed by Carlos Garcia Campos.
453
454         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: Add missing
455         ENABLE(WEBDRIVER_MOUSE_INTERACTIONS) and ENABLE(WEBDRIVER_KEYBOARD_INTERACTIONS)
456         preprocessor guards.
457         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: Ditto.
458
459 2019-10-07  Ryosuke Niwa  <rniwa@webkit.org>
460
461         Add IDL for requestIdleCallback
462         https://bugs.webkit.org/show_bug.cgi?id=202653
463
464         Reviewed by Geoffrey Garen.
465
466         * Shared/WebPreferences.yaml:
467
468 2019-10-07  Kate Cheney  <katherine_cheney@apple.com>
469
470         Domain relationships in the ITP Database should be inserted in a single query and ignore repeat insert attempts. (202604)
471         https://bugs.webkit.org/show_bug.cgi?id=202604
472         <rdar://problem/55995831>
473
474         Reviewed by Chris Dumez. 
475         
476         This patch addresses two clean-ups for the ITP SQLite Database Store.
477         First, by using INSERT OR IGNORE as opposed to INSERT, it eliminates
478         the need to check if a relationship already exists in the database
479         before inserting it. Second, instead of looping through domain lists
480         and inserting each relationship as a separate query, this patch now
481         converts lists to a string which SQLite can use to insert multiple
482         rows into a database using a single query.
483
484         Some Exists queries could not be deleted because they were being
485         used for testing.
486
487         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
488         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
489         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
490         Removed old insert queries and replaced them with queries able to
491         insert string-lists of domains in a single query. Also reorganized
492         the queries by functionality to make them easier to find and edit.
493
494         (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices):
495         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
496         In order to properly take advantage of the INSERT OR IGNORE
497         functionality, unique indices must be established so the SQLite table
498         is aware of what patterns to look for when ignoring a new insert.
499
500         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndmakeDomainList):
501         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
502         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
503         Looping through the domain list is no longer needed with the new query
504         changes. Additionally, ensuring a domain is in the Observed Domains
505         table of the database must be done before utilizing any inserting of 
506         relationships because the relationship queries rely on fetching the
507         topFrame domainID from the ObservedDomains table.
508
509         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
510         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
511         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
512         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameDomain):
513         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameDomain):
514         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
515         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
516         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
517         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
518         With the ensure check being done once in the ensureAndmakeDomainList
519         function, these functions no longer have to make that check before
520         inserting.
521         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
522
523         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
524         (WebKit::WebResourceLoadStatisticsStore::mergeStatisticForTesting):
525         (WebKit::WebResourceLoadStatisticsStore::isRelationshipOnlyInDatabaseOnce):
526         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
527         Changes in WeResourceLoadStatisticsStore were for testing only. This
528         patch updated the merge statistic testing to also test this change by
529         having a topFrameDomain list with more than one domain.
530
531         * NetworkProcess/NetworkProcess.cpp:
532         (WebKit::NetworkProcess::mergeStatisticForTesting):
533         (WebKit::NetworkProcess::isRelationshipOnlyInDatabaseOnce):
534         * NetworkProcess/NetworkProcess.h:
535         * NetworkProcess/NetworkProcess.messages.in:
536         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
537         (WKWebsiteDataStoreSetStatisticsMergeStatistic):
538         (WKWebsiteDataStoreIsStatisticsOnlyInDatabaseOnce):
539         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
540         * UIProcess/Network/NetworkProcessProxy.cpp:
541         (WebKit::NetworkProcessProxy::mergeStatisticForTesting):
542         (WebKit::NetworkProcessProxy::isRelationshipOnlyInDatabaseOnce):
543         * UIProcess/Network/NetworkProcessProxy.h:
544         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
545         (WebKit::WebsiteDataStore::mergeStatisticForTesting):
546         (WebKit::WebsiteDataStore::isRelationshipOnlyInDatabaseOnce):
547         * UIProcess/WebsiteData/WebsiteDataStore.h:
548         Added a new function for testing that there are no repeat inserts
549         into the database. Updated mergeStatistics to test the list-insert
550         functionality.
551
552 2019-10-07  Yusuke Suzuki  <ysuzuki@apple.com>
553
554         [JSC] Change signature of HostFunction to (JSGlobalObject*, CallFrame*)
555         https://bugs.webkit.org/show_bug.cgi?id=202569
556
557         Reviewed by Saam Barati.
558
559         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
560         (WebKit::callMethod):
561         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
562         (WebKit::callNPJSObject):
563         (WebKit::constructWithConstructor):
564         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
565
566 2019-10-07  Megan Gardner  <megan_gardner@apple.com>
567
568         Switch to WKShareSheet for WKPDFView
569         https://bugs.webkit.org/show_bug.cgi?id=202338
570
571         Reviewed by Tim Horton.
572
573         Switch to WKShareSheet from the share sheet in UIWKSelectionAssistant, since this is the only instance
574         of UIWKSelectionAssistant any more. This will keep all our share sheet code together, and allow
575         us to eliminate this class that will be completely unused with this change.
576
577         * Platform/spi/ios/UIKitSPI.h:
578         * UIProcess/ios/WKPDFView.h:
579         * UIProcess/ios/WKPDFView.mm:
580         (-[WKPDFView dealloc]):
581         (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
582         (-[WKPDFView shareSheetDidDismiss:]):
583
584 2019-10-07  Per Arne Vollan  <pvollan@apple.com>
585
586         [macOS] Layering violation in AuxiliaryProcessProxy::didFinishLaunching
587         https://bugs.webkit.org/show_bug.cgi?id=201617
588
589         Reviewed by Brent Fulgham.
590
591         The commit <https://trac.webkit.org/changeset/249649> introduced a layering violation in AuxiliaryProcessProxy::didFinishLaunching
592         where we inspect the pending message queue looking for a local file load message which needs the PID to create a sandbox extension
593         for the WebContent process. The layering violation can be fixed by creating a virtual method in AuxiliaryProcessProxy and override
594         the method in the WebProcessProxy to do the work needed to replace the message with a load request message containing a sandbox
595         extension created using the PID of the WebContent process. No new tests have been created, since this is covered by existing tests.
596
597         * UIProcess/AuxiliaryProcessProxy.cpp:
598         (WebKit::AuxiliaryProcessProxy::didFinishLaunching):
599         * UIProcess/AuxiliaryProcessProxy.h:
600         (WebKit::AuxiliaryProcessProxy::shouldSendPendingMessage):
601         * UIProcess/WebProcessProxy.cpp:
602         (WebKit::WebProcessProxy::shouldSendPendingMessage):
603         * UIProcess/WebProcessProxy.h:
604
605 2019-10-07  Dean Jackson  <dino@apple.com>
606
607         Provide options for DTTZ to happen in more situations
608         https://bugs.webkit.org/show_bug.cgi?id=202634
609         <rdar://problem/55732762>
610
611         Reviewed by Antoine Quint.
612
613         Add two options that can be enabled to trigger double tap zooming 
614         in more places.
615
616         Firstly, an option to keep listening for a double-tap-to-zoom if the
617         first tap found a click handler on the body or document element. The
618         tap will still be dispatched. This is probably the most common case
619         for disabling a DTTZ.
620
621         Secondly, an option to always keep listening for a double-tap-to-zoom,
622         even if there was a clickable (non-root) element under the first tap.
623
624         * Shared/WebPreferences.yaml: Add ZoomOnDoubleTapWhenRoot and AlwaysZoomOnDoubleTap.
625         * UIProcess/PageClient.h: The message from the WebProcess now tells the UIProcess if
626         the tapped element was a root-level (document or body).
627         * UIProcess/WebPageProxy.h:
628         * UIProcess/WebPageProxy.messages.in:
629         * UIProcess/ios/PageClientImplIOS.h:
630         * UIProcess/ios/PageClientImplIOS.mm:
631         (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
632         * UIProcess/ios/WKContentViewInteraction.h:
633         * UIProcess/ios/WKContentViewInteraction.mm:
634         (-[WKContentView _endPotentialTapAndEnableDoubleTapGesturesIfNecessary]):
635         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]):
636         Handle the two new options.
637
638         * UIProcess/ios/WebPageProxyIOS.mm:
639         (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
640         * WebProcess/WebPage/ios/WebPageIOS.mm:
641         (WebKit::WebPage::potentialTapAtPosition): Check if the tap was on a root-level element.
642
643 2019-10-07  Matt Mokary  <mmokary@apple.com>
644
645         foundStringMatchIndex in FindController::findString gets reset on page scroll
646         https://bugs.webkit.org/show_bug.cgi?id=201773
647         <rdar://problem/55351892>
648
649         Reviewed by Tim Horton.
650
651         Decouple hiding of the find indicator from resetting match index, and only reset match index when there is not
652         an active match.
653
654         * WebProcess/WebPage/FindController.cpp:
655         (WebKit::FindController::updateFindUIAfterPageScroll):
656         (WebKit::FindController::hideFindUI):
657         (WebKit::FindController::hideFindIndicator):
658         (WebKit::FindController::resetMatchIndex):
659         * WebProcess/WebPage/FindController.h:
660         * WebProcess/WebPage/ios/FindControllerIOS.mm:
661         (WebKit::FindController::hideFindIndicator):
662         (WebKit::FindController::resetMatchIndex):
663
664 2019-10-07  youenn fablet  <youenn@apple.com>
665
666         WebPageProxy::updatePlayingMediaDidChange should protect from a null m_userMediaPermissionRequestManager
667         https://bugs.webkit.org/show_bug.cgi?id=202628
668         <rdar://problem/55935091>
669
670         Reviewed by Eric Carlson.
671
672         On process swap on navigation or process crash, m_userMediaPermissionRequestManager is made null.
673         At the same time, the media state is set back to not playing.
674         Future calls of updatePlayingMediaDidChange should not have any capture state change until getUserMedia/getDisplayMedia
675         is called, which would create m_userMediaPermissionRequestManager.
676         But this assumption is not always true given that the media state is computed as process-wide in MediaStreamTrack::captureState on iOS.
677         The above behavior is fixed as part of https://bugs.webkit.org/show_bug.cgi?id=202627.
678         Since the call to updatePlayingMediaDidChange is triggered straight from IPC, it should not be trusted and a null check should be added.
679
680         * UIProcess/WebPageProxy.cpp:
681         (WebKit::WebPageProxy::updatePlayingMediaDidChange):
682
683 2019-10-04  Dean Jackson  <dino@apple.com>
684
685         Use a better name than allowFastClicksEverywhere
686         https://bugs.webkit.org/show_bug.cgi?id=202607
687         <rdar://problem/55997133>
688
689         Reviewed by Tim Horton.
690
691         This preference name is quite confusing. Change it to
692         PreferFasterClickOverDoubleTap.
693
694         * Shared/WebPreferences.yaml:
695         * Shared/WebPreferencesDefaultValues.h:
696         * UIProcess/WebPageProxy.h:
697         (WebKit::WebPageProxy::preferFasterClickOverDoubleTap const):
698         (WebKit::WebPageProxy::allowsFastClicksEverywhere const): Deleted.
699         * UIProcess/ios/WKContentViewInteraction.mm:
700         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
701         * UIProcess/ios/WebPageProxyIOS.mm:
702         (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
703
704 2019-10-04  Ross Kirsling  <ross.kirsling@sony.com>
705
706         Socket-based RWI should base64-encode backend commands on client, not server
707         https://bugs.webkit.org/show_bug.cgi?id=202605
708
709         Reviewed by Don Olmstead.
710
711         * UIProcess/socket/RemoteInspectorClient.cpp:
712         (WebKit::RemoteInspectorClient::setBackendCommands):
713
714 2019-10-04  Jiewen Tan  <jiewen_tan@apple.com>
715
716         Unreviewed, build fix after r250729
717
718         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
719         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
720
721 2019-10-04  Keith Rollin  <krollin@apple.com>
722
723         Fix determination of the top-level resource
724         https://bugs.webkit.org/show_bug.cgi?id=202491
725         <rdar://problem/50780648>
726
727         Reviewed by Youenn Fablet.
728
729         When loading the resources associated with a page, the Networking
730         process needs to know the main resource for the main frame. It uses
731         this information to keep track of page loads and the resources that
732         are loaded in those pages. By keeping track of this information,
733         WebKit can track and report difficult (slow or incomplete) resource
734         loads and their impact on the overall page.
735
736         The initial determination of the top resource only looked at whether
737         the resource was the "main" resource of a frame or not. However, this
738         determination was insufficient, and would confuse the tracking
739         mechanism when sub-frames also had main frames. Therefore, augment the
740         test by also looking to see if the hosting frame is the main frame.
741
742         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
743         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
744         * NetworkProcess/NetworkConnectionToWebProcess.h:
745         * NetworkProcess/NetworkResourceLoader.cpp:
746         (WebKit::NetworkResourceLoader::start):
747
748 2019-10-04  Ross Kirsling  <ross.kirsling@sony.com>
749
750         Unreviewed WinCairo build fix for r250717.
751
752         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
753         (WebKit::LayerTreeHost::invalidate): Deleted.
754
755 2019-10-04  Alex Christensen  <achristensen@webkit.org>
756
757         Stop sending list of display-isolated schemes to NetworkProcess
758         https://bugs.webkit.org/show_bug.cgi?id=202557
759
760         Reviewed by Youenn Fablet.
761
762         * NetworkProcess/NetworkProcess.cpp:
763         (WebKit::NetworkProcess::initializeNetworkProcess):
764         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const): Deleted.
765         * NetworkProcess/NetworkProcess.h:
766         * NetworkProcess/NetworkProcess.messages.in:
767         * NetworkProcess/NetworkProcessCreationParameters.cpp:
768         (WebKit::NetworkProcessCreationParameters::encode const):
769         (WebKit::NetworkProcessCreationParameters::decode):
770         * NetworkProcess/NetworkProcessCreationParameters.h:
771         * UIProcess/WebProcessPool.cpp:
772         (WebKit::WebProcessPool::ensureNetworkProcess):
773         (WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):
774
775 2019-10-04  Alex Christensen  <achristensen@webkit.org>
776
777         Rename SchemeRegistry to LegacySchemeRegistry
778         https://bugs.webkit.org/show_bug.cgi?id=202586
779
780         Reviewed by Tim Horton.
781
782         * NetworkProcess/NetworkLoadChecker.cpp:
783         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
784         * NetworkProcess/NetworkProcess.cpp:
785         (WebKit::NetworkProcess::registerURLSchemeAsSecure const):
786         (WebKit::NetworkProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
787         (WebKit::NetworkProcess::registerURLSchemeAsLocal const):
788         (WebKit::NetworkProcess::registerURLSchemeAsNoAccess const):
789         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const):
790         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const):
791         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
792         * Shared/AuxiliaryProcess.cpp:
793         (WebKit::AuxiliaryProcess::registerURLSchemeServiceWorkersCanHandle const):
794         * UIProcess/API/Cocoa/WKWebView.mm:
795         (+[WKWebView handlesURLScheme:]):
796         * UIProcess/API/glib/WebKitSecurityManager.cpp:
797         (registerSecurityPolicyForURIScheme):
798         (checkSecurityPolicyForURIScheme):
799         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
800         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
801         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
802         (WebKit::WebServiceWorkerProvider::handleFetch):
803         * WebProcess/WebPage/WebPage.cpp:
804         (WebKit::WebPage::canHandleRequest):
805         * WebProcess/WebProcess.cpp:
806         (WebKit::WebProcess::registerURLSchemeAsEmptyDocument):
807         (WebKit::WebProcess::registerURLSchemeAsSecure const):
808         (WebKit::WebProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
809         (WebKit::WebProcess::setDomainRelaxationForbiddenForURLScheme const):
810         (WebKit::WebProcess::registerURLSchemeAsLocal const):
811         (WebKit::WebProcess::registerURLSchemeAsNoAccess const):
812         (WebKit::WebProcess::registerURLSchemeAsDisplayIsolated const):
813         (WebKit::WebProcess::registerURLSchemeAsCORSEnabled const):
814         (WebKit::WebProcess::registerURLSchemeAsAlwaysRevalidated const):
815         (WebKit::WebProcess::registerURLSchemeAsCachePartitioned const):
816         (WebKit::WebProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
817         * WebProcess/WebStorage/StorageAreaImpl.cpp:
818
819 2019-10-04  Jiewen Tan  <jiewen_tan@apple.com>
820
821         [WebAuthn] Implement _WKWebAuthenticationPanel SPI
822         https://bugs.webkit.org/show_bug.cgi?id=202559
823         <rdar://problem/55932094>
824
825         Reviewed by Brent Fulgham.
826
827         This patch implements _WKWebAuthenticationPanel SPI. Here is the structure:
828         1) API::WebAuthenticationPanel is the APIObject of _WKWebAuthenticationPanel. It is owned by AuthenticatorManager.
829         The lifetime of _WKWebAuthenticationPanel on the other hand is managed by clients. This binding is the surface
830         where clients could interact with WebKit's WebAuthentication implementation.
831         2) API::WebAuthenticationPanelClient is a base class representing _WKWebAuthenticationPanelDelegate. Its subclass
832         WebKit::WebAuthenticationPanelClient implements bridges to _WKWebAuthenticationPanelDelegate methods. It is owned by
833         API::WebAuthenticationPanel. A weak pointer of WebKit::WebAuthenticationPanelClient is kept in _WKWebAuthenticationPanel
834         to get the _WKWebAuthenticationPanelDelegate set by clients or nil otherwise. This binding is the surface where WebKit
835         interacts with clients.
836         3) WebAuthenticationPanelFlags is the mirror of enums within _WKWebAuthenticationPanel.
837
838         Implementation wise, this patch implements:
839         1) -[WKUIDelegatePrivate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:], this is bridged from
840         the regular UIDelegate route. Noted, WKFrameInfo is nil for now, a follow up on Bug 202563 will take care of it. This
841         will be called from AuthenticatorManager::runPanel() which gates the start of discovery on the callback. For clients
842         that don't implement the delegate, the callback will always be called with _WKWebAuthenticationPanelResultUnavailable
843         to allow WebKit run on non-UI mode. A specific C API hack is added to always return _WKWebAuthenticationPanelResultPresented
844         in WebKitTestRunner for layout tests.
845         2) -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] will be implemented in Bug 200932.
846         3) -[_WKWebAuthenticationPanelDelegate panel:dismissWebAuthenticationPanelWithResult:], this is bridged from
847         API::WebAuthenticationPanel/API::WebAuthenticationPanelClient. This will be called whenever AuthenticatorManager::m_pendingCompletionHandler
848         is invoked. Depending on the respond, _WKWebAuthenticationResult will be returned accordingly. To facilitate that,
849         invokePendingCompletionHandler is crafted to bundle those two operations.
850         4) -[_WKWebAuthenticationPanel cancel] will be implemented in Bug 191523.
851
852         Besides the above, this patch also silents the NFC action sheet.
853
854         * Platform/spi/Cocoa/NearFieldSPI.h:
855         * Shared/API/APIObject.h:
856         * Shared/Cocoa/APIObject.mm:
857         (API::Object::newObject):
858         * Sources.txt:
859         * SourcesCocoa.txt:
860         * UIProcess/API/APIUIClient.h:
861         (API::UIClient::runWebAuthenticationPanel):
862         * UIProcess/API/APIWebAuthenticationPanel.cpp: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm.
863         (API::WebAuthenticationPanel::create):
864         (API::WebAuthenticationPanel::WebAuthenticationPanel):
865         (API::WebAuthenticationPanel::setClient):
866         * UIProcess/API/APIWebAuthenticationPanel.h: Copied from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h.
867         * UIProcess/API/APIWebAuthenticationPanelClient.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h.
868         (API::WebAuthenticationPanelClient::dismissPanel const):
869         * UIProcess/API/C/WKPage.cpp:
870         (WKPageSetPageUIClient):
871         * UIProcess/API/C/WKPageUIClient.h:
872         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
873         (-[_WKWebAuthenticationPanel dealloc]):
874         (-[_WKWebAuthenticationPanel relyingPartyID]):
875         (-[_WKWebAuthenticationPanel delegate]):
876         (-[_WKWebAuthenticationPanel setDelegate:]):
877         (-[_WKWebAuthenticationPanel _apiObject]):
878         (-[_WKWebAuthenticationPanel _initWithRelayingPartyID:]): Deleted.
879         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
880         * UIProcess/Cocoa/UIDelegate.h:
881         * UIProcess/Cocoa/UIDelegate.mm:
882         (WebKit::UIDelegate::setDelegate):
883         (WebKit::webAuthenticationPanelResult):
884         (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
885         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
886         (WebKit::WebCore::isFeatureEnabled):
887         (WebKit::WebCore::getRpId):
888         (WebKit::AuthenticatorManager::handleRequest):
889         (WebKit::AuthenticatorManager::respondReceived):
890         (WebKit::AuthenticatorManager::startDiscovery):
891         (WebKit::AuthenticatorManager::initTimeOutTimer):
892         (WebKit::AuthenticatorManager::timeOutTimerFired):
893         (WebKit::AuthenticatorManager::runPanel):
894         (WebKit::AuthenticatorManager::startRequest):
895         (WebKit::AuthenticatorManager::invokePendingCompletionHandler):
896         (WebKit::AuthenticatorManagerInternal::collectTransports): Deleted.
897         (WebKit::AuthenticatorManagerInternal::processGoogleLegacyAppIdSupportExtension): Deleted.
898         * UIProcess/WebAuthentication/AuthenticatorManager.h:
899         (WebKit::AuthenticatorManager::pendingCompletionHandler): Deleted.
900         * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
901         (WebKit::NfcConnection::NfcConnection):
902         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
903         (WebKit::NfcService::platformStartDiscovery):
904         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: Copied from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationRequestData.h.
905         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp.
906         (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
907         (WebKit::wkWebAuthenticationResult):
908         (WebKit::WebAuthenticationPanelClient::dismissPanel const):
909         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
910         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
911         * UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h.
912         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
913         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
914         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
915         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
916         * WebKit.xcodeproj/project.pbxproj:
917
918 2019-10-04  Alex Christensen  <achristensen@webkit.org>
919
920         Move WKProcessPool._registerURLSchemeServiceWorkersCanHandle to _WKWebsiteDataStoreConfiguration
921         https://bugs.webkit.org/show_bug.cgi?id=202553
922
923         Reviewed by Youenn Fablet.
924
925         It was only used for testing, and all the tests that use it still pass with the new SPI.
926
927         * NetworkProcess/NetworkProcess.cpp:
928         (WebKit::NetworkProcess::initializeNetworkProcess):
929         (WebKit::NetworkProcess::addWebsiteDataStore):
930         (WebKit::NetworkProcess::swServerForSession):
931         (WebKit::NetworkProcess::addServiceWorkerSession):
932         * NetworkProcess/NetworkProcess.h:
933         * Shared/AuxiliaryProcess.cpp:
934         (WebKit::AuxiliaryProcess::registerURLSchemeServiceWorkersCanHandle const): Deleted.
935         * Shared/AuxiliaryProcess.h:
936         * Shared/AuxiliaryProcess.messages.in:
937         * Shared/WebsiteDataStoreParameters.cpp:
938         (WebKit::WebsiteDataStoreParameters::encode const):
939         (WebKit::WebsiteDataStoreParameters::decode):
940         * Shared/WebsiteDataStoreParameters.h:
941         * UIProcess/API/Cocoa/WKProcessPool.mm:
942         (-[WKProcessPool _registerURLSchemeServiceWorkersCanHandle:]): Deleted.
943         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
944         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
945         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
946         (-[_WKWebsiteDataStoreConfiguration registerURLSchemeServiceWorkersCanHandleForTesting:]):
947         * UIProcess/WebProcessPool.cpp:
948         (WebKit::WebProcessPool::ensureNetworkProcess):
949         (WebKit::WebProcessPool::initializeNewWebProcess):
950         (WebKit::WebProcessPool::registerURLSchemeServiceWorkersCanHandle): Deleted.
951         * UIProcess/WebProcessPool.h:
952         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
953         (WebKit::WebsiteDataStore::parameters):
954         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
955         (WebKit::WebsiteDataStoreConfiguration::copy):
956         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
957         (WebKit::WebsiteDataStoreConfiguration::serviceWorkerRegisteredSchemes const):
958         (WebKit::WebsiteDataStoreConfiguration::registerServiceWorkerScheme):
959         * WebProcess/WebProcess.cpp:
960         (WebKit::WebProcess::initializeWebProcess):
961
962 2019-10-04  youenn fablet  <youenn@apple.com>
963
964         Allow to suspend RTCPeerConnection when not connected
965         https://bugs.webkit.org/show_bug.cgi?id=202403
966
967         Reviewed by Chris Dumez.
968
969         Implement suspend/resume of sockets by doing the following:
970         - For UDP sockets, we simulate as if being sent data is queued when being suspended.
971         the webrtc backend will then stop sending packets until the queue is emptied.
972         At resume time, we do as if the queue is emptied and packets sent (even though packets are not sent).
973         For incoming traffic, we ignore it when being suspended.
974         - For TCP sockets, we close them at suspend time. We then notify at resume time that an error happeneded
975         for these sockets to the webrtc backend. We cannot simulate packet dropping like in the UDP case.
976
977         To manage resume/suspend, each socket now has a isSuspended state and a socket group.
978         The socket group is per peer connection.
979         A peer connection will notify the factory that it is suspended/resumed.
980         The factory will iterate through all sockets and will suspend/resume each socket of the socket group.
981
982         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
983         (WebKit::RTCSocketFactory::RTCSocketFactory):
984         (WebKit::RTCSocketFactory::CreateUdpSocket):
985         (WebKit::RTCSocketFactory::CreateServerTcpSocket):
986         (WebKit::RTCSocketFactory::CreateClientTcpSocket):
987         (WebKit::RTCSocketFactory::CreateAsyncResolver):
988         (WebKit::RTCSocketFactory::suspend):
989         (WebKit::RTCSocketFactory::resume):
990         (WebKit::LibWebRTCProvider::createSocketFactory):
991         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
992         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
993         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
994         (WebKit::LibWebRTCSocket::~LibWebRTCSocket):
995         (WebKit::LibWebRTCSocket::signalReadPacket):
996         (WebKit::LibWebRTCSocket::signalSentPacket):
997         (WebKit::LibWebRTCSocket::SendTo):
998         (WebKit::LibWebRTCSocket::Close):
999         (WebKit::LibWebRTCSocket::SetOption):
1000         (WebKit::LibWebRTCSocket::resume):
1001         (WebKit::LibWebRTCSocket::suspend):
1002         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
1003         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
1004         (WebKit::LibWebRTCSocketFactory::createServerTcpSocket):
1005         (WebKit::LibWebRTCSocketFactory::createUdpSocket):
1006         (WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
1007         (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket):
1008         (WebKit::LibWebRTCSocketFactory::addSocket):
1009         (WebKit::LibWebRTCSocketFactory::removeSocket):
1010         (WebKit::LibWebRTCSocketFactory::forSocketInGroup):
1011         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
1012
1013 2019-10-04  Alex Christensen  <achristensen@webkit.org>
1014
1015         Simplify sandbox enabling macros
1016         https://bugs.webkit.org/show_bug.cgi?id=202536
1017
1018         Reviewed by Brent Fulgham.
1019
1020         ENABLE_WEB_PROCESS_SANDBOX was always on for Cocoa platforms and only used in WebProcessCocoa.mm, so it did nothing.
1021         ENABLE_MANUAL_SANDBOXING was on for sdk=macosx* which I made more explicit in the code by using PLATFORM(MAC) || PLATFORM(MAACCATALYST)
1022         ENABLE_MANUAL_NETWORK_SANDBOXING was always off and hiding dead code we do not intend to use because iOS sandboxes are always on and never manual.
1023
1024         * Configurations/FeatureDefines.xcconfig:
1025         * NetworkProcess/ios/NetworkProcessIOS.mm:
1026         (WebKit::NetworkProcess::initializeSandbox):
1027         * Shared/ios/AuxiliaryProcessIOS.mm:
1028         (WebKit::AuxiliaryProcess::initializeSandbox):
1029         * WebProcess/cocoa/WebProcessCocoa.mm:
1030         (WebKit::WebProcess::initializeSandbox):
1031
1032 2019-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1033
1034         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.27.1 release
1035
1036         * gtk/NEWS: Add release notes for 2.27.1.
1037
1038 2019-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1039
1040         [GTK] Crash in WebChromeClient::createDisplayRefreshMonitor
1041         https://bugs.webkit.org/show_bug.cgi?id=202551
1042
1043         Reviewed by Žan Doberšek.
1044
1045         The crash happens when the drawing area is destroyed due to a page close. The layer tree host is invalidated
1046         causing a layer flush that ends up trying to create a display refresh monitor, which requires the drawing
1047         area. We need to null-check the drawing area in WebChromeClient::createDisplayRefreshMonitor() but we should
1048         also ensure that layer flush is not performed after layer tree host is destroyed.
1049
1050         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1051         (WebKit::WebChromeClient::createDisplayRefreshMonitor const): Null-check drawing area before using it.
1052         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1053         (WebKit::CompositingCoordinator::CompositingCoordinator): Receive a WebPage instead of a WebCore::Page and
1054         create the root layer here.
1055         (WebKit::CompositingCoordinator::~CompositingCoordinator): Do not purge backing stores again, invalidate should
1056         always be called right before the object is destroyed.
1057         (WebKit::CompositingCoordinator::flushPendingLayerChanges): Get WebCore::Page from WebPage.
1058         (WebKit::CompositingCoordinator::timestamp const): Ditto.
1059         (WebKit::CompositingCoordinator::syncDisplayState): Ditto.
1060         (WebKit::CompositingCoordinator::notifyFlushRequired): Do not continue if m_rootLayer is nullptr.
1061         (WebKit::CompositingCoordinator::deviceScaleFactor const): Get WebCore::Page from WebPage.
1062         (WebKit::CompositingCoordinator::pageScaleFactor const): Ditto.
1063         (WebKit::CompositingCoordinator::createGraphicsLayer): Call attachLayer() instead of duplicating the code.
1064         (WebKit::CompositingCoordinator::setVisibleContentsRect): Get WebCore::Page from WebPage.
1065         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1066         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1067         (WebKit::DrawingAreaCoordinatedGraphics::discardPreviousLayerTreeHost): Do not call LayerTreeHost::invalidate()
1068         that has been removed.
1069         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1070         (WebKit::LayerTreeHost::LayerTreeHost): Construct the coordinator after the sceneIntegration.
1071         (WebKit::LayerTreeHost::~LayerTreeHost): Invalidate everything here now. We don't really need invalidate()
1072         method since LayerTreeHost is not refcounted and we always called invalidate right before deleting the object.
1073         (WebKit::LayerTreeHost::layerFlushTimerFired): This can't happen on invalid state anymore.
1074         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
1075
1076 2019-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1077
1078         [GTK][WPE] REGRESSION(r250673): connection to network process is broken after r250673
1079         https://bugs.webkit.org/show_bug.cgi?id=202575
1080
1081         Reviewed by Carlos Alberto Lopez Perez.
1082
1083         The file descriptor is now closed when the IPC::Attachment is destroyed in NetworkProcessConnectionInfo
1084         destructor. In case of unix domain sockets we need to transfer the ownership of the fd to
1085         NetworkProcessConnection, but NetworkProcessConnectionInfo is ow keeping the ownership.
1086
1087         * WebProcess/Network/NetworkProcessConnectionInfo.h:
1088         (WebKit::NetworkProcessConnectionInfo::releaseIdentifier): Use IPC::Attachment::releaseFileDescriptor() in case
1089         of unix domain sockets.
1090         * WebProcess/WebProcess.cpp:
1091         (WebKit::WebProcess::ensureNetworkProcessConnection): Use NetworkProcessConnectionInfo::releaseIdentifier() when
1092         passing the identifier to NetworkProcessConnection.
1093
1094 2019-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1095
1096         Unreviewed. Fix GTK distcheck
1097
1098         * webkitglib-symbols.map: Remove symbols that are no longer in lib.
1099
1100 2019-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1101
1102         [GTK] WebAutomation: make setWindowRect synchronous
1103         https://bugs.webkit.org/show_bug.cgi?id=202530
1104
1105         Reviewed by Carlos Alberto Lopez Perez.
1106
1107         Move/resize window is asynchronous in GTK, but automation expects it to be synchronous so that get window rect
1108         after setting it always returns the value set. Use a nested run loop to wait for the configure events after the
1109         move/resize.
1110
1111         * UIProcess/API/glib/WebKitUIClient.cpp:
1112         (UIClient::windowConfigureEventCallback):
1113         (UIClient::setWindowFrameTimerFired):
1114
1115 2019-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1116
1117         Unreviewed. Address review comments after r250646.
1118
1119         I forgot to include the documentation improvements suggested.
1120
1121         * UIProcess/API/glib/WebKitWebContext.cpp:
1122         (webkit_web_context_class_init):
1123
1124 2019-10-03  Christopher Reid  <chris.reid@sony.com>
1125
1126         [WinCairo] Remote inspector client target list is racy
1127         https://bugs.webkit.org/show_bug.cgi?id=202169
1128
1129         Reviewed by Ross Kirsling.
1130
1131         Original patch by Basuke Suzuki.
1132
1133         Use LoaderClient to defer javascript target update calls to until after the page finished load.
1134
1135         * UIProcess/socket/RemoteInspectorProtocolHandler.cpp:
1136         * UIProcess/socket/RemoteInspectorProtocolHandler.h:
1137
1138 2019-10-03  Ross Kirsling  <ross.kirsling@sony.com>
1139
1140         Socket RWI client should acquire backend commands from server
1141         https://bugs.webkit.org/show_bug.cgi?id=202421
1142
1143         Reviewed by Devin Rousso.
1144
1145         * UIProcess/socket/RemoteInspectorClient.cpp:
1146         (WebKit::RemoteInspectorClient::dispatchMap):
1147         (WebKit::RemoteInspectorClient::setBackendCommands):
1148         * UIProcess/socket/RemoteInspectorClient.h:
1149         Receive "BackendCommands" message from server (which is already base64-encoded) and hand it over to RWIProxy.
1150
1151         * UIProcess/win/WebProcessPoolWin.cpp:
1152         (WebKit::backendCommandsPath):
1153         (WebKit::initializeRemoteInspectorServer):
1154         On Windows, initialize server with the path to InspectorBackendCommands.js from the CFBundle.
1155
1156 2019-10-03  Alex Christensen  <achristensen@webkit.org>
1157
1158         Replace _WKProcessPoolConfiguration.suppressesConnectionTerminationOnSystemChange with SPI on _WKWebsiteDataStoreConfiguration
1159         https://bugs.webkit.org/show_bug.cgi?id=202544
1160
1161         Reviewed by Tim Horton.
1162
1163         The _WKProcessPoolConfiguration SPI was originally introduced in rdar://problem/40650244
1164         Keep both working during the transition period, but we need it to not be on the process pool.
1165
1166         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1167         (WebKit::NetworkSessionCreationParameters::encode const):
1168         (WebKit::NetworkSessionCreationParameters::decode):
1169         * NetworkProcess/NetworkSessionCreationParameters.h:
1170         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1171         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1172         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1173         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1174         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1175         (-[_WKWebsiteDataStoreConfiguration suppressesConnectionTerminationOnSystemChange]):
1176         (-[_WKWebsiteDataStoreConfiguration setSuppressesConnectionTerminationOnSystemChange:]):
1177         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1178         (WebKit::WebsiteDataStore::parameters):
1179         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1180         (WebKit::WebsiteDataStoreConfiguration::copy):
1181         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1182         (WebKit::WebsiteDataStoreConfiguration::suppressesConnectionTerminationOnSystemChange const):
1183         (WebKit::WebsiteDataStoreConfiguration::setSuppressesConnectionTerminationOnSystemChange):
1184
1185 2019-10-03  Per Arne Vollan  <pvollan@apple.com>
1186
1187         REGRESSION(249649): Unable to open local files in MiniBrowser on macOS
1188         https://bugs.webkit.org/show_bug.cgi?id=201798
1189
1190         Reviewed by Brent Fulgham.
1191
1192         The commit <https://trac.webkit.org/changeset/249649> introduced a MiniBrowser regression on macOS where MiniBrowser
1193         is not able to open local files. The change set r249649 fixed a problem where the WebContent process PID was not ready
1194         to be used when creating a sandbox extension. This happened in the cases where the WebContent process had not finished
1195         launching when the load started. The WebContent process is also creating sandbox extensions for the Networking process
1196         for the files being loaded, and also needs to be passing the audit token of the Networking process when creating these.
1197         This patch implements getting the audit token for the Networking process when the WebProcess is sending a message to
1198         the UI process to establish the Networking process connection. The audit token is stored in the NetworkProcessConnection
1199         object, and passed to the NetworkLoadParameters object when the load is started. Finally, when encoding the Network
1200         resources load parameters, the audit token is used to create an extension for the Networking process.
1201
1202         API test: WKWebView.LoadFileWithLoadRequest
1203
1204         * NetworkProcess/NetworkLoadParameters.h:
1205         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1206         (WebKit::NetworkResourceLoadParameters::encode const):
1207         * Platform/IPC/ArgumentCoders.cpp:
1208         (IPC::ArgumentCoder<audit_token_t>::encode):
1209         (IPC::ArgumentCoder<audit_token_t>::decode):
1210         * Platform/IPC/ArgumentCoders.h:
1211         * Shared/Cocoa/SandboxExtensionCocoa.mm:
1212         (WebKit::SandboxExtensionImpl::create):
1213         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
1214         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
1215         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
1216         (WebKit::SandboxExtension::createHandleForReadByPid):
1217         (WebKit::SandboxExtension::createHandleForReadByAuditToken):
1218         * Shared/SandboxExtension.h:
1219         * UIProcess/Network/NetworkProcessProxy.cpp:
1220         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
1221         * UIProcess/WebProcessProxy.messages.in:
1222         * WebKit.xcodeproj/project.pbxproj:
1223         * WebProcess/Network/NetworkProcessConnection.h:
1224         (WebKit::NetworkProcessConnection::setNetworkProcessAuditToken):
1225         (WebKit::NetworkProcessConnection::networkProcessAuditToken const):
1226         * WebProcess/Network/NetworkProcessConnectionInfo.h: Added.
1227         (WebKit::NetworkProcessConnectionInfo::identifier):
1228         (WebKit::NetworkProcessConnectionInfo::encode const):
1229         (WebKit::NetworkProcessConnectionInfo::decode):
1230         * WebProcess/Network/WebLoaderStrategy.cpp:
1231         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1232         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1233         (WebKit::WebLoaderStrategy::startPingLoad):
1234         (WebKit::WebLoaderStrategy::preconnectTo):
1235         * WebProcess/WebProcess.cpp:
1236         (WebKit::getNetworkProcessConnection):
1237         (WebKit::WebProcess::ensureNetworkProcessConnection):
1238
1239 2019-10-03  Konstantin Tokarev  <annulen@yandex.ru>
1240
1241         CMake-built WebKit.framework should launch XPC services successfully
1242         https://bugs.webkit.org/show_bug.cgi?id=202490
1243
1244         Reviewed by Carlos Alberto Lopez Perez.
1245
1246         target_link_options() requires CMake 3.10, however we can avoid
1247         raising required CMake version by moving it to PlatformMac.cmake,
1248         also avoid introduction of new CMake variable.
1249
1250         * CMakeLists.txt:
1251         * PlatformMac.cmake:
1252
1253 2019-10-03  Jiewen Tan  <jiewen_tan@apple.com>
1254
1255         Support googleLegacyAppidSupport extension
1256         https://bugs.webkit.org/show_bug.cgi?id=202427
1257         <rdar://problem/55887473>
1258
1259         Reviewed by Brent Fulgham.
1260
1261         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1262         (WebKit::AuthenticatorManagerInternal::collectTransports):
1263         (WebKit::AuthenticatorManagerInternal::processGoogleLegacyAppIdSupportExtension):
1264         (WebKit::AuthenticatorManager::handleRequest):
1265         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
1266         (WebKit::CtapAuthenticator::makeCredential):
1267         (WebKit::CtapAuthenticator::processGoogleLegacyAppIdSupportExtension):
1268         * UIProcess/WebAuthentication/fido/CtapAuthenticator.h:
1269         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
1270         (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
1271
1272 2019-10-03  Jiewen Tan  <jiewen_tan@apple.com>
1273
1274         [WebAuthn] Implement dummy _WKWebAuthenticationPanel SPI
1275         https://bugs.webkit.org/show_bug.cgi?id=202507
1276         <rdar://problem/55918793>
1277
1278         Reviewed by Brent Fulgham.
1279
1280         This patch implements dummy _WKWebAuthenticationPanel SPI to unblock Safari.
1281
1282         Here are the illustrations for each SPI:
1283         1) -[WKUIDelegatePrivate webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:] is used at the beginning of
1284         any WebAuthn ceremonies. A WKFrameInfo is provided for more info of the initiating frame so clients could decide either show
1285         the RP ID or the origin of the frame which may or may not be the RP ID. A callback of _WKWebAuthenticationPanelResult is
1286         provided such that clients could inform WebKit to continue the ceremony or not. Case like rate limiting of a modular dialog
1287         could result in _WKWebAuthenticationPanelResultDidNotPresent. Then WebKit will abort the operation.
1288         _WKWebAuthenticationPanelResultUnavailable tells WebKit the client has no UI implemented and therefore WebKit will operate
1289         in a non UI mode which basically will only enable HID authenticators, and is the current behavior of macOS Safari.
1290         2) -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] is primarily to instruct users to do some
1291         actionable thing to recover from some error state. However, it could be used for pure info as well. For
1292         _WKWebAuthenticationPanelInfoMultipleNFCTagPresents, users can be instructed to only hold one NFC tag to the scanner. For
1293         _WKWebAuthenticationPanelInfoNoCredentialsFound, users can potentially switch to another security key that could hit a match.
1294         3) -[_WKWebAuthenticationPanelDelegate panel:dismissWebAuthenticationPanelWithResult:] is to dismiss UI.
1295         _WKWebAuthenticationResult is provided such that client could show different animations as a hint to the user. The reasons for
1296         failure could either be timeout or InvalidStateError which will be reported to the page as well. InvalidStateError signals a
1297         credential matching an entry of the exclude list (excludeCredentials) is found on the authenticator.
1298         4) -[_WKWebAuthenticationPanel cancel] is the way clients tell WebKit a user cancel.
1299
1300         * SourcesCocoa.txt:
1301         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1302         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: Added.
1303         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: Added.
1304         (-[_WKWebAuthenticationPanel _initWithRelayingPartyID:]):
1305         (-[_WKWebAuthenticationPanel relyingPartyID]):
1306         (-[_WKWebAuthenticationPanel cancel]):
1307         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h: Added.
1308         * WebKit.xcodeproj/project.pbxproj:
1309
1310 2019-10-03  Zan Dobersek  <zdobersek@igalia.com>
1311
1312         [GTK][WPE] Enable async scrolling
1313         https://bugs.webkit.org/show_bug.cgi?id=202449
1314
1315         Reviewed by Carlos Garcia Campos.
1316
1317         For WPE, explicitly enable the threaded scrolling preference on the
1318         WebPreferences object. For GTK, the same preference is enabled in
1319         parallel with the forced-compositing preference, as the async scrolling
1320         feature depends on always-on AC mode.
1321
1322         To help with quick evaluation of potential issues around async scrolling
1323         the feature can still be disabled via the WEBKIT_DISABLE_ASYNC_SCROLLING
1324         environment variable, though this only works in DEVELOPER_MODE builds.
1325
1326         * Shared/WebPreferencesDefaultValues.h: Default-enable async frame and
1327         overflow scrolling on Nicosia-using ports.
1328         * UIProcess/API/glib/WebKitSettings.cpp:
1329         (webkit_settings_set_hardware_acceleration_policy):
1330         * UIProcess/API/wpe/WPEView.cpp:
1331         (WKWPE::m_backend):
1332         * UIProcess/gtk/WebPreferencesGtk.cpp:
1333         (WebKit::WebPreferences::platformInitializeStore):
1334         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1335         (WebKit::DrawingAreaCoordinatedGraphics::DrawingAreaCoordinatedGraphics):
1336         (WebKit::DrawingAreaCoordinatedGraphics::updatePreferences):
1337         (WebKit::DrawingAreaCoordinatedGraphics::supportsAsyncScrolling):
1338         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
1339
1340 2019-10-03  Zan Dobersek  <zdobersek@igalia.com>
1341
1342         [Nicosia] Enable runtime checks and triggers for async non-main-frame scrolling
1343         https://bugs.webkit.org/show_bug.cgi?id=202509
1344
1345         Reviewed by Carlos Garcia Campos.
1346
1347         * WebProcess/WebCoreSupport/WebChromeClient.h:
1348         Allow the non-main-frame compositing trigger for the Nicosia-using ports
1349         as well. This will enable non-main-frame compositing if the related
1350         setting is also enabled.
1351
1352 2019-10-03  Alexander Mikhaylenko  <alexm@gnome.org>
1353
1354         [GTK] Don't hardcode swipe navigation gesture style
1355         https://bugs.webkit.org/show_bug.cgi?id=202447
1356
1357         Reviewed by Carlos Garcia Campos.
1358
1359         Use GTK foreign drawing to draw swipe gesture dimming and shadow instead of
1360         hardcoded opacity and gradient values.
1361
1362         Have separate elements for dimming and shadow. Additionally, add border
1363         and outline. Dimming layer opacity always matches progress, shadow opacity
1364         is 1 except when the page is almost completely retracted. Border and outline
1365         opacity is always 1. Outline is drawn above the top page. For determining
1366         shadow, border and outline width, 'min-width' property is used.
1367
1368         Each element also has .right or .left style class depending on text direction.
1369
1370         Creating patterns is relatively expensive, so do it once a gesture
1371         starts and clear them once it ends. Style changes are currently not
1372         handled, since it's unlikely anything would change while the gesture
1373         is done. Dimming layer is created with the same width as webview and is
1374         clipped when drawing.
1375
1376         Translate existing dimming and shadow into css as is, add subtle border and
1377         outline. Since it's controlled via css, downstreams can override the style.
1378
1379         Set WebKitWebView css name to 'webkitwebview', and only apply styles for
1380         elements directly preceded by it, otherwise the selectors are too generic.
1381
1382         * PlatformGTK.cmake: Add gtk.css to gresource bundle.
1383         * Resources/gtk/gtk-theme.css: Added.
1384         (webkitwebview > dimming):
1385         (webkitwebview > shadow):
1386         (webkitwebview > shadow.right):
1387         (webkitwebview > shadow.left):
1388         (webkitwebview > border):
1389         (webkitwebview > outline):
1390         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1391         (webkit_web_view_base_class_init): Set css name to 'webkitwebview'.
1392         * UIProcess/ViewGestureController.h:
1393         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
1394         (WebKit::ViewGestureController::createStyleContext):
1395         (WebKit::createElementPattern):
1396         (WebKit::elementWidth):
1397         (WebKit::ViewGestureController::beginSwipeGesture): Create helper patterns.
1398         (WebKit::ViewGestureController::draw): Rework drawing to use the patterns.
1399         (WebKit::ViewGestureController::removeSwipeSnapshot): Clear the patterns.
1400
1401 2019-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1402
1403         [GTK] Make PSON optional
1404         https://bugs.webkit.org/show_bug.cgi?id=200967
1405
1406         Reviewed by Michael Catanzaro.
1407
1408         It's not possible to enable PSON by default and keep backwards compatibility, applications might need to use new
1409         API to monitor the page ID changes in the Web view. So, this patch adds a construct only property to
1410         WebKitWebContext to enable PSON.
1411
1412         * UIProcess/API/glib/WebKitWebContext.cpp:
1413         (webkitWebContextGetProperty):
1414         (webkitWebContextSetProperty):
1415         (webkitWebContextConstructed):
1416         (webkit_web_context_class_init):
1417
1418 2019-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1419
1420         [GTK][WPE] Add WebKitWebView:page-id property
1421         https://bugs.webkit.org/show_bug.cgi?id=201642
1422
1423         Reviewed by Michael Catanzaro.
1424
1425         The page ID of a WebKitWebView can now change, so we need a way to get notified when it changes.
1426
1427         * UIProcess/API/glib/WebKitWebView.cpp:
1428         (webkitWebViewGetProperty): Add getter for page-id.
1429         (webkit_web_view_class_init): Add page-id property
1430         (webkitWebViewDidChangePageID): Emit notify::page-id.
1431         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1432         * UIProcess/API/gtk/PageClientImpl.cpp:
1433         (WebKit::PageClientImpl::didChangeWebPageID const): Call webkitWebViewDidChangePageID().
1434         * UIProcess/API/gtk/PageClientImpl.h:
1435         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1436         * UIProcess/API/wpe/APIViewClient.h:
1437         (API::ViewClient::didChangePageID): Added virtual method.
1438         * UIProcess/API/wpe/PageClientImpl.cpp:
1439         (WebKit::PageClientImpl::didChangeWebPageID const): Call WKWPE::View::didChangePageID().
1440         * UIProcess/API/wpe/PageClientImpl.h:
1441         * UIProcess/API/wpe/WPEView.cpp:
1442         (WKWPE::View::didChangePageID): Call API::ViewClient::didChangePageID().
1443         * UIProcess/API/wpe/WPEView.h:
1444         * UIProcess/PageClient.h:
1445         (WebKit::PageClient::didChangeWebPageID const): Added virtual method.
1446         * UIProcess/WebPageProxy.cpp:
1447         (WebKit::WebPageProxy::swapToWebProcess): Call PageClient::didChangeWebPageID().
1448
1449 2019-10-02  Andy Estes  <aestes@apple.com>
1450
1451         [iOS] When hit testing for a context menu interaction, do not consider whether the element is contenteditable
1452         https://bugs.webkit.org/show_bug.cgi?id=202498
1453         <rdar://problem/54723131>
1454
1455         Reviewed by Tim Horton.
1456
1457         * WebProcess/WebPage/ios/WebPageIOS.mm:
1458         (WebKit::WebPage::startInteractionWithElementAtPosition): Changed to call
1459         WebCore::Frame::nodeRespondingToInteraction.
1460
1461 2019-10-02  Myles C. Maxfield  <mmaxfield@apple.com>
1462
1463         REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
1464         https://bugs.webkit.org/show_bug.cgi?id=202198
1465
1466         Reviewed by Tim Horton.
1467
1468         NSFont has a bug where passing "auto" to kCTFontOpticalSizeAttribute
1469         causes an exception to be thrown. We don't catch the exception, so we
1470         pop up back to the runloop, which confuses the UI process.
1471
1472         The solution is twofold: 1) Workaround the bug by passing the font size
1473         to kCTFontOpticalSizeAttribute instead, and 2) catch any exceptions that
1474         this part of the code might throw.
1475
1476         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1477         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1478
1479 2019-10-02  Alex Christensen  <achristensen@webkit.org>
1480
1481         [CMake] Don't link WebKit.framework with SecItemShim
1482         ​https://bugs.webkit.org/show_bug.cgi?id=202490
1483
1484         * PlatformMac.cmake:
1485         Otherwise everything that uses the Security framework crashes immediately.
1486         We only need it in the NetworkProcess.
1487
1488 2019-10-02  Alex Christensen  <achristensen@webkit.org>
1489
1490         CMake-built WebKit.framework should launch XPC services successfully
1491         https://bugs.webkit.org/show_bug.cgi?id=202490
1492
1493         Rubber-stamped by Tim Horton.
1494
1495         * CMakeLists.txt:
1496         * PlatformMac.cmake:
1497
1498 2019-10-02  Kate Cheney  <katherine_cheney@apple.com>
1499
1500         Updated resource load statistics are never merged into the SQLite Database backend (202372).
1501         https://bugs.webkit.org/show_bug.cgi?id=202372
1502         <rdar://problem/55854542>
1503
1504         Reviewed by Brent Fulgham. 
1505
1506         This patch has a lot of changes to the test infrastructure to be able 
1507         to test the mergeStatistics function. Merging functionality mimics
1508         that of the ResourceLoadStatisticsMemoryStore and the merge() function in
1509         ResourceLoadStatistics.cpp.
1510
1511         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1512         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
1513         Added new SQLite queries that are needed to merge new statistics.
1514
1515         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
1516         Added new prepare statements for new SQLite queries.
1517
1518         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
1519         Updated to use domainID() instead of confirmDomainDoesNotExist which 
1520         was deleted. Changed the insert bind parameters
1521         to utilize new enum of Observed Domain table indices which will help
1522         reduce errors in the future if the database schema changes.
1523
1524         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
1525         Changed {public} to {private} in logging statement to avoid leaking
1526         sensitive information when logging the query error.
1527
1528         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const): Deleted.
1529         This function essentially does the exact same thing as domainID and
1530         we can reduce code duplication by deleting it and transitioning all
1531         other functions to use domainID instead.
1532
1533         (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
1534         Changed {public} to {private} in logging statement to avoid leaking
1535         sensitive information when logging the query error.
1536         
1537         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
1538         In order to reuse this code for the merge statistics function, I added
1539         a check before each insert call to ensure the relationship does not
1540         already exist in the database. This was not needed before because it
1541         was only called on an empty database.
1542
1543         (WebKit::ResourceLoadStatisticsDatabaseStore::merge):
1544         (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic):
1545         (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics):
1546         Merges new statistic.
1547
1548         (WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains):
1549         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
1550         (WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent):
1551         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1552         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
1553         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
1554         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
1555         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
1556         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
1557         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
1558         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
1559         (WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent):
1560         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
1561         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
1562         Changed {public} to {private} in logging statement to avoid leaking
1563         sensitive information when logging the query error.
1564
1565         (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
1566         Fix a bug uncovered by the new test cases.
1567         
1568         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain):
1569         (WebKit::ResourceLoadStatisticsDatabaseStore::clearDatabaseContents):
1570         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieTreatmentForOrigin const):
1571         (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions):
1572         (WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering):
1573         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded):
1574         (WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen):
1575         Changed {public} to {private} in logging statement to avoid leaking
1576         sensitive information when logging the query error.
1577         
1578         (WebKit::ResourceLoadStatisticsDatabaseStore::updateDataRecordsRemoved):
1579         A new function that utilizes a query needed for the merging of two
1580         statistics.
1581         
1582         (WebKit::ResourceLoadStatisticsDatabaseStore::confirmDomainDoesNotExist const): Deleted.
1583         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1584         
1585         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1586         (WebKit::ResourceLoadStatisticsMemoryStore::mergeStatistics):
1587         (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction const): Deleted.
1588         Removed the check for updating times accessed due to first party 
1589         interaction, which is data no longer needed in updated ITP. 
1590
1591         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1592         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1593         Added the mergeStatistics function (previously only in the memory
1594         store) to the parent class now that it is used by both stores.
1595         
1596         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1597         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
1598         This function now calls mergeStatistics on the database store if
1599         enabled.
1600
1601         (WebKit::WebResourceLoadStatisticsStore::mergeStatisticForTesting):
1602         This function builds a vector from the sample data to test the
1603         mergeStatistics() function of the database store.
1604
1605         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1606         * NetworkProcess/NetworkProcess.cpp:
1607         (WebKit::NetworkProcess::mergeStatisticForTesting):
1608         * NetworkProcess/NetworkProcess.h:
1609         * NetworkProcess/NetworkProcess.messages.in:
1610         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1611         (WKWebsiteDataStoreSetStatisticsMergeStatistic):
1612         Fixed bug where isGrandfathered function in WKWebsiteDataStoreRef
1613         was calling hasHadUserInteraction by mistake.
1614
1615         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1616         * UIProcess/Network/NetworkProcessProxy.cpp:
1617         (WebKit::NetworkProcessProxy::mergeStatisticForTesting):
1618         * UIProcess/Network/NetworkProcessProxy.h:
1619         This code is for testing the mergeStatistics() function.
1620
1621         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1622         (WebKit::WebsiteDataStore::isGrandfathered):
1623         (WebKit::WebsiteDataStore::mergeStatisticForTesting):
1624         * UIProcess/WebsiteData/WebsiteDataStore.h:
1625         Added this function which contacts the networkProcess to retrieve the
1626         grandfathered value for a domain. This was not included before because
1627         of a bug in WKWebsiteDataStoreRef.
1628
1629 2019-10-02  Dean Jackson  <dino@apple.com>
1630
1631         Provide originating website URL to AR QuickLook
1632         https://bugs.webkit.org/show_bug.cgi?id=202451
1633
1634         Reviewed by Antoine Quint.
1635
1636         Declare the setAdditionalParameters method and
1637         call it with the originating page URL if available.
1638
1639         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1640
1641 2019-10-02  Keith Rollin  <krollin@apple.com>
1642
1643         Properly mark canceled resources in NetworkActivityTracker
1644         https://bugs.webkit.org/show_bug.cgi?id=202440
1645         <rdar://problem/55843651>
1646
1647         Reviewed by Brent Fulgham.
1648
1649         The nw_activity facility tracking resource loads did not originally
1650         have support for reporting resources that were canceled. It now has
1651         that support (since late MacOS 14-aligned SDKs), so add support for it
1652         in NetworkActivityTracker and use it in places where we were
1653         previously reporting the status of canceled resources as "None".
1654
1655         * NetworkProcess/NetworkActivityTracker.h:
1656         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1657         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
1658         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
1659         * NetworkProcess/NetworkResourceLoader.cpp:
1660         (WebKit::NetworkResourceLoader::cleanup):
1661         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm:
1662         (WebKit::NetworkActivityTracker::complete):
1663
1664 2019-10-02  Zan Dobersek  <zdobersek@igalia.com>
1665
1666         Unreviewed build fix for non-Mac ports after r250600.
1667
1668         * UIProcess/WebProcessPool.cpp:
1669         Make the CoreGraphicsSPI.h header include exclusive to the Mac port.
1670
1671 2019-10-02  Antoine Quint  <graouts@apple.com>
1672
1673         Unreviewed build fix for macOS, broken by r250595.
1674
1675         * UIProcess/WebProcessPool.cpp:
1676
1677 2019-10-02  youenn fablet  <youenn@apple.com>
1678
1679         Use strongly typed identifiers for webrtc sockets
1680         https://bugs.webkit.org/show_bug.cgi?id=202400
1681
1682         Reviewed by Chris Dumez.
1683
1684         Refactoring to use LibWebRTCSocketIdentifier instead of uint64_t.
1685
1686         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
1687         (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
1688         * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
1689         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1690         (WebKit::NetworkRTCProvider::createSocket):
1691         (WebKit::NetworkRTCProvider::createUDPSocket):
1692         (WebKit::NetworkRTCProvider::createServerTCPSocket):
1693         (WebKit::NetworkRTCProvider::createClientTCPSocket):
1694         (WebKit::NetworkRTCProvider::wrapNewTCPConnection):
1695         (WebKit::NetworkRTCProvider::addSocket):
1696         (WebKit::NetworkRTCProvider::takeSocket):
1697         (WebKit::NetworkRTCProvider::newConnection):
1698         (WebKit::NetworkRTCProvider::didReceiveNetworkRTCSocketMessage):
1699         (WebKit::NetworkRTCProvider::closeListeningSockets):
1700         (WebKit::NetworkRTCProvider::callSocket):
1701         * NetworkProcess/webrtc/NetworkRTCProvider.h:
1702         * NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
1703         * NetworkProcess/webrtc/NetworkRTCSocket.cpp:
1704         (WebKit::NetworkRTCSocket::NetworkRTCSocket):
1705         * NetworkProcess/webrtc/NetworkRTCSocket.h:
1706         * Scripts/webkit/messages.py:
1707         * WebProcess/Network/NetworkProcessConnection.cpp:
1708         (WebKit::NetworkProcessConnection::didReceiveMessage):
1709         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
1710         (WebKit::LibWebRTCNetwork::socket):
1711         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
1712         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
1713         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
1714         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
1715         (WebKit::LibWebRTCSocketFactory::createServerTcpSocket):
1716         (WebKit::LibWebRTCSocketFactory::createUdpSocket):
1717         (WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
1718         (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket):
1719         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
1720         (WebKit::LibWebRTCSocketFactory::socket):
1721         (WebKit::LibWebRTCSocketFactory::resolver):
1722         (WebKit::LibWebRTCSocketFactory::takeResolver):
1723         (WebKit::LibWebRTCSocketFactory::disableNonLocalhostConnections):
1724         * WebProcess/Network/webrtc/WebRTCSocket.cpp:
1725         (WebKit::WebRTCSocket::signalOnNetworkThread):
1726         (WebKit::WebRTCSocket::WebRTCSocket):
1727         (WebKit::WebRTCSocket::signalSentPacket):
1728         (WebKit::WebRTCSocket::signalConnect):
1729         (WebKit::WebRTCSocket::signalClose):
1730         (WebKit::WebRTCSocket::signalNewConnection):
1731         * WebProcess/Network/webrtc/WebRTCSocket.h:
1732         * WebProcess/Network/webrtc/WebRTCSocket.messages.in:
1733
1734 2019-10-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1735
1736         [GTK][WPE] Stop using legacy custom protocol implementation
1737         https://bugs.webkit.org/show_bug.cgi?id=202407
1738
1739         Reviewed by Žan Doberšek.
1740
1741         Use the new approach, which is simpler and doesn't require to go to the network process to load custom
1742         protocols.
1743
1744         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp: Removed.
1745         * NetworkProcess/NetworkProcess.cpp:
1746         (WebKit::m_messagePortChannelRegistry):
1747         * NetworkProcess/soup/WebKitSoupRequestInputStream.cpp: Removed.
1748         * NetworkProcess/soup/WebKitSoupRequestInputStream.h: Removed.
1749         * PlatformGTK.cmake:
1750         * PlatformWPE.cmake:
1751         * SourcesGTK.txt:
1752         * SourcesWPE.txt:
1753         * UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp: Removed.
1754         * UIProcess/API/glib/WebKitCustomProtocolManagerClient.h: Removed.
1755         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
1756         (webkitURISchemeRequestCreate):
1757         (webkit_uri_scheme_request_get_scheme):
1758         (webkit_uri_scheme_request_get_uri):
1759         (webkit_uri_scheme_request_get_path):
1760         (webkit_uri_scheme_request_get_web_view):
1761         (webkitURISchemeRequestReadCallback):
1762         (webkit_uri_scheme_request_finish_error):
1763         * UIProcess/API/glib/WebKitURISchemeRequestPrivate.h:
1764         * UIProcess/API/glib/WebKitWebContext.cpp:
1765         (webkitWebContextConstructed):
1766         (webkitWebContextDispose):
1767         (webkit_web_context_register_uri_scheme):
1768         (webkitWebContextCreatePageForWebView):
1769         * UIProcess/API/glib/WebKitWebContextPrivate.h:
1770         * UIProcess/WebURLSchemeTask.h:
1771         (WebKit::WebURLSchemeTask::request const):
1772         * UIProcess/soup/WebProcessPoolSoup.cpp:
1773
1774 2019-10-02  Zan Dobersek  <zdobersek@igalia.com>
1775
1776         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports
1777         https://bugs.webkit.org/show_bug.cgi?id=202397
1778
1779         Reviewed by Carlos Garcia Campos.
1780
1781         * Shared/WebEvent.h:
1782         Enable WebWheelEvent phasing for WPE, as required by the
1783         ASYNC_SCROLLING code.
1784
1785 2019-10-01  Tim Horton  <timothy_horton@apple.com>
1786
1787         Clean up some includes to make the build a bit faster
1788         https://bugs.webkit.org/show_bug.cgi?id=202444
1789
1790         Reviewed by Geoff Garen.
1791
1792         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
1793
1794 2019-10-01  Alex Christensen  <achristensen@webkit.org>
1795
1796         Progress towards a functioning CMake build on Mac
1797         https://bugs.webkit.org/show_bug.cgi?id=202443
1798
1799         Rubber-stamped by Tim Horton.
1800
1801         * CMakeLists.txt:
1802         * PlatformMac.cmake:
1803
1804 2019-10-01  John Wilander  <wilander@apple.com>
1805
1806         Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
1807         https://bugs.webkit.org/show_bug.cgi?id=202435
1808         <rdar://problem/55718526>
1809
1810         Reviewed by Brent Fulgham.
1811
1812         WebKit's Storage Access API implementation has so far only looked at whether ITP is
1813         blocking cookie access or not. However, the default cookie policy is still in
1814         effect underneath ITP. document.hasStorageAccess() should return true if the
1815         third-party:
1816         a) is not classified by ITP, and
1817         b) has cookies which implies it can use cookies as third-party according to the
1818         default cookie policy.
1819
1820         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1821         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
1822         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1823         (WebKit::WebResourceLoadStatisticsStore::hasCookies):
1824         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1825         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1826         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
1827         * NetworkProcess/NetworkProcess.cpp:
1828         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
1829
1830 2019-10-01  Antti Koivisto  <antti@apple.com>
1831
1832         [CSS Shadow Parts] Parse 'part' attribute
1833         https://bugs.webkit.org/show_bug.cgi?id=202409
1834
1835         Reviewed by Ryosuke Niwa.
1836
1837         * Shared/WebPreferences.yaml:
1838
1839         Add experimental feature, default to disabled for now.
1840
1841 2019-10-01  Alex Christensen  <achristensen@webkit.org>
1842
1843         Progress towards successful CMake build on Mac
1844         https://bugs.webkit.org/show_bug.cgi?id=202426
1845
1846         Rubber-stamped by Tim Horton.
1847
1848         * Platform/cocoa/PaymentAuthorizationPresenter.h:
1849         * Platform/cocoa/PaymentAuthorizationPresenter.mm:
1850         * Platform/cocoa/PaymentAuthorizationViewController.h:
1851         * Platform/cocoa/PaymentAuthorizationViewController.mm:
1852         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
1853         * PlatformMac.cmake:
1854         * Shared/SandboxExtension.h:
1855         (WebKit::SandboxExtension::createHandleForReadByPid):
1856         * SourcesCocoa.txt:
1857         * UIProcess/API/Cocoa/WKWebView.mm:
1858         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1859         (-[WKWebsiteDataStore _hasRegisteredServiceWorker]):
1860         * UIProcess/API/mac/WKView.mm:
1861         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
1862         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
1863         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
1864         * UIProcess/Cocoa/WKShareSheet.mm:
1865         (-[WKShareSheet delegate]):
1866         (-[WKShareSheet setDelegate:]):
1867         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1868         * UIProcess/Cocoa/WebViewImpl.h:
1869         * WebKit.xcodeproj/project.pbxproj:
1870         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
1871         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h:
1872         * WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp:
1873
1874 2019-10-01  Tim Horton  <timothy_horton@apple.com>
1875
1876         Clean up some includes to make the build a bit faster
1877         https://bugs.webkit.org/show_bug.cgi?id=202417
1878
1879         Reviewed by Jer Noble.
1880
1881         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
1882         * WebProcess/Plugins/Plugin.h:
1883         Fix the build.
1884
1885 2019-10-01  Alex Christensen  <achristensen@webkit.org>
1886
1887         Fix GTK build after r250558
1888         https://bugs.webkit.org/show_bug.cgi?id=202390
1889
1890         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
1891         (webkit_dom_dom_window_confirm):
1892
1893 2019-10-01  Alex Christensen  <achristensen@webkit.org>
1894
1895         Fix an internal build.
1896
1897         Ignore some deprecation warnings.  We'll adopt new SPI soon.
1898
1899         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1900         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1901
1902 2019-10-01  youenn fablet  <youenn@apple.com>
1903
1904         Remove races condition when validating capture sandbox extension revocation
1905         https://bugs.webkit.org/show_bug.cgi?id=202133
1906         <rdar://problem/55660905>
1907
1908         Reviewed by Eric Carlson.
1909
1910         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1911         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
1912         Explicitly ask the page to stop capture.
1913         This will make sure capture is stopped when revoking sandbox extensions.
1914
1915 2019-09-30  Alex Christensen  <achristensen@webkit.org>
1916
1917         Resurrect Mac CMake build
1918         https://bugs.webkit.org/show_bug.cgi?id=202384
1919
1920         Rubber-stamped by Tim Horton.
1921
1922         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1923         * PlatformMac.cmake:
1924         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
1925         * UIProcess/API/Cocoa/WKWebView.mm:
1926         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1927         * WebKit2Prefix.h:
1928
1929 2019-09-30  Christopher Reid  <chris.reid@sony.com>
1930
1931         [WinCairo] Move Remote Inspector Server initialization out of WebView
1932         https://bugs.webkit.org/show_bug.cgi?id=202369
1933
1934         Reviewed by Ross Kirsling.
1935         
1936         Move Remote Inspector Server initialization to Windows WebProcessPool initialization.
1937
1938         * UIProcess/win/WebProcessPoolWin.cpp:
1939         * UIProcess/win/WebView.cpp:
1940
1941 2019-09-30  Alex Christensen  <achristensen@webkit.org>
1942
1943         Move DownloadMonitor test speed multiplier from WebProcessPool to WebsiteDataStoreConfiguration
1944         https://bugs.webkit.org/show_bug.cgi?id=202339
1945
1946         Reviewed by Youenn Fablet.
1947
1948         This was only used for some unit tests, which still are accelerated so they pass in the same amount of time as before.
1949         I need this value to not be process-global in the NetworkProcess.
1950
1951         * NetworkProcess/Downloads/Download.cpp:
1952         (WebKit::Download::Download):
1953         * NetworkProcess/Downloads/Download.h:
1954         (WebKit::Download::Download):
1955         (WebKit::Download::testSpeedMultiplier const):
1956         * NetworkProcess/Downloads/DownloadManager.cpp:
1957         (WebKit::DownloadManager::resumeDownload):
1958         * NetworkProcess/Downloads/DownloadManager.h:
1959         * NetworkProcess/Downloads/DownloadMonitor.cpp:
1960         (WebKit::DownloadMonitor::applicationDidEnterBackground):
1961         (WebKit::DownloadMonitor::testSpeedMultiplier const):
1962         (WebKit::DownloadMonitor::timerFired):
1963         (WebKit::DownloadMonitor::speedMultiplier const): Deleted.
1964         * NetworkProcess/Downloads/DownloadMonitor.h:
1965         * NetworkProcess/NetworkDataTaskBlob.cpp:
1966         (WebKit::NetworkDataTaskBlob::download):
1967         * NetworkProcess/NetworkProcess.cpp:
1968         (WebKit::NetworkProcess::initializeNetworkProcess):
1969         * NetworkProcess/NetworkProcess.h:
1970         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1971         (WebKit::NetworkProcessCreationParameters::encode const):
1972         (WebKit::NetworkProcessCreationParameters::decode):
1973         * NetworkProcess/NetworkProcessCreationParameters.h:
1974         * NetworkProcess/NetworkSession.cpp:
1975         (WebKit::NetworkSession::NetworkSession):
1976         * NetworkProcess/NetworkSession.h:
1977         (WebKit::NetworkSession::testSpeedMultiplier const):
1978         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1979         (WebKit::NetworkSessionCreationParameters::encode const):
1980         (WebKit::NetworkSessionCreationParameters::decode):
1981         * NetworkProcess/NetworkSessionCreationParameters.h:
1982         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1983         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1984         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1985         (API::ProcessPoolConfiguration::copy):
1986         * UIProcess/API/APIProcessPoolConfiguration.h:
1987         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1988         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1989         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplierForTesting]): Deleted.
1990         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplierForTesting:]): Deleted.
1991         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1992         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1993         (-[_WKWebsiteDataStoreConfiguration testSpeedMultiplier]):
1994         (-[_WKWebsiteDataStoreConfiguration setTestSpeedMultiplier:]):
1995         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1996         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1997         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1998         (WebKit::WebsiteDataStore::parameters):
1999         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2000         (WebKit::WebsiteDataStoreConfiguration::copy):
2001         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2002         (WebKit::WebsiteDataStoreConfiguration::testSpeedMultiplier const):
2003         (WebKit::WebsiteDataStoreConfiguration::setTestSpeedMultiplier):
2004
2005 2019-09-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2006
2007         [GTK] IconDatabase is not thread-safe
2008         https://bugs.webkit.org/show_bug.cgi?id=201303
2009
2010         Reviewed by Žan Doberšek.
2011
2012         Rewrite the IconDatabase implementation. Now that we are the only users of this code, we can simply it a lot and
2013         design it specifically for our API, which implementation has been simplified a lot too. There's no change in
2014         the database schema nor in behavior from the API point of view.
2015
2016         * UIProcess/API/glib/IconDatabase.cpp:
2017         (WebKit::IconDatabase::IconDatabase):
2018         (WebKit::IconDatabase::~IconDatabase):
2019         (WebKit::IconDatabase::createTablesIfNeeded):
2020         (WebKit::IconDatabase::populatePageURLToIconURLMap):
2021         (WebKit::IconDatabase::clearStatements):
2022         (WebKit::IconDatabase::pruneTimerFired):
2023         (WebKit::IconDatabase::startPruneTimer):
2024         (WebKit::IconDatabase::clearLoadedIconsTimerFired):
2025         (WebKit::IconDatabase::startClearLoadedIconsTimer):
2026         (WebKit::IconDatabase::iconIDForIconURL):
2027         (WebKit::IconDatabase::setIconIDForPageURL):
2028         (WebKit::IconDatabase::iconData):
2029         (WebKit::IconDatabase::addIcon):
2030         (WebKit::IconDatabase::updateIconTimestamp):
2031         (WebKit::IconDatabase::deleteIcon):
2032         (WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
2033         (WebKit::IconDatabase::loadIconForPageURL):
2034         (WebKit::IconDatabase::iconURLForPageURL):
2035         (WebKit::IconDatabase::setIconForPageURL):
2036         (WebKit::IconDatabase::clear):
2037         * UIProcess/API/glib/IconDatabase.h:
2038         (WebKit::IconDatabase::create):
2039         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2040         (webkitFaviconDatabaseCreate):
2041         (webkitFaviconDatabaseIsOpen):
2042         (webkitFaviconDatabaseOpen):
2043         (webkitFaviconDatabaseClose):
2044         (webkitFaviconDatabaseGetLoadDecisionForIcon):
2045         (webkitFaviconDatabaseSetIconForPageURL):
2046         (webkitFaviconDatabaseGetFaviconInternal):
2047         (webkit_favicon_database_get_favicon):
2048         (webkit_favicon_database_get_favicon_finish):
2049         (webkit_favicon_database_get_favicon_uri):
2050         (webkit_favicon_database_clear):
2051         * UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
2052         * UIProcess/API/glib/WebKitWebContext.cpp:
2053         (webkitWebContextDispose):
2054         (webkit_web_context_set_favicon_database_directory):
2055         (webkitWebContextCreatePageForWebView):
2056         (webkitWebContextWebViewDestroyed):
2057         * UIProcess/API/glib/WebKitWebView.cpp:
2058         (webkitWebViewRequestFavicon):
2059         (webkitWebViewGetLoadDecisionForIcon):
2060         (webkitWebViewSetIcon):
2061
2062 2019-09-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2063
2064         [GTK][WPE] Add about:gpu
2065         https://bugs.webkit.org/show_bug.cgi?id=202305
2066
2067         Reviewed by Žan Doberšek.
2068
2069         A builtin protocol handler to show information about hardware acceleration. This is useful information we need
2070         from people reporting issues in accelerated compositing mode.
2071
2072         * SourcesGTK.txt:
2073         * SourcesWPE.txt:
2074         * UIProcess/API/glib/WebKitProtocolHandler.cpp: Added.
2075         (WebKit::WebKitProtocolHandler::WebKitProtocolHandler):
2076         (WebKit::WebKitProtocolHandler::handleRequest):
2077         (WebKit::webkitPortName):
2078         (WebKit::hardwareAccelerationPolicy):
2079         (WebKit::webGLEnabled):
2080         (WebKit::openGLAPI):
2081         (WebKit::nativeInterface):
2082         (WebKit::WebKitProtocolHandler::handleGPU):
2083         * UIProcess/API/glib/WebKitProtocolHandler.h: Added.
2084         * UIProcess/API/glib/WebKitWebContext.cpp:
2085         (webkitWebContextConstructed):
2086
2087 2019-09-30  Commit Queue  <commit-queue@webkit.org>
2088
2089         Unreviewed, rolling out r250291.
2090         https://bugs.webkit.org/show_bug.cgi?id=202359
2091
2092         it is failing
2093         TestWebKitAPI.ProcessSwap.GetUserMediaCaptureState (Requested
2094         by youenn on #webkit).
2095
2096         Reverted changeset:
2097
2098         "Delay capture sandbox extension revocation to after the page
2099         close message is sent"
2100         https://bugs.webkit.org/show_bug.cgi?id=202133
2101         https://trac.webkit.org/changeset/250291
2102
2103 2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
2104
2105         ScrollingTreeScrollingNode: use LayerRepresentation for scroll container, scrolled contents layers
2106         https://bugs.webkit.org/show_bug.cgi?id=202256
2107         <rdar://problem/55772092>
2108
2109         Reviewed by Simon Fraser.
2110
2111         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2112         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
2113         Use static casts to retrieve the CALayer pointers from the
2114         LayerRepresentation objects due to the explicit operators.
2115
2116 2019-09-29  Zan Dobersek  <zdobersek@igalia.com>
2117
2118         Tighten up LayerRepresentation operators
2119         https://bugs.webkit.org/show_bug.cgi?id=202344
2120
2121         Reviewed by Simon Fraser.
2122
2123         With LayerRepresentation operators now being explicit, we require
2124         to manually specify conversion to CALayer pointers or
2125         GraphicsLayer::PlatformLayerID values.
2126
2127         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2128         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2129         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2130         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2131         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2132         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
2133         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2134         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren):
2135         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
2136         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
2137         * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp:
2138         (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::commitStateBeforeChildren):
2139
2140 2019-09-27  Adrian Perez de Castro  <aperez@igalia.com>
2141
2142         [GTK][WPE] Fixes for non-unified builds after r249714
2143         https://bugs.webkit.org/show_bug.cgi?id=202304
2144
2145         Reviewed by Youenn Fablet.
2146
2147         * NetworkProcess/NetworkLoadChecker.h: Add missing inclusion of the pal/SessionID.h header.
2148         * NetworkProcess/NetworkResourceLoadMap.cpp: Add missing inclusion of the
2149         NetworkResourceLoader.h header.
2150         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
2151         (WKWebsiteDataStoreConfigurationCreate): Add missing namespace to usage of the
2152         WebKit::IsPersistent::Yes value.
2153         * UIProcess/WebPageProxy.cpp: Add missing inclusion of the LegacyGlobalSettings.h header.
2154
2155 2019-09-27  Tim Horton  <timothy_horton@apple.com>
2156
2157         Adopt new UIWebGeolocationPolicyDecider SPI to pass a view instead of a window
2158         https://bugs.webkit.org/show_bug.cgi?id=202329
2159         <rdar://problem/25963823>
2160
2161         Reviewed by Wenson Hsieh.
2162
2163         * Platform/spi/ios/UIKitSPI.h:
2164         * UIProcess/ios/WKGeolocationProviderIOS.mm:
2165         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
2166         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
2167         (WebKit::decidePolicyForGeolocationRequestFromOrigin):
2168         Switch to newer SPI that takes a UIView instead of a UIWindow, so that
2169         UIWebGeolocationPolicyDecider can find the correct presenting view controller.
2170
2171 2019-09-27  Zalan Bujtas  <zalan@apple.com>
2172
2173         [iPadOS] Can’t use RalphLauren.com on iPad because hover menus don’t stay up
2174         https://bugs.webkit.org/show_bug.cgi?id=202331
2175         <rdar://problem/55629493>
2176
2177         Reviewed by Tim Horton.
2178
2179         * WebProcess/WebPage/ios/WebPageIOS.mm:
2180         (WebKit::WebPage::handleSyntheticClick):
2181         (WebKit::nodeTriggersFastPath): Deleted.
2182
2183 2019-09-27  Alex Christensen  <achristensen@webkit.org>
2184
2185         Move shouldUseTestingNetworkSession from NetworkProcessCreationParameters to NetworkSessionCreationParameters
2186         https://bugs.webkit.org/show_bug.cgi?id=202327
2187
2188         Reviewed by Tim Horton.
2189
2190         * NetworkProcess/NetworkProcess.cpp:
2191         (WebKit::NetworkProcess::initializeNetworkProcess):
2192         (WebKit::NetworkProcess::ensureSession):
2193         * NetworkProcess/NetworkProcess.h:
2194         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2195         (WebKit::NetworkProcessCreationParameters::encode const):
2196         (WebKit::NetworkProcessCreationParameters::decode):
2197         * NetworkProcess/NetworkProcessCreationParameters.h:
2198         * NetworkProcess/NetworkSession.cpp:
2199         (WebKit::NetworkSession::NetworkSession):
2200         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2201         (WebKit::NetworkSessionCreationParameters::encode const):
2202         (WebKit::NetworkSessionCreationParameters::decode):
2203         * NetworkProcess/NetworkSessionCreationParameters.h:
2204         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2205         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2206         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
2207         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2208         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2209         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2210         * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp:
2211         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2212         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
2213         (WKWebsiteDataStoreConfigurationSetPerOriginStorageQuota):
2214         (WKWebsiteDataStoreConfigurationSetNetworkCacheSpeculativeValidationEnabled):
2215         (WKWebsiteDataStoreConfigurationGetTestingSessionEnabled):
2216         (WKWebsiteDataStoreConfigurationSetTestingSessionEnabled):
2217         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h:
2218         * UIProcess/WebProcessPool.cpp:
2219         (WebKit::WebProcessPool::ensureNetworkProcess):
2220         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2221         (WebKit::WebsiteDataStore::parameters):
2222         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2223         (WebKit::WebsiteDataStoreConfiguration::copy):
2224         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2225         (WebKit::WebsiteDataStoreConfiguration::testingSessionEnabled const):
2226         (WebKit::WebsiteDataStoreConfiguration::setTestingSessionEnabled):
2227
2228 2019-09-27  Alex Christensen  <achristensen@webkit.org>
2229
2230         Move legacy custom protocol registration from process pool to NetworkProcessProxy
2231         https://bugs.webkit.org/show_bug.cgi?id=202315
2232
2233         Reviewed by Tim Horton.
2234
2235         Legacy custom protocol registration is a global thing, which is why it's legacy and we're trying to get rid of it.
2236         In the meantime, we don't want it to be in the set of things the NetworkProcess depends on the WebProcessPool for, which should be an empty set.
2237
2238         * UIProcess/WebProcessPool.cpp:
2239         (WebKit::WebProcessPool::ensureNetworkProcess):
2240         (WebKit::WebProcessPool::registerGlobalURLSchemeAsHavingCustomProtocolHandlers):
2241         (WebKit::WebProcessPool::unregisterGlobalURLSchemeAsHavingCustomProtocolHandlers):
2242         (WebKit::WebProcessPool::registerSchemeForCustomProtocol): Deleted.
2243         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol): Deleted.
2244         * UIProcess/WebProcessPool.h:
2245
2246 2019-09-27  Alex Christensen  <achristensen@webkit.org>
2247
2248         Layout Test http/tests/cache-storage/cache-records-persistency.https.html is failing
2249         https://bugs.webkit.org/show_bug.cgi?id=202323
2250
2251         Reviewed by Tim Horton.
2252
2253         This reverts most of r250351.
2254         It turns out NetworkProcessProxy::addSession has some side effects in the UIProcess that are useful for NetworkProcess resumption after crashes.  Let's keep that.
2255
2256         * NetworkProcess/NetworkProcess.cpp:
2257         (WebKit::NetworkProcess::initializeNetworkProcess):
2258         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2259         (WebKit::NetworkProcessCreationParameters::encode const):
2260         (WebKit::NetworkProcessCreationParameters::decode):
2261         * NetworkProcess/NetworkProcessCreationParameters.h:
2262         * UIProcess/WebProcessPool.cpp:
2263         (WebKit::WebProcessPool::ensureNetworkProcess):
2264
2265 2019-09-27  Jer Noble  <jer.noble@apple.com>
2266
2267         Unreviewed build-fix: wrap the AssertionServicesSPI.h in an IOS_FAMILY check.
2268
2269         * WebProcess/cocoa/WebProcessCocoa.mm:
2270
2271 2019-09-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
2272
2273         [iOS]: When inserting a photo and then inserting auto-corrected text, the photo is removed
2274         https://bugs.webkit.org/show_bug.cgi?id=202294
2275
2276         Reviewed by Wenson Hsieh.
2277
2278         WebPage::applyAutocorrectionInternal() calls wordRangeFromPosition() to
2279         calculate the range of the word to be replaced with the auto-corrected
2280         word. But if the text of the range does not match the original text,
2281         applyAutocorrectionInternal() tries to correct the range by moving it
2282         forward such that the length of the text range matches the length of the
2283         original text.
2284
2285         Another case, which should correct the range also, is: the range does not
2286         have a text but it is not collapsed. In this case, we should set the range
2287         back to the selection range so non-text nodes is removed.
2288
2289         * WebProcess/WebPage/ios/WebPageIOS.mm:
2290         (WebKit::WebPage::applyAutocorrectionInternal):
2291
2292 2019-09-27  John Wilander  <wilander@apple.com>
2293
2294         Storage Access API: document.hasStorageAccess() should return false by default
2295         https://bugs.webkit.org/show_bug.cgi?id=202281
2296         <rdar://problem/55718526>
2297
2298         Reviewed by Alex Christensen.
2299
2300         document.hasStorageAccess() should return false by default so that it only
2301         returns true if the context has asked for and been granted storage access.
2302
2303         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2304         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
2305         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2306         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
2307
2308 2019-09-27  Jer Noble  <jer.noble@apple.com>
2309
2310         [iOS] Lock screen controls can fail to play web content
2311         https://bugs.webkit.org/show_bug.cgi?id=202279
2312
2313         Reviewed by Chris Dumez.
2314
2315         When playback is paused from the lock screen via Now Playing controls, the WebProcess,
2316         UIProcess, and Network Process will all be suspended. MediaRemote will take an assertion
2317         and wake up the WebProcess when a remote control command to "play" is sent via the Now
2318         Playing controls. However, if a synchronous message to the (suspended) Network or UIProcess
2319         is issued before the notification that the process was unexpectedly unsuspended can be
2320         issued (which will subsequently unsuspend the UIProcess and Network process), we can get
2321         into a deadlocked state where the main thread is blocked on the sync message to a suspended
2322         process.
2323
2324         To work around this problem, move all the processing from ProcessTaskStateObserver to a
2325         WorkQueue / background thread. This requires making the ProcessTaskStateObserver thread-safe,
2326         though its only current client is a Singleton (the WebProcess class), and so the risk of
2327         thread safety issues is currently minimal. Regardless, access to the Client pointer must be
2328         guarded by a Lock, and the Client itself must become ref-counted, so that the
2329         ProcessTaskStateObserver can ref its Client (the WebProcess) during callback processing.
2330
2331         Unfortunately, sendWithAsyncReply() is not thread safe, nor is ProcessAssertion, so instead
2332         just use send() and set a 5-second timeout before expiring the assertion, and just use
2333         BKSProcessStateAssertion directly.
2334
2335         * Shared/Cocoa/ProcessTaskStateObserver.h:
2336         (WebKit::ProcessTaskStateObserver::Client::ref):
2337         (WebKit::ProcessTaskStateObserver::Client::deref):
2338         (WebKit::ProcessTaskStateObserver::setClient): Deleted.
2339         (WebKit::ProcessTaskStateObserver::client): Deleted.
2340         * Shared/Cocoa/ProcessTaskStateObserver.mm:
2341         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
2342         (WebKit::ProcessTaskStateObserver::create):
2343         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
2344         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
2345         (WebKit::ProcessTaskStateObserver::invalidate):
2346         (WebKit::ProcessTaskStateObserver::client):
2347         (WebKit::ProcessTaskStateObserver::setTaskState):
2348         * WebProcess/WebProcess.cpp:
2349         (WebKit::m_taskStateObserver):
2350         * WebProcess/WebProcess.h:
2351         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2352         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
2353         * UIProcess/WebProcessProxy.h:
2354         * UIProcess/WebProcessProxy.messages.in:
2355         * WebProcess/cocoa/WebProcessCocoa.mm:
2356         (WebKit::WebProcess::processTaskStateDidChange):
2357
2358 2019-09-27  Alex Christensen  <achristensen@webkit.org>
2359
2360         Move service worker process termination delay disabling from process pool to website data store
2361         https://bugs.webkit.org/show_bug.cgi?id=202308
2362
2363         Reviewed by Chris Dumez.
2364
2365         It's only there for a test, which still works quickly.
2366
2367         * NetworkProcess/NetworkProcess.cpp:
2368         (WebKit::NetworkProcess::initializeNetworkProcess):
2369         (WebKit::NetworkProcess::addWebsiteDataStore):
2370         (WebKit::NetworkProcess::destroySession):
2371         (WebKit::NetworkProcess::fetchWebsiteData):
2372         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2373         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
2374         (WebKit::NetworkProcess::swServerForSession):
2375         (WebKit::NetworkProcess::addServiceWorkerSession):
2376         (WebKit::NetworkProcess::disableServiceWorkerProcessTerminationDelay): Deleted.
2377         * NetworkProcess/NetworkProcess.h:
2378         * NetworkProcess/NetworkProcess.messages.in:
2379         * Shared/WebsiteDataStoreParameters.cpp:
2380         (WebKit::WebsiteDataStoreParameters::encode const):
2381         (WebKit::WebsiteDataStoreParameters::decode):
2382         * Shared/WebsiteDataStoreParameters.h:
2383         * UIProcess/API/Cocoa/WKProcessPool.mm:
2384         (-[WKProcessPool _disableServiceWorkerProcessTerminationDelay]): Deleted.
2385         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2386         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2387         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2388         (-[_WKWebsiteDataStoreConfiguration serviceWorkerProcessTerminationDelayEnabled]):
2389         (-[_WKWebsiteDataStoreConfiguration setServiceWorkerProcessTerminationDelayEnabled:]):
2390         * UIProcess/WebProcessPool.cpp:
2391         (WebKit::WebProcessPool::ensureNetworkProcess):
2392         (WebKit::WebProcessPool::disableServiceWorkerProcessTerminationDelay): Deleted.
2393         * UIProcess/WebProcessPool.h:
2394         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2395         (WebKit::WebsiteDataStore::parameters):
2396         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2397         (WebKit::WebsiteDataStoreConfiguration::copy):
2398         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2399         (WebKit::WebsiteDataStoreConfiguration::serviceWorkerProcessTerminationDelayEnabled const):
2400         (WebKit::WebsiteDataStoreConfiguration::setServiceWorkerProcessTerminationDelayEnabled):
2401
2402 2019-09-27  Alex Christensen  <achristensen@webkit.org>
2403
2404         Enable and disable ResourceLoadStatistics only by session
2405         https://bugs.webkit.org/show_bug.cgi?id=202298
2406
2407         Reviewed by Chris Dumez.
2408
2409         This is needed to keep per-session things per-session and per-process-pool things per-process-pool.
2410         This was a strange case where we would take the current session's value and apply it globally.
2411         This has no change in behavior because it is globally enabled and disabled by API clients anyways.
2412
2413         * NetworkProcess/NetworkProcess.cpp:
2414         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
2415         * NetworkProcess/NetworkProcess.h:
2416         * NetworkProcess/NetworkProcess.messages.in:
2417         * UIProcess/API/Cocoa/WKWebView.mm:
2418         (-[WKWebView _initializeWithConfiguration:]):
2419         * UIProcess/WebProcessPool.cpp:
2420         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled): Deleted.
2421         * UIProcess/WebProcessPool.h:
2422         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2423         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2424
2425 2019-09-27  Alex Christensen  <achristensen@webkit.org>
2426
2427         Remove unused WebProcessPool::setCanHandleHTTPSServerTrustEvaluation
2428         https://bugs.webkit.org/show_bug.cgi?id=202285
2429
2430         Reviewed by Youenn Fablet.
2431
2432         The SPI to set this was deprecated in r250377 with a replacement that was adopted in rdar://problem/55731135
2433         I removed a layout test using the old SPI and replaced it with a more precise API test verifying the behavior of the new SPI
2434         before and after the introduction of NSURLSession's _strictTrustEvaluate:queue:completionHandler:
2435
2436         * NetworkProcess/NetworkProcess.cpp:
2437         (WebKit::NetworkProcess::initializeNetworkProcess):
2438         (WebKit::NetworkProcess::setCanHandleHTTPSServerTrustEvaluation): Deleted.
2439         * NetworkProcess/NetworkProcess.h:
2440         (WebKit::NetworkProcess::canHandleHTTPSServerTrustEvaluation const): Deleted.
2441         * NetworkProcess/NetworkProcess.messages.in:
2442         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2443         (WebKit::NetworkProcessCreationParameters::encode const):
2444         (WebKit::NetworkProcessCreationParameters::decode):
2445         * NetworkProcess/NetworkProcessCreationParameters.h:
2446         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2447         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2448         (canNSURLSessionTrustEvaluate): Deleted.
2449         * UIProcess/API/C/WKContext.cpp:
2450         (WKContextSetCanHandleHTTPSServerTrustEvaluation):
2451         * UIProcess/API/Cocoa/WKProcessPool.mm:
2452         (-[WKProcessPool _setCanHandleHTTPSServerTrustEvaluation:]):
2453         * UIProcess/WebProcessPool.cpp:
2454         (WebKit::WebProcessPool::ensureNetworkProcess):
2455         (WebKit::WebProcessPool::setCanHandleHTTPSServerTrustEvaluation): Deleted.
2456         * UIProcess/WebProcessPool.h:
2457
2458 2019-09-27  Alex Christensen  <achristensen@webkit.org>
2459
2460         Remove unused APIProcessPoolConfiguration::diskCacheSpeculativeValidationEnabled
2461         https://bugs.webkit.org/show_bug.cgi?id=202290
2462
2463         Reviewed by Carlos Garcia Campos.
2464
2465         The SPI to set this was deprecated in r250377 with a replacement that was adopted in rdar://problem/55731135
2466
2467         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2468         (WebKit::NetworkProcessCreationParameters::encode const):
2469         (WebKit::NetworkProcessCreationParameters::decode):
2470         * NetworkProcess/NetworkProcessCreationParameters.h:
2471         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2472         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2473         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2474         (API::ProcessPoolConfiguration::copy):
2475         * UIProcess/API/APIProcessPoolConfiguration.h:
2476         * UIProcess/API/C/WKContext.cpp:
2477         (WKContextSetDiskCacheSpeculativeValidationEnabled):
2478         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
2479         (WKWebsiteDataStoreConfigurationGetNetworkCacheSpeculativeValidationEnabled):
2480         (WKWebsiteDataStoreConfigurationSetNetworkCacheSpeculativeValidationEnabled):
2481         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h:
2482         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2483         (-[_WKProcessPoolConfiguration diskCacheSpeculativeValidationEnabled]):
2484         (-[_WKProcessPoolConfiguration setDiskCacheSpeculativeValidationEnabled:]):
2485         * UIProcess/WebProcessPool.cpp:
2486         (WebKit::WebProcessPool::ensureNetworkProcess):
2487
2488 2019-09-27  Zan Dobersek  <zdobersek@igalia.com>
2489
2490         [CoordinatedGraphics] support bounds origin
2491         https://bugs.webkit.org/show_bug.cgi?id=198998
2492
2493         Reviewed by Carlos Garcia Campos.
2494
2495         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2496         (WebKit::CoordinatedGraphicsScene::updateSceneState):
2497         Apply bounds origin value to the TextureMapperLayer object.
2498
2499 2019-09-27  Youenn Fablet  <youenn@apple.com>
2500
2501         Make IsNSURLSessionWebSocketEnabled an experimental flag
2502         https://bugs.webkit.org/show_bug.cgi?id=202135
2503         <rdar://problem/55694721>
2504
2505         Reviewed by Geoff Garen.
2506
2507         Add C API to switch off this feature in WTR.
2508
2509         * Shared/WebPreferences.yaml:
2510         * UIProcess/API/C/WKPreferences.cpp:
2511         (WKPreferencesSetIsNSURLSessionWebSocketEnabled):
2512         (WKPreferencesGetIsNSURLSessionWebSocketEnabled):
2513         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2514
2515 2019-09-27  Jiewen Tan  <jiewen_tan@apple.com>
2516
2517         SubFrameSOAuthorizationSession should ensure messages are posted in the right order to the parent frame
2518         https://bugs.webkit.org/show_bug.cgi?id=202061
2519         <rdar://problem/55485666>
2520
2521         Reviewed by Youenn Fablet.
2522
2523         This patch ensures messages that signal the process of SOAuthorization interception are posted in
2524         the right order to the parent frame. Before this patch, there are chances that SOAuthorizationDidCancel
2525         could be posted to the parent before SOAuthorizationDidStart. There are few causes that lead to
2526         this race condition:
2527         1) SubFrameSOAuthorizationSession::beforeStart posts SOAuthorizationDidStart in the next runloop. So
2528         extension could have the chance to invoke SubFrameSOAuthorizationSession::fallBackToWebPathInternal
2529         before SOAuthorizationDidStart is posted.
2530         2) Even if the order is right in the UI process, it is not guaranteed that Web process will strictly
2531         follow the order as the loading process is async.
2532
2533         To fix the issue:
2534         1) SubFrameSOAuthorizationSession::beforeStart now posts SOAuthorizationDidStart in the same runloop.
2535         2) Observer is introduced in FrameLoadState such that SubFrameSOAuthorizationSession could know if
2536         the loading is finished. With this new capacity, SubFrameSOAuthorizationSession can ensure it only
2537         posts next message when the previous message has been posted.
2538
2539         Implementation wise, a deque to queue requests is provided to maintain order.
2540         1) When new request is added to the deque, SubFrameSOAuthorizationSession will only load the request
2541         if it is the only element in the deque. Otherwise, it does nothing.
2542         2) When SubFrameSOAuthorizationSession receives didFinishLoad, it pops the head of the queue and loads
2543         the next request in the queue if any.
2544         The above design should guarantee all requests are loaded in sequence.
2545
2546         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h:
2547         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
2548         (WebKit::SubFrameSOAuthorizationSession::SubFrameSOAuthorizationSession):
2549         (WebKit::SubFrameSOAuthorizationSession::~SubFrameSOAuthorizationSession):
2550         (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
2551         (WebKit::SubFrameSOAuthorizationSession::completeInternal):
2552         (WebKit::SubFrameSOAuthorizationSession::beforeStart):
2553         (WebKit::SubFrameSOAuthorizationSession::didFinishLoad):
2554         (WebKit::SubFrameSOAuthorizationSession::appendRequestToLoad):
2555         (WebKit::SubFrameSOAuthorizationSession::loadRequestToFrame):
2556         (WebKit::SubFrameSOAuthorizationSession::loadDataToFrame): Deleted.
2557         (WebKit::SubFrameSOAuthorizationSession::postDidCancelMessageToParent): Deleted.
2558         * UIProcess/FrameLoadState.cpp:
2559         (WebKit::FrameLoadState::addObserver):
2560         (WebKit::FrameLoadState::removeObserver):
2561         (WebKit::FrameLoadState::didFinishLoad):
2562         * UIProcess/FrameLoadState.h:
2563
2564 2019-09-26  Kate Cheney  <katherine_cheney@apple.com>
2565
2566         Resource Load Statistics: Downgrade all third-party referrer headers
2567         https://bugs.webkit.org/show_bug.cgi?id=201353
2568         <rdar://problem/54895650>
2569         
2570         Majority of this patch was written by John Wilander <wilander@apple.com>.
2571
2572         Reviewed by Brent Fulgham. 
2573
2574         When tracking protections are enabled, we should downgrade all third-party
2575         referrers to their origins. Note that this downgrade will be specific to
2576         Cocoa so other ports will have to adopt as they see fit.
2577
2578         Cocoa already does this downgrade in ephemeral sessions (shipping).
2579
2580         The majority of these changes are test infrastructure. The functional
2581         change is in WebKit::NetworkDataTaskCocoa and WebKit::NetworkSession.
2582
2583         * NetworkProcess/NetworkProcess.cpp:
2584         (WebKit::NetworkProcess::setShouldDowngradeReferrerForTesting):
2585         * NetworkProcess/NetworkProcess.h:
2586         * NetworkProcess/NetworkProcess.messages.in:
2587         * NetworkProcess/NetworkSession.cpp:
2588         (WebKit::NetworkSession::isResourceLoadStatisticsEnabled const):
2589         (WebKit::NetworkSession::setShouldDowngradeReferrerForTesting):
2590         (WebKit::NetworkSession::shouldDowngradeReferrer const):
2591         * NetworkProcess/NetworkSession.h:
2592         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2593         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2594         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest const):
2595         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2596         (WebKit::NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded):
2597         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2598         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest): Deleted.
2599         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2600         (WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting):
2601         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2602         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2603         * UIProcess/Network/NetworkProcessProxy.cpp:
2604         (WebKit::NetworkProcessProxy::setShouldDowngradeReferrerForTesting):
2605         * UIProcess/Network/NetworkProcessProxy.h:
2606         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2607         (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting):
2608         * UIProcess/WebsiteData/WebsiteDataStore.h:
2609
2610 2019-09-26  Eric Carlson  <eric.carlson@apple.com>
2611
2612         REGRESSION (iOS 13): Trying to record just audio using HTML Media Capture crashes Safari
2613         https://bugs.webkit.org/show_bug.cgi?id=202039
2614         <rdar://problem/55566628>
2615
2616         Reviewed by Jer Noble.
2617
2618         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2619         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]): UIImagePickerController doesn't 
2620         support audio-only recording, so show the video recorder for "audio/*".
2621
2622 2019-09-26  Tim Horton  <timothy_horton@apple.com>
2623
2624         Add some logging to help diagnose blank or stuck WKWebViews
2625         https://bugs.webkit.org/show_bug.cgi?id=202297
2626         <rdar://problem/55763610>
2627
2628         Reviewed by Wenson Hsieh.
2629
2630         Our current logging is insufficient to rule out some of the potential
2631         causes of stuck/blank WKWebViews in <rdar://problem/53399054>. Add
2632         some new logging, and improve some existing logging, to aid in diagnosis.
2633
2634         * UIProcess/API/Cocoa/WKWebView.mm:
2635         (-[WKWebView _willInvokeUIScrollViewDelegateCallback]):
2636         (-[WKWebView _didInvokeUIScrollViewDelegateCallback]):
2637         Rename _delayUpdateVisibleContentRects to be more specific that it
2638         was due to us being underneath a UIScrollView delegate callback.
2639
2640         (-[WKWebView _processWillSwapOrDidExit]):
2641         (-[WKWebView _didCommitLayerTree:]):
2642         Add a log when we receive an incoming commit while visible content rect
2643         updates are being deferred. Also, include the current transaction ID
2644         and the transaction ID that _needsResetViewState... is waiting for, to
2645         help rule out a class of potential problems.
2646
2647         Add a log when we receive an incoming commit more than 5 seconds after
2648         a visible content rect update.
2649
2650         (-[WKWebView _updateVisibleContentRects]):
2651         Keep track of when we defer visual content rect updates for any reason,
2652         and log the first time we do an update after deferring them. This will make
2653         it MUCH easier at-a-glance to tell if one of the "bailing" messages
2654         represents a long-term state (a problem), or is expected.
2655
2656         Keep track of how long it's been since we sent a visible content rect update
2657         and didn't get a commit back from the Web Content process; if it's been
2658         more than 5 seconds, start logging.
2659
2660         (-[WKWebView _cancelAnimatedResize]):
2661         (-[WKWebView _didCompleteAnimatedResize]):
2662         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2663         (-[WKWebView _endAnimatedResize]):
2664         (-[WKWebView _resizeWhileHidingContentWithUpdates:]):
2665         Turn animated resize logging into release logging. It is a common culprit
2666         for many kinds of bugs, while also not being high volume, so this is well worth it.
2667         
2668         * WebProcess/WebPage/WebPage.cpp:
2669         (WebKit::WebPage::freezeLayerTree):
2670         (WebKit::WebPage::unfreezeLayerTree):
2671         Show the current value of m_layerTreeFreezeReasons in addition to the old value and delta,
2672         so you don't have to manually compute the current value when reading logs.
2673
2674 2019-09-26  Dean Jackson  <dino@apple.com>
2675
2676         ContextMenu on a link in an email no longer shows web preview
2677         https://bugs.webkit.org/show_bug.cgi?id=201120
2678         <rdar://54353617>
2679
2680         Reviewed by Wenson Hsieh.
2681
2682         Only go down the image path if we are not also a link.
2683
2684         * UIProcess/ios/WKContentViewInteraction.mm:
2685         (-[WKContentView continueContextMenuInteraction:]):
2686
2687 2019-09-26  Chris Dumez  <cdumez@apple.com>
2688
2689         Stop using testRunner.overridePreference() to turn on Page Cache
2690         https://bugs.webkit.org/show_bug.cgi?id=202274
2691
2692         Reviewed by Alex Christensen.
2693
2694         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2695         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2696
2697 2019-09-26  Andy Estes  <aestes@apple.com>
2698
2699         Crash under WebPage::beginPrinting when m_printContext becomes null due to synchronous layout
2700         https://bugs.webkit.org/show_bug.cgi?id=202171
2701         <rdar://problem/49731211>
2702
2703         Reviewed by Tim Horton.
2704
2705         Speculatively fix a null pointer dereference crash in WebPage::beginPrinting.
2706
2707         WebPage::beginPrinting creates a PrintContext, stores it in m_printContext, then calls
2708         PrintContext::begin which forces a synchronous, paginated layout. If a post-layout task
2709         executes script, that might result in the WebPage being closed and m_printContext being set
2710         to nullptr.
2711
2712         Guard against this in WebPage::beginPrinting by adding a null check before calling
2713         PrintContext::computePageRects.
2714
2715         * WebProcess/WebPage/WebPage.cpp:
2716         (WebKit::WebPage::beginPrinting):
2717
2718 2019-09-26  Kate Cheney  <katherine_cheney@apple.com>
2719
2720         Enable LayoutTests using ResourceLoadStatistics SQLite backend (195420)
2721         https://bugs.webkit.org/show_bug.cgi?id=195420
2722         <rdar://problem/54213551>
2723
2724         Reviewed by Brent Fulgham.
2725
2726         Changed all RELEASE_LOG_ERROR() calls involving domain strings to
2727         RELEASE_LOG_ERROR_IF_ALLOWED() to prevent leaking information about
2728         the domain strings only if sessionID.isAlwaysOnLoggingAllowed().
2729
2730         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2731         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2732         Added autovacuuming to the constructor to avoid manually calling
2733         runVacuumCommand(). Changed constructor to take in sessionID so it
2734         can use RELEASE_LOG_ERROR_IF_ALLOWED which requires the sessionID.
2735
2736         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
2737         Added 2 statements that were not being prepared.
2738
2739         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
2740         Corrected incorrect capitalization. Added check for nullopt in case
2741         domainID is for a domain not in the database yet.
2742
2743         (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
2744         Changed return value to Optional<unsigned>. Some tests were directly
2745         checking for subframes under top frame domains on domains that had
2746         not been inserted yet. Now, domainID() won't crash but will return
2747         a nullopt value which can be checked to know that the tests failed.
2748
2749         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
2750         Added a check to assure domainID exists and updated the domainID
2751         interactions to work as Optionals.
2752
2753         (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
2754         Moved the prepareStatements() call after the vacuum command in the case
2755         where the database is empty. Otherwise called it before returning.
2756
2757         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
2758         Added a space to the SQL commands to correct the syntax.
2759
2760         (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
2761         Corrected a bug in the SQL command for querying
2762         subframeUnderTopFrameDomain. The old query was asking for subresource.
2763
2764         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
2765         Spelling fix.
2766
2767         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
2768         Changed string concatenation to binding.
2769
2770         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
2771         The grandfathering.html test was failing because domains were being
2772         "set" to grandfathered in the database before being inserted. This fix
2773         ensures all domains before setting the grandfathering flag.
2774
2775         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
2776         Multiple tests were failing because the query to insert the relationship
2777         for the source domain relies on the target domain being in the
2778         ObservedDomains table. This patch ensures all domains are added before
2779         performing the query.
2780
2781         (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction):
2782         Added a != SQLITE_OK check to make sure an error is logged if the
2783         statement fails to bind.
2784
2785         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
2786         Changed string concatenation to binding.
2787
2788         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):   
2789         The SQL statement was being bound to a value and not being reset. This
2790         patch resets the statement after binding. Additionally, the step()
2791         function was being compared to SQLITE_DONE instead of SQLITE_ROW,
2792         causing an error if the query returned results. The
2793         ASSERT_NOT_REACHED() was causing null searches to crash instead of
2794         returning false (i.e. if a domain is not in the database it should
2795         return that it has no user interaction instead of crashing).
2796
2797         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource): 
2798         Updated domainID call to act as an Optional. 
2799         
2800         (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const):
2801         The SQL statement was being bound to a value and not being reset. This
2802         patch resets the statement after binding. SQLITE_DONE changed to
2803         SQLITE_ROW to return non-empty query results. ASSERT_NOT_REACHED()
2804         removed for the same reasons as above. 
2805
2806         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain):
2807         Fixed the release log statement which was logging the wrong function 
2808         name.
2809
2810         (WebKit::ResourceLoadStatisticsDatabaseStore::clearDatabaseContents): 
2811         Clears the database and rebuilds the tables on a clear command to
2812         match the functionality in the Memory Store.
2813
2814         (WebKit::ResourceLoadStatisticsDatabaseStore::clear):                   
2815         Call the clearDatabaseContents function to match the functionality 
2816         in the Memory Store. 
2817
2818         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const):
2819         Updated domainID call to act as an Optional. 
2820
2821         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUnexpiredRecentUserInteraction):
2822         Tests were failing because shouldRemoveAllWebsiteDataFor() was not 
2823         checking for expired user interaction. Matched functionality in the
2824         Memory Store.
2825
2826         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor):
2827         Tests were failing because shouldRemoveAllWebsiteDataFor() was not 
2828         checking for expired user interaction. Matched functionality in the
2829         Memory Store. 
2830
2831         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
2832         Spelling fix. 
2833
2834         (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded): 
2835         Last seen should be sorted in ascending order because you want to 
2836         prune the older statistics first, which will have a lower lastSeen
2837         field (secondsSinceEpoch() will be lower for older values).
2838
2839         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const): Deleted.
2840         Deleted const specifier because the function needs to clear the
2841         database. 
2842
2843         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:      
2844         Declared new functions. Updated spelling error (registerable --> 
2845         registrable). Updated constructor to take sessionID. 
2846
2847         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 
2848         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2849         ITP database flag now is stored in the NetworkProcess.
2850         * NetworkProcess/NetworkProcess.cpp: 
2851
2852         (WebKit::NetworkProcess::initializeNetworkProcess): 
2853         Set the ITP database flag which is now stored in the Network Process. 
2854
2855         (WebKit::NetworkProcess::setUseITPDatabase): 
2856         * NetworkProcess/NetworkProcess.h:
2857         (WebKit::NetworkProcess::isITPDatabaseEnabled const):
2858         * NetworkProcess/NetworkProcess.messages.in:
2859         Passed the setUseITPDatabase flag to the initialization function 
2860         of the statistics store to enable the database backend.
2861
2862         * NetworkProcess/NetworkSession.cpp:
2863         (WebKit::NetworkSession::NetworkSession):
2864         SandboxExtension::consumePermanently was not getting called on the 
2865         WebKitTestRunner resourceLoadStatistics path. This was preventing
2866         the database file from opening. 
2867
2868         (WebKit::NetworkSession::recreateResourceLoadStatisticStore):
2869         Destroy old WebResourceLoadStatisticsStore and create a new one using
2870         the ITP database.
2871
2872         * NetworkProcess/NetworkSession.h:
2873         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2874         (WKWebsiteDataStoreSetUseITPDatabase):
2875         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2876         * UIProcess/Network/NetworkProcessProxy.cpp:
2877         (WebKit::NetworkProcessProxy::setUseITPDatabase):
2878         * UIProcess/Network/NetworkProcessProxy.h:
2879         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2880         (WebKit::WebsiteDataStore::setUseITPDatabase):
2881         * UIProcess/WebsiteData/WebsiteDataStore.h:
2882         Passed the setUseITPDatabase flag to the initialization function
2883         of the statistics store to enable the database backend. 
2884
2885 2019-09-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2886
2887         [iOS 13] Tapping on a non-editable text selection should toggle callout bar visibility instead of clearing selection
2888         https://bugs.webkit.org/show_bug.cgi?id=202254
2889         <rdar://problem/54410263>
2890
2891         Reviewed by Megan Gardner.
2892
2893         In iOS 13, tapping a text selection should toggle callout bar visibility (i.e. "selection commands" in UIKit).
2894         This currently does not work for non-editable text, since the synthetic click gesture simultaneously fires
2895         alongside the text interaction assistant's non-editable tap gesture, which dispatches a click to the page which
2896         then clears the selection.
2897
2898         To remedy this and match platform behavior, we avoid recognizing clicks that occur over the text selection, but
2899         only in the case where the bounding rect of the text selection doesn't cover a large portion of the visible
2900         content rect of the web view. This ensures that the user doesn't get stuck in a state where it's impossible to
2901         dismiss a very large text selection (e.g. after selecting all the content on the page).
2902
2903         Tests:  editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text.html
2904                 editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text.html
2905
2906         * UIProcess/ios/WKContentViewInteraction.mm:
2907         (-[WKContentView _shouldToggleSelectionCommandsAfterTapAt:]):
2908
2909         Check the last known selection rects (on _lastSelectionDrawingInfo) to see if the tapped point lies within at
2910         least one of the selection rects.
2911
2912         (-[WKContentView gestureRecognizerShouldBegin:]):
2913
2914 2019-09-26  Patrick Griffis  <pgriffis@igalia.com>
2915
2916         [GTK] Fix logic of dark theme detection
2917         https://bugs.webkit.org/show_bug.cgi?id=202276
2918
2919         - If GTK_THEME is set it has a higher priority to GtkSettings.
2920         - GTK_THEME may be a -dark theme or :dark variant, handle both.
2921
2922         Reviewed by Michael Catanzaro.
2923
2924         * UIProcess/API/gtk/PageClientImpl.cpp:
2925         (WebKit::PageClientImpl::effectiveAppearanceIsDark const):
2926
2927 2019-09-25  Alex Christensen  <achristensen@webkit.org>
2928
2929         Add replacement SPI on _WKWebsiteDataStoreConfiguration for enabling speculative cache validation and IPC-free server trust evaluation
2930         https://bugs.webkit.org/show_bug.cgi?id=202251
2931
2932         Reviewed by Tim Horton.
2933
2934         These are two performance optimizations that are currently per-ProcessPool that need to be per-WebsiteDataStore.
2935         This makes replacement SPI and deprecates the old SPI.  I'm going to adopt the new SPI then remove the old SPI.
2936
2937         * NetworkProcess/NetworkSession.cpp:
2938         (WebKit::NetworkSession::NetworkSession):
2939         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2940         (WebKit::NetworkSessionCreationParameters::encode const):
2941         (WebKit::NetworkSessionCreationParameters::decode):
2942         * NetworkProcess/NetworkSessionCreationParameters.h:
2943         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2944         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2945         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2946         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2947         * UIProcess/API/C/WKContextPrivate.h:
2948         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2949         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2950         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2951         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2952         (-[_WKWebsiteDataStoreConfiguration networkCacheSpeculativeValidationEnabled]):
2953         (-[_WKWebsiteDataStoreConfiguration setNetworkCacheSpeculativeValidationEnabled:]):
2954         (-[_WKWebsiteDataStoreConfiguration fastServerTrustEvaluationEnabled]):
2955         (-[_WKWebsiteDataStoreConfiguration setFastServerTrustEvaluationEnabled:]):
2956         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2957         (WebKit::WebsiteDataStore::parameters):
2958         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2959         (WebKit::WebsiteDataStoreConfiguration::copy):
2960         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2961         (WebKit::WebsiteDataStoreConfiguration::fastServerTrustEvaluationEnabled const):
2962         (WebKit::WebsiteDataStoreConfiguration::setFastServerTrustEvaluationEnabled):
2963         (WebKit::WebsiteDataStoreConfiguration::networkCacheSpeculativeValidationEnabled const):
2964         (WebKit::WebsiteDataStoreConfiguration::setNetworkCacheSpeculativeValidationEnabled):
2965
2966 2019-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2967
2968         Fix failing layout tests after trac.webkit.org/r250183
2969         https://bugs.webkit.org/show_bug.cgi?id=202053
2970         <rdar://problem/54542190>
2971
2972         Reviewed by Tim Horton.
2973
2974         Followup to r250183: move the implementation of -gestureRecognizer:shouldReceiveTouch: out of
2975         ENABLE(TOUCH_EVENTS) and into ENABLE(POINTER_EVENTS) instead. This logic is necessary in order for scrolling
2976         via pan gestures to work on iOS, in the case where ENABLE(POINTER_EVENTS) is on but ENABLE(TOUCH_EVENTS) is off.
2977         This is because the new swipe gesture recognizers added in r250183 will otherwise always take priority over the
2978         scroll view's pan gestures.
2979
2980         Fixes the following layout tests:
2981         - fast/scrolling/ios/reconcile-layer-position-recursive.html
2982         - fast/scrolling/ios/click-events-during-momentum-scroll-in-main-frame.html
2983         - fast/scrolling/ios/click-events-after-long-press-during-momentum-scroll-in-main-frame.html
2984
2985         * UIProcess/ios/WKContentViewInteraction.mm:
2986
2987 2019-09-25  Megan Gardner  <megan_gardner@apple.com>
2988
2989         Update selections after scrolling for iframes and hide selections while iframes and overflow scrolls are scrolling.
2990         https://bugs.webkit.org/show_bug.cgi?id=202125
2991
2992         Reviewed by Tim Horton.
2993
2994         Add additional calls into UIKit differentiate between main frame scrolling and overflow/iframe scrolling.
2995         Add piping for iframe specific scrolling.
2996
2997         * Platform/spi/ios/UIKitSPI.h:
2998         * UIProcess/ios/WKContentViewInteraction.mm:
2999         (-[WKContentView _willStartScrollingOrZooming]):
3000         (-[WKContentView _didEndScrollingOrZooming]):
3001         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3002         (WebKit::WebEditorClient::subFrameScrollPositionChanged):
3003         * WebProcess/WebCoreSupport/WebEditorClient.h:
3004         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
3005         (WebKit::WebEditorClient::subFrameScrollPositionChanged):
3006
3007 2019-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3008
3009         Page temporarily jumps to an excessively small viewport scale while loading usatoday.com
3010         https://bugs.webkit.org/show_bug.cgi?id=202224
3011         <rdar://problem/52906640>
3012
3013         Reviewed by Tim Horton.
3014
3015         Tweaks the content-aware shrink-to-fit algorithm to bail in the case where the content width is extremely large,
3016         such that it bails instead of attempting to fit the entire content of the page. See WebCore ChangeLog for more
3017         details.
3018
3019         * WebProcess/WebPage/ios/WebPageIOS.mm:
3020         (WebKit::WebPage::immediatelyShrinkToFitContent):
3021
3022 2019-09-25  Alex Christensen  <achristensen@webkit.org>
3023
3024         Don't fall back to default session if session can't be found for cookie operations
3025         https://bugs.webkit.org/show_bug.cgi?id=202222
3026
3027         Reviewed by Geoff Garen.
3028
3029         Apparently, during teardown of private browsing sessions, there is sometimes a race condition and cookies from a torn-down session are requested.
3030         In this case, just fail like we do all other operations in this file.  Otherwise, it's a breach of privacy.
3031
3032         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3033         (WebKit::NetworkConnectionToWebProcess::storageSession):
3034         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3035         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3036         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
3037         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
3038         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
3039         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
3040         * NetworkProcess/NetworkConnectionToWebProcess.h:
3041
3042 2019-09-25  Alex Christensen  <achristensen@webkit.org>
3043
3044         Remove duplicate WebsiteDataStoreConfiguration copying code
3045         https://bugs.webkit.org/show_bug.cgi?id=202215
3046
3047         Reviewed by Tim Horton.
3048
3049         WKWebsiteDataStore's _initWithConfiguration was duplicating the functionality of WebsiteDataStoreConfiguration::copy.
3050         The former should just call the latter.
3051         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.
3052
3053         * UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
3054         (WKWebsiteDataStoreConfigurationCreate):
3055         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3056         (-[WKWebsiteDataStore _initWithConfiguration:]):
3057         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3058         (-[_WKWebsiteDataStoreConfiguration init]):
3059         (-[_WKWebsiteDataStoreConfiguration initNonPersistentConfiguration]):
3060         * UIProcess/WebProcessPool.cpp:
3061         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
3062         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3063         (WebKit::WebsiteDataStore::createNonPersistent):
3064         (WebKit::WebsiteDataStore::defaultDataStore):
3065         (WebKit::WebsiteDataStore::defaultDataStoreConfiguration): Deleted.
3066         * UIProcess/WebsiteData/WebsiteDataStore.h:
3067         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3068         (WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
3069         (WebKit::WebsiteDataStoreConfiguration::copy):
3070         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3071         (WebKit::WebsiteDataStoreConfiguration::create):
3072         (WebKit::WebsiteDataStoreConfiguration::isPersistent const):
3073         (WebKit::WebsiteDataStoreConfiguration::setPersistent): Deleted.
3074
3075 2019-09-25  Alex Christensen  <achristensen@webkit.org>
3076
3077         Replace WebsiteDataStoreParameters::privateSessionParameters with re-initializing all sessions immediately upon NetworkProcess resumption
3078         https://bugs.webkit.org/show_bug.cgi?id=202211
3079
3080         Reviewed by Tim Horton.
3081
3082         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.
3083         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.
3084         I move the addition of non-default sessions to the initialization message instead of messages after the initialization message to remove race conditions that
3085         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
3086         resumption also works with non-default persistent WebsiteDataStores.
3087
3088         * NetworkProcess/NetworkProcess.cpp:
3089         (WebKit::NetworkProcess::initializeNetworkProcess):
3090         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3091         (WebKit::NetworkProcessCreationParameters::encode const):
3092         (WebKit::NetworkProcessCreationParameters::decode):
3093         * NetworkProcess/NetworkProcessCreationParameters.h:
3094         * NetworkProcess/NetworkResourceLoader.cpp:
3095         (WebKit::NetworkResourceLoader::startNetworkLoad):
3096         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3097         (WebKit::NetworkSessionCreationParameters::privateSessionParameters): Deleted.
3098         * NetworkProcess/NetworkSessionCreationParameters.h:
3099         * Shared/WebsiteDataStoreParameters.cpp:
3100         (WebKit::WebsiteDataStoreParameters::privateSessionParameters): Deleted.
3101         * Shared/WebsiteDataStoreParameters.h:
3102         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters): Deleted.
3103         * UIProcess/WebProcessPool.cpp:
3104         (WebKit::WebProcessPool::ensureNetworkProcess):
3105
3106 2019-09-25  Alex Christensen  <achristensen@webkit.org>
3107
3108         Replace _WKProcessPoolConfiguration.CTDataConnectionServiceType with _WKWebsiteDataStoreConfiguration.dataConnectionServiceType
3109         https://bugs.webkit.org/show_bug.cgi?id=202174
3110
3111         Reviewed by Tim Horton.
3112
3113         _WKProcessPoolConfiguration.CTDataConnectionServiceType is used in one place and needs a replacement so we can
3114         start a NetworkProcess without a WKProcessPool.  Since this SPI only does something in the low-level networking code,
3115         I verified that the new SPI sets the String the way the old one does, and the old one keeps working in the interim.
3116
3117         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3118         (WebKit::NetworkSessionCreationParameters::encode const):
3119         (WebKit::NetworkSessionCreationParameters::decode):
3120         * NetworkProcess/NetworkSessionCreationParameters.h:
3121         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3122         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3123         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3124         (-[WKWebsiteDataStore _initWithConfiguration:]):
3125         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3126         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3127         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3128         (-[_WKWebsiteDataStoreConfiguration dataConnectionServiceType]):
3129         (-[_WKWebsiteDataStoreConfiguration setDataConnectionServiceType:]):
3130         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3131         (WebKit::WebsiteDataStore::parameters):
3132         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3133         (WebKit::WebsiteDataStoreConfiguration::copy):
3134         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3135         (WebKit::WebsiteDataStoreConfiguration::dataConnectionServiceType const):
3136         (WebKit::WebsiteDataStoreConfiguration::setDataConnectionServiceType):
3137
3138 2019-09-25  Commit Queue  <commit-queue@webkit.org>
3139
3140         Unreviewed, rolling out r250336.
3141         https://bugs.webkit.org/show_bug.cgi?id=202210
3142
3143         it is creating failures on iOS bots (Requested by youenn on
3144         #webkit).
3145
3146         Reverted changeset:
3147
3148         "Make IsNSURLSessionWebSocketEnabled an experimental flag"
3149         https://bugs.webkit.org/show_bug.cgi?id=202135
3150         https://trac.webkit.org/changeset/250336
3151
3152 2019-09-25  Youenn Fablet  <youenn@apple.com>
3153
3154         Creation of a service worker connection for a service worker job should be based on the job scope
3155         https://bugs.webkit.org/show_bug.cgi?id=202185
3156
3157         Reviewed by Alex Christensen.
3158
3159         * NetworkProcess/NetworkProcess.cpp:
3160         (WebKit::NetworkProcess::swServerForSession):
3161         Assert that registrable domain is not empty.
3162         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3163         (WebKit::WebSWServerConnection::scheduleJobInServer):
3164         Use the scope URL instead of the script URL which may be empty in case of an unregister job.
3165
3166 2019-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3167
3168         [iPadOS] [DataActivation] Focus moves away after focusing input fields on www.att.com
3169         https://bugs.webkit.org/show_bug.cgi?id=202167
3170         <rdar://problem/55185021>
3171
3172         Reviewed by Tim Horton.
3173
3174         When using the data activation page on www.att.com, one of the sections on the page contains several select
3175         elements; in the case where the user agent:
3176
3177         1. contains the string "iPad", and
3178         2. does not contain the string "Safari"
3179
3180         ...www.att.com's data activation page will opt into a mode where it adds blur event listeners to the select
3181         elements; in this blur event listener, www.att.com proceeds to programmatically focus a non-editable div element
3182         after a 1 second timeout. The reasons for this behavior remain unclear to me, though it's worth noting that the
3183         blur event handler name is "screenReaderFocus", which suggests that this is in place to ensure compatibility
3184         with screen readers.
3185
3186         In iOS 12, dismissing the popover would blur the focused select menu with an animation. Since the animation
3187         would take a slightly less than 1 second, www.att.com's logic would have the effect of moving focus to the div
3188         element shortly after dismissing the select menu. However, after r243808, we no longer attempt to blur the
3189         focused select element when dismissing the popover. This means that the select element is only blurred the next
3190         time the user activates another focused element, such as one of the input fields on the page, or a different
3191         select element. Consequently, the logic to move focus into a div element now occurs only after a different
3192         element has already been focused; this results in focus moving away from newly focused elements after 1 second
3193         in the case where a select element has previously focused.
3194
3195         To mitigate this, restore iOS 12 behavior behind a site- and app-specific quirk. See comments below for more
3196         details.
3197
3198         * Shared/FocusedElementInformation.cpp:
3199         (WebKit::FocusedElementInformation::encode const):
3200         (WebKit::FocusedElementInformation::decode):
3201         * Shared/FocusedElementInformation.h:
3202
3203         Add a new behavioral quirk flag to FocusedElementInformation to determine whether we should use "legacy" select
3204         popover dismissal behavior (i.e. blurring the focused select element when dismissing the select popover, as well
3205         as dismissing the popover with animation).
3206
3207         * Shared/WebPreferences.yaml:
3208
3209         Enable site-specific quirks by default in WKWebView. With regards to this bug, this change allows for
3210         site-specific hacks (namely, legacy select popover dismissal) in DataActivation. However, this also fixes
3211         various known bugs that are otherwise addressed in Safari only, via site-specific quirks.
3212
3213         * UIProcess/API/Cocoa/WKWebView.mm:
3214         (-[WKWebView _initializeWithConfiguration:]):
3215
3216         For apps linked on or before iOS 13 and macOS 10.15, revert the default of value of NeedsSiteSpecificQuirks to
3217         false. This is done here instead of in a default value function in WebPreferencesDefaultValues to prevent the
3218         default values of NeedsSiteSpecificQuirks in the web process and UI process from going out of sync, since the
3219         web process is not necessarily linked against the same SDK as the application.
3220
3221         * UIProcess/Cocoa/VersionChecks.h:
3222
3223         Add a new DYLD version check for the first version of iOS and macOS where site-specific quirks are enabled by
3224         default.
3225
3226         * UIProcess/ios/WKContentViewInteraction.h:
3227         * UIProcess/ios/WKContentViewInteraction.mm:
3228         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]):
3229         (-[WKContentView _elementDidBlur]):
3230         (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]):
3231
3232         We only use "legacy" select popover dismissal behavior in the case where the site-specific quirk flag is on, a
3233         select popover is used (i.e. the device is an iPad and a select element is focused), and the application bundle
3234         is "com.apple.DataActivation".
3235
3236         * UIProcess/ios/forms/WKFormSelectPopover.mm:
3237         (-[WKSelectTableViewController shouldDismissWithAnimation]):
3238
3239         Keyed off of _shouldUseLegacySelectPopoverDismissalBehavior.
3240
3241         (-[WKSelectPopover controlEndEditing]):
3242         * WebProcess/WebPage/ios/WebPageIOS.mm:
3243         (WebKit::WebPage::getFocusedElementInformation):
3244
3245 2019-09-25  Jonathan Bedard  <jbedard@apple.com>
3246
3247         Unreviewed, rolling out r250324.
3248
3249         Broke many mac wk2 layout tests
3250
3251         Reverted changeset:
3252
3253         "Enable LayoutTests using ResourceLoadStatistics SQLite
3254         backend (195420)"
3255         https://bugs.webkit.org/show_bug.cgi?id=195420
3256         https://trac.webkit.org/changeset/250324
3257
3258 2019-09-25  Youenn Fablet  <youenn@apple.com>
3259
3260         Make IsNSURLSessionWebSocketEnabled an experimental flag
3261         https://bugs.webkit.org/show_bug.cgi?id=202135
3262
3263         Reviewed by Geoffrey Garen.
3264
3265         * Shared/WebPreferences.yaml:
3266
3267 2019-09-24  Chris Dumez  <cdumez@apple.com>
3268
3269         [iOS] Regression(r249703) frequent 'kill() returned unexpected error' log messages
3270         https://bugs.webkit.org/show_bug.cgi?id=202173
3271
3272         Reviewed by Geoffrey Garen.
3273
3274         The kill(pid, 0) command actually fails with an EPERM error when there is a process
3275         running with the given pid, and this is causing us to log a lot of errors. The good
3276         news is that we merely want to know that there is no process with the given PID and
3277         we correctly get a ESRCH error in this case. I renamed the function from
3278         isRunningProcessPID() to wasTerminated() and only check for ESRCH error now. I no
3279         longer log any error otherwise since this is expected.
3280
3281         Also, for performance reason, I no longer call kill(pid, 0) from inside
3282         AuxiliaryProcessProxy::state() as it gets called a lot. I instead only call it from
3283         AuxiliaryProcessProxy::wasTerminated() and call it from
3284         WebProcessPool::tryTakePrewarmedProcess().
3285
3286         * UIProcess/AuxiliaryProcessProxy.cpp:
3287         (WebKit::AuxiliaryProcessProxy::state const):
3288         (WebKit::AuxiliaryProcessProxy::wasTerminated const):
3289         (WebKit::AuxiliaryProcessProxy::isRunningProcessPID): Deleted.
3290         * UIProcess/AuxiliaryProcessProxy.h:
3291         * UIProcess/WebProcessPool.cpp:
3292         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
3293
3294 2019-09-24  Christopher Reid  <chris.reid@sony.com>
3295
3296         [WinCairo] Start RemoteInspectorServer
3297         https://bugs.webkit.org/show_bug.cgi?id=199938
3298         <rdar://problem/53323048>
3299
3300         Reviewed by Fujii Hironori.
3301
3302         Enable the remote inspector client on WinCairo.
3303         The inspector server will run if the WEBKIT_INSPECTOR_SERVER environment variable is set.
3304         WEBKIT_INSPECTOR_SERVER needs to be set in the form of <ip>:port e.g. WEBKIT_INSPECTOR_SERVER=127.0.0.1:1234.
3305
3306         Updated the protocol handler to update the target list with DOM manipulation.
3307
3308         * UIProcess/socket/RemoteInspectorClient.cpp:
3309         * UIProcess/socket/RemoteInspectorClient.h:
3310         * UIProcess/socket/RemoteInspectorProtocolHandler.cpp:
3311         * UIProcess/socket/RemoteInspectorProtocolHandler.h:
3312         * UIProcess/win/WebView.cpp:
3313
3314 2019-09-24  Kate Cheney  <katherine_cheney@apple.com>
3315
3316         Enable LayoutTests using ResourceLoadStatistics SQLite backend (195420)
3317         https://bugs.webkit.org/show_bug.cgi?id=195420
3318         <rdar://problem/54213551>
3319
3320         Reviewed by Brent Fulgham.
3321
3322         Changed all RELEASE_LOG_ERROR() calls involving domain strings to
3323         RELEASE_LOG_ERROR_IF_ALLOWED() to prevent leaking information about
3324         the domain strings only if sessionID.isAlwaysOnLoggingAllowed().
3325
3326         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3327         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
3328         Added autovacuuming to the constructor to avoid manually calling
3329         runVacuumCommand(). Changed constructor to take in sessionID so it
3330         can use RELEASE_LOG_ERROR_IF_ALLOWED which requires the sessionID.
3331
3332         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
3333         Added 2 statements that were not being prepared.
3334
3335         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
3336         Corrected incorrect capitalization. Added check for nullopt in case
3337         domainID is for a domain not in the database yet.
3338
3339         (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
3340         Changed return value to Optional<unsigned>. Some tests were directly
3341         checking for subframes under top frame domains on domains that had
3342         not been inserted yet. Now, domainID() won't crash but will return
3343         a nullopt value which can be checked to know that the tests failed.
3344
3345         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
3346         Added a check to assure domainID exists and updated the domainID
3347         interactions to work as Optionals.
3348
3349         (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
3350         Moved the prepareStatements() call after the vacuum command in the case
3351         where the database is empty. Otherwise called it before returning.
3352
3353         (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain):
3354         Added a space to the SQL commands to correct the syntax.
3355
3356         (WebKit::ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources):
3357         Corrected a bug in the SQL command for querying
3358         subframeUnderTopFrameDomain. The old query was asking for subresource.
3359
3360         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
3361         Spelling fix.
3362
3363         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
3364         Changed string concatenation to binding.
3365
3366         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
3367         The grandfathering.html test was failing because domains were being
3368         "set" to grandfathered in the database before being inserted. This fix
3369         ensures all domains before setting the grandfathering flag.