2021-03-31 Kocsen Chung Cherry-pick r275316. rdar://problem/76078629 REGRESSION: The NetworkProcess fails to relaunch after it crashes https://bugs.webkit.org/show_bug.cgi?id=224022 Reviewed by Darin Adler. NetworkProcessProxy::networkProcessCrashed() failed to clear defaultNetworkProcess() like we do on network process termination (in NetworkProcessProxy::didTerminate()). As a result, upon a network process crash, WebsiteDataStore::networkProcessCrashed() would get called and properly clear WebsiteDataStore::m_networkProcess. However, when calling WebsiteDataStore::networkProcess() later on, it would re-initialize m_networkProcess with the same dead NetworkProcessProxy, since networkProcessForSession() relies on NetworkProcessProxy::defaultNetworkProcess(). No new tests, will land an API test shortly as a follow-up. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::networkProcessCrashed): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275316 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-31 Chris Dumez REGRESSION: The NetworkProcess fails to relaunch after it crashes https://bugs.webkit.org/show_bug.cgi?id=224022 Reviewed by Darin Adler. NetworkProcessProxy::networkProcessCrashed() failed to clear defaultNetworkProcess() like we do on network process termination (in NetworkProcessProxy::didTerminate()). As a result, upon a network process crash, WebsiteDataStore::networkProcessCrashed() would get called and properly clear WebsiteDataStore::m_networkProcess. However, when calling WebsiteDataStore::networkProcess() later on, it would re-initialize m_networkProcess with the same dead NetworkProcessProxy, since networkProcessForSession() relies on NetworkProcessProxy::defaultNetworkProcess(). No new tests, will land an API test shortly as a follow-up. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::networkProcessCrashed): 2021-03-23 Russell Epstein Cherry-pick r274129. rdar://problem/75744624 Regression(r273875): Potential over-release in WKRemoteObjectCoder's decodeObjCObject() https://bugs.webkit.org/show_bug.cgi?id=222954 Reviewed by Darin Adler. r273875 added an adoptNS() for the result of `[allocation initWithCoder:decoder]`. This would be fine in general, except that we call awakeAfterUsingCoder on the result right after. As per the awakeAfterUsingCoder documentation [1], it may return the receiver or a new object. When it returns a new object, it takes care of releasing the receiver. This is an issue for us here since we were holding the receiver in a smart pointer. [1] https://developer.apple.com/documentation/objectivec/nsobject/1417074-awakeafterusingcoder * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (decodeObjCObject): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274129 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-08 Chris Dumez Regression(r273875): Potential over-release in WKRemoteObjectCoder's decodeObjCObject() https://bugs.webkit.org/show_bug.cgi?id=222954 Reviewed by Darin Adler. r273875 added an adoptNS() for the result of `[allocation initWithCoder:decoder]`. This would be fine in general, except that we call awakeAfterUsingCoder on the result right after. As per the awakeAfterUsingCoder documentation [1], it may return the receiver or a new object. When it returns a new object, it takes care of releasing the receiver. This is an issue for us here since we were holding the receiver in a smart pointer. [1] https://developer.apple.com/documentation/objectivec/nsobject/1417074-awakeafterusingcoder * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (decodeObjCObject): 2021-03-22 Russell Epstein Cherry-pick r274790. rdar://problem/75712649 Allow additional fcntl https://bugs.webkit.org/show_bug.cgi?id=223590 Reviewed by Brent Fulgham. An additional fcntl is being used and should be allowed. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274790 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-22 Per Arne Allow additional fcntl https://bugs.webkit.org/show_bug.cgi?id=223590 Reviewed by Brent Fulgham. An additional fcntl is being used and should be allowed. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-03-19 Russell Epstein Cherry-pick r273875. rdar://problem/75635901 WKRemoteObjectCoder should be able to handle NSErrors from TLS failures https://bugs.webkit.org/show_bug.cgi?id=222401 Source/WebKit: Patch by Alex Christensen on 2021-03-03 Reviewed by Chris Dumez. NSErrors from TLS failures contain values like a SecTrustRef or a SecCertificateRef, which are not ObjC objects, and they don't like it when you call encodeWithCoder: on them. Until r273141 it would crash when we do, but even after that we just decode a nil NSError. Add a special case like we did in encodeNSError to successfully encode and decode these errors. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (decodeObjCObject): (transformCertificatesToData): (transformTrustToData): (encodeError): (transformDataToCertificates): (transformDataToTrust): (decodeError): (encodeObject): (decodeObject): Tools: Patch by Alex Christensen on 2021-03-03 Reviewed by Chris Dumez. * TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistry.h: * TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistry.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/RemoteObjectRegistryPlugIn.mm: (-[RemoteObjectRegistryPlugIn sendError:completionHandler:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273875 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-03 Alex Christensen WKRemoteObjectCoder should be able to handle NSErrors from TLS failures https://bugs.webkit.org/show_bug.cgi?id=222401 Reviewed by Chris Dumez. NSErrors from TLS failures contain values like a SecTrustRef or a SecCertificateRef, which are not ObjC objects, and they don't like it when you call encodeWithCoder: on them. Until r273141 it would crash when we do, but even after that we just decode a nil NSError. Add a special case like we did in encodeNSError to successfully encode and decode these errors. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (decodeObjCObject): (transformCertificatesToData): (transformTrustToData): (encodeError): (transformDataToCertificates): (transformDataToTrust): (decodeError): (encodeObject): (decodeObject): 2021-03-19 Russell Epstein Apply patch. rdar://problem/75625529 2021-03-19 Per Arne Vollan [macOS] Reduce telemetry backtrace in sandbox https://bugs.webkit.org/show_bug.cgi?id=223515 Reviewed by Brent Fulgham. Reduce telemetry backtrace in the WebContent sandbox on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2021-03-16 Alan Coon Cherry-pick r274504. rdar://problem/75482851 The WebContent process crashes when launching Safari https://bugs.webkit.org/show_bug.cgi?id=223264 Reviewed by Brent Fulgham. The WebContent process crashes when launching Safari on older OSes, because of unavailable sandbox features. * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274504 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-16 Per Arne Vollan The WebContent process crashes when launching Safari https://bugs.webkit.org/show_bug.cgi?id=223264 Reviewed by Brent Fulgham. The WebContent process crashes when launching Safari on older OSes, because of unavailable sandbox features. * WebProcess/com.apple.WebProcess.sb.in: 2021-03-16 Ruben Turcios Cherry-pick r274462. rdar://problem/75485338 Unreviewed, revert r272629 as it caused regressions in some apps https://bugs.webkit.org/show_bug.cgi?id=223232 * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: * UIProcess/Cocoa/WKBlankOverlayView.h: Removed. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): * UIProcess/mac/WebPageProxyMac.mm: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): * WebProcess/WebPage/mac/WebPageMac.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274462 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-15 Chris Dumez Unreviewed, revert r272629 as it caused regressions in some apps https://bugs.webkit.org/show_bug.cgi?id=223232 * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: * UIProcess/Cocoa/WKBlankOverlayView.h: Removed. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): * UIProcess/mac/WebPageProxyMac.mm: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): * WebProcess/WebPage/mac/WebPageMac.mm: 2021-03-15 Ruben Turcios Cherry-pick r274439. rdar://problem/75450672 Enforce subcommand filtering https://bugs.webkit.org/show_bug.cgi?id=223192 Reviewed by Brent Fulgham. Enforce subcommand filtering in the WebContent process' sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274439 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-15 Per Arne Vollan Enforce subcommand filtering https://bugs.webkit.org/show_bug.cgi?id=223192 Reviewed by Brent Fulgham. Enforce subcommand filtering in the WebContent process' sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-03-10 Russell Epstein Cherry-pick r274231. rdar://problem/75290553 [iOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223035 Reviewed by Geoffrey Garen. Add additional telemetry to WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274231 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-10 Per Arne [iOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223035 Reviewed by Geoffrey Garen. Add additional telemetry to WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-03-11 Ruben Turcios Cherry-pick r274295. rdar://problem/75290553 [macOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223080 Reviewed by Brent Fulgham. Add additional telemetry to WebContent sandbox on macOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274295 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-11 Per Arne Vollan [macOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223080 Reviewed by Brent Fulgham. Add additional telemetry to WebContent sandbox on macOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-03-08 Russell Epstein Cherry-pick r273997. rdar://problem/75180339 Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate https://bugs.webkit.org/show_bug.cgi?id=222809 Reviewed by Michael Catanzaro. Source/WebKit: There was a PageLoadState::Transaction in resetStateAfterProcessTermination() that was previously making sure we would not clear the WebView's URL before calling the processDidTerminate client delegate. Now that we call the client delegate in a separate function (WebPageProxy::dispatchProcessDidTerminate), we need to make move the PageLoadState::Transaction to the caller in WebProcessProxy::processDidTerminateOrFailedToLaunch(), so that its scope covers both resetStateAfterProcessTermination() & dispatchProcessDidTerminate() calls. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetStateAfterProcessTermination): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm: (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273997 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-05 Chris Dumez Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate https://bugs.webkit.org/show_bug.cgi?id=222809 Reviewed by Michael Catanzaro. There was a PageLoadState::Transaction in resetStateAfterProcessTermination() that was previously making sure we would not clear the WebView's URL before calling the processDidTerminate client delegate. Now that we call the client delegate in a separate function (WebPageProxy::dispatchProcessDidTerminate), we need to make move the PageLoadState::Transaction to the caller in WebProcessProxy::processDidTerminateOrFailedToLaunch(), so that its scope covers both resetStateAfterProcessTermination() & dispatchProcessDidTerminate() calls. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetStateAfterProcessTermination): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2021-03-02 Alan Coon Cherry-pick r273695. rdar://problem/74940739 Crash under WebProcessPool::pageBeginUsingWebsiteDataStore() https://bugs.webkit.org/show_bug.cgi?id=222574 Reviewed by Geoffrey Garen. Source/WebKit: The issue was that when WebProcessProxy::requestTermination() was called (e.g. process is killed by WebKit for using too much memory), we would fail to remove the process from the WebProcessCache. Because the terminated would stay in the cache (even though WebProcessProxy::shutDown() was called), we could potentially try and use it later on for a navigation to the same domain. This would lead to crashes because WebProcessProxy::shutDown() has already been called. Note that we were previously correctly removing the process from the cache in case of a proper crash, inside WebProcessProxy::processDidTerminateOrFailedToLaunch(). I have moved the logic to remove from the cache from processDidTerminateOrFailedToLaunch() to shutDown() to avoid similar issues in the future. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _requestWebProcessTermination:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273695 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-01 Chris Dumez Crash under WebProcessPool::pageBeginUsingWebsiteDataStore() https://bugs.webkit.org/show_bug.cgi?id=222574 Reviewed by Geoffrey Garen. The issue was that when WebProcessProxy::requestTermination() was called (e.g. process is killed by WebKit for using too much memory), we would fail to remove the process from the WebProcessCache. Because the terminated would stay in the cache (even though WebProcessProxy::shutDown() was called), we could potentially try and use it later on for a navigation to the same domain. This would lead to crashes because WebProcessProxy::shutDown() has already been called. Note that we were previously correctly removing the process from the cache in case of a proper crash, inside WebProcessProxy::processDidTerminateOrFailedToLaunch(). I have moved the logic to remove from the cache from processDidTerminateOrFailedToLaunch() to shutDown() to avoid similar issues in the future. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _requestWebProcessTermination:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2021-03-01 Alan Coon Cherry-pick r273564. rdar://problem/74886917 [Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created https://bugs.webkit.org/show_bug.cgi?id=222473 Reviewed by Eric Carlson. Source/WebCore: Currently, VP9 decoders are registered when a Web page is created in the WebContent process. Instead, VP9 decoders can be registered when PlatformMediaSessionManager is created, which should be a slight performance improvement, since calls into media frameworks will then not be made unconditionally when creating a Web page, but delayed until required. No new tests, covered by existing tests. * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::setShouldEnableVP9Decoder): (WebCore::PlatformMediaSessionManager::shouldEnableVP9Decoder): (WebCore::PlatformMediaSessionManager::setShouldEnableVP8Decoder): (WebCore::PlatformMediaSessionManager::shouldEnableVP8Decoder): (WebCore::PlatformMediaSessionManager::setShouldEnableVP9SWDecoder): (WebCore::PlatformMediaSessionManager::shouldEnableVP9SWDecoder): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (WebCore::MediaSessionManagerCocoa::MediaSessionManagerCocoa): Source/WebKit: Currently, VP9 decoders are registered when a Web page is created in the WebContent process. Instead, VP9 decoders can be registered when PlatformMediaSessionManager is created, which should be a slight performance improvement, since calls into media frameworks will then not be made unconditionally when creating a Web page, but delayed until required. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_lastNavigationWasAppBound): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): Deleted. (WebKit::WebProcess::enableVP8SWDecoder): Deleted. (WebKit::WebProcess::enableVP9SWDecoder): Deleted. * WebProcess/WebProcess.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273564 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-26 Per Arne [Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created https://bugs.webkit.org/show_bug.cgi?id=222473 Reviewed by Eric Carlson. Currently, VP9 decoders are registered when a Web page is created in the WebContent process. Instead, VP9 decoders can be registered when PlatformMediaSessionManager is created, which should be a slight performance improvement, since calls into media frameworks will then not be made unconditionally when creating a Web page, but delayed until required. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_lastNavigationWasAppBound): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): Deleted. (WebKit::WebProcess::enableVP8SWDecoder): Deleted. (WebKit::WebProcess::enableVP9SWDecoder): Deleted. * WebProcess/WebProcess.h: 2021-03-01 Kocsen Chung Cherry-pick r273590. rdar://problem/74881385 Non-cookie website data not deleted after 7 days of browser use without user interaction https://bugs.webkit.org/show_bug.cgi?id=222248 Reviewed by Brent Fulgham and informally by Kate Cheney. Source/WebKit: Tests: http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago.html http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago.html * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::updateOperatingDatesParameters): Now sets two new member variables: - Optional m_longWindowOperatingDate - Optional m_shortWindowOperatingDate These are only set if the minimum number of operating days has passed. This function no longer sets m_leastRecentOperatingDate. (WebKit::ResourceLoadStatisticsDatabaseStore::hasStatisticsExpired const): Now checks against the two new member variables m_longWindowOperatingDate and m_shortWindowOperatingDate. This fixes the bug. (WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting): Test infrastructure. Now takes the new parameter numberOfOperatingDaysPassed with which layout tests can control the exact number of operating days passed since user interaction. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: Added m_longWindowOperatingDate and m_shortWindowOperatingDate, and removed m_leastRecentOperatingDate since it's no longer used. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::insertExpiredStatisticForTesting): Test infrastructure. The same changes as in the DB store. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::insertExpiredStatisticForTesting): Test infrastructure. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::insertExpiredStatisticForTesting): Test infrastructure. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetStatisticsExpiredStatistic): Test infrastructure. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::insertExpiredStatisticForTesting): Test infrastructure. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::insertExpiredStatisticForTesting): Test infrastructure. * UIProcess/WebsiteData/WebsiteDataStore.h: Tools: A new numberOfOperatingDaysPassed parameter was added to testRunner.setStatisticsExpiredStatistic() to control the exact number of operating days passed since user interaction. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setStatisticsExpiredStatistic): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setStatisticsExpiredStatistic): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): LayoutTests: Existing test cases now make use of the new numberOfOperatingDaysPassed parameter to testRunner.setStatisticsExpiredStatistic() to control the exact number of operating days passed since user interaction. A new test case makes sure website data is not deleted below the threshold. * http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago-expected.txt: Added. * http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago.html: Added. Sets numberOfOperatingDaysPassed to 6. * http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago-expected.txt: Renamed from LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-statistics-with-no-user-interaction-expected.txt. * http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago.html: Renamed from LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-statistics-with-no-user-interaction.html. Sets numberOfOperatingDaysPassed to 7. * http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html: Sets numberOfOperatingDaysPassed to 30. * platform/wk2/TestExpectations: Updated existing expectation with new file name. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273590 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-26 John Wilander Non-cookie website data not deleted after 7 days of browser use without user interaction https://bugs.webkit.org/show_bug.cgi?id=222248 Reviewed by Brent Fulgham and informally by Kate Cheney. Tests: http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago.html http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago.html * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::updateOperatingDatesParameters): Now sets two new member variables: - Optional m_longWindowOperatingDate - Optional m_shortWindowOperatingDate These are only set if the minimum number of operating days has passed. This function no longer sets m_leastRecentOperatingDate. (WebKit::ResourceLoadStatisticsDatabaseStore::hasStatisticsExpired const): Now checks against the two new member variables m_longWindowOperatingDate and m_shortWindowOperatingDate. This fixes the bug. (WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting): Test infrastructure. Now takes the new parameter numberOfOperatingDaysPassed with which layout tests can control the exact number of operating days passed since user interaction. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: Added m_longWindowOperatingDate and m_shortWindowOperatingDate, and removed m_leastRecentOperatingDate since it's no longer used. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::insertExpiredStatisticForTesting): Test infrastructure. The same changes as in the DB store. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::insertExpiredStatisticForTesting): Test infrastructure. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::insertExpiredStatisticForTesting): Test infrastructure. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetStatisticsExpiredStatistic): Test infrastructure. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::insertExpiredStatisticForTesting): Test infrastructure. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::insertExpiredStatisticForTesting): Test infrastructure. * UIProcess/WebsiteData/WebsiteDataStore.h: 2021-02-25 Russell Epstein Cherry-pick r273452. rdar://problem/74753294 [iOS] Get default value in the UI process for whether synchronous XMLHttpRequest are allowed during unload https://bugs.webkit.org/show_bug.cgi?id=222377 Reviewed by Brent Fulgham. Getting this default value in the UI process instead of in every WebContent process should be a small speedup, since getting this default value is a bit costly on iOS. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/ios/WebPreferencesDefaultValuesIOS.h: Added. * Shared/ios/WebPreferencesDefaultValuesIOS.mm: (WebKit::cachedAllowsRequest): (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload): (WebKit::setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_lastNavigationWasAppBound): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273452 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-24 Per Arne Vollan [iOS] Get default value in the UI process for whether synchronous XMLHttpRequest are allowed during unload https://bugs.webkit.org/show_bug.cgi?id=222377 Reviewed by Brent Fulgham. Getting this default value in the UI process instead of in every WebContent process should be a small speedup, since getting this default value is a bit costly on iOS. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/ios/WebPreferencesDefaultValuesIOS.h: Added. * Shared/ios/WebPreferencesDefaultValuesIOS.mm: (WebKit::cachedAllowsRequest): (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload): (WebKit::setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_lastNavigationWasAppBound): 2021-01-25 Chris Dumez Unreviewed, add missing header includes to address build issues. * UIProcess/API/Cocoa/WKUserScript.mm: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: * UIProcess/Cocoa/AutomationClient.mm: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: 2021-02-25 Alan Coon Cherry-pick r272203. rdar://problem/74451201 WKASCAuthorizationPresenterDelegate needs to import RunLoop.h and BlockPtr.h https://bugs.webkit.org/show_bug.cgi?id=221250 Reviewed by Antti Koivisto. * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272203 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-02 Antoine Quint WKASCAuthorizationPresenterDelegate needs to import RunLoop.h and BlockPtr.h https://bugs.webkit.org/show_bug.cgi?id=221250 Reviewed by Antti Koivisto. * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: 2021-02-25 Alan Coon Cherry-pick r272039. rdar://problem/74451201 [GPUP][MSE] A video element does not fire “canplaythrough” event if SourceBuffer.abort() is called https://bugs.webkit.org/show_bug.cgi?id=220964 Reviewed by Jer Noble. Source/WebCore: This patch removes `initializationSegmentIsHandledSemaphore` from both `SourceBufferParserAVFObjC` and `SourceBufferParserWebM`, and implements a media sample cache mechanism in `SourceBufferPrivateAVFObjC` to ensure that "Coded Frame Processing" steps execute after `SourceBufferPrivate` has handled the initialization segment and enabled video/audio tracks. Without the cache mechanism, some media samples following the initialization segment may be dropped when we run `SourceBufferPrivateAVFObjC` in the GPU process, and the media element won't fire "canplaythrough" event because it cannot change its ready state to a value greater than HAVE_METADATA. This patch also implements the mechanism to make sure `SourceBufferPrivateAVFObjC::appendCompleted()` runs after all media samples have gone through the "Coded Frame Processing" steps, so that the source buffer object will fire "update" and "updateend" event after the parser has completedly parsed the appended buffer. * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferParserAVFObjC.mm: (WebCore::SourceBufferParserAVFObjC::SourceBufferParserAVFObjC): (WebCore::SourceBufferParserAVFObjC::~SourceBufferParserAVFObjC): (WebCore::SourceBufferParserAVFObjC::appendData): Add a parameter "CompletionHandler" to notify the caller that the parser has parsed the whole buffer. (WebCore::SourceBufferParserAVFObjC::flushPendingMediaData): (WebCore::SourceBufferParserAVFObjC::resetParserState): (WebCore::SourceBufferParserAVFObjC::invalidate): (WebCore::SourceBufferParserAVFObjC::didParseStreamDataAsAsset): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): (WebCore::SourceBufferPrivateAVFObjC::didParseInitializationData): After `SourceBufferPrivateClient` has done the configuration with the initialization segment, we need to push the cached media samples (if any) to `SourceBufferPrivate` to run the "Coded Frame Processing" steps. And we need to call "appendCompleted()" if there is a pending callback. (WebCore::SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackId): `SourceBufferPrivateAVFObjC` needs to cache the media sample if the initialization segment has not been processed by `SourceBufferPrivateClient` yet. (WebCore::SourceBufferPrivateAVFObjC::append): We need to postpone the "appendCompleted()" callback if there are cached media samples. (WebCore::SourceBufferPrivateAVFObjC::appendCompleted): (WebCore::SourceBufferPrivateAVFObjC::abort): (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): (WebCore::SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackID): Deleted. * platform/graphics/cocoa/SourceBufferParser.h: * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::SourceBufferParserWebM::SourceBufferParserWebM): (WebCore::SourceBufferParserWebM::~SourceBufferParserWebM): (WebCore::SourceBufferParserWebM::appendData): (WebCore::SourceBufferParserWebM::flushPendingMediaData): (WebCore::SourceBufferParserWebM::resetParserState): (WebCore::SourceBufferParserWebM::invalidate): (WebCore::SourceBufferParserWebM::OnClusterBegin): * platform/graphics/cocoa/SourceBufferParserWebM.h: Source/WebKit: * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::parseByteSource): LayoutTests: * gpu-process/TestExpectations: * media/media-source/media-source-webm-append-buffer-after-abort-expected.txt: Added. * media/media-source/media-source-webm-append-buffer-after-abort.html: Added. * platform/mac/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272039 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-28 Peng Liu [GPUP][MSE] A video element does not fire “canplaythrough” event if SourceBuffer.abort() is called https://bugs.webkit.org/show_bug.cgi?id=220964 Reviewed by Jer Noble. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::parseByteSource): 2021-02-24 Russell Epstein Cherry-pick r272935. rdar://problem/74500849 REGRESSION(r266890): [Cocoa] Fix InspectorDelegate / API::InspectorClient leak https://bugs.webkit.org/show_bug.cgi?id=221988 Reviewed by Devin Rousso. There was a logic error introduced into the new delegate situation after moving _WKInspectorDelegate from WKWebView to _WKInspector. When setting .delegate to nil, we shouldn't allocate dummy API::InspectorClient/ InspectorDelegate instances. As written, these instances form their own retain cycle and cause a leak if Web Inspector has been opened or if WKWebView._inspector is accessed (which lazily creates the delegates). * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector setDelegate:]): Adopt new constructor and pass in the ObjC delegate. * UIProcess/Inspector/Cocoa/InspectorDelegate.h: * UIProcess/Inspector/Cocoa/InspectorDelegate.mm: (WebKit::InspectorDelegate::InspectorDelegate): (WebKit::InspectorDelegate::createInspectorClient): Deleted. (WebKit::InspectorDelegate::setDelegate): Deleted. Clean up this class so that we always receive the ObjC delegate via the constructor. If a nil delegate is passed---for example, when closing the WKWebView---then don't create an API::InspectorClient and set the WebInspectorProxy's client to nullptr. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272935 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-16 BJ Burg REGRESSION(r266890): [Cocoa] Fix InspectorDelegate / API::InspectorClient leak https://bugs.webkit.org/show_bug.cgi?id=221988 Reviewed by Devin Rousso. There was a logic error introduced into the new delegate situation after moving _WKInspectorDelegate from WKWebView to _WKInspector. When setting .delegate to nil, we shouldn't allocate dummy API::InspectorClient/ InspectorDelegate instances. As written, these instances form their own retain cycle and cause a leak if Web Inspector has been opened or if WKWebView._inspector is accessed (which lazily creates the delegates). * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector setDelegate:]): Adopt new constructor and pass in the ObjC delegate. * UIProcess/Inspector/Cocoa/InspectorDelegate.h: * UIProcess/Inspector/Cocoa/InspectorDelegate.mm: (WebKit::InspectorDelegate::InspectorDelegate): (WebKit::InspectorDelegate::createInspectorClient): Deleted. (WebKit::InspectorDelegate::setDelegate): Deleted. Clean up this class so that we always receive the ObjC delegate via the constructor. If a nil delegate is passed---for example, when closing the WKWebView---then don't create an API::InspectorClient and set the WebInspectorProxy's client to nullptr. 2021-02-24 Russell Epstein Cherry-pick r272629. rdar://problem/74410251 Make sure we are no longer show the previous page when running a JS prompt https://bugs.webkit.org/show_bug.cgi?id=215782 Reviewed by Simon Fraser. Make sure we are no longer show the previous page when running a JS prompt. If we have not yet done a layer tree commit since the last load commit, then we are likely still showing the previous page. If we are asked to run a JS prompt / alert / confirm at this point, it would be confusing to still show the previous page. In order to address the issue, we now make the view blank in such scenario (ideally, we'd have painted the new page but this is currently not a trivial thing to do). To make the view blank, the approach chosen was to add a blank overlay view on top of the content. This overlay view gets taken down as soon as we paint the view again. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _hasBlankOverlay]): (-[WKWebView _setHasBlankOverlay:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::setHasBlankOverlay): * UIProcess/Cocoa/WKBlankOverlayView.h: Added. * UIProcess/Cocoa/WKBlankOverlayView.mm: Added. (-[WKBlankOverlayView initWithFrame:]): * UIProcess/PageClient.h: (WebKit::PageClient::setHasBlankOverlay): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFirstLayerTreeCommitAfterCommittingLoad): (WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::didUpdateRendering): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272629 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-09 Chris Dumez Make sure we are no longer show the previous page when running a JS prompt https://bugs.webkit.org/show_bug.cgi?id=215782 Reviewed by Simon Fraser. Make sure we are no longer show the previous page when running a JS prompt. If we have not yet done a layer tree commit since the last load commit, then we are likely still showing the previous page. If we are asked to run a JS prompt / alert / confirm at this point, it would be confusing to still show the previous page. In order to address the issue, we now make the view blank in such scenario (ideally, we'd have painted the new page but this is currently not a trivial thing to do). To make the view blank, the approach chosen was to add a blank overlay view on top of the content. This overlay view gets taken down as soon as we paint the view again. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _hasBlankOverlay]): (-[WKWebView _setHasBlankOverlay:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::setHasBlankOverlay): * UIProcess/Cocoa/WKBlankOverlayView.h: Added. * UIProcess/Cocoa/WKBlankOverlayView.mm: Added. (-[WKBlankOverlayView initWithFrame:]): * UIProcess/PageClient.h: (WebKit::PageClient::setHasBlankOverlay): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFirstLayerTreeCommitAfterCommittingLoad): (WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::didUpdateRendering): 2021-02-23 Alan Coon Cherry-pick r273304. rdar://problem/74622914 [macOS] Crash under AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=222233 Unreviewed, address additional review feedback. Add comment and logging when the WebKit client is setting the user directory suffix. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273304 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-23 Per Arne Vollan [macOS] Crash under AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=222233 Unreviewed, address additional review feedback. Add comment and logging when the WebKit client is setting the user directory suffix. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): 2021-02-23 Alan Coon Cherry-pick r273289. rdar://problem/74623623 UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 Unreviewed, address post-review comment. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): Use captured `this`. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273289 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-22 Eric Carlson UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 Unreviewed, address post-review comment. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): Use captured `this`. 2021-02-23 Alan Coon Cherry-pick r273286. rdar://problem/74622950 [Cocoa] Send sandbox extensions for Network Extension services in load parameters https://bugs.webkit.org/show_bug.cgi?id=222284 Reviewed by Brent Fulgham. Currently, sandbox extensions for Network Extension services are sent from the UI process to the WebContent process when the policy decision is made, but that is not soon enough in all cases. They should also be sent as part of the load parameters. * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273286 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-22 Per Arne Vollan [Cocoa] Send sandbox extensions for Network Extension services in load parameters https://bugs.webkit.org/show_bug.cgi?id=222284 Reviewed by Brent Fulgham. Currently, sandbox extensions for Network Extension services are sent from the UI process to the WebContent process when the policy decision is made, but that is not soon enough in all cases. They should also be sent as part of the load parameters. * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2021-02-23 Alan Coon Cherry-pick r273271. rdar://problem/74622914 [macOS] Crash under AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=222233 Reviewed by Brent Fulgham. When a WebKit client provides a user directory suffix in the process initialization parameters, confstr with the new user suffix applied will fail to create the full directory path if it does not exist, and return an empty result. This will lead to empty paths in the sandbox parameters, which will cause the sandbox to fail to compile, which will eventually crash the WebKit process. This patch addresses this by making sure the new user directory suffix does not represent a path, since confstr is not able to handle user directory suffixes containing paths that do not exist. Additionally, this patch reverts r271417, which was the first attempt at fixing this crash, but was unsuccessful in doing so. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): (WebKit::AuxiliaryProcess::initializeSandbox): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273271 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-22 Per Arne Vollan [macOS] Crash under AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=222233 Reviewed by Brent Fulgham. When a WebKit client provides a user directory suffix in the process initialization parameters, confstr with the new user suffix applied will fail to create the full directory path if it does not exist, and return an empty result. This will lead to empty paths in the sandbox parameters, which will cause the sandbox to fail to compile, which will eventually crash the WebKit process. This patch addresses this by making sure the new user directory suffix does not represent a path, since confstr is not able to handle user directory suffixes containing paths that do not exist. Additionally, this patch reverts r271417, which was the first attempt at fixing this crash, but was unsuccessful in doing so. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): (WebKit::AuxiliaryProcess::initializeSandbox): 2021-02-23 Alan Coon Cherry-pick r273265. rdar://problem/74623623 UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 Reviewed by Youenn Fablet. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): Return early if `weakThis` is NULL. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273265 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-22 Eric Carlson UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 Reviewed by Youenn Fablet. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): Return early if `weakThis` is NULL. 2021-02-23 Alan Coon Cherry-pick r273196. rdar://problem/74623520 Crash under Decoder::Decoder() https://bugs.webkit.org/show_bug.cgi?id=222192 Reviewed by Geoffrey Garen. We are sometimes crashing under Decoder's copyBuffer(), inside the memcpy() call, with a null address. I have no idea how this is happening and this code has not changed in a long time so I have made the following hardening: 1. Update copyBuffer() to use tryFastMalloc() instead of fastMalloc(). Log and return null if tryFastMalloc() failed instead of calling memcpy(). 2. Update Decoder::create() to log and return early if the input buffer is null. 3. Update Connection's createMessageDecoder() to use CheckedSize when computing the bodySize that is being passed to Decoder::create(). If we overflow, log and return null. No new tests, no idea how this can happen in practice. * Platform/IPC/Decoder.cpp: (IPC::copyBuffer): (IPC::Decoder::create): (IPC::Decoder::Decoder): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::createMessageDecoder): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273196 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-19 Chris Dumez Crash under Decoder::Decoder() https://bugs.webkit.org/show_bug.cgi?id=222192 Reviewed by Geoffrey Garen. We are sometimes crashing under Decoder's copyBuffer(), inside the memcpy() call, with a null address. I have no idea how this is happening and this code has not changed in a long time so I have made the following hardening: 1. Update copyBuffer() to use tryFastMalloc() instead of fastMalloc(). Log and return null if tryFastMalloc() failed instead of calling memcpy(). 2. Update Decoder::create() to log and return early if the input buffer is null. 3. Update Connection's createMessageDecoder() to use CheckedSize when computing the bodySize that is being passed to Decoder::create(). If we overflow, log and return null. No new tests, no idea how this can happen in practice. * Platform/IPC/Decoder.cpp: (IPC::copyBuffer): (IPC::Decoder::create): (IPC::Decoder::Decoder): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::createMessageDecoder): 2021-02-23 Alan Coon Cherry-pick r273180. rdar://problem/74623601 CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper on 2021-02-19 Reviewed by Chris Dumez. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273180 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-19 Alex Christensen CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper Cherry-pick r272355. rdar://problem/74032694 ASSERTION FAILED: !size.isEmpty() under platformInitializeWebProcess * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Follow-up to r272335; don't call IOSurface::setMaximumSize if the UI process did not send us a size. Caused all Web Content processes to assert in debug on launch. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272355 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-03 Timothy Horton ASSERTION FAILED: !size.isEmpty() under platformInitializeWebProcess * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Follow-up to r272335; don't call IOSurface::setMaximumSize if the UI process did not send us a size. Caused all Web Content processes to assert in debug on launch. 2021-02-17 Ruben Turcios Cherry-pick r272165. rdar://problem/74032536 Use user media permission prompt for speech recognition https://bugs.webkit.org/show_bug.cgi?id=221082 rdar://problem/73372499 Patch by Sihui Liu on 2021-02-01 Reviewed by Youenn Fablet. Source/WebCore: Add frame identifier to SpeechRecognitionRequest as it is needed for checking user media permission. Updated existing tests for changed behavior. * Modules/speech/SpeechRecognition.cpp: (WebCore::SpeechRecognition::startRecognition): * Modules/speech/SpeechRecognitionConnection.h: * Modules/speech/SpeechRecognitionRequest.h: (WebCore::SpeechRecognitionRequest::frameIdentifier const): * Modules/speech/SpeechRecognitionRequestInfo.h: (WebCore::SpeechRecognitionRequestInfo::encode const): (WebCore::SpeechRecognitionRequestInfo::decode): * page/DummySpeechRecognitionProvider.h: Source/WebKit: Make SpeechRecognitionPermissionManager ask UserMediaPermissionRequestManagerProxy for user permission on microphone. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::frameIdentifier const): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/SpeechRecognitionServer.messages.in: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): (WebKit::UserMediaPermissionRequestManagerProxy::grantRequest): (WebKit::UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy): * UIProcess/UserMediaPermissionRequestProxy.h: (WebKit::UserMediaPermissionRequestProxy::create): (WebKit::UserMediaPermissionRequestProxy::decisionCompletionHandler): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): (WebKit::WebPageProxy::requestUserMediaPermissionForSpeechRecognition): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::start): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/SpeechRecognition.mm: (-[SpeechRecognitionUIDelegate _webView:requestMediaCaptureAuthorization:decisionHandler:]): LayoutTests: * fast/speechrecognition/permission-error.html: * fast/speechrecognition/start-recognition-in-removed-iframe-expected.txt: * fast/speechrecognition/start-recognition-in-removed-iframe.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272165 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-01 Sihui Liu Use user media permission prompt for speech recognition https://bugs.webkit.org/show_bug.cgi?id=221082 rdar://problem/73372499 Reviewed by Youenn Fablet. Make SpeechRecognitionPermissionManager ask UserMediaPermissionRequestManagerProxy for user permission on microphone. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::frameIdentifier const): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/SpeechRecognitionServer.messages.in: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): (WebKit::UserMediaPermissionRequestManagerProxy::grantRequest): (WebKit::UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy): * UIProcess/UserMediaPermissionRequestProxy.h: (WebKit::UserMediaPermissionRequestProxy::create): (WebKit::UserMediaPermissionRequestProxy::decisionCompletionHandler): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): (WebKit::WebPageProxy::requestUserMediaPermissionForSpeechRecognition): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::start): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: 2021-02-17 Ruben Turcios Cherry-pick r271636. rdar://problem/74452635 Update media state for active speech recognition as it uses audio capture https://bugs.webkit.org/show_bug.cgi?id=220667 Patch by Sihui Liu on 2021-01-19 Reviewed by Youenn Fablet. Source/WebCore: To make sure the media capture state is correctly sent to client. API test: WebKit2.SpeechRecognitionMediaCaptureStateChange * Modules/speech/SpeechRecognition.cpp: (WebCore::SpeechRecognition::startRecognition): (WebCore::SpeechRecognition::stop): (WebCore::SpeechRecognition::didStartCapturingAudio): (WebCore::SpeechRecognition::didStopCapturingAudio): * Modules/speech/SpeechRecognition.h: * Modules/speech/SpeechRecognitionConnection.h: * dom/Document.cpp: (WebCore::Document::setActiveSpeechRecognition): (WebCore::Document::updateIsPlayingMedia): * dom/Document.h: * page/DummySpeechRecognitionProvider.h: Source/WebKit: * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::unregisterClient): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: Tools: * TestWebKitAPI/Tests/WebKitCocoa/SpeechRecognition.mm: (-[SpeechRecognitionUIDelegate _webView:mediaCaptureStateDidChange:]): (TestWebKitAPI::TEST): (-[SpeechRecognitionPermissionUIDelegate _webView:requestSpeechRecognitionPermissionForOrigin:decisionHandler:]): Deleted. (-[SpeechRecognitionPermissionUIDelegate _webView:requestMediaCaptureAuthorization:decisionHandler:]): Deleted. (-[SpeechRecognitionPermissionUIDelegate _webView:checkUserMediaPermissionForURL:mainFrameURL:frameIdentifier:decisionHandler:]): Deleted. (-[SpeechRecognitionPermissionUIDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271636 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-19 Sihui Liu Update media state for active speech recognition as it uses audio capture https://bugs.webkit.org/show_bug.cgi?id=220667 Reviewed by Youenn Fablet. * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::unregisterClient): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: 2021-02-17 Ruben Turcios Cherry-pick r271381. rdar://problem/74451875 Make SpeechRecognition permission error more informative https://bugs.webkit.org/show_bug.cgi?id=220436 Patch by Sihui Liu on 2021-01-11 Reviewed by Youenn Fablet. Source/WebKit: Make SpeechRecognitionPermissionManager complete requests with an optional SpeechRecognitionError instead of a boolean value. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::~SpeechRecognitionPermissionManager): (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::completeCurrentRequest): (WebKit::SpeechRecognitionPermissionManager::requestSpeechRecognitionServiceAccess): (WebKit::SpeechRecognitionPermissionManager::requestMicrophoneAccess): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::complete): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::requestPermissionForRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): Tools: * TestWebKitAPI/Tests/WebKitCocoa/SpeechRecognition.mm: (TestWebKitAPI::TEST): LayoutTests: * fast/speechrecognition/permission-error-expected.txt: * fast/speechrecognition/permission-error.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271381 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-11 Sihui Liu Make SpeechRecognition permission error more informative https://bugs.webkit.org/show_bug.cgi?id=220436 Reviewed by Youenn Fablet. Make SpeechRecognitionPermissionManager complete requests with an optional SpeechRecognitionError instead of a boolean value. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::~SpeechRecognitionPermissionManager): (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::completeCurrentRequest): (WebKit::SpeechRecognitionPermissionManager::requestSpeechRecognitionServiceAccess): (WebKit::SpeechRecognitionPermissionManager::requestMicrophoneAccess): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::complete): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::requestPermissionForRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): 2021-02-17 Ruben Turcios Cherry-pick r272504. rdar://problem/74409474 NetworkRTCSocketCocoa extractDataMessages should not read too much data https://bugs.webkit.org/show_bug.cgi?id=221544 Reviewed by Eric Carlson. Source/WebCore: Move STUN/TURN message parsing to its own file routine so that we can add API test. Code is taken from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm. Fix the test verifying we can actually read a message given its expected length. Covered by API test. * Headers.cmake: * Modules/mediastream/STUNMessageParsing.cpp: Added. (WebCore::isStunMessage): (WebCore::getSTUNOrTURNMessageLengths): (WebCore::extractSTUNOrTURNMessages): (WebCore::extractDataMessages): (WebCore::extractMessages): * Modules/mediastream/STUNMessageParsing.h: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Source/WebKit: * NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm: Make use of WebCore method. Tools: * TestWebKitAPI/Tests/WebCore/STUNMessageParsingTest.cpp: Added. (TestWebKitAPI::TEST): * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272504 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-08 Youenn Fablet NetworkRTCSocketCocoa extractDataMessages should not read too much data https://bugs.webkit.org/show_bug.cgi?id=221544 Reviewed by Eric Carlson. * NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm: Make use of WebCore method. 2021-02-19 Alan Coon Cherry-pick r272990. rdar://problem/74500669 Regression(r268097): Calling processDidTerminate delegate asynchronously is risky compatibility-wise https://bugs.webkit.org/show_bug.cgi?id=222011 Reviewed by Carlos Garcia Campos. Calling processDidTerminate delegate asynchronously like we did in r268097 is risky compatibility-wise. This caused breakage in at least 2 client applications. While this can be dealt with on the client side, it would be better to fix what r268097 was trying to fix without making the delegate call asynchronous. The reason calling the delegate asynchronously is risky is because some view state may have time to get reset by the time the client gets notified on the crash, potentially confusing the crash handling logic in the client. No new tests, covered by WKNavigation.ReloadRelatedViewsInProcessDidTerminate API test that is still passing even though the delegate call is no longer asynchronous. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::resetStateAfterProcessTermination): (WebKit::WebPageProxy::dispatchProcessDidTerminate): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::requestTermination): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272990 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-17 Chris Dumez Regression(r268097): Calling processDidTerminate delegate asynchronously is risky compatibility-wise https://bugs.webkit.org/show_bug.cgi?id=222011 Reviewed by Carlos Garcia Campos. Calling processDidTerminate delegate asynchronously like we did in r268097 is risky compatibility-wise. This caused breakage in at least 2 client applications. While this can be dealt with on the client side, it would be better to fix what r268097 was trying to fix without making the delegate call asynchronous. The reason calling the delegate asynchronously is risky is because some view state may have time to get reset by the time the client gets notified on the crash, potentially confusing the crash handling logic in the client. No new tests, covered by WKNavigation.ReloadRelatedViewsInProcessDidTerminate API test that is still passing even though the delegate call is no longer asynchronous. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::resetStateAfterProcessTermination): (WebKit::WebPageProxy::dispatchProcessDidTerminate): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::requestTermination): 2021-02-19 Alan Coon Revert r246382. rdar://problem/74501060 2021-02-17 Alan Coon Cherry-pick r272345. rdar://problem/74195248 [WebAuthn] Allow one user gesture free prompt for each navigation https://bugs.webkit.org/show_bug.cgi?id=220897 Reviewed by Brent Fulgham. Source/WebCore: * Modules/webauthn/AuthenticatorCoordinator.cpp: (WebCore::AuthenticatorCoordinator::resetUserGestureRequirement): * Modules/webauthn/AuthenticatorCoordinator.h: * Modules/webauthn/AuthenticatorCoordinatorClient.h: * page/Quirks.cpp: * page/Quirks.cpp.h: * replay/UserInputBridge.cpp: (WebCore::UserInputBridge::loadRequest): (WebCore::UserInputBridge::reloadFrame): Adds the ability to reset the user gesture requirement flag for user initiated reloads and quirks. Source/WebKit: This is a quirk that only allows certain websites. Covered by existing tests. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::filterTransports const): (WebKit::AuthenticatorManager::runPanel): (WebKit::AuthenticatorManager::runPresenter): Cancel the whole WebAuthn operation if no user gesture is indicated. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h: Set a boolean to indicate a free coupon for each navigation. Tools: * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: (TestWebKitAPI::TEST): LayoutTests: * http/wpt/webauthn/ctap-hid-failure.https-expected.txt: * http/wpt/webauthn/ctap-hid-success.https-expected.txt: * http/wpt/webauthn/ctap-nfc-failure.https-expected.txt: * http/wpt/webauthn/idl.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-u2f.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-u2f.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-local-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-u2f.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-u2f.https-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272345 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-03 Jiewen Tan [WebAuthn] Allow one user gesture free prompt for each navigation https://bugs.webkit.org/show_bug.cgi?id=220897 Reviewed by Brent Fulgham. This is a quirk that only allows certain websites. Covered by existing tests. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::filterTransports const): (WebKit::AuthenticatorManager::runPanel): (WebKit::AuthenticatorManager::runPresenter): Cancel the whole WebAuthn operation if no user gesture is indicated. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h: Set a boolean to indicate a free coupon for each navigation. 2021-02-16 Ruben Turcios Cherry-pick r272723. rdar://problem/74410353 [macOS] Add syscall to allow list in WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=221705 Reviewed by Brent Fulgham. Add required syscall to allow list in WebContent sandbox on macOS. * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272723 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-11 Per Arne [macOS] Add syscall to allow list in WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=221705 Reviewed by Brent Fulgham. Add required syscall to allow list in WebContent sandbox on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-16 Ruben Turcios Cherry-pick r272698. rdar://problem/74410282 REGRESSION (r269824) IOSurface allocation failure causes crash in RemoteLayerBackingStore::display() https://bugs.webkit.org/show_bug.cgi?id=221729 rdar://72651289 Reviewed by Tim Horton. The refactoring in r269824 dropped a null check on the front buffer surface (IOSurface allocation can fail when the process reaches a hardcoded limit). Restore the null check. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::display): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272698 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-10 Simon Fraser REGRESSION (r269824) IOSurface allocation failure causes crash in RemoteLayerBackingStore::display() https://bugs.webkit.org/show_bug.cgi?id=221729 rdar://72651289 Reviewed by Tim Horton. The refactoring in r269824 dropped a null check on the front buffer surface (IOSurface allocation can fail when the process reaches a hardcoded limit). Restore the null check. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::display): 2021-02-16 Ruben Turcios Cherry-pick r272550. rdar://problem/74409264 Make the UserContentController for ServiceWorker pages be non-optional. and https://bugs.webkit.org/show_bug.cgi?id=221503 Reviewed by Alex Christensen. Source/WebCore: * loader/EmptyClients.cpp: (WebCore::pageConfigurationWithEmptyClients): * page/Page.cpp: (WebCore::Page::Page): * page/PageConfiguration.cpp: (WebCore::PageConfiguration::PageConfiguration): * page/PageConfiguration.h: Source/WebKit: Normal Pages always have a UserContentProvider, even if they just create an empty default one. Same should be true for ServiceWorkers. * Shared/ServiceWorkerInitializationData.cpp: (WebKit::ServiceWorkerInitializationData::decode): * Shared/ServiceWorkerInitializationData.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::userContentControllerIdentifierForServiceWorkers): (WebKit::WebProcessPool::createWebPage): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::enableServiceWorkers): * UIProcess/WebProcessProxy.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::m_userContentController): (WebKit::m_userAgent): Deleted. * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::initWithFrame): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272550 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-08 Brady Eidson Make the UserContentController for ServiceWorker pages be non-optional. and https://bugs.webkit.org/show_bug.cgi?id=221503 Reviewed by Alex Christensen. Normal Pages always have a UserContentProvider, even if they just create an empty default one. Same should be true for ServiceWorkers. * Shared/ServiceWorkerInitializationData.cpp: (WebKit::ServiceWorkerInitializationData::decode): * Shared/ServiceWorkerInitializationData.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::userContentControllerIdentifierForServiceWorkers): (WebKit::WebProcessPool::createWebPage): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::enableServiceWorkers): * UIProcess/WebProcessProxy.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::m_userContentController): (WebKit::m_userAgent): Deleted. * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2021-02-16 Ruben Turcios Cherry-pick r272506. rdar://problem/74409747 Check that CGPDFDocumentRef is consistently unlocked and printable Reviewed by Daniel Bates. This patch does the following when printing PDFs: - Checks return value of CGPDFDocumentUnlockWithPassword(). - Calls CGPDFDocumentAllowsPrinting() consistently. - Handles -_ensureDocumentForPrinting and -_wk_printedDocument returning nullptr. * UIProcess/_WKWebViewPrintFormatter.mm: (-[_WKWebViewPrintFormatter drawInRect:forPageAtIndex:]): - Check return value of -_wk_printedDocument since it may return nullptr now. * UIProcess/ios/WKPDFView.mm: (-[WKPDFView _ensureDocumentForPrinting]): - Check return value of CGPDFDocumentUnlockWithPassword(), and return nullptr if unsuccessful. - Add CGPDFDocumentAllowsPrinting() check and return nullptr if it fails. (-[WKPDFView _wk_pageCountForPrintFormatter:]): - Move the CGPDFDocumentAllowsPrinting() check into -[WKPDFView _ensureDocumentForPrinting]. - Check return value of -_ensureDocumentForPrinting since it may return nullptr now. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272506 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-08 David Kilzer Check that CGPDFDocumentRef is consistently unlocked and printable Reviewed by Daniel Bates. This patch does the following when printing PDFs: - Checks return value of CGPDFDocumentUnlockWithPassword(). - Calls CGPDFDocumentAllowsPrinting() consistently. - Handles -_ensureDocumentForPrinting and -_wk_printedDocument returning nullptr. * UIProcess/_WKWebViewPrintFormatter.mm: (-[_WKWebViewPrintFormatter drawInRect:forPageAtIndex:]): - Check return value of -_wk_printedDocument since it may return nullptr now. * UIProcess/ios/WKPDFView.mm: (-[WKPDFView _ensureDocumentForPrinting]): - Check return value of CGPDFDocumentUnlockWithPassword(), and return nullptr if unsuccessful. - Add CGPDFDocumentAllowsPrinting() check and return nullptr if it fails. (-[WKPDFView _wk_pageCountForPrintFormatter:]): - Move the CGPDFDocumentAllowsPrinting() check into -[WKPDFView _ensureDocumentForPrinting]. - Check return value of -_ensureDocumentForPrinting since it may return nullptr now. 2021-02-16 Ruben Turcios Cherry-pick r272418. rdar://problem/74410581 CrashTracer: com.apple.WebKit.Networking at WebKit: WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource https://bugs.webkit.org/show_bug.cgi?id=221432 Reviewed by John Wilander. We are seeing crashes in ResourceLoadStatisticsDatabaseStore::setPrevalentResource as a result of trying to use a nullopt domainID value. In theory this should never be WTF::nullopt but is because of a failing SQLite query in ResourceLoadStatisticsDatabaseStore::domainID which reports the error "not an error". To fix this we should check the domain ID and return early with a debug assert in setPrevalentResource() if it is WTF::nullopt to avoid a crash. Additionally, we should add more information to the logging statement, specifically the SQLite statement string, to try and debug further. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const): (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272418 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-05 Kate Cheney CrashTracer: com.apple.WebKit.Networking at WebKit: WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource https://bugs.webkit.org/show_bug.cgi?id=221432 Reviewed by John Wilander. We are seeing crashes in ResourceLoadStatisticsDatabaseStore::setPrevalentResource as a result of trying to use a nullopt domainID value. In theory this should never be WTF::nullopt but is because of a failing SQLite query in ResourceLoadStatisticsDatabaseStore::domainID which reports the error "not an error". To fix this we should check the domain ID and return early with a debug assert in setPrevalentResource() if it is WTF::nullopt to avoid a crash. Additionally, we should add more information to the logging statement, specifically the SQLite statement string, to try and debug further. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const): (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource): 2021-02-10 Alan Coon Revert r272541. rdar://problem/74208306 2021-02-08 Russell Epstein Cherry-pick r272345. rdar://problem/74032500 [WebAuthn] Allow one user gesture free prompt for each navigation https://bugs.webkit.org/show_bug.cgi?id=220897 Reviewed by Brent Fulgham. Source/WebCore: * Modules/webauthn/AuthenticatorCoordinator.cpp: (WebCore::AuthenticatorCoordinator::resetUserGestureRequirement): * Modules/webauthn/AuthenticatorCoordinator.h: * Modules/webauthn/AuthenticatorCoordinatorClient.h: * page/Quirks.cpp: * page/Quirks.cpp.h: * replay/UserInputBridge.cpp: (WebCore::UserInputBridge::loadRequest): (WebCore::UserInputBridge::reloadFrame): Adds the ability to reset the user gesture requirement flag for user initiated reloads and quirks. Source/WebKit: This is a quirk that only allows certain websites. Covered by existing tests. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::filterTransports const): (WebKit::AuthenticatorManager::runPanel): (WebKit::AuthenticatorManager::runPresenter): Cancel the whole WebAuthn operation if no user gesture is indicated. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h: Set a boolean to indicate a free coupon for each navigation. Tools: * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: (TestWebKitAPI::TEST): LayoutTests: * http/wpt/webauthn/ctap-hid-failure.https-expected.txt: * http/wpt/webauthn/ctap-hid-success.https-expected.txt: * http/wpt/webauthn/ctap-nfc-failure.https-expected.txt: * http/wpt/webauthn/idl.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure-u2f.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-create-success-u2f.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-local-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure-u2f.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-failure.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-hid.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-local.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-nfc.https-expected.txt: * http/wpt/webauthn/public-key-credential-get-success-u2f.https-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272345 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-03 Jiewen Tan [WebAuthn] Allow one user gesture free prompt for each navigation https://bugs.webkit.org/show_bug.cgi?id=220897 Reviewed by Brent Fulgham. This is a quirk that only allows certain websites. Covered by existing tests. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::filterTransports const): (WebKit::AuthenticatorManager::runPanel): (WebKit::AuthenticatorManager::runPresenter): Cancel the whole WebAuthn operation if no user gesture is indicated. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h: Set a boolean to indicate a free coupon for each navigation. 2021-02-08 Russell Epstein Cherry-pick r272184. rdar://problem/74032500 [WebAuthn] Optimize _WKWebAuthenticationPanelDelegate for native API https://bugs.webkit.org/show_bug.cgi?id=221125 Reviewed by Brent Fulgham. Source/WebKit: This patch mainly does the following few things: 1. It connects the new SPI with the existing mock testing infrastructure such that we can mock test it. 2. It adds a new mode in AuthenticatorManager to connect it to the new _WKWebAuthenticationPanelDelegate object. 3. It adss a new SPI to _WKWebAuthenticationPanelDelegate: -[panel:requestLAContextForUserVerificationWithCompletionHandler:], and adds a new method within _WKWebAuthenticationAssertionResponse to accept an LAContext from the caller to unlock the keychain. 4. It enables -[_WKWebAuthenticationPanel cancel] to use the new cancel method. Covered by API tests. * UIProcess/API/APIWebAuthenticationAssertionResponse.h: Accepts a LAContext object. * UIProcess/API/APIWebAuthenticationPanel.cpp: (API::WebAuthenticationPanel::WebAuthenticationPanel): (API::WebAuthenticationPanel::handleRequest): (API::WebAuthenticationPanel::cancel const): (API::WebAuthenticationPanel::setMockConfiguration): * UIProcess/API/APIWebAuthenticationPanel.h: * UIProcess/API/APIWebAuthenticationPanelClient.h: (API::WebAuthenticationPanelClient::requestLAContextForUserVerification const): Adds new SPI and mocking. * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.mm: (-[_WKWebAuthenticationAssertionResponse setLAContext:]): Accepts a LAContext object. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (-[_WKWebAuthenticationPanel setMockConfiguration:]): * UIProcess/API/Cocoa/_WKWebAuthenticationPanelForTesting.h: Adds new SPI and mocking. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): (WebKit::AuthenticatorManager::enableModernWebAuthentication): (WebKit::AuthenticatorManager::enableNativeSupport): (WebKit::AuthenticatorManager::authenticatorAdded): (WebKit::AuthenticatorManager::requestLAContextForUserVerification): (WebKit::AuthenticatorManager::runPresenter): (WebKit::AuthenticatorManager::dispatchPanelClientCall const): * UIProcess/WebAuthentication/AuthenticatorManager.h: Adds a new mode to power the native API. * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient): (WebKit::WebAuthenticationPanelClient::requestLAContextForUserVerification const): Accepts a LAContext object. * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::verifyUser): Adds new mocking functions. * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Adds the new weak panel. Tools: * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm: (-[TestWebAuthenticationPanelDelegate panel:selectAssertionResponse:source:completionHandler:]): (-[TestWebAuthenticationPanelDelegate panel:requestLAContextForUserVerificationWithCompletionHandler:]): (TestWebKitAPI::WebCore::reset): (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272184 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-01 Jiewen Tan [WebAuthn] Optimize _WKWebAuthenticationPanelDelegate for native API https://bugs.webkit.org/show_bug.cgi?id=221125 Reviewed by Brent Fulgham. This patch mainly does the following few things: 1. It connects the new SPI with the existing mock testing infrastructure such that we can mock test it. 2. It adds a new mode in AuthenticatorManager to connect it to the new _WKWebAuthenticationPanelDelegate object. 3. It adss a new SPI to _WKWebAuthenticationPanelDelegate: -[panel:requestLAContextForUserVerificationWithCompletionHandler:], and adds a new method within _WKWebAuthenticationAssertionResponse to accept an LAContext from the caller to unlock the keychain. 4. It enables -[_WKWebAuthenticationPanel cancel] to use the new cancel method. Covered by API tests. * UIProcess/API/APIWebAuthenticationAssertionResponse.h: Accepts a LAContext object. * UIProcess/API/APIWebAuthenticationPanel.cpp: (API::WebAuthenticationPanel::WebAuthenticationPanel): (API::WebAuthenticationPanel::handleRequest): (API::WebAuthenticationPanel::cancel const): (API::WebAuthenticationPanel::setMockConfiguration): * UIProcess/API/APIWebAuthenticationPanel.h: * UIProcess/API/APIWebAuthenticationPanelClient.h: (API::WebAuthenticationPanelClient::requestLAContextForUserVerification const): Adds new SPI and mocking. * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.mm: (-[_WKWebAuthenticationAssertionResponse setLAContext:]): Accepts a LAContext object. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (-[_WKWebAuthenticationPanel setMockConfiguration:]): * UIProcess/API/Cocoa/_WKWebAuthenticationPanelForTesting.h: Adds new SPI and mocking. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): (WebKit::AuthenticatorManager::enableModernWebAuthentication): (WebKit::AuthenticatorManager::enableNativeSupport): (WebKit::AuthenticatorManager::authenticatorAdded): (WebKit::AuthenticatorManager::requestLAContextForUserVerification): (WebKit::AuthenticatorManager::runPresenter): (WebKit::AuthenticatorManager::dispatchPanelClientCall const): * UIProcess/WebAuthentication/AuthenticatorManager.h: Adds a new mode to power the native API. * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient): (WebKit::WebAuthenticationPanelClient::requestLAContextForUserVerification const): Accepts a LAContext object. * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::verifyUser): Adds new mocking functions. * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Adds the new weak panel. 2021-02-08 Russell Epstein Cherry-pick r272422. rdar://problem/74033021 Make sure click attribution is processed in case of redirected kept alive loads https://bugs.webkit.org/show_bug.cgi?id=221453 Reviewed by John Wilander. Source/WebCore: Test: http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::addSubresourceLoader): Update assertion to cope with keep alive fetches which are similar to beacon/ping loads. Source/WebKit: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): Move the click attribution processing before kept alive check. LayoutTests: * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt: Added. * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html: Added. * http/tests/privateClickMeasurement/resources/redirectToConversion.php: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272422 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-05 Youenn Fablet Make sure click attribution is processed in case of redirected kept alive loads https://bugs.webkit.org/show_bug.cgi?id=221453 Reviewed by John Wilander. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): Move the click attribution processing before kept alive check. 2021-02-08 Russell Epstein Cherry-pick r272376. rdar://problem/74032694 REGRESSION(r267763) Network process launches earlier than before https://bugs.webkit.org/show_bug.cgi?id=221384 Patch by Alex Christensen on 2021-02-04 Reviewed by Chris Dumez. Source/WebKit: Before r267763 we could have an app launch, allocate a WKWebView, and set _resourceLoadStatisticsEnabled all without having a network process launch. When setting _resourceLoadStatisticsEnabled, we don't need to launch a network process if we haven't already because when we do, WebsiteDataStore::parameters will send the correct value. I added a test that verifies this doesn't launch the network process if it hasn't already been launched. We also don't need to update the process assertion or the process suspension state if there is no network process. sendNetworkProcessXPCEndpointToWebProcess is also called when opening Safari on iOS and would be the next thing to unnecessarily launch the network process during app initialization. I manually verified that if we add an early return if there is no network process yet, we do send the XPC endpoint to the web process when the network process does launch through the call site in sendNetworkProcessXPCEndpointToAllWebProcesses. I verified on my phone that this is the minimal change needed for Safari on iOS to not launch the network process before application:didFinishLaunchingWithOptions: is called as it did before r267763. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::updateProcessSuppressionState): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::updateProcessAssertions): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToWebProcess): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::networkProcessIfExists): Tools: * TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm: (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272376 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-04 Alex Christensen REGRESSION(r267763) Network process launches earlier than before https://bugs.webkit.org/show_bug.cgi?id=221384 Reviewed by Chris Dumez. Before r267763 we could have an app launch, allocate a WKWebView, and set _resourceLoadStatisticsEnabled all without having a network process launch. When setting _resourceLoadStatisticsEnabled, we don't need to launch a network process if we haven't already because when we do, WebsiteDataStore::parameters will send the correct value. I added a test that verifies this doesn't launch the network process if it hasn't already been launched. We also don't need to update the process assertion or the process suspension state if there is no network process. sendNetworkProcessXPCEndpointToWebProcess is also called when opening Safari on iOS and would be the next thing to unnecessarily launch the network process during app initialization. I manually verified that if we add an early return if there is no network process yet, we do send the XPC endpoint to the web process when the network process does launch through the call site in sendNetworkProcessXPCEndpointToAllWebProcesses. I verified on my phone that this is the minimal change needed for Safari on iOS to not launch the network process before application:didFinishLaunchingWithOptions: is called as it did before r267763. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::updateProcessSuppressionState): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::updateProcessAssertions): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToWebProcess): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::networkProcessIfExists): 2021-02-08 Russell Epstein Cherry-pick r272368. rdar://problem/74032667 [macOS] Selecting a date on datetime-local inputs unexpectedly adds second and millisecond fields https://bugs.webkit.org/show_bug.cgi?id=221350 Reviewed by Devin Rousso. Source/WebCore: Currently, when setting the value of a datetime-local input using the picker, the length of the current value of the input is used to determine whether or not to return a value with second/millisecond precision. This is approach is incorrect, since the value could be empty, while the step attribute can specify second/millisecond precision. To fix, ensure the DateTimeChooserParameters knows whether the input has second and millisecond fields. That information can then be used by the UIProcess to return a correctly formatted value to the WebProcess. Test: fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-choose-value-from-picker.html * html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::handleDOMActivateEvent): (WebCore::BaseDateAndTimeInputType::didChangeValueFromControl): (WebCore::BaseDateAndTimeInputType::setupDateTimeChooserParameters): Moved this method from HTMLInputElement to the input type, since it is specific to date/time input types, and to leverage the existing shouldHaveSecondField and shouldHaveMillisecondField methods when building the DateTimeChooserParameters. * html/BaseDateAndTimeInputType.h: * html/HTMLInputElement.cpp: * html/HTMLInputElement.h: * platform/DateTimeChooserParameters.h: Added hasSecondField and hasMillisecondField members, so that the UIProcess knows whether or not to return a string that contains seconds/milliseconds. (WebCore::DateTimeChooserParameters::encode const): (WebCore::DateTimeChooserParameters::decode): Source/WebKit: * UIProcess/mac/WebDateTimePickerMac.mm: (-[WKDateTimePicker updatePicker:]): (-[WKDateTimePicker dateFormatStringForType:]): Do not use the length of the value to determine whether or seconds and milliseconds should be present, since the value can be empty. Instead, use the new information in DateTimeChooserParameters, matching the visual appearance of the input. Tools: Added a method to UIScriptController to simulate selecting a date using the presented date picker. * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: (WTR::UIScriptController::chooseDateTimePickerValue): * WebKitTestRunner/mac/UIScriptControllerMac.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptControllerMac::chooseDateTimePickerValue): LayoutTests: Added a test to to verify that the presence of seconds and milliseconds in the value of a datetime-local input after selecting a date using the picker matches the configuration. * fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-choose-value-from-picker-expected.txt: Added. * fast/forms/datetimelocal/datetimelocal-editable-components/datetimelocal-choose-value-from-picker.html: Added. * resources/ui-helper.js: (window.UIHelper.chooseDateTimePickerValue): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272368 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-04 Aditya Keerthi [macOS] Selecting a date on datetime-local inputs unexpectedly adds second and millisecond fields https://bugs.webkit.org/show_bug.cgi?id=221350 Reviewed by Devin Rousso. * UIProcess/mac/WebDateTimePickerMac.mm: (-[WKDateTimePicker updatePicker:]): (-[WKDateTimePicker dateFormatStringForType:]): Do not use the length of the value to determine whether or seconds and milliseconds should be present, since the value can be empty. Instead, use the new information in DateTimeChooserParameters, matching the visual appearance of the input. 2021-02-08 Russell Epstein Cherry-pick r272353. rdar://problem/74105476 [Cocoa] WebM audio goes out-of-sync or stops playing after a seek https://bugs.webkit.org/show_bug.cgi?id=221354 Reviewed by Eric Carlson. Source/WebCore: Add a new flag to MediaSample indicating whether the sample has any information about whether it is an sync-sample or not, and expose that through a new method hasSyncInfo(). Drive-by Fix: Force all video samples to contain a sample attachments dictionary, whether or not the sample is sync. Drive-by Fix #2: SampleMap does an equality comparison for `flags() == MediaSample::IsSync`. This breaks as soon as any sample has both `IsSync` and any other flag. Replace with a specific call to `isSync()` instead. * platform/MediaSample.h: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::doesCMSampleBufferHaveSyncInfo): (WebCore::MediaSampleAVFObjC::flags const): * platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer): Source/WebKit: The MTPluginFormatReader will attempt to determine whether an audio sample needs priming frames by querying for, among other things, its "syncInfo". Previously, we had just presumed all samples without a sample attachment dictionary were sync samples, and reported them as such from MediaSampleCursor, but this causes the format reader plugin to walk backwards all the way to the beginning of the audio track looking for priming samples. Instead, since the sample in question has no sync info (it was synthesized by MediaSample), return kCMBaseObjectError_ValueNotAvailable in this case, which causes the plugin format reader to assume all samples are both sync and do not require explicit priming frames. * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::MediaSampleCursor::getSampleTiming const): (WebKit::MediaSampleCursor::getSyncInfo const): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272353 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-03 Jer Noble [Cocoa] WebM audio goes out-of-sync or stops playing after a seek https://bugs.webkit.org/show_bug.cgi?id=221354 Reviewed by Eric Carlson. The MTPluginFormatReader will attempt to determine whether an audio sample needs priming frames by querying for, among other things, its "syncInfo". Previously, we had just presumed all samples without a sample attachment dictionary were sync samples, and reported them as such from MediaSampleCursor, but this causes the format reader plugin to walk backwards all the way to the beginning of the audio track looking for priming samples. Instead, since the sample in question has no sync info (it was synthesized by MediaSample), return kCMBaseObjectError_ValueNotAvailable in this case, which causes the plugin format reader to assume all samples are both sync and do not require explicit priming frames. * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::MediaSampleCursor::getSampleTiming const): (WebKit::MediaSampleCursor::getSyncInfo const): 2021-02-08 Russell Epstein Cherry-pick r272346. rdar://problem/74105218 PCM: earliestTimeToSend should be treated as an independent time value, not relative to timeOfAdClick https://bugs.webkit.org/show_bug.cgi?id=221303 Reviewed by John Wilander. r270136 assumed that PCM's earliestTimeToSend attribute was the difference between timeOfAdClick and when the attribution should be sent. As a result, it began each new browser session by adjusting this value based on the amount of time the session was closed. In reality, earliestTimeToSend is a raw secondsSinceEpoch() value, so we don't need any adjustment after a new session. No new tests, this is covered by http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start.html now that the corresponding test SPI has been updated. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::createTableQueries): (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): (WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Update the testing SPI to insert an expired time of now minus one hour as the earliestTimeToSend. (WebKit::ResourceLoadStatisticsDatabaseStore::updateTimerLastFired): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::timerLastFired): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::updatePrivateClickMeasurementAttributionTimes): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::updateTimerLastFired): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): Deleted. * NetworkProcess/PrivateClickMeasurementManager.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272346 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-03 Kate Cheney PCM: earliestTimeToSend should be treated as an independent time value, not relative to timeOfAdClick https://bugs.webkit.org/show_bug.cgi?id=221303 Reviewed by John Wilander. r270136 assumed that PCM's earliestTimeToSend attribute was the difference between timeOfAdClick and when the attribution should be sent. As a result, it began each new browser session by adjusting this value based on the amount of time the session was closed. In reality, earliestTimeToSend is a raw secondsSinceEpoch() value, so we don't need any adjustment after a new session. No new tests, this is covered by http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start.html now that the corresponding test SPI has been updated. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::createTableQueries): (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): (WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Update the testing SPI to insert an expired time of now minus one hour as the earliestTimeToSend. (WebKit::ResourceLoadStatisticsDatabaseStore::updateTimerLastFired): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::timerLastFired): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::updatePrivateClickMeasurementAttributionTimes): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::updateTimerLastFired): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): Deleted. * NetworkProcess/PrivateClickMeasurementManager.h: 2021-02-08 Russell Epstein Cherry-pick r272335. rdar://problem/74032694 REGRESSION (r270392): Launch time regression under IOSurface::maximumSize() https://bugs.webkit.org/show_bug.cgi?id=221346 Reviewed by Sam Weinig. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Scope r270392 to only the case where it is needed, when DOM rendering in the GPU process is enabled and the Web Content process does not have access to IOSurface, because it causes a small launch time regression. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272335 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-03 Tim Horton REGRESSION (r270392): Launch time regression under IOSurface::maximumSize() https://bugs.webkit.org/show_bug.cgi?id=221346 Reviewed by Sam Weinig. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Scope r270392 to only the case where it is needed, when DOM rendering in the GPU process is enabled and the Web Content process does not have access to IOSurface, because it causes a small launch time regression. 2021-02-08 Russell Epstein Cherry-pick r272326. rdar://problem/74105521 [iOS] delay `+[BKSMousePointerService sharedInstance]` so that it doesn't impact launch perf https://bugs.webkit.org/show_bug.cgi?id=221298 Reviewed by Geoffrey Garen. Source/WebKit: * UIProcess/ios/WKMouseDeviceObserver.h: * UIProcess/ios/WKMouseDeviceObserver.mm: (-[WKMouseDeviceObserver init]): Added. (-[WKMouseDeviceObserver startWithCompletionHandler:]): Added. (-[WKMouseDeviceObserver start]): (-[WKMouseDeviceObserver stop]): (-[WKMouseDeviceObserver stopWithCompletionHandler:]): Added. Tools: * TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm: (iOSMouseSupport.MouseInitiallyDisconnected): (iOSMouseSupport.MouseInitiallyConnected): (iOSMouseSupport.MouseLaterDisconnected): (iOSMouseSupport.MouseLaterConnected): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272326 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-03 Devin Rousso [iOS] delay `+[BKSMousePointerService sharedInstance]` so that it doesn't impact launch perf https://bugs.webkit.org/show_bug.cgi?id=221298 Reviewed by Geoffrey Garen. * UIProcess/ios/WKMouseDeviceObserver.h: * UIProcess/ios/WKMouseDeviceObserver.mm: (-[WKMouseDeviceObserver init]): Added. (-[WKMouseDeviceObserver startWithCompletionHandler:]): Added. (-[WKMouseDeviceObserver start]): (-[WKMouseDeviceObserver stop]): (-[WKMouseDeviceObserver stopWithCompletionHandler:]): Added. 2021-02-08 Russell Epstein Cherry-pick r272212. rdar://problem/74032657 Make sure NetworkRTCProvider stays valid for all NetworkRTCSocketCocoa callbacks https://bugs.webkit.org/show_bug.cgi?id=221249 Reviewed by Eric Carlson. Make the connection callback take a ref of the NetworkRTCProvider. The ref cycle will break at NetworkConnectionToWebProcess destruction since it will call NetworkRTCProvider::close which deletes all sockets owning the connection. * NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm: (WebKit::NetworkRTCSocketCocoa::NetworkRTCSocketCocoa): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272212 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-02 Youenn Fablet Make sure NetworkRTCProvider stays valid for all NetworkRTCSocketCocoa callbacks https://bugs.webkit.org/show_bug.cgi?id=221249 Reviewed by Eric Carlson. Make the connection callback take a ref of the NetworkRTCProvider. The ref cycle will break at NetworkConnectionToWebProcess destruction since it will call NetworkRTCProvider::close which deletes all sockets owning the connection. * NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm: (WebKit::NetworkRTCSocketCocoa::NetworkRTCSocketCocoa): 2021-02-08 Russell Epstein Cherry-pick r272178. rdar://problem/74105398 Allow support for CAAnimationGroup https://bugs.webkit.org/show_bug.cgi?id=221209 Reviewed by Dean Jackson, Sam Weinig and Simon Fraser. In order to fix bug 219894, we need to use Core Animation's CAAnimationGroup and its Source/WebCore: setAnimations() method. This patch adds a new "Group" type to PlatformCAAnimation and platform-specific integration for Windows and Cocoa ports. * platform/graphics/ca/PlatformCAAnimation.cpp: (WebCore::operator<<): * platform/graphics/ca/PlatformCAAnimation.h: * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.h: * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm: (WebCore::PlatformCAAnimationCocoa::PlatformCAAnimationCocoa): (WebCore::PlatformCAAnimationCocoa::keyPath const): (WebCore::PlatformCAAnimationCocoa::setTimingFunction): (WebCore::PlatformCAAnimationCocoa::isAdditive const): (WebCore::PlatformCAAnimationCocoa::setAdditive): (WebCore::PlatformCAAnimationCocoa::valueFunction const): (WebCore::PlatformCAAnimationCocoa::setValueFunction): (WebCore::PlatformCAAnimationCocoa::setFromValue): (WebCore::PlatformCAAnimationCocoa::copyFromValueFrom): (WebCore::PlatformCAAnimationCocoa::setToValue): (WebCore::PlatformCAAnimationCocoa::copyToValueFrom): (WebCore::PlatformCAAnimationCocoa::setValues): (WebCore::PlatformCAAnimationCocoa::copyValuesFrom): (WebCore::PlatformCAAnimationCocoa::setKeyTimes): (WebCore::PlatformCAAnimationCocoa::copyKeyTimesFrom): (WebCore::PlatformCAAnimationCocoa::setTimingFunctions): (WebCore::PlatformCAAnimationCocoa::copyTimingFunctionsFrom): (WebCore::PlatformCAAnimationCocoa::setAnimations): (WebCore::PlatformCAAnimationCocoa::copyAnimationsFrom): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (WebCore::PlatformCALayerCocoa::addAnimationForKey): (WebCore::PlatformCALayerCocoa::animationForKey): * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: (PlatformCAAnimationWin::PlatformCAAnimationWin): (PlatformCAAnimationWin::setAnimations): (PlatformCAAnimationWin::copyAnimationsFrom): * platform/graphics/ca/win/PlatformCAAnimationWin.h: Source/WebKit: setAnimations() method. Add support for the new "Group" PlatformCAAnimation type for the remote animations. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::PlatformCAAnimationRemote::Properties::encode const): (WebKit::PlatformCAAnimationRemote::Properties::decode): (WebKit::PlatformCAAnimationRemote::copy const): (WebKit::PlatformCAAnimationRemote::setAnimations): (WebKit::PlatformCAAnimationRemote::copyAnimationsFrom): (WebKit::createAnimation): (WebKit::addAnimationToLayer): (WebKit::operator<<): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272178 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-01 Antoine Quint Allow support for CAAnimationGroup https://bugs.webkit.org/show_bug.cgi?id=221209 Reviewed by Dean Jackson, Sam Weinig and Simon Fraser. In order to fix bug 219894, we need to use Core Animation's CAAnimationGroup and its setAnimations() method. Add support for the new "Group" PlatformCAAnimation type for the remote animations. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::PlatformCAAnimationRemote::Properties::encode const): (WebKit::PlatformCAAnimationRemote::Properties::decode): (WebKit::PlatformCAAnimationRemote::copy const): (WebKit::PlatformCAAnimationRemote::setAnimations): (WebKit::PlatformCAAnimationRemote::copyAnimationsFrom): (WebKit::createAnimation): (WebKit::addAnimationToLayer): (WebKit::operator<<): 2021-02-08 Russell Epstein Cherry-pick r271908. rdar://problem/74032594 Harden NetworkProcess against integer overflow in CacheStorageEngine size calculation https://bugs.webkit.org/show_bug.cgi?id=220997 Reviewed by Youenn Fablet. Since the CacheStorage allocation is based on data provided by the WebContent process, we should check for integer overflow before making an allocation. * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::put): Use checked arithmetic and return a failure if we overflow. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271908 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-26 Brent Fulgham Harden NetworkProcess against integer overflow in CacheStorageEngine size calculation https://bugs.webkit.org/show_bug.cgi?id=220997 Reviewed by Youenn Fablet. Since the CacheStorage allocation is based on data provided by the WebContent process, we should check for integer overflow before making an allocation. * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::put): Use checked arithmetic and return a failure if we overflow. 2021-02-02 Russell Epstein Cherry-pick r272229. rdar://problem/73907002 REGRESSION(r271744): Broke Microsoft live login in internal builds https://bugs.webkit.org/show_bug.cgi?id=221271 Reviewed by Alex Christensen. If a user goes straight to login.live.com without first visiting microsoft.com, we crash when checking for storage access because we assume the user has interacted with the page. Since this is a quirked flow, we should not assume that, and should insert the domain into the database. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt): (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272229 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-02 Kate Cheney REGRESSION(r271744): Broke Microsoft live login in internal builds https://bugs.webkit.org/show_bug.cgi?id=221271 Reviewed by Alex Christensen. If a user goes straight to login.live.com without first visiting microsoft.com, we crash when checking for storage access because we assume the user has interacted with the page. Since this is a quirked flow, we should not assume that, and should insert the domain into the database. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt): (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 2021-02-02 Alan Coon Cherry-pick r271813. rdar://problem/73888012 Update availability annotations to match the macOS 11.0 and iOS 14.0 GM SDKs https://bugs.webkit.org/show_bug.cgi?id=220874 Reviewed by Darin Adler. Source/JavaScriptCore: * API/JSContextPrivate.h: * API/JSContextRefPrivate.h: Source/WebKit: * UIProcess/API/Cocoa/WKContentWorld.h: * UIProcess/API/Cocoa/WKError.h: * UIProcess/API/Cocoa/WKFindConfiguration.h: * UIProcess/API/Cocoa/WKFindResult.h: * UIProcess/API/Cocoa/WKFrameInfoPrivate.h: * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h: * UIProcess/API/Cocoa/WKPDFConfiguration.h: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKScriptMessage.h: * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h: * UIProcess/API/Cocoa/WKUserContentController.h: * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: * UIProcess/API/Cocoa/WKUserScript.h: * UIProcess/API/Cocoa/WKUserScriptPrivate.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebpagePreferences.h: * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKFrameTreeNode.h: * UIProcess/API/Cocoa/_WKInputDelegate.h: * UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKResourceLoadDelegate.h: * UIProcess/API/Cocoa/_WKResourceLoadInfo.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.h: * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h: * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.h: * UIProcess/API/Cocoa/_WKTextManipulationItem.h: * UIProcess/API/Cocoa/_WKTextManipulationToken.h: * UIProcess/API/Cocoa/_WKUserContentWorld.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271813 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-25 Chris Dumez Update availability annotations to match the macOS 11.0 and iOS 14.0 GM SDKs https://bugs.webkit.org/show_bug.cgi?id=220874 Reviewed by Darin Adler. * UIProcess/API/Cocoa/WKContentWorld.h: * UIProcess/API/Cocoa/WKError.h: * UIProcess/API/Cocoa/WKFindConfiguration.h: * UIProcess/API/Cocoa/WKFindResult.h: * UIProcess/API/Cocoa/WKFrameInfoPrivate.h: * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h: * UIProcess/API/Cocoa/WKPDFConfiguration.h: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKScriptMessage.h: * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h: * UIProcess/API/Cocoa/WKUserContentController.h: * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: * UIProcess/API/Cocoa/WKUserScript.h: * UIProcess/API/Cocoa/WKUserScriptPrivate.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebpagePreferences.h: * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKFrameTreeNode.h: * UIProcess/API/Cocoa/_WKInputDelegate.h: * UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKResourceLoadDelegate.h: * UIProcess/API/Cocoa/_WKResourceLoadInfo.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.h: * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h: * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.h: * UIProcess/API/Cocoa/_WKTextManipulationItem.h: * UIProcess/API/Cocoa/_WKTextManipulationToken.h: * UIProcess/API/Cocoa/_WKUserContentWorld.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: 2021-02-02 Alan Coon Cherry-pick r272040. rdar://problem/73887486 [WebAuthn] Adopt new SPI to show no credentials error for the platform authenticator https://bugs.webkit.org/show_bug.cgi?id=220894 Reviewed by Brent Fulgham. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272040 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-28 Jiewen Tan [WebAuthn] Adopt new SPI to show no credentials error for the platform authenticator https://bugs.webkit.org/show_bug.cgi?id=220894 Reviewed by Brent Fulgham. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): 2021-02-02 Alan Coon Cherry-pick r271880. rdar://problem/73889737 WebGL power preference and discrete/internal gpu selection implemented incorrectly with ANGLE https://bugs.webkit.org/show_bug.cgi?id=220843 Patch by Kimmo Kinnunen on 2021-01-26 Reviewed by Dean Jackson. Source/WebCore: Use ANGLE extension EGL_ANGLE_power_preference to signal to ANGLE that the underlying CGL context should be updated as a response to display reconfiguration signal. This ensures that ANGLE state stays consistent with the actual CGL context behavior, as we don't change the context behind ANGLE's back. Remove the feature where the context GPU is selected based on the display the window is on. This cannot work with the logic of "powerPreference = "high-performance" goes to discrete GPU". Also, this cannot work with ANGLE at all, since all contexts are backed by a single platform context. Thus all contexts will use the same underlying GPU. No new tests due to the test runner missing features. The bug blockers track the testing. * PlatformMac.cmake: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::isHighPerformanceContext): * page/Chrome.cpp: (WebCore::Chrome::windowScreenDidChange): * platform/graphics/GraphicsContextGL.h: * platform/graphics/RemoteGraphicsContextGLProxyBase.cpp: * platform/graphics/RemoteGraphicsContextGLProxyBase.h: * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: (WebCore::GraphicsContextGLOpenGL::create): (WebCore::GraphicsContextGLOpenGL::createShared): (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): (WebCore::GraphicsContextGLOpenGL::setContextVisibility): (WebCore::GraphicsContextGLOpenGL::displayWasReconfigured): (WebCore::GraphicsContextGLOpenGL::simulateContextChanged): * platform/graphics/mac/GraphicsChecksMac.cpp: Added. (WebCore::attachToAppleGraphicsControl): (WebCore::hasMuxCapability): (WebCore::hasLowAndHighPowerGPUs): * platform/graphics/mac/GraphicsChecksMac.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h. * platform/graphics/mac/ScopedHighPerformanceGPURequest.h: Copied from Source/WebCore/platform/graphics/mac/SwitchingGPUClient.h. (WebCore::ScopedHighPerformanceGPURequest::ScopedHighPerformanceGPURequest): (WebCore::ScopedHighPerformanceGPURequest::~ScopedHighPerformanceGPURequest): (WebCore::ScopedHighPerformanceGPURequest::operator=): (WebCore::ScopedHighPerformanceGPURequest::acquire): * platform/graphics/mac/SwitchingGPUClient.h: * platform/graphics/opengl/GraphicsContextGLOpenGL.h: * platform/graphics/opengl/GraphicsContextGLOpenGLManager.cpp: (WebCore::GraphicsContextGLOpenGLManager::displayWasReconfigured): (WebCore::GraphicsContextGLOpenGLManager::addContext): (WebCore::GraphicsContextGLOpenGLManager::removeContext): * platform/graphics/opengl/GraphicsContextGLOpenGLManager.h: * testing/Internals.cpp: Source/WebKit: Move the high-performance GPU shutdown timer from individual web processes to the main class in the ui process. This simplifies the implementation and reduces the number of timers. * UIProcess/mac/HighPerformanceGPUManager.h: * UIProcess/mac/HighPerformanceGPUManager.mm: (WebKit::HighPerformanceGPUManager::HighPerformanceGPUManager): (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::updateState): * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp: (WebKit::WebSwitchingGPUClient::requestHighPerformanceGPU): (WebKit::WebSwitchingGPUClient::releaseHighPerformanceGPU): * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271880 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-26 Kimmo Kinnunen WebGL power preference and discrete/internal gpu selection implemented incorrectly with ANGLE https://bugs.webkit.org/show_bug.cgi?id=220843 Reviewed by Dean Jackson. Move the high-performance GPU shutdown timer from individual web processes to the main class in the ui process. This simplifies the implementation and reduces the number of timers. * UIProcess/mac/HighPerformanceGPUManager.h: * UIProcess/mac/HighPerformanceGPUManager.mm: (WebKit::HighPerformanceGPUManager::HighPerformanceGPUManager): (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::updateState): * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp: (WebKit::WebSwitchingGPUClient::requestHighPerformanceGPU): (WebKit::WebSwitchingGPUClient::releaseHighPerformanceGPU): * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h: 2021-02-02 Alan Coon Cherry-pick r272072. rdar://problem/73890534 [iOS] Stop observing changes in one preference domain https://bugs.webkit.org/show_bug.cgi?id=221130 Reviewed by Brent Fulgham. It has been determined that there is no need to observe preference changes in the domain 'com.apple.Preferences'. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKPreferenceObserver init]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272072 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-29 Per Arne [iOS] Stop observing changes in one preference domain https://bugs.webkit.org/show_bug.cgi?id=221130 Reviewed by Brent Fulgham. It has been determined that there is no need to observe preference changes in the domain 'com.apple.Preferences'. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKPreferenceObserver init]): 2021-02-02 Alan Coon Cherry-pick r271895. rdar://problem/73890430 REGRESSION(r261238): WKWebView crashes on launch inside a quicklook preview https://bugs.webkit.org/show_bug.cgi?id=219632 Reviewed by Alexey Proskuryakov. Partially revert r261238 to allow applications without access to 'nsurlsessiond' to still be able to use WebKit for local file access. This workaround should be removed once we complete the work needed to support true offline WebKit use. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::checkEntitlements): Add an early return if the application possesses the 'com.apple.security.network.client' entitlement. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271895 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-26 Brent Fulgham REGRESSION(r261238): WKWebView crashes on launch inside a quicklook preview https://bugs.webkit.org/show_bug.cgi?id=219632 Reviewed by Alexey Proskuryakov. Partially revert r261238 to allow applications without access to 'nsurlsessiond' to still be able to use WebKit for local file access. This workaround should be removed once we complete the work needed to support true offline WebKit use. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::checkEntitlements): Add an early return if the application possesses the 'com.apple.security.network.client' entitlement. 2021-02-02 Alan Coon Cherry-pick r271890. rdar://problem/73890942 [CoreIPC] Add size check in decodeSharedBuffer to allow it to be validated against the SharedMemory received https://bugs.webkit.org/show_bug.cgi?id=220962 Reviewed by Darin Adler. Add a new check during decoding so that we fail if the expected buffer size is larger than the block of shared memory supplied in the IPC call. * Shared/WebCoreArgumentCoders.cpp: (IPC::decodeSharedBuffer): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271890 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-26 Brent Fulgham [CoreIPC] Add size check in decodeSharedBuffer to allow it to be validated against the SharedMemory received https://bugs.webkit.org/show_bug.cgi?id=220962 Reviewed by Darin Adler. Add a new check during decoding so that we fail if the expected buffer size is larger than the block of shared memory supplied in the IPC call. * Shared/WebCoreArgumentCoders.cpp: (IPC::decodeSharedBuffer): 2021-02-02 Alan Coon Cherry-pick r271861. rdar://problem/73890854 [iOS] Obscured elements should not be focusable using the accessory bar https://bugs.webkit.org/show_bug.cgi?id=220929 Reviewed by Tim Horton. Source/WebCore: * rendering/HitTestResult.h: Export function so it can be called from WebKit layer. Source/WebKit: Currently, assistable elements hidden behind unassistable elements can be focused using the next/previous buttons on the accessory bar. This behavior is undesirable since users cannot see the focused element, but are still presented UI to enter information into the element. While the current behavior has been longstanding, its undesirability was exposed after r269059, which made it possible to use the accessory bar to focus elements across focusable scopes. As a result, it became possible to focus a hidden input field on appleid.apple.com using the accessory bar. Note that the hidden field is inside a subframe, which was previously excluded from accessory bar next/previous operations. However, the same bug would still exist even if the field was not inside a subframe, which means that r269059 is not the root cause of the issue, but simply exposed a larger underlying problem. To prevent obscured elements from being focusable using the accessory bar, we now use hit testing to determine whether or not an element is obscured, before considering the element "assistable". Test: fast/forms/ios/accessory-bar-navigation-obscured-input.html * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::isObscuredElement): An element is considered obscured if a hit test at its center position relative to the main document targets a different element. (WebKit::nextAssistableElement): Obscured elements should not be assistable. LayoutTests: * fast/forms/ios/accessory-bar-navigation-obscured-input-expected.txt: Added. * fast/forms/ios/accessory-bar-navigation-obscured-input.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271861 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-25 Aditya Keerthi [iOS] Obscured elements should not be focusable using the accessory bar https://bugs.webkit.org/show_bug.cgi?id=220929 Reviewed by Tim Horton. Currently, assistable elements hidden behind unassistable elements can be focused using the next/previous buttons on the accessory bar. This behavior is undesirable since users cannot see the focused element, but are still presented UI to enter information into the element. While the current behavior has been longstanding, its undesirability was exposed after r269059, which made it possible to use the accessory bar to focus elements across focusable scopes. As a result, it became possible to focus a hidden input field on appleid.apple.com using the accessory bar. Note that the hidden field is inside a subframe, which was previously excluded from accessory bar next/previous operations. However, the same bug would still exist even if the field was not inside a subframe, which means that r269059 is not the root cause of the issue, but simply exposed a larger underlying problem. To prevent obscured elements from being focusable using the accessory bar, we now use hit testing to determine whether or not an element is obscured, before considering the element "assistable". Test: fast/forms/ios/accessory-bar-navigation-obscured-input.html * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::isObscuredElement): An element is considered obscured if a hit test at its center position relative to the main document targets a different element. (WebKit::nextAssistableElement): Obscured elements should not be assistable. 2021-02-02 Alan Coon Cherry-pick r271786. rdar://problem/73890368 [iOS WK2] theverge.com - rubber band scrolling at the top of the page causes an abrupt jump https://bugs.webkit.org/show_bug.cgi?id=220886 Reviewed by Sam Weinig. Source/WebCore: theverge.com on iOS is a page that has long main thread stalls with forced layouts on a timer that alter the page height; this caused the post-layout updateScrollbars() called from FrameView::adjustViewSize() to call scrollToPosition() after adjusting the scroll position to the allowed range. If the page laid out while rubberbanding was happening, the current scroll position would be negative, then clamped to 0, then sent to the UI process as a requested scroll to 0, triggering the jump to top in the UI process. There's existing code to prevent this from happening if we know that rubberbanding is happening; this patch makes isRubberBandInProgress() work for iOS WK2. It does so by having updateVisibleContentRects() push information about rubberbanding nodes onto RemoteScrollingCoordinator. We remove an unnecessary shouldUpdateScrollLayerPositionSynchronously() check in FrameView::isRubberBandInProgress() - if it's true, then the scrolling coordinator won't see any rubberbanding nodes anyway. Test: fast/scrolling/ios/content-size-change-during-rubberband.html * page/FrameView.cpp: (WebCore::FrameView::isRubberBandInProgress const): * page/FrameView.h: * platform/ScrollView.cpp: (WebCore::ScrollView::updateScrollbars): Source/WebKit: theverge.com on iOS is a page that has long main thread stalls with forced layouts on a timer that alter the page height; this caused the post-layout updateScrollbars() called from FrameView::adjustViewSize() to call scrollToPosition() after adjusting the scroll position to the allowed range. If the page laid out while rubberbanding was happening, the current scroll position would be negative, then clamped to 0, then sent to the UI process as a requested scroll to 0, triggering the jump to top in the UI process. There's existing code to prevent this from happening if we know that rubberbanding is happening; this patch makes isRubberBandInProgress() work for iOS WK2. It does so by having updateVisibleContentRects() push information about rubberbanding nodes onto RemoteScrollingCoordinator. We remove an unnecessary shouldUpdateScrollLayerPositionSynchronously() check in FrameView::isRubberBandInProgress() - if it's true, then the scrolling coordinator won't see any rubberbanding nodes anyway. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::addNodeWithActiveRubberBanding): (WebKit::RemoteScrollingCoordinator::removeNodeWithActiveRubberBanding): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): Tools: Add test infrastructure to allow UIScriptController::scrollToOffset() and UIScriptController::immediateScrollToOffset() to take an options argument with a 'unconstrained' property, which allows scrolling to unstable offset to simulate rubberbanding. * DumpRenderTree/ios/UIScriptControllerIOS.h: * DumpRenderTree/ios/UIScriptControllerIOS.mm: (WTR::contentOffsetBoundedIfNecessary): (WTR::UIScriptControllerIOS::scrollToOffset): (WTR::UIScriptControllerIOS::immediateScrollToOffset): (WTR::contentOffsetBoundedInValidRange): Deleted. * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.h: (WTR::UIScriptController::scrollToOffset): (WTR::UIScriptController::immediateScrollToOffset): * TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp: (WTR::toScrollToOptions): * WebKitTestRunner/ios/UIScriptControllerIOS.h: * WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::contentOffsetBoundedIfNecessary): (WTR::UIScriptControllerIOS::scrollToOffset): (WTR::UIScriptControllerIOS::immediateScrollToOffset): (WTR::contentOffsetBoundedInValidRange): Deleted. LayoutTests: Add test infrastructure to allow UIScriptController::scrollToOffset() and UIScriptController::immediateScrollToOffset() to take an options argument with a 'unconstrained' property, which allows scrolling to unstable offset to simulate rubberbanding. * fast/scrolling/ios/content-size-change-during-rubberband-expected.txt: Added. * fast/scrolling/ios/content-size-change-during-rubberband.html: Added. * resources/ui-helper.js: (window.UIHelper.scrollTo.return.new.Promise.): (window.UIHelper.scrollTo.return.new.Promise): (window.UIHelper.scrollTo): (window.UIHelper.immediateScrollTo): (window.UIHelper.immediateUnstableScrollTo): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271786 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-24 Simon Fraser [iOS WK2] theverge.com - rubber band scrolling at the top of the page causes an abrupt jump https://bugs.webkit.org/show_bug.cgi?id=220886 Reviewed by Sam Weinig. theverge.com on iOS is a page that has long main thread stalls with forced layouts on a timer that alter the page height; this caused the post-layout updateScrollbars() called from FrameView::adjustViewSize() to call scrollToPosition() after adjusting the scroll position to the allowed range. If the page laid out while rubberbanding was happening, the current scroll position would be negative, then clamped to 0, then sent to the UI process as a requested scroll to 0, triggering the jump to top in the UI process. There's existing code to prevent this from happening if we know that rubberbanding is happening; this patch makes isRubberBandInProgress() work for iOS WK2. It does so by having updateVisibleContentRects() push information about rubberbanding nodes onto RemoteScrollingCoordinator. We remove an unnecessary shouldUpdateScrollLayerPositionSynchronously() check in FrameView::isRubberBandInProgress() - if it's true, then the scrolling coordinator won't see any rubberbanding nodes anyway. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::addNodeWithActiveRubberBanding): (WebKit::RemoteScrollingCoordinator::removeNodeWithActiveRubberBanding): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): 2021-02-02 Alan Coon Cherry-pick r271771. rdar://problem/73890368 [iOS WK2] Make the "in stable state" bit in visible content rect updates more fine-grained https://bugs.webkit.org/show_bug.cgi?id=220875 Reviewed by Tim Horton. VisibleContentRectUpdateInfo contains a single "in stable state" bit, but in a future patch the web process will need to know if the UI process is rubberbanding. In addition, we can fold "isChangingObscuredInsetsInteractively" into the same state bits. So give VisibleContentRectUpdateInfo a OptionSet. To give the correct state for non-main UIScrollViews, have _scrollViewIsRubberBanding take the UIScrollView in question, and only include isChangingObscuredInsetsInteractively if the question is being asked of the main UIScrollView. * Shared/VisibleContentRectUpdateInfo.cpp: (WebKit::VisibleContentRectUpdateInfo::encode const): (WebKit::VisibleContentRectUpdateInfo::decode): (WebKit::operator<<): * Shared/VisibleContentRectUpdateInfo.h: (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo): (WebKit::VisibleContentRectUpdateInfo::inStableState const): (WebKit::VisibleContentRectUpdateInfo::viewStability const): (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize const): (WebKit::operator==): (WebKit::VisibleContentRectUpdateInfo::isChangingObscuredInsetsInteractively const): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _didRelaunchProcess]): (-[WKWebView _scrollViewIsRubberBanding:]): (-[WKWebView _viewStabilityState:]): (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]): (-[WKWebView _updateVisibleContentRects]): (-[WKWebView _scrollViewIsRubberBanding]): Deleted. (-[WKWebView _scrollViewIsInStableState:]): Deleted. * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:viewStability:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271771 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-22 Simon Fraser [iOS WK2] Make the "in stable state" bit in visible content rect updates more fine-grained https://bugs.webkit.org/show_bug.cgi?id=220875 Reviewed by Tim Horton. VisibleContentRectUpdateInfo contains a single "in stable state" bit, but in a future patch the web process will need to know if the UI process is rubberbanding. In addition, we can fold "isChangingObscuredInsetsInteractively" into the same state bits. So give VisibleContentRectUpdateInfo a OptionSet. To give the correct state for non-main UIScrollViews, have _scrollViewIsRubberBanding take the UIScrollView in question, and only include isChangingObscuredInsetsInteractively if the question is being asked of the main UIScrollView. * Shared/VisibleContentRectUpdateInfo.cpp: (WebKit::VisibleContentRectUpdateInfo::encode const): (WebKit::VisibleContentRectUpdateInfo::decode): (WebKit::operator<<): * Shared/VisibleContentRectUpdateInfo.h: (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo): (WebKit::VisibleContentRectUpdateInfo::inStableState const): (WebKit::VisibleContentRectUpdateInfo::viewStability const): (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize const): (WebKit::operator==): (WebKit::VisibleContentRectUpdateInfo::isChangingObscuredInsetsInteractively const): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _didRelaunchProcess]): (-[WKWebView _scrollViewIsRubberBanding:]): (-[WKWebView _viewStabilityState:]): (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]): (-[WKWebView _updateVisibleContentRects]): (-[WKWebView _scrollViewIsRubberBanding]): Deleted. (-[WKWebView _scrollViewIsInStableState:]): Deleted. * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:viewStability:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): 2021-02-02 Alan Coon Cherry-pick r271754. rdar://problem/73890755 [WebAuthn] No error is visible after user enters the incorrect PIN https://bugs.webkit.org/show_bug.cgi?id=220839 Reviewed by Brent Fulgham. To fix that, let's have a boolean to indicate the PIN entry UI has already been presented within this session. And then rely on the error UI to let users retry the PIN. Covered by manual tests. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::requestPin): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): Besides above, this patch also fixes some crashes. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271754 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-22 Jiewen Tan [WebAuthn] No error is visible after user enters the incorrect PIN https://bugs.webkit.org/show_bug.cgi?id=220839 Reviewed by Brent Fulgham. To fix that, let's have a boolean to indicate the PIN entry UI has already been presented within this session. And then rely on the error UI to let users retry the PIN. Covered by manual tests. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::requestPin): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): Besides above, this patch also fixes some crashes. 2021-02-02 Alan Coon Cherry-pick r271737. rdar://problem/73890706 PiP video subtitles stop updating when Safari is backgrounded https://bugs.webkit.org/show_bug.cgi?id=220660 Reviewed by Darin Adler. Subtitles in the picture-in-picture window will stop updating when the browser is in the background because we freeze the layer tree when a browser is in the background. This patch fixes this issue by avoiding freezing the layer tree if a video is playing in picture-in-picture when the browser is in the background. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState): * WebProcess/cocoa/VideoFullscreenManager.h: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::videoInPictureInPicture const): (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271737 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-21 Peng Liu PiP video subtitles stop updating when Safari is backgrounded https://bugs.webkit.org/show_bug.cgi?id=220660 Reviewed by Darin Adler. Subtitles in the picture-in-picture window will stop updating when the browser is in the background because we freeze the layer tree when a browser is in the background. This patch fixes this issue by avoiding freezing the layer tree if a video is playing in picture-in-picture when the browser is in the background. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState): * WebProcess/cocoa/VideoFullscreenManager.h: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::videoInPictureInPicture const): (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): 2021-02-02 Alan Coon Cherry-pick r271656. rdar://problem/73890220 [Mac] Netflix controls do not fade out after entering fullscreen https://bugs.webkit.org/show_bug.cgi?id=220472 Reviewed by Eric Carlson. Test: TestWebKitAPI/Tests/mac/FullscreenPointerLeave.mm Netflix uses a "pointerleave" event over their playback controls to trigger setting their "fade out controls" timer, but a "pointerleave" event isn't fired when the element moves out from under the pointer (either due to style changes, or the window screen location moving due to entering fullscreen). Work around this behavior by sending a synthetic mouse event after entering fullscreen, which causes the "pointerleave" event to be fired if, indeed, the pointer is no longer over the element in question. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271656 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-20 Jer Noble [Mac] Netflix controls do not fade out after entering fullscreen https://bugs.webkit.org/show_bug.cgi?id=220472 Reviewed by Eric Carlson. Test: TestWebKitAPI/Tests/mac/FullscreenPointerLeave.mm Netflix uses a "pointerleave" event over their playback controls to trigger setting their "fade out controls" timer, but a "pointerleave" event isn't fired when the element moves out from under the pointer (either due to style changes, or the window screen location moving due to entering fullscreen). Work around this behavior by sending a synthetic mouse event after entering fullscreen, which causes the "pointerleave" event to be fired if, indeed, the pointer is no longer over the element in question. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): 2021-02-01 Alan Coon Cherry-pick r271939. rdar://problem/73838846 [Mac] MediaSampleCursor::stepInOrderedMap can hang when stepping to the end of a track that hasn't been fully parsed https://bugs.webkit.org/show_bug.cgi?id=220555 Reviewed by Eric Carlson. Source/WebCore: Test: http/tests/media/video-canplaythrough-webm.html * platform/graphics/FloatSize.h: Exported toJSONObject. Source/WebKit: When a container has multiple tracks, CoreMedia determines the overall duration by creating a cursor at a presentation time of +infinity then asking for its timing info, the expectation being that the cursor will clamp itself to the track duration and report that in MediaSampleCursor::getSampleTiming. Previously, this could result in a hang for tracks that had not yet finished parsing, as MediaSampleCursor was designed to wait for samples outside the playable range. With this change, MediaSampleCursor no longer waits for samples outside the playable range but rather reports clamped timing info without waiting for a sample. If CoreMedia asks for information that requires a sample (e.g., sample location), MediaSampleCursor will respond with `kMTPluginSampleCursorError_LocationNotAvailable`. So that CoreMedia can determine the range of playable samples, this patch implements MediaSampleCursor::getPlayableHorizon. To simplify this implementation, MediaSampleCursor now assumes that decode time equals presentation time (for video tracks) or is invalid (for audio tracks). While here, also added media logging that helped debug this issue. Test: http/tests/media/video-canplaythrough-webm.html * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): Asserted our assmpution about the relationship between presentation time and decode time. * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::assumedDecodeTime): Added to compute decode time from presentation time and a nominal sample. (WebKit::upperBound): Changed to compute the decode key based on assumed decode time. (WebKit::stepIterator): Removed the MediaTime specialization. (WebKit::stepTime): Added to step a MediaTime rather than an iterator. (WebKit::MediaSampleCursor::MediaSampleCursor): Initialized logging. (WebKit::MediaSampleCursor::locateIterator const): Changed to find an iterator based on presentation time and assumed decode time. (WebKit::MediaSampleCursor::locateMediaSample const): Ditto. (WebKit::MediaSampleCursor::locateTiming const): Added to locate timing info even if no sample is available. (WebKit::MediaSampleCursor::stepInOrderedMap): Changed to call getSampleMap, and removed the MediaTime specialization. (WebKit::MediaSampleCursor::stepInPresentationTime): Added to replace the MediaTime specialization of stepInOrderedMap. (WebKit::MediaSampleCursor::getSampleMap const): Added to call MediaTrackReader::waitForSample and return as soon as at least one sample is available. Returns kMTPluginSampleCursorError_NoSamples if the track finishes parsing with no samples. (WebKit::MediaSampleCursor::getMediaSample const): Changed to call getSampleMap. (WebKit::MediaSampleCursor::getTiming const): Added to get timing info. (WebKit::MediaSampleCursor::copyProperty): Added logging. (WebKit::MediaSampleCursor::stepInDecodeOrderAndReportStepsTaken): Changed to call the new version of stepInOrderedMap. (WebKit::MediaSampleCursor::stepInPresentationOrderAndReportStepsTaken): Ditto. (WebKit::MediaSampleCursor::stepByDecodeTime): Changed to call stepInPresentationTime. (WebKit::MediaSampleCursor::stepByPresentationTime): Ditto. (WebKit::MediaSampleCursor::compareInDecodeOrder const): Changed to call getTiming. (WebKit::MediaSampleCursor::getSampleTiming const): Ditto. (WebKit::MediaSampleCursor::getPlayableHorizon const): Implemented by taking the difference between the last sample's end time and the cursor's presentation time. (WebKit::MediaSampleCursor::logChannel const): Added. (WebKit::makeIterator): Deleted. (WebKit::makeTime): Deleted. (WebKit::MediaSampleCursor::createAtDecodedSample): Deleted. * Shared/mac/MediaFormatReader/MediaSampleCursor.h: (WebKit::MediaSampleCursor::logger const): Configured logging. (WebKit::MediaSampleCursor::logClassName const): Ditto. (WebKit::MediaSampleCursor::logIdentifier const): Ditto. * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: (WebKit::MediaTrackReader::mediaTypeString const): Ditto. (WebKit::MediaTrackReader::nextSampleCursorLogIdentifier const): Ditto. * Shared/mac/MediaFormatReader/MediaTrackReader.h: LayoutTests: * http/conf/mime.types: Added an entry for video/webm. * http/tests/media/resources/long-test-vp9-vorbis.webm: Added. * http/tests/media/video-canplaythrough-webm-expected.txt: Added. * http/tests/media/video-canplaythrough-webm.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271939 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-27 Andy Estes [Mac] MediaSampleCursor::stepInOrderedMap can hang when stepping to the end of a track that hasn't been fully parsed https://bugs.webkit.org/show_bug.cgi?id=220555 Reviewed by Eric Carlson. When a container has multiple tracks, CoreMedia determines the overall duration by creating a cursor at a presentation time of +infinity then asking for its timing info, the expectation being that the cursor will clamp itself to the track duration and report that in MediaSampleCursor::getSampleTiming. Previously, this could result in a hang for tracks that had not yet finished parsing, as MediaSampleCursor was designed to wait for samples outside the playable range. With this change, MediaSampleCursor no longer waits for samples outside the playable range but rather reports clamped timing info without waiting for a sample. If CoreMedia asks for information that requires a sample (e.g., sample location), MediaSampleCursor will respond with `kMTPluginSampleCursorError_LocationNotAvailable`. So that CoreMedia can determine the range of playable samples, this patch implements MediaSampleCursor::getPlayableHorizon. To simplify this implementation, MediaSampleCursor now assumes that decode time equals presentation time (for video tracks) or is invalid (for audio tracks). While here, also added media logging that helped debug this issue. Test: http/tests/media/video-canplaythrough-webm.html * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): Asserted our assmpution about the relationship between presentation time and decode time. * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::assumedDecodeTime): Added to compute decode time from presentation time and a nominal sample. (WebKit::upperBound): Changed to compute the decode key based on assumed decode time. (WebKit::stepIterator): Removed the MediaTime specialization. (WebKit::stepTime): Added to step a MediaTime rather than an iterator. (WebKit::MediaSampleCursor::MediaSampleCursor): Initialized logging. (WebKit::MediaSampleCursor::locateIterator const): Changed to find an iterator based on presentation time and assumed decode time. (WebKit::MediaSampleCursor::locateMediaSample const): Ditto. (WebKit::MediaSampleCursor::locateTiming const): Added to locate timing info even if no sample is available. (WebKit::MediaSampleCursor::stepInOrderedMap): Changed to call getSampleMap, and removed the MediaTime specialization. (WebKit::MediaSampleCursor::stepInPresentationTime): Added to replace the MediaTime specialization of stepInOrderedMap. (WebKit::MediaSampleCursor::getSampleMap const): Added to call MediaTrackReader::waitForSample and return as soon as at least one sample is available. Returns kMTPluginSampleCursorError_NoSamples if the track finishes parsing with no samples. (WebKit::MediaSampleCursor::getMediaSample const): Changed to call getSampleMap. (WebKit::MediaSampleCursor::getTiming const): Added to get timing info. (WebKit::MediaSampleCursor::copyProperty): Added logging. (WebKit::MediaSampleCursor::stepInDecodeOrderAndReportStepsTaken): Changed to call the new version of stepInOrderedMap. (WebKit::MediaSampleCursor::stepInPresentationOrderAndReportStepsTaken): Ditto. (WebKit::MediaSampleCursor::stepByDecodeTime): Changed to call stepInPresentationTime. (WebKit::MediaSampleCursor::stepByPresentationTime): Ditto. (WebKit::MediaSampleCursor::compareInDecodeOrder const): Changed to call getTiming. (WebKit::MediaSampleCursor::getSampleTiming const): Ditto. (WebKit::MediaSampleCursor::getPlayableHorizon const): Implemented by taking the difference between the last sample's end time and the cursor's presentation time. (WebKit::MediaSampleCursor::logChannel const): Added. (WebKit::makeIterator): Deleted. (WebKit::makeTime): Deleted. (WebKit::MediaSampleCursor::createAtDecodedSample): Deleted. * Shared/mac/MediaFormatReader/MediaSampleCursor.h: (WebKit::MediaSampleCursor::logger const): Configured logging. (WebKit::MediaSampleCursor::logClassName const): Ditto. (WebKit::MediaSampleCursor::logIdentifier const): Ditto. * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: (WebKit::MediaTrackReader::mediaTypeString const): Ditto. (WebKit::MediaTrackReader::nextSampleCursorLogIdentifier const): Ditto. * Shared/mac/MediaFormatReader/MediaTrackReader.h: 2021-02-01 Alan Coon Cherry-pick r271916. rdar://problem/73834276 IPC::Decoder constructor should mark the Decoder as invalid if header decoding fails https://bugs.webkit.org/show_bug.cgi?id=220990 Reviewed by Darin Adler. Mark the decoder as invalid if any of the decode operations fail, not just the first one. * Platform/IPC/Decoder.cpp: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271916 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-26 Brent Fulgham IPC::Decoder constructor should mark the Decoder as invalid if header decoding fails https://bugs.webkit.org/show_bug.cgi?id=220990 Reviewed by Darin Adler. Mark the decoder as invalid if any of the decode operations fail, not just the first one. * Platform/IPC/Decoder.cpp: 2021-01-29 Alan Coon Cherry-pick r271503. rdar://problem/73473503 Add a quirk to disable "return to element fullscreen from picture-in-picture" for some sites https://bugs.webkit.org/show_bug.cgi?id=220606 Reviewed by Eric Carlson. Source/WebCore: For iPads, we add the support of "return to element fullscreen from picture-in-picture" in r265562. Unfortunately, some sites do not set element's styles properly when a video returns to fullscreen from picture-in-picture. This patch adds a quirk to disable the feature for those sites for now. * page/Quirks.cpp: (WebCore::Quirks::blocksReturnToFullscreenFromPictureInPictureQuirk const): * page/Quirks.h: * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::didStartPictureInPicture): * platform/ios/WebVideoFullscreenControllerAVKit.mm: (VideoFullscreenControllerContext::setUpFullscreen): Source/WebKit: * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): * UIProcess/WebFullScreenManagerProxy.cpp: (WebKit::WebFullScreenManagerProxy::blocksReturnToFullscreenFromPictureInPicture const): (WebKit::WebFullScreenManagerProxy::enterFullScreen): * UIProcess/WebFullScreenManagerProxy.h: * UIProcess/WebFullScreenManagerProxy.messages.in: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): (-[WKFullScreenWindowController didEnterPictureInPicture]): * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::enterFullScreenForElement): * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp: (WebKit::InjectedBundlePageFullScreenClient::enterFullScreenForElement): * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271503 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-14 Peng Liu Add a quirk to disable "return to element fullscreen from picture-in-picture" for some sites https://bugs.webkit.org/show_bug.cgi?id=220606 Reviewed by Eric Carlson. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): * UIProcess/WebFullScreenManagerProxy.cpp: (WebKit::WebFullScreenManagerProxy::blocksReturnToFullscreenFromPictureInPicture const): (WebKit::WebFullScreenManagerProxy::enterFullScreen): * UIProcess/WebFullScreenManagerProxy.h: * UIProcess/WebFullScreenManagerProxy.messages.in: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): (-[WKFullScreenWindowController didEnterPictureInPicture]): * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::enterFullScreenForElement): * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp: (WebKit::InjectedBundlePageFullScreenClient::enterFullScreenForElement): * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): 2021-01-29 Alan Coon Cherry-pick r271459. rdar://problem/73473665 [macOS] "Correct Spelling Automatically" menu items are inconsistent when autocorrect="off" https://bugs.webkit.org/show_bug.cgi?id=220598 Reviewed by Tim Horton. Source/WebCore: Disable the context menu item to toggle automatic spelling correction, as well as the menu bar item to toggle automatic spelling correction, in the case where the autocorrect attribute is set to "off". See below for more details. Tests: editing/mac/spelling/disable-automatic-spelling-correction-context-menu-item.html DisableAutomaticSpellingCorrection.AutocorrectAttribute * editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::canEnableAutomaticSpellingCorrection const): Factor out logic for checking the `autocorrect` attribute into a separate helper function; this is used to determine whether or not we should enable both the context menu item and menu item in the menu bar. (WebCore::AlternativeTextController::isAutomaticSpellingCorrectionEnabled): * editing/AlternativeTextController.h: (WebCore::AlternativeTextController::UNLESS_ENABLED): * editing/Editor.cpp: (WebCore::Editor::canEnableAutomaticSpellingCorrection const): * editing/Editor.h: * page/ContextMenuController.cpp: (WebCore::ContextMenuController::checkOrEnableIfNeeded const): Source/WebKit: Plumb the new `canEnableAutomaticSpellingCorrection` flag through `EditorState` to the UI process, where we can consult it when validating user interface items (namely, the "Correct Spelling Automatically" menu item, which corresponds to the `-toggleAutomaticSpellingCorrection:` selector). * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): (WebKit::operator<<): * Shared/EditorState.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::validateUserInterfaceItem): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::getPlatformEditorState const): Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/mac/DisableAutomaticSpellingCorrection.mm: Added. Add a new API test to verify that the `NSMenuItem` for toggling automatic spelling correction is invalid when editing inside a form control with autocorrect="off". * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::getMenuItemEnabledCallback): Add the readonly `enabled` JS property on context menu items. See the new layout test, editing/mac/spelling/disable-automatic-spelling-correction-context-menu-item.html, for more information. LayoutTests: Add a new API test to verify that the context menu item to toggle "Correct Spelling Automatically" is disabled when autocorrect="off". * editing/mac/spelling/disable-automatic-spelling-correction-context-menu-item-expected.txt: Added. * editing/mac/spelling/disable-automatic-spelling-correction-context-menu-item.html: Added. * platform/mac-wk1/TestExpectations: Disable the test in DumpRenderTree, due to lack of support for context menu testing in WebKit1. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271459 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-13 Wenson Hsieh [macOS] "Correct Spelling Automatically" menu items are inconsistent when autocorrect="off" https://bugs.webkit.org/show_bug.cgi?id=220598 Reviewed by Tim Horton. Plumb the new `canEnableAutomaticSpellingCorrection` flag through `EditorState` to the UI process, where we can consult it when validating user interface items (namely, the "Correct Spelling Automatically" menu item, which corresponds to the `-toggleAutomaticSpellingCorrection:` selector). * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): (WebKit::operator<<): * Shared/EditorState.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::validateUserInterfaceItem): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::getPlatformEditorState const): 2021-01-29 Alan Coon Cherry-pick r271414. rdar://problem/73473727 REGRESSION (r265044): [macOS] Safari autocorrects text when typing in login field on amazon.com https://bugs.webkit.org/show_bug.cgi?id=220556 Reviewed by Darin Adler. Source/WebCore: Add an internal testing hook to ask an input element whether it has disabled spellchecking (except for text replacement). * testing/Internals.cpp: (WebCore::Internals::isSpellcheckDisabledExceptTextReplacement const): * testing/Internals.h: * testing/Internals.idl: Source/WebKit: Restores the implementation of `WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled`, which was removed in r265044, with the reasoning that the code was unused. However, Safari still uses this SPI on macOS to prevent automatic spelling correction from triggering when editing form fields that are AutoFillable. Test: WebKit.DisableSpellcheck * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: (WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled): Tools: Add an API test that uses WebKit C API (`WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled`) to disable or enable spellchecking on input elements. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/DisableSpellcheck.mm: Added. * TestWebKitAPI/Tests/WebKitCocoa/DisableSpellcheckPlugIn.mm: Added. (-[DisableSpellcheckPlugIn webProcessPlugIn:didCreateBrowserContextController:]): (-[DisableSpellcheckPlugIn webProcessPlugInBrowserContextController:didClearWindowObjectForFrame:inScriptWorld:]): (-[DisableSpellcheckPlugIn webProcessPlugInBrowserContextController:didFinishLoadForFrame:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271414 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-12 Wenson Hsieh REGRESSION (r265044): [macOS] Safari autocorrects text when typing in login field on amazon.com https://bugs.webkit.org/show_bug.cgi?id=220556 Reviewed by Darin Adler. Restores the implementation of `WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled`, which was removed in r265044, with the reasoning that the code was unused. However, Safari still uses this SPI on macOS to prevent automatic spelling correction from triggering when editing form fields that are AutoFillable. Test: WebKit.DisableSpellcheck * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: (WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled): 2021-01-29 Alan Coon Cherry-pick r271384. rdar://problem/73473494 Crash in pageDidComputePageRects() https://bugs.webkit.org/show_bug.cgi?id=220518 Reviewed by Ryosuke Niwa. Make _printOperation a weak pointer and check it before use. Since WKPrintingView is ref counted, a reference could still exist even if _printOperation is nil. Remove the comment as it is not a justification for a raw pointer. * UIProcess/mac/WKPrintingView.h: * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): (-[WKPrintingView _firstPrintedPageNumber]): (-[WKPrintingView _lastPrintedPageNumber]): (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]): (pageDidComputePageRects): (-[WKPrintingView _askPageToComputePageRects]): (-[WKPrintingView knowsPageRange:]): (-[WKPrintingView _drawPreview:]): (-[WKPrintingView drawRect:]): (-[WKPrintingView _drawPageBorderWithSizeOnMainThread:]): (-[WKPrintingView drawPageBorderWithSize:]): (-[WKPrintingView rectForPage:]): (-[WKPrintingView locationOfPrintRect:]): (-[WKPrintingView beginDocument]): (-[WKPrintingView endDocument]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271384 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-11 Kate Cheney Crash in pageDidComputePageRects() https://bugs.webkit.org/show_bug.cgi?id=220518 Reviewed by Ryosuke Niwa. Make _printOperation a weak pointer and check it before use. Since WKPrintingView is ref counted, a reference could still exist even if _printOperation is nil. Remove the comment as it is not a justification for a raw pointer. * UIProcess/mac/WKPrintingView.h: * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): (-[WKPrintingView _firstPrintedPageNumber]): (-[WKPrintingView _lastPrintedPageNumber]): (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]): (pageDidComputePageRects): (-[WKPrintingView _askPageToComputePageRects]): (-[WKPrintingView knowsPageRange:]): (-[WKPrintingView _drawPreview:]): (-[WKPrintingView drawRect:]): (-[WKPrintingView _drawPageBorderWithSizeOnMainThread:]): (-[WKPrintingView drawPageBorderWithSize:]): (-[WKPrintingView rectForPage:]): (-[WKPrintingView locationOfPrintRect:]): (-[WKPrintingView beginDocument]): (-[WKPrintingView endDocument]): 2021-01-29 Alan Coon Cherry-pick r271374. rdar://problem/73477142 Web Inspector: add nullptr check for WebInspectorProxy::m_extensionsController https://bugs.webkit.org/show_bug.cgi?id=220485 Reviewed by Devin Rousso. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::frontendLoaded): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271374 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-11 BJ Burg Web Inspector: add nullptr check for WebInspectorProxy::m_extensionsController https://bugs.webkit.org/show_bug.cgi?id=220485 Reviewed by Devin Rousso. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::frontendLoaded): 2021-01-29 Alan Coon Cherry-pick r271369. rdar://problem/73473654 WebProcessPool::establishWorkerContextConnectionToNetworkProcess should make sure to remove the selected process from the cache https://bugs.webkit.org/show_bug.cgi?id=220503 Reviewed by Darin Adler. Source/WebKit: In case we reuse an existing web process, make sure to remove it from web process cache. Covered by API test. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): (WebKit::WebProcessCache::addProcess): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): Tools: * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271369 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-11 Youenn Fablet WebProcessPool::establishWorkerContextConnectionToNetworkProcess should make sure to remove the selected process from the cache https://bugs.webkit.org/show_bug.cgi?id=220503 Reviewed by Darin Adler. In case we reuse an existing web process, make sure to remove it from web process cache. Covered by API test. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): (WebKit::WebProcessCache::addProcess): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): 2021-01-29 Alan Coon Cherry-pick r271619. rdar://problem/73461349 REGRESSION(r269865) Mail's context menu when right clicking on a link does not contain correct entries https://bugs.webkit.org/show_bug.cgi?id=220745 Patch by Alex Christensen on 2021-01-19 Reviewed by Tim Horton. Source/WebCore: r269865 broke binary compatibility by changing the values of many WebCore::ContextMenuAction values and many WKContextMenuItemTag values, and not in the same way. In WebContextMenuProxyMac::getContextMenuItem we call NSMenuItem setTag: with the value from WebCore::ContextMenuAction and mail compares those values with values from WKContextMenuItemTag in our C API. This isn't ideal, but we need to retain binary compatibility. * platform/ContextMenuItem.h: Source/WebKit: * Shared/API/c/WKContextMenuItem.cpp: Add a bunch of static_asserts to verify that our binary values correspond to each other and don't change. * Shared/API/c/WKContextMenuItemTypes.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271619 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-19 Alex Christensen REGRESSION(r269865) Mail's context menu when right clicking on a link does not contain correct entries https://bugs.webkit.org/show_bug.cgi?id=220745 Reviewed by Tim Horton. * Shared/API/c/WKContextMenuItem.cpp: Add a bunch of static_asserts to verify that our binary values correspond to each other and don't change. * Shared/API/c/WKContextMenuItemTypes.h: 2021-01-28 Alan Coon Cherry-pick r271873. rdar://problem/73722521 REGRESSION (r270874): Some React Native apps are reported broken on iOS https://bugs.webkit.org/show_bug.cgi?id=220809 Reviewed by Saam Barati. Source/JavaScriptCore: r270874 fixed for/in shadowing issue by introducing an invariant: a property returned by getOwn*PropertyNames() in DontEnumPropertiesMode::Exclude should be reported as [[Enumerable]] by getOwnPropertySlot(). Otherwise, for/in skips the property, which causes RN apps to break. Since there is no way to enforce this invariant for opaque API objects like JSCallbackObject, this change skips [[Enumerable]] check for them by introducing GetOwnPropertySlotMayBeWrongAboutDontEnum out of line type info flag. Also, this patch reverts JSCallbackObject::getOwnPropertySlot() changes of r270874 that are no longer necessary and observable (via Object.getOwnPropertyDescriptor). * API/JSCallbackObject.h: * API/JSCallbackObjectFunctions.h: (JSC::JSCallbackObject::getOwnPropertySlot): * API/tests/testapiScripts/testapi.js: * runtime/JSObject.cpp: (JSC::JSObject::hasEnumerableProperty const): * runtime/JSTypeInfo.h: (JSC::TypeInfo::getOwnPropertySlotMayBeWrongAboutDontEnum const): Source/WebCore: * bridge/runtime_object.h: Source/WebKit: * WebProcess/Plugins/Netscape/JSNPObject.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271873 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-25 Alexey Shvayka REGRESSION (r270874): Some React Native apps are reported broken on iOS https://bugs.webkit.org/show_bug.cgi?id=220809 Reviewed by Saam Barati. * WebProcess/Plugins/Netscape/JSNPObject.h: 2021-01-27 Alan Coon Cherry-pick r271710. rdar://problem/73678158 [macOS] The development WebContent XPC service crashes under WebKit::AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=220777 Reviewed by Brent Fulgham. This happens because the development XPC service does not have the required private entitlement to enable message filtering in the sandbox, and therefore fails to apply the sandbox. The existing runtime switching to enable message filtering based on the presence of the entitlement is not working correctly. The 'if' clause checking the sandbox parameter in the sandbox cannot be nested inside an 'allow' clause, it appears. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271710 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-21 Per Arne Vollan [macOS] The development WebContent XPC service crashes under WebKit::AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=220777 Reviewed by Brent Fulgham. This happens because the development XPC service does not have the required private entitlement to enable message filtering in the sandbox, and therefore fails to apply the sandbox. The existing runtime switching to enable message filtering based on the presence of the entitlement is not working correctly. The 'if' clause checking the sandbox parameter in the sandbox cannot be nested inside an 'allow' clause, it appears. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2021-01-25 Alan Coon Cherry-pick r271753. rdar://problem/73586655 [WebAuthn] Should only check default browsers for the Modern WebAuthn https://bugs.webkit.org/show_bug.cgi?id=220840 Reviewed by Brent Fulgham. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271753 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-22 Jiewen Tan [WebAuthn] Should only check default browsers for the Modern WebAuthn https://bugs.webkit.org/show_bug.cgi?id=220840 Reviewed by Brent Fulgham. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): 2021-01-25 Alan Coon Cherry-pick r271613. rdar://problem/73477407 [WebAuthn] Polish the new WebAuthn UI https://bugs.webkit.org/show_bug.cgi?id=220617 Reviewed by Brent Fulgham. This patch does the following few things: 1. It updates the way how the PIN error for security keys is handled. 2. It uses the credential name to identify a credential that passed to the UI instead of the login choice object as it turns out that the UI won't return the same object at all. 3. It delays to show the UI if the platform authenticator is involved given the platform authenticator might not contain the requested credentials. If not, we should either show an error or just requesting the security key ones. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: (NS_ERROR_ENUM): * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::didSelectAssertionResponse): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271613 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-19 Jiewen Tan [WebAuthn] Polish the new WebAuthn UI https://bugs.webkit.org/show_bug.cgi?id=220617 Reviewed by Brent Fulgham. This patch does the following few things: 1. It updates the way how the PIN error for security keys is handled. 2. It uses the credential name to identify a credential that passed to the UI instead of the login choice object as it turns out that the UI won't return the same object at all. 3. It delays to show the UI if the platform authenticator is involved given the platform authenticator might not contain the requested credentials. If not, we should either show an error or just requesting the security key ones. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: (NS_ERROR_ENUM): * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::didSelectAssertionResponse): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): 2021-01-25 Alan Coon Cherry-pick r271537. rdar://problem/73478698 REGRESSION(r267763) Uploading zipped directories does not work on iOS https://bugs.webkit.org/show_bug.cgi?id=220666 Patch by Alex Christensen on 2021-01-15 Reviewed by Geoffrey Garen. r267763 removed indexedDatabaseTempBlobDirectoryExtensionHandle with no replacement, which used to give the network process read/write access to /tmp inside the parent process's container. This seems to have been unused for IndexedDB, but it was used by createTemporaryZipArchive when uploading directories, such as Pages, Numbers, and Keynote documents. Unfortunately the unit test added by r248139 is macOS-only because WKOpenPanelParameters is only available on macOS and it would require a large and risky amount of refactoring to add SPI on iOS to test this because iOS uses WKFileUploadPanel instead. I did manually verify that the bug is fixed using my phone, though. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271537 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-15 Alex Christensen REGRESSION(r267763) Uploading zipped directories does not work on iOS https://bugs.webkit.org/show_bug.cgi?id=220666 Reviewed by Geoffrey Garen. r267763 removed indexedDatabaseTempBlobDirectoryExtensionHandle with no replacement, which used to give the network process read/write access to /tmp inside the parent process's container. This seems to have been unused for IndexedDB, but it was used by createTemporaryZipArchive when uploading directories, such as Pages, Numbers, and Keynote documents. Unfortunately the unit test added by r248139 is macOS-only because WKOpenPanelParameters is only available on macOS and it would require a large and risky amount of refactoring to add SPI on iOS to test this because iOS uses WKFileUploadPanel instead. I did manually verify that the bug is fixed using my phone, though. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess): 2021-01-25 Alan Coon Cherry-pick r271486. rdar://problem/73478688 Use callOnMainRunLoop in MediaPermissionUtilities https://bugs.webkit.org/show_bug.cgi?id=220616 Reviewed by Chris Dumez. This ensures that we are in main thread and not in web thread. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::requestAVCaptureAccessForType): (WebKit::requestSpeechRecognitionAccess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271486 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-14 Youenn Fablet Use callOnMainRunLoop in MediaPermissionUtilities https://bugs.webkit.org/show_bug.cgi?id=220616 Reviewed by Chris Dumez. This ensures that we are in main thread and not in web thread. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::requestAVCaptureAccessForType): (WebKit::requestSpeechRecognitionAccess): 2021-01-25 Alan Coon Cherry-pick r271473. rdar://problem/73478401 PCM: Output logs by default, including to Web Inspector https://bugs.webkit.org/show_bug.cgi?id=220596 Reviewed by Brent Fulgham. This change turns on PCM output to Web Inspector and logs Source/WebCore: by default. In the case of WebCore::PrivateClickMeasurement, this means we no longer need the debugModeEnabled() convenience function. * loader/PrivateClickMeasurement.cpp: (WebCore::PrivateClickMeasurement::parseAttributionRequest): (WebCore::PrivateClickMeasurement::debugModeEnabled): Deleted. * loader/PrivateClickMeasurement.h: Source/WebKit: by default. In some of the cases, the syslog output was deleted since it doesn't make sense to log those messages now that we have output in Web Inspector. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::handleAttribution): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271473 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-13 John Wilander PCM: Output logs by default, including to Web Inspector https://bugs.webkit.org/show_bug.cgi?id=220596 Reviewed by Brent Fulgham. This change turns on PCM output to Web Inspector and logs by default. In some of the cases, the syslog output was deleted since it doesn't make sense to log those messages now that we have output in Web Inspector. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::handleAttribution): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): 2021-01-25 Alan Coon Cherry-pick r271471. rdar://problem/73477068 Source/WebCore: [HANG] 496ms to 1360ms in WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices() https://bugs.webkit.org/show_bug.cgi?id=220471 Reviewed by Youenn Fablet. Refactor RealtimeMediaSourceCenter::getMediaStreamDevices() to take a completion handler, rather than synchronously return a Vector of CaptureDevices. This also requires all CaptureDeviceManager subclasses to support taking a completion handler themselves. By default, all CaptureDeviceManagers will support the CompletionHandler path by just synchronously calling the completion handler with the existing synchronous method. But for AVAudioSessionCaptureDeviceManager, override that default implementation by activating the AVAudioSession on a background thread, and querying that session's inputs on a background thread as well. * platform/mediastream/CaptureDeviceManager.h: * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): * platform/mediastream/RealtimeMediaSourceCenter.h: * platform/mediastream/RealtimeMediaSourceFactory.h: (WebCore::AudioCaptureFactory::getSpeakerDevices const): * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h: * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm: (WebCore::AVAudioSessionCaptureDeviceManager::audioSessionDeviceWithUID): (WebCore::AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices): (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): (WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): (WebCore::AVAudioSessionCaptureDeviceManager::activateAudioSession): (WebCore::AVAudioSessionCaptureDeviceManager::retrieveAudioSessionCaptureDevices const): (WebCore::AVAudioSessionCaptureDeviceManager::setAudioCaptureDevices): (WebCore::AVAudioSessionCaptureDeviceManager::audioSessionCaptureDevices): Deleted. Source/WebKit: [HANG] 496ms to 1360ms in WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices() https://bugs.webkit.org/show_bug.cgi?id=220471 Reviewed by Youenn Fablet. Use the completion-handler version of RealtimeMediaSourceCenter::getMediaStreamDevices(). * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::updateCaptureDevices): (WebKit::UserMediaProcessManager::beginMonitoringCaptureDevices): * UIProcess/UserMediaProcessManager.h: LayoutTests: [Cocoa] Support key rotation with HLS-backed encrypted media streams https://bugs.webkit.org/show_bug.cgi?id=220493 Reviewed by Youenn Fablet. Fix a broken layout test; the test enumerates devices, then uses the deviceIds returned to generate constraints for a call to getUserMedia(). However, it assumes all devices will either be of kind 'audioinput' or 'videoinput'. If an 'audiooutput' device is returned (as the MockRealtimeMediaSourceCenter does), then the test turns that into a video capture constraint, which fails. * fast/mediastream/get-user-media-device-id.html: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271471 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-13 Jer Noble [HANG] 496ms to 1360ms in WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices() https://bugs.webkit.org/show_bug.cgi?id=220471 Reviewed by Youenn Fablet. Use the completion-handler version of RealtimeMediaSourceCenter::getMediaStreamDevices(). * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::updateCaptureDevices): (WebKit::UserMediaProcessManager::beginMonitoringCaptureDevices): * UIProcess/UserMediaProcessManager.h: 2021-01-25 Alan Coon Cherry-pick r271467. rdar://problem/73477045 Crash at SOAuthorizationSession::dismissViewController https://bugs.webkit.org/show_bug.cgi?id=220482 Reviewed by Darin Adler. A crash report suggests that SOAuthorizationSession::dismissViewController could crash at evaluating m_page. This could only happen if the SOAuthorizationSession object is freed. The stack trace starts with callbacks from NSNotificationCenter, which capture a RefPtr of the SOAuthorizationSession object and should guarantee the lifetime of the object. So it contradicts the crash report. One of the possible explanations is that the RefPtr is somehow over-released within NSNotificationCenter since it's not thread-safe. To fix that, the RefPtr can be made thread-safe. No tests. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::dismissViewController): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271467 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-13 Jiewen Tan Crash at SOAuthorizationSession::dismissViewController https://bugs.webkit.org/show_bug.cgi?id=220482 Reviewed by Darin Adler. A crash report suggests that SOAuthorizationSession::dismissViewController could crash at evaluating m_page. This could only happen if the SOAuthorizationSession object is freed. The stack trace starts with callbacks from NSNotificationCenter, which capture a RefPtr of the SOAuthorizationSession object and should guarantee the lifetime of the object. So it contradicts the crash report. One of the possible explanations is that the RefPtr is somehow over-released within NSNotificationCenter since it's not thread-safe. To fix that, the RefPtr can be made thread-safe. No tests. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::dismissViewController): 2021-01-25 Alan Coon Cherry-pick r271417. rdar://problem/73376369 [macOS] Reset user directory suffix before getting sandbox directory https://bugs.webkit.org/show_bug.cgi?id=220358 Reviewed by Alexey Proskuryakov. Source/WebCore/PAL: Declare functions to get and set user directory suffix. * pal/spi/cocoa/CoreServicesSPI.h: Source/WebKit: Reset the user directory suffix before getting the sandbox data vault directory with confstr. We do not want to include the user directory suffix, since the sandbox data vault will then end up inside the host process' cache folder, which is undesirable. Also, creating the data vault directory with confstr can fail under some circumstances if the user directory suffix is not empty. This patch also changes how we next set the user directory suffix for the process. Instead of setting the environment variable DIRHELPER_USER_DIR_SUFFIX, we can use the SPI _set_user_dir_suffix. The behavior should be identical, but I believe it is better to use SPI for this. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): (WebKit::AuxiliaryProcess::initializeSandbox): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271417 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-12 Per Arne Vollan [macOS] Reset user directory suffix before getting sandbox directory https://bugs.webkit.org/show_bug.cgi?id=220358 Reviewed by Alexey Proskuryakov. Reset the user directory suffix before getting the sandbox data vault directory with confstr. We do not want to include the user directory suffix, since the sandbox data vault will then end up inside the host process' cache folder, which is undesirable. Also, creating the data vault directory with confstr can fail under some circumstances if the user directory suffix is not empty. This patch also changes how we next set the user directory suffix for the process. Instead of setting the environment variable DIRHELPER_USER_DIR_SUFFIX, we can use the SPI _set_user_dir_suffix. The behavior should be identical, but I believe it is better to use SPI for this. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): (WebKit::AuxiliaryProcess::initializeSandbox): 2021-01-25 Alan Coon Cherry-pick r271543. rdar://problem/73469576 [iOS] Emoji keyboard covers text field on twitter.com/messages https://bugs.webkit.org/show_bug.cgi?id=220664 Reviewed by Devin Rousso. Source/WebKit: After iOS 14, the emoji software keyboard layout now includes a search field that can be used to filter for specific emojis. This slightly increases the overall height of the software keyboard when the emoji keyplane is active; in turn, this means that if the selection or caret is positioned right above the top of the software keyboard when the normal (alphabetic) keyplane is active, switching to the emoji keyplane will cause the keyboard to overlap the selection, making it difficult to see inserted text. To address this, add a mechanism to detect when a change in the bounds of the software keyboard causes a visible selection or caret rect to become overlapped, and react by scrolling to keep the selection visible. This has the effect of fixing this bug by scrolling to reveal the text field after switching to the emoji keyboard, but it also has the effect of scrolling to keep the selection visible after detaching a connected hardware keyboard, in the case where it would've otherwise been overlapped by the (much taller) software keyboard that appears. Test: editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _selectionRectIsFullyVisibleAndNonEmpty]): Add an internal helper to check whether the selection bounds are fully visible. (-[WKWebView _scrollToRevealSelectionIfNeeded]): (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]): In the case where changing input view bounds causes a previously visible selection to become overlapped, call `-_scrollToRevealSelectionIfNeeded` to make the selection visible again. (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): (-[WKContentView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted. Drive-by fix: remove the unused `insideFixed:` parameter from this adjacent method. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView rectToRevealWhenZoomingToFocusedElement]): (-[WKContentView _zoomToRevealFocusedElement]): (rectToRevealWhenZoomingToFocusedElement): Deleted. Pull this into the `-rectToRevealWhenZoomingToFocusedElement` internal helper method instead, and use the new `selectionBoundingRectInRootViewCoordinates` method below. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::selectionBoundingRectInRootViewCoordinates const): Pull out code to compute the selection bounding rect (for both ranged and caret selections) into a method on `WebPageProxy`, so that it can be used in `WKContentView` and `WKWebView`. LayoutTests: Add a test to verify that after disconnecting a hardware keyboard and showing the software keyboard, we scroll up to reveal the caret in a focused text field. * editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard-expected.txt: Added. * editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271543 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-15 Wenson Hsieh [iOS] Emoji keyboard covers text field on twitter.com/messages https://bugs.webkit.org/show_bug.cgi?id=220664 Reviewed by Devin Rousso. After iOS 14, the emoji software keyboard layout now includes a search field that can be used to filter for specific emojis. This slightly increases the overall height of the software keyboard when the emoji keyplane is active; in turn, this means that if the selection or caret is positioned right above the top of the software keyboard when the normal (alphabetic) keyplane is active, switching to the emoji keyplane will cause the keyboard to overlap the selection, making it difficult to see inserted text. To address this, add a mechanism to detect when a change in the bounds of the software keyboard causes a visible selection or caret rect to become overlapped, and react by scrolling to keep the selection visible. This has the effect of fixing this bug by scrolling to reveal the text field after switching to the emoji keyboard, but it also has the effect of scrolling to keep the selection visible after detaching a connected hardware keyboard, in the case where it would've otherwise been overlapped by the (much taller) software keyboard that appears. Test: editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _selectionRectIsFullyVisibleAndNonEmpty]): Add an internal helper to check whether the selection bounds are fully visible. (-[WKWebView _scrollToRevealSelectionIfNeeded]): (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]): In the case where changing input view bounds causes a previously visible selection to become overlapped, call `-_scrollToRevealSelectionIfNeeded` to make the selection visible again. (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): (-[WKContentView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted. Drive-by fix: remove the unused `insideFixed:` parameter from this adjacent method. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView rectToRevealWhenZoomingToFocusedElement]): (-[WKContentView _zoomToRevealFocusedElement]): (rectToRevealWhenZoomingToFocusedElement): Deleted. Pull this into the `-rectToRevealWhenZoomingToFocusedElement` internal helper method instead, and use the new `selectionBoundingRectInRootViewCoordinates` method below. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::selectionBoundingRectInRootViewCoordinates const): Pull out code to compute the selection bounding rect (for both ranged and caret selections) into a method on `WebPageProxy`, so that it can be used in `WKContentView` and `WKWebView`. 2021-01-25 Alan Coon Cherry-pick r271497. rdar://problem/73469623 Exceptions thrown when invoking a instead of popover) for two reasons: - we want to maximize compatibility, so they should behave exactly as they do on the only platform they're tested on - other frameworks (mostly UIKit) enforce the use of iPhone UI in iPhone-idiom apps, even on macOS * Shared/UserInterfaceIdiom.mm: (WebKit::currentUserInterfaceIdiomIsPadOrMac): (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac): (WebKit::updateCurrentUserInterfaceIdiom): (WebKit::userInterfaceIdiomIsPad): Deleted. Simplify our UIUserInterfaceIdiom-caching code. currentUserInterfaceIdiomIsPadOrMac now does what it says on the tin, globally; previously on macOS it said YES for iPhone-idiom apps, but now it says NO, like you would expect. Use UIDevice everywhere instead of the soft-deprecated UICurrentUserInterfaceIdiomIsPad, both because it is soft-deprecated, and because it lets us elide the static helper. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271497 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-14 Tim Horton Exceptions thrown when invoking a instead of popover) for two reasons: - we want to maximize compatibility, so they should behave exactly as they do on the only platform they're tested on - other frameworks (mostly UIKit) enforce the use of iPhone UI in iPhone-idiom apps, even on macOS * Shared/UserInterfaceIdiom.mm: (WebKit::currentUserInterfaceIdiomIsPadOrMac): (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac): (WebKit::updateCurrentUserInterfaceIdiom): (WebKit::userInterfaceIdiomIsPad): Deleted. Simplify our UIUserInterfaceIdiom-caching code. currentUserInterfaceIdiomIsPadOrMac now does what it says on the tin, globally; previously on macOS it said YES for iPhone-idiom apps, but now it says NO, like you would expect. Use UIDevice everywhere instead of the soft-deprecated UICurrentUserInterfaceIdiomIsPad, both because it is soft-deprecated, and because it lets us elide the static helper. 2021-01-25 Alan Coon Cherry-pick r271479. rdar://problem/73469631 REGRESSION (r266634): Messages crashes sometimes while scrolling around and playing YouTube videos https://bugs.webkit.org/show_bug.cgi?id=220602 Reviewed by Wenson Hsieh. Source/WebKit: No new tests; we are unable to API test video full-screen because of the lack of UIApp; I have written a stand-alone test app that can reliably reproduce before this patch and not afterwards. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::scheduleActivityStateUpdate): We can't call dispatchActivityStateChange directly underneath a post-commit callback, because it has side-effects (like un-parenting the full-screen window) that may result in other frameworks (e.g. UIKit) trying to install commit handlers for the same phase, which is not allowed. To fix this, add a dispatch_async; we _only_ care that the activity state change doesn't apply until after the active commit is complete. Tools: * TestWebKitAPI/PlatformWebView.h: Mark PlatformWebView noncopyable, since it is effectively noncopyable (at least, the macOS implementation will overrelease the view if you copy it, whoops). * TestWebKitAPI/Tests/WebKit/DeferredViewInWindowStateChange.mm: (TestWebKitAPI::TEST): Add a matching dispatch_async, or this test fails. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271479 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-13 Tim Horton REGRESSION (r266634): Messages crashes sometimes while scrolling around and playing YouTube videos https://bugs.webkit.org/show_bug.cgi?id=220602 Reviewed by Wenson Hsieh. No new tests; we are unable to API test video full-screen because of the lack of UIApp; I have written a stand-alone test app that can reliably reproduce before this patch and not afterwards. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::scheduleActivityStateUpdate): We can't call dispatchActivityStateChange directly underneath a post-commit callback, because it has side-effects (like un-parenting the full-screen window) that may result in other frameworks (e.g. UIKit) trying to install commit handlers for the same phase, which is not allowed. To fix this, add a dispatch_async; we _only_ care that the activity state change doesn't apply until after the active commit is complete. 2021-01-25 Alan Coon Cherry-pick r271469. rdar://problem/73468174 [Cocoa] Network extension sandbox extensions are sometimes issued too late https://bugs.webkit.org/show_bug.cgi?id=220525 Reviewed by Brent Fulgham. Currently, Network extension sandbox extensions are sent to the WebContent process as part of the load parameters, but this is too late in some cases. In these cases, the extensions can be sent along with the DidReceivePolicyDecision message. * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * UIProcess/WebPageProxy.cpp: (WebKit::createNetworkExtensionsSandboxExtensions): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271469 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-13 Per Arne Vollan [Cocoa] Network extension sandbox extensions are sometimes issued too late https://bugs.webkit.org/show_bug.cgi?id=220525 Reviewed by Brent Fulgham. Currently, Network extension sandbox extensions are sent to the WebContent process as part of the load parameters, but this is too late in some cases. In these cases, the extensions can be sent along with the DidReceivePolicyDecision message. * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * UIProcess/WebPageProxy.cpp: (WebKit::createNetworkExtensionsSandboxExtensions): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-25 Alan Coon Cherry-pick r271405. rdar://problem/73466993 [Cocoa] Support key rotation with HLS-backed encrypted media streams https://bugs.webkit.org/show_bug.cgi?id=220493 Reviewed by Eric Carlson. Source/WebCore: Support key rotation through AVContentKeySession by explicitly handling unexpected key requests submitted through the new -contentKeySession:didProvideContentKeyRequests:forInitializationData:. Rotation was previously handled in the delegate method -contentKeySession:didProvideContentKeyRequest, but that method is no longer called after the replacement delegate method was implemented, and that method never handled "skd://" style initialization data. Update the helper method, initTypeForRequest(), to detect "skd://" identifiers and correctly identify those sessions as "skd". Add a new helper method, initializationDataForRequest(), which will package the AVContentKeySession's identifier as initialization data. Drive-by Fix: Fixing this bug causes the default key group to update it's identifier, which causes an assert when the group in question isn't any of those associated with an existing MediaKeySession, so handle that case explicitly. Drive-by Fix 2: Sometimes, when GPUP is enabled for media, we will get spurious mediaPlayerEngineUpdated() calls which cause cdmInstanceAttached() to be called multiple times for the same player, triggering an ASSERT. If called twice with the same CDM, just return early rather than ASSERTing. * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::initTypeForRequest): (WebCore::initializationDataForRequest): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::takeUnexpectedKeyRequestForInitializationData): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequests): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::handleUnexpectedRequests): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::groupSessionIdentifierChanged): * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: (WebCore::MediaSourcePrivateAVFObjC::cdmInstanceAttached): Source/WebCore/PAL: * pal/spi/cocoa/AVFoundationSPI.h: Source/WebKit: Support handling the "unexpectedInitializationDataReceived()" client callback from within the GPUP. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/RemoteCDMInstanceProxy.cpp: (WebKit::RemoteCDMInstanceProxy::create): (WebKit::RemoteCDMInstanceProxy::RemoteCDMInstanceProxy): (WebKit::RemoteCDMInstanceProxy::~RemoteCDMInstanceProxy): (WebKit::RemoteCDMInstanceProxy::unrequestedInitializationDataReceived): * GPUProcess/media/RemoteCDMInstanceProxy.h: * GPUProcess/media/RemoteCDMProxy.cpp: (WebKit::RemoteCDMProxy::createInstance): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/RemoteCDMInstance.cpp: (WebKit::RemoteCDMInstance::RemoteCDMInstance): (WebKit::RemoteCDMInstance::~RemoteCDMInstance): (WebKit::RemoteCDMInstance::unrequestedInitializationDataReceived): * WebProcess/GPU/media/RemoteCDMInstance.h: * WebProcess/GPU/media/RemoteCDMInstance.messages.in: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271405 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-12 Jer Noble [Cocoa] Support key rotation with HLS-backed encrypted media streams https://bugs.webkit.org/show_bug.cgi?id=220493 Reviewed by Eric Carlson. Support handling the "unexpectedInitializationDataReceived()" client callback from within the GPUP. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/RemoteCDMInstanceProxy.cpp: (WebKit::RemoteCDMInstanceProxy::create): (WebKit::RemoteCDMInstanceProxy::RemoteCDMInstanceProxy): (WebKit::RemoteCDMInstanceProxy::~RemoteCDMInstanceProxy): (WebKit::RemoteCDMInstanceProxy::unrequestedInitializationDataReceived): * GPUProcess/media/RemoteCDMInstanceProxy.h: * GPUProcess/media/RemoteCDMProxy.cpp: (WebKit::RemoteCDMProxy::createInstance): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/RemoteCDMInstance.cpp: (WebKit::RemoteCDMInstance::RemoteCDMInstance): (WebKit::RemoteCDMInstance::~RemoteCDMInstance): (WebKit::RemoteCDMInstance::unrequestedInitializationDataReceived): * WebProcess/GPU/media/RemoteCDMInstance.h: * WebProcess/GPU/media/RemoteCDMInstance.messages.in: Added. 2021-01-25 Alan Coon Cherry-pick r271387. rdar://problem/73469606 Receiving two enter/exit fullscreen delegate callbacks on iPad when presenting fullscreen elements https://bugs.webkit.org/show_bug.cgi?id=218688 Reviewed by Darin Adler. Source/WebCore: On iPads, when a video enters/exits fullscreen standby, we should not call the video fullscreen delegate callbacks. * platform/ios/VideoFullscreenInterfaceAVKit.h: * platform/ios/VideoFullscreenInterfaceAVKit.mm: (VideoFullscreenInterfaceAVKit::setupFullscreen): (VideoFullscreenInterfaceAVKit::exitFullscreen): Source/WebKit: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::didExitFullscreen): (WebKit::VideoFullscreenManagerProxy::didEnterFullscreen): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271387 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-11 Peng Liu Receiving two enter/exit fullscreen delegate callbacks on iPad when presenting fullscreen elements https://bugs.webkit.org/show_bug.cgi?id=218688 Reviewed by Darin Adler. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::didExitFullscreen): (WebKit::VideoFullscreenManagerProxy::didEnterFullscreen): 2021-01-25 Alan Coon Cherry-pick r271386. rdar://problem/73426229 Double tap to select does not work if the page clears selections on tap, like grammarly.com does https://bugs.webkit.org/show_bug.cgi?id=220454 Source/WebKit: rdar://67757411 Reviewed by Wenson Hsieh. Double tap to select content did not work on grammerly.com on iPad because this is a desktop website run on a touch-based device, and there was a script running that would clear the selection on a mouseDown event. When we would send synthetic click events to the page we would first update the selection and then on completion of the tap, we would dispatch a mouseDown and mouseUp event on iOS. On Mac, we update the selection between the mouseDown and the mouseUp, so in order to bring us more in line with mac/mouse behaviors, we are now saving the information needed to update the selection when we believe we are in the middle of a potential tap, and then setting the selection between these two events. This makes for a more expected change of events, and does not let grammerly.com clear a valid selection based off of synthetic clicks. Test: fast/events/touch/ios/double-tap-on-editable-content-for-selection-with-clear-on-touch.html * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::completeSyntheticClick): (WebKit::WebPage::setSelectionRange): (WebKit::WebPage::selectTextWithGranularityAtPoint): LayoutTests: Reviewed by Wenson Hsieh. * fast/events/touch/ios/double-tap-on-editable-content-for-selection-with-clear-on-touch-expected.txt: Added. * fast/events/touch/ios/double-tap-on-editable-content-for-selection-with-clear-on-touch.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271386 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-11 Megan Gardner Double tap to select does not work if the page clears selections on tap, like grammarly.com does https://bugs.webkit.org/show_bug.cgi?id=220454 rdar://67757411 Reviewed by Wenson Hsieh. Double tap to select content did not work on grammerly.com on iPad because this is a desktop website run on a touch-based device, and there was a script running that would clear the selection on a mouseDown event. When we would send synthetic click events to the page we would first update the selection and then on completion of the tap, we would dispatch a mouseDown and mouseUp event on iOS. On Mac, we update the selection between the mouseDown and the mouseUp, so in order to bring us more in line with mac/mouse behaviors, we are now saving the information needed to update the selection when we believe we are in the middle of a potential tap, and then setting the selection between these two events. This makes for a more expected change of events, and does not let grammerly.com clear a valid selection based off of synthetic clicks. Test: fast/events/touch/ios/double-tap-on-editable-content-for-selection-with-clear-on-touch.html * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::completeSyntheticClick): (WebKit::WebPage::setSelectionRange): (WebKit::WebPage::selectTextWithGranularityAtPoint): 2021-01-14 Alan Coon Cherry-pick r271477. rdar://problem/73204264 REGRESSION(r270961): Flipgrid can no longer capture video https://bugs.webkit.org/show_bug.cgi?id=220609 Reviewed by Darin Adler. Add back line in RemoteAudio::setStorage() that was initializing m_buffer and that was dropped by mistake in the refactoring in r270961. This was causing RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable() to return early because m_buffer was not initialized. No new tests, unsure how to test this. * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271477 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-13 Chris Dumez REGRESSION(r270961): Flipgrid can no longer capture video https://bugs.webkit.org/show_bug.cgi?id=220609 Reviewed by Darin Adler. Add back line in RemoteAudio::setStorage() that was initializing m_buffer and that was dropped by mistake in the refactoring in r270961. This was causing RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable() to return early because m_buffer was not initialized. No new tests, unsure how to test this. * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): 2021-01-13 Russell Epstein Cherry-pick r271448. rdar://problem/73168438 PCM: Experimental debug mode needs to be read from defaults differently on iOS https://bugs.webkit.org/show_bug.cgi?id=220573 Reviewed by Brent Fulgham. Experimental features on iOS use the prefix "WebKitExperimental" so we need to read it that way on that platform. PCM is not supported on other platforms than macOS and iOS at this point. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271448 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-13 John Wilander PCM: Experimental debug mode needs to be read from defaults differently on iOS https://bugs.webkit.org/show_bug.cgi?id=220573 Reviewed by Brent Fulgham. Experimental features on iOS use the prefix "WebKitExperimental" so we need to read it that way on that platform. PCM is not supported on other platforms than macOS and iOS at this point. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): 2021-01-11 Kimmo Kinnunen WebKit::IPC::Encoder needs definitions of all custom enum values at the Encoder definition time https://bugs.webkit.org/show_bug.cgi?id=220410 Reviewed by Darin Adler. Change WTF::EnumTraits to have either EnumTraits::values or EnumTraits::isValidEnum(). Fixes the upcoming problem where Encoder::encode(E) function is moved from Encoder to other class, such as EncoderBase, and where we do not want to add redundant includes. See the WTF/ ChangeLog for discussiong wrt why they were needed before. * Scripts/webkit/messages.py: * Scripts/webkit/tests/MessageNames.h: (WTF::EnumTraits::isValidEnum): 2021-01-11 Carlos Garcia Campos [GTK] System font scaling not applied to 'font-size: XXXpt' https://bugs.webkit.org/show_bug.cgi?id=218450 Reviewed by Žan Doberšek. Apply the text scale factor as WebPageProxy text zoom factor, instead of changing the default font size in settings that only applies to default fonts and it was incorrectly calculated. * UIProcess/API/glib/WebKitSettings.cpp: (webKitSettingsDispose): (webKitSettingsConstructed): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewConstructed): (webkitWebViewDispose): (webkit_web_view_set_zoom_level): (webkit_web_view_get_zoom_level): 2021-01-08 Commit Queue Unreviewed, reverting r271331. https://bugs.webkit.org/show_bug.cgi?id=220487 Wasn't ready for review. Reverted changeset: "[macOS] Reset user directory suffix before getting sandbox directory" https://bugs.webkit.org/show_bug.cgi?id=220358 https://trac.webkit.org/changeset/271331 2021-01-08 Per Arne Vollan [macOS] Reset user directory suffix before getting sandbox directory https://bugs.webkit.org/show_bug.cgi?id=220358 Reviewed by Brent Fulgham. Reset user directory suffix before getting sandbox data vault directory. We do not want to include the user directory suffix, since the compiled sandbox should be shared by all WebKit processes of the same type. Also, creating the data vault directory can fail under some circumstances if the user directory suffix is not empty. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::AuxiliaryProcess::initializeSandbox): 2021-01-08 Peng Liu PlaybackSessionManager::m_clientCounts is not updated correctly when a video enters picture-in-picture from fullscreen https://bugs.webkit.org/show_bug.cgi?id=220435 Reviewed by Jer Noble. A follow-up patch to fix an assertion failure on Mac. `VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation()` should not call `removeClientForContext()` on Mac because `didCleanupFullscreen()` will do that. Fix layout test: media/element-containing-pip-video-going-into-fullscreen.html * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): 2021-01-08 Wenson Hsieh [macOS] -[WKWebView acceptsFirstMouse:] sometimes crashes in IPC::Connection::createSyncMessageEncoder https://bugs.webkit.org/show_bug.cgi?id=220469 Reviewed by Chris Dumez. When sending IPC to the web process from the UI process, it's possible for the `WebProcessProxy`'s IPC connection to be null in the case where the web process is still in the act of launching. In the case of asynchronous IPC, we handle this by queueing the IPC message on the `WebProcessProxy` in the case where the connection hasn't been created yet (refer to `AuxiliaryProcessProxy::sendMessage`). However, in the case where we're sending a sync message, we assume that the IPC connection exists in `MessageSender::sendSync`, which causes us to crash with a null dereference. To fix this, remove the debug assertion in `MessageSender::sendSync` and return a null `SendSyncResult` in the case where the connection has not been created. Test: WebKit2.AcceptsFirstMouseDuringWebProcessLaunch * Platform/IPC/MessageSender.h: 2021-01-08 Jiewen Tan [WebAuthn] Adopt new UI for the update flow https://bugs.webkit.org/show_bug.cgi?id=219713 Reviewed by Brent Fulgham. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: (NS_ERROR_ENUM): * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): 2021-01-08 Youenn Fablet Service Worker is no longer inspectable https://bugs.webkit.org/show_bug.cgi?id=220406 Reviewed by Per Arne Vollan. We were sending the sandbox extension later when enabling remote inspector. But this is not soon enough for inspecting service workers. For that reason, send the sandbox extension at process init time based on whether develop menu is on or not. Manually tested by validating that Develop Menu can list running service workers. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::shouldEnableRemoteInspector): (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded): * UIProcess/WebProcessProxy.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::enableRemoteWebInspector): 2021-01-08 Chris Lord [WPE] Enable smooth-motion and kinetic scrolling on touchpads https://bugs.webkit.org/show_bug.cgi?id=219942 Reviewed by Žan Doberšek. Interpret axis motion events with a zero value as axis stop events and send the appropriate wheel event phase. This enables kinetic scrolling when using touchpads and other smooth-scrolling devices. * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::doneWithTouchEvent): * UIProcess/API/wpe/WPEView.cpp: (WKWPE::m_backend): * UIProcess/API/wpe/WPEView.h: 2021-01-08 Youenn Fablet Make sure that if NetworkProcess clears DOMCache, it also clears service worker registrations https://bugs.webkit.org/show_bug.cgi?id=220408 Reviewed by Alex Christensen. It is expected that clearing DOM cache mandates clearing service worker registrations as service workers expect cache entries added at install time to stay. It is hard for clients to enforce this so it is best to handle it in Network Process. When DOMCache is cleared, service worker registrations will also be cleared. The reverse is not guaranteed. Covered by API test. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): 2021-01-07 Alex Christensen Use WeakHashSet instead of HashSet https://bugs.webkit.org/show_bug.cgi?id=220455 Reviewed by Geoffrey Garen. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::invalidateAndCancel): (WebKit::NetworkSession::registerNetworkDataTask): (WebKit::NetworkSession::unregisterNetworkDataTask): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::registerNetworkDataTask): Deleted. (WebKit::NetworkSession::unregisterNetworkDataTask): Deleted. * UIProcess/WebPageGroup.cpp: (WebKit::WebPageGroup::addPage): (WebKit::WebPageGroup::removePage): (WebKit::WebPageGroup::setPreferences): * UIProcess/WebPageGroup.h: * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::~WebPageProxy): * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::~WebPreferences): (WebKit::WebPreferences::addPage): (WebKit::WebPreferences::removePage): (WebKit::WebPreferences::update): (WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey): * UIProcess/WebPreferences.h: * WebProcess/Geolocation/WebGeolocationManager.cpp: (WebKit::WebGeolocationManager::registerWebPage): (WebKit::WebGeolocationManager::unregisterWebPage): (WebKit::WebGeolocationManager::setEnableHighAccuracyForPage): (WebKit::WebGeolocationManager::isUpdating const): (WebKit::WebGeolocationManager::isHighAccuracyEnabled const): * WebProcess/Geolocation/WebGeolocationManager.h: (WebKit::WebGeolocationManager::isUpdating const): Deleted. (WebKit::WebGeolocationManager::isHighAccuracyEnabled const): Deleted. 2021-01-07 Per Arne Vollan [iOS] Silence diagnostics sandbox violations https://bugs.webkit.org/show_bug.cgi?id=220414 Reviewed by Darin Adler. For performance reasons, silence benign diagnostics sandbox violations in the WebContent process on iOS. Additionally, remove logging for a sysctl in the Networking process' sandbox, since it is known to be used. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-01-07 Kate Cheney Error in layout tests: "Passed ITP enabled state (0) does not match TCC setting (1)" https://bugs.webkit.org/show_bug.cgi?id=220385 Reviewed by Darin Adler. No new tests, this has no behavior change. It will fix excessive logging when running tests. We do not need to log a discrepancy between these states for WebKitTestRunner or TestWebKitAPI because they are sometimes treated like web browsers but need to turn ITP on/off for specific tests, so these states will not always match. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::activateSessionCleanup): * Shared/Cocoa/DefaultWebBrowserChecks.h: * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::isRunningTest): (WebKit::isParentProcessAFullWebBrowser): (WebKit::isFullWebBrowser): (WebKit::shouldBeTreatedAsFullBrowser): Deleted. 2021-01-07 Alex Christensen Remove assertions in MESSAGE_CHECK definition https://bugs.webkit.org/show_bug.cgi?id=220401 * Platform/IPC/Connection.h: The unit test associated with r271263 hits these assertions in debug builds. Since we plan to increase this type of unit testing, I remove the assertions. 2021-01-07 Mark Lam Work around Clang bug in __builtin_return_address(). https://bugs.webkit.org/show_bug.cgi?id=220432 rdar://71648468 Reviewed by Yusuke Suzuki. * PluginProcess/mac/PluginProcessShim.mm: (WebKit::shimCFStringCompare): - We go direct to ptrauth.h instead of using the WTF PtrTag abstraction because this file appears to be going out of its way to avoid importing config.h. Because of this, importing PtrTag.h results in a lot of build error complications. Rather than jump thru many hoops to make importing PtrTag.h work and because all we really want is only to use ptrauth_strip(), importing ptrauth.h is simpler. 2021-01-07 Peng Liu PlaybackSessionManager::m_clientCounts is not updated correctly when a video enters picture-in-picture from fullscreen https://bugs.webkit.org/show_bug.cgi?id=220435 Reviewed by Eric Carlson. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): When a fullscreen video enters picture-in-picture, we should not call `addClientForContext()` because `m_clientCounts` was updated when the video entered fullscreen. (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): We need to call `removeClientForContext()` in this function like `didCleanupFullscreen()` does. 2021-01-07 Eric Carlson [Mac] Add runtime logging to format reader and WebM parser https://bugs.webkit.org/show_bug.cgi?id=220423 Reviewed by Andy Estes. Use the Document::sharedLogger to log format and track reader state changes and errors. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::nextLogIdentifier): (WebKit::logChannel): (WebKit::logClassName): (WebKit::MediaFormatReader::parseByteSource): (WebKit::MediaFormatReader::didParseTracks): (WebKit::MediaFormatReader::copyProperty): (WebKit::MediaFormatReader::nextTrackReaderLogIdentifier const): * Shared/mac/MediaFormatReader/MediaFormatReader.h: * Shared/mac/MediaFormatReader/WebKit::MediaTrackReader.cpp: (WebKit::MediaTrackReader::MediaTrackReader): (WebKit::MediaTrackReader::finishParsing): (WebKit::MediaTrackReader::mediaTypeString const): (WebKit::MediaTrackReader::copyProperty): (WebKit::MediaTrackReader::finalize): (WebKit::MediaTrackReader::logChannel const): * Shared/mac/MediaFormatReader/WebKit::MediaTrackReader.h: 2021-01-07 Alexey Shvayka [JSC] Simplify get*PropertyNames() methods and EnumerationMode https://bugs.webkit.org/show_bug.cgi?id=212954 Reviewed by Yusuke Suzuki. Adjust for changes in JSC's MethodTable, TypeInfo, and EnumerationMode. No new tests, no behavior change. * WebProcess/Plugins/Netscape/JSNPObject.cpp: (WebKit::JSNPObject::getOwnPropertyNames): * WebProcess/Plugins/Netscape/JSNPObject.h: * WebProcess/Plugins/Netscape/NPJSObject.cpp: (WebKit::NPJSObject::enumerate): 2021-01-07 Commit Queue Unreviewed, reverting r271192. https://bugs.webkit.org/show_bug.cgi?id=220440 Reverted changeset: "NSCrossWebsiteTrackingUsageDescription is not working on Mac, ITP is always enabled" https://bugs.webkit.org/show_bug.cgi?id=220190 https://trac.webkit.org/changeset/271192 2021-01-07 Alex Christensen Use smart pointers in UIDelegate and NavigationState https://bugs.webkit.org/show_bug.cgi?id=220394 Reviewed by Geoff Garen. UIDelegate and NavigationState are owned by WKWebView, but the clients are owned by WebPageProxy, which is independently reference counted and can have a different lifetime. There should be no raw C++ references between the two, so use WeakPtr instead. Also, use WeakObjCPtr instead of a raw C++ WKWebView* * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationState): (WebKit::NavigationState::~NavigationState): (WebKit::NavigationState::navigationGestureDidBegin): (WebKit::NavigationState::navigationGestureWillEnd): (WebKit::NavigationState::navigationGestureDidEnd): (WebKit::NavigationState::willRecordNavigationSnapshot): (WebKit::NavigationState::navigationGestureSnapshotWasRemoved): (WebKit::NavigationState::didRequestPasswordForQuickLookDocument): (WebKit::NavigationState::didFirstPaint): (WebKit::NavigationState::NavigationClient::NavigationClient): (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::didChangeBackForwardList): (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation): (WebKit::NavigationState::NavigationClient::didStartProvisionalLoadForFrame): (WebKit::NavigationState::NavigationClient::didReceiveServerRedirectForProvisionalNavigation): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didCancelClientRedirect): (WebKit::NavigationState::NavigationClient::didFailProvisionalNavigationWithError): (WebKit::NavigationState::NavigationClient::didFailProvisionalLoadWithErrorForFrame): (WebKit::NavigationState::NavigationClient::didCommitNavigation): (WebKit::NavigationState::NavigationClient::didCommitLoadForFrame): (WebKit::NavigationState::NavigationClient::didFinishDocumentLoad): (WebKit::NavigationState::NavigationClient::didFinishNavigation): (WebKit::NavigationState::NavigationClient::didFinishLoadForFrame): (WebKit::NavigationState::NavigationClient::didFailNavigationWithError): (WebKit::NavigationState::NavigationClient::didFailLoadWithErrorForFrame): (WebKit::NavigationState::NavigationClient::didSameDocumentNavigation): (WebKit::NavigationState::NavigationClient::renderingProgressDidChange): (WebKit::NavigationState::NavigationClient::shouldBypassContentModeSafeguards const): (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): (WebKit::NavigationState::NavigationClient::shouldAllowLegacyTLS): (WebKit::NavigationState::NavigationClient::didNegotiateModernTLS): (WebKit::NavigationState::NavigationClient::processDidTerminate): (WebKit::NavigationState::NavigationClient::processDidBecomeResponsive): (WebKit::NavigationState::NavigationClient::processDidBecomeUnresponsive): (WebKit::NavigationState::NavigationClient::webCryptoMasterKey): (WebKit::NavigationState::NavigationClient::navigationActionDidBecomeDownload): (WebKit::NavigationState::NavigationClient::navigationResponseDidBecomeDownload): (WebKit::NavigationState::NavigationClient::contextMenuDidCreateDownload): (WebKit::NavigationState::NavigationClient::didStartLoadForQuickLookDocumentInMainFrame): (WebKit::NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame): (WebKit::NavigationState::NavigationClient::decidePolicyForSOAuthorizationLoad): (WebKit::NavigationState::HistoryClient::HistoryClient): (WebKit::NavigationState::HistoryClient::didNavigateWithNavigationData): (WebKit::NavigationState::HistoryClient::didPerformClientRedirect): (WebKit::NavigationState::HistoryClient::didPerformServerRedirect): (WebKit::NavigationState::HistoryClient::didUpdateHistoryTitle): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::ContextMenuClient::ContextMenuClient): (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu): (WebKit::UIDelegate::UIClient::UIClient): (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::runJavaScriptAlert): (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): (WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest): (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance): (WebKit::UIDelegate::UIClient::canRunBeforeUnloadConfirmPanel const): (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel): (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): (WebKit::UIDelegate::UIClient::takeFocus): (WebKit::UIDelegate::UIClient::handleAutoplayEvent): (WebKit::UIDelegate::UIClient::canRunModal const): (WebKit::UIDelegate::UIClient::runModal): (WebKit::UIDelegate::UIClient::headerHeight): (WebKit::UIDelegate::UIClient::footerHeight): (WebKit::UIDelegate::UIClient::drawHeader): (WebKit::UIDelegate::UIClient::drawFooter): (WebKit::UIDelegate::UIClient::pageDidScroll): (WebKit::UIDelegate::UIClient::focus): (WebKit::UIDelegate::UIClient::unfocus): (WebKit::UIDelegate::UIClient::unavailablePluginButtonClicked): (WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground): (WebKit::UIDelegate::UIClient::didNotHandleWheelEvent): (WebKit::UIDelegate::UIClient::setIsResizable): (WebKit::UIDelegate::UIClient::setWindowFrame): (WebKit::UIDelegate::UIClient::windowFrame): (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement): (WebKit::UIDelegate::UIClient::toolbarsAreVisible): (WebKit::UIDelegate::UIClient::didClickAutoFillButton): (WebKit::UIDelegate::UIClient::showPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest): (WebKit::UIDelegate::UIClient::configurationForLocalInspector): (WebKit::UIDelegate::UIClient::didAttachLocalInspector): (WebKit::UIDelegate::UIClient::willCloseLocalInspector): (WebKit::UIDelegate::UIClient::runOpenPanel): (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess): (WebKit::UIDelegate::UIClient::didChangeFontAttributes): (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange): (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): (WebKit::UIDelegate::UIClient::printFrame): (WebKit::UIDelegate::UIClient::close): (WebKit::UIDelegate::UIClient::fullscreenMayReturnToInline): (WebKit::UIDelegate::UIClient::didEnterFullscreen): (WebKit::UIDelegate::UIClient::didExitFullscreen): (WebKit::UIDelegate::UIClient::shouldIncludeAppLinkActionsForElement): (WebKit::UIDelegate::UIClient::actionsForElement): (WebKit::UIDelegate::UIClient::didNotHandleTapAsClick): (WebKit::UIDelegate::UIClient::presentingViewController): (WebKit::UIDelegate::UIClient::dataDetectionContext): (WebKit::UIDelegate::UIClient::requestPointerLock): (WebKit::UIDelegate::UIClient::didLosePointerLock): (WebKit::UIDelegate::UIClient::didShowSafeBrowsingWarning): (WebKit::UIDelegate::UIClient::confirmPDFOpening): (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel): (WebKit::UIDelegate::UIClient::hasVideoInPictureInPictureDidChange): (WebKit::UIDelegate::UIClient::imageOrMediaDocumentSizeChanged): (WebKit::UIDelegate::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): 2021-01-07 Alex Christensen Assertion failure in WebPageProxy::stopURLSchemeTask, https://bugs.webkit.org/show_bug.cgi?id=220401 Reviewed by Ryosuke Niwa. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::processForTaskIdentifier const): (WebKit::WebURLSchemeHandler::stopTask): (WebKit::WebURLSchemeHandler::removeTaskFromPageMap): 2021-01-07 Andy Estes [Mac] Prepend "Media" to FormatReader, SampleCursor, and TrackReader class names https://bugs.webkit.org/show_bug.cgi?id=220424 Reviewed by Eric Carlson. Also moved MediaSampleByteRange into its own file from MediaTrackReader.cpp. * MediaFormatReaderPlugIn/MediaFormatReaderPlugIn.cpp: * Shared/API/c/mac/WKMediaFormatReader.cpp: Renamed from Source/WebKit/Shared/API/c/mac/WKFormatReader.cpp. * Shared/API/c/mac/WKMediaFormatReader.h: Renamed from Source/WebKit/Shared/API/c/mac/WKFormatReader.h. * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: Updated DECLARE_CORE_MEDIA_TRAITS to account for renaming. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/FormatReader.cpp. * Shared/mac/MediaFormatReader/MediaFormatReader.h: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/FormatReader.h. * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: Added. * Shared/mac/MediaFormatReader/MediaSampleByteRange.h: Added. * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/SampleCursor.cpp. * Shared/mac/MediaFormatReader/MediaSampleCursor.h: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/SampleCursor.h. * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/TrackReader.cpp. * Shared/mac/MediaFormatReader/MediaTrackReader.h: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/TrackReader.h. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2021-01-07 Chris Dumez [GPUProcess] Implement GPUProcess crash recovery for MediaElementAudioSourceNode https://bugs.webkit.org/show_bug.cgi?id=220391 Reviewed by Geoffrey Garen. When audio is playing using WebAudio and a MediaElementAudioSourceNode, make sure that audio resumes playing seemlessly after a GPUProcess crash. * WebProcess/GPU/GPUProcessConnection.h: Subclass CanMakeWeakPtr<> so that clients can hold a weak pointer to a GPUProcessConnection. * WebProcess/GPU/media/RemoteAudioSourceProvider.cpp: (WebKit::RemoteAudioSourceProvider::create): (WebKit::RemoteAudioSourceProvider::RemoteAudioSourceProvider): (WebKit::RemoteAudioSourceProvider::close): (WebKit::RemoteAudioSourceProvider::hasNewClient): * WebProcess/GPU/media/RemoteAudioSourceProvider.h: Associate the RemoteAudioSourceProvider with a specific GPUProcessConnection instead of always using the latest connection via WebProcess::ensureGPUProcessConnection(). In the event of a GPUProcess crash, MediaPlayer will reconstruct its MediaPlayerPrivate which will reconstruct a new RemoteAudioSourceProvider (since RemoteAudioSourceProvider is owned by MediaPlayerPrivateRemote). As a result, RemoteAudioSourceProvider does not need to do anything to deal with a GPUProcess crash. However, we need to make sure it only interacts with the GPUProcessConnection that existed when it was constructed. 2021-01-07 Kimmo Kinnunen WebKit IPC message names should indicate if the message is synchronous https://bugs.webkit.org/show_bug.cgi?id=220319 Reviewed by Chris Dumez. Order WebKit IPC MessageName enumerators by listing asynchronous messages first. This enables relatively efficient implementation of isMessageSync(). Remove MessageFlags::SyncMessage. This information is already stored in the MessageName -- a message is either synchronous or asynchronous, but not both. * Platform/IPC/Connection.cpp: (IPC::Connection::createSyncMessageEncoder): * Platform/IPC/Decoder.cpp: (IPC::Decoder::alignBufferPosition): * Platform/IPC/Decoder.h: (IPC::Decoder::isSyncMessage const): * Platform/IPC/Encoder.cpp: (IPC::Encoder::grow): * Platform/IPC/Encoder.h: * Platform/IPC/MessageArgumentDescriptions.h: * Platform/IPC/MessageFlags.h: * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: (GeneratedFileContentsTest): * Scripts/webkit/model.py: (check_global_model_inputs): * Scripts/webkit/model_unittest.py: (test_mismatch_message_attribute_sync): * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: * Scripts/webkit/tests/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: (IPC::messageIsSync): 2021-01-07 Sihui Liu ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::SpeechRecognitionServer::~SpeechRecognitionServer() https://bugs.webkit.org/show_bug.cgi?id=220404 Reviewed by Youenn Fablet. API test: WebKit2.SpeechRecognitionPageIsDestroyed * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::destroySpeechRecognitionServer): 2021-01-07 Kimmo Kinnunen WebKit IPC builtin messages should be part of the model https://bugs.webkit.org/show_bug.cgi?id=220318 Reviewed by Chris Dumez. Add IPC and AsyncReply message receivers to the IPC model so that their messages can be part of the generator dynamic logic instead of being part of the static textual templates. IPC receiver is a built-in message receiver that has few async messages. AsyncReply receiver is a built-in message receiver that has one async message for each message declared as 'Async' in any receiver. This helps to refine features such as "is message asynchronous" more easily. Adds new test case TestWithIfMessage to check a case that went wrong when making the change. Moves parsing tests to parser_unittest.py so that TestWithIfMessage does not need to be added to the parsing tests. The said test is not intended to exercises anything particular in the parsing. Adds test logic for asserting MessageNames.{h,cpp} and MessageArgumentDescriptions.cpp are as expected. * Scripts/generate-message-receiver.py: (main): * Scripts/webkit/messages.py: * Scripts/webkit/model.py: (check_global_model_inputs): (generate_global_model): * Scripts/webkit/model_unittest.py: * Scripts/webkit/tests/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: 2021-01-07 Lauro Moura REGRESSION(r270425) [GTK] wheel scrolling stopped working https://bugs.webkit.org/show_bug.cgi?id=219547 Reviewed by Carlos Garcia Campos. In GTK we may have the case where the async scrolling is disabled at runtime despite being compiled with ASYNC_SCROLLING/SCROLLING_THREAD. In these cases, the wheel events still need to be dispatched through the main thread. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2021-01-07 Carlos Garcia Campos [GTK] Build failures with GTK4 3.99.5.1 https://bugs.webkit.org/show_bug.cgi?id=219844 Reviewed by Philippe Normand. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSizeAllocate): 2021-01-07 Youenn Fablet WKWebView should expose navigator.mediaDevices when content is loaded from app bundle https://bugs.webkit.org/show_bug.cgi?id=220184 Reviewed by Eric Carlson. In case of non HTTP or HTTPS origins, getUserMedia was always denied. This patch updates the code by allowing getUserMedia prompts for other protocols. In that case, the user is presented the prompt with the application name since the origin domain does not mean anything. Manually tested. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::alertMessageText): 2021-01-07 Jiewen Tan Unreviewed, a build fix after r271221 * Platform/spi/Cocoa/NearFieldSPI.h: * UIProcess/WebAuthentication/Cocoa/NfcService.mm: (WebKit::NfcService::isAvailable): (WebKit::NfcService::platformStartDiscovery): Changed back to sharedHardwareManager. 2021-01-06 Jiewen Tan [WebAuthn] Adopt new UI for the Client PIN and dismiss flow https://bugs.webkit.org/show_bug.cgi?id=219712 Reviewed by Brent Fulgham. Covered by manual tests. This patch does the following few things: 1. It tweaks the WebAuthn process as a UI view service to be able to run NearField in the background. 2. It adopts new SPI for security keys' client pin support. 3. It adopts new SPI to dismiss the UI when necessary. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: (NS_ERROR_ENUM): Adds new SPI. * Scripts/process-entitlements.sh: Tweaks WebAuthn process for NFC. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: Paperwork. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::~AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): (WebKit::AuthenticatorPresenterCoordinator::requestPin): (WebKit::AuthenticatorPresenterCoordinator::dimissPresenter): (WebKit::AuthenticatorPresenterCoordinator::setPin): Adopts new SPIs. * UIProcess/WebAuthentication/Cocoa/NfcService.mm: (WebKit::NfcService::platformStartDiscovery): Tweaks NFC. * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:validateUserEnteredPIN:completionHandler:]): Adopts new SPIs. 2021-01-06 Jer Noble [Cocoa] Revert audioTimePitchAlgorithm to "TimeDomain" from "Spectral" https://bugs.webkit.org/show_bug.cgi?id=220341 Reviewed by Youenn Fablet. Add a private preference to control what pitch correction algorithm will be used by MediaPlayer. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::setPitchCorrectionAlgorithm): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _pitchCorrectionAlgorithm]): (-[WKPreferences _setPitchCorrectionAlgorithm:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::setPitchCorrectionAlgorithm): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2021-01-06 Yusuke Suzuki [JSC] Replace JSBigInt::toUint64 with JSBigInt::toBigUInt64 https://bugs.webkit.org/show_bug.cgi?id=220378 Reviewed by Darin Adler. * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::convertToUint64): (WebKit::IPCTestingAPI::encodeNumericType): 2021-01-06 Andy Estes [Mac] Replace most uses of HAVE(MT_PLUGIN_FORMAT_READER) with ENABLE(WEBM_FORMAT_READER) https://bugs.webkit.org/show_bug.cgi?id=220374 Reviewed by Eric Carlson. * Shared/API/c/mac/WKFormatReader.cpp: (WKFormatReaderCreate): (WKFormatReaderStartOnMainThread): * Shared/WebPreferencesDefaultValues.cpp: * Shared/WebPreferencesDefaultValues.h: * Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp: * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: * Shared/mac/MediaFormatReader/FormatReader.cpp: * Shared/mac/MediaFormatReader/FormatReader.h: * Shared/mac/MediaFormatReader/SampleCursor.cpp: * Shared/mac/MediaFormatReader/SampleCursor.h: * Shared/mac/MediaFormatReader/TrackReader.cpp: * Shared/mac/MediaFormatReader/TrackReader.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2021-01-06 Chris Dumez [GPUProcess] RemoteAudioSourceProviderManager should be a WorkQueueMessageReceiver https://bugs.webkit.org/show_bug.cgi?id=220371 Reviewed by Youenn Fablet. RemoteAudioSourceProviderManager should be a WorkQueueMessageReceiver (not a ThreadMessageReceiver), since it uses a WorkQueue (not a WTF::Thread). This simplifies the code a bit. * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::setConnection): (WebKit::RemoteAudioSourceProviderManager::addProvider): (WebKit::RemoteAudioSourceProviderManager::removeProvider): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: 2021-01-06 Wenson Hsieh [Concurrent Display Lists] GPU process should not immediately sleep after reading all available display list items https://bugs.webkit.org/show_bug.cgi?id=219586 Reviewed by Chris Dumez. This patch adds a mechanism for the GPU process to wait for a short duration (~30 microseconds) after it has finished reading all available data in its shared item buffer; if the web process writes additional data to the item buffer (thereby bumping the unread bytes counter) during this time, we immediately resume processing the new display list items in the GPU process, rather than wait for a new wakeup message. This allows us to avoid the cost of going to sleep just to immediately wake up in the GPU process, in the case where the web process is writing display list items at a very fast rate and the GPU process just happens to catch up (i.e. advance `unreadBytes()` to 0). See below for more details. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createRenderingBackend): Refactor the rendering backend creation message from the web process to the GPU process, so that the rendering backend creation arguments are encapsulated in a single struct, RemoteRenderingBackendCreationParameters. This struct contains the rendering backend identifier and, on Cocoa platforms, a mach send right that can be used to construct the corresponding display list wakeup semaphore in the GPU process. * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/graphics/DisplayListReaderHandle.h: (WebKit::DisplayListReaderHandle::startWaiting): (WebKit::DisplayListReaderHandle::stopWaiting): Add helper methods for the GPU process to start and stop waiting for new items. See the call site in RemoteRenderingBackend for more detail, as well as the comments in SharedDisplayListHandle below. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::create): (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): Refactor this codepath to take RemoteRenderingBackendCreationParameters instead of just an identifier. (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): In the case where we received the wakeup message due to exceeding the display list item count hysteresis, wait for a short duration using the semaphore after we hit an unread count of 0. This allows the web process to write more items and signal the semaphore, so that we can resume reading in the GPU process. (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/GPUProcessWakeupMessageArguments.h: (WebKit::GPUProcessWakeupMessageArguments::encode const): (WebKit::GPUProcessWakeupMessageArguments::decode): Plumb a GPUProcessWakeupReason enum flag over to the GPU process, via wake-up arguments. This flag is used by the GPU process to determine whether we should expect additional items to eventually enter the stream, and whether we should eagerly go to sleep after processing all known items. In other words, if the wakeup message is being sent as a result of flushing the image buffer, we don't want to unnecessarily wait for more items; however, if the wakeup message is being sent as a result of exceeding the (currently) 512-item hysteresis, then we can probably expect more items to stream in, so it's more optimal to wait after finishing all known display list items. * Shared/RemoteRenderingBackendCreationParameters.h: Copied from Source/WebKit/Shared/GPUProcessWakeupMessageArguments.h. (WebKit::RemoteRenderingBackendCreationParameters::encode const): (WebKit::RemoteRenderingBackendCreationParameters::decode): See above for more details. * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::header const): Adds a new WaitingStatus enum type internal to SharedDisplayListHandle and its subclasses, which is used to coordinate the act of waiting for new item data in the GPU process. A shared display list handle now contains an atomic `waitingStatus` flag indicating whether the GPU process is in the process of waiting for more items, and also whether the web process has acknowledged the fact that the GPU process is waiting (thereby putting the GPU process in a state where it is waiting to resume processing). Along with this enum, we also add two new 8-byte values to the header section: an offset to begin reading item data after resuming, and 8 bytes for an identifier indicating the new destination (for the purposes of display list rendering, this is a RenderingResourceIdentifier, though this will be different for WebGL). +--> NotWaiting <--+ | | | | | | [3a] | [3b] | [1] | | | | Resuming +----> Waiting ^ | | [2] | +------------------+ There are three main ways in which this state machine may transition, numbered [1]-[3] in the above diagram. [1] When the GPU process finishes processing available items, it enters Waiting state, indicating that it is now waiting for additional item data. This corresponds to the call to `DisplayListReaderHandle::startWaiting`. [2] When the web process bumps the unread count of an item buffer, if it has a pending wakeup message or would otherwise need to schedule a pending wakeup message, see if we can instead simply tell the GPU process to resume processing, instead of sending a wakeup message. This corresponds to a call to the helper method `DisplayListWriterHandle::tryToResume`. [3] If the maximum wait duration (~30 microseconds) has passed (i.e. scenario 3a) or if the web process has transitioned us from Waiting to Resuming state (i.e. scenario 3b), then transition back to NotWaiting. In both scenarios, this corresponds to a call to `DisplayListReaderHandle::stopWaiting`. In the case where we transitioned from Resuming state, we can immediately continue processing display list items. In the case where we successfully resume, we're essentially "re-waking" the GPU process without the overhead of an additional IPC message, using the same shared display list handle. Since this would've otherwise been a separate wakeup message, we need to be careful that we continue processing display list items from the correct offset into the shared display list handle, and using the correct destination image buffer. This is because the writable offset of the item buffer may have been reset in the middle of waiting by the web process, or the destination image buffer may have changed while waiting. To handle these scenarios, we introduce the `ResumeReadingInformation` struct, which contains both of these pieces of information. An instance of this struct exists in the shared memory header section; this is written by the web process immediately prior to transitioning to Resuming state, and read by the GPU process when transitioning from Resuming to NotWaiting. * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/DisplayListWriterHandle.h: (WebKit::DisplayListWriterHandle::tryToResume): Add a helper method for the web process to try and notify the GPU process that it should try and resume display list processing. See the call site in RemoteRenderingBackendProxy for more detail, as well as the comments in SharedDisplayListHandle above. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::connectToGPUProcess): (WebKit::RemoteRenderingBackendProxy::didAppendData): Rather than always schedule (or send) a wakeup message here in the case where the unread count is 0, see if we can instead tell the GPU process to stop waiting and resume display list processing. To do this, we use the new DisplayListWriterHandle::tryToResume method, giving it the new offset to begin reading items from as well as the destination image buffer to which we should apply display list items. If we successfully tell the GPU process to resume reading, then we can clear out (or avoid storing) wakeup message arguments and avoid sending an IPC wakeup message. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2021-01-06 Alex Christensen Add SPI to determine whether a regex is supported in WKContentRuleList https://bugs.webkit.org/show_bug.cgi?id=220095 Reviewed by Tim Horton. This is a more efficient way than making a little rule list and seeing if it compiles. Here, we don't need access to the disk, and we don't need to hop to another thread and back. Covered by API tests. * UIProcess/API/APIContentRuleList.cpp: (API::ContentRuleList::supportsRegularExpression): * UIProcess/API/APIContentRuleList.h: * UIProcess/API/Cocoa/WKContentRuleList.mm: (+[WKContentRuleList _supportsRegularExpression:]): * UIProcess/API/Cocoa/WKContentRuleListInternal.h: * UIProcess/API/Cocoa/WKContentRuleListPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListInternal.h. * WebKit.xcodeproj/project.pbxproj: 2021-01-06 Alex Christensen Modernize WebContextMenu https://bugs.webkit.org/show_bug.cgi?id=219969 Reviewed by Tim Horton. This is old code, complete with a raw pointer. Use references instead of pointers where possible, and WeakPtr instead of a raw pointer. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageClickMenuItem): (WKBundlePageCopyContextMenuItems): * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::showContextMenu): * WebProcess/WebPage/WebContextMenu.cpp: (WebKit::WebContextMenu::WebContextMenu): * WebProcess/WebPage/WebContextMenu.h: (WebKit::WebContextMenu::create): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::contextMenu): (WebKit::WebPage::contextMenuAtPointInWindow): (WebKit::handleContextMenuEvent): (WebKit::WebPage::contextMenuForKeyEvent): 2021-01-06 Sihui Liu Stop speech recognition if page becomes invisible https://bugs.webkit.org/show_bug.cgi?id=220073 Reviewed by Youenn Fablet. We should not allow speech recognition on page invisible to user, because page may get content of captured audio without user's notice. To do this, we should: 1. deny speech recognition request on invisibile page 2. abort ongoing speech recognition if page becomes invisible API test: WebKit2.SpeechRecognitionPageBecomesInvisible * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::abortForPageIsBecomingInvisible): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchActivityStateChange): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::pageIsBecomingInvisible): * UIProcess/WebProcessProxy.h: 2021-01-06 Alex Christensen Use sendWithAsyncReply instead of iOS-specific GenericCallbacks https://bugs.webkit.org/show_bug.cgi?id=220346 Reviewed by Darin Adler. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _accessibilityRetrieveRectsEnclosingSelectionOffset:withGranularity:]): (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]): (selectionChangedWithGesture): (selectionChangedWithTouch): (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]): (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]): (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]): (-[WKContentView updateCurrentFocusedElementInformation:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::requestFocusedElementInformation): (WebKit::WebPageProxy::selectWithGesture): (WebKit::WebPageProxy::updateSelectionWithTouches): (WebKit::WebPageProxy::selectWithTwoTouches): (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset): (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText): (WebKit::WebPageProxy::gestureCallback): Deleted. (WebKit::WebPageProxy::touchesCallback): Deleted. (WebKit::WebPageProxy::selectionRectsCallback): Deleted. (WebKit::WebPageProxy::focusedElementInformationCallback): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestFocusedElementInformation): (WebKit::WebPage::selectWithGesture): (WebKit::WebPage::updateSelectionWithTouches): (WebKit::WebPage::selectWithTwoTouches): (WebKit::WebPage::getRectsForGranularityWithSelectionOffset): (WebKit::WebPage::getRectsAtSelectionOffsetWithText): 2021-01-06 Per Arne Vollan [iOS] Silence selected sandbox violation reports https://bugs.webkit.org/show_bug.cgi?id=220320 Reviewed by Darin Adler. For performance reasons, benign sandbox violations in the WebContent process can be silenced on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-01-06 Per Arne Vollan [iOS] Add missing endpoint in sandbox message filter https://bugs.webkit.org/show_bug.cgi?id=219731 Reviewed by Darin Adler. Add missing endpoint in the WebContent process' sandbox message filter on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-01-05 Eric Carlson [Cocoa] WebM format reader doesn't work with a url in a element https://bugs.webkit.org/show_bug.cgi?id=219961 Reviewed by Andy Estes. Only enable a WebM track when the it has FlagEnabled element, or when we see that it has media samples. This is necessary because there are WebM files with empty tracks, and CoreMedia won't play a file if any enabled track doesn't have samples. * Shared/mac/MediaFormatReader/FormatReader.cpp: (WebKit::FormatReader::didParseTracks): * Shared/mac/MediaFormatReader/TrackReader.cpp: (WebKit::TrackReader::create): (WebKit::TrackReader::TrackReader): (WebKit::TrackReader::finishParsing): (WebKit::TrackReader::isEnabled const): (WebKit::TrackReader::copyProperty): * Shared/mac/MediaFormatReader/TrackReader.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2021-01-05 Wenson Hsieh Refactor some logic around touch event deferring gesture recognizers https://bugs.webkit.org/show_bug.cgi?id=220345 Reviewed by Tim Horton. Rename `_deferringGestureRecognizerForFoo` to `_touchStartDeferringGestureRecognizerForFoo`, to make it clear that these deferring gestures are only intended to defer native gestures until the "touchstart" event has been handled. This distinction becomes important once I introduce deferring gesture recognizers that defer the "touchend" event, and prevent gestures that activate upon touch end (i.e. various types of tap gesture recognizers). See below for more details. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::doneDeferringTouchStart): (WebKit::PageClientImpl::doneDeferringNativeGestures): Deleted. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView _touchStartDeferringGestures]): (-[WKContentView _doneDeferringTouchStart:]): (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): (-[WKContentView _deferringGestureRecognizers]): Deleted. (-[WKContentView _doneDeferringNativeGestures:]): Deleted. Rename this to `-_doneDeferringTouchStart:`. (-[WKContentView deferringGestureRecognizer:shouldDeferGesturesAfterEndingTouchesWithEvent:]): Deleted. This logic has been moved to WKContentView (see below). * UIProcess/ios/WKDeferringGestureRecognizer.h: * UIProcess/ios/WKDeferringGestureRecognizer.mm: (-[WKDeferringGestureRecognizer touchesEnded:withEvent:]): Deleted. Additionally refactor this code so that this fallback logic for lifting the gesture gate exists inside `WKContentView` (after ending all touches), rather than inside the deferring gesture recognizer. While this doesn't affect the extant touch start deferring gestures, it will ensure that touch end deferring gestures won't get reset prematurely due to the web touch events gesture recognizer ending before the touch end deferring gesture. 2021-01-05 Kate Cheney NSCrossWebsiteTrackingUsageDescription is not working on Mac, ITP is always enabled https://bugs.webkit.org/show_bug.cgi?id=220190 Reviewed by Brent Fulgham. Consider the presence of the NSCrossWebsiteTrackingUsageDescription key as an indication to disable ITP for WKWebView until we implement a mechanism for disabling it in WKWebView like we do for iOS to avoid compatibility bugs. * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::determineITPStateInternal): 2021-01-05 Aditya Keerthi REGRESSION (r261157): Crash in WKSelectPopover when running as iPhone app on iPad https://bugs.webkit.org/show_bug.cgi?id=220065 Reviewed by Darin Adler. r261157 changed how WebKit determined the user interface idiom for WKWebViews that were created in daemons. Since daemons do not create UIApplications, WebKit cannot use UIDevice in these instances. Instead, the user interface idiom determination logic was updated to include a check for device hardware, using MobileGestalt, in cases where no UIApplication was created. Since WebKit only determines the user interface idiom once (then storing the obtained value), the added determination logic breaks down for iPhone apps on iPad. Consider the following sequence of events, eventually leading to a crash when interacting with a element, WebKit checks its saved idiom, an attempts to present a UIPopoverController (the standard behavior under the iPad idiom). 5. However, since the actual idiom is iPhone, UIKit throws an NSInvalidArgumentException, since UIPopoverController should not be used when running under the iPhone idiom. A simple fix for the crash would be to call into UIKit to check the idiom each time it is required, rather than relying on the saved bit. However, this does not address the more general issue, which is that WebKit's saved idiom and the actual idiom can be out of sync. Consequently, the approach taken is to update the saved idiom when it changes. This should only occur when a UIApplication is initialized. Hence, we listen for UIApplicationDidFinishLaunchingNotification, and if the actual idiom is different from our saved idiom, we update the saved idiom and also notify the WebProcess. * Shared/UserInterfaceIdiom.h: * Shared/UserInterfaceIdiom.mm: (WebKit::updateCurrentUserInterfaceIdiom): This method checks the actual idiom and updates the saved idiom if they differ. Returns true only if the idiom was updated. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): Listen for UIApplicationDidFinishLaunchingNotification if the idiom can change (UIApplication is uninitialized). Then, if the actual and saved idiom differ, notify all WebProcesses of the change. (WebKit::WebProcessPool::unregisterNotificationObservers): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::userInterfaceIdiomDidChange): Update the saved idiom using the information from the UIProcess. 2021-01-05 Chris Dumez [iOS] Add a feature flag to stop leaking an XPC boost message to XPC services https://bugs.webkit.org/show_bug.cgi?id=219453 Reviewed by Geoff Garen. Add a feature flag to stop leaking an XPC boost message to XPC services on builds where RunningBoard is able to give the right priorities to our XPC services based on the type of RunningBoard assertion is being held. There is no behavior change for the Network/WebContent processes since those were blocklisted in RunningBoard (Turning on the RB_full_manage_WK_jetsam feature flag gives us the default RunningBoard behavior without blocklisting). However, this allows the new GPUProcess to move to IDLE jetsam band when homing out of MobileSafari, which makes the GPUProcess eligible for the freezer. Previously, the leaked boost message would keep the GPUProcess in a higher jetsam band. For now, the feature flag is off by default. I will turn it on later on. * FeatureFlags/WebKit.plist: Add RB_full_manage_WK_jetsam feature flag but keep it off for now. On recent enough builds of RunningBoard, this flag disables the blocklisting of the WebContent/Network processes in RunningBoard so that RunningBoard can now set the priority of those processes (instead of us boosting our priority via boost messages). * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: Set _ProcessType=App so that RunningBoard is able to set the priority of our XPC services on iOS. Without this change, we get a permission denied when RunningBoard attempts to set the priority of our XPC services. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::shouldLeakBoost): Stop leaking a boost message on iOS when RUNNINGBOARD_WEBKIT_PRIORITY_SUPPORT compile-time flag is enabled and when the RB_full_manage_WK_jetsam feature flag is enabled. 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of AttributedStringForCharacterRangeCallback and FontAtSelectionCallback https://bugs.webkit.org/show_bug.cgi?id=220344 Reviewed by Geoffrey Garen. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::updateFontManagerIfNeeded): (WebKit::WebViewImpl::attributedSubstringForProposedRange): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync): (WebKit::WebPageProxy::fontAtSelection): (WebKit::WebPageProxy::attributedStringForCharacterRangeCallback): Deleted. (WebKit::WebPageProxy::fontAtSelectionCallback): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): (WebKit::WebPage::fontAtSelection): 2021-01-05 John Wilander PCM: Experimental debug mode stops working after initial use https://bugs.webkit.org/show_bug.cgi?id=220336 Reviewed by Brent Fulgham. The existing experimental PCM debug mode uses RuntimeEnabledFeatures::sharedFeatures().privateClickMeasurementDebugModeEnabled() which is not correct in the network process. This makes the flag to lose its state after navigations in new tabs. This patch moves the flag to be alongside the PCM feature flag in WebKit::NetworkProcess. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcess::privateClickMeasurementDebugModeEnabled const): * NetworkProcess/NetworkProcess.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::debugModeEnabled const): 2021-01-05 Kimmo Kinnunen WebKit IPC generator tests have duplicate receiver names, limiting the implementation https://bugs.webkit.org/show_bug.cgi?id=220236 Reviewed by Chris Dumez. IPC test message receivers defined multiple receivers with same name. Rename the test message receivers based on what feature they test. No change in the non-test code. The IPC works with message identifier defined by the MessageName type. Having multiple clashing receiver names is problematic because a MessageName is defined by pair . Since different receivers might have different kinds of messages with same message name, these might end up mapping to two conflicting message kinds. The rename of test classes makes the tests conform to the already used contract that the MessageName is globally unique to each individual conceptual message because the receiver names are unique. This enables further implementations that make decisions based on the message name. Example is to decide whether a message is synchronous or not. This cannot be implemented generally if there is multiple different kinds of messages with same name. Rename the test message receiver files based on the receiver name. This is more consistent with the existing convention used in the actual code. Move the script test results from the Scripts/ directory to a tests/ subdirectory of the tool. This is to not fill the Scripts/ directory with Scripts/webkit/ related test result data. Adds previously missing test result file MessageArgumentDescriptions.cpp, which was not added when the feature was implemented. Tested by existing tests and new model_unittest.py. * Scripts/Makefile: Removed. * Scripts/MessageNames.cpp: Removed. * Scripts/MessageNames.h: Removed. * Scripts/generate-message-receiver.py: (main): * Scripts/test-legacyMessageReceiver.cpp: Removed. * Scripts/testMessageReceiver.cpp: Removed. * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: (ParsingTest.test_receiver): (GeneratedFileContentsTest.assertGeneratedFileContentsEqual): * Scripts/webkit/model.py: (Parameter.has_attribute): (check_global_model): * Scripts/webkit/model_unittest.py: Added. (ModelCheckTest): (ModelCheckTest.test_duplicate_receivers): (test_mismatch_message_attribute_sync): * Scripts/webkit/tests/Makefile: Added. * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: Added. (IPC::jsValueForArguments): (IPC::jsValueForReplyArguments): (IPC::messageArgumentDescriptions): (IPC::messageReplyArgumentDescriptions): (IPC::messageIsSync): * Scripts/webkit/tests/MessageNames.cpp: Added. (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: Added. (WTF::isValidEnum): * Scripts/webkit/tests/TestWithLegacyReceiver.messages.in: Renamed from Source/WebKit/Scripts/webkit/test-legacy.messages.in. * Scripts/webkit/tests/TestWithLegacyReceiverMessageReceiver.cpp: Added. (Messages::TestWithLegacyReceiver::GetPluginProcessConnection::send): (Messages::TestWithLegacyReceiver::TestMultipleAttributes::send): (WebKit::TestWithLegacyReceiver::didReceiveTestWithLegacyReceiverMessage): (WebKit::TestWithLegacyReceiver::didReceiveSyncTestWithLegacyReceiverMessage): * Scripts/webkit/tests/TestWithLegacyReceiverMessages.h: Renamed from Source/WebKit/Scripts/test-legacyMessages.h. (Messages::TestWithLegacyReceiver::messageReceiverName): (Messages::TestWithLegacyReceiver::LoadURL::name): (Messages::TestWithLegacyReceiver::LoadSomething::name): (Messages::TestWithLegacyReceiver::TouchEvent::name): (Messages::TestWithLegacyReceiver::AddEvent::name): (Messages::TestWithLegacyReceiver::LoadSomethingElse::name): (Messages::TestWithLegacyReceiver::DidReceivePolicyDecision::name): (Messages::TestWithLegacyReceiver::Close::name): (Messages::TestWithLegacyReceiver::PreferencesDidChange::name): (Messages::TestWithLegacyReceiver::SendDoubleAndFloat::name): (Messages::TestWithLegacyReceiver::SendInts::name): (Messages::TestWithLegacyReceiver::CreatePlugin::name): (Messages::TestWithLegacyReceiver::RunJavaScriptAlert::name): (Messages::TestWithLegacyReceiver::GetPlugins::name): (Messages::TestWithLegacyReceiver::GetPluginProcessConnection::name): (Messages::TestWithLegacyReceiver::TestMultipleAttributes::name): (Messages::TestWithLegacyReceiver::TestParameterAttributes::name): (Messages::TestWithLegacyReceiver::TemplateTest::name): (Messages::TestWithLegacyReceiver::SetVideoLayerID::name): (Messages::TestWithLegacyReceiver::DidCreateWebProcessConnection::name): (Messages::TestWithLegacyReceiver::InterpretKeyEvent::name): (Messages::TestWithLegacyReceiver::DeprecatedOperation::name): (Messages::TestWithLegacyReceiver::ExperimentalOperation::name): * Scripts/webkit/tests/TestWithLegacyReceiverMessagesReplies.h: Renamed from Source/WebKit/Scripts/testMessagesReplies.h. * Scripts/webkit/tests/TestWithSuperclass.messages.in: Renamed from Source/WebKit/Scripts/webkit/test-superclass.messages.in. * Scripts/webkit/tests/TestWithSuperclassMessageReceiver.cpp: Renamed from Source/WebKit/Scripts/test-superclassMessageReceiver.cpp. (WebKit::TestWithSuperclass::didReceiveMessage): (WebKit::TestWithSuperclass::didReceiveSyncMessage): * Scripts/webkit/tests/TestWithSuperclassMessages.h: Renamed from Source/WebKit/Scripts/test-superclassMessages.h. (Messages::TestWithSuperclass::messageReceiverName): (Messages::TestWithSuperclass::LoadURL::name): (Messages::TestWithSuperclass::TestAsyncMessage::name): (Messages::TestWithSuperclass::TestAsyncMessage::asyncMessageReplyName): (Messages::TestWithSuperclass::TestAsyncMessageWithNoArguments::name): (Messages::TestWithSuperclass::TestAsyncMessageWithNoArguments::asyncMessageReplyName): (Messages::TestWithSuperclass::TestAsyncMessageWithMultipleArguments::name): (Messages::TestWithSuperclass::TestAsyncMessageWithMultipleArguments::asyncMessageReplyName): (Messages::TestWithSuperclass::TestAsyncMessageWithConnection::name): (Messages::TestWithSuperclass::TestAsyncMessageWithConnection::asyncMessageReplyName): (Messages::TestWithSuperclass::TestSyncMessage::name): (Messages::TestWithSuperclass::TestSynchronousMessage::name): * Scripts/webkit/tests/TestWithSuperclassMessagesReplies.h: Renamed from Source/WebKit/Scripts/test-superclassMessagesReplies.h. * Scripts/webkit/tests/TestWithoutAttributes.messages.in: Renamed from Source/WebKit/Scripts/webkit/test.messages.in. * Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp: Added. (Messages::TestWithoutAttributes::GetPluginProcessConnection::send): (Messages::TestWithoutAttributes::TestMultipleAttributes::send): (WebKit::TestWithoutAttributes::didReceiveMessage): (WebKit::TestWithoutAttributes::didReceiveSyncMessage): * Scripts/webkit/tests/TestWithoutAttributesMessages.h: Renamed from Source/WebKit/Scripts/testMessages.h. (Messages::TestWithoutAttributes::messageReceiverName): (Messages::TestWithoutAttributes::LoadURL::name): (Messages::TestWithoutAttributes::LoadSomething::name): (Messages::TestWithoutAttributes::TouchEvent::name): (Messages::TestWithoutAttributes::AddEvent::name): (Messages::TestWithoutAttributes::LoadSomethingElse::name): (Messages::TestWithoutAttributes::DidReceivePolicyDecision::name): (Messages::TestWithoutAttributes::Close::name): (Messages::TestWithoutAttributes::PreferencesDidChange::name): (Messages::TestWithoutAttributes::SendDoubleAndFloat::name): (Messages::TestWithoutAttributes::SendInts::name): (Messages::TestWithoutAttributes::CreatePlugin::name): (Messages::TestWithoutAttributes::RunJavaScriptAlert::name): (Messages::TestWithoutAttributes::GetPlugins::name): (Messages::TestWithoutAttributes::GetPluginProcessConnection::name): (Messages::TestWithoutAttributes::TestMultipleAttributes::name): (Messages::TestWithoutAttributes::TestParameterAttributes::name): (Messages::TestWithoutAttributes::TemplateTest::name): (Messages::TestWithoutAttributes::SetVideoLayerID::name): (Messages::TestWithoutAttributes::DidCreateWebProcessConnection::name): (Messages::TestWithoutAttributes::InterpretKeyEvent::name): (Messages::TestWithoutAttributes::DeprecatedOperation::name): (Messages::TestWithoutAttributes::ExperimentalOperation::name): * Scripts/webkit/tests/TestWithoutAttributesMessagesReplies.h: Renamed from Source/WebKit/Scripts/test-legacyMessagesReplies.h. 2021-01-05 Tim Horton SourcesCocoa.txt should not be installed in the Web Content service bundle https://bugs.webkit.org/show_bug.cgi?id=220338 Reviewed by Wenson Hsieh. * WebKit.xcodeproj/project.pbxproj: Remove SourcesCocoa.txt from the target. 2021-01-05 Peng Liu [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed https://bugs.webkit.org/show_bug.cgi?id=220334 Reviewed by Eric Carlson. Update the IPC message RemoteSourceBufferProxy::RemoveCodedFrames to implement SourceBufferPrivateRemote::removeCodedFrames(). * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::removeCodedFrames): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::removeCodedFrames): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2021-01-05 Ryan Haddad Unreviewed, reverting r271169. Caused TestWebKitAPI.WebKit2.SpeechRecognitionErrorWhenStartingAudioCaptureOnDifferentPage to time out on macOS. Reverted changeset: "Stop speech recognition if page becomes invisible" https://bugs.webkit.org/show_bug.cgi?id=220073 https://trac.webkit.org/changeset/271169 2021-01-05 Alex Christensen Make WebPage::ForceRepaint use CompletionHandler instead of VoidCallback https://bugs.webkit.org/show_bug.cgi?id=212269 Reviewed by Chris Dumez. Fix a few unsafe pointer uses along the way. No change in behavior. * UIProcess/API/C/WKPage.cpp: (WKPageForceRepaint): * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::forceRepaintIfNeeded): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::forceRepaint): * UIProcess/WebPageProxy.h: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): (-[WKFullScreenWindowController _completedExitFullScreen]): * UIProcess/mac/WKFullScreenWindowController.h: * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController dealloc]): (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): (WebKit::LayerTreeHost::forceRepaintAsync): (WebKit::LayerTreeHost::renderNextFrame): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: (WebKit::LayerTreeHost::forceRepaintAsync): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::forceRepaintAsync): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::forceRepaint): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync): 2021-01-05 Sihui Liu Stop speech recognition if page becomes invisible https://bugs.webkit.org/show_bug.cgi?id=220073 Reviewed by Youenn Fablet. We should not allow speech recognition on page invisible to user, because page may get content of captured audio without user's notice. To do this, we should: 1. deny speech recognition request on invisibile page 2. abort ongoing speech recognition if page becomes invisible API test: WebKit2.SpeechRecognitionPageBecomesInvisible * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::abortForPageIsBecomingInvisible): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchActivityStateChange): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::pageIsBecomingInvisible): * UIProcess/WebProcessProxy.h: 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of ValidateCommandCallback https://bugs.webkit.org/show_bug.cgi?id=220124 Reviewed by Chris Dumez. * UIProcess/API/C/WKPage.cpp: (WKPageValidateCommand): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::validateUserInterfaceItem): * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::validateCommand): (WebKit::WebPageProxy::validateCommandCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::~WebProcessPool): * UIProcess/WebProcessPool.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::validateCommand): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of FontAttributesCallback https://bugs.webkit.org/show_bug.cgi?id=220123 Reviewed by Chris Dumez. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::typingAttributesWithCompletionHandler): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart): (WebKit::WebPageProxy::fontAttributesCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::requestFontAttributesAtSelectionStart): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of RectForCharacterRangeCallback https://bugs.webkit.org/show_bug.cgi?id=220125 Reviewed by Chris Dumez. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::firstRectForCharacterRange): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::firstRectForCharacterRangeAsync): (WebKit::WebPageProxy::rectForCharacterRangeCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::firstRectForCharacterRangeAsync): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-05 Sihui Liu Fail speech recognition when page is muted for audio capture https://bugs.webkit.org/show_bug.cgi?id=220133 Reviewed by Youenn Fablet. We currently only allow one page to capture media at a time and we did this by muting (stop capture in) other pages. To make speech recognition work with this behavior, two changes are made: 1. when page is muted, mute audio capture source used for speech recognition on the page. This will ultimately fail recognition. 2. when speech recognition is about to start, make sure other pages are muted for capture. * UIProcess/SpeechRecognitionPermissionManager.h: (WebKit::SpeechRecognitionPermissionManager::page): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::mute): * UIProcess/SpeechRecognitionServer.h: * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::muteCaptureMediaStreamsExceptIn): Deleted. * UIProcess/UserMediaProcessManager.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): (WebKit::WebPageProxy::setMuted): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::muteCaptureInPagesExcept): (WebKit::WebProcessProxy::pageMutedStateChanged): * UIProcess/WebProcessProxy.h: 2021-01-05 Alex Christensen Use WeakHashSet instead of HashSet https://bugs.webkit.org/show_bug.cgi?id=220102 Reviewed by Darin Adler. * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::setAsynchronousSpellCheckingEnabled): (WebKit::InjectedBundle::setUserStyleSheetLocation): (WebKit::InjectedBundle::liveDocumentURLs): * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::dispatchLocalStorageEvent): 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of SelectionContextCallback https://bugs.webkit.org/show_bug.cgi?id=220121 Reviewed by Chris Dumez. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _lookupForWebView:]): (-[WKContentView requestDictationContext:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::requestDictationContext): (WebKit::WebPageProxy::getSelectionContext): (WebKit::WebPageProxy::selectionContextCallback): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getSelectionContext): (WebKit::WebPage::requestDictationContext): 2021-01-05 Youenn Fablet Enable WebRTC codecs in GPU process only for --use-gpu-process option https://bugs.webkit.org/show_bug.cgi?id=220316 Reviewed by Alexey Proskuryakov. ADD C SPI used by TestController. Manually tested. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebRTCPlatformCodecsInGPUProcessEnabled): (WKPreferencesGetWebRTCPlatformCodecsInGPUProcessEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: 2021-01-04 Jeff Miller Update user-visible copyright strings to include 2021 https://bugs.webkit.org/show_bug.cgi?id=219901 Reviewed by Anders Carlsson. * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist: * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * Info.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-OSX.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.Info.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-OSX.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: 2021-01-02 Rob Buis Remove some FrameLoader::changeLocation parameters https://bugs.webkit.org/show_bug.cgi?id=220186 Reviewed by Darin Adler. Adapt to API change. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::searchWithGoogle): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick): 2020-12-23 Said Abou-Hallawa [GPU Process]: Don't call flushDrawingContext() in the middle of recording drawing commands https://bugs.webkit.org/show_bug.cgi?id=220126 Reviewed by Simon Fraser. There is no need to replay back the DrawImageBuffer immediately after it was recorded. The worry was the source ImageBuffer may change before replaying back the DrawImageBuffer into the destination ImageBuffer. But this should not happen with the shared memory buffer because the order of drawing among multiple ImageBuffer is preserved. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::display): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-12-23 Peng Liu [Media in GPU Process][MSE] Clean up SourceBufferPrivateRemote and implement functions with new IPC messages https://bugs.webkit.org/show_bug.cgi?id=220122 Reviewed by Eric Carlson. Add IPC messages and handlers in `RemoteSourceBufferProxy` to implement the added functions of `SourceBufferPrivateRemote`. Also add an IPC message to forward the `HighestPresentationTimestampChanged` callback from `RemoteSourceBufferProxy` to `SourceBufferPrivateRemote`. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHighestPresentationTimestampChanged): (WebKit::RemoteSourceBufferProxy::setMediaSourceEnded): (WebKit::RemoteSourceBufferProxy::setMode): (WebKit::RemoteSourceBufferProxy::startChangingType): (WebKit::RemoteSourceBufferProxy::removeCodedFrames): (WebKit::RemoteSourceBufferProxy::setAllTrackBuffersNeedRandomAccess): (WebKit::RemoteSourceBufferProxy::setGroupStartTimestamp): (WebKit::RemoteSourceBufferProxy::setGroupStartTimestampToEndTimestamp): (WebKit::RemoteSourceBufferProxy::setShouldGenerateTimestamps): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * Scripts/webkit/messages.py: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::setMediaSourceEnded): (WebKit::SourceBufferPrivateRemote::setMode): (WebKit::SourceBufferPrivateRemote::removeCodedFrames): (WebKit::SourceBufferPrivateRemote::setAllTrackBuffersNeedRandomAccess): (WebKit::SourceBufferPrivateRemote::setGroupStartTimestamp): (WebKit::SourceBufferPrivateRemote::setGroupStartTimestampToEndTimestamp): (WebKit::SourceBufferPrivateRemote::setShouldGenerateTimestamps): (WebKit::SourceBufferPrivateRemote::startChangingType): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateHighestPresentationTimestampChanged): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: 2020-12-23 Peng Liu [Media in GPU Process][MSE] Media element does not fire "resize" event https://bugs.webkit.org/show_bug.cgi?id=220119 Reviewed by Eric Carlson. Implement `RemoteMediaPlayerProxy::mediaPlayerSizeChanged()` to forward the video resize callback from MSE media player to web process. No new tests, covered by existing failing layout test. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerSizeChanged): * GPUProcess/media/RemoteMediaPlayerProxy.h: 2020-12-23 Simon Fraser Standardize on "allows scrolling" terminology instead of asking about scrollbars https://bugs.webkit.org/show_bug.cgi?id=220111 Reviewed by Wenson Hsieh. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): 2020-12-22 Dean Jackson Use an enum class to identify WebGL versions https://bugs.webkit.org/show_bug.cgi?id=220099 Reviewed by Ken Russell. Encode the WebGL version. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: 2020-12-22 Kate Cheney Cannot see 'Add to my stations' button in BBC World service Radio https://bugs.webkit.org/show_bug.cgi?id=219949 Reviewed by Alex Christensen. This is a temporary quirk to assist a high-traffic website while they complete the large task of migrating away from site compatibility using third party cookies. This quirk will be removed when the site is updated. Create a quirk that will call the Storage Access API on behalf of BBC for radioplayer.co.uk under bbc.co.uk. When the user clicks to open the radio player pop-up, storage access is requested. If the user grants permission, then we open the pop-up to static.radioplayer.co.uk to get first party status, then immediately redirect to the radio player page. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral): Change wording now that quirks are not only being used for login flows. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createNewPage): Mark the quirk-initiated pop-up as user-initiated so it doesn't get blocked. 2020-12-22 Ryan Haddad Unreviewed, fix the build with recent SDKs. * UIProcess/PDF/WKPDFHUDView.mm: (-[WKPDFHUDView _getImageForControlName:]): * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: (-[WKScrollerImpDelegate effectiveAppearanceForScrollerImp:]): 2020-12-22 Youenn Fablet [iOS] Do extensive search for microphone devices when trying to capture https://bugs.webkit.org/show_bug.cgi?id=220010 Reviewed by Eric Carlson. Enable exhaustive audio device query in case getUserMedia is called for audio capture. In case the manager is destroyed or reset after some time without capturing, make sure to disable exhaustive audio device query if no other page need it. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::invalidatePendingRequests): (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess): (WebKit::UserMediaPermissionRequestManagerProxy::startProcessingUserMediaPermissionRequest): * UIProcess/UserMediaPermissionRequestManagerProxy.h: 2020-12-21 Wenson Hsieh REGRESSION (iOS 14): Bad access crash in ShareableBitmap::makeCGImageCopy() under assignLegacyDataForContextMenuInteraction() https://bugs.webkit.org/show_bug.cgi?id=219843 Reviewed by Geoffrey Garen. Apply a speculative fix for the crash by making the UI process robust in the case where the requested position information has the `isImage` flag set, but no native image. Additionally, keep the existing debug assertions by moving them outside of their current if statements. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView assignLegacyDataForContextMenuInteraction]): (-[WKContentView continueContextMenuInteraction:]): 2020-12-21 Chris Dumez Simplify CARingBuffer usage with SharedMemory storage https://bugs.webkit.org/show_bug.cgi?id=220047 Reviewed by Geoff Garen. Simplify CARingBuffer usage with SharedMemory storage: 1. There are now 2 storage types: - ReadOnlySharedRingBufferStorage: Used by the reader - SharedRingBufferStorage: Used by the writer One type inherits the other. This allows the API to be a bit clearer and we can drop the m_readyOnly flag. 2. Drop SharedRingBufferStorage::updateReadOnlyStorage() function. Instead, the reader can now construct a new ReadOnlySharedRingBufferStorage directly of the SharedMemory handle and pass it to the CARingBuffer constructor. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::RemoteAudioDestination): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::RemoteAudioMediaStreamTrackRenderer): (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::RemoteMediaRecorder): (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): * GPUProcess/webrtc/RemoteMediaRecorder.h: * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::ReadOnlySharedRingBufferStorage::ReadOnlySharedRingBufferStorage): (WebKit::ReadOnlySharedRingBufferStorage::data): (WebKit::ReadOnlySharedRingBufferStorage::sharedFrameBounds const): (WebKit::ReadOnlySharedRingBufferStorage::getCurrentFrameBounds): (WebKit::ReadOnlySharedRingBufferStorage::flush): (WebKit::ReadOnlySharedRingBufferStorage::updateFrameBounds): (WebKit::SharedRingBufferStorage::setStorage): (WebKit::SharedRingBufferStorage::allocate): (WebKit::SharedRingBufferStorage::deallocate): (WebKit::SharedRingBufferStorage::setCurrentFrameBounds): * Shared/Cocoa/SharedRingBufferStorage.h: (WebKit::ReadOnlySharedRingBufferStorage::storage const): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::m_ringBuffer): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::RemoteAudio): (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage): * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::RemoteAudio): (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): 2020-12-21 Alex Christensen Retain IPC::Connection when using it when making a NetworkDataTask https://bugs.webkit.org/show_bug.cgi?id=220067 Reviewed by Geoffrey Garen. r265230 helped, but it's still crashing. Maybe we're getting a non-null pointer to an object that is about to be destroyed on another thread. There's no reason not to keep it alive here. Also, don't release assert in isParentProcessAFullWebBrowser if there's no audit token so we don't just kick this can down the road. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::sessionWrapperForTask): 2020-12-21 Ryan Haddad Unreviewed, reverting r270939 and r270952. Caused layout test timeouts on internal bots Reverted changesets: "[Cocoa] WebM format reader doesn't work with a url in a element" https://bugs.webkit.org/show_bug.cgi?id=219961 https://trac.webkit.org/changeset/270939 "[Cocoa] WebM format reader doesn't work with a url in a element" https://bugs.webkit.org/show_bug.cgi?id=219961 https://trac.webkit.org/changeset/270952 2020-12-21 Wenson Hsieh Many websites crash under toDataURL() when enabling GPU process for DOM https://bugs.webkit.org/show_bug.cgi?id=220051 Reviewed by Simon Fraser. Three methods of canvas readback (`toDataURL`, `toData`, and `toBGRAData`) currently cause the web content process to crash when enabling GPU process for DOM rendering. This is because we attempt to call into the respective methods on the image buffer backend following r270342, which unconditionally fire release assertions. Instead of using the proxy image buffer backend object in the web process, we need to communicate with the platform `RemoteImageBuffer` in the GPU process. To do this, we add some plumbing through `RemoteRenderingBackendProxy` and `RemoteRenderingBackend`, and override the `toDataURL`, `toData`, and `toBGRAData` methods on `RemoteImageBufferProxy` in the web process to request data from the remote rendering backend instead. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::getDataURLForImageBuffer): (WebKit::RemoteRenderingBackend::getDataForImageBuffer): (WebKit::RemoteRenderingBackend::getBGRADataForImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::getImageData): (WebKit::RemoteRenderingBackendProxy::getDataURLForImageBuffer): (WebKit::RemoteRenderingBackendProxy::getDataForImageBuffer): (WebKit::RemoteRenderingBackendProxy::getBGRADataForImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-21 Kate Cheney Missing textInteractionEnabled key in WKPreferences initWithCoder looks like a false value. https://bugs.webkit.org/show_bug.cgi?id=220061 Reviewed by Wenson Hsieh. We should check for the existence of the textInteractionEnabled key in the NSCoder before updating the default value in WKPreferences, otherwise a missing key will register as a false value when the default of textInteractionEnabled should be true. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences initWithCoder:]): 2020-12-21 Sihui Liu Check availability of speech recognition service before requesting permissions https://bugs.webkit.org/show_bug.cgi?id=220033 Reviewed by Youenn Fablet. If speech recognition service is not available for target language (maybe the language is not supported, user turns off dictation in system settings, etc), let's just fail the speech recognition request without prompting. Manually tested with MiniBrowser. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::requestSpeechRecognitionAccess): (WebKit::checkSpeechRecognitionServiceAccess): (WebKit::checkSpeechRecognitionServiceAvailability): * UIProcess/MediaPermissionUtilities.h: * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::lang const): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::requestPermissionForRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): 2020-12-21 Alicia Boya García [MSE] Fix allSamplesInTrackEnqueued() handling https://bugs.webkit.org/show_bug.cgi?id=220055 Reviewed by Philippe Normand. trySignalAllSamplesInTrackEnqueued() does not need to be exposed outside of SourceBufferPrivate. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::trySignalAllSamplesInTrackEnqueued): Deleted. * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::trySignalAllSamplesInTrackEnqueued): Deleted. * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-20 Chris Dumez Unreviewed, reverting r270969. Regressed MotionMark with GPUProcess enabled Reverted changeset: "[iOS] Stop leaking an XPC boost message to XPC services" https://bugs.webkit.org/show_bug.cgi?id=219453 https://trac.webkit.org/changeset/270969 2020-12-20 Rob Buis Convert remaining FrameLoaderType enums to enum classes https://bugs.webkit.org/show_bug.cgi?id=219898 Reviewed by Sam Weinig. Adapt to enum class changes. * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameGetFrameLoadState): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): 2020-12-19 Rob Buis Move FrameLoader::arePluginsEnabled to Frame https://bugs.webkit.org/show_bug.cgi?id=220022 Reviewed by Sam Weinig. Adapt to API change. * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::pluginInfo): (WebKit::WebPluginInfoProvider::populatePluginCache): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::objectContentType): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createPlugin): (WebKit::WebPage::canPluginHandleResponse): (WebKit::WebPage::canShowMIMEType const): 2020-12-19 Brent Fulgham REGRESSION(r270575): [iOS] Correct GPU Process sandbox syntax error https://bugs.webkit.org/show_bug.cgi?id=220041 Unreviewed build fix after r270575. A closing parentheses was omitted when the 'play-audio' rule was changed to remove its last rule. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: 2020-12-18 Tim Horton iOS wheel events don't work on many websites https://bugs.webkit.org/show_bug.cgi?id=220034 Reviewed by Simon Fraser. * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent): It turns out that many sites look at the legacy mousewheel event properties, so compute wheelTicks in the same way that we do on macOS. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _scrollView:asynchronouslyHandleScrollEvent:completion:]): If the UI process sends a wheel event with delta=0,0 to the Web Content process, it will not be sent to the page, and thus not handled. If this is the first event, it will prevent future events from being cancelable. Instead, synthetically defer the "Begin" phase to the first event in a given gesture that has non-zero deltas, and just short-circuit any zero-delta events entirely. This way, WebCore can continue with its existing only-the-first-event-is-cancelable logic, and we are assured that the first event that WebCore sees is also the first event that the page sees, and is a Begin-phase event. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::dispatchWheelEventWithoutScrolling): wheelScrollGestureState isn't reset to nullopt until we send the Begin-phase event to EventHandler, so we must make an exception for the Begin-phase event, and explicitly make it cancelable. Otherwise, the state of the previous gesture leaks into the new gesture. Existing API tests caught this, I just apparently failed to run them after adopting the shared wheelScrollGestureState(). 2020-12-18 Brady Eidson Fix some issues with PDFs as . https://bugs.webkit.org/show_bug.cgi?id=220024 Reviewed by Tim Horton. No new tests (Unable to write automated tests) * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::dataProviderGetBytesAtPositionCallback): (WebKit::PDFPlugin::getResourceBytesAtPosition): Set the correct URL. (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData): Try harder to catch mismatches in delivered bytes vs expected bytes. 2020-12-18 Jeff Miller WKProcessPool enhancements for URL schemes https://bugs.webkit.org/show_bug.cgi?id=220030 Reviewed by Brian Weinstein. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _registerURLSchemeAsSecure:]): Added, equivalent to WKContextRegisterURLSchemeAsSecure(). (-[WKProcessPool _registerURLSchemeAsBypassingContentSecurityPolicy:]): Added, equivalent to WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(). (-[WKProcessPool _setDomainRelaxationForbiddenForURLScheme:]): Added, equivalent to WKContextSetDomainRelaxationForbiddenForURLScheme(). * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 2020-12-18 BJ Burg [Cocoa] Web Inspector: clean up _WKRemoteWebInspectorViewController https://bugs.webkit.org/show_bug.cgi?id=219963 Reviewed by Devin Rousso. Remove deprecated and unused debuggableType-based SPI to load the frontend. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h: Promote the _WKInspectorDebuggableInfo-based SPI to the main header. Fix availability annotations. This class has never worked on iOS. Add TBA annotations for things added since the Big Sur SDK was finalized. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (legacyDebuggableTypeToModernDebuggableType): Deleted. (-[_WKRemoteWebInspectorViewController loadForDebuggableType:backendCommandsURL:]): Deleted. 2020-12-18 Peng Liu [Media in GPU Process][MSE] SourceBufferPrivateRemote needs to override some track buffer related functions of SourceBufferPrivate https://bugs.webkit.org/show_bug.cgi?id=219998 Reviewed by Jer Noble. Implement some track buffer related functions of `SourceBufferPrivateRemote` with new IPC messages. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::resetTrackBuffers): (WebKit::RemoteSourceBufferProxy::clearTrackBuffers): (WebKit::RemoteSourceBufferProxy::resetTimestampOffsetInTrackBuffers): (WebKit::RemoteSourceBufferProxy::setTimestampOffset): (WebKit::RemoteSourceBufferProxy::setAppendWindowStart): (WebKit::RemoteSourceBufferProxy::setAppendWindowEnd): (WebKit::RemoteSourceBufferProxy::updateTrackIds): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack): `MediaSource` manages the track information for the MSE media player, so we should not call `MediaPlayer::addAudioTrack()`, `MediaPlayer::addTextTrack()` and `MediaPlayer::addVideoTrack()`. * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::resetTrackBuffers): (WebKit::SourceBufferPrivateRemote::clearTrackBuffers): (WebKit::SourceBufferPrivateRemote::resetTimestampOffsetInTrackBuffers): (WebKit::SourceBufferPrivateRemote::setTimestampOffset): (WebKit::SourceBufferPrivateRemote::setAppendWindowStart): (WebKit::SourceBufferPrivateRemote::setAppendWindowEnd): (WebKit::SourceBufferPrivateRemote::updateTrackIds): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-18 Sihui Liu SpeechRecognitionRemoteRealtimeMediaSourceManager should not issue sandbox extension for mocked devices https://bugs.webkit.org/show_bug.cgi?id=219972 Reviewed by Eric Carlson. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): We need to sync the preference not only on when mockCaptureDevicesEnabled is set, but also when it is unset. * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::addSource): Grant sandbox extensions to web process when the first source that uses a real device is created. (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::removeSource): Revoke sandbox extensions from web process when the last source that uses a real device is delete. * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h: * UIProcess/SpeechRecognitionServer.cpp: Correct a typo. (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): * UIProcess/SpeechRecognitionServer.h: Correct a typo 2020-12-18 Chris Dumez REGRESSION (r270938): ASSERTION FAILED: !m_renderThread in WebKit::RemoteAudioDestinationProxy::startRenderingThread https://bugs.webkit.org/show_bug.cgi?id=220017 Reviewed by Darin Adler. In case of a GPU process crash, we call stopRenderingThread() and then connectToGPUProcess() which calls startRenderingThread(). We were hitting an assertion in startRenderingThread() making sure that m_renderThread is null because stopRenderingThread() was failing to set it to null after stopping the thread. No new tests, covered by existing failing API test. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::stopRenderingThread): 2020-12-18 Megan Gardner Gate all of the code associated with app highlights https://bugs.webkit.org/show_bug.cgi?id=220003 Reviewed by Tim Horton. * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAppHighlightsEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): 2020-12-18 Chris Dumez [iOS] Stop leaking an XPC boost message to XPC services https://bugs.webkit.org/show_bug.cgi?id=219453 Reviewed by Geoff Garen. Stop leaking an XPC boost message to XPC services on builds where RunningBoard is able to give the right priorities to our XPC services based on the type of RunningBoard assertion is being held. There is no behavior change for the Network/WebContent processes since those were blocklisted in RunningBoard (Turning on the RB_full_manage_WK_jetsam feature flag gives us the default RunningBoard behavior without blocklisting). However, this allows the new GPUProcess to move to IDLE jetsam band when homing out of MobileSafari, which makes the GPUProcess eligible for the freezer. Previously, the leaked boost message would keep the GPUProcess in a higher jetsam band. * FeatureFlags/WebKit.plist: Add RB_full_manage_WK_jetsam feature flag and turn it on. On recent enough builds of RunningBoard, this disables the blocklisting of the WebContent/Network processes in RunningBoard so that RunningBoard can now set the priority of those processes (instead of us boosting our priority via boost messages). * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: Set _ProcessType=App so that RunningBoard is able to set the priority of our XPC services on iOS. Without this change, we get a permission denied when RunningBoard attempts to set the priority of our XPC services. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::shouldLeakBoost): Stop leaking a boost message on iOS when RUNNINGBOARD_WEBKIT_PRIORITY_SUPPORT compile-time flag is enabled and when the RB_full_manage_WK_jetsam feature flag is enabled. 2020-12-17 Kimmo Kinnunen REGRESSION (r268386): Snapshots of WebGL content in the tab picker don't work (black map on Google Maps) https://bugs.webkit.org/show_bug.cgi?id=219946 Reviewed by Dean Jackson. Add dummy implementations of GraphicsContextGL::paintCompositedResultsToCanvas. Painting to canvas is not implemented yet for the remote GraphicsContextGL implementation. * GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp: (WebKit::RemoteGraphicsContextGLCocoa::displayBuffer const): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::paintCompositedResultsToCanvas): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: 2020-12-17 Alex Christensen REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request https://bugs.webkit.org/show_bug.cgi?id=220001 Reviewed by Tim Horton. A ResourceRequest was used after being moved in the super old C SPI that we need to remove, but to keep our client functioning correctly until they do we copy the ResourceRequest instead of moving it. Covered by an API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNewWindowAction): 2020-12-17 Chris Dumez [GPUProcess] https://www.waveplayer.info/createmediaelementsource-test/ demo is flaky https://bugs.webkit.org/show_bug.cgi?id=219951 Reviewed by Geoff Garen. The issue was with the following line in AudioSourceProviderAVFObjC::prepare: `m_ringBuffer = m_ringBufferCallback(description, capacity).moveToUniquePtr();` In the case where m_ringBuffer was non-null before the assignment, we would have 2 RingBuffers that would coexist for a very small period of time. When the new one was created, we would send an IPC to the remote process with the shared memory handle of the new RingBuffer. However, very shortly after, the old ring buffer would get destroyed, causing us to send another IPC to the remote process with a null handle (since the shared memory associated with the old ring buffer is getting destroyed). As a result, of this ordering issue, the remote process would end up with a RingBuffer with a null shared memory handle and no audio would be rendered. We could have addressed the issue like so: ``` m_ringBuffer = nullptr; m_ringBuffer = m_ringBufferCallback(description, capacity).moveToUniquePtr(); ``` However, this would be super fragile. Instead, I have made the following changes: 1. If there is already a ringBuffer, reuse it instead of reconstructing it. Calling allocate() with the new parameters on the existing ring buffer is sufficient in this case. 2. Because of 1, the ring buffer creation callback no longer needs to call CARingBuffer::allocate(). I also made the following changes to make the code simpler and to reduce code duplication: - The storage change handler passed to SharedRingBufferStorage is now given as parameter the CAAudioStreamDescription & frameCount. What the handler always does is send an IPC to the remote process to tell it that the storage changed and in all cases, it needs to provide these 2 parameters as well. This is because the remote process will need to call CARingBuffer::allocate(), which requires those 2 parameters. This simplifies our code in some cases since we no longer need a mechanism to retrieve those 2 parameters from inside the storage change handler. - The logic of the StorageChange IPC recipient to update its ringbuffer with the new shared memory handle is complicated and was duplicated in a LOT of places. To address this, I introduced a new SharedRingBufferStorage::updateReadOnlyStorage() function which does exactly what we need. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: (WebKit::RemoteAudioSourceProviderProxy::create): (WebKit::RemoteAudioSourceProviderProxy::createRingBuffer): (WebKit::RemoteAudioSourceProviderProxy::storageChanged): * GPUProcess/media/RemoteAudioSourceProviderProxy.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::SharedRingBufferStorage::setStorage): (WebKit::SharedRingBufferStorage::updateReadOnlyStorage): (WebKit::SharedRingBufferStorage::allocate): (WebKit::SharedRingBufferStorage::deallocate): * Shared/Cocoa/SharedRingBufferStorage.h: (WebKit::SharedRingBufferStorage::SharedRingBufferStorage): (WebKit::SharedRingBufferStorage::storage const): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::storageChanged): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::storageChanged): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::AudioMediaStreamTrackRenderer): (WebKit::AudioMediaStreamTrackRenderer::storageChanged): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): (WebKit::MediaRecorderPrivate::storageChanged): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): 2020-12-17 Chris Dumez Unreviewed build fix after r270938. Add missing include. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: 2020-12-17 Chris Dumez [WebAudio] Simplify code related to dispatchToRenderThread https://bugs.webkit.org/show_bug.cgi?id=219990 Reviewed by Geoffrey Garen. Simplify code related to dispatchToRenderThread in WebAudio: 1. AudioDestination::start() now always gets called with a non-null dispatchToRenderThread lambda. In the case where there is no AudioWorkletThread to dispatch to, the lambda simply calls its task synchronously. 2. For Cocoa ports, make it so that only AudioDestinationCocoa needs to worry about the dispatchToRenderThread lambda. The dispatchToRenderThread lambda is no longer exposed to subclasses such as MockAudioDestinationCocoa & RemoteAudioDestinationProxy. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::startRenderingThread): (WebKit::RemoteAudioDestinationProxy::startRendering): (WebKit::RemoteAudioDestinationProxy::stopRendering): (WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-12-17 Alex Christensen Fix "Open with Preview" menu item in PDF context menus on Big Sur https://bugs.webkit.org/show_bug.cgi?id=219986 Reviewed by Geoffrey Garen. In r266654 I removed the ability for the web process to open a PDF in Preview on Big Sur. I overlooked the fact that context menus also allow you to open a PDF in Preview, which this fixes by having the UI process initiate the Preview opening if the user clicks on the context menu item with the correct index. * Shared/mac/PDFContextMenu.h: (WebKit::PDFContextMenu::encode const): (WebKit::PDFContextMenu::decode): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::showPDFContextMenu): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::handleContextMenuEvent): 2020-12-17 Kate Cheney Followup patch: Still can't login to my.playstation.com https://bugs.webkit.org/show_bug.cgi?id=219900 Reviewed by Darin Adler. Using curly quotes when constructing the Storage Access prompt message may create issues with localizable strings. We should make a separate localizable string for this quirk case and remove it when Sony migrates away from third party cookies in their login flow. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): (WebKit::buildListForStorageAccessPrompt): Deleted. * UIProcess/Cocoa/WKStorageAccessAlert.h: * UIProcess/Cocoa/WKStorageAccessAlert.mm: (WebKit::presentStorageAccessAlert): (WebKit::presentStorageAccessAlertQuirk): (WebKit::displayStorageAccessAlert): 2020-12-17 Eric Carlson [Cocoa] WebM format reader doesn't work with a url in a element https://bugs.webkit.org/show_bug.cgi?id=219961 Reviewed by Andy Estes. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-12-17 Chris Dumez [GPUProcess] Replace WebAudio rendering timer with a cross-process semaphore https://bugs.webkit.org/show_bug.cgi?id=219964 Reviewed by Geoff Garen. r270907 replaced the per-rendering quantum IPC from the GPUProcess to the WebProcess with a very high-frequency timer in the WebProcess to trigger the rendering. While this works, this seemed a bit fragile and it also adds some latency to avoid missed frames. In this patch, I am replacing the high-frequency timer introduced in r270907 with a cross-process semaphore. When the WebProcess asks the GPU process to create an audio device, the GPUProcess sends it back a MachSendRight to the "rendering" semaphore. The WebProcess then starts a high-priority AudioThread which waits this semaphore to be signaled to render a quantum. Whenever render() gets called on the GPUProcess side, the GPUProcess simply signals the "rendering" semaphore, causing the WebProcess to do the rendering of a quantum. As was the case before, the WebProcess stores rendered buffers into the RingBuffer it shares with the GPUProcess and the GPUProcess fetches from the RingBuffer as needed. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::createRenderSemaphoreSendRight): (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::render): (WebKit::RemoteAudioDestinationManager::createAudioDestination): * GPUProcess/media/RemoteAudioDestinationManager.h: * GPUProcess/media/RemoteAudioDestinationManager.messages.in: * Shared/Cocoa/SharedRingBufferStorage.cpp: * Shared/Cocoa/SharedRingBufferStorage.h: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::startRenderingThread): (WebKit::RemoteAudioDestinationProxy::stopRenderingThread): (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): (WebKit::RemoteAudioDestinationProxy::~RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::stop): (WebKit::RemoteAudioDestinationProxy::renderQuantum): (WebKit::RemoteAudioDestinationProxy::storageChanged): (WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-12-17 Patrick Angle Web Inspector: REGRESSION(r266467): viewing a WebSocket created before Web Inspector was opened doesn't show any message frames https://bugs.webkit.org/show_bug.cgi?id=219510 Reviewed by Youenn Fablet. Restored functionality prior to r266467 so that the `progressIdentifier` (previously `channelIdentifier`) is available from `WebSocketChannel`. * WebProcess/Network/WebSocketChannel.h: 2020-12-17 Rob Buis Make FontCascade::CodePath an enum class https://bugs.webkit.org/show_bug.cgi?id=219947 Reviewed by Alex Christensen. Adapt to enum class change. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setAlwaysUsesComplexTextCodePath): 2020-12-16 Peng Liu [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes https://bugs.webkit.org/show_bug.cgi?id=219956 Reviewed by Eric Carlson. Implement `SourceBufferPrivateRemote::bufferedSamplesForTrackId()` with a new IPC message. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::bufferedSamplesForTrackId): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::bufferedSamplesForTrackId): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-16 Jiewen Tan Unreviewed, a build fix for the latest Internal SDK * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: 2020-12-16 Kate Cheney Still can't login to my.playstation.com https://bugs.webkit.org/show_bug.cgi?id=219900 Reviewed by John Wilander. Adapted from an original patch by John Wilander. This is a temporary quirk to assist a high-traffic website while they complete the large task of migrating away from login flows that require third party cookies. This quirk will be removed when the site is updated. Create a quirk to call the Storage Access API on behalf of Sony. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::buildList): (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): * UIProcess/Cocoa/WKStorageAccessAlert.mm: (WebKit::presentStorageAccessAlert): Prompt for multiple domains if site-specific quirks are enabled and either Sony login domain is being requested. * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::hasCrossPageStorageAccess const): (WebKit::WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess): * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::addDomainWithPageLevelStorageAccess): Store both Sony login domains as having page level storage access if quirks are enabled and the domain passed is one of the Sony login domains. In this case we know that both login domains were prompted for. 2020-12-16 Chris Dumez [GPUProcess] Avoid doing an IPC per rendering quantum when using WebAudio https://bugs.webkit.org/show_bug.cgi?id=219818 Reviewed by Geoff Garen. Previously, the GPUProcess was sending an IPC to the WebProcess to request to rendering of each quantum, which was very inefficient and a big regression compared to when we do not use a GPUProcess. To address the issue, we now start a rendering timer on the WebProcess side when rendering starts, so that the WebProcess renders each quantum as needed, without needing an IPC from the GPUProcess. Whenever a quantum is rendered, the WebProcess adds it to the RingBuffer it shares with the GPUProcess. To make sure that the WebProcess' writer keeps up with the GPUProcess' reader and that it does not stray too far ahead, the writer keeps track of the last frame that the reader attempted to read. It uses this information to try and stay a few rendering quantums ahead of the GPUProcess, to avoid missed frames. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::RemoteAudioDestination): (WebKit::RemoteAudioDestination::render): * Platform/SharedMemory.h: (WebKit::SharedMemory::protection const): * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::SharedRingBufferStorage::sharedFrameBounds const): (WebKit::SharedRingBufferStorage::setCurrentFrameBounds): (WebKit::SharedRingBufferStorage::setLastReadFrame): (WebKit::SharedRingBufferStorage::lastReadFrame const): * Shared/Cocoa/SharedRingBufferStorage.h: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::startRenderingThread): (WebKit::RemoteAudioDestinationProxy::stopRenderingThreadIfNecessary): (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): (WebKit::RemoteAudioDestinationProxy::~RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::startRendering): (WebKit::RemoteAudioDestinationProxy::stop): (WebKit::RemoteAudioDestinationProxy::stopRenderingIfNecessary): (WebKit::RemoteAudioDestinationProxy::renderQuantum): (WebKit::RemoteAudioDestinationProxy::storageChanged): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: (WebKit::RemoteAudioDestinationProxy::stopRenderingIfNecessary): * WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in: Removed. 2020-12-16 Youenn Fablet REGRESSION [iOS] Flaky GPU Process crash under -[RTCVideoEncoderH264 destroyCompressionSession] https://bugs.webkit.org/show_bug.cgi?id=219899 Reviewed by Alex Christensen. We can no longer get the connection when needed as we are now operating in a background thread. For that reason, capture the IPC connection in the lambda to make sure we have a valid IPC connection. Remove LibWebRTCCodecsProxy when being closed instead of when being destroyed as well. Covered by existing tests. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::~LibWebRTCCodecsProxy): (WebKit::LibWebRTCCodecsProxy::close): (WebKit::LibWebRTCCodecsProxy::createH264Decoder): (WebKit::LibWebRTCCodecsProxy::createH265Decoder): (WebKit::LibWebRTCCodecsProxy::createVP9Decoder): (WebKit::LibWebRTCCodecsProxy::createEncoder): 2020-12-16 Wenson Hsieh Suppress the image extraction interaction while editing text https://bugs.webkit.org/show_bug.cgi?id=219952 Reviewed by Devin Rousso. See radar and WebKitAdditions for more details. * UIProcess/ios/WKContentViewInteraction.h: (WebKit::SuppressInteractionToken::SuppressInteractionToken): (WebKit::SuppressInteractionToken::~SuppressInteractionToken): Add a helper class to help facilitate the temporary removal of UIInteraction objects from a WKContentView. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setIsEditable:]): Use the above helper class to temporarily remove the image extraction interaction while the user is editing text (and is therefore depending on editable text interaction gestures). Note that we avoid unnecessarily clearing out and resetting this member variable when changing focus between editable text fields. (-[WKContentView _didStartProvisionalLoadForMainFrame]): 2020-12-16 Brent Fulgham REGRESSION (r270657) [AS Only] GGE: Netflix, YouTube, Amazon Prime, and Hulu fail to playback https://bugs.webkit.org/show_bug.cgi?id=219954 Reviewed by Per Arne Vollan. Correct a syntax error in a sandbox rule added in r270657. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-15 Simon Fraser Calls to setFixedLayoutSize() should not be inside ENABLE(TEXT_AUTOSIZING) https://bugs.webkit.org/show_bug.cgi?id=219932 Reviewed by Wenson Hsieh. We always want to call setFixedLayoutSize(), whether or not ENABLE(TEXT_AUTOSIZING) is defined. For code simplicity, make resetTextAutosizing() an empty function when ENABLE(TEXT_AUTOSIZING) is not defined. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): (WebKit::WebPage::resetTextAutosizing): (WebKit::WebPage::viewportConfigurationChanged): 2020-12-16 Per Arne Vollan [macOS] Add sandbox parameter for message filter entitlement status https://bugs.webkit.org/show_bug.cgi?id=219852 Reviewed by Brent Fulgham. Add sandbox parameter to determine whether the WebContent process has message filter entitlement. This parameter will be used in the sandbox to enable message filtering. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-16 Youenn Fablet Make sure WebKit WebSocketChannel handle suspend/resume correctly https://bugs.webkit.org/show_bug.cgi?id=219910 Reviewed by Alex Christensen. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::fail): Make sure fail triggers close event if page resumes. 2020-12-15 Pablo Saavedra [CMake][WPE] Add LibWPE before WPEBackend-FDO for qtwpe_INCLUDE_DIRECTORIES https://bugs.webkit.org/show_bug.cgi?id=219920 Reviewed by Michael Catanzaro. * PlatformWPE.cmake: 2020-12-15 Commit Queue Unreviewed, reverting r270829. https://bugs.webkit.org/show_bug.cgi?id=219935 Introduced crash Reverted changeset: "[macOS] Add sandbox parameter for message filter entitlement status" https://bugs.webkit.org/show_bug.cgi?id=219852 https://trac.webkit.org/changeset/270829 2020-12-15 Andy Estes [Mac] Numerous webgl tests continue to time out with the WebM format reader enabled https://bugs.webkit.org/show_bug.cgi?id=219928 Reviewed by Eric Carlson. Covered by existing tests. * Shared/mac/MediaFormatReader/TrackReader.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): (WebKit::MediaSampleByteRange::trackID const): (WebKit::TrackReader::addSample): Store MediaSampleByteRange's track ID as a uint64_t instead of an AtomString that might've been created on another thread. (WebKit::TrackReader::finalize): Ensure that m_sampleStorage really is destroyed on the storage queue by explicitly settings its unique_ptr to nullptr in the lambda. Without doing this, it's possible that the lambda will execute on the storage queue *before* WorkQueue::dispatch returns, and since WorkQueue's BlockPtr is still holding a reference to the block containing the lambda, it would not have been destroyed on the storage queue. 2020-12-15 Per Arne Vollan [macOS, iOS] Add required mach syscall https://bugs.webkit.org/show_bug.cgi?id=219913 Reviewed by Brent Fulgham. Add required mach syscall on macOS and iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-12-15 Wenson Hsieh Image extraction interaction should remain active while scrolling https://bugs.webkit.org/show_bug.cgi?id=219895 Reviewed by Devin Rousso. Make our image extraction interaction behave more like the rest of the system by making it persist until explicitly dismissed via tap gesture (or any other competing interaction, such as text interactions, drag interactions and context menu interactions, as long as the interaction location is outside of the active image extraction interaction). We currently just dismiss any active image extraction upon starting a new touch, which prevents scrolling from working as expected with image extraction. See radar for more details. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): (-[WKContentView _singleTapIdentified:]): (-[WKContentView _dragInteraction:prepareForSession:completion:]): (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]): 2020-12-15 Kate Cheney CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper Reviewed by Alex Christensen. Followup patch to add missing completion handlers. This also moves the check for a null m_networkSession variable to the existing PrivateClickMeasurementManager::featureEnabled() function for simplicity. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::clearSentAttributions): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::featureEnabled const): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): 2020-12-15 Simon Fraser Add batching to WebPreferences updates https://bugs.webkit.org/show_bug.cgi?id=219878 Reviewed by Sam Weinig. WebPreferences::resetAllInternalDebugFeatures() and WebPreferences::enableAllExperimentalFeatures() would trigger tens of calls to WebPageProxy::preferencesDidChange(). Fix by adding batching, and only firing update() at the end of any prefs changed. * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::update): (WebKit::WebPreferences::startBatchingUpdates): (WebKit::WebPreferences::endBatchingUpdates): * UIProcess/WebPreferences.h: (WebKit::WebPreferences::UpdateBatch::UpdateBatch): (WebKit::WebPreferences::UpdateBatch::~UpdateBatch): 2020-12-15 Youenn Fablet Fix alertMessageText regression from https://trac.webkit.org/changeset/269918 https://bugs.webkit.org/show_bug.cgi?id=219891 Reviewed by Eric Carlson. alertMessageText was checking twice for audio while it should check once for audio and once for video. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::alertMessageText): 2020-12-15 Ryan Hostetler "make clean" fails on EmptyDSTROOT target https://bugs.webkit.org/show_bug.cgi?id=219870 rdar://72309233 Reviewed by Alexey Proskuryakov. make clean can't find PROJECT_NAME for EmptyDSTROOT. * WebKit.xcodeproj/project.pbxproj: 2020-12-15 Andy Estes [Mac] Numerous webgl tests time out with WebM format reader enabled https://bugs.webkit.org/show_bug.cgi?id=219887 Reviewed by Eric Carlson. When rendering a video frame to canvas, SampleCursor is invoked on the main thread in order to find a sync frame to render. This triggered an ASSERT(!isMainThread()) in debug builds, and possibly a deadlock if the cursor pointed to a sample that hadn't yet been parsed (because SourceBufferParser calls the 'didProvideMediaData' callback on the main thread). Resolve this by having SourceBufferParser provide parsed samples on a background queue. To avoid creating AtomStrings on this non-main queue, teach TrackReader to access the trackID as a uint64_t instead. * Shared/mac/MediaFormatReader/FormatReader.cpp: (WebKit::FormatReader::startOnMainThread): (WebKit::readerQueue): (WebKit::FormatReader::parseByteSource): (WebKit::FormatReader::didParseTracks): (WebKit::FormatReader::didProvideMediaData): (WebKit::FormatReader::finishParsing): (WebKit::FormatReader::copyTrackArray): * Shared/mac/MediaFormatReader/TrackReader.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): (WebKit::TrackReader::create): (WebKit::TrackReader::storageQueue): (WebKit::TrackReader::TrackReader): (WebKit::TrackReader::addSample): (WebKit::TrackReader::waitForSample const): (WebKit::TrackReader::finishParsing): (WebKit::TrackReader::finalize): * Shared/mac/MediaFormatReader/TrackReader.h: 2020-12-15 Chris Dumez [GPUProcess] Crash under AudioDestinationCocoa::setIsPlaying(bool) https://bugs.webkit.org/show_bug.cgi?id=219809 Reviewed by Youenn Fablet. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): 2020-12-15 Per Arne Vollan [macOS] Add sandbox parameter for message filter entitlement status https://bugs.webkit.org/show_bug.cgi?id=219852 Reviewed by Brent Fulgham. Add sandbox parameter to determine whether the WebContent process has message filter entitlement. This parameter will be used in the sandbox to enable message filtering. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-15 Carlos Garcia Campos [SOUP] WebSockets: wrong data sent in some cases with libsoup < 2.68 https://bugs.webkit.org/show_bug.cgi?id=219850 Reviewed by Michael Catanzaro. We are using soup_websocket_connection_send_text() when libsoup < 2.68, which expects a null terminated string, but we are receiving a IPC::DataReference that needs to be converted to a null terminated string by taking into account its size. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::sendString): 2020-12-14 Peng Liu [Media in GPU Process][MSE] VP9 stream playback is not smooth https://bugs.webkit.org/show_bug.cgi?id=219861 Reviewed by Eric Carlson. Add two new IPC messages in `RemoteMediaSourceProxy` to set `m_isSeeking` and `m_timeFudgeFactor` of the `MediaSourcePrivate` running in the GPU process. * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::setIsSeeking): (WebKit::RemoteMediaSourceProxy::setTimeFudgeFactor): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteMediaSourceProxy.messages.in: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::setIsSeeking): (WebKit::MediaSourcePrivateRemote::setTimeFudgeFactor): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: 2020-12-14 Per Arne Vollan REGRESSION (r270677-r270693): Catalina Perf tests failing https://bugs.webkit.org/show_bug.cgi?id=219802 Reviewed by Brent Fulgham. Create extension for RootDomainUserClient also for Intel Macs, and move logging rules outside of HAVE(SANDBOX_MESSAGE_FILTERING) section in sandbox. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedIOKitClasses): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-14 Alex Christensen Fix null dereference in WKURLCopyCFURL https://bugs.webkit.org/show_bug.cgi?id=219877 Reviewed by Geoffrey Garen. We had an optimistic assertion and crash reports indicating that it is not always true. When it's not, return null instead of crashing. * Shared/API/c/cf/WKURLCF.mm: (WKURLCopyCFURL): 2020-12-14 Chris Dumez Unreviewed, reverting r270768. Still crashes in debug in a different location Reverted changeset: "[GPUProcess] Crash under AudioDestinationCocoa::setIsPlaying(bool)" https://bugs.webkit.org/show_bug.cgi?id=219809 https://trac.webkit.org/changeset/270768 2020-12-14 Peng Liu [Media in GPU Process][MSE] Fix crashes in a debug build https://bugs.webkit.org/show_bug.cgi?id=219874 Reviewed by Eric Carlson. We need to call the completion handler in error cases. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment): 2020-12-14 Chris Dumez [GPUProcess] Bump QoS to UserInteractive for real-time audio rendering thread https://bugs.webkit.org/show_bug.cgi?id=219873 Reviewed by Eric Carlson. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): 2020-12-14 Peng Liu [Media in GPU Process][MSE] WebM source buffer parser is not enabled https://bugs.webkit.org/show_bug.cgi?id=219857 Reviewed by Eric Carlson. Share the value of `RuntimeEnabledFeatures::sharedFeatures().webMParserEnabled()` with the GPU process (`RemoteMediaSourceProxy`) when `MediaPlayerPrivateRemote` tries to load a media source. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::addSourceBuffer): * GPUProcess/media/RemoteMediaSourceProxy.h: * Shared/mac/MediaFormatReader/FormatReader.cpp: (WebKit::FormatReader::parseByteSource): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::load): * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::addSourceBuffer): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: 2020-12-14 Chris Dumez [GPUProcess] Crash in SharedRingBufferStorage::setStorage() under GuardMalloc https://bugs.webkit.org/show_bug.cgi?id=219867 Reviewed by Darin Adler. SharedRingBufferStorage was holding a raw pointer to its client and we would sometimes crash when dereferencing this client in SharedRingBufferStorage::setStorage() because the client is not guaranteed to be alive. To address the issue, I replace the SharedRingBufferStorage::Client with a lambda so that the client can protect itself in the lambda if needed. In particular, RemoteAudioSourceProviderProxy now protects itself in the lambda since the lifetime of the CARingBuffer is not tied to the lifetime of RemoteAudioSourceProviderProxy. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::RemoteAudioDestination): * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: (WebKit::RemoteAudioSourceProviderProxy::createRingBuffer): * GPUProcess/media/RemoteAudioSourceProviderProxy.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::RemoteAudioMediaStreamTrackRenderer): * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::RemoteMediaRecorder): * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::SharedRingBufferStorage::setStorage): * Shared/Cocoa/SharedRingBufferStorage.h: (WebKit::SharedRingBufferStorage::SharedRingBufferStorage): (WebKit::SharedRingBufferStorage::invalidate): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::storageChanged): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::m_ringBuffer): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::RemoteAudio): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::AudioMediaStreamTrackRenderer): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::Source): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::storageChanged): * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::RemoteAudio): 2020-12-14 Kate Cheney CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper Reviewed by Alex Christensen. No new tests, this should fix a crash. m_networkSession is a weakPtr. We should check that the object it references exists before trying to use it. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::clearSentAttributions): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): 2020-12-14 Tim Horton Adopt symbol image API instead of SPI in WKPDFHUDView https://bugs.webkit.org/show_bug.cgi?id=219866 Reviewed by Wenson Hsieh. * UIProcess/PDF/WKPDFHUDView.mm: (-[WKPDFHUDView _getImageForControlName:]): 2020-12-14 Pablo Saavedra [GLIB] Missing header for std::once_flag in WebKitInitialize.cpp https://bugs.webkit.org/show_bug.cgi?id=219865 Reviewed by Alex Christensen. * UIProcess/API/glib/WebKitInitialize.cpp: 2020-12-14 Wenson Hsieh GPU process sometimes hangs during MotionMark Focus when enabling GPU Process for DOM https://bugs.webkit.org/show_bug.cgi?id=219839 Reviewed by Tim Horton. Fixes an indefinite hang in the GPU process that may occur as a result of this very specific corner case in concurrent display list processing: [1] Let p and q represent two item buffers, and let A and B represent two remote image buffers whose drawing contexts will be destinations for display list playback in the GPU process. Suppose p has k remaining bytes where k >= 32, and A's writable buffer is mapped to a region closest to the end of p. In practice, when this hang reproduces, k is a relatively small number (typically 32-40 bytes). [2] Additionally, suppose that the GPU process is not reading from q (i.e. q's `unreadBytes()` count is 0), and that the GPU process has created a corresponding RemoteImageBuffer for A, but *not* a corresponding RemoteImageBuffer for B. [3] We now append a MetaCommandChangeDestinationImageBuffer item to change destinations from A to B, such that p now has (k - 16) remaining bytes. In preparation for appending new items for B's display list, the logic in `RemoteRenderingBackendProxy::willAppendItem` clears B's writable buffer, with the intention that B will turn around and call out to the client layer for a new writable buffer again once it notices that it has no writable buffer. [4] If we then immediately try to append an item to B that is larger than (k - 32) bytes, `RemoteRenderingBackendProxy::findReusableDisplayListHandle` will see that the most recently used item buffer p has insufficient space, and will instead return item buffer q. We end up appending the new item to item buffer q. [5] In the GPU process, we finish processing all available item data in p. When we encounter the destination buffer change item, we set `m_pendingWakeupInfo` before going to sleep, due to the fact that the GPU process has not learned about image buffer B yet (see the last part of step [2]). [6] Later, in the GPU process, when we create a RemoteImageBuffer for B, we see that we have a `m_pendingWakeupInfo` with destination image buffer B, so we resume display list processing. However, we're unable to resume where we stopped, since B's display list (in the web process) immediately appended to q instead of p, skipping MetaCommandChangeItemBuffer in the process. This manifests as an indefinite hang inside `RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists`, since we expect p to have a nonzero `unreadBytes()` count. [7] Now that the GPU process is in a broken state, the web process follows shortly -- in the Focus subtest of MotionMark, this manifests as a web process crash soon after the GPU process begins to hang, because `RemoteImageBufferProxy::ensureBackendCreated()` times out and returns null, and we subsequently dereference null in `RemoteLayerBackingStore::encode()` after failing to ensure the image buffer backend. To fix this, we target step [3]. Rather than clear B's writable buffer and expect it to append its new items to p, we simply hand it p's item handle -- in this case, a handle with (k - 16) available bytes -- and set its writable buffer before we try to append. In this scenario, doing this ensures that if we are about to append an item that is larger than (k - 32) bytes, we will first leave a 16-byte MetaCommandChangeItemBuffer item inside p before moving on to q. This eventually ensures that when the GPU process resumes display list processing after creating a RemoteImageBuffer for B, it will see 16 unread bytes in p and then immediately continue reading data from item buffer q. Finally, note that in this scenario, p is always guaranteed to contain at least 16 available bytes after step [3] (in other words, k >= 32). This is because all calls to append an item of size n bytes to an item buffer check that there is a minimum (n + 16) bytes remaining (via logic in `ItemBuffer::swapWritableBufferIfNeeded`), such that it is, by design, always possible to append a `MetaCommandChangeItemBuffer` item if necessary. As such, it is safe to return the most recently used item buffer's handle in step [4]. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::clearDisplayList): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::willAppendItem): Call into `prepareToAppendDisplayListItems` instead of `clearDisplayList` when switching destination image buffers. See problem diagnosis above for more detail. (WebKit::RemoteRenderingBackendProxy::mostRecentlyUsedDisplayListHandle): Pull logic to retrieve the most recently used display list handle out into a separate helper method. (WebKit::RemoteRenderingBackendProxy::findReusableDisplayListHandle): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-14 Sihui Liu WebProcessProxy::destroySpeechRecognitionServer should check if identifier exists before removing MessageReceiver https://bugs.webkit.org/show_bug.cgi?id=219815 Reviewed by Youenn Fablet. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::destroySpeechRecognitionServer): 2020-12-14 Chris Dumez Drop duplicate call to makeUniqueRef() in RemoteAudioSourceProviderProxy::createRingBuffer() https://bugs.webkit.org/show_bug.cgi?id=219859 Reviewed by Youenn Fablet. * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: (WebKit::RemoteAudioSourceProviderProxy::createRingBuffer): 2020-12-14 Youenn Fablet Make sure WebProcessPool::setUseSeparateServiceWorkerProcess handles correctly destroyed process pools https://bugs.webkit.org/show_bug.cgi?id=219773 Reviewed by Alex Christensen. Terminating a service worker process may destroy the web process pool. Copy the vector of process pools before iterating over it to terminate service worker processes. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setUseSeparateServiceWorkerProcess): 2020-12-14 Alex Christensen Remove WKDownloadDelegate.didWriteData https://bugs.webkit.org/show_bug.cgi?id=219820 Reviewed by Sam Weinig. API review revealed it was redundant with WKDownload.progress, which has KVO-compliant totalUnitCount and completedUnitCount. * UIProcess/API/Cocoa/WKDownload.mm: (-[WKDownload progress]): * UIProcess/API/Cocoa/WKDownloadDelegate.h: 2020-12-14 Andy Estes [Mac] Enable `webm_format_reader` feature flag by default https://bugs.webkit.org/show_bug.cgi?id=219858 Reviewed by Eric Carlson. * FeatureFlags/WebKit.plist: 2020-12-14 Wenson Hsieh Web process crashes during MotionMark Images when GPU Process for DOM is enabled https://bugs.webkit.org/show_bug.cgi?id=219838 Reviewed by Simon Fraser. It's possible to return prematurely with a null backend when waiting for image buffer backend creation under `RemoteImageBufferProxy::ensureBackendCreated()`. Consider the following scenario (where WEB and GPU denote events that occur in the web and GPU processes, respectively): 1. (WEB) RemoteImageBufferProxy A is created in the web process. 2. (GPU) RemoteImageBuffer A is created in the GPU process, along with an image buffer backend for A. 3. (WEB) RemoteImageBufferProxy B is created in the web process. 4. (GPU) RemoteImageBuffer B is created in the GPU process, along with an image buffer backend for B. 5. (WEB) Something calls `RemoteImageBufferProxy::ensureBackendCreated()` on B. 6. (WEB) We receive the `RemoteRenderingBackendProxy::DidCreateImageBufferBackend` message for A. B subsequently finishes waiting for backend creation because it incorrectly believes that its backend has been initialized, and we end up crashing downstream in `RemoteLayerBackingStore::encode()` because `ensureBackendCreated()` for B returned null. To fix this, we adopt a similar strategy to what we use in `waitForDidFlushWithTimeout()`, and repeatedly call `waitForDidCreateImageBufferBackend()` until the backend has been created (allowing for an arbitrary number of IPC timeouts or failures). Since this counter is only incremented upon timeout (or any other kind of IPC communication failure), we'll simply receive `RemoteRenderingBackendProxy::DidCreateImageBufferBackend` messages until we confirm (in the web process) that the current image buffer's backend has been initialized. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend): Drive-by fix: clarify this code by returning an enum to indicate whether or not we successfully received a backend creation IPC response from the GPU process, instead of just returning a bool. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-14 Sihui Liu Implement recognizer for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=219459 Reviewed by Youenn Fablet. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::invalidate): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): 2020-12-14 Chris Dumez [GPUProcess] Crash under AudioDestinationCocoa::setIsPlaying(bool) https://bugs.webkit.org/show_bug.cgi?id=219809 Reviewed by Eric Carlson. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::create): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/WebMediaStrategy.cpp: (WebKit::WebMediaStrategy::createAudioDestination): * WebProcess/GPU/media/WebMediaStrategy.h: 2020-12-14 Carlos Garcia Campos [WPE][GTK] Should enable WebProcessCache https://bugs.webkit.org/show_bug.cgi?id=219689 Reviewed by Adrian Perez de Castro. * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextConstructed): 2020-12-13 Yusuke Suzuki [JSC] Introduce vmEntryCustomAccessor and vmEntryHostFunction for JITCage https://bugs.webkit.org/show_bug.cgi?id=219847 Reviewed by Mark Lam. * Shared/WebKitJITOperations.cpp: (WebKit::populateJITOperations): 2020-12-13 Andy Estes [Mac] Create a MediaToolbox format reader plug-in for WebM https://bugs.webkit.org/show_bug.cgi?id=218908 Reviewed by Eric Carlson. Implemented a MTPluginFormatReader for WebM containers. The format reader is responsible for parsing a WebM byte stream (using SourceBufferParserWebM) into audio, video, and text tracks. MediaToolbox can then create cursors to step through the tracks' samples in decode or presentation order and access each sample's metadata (e.g., format description, duration, key-frame status) and location in the byte stream. * FeatureFlags/WebKit.plist: * MediaFormatReaderPlugIn/Info.plist: * MediaFormatReaderPlugIn/MediaFormatReaderPlugIn.cpp: * Shared/API/c/mac/WKFormatReader.cpp: Added. * Shared/API/c/mac/WKFormatReader.h: Added. * Shared/WebPreferencesDefaultValues.cpp: * Shared/WebPreferencesDefaultValues.h: * Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp: Added. * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: Added. * Shared/mac/MediaFormatReader/FormatReader.cpp: Added. * Shared/mac/MediaFormatReader/FormatReader.h: Added. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: Added. * Shared/mac/MediaFormatReader/MediaFormatReader.h: Added. * Shared/mac/MediaFormatReader/SampleCursor.cpp: Added. * Shared/mac/MediaFormatReader/SampleCursor.h: Added. * Shared/mac/MediaFormatReader/TrackReader.cpp: Added. * Shared/mac/MediaFormatReader/TrackReader.h: Added. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2020-12-13 Tim Horton Fix the watchOS build after r270712 * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent): 2020-12-12 Jiewen Tan [WebAuthn][iOS] Turn on modern WebAuthn for default browsers https://bugs.webkit.org/show_bug.cgi?id=219823 Reviewed by Brent Fulgham. Covered by manual tests. This patch turns on modern WebAuthn on iOS by default. In addition to that, it turns on WebAuthn for all default browsers. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebCore::isWebBrowser): (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): For apps that turn on WebAuthn by overriding the experimental feature settings, return silently. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences) Does the meat. 2020-12-12 Alexander Mikhaylenko [GTK4] Web view is incorrectly scaled on hidpi https://bugs.webkit.org/show_bug.cgi?id=218353 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): Account for the scale factor. 2020-12-12 Commit Queue Unreviewed, reverting r270692. https://bugs.webkit.org/show_bug.cgi?id=219828 Introduced crash Reverted changeset: "[macOS] Remove access to com.apple.MTLCompilerService in the WebContent process" https://bugs.webkit.org/show_bug.cgi?id=219774 https://trac.webkit.org/changeset/270692 2020-12-12 Wenson Hsieh Unreviewed, reverting r270674. Broke web content rendering on iOS Reverted changeset: "[iOS] Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process" https://bugs.webkit.org/show_bug.cgi?id=219733 https://trac.webkit.org/changeset/270674 2020-12-11 Peng Liu [Media in GPU Process][MSE] Implement SourceBuffer::reportExtraMemoryAllocated() https://bugs.webkit.org/show_bug.cgi?id=219812 Reviewed by Eric Carlson. Add a new IPC message `SourceBufferPrivateReportExtraMemoryCost` to forward the callback to the web process. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReportExtraMemoryCost): * GPUProcess/media/RemoteSourceBufferProxy.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateReportExtraMemoryCost): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: 2020-12-11 Jiewen Tan [WebAuthn] Adopt new UI for the Platform Authenticator getAssertion flow https://bugs.webkit.org/show_bug.cgi?id=219710 Reviewed by Brent Fulgham. This patch adopts the new UI for the platform authenticator getAssertion flow. It's more or less the same as the security key one except an LAContext will be passed in from the UI. Now LocalAuthenticator will just utilize the LAContext from the UI. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::~AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::didSelectAssertionResponse): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): 2020-12-11 John Wilander PCM: Change debugModeSecondsUntilSend from 60 seconds to 10 seconds https://bugs.webkit.org/show_bug.cgi?id=219816 Unreviewed change to a constant, only used for debugging. * NetworkProcess/PrivateClickMeasurementManager.cpp: debugModeSecondsUntilSend changed to 10 seconds. (WebKit::PrivateClickMeasurementManager::attribute): Fixed bad indentation. 2020-12-11 Ryosuke Niwa [GPU Process] Cache Font objects https://bugs.webkit.org/show_bug.cgi?id=219672 Reviewed by Wenson Hsieh. Partially based on the patch made by Said Abou-Hallawa. This patch introduces a mechanism to cache Font objects in the GPU process much the same way NativeImage objects are cached in the GPU process, and re-enables Web Fonts. Fonts are removed from the GPU process when either they hadn't been used for 4 rendering updates or a memory warning has been issued. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::submit): Added the font cache. (WebKit::RemoteRenderingBackend::cacheFont): Added. (WebKit::RemoteRenderingBackend::deleteAllFonts): Added. * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: Added CacheFont and DeleteAllFonts as new IPC messages. * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheFont): Added. (WebKit::RemoteResourceCache::deleteAllFonts): Added. Used when a memory warning is issued. * GPUProcess/graphics/RemoteResourceCache.h: (WebKit::RemoteResourceCache::fonts const): Added. * Platform/IPC/FontReference.h: Added. (IPC::FontReference): Added. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): Added FontReference. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): Encode the rendering resource identifier of Font. (IPC::ArgumentCoder>::decode): Ditto for decoding. * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::cacheFont): Added. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::cacheFont): Added. (WebKit::RemoteRenderingBackendProxy::deleteAllFonts): Added. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::cacheFont): Added. It updates the total number of fonts being used since the last rendering update and records the self assigned identifier for the next rendering update. (WebKit::RemoteResourceCacheProxy::didFinalizeRenderingUpdate): Added. Called at the end of each rendering update. It removes all fonts unused in the lsat 4 rendering updates if at least 1/4 of the fonts in the GPU process were not used in this rendering update. (WebKit::RemoteResourceCacheProxy::releaseMemory): Added. Removes all the fonts to free up memory when a memory warning is issued. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: (WebKit::RemoteResourceCacheProxy): Added m_fontLastRenderingUpdateMap which keeps track of the rendering resource identifiers of the fonts cached in the GPU process. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Re-enables the Web Fonts. (WebKit::WebPage::finalizeRenderingUpdate): Added the call to RemoteRenderingBackendProxy's didFinalizeRenderingUpdate. (WebKit::WebPage::releaseMemory): Added. Calls RemoteRenderingBackendProxy's function. * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): Added the call to WebPage::releaseMemory in the memory pressure handler. (WebKit::WebProcess::prepareToSuspend): Ditto for the process suspension. 2020-12-11 Jiewen Tan [WebAuthn] Adopt new UI for the Security Key getAssertion flow https://bugs.webkit.org/show_bug.cgi?id=219711 Reviewed by Brent Fulgham. This patch adopts the new UI for the security key getAssertion flow which contains two part: 1. showing a informative UI to ask the user to connect their security keys, 2. showing an account picker for users to select a credential to use. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: Paperwork. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::didSelectAssertionResponse): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): Implements the two flows. 2020-12-11 John Wilander PCM: Add feature flag support in the network process https://bugs.webkit.org/show_bug.cgi?id=219811 Reviewed by Alex Christensen. No new tests. This just forwards a preference to the network process. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): Stores the incoming enablePrivateClickMeasurement from WebKit::NetworkProcessCreationParameters. (WebKit::NetworkProcess::setPrivateClickMeasurementEnabled): (WebKit::NetworkProcess::privateClickMeasurementEnabled const): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: New field enablePrivateClickMeasurement. (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): Early return if the feature is not enabled. (WebKit::PrivateClickMeasurementManager::handleAttribution): Early return if the feature is not enabled. (WebKit::PrivateClickMeasurementManager::fireConversionRequest): Early return if the feature is not enabled. (WebKit::PrivateClickMeasurementManager::featureEnabled const): New convenience function. * NetworkProcess/PrivateClickMeasurementManager.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): Sets the new enablePrivateClickMeasurement in WebKit::NetworkProcessCreationParameters. 2020-12-11 Jiewen Tan Unreviewed, build fix after r270694 * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): Adds a instance method guard for new SPI. 2020-12-11 Jer Noble [Cocoa] Add Experimental VP8 support https://bugs.webkit.org/show_bug.cgi?id=219732 Reviewed by Eric Carlson. Add new WebPageCreationParameter flags to enable VP8 decoders in the WebContent and GPU processes when the experimental feature is enabled. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::enableVP9Decoders): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::enableVP9Decoders): * GPUProcess/GPUProcess.h: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultVP8DecoderEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::updateParameters): * WebProcess/GPU/GPUProcessConnection.h: (WebKit::GPUProcessConnection::isVP8DecoderEnabled const): * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP8SWDecoder): * WebProcess/WebProcess.h: 2020-12-11 Chris Dumez Potential null dereference of m_frame under DocumentLoader::stopLoading() https://bugs.webkit.org/show_bug.cgi?id=219786 Reviewed by Geoffrey Garen. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): Add some release logging. 2020-12-11 Tim Horton Fix the iOS !UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_HANDLING build. * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent): 2020-12-11 Tim Horton Trackpad and Mouse scroll events on iPad only fire "pointermove" -- not "wheel" https://bugs.webkit.org/show_bug.cgi?id=210071 Reviewed by Simon Fraser. * Platform/spi/ios/UIKitSPI.h: Add some SPI. * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: (toWebPhase): (WebIOSEventFactory::createWebWheelEvent): Add a UIScrollEvent->WebWheelEvent conversion helper. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setupScrollAndContentViews]): Enable async UIScrollEvent handling for WKScrollView. (-[WKWebView _scrollView:asynchronouslyHandleScrollEvent:completion:]): Adopt new UIKit SPI to asynchronously defer UIScrollEvents. We pass them to the Web Content process, where they are processed *only* for event handling, not for scrolling. If the event is not cancelable, we will synchronously reply that it was not handled; if it is cancelable, or we don't yet know if it will be, we'll wait to hear back from the Web Content process before replying. UIKit will wait until our reply to apply the UIScrollEvent to the UIScrollView. * UIProcess/PageClient.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::eventListenerTypesAtPoint): Expose a mechanism for retrieving the event listener types at a given point, similar to the existing mechanism for touch event listeners. (-[WKChildScrollView initWithFrame:]): Enable async UIScrollEvent handling for WKChildScrollView. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate _scrollView:asynchronouslyHandleScrollEvent:completion:]): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::handleAsynchronousCancelableScrollEvent): Plumb async scroll events for sub-scrollable regions through PageClient to WKWebView; we don't actually care which UIScrollView they're handed to, since we re-hit-test ourselves. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchWheelEventWithoutScrolling): * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::handleAsynchronousCancelableScrollEvent): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::wheelEvent): (WebKit::WebPage::dispatchWheelEventWithoutScrolling): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-12-11 Brent Fulgham Expose API for enabling/disabling Private Click Measurement https://bugs.webkit.org/show_bug.cgi?id=219791 Reviewed by Alex Christensen. Tested by existing PCM test cases. This patch moves the flag for enabling and disabling PCM support from the Experimental features settings to standard settings in preparation for exposing the option in more permanent UI. This patch does not make any changes in behavior. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _privateClickMeasurementEnabled]): (-[WKPreferences _setPrivateClickMeasurementEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2020-12-11 Peng Liu [Media in GPU Process][MSE] Implement some required functions with new IPC messages and remove some unneeded functions https://bugs.webkit.org/show_bug.cgi?id=219788 Reviewed by Eric Carlson. Implement unimplemented functions and remove unneeded ones. This patch also cleans up `RemoteSourceBufferProxy`. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateStreamEndedWithDecodeError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidDropSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError): * GPUProcess/media/RemoteSourceBufferProxy.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateStreamEndedWithDecodeError): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendError): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidDropSample): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveRenderingError): (WebKit::SourceBufferPrivateRemote::flush): Deleted. (WebKit::SourceBufferPrivateRemote::isReadyForMoreSamples): Deleted. (WebKit::SourceBufferPrivateRemote::notifyClientWhenReadyForMoreSamples): Deleted. (WebKit::SourceBufferPrivateRemote::canSetMinimumUpcomingPresentationTime const): Deleted. (WebKit::SourceBufferPrivateRemote::setMinimumUpcomingPresentationTime): Deleted. (WebKit::SourceBufferPrivateRemote::clearMinimumUpcomingPresentationTime): Deleted. * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: 2020-12-11 Chris Dumez [GPUProcess] WebAudio rendering quantum is 15 instead of 128 when the GPU Process is enabled https://bugs.webkit.org/show_bug.cgi?id=219797 Reviewed by Eric Carlson. WebAudio rendering quantum is 15 instead of 128 when the GPU Process is enabled. This generates a lot more IPC unnecessarily, not to mention how WebAudio code expects a rendering quantum of 128 and could potentially do bad things with a lower value. The issue was that RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess() was iterating over all RemoteAudioSessionProxy objects to find out the lowest rendering quantum. If there is a proxy with a preferred buffer size that is not set, the value ends up being 0. When then ask core audio for a rendering quantum of 0, and they end up using 15 (likely the minimum). * GPUProcess/media/RemoteAudioSessionProxyManager.cpp: (WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess): 2020-12-11 Don Olmstead [PlayStation] Link additional libraries into processes after r270690 https://bugs.webkit.org/show_bug.cgi?id=219795 Unreviewed build fix after r270690. Some libraries were being propagated from WebKit before the change so just add them to the Process_PRIVATE_LIBRARIES. * PlatformPlayStation.cmake: 2020-12-11 Fujii Hironori [WinCairo] Enable accelerated WebGL canvas https://bugs.webkit.org/show_bug.cgi?id=219768 Reviewed by Don Olmstead. prepareForRendering should be called before calling flushPendingLayerChanges to make the GL context current because it uses OpenGL API. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::compositeLayersToContext): (WebKit::LayerTreeHost::flushAndRenderLayers): 2020-12-10 Jiewen Tan [WebAuthn] Adopt new UI for the Platform Authenticator makeCredential flow https://bugs.webkit.org/show_bug.cgi?id=219709 Reviewed by Brent Fulgham. This patch adopts the new UI for the platform authenticator makeCredential flow. In this new design, the UI will be responsible for creating the LAContext and get it verified by the user. Therefore, WebKit just needs to reverify the LAContext in non-UI mode against the SecAccessControlRef without handling any LA UI anymore. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: Adds a new class which represents a successful operation. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: Adds rule to allow the WebAuthn process to access Keychain and SEP. * UIProcess/WebAuthentication/Authenticator.h: (WebKit::Authenticator::setWebAuthenticationModernEnabled): (WebKit::Authenticator::webAuthenticationModernEnabled const): Adds a flag to know which UI to call. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): (WebKit::AuthenticatorManager::enableModernWebAuthentication): (WebKit::AuthenticatorManager::authenticatorAdded): (WebKit::AuthenticatorManager::requestLAContextForUserVerification): (WebKit::AuthenticatorManager::invokePendingCompletionHandler): * UIProcess/WebAuthentication/AuthenticatorManager.h: Adds plumbing to the new UI method. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: Paperwork. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: (WebKit::AuthenticatorPresenterCoordinator::setCredentialRequestHandler): This handler is from the UI delegate which is supposed to call if the operation succeeds. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::requestLAContextForUserVerification): (WebKit::AuthenticatorPresenterCoordinator::dimissPresenter): (WebKit::AuthenticatorPresenterCoordinator::setLAContext): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::continueMakeCredentialAfterReceivingLAContext): * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::verifyUser): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): (-[WKASCAuthorizationPresenterDelegate dispatchCoordinatorCallback:]): Implements the new UI logic. 2020-12-11 Per Arne Vollan [macOS] Remove access to com.apple.MTLCompilerService in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219774 Reviewed by Brent Fulgham. Remove access to com.apple.MTLCompilerService in the WebContent process on macOS, since there are no reports of this being used. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-11 Per Arne Vollan [macOS] Remove Mobile Asset access from the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219738 Reviewed by Brent Fulgham. Remove Mobile Asset access from the WebContent process on macOS, since there are no reports of this being used. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-11 Don Olmstead [CMake] Determine correct visibility for linked frameworks https://bugs.webkit.org/show_bug.cgi?id=210366 Reviewed by Michael Catanzaro. Set WebKit_FRAMEWORKS to determine correct linkage for the library. Remove explicit setting of STATICALLY_LINKED_WITH_${framework} and $ by ports. * CMakeLists.txt: * PlatformFTW.cmake: * PlatformPlayStation.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: 2020-12-11 Commit Queue Unreviewed, reverting r270654. https://bugs.webkit.org/show_bug.cgi?id=219793 Introduced crash Reverted changeset: "[macOS] The development WebContent XPC service is missing a required entitlement" https://bugs.webkit.org/show_bug.cgi?id=219730 https://trac.webkit.org/changeset/270654 2020-12-11 Carlos Garcia Campos Protect the WebProcessPool earlier in WebProcessCache::addProcessIfPossible https://bugs.webkit.org/show_bug.cgi?id=219777 Reviewed by Adrian Perez de Castro. We are taking a reference of the WebProcessPool in the isResponsive() completion handler lambda, but the WebProcessPool can be destroyed earlier when CachedProcess is created if the WebProcessProxy contains the last strong reference. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): 2020-12-11 Brent Fulgham [macOS] Only extend access to the RootDomainUserClient IOKit class if the GPU Process is not used https://bugs.webkit.org/show_bug.cgi?id=219758 Reviewed by Per Arne Vollan. The RootDomainUserClient IOKit class appears to only be used by media on Apple Silicon. Dynamically extend access to this class for Apple Silicon builds if the GPU process is not being used. This patch also includes telemetry to confirm that it is not needed on Intel, or for any other purposes. It does not block access to the IOKit class yet. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedIOKitClasses): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-11 Don Olmstead [GLib] Move GCrypt initialization to platformInitialize https://bugs.webkit.org/show_bug.cgi?id=219749 Reviewed by Adrian Perez de Castro. It makes more sense for initialization of GCrypt to occur in platformInitialize than in the main method of the process. This means that the process does not have to link gcrypt libraries and can just link WebKit only. * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp: (main): * NetworkProcess/soup/NetworkProcessMainSoup.cpp: * WebProcess/EntryPoint/unix/WebProcessMain.cpp: (main): * WebProcess/gtk/WebProcessMainGtk.cpp: (WebKit::WebProcessMain): * WebProcess/wpe/WebProcessMainWPE.cpp: 2020-12-11 Per Arne Vollan [iOS] Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219733 Reviewed by Brent Fulgham. Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process on iOS, since this is not needed when allowing access to IOGPU. The IOGPU class is the superclass of AGXDeviceUserClient, and is the preferred IOKit reference to use according to the Sandbox team. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): 2020-12-11 Per Arne Vollan [macOS] Add telemetry for notification message filtering in sandbox https://bugs.webkit.org/show_bug.cgi?id=219684 Reviewed by Brent Fulgham. Add telemetry for notification message filtering in sandbox in the WebContent process on macOS. No new tests, since this just adds telemetry. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-12-11 Commit Queue Unreviewed, reverting r270655. https://bugs.webkit.org/show_bug.cgi?id=219772 Introduced sandbox compile error Reverted changeset: "[iOS] Add missing endpoint in sandbox message filter" https://bugs.webkit.org/show_bug.cgi?id=219731 https://trac.webkit.org/changeset/270655 2020-12-10 Alex Christensen Accept click measurement data from hosting application https://bugs.webkit.org/show_bug.cgi?id=219763 Reviewed by John Wilander. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase): * Platform/ios/UIKitSoftLink.h: Added. * Platform/ios/UIKitSoftLink.mm: Added. * Platform/spi/ios/UIKitSPI.h: * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _setPrivateClickMeasurementOverrideTimerForTesting:completionHandler:]): (-[WKWebView _setPrivateClickMeasurementConversionURLForTesting:completionHandler:]): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setEventAttribution:]): (-[WKWebView _eventAttribution]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::createNewPage): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::setPrivateClickMeasurement): (WebKit::WebPageProxy::privateClickMeasurement const): * WebKit.xcodeproj/project.pbxproj: 2020-12-10 Peng Liu [Media in GPU Process][MSE] Implement several methods in SourceBufferPrivateRemote to make seeking more reliable https://bugs.webkit.org/show_bug.cgi?id=219757 Reviewed by Eric Carlson. Add the required IPC messages and implement three functions of `SourceBufferPrivateRemote`. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::abort): (WebKit::RemoteSourceBufferProxy::resetParserState): (WebKit::RemoteSourceBufferProxy::removedFromMediaSource): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::abort): (WebKit::SourceBufferPrivateRemote::resetParserState): (WebKit::SourceBufferPrivateRemote::removedFromMediaSource): 2020-12-10 Andy Estes [Mac] Create a format reader plug-in for WebM https://bugs.webkit.org/show_bug.cgi?id=218908 Reviewed by Eric Carlson. Added a new bundle target that builds a MediaToolbox format reader plug-in and installs it in the WebContent and GPU XPC service bundles. The plug-in does nothing for now, but in follow-up patches will learn how to read WebM containers. * Configurations/MediaFormatReader.xcconfig: Added. * MediaFormatReaderPlugIn/Info.plist: Added. Defines a CMClassImplementations array specifying the plug-in factory function and the supported media types / extensions. * MediaFormatReaderPlugIn/MediaFormatReaderPlugIn.cpp: Added. * WebKit.xcodeproj/project.pbxproj: 2020-12-10 Chris Dumez [GPUProcess] Cut in half amount of IPC needed to do WebAudio https://bugs.webkit.org/show_bug.cgi?id=219715 Reviewed by Geoff Garen. Cut in half amount of IPC needed to do WebAudio. Previously, we would send 2 IPCs per rendering quantum: 1. RemoteAudioDestinationProxy::RequestBuffer from GPUProcess to WebProcess 2. The response to RemoteAudioDestinationProxy::RequestBuffer which contained the frame bounds for the RingBuffer. This patch gets rid of IPC 2 by having the CARingBuffer class store its bounds in its memory backing. As a result, when the CARingBuffer is using a shared memory backing, the bounds get shared between processes, without any need for IPC to sync them. This is still too much IPC but this is a step in the right direction. We can hopefully get rid of (or greatly reduce) IPC 1 in a follow-up patch. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::render): * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: (WebKit::RemoteAudioSourceProviderProxy::storageChanged): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesAvailable): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): (WebKit::RemoteMediaRecorder::audioSamplesAvailable): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::SharedRingBufferStorage::allocate): (WebKit::SharedRingBufferStorage::sharedFrameBounds): (WebKit::SharedRingBufferStorage::data): (WebKit::SharedRingBufferStorage::getCurrentFrameBounds): (WebKit::SharedRingBufferStorage::setCurrentFrameBounds): (WebKit::SharedRingBufferStorage::updateFrameBounds): (WebKit::SharedRingBufferStorage::flush): * Shared/Cocoa/SharedRingBufferStorage.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::remoteAudioSamplesAvailable): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::remoteAudioSamplesAvailable): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.messages.in: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::requestBuffer): (WebKit::RemoteAudioDestinationProxy::storageChanged): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage): (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::audioSamplesAvailable): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::pushSamples): (WebKit::AudioMediaStreamTrackRenderer::storageChanged): * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::audioSamplesAvailable): (WebKit::MediaRecorderPrivate::storageChanged): * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::audioSamplesAvailable): (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable): * WebProcess/cocoa/RemoteCaptureSampleManager.h: * WebProcess/cocoa/RemoteCaptureSampleManager.messages.in: 2020-12-10 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.SystemConfiguration.configd' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219680 Reviewed by Brent Fulgham. Deny mach-lookup to the service 'com.apple.SystemConfiguration.configd' in the WebContent process on macOS, since there are no reports of this being used. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-10 Per Arne Vollan [macOS] Create sandbox extension for AppleAVDUserClient when Media in GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=219740 Reviewed by Brent Fulgham. Create sandbox extension for AppleAVDUserClient for WebContent process when Media in GPU process is not enabled on macOS, since this IOKit class is only used for Media purposes. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedIOKitClasses): (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-10 Per Arne Vollan [macOS] Add telemetry for notification message filtering in sandbox https://bugs.webkit.org/show_bug.cgi?id=219684 Reviewed by Brent Fulgham. Add telemetry for notification message filtering in sandbox in the WebContent process on macOS. No new tests, since this just adds telemetry. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-10 Per Arne Vollan [iOS] Add missing endpoint in sandbox message filter https://bugs.webkit.org/show_bug.cgi?id=219731 Reviewed by Brent Fulgham. Add missing endpoint in the WebContent process' sandbox message filter on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-12-10 Per Arne Vollan [macOS] The development WebContent XPC service is missing a required entitlement https://bugs.webkit.org/show_bug.cgi?id=219730 Reviewed by Brent Fulgham. The message filtering entitlement is missing in com.apple.WebKit.WebContent.Development.xpc on macOS. * Scripts/process-entitlements.sh: 2020-12-10 Andres Gonzalez Rework of AXObjectCache::isIsolatedTreeEnabled. https://bugs.webkit.org/show_bug.cgi?id=219722 Reviewed by Chris Fleizach. - Renamed AXObjecCache::canUseSecondaryAXThread as usedOnAXThread. - No need for the additional thread check since isIsolatedTreeEnabled will return true for any call off of the main thread. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKAccessibilityCanUseSecondaryAXThread): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityHitTest:]): 2020-12-10 Sihui Liu REGRESSION (r270574): [iOS] ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::~SpeechRecognitionRemoteRealtimeMediaSourceManager https://bugs.webkit.org/show_bug.cgi?id=219745 Reviewed by Youenn Fablet. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): Remove SpeechRecognitionRemoteRealtimeMediaSourceManager from MessageReceiverMap before destroying it. 2020-12-10 Timothy Hatcher Add willInjectUserScriptForFrame to WKWebProcessPlugInLoadDelegate. https://bugs.webkit.org/show_bug.cgi?id=219727 rdar://71987073 Reviewed by Brady Eidson. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (willInjectUserScriptForFrame): Added. (setUpPageLoaderClient): Set client.willInjectUserScriptForFrame. 2020-12-10 Don Olmstead [GTK] Add even more exports to support hidden visibility https://bugs.webkit.org/show_bug.cgi?id=219747 Reviewed by Michael Catanzaro. Add WK_EXPORT to additional declarations. * UIProcess/API/glib/WebKitSettingsPrivate.h: * UIProcess/API/glib/WebKitWebViewInternal.h: * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: 2020-12-10 Peng Liu [Media in GPU Process][MSE] Implement seeking support https://bugs.webkit.org/show_bug.cgi?id=219658 Reviewed by Jer Noble. Implement the required functions with IPC to support seeking. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::seekToTime): (WebKit::RemoteMediaSourceProxy::waitForSeekCompleted): (WebKit::RemoteMediaSourceProxy::seekCompleted): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteMediaSourceProxy.messages.in: * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::seekToTime): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::~MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::waitForSeekCompleted): (WebKit::MediaSourcePrivateRemote::seekCompleted): (WebKit::MediaSourcePrivateRemote::seekToTime): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: * WebProcess/GPU/media/MediaSourcePrivateRemote.messages.in: Added. * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::seekToTime): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-10 Alex Christensen Introduce new download API https://bugs.webkit.org/show_bug.cgi?id=217747 Reviewed by Brady Eidson. Safari currently uses _WKDownload, which has evolved strangely over the last decade. In order to make a nicer interface, we need to learn from those lessons and take a step back. I did that, and here's what I came up with: WKDownload and WKDownloadDelegate! Notable changes include: 1. The delegate now lives on the download object instead of the process pool. 2. WKDownload does not conform to NSCopying because we have NSMapTable instead of NSDictionary. 3. publishProgressAtURL is gone. That will be reimplemented in the UI process of the client that used it. 4. cancel has a completion handler to get the resume data instead of waiting for didCancel then getting it from the download object. 5. didFailWithError also gives you the resume data, so there is no way to get it from the download object. That's more about a fail/cancel event than a property of the download. 6. wasUserInitiated is gone. Instead, WKNavigationDelegate has a callback that links a navigation action (where _isUserInitiated is exposed) to the download. 7. redirectChain is also gone. That can also be gotten from the link to the navigation and the download delegate's redirect callback. 8. _downloadDidStart is gone. Instead, we have completion handlers that expose a WKDownload once it's started. There's no need to reference the download object before then anyways. Note: that's when the download "starts" which is before it receives the response, so there will be no server delay in the difference between download object availabilities. 9. didReceiveServerRedirectToURL now gives you the option of continuing or cancelling. This reflects the amount of control the WKNavigationDelegate has. 10. decideDestinationWithSuggestedFilename and didReceiveResponse have been merged, since they actually happen at the same time and NSURLResponse has suggestedFilename API. allowOverwrite is also gone. It wasn't used, and not really needed. 11. didCreateDestination is gone. That callback time wasn't really necessary. If you need to know when it's created, wait until the first didWriteData callback. The destination has definitely been created by then. 12. shouldDecodeSourceDataOfMIMEType is gone. It's actually not called since we adopted NSURLSession, and we should remove the related dead code. 13. originatingFrame is gone. On _WKDownload it was actually a non-null WKFrameInfo that often contained no information. When information was there, the information access has been replaced by didBecomeDownload which links the WKNavigationResponse which has frame info on it. I wrote API tests for everything I could think of. * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::resumeDownload): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): (WebKit::Download::platformCancelNetworkLoad): * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::suggestedFilename const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::resumeDownload): (WebKit::NetworkProcess::findPendingDownloadLocation): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): * Scripts/webkit/messages.py: * Shared/API/Cocoa/WebKit.h: * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIDownloadClient.h: (API::DownloadClient::legacyDidStart): (API::DownloadClient::didFail): (API::DownloadClient::didStart): Deleted. * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::navigationResponseDidBecomeDownload): (API::NavigationClient::navigationActionDidBecomeDownload): (API::NavigationClient::contextMenuDidCreateDownload): * UIProcess/API/APIPolicyClient.h: (API::PolicyClient::decidePolicyForNavigationAction): (API::PolicyClient::decidePolicyForNewWindowAction): * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKContextDownloadClient.h: Removed. * UIProcess/API/C/WKDownload.cpp: Removed. * UIProcess/API/C/WKDownloadClient.h: Added. * UIProcess/API/C/WKDownloadRef.cpp: Added. (WKDownloadGetTypeID): (WKDownloadCopyRequest): (WKDownloadCancel): (WKDownloadGetOriginatingPage): (WKDownloadGetWasUserInitiated): (WKDownloadSetClient): * UIProcess/API/C/WKDownloadRef.h: Renamed from Source/WebKit/UIProcess/API/C/WKDownload.h. * UIProcess/API/C/WKPage.cpp: (WKPageSetPagePolicyClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageNavigationClient.h: * UIProcess/API/Cocoa/WKDownload.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownload.h. * UIProcess/API/Cocoa/WKDownload.mm: Added. (-[WKDownload cancel:]): (-[WKDownload originalRequest]): (-[WKDownload delegate]): (-[WKDownload setDelegate:]): (-[WKDownload dealloc]): (-[WKDownload _apiObject]): * UIProcess/API/Cocoa/WKDownloadDelegate.h: Added. * UIProcess/API/Cocoa/WKDownloadInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownloadInternal.h. * UIProcess/API/Cocoa/WKNavigationAction.h: * UIProcess/API/Cocoa/WKNavigationAction.mm: (-[WKNavigationAction downloadAttribute]): (-[WKNavigationAction _shouldPerformDownload]): * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _downloadURLRequest:websiteDataStore:originatingWebView:]): (-[WKProcessPool _resumeDownloadFromData:websiteDataStore:path:originatingWebView:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView downloadRequest:completionHandler:]): (-[WKWebView resumeDownloadWithData:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload initWithDownload2:]): (+[_WKDownload downloadWithDownload:]): (-[_WKDownload cancel]): (-[_WKDownload publishProgressAtURL:]): (-[_WKDownload request]): (-[_WKDownload originatingWebView]): (-[_WKDownload redirectChain]): (-[_WKDownload wasUserInitiated]): (-[_WKDownload resumeData]): (-[_WKDownload originatingFrame]): (-[_WKDownload _apiObject]): (-[_WKDownload dealloc]): Deleted. * UIProcess/API/Cocoa/_WKDownloadDelegate.h: * UIProcess/API/Cocoa/_WKDownloadInternal.h: * UIProcess/API/glib/WebKitDownloadClient.cpp: * UIProcess/Cocoa/LegacyDownloadClient.h: * UIProcess/Cocoa/LegacyDownloadClient.mm: (WebKit::LegacyDownloadClient::legacyDidStart): (WebKit::LegacyDownloadClient::didReceiveResponse): (WebKit::LegacyDownloadClient::didReceiveData): (WebKit::LegacyDownloadClient::didReceiveAuthenticationChallenge): (WebKit::LegacyDownloadClient::didCreateDestination): (WebKit::LegacyDownloadClient::processDidCrash): (WebKit::LegacyDownloadClient::decideDestinationWithSuggestedFilename): (WebKit::LegacyDownloadClient::didFinish): (WebKit::LegacyDownloadClient::didFail): (WebKit::LegacyDownloadClient::legacyDidCancel): (WebKit::LegacyDownloadClient::willSendRequest): (WebKit::LegacyDownloadClient::didStart): Deleted. * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): (WebKit::NavigationState::NavigationClient::navigationActionDidBecomeDownload): (WebKit::NavigationState::NavigationClient::navigationResponseDidBecomeDownload): (WebKit::NavigationState::NavigationClient::contextMenuDidCreateDownload): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::~DownloadProxy): (WebKit::DownloadProxy::didStart): (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): (WebKit::DownloadProxy::didFail): (WebKit::DownloadProxy::setClient): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setDidStartCallback): (WebKit::DownloadProxy::setSuggestedFilename): * UIProcess/Network/NetworkProcessProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::resumeDownload): (WebKit::WebPageProxy::downloadRequest): (WebKit::WebPageProxy::contextMenuItemSelected): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::resumeDownload): * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2020-12-10 Don Olmstead [CMake] Use TARGET_PROPERTY to set includes for executables https://bugs.webkit.org/show_bug.cgi?id=219743 Reviewed by Michael Catanzaro. Use $ for all executables being built alongside WebKit. This simplifies the includes for those targets. * CMakeLists.txt: 2020-12-10 Chris Dumez Unreviewed, reverting r270542. Seems to have regressed perf benchmarks Reverted changeset: "[iOS] Stop leaking an XPC boost message to XPC services" https://bugs.webkit.org/show_bug.cgi?id=219453 https://trac.webkit.org/changeset/270542 2020-12-10 Youenn Fablet ICE does not resolve for `turns` relay candidates rooted in LetsEncrypt CA https://bugs.webkit.org/show_bug.cgi?id=219274 Reviewed by Eric Carlson. Use NWConnection for client TCP sockets. This allows piggy-backing on this API for things such as proxies or certificate validation. Implementation does opening a TCP socket with TLS using NWConnection: - If the socket is created for STUN/TURN, it is sending packets as is. For receiving data, the socket will make sure to split received data in meaningful messages that WebProcess will process. - If the socket is TCP for data, sent data is prefixed with the size of the data. For received data, the length of the message is read and we wait to receive the whole message data to send it to WebProcess. We enable that new code path based on an experimental feature. Tested manually with TURNS servers and TCP-only connections. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createClientTCPSocket): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::setPlatformSocketsEnabled): * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * NetworkProcess/webrtc/NetworkRTCSocketSocketCocoa.h: Added. * NetworkProcess/webrtc/NetworkRTCSocketSocketCocoa.mm: Added. (WebKit::socketQueue): (WebKit::NetworkRTCSocketSocketCocoa::createClientTCPSocket): (WebKit::isStunMessage): (WebKit::getSTUNOrTURNMessageLength): (WebKit::extractSTUNOrTURNMessages): (WebKit::extractMessages): (WebKit::processMessage): (WebKit::NetworkRTCSocketSocketCocoa::NetworkRTCSocketSocketCocoa): (WebKit::NetworkRTCSocketSocketCocoa::close): (WebKit::NetworkRTCSocketSocketCocoa::setOption): (WebKit::dataFromVector): (WebKit::NetworkRTCSocketSocketCocoa::sendTo): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::setConnection): 2020-12-10 Antoine Quint Unified WebKit build fails https://bugs.webkit.org/show_bug.cgi?id=219734 Reviewed by Tim Horton. * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: 2020-12-10 Jiewen Tan Unreviewed, build fix after r270616 Adds a platform have flag. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h: * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: 2020-12-10 Jiewen Tan [WebAuthn] Adopt new UI for the Security Key makeCredential flow https://bugs.webkit.org/show_bug.cgi?id=219708 Reviewed by Brent Fulgham. This patch adopts the new AuthenticationServices' UI. The idea is to use AuthenticatorPresenterCoordinator as the middle layer to connect to the new UI while keeping the existing interfaces the same in the AuthenticatorManager to handle the interactions between UI and authenticators. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: Added. SPI for the new UI. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: * Scripts/process-entitlements.sh: Added new sandbox rules for Remote SpringBoard services which are used by the new UI. * SourcesCocoa.txt: Paperwork. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): (WebKit::AuthenticatorManager::cancel): (WebKit::AuthenticatorManager::enableModernWebAuthentication): (WebKit::AuthenticatorManager::clearState): (WebKit::AuthenticatorManager::serviceStatusUpdated): (WebKit::AuthenticatorManager::authenticatorStatusUpdated): (WebKit::AuthenticatorManager::requestPin): (WebKit::AuthenticatorManager::selectAssertionResponse): (WebKit::AuthenticatorManager::startDiscovery): (WebKit::AuthenticatorManager::runPanel): (WebKit::AuthenticatorManager::runPresenter): (WebKit::AuthenticatorManager::invokePendingCompletionHandler): * UIProcess/WebAuthentication/AuthenticatorManager.h: Teached AuthenticatorManager to use the new UI's presenter when it is available. Otherwise, it falls back to the old UI. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: Added. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: Added. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: Added. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: Added. (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): (WebKit::AuthenticatorPresenterCoordinator::requestPin): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::dimissPresenter): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h: Added. * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: Added. (-[WKASCAuthorizationPresenterDelegate initWithCoordinator:]): (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:validateUserEnteredPIN:completionHandler:]): Introduced the AuthenticatorPresenterCoordinator to handle the new UI. * WebAuthnProcess/WebAuthnProcess.cpp: (WebKit::WebAuthnProcess::WebAuthnProcess): (WebKit::WebAuthnProcess::setMockWebAuthenticationConfiguration): Teached WebAuthnProcess to inform AuthenticatorManager about its existence. * WebKit.xcodeproj/project.pbxproj: Paperwork. 2020-12-09 Per Arne Vollan [macOS] Remove com.apple.PowerManagement.control from WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=219685 Reviewed by Darin Adler. Remove com.apple.PowerManagement.control from WebContent sandbox on macOS, since there are no reports of this being in use. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-09 Peng Liu [Media in GPU Process][MSE] Implement basic video playback https://bugs.webkit.org/show_bug.cgi?id=219402 Reviewed by Jer Noble. Implement the necessary functions with IPC to support media playback. * GPUProcess/media/RemoteAudioTrackProxy.cpp: (WebKit::RemoteAudioTrackProxy::configuration): Rename `identifier` to `trackId` because it is easy to confuse with `TrackPrivateRemoteIdentifier`. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): (WebKit::RemoteMediaPlayerProxy::updateCachedState): For MSE media player, `SourceBuffer` provides the buffered ranges, so `RemoteMediaPlayerProxy` does not need to report this information to the `MediaPlayer` object in the Web process. * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::duration const): (WebKit::RemoteMediaSourceProxy::buffered const): (WebKit::RemoteMediaSourceProxy::durationChanged): (WebKit::RemoteMediaSourceProxy::setReadyState): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteMediaSourceProxy.messages.in: * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::~RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidParseSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateBufferedDirtyChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateBufferedRangesChanged): (WebKit::RemoteSourceBufferProxy::setActive): (WebKit::RemoteSourceBufferProxy::setReadyState): (WebKit::RemoteSourceBufferProxy::updateBufferedFromTrackBuffers): (WebKit::RemoteSourceBufferProxy::evictCodedFrames): (WebKit::RemoteSourceBufferProxy::addTrackBuffer): (WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded): (WebKit::RemoteSourceBufferProxy::trySignalAllSamplesInTrackEnqueued): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasAudio const): Deleted. (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasVideo const): Deleted. * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::configuration): * GPUProcess/media/RemoteVideoTrackProxy.cpp: (WebKit::RemoteVideoTrackProxy::configuration): * GPUProcess/media/TextTrackPrivateRemoteConfiguration.h: (WebKit::TextTrackPrivateRemoteConfiguration::encode const): (WebKit::TextTrackPrivateRemoteConfiguration::decode): * GPUProcess/media/TrackPrivateRemoteConfiguration.h: (WebKit::TrackPrivateRemoteConfiguration::encode const): (WebKit::TrackPrivateRemoteConfiguration::decode): * WebProcess/GPU/media/AudioTrackPrivateRemote.cpp: (WebKit::AudioTrackPrivateRemote::updateConfiguration): * WebProcess/GPU/media/AudioTrackPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::load): * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::durationChanged): (WebKit::MediaSourcePrivateRemote::isEnded const): (WebKit::MediaSourcePrivateRemote::setReadyState): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::setReadyState): (WebKit::SourceBufferPrivateRemote::flush): (WebKit::SourceBufferPrivateRemote::setActive): (WebKit::SourceBufferPrivateRemote::updateBufferedFromTrackBuffers): (WebKit::SourceBufferPrivateRemote::evictCodedFrames): (WebKit::SourceBufferPrivateRemote::addTrackBuffer): (WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded): (WebKit::SourceBufferPrivateRemote::trySignalAllSamplesInTrackEnqueued): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDurationChanged): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidParseSample): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateBufferedDirtyChanged): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateBufferedRangesChanged): (WebKit::SourceBufferPrivateRemote::enqueueSample): Deleted. * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: * WebProcess/GPU/media/TextTrackPrivateRemote.cpp: (WebKit::TextTrackPrivateRemote::updateConfiguration): * WebProcess/GPU/media/VideoTrackPrivateRemote.cpp: (WebKit::VideoTrackPrivateRemote::updateConfiguration): 2020-11-30 Brian Burg [Cocoa] Web Inspector: add support for creating extension tabs in WebInspectorUI via _WKInspectorExtension https://bugs.webkit.org/show_bug.cgi?id=219380 Reviewed by Devin Rousso and Timothy Hatcher. Add a new method to _WKInspectorExtension for creating an extension tab in WebInpectorUI. This can be used to implement browser.devtools.panels.create() as provided by the Web Extensions API. * Platform/Logging.h: Add Inspector channel for error logging. * Shared/InspectorExtensionTypes.h: Add a missing EnumTraits case. * WebKit.xcodeproj/project.pbxproj: * Sources.txt: Add files. * UIProcess/API/APIInspectorExtension.h: * UIProcess/API/APIInspectorExtension.cpp: (API::InspectorExtension::InspectorExtension): (API::InspectorExtension::create): (API::InspectorExtension::createTab): Inspector extensions need to be able to invoke commands in the WebProcess-side extension proxy controller, so keep a WeakRef to the extension controller that created the extension object. Also, implement the new API by forwarding it on. * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): Adapt to the new constructor as explained above. * UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: Expose member m_remoteInspectorPorxy for use in the API::InspectorExtension constructor. * UIProcess/API/Cocoa/_WKInspectorExtension.h: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: (-[_WKInspectorExtension initWithIdentifier:]): Deleted. (-[_WKInspectorExtension createTabWithName:tabIconURL:sourceURL:completionHandler:]): Implement new API. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerInternal.h: Added. Make the RefPtr member variable accessible to the API object constructor. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): Adapt to new constructor as explained above. * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: (WebKit::WebInspectorUIExtensionControllerProxy::createTabForExtension): Forward the request to the inspector frontend WebProcess. * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: Add a new async IPC command for creating a new inspector extension tab. * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: (WebKit::WebInspectorUIExtensionController::unwrapEvaluationResultAsObject): Added. Pull out the code needed for error-handling this common operation. (WebKit::WebInspectorUIExtensionController::createTabForExtension): Added. Call into InspectorFrontendAPI to request a new tab. Turn the result into an InspectorExtensionError or InspectorExtensionTabID and send the IPC reply. * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h: Fix unified sources fallout. 2020-12-09 Said Abou-Hallawa [GPU Process]: Recording an in-process ImageBuffer drawing has to convert it to a NativeImage first https://bugs.webkit.org/show_bug.cgi?id=219705 Reviewed by Wenson Hsieh. Override the virtual method isCachedImageBuffer() which in this case answers the question: is this a remote ImageBuffer or not? * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-12-09 Per Arne Vollan [macOS] Allow mach-lookup of com.apple.relatived.tempest in WebKit GPU process https://bugs.webkit.org/show_bug.cgi?id=219701 Reviewed by Darin Adler. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: 2020-12-09 Wenson Hsieh Some WebGL tests crash in WebKit::RemoteRenderingBackendProxy::willAppendItem(WebCore::RenderingResourceIdentifier) https://bugs.webkit.org/show_bug.cgi?id=219700 Reviewed by Tim Horton. Fixes these assertions by resetting the identifier of the "most recently appended" image buffer (m_currentDestinationImageBufferIdentifier) when the image buffer is released in the rendering backend. We keep track of this so that we can append MetaCommandChangeDestinationImageBuffer items when painting into multiple image buffers; the code to do this in willAppendItem is actually robust against the case where m_currentDestinationImageBufferIdentifier is unknown, but still debug asserts. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): 2020-12-09 Alex Christensen Fix clicking on links in PDFs on Big Sur after r266654 https://bugs.webkit.org/show_bug.cgi?id=219665 Reviewed by Tim Horton. mouseUp: was being called by AppKit on the WKPDFHUDView instead of the WKWebView, causing the event to not make it to the PDFPlugin, which meant PDFKit wasn't being told it was clicked on, which means it wasn't telling WebKit to change the frame's location. Overriding hitTest to forward all mouse events to the WKWebView solves this problem. Covered by the WebKit.PDFLinkReferrer API test, which was failing on Big Sur, where ENABLE(UI_PROCESS_PDF_HUD) is true. * UIProcess/PDF/WKPDFHUDView.mm: (-[WKPDFHUDView hitTest:]): 2020-12-09 Wenson Hsieh [Concurrent display lists] Support playback of display list items with cached resources https://bugs.webkit.org/show_bug.cgi?id=218614 Reviewed by Tim Horton. Teaches the GPU process to resume playback of display list items that were previously unable to be played back due to missing cached resources. See below for more details. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): See if the newly created image buffer's ID matches that of the pending wakeup message; if so, immediately kick off the wakeup loop. (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): In the case where the next destination image buffer is unknown, bail early and resume when we eventually learn about the image buffer in the GPU process. This can happen if a MetaCommandChangeDestinationImageBuffer item is added that references a newly created image buffer. (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): (WebKit::RemoteRenderingBackend::cacheNativeImage): See if the newly cached image's ID matches that of the pending wakeup message; if so, immediately kick off the wakeup loop. (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * GPUProcess/graphics/RemoteRenderingBackend.h: Add a private `PendingWakeupInformation` struct that encapsulates all the information needed to remember that we stopped display list processing, and resume processing in the future. Currently, this contains a set of wakeup message arguments, and (optionally) the identifier of the missing resource that we need to receive in order to continue. We also use this in place of storing GPUProcessWakeupMessageArguments on RemoteRenderingBackend. (WebKit::RemoteRenderingBackend::PendingWakeupInformation::shouldPerformWakeup const): 2020-12-09 Kimmo Kinnunen Implement RemoteWebGLBackend https://bugs.webkit.org/show_bug.cgi?id=217216 Reviewed by Simon Fraser. Implements a beginning of a remote version of GraphicsContextGL for GPU process. Current implementation is using WebKit IPC. Implemented with a generator script implementing the IPC to pass the GraphicsContextGL member function calls from web process to the GPU process. The script is run during development time and the results are committed to the repo for ease of review. Implement the RemoteGraphicsContextGL in WebKit side. This class will forward calls received via IPC to the GraphicsContextGLOpenGL. At the moment RemoteGraphicsContextGL instance is a direct child of GPUConnectionToWebProcess. Compositing is implemented only for PLATFORM(COCOA). Missing: - Simulated context loss - Simulated context change - Paint WebGL contents to 2D canvas - Upload video to WebGL - Upload canvas to WebGL * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createGraphicsContextGL): (WebKit::GPUConnectionToWebProcess::releaseGraphicsContextGL): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: Added. (WebKit::RemoteGraphicsContextGL::create): (WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL): (WebKit::RemoteGraphicsContextGL::~RemoteGraphicsContextGL): (WebKit::RemoteGraphicsContextGL::gpuConnectionToWebProcess const): (WebKit::RemoteGraphicsContextGL::messageSenderConnection const): (WebKit::RemoteGraphicsContextGL::messageSenderDestinationID const): (WebKit::RemoteGraphicsContextGL::didComposite): (WebKit::RemoteGraphicsContextGL::forceContextLost): (WebKit::RemoteGraphicsContextGL::recycleContext): (WebKit::RemoteGraphicsContextGL::dispatchContextChangedNotification): (WebKit::RemoteGraphicsContextGL::recycleBuffer): (WebKit::RemoteGraphicsContextGL::present): (WebKit::RemoteGraphicsContextGL::detachClient): (WebKit::RemoteGraphicsContextGL::reshape): (WebKit::RemoteGraphicsContextGL::prepareForDisplay): (WebKit::RemoteGraphicsContextGL::ensureExtensionEnabled): (WebKit::RemoteGraphicsContextGL::notifyMarkContextChanged): * GPUProcess/graphics/RemoteGraphicsContextGL.h: Added. * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: Added. * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h: Added. (setFailNextGPUStatusCheck): (synthesizeGLError): (moveErrorsToSyntheticErrorList): (activeTexture): (attachShader): (bindAttribLocation): (bindBuffer): (bindFramebuffer): (bindRenderbuffer): (bindTexture): (blendColor): (blendEquation): (blendEquationSeparate): (blendFunc): (blendFuncSeparate): (checkFramebufferStatus): (clear): (clearColor): (clearDepth): (clearStencil): (colorMask): (compileShader): (copyTexImage2D): (copyTexSubImage2D): (createBuffer): (createFramebuffer): (createProgram): (createRenderbuffer): (createShader): (createTexture): (cullFace): (deleteBuffer): (deleteFramebuffer): (deleteProgram): (deleteRenderbuffer): (deleteShader): (deleteTexture): (depthFunc): (depthMask): (depthRange): (detachShader): (disable): (disableVertexAttribArray): (drawArrays): (drawElements): (enable): (enableVertexAttribArray): (finish): (flush): (framebufferRenderbuffer): (framebufferTexture2D): (frontFace): (generateMipmap): (getActiveAttrib): (getActiveUniform): (getAttribLocation): (getBufferParameteri): (getString): (getFloatv): (getIntegerv): (getInteger64): (getInteger64i): (getProgrami): (getBooleanv): (getError): (getFramebufferAttachmentParameteri): (getProgramInfoLog): (getRenderbufferParameteri): (getShaderi): (getShaderInfoLog): (getShaderPrecisionFormat): (getShaderSource): (getTexParameterf): (getTexParameteri): (getUniformfv): (getUniformiv): (getUniformuiv): (getUniformLocation): (getVertexAttribOffset): (hint): (isBuffer): (isEnabled): (isFramebuffer): (isProgram): (isRenderbuffer): (isShader): (isTexture): (lineWidth): (linkProgram): (pixelStorei): (polygonOffset): (renderbufferStorage): (sampleCoverage): (scissor): (shaderSource): (stencilFunc): (stencilFuncSeparate): (stencilMask): (stencilMaskSeparate): (stencilOp): (stencilOpSeparate): (texParameterf): (texParameteri): (uniform1f): (uniform1fv): (uniform1i): (uniform1iv): (uniform2f): (uniform2fv): (uniform2i): (uniform2iv): (uniform3f): (uniform3fv): (uniform3i): (uniform3iv): (uniform4f): (uniform4fv): (uniform4i): (uniform4iv): (uniformMatrix2fv): (uniformMatrix3fv): (uniformMatrix4fv): (useProgram): (validateProgram): (vertexAttrib1f): (vertexAttrib1fv): (vertexAttrib2f): (vertexAttrib2fv): (vertexAttrib3f): (vertexAttrib3fv): (vertexAttrib4f): (vertexAttrib4fv): (vertexAttribPointer): (viewport): (bufferData0): (bufferData1): (bufferSubData): (readnPixels0): (readnPixels1): (texImage2D0): (texImage2D1): (texSubImage2D0): (texSubImage2D1): (compressedTexImage2D0): (compressedTexImage2D1): (compressedTexSubImage2D0): (compressedTexSubImage2D1): (drawArraysInstanced): (drawElementsInstanced): (vertexAttribDivisor): (createVertexArray): (deleteVertexArray): (isVertexArray): (bindVertexArray): (copyBufferSubData): (getBufferSubData): (blitFramebuffer): (framebufferTextureLayer): (invalidateFramebuffer): (invalidateSubFramebuffer): (readBuffer): (renderbufferStorageMultisample): (texStorage2D): (texStorage3D): (texImage3D0): (texImage3D1): (texSubImage3D0): (texSubImage3D1): (copyTexSubImage3D): (compressedTexImage3D0): (compressedTexImage3D1): (compressedTexSubImage3D0): (compressedTexSubImage3D1): (getFragDataLocation): (uniform1ui): (uniform2ui): (uniform3ui): (uniform4ui): (uniform1uiv): (uniform2uiv): (uniform3uiv): (uniform4uiv): (uniformMatrix2x3fv): (uniformMatrix3x2fv): (uniformMatrix2x4fv): (uniformMatrix4x2fv): (uniformMatrix3x4fv): (uniformMatrix4x3fv): (vertexAttribI4i): (vertexAttribI4iv): (vertexAttribI4ui): (vertexAttribI4uiv): (vertexAttribIPointer): (drawRangeElements): (drawBuffers): (clearBufferiv): (clearBufferuiv): (clearBufferfv): (clearBufferfi): (createQuery): (deleteQuery): (isQuery): (beginQuery): (endQuery): (getQuery): (getQueryObjectui): (createSampler): (deleteSampler): (isSampler): (bindSampler): (samplerParameteri): (samplerParameterf): (getSamplerParameterf): (getSamplerParameteri): (fenceSync): (isSync): (deleteSync): (clientWaitSync): (waitSync): (getSynci): (createTransformFeedback): (deleteTransformFeedback): (isTransformFeedback): (bindTransformFeedback): (beginTransformFeedback): (endTransformFeedback): (transformFeedbackVaryings): (getTransformFeedbackVarying): (pauseTransformFeedback): (resumeTransformFeedback): (bindBufferBase): (bindBufferRange): (getUniformIndices): (getActiveUniforms): (getUniformBlockIndex): (getActiveUniformBlockName): (uniformBlockBinding): (getActiveUniformBlockiv): (getGraphicsResetStatusARB): (blitFramebufferANGLE): (renderbufferStorageMultisampleANGLE): (createVertexArrayOES): (deleteVertexArrayOES): (isVertexArrayOES): (bindVertexArrayOES): (getTranslatedShaderSourceANGLE): (insertEventMarkerEXT): (pushGroupMarkerEXT): (popGroupMarkerEXT): (drawBuffersEXT): (drawArraysInstancedANGLE): (drawElementsInstancedANGLE): (vertexAttribDivisorANGLE): * GPUProcess/mac/GPUProcessMac.mm: (WebKit::GPUProcess::initializeProcess): * GPUProcess/media/RemoteLegacyCDMProxy.h: * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: * GPUProcess/media/RemoteMediaResourceManager.cpp: * GPUProcess/media/RemoteMediaResourceManager.h: * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.cpp: * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: * GPUProcess/webrtc/RemoteMediaRecorder.h: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: * NetworkProcess/Downloads/Download.cpp: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/NetworkSocketChannel.cpp: * NetworkProcess/NetworkSocketChannel.h: * NetworkProcess/NetworkSocketStream.cpp: * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: * NetworkProcess/WebSocketTask.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: * NetworkProcess/soup/WebSocketTaskSoup.cpp: * NetworkProcess/soup/WebSocketTaskSoup.h: * Platform/IPC/ArgumentCoders.h: * Platform/IPC/ArrayReference.h: Copied from Source/WebKit/Platform/IPC/DataReference.h. (IPC::ArrayReference::ArrayReference): (IPC::ArrayReference::isEmpty const): (IPC::ArrayReference::size const): (IPC::ArrayReference::data const): (IPC::ArrayReference::vector const): * Platform/IPC/Connection.h: (IPC::Connection::sendSync): * Platform/IPC/DataReference.h: * Platform/IPC/Decoder.cpp: (IPC::Decoder::decodeFixedLengthReference): * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.cpp: (IPC::Encoder::wrapForTesting): * Platform/IPC/Encoder.h: * Platform/IPC/HandleMessage.h: * Platform/IPC/MessageSender.h: (IPC::MessageSender::sendSync): * Platform/IPC/SharedBufferCopy.cpp: (IPC::SharedBufferCopy::decode): * Platform/IPC/SharedBufferDataReference.cpp: * Platform/IPC/StringReference.cpp: * PluginProcess/PluginControllerProxy.cpp: * PluginProcess/PluginControllerProxy.h: * Scripts/webkit/messages.py: * Shared/API/APIData.cpp: * Shared/AuxiliaryProcess.h: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/cf/ArgumentCodersCF.cpp: * Shared/soup/WebCoreArgumentCodersSoup.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIIconLoadingClient.h: * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::sendSync): * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h: * UIProcess/PageClient.h: * UIProcess/UserContent/WebUserContentControllerProxy.cpp: * UIProcess/UserContent/WebUserContentControllerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/graphics/GraphicsContextGLIdentifier.h: Renamed from Source/WebKit/Platform/IPC/DataReference.cpp. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: Added. (WebKit::RemoteGraphicsContextGLProxy::create): (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy): (WebKit::RemoteGraphicsContextGLProxy::~RemoteGraphicsContextGLProxy): (WebKit::RemoteGraphicsContextGLProxy::messageSenderConnection const): (WebKit::RemoteGraphicsContextGLProxy::messageSenderDestinationID const): (WebKit::RemoteGraphicsContextGLProxy::reshape): (WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay): (WebKit::RemoteGraphicsContextGLProxy::ensureExtensionEnabled): (WebKit::RemoteGraphicsContextGLProxy::notifyMarkContextChanged): (WebKit::RemoteGraphicsContextGLProxy::simulateContextChanged): (WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas): (WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToImageData): (WebKit::RemoteGraphicsContextGLProxy::wasCreated): (WebKit::RemoteGraphicsContextGLProxy::wasLost): (WebKit::RemoteGraphicsContextGLProxy::wasChanged): (WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: Added. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in: Copied from Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp: Added. (WebKit::RemoteGraphicsContextGLProxy::setFailNextGPUStatusCheck): (WebKit::RemoteGraphicsContextGLProxy::synthesizeGLError): (WebKit::RemoteGraphicsContextGLProxy::moveErrorsToSyntheticErrorList): (WebKit::RemoteGraphicsContextGLProxy::activeTexture): (WebKit::RemoteGraphicsContextGLProxy::attachShader): (WebKit::RemoteGraphicsContextGLProxy::bindAttribLocation): (WebKit::RemoteGraphicsContextGLProxy::bindBuffer): (WebKit::RemoteGraphicsContextGLProxy::bindFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::bindRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::bindTexture): (WebKit::RemoteGraphicsContextGLProxy::blendColor): (WebKit::RemoteGraphicsContextGLProxy::blendEquation): (WebKit::RemoteGraphicsContextGLProxy::blendEquationSeparate): (WebKit::RemoteGraphicsContextGLProxy::blendFunc): (WebKit::RemoteGraphicsContextGLProxy::blendFuncSeparate): (WebKit::RemoteGraphicsContextGLProxy::checkFramebufferStatus): (WebKit::RemoteGraphicsContextGLProxy::clear): (WebKit::RemoteGraphicsContextGLProxy::clearColor): (WebKit::RemoteGraphicsContextGLProxy::clearDepth): (WebKit::RemoteGraphicsContextGLProxy::clearStencil): (WebKit::RemoteGraphicsContextGLProxy::colorMask): (WebKit::RemoteGraphicsContextGLProxy::compileShader): (WebKit::RemoteGraphicsContextGLProxy::copyTexImage2D): (WebKit::RemoteGraphicsContextGLProxy::copyTexSubImage2D): (WebKit::RemoteGraphicsContextGLProxy::createBuffer): (WebKit::RemoteGraphicsContextGLProxy::createFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::createProgram): (WebKit::RemoteGraphicsContextGLProxy::createRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::createShader): (WebKit::RemoteGraphicsContextGLProxy::createTexture): (WebKit::RemoteGraphicsContextGLProxy::cullFace): (WebKit::RemoteGraphicsContextGLProxy::deleteBuffer): (WebKit::RemoteGraphicsContextGLProxy::deleteFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::deleteProgram): (WebKit::RemoteGraphicsContextGLProxy::deleteRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::deleteShader): (WebKit::RemoteGraphicsContextGLProxy::deleteTexture): (WebKit::RemoteGraphicsContextGLProxy::depthFunc): (WebKit::RemoteGraphicsContextGLProxy::depthMask): (WebKit::RemoteGraphicsContextGLProxy::depthRange): (WebKit::RemoteGraphicsContextGLProxy::detachShader): (WebKit::RemoteGraphicsContextGLProxy::disable): (WebKit::RemoteGraphicsContextGLProxy::disableVertexAttribArray): (WebKit::RemoteGraphicsContextGLProxy::drawArrays): (WebKit::RemoteGraphicsContextGLProxy::drawElements): (WebKit::RemoteGraphicsContextGLProxy::enable): (WebKit::RemoteGraphicsContextGLProxy::enableVertexAttribArray): (WebKit::RemoteGraphicsContextGLProxy::finish): (WebKit::RemoteGraphicsContextGLProxy::flush): (WebKit::RemoteGraphicsContextGLProxy::framebufferRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::framebufferTexture2D): (WebKit::RemoteGraphicsContextGLProxy::frontFace): (WebKit::RemoteGraphicsContextGLProxy::generateMipmap): (WebKit::RemoteGraphicsContextGLProxy::getActiveAttrib): (WebKit::RemoteGraphicsContextGLProxy::getActiveUniform): (WebKit::RemoteGraphicsContextGLProxy::getAttribLocation): (WebKit::RemoteGraphicsContextGLProxy::getBufferParameteri): (WebKit::RemoteGraphicsContextGLProxy::getString): (WebKit::RemoteGraphicsContextGLProxy::getFloatv): (WebKit::RemoteGraphicsContextGLProxy::getIntegerv): (WebKit::RemoteGraphicsContextGLProxy::getInteger64): (WebKit::RemoteGraphicsContextGLProxy::getInteger64i): (WebKit::RemoteGraphicsContextGLProxy::getProgrami): (WebKit::RemoteGraphicsContextGLProxy::getBooleanv): (WebKit::RemoteGraphicsContextGLProxy::getError): (WebKit::RemoteGraphicsContextGLProxy::getFramebufferAttachmentParameteri): (WebKit::RemoteGraphicsContextGLProxy::getProgramInfoLog): (WebKit::RemoteGraphicsContextGLProxy::getRenderbufferParameteri): (WebKit::RemoteGraphicsContextGLProxy::getShaderi): (WebKit::RemoteGraphicsContextGLProxy::getShaderInfoLog): (WebKit::RemoteGraphicsContextGLProxy::getShaderPrecisionFormat): (WebKit::RemoteGraphicsContextGLProxy::getShaderSource): (WebKit::RemoteGraphicsContextGLProxy::getTexParameterf): (WebKit::RemoteGraphicsContextGLProxy::getTexParameteri): (WebKit::RemoteGraphicsContextGLProxy::getUniformfv): (WebKit::RemoteGraphicsContextGLProxy::getUniformiv): (WebKit::RemoteGraphicsContextGLProxy::getUniformuiv): (WebKit::RemoteGraphicsContextGLProxy::getUniformLocation): (WebKit::RemoteGraphicsContextGLProxy::getVertexAttribOffset): (WebKit::RemoteGraphicsContextGLProxy::hint): (WebKit::RemoteGraphicsContextGLProxy::isBuffer): (WebKit::RemoteGraphicsContextGLProxy::isEnabled): (WebKit::RemoteGraphicsContextGLProxy::isFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::isProgram): (WebKit::RemoteGraphicsContextGLProxy::isRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::isShader): (WebKit::RemoteGraphicsContextGLProxy::isTexture): (WebKit::RemoteGraphicsContextGLProxy::lineWidth): (WebKit::RemoteGraphicsContextGLProxy::linkProgram): (WebKit::RemoteGraphicsContextGLProxy::pixelStorei): (WebKit::RemoteGraphicsContextGLProxy::polygonOffset): (WebKit::RemoteGraphicsContextGLProxy::renderbufferStorage): (WebKit::RemoteGraphicsContextGLProxy::sampleCoverage): (WebKit::RemoteGraphicsContextGLProxy::scissor): (WebKit::RemoteGraphicsContextGLProxy::shaderSource): (WebKit::RemoteGraphicsContextGLProxy::stencilFunc): (WebKit::RemoteGraphicsContextGLProxy::stencilFuncSeparate): (WebKit::RemoteGraphicsContextGLProxy::stencilMask): (WebKit::RemoteGraphicsContextGLProxy::stencilMaskSeparate): (WebKit::RemoteGraphicsContextGLProxy::stencilOp): (WebKit::RemoteGraphicsContextGLProxy::stencilOpSeparate): (WebKit::RemoteGraphicsContextGLProxy::texParameterf): (WebKit::RemoteGraphicsContextGLProxy::texParameteri): (WebKit::RemoteGraphicsContextGLProxy::uniform1f): (WebKit::RemoteGraphicsContextGLProxy::uniform1fv): (WebKit::RemoteGraphicsContextGLProxy::uniform1i): (WebKit::RemoteGraphicsContextGLProxy::uniform1iv): (WebKit::RemoteGraphicsContextGLProxy::uniform2f): (WebKit::RemoteGraphicsContextGLProxy::uniform2fv): (WebKit::RemoteGraphicsContextGLProxy::uniform2i): (WebKit::RemoteGraphicsContextGLProxy::uniform2iv): (WebKit::RemoteGraphicsContextGLProxy::uniform3f): (WebKit::RemoteGraphicsContextGLProxy::uniform3fv): (WebKit::RemoteGraphicsContextGLProxy::uniform3i): (WebKit::RemoteGraphicsContextGLProxy::uniform3iv): (WebKit::RemoteGraphicsContextGLProxy::uniform4f): (WebKit::RemoteGraphicsContextGLProxy::uniform4fv): (WebKit::RemoteGraphicsContextGLProxy::uniform4i): (WebKit::RemoteGraphicsContextGLProxy::uniform4iv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4fv): (WebKit::RemoteGraphicsContextGLProxy::useProgram): (WebKit::RemoteGraphicsContextGLProxy::validateProgram): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib1f): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib1fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib2f): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib2fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib3f): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib3fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib4f): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib4fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribPointer): (WebKit::RemoteGraphicsContextGLProxy::viewport): (WebKit::RemoteGraphicsContextGLProxy::bufferData): (WebKit::RemoteGraphicsContextGLProxy::bufferSubData): (WebKit::RemoteGraphicsContextGLProxy::readnPixels): (WebKit::RemoteGraphicsContextGLProxy::texImage2D): (WebKit::RemoteGraphicsContextGLProxy::texSubImage2D): (WebKit::RemoteGraphicsContextGLProxy::compressedTexImage2D): (WebKit::RemoteGraphicsContextGLProxy::compressedTexSubImage2D): (WebKit::RemoteGraphicsContextGLProxy::drawArraysInstanced): (WebKit::RemoteGraphicsContextGLProxy::drawElementsInstanced): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribDivisor): (WebKit::RemoteGraphicsContextGLProxy::createVertexArray): (WebKit::RemoteGraphicsContextGLProxy::deleteVertexArray): (WebKit::RemoteGraphicsContextGLProxy::isVertexArray): (WebKit::RemoteGraphicsContextGLProxy::bindVertexArray): (WebKit::RemoteGraphicsContextGLProxy::copyBufferSubData): (WebKit::RemoteGraphicsContextGLProxy::getBufferSubData): (WebKit::RemoteGraphicsContextGLProxy::blitFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::framebufferTextureLayer): (WebKit::RemoteGraphicsContextGLProxy::invalidateFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::invalidateSubFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::readBuffer): (WebKit::RemoteGraphicsContextGLProxy::renderbufferStorageMultisample): (WebKit::RemoteGraphicsContextGLProxy::texStorage2D): (WebKit::RemoteGraphicsContextGLProxy::texStorage3D): (WebKit::RemoteGraphicsContextGLProxy::texImage3D): (WebKit::RemoteGraphicsContextGLProxy::texSubImage3D): (WebKit::RemoteGraphicsContextGLProxy::copyTexSubImage3D): (WebKit::RemoteGraphicsContextGLProxy::compressedTexImage3D): (WebKit::RemoteGraphicsContextGLProxy::compressedTexSubImage3D): (WebKit::RemoteGraphicsContextGLProxy::getFragDataLocation): (WebKit::RemoteGraphicsContextGLProxy::uniform1ui): (WebKit::RemoteGraphicsContextGLProxy::uniform2ui): (WebKit::RemoteGraphicsContextGLProxy::uniform3ui): (WebKit::RemoteGraphicsContextGLProxy::uniform4ui): (WebKit::RemoteGraphicsContextGLProxy::uniform1uiv): (WebKit::RemoteGraphicsContextGLProxy::uniform2uiv): (WebKit::RemoteGraphicsContextGLProxy::uniform3uiv): (WebKit::RemoteGraphicsContextGLProxy::uniform4uiv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2x3fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3x2fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2x4fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4x2fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3x4fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4x3fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4i): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4iv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4ui): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4uiv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribIPointer): (WebKit::RemoteGraphicsContextGLProxy::drawRangeElements): (WebKit::RemoteGraphicsContextGLProxy::drawBuffers): (WebKit::RemoteGraphicsContextGLProxy::clearBufferiv): (WebKit::RemoteGraphicsContextGLProxy::clearBufferuiv): (WebKit::RemoteGraphicsContextGLProxy::clearBufferfv): (WebKit::RemoteGraphicsContextGLProxy::clearBufferfi): (WebKit::RemoteGraphicsContextGLProxy::createQuery): (WebKit::RemoteGraphicsContextGLProxy::deleteQuery): (WebKit::RemoteGraphicsContextGLProxy::isQuery): (WebKit::RemoteGraphicsContextGLProxy::beginQuery): (WebKit::RemoteGraphicsContextGLProxy::endQuery): (WebKit::RemoteGraphicsContextGLProxy::getQuery): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectui): (WebKit::RemoteGraphicsContextGLProxy::createSampler): (WebKit::RemoteGraphicsContextGLProxy::deleteSampler): (WebKit::RemoteGraphicsContextGLProxy::isSampler): (WebKit::RemoteGraphicsContextGLProxy::bindSampler): (WebKit::RemoteGraphicsContextGLProxy::samplerParameteri): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterf): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterf): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameteri): (WebKit::RemoteGraphicsContextGLProxy::fenceSync): (WebKit::RemoteGraphicsContextGLProxy::isSync): (WebKit::RemoteGraphicsContextGLProxy::deleteSync): (WebKit::RemoteGraphicsContextGLProxy::clientWaitSync): (WebKit::RemoteGraphicsContextGLProxy::waitSync): (WebKit::RemoteGraphicsContextGLProxy::getSynci): (WebKit::RemoteGraphicsContextGLProxy::createTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::deleteTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::isTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::bindTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::beginTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::endTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::transformFeedbackVaryings): (WebKit::RemoteGraphicsContextGLProxy::getTransformFeedbackVarying): (WebKit::RemoteGraphicsContextGLProxy::pauseTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::resumeTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::bindBufferBase): (WebKit::RemoteGraphicsContextGLProxy::bindBufferRange): (WebKit::RemoteGraphicsContextGLProxy::getUniformIndices): (WebKit::RemoteGraphicsContextGLProxy::getActiveUniforms): (WebKit::RemoteGraphicsContextGLProxy::getUniformBlockIndex): (WebKit::RemoteGraphicsContextGLProxy::getActiveUniformBlockName): (WebKit::RemoteGraphicsContextGLProxy::uniformBlockBinding): (WebKit::RemoteGraphicsContextGLProxy::getActiveUniformBlockiv): (WebKit::RemoteGraphicsContextGLProxy::getGraphicsResetStatusARB): (WebKit::RemoteGraphicsContextGLProxy::blitFramebufferANGLE): (WebKit::RemoteGraphicsContextGLProxy::renderbufferStorageMultisampleANGLE): (WebKit::RemoteGraphicsContextGLProxy::createVertexArrayOES): (WebKit::RemoteGraphicsContextGLProxy::deleteVertexArrayOES): (WebKit::RemoteGraphicsContextGLProxy::isVertexArrayOES): (WebKit::RemoteGraphicsContextGLProxy::bindVertexArrayOES): (WebKit::RemoteGraphicsContextGLProxy::getTranslatedShaderSourceANGLE): (WebKit::RemoteGraphicsContextGLProxy::insertEventMarkerEXT): (WebKit::RemoteGraphicsContextGLProxy::pushGroupMarkerEXT): (WebKit::RemoteGraphicsContextGLProxy::popGroupMarkerEXT): (WebKit::RemoteGraphicsContextGLProxy::drawBuffersEXT): (WebKit::RemoteGraphicsContextGLProxy::drawArraysInstancedANGLE): (WebKit::RemoteGraphicsContextGLProxy::drawElementsInstancedANGLE): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribDivisorANGLE): (WebKit::RemoteGraphicsContextGLProxy::getInternalformativ): (WebKit::RemoteGraphicsContextGLProxy::readPixelsRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::texParameterfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::texParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getBufferPointervRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getInternalformativRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getVertexAttribIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getVertexAttribIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getUniformuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getBufferParameteri64vRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getFramebufferParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getProgramInterfaceivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getBooleani_vRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getMultisamplefvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getTexLevelParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getTexLevelParameterfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getPointervRobustANGLERobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getnUniformfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getnUniformivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getnUniformuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::texParameterIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::texParameterIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getTexParameterIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getTexParameterIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjecti64vRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectui64vRobustANGLE): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): * WebProcess/GPU/media/RemoteAudioSession.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: * WebProcess/GPU/media/RemoteLegacyCDMSession.cpp: * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/TextTrackPrivateRemote.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/Network/NetworkProcessConnection.h: * WebProcess/Network/WebResourceLoader.cpp: * WebProcess/Network/WebResourceLoader.h: * WebProcess/Network/WebSocketChannel.cpp: * WebProcess/Network/WebSocketChannel.h: * WebProcess/Network/WebSocketStream.cpp: * WebProcess/Network/WebSocketStream.h: * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createGraphicsContextGL const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::sendSyncWithDelayedReply): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleEditingKeyboardEvent): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setUseGPUProcessForWebGL): (WebKit::WebProcess::shouldUseRemoteRenderingForWebGL const): * WebProcess/WebProcess.h: 2020-12-09 Brent Fulgham REGRESSION(r269647) [Cocoa] Consume GPU sandbox extensions early in Web page creation flow https://bugs.webkit.org/show_bug.cgi?id=219659 Reviewed by Jer Noble. We need to consume GPU sandbox extensions earlier in the Web page creation flow so that API calls to things like muting video have the relevant mach connections available. This change corrects a regression introduced in Bug 218708 (r269647). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Move extension consumption earlier in the constructor. 2020-12-09 Carlos Garcia Campos WebDriver: add support for pen pointer events https://bugs.webkit.org/show_bug.cgi?id=219024 Reviewed by Brian Burg. Make it possible to synthesize pointer events for any pointer type. Add pen input source to automation and handle it when dispatching actions. * Shared/NativeWebMouseEvent.h: * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent): * Shared/WebMouseEvent.cpp: (WebKit::WebMouseEvent::WebMouseEvent): (WebKit::WebMouseEvent::encode const): (WebKit::WebMouseEvent::decode): * Shared/WebMouseEvent.h: (WebKit::WebMouseEvent::pointerId const): (WebKit::WebMouseEvent::pointerType const): * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (primaryPointerForType): (webkitWebViewBaseSynthesizeMouseEvent): * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: * UIProcess/Automation/Automation.json: * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputSourceState::emptyStateForSourceType): (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::simulateMouseInteraction): (WebKit::WebAutomationSession::performMouseInteraction): (WebKit::simulatedInputSourceTypeFromProtocolSourceType): (WebKit::WebAutomationSession::performInteractionSequence): * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): * UIProcess/Automation/mac/WebAutomationSessionMac.mm: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): * UIProcess/gtk/PointerLockManager.cpp: (WebKit::PointerLockManager::handleMotion): 2020-12-09 Stephan Szabo [PlayStation] Fix PlayStation GPU process code after r270563 https://bugs.webkit.org/show_bug.cgi?id=219682 Unreviewed build fix. Remove mediaPlayerRenderingModeChanged from playstation specific RemoteMediaPlayerProxyPlayStation file similar to the removals from other versions in r270563. * GPUProcess/media/playstation/RemoteMediaPlayerProxyPlayStation.cpp: 2020-12-09 Per Arne Vollan [macOS] Change Universal Access zoom in the UI process https://bugs.webkit.org/show_bug.cgi?id=219635 Reviewed by Darin Adler. Implement the method changeUniversalAccessZoomFocus in the WebProcess' chrome client, which will send a message to the UI process, where the Universal Access zoom will be changed. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::changeUniversalAccessZoomFocus): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::changeUniversalAccessZoomFocus): * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-12-09 Ryosuke Niwa iOS build fix after r270573. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): 2020-12-09 Per Arne Vollan Remove access to com.apple.audio.toolbox.reporting.service https://bugs.webkit.org/show_bug.cgi?id=219638 Reviewed by Darin Adler. Remove access to com.apple.audio.toolbox.reporting.service for WebKit processes, since this is a logging service which is not needed for correctness. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-09 Sihui Liu Implement audio capture for SpeechRecognition on iOS https://bugs.webkit.org/show_bug.cgi?id=219371 Reviewed by Youenn Fablet. On iOS, audio capture is done in web process. For speech recognition, recognizer is in UI process. Therefore, UI process needs to ask web process to capture audio and send back data. To implement this, this patch added: - SpeechRecognitionRemoteRealtimeMediaSource: subclass WebCore::RealtimeMediaSource and connect to a remote WebCore::RealtimeMediaSource (owned by SpeechRecognitionRealtimeMediaSourceManager::Source) in web process. - SpeechRecognitionRemoteRealtimeMediaSourceManager: manage all RemoteRealtimeMediaSources. - SpeechRecognitionRealtimeMediaSourceManager: manage all SpeechRecognitionRemoteRealtimeMediaSource. - SpeechRecognitionRealtimeMediaSourceManager::Source: own and monitor a local WebCore::RealtimeMediaSource. This structure is very similar to how we implement media capture on macOS (RemoteRealtimeMediaSource, UserMediaCaptureManager and UserMediaCaptureManagerProxy), where we send data from UI process to web process instead. We should unify the architecture if possible. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: Added. (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::create): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::SpeechRecognitionRemoteRealtimeMediaSource): (WebKit::m_ringBuffer): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::~SpeechRecognitionRemoteRealtimeMediaSource): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::startProducingData): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::stopProducingData): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::remoteAudioSamplesAvailable): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::remoteCaptureFailed): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::remoteSourceStopped): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: Added. (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::identifier const): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: Added. (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::SpeechRecognitionRemoteRealtimeMediaSourceManager): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::addSource): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::removeSource): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::remoteAudioSamplesAvailable): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::remoteCaptureFailed): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::remoteSourceStopped): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::messageSenderConnection const): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::messageSenderDestinationID const): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::setStorage): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h: Added. * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.messages.in: Added. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::handleRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createRealtimeMediaSourceForSpeechRecognition): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): (WebKit::WebProcessProxy::ensureSpeechRecognitionRemoteRealtimeMediaSourceManager): * UIProcess/WebProcessProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: Added. (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::Source): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::~Source): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::start): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::stop): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::storage): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::SpeechRecognitionRealtimeMediaSourceManager): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::~SpeechRecognitionRealtimeMediaSourceManager): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::grantSandboxExtensions): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::revokeSandboxExtensions): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::createSource): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::deleteSource): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::start): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::stop): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::messageSenderConnection const): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::messageSenderDestinationID const): * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.h: Added. * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.messages.in: Added. * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::WebSpeechRecognitionConnection): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::ensureSpeechRecognitionRealtimeMediaSourceManager): * WebProcess/WebProcess.h: 2020-12-08 Kimmo Kinnunen IPC should support non-byte aligned data references https://bugs.webkit.org/show_bug.cgi?id=219487 Reviewed by Chris Dumez. Add a templated version of IPC::DataReference: ArrayReference. The number of elements can be omitted, in which case the ArrayReference size is determined at run-time. This way pointers of typed arrays such as float arrays can be transferred directly from the IPC message data store to the target. This is useful when implementing IPC for WebGL in GPU process. Changes IPC to support passing data references, i.e. DataReference or ArrayReference, as a synchronous IPC call return value. The caller must hold the Connection::syncSend() result (Decoder object) for the duration of using the data values. Makes DataReference an alias of uint8_t dynamic array reference. Unfortunately this makes the forward declaring DataReference hard. Due to this, changes use declaration sites to #include instead of using forward declarations. Removes forward declarations for headers where the type is not used. Adds various #includes to fix errors hidden by the unified build. Adds some WebCore:: namespace qualifications to fix errors hidden by the unified build. * GPUProcess/media/RemoteAudioSessionProxy.cpp: * GPUProcess/media/RemoteLegacyCDMProxy.cpp: * GPUProcess/media/RemoteLegacyCDMProxy.h: * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: * GPUProcess/media/RemoteMediaResourceManager.cpp: * GPUProcess/media/RemoteMediaResourceManager.h: * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.cpp: * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: * GPUProcess/webrtc/RemoteMediaRecorder.h: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: * NetworkProcess/Downloads/Download.cpp: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/NetworkSocketChannel.cpp: * NetworkProcess/NetworkSocketChannel.h: * NetworkProcess/NetworkSocketStream.cpp: * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: * NetworkProcess/WebSocketTask.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: * NetworkProcess/soup/WebSocketTaskSoup.cpp: * NetworkProcess/soup/WebSocketTaskSoup.h: * Platform/IPC/ArgumentCoders.h: * Platform/IPC/ArrayReference.h: Copied from Source/WebKit/Platform/IPC/DataReference.h. (IPC::ArrayReference::ArrayReference): (IPC::ArrayReference::isEmpty const): (IPC::ArrayReference::size const): (IPC::ArrayReference::data const): (IPC::ArrayReference::vector const): * Platform/IPC/Connection.h: (IPC::Connection::sendSync): * Platform/IPC/DataReference.cpp: Removed. * Platform/IPC/DataReference.h: * Platform/IPC/Decoder.cpp: (IPC::Decoder::decodeFixedLengthReference): * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.cpp: (IPC::Encoder::wrapForTesting): * Platform/IPC/Encoder.h: * Platform/IPC/HandleMessage.h: * Platform/IPC/MessageSender.h: (IPC::MessageSender::sendSync): * Platform/IPC/SharedBufferCopy.cpp: (IPC::SharedBufferCopy::decode): * Platform/IPC/SharedBufferDataReference.cpp: * Platform/IPC/StringReference.cpp: * PluginProcess/PluginControllerProxy.cpp: * PluginProcess/PluginControllerProxy.h: * Scripts/webkit/messages.py: * Shared/API/APIData.cpp: * Shared/cf/ArgumentCodersCF.cpp: * Shared/soup/WebCoreArgumentCodersSoup.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Sources.txt: * UIProcess/API/APIIconLoadingClient.h: * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::sendSync): * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h: * UIProcess/PageClient.h: * UIProcess/UserContent/WebUserContentControllerProxy.cpp: * UIProcess/UserContent/WebUserContentControllerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): * WebProcess/GPU/media/RemoteAudioSourceProvider.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: * WebProcess/GPU/media/RemoteLegacyCDMSession.cpp: * WebProcess/GPU/media/TextTrackPrivateRemote.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): * WebProcess/Network/NetworkProcessConnection.h: * WebProcess/Network/WebResourceLoader.cpp: * WebProcess/Network/WebResourceLoader.h: * WebProcess/Network/WebSocketChannel.cpp: * WebProcess/Network/WebSocketChannel.h: * WebProcess/Network/WebSocketStream.cpp: * WebProcess/Network/WebSocketStream.h: * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::sendSyncWithDelayedReply): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleEditingKeyboardEvent): 2020-12-08 Wenson Hsieh [Concurrent Display Lists] Add a new type to represent a set of GPU process wakeup arguments https://bugs.webkit.org/show_bug.cgi?id=219657 Reviewed by Tim Horton. Pull the initial item buffer identifier, offset, and destination image buffer identifier used to wake the GPU process out into a separate struct, in `GPUProcessWakeupMessageArguments.h`, and refactor both the web and GPU process-side rendering backends to use this new struct. This will greatly simplify future logic that will be added to address , which requires us to defer calling into the GPU process wakeup loop in more scenarios. No change in behavior. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Shared/GPUProcessWakeupMessageArguments.h: Added. (WebKit::GPUProcessWakeupMessageArguments::encode const): (WebKit::GPUProcessWakeupMessageArguments::decode): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::sendWakeupMessage): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-08 Peng Liu [Media in GPU Process][MSE] The GPU Process may crash in the destructor of MediaPlayerPrivateMediaSourceAVFObjC https://bugs.webkit.org/show_bug.cgi?id=219622 Reviewed by Eric Carlson. The purpose of `mediaPlayerRenderingModeChanged()` callback is to notify the media element that the player's rendering mode is changed, including the case that the layer is destroyed. So we should not operate on the layer in this function. With this patch, `RemoteMediaPlayerProxy` forwards the callback from the GPU process to the Web process. This patch also cleans up `RemoteMediaPlayerProxy.h`. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Deleted. * GPUProcess/media/gstreamer/RemoteMediaPlayerProxyGStreamer.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Deleted. * GPUProcess/media/win/RemoteMediaPlayerProxyWin.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::renderingModeChanged): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: 2020-12-08 Chris Dumez Potential crash under [WKRemoteObjectEncoder encodeObject:forKey:] when the object graph contains a cycle https://bugs.webkit.org/show_bug.cgi?id=219620 Reviewed by Geoffrey Garen. Update WKRemoteObjectEncoder to detect cycles when encoding objects. When a cycle is detected, we first attempt to encode a default-initialized object of the same type instead. If that fails, we raise a NSInvalidArgumentException. Based on crashes in the wild, we have evidence that such cycles are occuring and I suspect this is caused by Norton Safe Web extension somehow. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (-[WKRemoteObjectEncoder init]): (encodeObject): 2020-12-08 Simon Fraser Make ScrollingPerformanceLoggingEnabled an internal debug preference https://bugs.webkit.org/show_bug.cgi?id=219647 Reviewed by Sam Weinig. ScrollingPerformanceLoggingEnabled is used by a Safari performance test, so it needs to be easily toggleable from a script. That's easier if it's an Internal Debug preference. Testing also sets ForceUpdateScrollbarsOnMainThreadForPerformanceTesting but we can just use the ScrollingPerformanceLoggingEnabled flag, but it makes more sense to rename ScrollingPerformanceLoggingEnabled to ScrollingPerformanceTestingEnabled when we do that. Also fix how we propagate ScrollingPerformanceTestingEnabled to the scrolling tree; do so via ScrollingStateFrameScrollingNode as we do for the other tree-wide settings, removing code in TiledCoreAnimationDrawingArea::updatePreferences() that did this. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): (ArgumentCoder::decode): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetScrollingPerformanceLoggingEnabled): (WKPreferencesGetScrollingPerformanceLoggingEnabled): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::forceUpdateScrollbarsOnMainThreadForPerformanceTesting const): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updatePreferences): 2020-12-08 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.assertiond.processassertionconnection' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219637 Reviewed by Darin Adler. Deny mach-lookup to the service 'com.apple.assertiond.processassertionconnection' in the WebContent process on macOS, since there are no reports of this service being used. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-08 Alex Christensen Remove NSString overrelease in _WKUserContentExtensionStore https://bugs.webkit.org/show_bug.cgi?id=219621 Reviewed by Darin Adler. Gasp! * UIProcess/API/Cocoa/WKContentRuleListStore.mm: (-[WKContentRuleListStore compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]): (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]): 2020-12-08 Per Arne Vollan [macOS] Create sandbox extension for audio service when Media in GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=219540 Reviewed by Brent Fulgham. Create sandbox extension for com.apple.audio.SandboxHelper when Media in GPU process is not enabled. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-08 Chris Dumez [iOS] Stop leaking an XPC boost message to XPC services https://bugs.webkit.org/show_bug.cgi?id=219453 Reviewed by Geoffrey Garen. Stop leaking an XPC boost message to XPC services on builds where RunningBoard is able to give the right priorities to our XPC services based on the type of RunningBoard assertion is being held. There is no behavior change for the Network/WebContent processes since those were blocklisted in RunningBoard (Turning on the RB_full_manage_WK_jetsam feature flag gives us the default RunningBoard behavior without blocklisting). However, this allows the new GPUProcess to move to IDLE jetsam band when homing out of MobileSafari, which makes the GPUProcess eligible for the freezer. Previously, the leaked boost message would keep the GPUProcess in a higher jetsam band. * FeatureFlags/WebKit.plist: Add RB_full_manage_WK_jetsam feature flag and turn it on. On recent enough builds of RunningBoard, this disables the blocklisting of the WebContent/Network processes in RunningBoard so that RunningBoard can now set the priority of those processes (instead of us boosting our priority via boost messages). * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: Set _ProcessType=App so that RunningBoard is able to set the priority of our XPC services on iOS. Without this change, we get a permission denied when RunningBoard attempts to set the priority of our XPC services. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::shouldLeakBoost): Stop leaking a boost message on iOS when RUNNINGBOARD_WEBKIT_PRIORITY_SUPPORT compile-time flag is enabled and when the RB_full_manage_WK_jetsam feature flag is enabled. 2020-12-08 Ryan Hostetler Add target to create /usr/local to work around XBS Bug https://bugs.webkit.org/show_bug.cgi?id=219618 rdar://72064576 Reviewed by Jonathan Bedard. * WebKit.xcodeproj/project.pbxproj: Add a build target EmptyDSTROOT with script to create an empty folder "/usr/local". This allows WebKit to retain a unified XBS project name across different train configurations. 2020-12-07 Said Abou-Hallawa [GPU Process] Ensure the backend of ImageBuffer is created before getting its handle https://bugs.webkit.org/show_bug.cgi?id=219623 Reviewed by Tim Horton. In r270458 and in RemoteLayerBackingStore::encode(), casting the ImageBuffer and calling the overriding createImageBufferBackendHandle() of the superclass was replaced by casting the backend and calling its createImageBufferBackendHandle() directly. This may lead to crash if the backend was not created when calling its createImageBufferBackendHandle(). The createImageBufferBackendHandle() of the ImageBuffer superclass calls ensureBackendCreated() before calling createImageBufferBackendHandle() of the backend. So we need to replace to call backend() to ensureBackendCreated(). * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-12-07 Brent Fulgham Add sandbox telemetry for likely unused features https://bugs.webkit.org/show_bug.cgi?id=219544 Reviewed by Per Arne Vollan. Add telemetry to confirm the results of our manual review of the sandbox. Add 'hw.memsize' to the allowed sysctl's for the Network process on macOS, since it is needed by CFNetwork, and is already permitted on iOS. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Allow the 'hw.memsize' sysctl, which is needed by CFNetwork, and is already allowed on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add logging to confirm we do not need file-read-metadata for syslog. * WebProcess/com.apple.WebProcess.sb.in: Add logging to confirm BluetoothServices is not needed. 2020-12-07 Wenson Hsieh Ensure that DisplayListSharedMemoryHeader is never explicitly created or destroyed at compile-time https://bugs.webkit.org/show_bug.cgi?id=219609 Reviewed by Tim Horton. Make sure that a `DisplayListSharedMemoryHeader` is never created or destroyed by marking the constructor and destructor as deleted. A `DisplayListSharedMemoryHeader` should only ever be `reinterpret_cast`-ed from the first few bytes of a shared display list handle. * Shared/SharedDisplayListHandle.h: 2020-12-07 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.audio.SystemSoundServer-OSX' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219590 Reviewed by Brent Fulgham. After r269593, mach-lookup to the service 'com.apple.audio.SystemSoundServer-OSX' in the WebContent process can be denied. Test: fast/sandbox/mac/sandbox-mach-lookup.html * WebProcess/com.apple.WebProcess.sb.in: 2020-12-07 Don Olmstead [CMake] Remove WEBKIT_WRAP_SOURCELIST https://bugs.webkit.org/show_bug.cgi?id=196916 Reviewed by Michael Catanzaro. * PlatformFTW.cmake: * PlatformWin.cmake: 2020-12-07 Tim Horton Fix incorrect capitalization of ClearWheelEventTestMonitor IPC message name https://bugs.webkit.org/show_bug.cgi?id=219606 Reviewed by Wenson Hsieh. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): * WebProcess/WebPage/WebPage.messages.in: 2020-12-07 Chris Dumez [iOS] Add basic GPUProcess crash recovery logic to RemoteMediaSessionHelper https://bugs.webkit.org/show_bug.cgi?id=219494 Reviewed by Eric Carlson. * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp: (WebKit::RemoteMediaSessionHelper::RemoteMediaSessionHelper): (WebKit::RemoteMediaSessionHelper::connectToGPUProcess): (WebKit::RemoteMediaSessionHelper::gpuProcessConnectionDidClose): * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h: 2020-12-07 Commit Queue Unreviewed, reverting r270498. https://bugs.webkit.org/show_bug.cgi?id=219596 Broke the build as it landed simultaneously with a more complete fix Reverted changeset: "Unreviewed. Add the switch case handling missed out from r270415." https://trac.webkit.org/changeset/270498 2020-12-07 Lauro Moura Fix warnings when GPUProcess is disabled https://bugs.webkit.org/show_bug.cgi?id=219587 Reviewed by Žan Doberšek. * UIProcess/API/glib/WebKitNavigationClient.cpp: Handle new enum value in switch after r270415. * WebProcess/WebPage/DrawingArea.cpp: (WebKit::DrawingArea::supportsGPUProcessRendering): Default returning false when GPUProcess is disabled. 2020-12-07 Joonghun Park Unreviewed. Add the switch case handling missed out from r270415. This change removes the build warning below. warning: enumeration value ‘RequestedByGPUProcess’ not handled in switch [-Wswitch] No new tests, no new behaviors. * UIProcess/API/glib/WebKitNavigationClient.cpp: 2020-12-06 Samuel Thibault [WebKit] Fix use of std::max_align_t https://bugs.webkit.org/show_bug.cgi?id=219579 Reviewed by Fujii Hironori. Standard says that it's alignof(std::max_align_t) that should be used, not its size, e.g. https://en.cppreference.com/w/cpp/types/max_align_t and indeed at least with gcc 10's stddef.h, max_align_t is a structure containing a long long, a long double, and a float18, thus not a power of two. * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::headerSize): Use alignof(std::max_align_t) instead of sizeof(std::max_align_t). 2020-12-06 Lauro Moura Unreviewed. Add missing GPU_PROCESS guards around RemoteMediaEngineConfigurationFactory after r270462 https://bugs.webkit.org/show_bug.cgi?id=219578 Was breaking the Ubuntu LTS/Debian builds. * WebProcess/GPU/media/RemoteMediaEngineConfigurationFactory.cpp: * WebProcess/WebProcess.cpp: 2020-12-04 Wenson Hsieh [Concurrent display lists] Synchronize display list rendering across remote image buffers https://bugs.webkit.org/show_bug.cgi?id=219091 Reviewed by Geoff Garen. Refactors the existing concurrent display list processing mechanism, such that we no longer update the unread bytes count every 512 items (or when flushing the drawing context), and instead update it every time we append display list item data. In order to achieve this without making it impossible for multiple display-list backed image buffers to render simultaneously, we also add support for synchronizing display list items across different image buffers by using the new meta command items added in bug #219262. As detailed in the ChangeLog for that bug, a stream of display list data written by the web process and consumed by the GPU process is now structured like so: Wakeup message initiates display list processing with Image Buffer A and Item Buffer 1 | | MetaCommandChangeDestinationImageBuffer(B) | | | | MetaCommandChangeItemBuffer(2) | | | | | | v v v +-----------------------+--------------------------------++ | +--------------------+ +------------------------------+ | | | Destination | | Destination | | Item Buffer 1 | | Image Buffer A | | Image Buffer B | | | +--------------------+ +------------------------------+ | +---------------------------------------------------------+ +---------------------------------------------------------+ | +--------------+ +-----------------------+ | | | Dst. Image | | Destination Image | Unused | Item Buffer 2 | | Buffer B | | Buffer A | Capacity | | +--------------+ +-----------------------+ | +-----------------+-------------------------+-------------+ ^ | | MetaCommandChangeDestinationImageBuffer(A) (Note that the `MetaCommandEnd` item has been omitted, since we no longer need to explicitly tell the GPU process to go to sleep with the latest iteration of this patch). In order to write display list data conforming to this format, we add a mechanism to the web process that keeps track of the "current destination image buffer" (i.e. the image buffer that has most recently appended a display list item). Right before this destination is about to change, we append a new `MetaCommandChangeDestinationImageBuffer` item before proceeding to append display list items for the new current destination. Since we now bump the unread count every time, we need to do some additional work to avoid an excessive number of wakeups and sleeps in the GPU process, which would otherwise cause a massive regression. To do this, we introduce an item count hysteresis in the web process, such that we will wait for 512 items to be written before attempting to send the wakeup message. This allows the web process to get a small head start over the GPU process, and thus allows the GPU process to be more consistently busy over the course of a single frame. On the reader (GPU process) side, we make some minor adjustments so that the main display list processing loop of the GPU process is capable of changing destination image buffers while processing a stream of display list items. See below for more details. * GPUProcess/graphics/DisplayListReaderHandle.cpp: (WebKit::DisplayListReaderHandle::advance): Update `advance` so that it just performs a single 8-byte atomic `exchangeSub` rather than grabbing a spinlock. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::submit): (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): Rename `applyDisplayListsFromHandle` to `nextDestinationImageBufferAfterApplyingDisplayLists`, and make it return the current image buffer to use as the destination for replaying display list commands. This helper is still responsible for replaying a display list item buffer until it has no more data (that is, until we encounter a `MetaCommandChangeItemBuffer` item informing us of the next item buffer to consume). (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): Adjust this to call `nextDestinationImageBufferAfterApplyingDisplayLists`. (WebKit::RemoteRenderingBackend::decodeItem): (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/SharedDisplayListHandle.h: Remove `SharedDisplayListHandle::Lock` altogether, now that we just have a single atomic `uint64_t` counter to represent the number of unread bytes. (WebKit::SharedDisplayListHandle::unreadBytes): (WebKit::SharedDisplayListHandle::Lock::Lock): Deleted. (WebKit::SharedDisplayListHandle::Lock::~Lock): Deleted. * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: (WebKit::DisplayListWriterHandle::advance): Make this use the single atomic counter, instead of grabbing a spinlock. (WebKit::DisplayListWriterHandle::moveWritableOffsetToStartIfPossible): (WebKit::DisplayListWriterHandle::resetWritableOffsetIfPossible): Deleted. Rename `resetWritableOffsetIfPossible` to the more accurate `moveWritableOffsetToStartIfPossible`. * WebProcess/GPU/graphics/DisplayListWriterHandle.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::changeDestinationImageBuffer): Add a helper method to append a `MetaCommandChangeDestinationImageBuffer` item to the display list, given the identifier of this next item buffer. (WebKit::RemoteImageBufferProxy::clearDisplayList): Add a helper method to clear the display list, such that the `RemoteImageBufferProxy` will be asked for a new buffer handle the next time we append an item. (WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout): Make this hit the maximum `waitForAndDispatchImmediately` attempt count and "fail" only if the call to `waitForAndDispatchImmediately` actually times out. This change is necessary to ensure that the scenario of multiple image buffers simultaneously appending display list items works when all image buffers perform (non- blocking) flushes simultaneously, followed by a sync-wait (blocking) flush. In this situation, the web process may receive more than three `DidFlush` messages in rapid succession, causing it to hit this maximum limit of 3 instantly and avoid waiting for the expected `DidFlush` message to arrive. (WebKit::RemoteImageBufferProxy::submitDisplayList): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose): Reset state when the GPU process is terminated. (WebKit::RemoteRenderingBackendProxy::willAppendItem): Update the current destination image buffer (`m_currentDestinationImageBufferIdentifier`). If this identifier changed, then we append a `MetaCommandChangeDestinationImageBuffer` item to the previous destination before setting the new destination image buffer. We also need to clear the new destination image buffer's display list before writing new items, to prevent it from overwriting shared display list item data. (WebKit::RemoteRenderingBackendProxy::sendWakeupMessage): (WebKit::RemoteRenderingBackendProxy::sendDeferredWakeupMessageIfNeeded): (WebKit::RemoteRenderingBackendProxy::didAppendData): Implement a new `ItemBufferWritingClient` hook by advancing the corresponding item buffer's unread count. Additionally, schedule a wakeup message in the case where the unread count was zero when we advanced, and the item buffer we've appended to is not "connected" to a previous item buffer by way of an item buffer change item. Additionally, in the case where we don't schedule a new wakeup message, check whether or not there is a deferred wakeup message; if there is, then decrement the remaining item count before we send the wakeup message, and send the message if the count reaches 0. (WebKit::RemoteRenderingBackendProxy::findReusableDisplayListHandle): Pull logic to find a shared display list handle suitable for reuse into a separate helper method, and adjust it so that if the most recently used display list handle has run out of available capacity, we move it to the end of the reuse queue and only reuse the new first shared handle in the queue if its writable offset can be reset. This ensures that the GPU process can always continue reading display list item data from the start of new item buffers -- i.e., we don't end up with the web process writing out a stream of display list data like: (Start) Bytes (16, 65520) in ItemBuffer[1] Bytes (16, 65536) in ItemBuffer[2] Bytes (65520, 65536) in ItemBuffer[1] (WebKit::RemoteRenderingBackendProxy::createItemBuffer): (WebKit::RemoteRenderingBackendProxy::submitDisplayList): Deleted. (WebKit::RemoteRenderingBackendProxy::updateReusableHandles): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-05 Fujii Hironori Remove ENABLE_GRAPHICS_CONTEXT_GL by replacing it with ENABLE(WEBGL) https://bugs.webkit.org/show_bug.cgi?id=219551 Reviewed by Kenneth Russell. * CMakeLists.txt: * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleGPU): * UIProcess/gtk/HardwareAccelerationManager.cpp: (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): 2020-12-04 Said Abou-Hallawa [GPU Process] Remove ConcreteShareableImageBuffer https://bugs.webkit.org/show_bug.cgi?id=219563 Reviewed by Simon Fraser. Delete this class since the only function it implements: 'createImageBufferBackendHandle()' is not used. * Shared/ConcreteShareableImageBuffer.h: Removed. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): 2020-12-04 Wenson Hsieh [iOS] Cancel image extraction when navigating https://bugs.webkit.org/show_bug.cgi?id=219559 Reviewed by Tim Horton. Call `-_cancelImageExtraction` during mainframe navigation. See WebKitAdditions change for more information. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView _didStartProvisionalLoadForMainFrame]): 2020-12-04 Jer Noble [Cocoa] Adopt AVOutputDevice.allowsHeadTrackedSpatialAudio https://bugs.webkit.org/show_bug.cgi?id=219503 Reviewed by Eric Carlson. Adopt the "com.apple.avfoundation.allow-system-wide-context" entitlement on macOS for both the WebContent and GPU processes. * Scripts/process-entitlements.sh: 2020-12-04 Jer Noble [GPUP] Move MediaCapabilities into the GPU process https://bugs.webkit.org/show_bug.cgi?id=219521 Reviewed by Eric Carlson. Add a new pair of process supplements, RemoteMediaEngineConfigurationFactory and ..Proxy. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::mediaEngineConfigurationFactoryProxy): (WebKit::GPUConnectionToWebProcess::dispatchMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.cpp: Added. (WebKit::RemoteMediaEngineConfigurationFactoryProxy::RemoteMediaEngineConfigurationFactoryProxy): (WebKit::createDecodingConfiguration): (WebKit::RemoteMediaEngineConfigurationFactoryProxy::createEncodingConfiguration): * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.h: Added. * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.messages.in: Added. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::mediaEngineConfigurationFactory): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: * WebProcess/GPU/media/RemoteMediaEngineConfigurationFactory.cpp: Added. (WebKit::RemoteMediaEngineConfigurationFactory::RemoteMediaEngineConfigurationFactory): (WebKit::RemoteMediaEngineConfigurationFactory::registerFactory): (WebKit::RemoteMediaEngineConfigurationFactory::supplementName): (WebKit::RemoteMediaEngineConfigurationFactory::gpuProcessConnection): (WebKit::RemoteMediaEngineConfigurationFactory::createDecodingConfiguration): (WebKit::RemoteMediaEngineConfigurationFactory::createEncodingConfiguration): * WebProcess/GPU/media/RemoteMediaEngineConfigurationFactory.h: Copied from Source/WTF/wtf/Algorithms.h. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setUseGPUProcessForMedia): 2020-12-04 Said Abou-Hallawa [GPU Process] Clean up recreating the ImageBufferBackend because of GPU crashing https://bugs.webkit.org/show_bug.cgi?id=219007 Reviewed by Simon Fraser. There is no need to store the backend parameters in RemoteImageBufferProxy. These parameters are now stored in the base class ImageBuffer before the backend is created. Remove the traits definition for RemoteImageBufferProxy types because they are wrong. All ImageBuffers have valid renderingResourceIdentifier() regardless whether they are remote or not. ImageBuffer::setBackend and ImageBuffer::submitDisplayList() are now implemented in WebCore. So no casting is needed. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::RemoteImageBuffer): (WebKit::RemoteImageBuffer::submitDisplayList): Deleted. submitDisplayList() is now a virtual method of ImageBuffer. So make it private and ignore the return of DisplayList::Replayer::replay() since the caller does not use it. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::didCreateImageBufferBackend): (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle): (WebKit::RemoteRenderingBackend::imageBufferBackendWasCreated): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.h: Rename 'imageBufferBackendWasCreated()' to 'didCreateImageBufferBackend()' to be consistent with 'didFlush()'. * Shared/ConcreteShareableImageBuffer.h: (WebKit::ConcreteShareableImageBuffer::create): (WebKit::ConcreteShareableImageBuffer::ConcreteShareableImageBuffer): Deleted. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): Call the function with the new name and delete the FIXME comment. * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::create): (WebKit::ImageBufferShareableBitmapBackend::ImageBufferShareableBitmapBackend): (WebKit::ImageBufferShareableBitmapBackend::backendSize const): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: Use the new structure 'ImageBufferBackend::Parameters'. Implement the virtual method 'backendSize()'. * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: (isType): Deleted. Delete the wrong traits. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): Use the new structure 'ImageBufferBackend::Parameters'. (WebKit::RemoteImageBufferProxy::clearBackend): Deleted. (WebKit::RemoteImageBufferProxy::createBackend): Deleted. (WebKit::RemoteImageBufferProxy::didFlush): Deleted. (WebKit::RemoteImageBufferProxy::size const): Deleted. (WebKit::RemoteImageBufferProxy::renderingMode const): Deleted. (WebKit::RemoteImageBufferProxy::colorSpace const): Deleted. (WebKit::RemoteImageBufferProxy::pixelFormat const): Deleted. These functions are now implemented in ConcreteImageBuffer. (WebKit::RemoteImageBufferProxy::submitDisplayList): Deleted. submitDisplayList() is now virtual. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::reestablishGPUProcessConnection): (WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend): (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::didCreateImageBufferBackend): (WebKit::RemoteRenderingBackendProxy::didFlush): (WebKit::recreateImageBuffer): Deleted. (WebKit::RemoteRenderingBackendProxy::waitForImageBufferBackendWasCreated): Deleted. (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: No need to cast the ImageBuffer to RemoteImageBufferProxy since all what RemoteRenderingBackendProxy needs can be accessed through the base class. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: Rename 'ImageBufferBackendWasCreated' to 'DidCreateImageBufferBackend' to be consistent with 'DidFlush'. No need to pass the creation parameters since they set in the ConcreteImageBuffer. No need to pass the backendSize since it can be retrieved through the backend itself. * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableIOSurfaceBackend::create): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.h: Use the new structure 'ImageBufferBackend::Parameters'. 2020-12-04 John Wilander PCM: Switch to 8+4 bits for source IDs and trigger values respectively https://bugs.webkit.org/show_bug.cgi?id=219519 Reviewed by Brent Fulgham. We've received a lot of feedback saying increased entropy on the click side is more important than the current 6 bits on the conversion side. Some of that conversation is captured in https://github.com/privacycg/private-click-measurement/issues/28. This patch switches from 6+6 bits to 8+4 bits. It also makes sure PCM Debug Mode consistently logs on the LOG level except for real errors. Existing layout tests and API tests were updated. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): 2020-12-04 Commit Queue Unreviewed, reverting r270422. https://bugs.webkit.org/show_bug.cgi?id=219554 Deleted an SPI that is still in use. Reverted changeset: "Introduce new download API" https://bugs.webkit.org/show_bug.cgi?id=217747 https://trac.webkit.org/changeset/270422 2020-12-04 Brian Burg Web Inspector: InspectorFrontendAPIDispatcher should not ignore all exceptions https://bugs.webkit.org/show_bug.cgi?id=219378 Reviewed by Devin Rousso. The underlying method used for frontend expression evaluations is ScriptController::evaluateIgnoringExceptions. This method calls evaluateInWorld and returns nullopt if an exception happens. Switch to using evaluateInWorld directly and using the existing ValueOrException type from in WebCore. Change our EvaluationResult type to use ValueOrException in place of JSC::JSValue. ValueOrException is Expected so this is exposing more error information in addition to the JSC::JSValue. * Platform/Logging.h: Add 'Inspector' log channel for WebKit.framework. * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController): Remove unnecessary debugging code that was accidentally left in/commented out. * WebProcess/Inspector/WebInspectorUIExtensionController.h: (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromResult): Deleted. (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromEvaluationResult): Added. (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): Adapt to using the new result type. Use the InspectorExtensionID type where possible. 2020-12-04 Kate Cheney Create API to enable/disable text interaction gestures in WKWebView https://bugs.webkit.org/show_bug.cgi?id=217784 Reviewed by Wenson Hsieh. Create a new API to disable text interaction gestures in a WKWebView. We have SPI for this for iOS, but it could be useful to other WebKit clients and on macOS. Add the API to WKPreferences, instead of WKWebViewConfiguration, so it can be changed on the fly. Deprecate the SPI. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences encodeWithCoder:]): (-[WKPreferences initWithCoder:]): (-[WKPreferences textInteractionEnabled]): (-[WKPreferences setTextInteractionEnabled:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration encodeWithCoder:]): (-[WKWebViewConfiguration initWithCoder:]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _textInteractionEnabled]): (-[WKWebViewConfiguration _setTextInteractionEnabled:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView pointIsNearMarkedText:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): (-[WKContentView _cascadeInteractionTintColor]): (-[WKContentView selectForWebView:]): (-[WKContentView selectAllForWebView:]): Add check for textInteractionEnabled in these select* functions because disabling text interaction should disable selection in WKWebView. * WebProcess/WebPage/WebPage.cpp: Update the textInteractionEnabled value in the page when preferences are updated. (WebKit::WebPage::updatePreferences): 2020-12-04 Adam Roben More FALLBACK_PLATFORM adoption https://bugs.webkit.org/show_bug.cgi?id=219545 Reviewed by Tim Horton. * Configurations/SDKVariant.xcconfig: WK_EMPTY_$(THIS_IS_NOT_EMPTY) evaluates to the empty string, not to NO. 2020-12-04 Said Abou-Hallawa [GPU Process] Share the NativeImage with GPU Process through a ShareableBitmap https://bugs.webkit.org/show_bug.cgi?id=218934 Reviewed by Tim Horton. Instead of relying on the IPC coders to transfer the NativeImage to the GPUP, we are going to move this logic to RemoteResourceCacheProxy and RemoteRenderingBackend. The NativeImage will be transfered as a handle of ShareableBitamp and a renderingResourceIdentifier. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::cacheNativeImage): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Shared/ShareableBitmap.h: (WebKit::ShareableBitmap::createPlatformImage): Add this helper function and avoid adding directive code in many places. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): Deleted. (IPC::ArgumentCoder>::decode): Deleted. * Shared/WebCoreArgumentCoders.h: * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::copyNativeImage const): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::cacheNativeImage): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::createShareableBitmapFromNativeImage): (WebKit::RemoteResourceCacheProxy::cacheNativeImage): 2020-12-04 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219541 Reviewed by Darin Adler. On macOS, deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebContent process, since there are no reports of this being used. No new tests, since the result will depend on the macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-04 Devin Rousso [iOS] Provide a context menu action to perform accessibility image extraction https://bugs.webkit.org/show_bug.cgi?id=219524 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/_WKElementAction.h: * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): (+[_WKElementAction imageForElementActionType:]): (elementActionTypeToUIActionIdentifier): (uiActionIdentifierToElementActionType): Add a new `_WKElementActionTypeImageExtraction` enum type with a default icon and title. * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant defaultActionsForLinkSheet:]): (-[WKActionSheetAssistant defaultActionsForImageSheet:]): (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): If the `WKActionSheetAssistantDelegate` allows it, add a `_WKElementActionTypeImageExtraction` action for images (including those inside links). Call out to the `WKActionSheetAssistantDelegate` when handling the action. 2020-12-04 Peng Liu [MSE] Move track buffer management from SourceBuffer to SourceBufferPrivate https://bugs.webkit.org/show_bug.cgi?id=219332 Reviewed by Daniel Bates. Update `SourceBufferPrivateRemote` and `RemoteSourceBufferProxy` because of the changes on `SourceBufferPrivate` and `SourceBufferPrivateClient`. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidParseSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidDropSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateStreamEndedWithDecodeError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasAudio const): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasVideo const): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveSample): Deleted. (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReenqueSamples): Deleted. (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidBecomeReadyForMoreSamples): Deleted. (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateFastSeekTimeForMediaTime): Deleted. * GPUProcess/media/RemoteSourceBufferProxy.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::setClient): Deleted. * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-04 Kimmo Kinnunen GPU Process WindowServer blocking prevents CGL https://bugs.webkit.org/show_bug.cgi?id=219431 Reviewed by Per Arne Vollan. Mark the GPU process as NSSupportsAutomaticGraphicsSwitching. This allows CGL to work in cases when WindowServer connection is blocked. No new tests, makes the future WebGL in GPU process work. * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist: 2020-12-03 Simon Fraser Only the first wheel event in a gesture should be cancelable https://bugs.webkit.org/show_bug.cgi?id=218764 Reviewed by Tim Horton. In EventDispatcher::wheelEvent(), all wheel events now bounce through the scrolling thread, even those destined for main thread scrolling. This allows the scrolling thread to wait on a condition for the event to come back to the scrolling thread via handleWheelEventAfterMainThread(), since we have to know whether content called preventDefault() on the first event before sending subsequent events. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-12-03 Alex Christensen Introduce new download API https://bugs.webkit.org/show_bug.cgi?id=217747 Reviewed by Brady Eidson. Safari currently uses _WKDownload, which has evolved strangely over the last decade. In order to make a nicer interface, we need to learn from those lessons and take a step back. I did that, and here's what I came up with: WKDownload and WKDownloadDelegate! Notable changes include: 1. The delegate now lives on the download object instead of the process pool. 2. WKDownload does not conform to NSCopying because we have NSMapTable instead of NSDictionary. 3. publishProgressAtURL is gone. That will be reimplemented in the UI process of the client that used it. 4. cancel has a completion handler to get the resume data instead of waiting for didCancel then getting it from the download object. 5. didFailWithError also gives you the resume data, so there is no way to get it from the download object. That's more about a fail/cancel event than a property of the download. 6. wasUserInitiated is gone. Instead, WKNavigationDelegate has a callback that links a navigation action (where _isUserInitiated is exposed) to the download. 7. redirectChain is also gone. That can also be gotten from the link to the navigation and the download delegate's redirect callback. 8. _downloadDidStart is gone. Instead, we have completion handlers that expose a WKDownload once it's started. There's no need to reference the download object before then anyways. Note: that's when the download "starts" which is before it receives the response, so there will be no server delay in the difference between download object availabilities. 9. didReceiveServerRedirectToURL now gives you the option of continuing or cancelling. This reflects the amount of control the WKNavigationDelegate has. 10. decideDestinationWithSuggestedFilename and didReceiveResponse have been merged, since they actually happen at the same time and NSURLResponse has suggestedFilename API. allowOverwrite is also gone. It wasn't used, and not really needed. 11. didCreateDestination is gone. That callback time wasn't really necessary. If you need to know when it's created, wait until the first didWriteData callback. The destination has definitely been created by then. 12. shouldDecodeSourceDataOfMIMEType is gone. It's actually not called since we adopted NSURLSession, and we should remove the related dead code. 13. originatingFrame is gone. On _WKDownload it was actually a non-null WKFrameInfo that often contained no information. When information was there, the information access has been replaced by didBecomeDownload which links the WKNavigationResponse which has frame info on it. I wrote API tests for everything I could think of. * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::resumeDownload): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): (WebKit::Download::platformCancelNetworkLoad): * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::suggestedFilename const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::resumeDownload): (WebKit::NetworkProcess::findPendingDownloadLocation): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): * Scripts/webkit/messages.py: * Shared/API/Cocoa/WebKit.h: * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIDownloadClient.h: (API::DownloadClient::legacyDidStart): (API::DownloadClient::didFail): (API::DownloadClient::didStart): Deleted. * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::navigationResponseDidBecomeDownload): (API::NavigationClient::navigationActionDidBecomeDownload): (API::NavigationClient::contextMenuDidCreateDownload): * UIProcess/API/APIPolicyClient.h: (API::PolicyClient::decidePolicyForNavigationAction): (API::PolicyClient::decidePolicyForNewWindowAction): * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKContextDownloadClient.h: Removed. * UIProcess/API/C/WKDownload.cpp: Removed. * UIProcess/API/C/WKDownloadClient.h: Added. * UIProcess/API/C/WKDownloadRef.cpp: Added. (WKDownloadGetTypeID): (WKDownloadCopyRequest): (WKDownloadCancel): (WKDownloadGetOriginatingPage): (WKDownloadGetWasUserInitiated): (WKDownloadSetClient): * UIProcess/API/C/WKDownloadRef.h: Renamed from Source/WebKit/UIProcess/API/C/WKDownload.h. * UIProcess/API/C/WKNavigationActionRef.cpp: (WKNavigationActionGetDownloadAttribute): (WKNavigationActionShouldPerformDownload): Deleted. * UIProcess/API/C/WKNavigationActionRef.h: * UIProcess/API/C/WKPage.cpp: (WKPageSetPagePolicyClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageNavigationClient.h: * UIProcess/API/Cocoa/WKDownload.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownload.h. * UIProcess/API/Cocoa/WKDownload.mm: Added. (-[WKDownload cancel:]): (-[WKDownload originalRequest]): (-[WKDownload delegate]): (-[WKDownload setDelegate:]): (-[WKDownload dealloc]): (-[WKDownload _apiObject]): * UIProcess/API/Cocoa/WKDownloadDelegate.h: Added. * UIProcess/API/Cocoa/WKDownloadInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownloadInternal.h. * UIProcess/API/Cocoa/WKNavigationAction.h: * UIProcess/API/Cocoa/WKNavigationAction.mm: (-[WKNavigationAction downloadAttribute]): (-[WKNavigationAction _shouldPerformDownload]): * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _downloadURLRequest:websiteDataStore:originatingWebView:]): (-[WKProcessPool _resumeDownloadFromData:websiteDataStore:path:originatingWebView:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView downloadRequest:completionHandler:]): (-[WKWebView resumeDownloadWithData:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload initWithDownload2:]): (+[_WKDownload downloadWithDownload:]): (-[_WKDownload cancel]): (-[_WKDownload publishProgressAtURL:]): (-[_WKDownload request]): (-[_WKDownload originatingWebView]): (-[_WKDownload redirectChain]): (-[_WKDownload wasUserInitiated]): (-[_WKDownload resumeData]): (-[_WKDownload originatingFrame]): (-[_WKDownload _apiObject]): (-[_WKDownload dealloc]): Deleted. * UIProcess/API/Cocoa/_WKDownloadDelegate.h: * UIProcess/API/Cocoa/_WKDownloadInternal.h: * UIProcess/API/glib/WebKitDownloadClient.cpp: * UIProcess/Cocoa/LegacyDownloadClient.h: * UIProcess/Cocoa/LegacyDownloadClient.mm: (WebKit::LegacyDownloadClient::legacyDidStart): (WebKit::LegacyDownloadClient::didReceiveResponse): (WebKit::LegacyDownloadClient::didReceiveData): (WebKit::LegacyDownloadClient::didReceiveAuthenticationChallenge): (WebKit::LegacyDownloadClient::didCreateDestination): (WebKit::LegacyDownloadClient::processDidCrash): (WebKit::LegacyDownloadClient::decideDestinationWithSuggestedFilename): (WebKit::LegacyDownloadClient::didFinish): (WebKit::LegacyDownloadClient::didFail): (WebKit::LegacyDownloadClient::legacyDidCancel): (WebKit::LegacyDownloadClient::willSendRequest): (WebKit::LegacyDownloadClient::didStart): Deleted. * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): (WebKit::NavigationState::NavigationClient::navigationActionDidBecomeDownload): (WebKit::NavigationState::NavigationClient::navigationResponseDidBecomeDownload): (WebKit::NavigationState::NavigationClient::contextMenuDidCreateDownload): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::~DownloadProxy): (WebKit::DownloadProxy::didStart): (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): (WebKit::DownloadProxy::didFail): (WebKit::DownloadProxy::setClient): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setDidStartCallback): (WebKit::DownloadProxy::setSuggestedFilename): * UIProcess/Network/NetworkProcessProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::resumeDownload): (WebKit::WebPageProxy::downloadRequest): (WebKit::WebPageProxy::contextMenuItemSelected): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::resumeDownload): * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2020-12-03 Adam Roben Adopt FALLBACK_PLATFORM https://bugs.webkit.org/show_bug.cgi?id=219504 Reviewed by Tim Horton. * Configurations/SDKVariant.xcconfig: * Scripts/check-xcfilelists.sh: Use FALLBACK_PLATFORM it if it's defined, otherwise use PLATFORM_NAME as before. 2020-12-03 Chris Dumez Drop unimplemented suspension functions on GPUConnectionToWebProcess and WebAuthnConnectionToWebProcess https://bugs.webkit.org/show_bug.cgi?id=219513 Reviewed by Tim Horton. These functions are never called and have no implementation. This is just bad copy/paste from NetworkConnectionToWebProcess. * GPUProcess/GPUConnectionToWebProcess.h: * WebAuthnProcess/WebAuthnConnectionToWebProcess.h: 2020-12-03 Brent Fulgham [macOS] Only extend access to the AppleSNBFBUserClient IOKit class if the GPU Process is not used https://bugs.webkit.org/show_bug.cgi?id=219014 Reviewed by Per Arne Vollan. Instead of globally extending access to the AppleSNBFBUserClient IOKit class, only extend it when the GPU process is not in use. * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): Add 'AppleSNBFBUserClient' as a dynamically-extended IOKit class. * WebProcess/com.apple.WebProcess.sb.in: Only allow 'AppleSNBFBUserClient' if it was dynamically extended. 2020-12-03 Said Abou-Hallawa [GPU Process] Disconnect NativeImages from RemoteResourceCacheProxy when RemoteRenderingBackendProxy is destroyed https://bugs.webkit.org/show_bug.cgi?id=219417 Reviewed by Tim Horton. If the WebPage is destroyed before destroying the CachedImages, a crash may happen. The NativeImage will try to release itself from its observer, which is RemoteResourceCacheProxy, after it has been freed. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::~RemoteResourceCacheProxy): (WebKit::RemoteResourceCacheProxy::cacheNativeImage): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2020-12-03 Chris Dumez Bad IPC from the WebProcess should not terminate the GPUProcess https://bugs.webkit.org/show_bug.cgi?id=219511 Reviewed by Simon Fraser. Bad IPC from the WebProcess should not terminate the GPUProcess. The GPUProcess is shared by all WebProcesses and it is not acceptable for a single bad WebProcess to negatively impact other WebProcesses. Instead, we should terminate the bad WebProcess, like the NetworkProcess already does on bad IPC. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveInvalidMessage): * Shared/ProcessTerminationReason.h: * UIProcess/API/C/WKAPICast.h: (WebKit::toAPI): * UIProcess/Cocoa/NavigationState.mm: (WebKit::wkProcessTerminationReason): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::terminateWebProcess): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/GPU/GPUProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::shouldReloadAfterProcessTermination): 2020-12-03 Alex Christensen Serialize NFA to disk before converting it to a DFA when compiling a WKContentRuleList https://bugs.webkit.org/show_bug.cgi?id=219452 Reviewed by Geoffrey Garen. * UIProcess/API/Cocoa/WKContentRuleListStore.mm: (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]): * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h: Remove NS_RELEASES_ARGUMENT because it was incorrect and unnecessary because the WTF::String is copied to a background thread. 2020-12-03 Chris Dumez Make sure the GPUConnectionToWebProcess gets destroyed when the connection to the WebProcess gets severed https://bugs.webkit.org/show_bug.cgi?id=219508 Reviewed by Geoffrey Garen. Make sure the GPUConnectionToWebProcess gets destroyed when the connection to the WebProcess gets severed (WebProcess exited normally or crashed). This is similar to what we do in the NetworkProcess for NetworkConnectionToWebProcess. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didClose): 2020-12-03 Tim Horton GPU Process: Sandbox violations under IOSurface::maximumSize in the Web Content process https://bugs.webkit.org/show_bug.cgi?id=219484 Reviewed by Ryosuke Niwa. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Fetch the maximum allowed size of an IOSurface on the current hardware in the UI process, and push it to the Web Content process on creation. 2020-12-03 Martin Robinson Move code from AxisScrollSnapOffsets to ScrollSnapOffsetsInfo https://bugs.webkit.org/show_bug.cgi?id=219345 Reviewed by Daniel Bates. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: Remove AxisScrollSnapOffsets.h include. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Ditto. 2020-12-02 Tim Horton Many different assertion failures on the GPU process bot after r270366 https://bugs.webkit.org/show_bug.cgi?id=219467 Reviewed by Simon Fraser. * WebProcess/WebPage/DrawingArea.cpp: (WebKit::DrawingArea::supportsGPUProcessRendering): * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: Disable DOM rendering in the GPU process if the DrawingArea doesn't support it. Currently only RemoteLayerTreeDrawingArea does. 2020-12-02 Tim Horton GPU Process: Temporarily disable Web Fonts when DOM rendering in the GPU process is enabled https://bugs.webkit.org/show_bug.cgi?id=219479 Reviewed by Simon Fraser. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Web fonts don't work in the GPU process yet, so disable them. Unstyled text is better than no text. 2020-12-02 Brent Fulgham [macOS] WebContent sandbox; remove AppleIntelMEUserClient https://bugs.webkit.org/show_bug.cgi?id=219012 Reviewed by Eric Carlson. Instead of globally extending access to the AppleIntelMEUserClient IOKit class, only extend it when the GPU process is not in use. * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): Add 'AppleIntelMEUserClient' as a dynamically-extended IOKit class. * WebProcess/com.apple.WebProcess.sb.in: Only allow 'AppleIntelMEUserClient' if it was dynamically extended. 2020-12-02 Wenson Hsieh Unreviewed, fix the iOS build after r270362 * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView createHighlightInCurrentGroupWithRange:]): (-[WKContentView createHighlightInNewGroupWithRange:]): 2020-12-02 Megan Gardner Create and draw app highlights https://bugs.webkit.org/show_bug.cgi?id=219365 Reviewed by Wenson Hsieh. Handle the creation of App Highlights from selections when the context menu item is selected. This patch will add the highlights to the Document's app Highlight register, and handle drawing them in InlineTextBox. Later patches will handle the persistent storage and repopulation of app highlights on launch or reload of a page. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createAppHighlightInSelectedRange): * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::contextMenuItemSelected): * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView createHighlightInCurrentGroupWithRange:]): (-[WKContentView createHighlightInNewGroupWithRange:]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createAppHighlightInSelectedRange): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-12-02 Brent Fulgham [iOS] Silence sandbox warning for unneeded sysctl-read of "hw.tbfrequency_compat" https://bugs.webkit.org/show_bug.cgi?id=219414 Reviewed by Per Arne Vollan. Silence a spurious log generated when our sandbox denies access to the unused sysctl "hw.tbfrequency_compat". I have confirmed with the framework that attempts to read this value, and they confirm they don't need the value, and actually are not using the result anywhere in their framework. Let's silence this report. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-12-02 Wenson Hsieh Entire image elements are sometimes selected after ending a image extraction interaction https://bugs.webkit.org/show_bug.cgi?id=219435 Reviewed by Megan Gardner. If the image extraction interaction is currently active, regular text interactions may need to defer to these image extraction interactions. See WebKitAdditions changes for more details. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): 2020-12-02 Wenson Hsieh Context menu should be shown after a long timeout following image extraction https://bugs.webkit.org/show_bug.cgi?id=219415 Reviewed by Andy Estes. Ensures that the context menu can still be shown when triggering an image extraction gesture. To do this, we add a new long press gesture recognizer with a much longer delay. See WebKitAdditions patch for more details. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView _doAfterPendingImageExtraction:]): (-[WKContentView _invokeAllActionsToPerformAfterPendingImageExtraction]): Drive-by fix: move a couple of methods out of WebKitAdditions and into non-internal source. 2020-12-01 Tim Horton GPU Process: IOSurfaces should not be mapped into the Web Content Process https://bugs.webkit.org/show_bug.cgi?id=219368 Reviewed by Said Abou-Hallawa. Since the Web Content process sandbox will eventually not have access to IOKit, it will not be able to map/lock/use IOSurfaces. Thankfully, all it really needs to be able to do is carry a reference to the surface from the GPU process to the UI process (where it is mapped and applied as layer contents). * GPUProcess/graphics/PlatformRemoteImageBuffer.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h: * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: (isType): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::reestablishGPUProcessConnection): (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackendProxy::didFlush): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableIOSurfaceBackend::create): (WebKit::ImageBufferShareableIOSurfaceBackend::createImageBufferBackendHandle const): (WebKit::ImageBufferShareableIOSurfaceBackend::context const): (WebKit::ImageBufferShareableIOSurfaceBackend::copyNativeImage const): (WebKit::ImageBufferShareableIOSurfaceBackend::copyImage const): (WebKit::ImageBufferShareableIOSurfaceBackend::draw): (WebKit::ImageBufferShareableIOSurfaceBackend::drawPattern): (WebKit::ImageBufferShareableIOSurfaceBackend::toDataURL const): (WebKit::ImageBufferShareableIOSurfaceBackend::toData const): (WebKit::ImageBufferShareableIOSurfaceBackend::toBGRAData const): (WebKit::ImageBufferShareableIOSurfaceBackend::getImageData const): (WebKit::ImageBufferShareableIOSurfaceBackend::putImageData): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp. (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create): (WebKit::ImageBufferShareableMappedIOSurfaceBackend::createImageBufferBackendHandle const): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h. Rename ImageBufferShareableIOSurfaceBackend to ImageBufferShareableMappedIOSurfaceBackend. Readd ImageBufferShareableIOSurfaceBackend, the unmapped variant. The mapped variant is only used: - in the GPU process - in the Web Content process when DOM rendering in the GPU process is disabled The unmapped variant cannot perform most ImageBufferBackend duties, except creating an ImageBufferBackendHandle, which it does by cloning the existing handle. It explicitly does *not* map the IOSurface in the process, and is meant for use in Web Content processes that do not have access to IOSurface. 2020-12-01 Peng Liu [Media In GPU Process][MSE] Add the support to forward initialization segment from the GPU Process to Web processes https://bugs.webkit.org/show_bug.cgi?id=219227 Reviewed by Eric Carlson. This patch adds the support to forward `sourceBufferPrivateDidReceiveInitializationSegment()` callback from the source buffer parser running in the GPU process to the `SourceBufferPrivateRemote` running in the Web process, which in turn provides the initialization segment to `SourceBuffer`. No change in behavior. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/InitializationSegmentInfo.h: Added. (WebKit::InitializationSegmentInfo::TrackInformation::encode const): (WebKit::InitializationSegmentInfo::TrackInformation::decode): (WebKit::InitializationSegmentInfo::encode const): (WebKit::InitializationSegmentInfo::decode): * GPUProcess/media/RemoteAudioTrackProxy.cpp: (WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy): (WebKit::RemoteAudioTrackProxy::~RemoteAudioTrackProxy): (WebKit::RemoteAudioTrackProxy::configurationChanged): (WebKit::RemoteAudioTrackProxy::willRemove): * GPUProcess/media/RemoteAudioTrackProxy.h: * GPUProcess/media/RemoteAudioTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in. * GPUProcess/media/RemoteMediaDescription.h: Added. (WebKit::MediaDescriptionInfo::encode const): (WebKit::MediaDescriptionInfo::decode): (WebKit::RemoteMediaDescription::RemoteMediaDescription): * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): (WebKit::RemoteMediaPlayerProxy::addRemoteAudioTrackProxy): (WebKit::RemoteMediaPlayerProxy::addRemoteVideoTrackProxy): (WebKit::RemoteMediaPlayerProxy::addRemoteTextTrackProxy): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddAudioTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveAudioTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddVideoTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveVideoTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddTextTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveTextTrack): (WebKit::RemoteMediaPlayerProxy::audioTrackSetEnabled): Deleted. (WebKit::RemoteMediaPlayerProxy::videoTrackSetSelected): Deleted. (WebKit::RemoteMediaPlayerProxy::textTrackSetMode): Deleted. * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::addSourceBuffer): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::create): (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy): (WebKit::RemoteTextTrackProxy::~RemoteTextTrackProxy): (WebKit::RemoteTextTrackProxy::configurationChanged): (WebKit::RemoteTextTrackProxy::willRemove): (WebKit::RemoteTextTrackProxy::addDataCue): (WebKit::RemoteTextTrackProxy::updateDataCue): (WebKit::RemoteTextTrackProxy::removeDataCue): (WebKit::RemoteTextTrackProxy::addGenericCue): (WebKit::RemoteTextTrackProxy::updateGenericCue): (WebKit::RemoteTextTrackProxy::removeGenericCue): (WebKit::RemoteTextTrackProxy::parseWebVTTFileHeader): (WebKit::RemoteTextTrackProxy::parseWebVTTCueData): * GPUProcess/media/RemoteTextTrackProxy.h: * GPUProcess/media/RemoteTextTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in. * GPUProcess/media/RemoteVideoTrackProxy.cpp: (WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy): (WebKit::RemoteVideoTrackProxy::~RemoteVideoTrackProxy): (WebKit::RemoteVideoTrackProxy::configurationChanged): (WebKit::RemoteVideoTrackProxy::willRemove): * GPUProcess/media/RemoteVideoTrackProxy.h: * GPUProcess/media/RemoteVideoTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in. * Scripts/webkit/messages.py: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/AudioTrackPrivateRemote.cpp: (WebKit::AudioTrackPrivateRemote::AudioTrackPrivateRemote): (WebKit::AudioTrackPrivateRemote::setEnabled): * WebProcess/GPU/media/AudioTrackPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::create): (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::addSourceBuffer): (WebKit::MediaSourcePrivateRemote::readyState const): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::create): (WebKit::SourceBufferPrivateRemote::SourceBufferPrivateRemote): (WebKit::SourceBufferPrivateRemote::readyState const): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: * WebProcess/GPU/media/TextTrackPrivateRemote.cpp: (WebKit::TextTrackPrivateRemote::TextTrackPrivateRemote): (WebKit::TextTrackPrivateRemote::setMode): * WebProcess/GPU/media/TextTrackPrivateRemote.h: * WebProcess/GPU/media/VideoTrackPrivateRemote.cpp: (WebKit::VideoTrackPrivateRemote::VideoTrackPrivateRemote): (WebKit::VideoTrackPrivateRemote::setSelected): * WebProcess/GPU/media/VideoTrackPrivateRemote.h: (WebKit::VideoTrackPrivateRemote::create): 2020-12-01 Wenson Hsieh [iOS] Support image extraction interactions for accessibility https://bugs.webkit.org/show_bug.cgi?id=219398 Reviewed by Devin Rousso. Adds support for a new accessibility feature related to images. Refer to the bug for more details. * Shared/ios/InteractionInformationRequest.cpp: (WebKit::InteractionInformationRequest::encode const): (WebKit::InteractionInformationRequest::decode): (WebKit::InteractionInformationRequest::isValidForRequest const): * Shared/ios/InteractionInformationRequest.h: Add a new flag to request image data via position information. This flag works similarly to the existing `includeSnapshot` flag, except that it only grabs data when the hit-tested node is an image. As such, a position information request with the `includeSnapshot` flag set is valid for an identical request with this new `includeImageData` flag set, but not vice versa. * SourcesCocoa.txt: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: Add various extension points for new WebKitAdditions snippets. (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): Call new methods to set up and tear down the image extraction interaction (defined in WebKitAdditions). (-[WKContentView _webTouchEventsRecognized:]): Upon starting a new gesture, reset the active (or pending) image extraction interaction, if appropriate. (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Allow the image extraction gesture to fire alongside any other gesture. (-[WKContentView _dragInteraction:prepareForSession:completion:]): (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]): These existing interactions may conflict with pending image extraction interactions. Luckily, since these interactions are both asynchronous, we're able to defer them until any pending image extraction request has finished, to determine whether or not they should commence. In both cases, image extraction should take precedence over dragging and context menus. * UIProcess/ios/WKImageExtractionGestureRecognizer.h: * UIProcess/ios/WKImageExtractionGestureRecognizer.mm: Add a new long press gesture recognizer that fires on a very short (100ms) delay. This gesture is used to preflight image extraction requests ahead of the other long press gestures (in particular, context menus), such that these other gestures should be minimally impacted by the time required to perform image extraction. This is still a long press gesture instead of a regular gesture recognizer, since preflighting image extraction requests could be expensive if performed during every single gesture (i.e. scrolling, taps, etc). (-[WKImageExtractionGestureRecognizer initWithDelegate:]): (-[WKImageExtractionGestureRecognizer setState:]): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::imagePositionInformation): 2020-12-01 Per Arne Vollan [macCatalyst] Embedded YouTube videos fail to play https://bugs.webkit.org/show_bug.cgi?id=219412 Reviewed by Tim Horton. Add a missing comma in list of Media services, for which sandbox extensions are created. The missing comma is causing a sandbox violation, since strings are concatenated when there's no comma. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): 2020-12-01 Per Arne Vollan [macOS] Deny mach lookup of 'com.apple.webinspector' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219386 Reviewed by Darin Adler. After r270035, mach-lookup of 'com.apple.webinspector' can be denied in the WebContent process on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-01 Brent Fulgham [macOS] Add telemetry for sandbox rules we believe are unused https://bugs.webkit.org/show_bug.cgi?id=219141 Reviewed by Per Arne Vollan. This patch adds telemetry to a set of sandbox features we believe are unused. We should capture telemetry to verify, and confirm before removing. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-01 Keith Rollin Consolidate header postprocessing scripts https://bugs.webkit.org/show_bug.cgi?id=219388 Reviewed by David Kilzer. Our build system contains the following scripts to perform some postprocessing of headers that we export to the SDK: JavaScriptCore/postprocess-headers.sh WebKit/mac/postprocess-framework-headers.sh WebKitLegacy/mac/postprocess-headers.sh The preceding scripts are used when using the non-XCBuild -- or "legacy" -- Xcode build system. They are invoked in a custom Run Script build phase after the headers have been exported with the standard Xcode facility for creating frameworks. Alternatively, we also have the following postprocessing scripts: WebKit/Scripts/postprocess-header-rule JavaScriptCore/Scripts/postprocess-header-rule WebKitLegacy/scripts/postprocess-header-rule These scripts are used when using the XCBuild build system. They are invoked *during* the header export process to copy and postprocess the headers in one blow. They are part of a Custom Build Rule for exporting files ending in ".h". The reason why we have two sets of scripts is because of the different capabilities of the two Xcode build systems. The legacy system does not support a custom "export header" step that would allow us to copy and postprocess each header in a single step. Therefore, when using the legacy build system, we export in one build step and postprocess in a subsequent build step. And XCBuild doesn't like the approach taken by the old build system where files are exported first and then munged in a separate step, since that confuses its notion of the state of the build ("Hey! That file I exported in the previous build? I see now that it's been changed, so I'm going to export it again. And change its modification date. And then rebuild everything downstream that uses it."). Therefore, XCBuild added a facility for copying and postprocessing in one step. The scripts supporting each of these approaches are very similar to each other, such that there is a lot of code duplication between them. At the same time, by having two sets of scripts that are very similar to each other, we run the risk of "drift", where files in one set may get updated while their counterparts in the other set are not. Address this duplication by making the scripts in the "legacy" set be mere stubs that invoke the scripts in the new "XCBuild" set. In doing this, we also fix a case of drift: the legacy-based scripts made use of a timestamp file to determine if headers needed to be reprocessed and exported, while the XCBuild-based scripts used a "process the files and export them if any actual changes now exist between this new version and any previously-exported version" approach. Along the way, fix a bug in WebKitLegacy's postprocess-header-rule that resulted in WebKitAvailability.h not being processed. The practical effect of this bug is that the file ended up with both macOS and iOS code, along with the #if that controlled which chunk of code was compiled, instead of just the chunk of code specific to the targeted SDK. Normally, the unused chunk of code would get removed through the invocation of `unifdef`. But, because of the bug, the results of running `unifdef` were being discarded. * mac/postprocess-framework-headers.sh: 2020-12-01 Kate Cheney ITP logging mixes up the UI process ITP state with the Settings ITP state https://bugs.webkit.org/show_bug.cgi?id=219359 Reviewed by Youenn Fablet. Update an ITP logging message in the network process which mixes up the variables for the ITP state passed from the UI process and the ITP value from Settings. No new tests, this only updates an incorrect logging message. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::activateSessionCleanup): 2020-12-01 Alejandro G. Castro [GTK][WPE] Async scrolling udpates are blocked in the main thread https://bugs.webkit.org/show_bug.cgi?id=219308 Reviewed by Simon Fraser. We need to use the EventDispatcher from the frameDone callback in the ThreadedCompositor, for GTK and WPE we receive the frame information in that thread. We have to notify the scrolling trees in the scrolling thread even if the main thread is busy or we will freeze when the main thread is busy. For that we use the API in the EventDispatcher. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::sceneUpdateFinished): Call the EventDispatcher to notify the scrolling trees a frame was rendered. * WebProcess/WebPage/EventDispatcher.cpp: Enable the compilation of the notify function for all the ports. * WebProcess/WebPage/EventDispatcher.h: Ditto. 2020-12-01 Tim Horton GPU Process: Invalid static_cast from ConcreteImageBuffer to RemoteImageBufferProxy https://bugs.webkit.org/show_bug.cgi?id=219387 Reviewed by Ryosuke Niwa. * Shared/ConcreteShareableImageBuffer.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h. (WebKit::ConcreteShareableImageBuffer::create): (WebKit::ConcreteShareableImageBuffer::ConcreteShareableImageBuffer): (WebKit::ConcreteShareableImageBuffer::createImageBufferBackendHandle): * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): * WebKit.xcodeproj/project.pbxproj: Add and adopt ConcreteShareableImageBuffer. This is a ConcreteImageBuffer that knows how to create an ImageBufferBackendHandle, with no other behavior change. Previously, we were (completely incorrectly) casting ConcreteImageBuffer to RemoteImageBufferProxy to get this behavior, and somehow just got very lucky. * WebProcess/GPU/media/RemoteAudioSession.cpp: Fix some unified source issues. 2020-11-30 Per Arne Vollan [macOS] Adopt SPI to prevent establishing XPC connections to Launch Services https://bugs.webkit.org/show_bug.cgi?id=219173 Reviewed by Alex Christensen. Adopt SPI to prevent establishing XPC connections to Launch Services in the WebContent process on macOS. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-30 Tim Horton Unreviewed, reverting r270275. Broke canvas painting Reverted changeset: "GPU Process: IOSurfaces should not be mapped into the Web Content Process" https://bugs.webkit.org/show_bug.cgi?id=219368 https://trac.webkit.org/changeset/270275 2020-11-30 Fujii Hironori [WinCairo?] GPU process remains alive even after UI process exited https://bugs.webkit.org/show_bug.cgi?id=219321 Reviewed by Don Olmstead. GPUConnectionToWebProcess::didClose is called when web process exits, and GPUProcess::didClose is called when UI process exits in GPU process. GPUProcess::didClose should terminate the GPU process. AuxiliaryProcess is the base class of GPUProcess. AuxiliaryProcess::didClose is calling _exit. However, GPUProcess overrode AuxiliaryProcess::didClose but it did nothing. GPUProcess doesn't need to override it. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::didClose): Deleted. * GPUProcess/GPUProcess.h: 2020-11-30 Simon Fraser Pass OptionSet to various wheel event handler functions https://bugs.webkit.org/show_bug.cgi?id=219373 Reviewed by Tim Horton. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::handleWheelEvent): 2020-11-30 Tim Horton GPU Process: IOSurfaces should not be mapped into the Web Content Process https://bugs.webkit.org/show_bug.cgi?id=219368 Reviewed by Ryosuke Niwa. Since the Web Content process sandbox will eventually not have access to IOKit, it will not be able to map/lock/use IOSurfaces. Thankfully, all it really needs to be able to do is carry a reference to the surface from the GPU process to the UI process (where it is mapped and applied as layer contents). * Shared/ConcreteShareableImageBuffer.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h. (WebKit::ConcreteShareableImageBuffer::create): (WebKit::ConcreteShareableImageBuffer::ConcreteShareableImageBuffer): (WebKit::ConcreteShareableImageBuffer::createImageBufferBackendHandle): * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): Add and adopt ConcreteShareableImageBuffer. This is a ConcreteImageBuffer that knows how to create an ImageBufferBackendHandle, with no other behavior change. Previously, we were (completely incorrectly) casting ConcreteImageBuffer to RemoteImageBufferProxy to get this behavior, and somehow just got very lucky. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h: * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: Remove the ImageBufferShareableIOSurfaceBackend create() method that takes an ImageBufferBackendHandle, since we always use the Unmapped variant. ImageBufferShareableIOSurfaceBackend is now only used: - in the GPU process - in the Web Content process when DOM rendering in the GPU process is disabled In both cases, the process that uses ImageBufferShareableIOSurfaceBackend also originates the surface, so does not create it from a handle. * WebProcess/GPU/graphics/cocoa/ImageBufferShareableUnmappedIOSurfaceBackend.cpp: Added. (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::create): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::createImageBufferBackendHandle const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::context const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::copyNativeImage const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::copyImage const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::draw): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::drawPattern): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toDataURL const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toData const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toBGRAData const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::getImageData const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::putImageData): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableUnmappedIOSurfaceBackend.h: Added. Add and adopt ImageBufferShareableUnmappedIOSurfaceBackend, which is a ImageBufferBackend that cannot perform most ImageBufferBackend duties, except creating an ImageBufferBackendHandle, which it does by cloning the existing handle. It explicitly does *not* map the IOSurface in the process, and is meant for use in Web Content processes that do not have access to IOSurface. * WebProcess/GPU/media/RemoteAudioSession.cpp: Fix some unified source issues. 2020-11-30 Chris Dumez sessionStorage should not be cloned when a window is opened with rel=noopener https://bugs.webkit.org/show_bug.cgi?id=218804 Reviewed by Alex Christensen. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchCreatePage): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-11-30 Youenn Fablet Introduce an experimental flag specific to VP9 profile 2 https://bugs.webkit.org/show_bug.cgi?id=219350 Reviewed by Eric Carlson. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2020-11-30 Antti Koivisto Remove throttling code from NetworkLoad https://bugs.webkit.org/show_bug.cgi?id=219347 Reviewed by Anders Carlsson. It is not a good latency simulation and no one is using it anyway. * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::NetworkLoad): (WebKit::NetworkLoad::didReceiveResponse): (WebKit::NetworkLoad::didReceiveData): (WebKit::NetworkLoad::didCompleteWithError): (WebKit::NetworkLoad::Throttle::Throttle): Deleted. (WebKit::NetworkLoad::throttleDelayCompleted): Deleted. * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::shouldLogCookieInformation const): (WebKit::NetworkSession::loadThrottleLatency const): Deleted. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): 2020-11-29 Adam Mazander Deny logs for benign fontservicesd daemon https://bugs.webkit.org/show_bug.cgi?id=219180 Reviewed by Per Arne Vollan. After investigating denials of fontservicesd logs over several submissions and without any fallout we are removing logging. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-11-28 Per Arne Vollan [macOS] Set application information in the Networking process on behalf of the WebContent process https://bugs.webkit.org/show_bug.cgi?id=218052 Reviewed by Brent Fulgham. In preparation for blocking Launch Services in the WebContent process' sandbox, application information for the process should be set in the Networking process. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/mac/NetworkConnectionToWebProcessMac.mm: Added. (WebKit::NetworkConnectionToWebProcess::updateActivePages): * Scripts/process-entitlements.sh: * WebKit.xcodeproj/project.pbxproj: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::activePagesOrigins): (WebKit::WebProcess::updateActivePages): (WebKit::WebProcess::getActivePagesOriginsForTesting): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-28 Per Arne Vollan [macOS] Issue sandbox extension to icon services when starting a drag operation https://bugs.webkit.org/show_bug.cgi?id=219159 Reviewed by Brent Fulgham. Issue sandbox extension to icon services when starting a drag operation on macOS, since the WebContent process needs access to these services when a drag is started. This patch detects when a drag is about to start, and sends sandbox extensions to the icon services along with the mouse event. The sandbox extensions are then temporarily consumed while handling the mouse event in the WebContent process. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::processNextQueuedMouseEvent): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::mouseEvent): (WebKit::WebPage::simulateMouseDown): (WebKit::WebPage::simulateMouseUp): (WebKit::WebPage::simulateMouseMotion): (WebKit::WebPage::consumeSandboxExtensions): (WebKit::WebPage::revokeSandboxExtensions): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-11-27 Fujii Hironori Unreviewed, reverting r270210. It broke TestWebKitAPI.GPUProcess.CrashWhilePlayingVideo on iOS Reverted changeset: "[WinCairo?] GPU process remains alive even after web process exited" https://bugs.webkit.org/show_bug.cgi?id=219321 https://trac.webkit.org/changeset/270210 2020-11-27 Fujii Hironori [WinCairo?] GPU process remains alive even after web process exited https://bugs.webkit.org/show_bug.cgi?id=219321 Reviewed by Don Olmstead. AuxiliaryProcess::didClose is calling _exit. However, GPUProcess overrode AuxiliaryProcess::didClose but it did nothing. GPUProcess doesn't need to override it. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::didClose): Deleted. * GPUProcess/GPUProcess.h: 2020-11-27 Don Olmstead Non-unified build fixes, late November 2020 edition, take two https://bugs.webkit.org/show_bug.cgi?id=219317 Unreviewed non-unified build fixes. * Shared/WebPreferencesDefaultValues.cpp: 2020-11-27 Don Olmstead Fix build when ENABLE_RESOURCE_LOAD_STATISTICS is disabled https://bugs.webkit.org/show_bug.cgi?id=219316 Unreviewed build fix. Add ENABLE(RESOURCE_LOAD_STATISTICS) guards around NetworkSession requests for resource load statistics. Move firePrivateClickMeasurementTimerImmediately out of a ENABLE(RESOURCE_LOAD_STATISTICS) guard and place it where its ordered in the header. This originally broke the PlayStation build before ENABLE_RESOURCE_LOAD_STATISTICS was turned on. No new tests. No change in behavior. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::firePrivateClickMeasurementTimerImmediately): * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::clearSentAttributions): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): 2020-11-27 Wenson Hsieh Introduce new display list meta commands in preparation for webkit.org/b/219091 https://bugs.webkit.org/show_bug.cgi?id=219262 Reviewed by Ryosuke Niwa. See WebCore ChangeLog for more information. Additionally, rename `MetaCommandSwitchToItemBuffer` to `MetaCommandChangeItemBuffer`, for consistency with the new `MetaCommandChangeDestinationImageBuffer` item. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-27 Wenson Hsieh Remove some extraneous PLATFORM(IOS_FAMILY) guards in WKContentViewInteraction https://bugs.webkit.org/show_bug.cgi?id=219289 Reviewed by Sam Weinig. Remove several redundant uses of `PLATFORM(IOS_FAMILY)`. The entire class is already conditional on `IOS_FAMILY`, so adding additional compile-time guards for iOS family is not necessary. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setTimePickerValueToHour:minute:]): (-[WKContentView timePickerValueHour]): (-[WKContentView timePickerValueMinute]): 2020-11-27 Adrian Perez de Castro Non-unified build fixes, late November 2020 edition https://bugs.webkit.org/show_bug.cgi?id=219306 Unreviewed non-unified build fixes. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Add missing PrivateClickMeasurementManager.h header. * NetworkProcess/PrivateClickMeasurementManager.cpp: Add missing NetworkSession.h header. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::handleRequest): Add missing WebCore:: namespace to uses of the WebCore::SpeechRecognizer and WebCore::SpeechRecognitionUpdateType types. 2020-11-27 Yoshiaki Jitsukawa [PlayStation] Define platform argument coders for Font https://bugs.webkit.org/show_bug.cgi?id=219300 Reviewed by Fujii Hironori. * PlatformPlayStation.cmake: * Shared/playstation/WebCoreArgumentCodersPlayStation.cpp: Added. Define required member functions of ArgumentCoder> class. 2020-11-26 Wenson Hsieh Calling waitForAndDispatchImmediately on a loop fails when multiple M messages arrive simultaneously https://bugs.webkit.org/show_bug.cgi?id=219240 Reviewed by Chris Dumez. Fixes a race that may occur when calling `waitForAndDispatchImmediately` in a loop, when multiple messages `N` arrive on the IPC thread simultaneously. This may result from the following sequence of events (note that (Main) and (IPC) in the timeline below refer to the main thread and IPC background thread, respectively): (Main) Call `waitForAndDispatchImmediately`, and begin waiting. (IPC) A message `N` arrives, and is handled in `processIncomingMessage` by setting the decoder of `m_waitingForMessage` and notifying the condition variable. (Main) The main thread wakes up and starts to process `N`, clearing out `m_waitingForMessage` in the process. (IPC) A second message `N` arrives. We see that `m_waitingForMessage` is null, so we don't set the decoder and bail. Instead, we prepare to call `enqueueIncomingMessage` and push the message onto the main thread, *but importantly*, we haven't done so yet. (Main) Call `waitForAndDispatchImmediately` again, set `m_waitingForMessage`, and begin waiting. Since the incoming message that was just received above has not been enqueued yet, we are unable to avoid waiting due to the incoming message. (IPC) We finally call `enqueueIncomingMessage`, which pushes the message `N` into `m_incomingMessages` and dispatches onto the main thread. However, this is too late, since the main thread is already stuck waiting for the incoming IPC message that we've now just enqueued. Two minor adjustments are required to fix this, described in the below comments. The combination of these two changes ensures that the scenario described above is impossible, since we'll either set `m_waitingForMessage`'s decoder and wake up the main thread in the case where `waitForMessage` is called before `processIncomingMessage`, or we'll bail early in `waitForMessage` with the enqueued IPC message in the case where `processIncomingMessage` runs before `waitForMessage`. * Platform/IPC/Connection.cpp: (IPC::Connection::waitForMessage): Move logic that checks the incoming messages queue when calling `Connection::waitForMessage` into the `m_waitForMessageMutex` critical section. (IPC::Connection::processIncomingMessage): Extend the critical section of `m_waitForMessageMutex` when processing an incoming message, such that it encompasses the part that enqueues the incoming message. 2020-11-26 Lauro Moura [GTK][GTK4] Building with GObject-Introspection support does not work https://bugs.webkit.org/show_bug.cgi?id=219221 Reviewed by Carlos Garcia Campos. * PlatformGTK.cmake: Forward GTK version to gir scanner and use correct pkg-config package. 2020-11-26 Lauro Moura [GTK4] Declare lambda return type to avoid build error deducing it https://bugs.webkit.org/show_bug.cgi?id=219268 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::createPopupMenu): 2020-11-26 Fujii Hironori [WinCairo] Enable GPU process https://bugs.webkit.org/show_bug.cgi?id=219294 Reviewed by Don Olmstead. Added stub functions to build GPU process. Invoke the following command to enable GPU process: > reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /t REG_DWORD /d 1 /f Invoke the following command to disable GPU process: > reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /f * GPUProcess/media/win/RemoteMediaPlayerProxyWin.cpp: Added. (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): (WebKit::RemoteMediaPlayerProxy::enterFullscreen): (WebKit::RemoteMediaPlayerProxy::exitFullscreen): * GPUProcess/win/GPUProcessMainWin.cpp: Added. (WebKit::initializeAuxiliaryProcess): (WebKit::GPUProcessMain): * GPUProcess/win/GPUProcessWin.cpp: Added. (WebKit::GPUProcess::initializeProcess): (WebKit::GPUProcess::initializeProcessName): (WebKit::GPUProcess::initializeSandbox): * PlatformWin.cmake: * Shared/WebPreferencesDefaultValues.h: * Shared/curl/WebCoreArgumentCodersCurl.cpp: (IPC::ArgumentCoder::encodePlatformData): Deleted. (IPC::ArgumentCoder::decodePlatformData): Deleted. (IPC::ArgumentCoder>::encodePlatformData): Deleted. (IPC::ArgumentCoder>::decodePlatformData): Deleted. * Shared/win/WebCoreArgumentCodersWin.cpp: Added. (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): (IPC::ArgumentCoder>::encodePlatformData): (IPC::ArgumentCoder>::decodePlatformData): * Shared/win/WebPreferencesDefaultValuesWin.cpp: Added. (WebKit::isFeatureFlagEnabled): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::submitDisplayList): (WebKit::RemoteRenderingBackendProxy::createItemBuffer): * WebProcess/GPU/media/win/VideoLayerRemoteWin.cpp: Added. (WebKit::createVideoLayerRemote): 2020-11-26 Youenn Fablet https://collab-project.github.io/videojs-record/demo/video-only.html is not working https://bugs.webkit.org/show_bug.cgi?id=219258 Reviewed by Eric Carlson. Fixed a potential null pointer crash in case load is aborted by WebCore at creation time. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::requestResource): 2020-11-26 Yoshiaki Jitsukawa [PlayStation] Enable ResourceLoadStatistics https://bugs.webkit.org/show_bug.cgi?id=219292 Reviewed by Fujii Hironori. * PlatformPlayStation.cmake: 2020-11-21 Sihui Liu Implement audio capture for SpeechRecognition on macOS https://bugs.webkit.org/show_bug.cgi?id=218855 Reviewed by Youenn Fablet. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): Check and enable mock devices based on preference as SpeechRecognition needs it for testing. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::stop): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::invalidate): (WebKit::SpeechRecognitionServer::sendUpdate): (WebKit::SpeechRecognitionServer::stopRequest): Deleted. (WebKit::SpeechRecognitionServer::abortRequest): Deleted. * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::syncIfMockDevicesEnabledChanged): * UIProcess/WebPageProxy.h: 2020-11-21 Simon Fraser Propagate the 'wheelEventGesturesBecomeNonBlocking' setting to the ScrollingTree https://bugs.webkit.org/show_bug.cgi?id=219241 Reviewed by Tim Horton. Propagate the 'wheelEventGesturesBecomeNonBlocking' setting to the ScrollingTree via the ScrollingStateFrameScrollingNode, as we do for other settings. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): 2020-11-21 Simon Fraser Add an Experimental Features for wheel event gestures becoming non-blocking https://bugs.webkit.org/show_bug.cgi?id=219236 Reviewed by Sam Weinig. Add a feature flag for the behavior that is being added via webkit.org/b/218764, which is that only the first wheel event in a gesture is cancelable. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWheelEventGesturesBecomeNonBlocking): * Shared/WebPreferencesDefaultValues.h: 2020-11-21 Jiewen Tan [WebAuthn] Implement SPI for AuthenticationServices.Framework https://bugs.webkit.org/show_bug.cgi?id=218893 Reviewed by Alex Christensen. This patch implements the SPI for AuthenticationServices.Framework, which is more or less a direct translation of the WebAuthn Web IDLs and a thin wrapper on top of functionalities of the WebAuthn process. It deprecates the existing _WKWebAuthenticationPanel SPI which is for Safari to show UI only. This patch does not just repurpose the SPI but also modifies some of the implementations. The most noticeable one is the change of ownerships. Prior to this change, AuthenticatorManager owns the APIWebAuthenticationPanel. Now, it's the opposite way. Since there will be a period of time that the deprecated implementation will coexist with the new implementation, this path also marks things that are meant to deprecate in the future to reduce confusions. * UIProcess/API/APIWebAuthenticationPanel.cpp: (API::WebAuthenticationPanel::WebAuthenticationPanel): (API::WebAuthenticationPanel::handleRequest): (API::WebAuthenticationPanel::cancel const): * UIProcess/API/APIWebAuthenticationPanel.h: Implements the plumbing for the new SPI and owns the AuthenticatorManager now. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (-[_WKAuthenticationExtensionsClientOutputs initWithAppid:]): (-[_WKAuthenticatorResponse initWithRawId:extensions:]): (-[_WKAuthenticatorAssertionResponse initWithRawId:extensions:authenticatorData:signature:userHandle:]): (-[_WKAuthenticatorAttestationResponse initWithRawId:extensions:attestationObject:]): (-[_WKAuthenticatorSelectionCriteria init]): (-[_WKPublicKeyCredentialCreationOptions initWithRp:user:pubKeyCredParams:]): (-[_WKPublicKeyCredentialDescriptor initWithType:identifier:]): (-[_WKPublicKeyCredentialEntity initWithName:]): (-[_WKPublicKeyCredentialParameters initWithType:alg:]): (-[_WKPublicKeyCredentialRequestOptions init]): (-[_WKPublicKeyCredentialRpEntity initWithName:]): (-[_WKPublicKeyCredentialUserEntity initWithName:identifier:displayName:]): (-[_WKWebAuthenticationPanel init]): (vectorFromNSData): (encodeEntity): (publicKeyCredentialRpEntity): (publicKeyCredentialUserEntity): (publicKeyCredentialParameters): (authenticatorTransport): (authenticatorTransports): (publicKeyCredentialDescriptors): (authenticatorAttachment): (userVerification): (authenticatorSelectionCriteria): (attestationConveyancePreference): (authenticationExtensionsClientInputs): (+[_WKWebAuthenticationPanel convertToCoreCreationOptionsWithOptions:]): (wkAuthenticatorAttestationResponse): (-[_WKWebAuthenticationPanel makeCredentialWithHash:options:completionHandler:]): (+[_WKWebAuthenticationPanel convertToCoreRequestOptionsWithOptions:]): (wkAuthenticatorAssertionResponse): (-[_WKWebAuthenticationPanel getAssertionWithHash:options:completionHandler:]): (+[_WKWebAuthenticationPanel isUserVerifyingPlatformAuthenticatorAvailable]): Implements the SPI. * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Marks things as to deprecate. 2020-11-20 Kate Cheney PCM: Persist pending ad clicks and attributions so they can survive browser restart https://bugs.webkit.org/show_bug.cgi?id=219134 Reviewed by John Wilander. This patch migrates Private Click Measurement to use SQLite, which is beneficial because it requires less in-memory storage and persists PCM data across browser sessions. It also updates naming to match naming agreed upon in standards bodies: - source -> sourceSite - campaign/campaignID -> sourceID - destination -> attributeOnSite - conversion/conversionValue -> attributionTriggerData - unconverted -> unattributed - convert(ed) -> attribute(d) This adds 3 SQLite tables: one for clicks that haven't been attributed, one for attributions that haven't been sent, and one to store the last time the reports were sent to make sure reports get sent as soon as possible if needed after a browser restart. Behavior is identical to existing PCM implementation with the addition of persistence. Existing PCM tests confirm no regressions. Reviewed by John Wilander. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::createTableQueries): (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): New queries to interact with PCM data. (WebKit::ResourceLoadStatisticsDatabaseStore::updateTimerLastFired): (WebKit::ResourceLoadStatisticsDatabaseStore::timerLastFired): (WebKit::ResourceLoadStatisticsDatabaseStore::updatePrivateClickMeasurementAttributionTimes): Set earliestTimeToSend to be the original value minus the time passed since the last timer fire for each entry. If the result is less than 0, set to 0 so the report gets sent immediately. (WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase): Creates a PCM object from data in the database. (WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): (WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed): (WebKit::ResourceLoadStatisticsDatabaseStore::attributePrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): (WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): (WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttributions): These functions use database queries to implement PCM functionality with exactly the same behavior as the in-memory PCM implementation. (WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::updateTimerLastFired): (WebKit::WebResourceLoadStatisticsStore::insertPrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): (WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::allAttributedPrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurementForRegistrableDomain): (WebKit::WebResourceLoadStatisticsStore::clearExpiredPrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::privateClickMeasurementToString): (WebKit::WebResourceLoadStatisticsStore::clearSentAttributions): (WebKit::WebResourceLoadStatisticsStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::firePrivateClickMeasurementTimerImmediately): (WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart): (WebKit::NetworkProcess::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Test functions to help simulate a browser restart after PCM data has expired during a session close. This is the only behavior change from the existing PCM implementation. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::firePrivateClickMeasurementTimerImmediately): (WebKit::NetworkSession::storePrivateClickMeasurement): (WebKit::NetworkSession::handlePrivateClickMeasurementConversion): (WebKit::NetworkSession::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkSession::markPrivateClickMeasurementsAsExpiredForTesting): * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): Move constructor to cpp file to call startTimer(5_s) which will kick off sending any reports that have expired in the database. We should wait 5 seconds so we are sure ITP is up and running. (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::handleAttribution): (WebKit::PrivateClickMeasurementManager::startTimer): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::clearSentAttributions): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::setConversionURLForTesting): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::storeUnconverted): Deleted. (WebKit::PrivateClickMeasurementManager::handleConversion): Deleted. (WebKit::PrivateClickMeasurementManager::convert): Deleted. (WebKit::PrivateClickMeasurementManager::firePendingConversionRequests): Deleted. (WebKit::PrivateClickMeasurementManager::markAllUnconvertedAsExpiredForTesting): Deleted. Implementation moved to ResourceLoadStatisticsDatabaseStore. * NetworkProcess/PrivateClickMeasurementManager.h: (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): Deleted. Moved to cpp file. (WebKit::PrivateClickMeasurementManager::m_sessionID): Deleted. * UIProcess/API/C/WKPage.cpp: (WKPageMarkAttributedPrivateClickMeasurementsAsExpiredForTesting): (WKPageSimulateResourceLoadStatisticsSessionRestart): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::WebPageProxy::simulateResourceLoadStatisticsSessionRestart): * UIProcess/WebPageProxy.h: Testing support. 2020-11-20 Simon Fraser Dispatch main-thread overflow scrolls to the scrolling thread as we do for page scrolls https://bugs.webkit.org/show_bug.cgi?id=219213 Reviewed by Tim Horton. Unify the behavior of overflow scrolling and page scrolling for synchronous scrolls. Somewhat surprisingly, synchronous page scrolls move layers via a dispatch to the scrolling thread in FrameView::handleWheelEventForScrolling(), but overflow scrolls just did main thread compositing updates to set the new layer positions. A future patch will require that the "began" event for a synchronous scroll gets back to the scrolling thread, so unify these code paths to have overflow scrolls also leverage handleWheelEventAfterMainThread(), via RenderLayer::handleWheelEventForScrolling(). There's some fallout from this. ThreadedScrollingTree::handleWheelEventAfterMainThread() calls into handleWheelEventWithNode(), but in this special case that codepath needs to know that we're in a special "post main thread" mode that should 1. Behave as if the node is latched, i.e. don't propagate to parent nodes, and target the node if if it's scrolled to a the min or max to allow rubberbanding 2. Scroll even if the node has synchronous scrolling reasons This mode is represented by the EventTargeting value. Finally, EventHandler::handleWheelEventInternal() should only clear latching state if the content has called preventDefault() on the event. * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent): * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent): * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h: 2020-11-20 Simon Fraser Rename some wheel-event handling functions for clarity https://bugs.webkit.org/show_bug.cgi?id=219211 Reviewed by Tim Horton. There are too many functions called wheelEvent() or handleWheelEvent(), making it hard to know which phase of handling they apply to. So rename some to handleWheelEventForScrolling(), which applies to the "default handling" phase after DOM event dispatch. In addition, make ScrollableArea's handleWheelEventForScrolling() virtual and have FrameView override it (a future patch will also add an override in RenderLayer). Rename ScrollingCoordinator::performDefaultWheelEventHandling() to use handleWheelEventForScrolling() for clarity. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::handleWheelEvent): 2020-11-20 Ryan Haddad Unreviewed fix for my build fix. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): You have to spell DEPRECATED correctly for this to work. 2020-11-20 Ryan Haddad Unreviewed, fix the build with recent SDKs. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): 2020-11-20 Philippe Normand Unreviewed, GTK build warning fix * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: Mark configurationForRemoteInspector as override of corresponding parent class method declaration. 2020-11-19 Wenson Hsieh REGRESSION (r259151): The "Convert Text to Traditional Chinese" services menu action is broken https://bugs.webkit.org/show_bug.cgi?id=219190 Reviewed by Tim Horton. Some system services, such as "Convert Text to (Traditional|Simplified) Chinese", use `-[NSServicesMenuRequestor readSelectionFromPasteboard:]` to insert the contents of the given pasteboard into the current selection. After the changes in r259151, this requires the UI process to explicitly grant access to the contents of the given pasteboard, on behalf of the web content process. Fix the bug by adding the missing call to `grantAccessToCurrentPasteboardData`. This is only called from API in the UI process, so it cannot be abused by a compromised web content process to grab the contents of `NSPasteboard`. Test: PasteHTML.ReadSelectionFromPasteboard * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::readSelectionFromPasteboard): 2020-11-19 Fujii Hironori [TextureMapper] Remove m_textureMapper from TextureMapperLayer https://bugs.webkit.org/show_bug.cgi?id=219191 Reviewed by Carlos Garcia Campos. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): (WebKit::CoordinatedGraphicsScene::ensureRootLayer): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::compositeLayersToContext): (WebKit::LayerTreeHost::flushPendingLayerChanges): (WebKit::LayerTreeHost::LayerTreeHost): 2020-11-19 Hoa Dinh Code formatting: change instances of "@synthesize a=b" to "@synthesize a = b". https://bugs.webkit.org/show_bug.cgi?id=219094 Reviewed by Wenson Hsieh. There was a mix of "@synthesize a=b" and "@synthesize a = b" in the codebase. Most of the instances are "@synthesize a = b", with spaces around the equal sign. With https://bugs.webkit.org/show_bug.cgi?id=219092, we're changing the behavior of the code style checker to require spaces around the equal sign. The change replace all the instances of "@synthesize a=b" with "@synthesize a = b". * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * UIProcess/API/Cocoa/WKPreviewActionItem.mm: * UIProcess/API/Cocoa/_WKThumbnailView.mm: * UIProcess/Cocoa/WebViewImpl.mm: * UIProcess/QuickLookThumbnailLoader.mm: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: * UIProcess/mac/ViewGestureControllerMac.mm: * UIProcess/mac/WKFullScreenWindowController.mm: * WebProcess/Plugins/PDF/PDFPlugin.mm: 2020-11-19 Brent Fulgham Unreviewed rollout of r269890 and r269911 due to EME issues on Mac Mini. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-19 Chris Dumez Web Inspector: Unable to Show JavaScript Console in empty tab in Safari Technology Preview https://bugs.webkit.org/show_bug.cgi?id=211590 Reviewed by Simon Fraser. We used to launch the initial process for the inspected page from inside WebInspectorProxy::connect(). I thought this was a good bottleneck to make sure the inspected page has a process to inspect. However, while WebInspectorProxy::connect() gets called by functions by WebInspectorProxy::show(), it does not get called by WebInspectorProxy::showConsole() for example. To address this, I have moved the code that launches the inspected page's initial process from WebInspectorProxy::connect() to WebInspectorProxy::createFrontendPage(). This seems like a much better bottleneck. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::connect): (WebKit::WebInspectorProxy::createFrontendPage): 2020-11-19 Per Arne Vollan [macOS] Issue sandbox extension to Web Inspector service https://bugs.webkit.org/show_bug.cgi?id=219041 Reviewed by Brent Fulgham. In preparation of blocking this service in the WebContent process, a sandbox extension should be issued if Safari's Develop menu is enabled. This extension will also be dynamically issued to all WebContent processes, if the Develop menu preference changes, by observing this preference. * UIProcess/Cocoa/WebInspectorPreferenceObserver.h: Added. * UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: Added. (+[WKWebInspectorPreferenceObserver sharedInstance]): (-[WKWebInspectorPreferenceObserver init]): (-[WKWebInspectorPreferenceObserver observeValueForKeyPath:ofObject:change:context:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitialize): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded): * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2020-11-19 Per Arne Vollan [macOS] Issue sandbox extension to audio service if Media in the GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=219051 Reviewed by Youenn Fablet. Issue sandbox extension to com.apple.audio.audiohald for the WebContent process on macOS if Media in the GPU process is not enabled. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-19 Joshua Watt [WPE] Prevent elements getting stuck in a pressed state when scrolling on a touchscreen https://bugs.webkit.org/show_bug.cgi?id=218903 Reviewed by Adrian Perez de Castro. Stops the scroll gesture controller from eating touch up events and preventing them from propagating to the page when the controller is handling a scroll event. If the scroll logic prevents the events from propagating to the page, elements on the page (e.g. buttons) can get stuck in a pressed state when the user lifts their finger. * UIProcess/API/wpe/ScrollGestureController.cpp: (WebKit::ScrollGestureController::handleEvent): 2020-11-19 Carlos Garcia Campos Protect WebSocketChannel before calling client methods https://bugs.webkit.org/show_bug.cgi?id=216791 Reviewed by Youenn Fablet. Ensure we keep a reference to the WebSocketChannel before calling client methods that might close the channel. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::close): (WebKit::WebSocketChannel::fail): (WebKit::WebSocketChannel::didClose): (WebKit::WebSocketChannel::resume): 2020-11-18 Megan Gardner Menu Bar support for app highlights in book. https://bugs.webkit.org/show_bug.cgi?id=219117 Reviewed by Wenson Hsieh. Add menu stubs in iOS to support highlights for books in modern webkit. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView canPerformAction:withSender:]): (-[WKContentView setupAppHighlightMenus]): (-[WKContentView createHighlightInCurrentGroupWithRange:]): (-[WKContentView createHighlightInNewGroupWithRange:]): 2020-11-18 Wenson Hsieh Rename MetaCommandSwitchTo to MetaCommandSwitchToItemBuffer https://bugs.webkit.org/show_bug.cgi?id=219130 Reviewed by Tim Horton. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-18 Wenson Hsieh [Concurrent display lists] Add a way for display lists to partially replay https://bugs.webkit.org/show_bug.cgi?id=219067 Reviewed by Simon Fraser. See WebCore ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: Make `submitDisplayList` on `RemoteImageBuffer` return a `ReplayResult`. (WebKit::RemoteImageBuffer::submitDisplayList): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::submitDisplayList): 2020-11-18 Chris Dumez Drop redundant code that tries to bump the QoS of the WebContent main thread of UserInteractive when handling a sync IPC https://bugs.webkit.org/show_bug.cgi?id=219110 Reviewed by Alex Christensen. Drop redundant code that tries to bump the QoS of the WebContent main thread of UserInteractive when handling a sync IPC. Nowadays, we always run the main thread of the WebContent at UserInteractive QoS (see WTF::Thread::setCurrentThreadIsUserInteractive() call in WebProcess::initializeWebProcess()) so there is no need to boost the QoS during a sync IPC. * Platform/IPC/Connection.cpp: (IPC::Connection::processIncomingMessage): * Platform/IPC/Connection.h: (IPC::Connection::setShouldBoostMainThreadOnSyncMessage): Deleted. * Platform/IPC/Decoder.h: (IPC::Decoder::setQOSClassOverride): Deleted. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): 2020-11-18 Darin Adler Remove advanced plug-in feature: small plug-in blocking https://bugs.webkit.org/show_bug.cgi?id=219101 Reviewed by Anders Carlsson. * WebProcess/WebPage/WebPage.cpp: (WebKit::pluginIsSmall): Deleted. (WebKit::WebPage::createPlugin): Removed code that blocks small plug-ins. 2020-11-18 Simon Fraser Propagate wheel event handling back to the scrolling thread https://bugs.webkit.org/show_bug.cgi?id=219050 Reviewed by Chris Dumez. For now, use MainThreadForBlockingDOMEventDispatch for the default steps (used by non-macOS platforms). * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-11-18 Wenson Hsieh Clean up some code in SharedDisplayListHandle https://bugs.webkit.org/show_bug.cgi?id=219089 Reviewed by Geoff Garen. Currently, `reservedCapacityAtStart` is defined as a constant 16 bytes, which is enough to encompass the contents of the header structure in a shared display list handle (i.e. an 8-byte atomic for the lock, and another 8 bytes for the unread count). Instead of hard-coding this, we could simply make this a constexpr function that returns the size of `DisplayListSharedMemoryHeader` (rounded up to ensure alignment of all display list item data). No change in behavior. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::headerSize): * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: (WebKit::DisplayListWriterHandle::resetWritableOffsetIfPossible): * WebProcess/GPU/graphics/DisplayListWriterHandle.h: (WebKit::DisplayListWriterHandle::DisplayListWriterHandle): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createItemBuffer): Also add a static assert that the size of a newly allocated buffer is larger than the reserved header capacity. 2020-11-18 Per Arne Vollan [macOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=219090 Reviewed by Geoffrey Garen. The message filter in the WebContent process on macOS needs to allow some additional messages. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-18 Chris Dumez [GPUProcess] Main thread of the GPUProcess should have same priority as main thread of the WebContent https://bugs.webkit.org/show_bug.cgi?id=219057 Reviewed by Simon Fraser. Main thread of the GPUProcess should have same priority as main thread of the WebContent since it is doing rendering on its behalf. For now, this means that on macOS, the main threads of the GPU and WebContent processes with both get UserInteractive QoS. On iOS, they will both still get UserInitiated QoS until our RunningBoard foreground process assertion get fixed to get the right priority (). * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist: Use _ProcessType=App, similarly as what we do for the WebContent process. If we don't do this, the process is an adaptive daemon and its QoS can never be higher than UserInitiated. We need its priority to go to UserInteractive to match the WebContent process. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): Request UserInteractive QoS for the main thread of the GPUProcess, similarly to what we do for the main thread of the WebContent process already in WebProcess::InitializeWebProcess(). 2020-11-18 Sam Weinig Address additional feedback from https://bugs.webkit.org/show_bug.cgi?id=218960 https://bugs.webkit.org/show_bug.cgi?id=219044 Reviewed by Alex Christensen. * Shared/API/Cocoa/WKDataDetectorTypesInternal.h: (fromWKDataDetectorTypes): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::detectDataInAllFrames): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): (WebKit::WebPage::detectDataInAllFrames): Update for rename of WebCore::DataDetectionTypes to WebCore::DataDetectionType. 2020-11-17 Tim Horton GPU-process-hosted RemoteLayerBackingStore should flush off the main thread https://bugs.webkit.org/show_bug.cgi?id=219063 Reviewed by Simon Fraser. * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::display): Construct the ImageBuffer flusher /after/ submitting the final DisplayList, so that it takes the correct flush identifier. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::didFlush): (WebKit::RemoteRenderingBackend::flushDisplayListWasCommitted): Deleted. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::didFlush): (WebKit::RemoteImageBufferProxy::lastSentFlushIdentifier const): (WebKit::RemoteImageBufferProxy::waitForDidFlushOnSecondaryThread): (WebKit::RemoteImageBufferProxy::hasPendingFlush const): (WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout): (WebKit::ThreadSafeRemoteImageBufferFlusher::ThreadSafeRemoteImageBufferFlusher): (WebKit::RemoteImageBufferProxy::commitFlushDisplayList): Deleted. (WebKit::RemoteImageBufferProxy::isPendingFlush const): Deleted. (WebKit::RemoteImageBufferProxy::timeoutWaitForFlushDisplayListWasCommitted): Deleted. Some renames: Rename flushDisplayListWasCommitted to didFlush; this is the back-message from GPU process to Web Content process that a FlushContext display list item was completed successfully. Rename isPendingFlush to hasPendingFlush, for grammar. Rename timeoutWaitForFlushDisplayListWasCommitted to waitForDidFlushWithTimeout, for similar reasons. Rename waitForFlushDisplayListWasCommitted to waitForDidFlush. Rename commitFlushDisplayList to didFlush. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::waitForDidFlush): (WebKit::RemoteRenderingBackendProxy::didFlush): (WebKit::RemoteRenderingBackendProxy::waitForFlushDisplayListWasCommitted): Deleted. (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: Reimplement ThreadSafeRemoteImageBufferFlusher such that it waits (on the RemoteLayerTreeDrawingArea CommitQueue, in the only current use of it) for the correct flush reply to come in before continuing. This is analogous to what we do for in-process buffers, where we call CGContextFlush() in the flusher. 2020-11-17 Chris Dumez [iOS] ASSERTION FAILED: Completion handler should always be called under WebKit::GPUProcess::didReceiveMessage https://bugs.webkit.org/show_bug.cgi?id=219055 Reviewed by Alex Christensen. Make sure GPUProcess::prepareToSuspend() calls its completion handler to avoid delaying suspension and avoid assertion hits in debug. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::prepareToSuspend): 2020-11-17 Chris Dumez Make sure ProcessThrottler is always holding a ProcessAssertion for its child process https://bugs.webkit.org/show_bug.cgi?id=219053 Reviewed by Geoff Garen. Make sure ProcessThrottler is always holding a ProcessAssertion for its child process. Previously, when changing the assertion type (e.g. when going from background to foreground) we would release the previous assertion and then take the new one. RunningBoard developers recommend that we wait until the new ProcessAssertion is taken before we release the previous one to avoid churn. It is also important we always hold a ProcessAssertion at all times for the child process because the child process may exit otherwise. * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::setAssertionType): 2020-11-17 Chris Dumez [macOS] Stop using RunLoopType=_WebKit starting in Big Sur https://bugs.webkit.org/show_bug.cgi?id=219052 Reviewed by Geoffrey Garen. Stop using RunLoopType=_WebKit starting in Big Sur. This was a temporary hack so that our WebProcesses would get the right scheduling priority. Starting with Big Sur, the right way to do this is to use _ProcessType=App and restore the RunLoopType to be NSRunLoop. After this change, I have verified that the WebContent's main thread still runs at UserInteractive QoS. App Nap is also still working as expected. * Configurations/WebContentService.xcconfig: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: 2020-11-17 Per Arne Vollan [macOS] Issue sandbox extension to trust service if Media in the GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=218986 Reviewed by Brent Fulgham. Since Media is using the trust service, issue a sandbox extension to the WebContent process if Media in the GPU process is not enabled. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-17 Sihui Liu Add a default action for SpeechRecognition permission request https://bugs.webkit.org/show_bug.cgi?id=219021 Reviewed by Youenn Fablet. When there is no delegate or selector for deciding user permission on speech recognition, force an alert and let user decide. This is currently what we do for UserMedia permission request, and it makes testing easier. * SourcesCocoa.txt: * UIProcess/API/APIUIClient.h: (API::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::visibleDomain): (WebKit::alertMessageText): (WebKit::allowButtonText): (WebKit::doNotAllowButtonText): (WebKit::alertForPermission): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): * UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm: Removed. Moved alert code to MediaPermissionUtilities so it can be shared between UserMedia and SpeechRecognition. * UIProcess/MediaPermissionUtilities.h: * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::decideByDefaultAction): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::doDefaultAction): * UIProcess/UserMediaPermissionRequestProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermissionByDefaultAction): * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: 2020-11-17 Saagar Jha Check com.apple.private.webkit.use-xpc-endpoint only on internal builds https://bugs.webkit.org/show_bug.cgi?id=215423 Reviewed by Per Arne Vollan. Signing with com.apple.private entitlements can only be done by Apple internally. Thus, it should only checked for internal builds. * Shared/Cocoa/XPCEndpoint.mm: (WebKit::XPCEndpoint::XPCEndpoint): Wrap check in USE(APPLE_INTERNAL_SDK). * Shared/Cocoa/XPCEndpointClient.mm: (WebKit::XPCEndpointClient::setEndpoint): Wrap check in USE(APPLE_INTERNAL_SDK). 2020-11-17 Brent Fulgham [macOS] Remove access to the unused AppleSNBFBUserClient IOKit class https://bugs.webkit.org/show_bug.cgi?id=219014 Reviewed by Eric Carlson. Although we originally thought this was needed for H.264 decoding, testing shows that this class is never used in WebKit flows, and is not needed. We should remove it. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-17 Chris Dumez [iOS] Stop leaking an XPC transaction in our XPC services https://bugs.webkit.org/show_bug.cgi?id=219036 Reviewed by Geoffrey Garen. Stop leaking an XPC transaction in our XPC services on iOS. We were doing this to control the lifetime of our child services ourselves. However, this is not needed on iOS because the UIProcess takes RunningBoard process assertions on behalf of its child processes. I have verified that our child processes do not exit/jetsam early. I have verified that our child processes are in the correct jetsam band (IDLE/0 when background and FG/10 when foreground). I have also verified that the main thread of these processes runs at UserInitiated QoS before and after this change. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceExit): 2020-11-17 Peng Liu [Media In GPU Process][MSE] Add infrastructure needed to run MediaPlayerPrivateMediaSourceAVFObjC in the GPU process https://bugs.webkit.org/show_bug.cgi?id=218912 Reviewed by Eric Carlson. Add MediaSourcePrivateRemote/RemoteMediaSourceProxy and SourceBufferPrivateRemote/RemoteSourceBufferProxy, and setup IPC connections for them. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUProcessSessionParameters.h: * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/RemoteMediaSourceProxy.cpp: Added. (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::~RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::setPrivateAndOpen): (WebKit::RemoteMediaSourceProxy::duration const): (WebKit::RemoteMediaSourceProxy::buffered const): (WebKit::RemoteMediaSourceProxy::seekToTime): (WebKit::RemoteMediaSourceProxy::monitorSourceBuffers): (WebKit::RemoteMediaSourceProxy::setLogIdentifier): (WebKit::RemoteMediaSourceProxy::failedToCreateRenderer): (WebKit::RemoteMediaSourceProxy::addSourceBuffer): * GPUProcess/media/RemoteMediaSourceProxy.h: Added. * GPUProcess/media/RemoteMediaSourceProxy.messages.in: Added. * GPUProcess/media/RemoteSourceBufferIdentifier.h: Added. * GPUProcess/media/RemoteSourceBufferProxy.cpp: Added. (WebKit::RemoteSourceBufferProxy::create): (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::~RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasAudio const): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasVideo const): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReenqueSamples): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidBecomeReadyForMoreSamples): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateFastSeekTimeForMediaTime): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError): (WebKit::RemoteSourceBufferProxy::append): * GPUProcess/media/RemoteSourceBufferProxy.h: Added. * GPUProcess/media/RemoteSourceBufferProxy.messages.in: Added. * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: * Scripts/webkit/messages.py: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::load): (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: Added. (WebKit::MediaSourcePrivateRemote::create): (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::~MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::addSourceBuffer): (WebKit::MediaSourcePrivateRemote::durationChanged): (WebKit::MediaSourcePrivateRemote::markEndOfStream): (WebKit::MediaSourcePrivateRemote::unmarkEndOfStream): (WebKit::MediaSourcePrivateRemote::readyState const): (WebKit::MediaSourcePrivateRemote::setReadyState): (WebKit::MediaSourcePrivateRemote::waitForSeekCompleted): (WebKit::MediaSourcePrivateRemote::seekCompleted): (WebKit::MediaSourcePrivateRemote::logChannel const): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: Added. * WebProcess/GPU/media/RemoteCDMConfiguration.h: * WebProcess/GPU/media/RemoteCDMInstanceConfiguration.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.h: * WebProcess/GPU/media/RemoteMediaSourceIdentifier.h: Added. * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: Added. (WebKit::SourceBufferPrivateRemote::create): (WebKit::SourceBufferPrivateRemote::SourceBufferPrivateRemote): (WebKit::SourceBufferPrivateRemote::~SourceBufferPrivateRemote): (WebKit::SourceBufferPrivateRemote::setClient): (WebKit::SourceBufferPrivateRemote::append): (WebKit::SourceBufferPrivateRemote::abort): (WebKit::SourceBufferPrivateRemote::resetParserState): (WebKit::SourceBufferPrivateRemote::removedFromMediaSource): (WebKit::SourceBufferPrivateRemote::readyState const): (WebKit::SourceBufferPrivateRemote::setReadyState): (WebKit::SourceBufferPrivateRemote::flush): (WebKit::SourceBufferPrivateRemote::enqueueSample): (WebKit::SourceBufferPrivateRemote::isReadyForMoreSamples): (WebKit::SourceBufferPrivateRemote::setActive): (WebKit::SourceBufferPrivateRemote::notifyClientWhenReadyForMoreSamples): (WebKit::SourceBufferPrivateRemote::canSetMinimumUpcomingPresentationTime const): (WebKit::SourceBufferPrivateRemote::setMinimumUpcomingPresentationTime): (WebKit::SourceBufferPrivateRemote::clearMinimumUpcomingPresentationTime): (WebKit::SourceBufferPrivateRemote::canSwitchToType): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendComplete): (WebKit::SourceBufferPrivateRemote::logChannel const): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: Added. * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: Added. 2020-11-17 Per Arne Vollan [macOS] Perform AX TCC check in the UI process https://bugs.webkit.org/show_bug.cgi?id=218870 Reviewed by Brent Fulgham. On behalf of the WebContent process, perform AX TCC check in the UI process on macOS. This is in preparation of blocking tccd in the WebContent process. No new tests. It has been manually tested that the WebContent process is allowing VoiceOver to perform AX requests with this patch. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::isAXAuthenticated): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::isAXAuthenticatedCallback): (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-17 Brian Burg [Cocoa] _WKInspectorExtensionHost should conform to NSObject protocol https://bugs.webkit.org/show_bug.cgi?id=219035 Reviewed by Alex Christensen. This was overlooked in the initial patch. Without it, we can't call -isEqual: and similar basic methods on a type of id<_WKInspectorExtensionHost>. * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: 2020-11-17 Tim Horton Preemptive build fix for https://bugs.webkit.org/show_bug.cgi?id=219024 * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: (SOFT_LINK_CLASS): (-[WKAirPlayRoutePicker show:fromRect:]): 2020-11-17 Tim Horton REGRESSION (r269824): YouTube media control bar sometimes flickers https://bugs.webkit.org/show_bug.cgi?id=219017 Reviewed by Simon Fraser. Test: compositing/repaint/transparent-layer-repaint.html * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::display): I accidentally lost the Copy composite operator in r269824, causing the repaint copy-forward to blend instead of just copying. This wreaks havoc on layers with contents with colors that have 0 < alpha < 1, because every repaint means the colors intensify. 2020-11-16 Brent Fulgham [macOS] Remove access to the unused AppleIntelMEUserClient IOKit class https://bugs.webkit.org/show_bug.cgi?id=219012 Reviewed by Eric Carlson. Although we originally thought this was needed for H.264 decoding, testing shows that this class is never used in WebKit flows, and is not needed. We should remove it. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-16 Per Arne Vollan [macOS] Create sandbox extension for the power log service on internal installs https://bugs.webkit.org/show_bug.cgi?id=218984 Reviewed by Brent Fulgham. Create a sandbox extension for the WebContent process for the power log service on macOS internal installs. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::diagnosticServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-16 Sam Weinig Standardize enums that are used by Settings in preperation for autogeneration https://bugs.webkit.org/show_bug.cgi?id=218960 Reviewed by Tim Horton. Update enum uses for renames and scoped syntax use. * UIProcess/API/C/WKAPICast.h: (WebKit::toAPI): (WebKit::toEditableLinkBehavior): (WebKit::toStorageBlockingPolicy): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetEditableLinkBehavior): (WKPreferencesSetStorageBlockingPolicy): (WKPreferencesGetStorageBlockingPolicy): * UIProcess/API/Cocoa/WKPreferences.mm: (toStorageBlockingPolicy): (toAPI): (-[WKPreferences _storageBlockingPolicy]): (-[WKPreferences _setStorageBlockingPolicy:]): (toEditableLinkBehavior): (-[WKPreferences _setEditableLinkBehavior:]): * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::createWithLegacyDefaults): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): (WebKit::WebPage::detectDataInAllFrames): 2020-11-16 John Wilander NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking() redacts the cookie name in log output on customer builds https://bugs.webkit.org/show_bug.cgi?id=218997 Unreviewed minor change to logging. NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking() redacts the cookie name in log output on customer builds. This patch changes the format specifier from %s to %{public}s. Note that this logging is just for ITP Debug Mode which is off by default, logs in-memory only, and is disabled again on browser quit. No new tests. This just changes log output on customer builds. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking): 2020-11-16 Chris Dumez [GPUProcess] Update GPUProcess process assertion based on active WebProcesses https://bugs.webkit.org/show_bug.cgi?id=219002 Reviewed by Simon Fraser. Update GPUProcess process assertion based on active WebProcesses, similarly to what we do for the network process. Previously, we would never release the GPUProcess process assertion and it would time out after 30 seconds in the background. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::updateProcessAssertion): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::updateProcessAssertions): 2020-11-16 Brent Fulgham [macOS] Remove remote tcp capability from WebContent Sandbox https://bugs.webkit.org/show_bug.cgi?id=218999 Reviewed by Per Arne Vollan. Since we have moved all network activity (aside from some syslog use) out of the WebContent process, we do not need the ability to open remote tcp connections. We should deny this capability from our non-Network sandboxes. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-16 Devin Rousso Ignore deprecation warnings for the uniform types C API https://bugs.webkit.org/show_bug.cgi?id=218989 Reviewed by Tim Horton. These should eventually be replaced with the ObjC API `UniformTypeIdentifiers.framework`. See . * Shared/ios/WebIconUtilities.mm: (WebKit::iconForFile): * Shared/mac/PasteboardTypes.mm: (WebKit::PasteboardTypes::forEditing): (WebKit::PasteboardTypes::forSelection): * UIProcess/API/Cocoa/APIAttachmentCocoa.mm: (API::isDeclaredOrDynamicTypeIdentifier): (API::Attachment::mimeType const): (API::Attachment::utiType const): (API::Attachment::setFileWrapperAndUpdateContentType): * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm: (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setPromisedDataForImage): * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView supportedPasteboardTypesForCurrentSelection]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:performAction:]): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel currentAvailableActionTitles]): (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]): (-[WKFileUploadPanel showFilePickerMenu]): (-[WKFileUploadPanel showDocumentPickerMenu]): (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]): * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::setupServicesMenu): 2020-11-16 Don Olmstead Non-unified build fixes, mid November 2020 edition https://bugs.webkit.org/show_bug.cgi?id=218911 Unreviewed build fix. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::sendUpdate): 2020-11-16 Per Arne Vollan [macOS] The WebContent sandbox does not apply for open source builds https://bugs.webkit.org/show_bug.cgi?id=218982 Reviewed by Alexey Proskuryakov. The WebContent sandbox does not apply for open source builds on macOS, since it has enabled message filtering, which requires a private entitlement. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-16 Megan Gardner Add menu support for app highlights for books https://bugs.webkit.org/show_bug.cgi?id=218879 Reviewed by Alex Christensen. Add menu items and associated plumbing for support for books highlights in modern WebKit. * FeatureFlags/WebKit.plist: * Shared/API/c/WKContextMenuItemTypes.h: * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm: (WebKit::isFeatureFlagEnabled): * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAppHighlightsEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm: * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): 2020-11-16 Trevor Stevenson Add didReceiveResponseForResource to WKWebProcessPlugInLoadDelegate https://bugs.webkit.org/show_bug.cgi?id=218925 Reviewed by Alex Christensen. Expose the callback for didReceiveResponseForResource in WKWebProcessPlugInLoadDelegate for use in the injected bundle. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (didReceiveResponseForResource): (setUpResourceLoadClient): 2020-11-16 Carlos Garcia Campos WebDriver: do not focus the main frame when switching to a window https://bugs.webkit.org/show_bug.cgi?id=218383 Reviewed by Brian Burg. The spec doesn't say we should focus the main frame. This is confusing WPT test infrastructure/testdriver/actions/crossOrigin.sub.html that first focuses an input in an iframe and then it send keyboard events to the window (after switching to the window again even when it's already the current one, that causes the iframe focus to be lost). * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::switchToBrowsingContext): * WebProcess/Automation/WebAutomationSessionProxy.cpp: * WebProcess/Automation/WebAutomationSessionProxy.h: * WebProcess/Automation/WebAutomationSessionProxy.messages.in: 2020-11-16 Kimmo Kinnunen Final refactor for WebGL implementation to use only GraphicsContextGL https://bugs.webkit.org/show_bug.cgi?id=218333 Reviewed by Simon Fraser. Change MediaPlayerPrivate to use GraphicsContextGL abstract class instead of GraphicsContextGLOpenGL concrete class, since the calling code is doing the same change. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 2020-11-16 Devin Rousso [iPad] nhl.com cannot select new video to play while video is playing with desktop UA https://bugs.webkit.org/show_bug.cgi?id=218868 Reviewed by Antoine Quint. The desktop "version" of this site uses custom media controls that don't work well on iOS because they rely on mouse events (which is why it was quirked in r255592). The mobile "version" uses the default/native media controls, so there is no issue. Currently, when tapping on another video with a desktop UA, the site uses its touch event handlers for mouse events. These handlers call `Event.prototype.preventDefault` if the event is not a touch event, meaning that `"click"` is not fired. This prevents new videos from being played. Rather than limit the quirk based on some DOM state (which is fragile if the site changes), just have the entire site default to a mobile UA. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommendedForRequest): 2020-11-16 Zan Dobersek [CoordinatedGraphics] Adjust client resizing, render-scope notifying in ThreadedCompositor::renderLayerTree() https://bugs.webkit.org/show_bug.cgi?id=218701 Reviewed by Carlos Garcia Campos. Rework the client operations in ThreadedCompositor::renderLayerTree() so that client resizing is done before the will-render client notification is dispatched. This ensures everything in the will-render-to-did-render scope is done for a well-specified size from the client's point of view. Similar to this change, the GL viewport update is split from the client resize operation and moved into the aforementioned rendering scope. This change is mostly cosmetic, but it's done to neatly package all the GL operations into that scope. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::renderLayerTree): 2020-11-15 Tim Horton Initial implementation of DOM rendering via the GPU process https://bugs.webkit.org/show_bug.cgi?id=218928 Reviewed by Simon Fraser. * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: (WebKit::RemoteLayerBackingStore::hasFrontBuffer const): (WebKit::RemoteLayerBackingStore::Buffer::operator bool const): * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::decode): (WebKit::RemoteLayerBackingStore::pixelFormat const): (WebKit::RemoteLayerBackingStore::bytesPerPixel const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): (WebKit::RemoteLayerBackingStore::display): (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): (WebKit::RemoteLayerBackingStore::takePendingFlusher): (WebKit::RemoteLayerBackingStore::setBufferVolatility): (WebKit::RemoteLayerBackingStore::Buffer::discard): (WebKit::RemoteLayerBackingStore::drawInContext): Deleted. (WebKit::RemoteLayerBackingStore::takeFrontContextPendingFlush): Deleted. (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): Deleted. Reimplement RemoteLayerBackingStore in terms of ImageBuffer instead of using ShareableBitmap + IOSurface explicitly. We use ConcreteImageBuffer versions of the shareable backends in the WebContent process in the non-GPU-process case, and normal DisplayList-backed RemoteImageBufferProxies in the GPU process case. * UIProcess/ViewSnapshotStore.h: * UIProcess/mac/ViewSnapshotStoreMac.mm: (WebKit::ViewSnapshot::setVolatile): (WebKit::ViewSnapshot::asLayerContents): * WebProcess/GPU/graphics/ImageBufferBackendHandle.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::ThreadSafeRemoteImageBufferFlusher::ThreadSafeRemoteImageBufferFlusher): Add a hack to emulate ThreadSafeRemoteImageBufferFlusher; right now, we'll synchronously flush on the main thread when creating the flusher; a future patch will move this into the flush() method so that RemoteLayerBackingStore can do it on a secondary queue. (WebKit::RemoteImageBufferProxy::createImageBufferBackendHandle): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): (WebKit::WebChromeClient::ensureRemoteRenderingBackendProxy const): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::ensureRemoteRenderingBackendProxy): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRendering): (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::create): (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::BackingStoreFlusher): (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::flush): Reimplement BackingStoreFlusher in terms of the abstract ThreadSafeImageBufferFlusher. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::ensureRemoteRenderingBackendProxy): * WebProcess/WebPage/WebPage.h: Move RemoteRenderingBackendProxy from WebChromeClient to WebPage, so that other non-WebCore clients can use it without having to think about WebChromeClient. 2020-11-14 Zan Dobersek Unreviewed, suppressing GCC compilation warnings. * UIProcess/API/wpe/ScrollGestureController.cpp: (WebKit::ScrollGestureController::handleEvent): Explicitly store the std::abs() results as uint32_t values. This avoids comparison between the otherwise-signed return values and the unsigned constants. 2020-11-13 Sihui Liu Implement basic permission check for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=218476 Reviewed by Youenn Fablet. Introduce SpeechRecognitionPermissionManager, which checks and requests speech recognition permissions before we actually start capturing audio and perform recognition. SpeechRecognitionPermissionManager is per-page, like SpeechRecognitionServer. The checks include: 1. Sandbox requirement for microphone 2. TCC check for microphone 3. TCC check for SFSpeechRecognizer 4. User permission on speech recognition for origin Add a delegate function for requesting user permission. By default, user permission is not granted. API test: WebKit2.SpeechRecognitionUserPermissionPersistence * Headers.cmake: * Shared/API/APIObject.h: * Shared/API/c/WKBase.h: * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIUIClient.h: (API::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): * UIProcess/API/C/WKAPICast.h: * UIProcess/API/C/WKPage.cpp: (WKPageSetPageUIClient): * UIProcess/API/C/WKPageUIClient.h: * UIProcess/API/C/WKSpeechRecognitionPermissionCallback.cpp: Added. (WKSpeechRecognitionPermissionCallbackGetTypeID): (WKSpeechRecognitionPermissionCallbackComplete): * UIProcess/API/C/WKSpeechRecognitionPermissionCallback.h: Added. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _speechRecognitionEnabled]): (-[WKPreferences _setSpeechRecognitionEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/MediaPermissionUtilities.mm: Added. (WebKit::checkSandboxRequirementForType): (WebKit::checkUsageDescriptionStringForType): (WebKit::checkUsageDescriptionStringForSpeechRecognition): (WebKit::requestAVCaptureAccessForType): (WebKit::checkAVCaptureAccessForType): (WebKit::requestSpeechRecognitionAccess): (WebKit::checkSpeechRecognitionServiceAccess): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): * UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm: (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureAudio): (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureVideo): (WebKit::UserMediaPermissionRequestManagerProxy::requestSystemValidation): (WebKit::requestAVCaptureAccessForMediaType): Deleted. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: * UIProcess/MediaPermissionUtilities.h: Copied from Added. * UIProcess/SpeechRecognitionPermissionManager.cpp: Added. (WebKit::computeMicrophoneAccess): (WebKit::computeSpeechRecognitionServiceAccess): (WebKit::SpeechRecognitionPermissionManager::SpeechRecognitionPermissionManager): (WebKit::SpeechRecognitionPermissionManager::~SpeechRecognitionPermissionManager): (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startNextRequest): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::completeCurrentRequest): (WebKit::SpeechRecognitionPermissionManager::requestSpeechRecognitionServiceAccess): (WebKit::SpeechRecognitionPermissionManager::requestMicrophoneAccess): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: Added. * UIProcess/SpeechRecognitionPermissionRequest.h: Added. (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::complete): (WebKit::SpeechRecognitionPermissionRequest::origin const): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): (WebKit::SpeechRecognitionPermissionCallback::create): (WebKit::SpeechRecognitionPermissionCallback::complete): (WebKit::SpeechRecognitionPermissionCallback::SpeechRecognitionPermissionCallback): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::stop): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::invalidate): (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::stopRequest): (WebKit::SpeechRecognitionServer::abortRequest): (WebKit::SpeechRecognitionServer::sendUpdate): (WebKit::SpeechRecognitionServer::processNextPendingRequestIfNeeded): Deleted. (WebKit::SpeechRecognitionServer::removePendingRequest): Deleted. (WebKit::SpeechRecognitionServer::startPocessingRequest): Deleted. (WebKit::SpeechRecognitionServer::stopProcessingRequest): Deleted. * UIProcess/SpeechRecognitionServer.h: * UIProcess/SpeechRecognitionServer.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChangeMainDocument): (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::requestSpeechRecognitionPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::start): (WebKit::WebSpeechRecognitionConnection::didReceiveUpdate): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: 2020-11-13 Chris Dumez [GPUProcess] Add basic GPUProcess crash handling for canvas https://bugs.webkit.org/show_bug.cgi?id=218924 Reviewed by Simon Fraser. Update RemoteRenderingBackendProxy to be a GPUProcessConnection::Client so that it gets notified when the IPC connection to the GPUProcess gets severed. When this happens, RemoteRenderingBackendProxy clears all its SharedMemory handles and sends IPC messages to the GPU process to recreate all the ImageBuffers we had. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): (WebKit::RemoteImageBufferProxy::clearBackend): (WebKit::RemoteImageBufferProxy::size const): (WebKit::RemoteImageBufferProxy::renderingMode const): (WebKit::RemoteImageBufferProxy::colorSpace const): (WebKit::RemoteImageBufferProxy::pixelFormat const): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy): (WebKit::RemoteRenderingBackendProxy::connectToGPUProcess): (WebKit::recreateImage): (WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose): (WebKit::RemoteRenderingBackendProxy::createImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: (WebKit::RemoteResourceCacheProxy::imageBuffers const): 2020-11-13 Chris Dumez [GPUProcess] Add basic low memory handling in the GPUProcess https://bugs.webkit.org/show_bug.cgi?id=218926 Reviewed by Geoffrey Garen. Add basic low memory handling in the GPUProcess. For now, the GPUProcess only calls WTF::releaseFastMallocFreeMemory() on low memory warning. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): 2020-11-13 Kate Cheney Can't login to Microsoft Teams https://bugs.webkit.org/show_bug.cgi?id=218778 Reviewed by John Wilander. This is a temporary quirk to assist a high-traffic website while they complete the large task of migrating away from login flows that require third party cookies. This quirk will be removed when the site is updated. Create a quirk to call the Storage Access API on behalf of Microsoft. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): Relax the requirement for user interaction for a specific third party needing cookies for authentication purposes. (WebKit::ResourceLoadStatisticsDatabaseStore::clear): (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess): Relax the requirement for user interaction for a specific third party needing cookies for authentication purposes. (WebKit::ResourceLoadStatisticsDatabaseStore::domainsWithStorageAccess const): (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::clear): (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral): Relax user interaction for reasons above. (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: (WebKit::RegistrableDomainsToBlockCookiesFor::isolatedCopy const): * Shared/WebProcessDataStoreParameters.h: (WebKit::WebProcessDataStoreParameters::encode const): (WebKit::WebProcessDataStoreParameters::decode): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setDomainsWithCrossPageStorageAccess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::webProcessDataStoreParameters): (WebKit::WebProcessPool::setDomainsWithCrossPageStorageAccess): * UIProcess/WebProcessPool.h: * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::hasCrossPageStorageAccess const): (WebKit::WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess): * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setWebsiteDataStoreParameters): (WebKit::WebProcess::setDomainsWithCrossPageStorageAccess): Add quirk'd domains to have page level storage access to be able to use document.cookie. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: Forward domains with the storage access quirk to the web process to avoid an async call to the network process. 2020-11-13 Sam Weinig Move some more WebKit and WebKitLegacy preferences bound to Settings to WebPreferences.yaml https://bugs.webkit.org/show_bug.cgi?id=218914 Reviewed by Tim Horton. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::appleMailPaginationQuirkEnabled): Deleted. (WebKit::WebPageProxy::appleMailLinesClampEnabled): Deleted. Removes appleMailPaginationQuirkEnabled and appleMailLinesClampEnabled. appleMailPaginationQuirkEnabled is now handled via the preferences infrastructure and appleMailLinesClampEnabled was unused. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAppleMailPaginationQuirkEnabled): * Shared/WebPreferencesDefaultValues.h: Adds default value for AppleMailPaginationQuirkEnabled, which is now in WebPreferences.yaml. Moved from WebPageProxyMac.mm * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Removes explicit setting of setAppleMailPaginationQuirkEnabled, setContentDispositionAttachmentSandboxEnabled, setScrollingPerformanceLoggingEnabled and setUseImageDocumentForSubframePDF which are all generated now. LayoutViewportHeightExpansionFactor was already generated so this call was just redundant. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::setScrollingPerformanceLoggingEnabled): Deleted. It's also no longer necessary to store m_scrollingPerformanceLoggingEnabled as the value can be extracted directly from the store in the one place it was read. setScrollingPerformanceLoggingEnabled was never called, so has been removed. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updatePreferences): Extract scrollingPerformanceLoggingEnabled directly from the store rather than having the page set it just for this one place to read it. 2020-11-13 Geoffrey Garen Removed DeferrableTaskTimer https://bugs.webkit.org/show_bug.cgi?id=218874 Reviewed by Chris Dumez. It was (mostly) redundant. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateReportedMediaCaptureState): * UIProcess/WebPageProxy.h: Use WTF::RunLoop::Timer instead of WebCore::Timer because WebCore::Timer for WebKit code in the UI process is a no-no, which can crash if the UI process also uses WebThread. 2020-11-13 Per Arne Vollan [macOS] Issue sandbox extension to the WebContent process for com.apple.lskdd https://bugs.webkit.org/show_bug.cgi?id=218920 Reviewed by Geoffrey Garen. This is a Media related service, and a sandbox extension should be issued to the WebContent process based on GPU runtime settings. No new tests, covered by existing tests. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-13 Claudio Saavedra Non-unified build fixes. https://bugs.webkit.org/show_bug.cgi?id=218905 Unreviewed. * GPUProcess/graphics/RemoteRenderingBackend.cpp: * GPUProcess/graphics/RemoteResourceCache.h: 2020-11-13 Alex Christensen Remove more SecItemShim leftovers https://bugs.webkit.org/show_bug.cgi?id=218919 Reviewed by Geoffrey Garen. * Configurations/SecItemShim.xcconfig: Removed. * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm: (NETWORK_SERVICE_INITIALIZER): * PlatformMac.cmake: * WebKit.xcodeproj/project.pbxproj: 2020-11-12 Darin Adler Remove unused advanced plug-in features: snapshotting and plug-in load policy https://bugs.webkit.org/show_bug.cgi?id=218835 Reviewed by Tim Horton. * PluginProcess/mac/PluginProcessMac.mm: (WebKit::muteAudio): Deleted. (WebKit::PluginProcess::platformInitializePluginProcess): * Scripts/webkit/messages.py: Remove PluginProcessType. * Shared/Plugins/PluginProcessAttributes.h: Ditto. * Shared/Plugins/PluginProcessCreationParameters.cpp: (WebKit::PluginProcessCreationParameters::encode const): Ditto. (WebKit::PluginProcessCreationParameters::decode): Ditto. * Shared/Plugins/PluginProcessCreationParameters.h: Ditto. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Remove plugInAutoStartOrigins and pluginLoadClientPolicies. (WebKit::WebProcessCreationParameters::decode): Ditto. * Shared/WebProcessCreationParameters.h: Ditto. * Shared/WebProcessDataStoreParameters.h: (WebKit::WebProcessDataStoreParameters::encode const): Remove plugInAutoStartOriginHashes. (WebKit::WebProcessDataStoreParameters::decode): Ditto. * Sources.txt: Remove PlugInAutoStartProvider.cpp and WebPlugInClient.cpp. * UIProcess/API/C/WKContext.cpp: (WKContextCopyPlugInAutoStartOriginHashes): Return nullptr. (WKContextSetPlugInAutoStartOriginHashes): Do nothing. (WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime): Ditto. (WKContextSetPlugInAutoStartOrigins): Ditto. * UIProcess/API/C/WKPage.cpp: (WKPageSetPageNavigationClient): Remove decidePolicyForPluginLoad. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetPlugInSnapshottingEnabled): Do nothing. (WKPreferencesGetPlugInSnapshottingEnabled): Return false. (WKPreferencesSetSnapshotAllPlugIns): Do nothing. (WKPreferencesGetSnapshotAllPlugIns): Return false. (WKPreferencesSetAutostartOriginPlugInSnapshottingEnabled): Do nothing. (WKPreferencesGetAutostartOriginPlugInSnapshottingEnabled): Return false. (WKPreferencesSetPrimaryPlugInSnapshotDetectionEnabled): Do nothing. (WKPreferencesGetPrimaryPlugInSnapshotDetectionEnabled): Return false. * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextIsPlugInUpdateAvailable): Return false. (WKContextSetPluginLoadClientPolicy): Do nothing. (WKContextClearPluginClientPolicies): Do nothing. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setPlugInSnapshottingEnabled:]): Do nothing. (-[WKPreferences _plugInSnapshottingEnabled]): Return NO. * UIProcess/API/Cocoa/WKProcessPool.mm: (toPluginLoadClientPoliciesHashMap): Deleted. (policiesHashMapToDictionary): Deleted. (-[WKProcessPool _resetPluginLoadClientPolicies:]): Do nothing. (-[WKProcessPool _pluginLoadClientPolicies]): Return an empty dictionary. * UIProcess/Cocoa/NavigationState.h: Remove didFailToInitializePlugIn, didBlockInsecurePluginVersion, decidePolicyForPluginLoad, webViewDidFailToInitializePlugInWithInfo, webViewDidBlockInsecurePluginVersionWithInfo, and webViewDecidePolicyForPluginLoadWithCurrentPolicyPluginInfoCompletionHandler. * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): Updated for abvoe removals. (WebKit::NavigationState::NavigationClient::didFailToInitializePlugIn): Deleted. (WebKit::NavigationState::NavigationClient::didBlockInsecurePluginVersion): Deleted. (WebKit::pluginModuleLoadPolicy): Deleted. (WebKit::wkPluginModuleLoadPolicy): Deleted. (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad): Deleted. * UIProcess/Plugins/PlugInAutoStartProvider.cpp: Removed. * UIProcess/Plugins/PlugInAutoStartProvider.h: Removed. * UIProcess/Plugins/PluginProcessManager.cpp: (WebKit::PluginProcessManager::pluginProcessToken): Removed the pluginProcessType argument. (WebKit::PluginProcessManager::fetchWebsiteData): Ditto. (WebKit::PluginProcessManager::deleteWebsiteData): Ditto. (WebKit::PluginProcessManager::deleteWebsiteDataForHostNames): Ditto. * UIProcess/Plugins/PluginProcessManager.h: Ditto. * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::didFinishLaunching): Removed the code to handle PluginProcessType::Snapshot. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::findPlugin): Removed the processType argument. * UIProcess/WebPageProxy.h: Ditto. * UIProcess/WebPageProxy.messages.in: Ditto. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::webProcessDataStoreParameters): Removed plugInAutoStartOriginHashes. (WebKit::WebProcessPool::initializeNewWebProcess): Removed plugInAutoStartOrigins and pluginLoadClientPolicies. (WebKit::WebProcessPool::plugInAutoStartOriginHashes const): Deleted. (WebKit::WebProcessPool::setPlugInAutoStartOriginHashes): Deleted. (WebKit::WebProcessPool::setPlugInAutoStartOrigins): Deleted. (WebKit::WebProcessPool::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime): Deleted. (WebKit::WebProcessPool::setPluginLoadClientPolicy): Deleted. (WebKit::WebProcessPool::resetPluginLoadClientPolicies): Deleted. (WebKit::WebProcessPool::clearPluginClientPolicies): Deleted. * UIProcess/WebProcessPool.h: Removed setPluginLoadClientPolicy, resetPluginLoadClientPolicies, clearPluginClientPolicies, pluginLoadClientPolicies, plugInAutoStartOriginHashes, setPlugInAutoStartOriginHashes, setPlugInAutoStartOrigins, setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime, plugInAutoStartProvider, m_plugInAutoStartProvider, and m_pluginLoadClientPolicies. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addPlugInAutoStartOriginHash): Deleted. (WebKit::WebProcessProxy::plugInDidReceiveUserInteraction): Deleted. * UIProcess/WebProcessProxy.h: Ditto. * UIProcess/WebProcessProxy.messages.in: Ditto. * WebKit.xcodeproj/project.pbxproj: Removed PlugInAutoStartProvider.cpp/h and WebPlugInClient.cpp/h. * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: Removed include of RenderSnapshottedPlugIn.h. * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm: (WebKit::PluginProxy::pluginLayer): Removed code to handle m_isRestartedProcess. * WebProcess/Plugins/PDF/PDFPlugin.h: Removed shouldAlwaysAutoStart. * WebProcess/Plugins/Plugin.h: Ditto. * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::create): Removed isRestartedProcess argument. (WebKit::PluginProxy::PluginProxy): Ditto. Also moved initialization to the class definition. * WebProcess/Plugins/PluginProxy.h: Updated for the above changes. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::PluginView): Removed m_pluginSnapshotTimer. (WebKit::PluginView::recreateAndInitialize): Removed code to manage m_pluginSnapshotTimer. (WebKit::PluginView::initializePlugin): Removed code to set m_didPlugInStartOffScreen. (WebKit::PluginView::didInitializePlugin): Removed code to handle restarting plug-ins. (WebKit::PluginView::paint): Ditto. (WebKit::PluginView::handleEvent): Removed calls to pluginDidReceiveUserInteraction. (WebKit::PluginView::shouldNotAddLayer const): Return false. (WebKit::PluginView::invalidateRect): Removed code to handle restarting plug-ins. (WebKit::PluginView::isAcceleratedCompositingEnabled): Removed some Flash-specific code. (WebKit::isAlmostSolidColor): Deleted. (WebKit::PluginView::pluginSnapshotTimerFired): Deleted. (WebKit::PluginView::beginSnapshottingRunningPlugin): Deleted. (WebKit::PluginView::shouldAlwaysAutoStart const): Deleted. (WebKit::PluginView::pluginDidReceiveUserInteraction): Deleted. * WebProcess/Plugins/PluginView.h: Removed pluginSnapshotTimerFired, pluginDidReceiveUserInteraction, shouldAlwaysAutoStart, beginSnapshottingRunningPlugin, m_didPlugInStartOffScreen, m_pluginSnapshotTimer, m_countSnapshotRetries, m_didReceiveUserInteraction. * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy): Deleted. (WebKit::WebPluginInfoProvider::clearPluginClientPolicies): Deleted. (WebKit::WebPluginInfoProvider::populatePluginCache): Do not call pluginLoadClientPolicyForHost. (WebKit::WebPluginInfoProvider::pluginLoadClientPolicyForHost const): Deleted. (WebKit::WebPluginInfoProvider::longestMatchedWildcardHostForHost const): Deleted. (WebKit::WebPluginInfoProvider::replaceHostWithMatchedWildcardHost const): Deleted. * WebProcess/Plugins/WebPluginInfoProvider.h: Removed setPluginLoadClientPolicy, clearPluginClientPolicies, pluginLoadClientPolicyForHost, longestMatchedWildcardHostForHost, replaceHostWithMatchedWildcardHost, PluginLoadClientPoliciesByBundleVersion, PluginPolicyMapsByIdentifier, and m_hostsToPluginIdentifierData. * WebProcess/WebCoreSupport/WebPlugInClient.cpp: Removed. * WebProcess/WebCoreSupport/WebPlugInClient.h: Removed. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Removed code to initialize m_determinePrimarySnapshottedPlugInTimer, plugInClient, and processType. (WebKit::WebPage::createPlugin): Removed isRestartedProcess. (WebKit::WebPage::close): Removed m_determinePrimarySnapshottedPlugInTimer code. (WebKit::WebPage::addPluginView): Ditto. (WebKit::WebPage::removePluginView): Ditto. (WebKit::WebPage::canPluginHandleResponse): Removed plug-in process type. (WebKit::WebPage::didCommitLoad): Removed call to resetPrimarySnapshottedPlugIn. (WebKit::WebPage::didFinishLoad): Removed m_determinePrimarySnapshottedPlugInTimer code. (WebKit::WebPage::determinePrimarySnapshottedPlugInTimerFired): Deleted. (WebKit::WebPage::determinePrimarySnapshottedPlugIn): Deleted. (WebKit::WebPage::resetPrimarySnapshottedPlugIn): Deleted. (WebKit::WebPage::matchesPrimaryPlugIn const): Deleted. (WebKit::WebPage::plugInIntersectsSearchRect): Deleted. (WebKit::WebPage::plugInIsPrimarySize): Deleted. * WebProcess/WebPage/WebPage.h: Removed determinePrimarySnapshottedPlugIn, determinePrimarySnapshottedPlugInTimerFired, resetPrimarySnapshottedPlugIn, matchesPrimaryPlugIn, plugInIntersectsSearchRect, plugInIsPrimarySize, m_readyToFindPrimarySnapshottedPlugin, m_didFindPrimarySnapshottedPlugin, m_numberOfPrimarySnapshotDetectionAttempts, m_primaryPlugInPageOrigin, m_primaryPlugInOrigin, m_primaryPlugInMimeType, and m_determinePrimarySnapshottedPlugInTimer. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): Removed code to set m_plugInAutoStartOrigins and call to resetPluginLoadClientPolicies. (WebKit::WebProcess::setWebsiteDataStoreParameters): Removed call to resetPlugInAutoStartOriginHashes. (WebKit::addCaseFoldedCharacters): Deleted. (WebKit::hashForPlugInOrigin): Deleted. (WebKit::WebProcess::isPlugInAutoStartOriginHash): Deleted. (WebKit::WebProcess::shouldPlugInAutoStartFromOrigin): Deleted. (WebKit::WebProcess::plugInDidStartFromOrigin): Deleted. (WebKit::WebProcess::didAddPlugInAutoStartOriginHash): Deleted. (WebKit::WebProcess::resetPlugInAutoStartOriginHashes): Deleted. (WebKit::WebProcess::plugInDidReceiveUserInteraction): Deleted. (WebKit::WebProcess::setPluginLoadClientPolicy): Deleted. (WebKit::WebProcess::resetPluginLoadClientPolicies): Deleted. (WebKit::WebProcess::clearPluginClientPolicies): Deleted. * WebProcess/WebProcess.h: Removed shouldPlugInAutoStartFromOrigin, plugInDidStartFromOrigin, plugInDidReceiveUserInteraction, setPluginLoadClientPolicy, resetPluginLoadClientPolicies, clearPluginClientPolicies, isPlugInAutoStartOriginHash, didAddPlugInAutoStartOriginHash, resetPlugInAutoStartOriginHashes, m_plugInAutoStartOriginHashes, and m_plugInAutoStartOrigins. * WebProcess/WebProcess.messages.in: Removed DidAddPlugInAutoStartOriginHash, ResetPlugInAutoStartOriginHashes, SetPluginLoadClientPolicy, ResetPluginLoadClientPolicies, and ClearPluginClientPolicies. 2020-11-12 Simon Fraser Force wheel event listeners on the root to be passive https://bugs.webkit.org/show_bug.cgi?id=218842 Reviewed by Chris Dumez. Following Blink (https://www.chromestatus.com/feature/6662647093133312) force 'wheel' and 'mousewheel' event listeners on root objects (window, document and body) to be passive if they were not explicitly registered as non-passive. This behavior is controlled by an experimental feature flag, and a linked-on-or-after check to avoid changing behavior for apps that embed WebKit until they link against new SDKs. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultCSSOMViewScrollingAPIEnabled): (WebKit::defaultPassiveWheelListenersAsDefaultOnDocument): * Shared/WebPreferencesDefaultValues.h: 2020-11-13 Eric Carlson Add _STAttributionDisplayName to macOS WebContent Info.plist https://bugs.webkit.org/show_bug.cgi?id=218900 Reviewed by Youenn Fablet. * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: 2020-11-13 Miguel Gomez [GTK][WPE] CSS backdrop overlay corners are not rounded on results.webkit.org https://bugs.webkit.org/show_bug.cgi?id=215445 Reviewed by Carlos Garcia Campos. Pass the backdropFiltersRect from the state to TextureMapperLayer. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::updateSceneState): 2020-11-13 Kimmo Kinnunen Remove SecItemShim.dylib from network service link https://bugs.webkit.org/show_bug.cgi?id=218892 Reviewed by Antti Koivisto. Fixes a build failure after https://bugs.webkit.org/show_bug.cgi?id=218862 * Configurations/NetworkService.xcconfig: 2020-11-12 Youenn Fablet Add infrastructure for WebRTC transforms https://bugs.webkit.org/show_bug.cgi?id=218750 Reviewed by Eric Carlson. Remove no longer needed const casting. * Configurations/WebKit.xcconfig: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::completedEncoding): 2020-11-12 Alex Christensen Remove SecItemShim.dylib https://bugs.webkit.org/show_bug.cgi?id=218862 Reviewed by Alexey Proskuryakov. This is dead code since r269697. * Shared/mac/SecItemShim.cpp: * WebKit.xcodeproj/project.pbxproj: * WebProcess/mac/SecItemShimLibrary.h: Removed. * WebProcess/mac/SecItemShimLibrary.mm: Removed. 2020-11-12 Tim Horton canvas-createPattern-video-modify-crash-log.txt asserts on debug GPUProcess bots https://bugs.webkit.org/show_bug.cgi?id=218872 Reviewed by Simon Fraser. * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::create): This assertion is wrong; make it the same as the one in ImageBufferCGBitmapBackend. 2020-11-12 Said Abou-Hallawa [GPU Process] GraphicsContext::drawPattern() should take a NativeImage argument https://bugs.webkit.org/show_bug.cgi?id=218865 Reviewed by Simon Fraser. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-12 Per Arne Vollan [iOS] IOKit sandbox violation when enabling all GPU runtime flags https://bugs.webkit.org/show_bug.cgi?id=218820 Reviewed by Brent Fulgham. When enabling all GPU runtime flags on iOS, there is an iokit-open sandbox violation for the IOKit class AGXDeviceUserClient in the WebContent process. When all GPU runtime flags are enabled, IOKit extensions are not provided to the WebContent process, which should then fall back to a set of rules allowing use of these IOKit classes, with logging. There seems to be a problem with the fallback for this specific IOKit class, which this patch addresses by adding an extra requirement to the rule. The extra requirement is that IOKit extensions have not been provided for these IOKit classes. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-11-12 Chris Dumez [GPUProcess] Add basic GPUProcess crash handling for media playback https://bugs.webkit.org/show_bug.cgi?id=218825 Reviewed by Eric Carlson. When the GPU process crashes and there are pending media players, we now relaunch the GPU process and ask those media players to reconstuct their private media players, reload the file and resume playback if necessary. This ensures that in case of a GPU process crash while the user is playing a video, the video just seamlessly keeps playing from where it was before the crash. Before this patch, we would end up busy looping and the WebContent process would use 100% CPU after a GPU process crash. * WebProcess/GPU/GPUProcessConnection.h: (WebKit::GPUProcessConnection::addClient): (WebKit::GPUProcessConnection::removeClient): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::proxyConfigurationForPlayer): (WebKit::RemoteMediaPlayerManager::gpuProcessConnection const): (WebKit::RemoteMediaPlayerManager::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteMediaPlayerManager.h: 2020-11-12 Chris Dumez ASSERTION FAILED: isValidIdentifier(m_identifier) seen with TestWebKitAPI.GPUProcess.WebProcessTerminationAfterTooManyGPUProcessCrashes https://bugs.webkit.org/show_bug.cgi?id=218856 Reviewed by Tim Horton. The API test is repeatedly killing the GPU process. As a result, it is possible for the GPUProcess to crash while RemoteAudioDestinationProxy::connectToGPUProcess() is in the middle of its RemoteAudioDestinationManager::CreateAudioDestination() synchronous IPC. The function would fail to check if the IPC was successful and proceed with an invalid destinationID in such cases, causing the crash. We now check if the sendSync() was successful. If it wasn't we now log an error and return early. RemoteAudioDestinationManager::gpuProcessConnectionDidClose() will get called later on to notify us that the GPU Process crashed and it will call connectToGPUProcess() again. No new tests, covered by existing API test that is flakily crashing. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): 2020-11-12 Youenn Fablet WebProcess should process WebRTC codecs IPC messages from the GPU Process in a background thread https://bugs.webkit.org/show_bug.cgi?id=218790 Reviewed by Eric Carlson. Use a WorkQueue to process GPU WebRTC codec IPC messages. For that reason, handle encoder and decoder map within that queue. Covered by existing tests. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::setEncodeRates): * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::~LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::setConnection): (WebKit::LibWebRTCCodecs::createDecoder): (WebKit::LibWebRTCCodecs::releaseDecoder): (WebKit::LibWebRTCCodecs::failedDecoding): (WebKit::LibWebRTCCodecs::completedDecoding): (WebKit::LibWebRTCCodecs::createEncoder): (WebKit::LibWebRTCCodecs::releaseEncoder): (WebKit::LibWebRTCCodecs::initializeEncoder): (WebKit::LibWebRTCCodecs::setEncodeRates): (WebKit::LibWebRTCCodecs::completedEncoding): (WebKit::LibWebRTCCodecs::dispatchToThread): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: 2020-11-12 Diego Pino Garcia [GTK] Unreviewed, non-unified build fix. * WebProcess/Gamepad/WebGamepadProvider.cpp: Add missing Logging.h header. 2020-11-12 Zalan Bujtas Show legacy line layout visual coverage instead of "simple line" layout. https://bugs.webkit.org/show_bug.cgi?id=218695 Reviewed by Antti Koivisto. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetLegacyLineLayoutVisualCoverageEnabled): (WKPreferencesGetLegacyLineLayoutVisualCoverageEnabled): (WKPreferencesSetSimpleLineLayoutDebugBordersEnabled): Deleted. (WKPreferencesGetSimpleLineLayoutDebugBordersEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _legacyLineLayoutVisualCoverageEnabled]): (-[WKPreferences _setLegacyLineLayoutVisualCoverageEnabled:]): (-[WKPreferences _simpleLineLayoutDebugBordersEnabled]): Deleted. (-[WKPreferences _setSimpleLineLayoutDebugBordersEnabled:]): Deleted. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2020-11-12 Said Abou-Hallawa [GPU Process] Implement DisplayList::ClipToImageBuffer item https://bugs.webkit.org/show_bug.cgi?id=218843 Reviewed by Tim Horton. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-12 Zan Dobersek Unreviewed follow-up to r268965. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_get_enable_accelerated_2d_canvas): Use the FALSE identifier, following GLib styling guidelines. 2020-11-12 Alexander Mikhaylenko [GTK] Swipe navigation shadow is blurry on hidpi https://bugs.webkit.org/show_bug.cgi?id=218800 Reviewed by Carlos Garcia Campos. * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::createElementPattern): Scale surface size and set its scale factor. (WebKit::ViewGestureController::beginSwipeGesture): Pass scale factor to createElementPattern(). 2020-11-11 Brian Burg REGRESSION(r267411): Unable to "Start Element Selection" with Web Inspector closed https://bugs.webkit.org/show_bug.cgi?id=218838 Reviewed by Devin Rousso. The inspector side of the connection between WebInspector (inspected WebProcess) and WebInspectorUI (inspector WebProcess) was mistakenly removed in r267411. Revert those changes. Without a valid frontend connection, WebInspector cannot forward some IPC messages to WebInspectorUI including StartElementSelection. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::updateConnection): (WebKit::WebInspectorUI::closeWindow): * WebProcess/Inspector/WebInspectorUI.h: 2020-11-11 Said Abou-Hallawa [GPU Process] Delete the DisplayList items: DrawImage and DrawTiledImage https://bugs.webkit.org/show_bug.cgi?id=218839 Reviewed by Tim Horton. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-11 Chris Dumez Add RunLoop::Timer constructor taking in a WTF::Function https://bugs.webkit.org/show_bug.cgi?id=218828 Reviewed by Darin Adler. Use the new RunLoop::Timer constructor to simplify the code a bit. * UIProcess/WebProcessPool.cpp: (WebKit::m_resetGPUProcessCrashCountTimer): * UIProcess/WebProcessPool.h: 2020-11-11 John Wilander PCM: Change from ad-click-attribution to private-click-measurement (in all forms, including .well-known URL) https://bugs.webkit.org/show_bug.cgi?id=218730 Reviewed by Alex Christensen. Change to the official name of the proposed standard Private Click Measurement https://github.com/privacycg/private-click-measurement. This includes a change of the reporting URL from "/.well-known/ad-click-attribution/" to "/.well-known/private-click-measurement/". * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::storePrivateClickMeasurement): (WebKit::NetworkProcess::dumpPrivateClickMeasurement): (WebKit::NetworkProcess::clearPrivateClickMeasurement): (WebKit::NetworkProcess::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::NetworkProcess::setPrivateClickMeasurementConversionURLForTesting): (WebKit::NetworkProcess::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkProcess::setAdClickAttributionDebugMode): Deleted. (WebKit::NetworkProcess::storeAdClickAttribution): Deleted. (WebKit::NetworkProcess::dumpAdClickAttribution): Deleted. (WebKit::NetworkProcess::clearAdClickAttribution): Deleted. (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::storePrivateClickMeasurement): (WebKit::NetworkSession::handlePrivateClickMeasurementConversion): (WebKit::NetworkSession::dumpPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurementForRegistrableDomain): (WebKit::NetworkSession::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::NetworkSession::setPrivateClickMeasurementConversionURLForTesting): (WebKit::NetworkSession::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkSession::storeAdClickAttribution): Deleted. (WebKit::NetworkSession::handleAdClickAttributionConversion): Deleted. (WebKit::NetworkSession::dumpAdClickAttribution): Deleted. (WebKit::NetworkSession::clearAdClickAttribution): Deleted. (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain): Deleted. (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting): Deleted. * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: Renamed from Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp. (WebKit::PrivateClickMeasurementManager::storeUnconverted): (WebKit::PrivateClickMeasurementManager::handleConversion): (WebKit::PrivateClickMeasurementManager::startTimer): (WebKit::PrivateClickMeasurementManager::convert): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::firePendingConversionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::setConversionURLForTesting): (WebKit::PrivateClickMeasurementManager::markAllUnconvertedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::debugModeEnabled const): * NetworkProcess/PrivateClickMeasurementManager.h: Renamed from Source/WebKit/NetworkProcess/AdClickAttributionManager.h. (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): (WebKit::PrivateClickMeasurementManager::m_sessionID): (WebKit::PrivateClickMeasurementManager::setPingLoadFunction): (WebKit::PrivateClickMeasurementManager::setOverrideTimerForTesting): * Platform/Logging.h: * Shared/NavigationActionData.cpp: (WebKit::NavigationActionData::encode const): (WebKit::NavigationActionData::decode): * Shared/NavigationActionData.h: * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::ownerProcess): * Shared/WebsiteData/WebsiteDataType.h: * Sources.txt: * UIProcess/API/APINavigation.h: (API::Navigation::privateClickMeasurement const): (API::Navigation::adClickAttribution const): Deleted. * UIProcess/API/C/WKPage.cpp: (WKPageDumpPrivateClickMeasurement): (WKPageClearPrivateClickMeasurement): (WKPageSetPrivateClickMeasurementOverrideTimerForTesting): (WKPageSetPrivateClickMeasurementConversionURLForTesting): (WKPageMarkPrivateClickMeasurementsAsExpiredForTesting): (WKPageDumpAdClickAttribution): Deleted. (WKPageClearAdClickAttribution): Deleted. (WKPageSetAdClickAttributionOverrideTimerForTesting): Deleted. (WKPageSetAdClickAttributionConversionURLForTesting): Deleted. (WKPageMarkAdClickAttributionsAsExpiredForTesting): Deleted. * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreClearPrivateClickMeasurementsThroughWebsiteDataRemoval): (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm: (dataTypesToString): _WKWebsiteDataTypeAdClickAttributions still supported. _WKWebsiteDataTypePrivateClickMeasurements added. * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h: (WebKit::toWebsiteDataType): _WKWebsiteDataTypeAdClickAttributions still supported and mapped to WebsiteDataType::PrivateClickMeasurements. (WebKit::toWKWebsiteDataTypes): * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: _WKWebsiteDataTypeAdClickAttributions still supported. _WKWebsiteDataTypePrivateClickMeasurements added. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: _WKWebsiteDataTypeAdClickAttributions still supported. _WKWebsiteDataTypePrivateClickMeasurements added. (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::setDeveloperPreferenceOverride): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcessProxy::setAdClickAttributionDebugMode): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::dumpPrivateClickMeasurement): (WebKit::WebPageProxy::clearPrivateClickMeasurement): (WebKit::WebPageProxy::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::WebPageProxy::setPrivateClickMeasurementConversionURLForTesting): (WebKit::WebPageProxy::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::WebPageProxy::dumpAdClickAttribution): Deleted. (WebKit::WebPageProxy::clearAdClickAttribution): Deleted. (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setPrivateClickMeasurementDebugMode): (WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 2020-11-11 Peng Liu Update RemoteMediaPlayerMIMETypeCache to add the support for AVFoundationMSE media engine https://bugs.webkit.org/show_bug.cgi?id=218788 Reviewed by Eric Carlson. Originally, `RemoteMediaPlayerMIMETypeCache` inherits from `MIMETypeCache`. It needs to implement three functions: `isAvailable()`, `canDecodeExtendedType()`, `supportedTypes()` through IPC messages, and the IPC message receivers in `RemoteMediaPlayerManagerProxy` needs to repeat the work done by `AVAssetMIMETypeCache` and `AVStreamDataParserMIMETypeCache`. Actually, `MediaPlayerRemoteFactory` only needs two functions from `RemoteMediaPlayerMIMETypeCache`: `supportedTypes()` and `supportsTypeAndCodecs()`. We can implement these two functions with IPC messages to `RemoteMediaPlayerManagerProxy` and cache the results to avoid too many IPC messages. In addition, the implementation of the IPC message receivers in `RemoteMediaPlayerManagerProxy` can reuse the implementation of `AVAssetMIMETypeCache` and `AVStreamDataParserMIMETypeCache`. * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::supportsTypeAndCodecs): (WebKit::RemoteMediaPlayerManagerProxy::canDecodeExtendedType): Deleted. * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/RemoteCDMInstanceSession.cpp: * WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp: (WebKit::RemoteMediaPlayerMIMETypeCache::addSupportedTypes): (WebKit::RemoteMediaPlayerMIMETypeCache::supportedTypes): (WebKit::RemoteMediaPlayerMIMETypeCache::supportsTypeAndCodecs): (WebKit::RemoteMediaPlayerMIMETypeCache::mimeCache const): Deleted. (WebKit::RemoteMediaPlayerMIMETypeCache::staticContainerTypeList): Deleted. (WebKit::RemoteMediaPlayerMIMETypeCache::isUnsupportedContainerType): Deleted. (WebKit::RemoteMediaPlayerMIMETypeCache::canDecodeExtendedType): Deleted. (WebKit::RemoteMediaPlayerMIMETypeCache::initializeCache): Deleted. * WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::getSupportedTypes): (RemoteMediaPlayerManager::initialize): 2020-11-11 Tim Horton Add minimal support for deep color IOSurface backing store to ImageBuffer https://bugs.webkit.org/show_bug.cgi?id=218816 Reviewed by Simon Fraser. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::create): (WebKit::RemoteImageBuffer::RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackend::createImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::bytesPerPixel const): (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::create): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _takeViewSnapshot]): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::create): (WebKit::ImageBufferShareableBitmapBackend::ImageBufferShareableBitmapBackend): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::createBackend): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableIOSurfaceBackend::create): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-11-11 Wenson Hsieh Add system trace points for the GPU process display list processing loop https://bugs.webkit.org/show_bug.cgi?id=218824 Reviewed by Simon Fraser. Capture the time spent applying display list items in the GPU process with a pair of new trace points, to aid performance debugging and analysis. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): 2020-11-11 Said Abou-Hallawa [GPU Process] Cache the NativeImage in GPU Process and allow referencing it with its RemoteResourceIdentifier https://bugs.webkit.org/show_bug.cgi?id=217596 Reviewed by Simon Fraser. Recorder::drawNativeImage() will ensure the NativeImage is cached before recording the DrawNativeImage item with the renderingResourceIdentifier. Because RemoteImageBufferProxy is a superclass of DisplayList::Recorder:: Delegate, it will ensure the NativeImage is cached in its RemoteResourceCacheProxy. If the NativeImage is registered in RemoteResourceCacheProxy for the first time, it is going to be sent as an IPC message to GPU. Upon receiving this message, RemoteRenderingBackend will cache this NativeImage in its RemoteResourceCache. This message has to be received for any NativeImage only once for its entire life time. When flushing the DisplayList of any ImageBuffer, RemoteImageBuffer will ensure the NativeImages are cached in the RemoteResourceCache are passed to DisplayList::Replayer so it can use them to get NativeImage for every DrawNativeImage with the same renderingResourceIdentifier it was recorded with. When NativeImage is bing destroyed, its destructor will call its observer virtual method releaseNativeImage(). RemoteResourceCacheProxy will be a superclass NativeImage::Observer so its overriding method will be called. When RemoteResourceCacheProxy::releaseNativeImage() is called it is going to delete the NativeImage from RemoteResourceCacheProxy and is going to send a message to GPU to delete the corresponding NativeImage from RemoteResourceCache via RemoteRenderingBackend::releaseRemoteResource(). * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::cacheNativeImage): (WebKit::RemoteRenderingBackend::decodeItem): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheNativeImage): (WebKit::RemoteResourceCache::releaseRemoteResource): * GPUProcess/graphics/RemoteResourceCache.h: (WebKit::RemoteResourceCache::nativeImages const): * Scripts/webkit/messages.py: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::cacheNativeImage): (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::RemoteResourceCacheProxy): (WebKit::RemoteResourceCacheProxy::cacheImageBuffer): (WebKit::RemoteResourceCacheProxy::cachedImageBuffer): (WebKit::RemoteResourceCacheProxy::cacheNativeImage): (WebKit::RemoteResourceCacheProxy::releaseNativeImage): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2020-11-11 Chris Dumez Terminate WebProcesses if GPUProcess crashes more than twice in 30 seconds https://bugs.webkit.org/show_bug.cgi?id=218811 Reviewed by Tim Horton. If the GPUProcess crashes more than twice in 30 seconds, we now terminate all WebProcesses to try and get back into a good state. This is to avoid getting into a situation where the GPUProcess is crash looping. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::terminate): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessCrashed): (WebKit::WebProcessPool::resetGPUProcessCrashCount): (WebKit::WebProcessPool::terminateAllWebContentProcesses): * UIProcess/WebProcessPool.h: 2020-11-11 Brian Burg [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing https://bugs.webkit.org/show_bug.cgi?id=217783 Reviewed by Devin Rousso. _WKInspectorExtension is new SPI that represents a Web Extension that uses the 'devtools' API to interact with Web Inspector. An extension is associated with its _WKInspectorExtensionHost. A WebKit client that supports Web Extensions can use this class to implement 'devtools' extension APIs. Add _WKInspectorExtensionHost methods to register and unregister an extension. Add plumbing so that the extension in registered in the frontend with WI.InspectorExtensionController. Later patches will flesh out the needed functionality to implement rest of the 'devtools' API. * Sources.txt: * SourcesCocoa.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * WebKit.xcodeproj/project.pbxproj: Add new files. * Scripts/webkit/messages.py: If a message includes InspectorExtensionError, then generate an include for InspectorExtensionTypes.h where it is declared. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): New API object type. * Shared/InspectorExtensionTypes.h: Added error code enum and useful type aliases. * Shared/InspectorExtensionTypes.cpp: (WebKit::inspectorExtensionErrorToString): * UIProcess/API/APIInspectorExtension.h: * UIProcess/API/APIInspectorExtension.cpp: (API::InspectorExtension::create): (API::InspectorExtension::InspectorExtension): (API::InspectorExtension::~InspectorExtension): Added. This is a placeholder object that's used for the wrapper system, since we don't have single C++ objects for each extension to back the API object. * UIProcess/API/Cocoa/_WKInspector.h: * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): (-[_WKInspector unregisterExtension:completionHandler:]): Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. * UIProcess/API/Cocoa/_WKInspectorExtension.h: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: (-[_WKInspectorExtension initWithIdentifier:]): (-[_WKInspectorExtension dealloc]): (-[_WKInspectorExtension _apiObject]): (-[_WKInspectorExtension extensionID]): Added. This is a data object that's also used as a token to unregister the extension. * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: Add new SPI. * UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): (-[_WKRemoteWebInspectorViewController unregisterExtension:completionHandler:]): Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. * UIProcess/Inspector/RemoteWebInspectorProxy.h: * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: Add FrontendLoaded. (WebKit::RemoteWebInspectorProxy::extensionController const): Added. * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::frontendLoaded): (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow): Set up the extension controller object after the frontend has been created. Hook up the FrontendLoaded event sent from Inspector web process so that the extension controller can be notified of when it's safe to message the frontend. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::createFrontendPage): (WebKit::WebInspectorProxy::closeFrontendPageAndWindow): (WebKit::WebInspectorProxy::frontendLoaded): Set up the extension controller object after the frontend has been created. * UIProcess/Inspector/WebInspectorProxy.h: (WebKit::WebInspectorProxy::extensionController const): Added. * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: Added. (WebKit::WebInspectorUIExtensionControllerProxy::WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::~WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::whenFrontendHasLoaded): (WebKit::WebInspectorUIExtensionControllerProxy::inspectorFrontendLoaded): (WebKit::WebInspectorUIExtensionControllerProxy::registerExtension): (WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension): Added. Forward API requests to the Web Inspector's web process to be evaluated in the frontend. * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: (WebKit::WebInspectorFrontendAPIDispatcher::dispatchCommand): Add a more generic way to encode values to be passed as arguments to InspectorFrontendAPI.dispatch. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::establishConnection): (WebKit::WebInspectorUI::closeWindow): * WebProcess/Inspector/WebInspectorUI.h: (WebKit::WebInspectorUI::frontendPage const): Added. (WebKit::WebInspectorUI::frontendAPIDispatcher): Added. * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: Added. * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: Added. (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromResult): Handle incoming messages by forwarding the associated command to WI.WebExtensionController via InspectorFrontendAPI evaluations. * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: Fallout from unified build chunking shifts. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::getExistingCredentials): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): Fallout from unified build chunking shifts, but more. 2020-11-11 Alex Christensen Define USE(LEGACY_CFNETWORK_DOWNLOADS) https://bugs.webkit.org/show_bug.cgi?id=218814 Reviewed by Geoffrey Garen. Mojave CFNetwork has a few download bugs I'll need to work around. With this change I can use USE(LEGACY_CFNETWORK_DOWNLOADS) instead of __MAC_OS_X_VERSION_MIN_REQUIRED, which is more in line with WebKit style. This will be used more in bug 217747. * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): 2020-11-11 Chris Dumez [GPUProcess] Seamlessly resume WebAudio playback if the GPU Process crashes https://bugs.webkit.org/show_bug.cgi?id=218806 Reviewed by Geoffrey Garen. In case of a GPU process crash, we were previously terminating all WebProcesses. This patch makes it so that WebProcesses are no longer terminated in such cases. Additionally, this patch makes sure that if WebAudio is rendering audio while the GPU Process crashes, the GPU process will get relaunched right away and audio rendering will seamlessly continue. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessCrashed): * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::didClose): * WebProcess/GPU/GPUProcessConnection.h: (WebKit::GPUProcessConnection::Client::gpuProcessConnectionDidClose): (WebKit::GPUProcessConnection::addClient): (WebKit::GPUProcessConnection::removeClient): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): (WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::gpuProcessConnectionClosed): * WebProcess/WebProcess.h: 2020-11-11 Alex Christensen Use _CFURLConnectionSetFrameworkStubs instead of DYLD_INTERPOSE on Intel Macs https://bugs.webkit.org/show_bug.cgi?id=218810 Reviewed by Geoffrey Garen. A long, long time ago, we realized that CFNetwork was looking in the keychain for persistent credentials, and in order to make the network process get credentials as the UI process, we introduced SecItemShim which used DYLD_INTERPOSE to intercept the calls to the security framework and synchronously message the UI process for those calls. Over the last 6 years we have realized that doesn't work on iOS or Apple silicon Macs, so we use _CFURLConnectionSetFrameworkStubs instead. That works on Intel Macs, too, and I'm reasonably certain that using it everywhere won't break anything, so as a step towards rdar://problem/15588174 which should allow us to use asynchronous messages and no more globalNetworkProcess pointer, let's stop using DYLD_INTERPOSE. * Shared/mac/SecItemShim.cpp: (WebKit::initializeSecItemShim): 2020-11-11 Alex Christensen Don't look in keychain for SecKeyRef after deserializing SecIdentityRef https://bugs.webkit.org/show_bug.cgi?id=218809 Reviewed by Geoffrey Garen. In ye olden days of WebKit2, we used to use special code to serialize an NSURLCredential with an identity. We needed to serialize the certificate chain and a way to look in the keychain to find the private key. That didn't work with third party apps not entitled to look in the keychain, and it also didn't work with hardware keys that retain the private key themselves, so we introduced SecKeyProxy. Now, all those things work and we don't serialize SecIdentityRefs any more, so let's remove the problematic dead code that would have tried. Luckily, we now have API tests that verify that client certificate authentication still works. r169938 added a restriction to looking in the keychain only if the parent app has entitlements needed to do so. That restriction isn't needed any more because nobody looks in the keychain from the network process. r269162 entirely removed looking in the keychain for private keys for client certificate authentication. This is moving in that same direction. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::checkEntitlements): * Shared/cf/ArgumentCodersCF.cpp: (IPC::typeFromCFTypeRef): (IPC::encode): (IPC::decode): (IPC::setAllowsDecodingSecKeyRef): Deleted. (IPC::copyPersistentRef): Deleted. * Shared/cf/ArgumentCodersCF.h: * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): 2020-11-11 Sihui Liu REGRESSION (r269348): ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::SpeechRecognitionServer::~SpeechRecognitionServer https://bugs.webkit.org/show_bug.cgi?id=218770 Reviewed by Youenn Fablet. Remove SpeechRecognitionServer from MessageReceiverMap before it is destroyed. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): 2020-11-11 Chris Dumez REGRESSION (r269657): ASSERTION FAILED: Completion handler should always be called under WebKit::GPUProcessProxy::~GPUProcessProxy https://bugs.webkit.org/show_bug.cgi?id=218807 Reviewed by Geoffrey Garen. GPUProcessProxy::sendPrepareToSuspend() was failing to send the IPC to the GPUProcess and was also failing to call its completion handler, thus asserting in Debug. Update GPUProcessProxy to actually send the PrepareToSuspend / ProcessDidResume IPCs to the GPUProcess. The GPUProcess actually already had an implementation to deal with those IPCs. No new tests, covered by existing tests that are crashing in debug. * GPUProcess/GPUProcess.messages.in: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::sendPrepareToSuspend): (WebKit::GPUProcessProxy::sendProcessDidResume): * UIProcess/GPU/GPUProcessProxy.h: 2020-11-11 Wenson Hsieh [Concurrent display lists] Add an initial implementation of concurrent display list rendering https://bugs.webkit.org/show_bug.cgi?id=218426 Reviewed by Ryosuke Niwa. This patch adds a first-cut implementation of concurrent display list rendering, which allows the GPU and web processes to read and write display list data at the same time. To achieve this, we remove the placeholder shared memory display list encoding mechanism previously added in , and replace it with a new model in which a writer (i.e. the web process) and a reader (i.e. the GPU process) share a set of reusable shared memory buffers which contain display list item data. As the writer appends data to shared memory, it increments a counter in each shared memory buffer that represents the number of bytes that the reader has yet to read; as the reader reads display list items from shared memory, it decrements this counter. This patch also implements a simple strategy for reusing these shared item buffers. The web process maintains a queue of reusable buffers; when display list items are appended and the current writable buffer is out of capacity, the display list item buffer calls out to WebKit2 via a client method to request more shared memory. Here, the web process traverses the queue of reusable item buffers in search of a buffer with sufficient capacity; if found, we hand this back to WebCore as an opaque `ItemBufferHandle`; otherwise, we allocate a new reusable shared memory buffer. Item buffers that have been used become reusable only after they are (1) no longer being read from -- i.e., the counter value is 0, and (2) they are not actively being written to. Buffers that have been used are lazily reintroduced into the reuse queue when a display list requests a handle to writable item buffer data. See below for more details. * GPUProcess/graphics/DisplayListReaderHandle.cpp: Copied from Source/WebKit/Shared/SharedDisplayListHandle.cpp. (WebKit::DisplayListReaderHandle::advance): (WebKit::DisplayListReaderHandle::displayListForReading const): * GPUProcess/graphics/DisplayListReaderHandle.h: Copied from Source/WebKit/Shared/SharedDisplayListHandle.cpp. (WebKit::DisplayListReaderHandle::create): (WebKit::DisplayListReaderHandle::DisplayListReaderHandle): Add a new helper class to represent a shared display list item buffer that the GPU process can use to consume display list items. Advancing the cursor in `DisplayListReaderHandle` decrements the "remaining bytes" counter; the class also has a helper method for creating a new `DisplayList` with a given offset into the shared buffer, as well the number of bytes to read. * GPUProcess/graphics/RemoteImageBuffer.h: Handle the `MetaCommandSwitchTo` and `FlushContext` items by (respectively) informing the rendering backend about the next buffer to read from, and sending a "flush committed" IPC message back to the web process. (WebKit::RemoteImageBuffer::RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle): (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): This is the main loop in the GPU process that is responsible for applying incoming display list item data. This IPC endpoint receives information about where to start (i.e. an item buffer ID and an offset into shared memory in that buffer) and begins reading ranges of display list item data inside that buffer. After it is done processing all of its unread bytes, it then checks the unread byte count once again, and continues the loop if the web process has advanced this count. (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): Add logic to handle the case where we reached the end of an item buffer, but the next buffer identifier is still unknown to us (since it is still "in transit" via the `DidCreateSharedDisplayListHandle` IPC message). In this case, we remember the next buffer identifier in `m_nextItemBufferToRead`, and exit the processing loop inside `wakeUpAndApplyDisplayList`. Upon receiving the shared memory handle in `didCreateSharedDisplayListHandle`, we then automatically resume display list processing, starting from the beginning of this new buffer. (WebKit::RemoteRenderingBackend::applyDisplayList): Deleted. (WebKit::RemoteRenderingBackend::submitDisplayList): Deleted. (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): Deleted. (WebKit::RemoteRenderingBackend::didCreateSharedItemData): Deleted. We don't need any of these methods anymore, now that there is only one codepath for processing display list items. See `RemoteRenderingBackend::wakeUpAndApplyDisplayList` above. Also, rename `didCreateSharedItemData` to `didCreateSharedDisplayListHandle` (also above). * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::sharedMemory): (WebKit::SharedDisplayListHandle::sharedMemory const): (WebKit::SharedDisplayListHandle::identifier const): (WebKit::SharedDisplayListHandle::data const): (WebKit::SharedDisplayListHandle::unreadBytes): (WebKit::SharedDisplayListHandle::Lock::Lock): (WebKit::SharedDisplayListHandle::Lock::~Lock): (WebKit::SharedDisplayListHandle::SharedDisplayListHandle): (WebKit::SharedDisplayListHandle::header): (WebKit::SharedDisplayListHandle::header const): (WebKit::SharedDisplayListHandle::encode const): Deleted. (WebKit::SharedDisplayListHandle::decode): Deleted. Repurpose `SharedDisplayListHandle` to serve as a base class for both `DisplayListReaderHandle` and `DisplayListWriterHandle`. This base class is aware of the memory layout of the display list item buffer in shared memory (in particular, the fact that the first 8 bytes are the atomic lock and the next 8 bytes contain the unread byte counter). Internally, this uses a protected RAII class, `SharedDisplayListHandle::Lock`, to grab the lock before either reading or writing the unread bytes count. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: Added. (WebKit::DisplayListWriterHandle::advance): (WebKit::DisplayListWriterHandle::availableCapacity const): (WebKit::DisplayListWriterHandle::createHandle const): (WebKit::DisplayListWriterHandle::resetWritableOffsetIfPossible): This helper method moves the writable offset (see below) back to the start of the buffer if it is not being read from by the GPU process. * WebProcess/GPU/graphics/DisplayListWriterHandle.h: Renamed from Source/WebKit/Shared/SharedDisplayListHandle.cpp. (WebKit::DisplayListWriterHandle::create): (WebKit::DisplayListWriterHandle::writableOffset const): Similar to `DisplayListReaderHandle`, except that this contains logic specific to the web process for writing display list items into shared memory. Advancing the cursor in `DisplayListWriterHandle` increments the counter. It also increments the `writableOffset` of the handle, which represents the minimum offset into the shared buffer that may contain newly appended display list items. (WebKit::DisplayListWriterHandle::DisplayListWriterHandle): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::submitDisplayList): (WebKit::RemoteRenderingBackendProxy::updateReusableHandles): This private helper iterates the set of buffers that are not currently being written to, and adds each one to the reusable buffer queue only if its writable offset is at the start. (WebKit::RemoteRenderingBackendProxy::createItemBuffer): Implements logic that hands shared item buffer data handles to WebCore for writing display list items. This will try to reuse an item buffer in the reuse queue, if possible, and fall back to allocating a new chunk of shared memory if no reusable buffer is found (or the existing buffers have insufficient capacity). The fact that we iterate through each reusable buffer in order, combined with the above logic in `updateReusableHandles`, ensures that once we begin writing to a item buffer, we will continue using that item buffer until it exhausts available capacity. This property is important because it allows the GPU process to simply start reading item data from a given offset and buffer ID (specified in the `WakeUpAndApplyDisplayList` IPC message), and seamlessly continue reading data even after it exhausts all available item data in the current buffer by continuing from the start of the item buffer that contains the next display list items (which we learn in the GPU process by encountering a `MetaCommandSwitchTo` item at the end of the previous buffer). In "steady state" (wherein both processes are concurrently writing and reading items as quickly as possible), this means that as the web process is busy filling up each item buffer with item data, the GPU process is also busy applying all the item data in one buffer and automatically moving on to the next buffer with no additional IPC messages required. (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-11-11 Commit Queue Unreviewed, reverting r269244. https://bugs.webkit.org/show_bug.cgi?id=218483 Patch is breaking tests Reverted changeset: "Stop sending origins from WebProcess to UIProcess for getUserMedia requests" https://bugs.webkit.org/show_bug.cgi?id=218192 https://trac.webkit.org/changeset/269244 2020-11-11 Corentin Noël [GTK] Annotate WebKitUserMessage getters as nullable https://bugs.webkit.org/show_bug.cgi?id=218761 Reviewed by Carlos Garcia Campos. These properties can be set to NULL at creation time. * Shared/API/glib/WebKitUserMessage.cpp: 2020-11-10 Commit Queue Unreviewed, reverting r269660. https://bugs.webkit.org/show_bug.cgi?id=218786 Crashing in EWS iOS simulator bots Reverted changeset: "PCM: Change from ad-click-attribution to private-click- measurement (in all forms, including .well-known URL)" https://bugs.webkit.org/show_bug.cgi?id=218730 https://trac.webkit.org/changeset/269660 2020-11-10 Per Arne Vollan [macOS] Enforce message filtering in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=218756 Reviewed by David Kilzer. Based on telemetry, we should deny access to messages not being used in the WebContent process on macOS. No new tests, covered by existing tests. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-10 Chris Dumez Webkit incorrectly setting visibilityState to "prerender" when opening link in new tab https://bugs.webkit.org/show_bug.cgi?id=215851 Reviewed by Geoff Garen. * Shared/API/c/WKSharedAPICast.h: (WebKit::toVisibilityState): * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: (webkit_dom_document_get_visibility_state): 2020-11-10 Tim Horton Use GraphicsContext instead of CGContext in RemoteLayerBackingStore https://bugs.webkit.org/show_bug.cgi?id=218738 Reviewed by Wenson Hsieh. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::drawInContext): Make use of the GraphicsContext abstraction instead of dropping down to CGContext, in preparation for DisplayList rendering. 2020-11-10 Darin Adler Remove another function that implicitly uses the composed tree (intersects with range) https://bugs.webkit.org/show_bug.cgi?id=218726 Reviewed by Ryosuke Niwa. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): Refactor to use VisiblePositionRange and to call intersects on two of them, to improve the code readability and also sidestep the issue of calling the intersects template function from outside WebCore. 2020-11-10 John Wilander PCM: Change from ad-click-attribution to private-click-measurement (in all forms, including .well-known URL) https://bugs.webkit.org/show_bug.cgi?id=218730 Reviewed by Devin Rousso. Change to the official name of the proposed standard Private Click Measurement https://github.com/privacycg/private-click-measurement. This includes a change of the reporting URL from "/.well-known/ad-click-attribution/" to "/.well-known/private-click-measurement/". * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::storePrivateClickMeasurement): (WebKit::NetworkProcess::dumpPrivateClickMeasurement): (WebKit::NetworkProcess::clearPrivateClickMeasurement): (WebKit::NetworkProcess::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::NetworkProcess::setPrivateClickMeasurementConversionURLForTesting): (WebKit::NetworkProcess::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkProcess::setAdClickAttributionDebugMode): Deleted. (WebKit::NetworkProcess::storeAdClickAttribution): Deleted. (WebKit::NetworkProcess::dumpAdClickAttribution): Deleted. (WebKit::NetworkProcess::clearAdClickAttribution): Deleted. (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::storePrivateClickMeasurement): (WebKit::NetworkSession::handlePrivateClickMeasurementConversion): (WebKit::NetworkSession::dumpPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurementForRegistrableDomain): (WebKit::NetworkSession::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::NetworkSession::setPrivateClickMeasurementConversionURLForTesting): (WebKit::NetworkSession::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkSession::storeAdClickAttribution): Deleted. (WebKit::NetworkSession::handleAdClickAttributionConversion): Deleted. (WebKit::NetworkSession::dumpAdClickAttribution): Deleted. (WebKit::NetworkSession::clearAdClickAttribution): Deleted. (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain): Deleted. (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting): Deleted. * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: Renamed from Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp. (WebKit::PrivateClickMeasurementManager::storeUnconverted): (WebKit::PrivateClickMeasurementManager::handleConversion): (WebKit::PrivateClickMeasurementManager::startTimer): (WebKit::PrivateClickMeasurementManager::convert): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::firePendingConversionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::setConversionURLForTesting): (WebKit::PrivateClickMeasurementManager::markAllUnconvertedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::debugModeEnabled const): * NetworkProcess/PrivateClickMeasurementManager.h: Renamed from Source/WebKit/NetworkProcess/AdClickAttributionManager.h. (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): (WebKit::PrivateClickMeasurementManager::m_sessionID): (WebKit::PrivateClickMeasurementManager::setPingLoadFunction): (WebKit::PrivateClickMeasurementManager::setOverrideTimerForTesting): * Platform/Logging.h: * Shared/NavigationActionData.cpp: (WebKit::NavigationActionData::encode const): (WebKit::NavigationActionData::decode): * Shared/NavigationActionData.h: * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::ownerProcess): * Shared/WebsiteData/WebsiteDataType.h: * Sources.txt: * UIProcess/API/APINavigation.h: (API::Navigation::privateClickMeasurement const): (API::Navigation::adClickAttribution const): Deleted. * UIProcess/API/C/WKPage.cpp: (WKPageDumpPrivateClickMeasurement): (WKPageClearPrivateClickMeasurement): (WKPageSetPrivateClickMeasurementOverrideTimerForTesting): (WKPageSetPrivateClickMeasurementConversionURLForTesting): (WKPageMarkPrivateClickMeasurementsAsExpiredForTesting): (WKPageDumpAdClickAttribution): Deleted. (WKPageClearAdClickAttribution): Deleted. (WKPageSetAdClickAttributionOverrideTimerForTesting): Deleted. (WKPageSetAdClickAttributionConversionURLForTesting): Deleted. (WKPageMarkAdClickAttributionsAsExpiredForTesting): Deleted. * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreClearPrivateClickMeasurementsThroughWebsiteDataRemoval): (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm: (dataTypesToString): * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h: (WebKit::toWebsiteDataType): (WebKit::toWKWebsiteDataTypes): * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::setDeveloperPreferenceOverride): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcessProxy::setAdClickAttributionDebugMode): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::dumpPrivateClickMeasurement): (WebKit::WebPageProxy::clearPrivateClickMeasurement): (WebKit::WebPageProxy::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::WebPageProxy::setPrivateClickMeasurementConversionURLForTesting): (WebKit::WebPageProxy::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::WebPageProxy::dumpAdClickAttribution): Deleted. (WebKit::WebPageProxy::clearAdClickAttribution): Deleted. (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setPrivateClickMeasurementDebugMode): (WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 2020-11-10 Simon Fraser Make PlatformWheelEventPhase an enum class https://bugs.webkit.org/show_bug.cgi?id=218772 Reviewed by Tim Horton. Change PlatformWheelEventPhase to be an enum class. Changed code that maps between NSEventPhase and PlatformWheelEventPhase to not treat NSEventPhase as a set of bits, since it only ever contains one of the bits. * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: (WebKit::ScrollerPairMac::handleWheelEvent): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-11-10 Chris Dumez GPUProcess does not properly get relaunched after crashing https://bugs.webkit.org/show_bug.cgi?id=218769 Reviewed by Tim Horton. After the GPUProcess crashes, we need to make sure we construct a new GPUProcessProxy so that a new process gets relaunched. Previously, this wasn't possible because the GPUProcessProxy was a "never destroyed" singleton. The GPUProcessProxy is now kept alive by the WebProcessPool objects refing it. Upon crashing, all WebProcessPools clear their GPUProcessProxy RefPtr so that the old GPUProcessProxy gets destroyed. The next time a GPUProcessProxy is needed, a new one gets constructed. We still make sure that all WebProcessPool objects share the same GPUProcessProxy, as before this patch. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _gpuProcessIdentifier]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::getOrCreate): (WebKit::GPUProcessProxy::GPUProcessProxy): (WebKit::GPUProcessProxy::~GPUProcessProxy): (WebKit::GPUProcessProxy::processWillShutDown): (WebKit::GPUProcessProxy::gpuProcessCrashed): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::willStartCapture): (WebKit::WebPageProxy::setOrientationForMediaCapture): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureGPUProcess): (WebKit::WebProcessPool::gpuProcessCrashed): (WebKit::WebProcessPool::getGPUProcessConnection): (WebKit::WebProcessPool::updateAudibleMediaAssertions): * UIProcess/WebProcessPool.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _setupVisibilityPropagationViewForGPUProcess]): 2020-11-10 Brent Fulgham [macOS] Allow IOGLESBundleName for Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218774 Unreviewed follow-up fix to r269649. Two additional keys are needed: MetalPluginClassName and MetalPluginName * WebProcess/com.apple.WebProcess.sb.in: 2020-11-10 Brent Fulgham [macOS] Allow IOGLESBundleName for Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218774 Reviewed by Tim Horton. The WebContent should be able to read the IOGLESBundleName IOKit property on Apple Silicon Macs. This will help the OpenGL stack make better choices about which bundles to load when processing WebGL content. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-10 Said Abou-Hallawa [macCatalyst] Fix various build breaks https://bugs.webkit.org/show_bug.cgi?id=218771 Reviewed by Tim Horton. Use NO_RETURN_DUE_TO_ASSERT for unreachable function. * UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm: (WebKit::UserMediaPermissionRequestProxy::doDefaultAction): * UIProcess/UserMediaPermissionRequestProxy.h: 2020-11-10 Per Arne Vollan [Cocoa] Send GPU sandbox extensions in Web page creation parameters https://bugs.webkit.org/show_bug.cgi?id=218708 Reviewed by Brent Fulgham. To pick up correct runtime settings, the GPU sandbox extensions should be sent to the WebContent process as part of the Web page creation parameters. No new tests, covered by existing tests. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::mediaRelatedMachServices): Deleted. (WebKit::gpuIOKitClasses): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): (WebKit::mediaRelatedMachServices): (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-10 Per Arne Vollan [macCatalyst] Add entitlement for message filtering https://bugs.webkit.org/show_bug.cgi?id=218768 Reviewed by Tim Horton. Add required message filtering entitlement for Catalyst. No new tests, covered by existing tests. * Scripts/process-entitlements.sh: 2020-11-10 Youenn Fablet Update WebRTC liwebrtc to M87 https://bugs.webkit.org/show_bug.cgi?id=218436 Reviewed by Eric Carlson. Update code now that fragmentation headers are computed at packetization time. * Configurations/WebKit.xcconfig: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::createEncoder): * Scripts/webkit/messages.py: * Shared/RTCNetwork.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::completedEncoding): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.messages.in: 2020-11-10 Wenson Hsieh REGRESSION (r269525): Many layout tests crash when run under ASan https://bugs.webkit.org/show_bug.cgi?id=218733 Reviewed by Tim Horton. Construct the item 8 bytes after the handle offset, instead of 1 byte (also, add a FIXME indicating that we some way of achieving this without requiring WebKit2 to be aware of an item handle's memory layout). * GPUProcess/graphics/RemoteRenderingBackend.h: (WebKit::RemoteRenderingBackend::decodeAndCreate): 2020-11-10 Chris Dumez [GPUProcess] Regression(r268632) Garbage is rendered on speakers when using WebAudio https://bugs.webkit.org/show_bug.cgi?id=218729 Reviewed by Eric Carlson. RemoteAudioDestinationProxy::requestBuffer() was calling AudioDestinationCocoa::render() and expecting RemoteAudioDestinationProxy::renderOnRenderingThead() to get called as a result. It would take care of writing to the CARingBuffer and sending the IPC back to the GPU process in renderOnRenderingThead(). The issue was that AudioDestinationCocoa uses a PushPullFIFO internally for buffering. It first fetches available frames from the FIFO and then only calls renderOnRenderingThead() with the number of frames that remain to processed (usually 0). As a result, RemoteAudioDestinationProxy::renderOnRenderingThead() would often store 0 frames instead of 128 (or sometimes a number of frames less than 128), even though the full 128 frames were actually rendered. To address the issue, stop overriding renderOnRenderingThead() in RemoteAudioDestinationProxy. Instead, do the writing to the CARingBuffer and the IPC response in RemoteAudioDestinationProxy::requestBuffer(), directly after calling AudioDestinationCocoa::render(). After calling AudioDestinationCocoa::render() we know that |framesToRender| frames have been rendered / added to the buffer. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::requestBuffer): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-11-10 Carlos Garcia Campos [GTK4] WebView is flipped https://bugs.webkit.org/show_bug.cgi?id=218354 Reviewed by Adrian Perez de Castro. Stop painting y-flipped textures when buildig with GTK4. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h: 2020-11-10 Carlos Garcia Campos [GTK] Crash in WebKit::DropTarget::drop https://bugs.webkit.org/show_bug.cgi?id=217482 Reviewed by Michael Catanzaro. If we don't have selection data when drop is called, just return early to let leave continue. Also change accept() to receive the drop context and position to be set after leaving any previous operation. * UIProcess/API/gtk/DropTarget.h: * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::accept): (WebKit::DropTarget::drop): * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::accept): 2020-11-10 Carlos Garcia Campos [GTK][WPE] WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD returned when plugins are disabled https://bugs.webkit.org/show_bug.cgi?id=216123 Reviewed by Adrian Perez de Castro. Undeprecate webkit_plugin_error_quark and WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD, and update documentation. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewLoadFail): * UIProcess/API/gtk/WebKitError.h: * UIProcess/API/wpe/WebKitError.h: 2020-11-10 Wenson Hsieh Fix crashes when mapping shared display list item data into display lists in the GPU process https://bugs.webkit.org/show_bug.cgi?id=218739 Reviewed by Tim Horton. I added a "stop-gap" mechanism in r269525 to allow the GPU process to handle newly refactored display list items by encoding display list items directly into shared memory buffers in the web process and reading them back in the GPU process, using standard IPC messages only, and also without reusing any shared memory buffers. However, I introduced a bug in this "stop-gap" mechanism when I tried to clean up some GPU-process-side logic for unregistering these shared memory buffers in the GPU process, by taking shared memory buffers out of the map in the GPU process without ensuring that they're kept alive over the course of applying the display list. This code is going away soon anyways (see webkit.org/b/218426), but in the meantime, we should at least ensure that this temporary shared memory mechanism doesn't cause huge waves of layout test failures. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyDisplayList): 2020-11-09 Said Abou-Hallawa [GPU Process] Control the life cycle of the platform image by a new class named NativeImage https://bugs.webkit.org/show_bug.cgi?id=218427 Reviewed by Simon Fraser. * Scripts/webkit/messages.py: * Shared/API/c/cg/WKImageCG.cpp: (WKImageCreateFromCGImage): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): (IPC::encodeNativeImage): Deleted. (IPC::decodeNativeImage): Deleted. (IPC::encodeOptionalNativeImage): Deleted. (IPC::decodeOptionalNativeImage): Deleted. (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * Shared/WebCoreArgumentCoders.h: * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::createImage): * Shared/win/ShareableBitmapDirect2D.cpp: (WebKit::ShareableBitmap::paint): * UIProcess/API/glib/IconDatabase.cpp: (WebKit::IconDatabase::loadIconForPageURL): (WebKit::IconDatabase::setIconForPageURL): * UIProcess/API/glib/IconDatabase.h: * UIProcess/ios/DragDropInteractionState.mm: (WebKit::uiImageForImage): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _deliverDelayedDropPreviewIfPossible:]): (uiImageForImage): (-[WKContentView _handleDropByInsertingImagePlaceholders:session:]): (-[WKContentView _presentationSnapshotForPreviewItemController:]): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::copyNativeImage const): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::isAlmostSolidColor): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon): 2020-11-09 Chris Dumez Unexpose obsolete HTMLAppletElement interface https://bugs.webkit.org/show_bug.cgi?id=218677 Reviewed by Darin Adler. * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp: (webkit_dom_html_applet_element_dispatch_event): (webkit_dom_html_applet_element_add_event_listener): (webkit_dom_html_applet_element_remove_event_listener): (webkit_dom_html_applet_element_get_align): (webkit_dom_html_applet_element_set_align): (webkit_dom_html_applet_element_get_alt): (webkit_dom_html_applet_element_set_alt): (webkit_dom_html_applet_element_get_archive): (webkit_dom_html_applet_element_set_archive): (webkit_dom_html_applet_element_get_code): (webkit_dom_html_applet_element_set_code): (webkit_dom_html_applet_element_get_code_base): (webkit_dom_html_applet_element_set_code_base): (webkit_dom_html_applet_element_get_height): (webkit_dom_html_applet_element_set_height): (webkit_dom_html_applet_element_get_hspace): (webkit_dom_html_applet_element_set_hspace): (webkit_dom_html_applet_element_get_name): (webkit_dom_html_applet_element_set_name): (webkit_dom_html_applet_element_get_object): (webkit_dom_html_applet_element_set_object): (webkit_dom_html_applet_element_get_vspace): (webkit_dom_html_applet_element_set_vspace): (webkit_dom_html_applet_element_get_width): (webkit_dom_html_applet_element_set_width): * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElementPrivate.h: * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPrivate.cpp: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-11-09 Peng Liu REGRESSION (r269557): ASSERTION FAILED: Completion handler should always be called under WebCore::HTMLMediaElement::exitFullscreen https://bugs.webkit.org/show_bug.cgi?id=218722 Reviewed by Eric Carlson. No new tests, covered by an existing test that is crashing on the bots. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): 2020-11-09 Wenson Hsieh Rename ImageBuffer::flushDisplayList to ImageBuffer::submitDisplayList https://bugs.webkit.org/show_bug.cgi?id=218720 Reviewed by Tim Horton. See Source/WebCore/ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyDisplayList): (WebKit::RemoteRenderingBackend::submitDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayList): Deleted. Additionally rename `flushDisplayList` on `RemoteRenderingBackend`, since this IPC message doesn't actually perform a context flush. * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::submitDisplayList): (WebKit::RemoteRenderingBackendProxy::flushDisplayList): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-11-09 Alan Bujtas Unreviewed, reverting r269603. Needs Safari patch Reverted changeset: "Show legacy line layout visual coverage instead of "simple line" layout." https://bugs.webkit.org/show_bug.cgi?id=218695 https://trac.webkit.org/changeset/269603 2020-11-09 Zalan Bujtas Show legacy line layout visual coverage instead of "simple line" layout. https://bugs.webkit.org/show_bug.cgi?id=218695 Reviewed by Antti Koivisto. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetLegacyLineLayoutVisualCoverageEnabled): (WKPreferencesGetLegacyLineLayoutVisualCoverageEnabled): (WKPreferencesSetSimpleLineLayoutDebugBordersEnabled): Deleted. (WKPreferencesGetSimpleLineLayoutDebugBordersEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _legacyLineLayoutVisualCoverageEnabled]): (-[WKPreferences _setLegacyLineLayoutVisualCoverageEnabled:]): (-[WKPreferences _simpleLineLayoutDebugBordersEnabled]): Deleted. (-[WKPreferences _setSimpleLineLayoutDebugBordersEnabled:]): Deleted. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2020-11-09 Per Arne Vollan [macOS] System sounds should be played in the UI process https://bugs.webkit.org/show_bug.cgi?id=218405 Reviewed by Darin Adler. Subclass SystemSoundDelegate, which will forward system sound requests to the UI process. * Sources.txt: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::systemBeep): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebSystemSoundDelegate.cpp: Added. (WebKit::WebSystemSoundDelegate::systemBeep): * WebProcess/WebSystemSoundDelegate.h: Added. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-09 Per Arne Vollan [Cocoa] Diagnostic service sandbox violation loading any webpage https://bugs.webkit.org/show_bug.cgi?id=218710 Reviewed by Alexey Proskuryakov. Loading any Web page will cause a diagnostic service mach-lookup sandbox violation. Consume the extension to the service as early as possible in WebProcess::platformInitializeWebProcess, since there are code paths in this method which will try to access the diagnostic service. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-09 Devin Rousso autofocus of text input should not select text https://bugs.webkit.org/show_bug.cgi?id=218585 Reviewed by Wenson Hsieh. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::restoreSelectionInFocusedEditableElement): Slightly rework `SelectionRestorationMode` to replace `SetDefault` with two new values: - `PlaceCaretAtStart` puts the caret at the start, regardless of any cached selection - `SelectAll` selects all text, regardless of any cached selection (existing behavior) In order to preserve existing behavior, the default `Restore` will have the same effect as `SelectAll` if there is no cached selection (and is renamed to `RestoreOrSelectAll` as such). 2020-11-09 Per Arne Vollan [macOS] Set preference for overridden languages in the WebContent process after entering the sandbox. https://bugs.webkit.org/show_bug.cgi?id=218097 Reviewed by Alexey Proskuryakov. Currently, the preference for overridden languages in the WebContent process is set before entering the sandbox, which leaves behind an open connection to opendirectoryd. This preference should be set after entering the sandbox to avoid this. This patch sets the preference after the initialization function has been executed. API test: WebKit.OverrideAppleLanguagesPreference * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::setAppleLanguagesPreference): (WebKit::XPCServiceEventHandler): (WebKit::XPCServiceMain): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-09 Joonghun Park Unreviewed. Fix the build warning below since r269525. warning: control reaches end of non-void function [-Wreturn-type] No new tests, no new behaviors. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-09 Zan Dobersek [WPE] ScrollGestureController should only handle complete touch interactions https://bugs.webkit.org/show_bug.cgi?id=218329 Reviewed by Carlos Garcia Campos. ScrollGestureController's purpose is to handle otherwise-unhandled touch events and translate those into a scrolling gesture. Until now, it was possible for a touch motion event to trigger that gesture even when the corresponding touch down event was not handled by the ScrollGestureController, e.g. it was not produced due to the touch interaction being started somewhere else, or the Web content actually handled that event. A flag is added to ScrollGestureController to track that an unhandled touch down event was confronted, before allowing subsequent unhandled touch motion events to trigger the scrolling gesture when conditions are met. The flag is reset upon the touch up event. * UIProcess/API/wpe/ScrollGestureController.cpp: (WebKit::ScrollGestureController::handleEvent): * UIProcess/API/wpe/ScrollGestureController.h: 2020-11-08 Lauro Moura [GTK] REGRESSION(r267250) API test /webkit/WebKitWebView/usermedia-enumeratedevices-permission-check is crashing https://bugs.webkit.org/show_bug.cgi?id=216727 Reviewed by Carlos Garcia Campos. Coverered by existing tests. In some cases, like in TestWebKitAPI, a message can arrive to the GeolocationProvider and it would try to access a WebGeolocationManager that could already had been deleted. * UIProcess/API/glib/WebKitGeolocationManager.cpp: (webkitGeolocationManagerDispose): Added. Removes the provider. (webkit_geolocation_manager_class_init): Register dispose callback. 2020-11-07 Wenson Hsieh Clean up some logic in RemoteImageBuffer and RemoteRenderingBackend https://bugs.webkit.org/show_bug.cgi?id=218689 Reviewed by Tim Horton. Move the implementation of `decodeItem` out of `RemoteImageBuffer`, and into `RemoteRenderingBackend`. This allows us to avoid `static_cast`-ing image buffers to their unaccelerated or accelerated versions when setting the display list's item buffer client in the GPU process. No change in behavior. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::decodeAndCreate): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::applyDisplayList): Also, remove a couple of unnecessary `WebCore::` namespace prefixes while we're here. (WebKit::RemoteRenderingBackend::decodeItem): Move `decodeItem` into the rendering backend. This also has the added bonus of letting us put the method definition in the implementation file instead of a header (i.e. `RemoteRenderingBackend.cpp`). * GPUProcess/graphics/RemoteRenderingBackend.h: (WebKit::RemoteRenderingBackend::decodeAndCreate): 2020-11-06 Peng Liu PiP return to element full screen is not smooth on some websites https://bugs.webkit.org/show_bug.cgi?id=218419 Reviewed by Jer Noble. In r265562, VideoFullscreenInterfaceAVKit uses `fullscreenMayReturnToInline()` to request the observer (WKFullScreenWindowController) to enter element fullscreen before exiting picture-in-picture, and calls `fullscreenWillReturnToInline()` to proceed returning to inline or element fullscreen after WKFullScreenWindowController is ready. In this patch, VideoFullscreenInterfaceAVKit will directly enter a temporary video fullscreen from picture-in-picture, so the preparation step (entering element fullscreen) is not needed. Some important points regarding edge cases: 1) A video enters picture-in-picture and exits picture-in-picture immediately before WKFullScreenWindowController is notified to exit element fullscreen. In this case, WKFullScreenWindowController will do nothing when it is notified that the video has exited picture-in-picture. It will directly tell VideoFullscreenInterfaceAVKit to enter standby. 2) A video exits picture-in-picture when WKFullScreenWindowController is exiting element fullscreen but not complete yet. In this case, WKFullScreenWindowController needs to hold the enter element fullscreen request and exits element fullscreen first before entering element fullscreen. 3) The ancestor element of the video element exits fullscreen and asks the video element to exit standby (in web process) while the video is entering picture-in-picture (in UI process). In this case, VideoFullscreenInterfaceAVKit (in UI process) should ignore the request to exit standby and tell the web process the request is rejected. 4) A user may try to enter picture-in-picture when the video is exiting picture-in-picture and returning to element fullscreen. In this case, VideoFullscreenInterfaceAVKit (in UI process) should temporarily disable the picture-in-picture support. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: Remove the message `EnterFullscreen` for the iOS port because the UI process can enter fullscreen/picture-in-picture directly. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): We need to call `m_page->fullscreenMayReturnToInline()` in this function after removing `fullscreenWillReturnToInline()`. (WebKit::VideoFullscreenManagerProxy::didSetupFullscreen): For the iOS port, we should enter fullscreen directly. (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::fullscreenMayReturnToInline): (WebKit::VideoFullscreenModelContext::fullscreenWillReturnToInline): Deleted. (WebKit::VideoFullscreenManagerProxy::fullscreenWillReturnToInline): Deleted. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController requestEnterFullScreen]): (-[WKFullScreenWindowController exitFullScreen]): (-[WKFullScreenWindowController _completedExitFullScreen]): (-[WKFullScreenWindowController didEnterPictureInPicture]): (-[WKFullScreenWindowController didExitPictureInPicture]): (-[WKFullScreenWindowController _exitFullscreenImmediately]): We should force to exit fullscreen because the current exiting fullscreen process might be stuck. (-[WKFullScreenWindowController prepareToExitPictureInPicture]): Deleted. * UIProcess/mac/WKFullScreenWindowController.mm: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::exitVideoFullscreenForVideoElement): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/cocoa/VideoFullscreenManager.h: (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): The request to exit fullscreen (standby) may be rejected. (WebKit::VideoFullscreenManager::didSetupFullscreen): Only the macOS port needs to implement this function. (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didExitFullscreen): (WebKit::VideoFullscreenManager::fullscreenMayReturnToInline): (WebKit::VideoFullscreenManager::fullscreenWillReturnToInline): Deleted. 2020-11-06 Jiewen Tan [WebAuthn] [iOS] WebAuthn process doesn't start on iOS devices https://bugs.webkit.org/show_bug.cgi?id=218479 Reviewed by Brent Fulgham. One of the reasons is missing the iOS sandbox profile. Therefore, this patch adds one. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: Added. Copied from the GPU process. Will strip it down once the process is fully functional. * Scripts/process-entitlements.sh: Adds some missing entitlements. * UIProcess/WebAuthentication/WebAuthnProcessProxy.h: Deals with CompletionHandler assertion. * WebKit.xcodeproj/project.pbxproj: Adds some plumbings for the sandbox profile. 2020-11-06 Wenson Hsieh Add new display list item types in preparation for webkit.org/b/218426 https://bugs.webkit.org/show_bug.cgi?id=218588 Reviewed by Simon Fraser. Simply treat these new items as no-ops for the time being. See Source/WebCore/ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-06 Per Arne Vollan [macOS] Add IOKIt message filtering https://bugs.webkit.org/show_bug.cgi?id=218657 Reviewed by Brent Fulgham. Like on iOS, the WebContent process on macOS should have IOKit message filtering. This patch also allows reading of some IOKIt properties, which was reported when running layout tests. No new tests, covered by existing tests. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-06 Wenson Hsieh Add a display list item to represent stroking a single line https://bugs.webkit.org/show_bug.cgi?id=218589 Reviewed by Tim Horton. * GPUProcess/graphics/RemoteImageBuffer.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-06 Sam Weinig Further progress towards merging Settings.yaml into WebPreferences.yaml https://bugs.webkit.org/show_bug.cgi?id=218663 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): Replace call to WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport() which always returned the empty string with a literal empty string. This was the only caller so the function is really no needed. 2020-11-06 Aditya Keerthi [macOS] Align left edge of presented calendar with left edge of date inputs https://bugs.webkit.org/show_bug.cgi?id=218668 Reviewed by Tim Horton. When a date input is activated, a calendar is presented by adding an NSWindow containing an NSDatePicker to the screen. The frame of the window is set to ensure proper alignment with the date input. However, since the window's hasShadow is set to true, AppKit draws a thin border and shadow around the window's contentView. This results in left border of the window being drawn further out than the left border of the input itself. If the hasShadow property is set to false, the issue is no longer observed, and the calendar aligns with the input. However, this is not an acceptable solution, since we lose the border and the shadow. To ensure alignment between the border of the calendar view and the border of the date input, we can inset the edges of the view. Note that the inset is not applied along the y-axis, to avoid a gap between the bottom of the date input and the top of the calendar view. * UIProcess/mac/WebDateTimePickerMac.mm: (-[WKDateTimePickerBackdropView drawRect:]): 2020-11-06 Alex Christensen Fix build with different unified source arrangement. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 2020-11-06 Wenson Hsieh Move DisplayListFlushIdentifier into WebCore as DisplayList::FlushIdentifier https://bugs.webkit.org/show_bug.cgi?id=218586 Reviewed by Simon Fraser. In preparation for adding a display list item to represent flushing the graphics context, move WebKit's `DisplayListFlushIdentifier` to the `DisplayList` namespace in WebCore, and rename it to `DisplayList::FlushIdentifier`. No change in behavior. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::flushDisplayListWasCommitted): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/DisplayListFlushIdentifier.h: Removed. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::commitFlushDisplayList): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: 2020-11-06 Alex Christensen Fix build after adding files to UIProcess/API/Cocoa https://bugs.webkit.org/show_bug.cgi?id=218664 There is some code that assumes that unified sources always combine sources into the same translation units. inspectorWebView is used from _WKInspectorTesting.mm, but only defined in _WKInspector.mm so it should be added to a header. _WKUserContentWorld also doesn't include WKObject.h or RetainPtr.h but uses both. * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector inspectorWebView]): Deleted. * UIProcess/API/Cocoa/_WKInspectorPrivateForTesting.h: * UIProcess/API/Cocoa/_WKInspectorTesting.mm: (-[_WKInspector inspectorWebView]): * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h: 2020-11-06 Wenson Hsieh Encoding PutImageData should not serialize separate IPC attachments for the image data https://bugs.webkit.org/show_bug.cgi?id=218649 Reviewed by Simon Fraser. The argument coder for `WebCore::ImageData` currently sends its image data by allocating a separate shared memory buffer and sending it over to the GPU process via a separate `IPC::Attachment`. This isn't compatible with the new "concurrent display list" model for processing display list items, wherein all out-of-line items are encoded as raw bytes directly into reusable shared memory buffers and decoded from the corresponding buffer in the GPU process. Instead, encode and decode image data directly into and out of the main IPC data buffer. This also addresses a couple of existing FIXMEs in the ImageData coder methods by avoiding the need for redundant copies to and from temporary `WebCore::SharedBuffer`s. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): 2020-11-06 Wenson Hsieh [Concurrent display lists] Encode display list items directly into shared memory https://bugs.webkit.org/show_bug.cgi?id=218406 Reviewed by Tim Horton. Adjust for changes to display lists and display list items in WebCore (see Source/WebCore/ChangeLog for more information). In particular, we implement the reading and writing client hooks consulted by ItemBuffer, and we also add a temporary mechanism that allows RemoteRenderingBackendProxy (in the web process) to send display list item data through shared memory to the RemoteRenderingBackend (in the GPU process). This temporary mechanism does not attempt to make any reading or writing in shared memory concurrent between the GPU and web processes, and exists only to make sure that rendering with the GPU process still works using these new display list items. In the next patch, I will add a simple concurrent reader/writer model for display list processing between the web and GPU processes, and (in doing so) revert most of the changes in `RemoteRenderingBackend` and `RemoteRenderingBackendProxy` below. See comments below for more detail. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::decodeAndCreate): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyResourceItem): (WebKit::RemoteRenderingBackend::applyMediaItem): Refactor these to take `WebCore::DisplayList::ItemHandle`. (WebKit::RemoteRenderingBackend::applyDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackend::didCreateSharedItemData): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: * Shared/SharedDisplayListHandle.cpp: Added. (WebKit::SharedDisplayListHandle::SharedDisplayListHandle): (WebKit::SharedDisplayListHandle::createDisplayList const): * Shared/SharedDisplayListHandle.h: Added. Add a WebKit2 helper class that represents display list data in shared memory that is propagated from the web process to the GPU process. In the next patch, this class will be rewritten to support concurrent display list reading and writing, with specialized subclasses in service of both the reader (i.e. the GPU process) and the writer (i.e. the web process). (WebKit::SharedDisplayListHandle::SharedDisplayListHandle): (WebKit::SharedDisplayListHandle::encode const): (WebKit::SharedDisplayListHandle::decode): * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::flushDisplayList): (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackendProxy::createItemBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: 2020-11-06 Truitt Savell Unreviewed, reverting r269486. Caused 50+ timeouts on Mac Debug WK2 Reverted changeset: "[Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing" https://bugs.webkit.org/show_bug.cgi?id=217783 https://trac.webkit.org/changeset/269486 2020-11-06 Wenson Hsieh Add some missing header includes in WebAuthenticatorCoordinator.cpp https://bugs.webkit.org/show_bug.cgi?id=218661 Reviewed by Simon Fraser. Add the missing headers. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: 2020-11-06 Brent Fulgham [macOS] Allow IOAVDHEVCDecodeCapabilities on Intel https://bugs.webkit.org/show_bug.cgi?id=218639 Reviewed by Eric Carlson. The current rule for IOAVDHEVCDecodeCapabilities is incorrect for macOS 11. We should allow this access on Intel, too. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-06 Milan Crha [GTK] Application cannot override drag&drop callbacks https://bugs.webkit.org/show_bug.cgi?id=218562 Reviewed by Michael Catanzaro. * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::DropTarget): Use g_signal_connect_after(), thus any descendants can override the callbacks. (WebKit::DropTarget::didPerformAction): Always call gdk_drag_status(), to have gtk+ notified about drag progress. 2020-11-06 Michael Catanzaro [GTK] dlopen libWPEBackend-fdo-1.0.so.1 instead of libWPEBackend-fdo-1.0.so https://bugs.webkit.org/show_bug.cgi?id=218584 Reviewed by Carlos Garcia Campos. wpe_loader_init() tries to dlopen a development symlink, but these will not usually be installed. It only works in the GNOME flatpak runtime because we don't use devel split rules in the GNOME runtime, but we really ought to, and freedesktop-sdk already does, so it's going to break upstream too once that gets implemented. It's easier for everyone if we tackle this now. Since all major distros except Arch Linux use devel split, this patch is really required for almost every distro to use WPE renderer. The downside is that this makes it harder to update the wpebackend-fdo library version, since minor changes there will now unnecessarily break WebKit. This is not good, but it's better than forcing distros to apply this same patch downstream. I considered trying a bunch of different library versions in a loop in order to maximize the chance of success in case the wpebackend-fdo library version increases in the future, but it's probably nicer to just be careful about not changing its library version until we find a better solution for this. * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-11-05 Said Abou-Hallawa [GPU Process] Use the Ref counting of ImageBuffer to control its life cycle in Web Process and GPU Process https://bugs.webkit.org/show_bug.cgi?id=218529 Reviewed by Simon Fraser. When a DrawImageBuffer item is appended to DisplayList, a Ref will be cached till the DisplayList items list is cleared. So no need to lock the remote resource in RemoteResourceCacheProxy. All we need to is to pass the ImageBufferHashMap which is maintained by the DisplayList or by RemoteResourceCache to the DisplayList::Replayer. It is going to be used to resolve the RenderingResourceIdentifer to an ImageBuffer so the DrawImageBuffer can be applied. No need to special-case DrawImageBuffer::apply() in the RemoteImageBuffer. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::applyResourceItem): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.h: (WebKit::RemoteRenderingBackend::remoteResourceCache): * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheImageBuffer): * GPUProcess/graphics/RemoteResourceCache.h: (WebKit::RemoteResourceCache::imageBuffers const): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::releaseImageBuffer): (WebKit::RemoteResourceCacheProxy::RemoteResourceCacheProxy): Deleted. (WebKit::RemoteResourceCacheProxy::lockRemoteImageBufferForRemoteClient): Deleted. (WebKit::RemoteResourceCacheProxy::lockRemoteResourceForRemoteClient): Deleted. (WebKit::RemoteResourceCacheProxy::releaseRemoteResource): Deleted. (WebKit::RemoteResourceCacheProxy::unlockRemoteResourcesForRemoteClient): Deleted. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2020-11-05 Brent Fulgham [macOS] Remove mdnsresponder access from WebKit processes https://bugs.webkit.org/show_bug.cgi?id=218633 Unreviewed follow-up: Make the sandbox rule conditional on recent macOS to avoid breaking STP use on older macOS releases. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-05 Alex Christensen Add null checks effectively in UserInputBridge https://bugs.webkit.org/show_bug.cgi?id=218622 Reviewed by Wenson Hsieh. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::stopLoadingFrame): (WebKit::WebPage::stopLoading): (WebKit::WebPage::reload): 2020-11-05 Brent Fulgham [macOS] Remove mdnsresponder access from WebKit processes https://bugs.webkit.org/show_bug.cgi?id=218633 Reviewed by Per Arne Vollan. Now that all network loading (including media) happens in the Network process, we can remove an old permission to open outbound connections to mdnsresponder. This is also unneeded in the GPU process, for the same reason. I noticed that the new WebAuthn process sandbox mistakenly included this, and removed it there, too. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-05 John Wilander PCM: Switch to JSON report format https://bugs.webkit.org/show_bug.cgi?id=218634 Reviewed by Brent Fulgham. The standards conversation has landed in attribution reports in a JSON format as opposed to the currently implemented URL format. Discussion here: https://github.com/privacycg/private-click-measurement/issues/30 * NetworkProcess/AdClickAttributionManager.cpp: (WebKit::AdClickAttributionManager::fireConversionRequest): 2020-11-05 Brian Burg [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing https://bugs.webkit.org/show_bug.cgi?id=217783 Reviewed by Devin Rousso. _WKInspectorExtension is new SPI that represents a Web Extension that uses the 'devtools' API to interact with Web Inspector. An extension is associated with its _WKInspectorExtensionHost. A WebKit client that supports Web Extensions can use this class to implement 'devtools' extension APIs. Add _WKInspectorExtensionHost methods to register and unregister an extension. Add plumbing so that the extension in registered in the frontend with WI.InspectorExtensionController. Later patches will flesh out the needed functionality to implement rest of the 'devtools' API. * Sources.txt: * SourcesCocoa.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * WebKit.xcodeproj/project.pbxproj: Add new files. * Scripts/webkit/messages.py: If a message includes InspectorExtensionError, then generate an include for InspectorExtensionTypes.h where it is declared. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): New API object type. * Shared/InspectorExtensionTypes.h: Added error code enum and useful type aliases. * Shared/InspectorExtensionTypes.cpp: (WebKit::inspectorExtensionErrorToString): * UIProcess/API/APIInspectorExtension.h: * UIProcess/API/APIInspectorExtension.cpp: (API::InspectorExtension::create): (API::InspectorExtension::InspectorExtension): (API::InspectorExtension::~InspectorExtension): Added. This is a placeholder object that's used for the wrapper system, since we don't have single C++ objects for each extension to back the API object. * UIProcess/API/Cocoa/_WKInspector.h: * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): (-[_WKInspector unregisterExtension:completionHandler:]): Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. * UIProcess/API/Cocoa/_WKInspectorExtension.h: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: (-[_WKInspectorExtension initWithIdentifier:]): (-[_WKInspectorExtension dealloc]): (-[_WKInspectorExtension _apiObject]): (-[_WKInspectorExtension extensionID]): Added. This is a data object that's also used as a token to unregister the extension. * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: Add new SPI. * UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): (-[_WKRemoteWebInspectorViewController unregisterExtension:completionHandler:]): Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. * UIProcess/Inspector/RemoteWebInspectorProxy.h: * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: Add FrontendLoaded. (WebKit::RemoteWebInspectorProxy::extensionController const): Added. * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::frontendLoaded): (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow): Set up the extension controller object after the frontend has been created. Hook up the FrontendLoaded event sent from Inspector web process so that the extension controller can be notified of when it's safe to message the frontend. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::createFrontendPage): (WebKit::WebInspectorProxy::closeFrontendPageAndWindow): (WebKit::WebInspectorProxy::frontendLoaded): Set up the extension controller object after the frontend has been created. * UIProcess/Inspector/WebInspectorProxy.h: (WebKit::WebInspectorProxy::extensionController const): Added. * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: Added. (WebKit::WebInspectorUIExtensionControllerProxy::WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::~WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::whenFrontendHasLoaded): (WebKit::WebInspectorUIExtensionControllerProxy::inspectorFrontendLoaded): (WebKit::WebInspectorUIExtensionControllerProxy::registerExtension): (WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension): Added. Forward API requests to the Web Inspector's web process to be evaluated in the frontend. * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: (WebKit::WebInspectorFrontendAPIDispatcher::dispatchCommand): Add a more generic way to encode values to be passed as arguments to InspectorFrontendAPI.dispatch. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::establishConnection): (WebKit::WebInspectorUI::closeWindow): * WebProcess/Inspector/WebInspectorUI.h: (WebKit::WebInspectorUI::frontendPage const): Added. (WebKit::WebInspectorUI::frontendAPIDispatcher): Added. * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: Added. * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: Added. (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromResult): Handle incoming messages by forwarding the associated command to WI.WebExtensionController via InspectorFrontendAPI evaluations. * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: Fallout from unified build chunking shifts. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::getExistingCredentials): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): Fallout from unified build chunking shifts, but more. 2020-11-05 Per Arne Vollan [macOS] Update message filters in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=218520 Reviewed by Brent Fulgham. Based on telemetry, update the message filters with allowed messages in the WebContent sandbox. No new tests, covered by existing tests. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-05 Ryan Haddad Unreviewed, fix the build with recent SDKs. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::platformInvalidate): 2020-11-05 Don Olmstead Non-unified build fixes, early November 2020 edition https://bugs.webkit.org/show_bug.cgi?id=218628 Unreviewed non-unified build fix. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::removePendingRequest): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: 2020-11-05 Ryan Haddad Unreviewed, fix the build with recent SDKs. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::kill): 2020-11-05 Brent Fulgham [iOS] Remove redundant rule using never-granted extension https://bugs.webkit.org/show_bug.cgi?id=218596 Reviewed by Per Arne Vollan. WebKit has long had a sandbox rule granting the ability to issue iokit-open operations if a particular security extension was granted to the process. The WebKit processes are known to never grant this extension, so this rule is not needed. We should remove the rule to reduce sandbox complexity and increase the speed of sandbox compilation. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-11-05 Brent Fulgham [iOS] Remove redundant rule for shared-preference.read-write https://bugs.webkit.org/show_bug.cgi?id=218594 Reviewed by Per Arne Vollan. We have long had a rule to allow shared preferences to be read and written if a particular sandbox extension was granted to the process. However, we do not issue this extension to any WebKit process, so the rule is unnecessary. We should remove it to reduce confusion, and make the sandbox smaller (and quicker to compile). * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-11-03 Darin Adler Remove more functions that implicitly use composed tree https://bugs.webkit.org/show_bug.cgi?id=218544 Reviewed by Ryosuke Niwa. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::constrainRangeToSelection): Factored this function out of the requestDocumentEditingContext and also rewrote it to use higher level operations. (WebKit::WebPage::requestDocumentEditingContext): Refactored to use the new constrainRangeToSelection. 2020-11-05 Alex Christensen Store WeakPtr instead of Frame* https://bugs.webkit.org/show_bug.cgi?id=218599 Reviewed by Youenn Fablet. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::initWithCoreMainFrame): (WebKit::WebFrame::createSubframe): (WebKit::WebFrame::coreFrame const): (WebKit::WebFrame::info const): (WebKit::WebFrame::handlesPageScaleGesture const): (WebKit::WebFrame::requiresUnifiedScaleFactor const): * WebProcess/WebPage/WebFrame.h: (WebKit::WebFrame::coreFrame const): Deleted. 2020-11-05 Alex Christensen Use fewer raw pointers and more const correctness in Frame.h https://bugs.webkit.org/show_bug.cgi?id=218598 Reviewed by Youenn Fablet. * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: (WebKit::toWebFrameLoaderClient): 2020-11-05 Carlos Garcia Campos WebDriver: handle surrogate pairs in keyboard actions https://bugs.webkit.org/show_bug.cgi?id=218279 Reviewed by Brian Burg. And fail with invalid argument if the string can be represented as a single code point. Fixes: imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f604] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f60d] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[fa] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u0ba8\u0bbfb] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u0ba8\u0bbf\u0ba8] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u1100\u1161\u11a8c] * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::pressedCharKey): (WebKit::WebAutomationSession::performInteractionSequence): 2020-11-05 Jiewen Tan [WebAuthn] Determine an AAGUID for the platform authenticators https://bugs.webkit.org/show_bug.cgi?id=217945 Reviewed by Brent Fulgham. Relying parties use the AAGUID to recognize supported authenticators. Using a NULL AAGUID blocks them from recognizing Apple products as valid WebAuthentication targets. We need to assign ourselves a GUID representing Apple authenticators, then publish with our attestation certificate and with the FIDO Alliance. Covered by existing tests. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::aaguidVector): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): 2020-11-05 Carlos Garcia Campos WebDriver: session can have more than one active input source of the same type https://bugs.webkit.org/show_bug.cgi?id=218382 Reviewed by Brian Burg. We are failing in that case, and the dispatcher assumes it's not possible, but the spec doesn't say there's such limitation and there's a WPT infrastructure test checking that (infrastructure/testdriver/actions/eventOrder.html). * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputKeyFrame::keyFrameFromStateOfInputSources): Input sources are now stored in a HashMap. (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): Ditto. (WebKit::SimulatedInputDispatcher::run): We don't need to copy the given input sources, since they are owned by the session. (WebKit::SimulatedInputDispatcher::finishDispatching): Ditto. * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::WebAutomationSession): Do not create initial input sources for each type. (WebKit::WebAutomationSession::performInteractionSequence): Check there aren't multiple input sources with the same ID, but don't fail if there are multiple input sources with the same type. (WebKit::WebAutomationSession::cancelInteractionSequence): Clear the active input sources. (WebKit::WebAutomationSession::inputSourceForType): Removed. * UIProcess/Automation/WebAutomationSession.h: 2020-11-04 Said Abou-Hallawa [GPU Process] Move the internal GPU rendering flags from WebPage to WebProcess https://bugs.webkit.org/show_bug.cgi?id=218549 Reviewed by Tim Horton. Move UseGPUProcessForCanvasRendering from WebPage to WebProcess. Add a new setting for UseGPUProcessForDOMRendering to WebProcess. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Encode/decode the flags from the UI Process to the Web Process. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): Read the flags in from the preferences. * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::setUseGPUProcess): (WebKit::RemoteMediaPlayerManager::updatePreferences): Deleted. * WebProcess/GPU/media/RemoteMediaPlayerManager.h: These flags belong to WebKit so they should not be accessed through the Settings. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): (WebKit::WebPage::shouldUseRemoteRenderingFor): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setUseGPUProcessForCanvasRendering): (WebKit::WebProcess::setUseGPUProcessForDOMRendering): (WebKit::WebProcess::shouldUseRemoteRenderingFor): * WebProcess/WebProcess.h: The rendering and media flags can now be accessed from the WebPorcess. 2020-11-04 Aditya Keerthi [Contact Picker API] Add support for picker UI on iOS https://bugs.webkit.org/show_bug.cgi?id=218189 Reviewed by Devin Rousso. ContactsManager.select() should present a contact picker on platforms which support one. This patch enables the end-to-end functionality on iOS, presenting a contact picker upon a call to the API and returning the selected contacts upon dismissal. Tests: contact-picker/contacts-select-after-dismissing-picker.html contact-picker/contacts-select-while-presenting-picker.html contact-picker/contacts-select.html * Platform/spi/Cocoa/ContactsUISPI.h: Added. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _didPresentContactPicker]): (-[WKWebView _didDismissContactPicker]): (-[WKWebView _dismissContactPickerWithContacts:]): * UIProcess/Cocoa/WKContactPicker.h: Added. * UIProcess/Cocoa/WKContactPicker.mm: Added. WKContactPicker is a WebKit wrapper around CNContactPickerViewController. (-[WKCNContactPickerDelegate initWithContactPickerDelegate:]): WKCNContactPickerDelegate is wrapper around CNContactPickerDelegate. This is necessary as single/multiple selection in a CNContactPickerViewController is determined by which delegate methods are implemented. The two specializations of this class include the methods necessary to present a single-select and multi-select picker respectively. (-[WKCNContactPickerDelegate contactPickerDidCancel:]): (-[WKCNContactPickerSingleSelectDelegate contactPicker:didSelectContact:]): (-[WKCNContactPickerMultiSelectDelegate contactPicker:didSelectContacts:]): (-[WKContactPicker delegate]): (-[WKContactPicker setDelegate:]): (-[WKContactPicker initWithView:]): (-[WKContactPicker presentWithRequestData:completionHandler:]): (-[WKContactPicker contactPickerDidCancel:]): This delegate method is called when the picker is dismissed by tapping the done button or when the picker is dismissed by swiping down. (-[WKContactPicker contactPicker:didSelectContact:]): (-[WKContactPicker contactPicker:didSelectContacts:]): (-[WKContactPicker _contactPickerDidDismissWithContactInfo:]): (-[WKContactPicker _contactInfoFromCNContact:]): (-[WKContactPicker dismissWithContacts:]): (-[WKContactPicker _contactsFromJSContacts:]): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showContactPicker): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showContactPicker:completionHandler:]): (-[WKContentView contactPickerDidPresent:]): (-[WKContentView contactPickerDidDismiss:]): (-[WKContentView _dismissContactPickerWithContacts:]): * WebKit.xcodeproj/project.pbxproj: 2020-11-04 Chris Dumez Unreviewed, fix build with very recent SDK by silencing a deprecation warning. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::ConnectionTerminationWatchdog::watchdogTimerFired): 2020-11-04 Chris Dumez REGRESSION(r268161?): [ macOS ] imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/processing-after-resume.https.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=217542 Reviewed by Youenn Fablet. When the script calls suspend(), we call AudioDestinationCocoa::stop() to stop rendering and then resolve the suspend promise. At this point, the script saves the AudioContext's current sample frame and expects this value to not change until the AudioContext is resumed. The issue was that we previously were potentially resolving the promise on the main thread while the last rendering quantum was still being processed on the AudioWorklet thread. This meant that the sample frame could still increase a bit, a short while after the suspend promise has been resolved. To address the issue, we now to a round trip to the AudioWorklet thread after stopping rendering, to make sure we only resolve the promise after the last rendering quantum has been processed on the AudioWorklet thread. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::stop): 2020-11-04 Said Abou-Hallawa [GPU Process] Enable Document based ImageBitmap and OffscreenCanvas drawing to use GPU Process rendering https://bugs.webkit.org/show_bug.cgi?id=217735 Reviewed by Simon Fraser. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: putImageData() might be called immediately after creating the ImageBuffer and before receiving the RemoteRenderingBackend.CreateImageBufferBackend message. We need to handle for this case and avoid asserting. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): If the size of the ImageBuffer is very big, no remote ImageBuffer can be created. So we have to be bail out quietly in this case. 2020-11-04 David Kilzer WebKit should remove unused debug variant support Reviewed by Darin Adler. Remove support for building the debug variant since it is currently unused. We now set default values for the DEAD_CODE_STRIPPING, DEBUG_DEFINES, GCC_OPTIMIZATION_LEVEL and STRIP_INSTALLED_PRODUCT variables. Also move these values out of the Xcode project into Base.xcconfig files using the [config=Debug] specifier so that these overrides are next to the definitions. Additional changes in behavior are noted below. * Configurations/Base.xcconfig: * WebKit.xcodeproj/project.pbxproj: - STRIP_INSTALLED_PRODUCT is now set to NO for Debug builds. Previously symbols were always stripped in Debug builds. 2020-11-04 Wenson Hsieh Add some missing header includes in media sources https://bugs.webkit.org/show_bug.cgi?id=218568 Reviewed by Eric Carlson. * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp: Include `WebCoreArgumentCoders.h`, since we need to know how to encode a `MediaPlaybackTargetContext`. * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: Add a missing `WebCore::` namespace. 2020-11-04 Luming Yin [watchOS] Don't allow managed preference to enable legacy sync XHRs on watchOS https://bugs.webkit.org/show_bug.cgi?id=218548 Reviewed by Geoffrey Garen. The managed preference to allow legacy sync XHRs during page dismissal is not applicable to watchOS, but we still attempt to dlopen ManagedConfiguration to get the managed configuration value. This redundant check blocks the main thread and leads to hangs. We now compile out this code for the watchOS platforms. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/ios/WebPreferencesDefaultValuesIOS.mm: 2020-11-04 Dean Jackson WKContentView might get KVO notifications it doesn't expect https://bugs.webkit.org/show_bug.cgi?id=218558 Reviewed by Tim Horton. It's possible that code elsewhere in the system adds KVO observation to the CALayer of a WKContentView, which is a problem because our implementation of observeValue only expects calls that it registered for. Fix this by passing a context to the registration and passing the observation call onto the superclass if it isn't the expected context. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView observeValueForKeyPath:ofObject:change:context:]): 2020-11-04 Youenn Fablet Make functional WebRTC encoders in GPUProcess https://bugs.webkit.org/show_bug.cgi?id=218498 Reviewed by Eric Carlson. Update code according libwebrtc changes. Add missing support for timestamp. Also, in case of samples that are non IO Surface and not BGRA, do a conversion to BGRA and then create an IO surface from it. This allows supporting sending black frames generated in case of muted tracks. Create a remote factory in LibWebRTCProvider based on whether using gpu process or not. * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::encodeFrame): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::createVideoDecoder): (WebKit::encodeVideoFrame): (WebKit::toWebRTCCodecType): (WebKit::LibWebRTCCodecs::createEncoder): (WebKit::LibWebRTCCodecs::encodeFrame): (WebKit::LibWebRTCCodecs::completedEncoding): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.mm: Added. (WebKit::LibWebRTCCodecs::convertToBGRA): * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: (WebKit::LibWebRTCProvider::createEncoderFactory): * WebProcess/Network/webrtc/LibWebRTCProvider.h: 2020-11-03 Sihui Liu Set up basic infrastructure for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=218216 Reviewed by Youenn Fablet. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Scripts/webkit/messages.py: * Sources.txt: * UIProcess/SpeechRecognitionServer.cpp: Added. (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::processNextPendingRequestIfNeeded): (WebKit::SpeechRecognitionServer::stop): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::removePendingRequest): (WebKit::SpeechRecognitionServer::invalidate): (WebKit::SpeechRecognitionServer::startPocessingRequest): (WebKit::SpeechRecognitionServer::stopProcessingRequest): (WebKit::SpeechRecognitionServer::messageSenderConnection const): (WebKit::SpeechRecognitionServer::messageSenderDestinationID const): * UIProcess/SpeechRecognitionServer.h: Added. * UIProcess/SpeechRecognitionServer.messages.in: Added. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): (WebKit::WebProcessProxy::destroySpeechRecognitionServer): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: Added. (WebKit::WebSpeechRecognitionConnection::create): (WebKit::WebSpeechRecognitionConnection::WebSpeechRecognitionConnection): (WebKit::WebSpeechRecognitionConnection::~WebSpeechRecognitionConnection): (WebKit::WebSpeechRecognitionConnection::registerClient): (WebKit::WebSpeechRecognitionConnection::start): (WebKit::WebSpeechRecognitionConnection::stop): (WebKit::WebSpeechRecognitionConnection::abort): (WebKit::WebSpeechRecognitionConnection::invalidate): (WebKit::WebSpeechRecognitionConnection::didReceiveUpdate): (WebKit::WebSpeechRecognitionConnection::messageSenderConnection const): (WebKit::WebSpeechRecognitionConnection::messageSenderDestinationID const): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: Added. * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.messages.in: Added. * WebProcess/WebCoreSupport/WebSpeechRecognitionProvider.h: Added. * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::encodeArgument): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2020-11-03 Brent Fulgham [macOS] remove sysctl.oidfmt. access https://bugs.webkit.org/show_bug.cgi?id=218524 Reviewed by Per Arne Vollan. Access to "sysctl.oidfmt." was needed due to a bug . Since that issue has been fixed, we can remove the access. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-03 Rini Patel [GPU Process] Flush canvas displayList from doAfterUpdateRendering https://bugs.webkit.org/show_bug.cgi?id=218401 Reviewed by Simon Fraser. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::flushDrawingContextAndCommit): Deleted. 2020-11-03 Wenson Hsieh Replace DisplayList::Recorder::Delegate::(will|did)AppendItem with (will|did)AppendItemOfType https://bugs.webkit.org/show_bug.cgi?id=218518 Reviewed by Simon Fraser. See WebCore ChangeLog for more information. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-03 Wenson Hsieh Add helper methods to encode and decode IPC arguments as raw data https://bugs.webkit.org/show_bug.cgi?id=218516 Reviewed by Geoff Garen. Add new helper methods to `IPC::Encoder` and `IPC::Decoder` that can be used to convert anything that can be sent as an IPC argument into raw bytes (i.e. using `WebCore::SharedBuffer`), as long as there are no IPC attachments in the encoded data. For more details, see . * Platform/IPC/Decoder.cpp: (IPC::Decoder::Decoder): Add private versions of the Encoder and Decoder constructors that avoid IPC header data. These constructors are called only from within `encodeSingleObject` and `decodeSingleObject`, respectively. (IPC::m_bufferDeallocator): * Platform/IPC/Decoder.h: (IPC::Decoder::decodeSingleObject): * Platform/IPC/Encoder.cpp: (IPC::Encoder::Encoder): (IPC::Encoder::releaseAttachments): (IPC::Encoder::hasAttachments const): * Platform/IPC/Encoder.h: 2020-11-03 Stephan Szabo [WinCairo/PlayStation] ICU 68.1 no longer exposes FALSE and TRUE macros by default https://bugs.webkit.org/show_bug.cgi?id=218522 Reviewed by Don Olmstead. * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: Replace FALSE with false 2020-11-03 Said Abou-Hallawa [GPU Process] Make ImageBuffer RefCounted https://bugs.webkit.org/show_bug.cgi?id=218472 Reviewed by Simon Fraser. Currently after a remote ImageBuffer is deleted, its identifier is locked in the RemoteResourceCacheProxy till no remote client is referencing it. Then an IPC message is sent to GPU Process to release it. The plan is to decode the DisplayList::DrawImageBuffer by replacing the ImageBuffer identifier with a RefPtr to the ImageBuffer itself. Once the ImageBuffer is removed from the RemoteResourceCache, it is going to be deleted after the last DrawImageBuffer is replayed back. So no locking is needed to guarantee the existence of the ImageBuffer when it is drawn. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::flushDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackend::getImageData): * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheImageBuffer): * GPUProcess/graphics/RemoteResourceCache.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createSelectionSnapshot const): 2020-11-03 Wenson Hsieh Replace DisplayList::itemCount with DisplayList::isEmpty https://bugs.webkit.org/show_bug.cgi?id=218517 Reviewed by Geoffrey Garen. Separately keep track of the item count in the context's display list. See WebCore/ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: Use `isEmpty()` instead of checking `itemCount()`. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::flushDrawingContextAndCommit): 2020-11-02 Simon Fraser Scroll position can get reset after programmatic scroll https://bugs.webkit.org/show_bug.cgi?id=218477 Reviewed by Antti Koivisto. * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): 2020-11-03 Brent Fulgham [macOS] Adopt additional QuartzCore entitlement to reduce accessible endpoints https://bugs.webkit.org/show_bug.cgi?id=218466 Reviewed by Per Arne Vollan. In iOS 14 we adopted a new entitlement that limited the set of XPC endpoints available to QuartzCore clients. We should do the same on macOS to provide a similar level of protection. * Scripts/process-entitlements.sh: 2020-11-03 Youenn Fablet Add support for WebRTC VP9 decoder in GPU process https://bugs.webkit.org/show_bug.cgi?id=218445 Reviewed by Eric Carlson. Add support for VP9 decoder, send key frame size as IPC message specifically for VP9 hardware decoder. If GPU process does not enable either SW or HW VP9 decoder, we fall back to in process VP9 decoder. Manually tested by enabling WebRTC codec in GPU process. Will be covered by existing VP9 tests in GPU process mode once canvas in GPUProcess is fully supported. * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::createVP9Decoder): (WebKit::LibWebRTCCodecsProxy::setFrameSize): * WebProcess/GPU/GPUProcessConnection.h: (WebKit::GPUProcessConnection::isVP9DecoderEnabled const): (WebKit::GPUProcessConnection::isVPSWDecoderEnabled const): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::createVideoDecoder): (WebKit::decodeVideoFrame): (WebKit::LibWebRTCCodecs::setCallbacks): (WebKit::LibWebRTCCodecs::createDecoder): (WebKit::LibWebRTCCodecs::decodeFrame): (WebKit::formatNameFromCodecType): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: (WebKit::LibWebRTCCodecs::setVP9VTBSupport): (WebKit::LibWebRTCCodecs::supportVP9VTB const): 2020-11-03 Youenn Fablet Allow low latency H264 encoder in GPUProcess https://bugs.webkit.org/show_bug.cgi?id=218442 Reviewed by Eric Carlson. Pass useLowLatency boolean from WebProcess to GPUProcess. * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::createEncoder): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::completedDecoding): (WebKit::LibWebRTCCodecs::createEncoder): 2020-11-03 Chris Lord [GTK] Zooming causes page to scroll to top https://bugs.webkit.org/show_bug.cgi?id=217955 Reviewed by Carlos Garcia Campos. Don't reset page scale when setting zoom level on GLIB backend. * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_set_zoom_level): 2020-11-03 Adrian Perez de Castro [GTK][WPE] Cannot remove individual scripts/stylesheets using WebKitUserContentManager https://bugs.webkit.org/show_bug.cgi?id=218403 Reviewed by Carlos Garcia Campos. Add the missing WebKitUserContentManager functions which allow removing a single script and style sheet from the manager. Given that it is possible to remove a single content filter and message handlers already, this make the API orthogonal for scripts and style sheets as well. * UIProcess/API/glib/WebKitUserContentManager.cpp: (webkit_user_content_manager_remove_style_sheet): Added. (webkit_user_content_manager_remove_script): Added. * UIProcess/API/gtk/WebKitUserContentManager.h: Add declarations for the new functions. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Ditto. * UIProcess/API/wpe/WebKitUserContentManager.h: Ditto. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Ditto. 2020-11-02 Ryosuke Niwa Remove some useless comments from .messages.in files https://bugs.webkit.org/show_bug.cgi?id=218473 Reviewed by Tim Horton. Remove comments that simply repeats what the code says. * GPUProcess/GPUProcess.messages.in: * NetworkProcess/NetworkProcess.messages.in: * WebProcess/WebProcess.messages.in: 2020-11-02 Devin Rousso guard UIScribbleInteraction class property observing behind a LOA check https://bugs.webkit.org/show_bug.cgi?id=218463 Reviewed by Tim Horton. Some apps appear to swizzle `-[NSObject addObserver:forKeyPath:options:context:]` without support for the fact that the object can be a class rather than an instance and therefore crash. Use a LOA check to guard observing `+[UIScribbleInteraction isPencilInputExpected]` so that this doesn't happen, but only until the apps update, at which point they can fix it. * UIProcess/ios/WKStylusDeviceObserver.mm: (-[WKStylusDeviceObserver start]): (-[WKStylusDeviceObserver stop]): 2020-11-02 James Savage Changes to SWIFT_MODULE_ONLY_ARCHS https://bugs.webkit.org/show_bug.cgi?id=218404 Reviewed by Tim Horton. * SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Simplify how we specify these options. 2020-11-02 Aditya Keerthi [iOS] Link Contacts.framework during build https://bugs.webkit.org/show_bug.cgi?id=218289 Reviewed by Andy Estes. Contacts.framework is currrently soft linked in PaymentAuthorizationPresenter. Soft linking is generally discouraged, since it requires running the linker at runtime, leading to an unwanted performance cost. By normally linking the framework, the linkage is declared at build time, which enables running the linker at build/update/install time and avoiding the runtime cost. Unfortunately, we still have to soft link the framework on macOS, to avoid introducing a dependency cycle. Upward linking is not an option, since the Contacts framework does not implement InstallAPI. The SOFT_LINK_FRAMEWORK macro has been kept in PaymentAuthorizationPresenter to avoid introducing additional #ifs. This should be fine to keep on iOS, since the framework will already loaded in the address space, and the call to dlopen() should be much less expensive. * Configurations/WebKit.xcconfig: * Platform/cocoa/PaymentAuthorizationPresenter.mm: 2020-11-02 Chris Dumez Crash under ProcessThrottler::setAssertionType() https://bugs.webkit.org/show_bug.cgi?id=218448 Reviewed by Geoffrey Garen. A ProcessThrottler object is owned by its associated AuxiliaryProcessProxy. The crash was happening in ProcessThrottler::setAssertionType(), we would replace m_assertion with a new "Suspended" assertion and then crash on the next line when using m_assertion. The reason we crash is that when we replaced m_assertion with a new assertion, the destruction of the previous assertion caused the UIProcess's background task to get released (because this was the last non-suspended process assertion). When we release the UIProcess' background task, we call WebProcessPool::notifyProcessPoolsApplicationIsAboutToSuspend(), which destroys non-critical WebProcesses (e.g. WebProcesses in the back/forward cache), which in turns destroy their ProcessThrottler. As a result, when replacing m_assertion, the ProcessAssertion may get destroyed, which is why we would crash on the next line when trying to use m_assertion. To address the issue, we now release the UIProcess's background task asynchronously when releasing the last non-suspended ProcessAssertion, making sure we still need to release the assertion beforehand. This has 2 benefits: - The ProcessThrottler can no longer get destroyed synchronously when releasing its ProcessAssertion. - In the case where the ProcessThrottler replaces a foreground assertion with a background assertion (or vice-versa) and this is the last non-suspended assertion, this avoids unnecessarily releasing and retaking the UIProcess's background task. This also avoids killing non-critical processes unnecessarily. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): 2020-11-02 Brent Fulgham [macOS] Remove unneeded shmem access to ColorSync https://bugs.webkit.org/show_bug.cgi?id=218395 Reviewed by Per Arne Vollan. ColorSync on macOS has not used shared memory since Mac OS X 10.7, and our sandbox should not have this access. Removing this unused shared memory capability. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-01 Darin Adler Start removing functions that implicitly use composed tree https://bugs.webkit.org/show_bug.cgi?id=218424 Reviewed by Ryosuke Niwa. * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::getPlatformEditorState const): Use contains. 2020-11-02 David Kilzer Fix link error with WebKit.framework Undefined symbols for architecture x86_64: "JSC::GenericTypedArrayView::create(WTF::RefPtr, WTF::DefaultRefDerefTraits >&&, unsigned int, unsigned int)", referenced from: WebKit::convertToUint8Array(IPC::SharedBufferCopy&&) in UnifiedSource7.o ld: symbol(s) not found for architecture x86_64 * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: - Include to fix linker error with some builds of WebKit. - See also WebProcess/GPU/media/RemoteLegacyCDMSession.cpp. 2020-11-02 Youenn Fablet Stop sending origins from WebProcess to UIProcess for getUserMedia requests https://bugs.webkit.org/show_bug.cgi?id=218192 Reviewed by Eric Carlson. Pass directly a UserMediaRequestIdentifier through IPC. Stop passing origins from IPC and instead compute them from UIProcess side. * Scripts/webkit/messages.py: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): (WebKit::UserMediaPermissionRequestManagerProxy::grantRequest): (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest): (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest): (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy): * UIProcess/UserMediaPermissionRequestProxy.h: (WebKit::UserMediaPermissionRequestProxy::create): (WebKit::UserMediaPermissionRequestProxy::userMediaID const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest): (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted): (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasDenied): (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices): * WebProcess/MediaStream/UserMediaPermissionRequestManager.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::userMediaAccessWasGranted): (WebKit::WebPage::userMediaAccessWasDenied): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-11-01 Sam Weinig Remove remaining alternative preference setting mechanisms from LayoutTests https://bugs.webkit.org/show_bug.cgi?id=218417 Reviewed by Simon Fraser. Remove now unused bundle SPI that was only used by the WebKitTestRuner. * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleOverrideBoolPreferenceForTestRunner): Deleted. (WKBundleSetAllowUniversalAccessFromFileURLs): Deleted. (WKBundleSetAllowFileAccessFromFileURLs): Deleted. (WKBundleSetAllowStorageAccessFromFileURLS): Deleted. (WKBundleSetMinimumLogicalFontSize): Deleted. (WKBundleSetFrameFlatteningEnabled): Deleted. (WKBundleSetJavaScriptCanAccessClipboard): Deleted. (WKBundleSetPopupBlockingEnabled): Deleted. (WKBundleSetAuthorAndUserStylesEnabled): Deleted. * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::addOriginAccessAllowListEntry): (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Deleted. (WebKit::InjectedBundle::setAllowUniversalAccessFromFileURLs): Deleted. (WebKit::InjectedBundle::setAllowFileAccessFromFileURLs): Deleted. (WebKit::InjectedBundle::setNeedsStorageAccessFromFileURLsQuirk): Deleted. (WebKit::InjectedBundle::setMinimumLogicalFontSize): Deleted. (WebKit::InjectedBundle::setFrameFlatteningEnabled): Deleted. (WebKit::InjectedBundle::setAsyncFrameScrollingEnabled): Deleted. (WebKit::InjectedBundle::setJavaScriptCanAccessClipboard): Deleted. (WebKit::InjectedBundle::setPopupBlockingEnabled): Deleted. (WebKit::InjectedBundle::setAuthorAndUserStylesEnabled): Deleted. * WebProcess/InjectedBundle/InjectedBundle.h: 2020-10-31 Simon Fraser Clean up BoxSide and BorderEdge code https://bugs.webkit.org/show_bug.cgi?id=218197 Reviewed by Sam Weinig. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (boxSide): 2020-10-30 Brian Burg Web Inspector: move InspectorFrontendAPIDispatcher to WebCore, clean up uses https://bugs.webkit.org/show_bug.cgi?id=217835 Reviewed by Devin Rousso. Adopt the JSONValue-based InspectorFrontendAPIDispatcher::dispatch() method in WebInspectorUI and RemoteInspectorUI methods that dispatch to the frontend. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: Move files. * WebProcess/Inspector/RemoteWebInspectorUI.h: * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::RemoteWebInspectorUI): (WebKit::RemoteWebInspectorUI::initialize): (WebKit::RemoteWebInspectorUI::updateFindString): (WebKit::RemoteWebInspectorUI::didSave): (WebKit::RemoteWebInspectorUI::didAppend): (WebKit::RemoteWebInspectorUI::frontendLoaded): (WebKit::RemoteWebInspectorUI::sendMessageToFrontend): (WebKit::RemoteWebInspectorUI::pagePaused): (WebKit::RemoteWebInspectorUI::pageUnpaused): (WebKit::RemoteWebInspectorUI::setDiagnosticLoggingAvailable): * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::WebInspectorUI): (WebKit::WebInspectorUI::setDockSide): (WebKit::WebInspectorUI::setDockingUnavailable): (WebKit::WebInspectorUI::setIsVisible): (WebKit::WebInspectorUI::updateFindString): (WebKit::WebInspectorUI::setDiagnosticLoggingAvailable): (WebKit::WebInspectorUI::showConsole): (WebKit::WebInspectorUI::showResources): (WebKit::WebInspectorUI::showMainResourceForFrame): (WebKit::WebInspectorUI::startPageProfiling): (WebKit::WebInspectorUI::stopPageProfiling): (WebKit::WebInspectorUI::startElementSelection): (WebKit::WebInspectorUI::stopElementSelection): (WebKit::WebInspectorUI::didSave): (WebKit::WebInspectorUI::didAppend): (WebKit::WebInspectorUI::sendMessageToFrontend): (WebKit::WebInspectorUI::evaluateInFrontendForTesting): (WebKit::WebInspectorUI::pagePaused): (WebKit::WebInspectorUI::pageUnpaused): * WebProcess/WebCoreSupport/WebChromeClient.cpp: Add missing header includes (related to unified sources changes from r269168). 2020-10-30 Brent Fulgham Correct sandbox violations in GPU Process https://bugs.webkit.org/show_bug.cgi?id=218356 Reviewed by Eric Carlson. The new GPU Process sandbox is missing 'sysctl.name2oid' from the allow list, even though we allow it everywhere else. We need this for proper function. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: 2020-10-30 Simon Fraser Convert ScrollingTreeNode change flags to an OptionSet<> https://bugs.webkit.org/show_bug.cgi?id=218374 Reviewed by Antti Koivisto. Address the FIXME in ScrollingStateNode.h and use an OptionSet<> for the ScrollingState tree change flags. This required moving them all into the same enum class in ScrollingStateNode. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder::encode): (ArgumentCoder::encode): (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder::decode): (ArgumentCoder::decode): (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder::encode): (ArgumentCoder::decode): (WebKit::dump): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren): (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren): * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::commitStateBeforeChildren): 2020-10-29 Aditya Keerthi [Cocoa] Remove soft linking of NetworkExtension.framework https://bugs.webkit.org/show_bug.cgi?id=218314 Reviewed by Andy Estes. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): Replaced the soft linked method call with a new method exported from WebCore. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2020-10-29 Chris Dumez Regression(PSON): Back/forward navigation may hang https://bugs.webkit.org/show_bug.cgi?id=216611 Reviewed by Geoffrey Garen. The scenario was as follows: 1. Load A in Process P1 2. Load A#foo in Process P1 (fragment navigation) 3. Load B in Process P2 4. history.go(-2) to load A again in P1 5. history.go(2) to load B again in P2 6. history.back() to go back to A#foo in P1 -> Hang We doing the process swap at step 3, we would suspend the page containing A#foo in P1 when doing the new load in P2. When process swapping again at step 4, we would go back to process P1 (because it is same origin) but we did not have any suspended WebPage for A so we would create a new WebPage (with a new WebPageIdentifier). The reason we do this is to allow the suspended WebPage for A#foo to remain in process, as we may want it for another back/forward navigation later. The issue was that when constructing the new WebPage in P1 for A at step 4, we would restore all history items from the WebPageProxy's BackForwardList and overwrite any existing HistoryItems with the same IDs in the WebProcess. This meant that WebKit layer would construct new HistoryItems for HistoryItems that already existing and are used by the Suspended WebPage containing A#foo. Later on, at step 6, when trying to go back A#foo in P1, we would ask the Suspended WebPage in P1 to load a given HistoryItem. This HistoryItem is supposed to be present in the Page's back/forward list and is supposed to have an associated back/forward cache entry. However, it was not the case here because we ended up with a new HistoryItem instance that was restored from the UIProcess earlier. To address the issue, The WebPage constructor no longer overwrites existing HistoryItems. Note that before prior to r231048, the WebPage constructor was NOT overwriting existing HistoryItems so this restores previous behavior. Presumably, we started overwriting to stop hitting the assertion in WebBackForwardListProxy::addItemFromUIProcess() that checked that we either wanted to overwrite or that there was no existing HistoryItem with the given ID. This is no longer an issue since I replaced this assertion with an if-check and an early return. * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::WebBackForwardListProxy::addItemFromUIProcess): * WebProcess/WebPage/WebPage.cpp: 2020-10-29 Jiewen Tan [WebAuthn] Make WebContent process talk to the WebAuthn process for WebAuthn requests https://bugs.webkit.org/show_bug.cgi?id=218070 Reviewed by Brent Fulgham. Once modern web authentication is enabled, let WebContent process talk to the WebAuthn process for WebAuthn requests. * Scripts/process-entitlements.sh: Adds necessary entitlements for the WebAuthn process. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): Adds a way to distinguish if itself is in the UI Process or in the WebAuthn process. * WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp: (WebKit::WebAuthnConnectionToWebProcess::makeCredential): (WebKit::WebAuthnConnectionToWebProcess::getAssertion): (WebKit::WebAuthnConnectionToWebProcess::handleRequest): (WebKit::WebAuthnConnectionToWebProcess::isUserVerifyingPlatformAuthenticatorAvailable): (WebKit::WebAuthnConnectionToWebProcess::setMockWebAuthenticationConfiguration): * WebAuthnProcess/WebAuthnConnectionToWebProcess.h: * WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in: Adds receivers for messages coming from the web content processes. * WebAuthnProcess/WebAuthnProcess.cpp: (WebKit::WebAuthnProcess::WebAuthnProcess): (WebKit::WebAuthnProcess::setMockWebAuthenticationConfiguration): * WebAuthnProcess/WebAuthnProcess.h: (WebKit::WebAuthnProcess::authenticatorManager): Handles the authenticator managers. * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: Relaxes sandbox for necessary hardware accesses. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): Sends messages to the WebAuthn process accordingly. 2020-10-29 Per Arne Vollan [macOS] Add required entitlement for message filtering https://bugs.webkit.org/show_bug.cgi?id=218342 Reviewed by Brent Fulgham. The entitlement 'com.apple.private.security.message-filter' needs to be set to YES. This patch also adds telemetry for mach-bootstrap filtering. * Scripts/process-entitlements.sh: * WebProcess/com.apple.WebProcess.sb.in: 2020-10-29 Alex Christensen Don't look in the keychain for a preferred client certificate in the network process https://bugs.webkit.org/show_bug.cgi?id=218322 Reviewed by Geoffrey Garen. Often, based on a race condition of preconnecting to a server we have just been told to load and the use of Safari's BackgroundLoad class when navigating to a page we have not received any data from yet, and with an installed client certificate and an identity preference in the keychain, the user will be asked if com.apple.WebKit.Networking can access a private key in the keychain instead of if Safari can access a private key in the keychain. If the user types in the password and clicks "Always Allow" this does not make it always allowed, but it would have if Safari had asked instead of com.apple.WebKit.Networking. This is because Safari is responding to WKNavigationDelegate's didReceiveAuthenticationChallenge with NSURLSessionAuthChallengeUseCredential and nil, which would cause CFNetwork to search in the keychain as the network process for the preferred client certificate. What we want Safari's network process to do is not search in the keychain for this preconnect request's challenge but wait until the actual request, at which time Safari will use its proper logic to find the correct client certificate and AuthenticationManager::initializeConnection will create a SecKeyProxy to do the signing in the UI process. Third party applications will not be affected because the SecKeyProxy path is the only one that works for applications lacking Safari's entitlements. I used the steps in the radar to verify that this is fixed. Unfortunately, it is not practical to make a unit test that installs a system client certificate and an identity preference because doing so would require the entry of the login keychain password while running the unit test. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 2020-10-29 Said Abou-Hallawa REGRESSION(269065): [GPU Process]: Order of drawing has to be preserved when drawing a canvas to another canvas https://bugs.webkit.org/show_bug.cgi?id=218324 Reviewed by Simon Fraser. When drawing an ImageBuffer to another ImageBuffer, the DrawingContext of the source and the destination ImageBuffers have to be flushed immediately. Otherwise an older version or a newer version of the source ImageBuffer might be drawn to the destination ImageBuffer. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-10-29 Ryan Haddad Unreviewed, reverting r269109. Introduced dependency cycle Reverted changeset: "[Cocoa] Remove soft linking of Contacts.framework" https://bugs.webkit.org/show_bug.cgi?id=218289 https://trac.webkit.org/changeset/269109 2020-10-29 Per Arne Vollan [macOS] Add telemetry for IOKit use https://bugs.webkit.org/show_bug.cgi?id=218343 Reviewed by Geoffrey Garen. Add telemetry with backtrace for IOKIt use in the WebContent process. * WebProcess/com.apple.WebProcess.sb.in: 2020-10-29 Chris Lord [WPE] Add axis-locking to kinetic scrolling https://bugs.webkit.org/show_bug.cgi?id=209729 Reviewed by Adrian Perez de Castro. Add axis-locking to scroll gestures on WPE, and new WPE-specific settings to control the process. * UIProcess/API/wpe/ScrollGestureController.cpp: (WebKit::ScrollGestureController::handleEvent): * UIProcess/API/wpe/ScrollGestureController.h: 2020-10-29 Youenn Fablet Improve LibWebRTCSocketClient logging https://bugs.webkit.org/show_bug.cgi?id=218336 Reviewed by Eric Carlson. Output webrtc socket identifier in case of error. Fix the case of LibWebRTCSocketClient::sendTo that can log too much. No observable change of behavior. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::sendTo): (WebKit::LibWebRTCSocketClient::close): (WebKit::LibWebRTCSocketClient::setOption): 2020-10-29 Chris Lord [GTK] Smooth scrolling should not apply to continuous scrolling with sync scrolling https://bugs.webkit.org/show_bug.cgi?id=218133 Reviewed by Adrian Perez de Castro. Set hasPreciseScrollDeltas appropriately on scroll events created from GdkEvent. * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): 2020-10-28 John Wilander PCM: Accept ad click data when the link opens a new window https://bugs.webkit.org/show_bug.cgi?id=214176 Reviewed by Brent Fulgham. A link with the attribute target="_blank" takes another code path for navigation which involves the creation of a new window and webpage. That code path needs to transfer ad click attribution data to the new webpage where it can be picked up in WebPageProxy::didCommitLoadForFrame(). The ad click attribution data sits in the NavigationAction which is not available in the completion handler WebPageProxy::createNewPage(). The client, which differs between TestRunner and e.g. Safari, consumes the NavigationAction. I don't want to risk a regression in e.g. Safari while still passing the test because TestRunner hasn't regressed. Test: http/tests/adClickAttribution/attribution-conversion-through-image-redirect-in-new-window.html * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): Now also checks for pending ad click attribution data in its new member variable m_newPageNavigationAdClickAttribution. (WebKit::WebPageProxy::createNewPage): Now forwards optional ad click attribution data to the completion handler where it can be stored on the newly created webpage in the new member variable m_newPageNavigationAdClickAttribution. * UIProcess/WebPageProxy.h: Added m_newPageNavigationAdClickAttribution. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): Added missing navigationAction.adClickAttribution() copy. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): Added missing navigationAction.adClickAttribution() copy. 2020-10-28 Said Abou-Hallawa [GPU Process] Eagerly flush the PutImageData item to the GPU Process https://bugs.webkit.org/show_bug.cgi?id=218116 Reviewed by Simon Fraser. Flush the DrawingContext of the RemoteImageBufferProxy once the PutImageData item is recorded. So no expensive operation is going to block the painting. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-10-28 Tim Horton macCatalyst WebGL on Apple Silicon devices is using a software renderer https://bugs.webkit.org/show_bug.cgi?id=218303 Reviewed by Geoffrey Garen. * UIProcess/mac/HighPerformanceGPUManager.mm: (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::updateState): (WebKit::isiOSAppOnMac): Deleted. HighPerformanceGPUManager is PLATFORM(MAC)-only, which is not true for MACCATALYST, so delete this dead code. 2020-10-28 Sam Weinig Reduce Preference Override Methods: TabsToLinks/SpatialNavigation https://bugs.webkit.org/show_bug.cgi?id=218288 Reviewed by Tim Horton. Removes WKPreferencesGet/SetTabToLinksEnabled preference as it duplicates functionality of WKPreferencesGet/SetTabsToLinks. The former was added for https://bugs.webkit.org/show_bug.cgi?id=95329 but was redundant even at the time. We can now use test header commands for all of its use cases. Also removes testing only bundle SPI for enabling spatial navigation which also can be set via test headers instead. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetTabToLinksEnabled): Deleted. (WKPreferencesGetTabToLinksEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleSetSpatialNavigationEnabled): Deleted. * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): (WebKit::InjectedBundle::setSpatialNavigationEnabled): Deleted. * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::setTabToLinksEnabled): Deleted. (WebKit::WebPage::tabToLinksEnabled const): Deleted. 2020-10-28 Aditya Keerthi [Cocoa] Remove soft linking of Contacts.framework https://bugs.webkit.org/show_bug.cgi?id=218289 Reviewed by Geoff Garen. Since Contacts.framework does not depend on WebKit and soft linking is discouraged, WebKit should link Contacts.framework normally. Soft linking requires running the linker at runtime, leading to an unwanted performance cost. By normally linking (on iOS) and weak linking (on macOS), the linkage is declared at build time, which enables running the linker at build/update/install time and avoiding the runtime cost. * Configurations/WebKit.xcconfig: On macOS, weak link the framework since Contacts.framework is not available on the Base System. * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toNSError): 2020-10-28 Adrian Perez de Castro [GTK4] Build broken with GTK 3.99.3 https://bugs.webkit.org/show_bug.cgi?id=218270 Reviewed by Carlos Garcia Campos. No new tests needed. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (toplevelWindowStateChanged): Replace GDK_SURFACE_STATE_MINIMIZED with GDK_TOPLEVEL_STATE_MINIMIZED. * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (surfaceStateChangedCallback): Ditto, and GDK_SURFACE_STATE_MAXIMIZED with GDK_TOPLEVEL_STATE_MAXIMIZED. * UIProcess/Gamepad/gtk/UIGamepadProviderGtk.cpp: (WebKit::getWebPageProxy): Write an implementation which works for GTK4. (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput): Accomodate for windows being a bit less special in GTK4 and use gtk_widget_has_focus() directly. 2020-10-27 Alex Christensen Use _CFURLConnectionSetFrameworkStubs for SecItemShim instead of DYLD_INTERPOSE on Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218269 Reviewed by Darin Adler. r171066 introduced the use of _CFURLConnectionSetFrameworkStubs on iOS for CFNetwork to be able to get and set credentials as the UI process. This is also needed on Apple Silicon Macs. We should eventually replace it with an even cleaner per-NSURLSession solution, but this is a step in the right direction, and I verified manually that it fixes the radar. Covered by an API test that used to fail on Apple Silicon Macs. * Shared/mac/SecItemShim.cpp: (WebKit::initializeSecItemShim): 2020-10-27 Said Abou-Hallawa Make RenderingMode a bool enum and remove ShouldAccelerate https://bugs.webkit.org/show_bug.cgi?id=218264 Reviewed by Tim Horton. When creating a remote ImageBuffer in WebKit, all we need to know is whether the backend is accelerated or not. RemoteImageBufferProxy has to be backed by a DisplayList. RemoteImageBuffer has to own the real backend. Two enum values for RenderingMode is sufficient for creating the remote ImageBuffer. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/WebCoreArgumentCoders.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-10-27 Tim Horton Adopt the UIPointerInteraction API https://bugs.webkit.org/show_bug.cgi?id=218266 Reviewed by Wenson Hsieh. No new tests, just moving from deprecated SPI to API. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView setUpPointerInteraction]): (-[WKContentView _pointerInteraction:regionForRequest:defaultRegion:completion:]): (-[WKContentView pointerRegionForPositionInformation:point:]): (-[WKContentView pointerInteraction:styleForRegion:]): (-[WKContentView setUpCursorInteraction]): Deleted. (-[WKContentView _cursorInteraction:regionForLocation:defaultRegion:completion:]): Deleted. (-[WKContentView cursorRegionForPositionInformation:point:]): Deleted. (-[WKContentView cursorInteraction:styleForRegion:modifiers:]): Deleted. 2020-10-27 Chris Dumez [GPUProcess] Use async IPC for RemoteAudioDestinationManager's StartAudioDestination / StopAudioDestination https://bugs.webkit.org/show_bug.cgi?id=218251 Reviewed by Geoffrey Garen. Use async IPC for RemoteAudioDestinationManager's StartAudioDestination / StopAudioDestination. * GPUProcess/media/RemoteAudioDestinationManager.messages.in: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::stop): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-10-27 Brian Burg [Cocoa] Introduce _WKInspectorConfiguration for customizing local and remote Web Inspectors https://bugs.webkit.org/show_bug.cgi?id=217896 Reviewed by Devin Rousso. Introduce _WKInspectorConfiguration for customizing the behavior of Web Inspector instances. The initial customization is to allow for custom WKURLSchemeHandlers to be used by Web Inspector's WebView to load resources from client-controlled locations. This can be used to implement loading of extension resources using a custom scheme such as web-extension://. Scheme handlers need to be registered at WebView creation time via WKWebViewConfiguration. In order to configure a inspector page summoned from within WebKit (i.e., Inspect Element context menu item), we need to add a method to the UI delegate to get a configuration when the page is being created. This configuration object is used in two different SPI (local and remote cases): - As part of WKUIDelegatePrivate, to retrieve a _WKInspectorConfiguration given a _WKInspector. - As an argument to the _WKRemoteWebInspectorViewController initializer. It's used later as needed. New API test: WKInspectorDelegate.InspectorConfiguration. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Add new files. * UIProcess/API/APIInspectorConfiguration.h: Added. * UIProcess/API/APIInspectorConfiguration.cpp: Added. * UIProcess/API/Cocoa/_WKInspectorConfiguration.h: Added. * UIProcess/API/Cocoa/_WKInspectorConfigurationInternal.h: Added. * UIProcess/API/Cocoa/_WKInspectorConfiguration.mm: Added. (-[_WKInspectorConfiguration init]): (-[_WKInspectorConfiguration dealloc]): (-[_WKInspectorConfiguration _apiObject]): (-[_WKInspectorConfiguration setURLSchemeHandler:forURLScheme:]): (-[_WKInspectorConfiguration applyToWebViewConfiguration:]): (-[_WKInspectorConfiguration copyWithZone:]): Create _WKInspectorConfiguration and add a method to register WKURLSchemeHandlers. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): Add new API object types. Add missing InspectorExtension. * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/APIUIClient.h: (API::UIClient::configurationForLocalInspector): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::configurationForLocalInspector): Add new client/delegate method to fetch an inspector configuration as needed. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController initWithConfiguration:]): Renamed from -init. (-[_WKRemoteWebInspectorViewController init]): Deleted. (-[_WKRemoteWebInspectorViewController loadForDebuggableType:backendCommandsURL:]): (-[_WKRemoteWebInspectorViewController configurationForDebuggable:]): (-[_WKRemoteWebInspectorViewController _setDiagnosticLoggingDelegate:]): Store a _WKInspectorConfiguration and provide it when asked by RemoteWebInspectorProxy. * UIProcess/Inspector/RemoteWebInspectorProxy.h: * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::load): Store m_debuggableInfo before creating the page and window. It's used from inside platformCreateFrontendPageAndWindow to pass as an argument to the delegate method. * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformCreateFrontendPage): Obtain a configuration and use it to initialize the WKInspectorViewController. * UIProcess/Inspector/mac/WKInspectorViewController.h: * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController initWithConfiguration:inspectedPage:]): (-[WKInspectorViewController webView]): (-[WKInspectorViewController webViewConfiguration]): Renamed from -configuration. (-[WKInspectorViewController initWithInspectedPage:]): Deleted. (-[WKInspectorViewController configuration]): Deleted. Apply the URL scheme handlers registered in the _WKInspectorConfiguration to the WKWebViewConfiguration. * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: Stub out RemoteWebInspectorProxyClient::configurationForRemoteInspector(). * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: Fix build problems caused by repartitioning of unified sources. 2020-10-27 Said Abou-Hallawa [GPU Process]: Implement DisplayList::DrawImageBuffer item https://bugs.webkit.org/show_bug.cgi?id=217566 Reviewed by Simon Fraser. The sequence in the Web Process is the following: -- GraphicsContext::drawImageBuffer() uses DisplayList::Recorder to check whether it is appropriate to create a DrawImageBuffer item or not. -- DisplayList::Recorder::drawImageBuffer() uses the delegate to see if the ImageBuffer is remote or not and whether it can be locked till replaying back the DisplayList in the GPU side. -- RemoteImageBufferProxy inherits DisplayList::Recorder::Delegate. So its lockRemoteImageBuffer() is called. -- If the ImageBuffer can be locked, a DrawImageBufferItem is created with the ImageBuffer::renderingResourceIdentifier(). The sequence in the GPU Process is the following: -- When replaying back the DisplayList, DisplayList::Replayer will call its delegate to check if it wants to apply the DrawImageBuffer. -- Because RemoteImageBuffer inherits DisplayList::Replayer::Delegate, RemoteImageBuffer::apply() will be called. -- RemoteImageBuffer will call RemoteRenderingBackend::applyResourceItem() which will check whether the item's renderingResourceIdentifier is one of the ImageBuffers in its RemoteResourceCache or not. -- If there is a cached ImageBuffer, RemoteRenderingBackend::applyResourceItem() will draw it in the GraphicsContext. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::apply): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyResourceItem): (WebKit::RemoteRenderingBackend::applyMediaItem): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cachedImageBuffer): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::releaseImageBuffer): (WebKit::RemoteResourceCacheProxy::lockRemoteImageBufferForRemoteClient): (WebKit::RemoteResourceCacheProxy::lockRemoteResourceForRemoteClient): (WebKit::RemoteResourceCacheProxy::releaseRemoteResource): (WebKit::RemoteResourceCacheProxy::unlockRemoteResourcesForRemoteClient): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2020-10-27 Alex Christensen Use NSURLSessionAuthChallengeRejectProtectionSpace if WKNavigationDelegate didReceiveAuthenticationChallenge is not implemented https://bugs.webkit.org/show_bug.cgi?id=218008 Reviewed by Darin Adler. This is documented in WKNavigationDelegate.h, and the behavior is basically identical. The difference is if there is a challenge with multiple protection spaces and a delegate that implements didReceiveAuthenticationChallenge is attached between the delegate callbacks, it will receive the second callback. This is unlikely and next to impossible to test, but out of principle we should behave like we have documented that we do. * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): 2020-10-27 Sam Weinig Rename WKPreferencesSet*ValueForKey SPI to WKPreferencesSet*ValueForKeyForTesting https://bugs.webkit.org/show_bug.cgi?id=218240 Reviewed by Darin Adler. Addresses feedback from initial naming to make it clear what they are used for and for consistency with WebKitLegacy. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetBoolValueForKeyForTesting): (WKPreferencesSetDoubleValueForKeyForTesting): (WKPreferencesSetUInt32ValueForKeyForTesting): (WKPreferencesSetStringValueForKeyForTesting): (WKPreferencesSetBoolValueForKey): Deleted. (WKPreferencesSetDoubleValueForKey): Deleted. (WKPreferencesSetUInt32ValueForKey): Deleted. (WKPreferencesSetStringValueForKey): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: 2020-10-27 Carlos Garcia Campos WebDriver: sequence of char key press is not supported https://bugs.webkit.org/show_bug.cgi?id=217951 Reviewed by Brian Burg. We are assuming there can be only one char key pressed at a time. Use a HashSet to store the currently pressed char keys and the handle them the same way we do with virtual keys. Fixes: imported/w3c/webdriver/tests/perform_actions/key_events.py::test_sequence_of_keydown_printable_keys_sends_events * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::performInteractionSequence): 2020-10-27 Tetsuharu Ohzeki Make WebCore::FocusDirection to enum class https://bugs.webkit.org/show_bug.cgi?id=218162 Reviewed by Darin Adler. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::takeFocus): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::takeFocus): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::takeFocus): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::handleKeyEventByRelinquishingFocusToChrome): (WebKit::WebPage::setInitialFocus): 2020-10-26 Said Abou-Hallawa [GPU Process]: Introduce RemoteResourceCacheProxy to manage the remote resources in Web Process https://bugs.webkit.org/show_bug.cgi?id=217558 Reviewed by Simon Fraser. Remove RemoteImageBufferMessageHandlerProxy and move sending the messages to RemoteRenderingBackendProxy. To allow casting ImageBuffer to RemoteImageBufferProxy, a new method named remoteResourceIdentifier() is added to IamgeBuffer and it is only overridden by RemoteImageBufferProxy. This method is used in SPECIALIZE_TYPE_TRAITS macros along with IamgeBuffer::isAccelerated(). Introduce RemoteResourceCacheProxy which will manage caching and releasing the RemoteImageBufferProxy. Caching NativeImage will be added to it in future patches. More about controlling the life cycles of remote resources will be added also when supporting drawing remote resources to remote client in future patches. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::create): (WebKit::RemoteImageBuffer::RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackend::flushDisplayListWasCommitted): (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::flushDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackend::getImageData): (WebKit::RemoteRenderingBackend::releaseRemoteResource): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheImageBuffer): (WebKit::RemoteResourceCache::cachedImageBuffer): (WebKit::RemoteResourceCache::releaseRemoteResource): * GPUProcess/graphics/RemoteResourceCache.h: * Scripts/webkit/messages.py: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: (isType): * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp: Removed. * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h: Removed. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): (WebKit::RemoteImageBufferProxy::createBackend): (WebKit::RemoteImageBufferProxy::commitFlushDisplayList): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): (WebKit::RemoteImageBufferProxy::isPendingFlush const): (WebKit::RemoteImageBufferProxy::timeoutWaitForFlushDisplayListWasCommitted): (WebKit::RemoteImageBufferProxy::flushDrawingContextAndCommit): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::getImageData): (WebKit::RemoteRenderingBackendProxy::flushDisplayList): (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: (WebKit::RemoteRenderingBackendProxy::remoteResourceCacheProxy): (WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: Copied from Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp. (WebKit::RemoteResourceCacheProxy::RemoteResourceCacheProxy): (WebKit::RemoteResourceCacheProxy::cacheImageBuffer): (WebKit::RemoteResourceCacheProxy::cachedImageBuffer): (WebKit::RemoteResourceCacheProxy::releaseImageBuffer): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: Copied from Source/WebKit/GPUProcess/graphics/RemoteResourceCache.h. 2020-10-26 Alex Christensen Add null checks and smart pointers in PDF and Plugin code https://bugs.webkit.org/show_bug.cgi?id=218144 Reviewed by Youenn Fablet. It's nice when things don't crash. isBeingAsynchronouslyInitialized wasn't called anywhere, so I removed it. * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::PDFPlugin): (WebKit::PDFPlugin::~PDFPlugin): (WebKit::PDFPlugin::getResourceBytesAtPosition): (WebKit::PDFPlugin::updateScrollbars): (WebKit::PDFPlugin::createScrollbar): (WebKit::PDFPlugin::isActive const): (WebKit::PDFPlugin::forceUpdateScrollbarsOnMainThreadForPerformanceTesting const): (WebKit::PDFPlugin::jsPDFDocPrint): (WebKit::PDFPlugin::installPDFDocument): (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors): (WebKit::PDFPlugin::calculateSizes): (WebKit::PDFPlugin::willDetachRenderer): (WebKit::PDFPlugin::destroy): (WebKit::PDFPlugin::paintControlForLayerInContext): (WebKit::PDFPlugin::convertFromPDFViewToScreen const): (WebKit::PDFPlugin::boundsOnScreen const): (WebKit::PDFPlugin::visibilityDidChange): (WebKit::PDFPlugin::showContextMenuAtPoint): (WebKit::PDFPlugin::handleContextMenuEvent): (WebKit::PDFPlugin::isFullFramePlugin const): (WebKit::PDFPlugin::handlesPageScaleFactor const): (WebKit::PDFPlugin::clickedLink): (WebKit::PDFPlugin::save): (WebKit::PDFPlugin::openWithPreview): (WebKit::PDFPlugin::saveToPDF): (WebKit::PDFPlugin::openWithNativeApplication): (WebKit::PDFPlugin::showDefinitionForAttributedString): (WebKit::PDFPlugin::notifySelectionChanged): (WebKit::PDFPlugin::notifyCursorChanged): (WebKit::PDFPlugin::axObjectCache const): (WebKit::PDFPlugin::performWebSearch): (WebKit::PDFPlugin::performSpotlightSearch): * WebProcess/Plugins/Plugin.cpp: (WebKit::Plugin::Plugin): (WebKit::Plugin::initialize): (WebKit::Plugin::controller): (WebKit::Plugin::controller const): (WebKit::Plugin::~Plugin): Deleted. * WebProcess/Plugins/Plugin.h: (WebKit::Plugin::controller): Deleted. (WebKit::Plugin::controller const): Deleted. * WebProcess/Plugins/PluginController.h: * WebProcess/WebPage/WebFrame.h: (WebKit::WebFrame::setLoadListener): (WebKit::WebFrame::loadListener const): 2020-10-26 Youenn Fablet Add support for VP9 Profile 2 (10-bit color) in WebRTC https://bugs.webkit.org/show_bug.cgi?id=217673 Reviewed by Eric Carlson. * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::pixelBufferPool): 2020-10-26 Zan Dobersek Remove Accelerated2dCanvasEnabled WebPreferences entry https://bugs.webkit.org/show_bug.cgi?id=218114 Reviewed by Adrian Perez de Castro. With the removal of the Accelerated2dCanvasEnabled preference key, relevant API functions in the WK2 C API are made no-op. Similar thing is done for the relevant GLib API, with the addition of marking relevant API funcions as deprecated. * Shared/API/c/WKDeprecatedFunctions.cpp: (WKPreferencesSetAccelerated2DCanvasEnabled): (WKPreferencesGetAccelerated2DCanvasEnabled): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetAccelerated2DCanvasEnabled): Deleted. (WKPreferencesGetAccelerated2DCanvasEnabled): Deleted. * UIProcess/API/glib/WebKitSettings.cpp: (webKitSettingsSetProperty): (webKitSettingsGetProperty): (webkit_settings_class_init): (webkit_settings_get_enable_accelerated_2d_canvas): (webkit_settings_set_enable_accelerated_2d_canvas): * UIProcess/API/gtk/WebKitSettings.h: * UIProcess/API/wpe/WPEView.cpp: (WKWPE::m_backend): * UIProcess/API/wpe/WebKitSettings.h: 2020-10-22 Ryosuke Niwa IPC testing API should expose ArrayBuffer for an unknown decoded argument https://bugs.webkit.org/show_bug.cgi?id=218113 Reviewed by Darin Adler. Expose the decoded argument as an ArrayBuffer when it can't be encoded as a JS value. Also make the treatment of a JS array as a tuple or a Vector explicit in argument encoding. Test: TestWebKitAPI.IPCTestingAPI.CanInterceptAlert * Platform/IPC/Decoder.h: (IPC::Decoder::currentBufferPosition const): Added. * Platform/IPC/JSIPCBinding.cpp: (IPC::putJSValueForDecodedArgumentAtIndexOrArrayBufferIfUndefined): Added. * Platform/IPC/JSIPCBinding.h: (IPC::DecodedArgumentJSValueConverter): Deleted. (IPC::putJSValueForDecodeArgumentInArray): Replaced DecodedArgumentJSValueConverter. Take Decoder and decode each tuple argument and create a JS value at a time. (IPC::jsValueForArgumentTuple): Deleted. Merged into jsValueForDecodedArguments. (IPC::jsValueForDecodedArguments): * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::VectorEncodeHelper::encode const): (WebKit::IPCTestingAPI::encodeArrayArgument): Extracted out of encodeArgument. (WebKit::IPCTestingAPI::encodeArgument): Treat an array as a tuple unless it's explicitly specified that the argument's type is a Vector. 2020-10-23 Eric Carlson [Media in GPU Process] in-band metadata cues sometimes crash https://bugs.webkit.org/show_bug.cgi?id=218106 Reviewed by Jer Noble. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): SerializedPlatformDataCueValue::nativeValue() is a RetainPtr<>. 2020-10-23 Miguel Gomez [GTK][WPE] Implement antialiased rounded rectangle clipping in TextureMapper https://bugs.webkit.org/show_bug.cgi?id=174457 Reviewed by Carlos Garcia Campos. Use the new TextureMapper::beginClip() method that receives a FloatRoundedRect. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): 2020-10-23 Michael Catanzaro [SOUP] Fix crash in WebSocketTask https://bugs.webkit.org/show_bug.cgi?id=217892 Reviewed by Carlos Garcia Campos. The WebSocketTask connects to the "starting" signal of its SoupMessage and never disconnects this signal, which is only safe if it is guaranteed to outlive its SoupMessage. However, it is not. We crash when the signal is emitted after the WebSocketTask is destroyed. To solve this, we just need to disconnect the signal when required. Normally that would be done in the destructor, but the WebSocketTask drops its ownership of the SoupMessage prior to that point, so we need to disconnect on each possible paths. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::~WebSocketTask): (WebKit::WebSocketTask::didConnect): (WebKit::WebSocketTask::didFail): 2020-10-22 Aditya Keerthi [Contact Picker API] Add skeleton implementation of ContactsManager.select() https://bugs.webkit.org/show_bug.cgi?id=218050 Reviewed by Devin Rousso. Added the necessary plumbing in order for the UIProcess to display a contact picker after a call to ContactsManager.select() is made. * UIProcess/PageClient.h: (WebKit::PageClient::showContactPicker): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContactPicker): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::showContactPicker): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::showContactPicker): * WebProcess/WebPage/WebPage.h: 2020-10-22 Ryosuke Niwa IPC testing API should have the capability to observe messages being sent and received https://bugs.webkit.org/show_bug.cgi?id=217870 Unreviewed ASAN release build fix. * Platform/IPC/JSIPCBinding.cpp: * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSMessageListener::JSMessageListener): 2020-10-22 Eric Carlson UIClient isn't notified when page muted state changes https://bugs.webkit.org/show_bug.cgi?id=218085 Reviewed by Youenn Fablet. API test: WKWebView.MediaMuted * UIProcess/API/C/WKPage.cpp: (WKPageGetMediaState): reportedMediaCaptureState -> reportedMediaState. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _mediaCaptureState]): Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateReportedMediaCaptureState): Only record current capture state in m_reportedMediaCaptureState. m_delayStopCapturingReporting isn't necessary, remove it. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::reportedMediaState const): Renamed from reportedMediaCaptureState to reflect what it returns. (WebKit::WebPageProxy::mediaStateFlags const): Deleted. (WebKit::WebPageProxy::reportedMediaCaptureState const): Deleted. 2020-10-22 Youenn Fablet Introduce worklet destinations and allow to fetch modules with CORS based on destination https://bugs.webkit.org/show_bug.cgi?id=218019 Reviewed by Chris Dumez. Add support to new fetch destinations in enumerations. * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::resourceLoadInfo): 2020-10-22 Nitzan Uziely Elements in Shadow DOM are wrongly marked as stale by the WebDriver https://bugs.webkit.org/show_bug.cgi?id=217635 Reviewed by Brian Burg. Fixed the focus script to work for elements in Shadow DOM instead of declaring them as not interactable. * WebProcess/Automation/WebAutomationSessionProxy.js: (let.AutomationSessionProxy.prototype._clearStaleNodes): (let.AutomationSessionProxy): 2020-10-22 Aditya Keerthi [iOS] Prevent presentation of input peripherals when focusing form controls with a validation message https://bugs.webkit.org/show_bug.cgi?id=218004 Reviewed by Wenson Hsieh. Interactive form validation can result in the presentation of a validation message bubble near the first form control that has invalid data. Prior to displaying the message, the invalid control is focused. On iOS, this also has the effect of also presenting a virtual keyboard or another custom input peripheral, such as a context menu for date inputs. Attempting to present both the validation message and custom input peripheral can leave the view in an inconsistent state. For example, or a