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