c6c3494fe1470376f169fb223ca7b32efaff1c01
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-09-24  Brian Burg  <bburg@apple.com>
2
3         REGRESSION(iOS WebDriver): action chains with 'Touch' pointerType don't work on Mac
4         https://bugs.webkit.org/show_bug.cgi?id=216937
5         <rdar://problem/69149171>
6
7         Reviewed by Darin Adler.
8
9         Before iOS WebDriver shipped, 'Touch' was unconditionally aliased to 'Mouse.'
10         Make sure the aliasing happens for macOS so the command doesn't fail frivolously.
11
12         * UIProcess/Automation/WebAutomationSession.cpp:
13         (WebKit::WebAutomationSession::performInteractionSequence):
14         Alias 'Touch' to 'Mouse' when touch is not available and mouse is.
15         This is the case for macOS. 
16
17 2020-09-24  Kate Cheney  <katherine_cheney@apple.com>
18
19         CrashTracer: com.apple.WebKit.Networking in NetworkSession::firstPartyHostCNAMEDomain() code
20         https://bugs.webkit.org/show_bug.cgi?id=216934
21         <rdar://problem/69216768>
22
23         Reviewed by Alex Christensen.
24
25         Add a check for a valid key.
26
27         * NetworkProcess/NetworkSession.cpp:
28         (WebKit::NetworkSession::firstPartyHostCNAMEDomain):
29
30 2020-09-24  Ryan Haddad  <ryanhaddad@apple.com>
31
32         Unreviewed, fix the build for recent SDKs.
33         rdar://69394018
34
35         * Shared/cf/ArgumentCodersCF.cpp:
36         (IPC::decode):
37
38 2020-09-24  Carlos Garcia Campos  <cgarcia@igalia.com>
39
40         [GTK][WPE] Move proxy settings from WebKitContext to WebKitWebsiteDataManager
41         https://bugs.webkit.org/show_bug.cgi?id=216927
42
43         Reviewed by Alex Christensen.
44
45         Make proxy settings per session instead of global to the network process. The web context API now simply
46         forwards the request to the website data manager.
47
48         * NetworkProcess/NetworkProcess.h:
49         * NetworkProcess/NetworkProcess.messages.in:
50         * NetworkProcess/NetworkProcessCreationParameters.cpp:
51         (WebKit::NetworkProcessCreationParameters::encode const):
52         (WebKit::NetworkProcessCreationParameters::decode):
53         * NetworkProcess/NetworkProcessCreationParameters.h:
54         * NetworkProcess/NetworkSessionCreationParameters.cpp:
55         (WebKit::NetworkSessionCreationParameters::encode const):
56         (WebKit::NetworkSessionCreationParameters::decode):
57         * NetworkProcess/NetworkSessionCreationParameters.h:
58         * NetworkProcess/soup/NetworkProcessSoup.cpp:
59         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
60         (WebKit::NetworkProcess::setNetworkProxySettings):
61         * NetworkProcess/soup/NetworkSessionSoup.cpp:
62         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
63         (WebKit::NetworkSessionSoup::setProxySettings):
64         * NetworkProcess/soup/NetworkSessionSoup.h:
65         * Shared/WebProcessCreationParameters.cpp:
66         (WebKit::WebProcessCreationParameters::encode const):
67         (WebKit::WebProcessCreationParameters::decode):
68         * Shared/WebProcessCreationParameters.h:
69         * UIProcess/API/glib/WebKitAutomationSession.cpp:
70         (webkitAutomationSessionCreate):
71         * UIProcess/API/glib/WebKitWebContext.cpp:
72         (webkit_web_context_set_network_proxy_settings):
73         * UIProcess/API/glib/WebKitWebView.cpp:
74         (webkitWebViewConstructed):
75         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
76         (webkit_website_data_manager_set_network_proxy_settings):
77         * UIProcess/API/gtk/WebKitNetworkProxySettings.h:
78         * UIProcess/API/gtk/WebKitWebContext.h:
79         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
80         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
81         * UIProcess/API/wpe/WebKitNetworkProxySettings.h:
82         * UIProcess/API/wpe/WebKitWebContext.h:
83         * UIProcess/API/wpe/WebKitWebsiteDataManager.h:
84         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
85         * UIProcess/WebProcessPool.h:
86         * UIProcess/WebsiteData/WebsiteDataStore.h:
87         (WebKit::WebsiteDataStore::networkProxySettings const):
88         * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp:
89         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
90         (WebKit::WebsiteDataStore::setNetworkProxySettings):
91         * UIProcess/glib/WebProcessPoolGLib.cpp:
92         (WebKit::WebProcessPool::platformInitializeWebProcess):
93         * UIProcess/soup/WebProcessPoolSoup.cpp:
94         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
95         (WebKit::WebProcessPool::setNetworkProxySettings): Deleted.
96
97 2020-09-24  Carlos Garcia Campos  <cgarcia@igalia.com>
98
99         REGRESSION(r267502): [GTK][WPE] ephemeral WebKitWebsiteDataManager ignores TLS errors by default
100         https://bugs.webkit.org/show_bug.cgi?id=216919
101
102         Reviewed by Adrian Perez de Castro.
103
104         Initialize ignoreTLSErrors on website data store for ephemeral sessions.
105
106         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
107         (webkitWebsiteDataManagerConstructed):
108
109 2020-09-24  Carlos Garcia Campos  <cgarcia@igalia.com>
110
111         REGRESSION(r267502) [GLIB] Make WTR ignoreTLSErrors
112         https://bugs.webkit.org/show_bug.cgi?id=216911
113
114         Reviewed by Adrian Perez de Castro.
115
116         I forgot to initialize ignoreTLSErrors in network session parameters.
117
118         * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp:
119         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
120
121 2020-09-23  Peng Liu  <peng.liu6@apple.com>
122
123         Add feature flags for GPU Process features
124         https://bugs.webkit.org/show_bug.cgi?id=216901
125
126         Reviewed by Tim Horton.
127
128         Add feature flags for the following GPU Process features:
129         - 2D canvas in GPU process
130         - WebGL in GPU process
131         - DOM rendering in GPU Process
132
133         Also, clean up some related feature/function names.
134
135         * FeatureFlags/WebKit.plist:
136         Add keys for the GPU process features and sort all keys.
137
138         * Shared/WebPreferencesDefaultValues.cpp:
139         (WebKit::defaultUseGPUProcessForCanvasRenderingEnabled):
140         (WebKit::defaultUseGPUProcessForDOMRenderingEnabled):
141         (WebKit::defaultUseGPUProcessForMediaEnabled):
142         (WebKit::defaultUseGPUProcessForWebGLEnabled):
143         (WebKit::defaultCaptureAudioInGPUProcessEnabled):
144         (WebKit::defaultCaptureVideoInGPUProcessEnabled):
145         (WebKit::defaultWebRTCCodecsInGPUProcess):
146         (WebKit::defaultUseGPUProcessForMedia): Deleted.
147         (WebKit::defaultRenderCanvasInGPUProcessEnabled): Deleted.
148         * Shared/WebPreferencesDefaultValues.h:
149         * Shared/WebPreferencesInternal.yaml:
150         Add preferences and corresponding default values.
151
152         * Shared/WebProcessCreationParameters.h:
153         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
154         (WebKit::WebProcessPool::platformInitializeWebProcess):
155         Rename useGPUProcessForMedia to useGPUProcessForMediaEnabled.
156
157         * UIProcess/WebPageProxy.cpp:
158         (WebKit::WebPageProxy::creationParameters):
159         Use useGPUProcessForCanvasRenderingEnabled instead of renderCanvasInGPUProcessEnabled.
160
161         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
162         (WebKit::RemoteMediaPlayerManager::updatePreferences):
163         Use useGPUProcessForMediaEnabled instead of useGPUProcessForMedia.
164
165         * WebProcess/InjectedBundle/InjectedBundle.cpp:
166         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Ditto.
167
168         * WebProcess/WebPage/WebPage.cpp:
169         (WebKit::m_limitsNavigationsToAppBoundDomains): Ditto.
170         (WebKit::WebPage::updatePreferences): Ditto.
171
172 2020-09-23  Chris Dumez  <cdumez@apple.com>
173
174         Turn off the legacy prefixed WebAudio API
175         https://bugs.webkit.org/show_bug.cgi?id=216886
176
177         Reviewed by Sam Weinig.
178
179         Turn off the legacy prefixed WebAudio API, now that the modern unprefixed API has been enabled
180         in r267488.
181
182         * Shared/WebPreferencesInternal.yaml:
183
184 2020-09-23  Carlos Garcia Campos  <cgarcia@igalia.com>
185
186         [GTK][WPE] Move TLS errors API from WebKitContext to WebKitWebsiteDataManager
187         https://bugs.webkit.org/show_bug.cgi?id=216822
188
189         Reviewed by Alex Christensen.
190
191         Make TLS errors policy per session instead of global to the network process. The web context API now simply
192         forwards the request to the website data manager. The website data manager created for an ephemeral web view
193         will inherit the network settings from the web context website data manager. This ensures backwards
194         compatibility, but it's also convenient, since it's the desired behavior in most of the cases. Apps can still
195         change the network settings of the web view by getting the website data manager.
196
197         * NetworkProcess/NetworkProcess.h:
198         * NetworkProcess/NetworkProcess.messages.in:
199         * NetworkProcess/NetworkProcessCreationParameters.cpp:
200         (WebKit::NetworkProcessCreationParameters::encode const):
201         (WebKit::NetworkProcessCreationParameters::decode):
202         * NetworkProcess/NetworkProcessCreationParameters.h:
203         * NetworkProcess/NetworkSessionCreationParameters.cpp:
204         (WebKit::NetworkSessionCreationParameters::encode const):
205         (WebKit::NetworkSessionCreationParameters::decode):
206         * NetworkProcess/NetworkSessionCreationParameters.h:
207         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
208         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate):
209         * NetworkProcess/soup/NetworkProcessSoup.cpp:
210         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
211         (WebKit::NetworkProcess::setIgnoreTLSErrors):
212         * NetworkProcess/soup/NetworkSessionSoup.cpp:
213         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
214         (WebKit::webSocketAcceptCertificateCallback):
215         (WebKit::webSocketMessageNetworkEventCallback):
216         (WebKit::NetworkSessionSoup::createWebSocketTask):
217         (WebKit::NetworkSessionSoup::setIgnoreTLSErrors):
218         * NetworkProcess/soup/NetworkSessionSoup.h:
219         * UIProcess/API/glib/WebKitAutomationSession.cpp:
220         (webkitAutomationSessionCreate):
221         * UIProcess/API/glib/WebKitWebContext.cpp:
222         (webkitWebContextConstructed):
223         (webkit_web_context_set_tls_errors_policy):
224         (webkit_web_context_get_tls_errors_policy):
225         * UIProcess/API/glib/WebKitWebView.cpp:
226         (webkitWebViewConstructed):
227         (webkit_web_view_class_init):
228         (webkitWebViewLoadFailedWithTLSErrors):
229         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
230         (webkitWebsiteDataManagerConstructed):
231         (webkitWebsiteDataManagerGetDataStore):
232         (webkit_website_data_manager_set_tls_errors_policy):
233         (webkit_website_data_manager_get_tls_errors_policy):
234         * UIProcess/API/gtk/WebKitWebContext.h:
235         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
236         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
237         * UIProcess/API/wpe/WebKitWebContext.h:
238         * UIProcess/API/wpe/WebKitWebsiteDataManager.h:
239         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
240         * UIProcess/WebProcessPool.h:
241         * UIProcess/WebsiteData/WebsiteDataStore.h:
242         (WebKit::WebsiteDataStore::ignoreTLSErrors const):
243         * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp:
244         (WebKit::WebsiteDataStore::setIgnoreTLSErrors):
245         * UIProcess/soup/WebProcessPoolSoup.cpp:
246         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
247         (WebKit::WebProcessPool::setIgnoreTLSErrors): Deleted.
248
249 2020-09-23  Per Arne Vollan  <pvollan@apple.com>
250
251         [macOS] Issue sandbox extension for the diagnostic daemon
252         https://bugs.webkit.org/show_bug.cgi?id=216834
253         <rdar://problem/58496834>
254
255         Reviewed by Brent Fulgham.
256
257         * Shared/WebProcessCreationParameters.cpp:
258         (WebKit::WebProcessCreationParameters::encode const):
259         (WebKit::WebProcessCreationParameters::decode):
260         * Shared/WebProcessCreationParameters.h:
261         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
262         (WebKit::isInternalInstall):
263         (WebKit::agxCompilerClasses):
264         (WebKit::diagnosticServices):
265         (WebKit::WebProcessPool::platformInitializeWebProcess):
266         * WebProcess/cocoa/WebProcessCocoa.mm:
267         (WebKit::WebProcess::platformInitializeWebProcess):
268         * WebProcess/com.apple.WebProcess.sb.in:
269
270 2020-09-23  Fujii Hironori  <Hironori.Fujii@sony.com>
271
272         Remove ENABLE_SVG_FONTS macro
273         https://bugs.webkit.org/show_bug.cgi?id=216850
274
275         Reviewed by Don Olmstead.
276
277         * WebProcess/Network/WebLoaderStrategy.cpp:
278         (WebKit::maximumBufferingTime):
279
280 2020-09-23  Per Arne Vollan  <pvollan@apple.com>
281
282         [macOS] Change name of client decoder entitlement
283         https://bugs.webkit.org/show_bug.cgi?id=216670
284         <rdar://problem/69101997>
285
286         Reviewed by Darin Adler.
287
288         The client decoder entitlement landed in <https://trac.webkit.org/changeset/266613/webkit> has changed name, and should be updated.
289
290         * Scripts/process-entitlements.sh:
291
292 2020-09-23  Peng Liu  <peng.liu6@apple.com>
293
294         [Media in GPU Process] Implement caption support in video fullscreen and PiP
295         https://bugs.webkit.org/show_bug.cgi?id=208752
296
297         Reviewed by Eric Carlson.
298
299         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
300         (WebKit::RemoteMediaPlayerProxy::syncTextTrackBounds): Deleted.
301         * GPUProcess/media/RemoteMediaPlayerProxy.h:
302         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
303         Remove syncTextTrackBounds() because the GPU process does not need to deal with
304         the text track bounds.
305
306         * WebProcess/GPU/GPUProcessConnection.cpp:
307         (WebKit::GPUProcessConnection::dispatchMessage):
308         Add a missing IPC message receiver.
309
310         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
311         (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenLayer): Set the flag
312         m_requiresTextTrackRepresentation when changing video presentation mode.
313         (WebKit::MediaPlayerPrivateRemote::requiresTextTrackRepresentation const): Deleted.
314         (WebKit::MediaPlayerPrivateRemote::setTextTrackRepresentation): Deleted.
315         (WebKit::MediaPlayerPrivateRemote::syncTextTrackBounds): Deleted.
316         Move the implementation of those functions to MediaPlayerPrivateRemoteCocoa.
317
318         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
319         Add the flag m_requiresTextTrackRepresentation and add a reference
320         to the layer used to render text track (in fullscreen or picture-in-picture).
321
322         * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
323         (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame):
324         (WebKit::MediaPlayerPrivateRemote::setTextTrackRepresentation):
325         (WebKit::MediaPlayerPrivateRemote::syncTextTrackBounds):
326         Those functions share a similar implementation as VideoLayerManagerObjC.
327
328 2020-09-23  Per Arne Vollan  <pvollan@apple.com>
329
330         [macOS] Start collecting telemetry from a set of XPC services
331         <https://bugs.webkit.org/show_bug.cgi?id=216797>
332
333         Reviewed by Brent Fulgham.
334
335         * WebProcess/com.apple.WebProcess.sb.in:
336
337 2020-09-23  Chris Dumez  <cdumez@apple.com>
338
339         Turn on the modern unprefixed WebAudio API
340         https://bugs.webkit.org/show_bug.cgi?id=216885
341
342         Reviewed by Eric Carlson.
343
344         Turn on the modern unprefixed WebAudio API now that we support most of the API
345         besides AudioWorklet and now that we have a good pass rate on WPT tests.
346
347         * Shared/WebPreferencesExperimental.yaml:
348
349 2020-09-23  Truitt Savell  <tsavell@apple.com>
350
351         Unreviewed, reverting r267403.
352
353         Caused 50+ Crashes on iOS Debug
354
355         Reverted changeset:
356
357         "Move Media in GPU Process flag from internal to experimental"
358         https://bugs.webkit.org/show_bug.cgi?id=216473
359         https://trac.webkit.org/changeset/267403
360
361 2020-09-23  Youenn Fablet  <youenn@apple.com>
362
363         Add support for HTMLMediaElement.setSinkId
364         https://bugs.webkit.org/show_bug.cgi?id=216696
365
366         Reviewed by Eric Carlson.
367
368         Add internal flag to enable/disable user gesture requirement for setting audio output device,
369         and for per media element setting of audio output device.
370
371         * Shared/WebPreferencesExperimental.yaml:
372         * Shared/WebPreferencesInternals.yaml:
373
374 2020-09-22  Wenson Hsieh  <wenson_hsieh@apple.com>
375
376         [GPU Process] fast/canvas/canvas-blend-image.html and fast/canvas/canvas-blend-solid.html fail on macOS
377         https://bugs.webkit.org/show_bug.cgi?id=216860
378
379         Reviewed by Said Abou-Hallawa.
380
381         These two tests disable accelerated drawing for canvas elements; when using the GPU process, this causes us to
382         use `ImageBufferShareableBitmapBackend` as the back-end for the image buffer backing the canvas element.
383
384         On both macOS and iOS, the image buffer is backed by BGRA image data. However, we override
385         `backendColorFormat()` and return `ColorFormat::BGRA` only for `PLATFORM(IOS_FAMILY)`, causing `putImageData`
386         and `getImageData` to result in flipped red and blue channels on macOS, which subsequently causes these two
387         layout tests to fail.
388
389         Fix these tests by removing the `PLATFORM(IOS_FAMILY)` guard.
390
391         * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
392
393 2020-09-22  Commit Queue  <commit-queue@webkit.org>
394
395         Unreviewed, reverting r267421.
396         https://bugs.webkit.org/show_bug.cgi?id=216864
397
398         Broke a test on macOS
399
400         Reverted changeset:
401
402         "[macOS] Start collecting telemetry from a set of XPC
403         services"
404         https://bugs.webkit.org/show_bug.cgi?id=216797
405         https://trac.webkit.org/changeset/267421
406
407 2020-09-22  Lauro Moura  <lmoura@igalia.com>
408
409         [GTK] REGRESSION(r267398): several hidpi tests are failing
410         https://bugs.webkit.org/show_bug.cgi?id=216830
411
412         Reviewed by Adrian Perez de Castro.
413
414         * UIProcess/WebPageProxy.cpp:
415         (WebKit::WebPageProxy::setCustomDeviceScaleFactor): Remove check for removed define.
416
417 2020-09-22  Peng Liu  <peng.liu6@apple.com>
418
419         [Media in GPU Process] Add missing IPC message receivers
420         https://bugs.webkit.org/show_bug.cgi?id=216829
421
422         Reviewed by Jer Noble.
423
424         Add missing IPC message receivers and clean up some macro usages.
425         Also remove the empty RemoteMediaPlayerManager.messages.in.
426
427         No new tests, no functional change.
428
429         * CMakeLists.txt:
430         * DerivedSources-input.xcfilelist:
431         * DerivedSources.make:
432         * GPUProcess/GPUConnectionToWebProcess.cpp:
433         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
434         (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
435         * GPUProcess/GPUConnectionToWebProcess.h:
436         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h:
437         (WebKit::RemoteMediaSessionHelperProxy::didReceiveMessageFromWebProcess):
438         * WebKit.xcodeproj/project.pbxproj:
439         * WebProcess/GPU/GPUProcessConnection.cpp:
440         (WebKit::GPUProcessConnection::dispatchMessage):
441         * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in: Removed.
442
443 2020-09-22  Per Arne Vollan  <pvollan@apple.com>
444
445         [macOS] Start collecting telemetry from a set of XPC services
446         <https://bugs.webkit.org/show_bug.cgi?id=216797>
447
448         Reviewed by Brent Fulgham.
449
450         * WebProcess/com.apple.WebProcess.sb.in:
451
452 2020-09-22  Youenn Fablet  <youenn@apple.com>
453
454         Implement a default prompt for getUserMedia
455         https://bugs.webkit.org/show_bug.cgi?id=216821
456
457         Reviewed by Eric Carlson.
458
459         Move preferences used by WebRTC develop menu to internals.
460         This allows having them in MiniBrowser.
461
462         Enable video capture in UIProcess by default for non Safari applications.
463         Add support for a getUserMedia prompt, very similar to iOS current prompt.
464         Use the prompt in case the application does not implement any of the two delegates.
465
466         * Shared/WebPreferences.yaml:
467         * Shared/WebPreferencesDefaultValues.cpp:
468         (WebKit::defaultCaptureVideoInUIProcessEnabled):
469         * Shared/WebPreferencesDefaultValues.h:
470         * Shared/WebPreferencesExperimental.yaml:
471         * Shared/WebPreferencesInternal.yaml:
472         * UIProcess/Cocoa/UIDelegate.h:
473         * UIProcess/Cocoa/UIDelegate.mm:
474         (WebKit::UIDelegate::setDelegate):
475         (WebKit::requestUserMediaAuthorizationForFrame):
476         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
477         * UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.h: Added.
478         * UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.mm: Added.
479         (WebKit::visibleDomain):
480         (WebKit::alertMessageText):
481         (WebKit::presentUserMediaCaptureAccessAlert):
482         * WebKit.xcodeproj/project.pbxproj:
483
484 2020-09-22  Brady Eidson  <beidson@apple.com>
485
486         Crashtracer inside PDFPlugin::createScrollbar.
487         <rdar://problem/69256031> and https://bugs.webkit.org/show_bug.cgi?id=216810
488
489         Reviewed by Tim Horton.
490
491         To quote Tim from r264945:
492         No new tests; timing is such that I can't reproduce without inserting
493         intentional delays into the main thread hops, which is further than
494         I'm willing to go for a test.
495
496         This is a speculative fix due to the aforementioned reproducibility issue.
497         
498         * WebProcess/Plugins/PDF/PDFPlugin.mm:
499         (WebKit::PDFPlugin::installPDFDocument): With all the past fixes in place, its apparent
500           the plug-in HAS been torn down, and it's somewhat common to bypass the other "hasBeenDestroyed"
501           checks. So put an explicit check here followed by an explicit release assert.
502
503 2020-09-22  Brian Burg  <bburg@apple.com>
504
505         [Cocoa] _WKInspectorDelegate should handle showing external resources
506         https://bugs.webkit.org/show_bug.cgi?id=216334
507
508         Reviewed by Devin Rousso.
509
510         WebKit clients need a way to control the loading and presentation of
511         external resources that are linked in Web Inspector's user interface.
512
513         Rename InspectorFrontendHost.openInNewTab to openURLExternally. Change
514         the implementation to forward the request to UIProcess rather than the
515         inspected WebProcess.
516
517         When a navigation is triggered in WKInspectorViewController's WKWebView,
518         allow the delegate to open the requested resource. Otherwise, redirect
519         the navigation to the inspected WebView or open it using NSWorkspace
520         (for the remote case).
521
522         New API test: WKInspectorDelegate.OpenURLExternally.
523
524         * UIProcess/API/Cocoa/_WKInspectorPrivateForTesting.h: Added.
525         * UIProcess/API/Cocoa/_WKInspectorTesting.mm: Added.
526         (snippetToOpenURLExternally):
527         (-[_WKInspector _openURLExternallyForTesting:useFrontendAPI:]):
528         Add some helpers for writing API tests.
529
530         * UIProcess/API/APIInspectorClient.h:
531         (API::InspectorClient::openURLExternally):
532         * UIProcess/API/Cocoa/_WKInspectorDelegate.h:
533         * UIProcess/Cocoa/PageClientImplCocoa.mm:
534         * UIProcess/Inspector/Cocoa/InspectorDelegate.h:
535         * UIProcess/Inspector/Cocoa/InspectorDelegate.mm:
536         (WebKit::InspectorDelegate::setDelegate):
537         (WebKit::InspectorDelegate::InspectorClient::openURLExternally):
538         Add new delegate method to _WKInspectorDelegate.
539
540         * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in:
541         * UIProcess/Inspector/RemoteWebInspectorProxy.h:
542         * UIProcess/Inspector/RemoteWebInspectorProxy.cpp:
543         (WebKit::RemoteWebInspectorProxy::openURLExternally):
544         (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally):
545         (WebKit::RemoteWebInspectorProxy::openInNewTab): Deleted.
546         (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted.
547         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
548         (WebKit::RemoteWebInspectorProxy::platformURLExternally):
549         (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted.
550         * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm:
551         (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally):
552         (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted.
553         * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp:
554         (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally):
555         (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted.
556         Rename openInNewTab to openURLExternally. In some cases the client
557         may not choose to present a new tab, so the name is no longer accurate.
558
559         * UIProcess/Inspector/WebInspectorProxy.messages.in:
560         * UIProcess/Inspector/WebInspectorProxy.h:
561         * UIProcess/Inspector/WebInspectorProxy.cpp:
562         (WebKit::WebInspectorProxy::inspectorWindow const):
563         (WebKit::WebInspectorProxy::openURLExternally):
564         (WebKit::WebInspectorProxy::evaluateInFrontendForTesting):
565         * UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
566         (-[WKWebInspectorProxyObjCAdapter inspectorViewController:openURLExternally:]):
567         Add some helpers for writing API tests. Add an IPC message
568         for evaluating a JavaScript expression in the frontend page.
569         Also, add a message receiver for the OpenURLExternally message
570         which passes the request to the API layer.
571
572         * UIProcess/Inspector/mac/WKInspectorViewController.h:
573         * UIProcess/Inspector/mac/WKInspectorViewController.mm:
574         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
575         Call the delegate method if a navigation inside the inspector WKWebView is an external URL.
576         Specifically the request is to load something other than the Web Inspector's main HTML page.
577
578         * WebProcess/Inspector/WebInspector.cpp:
579         (WebKit::WebInspector::openInNewTab): Deleted.
580         * WebProcess/Inspector/WebInspector.h:
581         * WebProcess/Inspector/WebInspector.messages.in:
582         No need to handle this message anymore in the inspected WebProcess.
583
584         * WebProcess/Inspector/RemoteWebInspectorUI.h:
585         * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
586         (WebKit::RemoteWebInspectorUI::openURLExternally):
587         (WebKit::RemoteWebInspectorUI::openInNewTab): Deleted.
588         * WebProcess/Inspector/WebInspectorUI.messages.in:
589         * WebProcess/Inspector/WebInspectorUI.h:
590         * WebProcess/Inspector/WebInspectorUI.cpp:
591         (WebKit::WebInspectorUI::updateConnection):
592         (WebKit::WebInspectorUI::closeWindow):
593         (WebKit::WebInspectorUI::openURLExternally):
594         (WebKit::WebInspectorUI::evaluateInFrontendForTesting):
595         (WebKit::WebInspectorUI::openInNewTab): Deleted.
596         When we need to open the URL externally, send an IPC message to UIProcess.
597         The old implementation triggered the navigation from the inspected WebProcess.
598         That approach is no longer desirable. Remove the unneeded IPC connection.
599
600         * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h:
601         * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp:
602         (WebKit::WebInspectorFrontendAPIDispatcher::evaluateExpressionForTesting):
603         Fulfill the request to evaluate the expression in the frontend page.
604
605         * SourcesCocoa.txt:
606         * WebKit.xcodeproj/project.pbxproj:
607         Some files were added.
608
609
610 2020-09-22  Per Arne Vollan  <pvollan@apple.com>
611
612         [macOS] Start collecting telemetry from message filtering
613         <https://bugs.webkit.org/show_bug.cgi?id=216803>
614
615         Reviewed by Darin Adler.
616
617         Start collecting telemetry for message filtering in the WebContent sandbox on macOS.
618
619         * WebProcess/com.apple.WebProcess.sb.in:
620
621 2020-09-22  Youenn Fablet  <youenn@apple.com>
622
623         Move Media in GPU Process flag from internal to experimental
624         https://bugs.webkit.org/show_bug.cgi?id=216473
625         <rdar://problem/69318786>
626
627         Reviewed by Eric Carlson.
628
629         No change of behavior.
630
631         * Shared/WebPreferencesExperimental.yaml:
632         * Shared/WebPreferencesInternal.yaml:
633
634 2020-09-21  Youenn Fablet  <youenn@apple.com>
635
636         Enable MediaRecorder by default on iOS
637         https://bugs.webkit.org/show_bug.cgi?id=216664
638
639         Reviewed by Darin Adler.
640
641         * Shared/WebPreferencesDefaultValues.cpp:
642         (WebKit::defaultMediaRecorderEnabled):
643
644 2020-09-21  Adrian Perez de Castro  <aperez@igalia.com>
645
646         [CMake] Use imported targets in find module for the ATK SPI2 bridge dependency
647         https://bugs.webkit.org/show_bug.cgi?id=216773
648
649         Reviewed by Don Olmstead.
650
651         No new tests needed.
652
653         * PlatformWPE.cmake: Use the ATK::Bridge imported target.
654
655 2020-09-21  Adrian Perez de Castro  <aperez@igalia.com>
656
657         [GTK] Bump cairo version to support HiDPI
658         https://bugs.webkit.org/show_bug.cgi?id=133378
659
660         Reviewed by Carlos Garcia Campos.
661
662         Remove conditional compilation around cairo_{g,s}et_device_scale() as there is no need to
663         support older versions of Cairo which lack the functions. The minimum version of Cairo
664         being required by CMake is 1.14.0, which already includes them.
665
666         * Shared/cairo/ShareableBitmapCairo.cpp:
667         (WebKit::ShareableBitmap::paint): use cairo_surface_set_device_scale() directly.
668         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
669         (webkitWebViewBaseTakeViewSnapshot): Ditto.
670         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
671         (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Ditto.
672         (WebKit::AcceleratedBackingStoreWayland::downloadTexture): Ditto.
673         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
674         (WebKit::AcceleratedBackingStoreX11::update): Ditto.
675
676 2020-09-21  Tim Horton  <timothy_horton@apple.com>
677
678         paper.io ad close buttons cannot be iteracted with via trackpad on iPad
679         https://bugs.webkit.org/show_bug.cgi?id=216812
680         <rdar://problem/68738585>
681
682         Reviewed by Wenson Hsieh.
683
684         * UIProcess/ios/WKContentViewInteraction.mm:
685         (applicationIsKnownToIgnoreMouseEvents):
686
687 2020-09-21  Timothy Hatcher  <timothy@apple.com>
688
689         Add some WKWebProcessPlugInFrame SPI needed by Safari.
690         https://bugs.webkit.org/show_bug.cgi?id=216809
691         rdar://problem/69336928
692
693         Reviewed by Brian Weinstein.
694
695         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
696         (+[WKWebProcessPlugInFrame lookUpFrameFromJSContext:]): Added.
697         (-[WKWebProcessPlugInFrame _securityOrigin]): Added.
698         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h:
699
700 2020-09-21  Andres Gonzalez  <andresg_22@apple.com>
701
702         Make accessibility isolated tree a non-experimental feature.
703         https://bugs.webkit.org/show_bug.cgi?id=216792
704
705         Reviewed by Chris Fleizach.
706
707         Promote accessibility isolated tree from an experimental feature to a
708         non-experimental one. This avoids the problem where a user can turn off
709         the feature through the Safari > Develop > Experimental Features submenu,
710         while the accessibility request are still coming on a secondary thread,
711         which leads to random crashes.
712
713         * Shared/WebPreferences.yaml:
714         * Shared/WebPreferencesExperimental.yaml:
715
716 2020-09-21  Basuke Suzuki  <basuke.suzuki@sony.com>
717
718         [WinCairo][PlayStation] Support different instances of listener client.
719         https://bugs.webkit.org/show_bug.cgi?id=216733
720
721         Reviewed by Don Olmstead.
722
723         Follows the change of RemoteInspectorSocketEndpoint::Client interface change.
724
725         No new tests because there's no behaivior change.
726
727         * UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
728         (WebKit::RemoteInspectorClient::didClose):
729         * UIProcess/Inspector/socket/RemoteInspectorClient.h:
730
731 2020-09-21  Youenn Fablet  <youenn@apple.com>
732
733         [iOS] MediaRecorder incorrect screen orientation handling
734         https://bugs.webkit.org/show_bug.cgi?id=198912
735         <rdar://problem/51802521>
736
737         Reviewed by Eric Carlson.
738
739         * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
740         (WebKit::RemoteMediaRecorder::videoSampleAvailable):
741
742 2020-09-21  Keith Miller  <keith_miller@apple.com>
743
744         Functions should consistently enumerate length before name
745         https://bugs.webkit.org/show_bug.cgi?id=216789
746
747         Reviewed by Yusuke Suzuki.
748
749         JSNPMethod inherits from InternalFunction which now sets length by default.
750         I chose 0 because it looks like this function doesn't directly look at any
751         arguments and I doubt anyone is looking at the length anyway.
752
753         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
754         (WebKit::JSNPMethod::finishCreation):
755
756 2020-09-20  Darin Adler  <darin@apple.com>
757
758         Next step towards eliminating deprecated legacy positions
759         https://bugs.webkit.org/show_bug.cgi?id=216751
760
761         Reviewed by Sam Weinig.
762
763         * WebProcess/WebPage/ios/WebPageIOS.mm:
764         (WebKit::WebPage::selectWithGesture):
765         (WebKit::WebPage::extendSelection):
766         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
767         (WebKit::WebPage::requestAutocorrectionData):
768         (WebKit::WebPage::applyAutocorrectionInternal):
769         (WebKit::focusedElementPositionInformation):
770         (WebKit::dataDetectorLinkPositionInformation):
771         (WebKit::WebPage::requestDocumentEditingContext):
772         Replaced calls to createLegacyEditingPosition with calls to
773         makeDeprecatedLegacyPosition or makeContainerOffsetPosition.
774
775 2020-09-21  Wenson Hsieh  <wenson_hsieh@apple.com>
776
777         Adjust the human readable names some GPU process internal feature flags
778         https://bugs.webkit.org/show_bug.cgi?id=216794
779
780         Reviewed by Darin Adler.
781
782         Change the human readable names so that all the GPU-process-specific internal features start are of the form
783         "Use GPU Process…".
784
785         * Shared/WebPreferencesInternal.yaml:
786
787 2020-09-21  James Savage  <james.savage@apple.com>
788
789         WKWebView Swift overlay has mis-annotated nullability for evaluateJavaScript
790         <http://webkit.org/b/216198>
791         <rdar://problem/68035950>
792
793         Reviewed by Darin Adler.
794
795         Due to a mistranslation of evaluateJavaScript, we are vending an API which does not expect
796         to receive nil as a valid result value. This change fixes the crash, but does not yet fix
797         the API to have the correct signature. That will come in a later patch.
798
799         To fix the crash, we need to produce a valid Result<Any, Error> to pass back to clients.
800         Fortunately, instead of inventing something clever, we can just use nil. It's valid to box
801         optional values into Any, and clients can technically retrieve them with the right dynamic cast
802         as well. Since client code must be using dynamic casting to convert the result Any to a usable
803         type, and because in the case where we now return a new value at runtime we would have previously
804         crashed, this shouldn't have any binary compatibility impact either.
805
806         To better validate these changes, I also add new unit tests for the conversion of JavaScript
807         results into Swift values, including a test for the deprecated API.
808
809         * SwiftOverlay/SwiftOverlay/ObjectiveCBlockConversions.swift: Added. For clarity I'm factoring
810         helper methods into a single namespace, as it also makes a nice place to document their expectations.
811         (ObjectiveCBlockConversion.exclusive.exclusive(_:)): This is renamed from the free function,
812             makeResultHandler(_:). It still has the same fatalError (now precondition) as before, but
813             hopefully a better name to clarify that it expects exactly-one value.
814         (ObjectiveCBlockConversions.boxingNilAsAnyForCompatibility(_:)): This is a variant of exclusive(_:)
815             that makes the tradeoff of boxing any nil values as Any to avoid crashing. This is still safe,
816             since as mentioned our clients will need to cast the value they recieve to do anything with it,
817             and since the deprecated API expects `Any`, no one could have been successfully comparing it
818             to `nil` today anyways.
819
820         * SwiftOverlay/Tests/JavaScriptToSwiftTypeConversions.swift: Added.
821         (JavaScriptToSwiftConversions.setUp): Construct a new web view, and add it to a window so that it is
822             in an expected state. I'm using about:blank as the URL, since page content doesn't matter for
823             these tests and I want the web content to be ready immediately.
824         (JavaScriptToSwiftConversions.tearDown): Just perform some window cleanup.
825         (JavaScriptToSwiftConversions.evaluateJavaScript(_:andExpect:)): Helper method to evaluate script and
826             check its result. I'm using String.debugDescription because it escapes quotes and special characters
827             which makes the readout easier to parse.
828         (JavaScriptToSwiftConversions.testNull): JavaScript's null is actually mapped to NSNull, not nil.
829         (JavaScriptToSwiftConversions.testInteger): Some standard type coercion tests. The underlying value for
830             all number types should be NSNumber, so this is actually check against a float or integer type
831             without issue.
832         (JavaScriptToSwiftConversions.testDecimal): Ditto.
833         (JavaScriptToSwiftConversions.testBoolean): Ditto.
834         (JavaScriptToSwiftConversions.testString): Ditto.
835         (JavaScriptToSwiftConversions.testArray): Ditto.
836         (JavaScriptToSwiftConversions.testDictionary): Ditto, only you can't evaluate an object literal directly
837             so I need to store it in a temporary location first.
838         (JavaScriptToSwiftConversions.testUndefined): Test our boxing of nil. The exact value matters less than
839             not crashing at all.
840
841         * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added new files to project. I kept the
842             new test file and helper files within the SwiftOverlay group, because they do not contribute any API.
843
844         * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift:
845         (WKWebView.callAsyncJavaScript(_:arguments:in:in:completionHandler:)): Switch to a conversion which does
846             not trap on nil.
847         (WKWebView.createPDF(_:completionHandler:)): Updated to use new helper method name.
848         (WKWebView.createWebArchiveData(_:)): Ditto.
849         (WKWebView.evaluateJavaScript(_:in:in:completionHandler:Error:)): See above.
850         (makeResultHandler(_:): This has been subsumed by ObjCBlockConversions.
851
852 2020-09-21  Kate Cheney  <katherine_cheney@apple.com>
853
854         Allow about:blank subframe loads for non app-bound top frames
855         https://bugs.webkit.org/show_bug.cgi?id=216715
856         <rdar://problem/69070720>
857
858         Reviewed by Darin Adler.
859
860         In the original implementation of App Bound Domains, any loads using
861         certain protocols like about: were automatically considered app-bound.
862         When a subframe loads about:blank for example, this forces web views
863         into app-bound mode even if the top frame is not app-bound, which
864         should not be the case.
865
866         These special protocols inherit security origins from their top-frame
867         loads, so we can refer to those to determine whether subframe loads
868         should be considered app-bound. For about: loads in a main frame there
869         is no behavior change and WKWebViews will still automatically be considered
870         app-bound in this case.
871
872         * UIProcess/WebPageProxy.cpp:
873         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted):
874         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
875         Refer to the security origin if the subframe load is one of the
876         special protocols caught by the shouldTreatURLProtocolAsAppBound() function.
877
878         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
879         (WebKit::schemeOrDomainIsAppBound):
880         (WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
881         * UIProcess/WebsiteData/WebsiteDataStore.h:
882
883 2020-09-20  Simon Fraser  <simon.fraser@apple.com>
884
885         Sort the project file.
886
887         * WebKit.xcodeproj/project.pbxproj:
888
889 2020-09-19  Sam Weinig  <weinig@apple.com>
890
891         Remove runtime setting for enabling/disabling the CrossOriginResourcePolicy API
892         https://bugs.webkit.org/show_bug.cgi?id=216561
893
894         Reviewed by Darin Adler.
895
896         Remove runtime setting for enabling/disabling CrossOriginResourcePolicy. It has been
897         enabled by default for a while and there are no known reasons one would need to
898         disable it.
899
900         * Shared/WebPreferences.yaml:
901         * UIProcess/API/C/WKPreferences.cpp:
902         (WKPreferencesSetCrossOriginResourcePolicyEnabled):
903         (WKPreferencesGetCrossOriginResourcePolicyEnabled):
904         * UIProcess/API/C/WKPreferencesRef.h:
905         * WebProcess/Network/WebLoaderStrategy.cpp:
906         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
907
908 2020-09-18  Wenson Hsieh  <wenson_hsieh@apple.com>
909
910         [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
911         https://bugs.webkit.org/show_bug.cgi?id=216718
912         <rdar://problem/69150358>
913
914         Reviewed by Tim Horton.
915
916         Test: CopyHTML.WriteRichTextSelectionToPasteboard
917
918         * UIProcess/mac/WebPageProxyMac.mm:
919         (WebKit::WebPageProxy::dataSelectionForPasteboard):
920
921         After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
922         due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
923         use `ipcHandle.dataSize`.
924
925 2020-09-18  Megan Gardner  <megan_gardner@apple.com>
926
927         Remove unneeded respondsToSelector staging for keyboard.
928         https://bugs.webkit.org/show_bug.cgi?id=216421
929
930         Staging needed for dual work in UIKit in 2019, no longer needed.
931
932         Reviewed by Tim Horton.
933
934         No behavior change, covered by existing tests.
935
936         * UIProcess/ios/WKContentViewInteraction.mm:
937         (-[WKContentView insertText:]):
938         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
939         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
940
941 2020-09-18  Sihui Liu  <sihui_liu@apple.com>
942
943         REGRESSION (r266634): fast/selectors/text-field-selection-stroke-color.html and fast/selectors/text-field-selection-window-inactive-stroke-color.html are flaky failures with pixel noise
944         https://bugs.webkit.org/show_bug.cgi?id=216394
945         <rdar://problem/68679551>
946
947         Reviewed by Tim Horton.
948
949         In WebKitTestRunner, we reset the states and load about:blank page between tests. The resetting may cause some
950         activity state changes of web page, like WindowIsActive. Before r266634, these changes will be dispatched
951         quickly enough (before runloop waits or when runloop exits) to web process, so web process can do rendering with
952         updated activity state. After r266634, dispatch of the changes may be delayed (until CATransaction commits). 
953         Page activity state can affect scrollability (in FrameView::computeScrollability()) and scrollability can affect
954         tiling size (in TileController::computeTileSize()). Different tilings may cause the tiny pixel difference we see
955         in the test results.
956
957         To fix this, create an SPI for sending out activity state updates in next runloop cycle and adopt it in WTR.
958
959         * UIProcess/API/C/WKPage.cpp:
960         (WKPageDispatchActivityStateUpdateForTesting):
961         * UIProcess/API/C/WKPagePrivate.h:
962         * UIProcess/WebPageProxy.cpp:
963         (WebKit::WebPageProxy::dispatchActivityStateUpdateForTesting):
964         * UIProcess/WebPageProxy.h:
965
966 2020-09-18  Alex Christensen  <achristensen@webkit.org>
967
968         WKWebView._tryClose should return whether it succeeded or not
969         https://bugs.webkit.org/show_bug.cgi?id=216660
970
971         Reviewed by Tim Horton.
972
973         The return value of WKPageTryClose is used by Safari.
974         In order to migrate to WKWebView _tryClose, we need to expose this return value.
975
976         * UIProcess/API/Cocoa/WKWebView.mm:
977         (-[WKWebView _tryClose]):
978         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
979
980 2020-09-18  Sihui Liu  <sihui_liu@apple.com>
981
982         Webpages flash when getting closed
983         https://bugs.webkit.org/show_bug.cgi?id=216131
984         <rdar://problem/62264106>
985
986         Reviewed by Chris Dumez.
987
988         Closing a page in web process will detach root CA layer and clears content in view immediately. If this happens
989         in web process before transaction, which contains view hierachy change or layer change, is committed in UI 
990         process, we would see a white flash. To try fixing this issue, we explicitly delay sending the close message
991         to next runloop cycle.
992
993         * UIProcess/WebPageProxy.cpp:
994         (WebKit::WebPageProxy::close):
995         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
996         * UIProcess/WebProcessProxy.cpp:
997         (WebKit::m_shutdownPreventingScopeCounter):
998         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
999         * UIProcess/WebProcessProxy.h: remove class ScopePreventingShutdown and use RefCounter to prevent process 
1000         shutdown.
1001         (WebKit::WebProcessProxy::shutdownPreventingScope):
1002         (WebKit::WebProcessProxy::ScopePreventingShutdown::ScopePreventingShutdown): Deleted.
1003         (WebKit::WebProcessProxy::ScopePreventingShutdown::~ScopePreventingShutdown): Deleted.
1004         (WebKit::WebProcessProxy::makeScopePreventingShutdown): Deleted.
1005
1006 2020-09-18  Youenn Fablet  <youenn@apple.com>
1007
1008         Add internal flag to enable/disable H264 hardware encoder
1009         https://bugs.webkit.org/show_bug.cgi?id=216534
1010
1011         Reviewed by Eric Carlson.
1012
1013         * Shared/WebPreferencesInternal.yaml:
1014         * WebProcess/WebPage/WebPage.cpp:
1015         (WebKit::WebPage::updatePreferences):
1016
1017 2020-09-18  Youenn Fablet  <youenn@apple.com>
1018
1019         Hash deviceIds in WebProcess instead of UIProcess to allow audio output device IDs in WebProcess
1020         https://bugs.webkit.org/show_bug.cgi?id=216693
1021
1022         Reviewed by Eric Carlson.
1023
1024         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1025         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
1026         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1027         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1028
1029 2020-09-18  Youenn Fablet  <youenn@apple.com>
1030
1031         Unified build fixes in media code
1032         https://bugs.webkit.org/show_bug.cgi?id=216691
1033
1034         Reviewed by Sam Weinig.
1035
1036         Add missing includes and/or missing undef.
1037         No change of behavior.
1038
1039         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp:
1040         * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
1041         * WebProcess/WebPage/WebPageOverlay.h:
1042         * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp:
1043         * WebProcess/cocoa/RemoteRealtimeMediaSource.h:
1044
1045 2020-09-18  Noam Rosenthal  <noam@webkit.org>
1046
1047         Enable paint timing by default
1048         https://bugs.webkit.org/show_bug.cgi?id=211736
1049
1050         Reviewed by Simon Fraser.
1051
1052         * Shared/WebPreferencesExperimental.yaml:
1053                 PaintTimingEnabled default to true.
1054
1055 2020-09-18  Youenn Fablet  <youenn@apple.com>
1056
1057         XHR.timeout is affected by long tasks
1058         https://bugs.webkit.org/show_bug.cgi?id=216266
1059         <rdar://problem/68908150>
1060
1061         Reviewed by Alex Christensen.
1062
1063         Go to network process to know whether a load is finished or not.
1064
1065         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1066         (WebKit::NetworkConnectionToWebProcess::isResourceLoadFinished):
1067         * NetworkProcess/NetworkConnectionToWebProcess.h:
1068         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1069         * WebProcess/Network/WebLoaderStrategy.cpp:
1070         (WebKit::WebLoaderStrategy::isResourceLoadFinished):
1071         * WebProcess/Network/WebLoaderStrategy.h:
1072
1073 2020-09-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1074
1075         [GTK] Epiphany does not make connections in Incognito Mode after clearing .cache
1076         https://bugs.webkit.org/show_bug.cgi?id=216430
1077
1078         Reviewed by Adrian Perez de Castro.
1079
1080         The problem is that when using an ephemeral context, the download is started before the ephemeral session has
1081         been registered in the network process, so it's just ignored.
1082
1083         * UIProcess/WebProcessPool.cpp:
1084         (WebKit::WebProcessPool::createDownloadProxy): Pass the given WebsiteDataStore to ensureNetworkProcess().
1085
1086 2020-09-18  Youenn Fablet  <youenn@apple.com>
1087
1088         Enable MediaRecorder by default on MacOS
1089         https://bugs.webkit.org/show_bug.cgi?id=216663
1090
1091         Reviewed by Eric Carlson.
1092
1093         * Shared/WebPreferencesDefaultValues.cpp:
1094         (WebKit::defaultMediaRecorderEnabled):
1095         * Shared/WebPreferencesDefaultValues.h:
1096         * Shared/WebPreferencesExperimental.yaml:
1097
1098 2020-09-17  Sam Weinig  <weinig@apple.com>
1099
1100         Remove runtime setting for enabling/disabling the UserTiming and ResourceTiming APIs
1101         https://bugs.webkit.org/show_bug.cgi?id=216556
1102
1103         Reviewed by Darin Adler.
1104
1105         Remove runtime setting for enabling/disabling UserTiming and ResourceTiming 
1106         APIs. They have both been on for a while in WebKit2 and there aren't any
1107         known uses cases for disabling them. In addition to removing the setting, 
1108         they are now enabled in LegacyWebKit as well.
1109
1110         * Shared/WebPreferences.yaml:
1111         * UIProcess/API/C/WKPreferences.cpp:
1112         (WKPreferencesSetUserTimingEnabled):
1113         (WKPreferencesGetUserTimingEnabled):
1114         (WKPreferencesSetResourceTimingEnabled):
1115         (WKPreferencesGetResourceTimingEnabled):
1116         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1117
1118 2020-09-16  Darin Adler  <darin@apple.com>
1119
1120         Selection API: Introduce LiveRangeSelectionEnabled, off by default
1121         https://bugs.webkit.org/show_bug.cgi?id=216656
1122
1123         Reviewed by Sam Weinig.
1124
1125         * Shared/WebPreferencesInternal.yaml: Added LiveRangeSelectionEnabled.
1126
1127 2020-09-17  Tim Horton  <timothy_horton@apple.com>
1128
1129         Per-app accent color overrides are broken
1130         https://bugs.webkit.org/show_bug.cgi?id=216674
1131         <rdar://problem/67745464>
1132
1133         Reviewed by Wenson Hsieh.
1134
1135         No new tests; I've no idea how to write a test that would have caught this;
1136         any test I can imagine would have also written to _accentColor and worked fine.
1137
1138         * UIProcess/mac/PageClientImplMac.mm:
1139         (WebKit::PageClientImpl::accentColor):
1140         AppKit changed the meaning of the IPI. Use the correct version.
1141         We still write to _accentColor; it is now purely an override.
1142
1143 2020-09-17  Kate Cheney  <katherine_cheney@apple.com>
1144
1145         Enable ITP in WKWebViews for apps with the full browser entitlement who are not linked to iOS 14.0
1146         https://bugs.webkit.org/show_bug.cgi?id=216655
1147         <rdar://problem/69081227>
1148
1149         Reviewed by Brent Fulgham.
1150
1151         Apps with the full browser entitlement who are not linked to iOS 14.0
1152         should have ITP enabled in WKWebViews by default.
1153
1154         No new tests, no way currently to test apps with different iOS
1155         versions. Tested manually.
1156
1157         * Shared/Cocoa/DefaultWebBrowserChecks.mm:
1158         (WebKit::determineITPStateInternal):
1159         Ignore the early return for the linked-on-or-after check if the
1160         app has the default browser entitlement so we still enable ITP based
1161         on the user's preference.
1162
1163 2020-09-17  David Kilzer  <ddkilzer@apple.com>
1164
1165         WebKit::XPCServiceEventHandler block should call exit() on the main thread
1166         <https://webkit.org/b/216594>
1167         <rdar://problem/68053217>
1168
1169         Reviewed by Chris Dumez.
1170
1171         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
1172         (WebKit::XPCServiceEventHandler):
1173         - Call exit() on the main thread. I chose dispatch_sync() here
1174           so that if other crashes occur on the main thread, we will
1175           know if this background thread is waiting to call exit() at
1176           the same time. Also, if a different background thread calls
1177           exit() in the future with this block running on the main
1178           thread, we'll know where the block came from since the XPC
1179           handler thread will be waiting for the dispatch_sync() to
1180           return (instead of having a mysterious block calling exit() on
1181           the main thread and not knowing where it came from).
1182         - Add logging (including simulated crash logs) when either of
1183           these exit() code paths is taken.
1184
1185 2020-09-17  Hoa Dinh  <dvh@apple.com>
1186
1187         Rename ShouldAllowExternalSchemes to ShouldAllowExternalSchemesButNotAppLinks to clarify what this enum value is for.
1188         https://bugs.webkit.org/show_bug.cgi?id=216651
1189
1190         Reviewed by Alex Christensen.
1191
1192         Rename ShouldAllowExternalSchemes to ShouldAllowExternalSchemesButNotAppLinks and reflects the change where it's used.
1193
1194         Source/WebKit:
1195         * Shared/SessionState.cpp:
1196         (WebKit::isValidEnum):
1197         * UIProcess/API/APINavigationAction.h:
1198         * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
1199         (toExternalURLsPolicy):
1200         (toWebCoreExternalURLsPolicy):
1201         * UIProcess/WebPageProxy.h:
1202         * UIProcess/mac/LegacySessionStateCoding.cpp:
1203         (WebKit::decodeSessionHistoryEntry):
1204         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
1205         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
1206
1207 2020-09-17  Sam Weinig  <weinig@apple.com>
1208
1209         We shouldn't need to specify a category for preferences now that they are split into separate files
1210         https://bugs.webkit.org/show_bug.cgi?id=216648
1211
1212         Reviewed by Tim Horton.
1213
1214         Remove need / ability to specify a category in the yaml, rather, infer the category
1215         from which file it is in.
1216
1217         * Scripts/GeneratePreferences.rb:
1218         * Shared/WebPreferencesDebug.yaml:
1219         * Shared/WebPreferencesExperimental.yaml:
1220         * Shared/WebPreferencesInternal.yaml:
1221
1222 2020-09-17  Antoine Quint  <graouts@webkit.org>
1223
1224         Remove the legacy animation code
1225         https://bugs.webkit.org/show_bug.cgi?id=216608
1226
1227         Reviewed by Dean Jackson.
1228
1229         Since we now have a single animation engine, the runtime flags to optionally enable the Web Animations engine are
1230         not needed anymore and are now removed.
1231
1232         * Shared/WebPreferencesExperimental.yaml:
1233         * UIProcess/API/C/WKPreferences.cpp:
1234         (WKPreferencesSetWebAnimationsEnabled): Deleted.
1235         (WKPreferencesGetWebAnimationsEnabled): Deleted.
1236         (WKPreferencesSetWebAnimationsCSSIntegrationEnabled): Deleted.
1237         (WKPreferencesGetWebAnimationsCSSIntegrationEnabled): Deleted.
1238         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1239         * UIProcess/API/Cocoa/WKPreferences.mm:
1240         (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]): Deleted.
1241         (-[WKPreferences _webAnimationsCSSIntegrationEnabled]): Deleted.
1242         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1243         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1244         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1245         (WebKit::InjectedBundle::setWebAnimationsEnabled): Deleted.
1246         (WebKit::InjectedBundle::setWebAnimationsCSSIntegrationEnabled): Deleted.
1247         * WebProcess/InjectedBundle/InjectedBundle.h:
1248
1249 2020-09-17  Rob Buis  <rbuis@igalia.com>
1250
1251         Clean up lazy frame loading
1252         https://bugs.webkit.org/show_bug.cgi?id=216560
1253
1254         Reviewed by Youenn Fablet.
1255
1256         Allow web preference to be consistent with lazy image loading.
1257
1258         * Shared/WebPreferencesExperimental.yaml:
1259
1260 2020-09-17  Jer Noble  <jer.noble@apple.com>
1261
1262         Unified build fix for "redefinition of 'kCMVideoCodecType_VP9"
1263         https://bugs.webkit.org/show_bug.cgi?id=216205
1264
1265         Reviewed by Youenn Fablet.
1266
1267         Wrap calls to WebCore VP9 functions in ENABLE(VP9) checks.
1268
1269         * UIProcess/WebPageProxy.cpp:
1270         (WebKit::WebPageProxy::creationParameters):
1271         * WebProcess/WebProcess.cpp:
1272         * WebProcess/WebProcess.h:
1273
1274 2020-09-16  Sam Weinig  <weinig@apple.com>
1275
1276         WebPreferences.yaml is overwhelming, what if we split it up a bit
1277         https://bugs.webkit.org/show_bug.cgi?id=216627
1278
1279         Reviewed by Tim Horton.
1280
1281         Split out experimental, internal and debug preferences into their own
1282         yaml files to add a bit of order.
1283
1284         * CMakeLists.txt:
1285         * DerivedSources.make:
1286         * Shared/WebPreferences.yaml:
1287         * Shared/WebPreferencesDebug.yaml: Copied from Source/WebKit/Shared/WebPreferences.yaml.
1288         * Shared/WebPreferencesExperimental.yaml: Copied from Source/WebKit/Shared/WebPreferences.yaml.
1289         * Shared/WebPreferencesInternal.yaml: Copied from Source/WebKit/Shared/WebPreferences.yaml.
1290         * WebKit.xcodeproj/project.pbxproj:
1291
1292 2020-09-16  Kate Cheney  <katherine_cheney@apple.com>
1293
1294         Revert _setIgnoresAppBoundDomains SPI to compile for macOS
1295         https://bugs.webkit.org/show_bug.cgi?id=216628
1296         <rdar://problem/69025655>
1297
1298         Reviewed by Tim Horton.
1299
1300         We need to give users of the _setIgnoresAppBoundDomains SPI time to
1301         convert uses to iOS only, so in the meantime we should still compile
1302         the SPI for macOS so we don't break anything.
1303
1304         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1305         (-[WKWebViewConfiguration _ignoresAppBoundDomains]):
1306         (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]):
1307         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1308
1309 2020-09-16  Sam Weinig  <weinig@apple.com>
1310
1311         Remove runtime setting for enabling/disabling CSS shadow parts
1312         https://bugs.webkit.org/show_bug.cgi?id=216567
1313
1314         Reviewed by Tim Horton.
1315
1316         Remove runtime setting for enabling/disabling CSS shadow parts. It is
1317         on by default and there is no known reason one would need to disable it.
1318
1319         * Shared/WebPreferences.yaml:
1320
1321 2020-09-16  Sam Weinig  <weinig@apple.com>
1322
1323         Remove runtime setting for enabling/disabling the isSecureContext API?
1324         https://bugs.webkit.org/show_bug.cgi?id=216562
1325
1326         Reviewed by Darin Adler.
1327
1328         Remove runtime setting for enabling/disabling the the isSecureContext attribute. 
1329         on window and the worker global scope. There is no known reason one would need 
1330         to disable it.
1331
1332         * Shared/WebPreferences.yaml:
1333         * UIProcess/API/C/WKPreferences.cpp:
1334         (WKPreferencesSetIsSecureContextAttributeEnabled):
1335         (WKPreferencesGetIsSecureContextAttributeEnabled):
1336         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1337         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1338         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1339
1340 2020-09-16  Youenn Fablet  <youenn@apple.com>
1341
1342         RemoteSampleBufferDisplayLayer should process its IPC messages from a background thread
1343         https://bugs.webkit.org/show_bug.cgi?id=216475
1344
1345         Reviewed by Eric Carlson.
1346
1347         Use a process wide work queue to process all track video renderer messages in a background thread.
1348         This queue is shared by all RemoteSampleBufferDisplayLayerManager and RemoteSampleBufferDisplayLayer objects, which are per web process.
1349         Since LocalSampleBufferDisplayLayer must currently be created in main thread, hop to main thread to create/delete renderers.
1350
1351         We update messages.py to support WantsAsyncDispatchMessage, which removes the sync handling with dispatchMessage.
1352         This allows RemoteSampleBufferDisplayLayerManager to also handle messages from RemoteSampleBufferDisplayLayer.
1353         Update RemoteSampleBufferDisplayLayerManager accordingly as well.
1354
1355         Covered by webrtc/video.html with GPU process enabled.
1356
1357         * GPUProcess/GPUConnectionToWebProcess.cpp:
1358         (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
1359         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
1360         * GPUProcess/GPUConnectionToWebProcess.h:
1361         * GPUProcess/GPUProcess.cpp:
1362         (WebKit::GPUProcess::videoMediaStreamTrackRendererQueue):
1363         * GPUProcess/GPUProcess.h:
1364         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp:
1365         (WebKit::RemoteAudioMediaStreamTrackRendererManager::dispatchMessage):
1366         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h:
1367         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.messages.in:
1368         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp:
1369         (WebKit::RemoteSampleBufferDisplayLayerManager::RemoteSampleBufferDisplayLayerManager):
1370         (WebKit::RemoteSampleBufferDisplayLayerManager::~RemoteSampleBufferDisplayLayerManager):
1371         (WebKit::RemoteSampleBufferDisplayLayerManager::close):
1372         (WebKit::RemoteSampleBufferDisplayLayerManager::dispatchToThread):
1373         (WebKit::RemoteSampleBufferDisplayLayerManager::dispatchMessage):
1374         (WebKit::RemoteSampleBufferDisplayLayerManager::createLayer):
1375         (WebKit::RemoteSampleBufferDisplayLayerManager::releaseLayer):
1376         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:
1377         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in:
1378         * Scripts/webkit/messages.py:
1379         * SourcesCocoa.txt:
1380
1381 2020-09-16  Alex Christensen  <achristensen@webkit.org>
1382
1383         Move TLS certificate bypass SPI from WebProcessPool to WebsiteDataStore
1384         https://bugs.webkit.org/show_bug.cgi?id=216585
1385
1386         Reviewed by Geoffrey Garen.
1387
1388         It will eventually be replaced by WKNavigationDelegate's didReceiveAuthenticationChallenge in rdar://30655740
1389         but the SPI needs to continue to exist somewhere until that is complete.
1390         In the meantime, it needs to be moved from the WebProcessPool for https://bugs.webkit.org/show_bug.cgi?id=216041
1391         and rdar://problem/68942815 tracks Safari's adoption of the SPI introduced here, which I will fix within an hour of landing this.
1392
1393         * UIProcess/API/C/WKContext.cpp:
1394         (WKContextAllowSpecificHTTPSCertificateForHost):
1395         * UIProcess/API/C/WKContextPrivate.h:
1396         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1397         (-[WKProcessGroup _setAllowsSpecificHTTPSCertificate:forHost:]): Deleted.
1398         * UIProcess/API/Cocoa/WKProcessGroupPrivate.h:
1399         * UIProcess/API/Cocoa/WKProcessPool.mm:
1400         (-[WKProcessPool _setAllowsSpecificHTTPSCertificate:forHost:]):
1401         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1402         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1403         (-[WKWebsiteDataStore _allowTLSCertificate:forHost:]):
1404         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1405         * UIProcess/API/glib/WebKitWebContext.cpp:
1406         (webkit_web_context_allow_tls_certificate_for_host):
1407         Use the default data store until this API can be replaced by API in a different place.
1408         * UIProcess/WebProcessPool.cpp:
1409         (WebKit::WebProcessPool::allowSpecificHTTPSCertificateForHost): Deleted.
1410         * UIProcess/WebProcessPool.h:
1411         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1412         (WebKit::WebsiteDataStore::allowSpecificHTTPSCertificateForHost):
1413         * UIProcess/WebsiteData/WebsiteDataStore.h:
1414
1415 2020-09-16  Alex Christensen  <achristensen@webkit.org>
1416
1417         Remove unneeded HAVE_FOUNDATION_WITH_SAVE_COOKIES_WITH_COMPLETION_HANDLER
1418         https://bugs.webkit.org/show_bug.cgi?id=216572
1419
1420         Reviewed by Youenn Fablet.
1421
1422         It's available everywhere we support.
1423
1424         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1425         (WebKit::saveCookies):
1426         (WebKit::NetworkProcess::platformFlushCookies):
1427
1428 2020-09-16  Youenn Fablet  <youenn@apple.com>
1429
1430         Move LibWebRTCCodecsProxy message handling out of the main thread
1431         https://bugs.webkit.org/show_bug.cgi?id=216531
1432
1433         Reviewed by Eric Carlson.
1434
1435         Use a process wide work queue to process all LibWebRTCCodecsProxy messages in a background thread.
1436         This queue is shared by all LibWebRTCCodecsProxy objects, which are per web process.
1437         Covered by webrtc/video.html with GPU process enabled.
1438
1439         * GPUProcess/GPUConnectionToWebProcess.cpp:
1440         (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
1441         (WebKit::GPUConnectionToWebProcess::~GPUConnectionToWebProcess):
1442         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
1443         (WebKit::GPUConnectionToWebProcess::libWebRTCCodecsProxy): Deleted.
1444         * GPUProcess/GPUConnectionToWebProcess.h:
1445         * GPUProcess/GPUProcess.cpp:
1446         (WebKit::GPUProcess::libWebRTCCodecsQueue):
1447         * GPUProcess/GPUProcess.h:
1448         * GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
1449         (WebKit::LibWebRTCCodecsProxy::create):
1450         (WebKit::LibWebRTCCodecsProxy::didReceiveMessageFromWebProcess): Deleted.
1451         * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
1452         (WebKit::LibWebRTCCodecsProxy::LibWebRTCCodecsProxy):
1453         (WebKit::LibWebRTCCodecsProxy::~LibWebRTCCodecsProxy):
1454         (WebKit::LibWebRTCCodecsProxy::dispatchToThread):
1455         (WebKit::LibWebRTCCodecsProxy::close):
1456
1457 2020-09-16  Adrian Perez de Castro  <aperez@igalia.com>
1458
1459         Non-unified build fixes, early September 2020 edition
1460         https://bugs.webkit.org/show_bug.cgi?id=216599
1461
1462         Unreviewed build fix.
1463
1464         Largely based on a patch by Lauro Moura <lmoura@igalia.com>
1465
1466         * GPUProcess/media/RemoteCDMProxy.cpp: Add missing WebCore/SharedBuffer.h include.
1467         * GPUProcess/media/RemoteMediaResourceLoader.cpp: Add missing WebCore/ResourceError.h
1468         include.
1469         * NetworkProcess/webrtc/NetworkRTCProvider.cpp: Add missing DataReference.h include.
1470         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp:
1471         (WebKit::WebDataListSuggestionsDropdownGtk::show): Add missing namespace to
1472         WebCore::monitorWorkArea() call.
1473         * WebProcess/Network/WebSocketChannelManager.cpp: Add missing
1474         WebCore/WebSocketIdentifier.h include.
1475         (WebKit::WebSocketChannelManager::didReceiveMessage): Add missing namespace to
1476         WebCore::WebSocketIdentifierType usage.
1477
1478 2020-09-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
1479
1480         REGRESSION(r266677): ASSERTION FAILED in PaintFrequencyTracker::end()
1481         https://bugs.webkit.org/show_bug.cgi?id=216591
1482         <rdar://problem/68635418>
1483
1484         Reviewed by Simon Fraser.
1485
1486         timestampForPaintFrequencyTracking() do not have to be in ChromeClient.
1487         RenderLayer can access it through its page(). No need to special case
1488         isSVGImageChromeClient() because we are going to track the painting that
1489         goes through Page::updateRendering(). This means all the painting of the
1490         SVG image RenderLayers will be tracked by the same timestamp. Currently 
1491         we do not support compositing inside the SVG image which means there is
1492         only one RenderLayer per SVG image.
1493
1494         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1495         (WebKit::WebChromeClient::timestampForPaintFrequencyTracking const): Deleted.
1496         * WebProcess/WebCoreSupport/WebChromeClient.h:
1497
1498 2020-09-15  Aditya Keerthi  <akeerthi@apple.com>
1499
1500         [macOS] Date pickers should respect the document's color scheme
1501         https://bugs.webkit.org/show_bug.cgi?id=216514
1502         <rdar://problem/68889548>
1503
1504         Reviewed by Tim Horton.
1505
1506         Use the appearance property of NSWindow to ensure the appearance of the
1507         contained NSDatePicker matches the value encoded in DateTimeChooserParameters.
1508
1509         * UIProcess/mac/WebDateTimePickerMac.mm:
1510         (-[WKDateTimePicker initWithParams:inView:]):
1511
1512 2020-09-15  Alex Christensen  <achristensen@webkit.org>
1513
1514         Move local storage sync SPI from WebProcessPool to WebsiteDataStore
1515         https://bugs.webkit.org/show_bug.cgi?id=216581
1516
1517         Reviewed by Geoffrey Garen.
1518
1519         This move is needed for https://bugs.webkit.org/show_bug.cgi?id=216041
1520         We no longer need to sync the legacy private browsing storage because it is no longer used by WebKitTestRunner.  Thank goodness.
1521
1522         * NetworkProcess/NetworkProcess.cpp:
1523         (WebKit::NetworkProcess::clearLegacyPrivateBrowsingLocalStorage): Deleted.
1524         * NetworkProcess/NetworkProcess.h:
1525         * NetworkProcess/NetworkProcess.messages.in:
1526         * UIProcess/API/C/WKContext.cpp:
1527         (WKContextSyncLocalStorage): Deleted.
1528         (WKContextClearLegacyPrivateBrowsingLocalStorage): Deleted.
1529         * UIProcess/API/C/WKContextPrivate.h:
1530         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1531         (WKWebsiteDataStoreSyncLocalStorage):
1532         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1533         * UIProcess/WebProcessPool.cpp:
1534         (WebKit::WebProcessPool::syncLocalStorage): Deleted.
1535         (WebKit::WebProcessPool::clearLegacyPrivateBrowsingLocalStorage): Deleted.
1536         * UIProcess/WebProcessPool.h:
1537         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1538         (WebKit::WebsiteDataStore::syncLocalStorage):
1539         * UIProcess/WebsiteData/WebsiteDataStore.h:
1540
1541 2020-09-15  Alex Christensen  <achristensen@webkit.org>
1542
1543         Move service worker testing timeout setting from WebProcessPool to WebsiteDataStore
1544         https://bugs.webkit.org/show_bug.cgi?id=216578
1545
1546         Reviewed by Geoffrey Garen.
1547
1548         This is needed for https://bugs.webkit.org/show_bug.cgi?id=216041
1549
1550         * UIProcess/API/C/WKContext.cpp:
1551         (WKContextSetServiceWorkerFetchTimeoutForTesting): Deleted.
1552         (WKContextResetServiceWorkerFetchTimeoutForTesting): Deleted.
1553         * UIProcess/API/C/WKContext.h:
1554         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1555         (WKWebsiteDataStoreSetServiceWorkerFetchTimeoutForTesting):
1556         (WKWebsiteDataStoreResetServiceWorkerFetchTimeoutForTesting):
1557         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1558         * UIProcess/WebProcessPool.cpp:
1559         (WebKit::WebProcessPool::setServiceWorkerTimeoutForTesting): Deleted.
1560         (WebKit::WebProcessPool::resetServiceWorkerTimeoutForTesting): Deleted.
1561         * UIProcess/WebProcessPool.h:
1562         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1563         (WebKit::WebsiteDataStore::setServiceWorkerTimeoutForTesting):
1564         (WebKit::WebsiteDataStore::resetServiceWorkerTimeoutForTesting):
1565         * UIProcess/WebsiteData/WebsiteDataStore.h:
1566
1567 2020-09-15  Peng Liu  <peng.liu6@apple.com>
1568
1569         REGRESSION (r267053): ASSERTION FAILED: videoFullscreenManager->client() == &_videoFullscreenManagerProxyClient in [WKFullScreenWindowController _completedExitFullScreen]
1570         https://bugs.webkit.org/show_bug.cgi?id=216571
1571
1572         Reviewed by Jer Noble.
1573
1574         It is possible that an element exits fullscreen before it completely enters
1575         fullscreen. In that case, the client of VideoFullscreenManagerProxy is nullptr.
1576
1577         No new tests, fixing an assertion failure when running
1578         TestWebKitAPI.WKWebViewCloseAllMediaPresentations.ElementFullscreen.
1579
1580         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1581         (-[WKFullScreenWindowController _completedExitFullScreen]):
1582
1583 2020-09-15  Sam Weinig  <weinig@apple.com>
1584
1585         Remove runtime setting for enabling/disabling the fetch API
1586         https://bugs.webkit.org/show_bug.cgi?id=216519
1587
1588         Reviewed by Alex Christensen.
1589
1590         Remove runtime setting for enabling/disabling the fetch API. There is no
1591         reason one needs to disable it now and it has been on by default for
1592         a long enough time.
1593
1594         Also cleans up WKPreferencesRefPrivate.h/WKPreferences.cpp to move all the obsolete
1595         preferences to the bottom with a comment about removing them when possible.
1596
1597         * Shared/WebPreferences.yaml:
1598         * UIProcess/API/C/WKPreferences.cpp:
1599         (WKPreferencesResetTestRunnerOverrides):
1600         (WKPreferencesSetPrivateBrowsingEnabled):
1601         (WKPreferencesGetPrivateBrowsingEnabled):
1602         (WKPreferencesSetIgnoreViewportScalingConstraints):
1603         (WKPreferencesGetIgnoreViewportScalingConstraints):
1604         (WKPreferencesSetWebRTCLegacyAPIEnabled):
1605         (WKPreferencesGetWebRTCLegacyAPIEnabled):
1606         (WKPreferencesSetNewBlockInsideInlineModelEnabled):
1607         (WKPreferencesGetNewBlockInsideInlineModelEnabled):
1608         (WKPreferencesSetLongMousePressEnabled):
1609         (WKPreferencesGetLongMousePressEnabled):
1610         (WKPreferencesSetAntialiasedFontDilationEnabled):
1611         (WKPreferencesGetAntialiasedFontDilationEnabled):
1612         (WKPreferencesSetHixie76WebSocketProtocolEnabled):
1613         (WKPreferencesGetHixie76WebSocketProtocolEnabled):
1614         (WKPreferencesSetApplicationChromeModeEnabled):
1615         (WKPreferencesGetApplicationChromeModeEnabled):
1616         (WKPreferencesSetInspectorUsesWebKitUserInterface):
1617         (WKPreferencesGetInspectorUsesWebKitUserInterface):
1618         (WKPreferencesSetFetchAPIEnabled):
1619         (WKPreferencesGetFetchAPIEnabled):
1620         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1621
1622 2020-09-15  Sam Weinig  <weinig@apple.com>
1623
1624         Remove runtime setting for enabling/disabling custom elements
1625         https://bugs.webkit.org/show_bug.cgi?id=216518
1626
1627         Reviewed by Tim Horton.
1628
1629         Remove runtime setting for enabling/disabling custom elements. There is no
1630         reason one need to disable it now, and it has been on by default for
1631         a long enough time.
1632
1633         * Shared/WebPreferences.yaml:
1634
1635 2020-09-15  Simon Fraser  <simon.fraser@apple.com>
1636
1637         REGRESSION (r267002): ASSERTION FAILED:[ iOS wk2 Debug ] !HashTranslator::equal(KeyTraits::emptyValue(), key) on compositing/ios/overflow-scroll-update-overlap.html
1638         https://bugs.webkit.org/show_bug.cgi?id=216520
1639         <rdar://problem/68894931>
1640
1641         Reviewed by Tim Horton.
1642
1643         Avoid hash lookups with zero nodeIDs.
1644
1645         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
1646         (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const):
1647         (WebKit::RemoteScrollingCoordinator::isUserScrollInProgress const):
1648         (WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress const):
1649
1650 2020-09-15  Alex Christensen  <achristensen@webkit.org>
1651
1652         Move WKContextClearCachedCredentials SPI to WKWebsiteDataStoreClearCachedCredentials
1653         https://bugs.webkit.org/show_bug.cgi?id=216513
1654
1655         Reviewed by Chris Dumez.
1656
1657         The credentials are owned by session anyways.
1658         This is needed for https://bugs.webkit.org/show_bug.cgi?id=216041
1659
1660         * NetworkProcess/NetworkProcess.cpp:
1661         (WebKit::NetworkProcess::clearCachedCredentials):
1662         * NetworkProcess/NetworkProcess.h:
1663         * NetworkProcess/NetworkProcess.messages.in:
1664         * UIProcess/API/C/WKContext.cpp:
1665         (WKContextClearCachedCredentials): Deleted.
1666         * UIProcess/API/C/WKContextPrivate.h:
1667         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1668         (WKWebsiteDataStoreClearCachedCredentials):
1669         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1670         * UIProcess/WebProcessPool.cpp:
1671         (WebKit::WebProcessPool::clearCachedCredentials):
1672         * UIProcess/WebProcessPool.h:
1673         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1674         (WebKit::WebsiteDataStore::clearCachedCredentials):
1675         * UIProcess/WebsiteData/WebsiteDataStore.h:
1676
1677 2020-09-15  Alex Christensen  <achristensen@webkit.org>
1678
1679         Remove unused plumbing for setting whether the storage access API is enabled
1680         https://bugs.webkit.org/show_bug.cgi?id=216516
1681
1682         Reviewed by Youenn Fablet.
1683
1684         * NetworkProcess/NetworkProcess.h:
1685         * NetworkProcess/NetworkProcess.messages.in:
1686         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1687         (WebKit::NetworkProcessCreationParameters::encode const):
1688         (WebKit::NetworkProcessCreationParameters::decode):
1689         * NetworkProcess/NetworkProcessCreationParameters.h:
1690         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1691         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1692         (WebKit::NetworkProcess::setStorageAccessAPIEnabled): Deleted.
1693         * UIProcess/API/C/WKContext.cpp:
1694         (WKContextSetStorageAccessAPIEnabled): Deleted.
1695         * UIProcess/API/C/WKContext.h:
1696         * UIProcess/API/C/WKCookieManager.cpp:
1697         (WKCookieManagerSetStorageAccessAPIEnabled): Deleted.
1698         * UIProcess/API/C/WKCookieManager.h:
1699         * UIProcess/API/Cocoa/WKProcessPool.mm:
1700         (-[WKProcessPool _isStorageAccessAPIEnabled]): Deleted.
1701         (-[WKProcessPool _setStorageAccessAPIEnabled:]): Deleted.
1702         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1703         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1704         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1705         * UIProcess/WebProcessPool.cpp:
1706         (WebKit::WebProcessPool::setStorageAccessAPIEnabled): Deleted.
1707         * UIProcess/WebProcessPool.h:
1708
1709 2020-09-15  Alex Christensen  <achristensen@webkit.org>
1710
1711         Move WebSocket TLS bypass SPI from WebProcessPool to WebsiteDataStore
1712         https://bugs.webkit.org/show_bug.cgi?id=216509
1713
1714         Reviewed by Youenn Fablet.
1715
1716         After https://bugs.webkit.org/show_bug.cgi?id=216041 we will be unable to determine which WebsiteDataStore's
1717         NetworkProcess to add the TLS bypass to, so we need to move the SPI to the WebsiteDataStore object.  This breaks
1718         off a piece of that large change into a small, easy-to-review change.
1719
1720         * UIProcess/API/C/WKContext.cpp:
1721         (WKContextSetAllowsAnySSLCertificateForWebSocketTesting): Deleted.
1722         * UIProcess/API/C/WKContextPrivate.h:
1723         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1724         (WKWebsiteDataStoreSetAllowsAnySSLCertificateForWebSocketTesting):
1725         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1726         * UIProcess/API/Cocoa/WKProcessPool.mm:
1727         (-[WKProcessPool _allowAnyTLSCertificateForWebSocketTesting]): Deleted.
1728         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1729         * UIProcess/WebProcessPool.cpp:
1730         (WebKit::WebProcessPool::setAllowsAnySSLCertificateForWebSocket): Deleted.
1731         * UIProcess/WebProcessPool.h:
1732         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1733         (WebKit::WebsiteDataStore::setAllowsAnySSLCertificateForWebSocket):
1734         * UIProcess/WebsiteData/WebsiteDataStore.h:
1735
1736 2020-09-15  Aditya Keerthi  <akeerthi@apple.com>
1737
1738         [macOS] Update date picker appearance to match system date pickers
1739         https://bugs.webkit.org/show_bug.cgi?id=216517
1740         <rdar://problem/68890678>
1741
1742         Reviewed by Wenson Hsieh.
1743
1744         System date pickers in macOS do not use NSVisualEffectView. Instead, use
1745         a solid background view with three rounded corners.
1746
1747         * UIProcess/mac/WebDateTimePickerMac.mm:
1748         (-[WKDateTimePickerWindow initWithContentRect:styleMask:backing:defer:]):
1749         (-[WKDateTimePickerBackdropView drawRect:]):
1750         (-[WKDateTimePicker initWithParams:inView:]):
1751
1752 2020-09-15  Rob Buis  <rbuis@igalia.com>
1753
1754         Convert runtime flag to setting for lazy image loading
1755         https://bugs.webkit.org/show_bug.cgi?id=215610
1756
1757         Reviewed by Youenn Fablet.
1758
1759         Remove lazy image loading runtime flag.
1760
1761         * UIProcess/API/C/WKPreferences.cpp:
1762         (WKPreferencesSetLazyImageLoadingEnabled): Deleted.
1763         (WKPreferencesGetLazyImageLoadingEnabled): Deleted.
1764         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1765
1766 2020-09-15  Youenn Fablet  <youenn@apple.com>
1767
1768         End of media capture should not be reported before 3 seconds of the start of capture
1769         https://bugs.webkit.org/show_bug.cgi?id=216415
1770         <rdar://problem/68512358>
1771
1772         Reviewed by Eric Carlson.
1773
1774         Add support for delaying of end of capture notification to the application.
1775         This allows to ensure that a capture indicator stays for long enough for the user to notice it.
1776         A capture indicator should be visible to the user for at least three seconds.
1777
1778         A timer is scheduled when starting a capture and there is no ongoing capture.
1779         As long as the timer is active, the capture state cannot be transitioned to no capture.
1780         Other transitions are allowed.
1781         Once the timer kicks in, any capture state update is done synchronously.
1782         Ensure to update the capture state when the timer kicks in.
1783
1784         Note that even navigations will not allow transitioning the capture state sooner.
1785         This is done to ensure a page does not try to capture one frame before navigating to another page.
1786         In practice, very few pages should navigate quickly after starting capture.
1787
1788         * UIProcess/API/C/WKPage.cpp:
1789         (WKPageGetMediaState):
1790         (WKPageSetMediaCaptureReportingDelayForTesting):
1791         * UIProcess/API/C/WKPagePrivate.h:
1792         * UIProcess/API/Cocoa/WKWebView.mm:
1793         (-[WKWebView _mediaCaptureState]):
1794         * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
1795         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
1796         (-[WKWebView _mediaCaptureReportingDelayForTesting]):
1797         (-[WKWebView _setMediaCaptureReportingDelayForTesting:]):
1798         * UIProcess/WebPageProxy.cpp:
1799         (WebKit::WebPageProxy::updatePlayingMediaDidChange):
1800         (WebKit::WebPageProxy::updateReportedMediaCaptureState):
1801         * UIProcess/WebPageProxy.h:
1802         (WebKit::WebPageProxy::reportedMediaCaptureState const):
1803         (WebKit::WebPageProxy::mediaCaptureReportingDelay const):
1804         (WebKit::WebPageProxy::setMediaCaptureReportingDelay):
1805
1806 2020-09-15  Youenn Fablet  <youenn@apple.com>
1807
1808         Enable VP9 in GPUProcess if page needs it
1809         https://bugs.webkit.org/show_bug.cgi?id=216472
1810
1811         Reviewed by Eric Carlson.
1812
1813         In case a page is using GPUProcess for media, send the VP9 parameters to GPUProcess.
1814         GPUProcess will enable VP9 decoders based on that input.
1815         Covered by LayoutTests/media/vp9.html with GPU process enabled.
1816
1817         * GPUProcess/GPUConnectionToWebProcess.cpp:
1818         (WebKit::GPUConnectionToWebProcess::enableVP9Decoders):
1819         * GPUProcess/GPUConnectionToWebProcess.h:
1820         * GPUProcess/GPUConnectionToWebProcess.messages.in:
1821         * GPUProcess/GPUProcess.cpp:
1822         (WebKit::GPUProcess::enableVP9Decoders):
1823         * GPUProcess/GPUProcess.h:
1824         * WebProcess/GPU/GPUProcessConnection.cpp:
1825         (WebKit::GPUProcessConnection::updateParameters):
1826         * WebProcess/GPU/GPUProcessConnection.h:
1827         * WebProcess/WebPage/WebPage.cpp:
1828         (WebKit::m_limitsNavigationsToAppBoundDomains):
1829
1830 2020-09-14  Sam Weinig  <weinig@apple.com>
1831
1832         Remove runtime setting for enabling/disabling ShadowDOM
1833         https://bugs.webkit.org/show_bug.cgi?id=216511
1834
1835         Reviewed by Ryosuke Niwa.
1836
1837         Remove runtime setting for enabling/disabling ShadowDOM. There is no
1838         reason one need to disable it now, and it has been on by default for
1839         a long enough time.
1840
1841         * Shared/WebPreferences.yaml:
1842
1843 2020-09-14  Aditya Keerthi  <akeerthi@apple.com>
1844
1845         [macOS] Do not dismiss date picker when a value is selected
1846         https://bugs.webkit.org/show_bug.cgi?id=216515
1847         <rdar://problem/68889944>
1848
1849         Reviewed by Darin Adler.
1850
1851         The calendar presented when activating a date input should not be
1852         dismissed after the user selects a date. This matches the behavior
1853         of date pickers in Calendar.app.
1854
1855         * UIProcess/mac/WebDateTimePickerMac.mm:
1856         (WebKit::WebDateTimePickerMac::didChooseDate):
1857
1858 2020-09-14  Peng Liu  <peng.liu6@apple.com>
1859
1860         Returning to element fullscreen from PiP is not stable under stress tests
1861         https://bugs.webkit.org/show_bug.cgi?id=216287
1862
1863         Reviewed by Jer Noble.
1864
1865         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1866         (WebKit::VideoFullscreenManagerProxyClient::~VideoFullscreenManagerProxyClient):
1867         (WebKit::VideoFullscreenManagerProxy::setClient):
1868         (WebKit::VideoFullscreenManagerProxy::client const):
1869         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1870         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
1871         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
1872         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
1873         (WebKit::VideoFullscreenManagerProxy::hasVideoInPictureInPictureDidChange):
1874         (WebKit::VideoFullscreenManagerProxy::fullscreenMayReturnToInline):
1875         (WebKit::VideoFullscreenModelContext::prepareToExitFullscreen): Deleted.
1876         Add the interface VideoFullscreenManagerProxyClient, which is used by WKFullScreenWindowController
1877         to implement the support of "returning to element fullscreen from PiP". Using VideoFullscreenModelClient
1878         for that purpose is not a good idea because the instance observed by VideoFullscreenModelClient may be
1879         destroyed when a video element is exiting picture-in-picture if we don't call
1880         VideoFullscreenManagerProxy::addClientForContext() and VideoFullscreenManagerProxy::removeClientForContext()
1881         properly.
1882
1883         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1884         (-[WKFullScreenWindowController initWithWebView:]):
1885         (-[WKFullScreenWindowController dealloc]):
1886         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
1887         (-[WKFullScreenWindowController _completedExitFullScreen]):
1888         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
1889         (-[WKFullScreenWindowController prepareToExitPictureInPicture]):
1890         (-[WKFullScreenWindowController didExitPictureInPicture]):
1891         (-[WKFullScreenWindowController _videoFullscreenManager]):
1892         (WKFullScreenWindowControllerVideoFullscreenModelClient::setParent): Deleted.
1893         (WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): Deleted.
1894         (WKFullScreenWindowControllerVideoFullscreenModelClient::interface const): Deleted.
1895         (-[WKFullScreenWindowController willEnterPictureInPicture]): Deleted.
1896         (-[WKFullScreenWindowController failedToEnterPictureInPicture]): Deleted.
1897         Use VideoFullscreenManagerProxyClient instead of VideoFullscreenModelClient to implement
1898         the support of "returning to element fullscreen from PiP" on iOS.
1899         A user can "return to element fullscreen from PiP" by clicking the "return to fullscreen"
1900         button on the PiP window, or by clicking the "fullscreen" button on the page. This patch
1901         adds support for the latter case.
1902
1903         * UIProcess/mac/WKFullScreenWindowController.h:
1904         * UIProcess/mac/WKFullScreenWindowController.mm:
1905         (-[WKFullScreenWindowController initWithWindow:webView:page:]):
1906         (-[WKFullScreenWindowController dealloc]):
1907         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
1908         (-[WKFullScreenWindowController didExitPictureInPicture]):
1909         (-[WKFullScreenWindowController windowDidEnterFullScreen:]):
1910         (-[WKFullScreenWindowController _videoFullscreenManager]):
1911         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setParent): Deleted.
1912         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): Deleted.
1913         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::interface const): Deleted.
1914         Use VideoFullscreenManagerProxyClient instead of VideoFullscreenModelClient to implement the
1915         support of "exiting fullscreen after entering PiP" on Mac. We may implement the support of
1916         "returning to element fullscreen from PiP" on Mac in the future.
1917
1918 2020-09-14  Alex Christensen  <achristensen@webkit.org>
1919
1920         Move cookie flushing SPI from WKProcessPool to WKHTTPCookieStore
1921         https://bugs.webkit.org/show_bug.cgi?id=216493
1922
1923         Reviewed by Chris Dumez.
1924
1925         In order for https://bugs.webkit.org/show_bug.cgi?id=216041 to be possible, our interface for flushing cookies to disk can't be
1926         on the WKProcessPool.  It should be with the other cookie operations, in WKHTTPCookieStore.
1927         AuxiliaryProcessProxy::sendWithAsyncReply takes care of the background assertion, so we remove that code from NetworkProcessProxy::syncAllCookies.
1928         rdar://problem/68872711 tracks adoption in Safari, which I will land within an hour of landing this to avoid cookie regressions.
1929
1930         * NetworkProcess/NetworkProcess.cpp:
1931         (WebKit::NetworkProcess::syncAllCookies):
1932         (WebKit::NetworkProcess::didSyncAllCookies): Deleted.
1933         * NetworkProcess/NetworkProcess.h:
1934         * NetworkProcess/NetworkProcess.messages.in:
1935         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1936         (WebKit::NetworkProcess::syncAllCookies):
1937         * UIProcess/API/APIHTTPCookieStore.cpp:
1938         (API::HTTPCookieStore::syncCookies):
1939         * UIProcess/API/APIHTTPCookieStore.h:
1940         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1941         (-[WKHTTPCookieStore _flushCookiesToDiskWithCompletionHandler:]):
1942         * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h:
1943         * UIProcess/API/Cocoa/WKProcessPool.mm:
1944         (-[WKProcessPool _syncNetworkProcessCookies]):
1945         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1946         * UIProcess/Network/NetworkProcessProxy.cpp:
1947         (WebKit::NetworkProcessProxy::didClose):
1948         (WebKit::NetworkProcessProxy::syncAllCookies):
1949         (WebKit::NetworkProcessProxy::didSyncAllCookies): Deleted.
1950         * UIProcess/Network/NetworkProcessProxy.h:
1951         * UIProcess/Network/NetworkProcessProxy.messages.in:
1952         * UIProcess/WebProcessPool.cpp:
1953         (WebKit::WebProcessPool::syncCookies):
1954         (WebKit::WebProcessPool::syncNetworkProcessCookies): Deleted.
1955         * UIProcess/WebProcessPool.h:
1956         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1957         (WebKit::WebsiteDataStore::syncCookies):
1958         * UIProcess/WebsiteData/WebsiteDataStore.h:
1959
1960 2020-09-14  Fujii Hironori  <Hironori.Fujii@sony.com>
1961
1962         [WinCairo][MediaFoundation] r264188 introduced linker warning: LNK4199: /DELAYLOAD:mf.dll ignored; no imports found from mf.dll
1963         https://bugs.webkit.org/show_bug.cgi?id=214170
1964
1965         Reviewed by Alex Christensen.
1966
1967         * PlatformWin.cmake:
1968
1969 2020-09-14  Devin Rousso  <drousso@apple.com>
1970
1971         Web Inspector: docking buttons don't work when already docked if window is too small
1972         https://bugs.webkit.org/show_bug.cgi?id=216488
1973         <rdar://problem/68242717>
1974
1975         Reviewed by Timothy Hatcher.
1976
1977         * UIProcess/Inspector/WebInspectorProxy.cpp:
1978         (WebKit::WebInspectorProxy::attach):
1979         (WebKit::WebInspectorProxy::attachAvailabilityChanged):
1980         If Web Inspector is already attached, it can re-attach with a different configuration.
1981
1982 2020-09-14  Dean Jackson  <dino@apple.com>
1983
1984         Enable WebGL2 by default
1985         https://bugs.webkit.org/show_bug.cgi?id=216464
1986         <rdar://problem/68811378>
1987
1988         Reviewed by Sam Weinig.
1989
1990         Our WebGL2 implementation is in good enough shape that we should
1991         enable it by default for broader testing.
1992
1993         Remove "defaultWebGL2Enabled" since it wasn't being used anywhere.
1994
1995         * Shared/WebPreferences.yaml:
1996         * Shared/WebPreferencesDefaultValues.cpp:
1997         (WebKit::defaultWebGL2Enabled): Deleted.
1998         * Shared/WebPreferencesDefaultValues.h:
1999
2000 2020-09-14  Youenn Fablet  <youenn@apple.com>
2001
2002         RemoteAudioMediaStreamTrackRenderer should process its IPC messages from a background thread
2003         https://bugs.webkit.org/show_bug.cgi?id=216474
2004
2005         Reviewed by Eric Carlson.
2006
2007         Register RemoteAudioMediaStreamTrackRendererManager as a thread message receiver
2008         for both RemoteAudioMediaStreamTrackRenderer and RemoteAudioMediaStreamTrackRendererManager messages.
2009         All processing is sent to a high priority work queue.
2010         Given AudioMediaStreamTrackRendererUnit is not fully thread safe, we use a single WorkQueue for the whole GPUProcess.
2011         All operations will happen in this thread, while in WebProcess, create/start/stop/release are main thread.
2012
2013         We no longer compile the generated RemoteAudioMediaStreamTrackRendererManager::didReceiveMessage
2014         and instead implement our own version to handle manager and renderer messages.
2015
2016         Covered by WebRTC audio tests run with GPU process enabled.
2017
2018         * GPUProcess/GPUConnectionToWebProcess.cpp:
2019         (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
2020         (WebKit::GPUConnectionToWebProcess::~GPUConnectionToWebProcess):
2021         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
2022         * GPUProcess/GPUConnectionToWebProcess.h:
2023         * GPUProcess/GPUProcess.cpp:
2024         (WebKit::GPUProcess::audioMediaStreamTrackRendererQueue):
2025         * GPUProcess/GPUProcess.h:
2026         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h:
2027         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp:
2028         (WebKit::RemoteAudioMediaStreamTrackRendererManager::RemoteAudioMediaStreamTrackRendererManager):
2029         (WebKit::RemoteAudioMediaStreamTrackRendererManager::~RemoteAudioMediaStreamTrackRendererManager):
2030         (WebKit::RemoteAudioMediaStreamTrackRendererManager::close):
2031         (WebKit::RemoteAudioMediaStreamTrackRendererManager::dispatchToThread):
2032         (WebKit::RemoteAudioMediaStreamTrackRendererManager::didReceiveMessage):
2033         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h:
2034         * SourcesCocoa.txt:
2035
2036 2020-09-13  Simon Fraser  <simon.fraser@apple.com>
2037
2038         Overflow:scroll rubberbanding is interrupted by post-layout scrolling
2039         https://bugs.webkit.org/show_bug.cgi?id=216463
2040         <rdar://problem/67095741>
2041
2042         Reviewed by Darin Adler.
2043
2044         When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset.
2045         If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can 
2046         clamp the scroll offset, causing the rubberband to collapse which interferes with
2047         the user interaction. This happend on Gmail when composing a reply.
2048         
2049         Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer
2050         query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout()
2051         already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress()
2052         and isScrollSnapInProgress() work.
2053         
2054         This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding()
2055         was just based on when the timer was started and stopped, which did not match the
2056         implementation of ScrollController::isRubberBandInProgress(). Now ScrollController
2057         correctly notifies its clients when the rubberbanding state changes by updating that
2058         state whenever any of the conditions consulted in isRubberBandInProgressInternal() change.
2059
2060         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h:
2061         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
2062         (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const):
2063         (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged):
2064
2065 2020-09-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2066
2067         Add a key to the text manipulation userInfo dictionary indicating whether the translated item is on-screen
2068         https://bugs.webkit.org/show_bug.cgi?id=216452
2069         <rdar://problem/68785397>
2070
2071         Reviewed by Darin Adler.
2072
2073         Add `_WKTextManipulationTokenUserInfoVisibilityKey` and set its value to the value of the `isVisible` member in
2074         `ManipulationTokenInfo`. See WebCore ChangeLog for more details.
2075
2076         * UIProcess/API/Cocoa/WKWebView.mm:
2077         (createUserInfo):
2078         * UIProcess/API/Cocoa/_WKTextManipulationToken.h:
2079         * UIProcess/API/Cocoa/_WKTextManipulationToken.mm:
2080
2081 2020-09-13  Pablo Saavedra  <psaavedra@igalia.com>
2082
2083         [GTK][WPE] Build fails when -DENABLE_SERVICE_WORKER=OFF
2084         https://bugs.webkit.org/show_bug.cgi?id=216455
2085
2086         Unreviewed build fix.
2087
2088         * UIProcess/API/glib/WebKitWebsiteData.cpp:
2089         (recordContainsSupportedDataTypes):
2090         (toWebKitWebsiteDataTypes):
2091         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
2092         (toWebsiteDataTypes):
2093         * WebProcess/Network/WebLoaderStrategy.cpp:
2094         (WebKit::WebLoaderStrategy::scheduleLoad):
2095
2096 2020-09-11  Alex Christensen  <achristensen@webkit.org>
2097
2098         Move _setCookieAcceptPolicy to WKHTTPCookieStore
2099         https://bugs.webkit.org/show_bug.cgi?id=216375
2100
2101         Reviewed by Geoffrey Garen.
2102
2103         It is only used by Safari, which I am changing along with this in rdar://problem/68659937
2104         I need it to not be on the process pool for https://bugs.webkit.org/show_bug.cgi?id=216041
2105         and because the cookie store's job is to manage cookie storage.  The fact that it was on the process pool
2106         is just a historical artifact of us trying to make it global.
2107
2108         WKContextUseTestingNetworkSession has had its important parts replaced by WKWebsiteDataStoreConfigurationSetTestingSessionEnabled
2109         but it was still being used to determinte whether the UI process should persist the cookie accept policy.  We don't need this
2110         any more because we send a message to the network process and let it manage the cookie accept policy.
2111
2112         * UIProcess/API/C/WKContext.cpp:
2113         (WKContextUseTestingNetworkSession): Deleted.
2114         * UIProcess/API/C/WKContextPrivate.h:
2115         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
2116         (-[WKHTTPCookieStore _setCookieAcceptPolicy:completionHandler:]):
2117         * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h:
2118         * UIProcess/API/Cocoa/WKProcessPool.mm:
2119         (-[WKProcessPool _setCookieAcceptPolicy:]):
2120         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2121         * UIProcess/WebCookieManagerProxy.cpp:
2122         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
2123         * UIProcess/WebProcessPool.cpp:
2124         (WebKit::WebProcessPool::useTestingNetworkSession): Deleted.
2125         * UIProcess/WebProcessPool.h:
2126
2127 2020-09-11  Ben Nham  <nham@apple.com>
2128
2129         Fix undeclared identifier issue due to clashes in soft link headers
2130         https://bugs.webkit.org/show_bug.cgi?id=216412
2131
2132         Reviewed by Geoffrey Garen.
2133
2134         Use the workaround constant kPALFigPhotoContainerFormat_JFIF instead of the enum value
2135         kFigPhotoContainerFormat_JFIF.
2136
2137         * WebProcess/cocoa/WebProcessCocoa.mm:
2138         (WebKit::WebProcess::platformInitializeWebProcess):
2139
2140 2020-09-11  Jer Noble  <jer.noble@apple.com>
2141
2142         [iOS] Add Experimental setting to disable calling PID Inheritance API.
2143         https://bugs.webkit.org/show_bug.cgi?id=216387
2144         <rdar://problem/66286777>
2145
2146         Reviewed by Eric Carlson.
2147
2148         * Shared/WebPreferences.yaml:
2149
2150 2020-09-11  Kate Cheney  <katherine_cheney@apple.com>
2151
2152         Followup to Bug 215027: address comments to improve APP_BOUND_DOMAINS macro use
2153         https://bugs.webkit.org/show_bug.cgi?id=216373
2154         <rdar://problem/68645704>
2155
2156         Reviewed by Darin Adler.
2157
2158         Use a local variable to avoid awkward #if ENABLE() macro placement.
2159
2160         * NetworkProcess/NetworkProcess.cpp:
2161         (WebKit::NetworkProcess::swServerForSession):
2162
2163 2020-09-10  Joonghun Park  <jh718.park@samsung.com>
2164
2165         Unreviewed. Remove the build warning below since r266885.
2166         warning: redundant move in return statement [-Wredundant-move]
2167
2168         Because return statement already returns rvalue reference,
2169         we don't need WTFMove at return.
2170
2171         * UIProcess/Automation/WebAutomationSession.cpp:
2172         (WebKit::WebAutomationSession::getSessionPermissions):
2173
2174 2020-09-10  Ben Nham  <nham@apple.com>
2175
2176         Disable hardware JPEG decoding on x86 Mac
2177         https://bugs.webkit.org/show_bug.cgi?id=216377
2178
2179         Reviewed by Geoff Garen.
2180
2181         In Big Sur, ImageIO uses hardware JPEG decoding automatically for certain JPEGs. This caused
2182         a small regression in our battery life benchmark since the one-time setup cost for the
2183         decoder (~20-30 ms per process) was higher than the per-decode win we got from the HW decoder.
2184
2185         For now, we're reverting to the Catalina behavior of not using hardware JPEG on x86 Macs by
2186         calling a MediaToolbox SPI. (The tradeoffs for Apple Silicon are different so we use
2187         ImageIO's default heuristics on that architecture.) We plan to revisit this decision once we
2188         move to a GPUProcess world.
2189
2190         * WebProcess/cocoa/WebProcessCocoa.mm:
2191         (WebKit::WebProcess::platformInitializeWebProcess):
2192
2193 2020-09-10  Chris Dumez  <cdumez@apple.com>
2194
2195         Unreviewed, reverting r266842 and r266883.
2196
2197         Causes some assertions to be hit in debug builds
2198
2199         Reverted changesets:
2200
2201         "Some WebAudio tests give different output on different
2202         machines"
2203         https://bugs.webkit.org/show_bug.cgi?id=216371
2204         https://trac.webkit.org/changeset/266842
2205
2206         "Unreviewed Windows build fix after r266842."
2207         https://trac.webkit.org/changeset/266883
2208
2209 2020-09-09  Brian Burg  <bburg@apple.com>
2210
2211         Web Inspector: _WKInspectorDelegate should be attached to _WKInspector not WKWebView
2212         https://bugs.webkit.org/show_bug.cgi?id=215961
2213
2214         Reviewed by Devin Rousso.
2215
2216         Move _WKInspectorDelegate to be a property of _WKInspector. If there
2217         is no _WKInspector available (i.e. for iOS), the delegate cannot be set.
2218
2219         As part of this change, move -didAttachLocalInspector: back to UIDelegatePrivate.
2220         This delegate method is called just as the inspector is shown, so there would
2221         be no way to act upon this message if it were part of _WKInspectorDelegate.
2222         Now, -didAttachLocalInspector: is the designated time to attach _WKInspectorDelegate.
2223
2224         Covered by existing API tests.
2225
2226         * UIProcess/API/APIInspectorClient.h:
2227         (API::InspectorClient::browserDomainEnabled):
2228         (API::InspectorClient::browserDomainDisabled):
2229         (API::InspectorClient::didAttachLocalInspector): Deleted.
2230         * UIProcess/API/APIUIClient.h:
2231         (API::UIClient::didAttachLocalInspector):
2232         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2233         * UIProcess/API/Cocoa/WKWebView.mm:
2234         (-[WKWebView _initializeWithConfiguration:]):
2235         (-[WKWebView _inspectorDelegate]): Deleted.
2236         (-[WKWebView _setInspectorDelegate:]): Deleted.
2237         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2238         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2239         * UIProcess/API/Cocoa/_WKInspector.h:
2240         * UIProcess/API/Cocoa/_WKInspector.mm:
2241         (-[_WKInspector dealloc]): Added.
2242         (-[_WKInspector delegate]): Added.
2243         (-[_WKInspector setDelegate:]): Added. Since _WKInspector/WebInspectorProxy is always
2244         created internally instead of via ObjC initializer, we need to initialize ivars before
2245         using them, as there is no other place for them to be initialized.
2246
2247         * UIProcess/API/Cocoa/_WKInspectorDelegate.h:
2248         * UIProcess/API/Cocoa/_WKInspectorInternal.h:
2249         * UIProcess/Cocoa/UIDelegate.h:
2250         * UIProcess/Cocoa/UIDelegate.mm:
2251         (WebKit::UIDelegate::setDelegate):
2252         (WebKit::UIDelegate::UIClient::didAttachLocalInspector):
2253         * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp:
2254         (WebKit::InspectorBrowserAgent::enable):
2255         (WebKit::InspectorBrowserAgent::disable):
2256         * UIProcess/Inspector/Cocoa/InspectorDelegate.h:
2257         * UIProcess/Inspector/Cocoa/InspectorDelegate.mm:
2258         (WebKit::InspectorDelegate::InspectorDelegate):
2259         (WebKit::InspectorDelegate::setDelegate):
2260         (WebKit::InspectorDelegate::InspectorClient::browserDomainEnabled):
2261         (WebKit::InspectorDelegate::InspectorClient::browserDomainDisabled):
2262         (WebKit::InspectorDelegate::InspectorClient::didAttachLocalInspector): Deleted.
2263
2264         * UIProcess/Inspector/WebInspectorProxy.h:
2265         (WebKit::WebInspectorProxy::inspectorClient):
2266         * UIProcess/Inspector/WebInspectorProxy.cpp:
2267         (WebKit::WebInspectorProxy::WebInspectorProxy):
2268         (WebKit::WebInspectorProxy::setInspectorClient):
2269         (WebKit::WebInspectorProxy::openLocalInspectorFrontend):
2270         * UIProcess/WebPageProxy.h:
2271         (WebKit::WebPageProxy::inspectorClient): Deleted.
2272         * UIProcess/WebPageProxy.cpp:
2273         (WebKit::WebPageProxy::WebPageProxy):
2274         (WebKit::WebPageProxy::setInspectorClient): Deleted.
2275         Similar to the Cocoa SPI, move InspectorClient from WebPageProxy
2276         to WebInspectorProxy.
2277
2278 2020-09-10  Devin Rousso  <drousso@apple.com>
2279
2280         Web Inspector: modernize generated backend protocol code
2281         https://bugs.webkit.org/show_bug.cgi?id=216302
2282         <rdar://problem/68547649>
2283
2284         Reviewed by Brian Burg.
2285
2286         Previously, the inspector protocol was expressed in code in a somewhat confusing way:
2287          - the error string was the first argument
2288          - required parameters were `T` or `const T&`
2289          - optional parameters were `const T*`
2290          - enum parameters were the underlying type requiring the backend dispatcher handler to
2291            process it instead of it being preprocessed
2292          - required returns were `T&`
2293          - optional returns were `T*`
2294         This doesn't really make for easy/obvious reading of code since the order of arguments is
2295         not weird (e.g. error string first), and that there are references/pointers to primitive
2296         types.
2297
2298         This patch cleans up the generated inspector protocol code to be:
2299          - required parameters are `T` or `Ref<T>&&`
2300          - optional parameters are `Optional<T>&&` or `RefPtr<T>&&`
2301          - enum parameters are preprocessed and passed to the backend dispatcher handler if valid
2302          - synchronous commands return `Expected<X, ErrorString>` using the same types/rules above
2303            where `X` is either a single return or a `std::tuple` of multiple returns
2304
2305         The one exception to the above is `String`, which is already a tri-state of `nullString()`,
2306         `emptyString()`, and something set, so there's no need to use `Optional<String>`.
2307
2308         Also use `Protocol` objects/`typedefs` wherever possible to further relate the protocol
2309         JSON and the actual backend dispatcher handler implementation.
2310
2311         * UIProcess/Automation/Automation.json:
2312         `CoordinateSystem` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks
2313         for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` enum value now that enums are
2314         processed before being passed to backend dispacher handlers to preserve functionality.
2315
2316         * UIProcess/Inspector/Agents/InspectorBrowserAgent.h:
2317         * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp:
2318         * UIProcess/Automation/WebAutomationSessionMacros.h:
2319         * UIProcess/Automation/WebAutomationSession.h:
2320         * UIProcess/Automation/WebAutomationSession.cpp:
2321         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2322         Elided backend dispatcher handler changes describe above.
2323
2324         * UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
2325         (WebKit::RemoteInspectorClient::setTargetList):
2326         `JSON` classes now use `Ref&&` wherever possible and `Optional` instead of an out parameter
2327         for `get*`/`as*` so that values can be more easily manipulated and can be confidently known
2328         to exist.
2329
2330 2020-09-10  Chris Dumez  <cdumez@apple.com>
2331
2332         Unreviewed Windows build fix after r266842.
2333
2334         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2335         (WebKit::InjectedBundle::setHardwareSampleRateOverride):
2336
2337 2020-09-10  Sihui Liu  <sihui_liu@apple.com>
2338
2339         REGRESSION(r266634): [macOS release] 4 layout tests became flaky failures
2340         https://bugs.webkit.org/show_bug.cgi?id=216275
2341         <rdar://problem/68515242>
2342
2343         Reviewed by Tim Horton.
2344
2345         After r266634, activity state changes caused by adding/removing view will not be dispatched to web process until
2346         transaction is committed in UI process. To make sure web process picks up the changes, we need to invoke the 
2347         callbacks after activity state changes are dispatched.
2348
2349         * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
2350         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
2351         (-[WKWebView _doAfterActivityStateUpdate:]):
2352         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2353         (WebKit::WebPageProxy::addActivityStateUpdateCompletionHandler):
2354         * UIProcess/WebPageProxy.cpp:
2355         (WebKit::WebPageProxy::dispatchActivityStateChange):
2356         * UIProcess/WebPageProxy.h:
2357
2358 2020-09-10  Chris Dumez  <cdumez@apple.com>
2359
2360         Some WebAudio tests give different output on different machines
2361         https://bugs.webkit.org/show_bug.cgi?id=216371
2362
2363         Reviewed by Alex Christensen.
2364
2365         Add InjectedBundle SPI to set the hardware sample rate.
2366
2367         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2368         (WKBundleSetHardwareSampleRateOverride):
2369         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
2370         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2371         (WebKit::InjectedBundle::setHardwareSampleRateOverride):
2372         * WebProcess/InjectedBundle/InjectedBundle.h:
2373
2374 2020-09-10  Sihui Liu  <sihui_liu@apple.com>
2375
2376         REGRESSION(r266634): fast/animation/request-animation-frame-throttling-lowPowerMode.html is flaky
2377         https://bugs.webkit.org/show_bug.cgi?id=216261
2378         <rdar://problem/68513429>
2379
2380         Reviewed by Tim Horton.
2381
2382         r266634 makes a behavior change that when there is an activity state change, TiledCoreAnimationDrawingArea 
2383         schedules a rendering update. This breaks timed rendering update from ScriptedAnimationController in the 
2384         test. If rendering update happens before timer fires, the callback of ScriptedAnimationController will be 
2385         invoked earlier than expected, thus more callbacks executed in the same time frame.
2386
2387         To fix this, let's only schedule rendering update when we need to handle activity state change callbacks,
2388         as before r266634, where we don't schedule activity state timer if there is no callback.
2389
2390         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2391         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
2392
2393 2020-09-10  Tim Horton  <timothy_horton@apple.com>
2394
2395         Upstream additional linked-on-or-after version checks
2396         https://bugs.webkit.org/show_bug.cgi?id=216365
2397
2398         Reviewed by Sam Weinig.
2399
2400         * UIProcess/Cocoa/VersionChecks.h:
2401
2402 2020-09-10  Adrian Perez de Castro  <aperez@igalia.com>
2403
2404         [CMake] Use imported targets in find module for libseccomp
2405         https://bugs.webkit.org/show_bug.cgi?id=216329
2406
2407         Reviewed by Don Olmstead.
2408
2409         * PlatformGTK.cmake: Remove unneeded usage of LIBSECCOMP_INCLUDE_DIRS.
2410         * PlatformWPE.cmake: Take the Libseccomp::Libseccomp imported target into use.
2411
2412 2020-09-10  Aditya Keerthi  <akeerthi@apple.com>
2413
2414         [macOS] Add editability to input type=datetime-local
2415         https://bugs.webkit.org/show_bug.cgi?id=216311
2416
2417         Reviewed by Devin Rousso.
2418
2419         * UIProcess/mac/WebDateTimePickerMac.mm:
2420         (-[WKDateTimePicker initWithParams:inView:]):
2421
2422         Move initialization that relies on DateTimeChooserParameters to
2423         updatePicker: to reduce code duplication.
2424
2425         (-[WKDateTimePicker updatePicker:]):
2426         (-[WKDateTimePicker dateFormatStringForType:value:]):
2427
2428         datetime-local inputs can have three different formats. The default
2429         contains hour and minute fields, but second and millisecond fields 
2430         may also be present. Update this method to return the appropriate
2431         format string based on the current value of the input.
2432
2433         (-[WKDateTimePicker initialDateForEmptyValue]):
2434
2435         The initial value displayed on the picker when the input's value is
2436         empty should match the user's system time. Since the date picker
2437         maintains UTC time, return [NSDate date] with an appropriate offset.
2438
2439 2020-09-10  Kate Cheney  <katherine_cheney@apple.com>
2440
2441         Clean up App-Bound Domains code to only compile for iOS with its own macro
2442         https://bugs.webkit.org/show_bug.cgi?id=215027
2443         <rdar://problem/63688232>
2444
2445         Reviewed by Darin Adler.
2446
2447         App-bound domains code should only be compiled on iOS, so this patch
2448         adds additional '#if ENABLE()' checks to ensure that. Additionally,
2449         for clarity this patch creates a new APP_BOUND_DOMAINS macro and
2450         replaces existing IOS_FAMILY checks for App-Bound Domains code with
2451         this new macro.
2452
2453         LoadParameters, PolicyDecision and WKPreferences will be in another
2454         patch, this one is huge already.
2455
2456         No new tests, behavior should not change so testing is covered by
2457         all existing App-Bound Domains layout and API tests.
2458
2459         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2460         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2461         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2462         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
2463         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2464         * NetworkProcess/NetworkProcess.cpp:
2465         (WebKit::NetworkProcess::swServerForSession):
2466         * NetworkProcess/NetworkProcess.h:
2467         * NetworkProcess/NetworkProcess.messages.in:
2468         * NetworkProcess/NetworkSession.h:
2469         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2470         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2471         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2472         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
2473         * Shared/WebPageCreationParameters.cpp:
2474         (WebKit::WebPageCreationParameters::encode const):
2475         (WebKit::WebPageCreationParameters::decode):
2476         * Shared/WebPageCreationParameters.h:
2477         * UIProcess/API/APIHTTPCookieStore.cpp:
2478         (API::HTTPCookieStore::filterAppBoundCookies):
2479         * UIProcess/API/APIPageConfiguration.cpp:
2480         (API::PageConfiguration::copy const):
2481         * UIProcess/API/APIPageConfiguration.h:
2482         (API::PageConfiguration::ignoresAppBoundDomains const):
2483         (API::PageConfiguration::setIgnoresAppBoundDomains):
2484         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2485         (WKWebsiteDataStoreHasAppBoundSession):
2486         (WKWebsiteDataStoreSetAppBoundDomainsForTesting):
2487         (WKWebsiteDataStoreClearAppBoundSession):
2488         (WKWebsiteDataStoreReinitializeAppBoundDomains):
2489         * UIProcess/API/Cocoa/WKWebView.mm:
2490         (-[WKWebView _isNavigatingToAppBoundDomain:]): Deleted.
2491         (-[WKWebView _isForcedIntoAppBoundMode:]): Deleted.
2492         Moved to WKWebViewIOS.
2493
2494         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2495         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2496         (-[WKWebViewConfiguration limitsNavigationsToAppBoundDomains]):
2497         (-[WKWebViewConfiguration setLimitsNavigationsToAppBoundDomains:]):
2498         (-[WKWebViewConfiguration _ignoresAppBoundDomains]):
2499         (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]):
2500         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2501         Moved App-Bound Domain functions to the part of the file that only compiles
2502         on iOS and removed macos tags for WK_API_AVAILABLE, because both the
2503         API and SPI are iOS only.
2504
2505         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2506         Moved App-Bound Domain functions to the part of the file that only compiles on iOS.
2507         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2508         (-[WKWebsiteDataStore _appBoundDomains:]):
2509         (-[WKWebsiteDataStore _appBoundSchemes:]):
2510         * UIProcess/API/ios/WKWebViewIOS.mm:
2511         (-[WKWebView _isNavigatingToAppBoundDomain:]):
2512         (-[WKWebView _isForcedIntoAppBoundMode:]):
2513         Moved these from WKWebView.
2514
2515         * UIProcess/Network/NetworkProcessProxy.cpp:
2516         (WebKit::NetworkProcessProxy::getAppBoundDomains):
2517         * UIProcess/Network/NetworkProcessProxy.h:
2518         * UIProcess/Network/NetworkProcessProxy.messages.in:
2519         * UIProcess/WebPageProxy.cpp:
2520         (WebKit::WebPageProxy::loadData):
2521         (WebKit::shouldTreatURLProtocolAsAppBound):
2522         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted):
2523         (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess):
2524         (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride):
2525         (WebKit::WebPageProxy::preconnectTo):
2526         Now that m_isNavigatingToAppBoundDomain is iOS only, I changed WebPageProxy::preconnectTo 
2527         to call the isNavigatingToAppBoundDomain() function, which is available
2528         on all platforms but returns WTF::nullopt unless the platform is iOS.
2529
2530         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2531         (WebKit::WebPageProxy::creationParameters):
2532         * UIProcess/WebPageProxy.h:
2533         (WebKit::WebPageProxy::isNavigatingToAppBoundDomain const):
2534         isNavigatingToAppBoundDomain() is used very frequently, it is cleaner
2535         to have two functions -- one for iOS which returns the actual value
2536         and one for non-iOS platforms which returns WTF::nullopt -- rather
2537         than have #if ENABLE(APP_BOUND_DOMAIN) checks everywhere. 
2538
2539         * UIProcess/WebProcessPool.cpp:
2540         (WebKit::WebProcessPool::download):
2541         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2542         (WebKit::appBoundDomainQueue):
2543         (WebKit::WebsiteDataStore::platformInitialize):
2544         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2545         (WebKit::WebsiteDataStore::parameters):
2546         (WebKit::WebsiteDataStore::renameOriginInWebsiteData):
2547         * UIProcess/WebsiteData/WebsiteDataStore.h:
2548         * WebProcess/Network/WebLoaderStrategy.cpp:
2549         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2550         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2551         (WebKit::WebLoaderStrategy::startPingLoad):
2552         (WebKit::WebLoaderStrategy::preconnectTo):
2553         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2554         (WebKit::WebFrameLoaderClient::sendH2Ping):
2555         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2556         * WebProcess/WebPage/WebFrame.cpp:
2557         * WebProcess/WebPage/WebFrame.h:
2558         * WebProcess/WebPage/WebPage.cpp:
2559         (WebKit::m_limitsNavigationsToAppBoundDomains):
2560         (WebKit::WebPage::loadRequest):
2561         (WebKit::WebPage::loadDataImpl):
2562         (WebKit::WebPage::didReceivePolicyDecision):
2563         (WebKit::WebPage::runJavaScript):
2564         (WebKit::WebPage::updatePreferences):
2565         Only check for the m_limitsNavigationsToAppBoundDomains flag if the
2566         platform is iOS. Otherwise it should always be false, because it will
2567         never be enabled on a non-iOS platform.
2568
2569         * WebProcess/WebPage/WebPage.h:
2570
2571 2020-09-09  Tim Horton  <timothy_horton@apple.com>
2572
2573         macCatalyst: Form controls behave strangely (like iPhone) in macOS-idiom apps
2574         https://bugs.webkit.org/show_bug.cgi?id=216326
2575
2576         Reviewed by Wenson Hsieh.
2577
2578         * Shared/UserInterfaceIdiom.h:
2579         * Shared/UserInterfaceIdiom.mm:
2580         (WebKit::userInterfaceIdiomIsPad):
2581         (WebKit::currentUserInterfaceIdiomIsPadOrMac):
2582         (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac):
2583         (WebKit::currentUserInterfaceIdiomIsPad): Deleted.
2584         (WebKit::setCurrentUserInterfaceIdiomIsPad): Deleted.
2585         * Shared/ios/WebPreferencesDefaultValuesIOS.mm:
2586         (WebKit::defaultTextAutosizingUsesIdempotentMode):
2587         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2588         (-[WKWebViewConfiguration init]):
2589         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2590         (WebKit::WebProcessPool::platformInitializeWebProcess):
2591         * UIProcess/ios/SmartMagnificationController.mm:
2592         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
2593         * UIProcess/ios/WKContentViewInteraction.mm:
2594         (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]):
2595         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]):
2596         (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
2597         (-[WKContentView _zoomToRevealFocusedElement]):
2598         (-[WKContentView requiresAccessoryView]):
2599         (-[WKContentView _updateAccessory]):
2600         (shouldShowKeyboardForElement):
2601         (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]):
2602         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
2603         (WebKit::WebDataListSuggestionsDropdownIOS::show):
2604         * UIProcess/ios/WebPageProxyIOS.mm:
2605         (WebKit::desktopClassBrowsingSupported):
2606         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2607         (-[WKAirPlayRoutePicker show:fromRect:]):
2608         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2609         (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
2610         (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]):
2611         * UIProcess/ios/forms/WKFormColorControl.mm:
2612         (-[WKFormColorControl initWithView:]):
2613         * UIProcess/ios/forms/WKFormColorPicker.mm:
2614         (-[WKColorPicker initWithView:inPopover:]):
2615         (-[WKColorPicker drawSelectionIndicatorForColorButton:]):
2616         * UIProcess/ios/forms/WKFormSelectControl.mm:
2617         (-[WKFormSelectControl initWithView:]):
2618         * WebProcess/cocoa/WebProcessCocoa.mm:
2619         (WebKit::WebProcess::platformInitializeWebProcess):
2620         Rename currentUserInterfaceIdiomIsPad to currentUserInterfaceIdiomIsPadOrMac,
2621         and force it to YES on macCatalyst since internally we use it to distinguish
2622         between iPhone and iPad behavior, and (for our behaviors, at least) macCatalyst
2623         should always follow iPad.
2624
2625         We should clean this up, and make all callers make their
2626         iPhone vs. iPad vs. macOS decisions more explicit.
2627
2628 2020-09-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2629
2630         Text copied and pasted from Mac Catalyst apps appears larger than expected
2631         https://bugs.webkit.org/show_bug.cgi?id=215971
2632         <rdar://problem/65768907>
2633
2634         Reviewed by Tim Horton.
2635
2636         Various pieces of platform logic in Mac Catalyst depend on the user interface idiom (i.e. Mac or iPad) of the
2637         app, as well as the application-wide "scale factor". In the context of this bug, NSAttributedString to RTF data
2638         conversion methods in `UIFoundation` consult the scale factor of `UIiOSMacIdiomManager` to determine whether to
2639         emit 0 (standard) or 1 (iOS) for the `\cocoatextscaling` attribute. The fact that the web process' scale factor
2640         may be out of sync with the UI process' scale factor leads to copied RTF data in the web process appearing
2641         either larger or smaller than expected, due to an incorrect `NSTextScalingType` value.
2642
2643         To mitigate this (as well as any other issues), we add a mechanism for the UI process to forward the global
2644         scale factor and user interface idiom to the web process inside of the web process creation parameters, and then
2645         use new UIKit SPI to override the scale factor and idiom within the web process.
2646
2647         * Scripts/process-entitlements.sh:
2648
2649         Add a new entitlement needed to use `_UIApplicationCatalystRequestViewServiceIdiomAndScaleFactor`.
2650
2651         * Shared/WebProcessCreationParameters.cpp:
2652         (WebKit::WebProcessCreationParameters::encode const):
2653         (WebKit::WebProcessCreationParameters::decode):
2654         * Shared/WebProcessCreationParameters.h:
2655         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2656         (WebKit::WebProcessPool::platformInitializeWebProcess):
2657
2658         Use `_UIApplicationCatalystUserInterfaceIdiom` and `_UIApplicationCatalystScaleFactor` to grab the global user
2659         interface idiom and scale factor, respectively.
2660
2661         * WebProcess/cocoa/WebProcessCocoa.mm:
2662         (WebKit::WebProcess::platformInitializeWebProcess):
2663
2664         Override the idiom and scale factor in the web process with the idiom and scale factor from the UI process,
2665         using the new SPI `_UIApplicationCatalystRequestViewServiceIdiomAndScaleFactor`. As this function hasn't landed
2666         yet, we soft link the function for now to avoid causing the web process to instantly crash on any builds without
2667         the fix for <rdar://problem/68524148>.
2668
2669 2020-09-09  Brady Eidson  <beidson@apple.com>
2670
2671         Make sure WKWebsiteDataStore operations reuse existing process pools even when all WKWebViews have closed.
2672         <rdar://problem/62978295> and https://bugs.webkit.org/show_bug.cgi?id=216317
2673
2674         Reviewed by Geoffrey Garen.
2675
2676         Covered by new API test.
2677         
2678         When WebsiteDataStores are gathering all the NetworkProcesses they might need to message, they miss some
2679         obvious candidates if there are no longer any related WKWebViews.
2680         
2681         Fix that by tracking which sessions a NetworkProcess knows about.
2682
2683         * UIProcess/Network/NetworkProcessProxy.cpp:
2684         (WebKit::NetworkProcessProxy::addSession):
2685         (WebKit::NetworkProcessProxy::hasSession const):
2686         (WebKit::NetworkProcessProxy::removeSession):
2687         * UIProcess/Network/NetworkProcessProxy.h:
2688
2689         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2690         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
2691
2692 2020-09-09  Chris Dumez  <cdumez@apple.com>
2693
2694         Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess
2695         https://bugs.webkit.org/show_bug.cgi?id=216195
2696
2697         Reviewed by Simon Fraser.
2698
2699         Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess, now that the
2700         DisplayLink has been moved to the UIProcess due to sandboxing.
2701
2702         After a DisplayLink no longer has any clients, we keep it firing up to 20 times without
2703         any clients in case a new client gets added shortly after. The idea was to avoid killing
2704         and respawning too many threads when adding and removing clients in quick succession.
2705         However, now that the DisplayLink lives in the UIProcess side and sends IPC to the
2706         WebProcesses every time it fires, it makes a lot more sense to implement this logic in
2707         the UIProcess side, to avoid sending unnecessary IPC to processes that do not care about
2708         it.
2709
2710         * UIProcess/mac/DisplayLink.cpp:
2711         (WebKit::DisplayLink::addObserver):
2712         (WebKit::DisplayLink::removeObserver):
2713         (WebKit::DisplayLink::removeObservers):
2714         (WebKit::DisplayLink::displayLinkCallback):
2715         (WebKit::DisplayLink::hasObservers const): Deleted.
2716         * UIProcess/mac/DisplayLink.h:
2717
2718 2020-09-08  Chris Dumez  <cdumez@apple.com>
2719
2720         Regression(r260614) Power usage has increased due to extra thread hopping
2721         https://bugs.webkit.org/show_bug.cgi?id=216296
2722         <rdar://problem/67719299>
2723
2724         Reviewed by Simon Fraser.
2725
2726         Power usage has increased after r260614 due to extra thread hopping. To recover,
2727         we now process the DisplayWasRefreshed IPC to a background queue if there is
2728         scrolling going on and responsiveness is thus critical. In the common case, where
2729         the user is not scrolling, we keep processing the IPC on the main thread, like
2730         before r260614. This avoids extra thread hopping and saves power.
2731
2732         * UIProcess/WebPageProxy.cpp:
2733         (WebKit::ScrollingObserver::willSendWheelEvent):
2734         (WebKit::ScrollingObserver::ScrollingObserver):
2735         (WebKit::ScrollingObserver::singleton):
2736         (WebKit::WebPageProxy::sendWheelEvent):
2737         * UIProcess/mac/DisplayLink.cpp:
2738         (WebKit::DisplayLink::displayLinkCallback):
2739         * UIProcess/mac/DisplayLink.h:
2740         (WebKit::DisplayLink::setShouldSendIPCOnBackgroundQueue):
2741         * WebProcess/WebPage/EventDispatcher.cpp:
2742         (WebKit::EventDispatcher::notifyScrollingTreesDisplayWasRefreshed):
2743         (WebKit::EventDispatcher::displayWasRefreshed):
2744         * WebProcess/WebPage/EventDispatcher.h:
2745         * WebProcess/WebProcess.cpp:
2746         (WebKit::WebProcess::displayWasRefreshed):
2747         * WebProcess/WebProcess.h:
2748         * WebProcess/WebProcess.messages.in:
2749
2750 2020-09-08  Megan Gardner  <megan_gardner@apple.com>
2751
2752         Removed unneeded respondsToSelector checks on UIWKTextInteractionAssistant in WKContentViewInteraction.
2753         https://bugs.webkit.org/show_bug.cgi?id=216204
2754
2755         Reviewed by Wenson Hsieh.
2756
2757         Over the years, we have had many selection and text interaction assistants, that may not have all
2758         responded to the selectors we expect them to. This has left many respondsToSelector checks around that
2759         should be removed, as they are unnecessary and an unneeded performance hit.
2760
2761         No behavior change, covered by existing tests.
2762
2763         * UIProcess/ios/WKContentViewInteraction.mm:
2764         (-[WKContentView _willStartScrollingOrZooming]):
2765         (-[WKContentView _didEndScrollingOrZooming]):
2766
2767 2020-09-08  Lauro Moura  <lmoura@igalia.com>
2768
2769         NetworkProcess: Check for invalid handle before writing salt file
2770         https://bugs.webkit.org/show_bug.cgi?id=216285
2771
2772         Reviewed by Sihui Liu.
2773
2774         Covered by existing tests.
2775
2776         Fixes crashes in GTK/WPE after r266742.
2777
2778         * NetworkProcess/cache/NetworkCacheData.cpp:
2779         (WebKit::NetworkCache::readOrMakeSalt):
2780
2781 2020-09-08  Brady Eidson  <beidson@apple.com>
2782
2783         Crashtracer inside PDFPlugin::createScrollbar.
2784         <rdar://problem/68474062> and https://bugs.webkit.org/show_bug.cgi?id=216286
2785
2786         Reviewed by Tim Horton.
2787
2788         To quote Tim from r264945:
2789         No new tests; timing is such that I can't reproduce without inserting
2790         intentional delays into the main thread hops, which is further than
2791         I'm willing to go for a test.
2792
2793         This is a speculative fix due to the aforementioned reproducibility issue.
2794
2795         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2796         (WebKit::PDFPlugin::createScrollbar): Plugin hasn't been destroyed, and there's still a PluginView,
2797           but the PluginView isn't in a frame. So null check that.
2798
2799 2020-09-08  Alex Christensen  <achristensen@webkit.org>
2800
2801         Null check m_layerHostingContext in TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded
2802         https://bugs.webkit.org/show_bug.cgi?id=216282
2803         <rdar://problem/64933878>
2804
2805         Reviewed by Tim Horton.
2806
2807         There's no reason to dereference null here.  Let's not crash.
2808
2809         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2810         (WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded):
2811
2812 2020-09-08  Youenn Fablet  <youenn@apple.com>
2813
2814         Tighten checks when creating an audio buffer list
2815         https://bugs.webkit.org/show_bug.cgi?id=216237
2816         <rdar://problem/68271376>
2817
2818         Reviewed by Geoffrey Garen.
2819
2820         Add message checks to verify that no message integer overflows happen when processing audio buffer list messages.
2821
2822         * GPUProcess/GPUConnectionToWebProcess.cpp:
2823         (WebKit::GPUConnectionToWebProcess::audioTrackRendererManager):
2824         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp:
2825         (WebKit::RemoteAudioMediaStreamTrackRenderer::RemoteAudioMediaStreamTrackRenderer):
2826         (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged):
2827         (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesAvailable):
2828         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h:
2829         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp:
2830         (WebKit::RemoteAudioMediaStreamTrackRendererManager::RemoteAudioMediaStreamTrackRendererManager):
2831         (WebKit::RemoteAudioMediaStreamTrackRendererManager::createRenderer):
2832         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h:
2833         * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
2834         (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged):
2835         (WebKit::RemoteMediaRecorder::audioSamplesAvailable):
2836         * GPUProcess/webrtc/RemoteMediaRecorder.h:
2837         * WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
2838         (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable):
2839
2840 2020-09-08  Tim Horton  <timothy_horton@apple.com>
2841
2842         iOS: <attachment>'s QuickLook thumbnails can appear squished
2843         https://bugs.webkit.org/show_bug.cgi?id=216209
2844         <rdar://problem/67817706>
2845
2846         Reviewed by Wenson Hsieh.
2847
2848         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2849         (WebKit::convertPlatformImageToBitmap):
2850         Propagate an image of the same aspect ratio that QuickLook provided,
2851         instead of squishing it to square.
2852
2853         * UIProcess/QuickLookThumbnailLoader.mm:
2854         (-[WKQLThumbnailLoadOperation start]):
2855         Only request full thumbnails; we do not want the icon form, since <attachment>
2856         already has one without QuickLook's help; if we can't get a full thumbnail,
2857         we'll just leave it alone.
2858
2859 2020-09-08  Sihui Liu  <sihui_liu@apple.com>
2860
2861         Remove storage WorkQueue in NetworkProcess
2862         https://bugs.webkit.org/show_bug.cgi?id=216199
2863
2864         Reviewed by Youenn Fablet.
2865
2866         The only meaningful usage of this WorkQueue is iterating IndexedDB directories and collecting origins, while
2867         there can be some IDB thread accessing the same directories. To remove the race, Let's just drop this WorkQueue
2868         and fetch origins via WebIDBServer.
2869
2870         * NetworkProcess/IndexedDB/WebIDBServer.cpp:
2871         (WebKit::WebIDBServer::getOrigins):
2872         * NetworkProcess/IndexedDB/WebIDBServer.h:
2873         * NetworkProcess/NetworkProcess.cpp:
2874         (WebKit::NetworkProcess::addSessionStorageQuotaManager):
2875         (WebKit::NetworkProcess::fetchWebsiteData):
2876         (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
2877         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
2878         (WebKit::NetworkProcess::addIndexedDatabaseSession):
2879         (WebKit::NetworkProcess::addServiceWorkerSession):
2880         (WebKit::NetworkProcess::ensurePathExists): Deleted.
2881         (WebKit::NetworkProcess::postStorageTask): Deleted.
2882         (WebKit::NetworkProcess::performNextStorageTask): Deleted.
2883         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion): Deleted.
2884         (WebKit::NetworkProcess::indexedDatabaseOrigins): Deleted.
2885         * NetworkProcess/NetworkProcess.h:
2886
2887 2020-09-08  Peng Liu  <peng.liu6@apple.com>
2888
2889         Clean up functions and state variables related to the picture-in-picture implementation
2890         https://bugs.webkit.org/show_bug.cgi?id=215972
2891
2892         Reviewed by Jer Noble.
2893
2894         This patch adds an optional FloatSize parameter to the VideoFullscreenManager::DidEnterFullscreen message.
2895         Also, it enables the picture-in-picture and fullscreen events when a video element enters picture-in-picture
2896         from the fullscreen mode.
2897
2898         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2899         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2900         (WebKit::VideoFullscreenModelContext::didEnterFullscreen):
2901         (WebKit::VideoFullscreenModelContext::prepareToExitFullscreen):
2902         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
2903         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
2904         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
2905         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
2906         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
2907         (WebKit::VideoFullscreenManagerProxy::ensureClientForContext):
2908         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
2909         (WebKit::VideoFullscreenManagerProxy::enterFullscreen):
2910         (WebKit::VideoFullscreenManagerProxy::didEnterFullscreen):
2911         Use ensureClientForContext() instead of addClientForContext() in setupFullscreenWithID()
2912         to avoid leaking VideoFullscreenInterfaceAVKit instances.
2913         Iterate a copy of the HashSet of VideoFullscreenModelClient pointers because a callback may
2914         remove the client itself during the iteration.
2915
2916         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2917         (-[WKFullScreenWindowController prepareToExitPictureInPicture]):
2918         * UIProcess/mac/WKFullScreenWindowController.h:
2919         * UIProcess/mac/WKFullScreenWindowController.mm:
2920         (-[WKFullScreenWindowController didExitPictureInPicture]):
2921         Fix leaking of VideoFullscreenInterfaceMac.
2922
2923         * WebProcess/cocoa/VideoFullscreenManager.h:
2924         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
2925         * WebProcess/cocoa/VideoFullscreenManager.mm:
2926         (WebKit::VideoFullscreenManager::fullscreenModeChanged):
2927         We need to change the fullscreen mode in the VideoFullscreenInterfaceContext instance as well.
2928         (WebKit::VideoFullscreenManager::didEnterFullscreen):
2929         (WebKit::VideoFullscreenManager::didCleanupFullscreen):
2930         Call didExitFullscreenOrPictureInPicture() instead of didStopBeingFullscreenElement(), which
2931         is for the FullscreenManager.
2932
2933 2020-09-08  Mike Gorse  <mgorse@suse.com>
2934
2935         [GTK] AcceleratedBackingStoreWayland might erroneously try to use SHM with older wpebackend-fdo
2936         https://bugs.webkit.org/show_bug.cgi?id=216254
2937
2938         Reviewed by Adrian Perez de Castro.
2939
2940         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
2941         (WebKit::tryInitializeSHM): Return false for wpebackend-fdo < 1.7.0.
2942
2943 2020-09-08  Pablo Saavedra  <psaavedra@igalia.com>
2944
2945         [GLIB] RemoteInspectorServer is not started if WebKitWebContext is not created already created
2946         https://bugs.webkit.org/show_bug.cgi?id=216120
2947
2948         Reviewed by Carlos Garcia Campos.
2949
2950         Added a WebKit/UIProcess/API/glib/WebKitInitialize what implements
2951         its own webkitInitialize() to ensure the inspector server is
2952         initialized as early as possible, before other api calls that would
2953         depend on the inspector server being running.
2954
2955         The RemoteInspectorServer initialization is not longer
2956         asociated to the initialization of the WebProcessPoolGLib.
2957
2958         The webkitInitialize() extends the shared InitializeWebKit2();
2959         and also includes the initialization of the RemoteInspectorServer
2960         so the initialization of the remote inspector server can be now
2961         triggered by the initialization of many other API objects too:
2962         WebKitInputMethodContext, WebKitSettings, WebKitUserContentManager,
2963         WebKitWebContext, WebKitWebsiteDataManager,
2964         WebKitUserContentFilterStore, WebKitWebViewBase.
2965
2966         * SourcesGTK.txt:
2967         * SourcesWPE.txt:
2968         * UIProcess/API/glib/WebKitInitialize.cpp: Added.
2969         (WebKit::initializeRemoteInspectorServer):
2970         (WebKit::webkitInitialize):
2971         * UIProcess/API/glib/WebKitInitialize.h: Added.
2972         * UIProcess/API/glib/WebKitInputMethodContext.cpp:
2973         (webkit_input_method_context_class_init):
2974         * UIProcess/API/glib/WebKitSettings.cpp:
2975         (webkit_settings_class_init):
2976         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
2977         (webkit_user_content_filter_store_class_init):
2978         * UIProcess/API/glib/WebKitUserContentManager.cpp:
2979         * UIProcess/API/glib/WebKitWebContext.cpp:
2980         (webkit_web_context_class_init):
2981         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
2982         (webkit_website_data_manager_class_init):
2983         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2984         (webkit_web_view_base_class_init):
2985         * UIProcess/glib/WebProcessPoolGLib.cpp:
2986         (WebKit::WebProcessPool::platformInitialize):
2987         (WebKit::initializeRemoteInspectorServer): Deleted.
2988
2989 2020-09-07  Commit Queue  <commit-queue@webkit.org>
2990
2991         Unreviewed, reverting r266645.
2992         https://bugs.webkit.org/show_bug.cgi?id=216251
2993
2994         Caused MotionMark regression
2995
2996         Reverted changeset:
2997
2998         "Move lazy DisplayLink tear down logic from the WebProcess to
2999         the UIProcess"
3000         https://bugs.webkit.org/show_bug.cgi?id=216195
3001         https://trac.webkit.org/changeset/266645
3002
3003 2020-09-07  Mike Gorse  <mgorse@suse.com>
3004
3005         Build failure; cannot find seccomp.h
3006         https://bugs.webkit.org/show_bug.cgi?id=216226
3007
3008         Reviewed by Darin Adler.
3009
3010         No new tests (build fix only).
3011
3012         * PlatformGTK.cmake: Add LIBSECCOMP_INCLUDE_DIRS to
3013         WebKit_SYSTEM_INCLUDE_DIRECTORIES.
3014
3015 2020-09-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3016
3017         [MotionMark] RenderLayer::paintLayerContents spends ~5% of the time in MonotonicTime::now() in Multiply
3018         https://bugs.webkit.org/show_bug.cgi?id=216190
3019
3020         Reviewed by Darin Adler.
3021
3022         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3023         (WebKit::WebChromeClient::timestampForPaintFrequencyTracking const):
3024
3025         In WebKit2, we can assume (with the exception of SVG pages) that we must've performed a rendering update prior
3026         to tracking painting frequencies. As such, we can use the page's rendering update timestamp instead of the real
3027         current time (`MonotonicTime::now()`).
3028
3029         Note that in WebKit1, it is possible for any client to force a synchronous paint of the page before the page has
3030         performed a rendering update, which triggers assertions in `SinglePaintFrequencyTracking::end()`. As such, we
3031         stick with `MonotonicTime::now()` in WebKit1.
3032
3033         * WebProcess/WebCoreSupport/WebChromeClient.h:
3034
3035 2020-09-05  Sam Weinig  <weinig@apple.com>
3036
3037         [WebIDL] Realign our IDL extended attribute names with those specified in WebIDL
3038         https://bugs.webkit.org/show_bug.cgi?id=216194
3039
3040         Reviewed by Darin Adler.
3041
3042         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
3043         (WebKit::InjectedBundleScriptWorld::disableOverrideBuiltinsBehavior):
3044         Update for new name WebCore::DOMWrapperWorld.
3045
3046 2020-09-04  Alex Christensen  <achristensen@webkit.org>
3047
3048         Move PDF heads-up display to UI process on macOS
3049         https://bugs.webkit.org/show_bug.cgi?id=215780
3050         <rdar://problem/58715847>
3051
3052         Reviewed by Tim Horton.
3053
3054         This has many benefits including the one in the radar, testability, and moving WebKit-specific code from PDFKit to WebKit.
3055
3056         Now that the HUD is displayed in the UI process instead of in the web content, zooming in keeps the HUD the same size.
3057         A 3d-transformed iframe with a PDF in it now shows the HUD in the place you can click on it, instead of in the transformed PDF.
3058         Also, moving the mouse to the HUD within the first 3 seconds prevents it from hiding, which it does when the mouse leaves the HUD.
3059         The rest of the behavior I think should be the same.  Most users should not notice any difference.
3060
3061         Functionality covered by API tests, the first tests for PDF content interaction!
3062
3063         * Scripts/webkit/messages.py:
3064         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3065         * UIProcess/API/mac/WKView.mm:
3066         (-[WKView _createPDFHUD:rect:]):
3067         (-[WKView _pdfHUD:changedLocation:]):
3068         (-[WKView _removePDFHUD:]):
3069         (-[WKView _removeAllPDFHUDs]):
3070         * UIProcess/API/mac/WKWebViewMac.mm:
3071         (-[WKWebView mouseMoved:]):
3072         (-[WKWebView mouseDown:]):
3073         (-[WKWebView mouseUp:]):
3074         (-[WKWebView _createPDFHUD:rect:]):
3075         (-[WKWebView _pdfHUD:changedLocation:]):
3076         (-[WKWebView _removePDFHUD:]):
3077         (-[WKWebView _removeAllPDFHUDs]):
3078         * UIProcess/API/mac/WKWebViewPrivateForTestingMac.h:
3079         * UIProcess/API/mac/WKWebViewTestingMac.mm:
3080         (-[WKWebView pdfHUDs]):
3081         * UIProcess/Cocoa/WebViewImpl.h:
3082         * UIProcess/Cocoa/WebViewImpl.mm:
3083         (WebKit::WebViewImpl::createPDFHUD):
3084         (WebKit::WebViewImpl::updatePDFHUDLocation):
3085         (WebKit::WebViewImpl::removePDFHUD):
3086         (WebKit::WebViewImpl::removeAllPDFHUDs):
3087         * UIProcess/PageClient.h:
3088         * UIProcess/WebPageProxy.cpp:
3089         (WebKit::WebPageProxy::didCommitLoadForFrame):
3090         (WebKit::WebPageProxy::processDidTerminate):
3091         * UIProcess/WebPageProxy.h:
3092         * UIProcess/WebPageProxy.messages.in:
3093         * UIProcess/ios/WebPageProxyIOS.mm:
3094         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): Deleted.
3095         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): Deleted.
3096         * UIProcess/mac/PageClientImplMac.h:
3097         * UIProcess/mac/PageClientImplMac.mm:
3098         (WebKit::PageClientImpl::createPDFHUD):
3099         (WebKit::PageClientImpl::updatePDFHUDLocation):
3100         (WebKit::PageClientImpl::removePDFHUD):
3101         (WebKit::PageClientImpl::removeAllPDFHUDs):
3102         * UIProcess/mac/WebPageProxyMac.mm:
3103         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
3104         (WebKit::WebPageProxy::createPDFHUD):
3105         (WebKit::WebPageProxy::removePDFHUD):
3106         (WebKit::WebPageProxy::updatePDFHUDLocation):
3107         (WebKit::WebPageProxy::pdfZoomIn):
3108         (WebKit::WebPageProxy::pdfZoomOut):
3109         (WebKit::WebPageProxy::pdfSaveToPDF):
3110         (WebKit::WebPageProxy::pdfOpenWithPreview):
3111         * WebKit.xcodeproj/project.pbxproj:
3112         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
3113         * WebProcess/Plugins/PDF/PDFPlugin.h:
3114         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3115         (-[WKPDFLayerControllerDelegate openWithNativeApplication]):
3116         (-[WKPDFLayerControllerDelegate saveToPDF]):
3117         (WebKit::PDFPlugin::PDFPlugin):
3118         (WebKit::PDFPlugin::~PDFPlugin):
3119         (WebKit::PDFPlugin::frameForHUD const):
3120         (WebKit::PDFPlugin::calculateSizes):
3121         (WebKit::PDFPlugin::convertFromPDFViewToRootView const):
3122         (WebKit::PDFPlugin::visibilityDidChange):
3123         (WebKit::PDFPlugin::zoomIn):
3124         (WebKit::PDFPlugin::zoomOut):
3125         (WebKit::PDFPlugin::save):
3126         (WebKit::PDFPlugin::openWithPreview):
3127         * WebProcess/WebPage/WebPage.cpp:
3128         * WebProcess/WebPage/WebPage.h:
3129         * WebProcess/WebPage/WebPage.messages.in:
3130         * WebProcess/WebPage/mac/WebPageMac.mm:
3131         (WebKit::WebPage::zoomPDFIn):
3132         (WebKit::WebPage::zoomPDFOut):
3133         (WebKit::WebPage::savePDF):
3134         (WebKit::WebPage::openPDFWithPreview):
3135         (WebKit::WebPage::createPDFHUD):
3136         (WebKit::WebPage::updatePDFHUDLocation):
3137         (WebKit::WebPage::removePDFHUD):
3138
3139 2020-09-04  Chris Dumez  <cdumez@apple.com>
3140
3141         handleXPCEndpointMessages does not check XPC object is an xpc_endpoint_t
3142         https://bugs.webkit.org/show_bug.cgi?id=216196
3143         <rdar://problem/68198293>
3144
3145         Reviewed by Per Arne Vollan.
3146
3147         Add a check to have sure the XPC object is indeed an xpc_endpoint_t before
3148         using it.
3149
3150         * WebProcess/cocoa/HandleXPCEndpointMessages.mm:
3151         (WebKit::handleXPCEndpointMessages):
3152
3153 2020-09-04  Chris Dumez  <cdumez@apple.com>
3154
3155         Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess
3156         https://bugs.webkit.org/show_bug.cgi?id=216195
3157
3158         Reviewed by Simon Fraser.
3159
3160         Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess, now that the
3161         DisplayLink has been moved to the UIProcess due to sandboxing.
3162
3163         After a DisplayLink no longer has any clients, we keep it firing up to 20 times without
3164         any clients in case a new client gets added shortly after. The idea was to avoid killing
3165         and respawning too many threads when adding and removing clients in quick succession.
3166         However, now that the DisplayLink lives in the UIProcess side and sends IPC to the
3167         WebProcesses every time it fires, it makes a lot more sense to implement this logic in
3168         the UIProcess side, to avoid sending unnecessary IPC to processes that do not care about
3169         it.
3170
3171         * UIProcess/mac/DisplayLink.cpp:
3172         (WebKit::DisplayLink::addObserver):
3173         (WebKit::DisplayLink::removeObserver):
3174         (WebKit::DisplayLink::removeObservers):
3175         (WebKit::DisplayLink::displayLinkCallback):
3176         (WebKit::DisplayLink::hasObservers const): Deleted.
3177         * UIProcess/mac/DisplayLink.h:
3178
3179 2020-09-04  Sihui Liu  <sihui_liu@apple.com>
3180
3181         Webpages flash when switching between windows
3182         https://bugs.webkit.org/show_bug.cgi?id=216012
3183
3184         Reviewed by Tim Horton.
3185
3186         Based on patches from Tim Horton. To avoid flash, we need to make sure view to be selected updates its content 
3187         before UI process commits its transaction. We did this by making UI process block until receiving a reply 
3188         DidUpdateActivityState from web process. However, web process did not make sure the reply would be sent after 
3189         normal rendering update and corresponding transasction commit. Instead, it flushed transactions in progress and 
3190         replied. To fix this, now we make web process reply in transaction commit handler after rendering update, if
3191         there is an active transaction.
3192
3193         In the switching case, view to be unselected will detach from root layer in its web process, which makes its 
3194         content empty. This change is independent from the UI process commit, so we want this to happen after UI process
3195         commits (which submits the view hierachy change). Otherwise, empty content(white flash) on the unselected view 
3196         will be displayed. To fix this, we let UI process send the activity state change message in transaction commit 
3197         handler, if there is an active transaction.
3198
3199         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3200         (WebKit::WebPageProxy::scheduleActivityStateUpdate):
3201         * UIProcess/WebPageProxy.cpp:
3202         (WebKit::WebPageProxy::setSuppressVisibilityUpdates):
3203         (WebKit::WebPageProxy::activityStateDidChange):
3204         (WebKit::WebPageProxy::dispatchActivityStateChange):
3205         * UIProcess/WebPageProxy.h:
3206         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3207         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3208         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3209         (WebKit::TiledCoreAnimationDrawingArea::updateRendering):
3210         (WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacks):
3211         (WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacksIfNeeded):
3212         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
3213         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired): Deleted.
3214
3215 2020-09-04  Per Arne Vollan  <pvollan@apple.com>
3216
3217         [macOS] Add client decoder entitlement
3218         https://bugs.webkit.org/show_bug.cgi?id=216175
3219         <rdar://problem/67532128>
3220
3221         Reviewed by Brent Fulgham.
3222
3223         Add client decoder entitlement in the WebContent process on macOS.
3224
3225         * Scripts/process-entitlements.sh:
3226
3227 2020-09-04  Youenn Fablet  <youenn@apple.com>
3228
3229         MediaRecorder timeslice parameter causing internal error on longer videos
3230         https://bugs.webkit.org/show_bug.cgi?id=216076
3231         <rdar://problem/68209422>
3232
3233         Reviewed by Eric Carlson.
3234
3235         Test: http/wpt/fetch/blob-range.html
3236
3237         * NetworkProcess/NetworkDataTaskBlob.cpp:
3238         (WebKit::NetworkDataTaskBlob::readData):
3239         readData can be re-entrant so we need to reset m_currentItemReadSize before consuming data.
3240
3241 2020-09-04  Aditya Keerthi  <akeerthi@apple.com>
3242
3243         REGRESSION (r241734): [iOS] Changing the value of a select element and tapping on another results in two changes
3244         https://bugs.webkit.org/show_bug.cgi?id=216077
3245
3246         Reviewed by Darin Adler.
3247
3248         r241734 added a call to [self _endEditing] in
3249         [WKContentView _elementDidBlur] to ensure that any open form controls
3250         are dismissed when using the keyboard to change focus.
3251         [self _endEditing] calls [_inputPeripheral endEditing], which
3252         eventually calls [WKFormControl controlEndEditing].
3253
3254         However, if the focus is changed by tapping on another form control, a
3255         a gesture recognizer calls [_inputPeripheral endEditing]. Consequently,
3256         changing the focused element by tapping results in two calls to
3257         [WKFormControl controlEndEditing]. First from the gesture recognizer,
3258         and then from [WKContentView _elementDidBlur].
3259
3260         For certain form controls on iPhone, such as the select element,
3261         controlEndEditing is responsible for updating the element's value in
3262         the WebProcess. Note that the same is not true on iPad, as
3263         controlEndEditing simply dismisses a popover. Now, the first call to
3264         [WKSelectSinglePicker controlEndEditing] correctly updates the expected
3265         select element. However, when tapping on another select element, the
3266         second call to [WKSelectSinglePicker controlEndEditing] also attempts
3267         to update the value of the focused element. By this time, the focused
3268         element in the WebProcess is the second select element. Consequently,
3269         changing the value in one select element and then tapping another
3270         results in updates to both elements.
3271
3272         To fix this issue, while preserving the intent of r241734, we should
3273         prevent callers from being able to end editing in a control twice. Note
3274         that WKFormPeripheralBase already keeps track of the editing state of a
3275         control in a boolean variable _editing. If the control has finished
3276         being edited, _editing is set to false. This patch adds an early return
3277         to [WKFormPeripheralBase endEditing] if _editing is false, ensuring
3278         controlEndEditing is never called twice. For parity, also ensure that
3279         controlBeginEditing can only be called if the control is not already
3280         being edited.
3281
3282         Test: fast/forms/ios/select-picker-change-and-focus-another-select.html
3283
3284         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
3285         (-[WKFormPeripheralBase beginEditing]): Early return if control is already being edited.
3286         (-[WKFormPeripheralBase endEditing]): Early return if control is not being edited.
3287
3288 2020-09-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3289
3290         [macOS] UI process sometimes crashes under -[WKSharingServicePickerDelegate sharingService:didShareItems:]
3291         https://bugs.webkit.org/show_bug.cgi?id=216167
3292         <rdar://problem/68287449>
3293
3294         Reviewed by Anders Carlsson.
3295
3296         It's not clear what causes the array of items in this delegate method to be empty, but we should at least be
3297         robust against this scenario and avoid crashing the application process.
3298
3299         * UIProcess/mac/WKSharingServicePickerDelegate.mm:
3300         (-[WKSharingServicePickerDelegate sharingService:didShareItems:]):
3301
3302 2020-09-04  Kate Cheney  <katherine_cheney@apple.com>
3303
3304         WebProcessProxy::checkURLReceivedFromWebProcess() does not always need to check the back/forward list
3305         https://bugs.webkit.org/show_bug.cgi?id=216109
3306         <rdar://problem/59867349>
3307
3308         Reviewed by Brady Eidson.
3309
3310         We should not need to check the back/forward list when setting a
3311         pasteboard URL because any valid pasteboard URL will be handled
3312         by one of the other if-statements in
3313         WebProcessProxy::checkURLReceivedFromWebProcess(), therefore checking
3314         again is a waste of time.
3315
3316         This also hardens the process against potential abuse by preventing
3317         the possibility of an invalid URL in the back/forward list being
3318         saved in the pasteboard property list.
3319
3320         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3321         (WebKit::WebPasteboardProxy::setPasteboardURL):
3322         * UIProcess/WebProcessProxy.cpp:
3323         (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
3324         * UIProcess/WebProcessProxy.h:
3325
3326 2020-09-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3327
3328         [GTK] Unexpected User-Agent on redirect
3329         https://bugs.webkit.org/show_bug.cgi?id=191858
3330
3331         Reviewed by Youenn Fablet.
3332
3333         Clear the user agent on new request after a redirect to ensure a new one is computed taking into account the
3334         quirks if needed. Also ensure quirks are applied for downloads started in the UI process.
3335
3336         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3337         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Clear the user agent on new request.
3338         * UIProcess/API/glib/WebKitDownloadClient.cpp:
3339         * UIProcess/WebPageProxy.h: Add userAgentForURL().
3340         * UIProcess/WebProcessPool.cpp:
3341         (WebKit::WebProcessPool::download): Use userAgentForURL() instead of userAgent().
3342         * UIProcess/gtk/WebPageProxyGtk.cpp:
3343         (WebKit::WebPageProxy::userAgentForURL): Implement it to apply quirks if needed.
3344         * UIProcess/ios/WebPageProxyIOS.mm:
3345         (WebKit::WebPageProxy::userAgentForURL): Just return the web page user agent.
3346         * UIProcess/mac/WebPageProxyMac.mm:
3347         (WebKit::WebPageProxy::userAgentForURL): Ditto.
3348         * UIProcess/playstation/WebPageProxyPlayStation.cpp:
3349         (WebKit::WebPageProxy::userAgentForURL): Ditto.
3350         * UIProcess/win/WebPageProxyWin.cpp:
3351         (WebKit::WebPageProxy::userAgentForURL): Ditto.
3352         * UIProcess/wpe/WebPageProxyWPE.cpp:
3353         (WebKit::WebPageProxy::userAgentForURL): Ditto.
3354
3355 2020-09-02  Darin Adler  <darin@apple.com>
3356
3357         Remove EAffinity, UPSTREAM, DOWNSTREAM, SEL_DEFAULT_AFFINITY, and VisibleSelection::selectionType
3358         https://bugs.webkit.org/show_bug.cgi?id=216102
3359
3360         Reviewed by Sam Weinig.
3361
3362         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
3363         (API::InjectedBundle::EditorClient::shouldChangeSelectedRange): Use Affinity.
3364         * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
3365         (WebKit::toAPI): Dito.
3366         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3367         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Ditto.
3368         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
3369         (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto.
3370         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Ditto.
3371         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3372         (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
3373         * WebProcess/WebCoreSupport/WebEditorClient.h: Ditto.
3374
3375         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3376         (WebKit::WebPage::insertDictatedTextAsync): Rely on default affinity.
3377         * WebProcess/WebPage/WebPage.cpp:
3378         (WebKit::WebPage::insertTextAsync): Ditto.
3379         (WebKit::WebPage::setCompositionAsync): Ditto.
3380         (WebKit::WebPage::deleteSurrounding): Ditto.
3381
3382         * WebProcess/WebPage/ios/WebPageIOS.mm:
3383         (WebKit::WebPage::didConcludeEditDrag): Use Affinity.
3384         (WebKit::WebPage::selectPositionAtBoundaryWithDirection): Ditto.
3385         (WebKit::WebPage::moveSelectionAtBoundaryWithDirection): Ditto.
3386         (WebKit::WebPage::selectTextWithGranularityAtPoint): Ditto.
3387         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary): Ditto.
3388         (WebKit::WebPage::updateSelectionWithExtentPoint): Ditto.
3389         (WebKit::WebPage::replaceSelectedText): Ditto.
3390         (WebKit::WebPage::replaceDictatedText): Ditto.
3391         (WebKit::WebPage::applyAutocorrectionInternal): Ditto.
3392         (WebKit::WebPage::updateSelectionWithDelta): Ditto.
3393
3394 2020-09-02  John Wilander  <wilander@apple.com>
3395
3396         Remove custom domain from SameSite=strict jail protection
3397         https://bugs.webkit.org/show_bug.cgi?id=216083
3398         <rdar://problem/68220223>
3399
3400         Reviewed by Alex Christensen.
3401
3402         No new tests. This was a site-specific opt-in rule. The feature
3403         itself has tests.
3404
3405         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3406         (WebKit::ResourceLoadStatisticsStore::shouldEnforceSameSiteStrictForSpecificDomain const):
3407
3408 2020-09-01  Darin Adler  <darin@apple.com>
3409
3410         Remove comparePositions and make VisiblePosition improvements
3411         https://bugs.webkit.org/show_bug.cgi?id=215982
3412
3413         Reviewed by Sam Weinig.
3414
3415         * WebProcess/WebPage/ios/WebPageIOS.mm:
3416         (WebKit::rangeForPointInRootViewCoordinates): Use <= instead of
3417         comparePositions.
3418
3419 2020-09-02  Timothy Horton  <timothy_horton@apple.com>
3420
3421         iPad + Trackpad: JW Library highlighting and edit menus don't appear
3422         https://bugs.webkit.org/show_bug.cgi?id=216086
3423
3424         Reviewed by Wenson Hsieh.
3425
3426         * UIProcess/ios/WKContentViewInteraction.mm:
3427         (applicationIsKnownToIgnoreMouseEvents):
3428         Add JW Library to the list.
3429
3430 2020-09-02  Youenn Fablet  <youenn@apple.com>
3431
3432         Introduce a ThreadableWebSocketChannel identifier
3433         https://bugs.webkit.org/show_bug.cgi?id=216034
3434
3435         Reviewed by Alex Christensen.
3436
3437         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3438         * NetworkProcess/NetworkConnectionToWebProcess.h:
3439         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3440         * NetworkProcess/NetworkSocketChannel.h:
3441         * NetworkProcess/NetworkSocketStream.h:
3442         * Scripts/webkit/messages.py:
3443         * WebKit.xcodeproj/project.pbxproj:
3444         * WebProcess/Network/WebSocketChannel.cpp:
3445         (WebKit::WebSocketChannel::WebSocketChannel):
3446         * WebProcess/Network/WebSocketChannel.h:
3447         (WebKit::WebSocketChannel::identifier const): Deleted.
3448         * WebProcess/Network/WebSocketChannelManager.h:
3449         * WebProcess/Network/WebSocketIdentifier.h: Removed.
3450         * WebProcess/Network/WebSocketProvider.cpp:
3451         (WebKit::WebSocketProvider::createSocketStreamHandle):
3452         * WebProcess/Network/WebSocketProvider.h:
3453         * WebProcess/Network/WebSocketStream.cpp:
3454         (WebKit::WebSocketStream::create):
3455         (WebKit::WebSocketStream::WebSocketStream):
3456         * WebProcess/Network/WebSocketStream.h:
3457
3458 2020-09-02  Aditya Keerthi  <akeerthi@apple.com>
3459
3460         [macOS] Update date picker when the inner control is edited
3461         https://bugs.webkit.org/show_bug.cgi?id=216004
3462
3463         Reviewed by Wenson Hsieh.
3464
3465         * UIProcess/mac/WebDateTimePickerMac.mm:
3466         (WebKit::WebDateTimePickerMac::showDateTimePicker):
3467
3468         If showDateTimePicker is called while a picker is already being
3469         displayed, call updatePicker: rather than showPicker:.
3470
3471         (-[WKDateTimePicker initWithParams:inView:]):
3472
3473         The NSDatePicker and NSDateFormatter should use a UTC timezone.
3474         This is necessary as all double values passed into WKDateTimePicker
3475         are UTC timestamps. This has no effect on the value returned to
3476         the WebProcess on user selection, as a timezone-agnostic format
3477         string is used.
3478
3479         (-[WKDateTimePicker updatePicker:]):
3480
3481         Set the date value of the owned NSDatePicker to the value in the
3482         DateTimeChooserParameters.
3483
3484 2020-09-01  Hector Lopez  <hector_i_lopez@apple.com>
3485
3486         Unreviewed, reverting r266408.
3487
3488         Revision caused constant crashes on iOS and macOS
3489
3490         Reverted changeset:
3491
3492         "Convert runtime flag to setting for lazy image loading"
3493         https://bugs.webkit.org/show_bug.cgi?id=215610
3494         https://trac.webkit.org/changeset/266408
3495
3496 2020-09-01  Kate Cheney  <katherine_cheney@apple.com>
3497
3498         Pass the correct data size for the SharedMemory::Handle in WebCompiledContentRuleListData::encode
3499         https://bugs.webkit.org/show_bug.cgi?id=216049
3500         <rdar://problem/60758278>
3501
3502         Reviewed by Alex Christensen.
3503
3504         No new tests, validated by existing API tests.
3505
3506         * Shared/WebCompiledContentRuleListData.cpp:
3507         (WebKit::WebCompiledContentRuleListData::encode const):
3508
3509 2020-09-01  Kate Cheney  <katherine_cheney@apple.com>
3510
3511         WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle()
3512         https://bugs.webkit.org/show_bug.cgi?id=211002
3513         <rdar://problem/60103950>
3514
3515         Reviewed by Wenson Hsieh.
3516
3517         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3518         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
3519         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
3520         Check result of SharedMemory::createHandle() and return early
3521         on failure.
3522
3523 2020-09-01  Hector Lopez  <hector_i_lopez@apple.com>
3524
3525         Unreviewed, reverting r266384.
3526
3527         Revision is causing 5 API faliures/timeouts and build failures
3528         on macOS
3529
3530         Reverted changeset:
3531
3532         "Webpages flash when switching between windows"
3533         https://bugs.webkit.org/show_bug.cgi?id=216012
3534         https://trac.webkit.org/changeset/266384
3535
3536 2020-09-01  Per Arne Vollan  <pvollan@apple.com>
3537
3538         [iOS] AGX compiler service sandbox violation
3539         https://bugs.webkit.org/show_bug.cgi?id=216042
3540         <rdar://problem/68111667>
3541
3542         Reviewed by Brent Fulgham.
3543
3544         For a set of devices, mach-lookup sandbox violations have been observed for an AGX compiler service. For these devices,
3545         we currently issue an extension for one AGX compiler service, but this is not sufficient since there is a similar
3546         service name that needs to be added as well.
3547
3548         * Shared/WebProcessCreationParameters.cpp:
3549         (WebKit::WebProcessCreationParameters::encode const):
3550         (WebKit::WebProcessCreationParameters::decode):
3551         * Shared/WebProcessCreationParameters.h:
3552         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3553         (WebKit::agxCompilerServices):
3554         (WebKit::WebProcessPool::platformInitializeWebProcess):
3555         * WebProcess/cocoa/WebProcessCocoa.mm:
3556         (WebKit::WebProcess::platformInitializeWebProcess):
3557
3558 2020-09-01  Rob Buis  <rbuis@igalia.com>
3559
3560         Convert runtime flag to setting for lazy image loading
3561         https://bugs.webkit.org/show_bug.cgi?id=215610
3562
3563         Reviewed by Youenn Fablet.
3564
3565         Remove lazy image loading runtime flag.
3566
3567         * UIProcess/API/C/WKPreferences.cpp:
3568         (WKPreferencesSetLazyImageLoadingEnabled): Deleted.
3569         (WKPreferencesGetLazyImageLoadingEnabled): Deleted.
3570         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3571
3572 2020-09-01  Tim Horton  <timothy_horton@apple.com>
3573
3574         Some apps linked beyond iOS 13.4 don't respect mouse events, only touch events
3575         https://bugs.webkit.org/show_bug.cgi?id=216021
3576         <rdar://problem/64830335>
3577
3578         Reviewed by Wenson Hsieh.
3579
3580         * UIProcess/Cocoa/VersionChecks.h:
3581         * UIProcess/ios/WKContentViewInteraction.mm:
3582         (applicationIsKnownToIgnoreMouseEvents):
3583         (-[WKContentView shouldUseMouseGestureRecognizer]):
3584         Remove Feedly from the list, they are no longer affected.
3585         Add a once-per-app-launch error-level log message to warn developers
3586         of the impending behavior change.
3587         Add three new apps with a later linked-on target.
3588
3589 2020-09-01  Megan Gardner  <megan_gardner@apple.com>
3590
3591         Switch to class method for smart insert/delete
3592         https://bugs.webkit.org/show_bug.cgi?id=215871
3593         <rdar://problem/67281776>
3594
3595         Reviewed by Darin Adler.
3596
3597         No process changes. Covered by existing tests.
3598
3599         * Platform/spi/ios/UIKitSPI.h:
3600         * UIProcess/ios/TextCheckerIOS.mm:
3601         (WebKit::TextChecker::isSmartInsertDeleteEnabled):
3602
3603 2020-09-01  Tim Horton  <timothy_horton@apple.com>
3604
3605         Upstream PencilKit text input support
3606         https://bugs.webkit.org/show_bug.cgi?id=216030
3607
3608         Reviewed by Anders Carlsson.
3609
3610         * UIProcess/ios/WKContentViewInteraction.h:
3611         * UIProcess/ios/WKContentViewInteraction.mm:
3612         (-[WKContentView setUpInteraction]):
3613         (-[WKContentView cleanUpInteraction]):
3614         (-[WKContentView _shouldSimulateKeyboardInputOnTextInsertion]):
3615         (-[WKContentView setUpScribbleInteraction]):
3616         (-[WKContentView cleanUpScribbleInteraction]):
3617         (-[WKContentView _textInputContextByScribbleIdentifier:]):
3618         (-[WKContentView _elementForTextInputContextIsFocused:]):
3619         (-[WKContentView indirectScribbleInteraction:requestElementsInRect:completion:]):
3620         (-[WKContentView indirectScribbleInteraction:isElementFocused:]):
3621         (-[WKContentView indirectScribbleInteraction:focusElementIfNeeded:referencePoint:completion:]):
3622         (-[WKContentView indirectScribbleInteraction:frameForElement:]):
3623         (-[WKContentView indirectScribbleInteraction:willBeginWritingInElement:]):
3624         (-[WKContentView indirectScribbleInteraction:didFinishWritingInElement:]):
3625
3626 2020-09-01  Alex Christensen  <achristensen@webkit.org>
3627
3628         Fix crash during WebPage constructor
3629         https://bugs.webkit.org/show_bug.cgi?id=216028
3630         <rdar://problem/67781279>
3631
3632         Reviewed by Timothy Hatcher.
3633
3634         * WebProcess/WebProcess.cpp:
3635         (WebKit::WebProcess::ensureNetworkProcessConnection):
3636
3637 2020-09-01  Youenn Fablet  <youenn@apple.com>
3638
3639         Enable inspection of WebSocket when opening Web Inspector in the middle of the connection like done for the legacy WebSocket implementation
3640         https://bugs.webkit.org/show_bug.cgi?id=215928
3641
3642         Reviewed by Devin Rousso.
3643
3644         Implement inspector related API and add additional messages for WebSocket frames.
3645
3646         * WebProcess/Network/WebSocketChannel.cpp:
3647         (WebKit::WebSocketChannel::close):
3648         (WebKit::WebSocketChannel::didClose):
3649         (WebKit::WebSocketChannel::didSendHandshakeRequest):
3650         (WebKit::WebSocketChannel::didReceiveHandshakeResponse):
3651         (WebKit::WebSocketChannel::clientHandshakeRequest const):
3652         (WebKit::WebSocketChannel::serverHandshakeResponse const):
3653         (WebKit::WebSocketChannel::handshakeMode const):
3654         * WebProcess/Network/WebSocketChannel.h:
3655
3656 2020-09-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3657
3658         [GTK][WPE] Do not use the default WebsiteDataStore for downloads
3659         https://bugs.webkit.org/show_bug.cgi?id=216001
3660
3661         Reviewed by Adrian Perez de Castro.
3662
3663         Use the web context one instead.
3664
3665         * UIProcess/API/glib/WebKitWebContext.cpp:
3666         (webkitWebContextStartDownload):
3667
3668 2020-08-31  Sihui Liu  <sihui_liu@apple.com>
3669
3670         Webpages flash when switching between windows
3671         https://bugs.webkit.org/show_bug.cgi?id=216012
3672
3673         Reviewed by Darin Adler.
3674
3675         Based on patches from Tim Horton. To avoid flash, we need to make sure view to be selected updates its content 
3676         before UI process commits its transaction. We did this by making UI process block until receiving a reply 
3677         DidUpdateActivityState from web process. However, web process did not make sure the reply would be sent after 
3678         normal rendering update and corresponding transasction commit. Instead, it flushed transactions in progress and 
3679         replied. To fix this, now we make web process reply in transaction commit handler after rendering update.
3680
3681         In the switching case, view to be unselected will detach from root layer in its web process, which makes its 
3682         content empty. This change is independent from the UI process commit, so we want this to happen after UI process
3683         commits (which submits the view hierachy change). Otherwise, empty content(white flash) on the unselected view 
3684         will be displayed. To fix this, we let UI process send the activity state update message in transaction commit 
3685         handler.
3686
3687         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3688         (WebKit::WebPageProxy::scheduleActivityStateUpdate):
3689         * UIProcess/WebPageProxy.cpp:
3690         (WebKit::m_limitsNavigationsToAppBoundDomains):
3691         (WebKit::WebPageProxy::setSuppressVisibilityUpdates):
3692         (WebKit::WebPageProxy::activityStateDidChange):
3693         (WebKit::WebPageProxy::dispatchActivityStateChange):
3694         * UIProcess/WebPageProxy.h:
3695         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3696         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3697         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3698         (WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacksIfNeeded):
3699         (WebKit::TiledCoreAnimationDrawingArea::updateRendering):
3700         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
3701         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired): Deleted.
3702
3703 2020-08-31  Tim Horton  <timothy_horton@apple.com>
3704
3705         Upstream support for image picker confirmation and downscaling
3706         https://bugs.webkit.org/show_bug.cgi?id=215997
3707
3708         Reviewed by Anders Carlsson.
3709
3710         * UIProcess/ios/WKContentViewInteraction.h:
3711         * UIProcess/ios/WKContentViewInteraction.mm:
3712         (-[WKContentView _showRunOpenPanel:frameInfo:resultListener:]):
3713         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3714         (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
3715         (-[WKFileUploadPanel _configureImagePicker:]): Deleted.
3716
3717 2020-08-31  Sam Weinig  <weinig@apple.com>
3718
3719         Many settings in RuntimeEnabledSettings should autogenerated Settings: Part 1
3720         https://bugs.webkit.org/show_bug.cgi?id=215981
3721
3722         Reviewed by Darin Adler.
3723
3724         This moves an initial chunk of RuntimeEnabledSettings settings to Settings.yaml, focusing
3725         on settings that don't require substantial refactoring or new features to work in Settings.yaml.
3726         
3727         In WebKit, this means mostly removing now unnecessary use of the webcoreBinding key in 
3728         WebPreferences.yaml and removing now superfluous cases in InjectedBundle::overrideBoolPreferenceForTestRunner.
3729
3730         * Shared/WebPreferences.yaml:
3731         Removing now unnecessary use of the webcoreBinding key and fix indentation of a few cases.
3732
3733         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3734         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3735         Remove now superfluous cases, as each boolean Settings based setting gets handled automatically.
3736  
3737         * WebProcess/WebPage/WebPage.cpp:
3738         (WebKit::WebPage::updatePreferences):
3739         Remove explicit setting of setInteractiveFormValidationEnabled now that we don't have the
3740         RuntimeEnabledSettings variant being set by the generator.
3741
3742 2020-08-31  Hector Lopez  <hector_i_lopez@apple.com>
3743
3744         Unreviewed, reverting r266350.
3745
3746         Revision is causing a constant crash on both macOS and iOS
3747
3748         Reverted changeset:
3749
3750         "Convert runtime flag to setting for lazy image loading"
3751         https://bugs.webkit.org/show_bug.cgi?id=215610
3752         https://trac.webkit.org/changeset/266350
3753
3754 2020-08-31  Rob Buis  <rbuis@igalia.com>
3755
3756         Convert runtime flag to setting for lazy image loading
3757         https://bugs.webkit.org/show_bug.cgi?id=215610
3758
3759         Reviewed by Youenn Fablet.
3760
3761         Remove lazy image loading runtime flag.
3762
3763         * Shared/WebPreferences.yaml:
3764         * UIProcess/API/C/WKPreferences.cpp:
3765         (WKPreferencesSetLazyImageLoadingEnabled): Deleted.
3766         (WKPreferencesGetLazyImageLoadingEnabled): Deleted.
3767         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3768
3769 2020-08-31  Youenn Fablet  <youenn@apple.com>
3770
3771         [Cocoa] Disable sniffing for WebSocket handshakes
3772         https://bugs.webkit.org/show_bug.cgi?id=215932
3773
3774         Reviewed by Darin Adler.
3775
3776         Covered by http/tests/websocket/tests/hybi/handshake-error.html no longer timing out with NSURLSession WebSocket code path.
3777
3778         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3779         (WebKit::NetworkSessionCocoa::createWebSocketTask):
3780
3781 2020-08-30  Tim Horton  <timothy_horton@apple.com>
3782
3783         Remove unused editable image code
3784         https://bugs.webkit.org/show_bug.cgi?id=215991
3785
3786         Reviewed by Simon Fraser.
3787
3788         * DerivedSources.make:
3789         * Platform/spi/ios/PencilKitSPI.h: Removed.
3790         * Shared/FocusedElementInformation.cpp:
3791         (WebKit::FocusedElementInformation::encode const):
3792         (WebKit::FocusedElementInformation::decode):
3793         * Shared/FocusedElementInformation.h:
3794         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
3795         (WebKit::RemoteLayerBackingStore::drawInContext):
3796         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3797         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3798         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
3799         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
3800         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
3801         * Shared/WebPreferences.yaml:
3802         * SourcesCocoa.txt:
3803         * UIProcess/API/Cocoa/WKWebView.mm:
3804         (-[WKWebView _setupPageConfiguration:]):
3805         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3806         (-[WKWebViewConfiguration init]):
3807         (-[WKWebViewConfiguration copyWithZone:]):
3808         (-[WKWebViewConfiguration _setEditableImagesEnabled:]): Deleted.
3809         (-[WKWebViewConfiguration _editableImagesEnabled]): Deleted.
3810         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3811         * UIProcess/API/ios/WKWebViewIOS.h:
3812         * UIProcess/API/ios/WKWebViewIOS.mm:
3813         (-[WKWebView _setupScrollAndContentViews]):
3814         (-[WKWebView _stylusTapGestureShouldCreateEditableImage]): Deleted.
3815         * UIProcess/PageClient.h:
3816         (WebKit::PageClient::createDrawingView): Deleted.
3817         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
3818         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3819         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
3820         (WebKit::RemoteLayerTreeHost::clearLayers):
3821         (WebKit::RemoteLayerTreeHost::makeNode):
3822         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3823         (WebKit::RemoteLayerTreeHost::makeNode):
3824         (WebKit::RemoteLayerTreeHost::createEmbeddedView): Deleted.
3825         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
3826         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3827         (-[WKEmbeddedView initWithEmbeddedViewID:]): Deleted.
3828         * UIProcess/WebPageProxy.cpp:
3829         (WebKit::WebPageProxy::didAttachToRunningProcess):
3830         (WebKit::WebPageProxy::resetState):
3831         (WebKit::WebPageProxy::willUpdateAttachmentAttributes):
3832         * UIProcess/WebPageProxy.h:
3833         (WebKit::WebPageProxy::editableImageController): Deleted.
3834         * UIProcess/ios/EditableImageController.h: Removed.
3835         * UIProcess/ios/EditableImageController.messages.in: Removed.
3836         * UIProcess/ios/EditableImageController.mm: Removed.
3837         * UIProcess/ios/PageClientImplIOS.h:
3838         * UIProcess/ios/PageClientImplIOS.mm:
3839         (WebKit::PageClientImpl::createDrawingView): Deleted.
3840         * UIProcess/ios/PencilKitSoftLink.h: Removed.
3841         * UIProcess/ios/PencilKitSoftLink.mm: Removed.
3842         * UIProcess/ios/WKContentViewInteraction.h:
3843         * UIProcess/ios/WKContentViewInteraction.mm:
3844         (-[WKContentView setUpInteraction]):
3845         (-[WKContentView cleanUpInteraction]):
3846         (-[WKContentView _removeDefaultGestureRecognizers]):
3847         (-[WKContentView _addDefaultGestureRecognizers]):
3848         (-[WKContentView gestureRecognizerShouldBegin:]):
3849         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
3850         (-[WKContentView _elementDidBlur]):
3851         (-[WKContentView _stylusSingleTapRecognized:]): Deleted.
3852         (-[WKContentView _drawingCoordinator]): Deleted.
3853         * UIProcess/ios/WKDrawingCoordinator.h: Removed.
3854         * UIProcess/ios/WKDrawingCoordinator.mm: Removed.
3855         * UIProcess/ios/WKDrawingView.h: Removed.
3856         * UIProcess/ios/WKDrawingView.mm: Removed.
3857         * UIProcess/ios/WebPageProxyIOS.mm:
3858         (WebKit::WebPageProxy::handleStylusSingleTapAtPoint): Deleted.
3859         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3860         * WebKit.xcodeproj/project.pbxproj:
3861         * WebProcess/WebCoreSupport/WebChromeClient.h:
3862         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3863         (WebKit::WebChromeClient::associateEditableImageWithAttachment): Deleted.
3864         (WebKit::WebChromeClient::didCreateEditableImage): Deleted.
3865         (WebKit::WebChromeClient::didDestroyEditableImage): Deleted.
3866         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
3867         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView): Deleted.
3868         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
3869         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3870         (WebKit::PlatformCALayerRemote::createForEmbeddedView): Deleted.
3871         (WebKit::PlatformCALayerRemote::embeddedViewID const): Deleted.
3872         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
3873         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
3874         (WebKit::RemoteLayerTreeContext::layerDidEnterContext):
3875         * WebProcess/WebPage/WebPage.h:
3876         * WebProcess/WebPage/WebPage.messages.in:
3877         * WebProcess/WebPage/ios/WebPageIOS.mm:
3878         (WebKit::isAssistableElement):
3879         (WebKit::WebPage::getFocusedElementInformation):
3880         (WebKit::WebPage::handleStylusSingleTapAtPoint): Deleted.
3881
3882 2020-08-28  Tim Horton  <timothy_horton@apple.com>
3883
3884         Sites built with flambe.js don't work with trackpad on iPad
3885         https://bugs.webkit.org/show_bug.cgi?id=215954
3886
3887         Reviewed by Wenson Hsieh.
3888
3889         New API Test: iOSMouseSupport.MouseTimestampTimebase
3890
3891         * UIProcess/ios/WKMouseGestureRecognizer.mm:
3892         (-[WKMouseGestureRecognizer createMouseEventWithType:]):
3893         Use the timestamp property on UITouch instead of GSCurrentEventTimestamp().
3894         This property is in the same units as mach_absolute_time/MonotonicTime.
3895         Previously, treating a monotonic time as wall time resulted in it getting clamped to 0,
3896         breaking sites that depend on it.
3897
3898 2020-08-28  Per Arne Vollan  <pvollan@apple.com>
3899
3900         [macOS] Fix iokit-get-properties sandbox violations
3901         https://bugs.webkit.org/show_bug.cgi?id=215925
3902
3903         Reviewed by Brent Fulgham.
3904
3905         Add iokit-property to WebContent sandbox that should have been a part of r266282.
3906
3907         * WebProcess/com.apple.WebProcess.sb.in:
3908
3909 2020-08-28  Darin Adler  <darin@apple.com>
3910
3911         Remove almost all the remaining uses of live ranges
3912         https://bugs.webkit.org/show_bug.cgi?id=215755
3913
3914         Reviewed by Sam Weinig.
3915
3916         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
3917         (webkit_dom_range_compare_boundary_points): Update for rename of
3918         compareBoundaryPointsForBindings.
3919         (webkit_dom_range_intersects_node): Removed exception handling.
3920         (webkit_dom_range_get_text): Use plainText.
3921
3922         * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
3923         (-[WKDOMRange initWithDocument:]): Tightened up into a one-liner.
3924         (-[WKDOMRange text]): Use plainText.
3925         (-[WKDOMRange textRects]): Stopped using Range::ownerDocument.
3926
3927         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
3928         (WebKit::InjectedBundleRangeHandle::document): Stopped using
3929         Range::ownerDocument.
3930         (WebKit::InjectedBundleRangeHandle::boundingRectInWindowCoordinates const):
3931         Ditto.
3932         (WebKit::InjectedBundleRangeHandle::renderedImage): Ditto.
3933         (WebKit::InjectedBundleRangeHandle::text const): Use plainText.
3934
3935         * WebProcess/WebPage/glib/WebPageGLib.cpp:
3936         (WebKit::WebPage::getPlatformEditorState const): Use contains.
3937
3938         * WebProcess/WebPage/ios/WebPageIOS.mm:
3939         (WebKit::WebPage::requestDocumentEditingContext): Use intersects.
3940
3941 2020-08-28  Alex Christensen  <achristensen@webkit.org>
3942
3943         REGRESSION(r266187): ARGUMENT BAD: WebIconUtilities.mm(138) : RetainPtr<UIImage> WebKit::iconForFile(NSURL *) file, [file isFileURL]
3944         https://bugs.webkit.org/show_bug.cgi?id=215931
3945
3946         Reviewed by Wenson Hsieh.
3947
3948         It's possible for JavaScript to make a filename that doesn't convert to a file URL, such as the empty string.
3949         When this happens, we would've returned null for the icon later anyways, but adding a null check prevents an assertion.
3950         Covered by 7 existing tests which would have hit that assertion.
3951
3952         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3953         (WebKit::WebChromeClient::createIconForFiles):
3954
3955 2020-08-28  Youenn Fablet  <youenn@apple.com>
3956
3957         Enable TransformStream by default
3958         https://bugs.webkit.org/show_bug.cgi?id=215891
3959
3960         Reviewed by Darin Adler.
3961
3962         * Shared/WebPreferences.yaml:
3963
3964 2020-08-28  Per Arne Vollan  <pvollan@apple.com>
3965
3966         [macOS] Fix iokit-get-properties sandbox violations
3967         https://bugs.webkit.org/show_bug.cgi?id=215925
3968
3969         Reviewed by Darin Adler.
3970
3971         A few iokit properties needs to be added to the WebContent process' sandbox after observing these being in use.
3972
3973         * WebProcess/com.apple.WebProcess.sb.in:
3974
3975 2020-08-27  John Wilander  <wilander@apple.com>
3976
3977         Remove the feature flag for capped cookies set in 3rd-party CNAME cloaked HTTP responses and add ITP debug logging
3978         https://bugs.webkit.org/show_bug.cgi?id=215902
3979         <rdar://problem/66699731>
3980
3981         Reviewed by Brent Fulgham.
3982
3983         This change removes the feature flag, effectively turning the feature on.
3984         It also adds log output of cookie names that have been capped when ITP
3985         Debug Mode is enabled.
3986
3987         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3988         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
3989             Now sets the flag in WebCore::NetworkStorageSession through the new function
3990             WebCore::NetworkStorageSession::setResourceLoadStatisticsDebugLoggingEnabled().
3991         * NetworkProcess/NetworkProcess.cpp:
3992         (WebKit::NetworkProcess::resetParametersToDefaultValues):
3993         (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
3994         * NetworkProcess/NetworkSession.cpp:
3995         (WebKit::NetworkSession::NetworkSession):
3996         (WebKit::NetworkSession::setFirstPartyHostCNAMEDomain):
3997         (WebKit::NetworkSession::firstPartyHostCNAMEDomain):
3998         * NetworkProcess/NetworkSession.h:
3999         (WebKit::NetworkSession::setCNAMECloakingMitigationEnabled): Deleted.
4000         (WebKit::NetworkSession::cnameCloakingMitigationEnabled const): Deleted.
4001         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
4002         (WebKit::NetworkDataTaskCocoa::updateFirstPartyInfoForSession):
4003         (WebKit::NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking):
4004         * Shared/ResourceLoadStatisticsParameters.h:
4005         (WebKit::ResourceLoadStatisticsParameters::encode const):
4006         (WebKit::ResourceLoadStatisticsParameters::decode):
4007         * Shared/WebPreferences.yaml:
4008         * UIProcess/WebProcessPool.cpp:
4009         (WebKit::WebProcessPool::ensureNetworkProcess):
4010         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
4011         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
4012         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
4013         (WebKit::WebsiteDataStore::parameters):
4014
4015 2020-08-27  Devin Rousso  <drousso@apple.com>
4016
4017         [iOS] provide a way to get previously inserted alternatives for the selected text
4018         https://bugs.webkit.org/show_bug.cgi?id=215816
4019         <rdar://problem/66646042>
4020
4021         Reviewed by Darin Adler.
4022
4023         * UIProcess/ios/WKContentViewInteraction.mm:
4024         (-[WKContentView alternativesForSelectedText]):