2021-05-17 Russell Epstein <repstein@apple.com> Apply patch. rdar://problem/78125245 2021-05-17 Per Arne Vollan <pvollan@apple.com> [iOS] Read access to passwd is required https://bugs.webkit.org/show_bug.cgi?id=223641 <rdar://75616105> Reviewed by Brent Fulgham. The WebContent sandbox on iOS should allow reading the passwd file. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-05-06 Russell Epstein <repstein@apple.com> Cherry-pick r277114. rdar://problem/77623232 Fix crash when WebsiteDataStore is destroyed with outstanding getNetworkProcessConnection request https://bugs.webkit.org/show_bug.cgi?id=225478 <rdar://77576148> Reviewed by Chris Dumez. In WebsiteDataStore::getNetworkProcessConnection if we don't get a connection the first time, we terminate the network process and try again. This greatly increases our success rate. However, if we are cancelling the reply because of the destruction of the WebsiteDataStore, we will end up doing bad things with partially destroyed objects, which ends up crashing. In order to prevent this, use RunLoop::main.dispatch to retry on the next runloop iteration so that we will never be inside the stack of WebsiteDataStore::~WebsiteDataStore when retrying. In that case, we will find that weakThis is null and send an empty reply. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::getNetworkProcessConnection): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277114 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-05-06 Alex Christensen <achristensen@webkit.org> Fix crash when WebsiteDataStore is destroyed with outstanding getNetworkProcessConnection request https://bugs.webkit.org/show_bug.cgi?id=225478 <rdar://77576148> Reviewed by Chris Dumez. In WebsiteDataStore::getNetworkProcessConnection if we don't get a connection the first time, we terminate the network process and try again. This greatly increases our success rate. However, if we are cancelling the reply because of the destruction of the WebsiteDataStore, we will end up doing bad things with partially destroyed objects, which ends up crashing. In order to prevent this, use RunLoop::main.dispatch to retry on the next runloop iteration so that we will never be inside the stack of WebsiteDataStore::~WebsiteDataStore when retrying. In that case, we will find that weakThis is null and send an empty reply. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::getNetworkProcessConnection): 2021-05-06 Russell Epstein <repstein@apple.com> Cherry-pick r276671. rdar://problem/77620826 HashTableConstIterator's consistency assertion fails while closing m_webIDBServers in NetworkProcess::didClose since r275846 https://bugs.webkit.org/show_bug.cgi?id=225089 Reviewed by Chris Dumez. The items of m_webIDBServers were removed while iterating m_webIDBServers. Move m_webIDBServers to a temporary HashMap before iterating. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276671 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-27 Fujii Hironori <Hironori.Fujii@sony.com> HashTableConstIterator's consistency assertion fails while closing m_webIDBServers in NetworkProcess::didClose since r275846 https://bugs.webkit.org/show_bug.cgi?id=225089 Reviewed by Chris Dumez. The items of m_webIDBServers were removed while iterating m_webIDBServers. Move m_webIDBServers to a temporary HashMap before iterating. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): 2021-05-06 Russell Epstein <repstein@apple.com> Apply patch. rdar://problem/77619719 2021-05-06 Chris Dumez <cdumez@apple.com> Crash under IPC::Connection::dispatchMessageToWorkQueueReceiver() <rdar://77576143> Reviewed by Alex Christensen. When r274565 was merged to the safari-611-branch branch, its `ASSERT(connection.m_incomingMessagesMutex.isHeld())` did not hold there. Unlike trunk, the call-site (Connection::processIncomingMessage(std::unique_ptr<Decoder>)) does not hold the m_incomingMessagesMutex lock on the safari-611-branch branch. This leads to crashes due to lack of synchronization when accessing / modifying the m_incomingMessages Dequeue on the main thread and IPC thread in parallel. To address the issue on the safari-611-branch branch, we now grab the m_incomingMessagesMutex lock before modifying the m_incomingMessages Dequeue in Connection::SyncMessageState::processIncomingMessage(). No new tests, existing tests were crashing in debug already. * Platform/IPC/Connection.cpp: (IPC::Connection::SyncMessageState::processIncomingMessage): 2021-05-03 Russell Epstein <repstein@apple.com> Cherry-pick r276852. rdar://problem/77468295 prefers-reduced-motion is not reactive on iOS https://bugs.webkit.org/show_bug.cgi?id=222381 <rdar://75933915> Reviewed by Brent Fulgham. With CFPrefs direct mode, there is a race between the notification that an accessibility preference has been changed by the user, and the the in-memory Accessibility preference cache in the WebContent process. We resolve this by using new SPI to clear the cached Accessibility settings when we are notified of an accessibility change so they always reflect the user's most recent setting. * Platform/spi/Cocoa/AccessibilitySupportSPI.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::setPreferenceValue): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276852 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-30 Per Arne Vollan <pvollan@apple.com> prefers-reduced-motion is not reactive on iOS https://bugs.webkit.org/show_bug.cgi?id=222381 <rdar://75933915> Reviewed by Brent Fulgham. With CFPrefs direct mode, there is a race between the notification that an accessibility preference has been changed by the user, and the the in-memory Accessibility preference cache in the WebContent process. We resolve this by using new SPI to clear the cached Accessibility settings when we are notified of an accessibility change so they always reflect the user's most recent setting. * Platform/spi/Cocoa/AccessibilitySupportSPI.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::setPreferenceValue): 2021-04-29 Russell Epstein <repstein@apple.com> Cherry-pick r276742. rdar://problem/77326513 [iOS] Web content process occasionally crashes under VisibleSelection::adjustPositionForEnd https://bugs.webkit.org/show_bug.cgi?id=225072 rdar://77159489 Reviewed by Darin Adler. Source/WebCore: Remove a helper method that was added in r276688, which we no longer need. * dom/Position.h: (WebCore::Position::isInTreeScope const): Deleted. Source/WebKit: The fix for this crash that I landed in r276688 was based on a misunderstanding that accessing `treeScope()` would trigger a null pointer deref if `isInTreeScope()` is `false`. This is not the case, since the `treeScope` of a `Node` is a separate notion from whether that `Node` is connected to said tree scope. Since this crash is really due to dereferencing a null container node in the case where `selectionStart` or `selectionEnd` are null, a better fix is to just check the nullity of the container node. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276742 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-28 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Web content process occasionally crashes under VisibleSelection::adjustPositionForEnd https://bugs.webkit.org/show_bug.cgi?id=225072 rdar://77159489 Reviewed by Darin Adler. The fix for this crash that I landed in r276688 was based on a misunderstanding that accessing `treeScope()` would trigger a null pointer deref if `isInTreeScope()` is `false`. This is not the case, since the `treeScope` of a `Node` is a separate notion from whether that `Node` is connected to said tree scope. Since this crash is really due to dereferencing a null container node in the case where `selectionStart` or `selectionEnd` are null, a better fix is to just check the nullity of the container node. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): 2021-04-29 Russell Epstein <repstein@apple.com> Cherry-pick r276688. rdar://problem/77326513 [iOS] Web content process occasionally crashes under VisibleSelection::adjustPositionForEnd https://bugs.webkit.org/show_bug.cgi?id=225072 rdar://77159489 Reviewed by Darin Adler. Source/WebCore: Add a helper method to check whether or not the given `Position` is in a tree scope. See WebKit/ChangeLog for more details. Test: editing/selection/ios/clear-selection-while-moving-selection-handles.html * dom/Position.h: (WebCore::Position::isInTreeScope const): Source/WebKit: Make `rangeForPointInRootViewCoordinates` robust in the case where the original selection may have become orphaned or null, by checking that the `targetNode` and existing `selectionStart` or `selectionEnd` are in a tree scope before accessing `treeScope()`. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): LayoutTests: Add a layout test that programmatically clears the selection in the middle of changing it by moving selection handles. * editing/selection/ios/clear-selection-while-moving-selection-handles-expected.txt: Added. * editing/selection/ios/clear-selection-while-moving-selection-handles.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276688 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-27 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Web content process occasionally crashes under VisibleSelection::adjustPositionForEnd https://bugs.webkit.org/show_bug.cgi?id=225072 rdar://77159489 Reviewed by Darin Adler. Make `rangeForPointInRootViewCoordinates` robust in the case where the original selection may have become orphaned or null, by checking that the `targetNode` and existing `selectionStart` or `selectionEnd` are in a tree scope before accessing `treeScope()`. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): 2021-04-23 Russell Epstein <repstein@apple.com> Cherry-pick r276324. rdar://problem/77086404 FullGCActivityCallback should use the percentage of pages uncompressed in RAM to determine deferral. https://bugs.webkit.org/show_bug.cgi?id=224817 Reviewed by Filip Pizlo. Source/JavaScriptCore: Right now we try to determine if too many pages are paged out by dereferencing them and bailing out of the GC if we go over a deadline. While this works if the only goal is to avoid causing extensive thrashing on spinny disks (HDD), it doesn't prevent thrashing when access to disk is fast (e.g. SSD). This is because on fast disks the proportional time to load the memory from disk is much lower. Additionally, on SSDs in particular we don't want to load the pages into RAM then bail as that will force a different page onto disk, increasing wear. This patch switches to asking the OS if each MarkedBlock is paged out. Then if we are over a threshold we wait until we would have GC'd anyway. This patch uses the (maxVMGrowthFactor - 1) as the percentage of "slow" pages (paged out or compressed) needed to defer the GC. The idea behind that threshold is that if we add that many pages then the same number of pages would be forced out of RAM for us to do a GC anyway (in the limit). * heap/BlockDirectory.cpp: (JSC::BlockDirectory::updatePercentageOfPagedOutPages): (JSC::BlockDirectory::isPagedOut): Deleted. * heap/BlockDirectory.h: * heap/FullGCActivityCallback.cpp: (JSC::FullGCActivityCallback::doCollection): * heap/Heap.cpp: (JSC::Heap::isPagedOut): * heap/Heap.h: * heap/MarkedSpace.cpp: (JSC::MarkedSpace::isPagedOut): * heap/MarkedSpace.h: * runtime/OptionsList.h: Source/WebKit: Add mincore to the acceptable syscall list. * WebProcess/com.apple.WebProcess.sb.in: Source/WTF: Add a noexcept flavor of FunctionTraits. On Linux mincore (and probably other syscalls) are marked noexcept so the existing overloads don't work. * wtf/FunctionTraits.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276324 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-20 Keith Miller <keith_miller@apple.com> FullGCActivityCallback should use the percentage of pages uncompressed in RAM to determine deferral. https://bugs.webkit.org/show_bug.cgi?id=224817 Reviewed by Filip Pizlo. Add mincore to the acceptable syscall list. * WebProcess/com.apple.WebProcess.sb.in: 2021-04-23 Russell Epstein <repstein@apple.com> Cherry-pick r276482. rdar://problem/77074513 [Mac] CMBaseClass object pointers can become unaligned on x86 https://bugs.webkit.org/show_bug.cgi?id=224950 <rdar://77020922> Reviewed by Eric Carlson. CMBaseClass has a 4-byte version member before its 8-byte pointers on x86. Deal with this the same way we do with other pointer-bearing, static, CM-type objects: enforce a 4-byte packing, and prepend the struct with another 4-byte object in order to force the pointers into 8-byte alignment. * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: (WebKit::CoreMediaWrapped<Wrapped>::vTable): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276482 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-22 Jer Noble <jer.noble@apple.com> [Mac] CMBaseClass object pointers can become unaligned on x86 https://bugs.webkit.org/show_bug.cgi?id=224950 <rdar://77020922> Reviewed by Eric Carlson. CMBaseClass has a 4-byte version member before its 8-byte pointers on x86. Deal with this the same way we do with other pointer-bearing, static, CM-type objects: enforce a 4-byte packing, and prepend the struct with another 4-byte object in order to force the pointers into 8-byte alignment. * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: (WebKit::CoreMediaWrapped<Wrapped>::vTable): 2021-04-21 Alan Coon <alancoon@apple.com> Cherry-pick r275805. rdar://problem/76963040 Crash under WebProcessProxy::shouldSendPendingMessage() https://bugs.webkit.org/show_bug.cgi?id=224377 <rdar://75329251> Reviewed by David Kilzer. We are crashing with a null-dereference of pendingMessage.encoder inside WebProcessProxy::shouldSendPendingMessage(). However, pendingMessage.encoder is a UniqueRef<> and thus cannot be null. Also, we know that the WebProcessProxy is alive because WebProcessProxy::didFinishLaunching() has a protector. One thing that I believe could theoretically happen and would not be safe though is AuxiliaryProcessProxy::sendMessage() being called on a non-main thread. Sending IPC off the main thread is safe in general and something we commonly do with an IPC::Connection. To make this safe, IPC::Connection uses a Lock to protect its vector of messages. However, sending IPC via an AuxiliaryProcessProxy is currently not thread safe as it relies on the process state (which gets updated on the main thread) and access to the m_pendingMessages is not synchronized. As a speculative fix, I have added logic in AuxiliaryProcessProxy::sendMessage() to dispatch to the main thread if we're not already on it. I have also used WTF::DestructionThread::MainRunLoop to make sure all AuxiliaryProcessProxy objects get destroyed on the main thread. In a follow-up, I am planning to add a release assertion in AuxiliaryProcessProxy::sendMessage() to make sure we're on a main thread. We'll then be able to drop the "dispatching the main thread" logic. For now though, I think we should start with the "dispatch to main thread" logic, so that we have a patch that we can cherry-pick to a branch. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::sendMessage): (WebKit::AuxiliaryProcessProxy::didFinishLaunching): (WebKit::AuxiliaryProcessProxy::replyToPendingMessages): * UIProcess/AuxiliaryProcessProxy.h: * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessProxy.h: * UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp: (WebKit::WebAuthnProcessProxy::singleton): * UIProcess/WebProcessProxy.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275805 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-10 Chris Dumez <cdumez@apple.com> Crash under WebProcessProxy::shouldSendPendingMessage() https://bugs.webkit.org/show_bug.cgi?id=224377 <rdar://75329251> Reviewed by David Kilzer. We are crashing with a null-dereference of pendingMessage.encoder inside WebProcessProxy::shouldSendPendingMessage(). However, pendingMessage.encoder is a UniqueRef<> and thus cannot be null. Also, we know that the WebProcessProxy is alive because WebProcessProxy::didFinishLaunching() has a protector. One thing that I believe could theoretically happen and would not be safe though is AuxiliaryProcessProxy::sendMessage() being called on a non-main thread. Sending IPC off the main thread is safe in general and something we commonly do with an IPC::Connection. To make this safe, IPC::Connection uses a Lock to protect its vector of messages. However, sending IPC via an AuxiliaryProcessProxy is currently not thread safe as it relies on the process state (which gets updated on the main thread) and access to the m_pendingMessages is not synchronized. As a speculative fix, I have added logic in AuxiliaryProcessProxy::sendMessage() to dispatch to the main thread if we're not already on it. I have also used WTF::DestructionThread::MainRunLoop to make sure all AuxiliaryProcessProxy objects get destroyed on the main thread. In a follow-up, I am planning to add a release assertion in AuxiliaryProcessProxy::sendMessage() to make sure we're on a main thread. We'll then be able to drop the "dispatching the main thread" logic. For now though, I think we should start with the "dispatch to main thread" logic, so that we have a patch that we can cherry-pick to a branch. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::sendMessage): (WebKit::AuxiliaryProcessProxy::didFinishLaunching): (WebKit::AuxiliaryProcessProxy::replyToPendingMessages): * UIProcess/AuxiliaryProcessProxy.h: * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessProxy.h: * UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp: (WebKit::WebAuthnProcessProxy::singleton): * UIProcess/WebProcessProxy.h: 2021-04-21 Ruben Turcios <rubent_22@apple.com> Cherry-pick r275487. rdar://problem/76962948 REGRESSION(r267763) NetworkProcess never terminates https://bugs.webkit.org/show_bug.cgi?id=224191 <rdar://problem/76124590> Patch by Alex Christensen <achristensen@webkit.org> on 2021-04-05 Reviewed by Chris Dumez. Source/WebKit: Before r267763, when a WebProcessPool was deallocated, the NetworkProcess it owned was terminated. Since then, once you start using a NetworkProcess, it will be kept until your app closes or it crashes. To reclaim these resources in a way similar to how we did before, we now terminate the network process in two situations: 1. If all WebsiteDataStores associated with it are deallocated. This happens if you have never used the default WKWebsiteDataStore. 2. If all WebProcessPools are deallocated. This can still happen if you do use the default WKWebsiteDataStore, which is never deallocated. Covered by API tests. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore _defaultNetworkProcessExists]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::defaultNetworkProcessExists): (WebKit::NetworkProcessProxy::removeSession): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::~WebProcessPool): Tools: * TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm: (TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275487 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-05 Alex Christensen <achristensen@webkit.org> REGRESSION(r267763) NetworkProcess never terminates https://bugs.webkit.org/show_bug.cgi?id=224191 <rdar://problem/76124590> Reviewed by Chris Dumez. Before r267763, when a WebProcessPool was deallocated, the NetworkProcess it owned was terminated. Since then, once you start using a NetworkProcess, it will be kept until your app closes or it crashes. To reclaim these resources in a way similar to how we did before, we now terminate the network process in two situations: 1. If all WebsiteDataStores associated with it are deallocated. This happens if you have never used the default WKWebsiteDataStore. 2. If all WebProcessPools are deallocated. This can still happen if you do use the default WKWebsiteDataStore, which is never deallocated. Covered by API tests. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore _defaultNetworkProcessExists]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::defaultNetworkProcessExists): (WebKit::NetworkProcessProxy::removeSession): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::~WebProcessPool): 2021-04-21 Ruben Turcios <rubent_22@apple.com> Cherry-pick r274504. rdar://problem/76962959 The WebContent process crashes when launching Safari https://bugs.webkit.org/show_bug.cgi?id=223264 <rdar://75482851> 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 <pvollan@apple.com> The WebContent process crashes when launching Safari https://bugs.webkit.org/show_bug.cgi?id=223264 <rdar://75482851> 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-04-16 Russell Epstein <repstein@apple.com> Cherry-pick r275485. rdar://problem/76412930 Make sure we no longer show the previous page when running a JS prompt https://bugs.webkit.org/show_bug.cgi?id=215782 <rdar://problem/67698601> Reviewed by Darin Adler. Source/WebCore: Add linked-on-after check for the behavior change to minimize the risk of breakage. * platform/cocoa/VersionChecks.h: Source/WebKit: Make sure we 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 is the set the opacity of our root layer to 0 when the JS prompt is requested (before the first paint) and set the opacity back to 1 after the first paint. To minimize the risks of breakage, the behavior change is behind a linked-on-after check. Also, we only trigger this behavior if the WKWebView client actually implements the corresponding JS prompt delegate. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::runJavaScriptAlert): (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): * UIProcess/PageClient.h: (WebKit::PageClient::makeViewBlank): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate): (WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::runJavaScriptAlert): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::makeViewBlank): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::makeViewBlank): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::runJavaScriptAlert): (WebKit::WebChromeClient::runJavaScriptConfirm): (WebKit::WebChromeClient::runJavaScriptPrompt): Add flag to make sure pending async messages are processed *before* the JS prompt sync IPCs. Without this, it was possible for the UIProcess to receive the JS prompt IPC *before* the DidCommitLoadForFrame IPC, which would confuse our logic, since we would think this is a JS prompt for the previous page. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::sendSyncWithDelayedReply): * 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@275485 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-05 Chris Dumez <cdumez@apple.com> Make sure we no longer show the previous page when running a JS prompt https://bugs.webkit.org/show_bug.cgi?id=215782 <rdar://problem/67698601> Reviewed by Darin Adler. Make sure we 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 is the set the opacity of our root layer to 0 when the JS prompt is requested (before the first paint) and set the opacity back to 1 after the first paint. To minimize the risks of breakage, the behavior change is behind a linked-on-after check. Also, we only trigger this behavior if the WKWebView client actually implements the corresponding JS prompt delegate. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::runJavaScriptAlert): (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): * UIProcess/PageClient.h: (WebKit::PageClient::makeViewBlank): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate): (WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::runJavaScriptAlert): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::makeViewBlank): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::makeViewBlank): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::runJavaScriptAlert): (WebKit::WebChromeClient::runJavaScriptConfirm): (WebKit::WebChromeClient::runJavaScriptPrompt): Add flag to make sure pending async messages are processed *before* the JS prompt sync IPCs. Without this, it was possible for the UIProcess to receive the JS prompt IPC *before* the DidCommitLoadForFrame IPC, which would confuse our logic, since we would think this is a JS prompt for the previous page. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::sendSyncWithDelayedReply): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::didUpdateRendering): 2021-04-16 Russell Epstein <repstein@apple.com> Cherry-pick r274565. rdar://problem/76412930 Maybe-regression(STP121): window.open flakily returning null https://bugs.webkit.org/show_bug.cgi?id=222590 <rdar://problem/75211786> Reviewed by Geoffrey Garen. Source/WebKit: This was an IPC ordering bug. WebPageProxy::DidCommitLoadForFrame is async and WebPageProxy::CreateNewPage is sync. As a result, it was possible for the WebPageProxy::CreateNewPage to get processed *BEFORE* the WebPageProxy::DidCommitLoadForFrame IPC. This was causing trouble because Safari rejects the popup opening if the main frame is doing a provisional load. To address the issue, introduce a new IPC::SendSyncOption::MaintainOrderingWithAsyncMessages flag and use it on WebPageProxy::CreateNewPage sync IPC so that it gets processed in order with surrounding async messages. * Platform/IPC/Connection.cpp: (IPC::Connection::SyncMessageState::processIncomingMessage): (IPC::Connection::sendSyncMessage): * Platform/IPC/Connection.h: * Platform/IPC/Decoder.cpp: (IPC::Decoder::shouldMaintainOrderingWithAsyncMessages const): * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.cpp: (IPC::Encoder::setShouldMaintainOrderingWithAsyncMessages): * Platform/IPC/Encoder.h: * Platform/IPC/MessageFlags.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): Tools: Add API test coverage. * TestWebKitAPI/Tests/WebKit/ModalAlertsSPI.cpp: (TestWebKitAPI::TEST): (TestWebKitAPI::checkFrameLoadStateAndCreateNewPage): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274565 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-17 Chris Dumez <cdumez@apple.com> Maybe-regression(STP121): window.open flakily returning null https://bugs.webkit.org/show_bug.cgi?id=222590 <rdar://problem/75211786> Reviewed by Geoffrey Garen. This was an IPC ordering bug. WebPageProxy::DidCommitLoadForFrame is async and WebPageProxy::CreateNewPage is sync. As a result, it was possible for the WebPageProxy::CreateNewPage to get processed *BEFORE* the WebPageProxy::DidCommitLoadForFrame IPC. This was causing trouble because Safari rejects the popup opening if the main frame is doing a provisional load. To address the issue, introduce a new IPC::SendSyncOption::MaintainOrderingWithAsyncMessages flag and use it on WebPageProxy::CreateNewPage sync IPC so that it gets processed in order with surrounding async messages. * Platform/IPC/Connection.cpp: (IPC::Connection::SyncMessageState::processIncomingMessage): (IPC::Connection::sendSyncMessage): * Platform/IPC/Connection.h: * Platform/IPC/Decoder.cpp: (IPC::Decoder::shouldMaintainOrderingWithAsyncMessages const): * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.cpp: (IPC::Encoder::setShouldMaintainOrderingWithAsyncMessages): * Platform/IPC/Encoder.h: * Platform/IPC/MessageFlags.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): 2021-04-15 Russell Epstein <repstein@apple.com> Cherry-pick r275846. rdar://problem/76727548 Create WebIDBServer only when it is needed https://bugs.webkit.org/show_bug.cgi?id=224305 rdar://71962196 Reviewed by Alex Christensen. Currently each WebIDBServer has a separate thread, so we don't want to create or keep WebIDBServer if it's not in use. There are two cases where network process needs a WebIDBServer: 1. handle requests from UI process to collect or remove data 2. handle requests from Web process to perform IDB operations Previously, we created a WebIDBServer when network process connects to a web process, but that does not mean web process will perform IDB operations and we may create a thread that's not used. To avoid this, add a new message AddIDBConnection for web process to ensure network process has WebIDBServer when it's about to perform operation. Also, previously network process removes a WebIDBServer when session is removed and WebIDBServer is not binded with any web process connection. Now we remove WebIDBServer when it's done handling requests, that is count of pending requests from UI process is 0 and WebIDBServer is not binded with web process connection. We also remove WebIDBServer at when network process is about to be destroyed (NetworkProcess::didClose) so we can break the reference cycle of NetworkProcess-WebIDBServer-IDBServer, and make sure thread exits. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::create): (WebKit::WebIDBServer::WebIDBServer): (WebKit::m_closeCallback): (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::getOrigins): (WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince): (WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins): (WebKit::WebIDBServer::renameOrigin): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): (WebKit::WebIDBServer::tryClose): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::addIDBConnection): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::createWebIDBServer): (WebKit::NetworkProcess::connectionToWebProcessClosed): (WebKit::NetworkProcess::removeWebIDBServerIfPossible): Deleted. Move the removal code to WebIDBServer. * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275846 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-12 Sihui Liu <sihui_liu@apple.com> Create WebIDBServer only when it is needed https://bugs.webkit.org/show_bug.cgi?id=224305 rdar://71962196 Reviewed by Alex Christensen. Currently each WebIDBServer has a separate thread, so we don't want to create or keep WebIDBServer if it's not in use. There are two cases where network process needs a WebIDBServer: 1. handle requests from UI process to collect or remove data 2. handle requests from Web process to perform IDB operations Previously, we created a WebIDBServer when network process connects to a web process, but that does not mean web process will perform IDB operations and we may create a thread that's not used. To avoid this, add a new message AddIDBConnection for web process to ensure network process has WebIDBServer when it's about to perform operation. Also, previously network process removes a WebIDBServer when session is removed and WebIDBServer is not binded with any web process connection. Now we remove WebIDBServer when it's done handling requests, that is count of pending requests from UI process is 0 and WebIDBServer is not binded with web process connection. We also remove WebIDBServer at when network process is about to be destroyed (NetworkProcess::didClose) so we can break the reference cycle of NetworkProcess-WebIDBServer-IDBServer, and make sure thread exits. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::create): (WebKit::WebIDBServer::WebIDBServer): (WebKit::m_closeCallback): (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::getOrigins): (WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince): (WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins): (WebKit::WebIDBServer::renameOrigin): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): (WebKit::WebIDBServer::tryClose): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::addIDBConnection): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::createWebIDBServer): (WebKit::NetworkProcess::connectionToWebProcessClosed): (WebKit::NetworkProcess::removeWebIDBServerIfPossible): Deleted. Move the removal code to WebIDBServer. * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer): 2021-04-15 Russell Epstein <repstein@apple.com> Cherry-pick r275680. rdar://problem/76727557 Cache NSInvocation objects on _WKRemoteObjectInterface https://bugs.webkit.org/show_bug.cgi?id=224331 <rdar://75628393> Reviewed by Geoffrey Garen. Have _WKRemoteObjectInterface eagerly create the NSInvocation objects and store them instead of re-constructing them every time they are needed. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (decodeInvocation): * Shared/API/Cocoa/_WKRemoteObjectInterface.mm: (methodArgumentTypeEncodingForSelector): (initializeMethod): (-[_WKRemoteObjectInterface debugDescription]): (classesForSelectorArgument): (-[_WKRemoteObjectInterface _invocationForSelector:]): (-[_WKRemoteObjectInterface _invocationForReplyBlockOfSelector:]): (-[_WKRemoteObjectInterface _allowedArgumentClassesForReplyBlockOfSelector:]): * Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275680 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-08 Chris Dumez <cdumez@apple.com> Cache NSInvocation objects on _WKRemoteObjectInterface https://bugs.webkit.org/show_bug.cgi?id=224331 <rdar://75628393> Reviewed by Geoffrey Garen. Have _WKRemoteObjectInterface eagerly create the NSInvocation objects and store them instead of re-constructing them every time they are needed. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (decodeInvocation): * Shared/API/Cocoa/_WKRemoteObjectInterface.mm: (methodArgumentTypeEncodingForSelector): (initializeMethod): (-[_WKRemoteObjectInterface debugDescription]): (classesForSelectorArgument): (-[_WKRemoteObjectInterface _invocationForSelector:]): (-[_WKRemoteObjectInterface _invocationForReplyBlockOfSelector:]): (-[_WKRemoteObjectInterface _allowedArgumentClassesForReplyBlockOfSelector:]): * Shared/API/Cocoa/_WKRemoteObjectInterfaceInternal.h: 2021-04-15 Russell Epstein <repstein@apple.com> Cherry-pick r274377. rdar://problem/76412582 AX: PDF frame conversion routines need to be updated https://bugs.webkit.org/show_bug.cgi?id=223138 Reviewed by Darin Adler. PDF bounding boxes are wrong in WebKit because. 1) There's no way for PDF objects to get the primary screen height. So we need to be able to return the primary screen height from an object in the PDF hierarchy. 2) The WKPDFPluginAccessibilityObject's position was not being converted correctly. * WebProcess/Plugins/PDF/PDFPlugin.mm: (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]): (-[WKPDFPluginAccessibilityObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (WebKit::PDFPlugin::boundsOnScreen const): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274377 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-12 Chris Fleizach <cfleizach@apple.com> AX: PDF frame conversion routines need to be updated https://bugs.webkit.org/show_bug.cgi?id=223138 Reviewed by Darin Adler. PDF bounding boxes are wrong in WebKit because. 1) There's no way for PDF objects to get the primary screen height. So we need to be able to return the primary screen height from an object in the PDF hierarchy. 2) The WKPDFPluginAccessibilityObject's position was not being converted correctly. * WebProcess/Plugins/PDF/PDFPlugin.mm: (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]): (-[WKPDFPluginAccessibilityObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): (WebKit::PDFPlugin::boundsOnScreen const): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r274491. rdar://problem/76374243 Terminate network process when making new WebProcessPool in Lutron App https://bugs.webkit.org/show_bug.cgi?id=223194 <rdar://74674915> Reviewed by Geoff Garen. Source/WebCore: * platform/RuntimeApplicationChecks.h: * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::IOSApplication::isLutron): * platform/cocoa/VersionChecks.h: Source/WebKit: The Lutron App uses allocation of a new WKProcessPool as a way to stop using old session cookies. Since r267763 we keep the session cookies for the lifetime of a WKWebsiteDataStore instead of making a new process for each WKProcessPool. Add a quirk for this app until they update to use a new WKWebsiteDataStore or use WKHTTPCookieStore API to clear the cookies properly. I manually verified this causes the logging out to succeed. * UIProcess/WebProcessPool.cpp: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274491 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-16 Alex Christensen <achristensen@webkit.org> Terminate network process when making new WebProcessPool in Lutron App https://bugs.webkit.org/show_bug.cgi?id=223194 <rdar://74674915> Reviewed by Geoff Garen. The Lutron App uses allocation of a new WKProcessPool as a way to stop using old session cookies. Since r267763 we keep the session cookies for the lifetime of a WKWebsiteDataStore instead of making a new process for each WKProcessPool. Add a quirk for this app until they update to use a new WKWebsiteDataStore or use WKHTTPCookieStore API to clear the cookies properly. I manually verified this causes the logging out to succeed. * UIProcess/WebProcessPool.cpp: 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r274325. rdar://problem/76416354 Adopt VM_FLAGS_PERMANENT for the config vm mapping https://bugs.webkit.org/show_bug.cgi?id=222086 <rdar://74402690> Reviewed by Yusuke Suzuki and Mark Lam. Source/JavaScriptCore: * runtime/JSCConfig.h: (JSC::Config::configureForTesting): Source/WebKit: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): Source/WTF: * wtf/PlatformHave.h: * wtf/Threading.cpp: (WTF::initialize): * wtf/WTFConfig.cpp: (WTF::setPermissionsOfConfigPage): * wtf/WTFConfig.h: (WTF::setPermissionsOfConfigPage): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274325 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-11 Saam Barati <sbarati@apple.com> Adopt VM_FLAGS_PERMANENT for the config vm mapping https://bugs.webkit.org/show_bug.cgi?id=222086 <rdar://74402690> Reviewed by Yusuke Suzuki and Mark Lam. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r272707. rdar://problem/76375033 Use event loop to set title https://bugs.webkit.org/show_bug.cgi?id=218496 Patch by Rob Buis <rbuis@igalia.com> on 2021-02-10 Reviewed by Darin Adler. Source/WebCore: Use event loop to set title to avoid calling WebFrameLoaderClient within HTMLTitleElement::insertedIntoAncestor. * dom/Document.cpp: (WebCore::Document::updateTitle): * dom/Document.h: (WebCore::Document::titleWithDirection const): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::setTitle): * loader/EmptyClients.h: * page/Chrome.cpp: (WebCore::Chrome::print): * page/ChromeClient.h: Source/WebKit: Add title parameter to PrintFrame message. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::printFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::print): * WebProcess/WebCoreSupport/WebChromeClient.h: Source/WebKitLegacy/mac: Adjust to API change. * WebCoreSupport/WebChromeClient.h: * WebCoreSupport/WebChromeClient.mm: (WebChromeClient::print): Source/WebKitLegacy/win: Adjust to API change. * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::print): * WebCoreSupport/WebChromeClient.h: Tools: Adapt unit tests to wait for title change tasks to be processed. * TestWebKitAPI/Tests/WebKit/PageLoadState.cpp: (TestWebKitAPI::didChangeTitle): (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: (TEST): * TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp: (testWebViewAuthenticationFailure): (testWebViewAuthenticationNoCredential): (testWebViewAuthenticationSuccess): (testWebViewAuthenticationEmptyRealm): * TestWebKitAPI/Tests/WebKitGLib/TestBackForwardList.cpp: (testBackForwardListNavigation): * TestWebKitAPI/Tests/WebKitGLib/TestLoaderClient.cpp: (testWebViewTitle): * TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp: (testLoadFailedWithTLSErrors): * TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp: (testWebKitSettingsJavaScriptMarkup): * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp: (testWebViewTitleChange): LayoutTests: Adapt tests to make sure pending title change tasks are processed before the test is done. * TestExpectations: * fast/dom/title-text-property-2.html: * fast/dom/title-text-property-assigning-empty-string.html: * fast/dom/title-text-property.html: * http/tests/globalhistory/history-delegate-basic-title-expected.txt: * http/tests/globalhistory/history-delegate-basic-title.html: * http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt: * http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html: * http/tests/loading/redirect-with-no-location-crash-expected.txt: * http/tests/loading/redirect-with-no-location-crash.html: * platform/mac-wk2/TestExpectations: * platform/win/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt: Copied from LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt. * platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt: * platform/wk2/http/tests/loading/redirect-with-no-location-crash-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272707 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-10 Rob Buis <rbuis@igalia.com> Use event loop to set title https://bugs.webkit.org/show_bug.cgi?id=218496 Reviewed by Darin Adler. Add title parameter to PrintFrame message. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::printFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::print): * WebProcess/WebCoreSupport/WebChromeClient.h: 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r275625. rdar://problem/76375389 [Cocoa] Incorrect selector used to set logging level https://bugs.webkit.org/show_bug.cgi?id=224292 <rdar://problem/75379660> Reviewed by John Wilander. Use {public} declarations so we get logging in release builds. These strings are not sensitive. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275625 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-07 Brent Fulgham <bfulgham@apple.com> [Cocoa] Incorrect selector used to set logging level https://bugs.webkit.org/show_bug.cgi?id=224292 <rdar://problem/75379660> Reviewed by John Wilander. Use {public} declarations so we get logging in release builds. These strings are not sensitive. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r275622. rdar://problem/76375389 [Cocoa] Incorrect selector used to set logging level https://bugs.webkit.org/show_bug.cgi?id=224292 <rdar://problem/75379660> Reviewed by John Wilander. The wrong selector label was used to configure the low-level network logging level. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275622 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-07 Brent Fulgham <bfulgham@apple.com> [Cocoa] Incorrect selector used to set logging level https://bugs.webkit.org/show_bug.cgi?id=224292 <rdar://problem/75379660> Reviewed by John Wilander. The wrong selector label was used to configure the low-level network logging level. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r275474. rdar://problem/76416845 Protect frame in WebPage::runJavaScriptInFrameInScriptWorld() https://bugs.webkit.org/show_bug.cgi?id=224210 Reviewed by Alex Christensen. Between the time we were getting the raw pointer to the frame, and the time were were passing it to WebPage::runJavaScript(), we were potentially calling WebFrameLoaderClient::dispatchGlobalObjectAvailable(). It is possible in theory for those synchronous injected bundle calls to mess with the frame tree and cause our frame to go bad. As a result, it is best to protect the frame as soon as we get it. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScriptInFrameInScriptWorld): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275474 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-04-05 Chris Dumez <cdumez@apple.com> Protect frame in WebPage::runJavaScriptInFrameInScriptWorld() https://bugs.webkit.org/show_bug.cgi?id=224210 Reviewed by Alex Christensen. Between the time we were getting the raw pointer to the frame, and the time were were passing it to WebPage::runJavaScript(), we were potentially calling WebFrameLoaderClient::dispatchGlobalObjectAvailable(). It is possible in theory for those synchronous injected bundle calls to mess with the frame tree and cause our frame to go bad. As a result, it is best to protect the frame as soon as we get it. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScriptInFrameInScriptWorld): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r275341. rdar://problem/76375265 Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler can exceed the soft thread limit when opening multiple inspectors simultaneously. https://bugs.webkit.org/show_bug.cgi?id=223958 Reviewed by BJ Burg. In engineering builds, the Web Inspector is loaded as hundreds of separate resources instead of the handful of minified sources used for released builds. When two Web Inspector windows are opened their loads can overlap and it is possible for the sum total of file load operations to exceed the dispatch soft thread limit. To resolve this, we set a sensible limit to the number of simultaneous inspector loading operations. A higher number of allowed concurrent operations yielded no noticeable increase in load speeds. * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm: (-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275341 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-31 Patrick Angle <pangle@apple.com> Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler can exceed the soft thread limit when opening multiple inspectors simultaneously. https://bugs.webkit.org/show_bug.cgi?id=223958 Reviewed by BJ Burg. In engineering builds, the Web Inspector is loaded as hundreds of separate resources instead of the handful of minified sources used for released builds. When two Web Inspector windows are opened their loads can overlap and it is possible for the sum total of file load operations to exceed the dispatch soft thread limit. To resolve this, we set a sensible limit to the number of simultaneous inspector loading operations. A higher number of allowed concurrent operations yielded no noticeable increase in load speeds. * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm: (-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r275147. rdar://problem/76411207 Use-after-move in UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=223842 <rdar://problem/75791668> Reviewed by Eric Carlson. Source/WebKit: Use request decision handler instead of already moved completion handler. Tests: fast/speechrecognition/start-recognition-after-denied-gum.html fast/speechrecognition/start-recognition-after-gum.html * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition): LayoutTests: * fast/speechrecognition/start-recognition-after-denied-gum-expected.txt: Added. * fast/speechrecognition/start-recognition-after-denied-gum.html: Added. * fast/speechrecognition/start-recognition-after-gum-expected.txt: Added. * fast/speechrecognition/start-recognition-after-gum.html: Added. * platform/mac-wk1/TestExpectations: * platform/win/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275147 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-28 Youenn Fablet <youenn@apple.com> Use-after-move in UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=223842 <rdar://problem/75791668> Reviewed by Eric Carlson. Use request decision handler instead of already moved completion handler. Tests: fast/speechrecognition/start-recognition-after-denied-gum.html fast/speechrecognition/start-recognition-after-gum.html * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r275011. rdar://problem/76375300 Crash in TextChecker::updateSpellingUIWithGrammarString() https://bugs.webkit.org/show_bug.cgi?id=223716 Patch by Julian Gonzalez <julian_a_gonzalez@apple.com> on 2021-03-24 Reviewed by Ryosuke Niwa. Prevent a crash by checking the GrammarDetail's range. * UIProcess/mac/TextCheckerMac.mm: (WebKit::TextChecker::updateSpellingUIWithGrammarString): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275011 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-24 Julian Gonzalez <julian_a_gonzalez@apple.com> Crash in TextChecker::updateSpellingUIWithGrammarString() https://bugs.webkit.org/show_bug.cgi?id=223716 Reviewed by Ryosuke Niwa. Prevent a crash by checking the GrammarDetail's range. * UIProcess/mac/TextCheckerMac.mm: (WebKit::TextChecker::updateSpellingUIWithGrammarString): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r274697. rdar://problem/76375608 [Cocoa] Web Inspector: load inspector resources using a custom scheme handler https://bugs.webkit.org/show_bug.cgi?id=179904 <rdar://problem/10887211> Reviewed by Geoff Garen. Load WebInspectorUI resources via the inspector-resource:// scheme. Moving off of file:// URLs will allow for a tighter sandbox and will fix the longstanding issue that Web Inspector's settings are part of the file:// scheme and cleared when Safari clears website data. This also has the effect of resetting Web Inspector settings since they are no longer associated with file:///. Loading via this scheme is exercised by existing inspector tests. * SourcesCocoa.txt: Added new file. * WebKit.xcodeproj/project.pbxproj: * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.h: Copied from Source/WebKit/WebProcess/Inspector/mac/WebInspectorUIMac.mm. * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm: Added. (-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]): Use a global concurrent queue and NSOperation / NSOperationQueue to support reading files off the main queue. (-[WKInspectorResourceURLSchemeHandler webView:stopURLSchemeTask:]): Translate the request URL to a bundle resource URL, read the data, and send a response with the file data. Return an error if the file could not be found or read. * UIProcess/Inspector/mac/WKInspectorViewController.h: * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController webViewConfiguration]): (+[WKInspectorViewController URLForInspectorResource:]): (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]): Allow navigations to URIs with the inspector-resource:// scheme. * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::inspectorPageURL): (WebKit::WebInspectorProxy::inspectorTestPageURL): (WebKit::WebInspectorProxy::inspectorBaseURL): Updated. * WebProcess/Inspector/mac/WebInspectorUIMac.mm: (WebKit::webInspectorUILocalizedStringsURL): Updated. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274697 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-18 BJ Burg <bburg@apple.com> [Cocoa] Web Inspector: load inspector resources using a custom scheme handler https://bugs.webkit.org/show_bug.cgi?id=179904 <rdar://problem/10887211> Reviewed by Geoff Garen. Load WebInspectorUI resources via the inspector-resource:// scheme. Moving off of file:// URLs will allow for a tighter sandbox and will fix the longstanding issue that Web Inspector's settings are part of the file:// scheme and cleared when Safari clears website data. This also has the effect of resetting Web Inspector settings since they are no longer associated with file:///. Loading via this scheme is exercised by existing inspector tests. * SourcesCocoa.txt: Added new file. * WebKit.xcodeproj/project.pbxproj: * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.h: Copied from Source/WebKit/WebProcess/Inspector/mac/WebInspectorUIMac.mm. * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm: Added. (-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]): Use a global concurrent queue and NSOperation / NSOperationQueue to support reading files off the main queue. (-[WKInspectorResourceURLSchemeHandler webView:stopURLSchemeTask:]): Translate the request URL to a bundle resource URL, read the data, and send a response with the file data. Return an error if the file could not be found or read. * UIProcess/Inspector/mac/WKInspectorViewController.h: * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController webViewConfiguration]): (+[WKInspectorViewController URLForInspectorResource:]): (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]): Allow navigations to URIs with the inspector-resource:// scheme. * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::inspectorPageURL): (WebKit::WebInspectorProxy::inspectorTestPageURL): (WebKit::WebInspectorProxy::inspectorBaseURL): Updated. * WebProcess/Inspector/mac/WebInspectorUIMac.mm: (WebKit::webInspectorUILocalizedStringsURL): Updated. 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r274378. rdar://problem/76412648 [Cocoa][WebM] Hang when reloading page before WebM content is loaded https://bugs.webkit.org/show_bug.cgi?id=223139 <rdar://75351029> Reviewed by Darin Adler. No new tests; a truly deterministic test would require a .cgi script to block loading after the WebM init segment, but a bug in the platform format reader causes URLs not ending in .webm to fail to load the format reader plugin. Once this issue is fixed, we can write a test to cover this behavior. The WebM TrackEntry "enabled" bit is optional, and WebKit previously waited until any media data was appended to say whether or not the track is enabled in the absense of an explicit signal. Instead, assume any track that is not explicity disabled is enabled, for the purpose of the format reader. This means that "enabled" queries will no longer block, which breaks the deadlock when tearing down the AVAsset backing the WebM file. * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: (WebKit::MediaTrackReader::copyProperty): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274378 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-12 Jer Noble <jer.noble@apple.com> [Cocoa][WebM] Hang when reloading page before WebM content is loaded https://bugs.webkit.org/show_bug.cgi?id=223139 <rdar://75351029> Reviewed by Darin Adler. No new tests; a truly deterministic test would require a .cgi script to block loading after the WebM init segment, but a bug in the platform format reader causes URLs not ending in .webm to fail to load the format reader plugin. Once this issue is fixed, we can write a test to cover this behavior. The WebM TrackEntry "enabled" bit is optional, and WebKit previously waited until any media data was appended to say whether or not the track is enabled in the absense of an explicit signal. Instead, assume any track that is not explicity disabled is enabled, for the purpose of the format reader. This means that "enabled" queries will no longer block, which breaks the deadlock when tearing down the AVAsset backing the WebM file. * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: (WebKit::MediaTrackReader::copyProperty): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r273820. rdar://problem/76412727 Report the correct document uri in the case of a ContentSecurityPolicyClient https://bugs.webkit.org/show_bug.cgi?id=222489 <rdar://problem/73774118> Reviewed by Brent Fulgham. Source/WebCore: Tests: http/tests/security/contentSecurityPolicy/report-document-uri-after-blocked-redirect.html http/tests/security/contentSecurityPolicy/report-document-uri-blob.html Previously we were setting the document URI to be the blocked URI in the case where we were using a ContentSecurityPolicyClient and didn't have access to the document URL. This patch passes the document URL to the network process when loading a resource so we can properly set the document URI in this case. * page/csp/ContentSecurityPolicy.cpp: (WebCore::shouldReportProtocolOnly): (WebCore::ContentSecurityPolicy::deprecatedURLForReporting const): (WebCore::ContentSecurityPolicy::reportViolation const): Follow spec guidelines https://www.w3.org/TR/CSP2/#violation-reports and set the document URI to be the URI's scheme if it is a globally unique identifier. In the case where we are using a client and don't have the document URL, we should at least strip the blocked URL before reporting to align with the spec. * page/csp/ContentSecurityPolicy.h: (WebCore::ContentSecurityPolicy::setDocumentURL): Source/WebKit: Pass the document URL from the Network Process when we schedule a load in case we need to report a CSP violation in NetworkLoadChecker. * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::NetworkLoadChecker): (WebKit::NetworkLoadChecker::contentSecurityPolicy): The regular toString() method sets file:// URLs to null. We should use toRawString() so we can report the scheme if the source origin is a local file, as per the W3C spec. * NetworkProcess/NetworkLoadChecker.h: * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::PingLoad): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Tools: Rename OverrideContentSecurityPolicy.mm to ContentSecurityPolicy.mm so we can use it for more general purpose CSP testing. Add a test for document-uri reporting for file:, data: and about: protocols. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebKitCocoa/ContentSecurityPolicy.mm: Renamed from Tools/TestWebKitAPI/Tests/WebKitCocoa/OverrideContentSecurityPolicy.mm. (TEST): * TestWebKitAPI/Tests/WebKitCocoa/csp-document-uri-report.html: Added. LayoutTests: Layout test coverage for redirects using a ContentSecurityPolicyClient and blob files. * http/tests/security/contentSecurityPolicy/report-document-uri-blob-expected.txt: Added. * http/tests/security/contentSecurityPolicy/report-document-uri-blob.html: Added. * http/tests/security/contentSecurityPolicy/report-document-uri-after-blocked-redirect-expected.txt: Added. * http/tests/security/contentSecurityPolicy/report-document-uri-after-blocked-redirect.html: Added. * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-document-uri-after-blocked-redirect-expected.txt: Added. * platform/win/http/tests/security/contentSecurityPolicy/report-document-uri-after-blocked-redirect-expected.txt: Added. * platform/win/TestExpectations: Blob URLs timeout on win. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273820 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-03 Kate Cheney <katherine_cheney@apple.com> Report the correct document uri in the case of a ContentSecurityPolicyClient https://bugs.webkit.org/show_bug.cgi?id=222489 <rdar://problem/73774118> Reviewed by Brent Fulgham. Pass the document URL from the Network Process when we schedule a load in case we need to report a CSP violation in NetworkLoadChecker. * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::NetworkLoadChecker): (WebKit::NetworkLoadChecker::contentSecurityPolicy): The regular toString() method sets file:// URLs to null. We should use toRawString() so we can report the scheme if the source origin is a local file, as per the W3C spec. * NetworkProcess/NetworkLoadChecker.h: * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::PingLoad): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r273367. rdar://problem/76375686 [iOS] Add null checks for Node before accessing treeScope() in rangeForPointInRootViewCoordinates https://bugs.webkit.org/show_bug.cgi?id=222338 <rdar://problem/72292289> Reviewed by Tim Horton. Add a null check for the hit test result's `targetNode` inside `rangeForPointInRootViewCoordinates()` to avoid crashing in the case where the target node is null and either `result <= selectionStart` is `false` or `selectionEnd <= result` is `false`. Additionally, avoid a potential null deref on `selectionStart.deepEquivalent().anchorNode()` and `selectionEnd.deepEquivalent().anchorNode()` by using `Position::treeScope()` (which null checks the anchor node) instead of directly asking the anchor node. Note that the call sites of `rangeForPointInRootViewCoordinates()` already handle a `WTF::nullopt` return value gracefully, by skipping the selection update. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273367 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-23 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Add null checks for Node before accessing treeScope() in rangeForPointInRootViewCoordinates https://bugs.webkit.org/show_bug.cgi?id=222338 <rdar://problem/72292289> Reviewed by Tim Horton. Add a null check for the hit test result's `targetNode` inside `rangeForPointInRootViewCoordinates()` to avoid crashing in the case where the target node is null and either `result <= selectionStart` is `false` or `selectionEnd <= result` is `false`. Additionally, avoid a potential null deref on `selectionStart.deepEquivalent().anchorNode()` and `selectionEnd.deepEquivalent().anchorNode()` by using `Position::treeScope()` (which null checks the anchor node) instead of directly asking the anchor node. Note that the call sites of `rangeForPointInRootViewCoordinates()` already handle a `WTF::nullopt` return value gracefully, by skipping the selection update. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): 2021-04-08 Russell Epstein <repstein@apple.com> Cherry-pick r272910. rdar://problem/76416446 Set a default path for device ID hash salts https://bugs.webkit.org/show_bug.cgi?id=221955 Reviewed by Eric Carlson. Source/WebKit: The default path was the empty string, which leads to not persist device IDs. Update this to provide a valid default path like for other persisting data types. Covered by API test. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): * UIProcess/WebsiteData/WebsiteDataStore.cpp: Tools: * TestWebKitAPI/Tests/WebKit/GetUserMediaNavigation.mm: (TestWebKitAPI::TEST): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272910 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-02-16 Youenn Fablet <youenn@apple.com> Set a default path for device ID hash salts https://bugs.webkit.org/show_bug.cgi?id=221955 Reviewed by Eric Carlson. The default path was the empty string, which leads to not persist device IDs. Update this to provide a valid default path like for other persisting data types. Covered by API test. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): * UIProcess/WebsiteData/WebsiteDataStore.cpp: 2021-03-15 Alan Coon <alancoon@apple.com> Cherry-pick r274439. rdar://problem/75450678 Enforce subcommand filtering https://bugs.webkit.org/show_bug.cgi?id=223192 <rdar://75434409> 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 <pvollan@apple.com> Enforce subcommand filtering https://bugs.webkit.org/show_bug.cgi?id=223192 <rdar://75434409> 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-15 Alan Coon <alancoon@apple.com> Cherry-pick r274295. rdar://problem/75450678 [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 <pvollan@apple.com> [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-10 Alan Coon <alancoon@apple.com> Cherry-pick r274231. rdar://problem/75291920 [iOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223035 <rdar://75275161> 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 <pvollan@apple.com> [iOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223035 <rdar://75275161> Reviewed by Geoffrey Garen. Add additional telemetry to WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-03-31 Kocsen Chung <kocsen_chung@apple.com> Cherry-pick r275316. rdar://problem/76078629 REGRESSION: The NetworkProcess fails to relaunch after it crashes https://bugs.webkit.org/show_bug.cgi?id=224022 <rdar://75148724> 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 <cdumez@apple.com> REGRESSION: The NetworkProcess fails to relaunch after it crashes https://bugs.webkit.org/show_bug.cgi?id=224022 <rdar://75148724> 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 <repstein@apple.com> Cherry-pick r274129. rdar://problem/75744624 Regression(r273875): Potential over-release in WKRemoteObjectCoder's decodeObjCObject() https://bugs.webkit.org/show_bug.cgi?id=222954 <rdar://75163359> 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 <cdumez@apple.com> Regression(r273875): Potential over-release in WKRemoteObjectCoder's decodeObjCObject() https://bugs.webkit.org/show_bug.cgi?id=222954 <rdar://75163359> 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 <repstein@apple.com> Cherry-pick r274790. rdar://problem/75712649 Allow additional fcntl https://bugs.webkit.org/show_bug.cgi?id=223590 <rdar://problem/75702241> 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 <pvollan@apple.com> Allow additional fcntl https://bugs.webkit.org/show_bug.cgi?id=223590 <rdar://problem/75702241> 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 <repstein@apple.com> 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: <rdar://problem/72103865> Patch by Alex Christensen <achristensen@webkit.org> 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 <achristensen@webkit.org> 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 <achristensen@webkit.org> WKRemoteObjectCoder should be able to handle NSErrors from TLS failures https://bugs.webkit.org/show_bug.cgi?id=222401 <rdar://problem/72103865> 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 <repstein@apple.com> Apply patch. rdar://problem/75625529 2021-03-19 Per Arne Vollan <pvollan@apple.com> [macOS] Reduce telemetry backtrace in sandbox https://bugs.webkit.org/show_bug.cgi?id=223515 <rdar://problem/75620362> Reviewed by Brent Fulgham. Reduce telemetry backtrace in the WebContent sandbox on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2021-03-16 Alan Coon <alancoon@apple.com> Cherry-pick r274504. rdar://problem/75482851 The WebContent process crashes when launching Safari https://bugs.webkit.org/show_bug.cgi?id=223264 <rdar://75482851> 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 <pvollan@apple.com> The WebContent process crashes when launching Safari https://bugs.webkit.org/show_bug.cgi?id=223264 <rdar://75482851> 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 <rubent_22@apple.com> 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 <rdar://75440378> * 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 <cdumez@apple.com> Unreviewed, revert r272629 as it caused regressions in some apps https://bugs.webkit.org/show_bug.cgi?id=223232 <rdar://75440378> * 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 <rubent_22@apple.com> Cherry-pick r274439. rdar://problem/75450672 Enforce subcommand filtering https://bugs.webkit.org/show_bug.cgi?id=223192 <rdar://75434409> 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 <pvollan@apple.com> Enforce subcommand filtering https://bugs.webkit.org/show_bug.cgi?id=223192 <rdar://75434409> 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 <repstein@apple.com> Cherry-pick r274231. rdar://problem/75290553 [iOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223035 <rdar://75275161> 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 <pvollan@apple.com> [iOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223035 <rdar://75275161> 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 <rubent_22@apple.com> 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 <pvollan@apple.com> [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 <repstein@apple.com> 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 <cdumez@apple.com> 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 <alancoon@apple.com> Cherry-pick r273695. rdar://problem/74940739 Crash under WebProcessPool::pageBeginUsingWebsiteDataStore() https://bugs.webkit.org/show_bug.cgi?id=222574 <rdar://68340471> 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 <cdumez@apple.com> Crash under WebProcessPool::pageBeginUsingWebsiteDataStore() https://bugs.webkit.org/show_bug.cgi?id=222574 <rdar://68340471> 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 <alancoon@apple.com> Cherry-pick r273564. rdar://problem/74886917 [Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created https://bugs.webkit.org/show_bug.cgi?id=222473 <rdar://problem/74790242> 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 <pvollan@apple.com> [Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created https://bugs.webkit.org/show_bug.cgi?id=222473 <rdar://problem/74790242> 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 <kocsen_chung@apple.com> 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 <rdar://problem/74612589> 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<OperatingDate> m_longWindowOperatingDate - Optional<OperatingDate> 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 <wilander@apple.com> Non-cookie website data not deleted after 7 days of browser use without user interaction https://bugs.webkit.org/show_bug.cgi?id=222248 <rdar://problem/74612589> 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<OperatingDate> m_longWindowOperatingDate - Optional<OperatingDate> 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-03-31 Russell Epstein <repstein@apple.com> Cherry-pick r275316. rdar://problem/76077169 REGRESSION: The NetworkProcess fails to relaunch after it crashes https://bugs.webkit.org/show_bug.cgi?id=224022 <rdar://75148724> 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 <cdumez@apple.com> REGRESSION: The NetworkProcess fails to relaunch after it crashes https://bugs.webkit.org/show_bug.cgi?id=224022 <rdar://75148724> 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-24 Ruben Turcios <rubent_22@apple.com> Apply patch. rdar://problem/75744524 Aply patch. rdar://75744524 2021-03-24 Per Arne Vollan <pvollan@apple.com> [iOS] Read access to passwd is required https://bugs.webkit.org/show_bug.cgi?id=223641 <rdar://75616105> Reviewed by Brent Fulgham. The WebContent sandbox on iOS should allow reading the passwd file. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-03-24 Ruben Turcios <rubent_22@apple.com> Cherry-pick r274766. rdar://problem/75762455 Add an early return in UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList https://bugs.webkit.org/show_bug.cgi?id=223571 Reviewed by Eric Carlson. Update code to early return as soon as possible. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274766 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-22 Youenn Fablet <youenn@apple.com> Add an early return in UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList https://bugs.webkit.org/show_bug.cgi?id=223571 Reviewed by Eric Carlson. Update code to early return as soon as possible. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): 2021-03-22 Russell Epstein <repstein@apple.com> Cherry-pick r274790. rdar://problem/75712637 Allow additional fcntl https://bugs.webkit.org/show_bug.cgi?id=223590 <rdar://problem/75702241> 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 <pvollan@apple.com> Allow additional fcntl https://bugs.webkit.org/show_bug.cgi?id=223590 <rdar://problem/75702241> 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-16 Alan Coon <alancoon@apple.com> Cherry-pick r274462. rdar://problem/75485320 Unreviewed, revert r272629 as it caused regressions in some apps https://bugs.webkit.org/show_bug.cgi?id=223232 <rdar://75440378> * 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 <cdumez@apple.com> Unreviewed, revert r272629 as it caused regressions in some apps https://bugs.webkit.org/show_bug.cgi?id=223232 <rdar://75440378> * 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 Russell Epstein <repstein@apple.com> Cherry-pick r274439. rdar://problem/75450660 Enforce subcommand filtering https://bugs.webkit.org/show_bug.cgi?id=223192 <rdar://75434409> 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 <pvollan@apple.com> Enforce subcommand filtering https://bugs.webkit.org/show_bug.cgi?id=223192 <rdar://75434409> 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-15 Russell Epstein <repstein@apple.com> Cherry-pick r274295. rdar://problem/75450660 [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 <pvollan@apple.com> [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-10 Ruben Turcios <rubent_22@apple.com> Revert r271193. rdar://problem/75273221 2021-03-10 Ruben Turcios <rubent_22@apple.com> Cherry-pick r274231. rdar://problem/75279800 [iOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223035 <rdar://75275161> 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 <pvollan@apple.com> [iOS] Add additional telemetry to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=223035 <rdar://75275161> Reviewed by Geoffrey Garen. Add additional telemetry to WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-03-08 Russell Epstein <repstein@apple.com> Cherry-pick r273997. rdar://problem/75180327 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 <cdumez@apple.com> 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-08 Russell Epstein <repstein@apple.com> Cherry-pick r274051. rdar://problem/75178467 [WebAuthn] Expand WebAuthn Process's sandbox profile on iOS https://bugs.webkit.org/show_bug.cgi?id=222858 <rdar://problem/74772012> Reviewed by Brent Fulgham. Allows WebAuthn process to use AAA again. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274051 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-03-06 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Expand WebAuthn Process's sandbox profile on iOS https://bugs.webkit.org/show_bug.cgi?id=222858 <rdar://problem/74772012> Reviewed by Brent Fulgham. Allows WebAuthn process to use AAA again. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: 2021-03-01 Alan Coon <alancoon@apple.com> Cherry-pick r273564. rdar://problem/74886738 [Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created https://bugs.webkit.org/show_bug.cgi?id=222473 <rdar://problem/74790242> 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 <pvollan@apple.com> [Cocoa] Register VP9 decoders when PlatformMediaSessionManager is created https://bugs.webkit.org/show_bug.cgi?id=222473 <rdar://problem/74790242> 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 Alan Coon <alancoon@apple.com> Cherry-pick r273590. rdar://problem/74881366 Non-cookie website data not deleted after 7 days of browser use without user interaction https://bugs.webkit.org/show_bug.cgi?id=222248 <rdar://problem/74612589> 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<OperatingDate> m_longWindowOperatingDate - Optional<OperatingDate> 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 <wilander@apple.com> Non-cookie website data not deleted after 7 days of browser use without user interaction https://bugs.webkit.org/show_bug.cgi?id=222248 <rdar://problem/74612589> 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<OperatingDate> m_longWindowOperatingDate - Optional<OperatingDate> 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 <repstein@apple.com> 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 <pvollan@apple.com> [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 <cdumez@apple.com> 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 <alancoon@apple.com> 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 <graouts@webkit.org> 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 <alancoon@apple.com> 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 <peng.liu6@apple.com> [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 <repstein@apple.com> Cherry-pick r272935. rdar://problem/74500849 REGRESSION(r266890): [Cocoa] Fix InspectorDelegate / API::InspectorClient leak https://bugs.webkit.org/show_bug.cgi?id=221988 <rdar://73594555> 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 <bburg@apple.com> REGRESSION(r266890): [Cocoa] Fix InspectorDelegate / API::InspectorClient leak https://bugs.webkit.org/show_bug.cgi?id=221988 <rdar://73594555> 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 <repstein@apple.com> 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 <rdar://problem/67698601> 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 <cdumez@apple.com> Make sure we are no longer show the previous page when running a JS prompt https://bugs.webkit.org/show_bug.cgi?id=215782 <rdar://problem/67698601> 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 <alancoon@apple.com> 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 <pvollan@apple.com> [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 <alancoon@apple.com> Cherry-pick r273289. rdar://problem/74623623 UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 <rdar://74480265> 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 <eric.carlson@apple.com> UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 <rdar://74480265> Unreviewed, address post-review comment. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): Use captured `this`. 2021-02-23 Alan Coon <alancoon@apple.com> 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 <rdar://problem/74402532> 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 <pvollan@apple.com> [Cocoa] Send sandbox extensions for Network Extension services in load parameters https://bugs.webkit.org/show_bug.cgi?id=222284 <rdar://problem/74402532> 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 <alancoon@apple.com> Cherry-pick r273271. rdar://problem/74622914 [macOS] Crash under AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=222233 <rdar://problem/74261611> 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 <pvollan@apple.com> [macOS] Crash under AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=222233 <rdar://problem/74261611> 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 <alancoon@apple.com> Cherry-pick r273265. rdar://problem/74623623 UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 <rdar://74480265> 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 <eric.carlson@apple.com> UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 <rdar://74480265> Reviewed by Youenn Fablet. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): Return early if `weakThis` is NULL. 2021-02-23 Alan Coon <alancoon@apple.com> Cherry-pick r273196. rdar://problem/74623520 Crash under Decoder::Decoder() https://bugs.webkit.org/show_bug.cgi?id=222192 <rdar://31392681> 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 <cdumez@apple.com> Crash under Decoder::Decoder() https://bugs.webkit.org/show_bug.cgi?id=222192 <rdar://31392681> 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 <alancoon@apple.com> Cherry-pick r273180. rdar://problem/74623601 CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper<WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests() https://bugs.webkit.org/show_bug.cgi?id=222201 Patch by Alex Christensen <achristensen@webkit.org> 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 <achristensen@webkit.org> CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper<WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests() https://bugs.webkit.org/show_bug.cgi?id=222201 Reviewed by Chris Dumez. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): 2021-02-18 Ruben Turcios <rubent_22@apple.com> 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 <timothy_horton@apple.com> 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 <rubent_22@apple.com> 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 <sihui_liu@appe.com> 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 <sihui_liu@appe.com> 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 <rubent_22@apple.com> 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 <sihui_liu@appe.com> 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 <sihui_liu@appe.com> 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 <rubent_22@apple.com> 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 <sihui_liu@appe.com> 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 <sihui_liu@appe.com> 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 <rubent_22@apple.com> 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 <youenn@apple.com> 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 <alancoon@apple.com> 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 <cdumez@apple.com> 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 <alancoon@apple.com> Revert r246382. rdar://problem/74501060 2021-02-17 Alan Coon <alancoon@apple.com> 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 <rdar://problem/73541303> 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 <jiewen_tan@apple.com> [WebAuthn] Allow one user gesture free prompt for each navigation https://bugs.webkit.org/show_bug.cgi?id=220897 <rdar://problem/73541303> 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 <rubent_22@apple.com> Cherry-pick r272723. rdar://problem/74410353 [macOS] Add syscall to allow list in WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=221705 <rdar://problem/74162777> 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 <pvollan@apple.com> [macOS] Add syscall to allow list in WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=221705 <rdar://problem/74162777> 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 <rubent_22@apple.com> 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 <simon.fraser@apple.com> 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 <rubent_22@apple.com> Cherry-pick r272550. rdar://problem/74409264 Make the UserContentController for ServiceWorker pages be non-optional. <rdar://problem/71434565> 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 <beidson@apple.com> Make the UserContentController for ServiceWorker pages be non-optional. <rdar://problem/71434565> 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 <rubent_22@apple.com> Cherry-pick r272506. rdar://problem/74409747 Check that CGPDFDocumentRef is consistently unlocked and printable <https://webkit.org/b/221512> <rdar://problem/65277765> 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 <ddkilzer@apple.com> Check that CGPDFDocumentRef is consistently unlocked and printable <https://webkit.org/b/221512> <rdar://problem/65277765> 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 <rubent_22@apple.com> 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 <rdar://problem/67069819> 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 <katherine_cheney@apple.com> CrashTracer: com.apple.WebKit.Networking at WebKit: WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource https://bugs.webkit.org/show_bug.cgi?id=221432 <rdar://problem/67069819> 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 <alancoon@apple.com> Revert r272541. rdar://problem/74208306 2021-02-08 Russell Epstein <repstein@apple.com> 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 <rdar://problem/73541303> 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 <jiewen_tan@apple.com> [WebAuthn] Allow one user gesture free prompt for each navigation https://bugs.webkit.org/show_bug.cgi?id=220897 <rdar://problem/73541303> 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 <repstein@apple.com> Cherry-pick r272184. rdar://problem/74032500 [WebAuthn] Optimize _WKWebAuthenticationPanelDelegate for native API https://bugs.webkit.org/show_bug.cgi?id=221125 <rdar://problem/71509141> 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 <jiewen_tan@apple.com> [WebAuthn] Optimize _WKWebAuthenticationPanelDelegate for native API https://bugs.webkit.org/show_bug.cgi?id=221125 <rdar://problem/71509141> 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 <repstein@apple.com> 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 <rdar://problem/70896640> 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 <youenn@apple.com> Make sure click attribution is processed in case of redirected kept alive loads https://bugs.webkit.org/show_bug.cgi?id=221453 <rdar://problem/70896640> Reviewed by John Wilander. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): Move the click attribution processing before kept alive check. 2021-02-08 Russell Epstein <repstein@apple.com> Cherry-pick r272376. rdar://problem/74032694 REGRESSION(r267763) Network process launches earlier than before https://bugs.webkit.org/show_bug.cgi?id=221384 <rdar://problem/73507706> Patch by Alex Christensen <achristensen@apple.com> 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 <achristensen@apple.com> REGRESSION(r267763) Network process launches earlier than before https://bugs.webkit.org/show_bug.cgi?id=221384 <rdar://problem/73507706> 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 <repstein@apple.com> 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 <rdar://problem/73943517> 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 <akeerthi@apple.com> [macOS] Selecting a date on datetime-local inputs unexpectedly adds second and millisecond fields https://bugs.webkit.org/show_bug.cgi?id=221350 <rdar://problem/73943517> 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 <repstein@apple.com> 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 <rdar://73471690> 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 <jer.noble@apple.com> [Cocoa] WebM audio goes out-of-sync or stops playing after a seek https://bugs.webkit.org/show_bug.cgi?id=221354 <rdar://73471690> 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 <repstein@apple.com> 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 <rdar://problem/73902668> 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 <katherine_cheney@apple.com> PCM: earliestTimeToSend should be treated as an independent time value, not relative to timeOfAdClick https://bugs.webkit.org/show_bug.cgi?id=221303 <rdar://problem/73902668> 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 <repstein@apple.com> Cherry-pick r272335. rdar://problem/74032694 REGRESSION (r270392): Launch time regression under IOSurface::maximumSize() https://bugs.webkit.org/show_bug.cgi?id=221346 <rdar://problem/73507706> 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 <timothy_horton@apple.com> REGRESSION (r270392): Launch time regression under IOSurface::maximumSize() https://bugs.webkit.org/show_bug.cgi?id=221346 <rdar://problem/73507706> 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 <repstein@apple.com> 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 <drousso@apple.com> [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 <repstein@apple.com> Cherry-pick r272212. rdar://problem/74032657 Make sure NetworkRTCProvider stays valid for all NetworkRTCSocketCocoa callbacks https://bugs.webkit.org/show_bug.cgi?id=221249 <rdar://problem/72671547> 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 <youenn@apple.com> Make sure NetworkRTCProvider stays valid for all NetworkRTCSocketCocoa callbacks https://bugs.webkit.org/show_bug.cgi?id=221249 <rdar://problem/72671547> 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 <repstein@apple.com> 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 <graouts@webkit.org> 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 <repstein@apple.com> Cherry-pick r271908. rdar://problem/74032594 Harden NetworkProcess against integer overflow in CacheStorageEngine size calculation https://bugs.webkit.org/show_bug.cgi?id=220997 <rdar://problem/66116827> 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 <bfulgham@apple.com> Harden NetworkProcess against integer overflow in CacheStorageEngine size calculation https://bugs.webkit.org/show_bug.cgi?id=220997 <rdar://problem/66116827> 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 <repstein@apple.com> Cherry-pick r272229. rdar://problem/73907002 REGRESSION(r271744): Broke Microsoft live login in internal builds https://bugs.webkit.org/show_bug.cgi?id=221271 <rdar://problem/73848416> 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 <katherine_cheney@apple.com> REGRESSION(r271744): Broke Microsoft live login in internal builds https://bugs.webkit.org/show_bug.cgi?id=221271 <rdar://problem/73848416> 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 <alancoon@apple.com> 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 <rdar://73474368> 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 <cdumez@apple.com> Update availability annotations to match the macOS 11.0 and iOS 14.0 GM SDKs https://bugs.webkit.org/show_bug.cgi?id=220874 <rdar://73474368> 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 <alancoon@apple.com> 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 <rdar://problem/73538568> 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 <jiewen_tan@apple.com> [WebAuthn] Adopt new SPI to show no credentials error for the platform authenticator https://bugs.webkit.org/show_bug.cgi?id=220894 <rdar://problem/73538568> 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 <alancoon@apple.com> 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 <kkinnunen@apple.com> 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 <kkinnunen@apple.com> 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 <alancoon@apple.com> Cherry-pick r272072. rdar://problem/73890534 [iOS] Stop observing changes in one preference domain https://bugs.webkit.org/show_bug.cgi?id=221130 <rdar://problem/70729182> 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 <pvollan@apple.com> [iOS] Stop observing changes in one preference domain https://bugs.webkit.org/show_bug.cgi?id=221130 <rdar://problem/70729182> 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 <alancoon@apple.com> 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 <rdar://problem/72154830> 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 <bfulgham@apple.com> REGRESSION(r261238): WKWebView crashes on launch inside a quicklook preview https://bugs.webkit.org/show_bug.cgi?id=219632 <rdar://problem/72154830> 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 <alancoon@apple.com> 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 <rdar://problem/68204552> 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 <bfulgham@apple.com> [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 <rdar://problem/68204552> 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 <alancoon@apple.com> 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 <rdar://problem/73239409> 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 <akeerthi@apple.com> [iOS] Obscured elements should not be focusable using the accessory bar https://bugs.webkit.org/show_bug.cgi?id=220929 <rdar://problem/73239409> 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 <alancoon@apple.com> 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 <rdar://71177566> 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 <simon.fraser@apple.com> [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 <rdar://71177566> 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 <alancoon@apple.com> 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<ViewStabilityFlag>. 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 <simon.fraser@apple.com> [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<ViewStabilityFlag>. 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 <alancoon@apple.com> 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 <rdar://problem/73378319> 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 <jiewen_tan@apple.com> [WebAuthn] No error is visible after user enters the incorrect PIN https://bugs.webkit.org/show_bug.cgi?id=220839 <rdar://problem/73378319> 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 <alancoon@apple.com> 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 <peng.liu6@apple.com> 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 <alancoon@apple.com> 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 <rdar://70602577> 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 <jer.noble@apple.com> [Mac] Netflix controls do not fade out after entering fullscreen https://bugs.webkit.org/show_bug.cgi?id=220472 <rdar://70602577> 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 <alancoon@apple.com> 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 <rdar://problem/72910000> 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 <aestes@apple.com> [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 <rdar://problem/72910000> 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 <alancoon@apple.com> 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 <rdar://problem/64984186> 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 <bfulgham@apple.com> IPC::Decoder constructor should mark the Decoder as invalid if header decoding fails https://bugs.webkit.org/show_bug.cgi?id=220990 <rdar://problem/64984186> 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 <alancoon@apple.com> 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 <peng.liu6@apple.com> 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 <alancoon@apple.com> 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 <rdar://problem/71713611> 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 <wenson_hsieh@apple.com> [macOS] "Correct Spelling Automatically" menu items are inconsistent when autocorrect="off" https://bugs.webkit.org/show_bug.cgi?id=220598 <rdar://problem/71713611> 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 <alancoon@apple.com> 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 <rdar://problem/71602937> 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 <wenson_hsieh@apple.com> REGRESSION (r265044): [macOS] Safari autocorrects text when typing in login field on amazon.com https://bugs.webkit.org/show_bug.cgi?id=220556 <rdar://problem/71602937> 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 <alancoon@apple.com> Cherry-pick r271384. rdar://problem/73473494 Crash in pageDidComputePageRects() https://bugs.webkit.org/show_bug.cgi?id=220518 <rdar://problem/71065870> 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 <katherine_cheney@apple.com> Crash in pageDidComputePageRects() https://bugs.webkit.org/show_bug.cgi?id=220518 <rdar://problem/71065870> 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 <alancoon@apple.com> Cherry-pick r271374. rdar://problem/73477142 Web Inspector: add nullptr check for WebInspectorProxy::m_extensionsController https://bugs.webkit.org/show_bug.cgi?id=220485 <rdar://72496401> 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 <bburg@apple.com> Web Inspector: add nullptr check for WebInspectorProxy::m_extensionsController https://bugs.webkit.org/show_bug.cgi?id=220485 <rdar://72496401> Reviewed by Devin Rousso. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::frontendLoaded): 2021-01-29 Alan Coon <alancoon@apple.com> 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 <youenn@apple.com> 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 <alancoon@apple.com> 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 <achristensen@webkit.org> 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 <achristensen@webkit.org> 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 <alancoon@apple.com> 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<Parent>::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 <shvaikalesh@gmail.com> 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 <alancoon@apple.com> 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 <rdar://problem/73382584> 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 <pvollan@apple.com> [macOS] The development WebContent XPC service crashes under WebKit::AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=220777 <rdar://problem/73382584> 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 <alancoon@apple.com> 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 <rdar://problem/73375937> 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 <jiewen_tan@apple.com> [WebAuthn] Should only check default browsers for the Modern WebAuthn https://bugs.webkit.org/show_bug.cgi?id=220840 <rdar://problem/73375937> Reviewed by Brent Fulgham. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): 2021-01-25 Alan Coon <alancoon@apple.com> Cherry-pick r271613. rdar://problem/73477407 [WebAuthn] Polish the new WebAuthn UI https://bugs.webkit.org/show_bug.cgi?id=220617 <rdar://problem/73185470> 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 <jiewen_tan@apple.com> [WebAuthn] Polish the new WebAuthn UI https://bugs.webkit.org/show_bug.cgi?id=220617 <rdar://problem/73185470> 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 <alancoon@apple.com> 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 <rdar://problem/72940505> Patch by Alex Christensen <achristensen@webkit.org> 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 <achristensen@webkit.org> REGRESSION(r267763) Uploading zipped directories does not work on iOS https://bugs.webkit.org/show_bug.cgi?id=220666 <rdar://problem/72940505> 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 <alancoon@apple.com> Cherry-pick r271486. rdar://problem/73478688 Use callOnMainRunLoop in MediaPermissionUtilities https://bugs.webkit.org/show_bug.cgi?id=220616 <rdar://problem/73002655> 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 <youenn@apple.com> Use callOnMainRunLoop in MediaPermissionUtilities https://bugs.webkit.org/show_bug.cgi?id=220616 <rdar://problem/73002655> 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 <alancoon@apple.com> Cherry-pick r271473. rdar://problem/73478401 PCM: Output logs by default, including to Web Inspector https://bugs.webkit.org/show_bug.cgi?id=220596 <rdar://problem/73159180> 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 <wilander@apple.com> PCM: Output logs by default, including to Web Inspector https://bugs.webkit.org/show_bug.cgi?id=220596 <rdar://problem/73159180> 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 <alancoon@apple.com> 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 <rdar://68227709> 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 <jer.noble@apple.com> [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 <alancoon@apple.com> Cherry-pick r271467. rdar://problem/73477045 Crash at SOAuthorizationSession::dismissViewController https://bugs.webkit.org/show_bug.cgi?id=220482 <rdar://problem/72375494> 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 <jiewen_tan@apple.com> Crash at SOAuthorizationSession::dismissViewController https://bugs.webkit.org/show_bug.cgi?id=220482 <rdar://problem/72375494> 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 <alancoon@apple.com> Cherry-pick r271417. rdar://problem/73376369 [macOS] Reset user directory suffix before getting sandbox directory https://bugs.webkit.org/show_bug.cgi?id=220358 <rdar://problem/57616019> 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 <pvollan@apple.com> [macOS] Reset user directory suffix before getting sandbox directory https://bugs.webkit.org/show_bug.cgi?id=220358 <rdar://problem/57616019> 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 <alancoon@apple.com> 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 <rdar://problem/68400471> 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 <wenson_hsieh@apple.com> [iOS] Emoji keyboard covers text field on twitter.com/messages https://bugs.webkit.org/show_bug.cgi?id=220664 <rdar://problem/68400471> 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 <alancoon@apple.com> Cherry-pick r271497. rdar://problem/73469623 Exceptions thrown when invoking a <select> on an iPhone-idiom app running on macOS https://bugs.webkit.org/show_bug.cgi?id=220628 <rdar://problem/70546547> Reviewed by Wenson Hsieh. Source/WebCore/PAL: * pal/spi/ios/MobileGestaltSPI.h: Source/WebKit: iPhone-idiom apps running on macOS need to behave exactly like iPhone apps, even in ways that might not totally make sense on the platform (e.g. using input accessory views for <select> 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 <timothy_horton@apple.com> Exceptions thrown when invoking a <select> on an iPhone-idiom app running on macOS https://bugs.webkit.org/show_bug.cgi?id=220628 <rdar://problem/70546547> Reviewed by Wenson Hsieh. iPhone-idiom apps running on macOS need to behave exactly like iPhone apps, even in ways that might not totally make sense on the platform (e.g. using input accessory views for <select> 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 <alancoon@apple.com> 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 <rdar://problem/70402593> 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 <timothy_horton@apple.com> REGRESSION (r266634): Messages crashes sometimes while scrolling around and playing YouTube videos https://bugs.webkit.org/show_bug.cgi?id=220602 <rdar://problem/70402593> 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 <alancoon@apple.com> 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 <rdar://problem/68443565> 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 <pvollan@apple.com> [Cocoa] Network extension sandbox extensions are sometimes issued too late https://bugs.webkit.org/show_bug.cgi?id=220525 <rdar://problem/68443565> 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 <alancoon@apple.com> 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 <rdar://68227709> 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 <jer.noble@apple.com> [Cocoa] Support key rotation with HLS-backed encrypted media streams https://bugs.webkit.org/show_bug.cgi?id=220493 <rdar://68227709> 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 <alancoon@apple.com> 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 <peng.liu6@apple.com> 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 <alancoon@apple.com> 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 <megan_gardner@apple.com> 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 <alancoon@apple.com> Cherry-pick r271477. rdar://problem/73204264 REGRESSION(r270961): Flipgrid can no longer capture video https://bugs.webkit.org/show_bug.cgi?id=220609 <rdar://73168009> 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 <cdumez@apple.com> REGRESSION(r270961): Flipgrid can no longer capture video https://bugs.webkit.org/show_bug.cgi?id=220609 <rdar://73168009> 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 <repstein@apple.com> 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 <rdar://problem/73092137> 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 <wilander@apple.com> PCM: Experimental debug mode needs to be read from defaults differently on iOS https://bugs.webkit.org/show_bug.cgi?id=220573 <rdar://problem/73092137> 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 <kkinnunen@apple.com> 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<IPC::MessageName>::isValidEnum): 2021-01-11 Carlos Garcia Campos <cgarcia@igalia.com> [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 <commit-queue@webkit.org> 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 <pvollan@apple.com> [macOS] Reset user directory suffix before getting sandbox directory https://bugs.webkit.org/show_bug.cgi?id=220358 <rdar://problem/57616019> 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 <peng.liu6@apple.com> 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 <wenson_hsieh@apple.com> [macOS] -[WKWebView acceptsFirstMouse:] sometimes crashes in IPC::Connection::createSyncMessageEncoder https://bugs.webkit.org/show_bug.cgi?id=220469 <rdar://problem/72319199> 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 <jiewen_tan@apple.com> [WebAuthn] Adopt new UI for the update flow https://bugs.webkit.org/show_bug.cgi?id=219713 <rdar://problem/72154988> 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 <youenn@apple.com> Service Worker is no longer inspectable https://bugs.webkit.org/show_bug.cgi?id=220406 <rdar://problem/72883757> 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 <clord@igalia.com> [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 <youenn@apple.com> Make sure that if NetworkProcess clears DOMCache, it also clears service worker registrations https://bugs.webkit.org/show_bug.cgi?id=220408 <rdar://problem/72360003> 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 <achristensen@webkit.org> Use WeakHashSet instead of HashSet<T*> 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 <pvollan@apple.com> [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 <katherine_cheney@apple.com> Error in layout tests: "Passed ITP enabled state (0) does not match TCC setting (1)" https://bugs.webkit.org/show_bug.cgi?id=220385 <rdar://problem/70730482> 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 <achristensen@webkit.org> 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 <mark.lam@apple.com> 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 <peng.liu6@apple.com> 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 <eric.carlson@apple.com> [Mac] Add runtime logging to format reader and WebM parser https://bugs.webkit.org/show_bug.cgi?id=220423 <rdar://problem/72896655> 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 <shvaikalesh@gmail.com> [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 <commit-queue@webkit.org> 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 <achristensen@webkit.org> Use smart pointers in UIDelegate and NavigationState https://bugs.webkit.org/show_bug.cgi?id=220394 <rdar://problem/72496374> 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<WKWebView> 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 <achristensen@webkit.org> 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 <aestes@apple.com> [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 <cdumez@apple.com> [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 <kkinnunen@apple.com> 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 <sihui_liu@appe.com> 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 <kkinnunen@apple.com> 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 <lmoura@igalia.com> 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 <cgarcia@igalia.com> [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 <youenn@apple.com> WKWebView should expose navigator.mediaDevices when content is loaded from app bundle https://bugs.webkit.org/show_bug.cgi?id=220184 <rdar://problem/72792032> 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 <jiewen_tan@apple.com> 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 <jiewen_tan@apple.com> [WebAuthn] Adopt new UI for the Client PIN and dismiss flow https://bugs.webkit.org/show_bug.cgi?id=219712 <rdar://problem/72154935> 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 <jer.noble@apple.com> [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 <ysuzuki@apple.com> [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 <aestes@apple.com> [Mac] Replace most uses of HAVE(MT_PLUGIN_FORMAT_READER) with ENABLE(WEBM_FORMAT_READER) https://bugs.webkit.org/show_bug.cgi?id=220374 <rdar://problem/72600426> 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 <cdumez@apple.com> [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 <wenson_hsieh@apple.com> [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 <rdar://problem/72275412> 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 <achristensen@webkit.org> Add SPI to determine whether a regex is supported in WKContentRuleList https://bugs.webkit.org/show_bug.cgi?id=220095 <rdar://problem/72058626> 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 <achristensen@webkit.org> 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 <sihui_liu@appe.com> Stop speech recognition if page becomes invisible https://bugs.webkit.org/show_bug.cgi?id=220073 <rdar://problem/72710704> 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 <achristensen@webkit.org> 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 <pvollan@apple.com> [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 <pvollan@apple.com> [iOS] Add missing endpoint in sandbox message filter https://bugs.webkit.org/show_bug.cgi?id=219731 <rdar://problem/71566760> 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 <eric.carlson@apple.com> [Cocoa] WebM format reader doesn't work with a url in a <source> element https://bugs.webkit.org/show_bug.cgi?id=219961 <rdar://problem/72399014> 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 <wenson_hsieh@apple.com> 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 <katherine_cheney@apple.com> NSCrossWebsiteTrackingUsageDescription is not working on Mac, ITP is always enabled https://bugs.webkit.org/show_bug.cgi?id=220190 <rdar://problem/72744909> 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 <akeerthi@apple.com> REGRESSION (r261157): Crash in WKSelectPopover when running as iPhone app on iPad https://bugs.webkit.org/show_bug.cgi?id=220065 <rdar://problem/71932792> 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 <select> element: 1. A WKWebView is created prior to UIApplication initialization. This can be achieved by creating one in another class's "load" method. 2. Since the app is physically running on an iPad, WebKit determines the user interface idiom to be "iPad" and saves this information. 3. Once the app actually launches, UIApplication is initialized. Since this is an iPhone app on iPad, the actual user interface idiom is "iPhone". However, WebKit does not know this, since it uses the saved user interface idiom from (2). 4. When tapping a <select> 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 <cdumez@apple.com> [iOS] Add a feature flag to stop leaking an XPC boost message to XPC services https://bugs.webkit.org/show_bug.cgi?id=219453 <rdar://72834999> 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 <achristensen@webkit.org> 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 <wilander@apple.com> PCM: Experimental debug mode stops working after initial use https://bugs.webkit.org/show_bug.cgi?id=220336 <rdar://problem/72398086> 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 <kkinnunen@apple.com> 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 <receiver name, message name>. 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 <timothy_horton@apple.com> 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 <peng.liu6@apple.com> [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 <ryanhaddad@apple.com> 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 <achristensen@webkit.org> 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 <sihui_liu@appe.com> Stop speech recognition if page becomes invisible https://bugs.webkit.org/show_bug.cgi?id=220073 <rdar://problem/72710704> 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 <achristensen@webkit.org> 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 <achristensen@webkit.org> 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 <achristensen@webkit.org> 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 <sihui_liu@appe.com> Fail speech recognition when page is muted for audio capture https://bugs.webkit.org/show_bug.cgi?id=220133 <rdar://problem/72745232> 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 <achristensen@webkit.org> Use WeakHashSet<Page> instead of HashSet<Page*> 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 <achristensen@webkit.org> 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 <youenn@apple.com> 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 <jeffm@apple.com> 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 <rbuis@igalia.com> 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 <said@apple.com> [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 <peng.liu6@apple.com> [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 <peng.liu6@apple.com> [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 <simon.fraser@apple.com> 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<ScrollableAreaParameters>::encode): (IPC::ArgumentCoder<ScrollableAreaParameters>::decode): 2020-12-22 Dean Jackson <dino@apple.com> Use an enum class to identify WebGL versions https://bugs.webkit.org/show_bug.cgi?id=220099 <rdar://problem/72596828> Reviewed by Ken Russell. Encode the WebGL version. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<WebCore::GraphicsContextGLAttributes>::encode): (IPC::ArgumentCoder<WebCore::GraphicsContextGLAttributes>::decode): * Shared/WebCoreArgumentCoders.h: 2020-12-22 Kate Cheney <katherine_cheney@apple.com> Cannot see 'Add to my stations' button in BBC World service Radio https://bugs.webkit.org/show_bug.cgi?id=219949 <rdar://problem/60319532> 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 <ryanhaddad@apple.com> 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 <youenn@apple.com> [iOS] Do extensive search for microphone devices when trying to capture https://bugs.webkit.org/show_bug.cgi?id=220010 <rdar://problem/72036034> 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 <wenson_hsieh@apple.com> REGRESSION (iOS 14): Bad access crash in ShareableBitmap::makeCGImageCopy() under assignLegacyDataForContextMenuInteraction() https://bugs.webkit.org/show_bug.cgi?id=219843 <rdar://problem/72537059> 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 <cdumez@apple.com> 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 <achristensen@webkit.org> 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 <ryanhaddad@apple.com> 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 <source> 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 <source> element" https://bugs.webkit.org/show_bug.cgi?id=219961 https://trac.webkit.org/changeset/270952 2020-12-21 Wenson Hsieh <wenson_hsieh@apple.com> Many websites crash under toDataURL() when enabling GPU process for DOM https://bugs.webkit.org/show_bug.cgi?id=220051 <rdar://problem/72412509> 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 <katherine_cheney@apple.com> Missing textInteractionEnabled key in WKPreferences initWithCoder looks like a false value. https://bugs.webkit.org/show_bug.cgi?id=220061 <rdar://problem/72487342> 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 <sihui_liu@apple.com> 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 <aboya@igalia.com> [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 <cdumez@apple.com> 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 <rbuis@igalia.com> 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 <rbuis@igalia.com> 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 <bfulgham@apple.com> REGRESSION(r270575): [iOS] Correct GPU Process sandbox syntax error https://bugs.webkit.org/show_bug.cgi?id=220041 <rdar://problem/72508138> 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 <timothy_horton@apple.com> 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 <beidson@apple.com> Fix some issues with PDFs as <object>. 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 <jeffm@apple.com> 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 <bburg@apple.com> [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 <peng.liu6@apple.com> [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 <sihui_liu@apple.com> 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 <cdumez@apple.com> REGRESSION (r270938): ASSERTION FAILED: !m_renderThread in WebKit::RemoteAudioDestinationProxy::startRenderingThread https://bugs.webkit.org/show_bug.cgi?id=220017 <rdar://problem/72470176> 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 <megan_gardner@apple.com> Gate all of the code associated with app highlights https://bugs.webkit.org/show_bug.cgi?id=220003 <rdar://problem/72451893> 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 <cdumez@apple.com> [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 <kkinnunen@apple.com> 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 <rdar://problem/72013784> 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 <achristensen@webkit.org> REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request https://bugs.webkit.org/show_bug.cgi?id=220001 <rdar://72436824> 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 <cdumez@apple.com> [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 <cdumez@apple.com> Unreviewed build fix after r270938. Add missing include. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: 2020-12-17 Chris Dumez <cdumez@apple.com> [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 <achristensen@webkit.org> Fix "Open with Preview" menu item in PDF context menus on Big Sur https://bugs.webkit.org/show_bug.cgi?id=219986 <rdar://problem/72406073> 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 <katherine_cheney@apple.com> Followup patch: Still can't login to my.playstation.com https://bugs.webkit.org/show_bug.cgi?id=219900 <rdar://problem/72062985> 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 <eric.carlson@apple.com> [Cocoa] WebM format reader doesn't work with a url in a <source> element https://bugs.webkit.org/show_bug.cgi?id=219961 <rdar://problem/72399014> Reviewed by Andy Estes. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-12-17 Chris Dumez <cdumez@apple.com> [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 <pangle@apple.com> 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 <rbuis@igalia.com> 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 <peng.liu6@apple.com> [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 <jiewen_tan@apple.com> Unreviewed, a build fix for the latest Internal SDK * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: 2020-12-16 Kate Cheney <katherine_cheney@apple.com> Still can't login to my.playstation.com https://bugs.webkit.org/show_bug.cgi?id=219900 <rdar://problem/72062985> 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 <cdumez@apple.com> [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 <youenn@apple.com> REGRESSION [iOS] Flaky GPU Process crash under -[RTCVideoEncoderH264 destroyCompressionSession] https://bugs.webkit.org/show_bug.cgi?id=219899 <rdar://problem/72347652> 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 <wenson_hsieh@apple.com> Suppress the image extraction interaction while editing text https://bugs.webkit.org/show_bug.cgi?id=219952 <rdar://problem/72390053> 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 <bfulgham@apple.com> REGRESSION (r270657) [AS Only] GGE: Netflix, YouTube, Amazon Prime, and Hulu fail to playback https://bugs.webkit.org/show_bug.cgi?id=219954 <rdar://problem/72325887> 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 <simon.fraser@apple.com> 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 <pvollan@apple.com> [macOS] Add sandbox parameter for message filter entitlement status https://bugs.webkit.org/show_bug.cgi?id=219852 <rdar://problem/72145560> 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 <youenn@apple.com> 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 <psaavedra@igalia.com> [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 <commit-queue@webkit.org> 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 <aestes@apple.com> [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 <pvollan@apple.com> [macOS, iOS] Add required mach syscall https://bugs.webkit.org/show_bug.cgi?id=219913 <rdar://problem/72347689> 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 <wenson_hsieh@apple.com> Image extraction interaction should remain active while scrolling https://bugs.webkit.org/show_bug.cgi?id=219895 <rdar://problem/72344814> 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 <katherine_cheney@apple.com> CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper<WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests() https://bugs.webkit.org/show_bug.cgi?id=219860 <rdar://problem/72254207> 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 <simon.fraser@apple.com> 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 <youenn@apple.com> 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 <rhost@apple.com> "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 <aestes@apple.com> [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 <cdumez@apple.com> [GPUProcess] Crash under AudioDestinationCocoa::setIsPlaying(bool) https://bugs.webkit.org/show_bug.cgi?id=219809 <rdar://problem/72298420> Reviewed by Youenn Fablet. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): 2020-12-15 Per Arne Vollan <pvollan@apple.com> [macOS] Add sandbox parameter for message filter entitlement status https://bugs.webkit.org/show_bug.cgi?id=219852 <rdar://problem/72145560> 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 <cgarcia@igalia.com> [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 <peng.liu6@apple.com> [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 <pvollan@apple.com> REGRESSION (r270677-r270693): Catalina Perf tests failing https://bugs.webkit.org/show_bug.cgi?id=219802 <rdar://problem/72236108> 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 <achristensen@webkit.org> Fix null dereference in WKURLCopyCFURL https://bugs.webkit.org/show_bug.cgi?id=219877 <rdar://problem/48921304> 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 <cdumez@apple.com> 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 <peng.liu6@apple.com> [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 <cdumez@apple.com> [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 <peng.liu6@apple.com> [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 <cdumez@apple.com> [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 <katherine_cheney@apple.com> CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper<WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests() https://bugs.webkit.org/show_bug.cgi?id=219860 <rdar://problem/72254207> 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 <timothy_horton@apple.com> 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 <psaavedra@igalia.com> [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 <wenson_hsieh@apple.com> GPU process sometimes hangs during MotionMark Focus when enabling GPU Process for DOM https://bugs.webkit.org/show_bug.cgi?id=219839 <rdar://problem/71562635> 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 <sihui_liu@apple.com> WebProcessProxy::destroySpeechRecognitionServer should check if identifier exists before removing MessageReceiver https://bugs.webkit.org/show_bug.cgi?id=219815 <rdar://problem/71369164> Reviewed by Youenn Fablet. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::destroySpeechRecognitionServer): 2020-12-14 Chris Dumez <cdumez@apple.com> 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 <youenn@apple.com> Make sure WebProcessPool::setUseSeparateServiceWorkerProcess handles correctly destroyed process pools https://bugs.webkit.org/show_bug.cgi?id=219773 <rdar://problem/71938320> 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 <achristensen@webkit.org> 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 <aestes@apple.com> [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 <wenson_hsieh@apple.com> 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 <sihui_liu@apple.com> Implement recognizer for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=219459 <rdar://problem/71914465> 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 <cdumez@apple.com> [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 <cgarcia@igalia.com> [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 <ysuzuki@apple.com> [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 <aestes@apple.com> [Mac] Create a MediaToolbox format reader plug-in for WebM https://bugs.webkit.org/show_bug.cgi?id=218908 <rdar://problem/71373264> 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 <timothy_horton@apple.com> Fix the watchOS build after r270712 <rdar://problem/72265227> * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent): 2020-12-12 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn][iOS] Turn on modern WebAuthn for default browsers https://bugs.webkit.org/show_bug.cgi?id=219823 <rdar://problem/72250436> 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 <alexm@gnome.org> [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 <commit-queue@webkit.org> 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 <wenson_hsieh@apple.com> 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 <peng.liu6@apple.com> [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 <jiewen_tan@apple.com> [WebAuthn] Adopt new UI for the Platform Authenticator getAssertion flow https://bugs.webkit.org/show_bug.cgi?id=219710 <rdar://problem/72154800> 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 <wilander@apple.com> PCM: Change debugModeSecondsUntilSend from 60 seconds to 10 seconds https://bugs.webkit.org/show_bug.cgi?id=219816 <rdar://problem/70779862> 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 <rniwa@webkit.org> [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<Ref<Font>>::encode): Encode the rendering resource identifier of Font. (IPC::ArgumentCoder<Ref<Font>>::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 <jiewen_tan@apple.com> [WebAuthn] Adopt new UI for the Security Key getAssertion flow https://bugs.webkit.org/show_bug.cgi?id=219711 <rdar://problem/72154840> 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 <wilander@apple.com> PCM: Add feature flag support in the network process https://bugs.webkit.org/show_bug.cgi?id=219811 <rdar://problem/72242633> 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 <jiewen_tan@apple.com> 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 <jer.noble@apple.com> [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 <cdumez@apple.com> Potential null dereference of m_frame under DocumentLoader::stopLoading() https://bugs.webkit.org/show_bug.cgi?id=219786 <rdar://71945402> Reviewed by Geoffrey Garen. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): Add some release logging. 2020-12-11 Tim Horton <timothy_horton@apple.com> Fix the iOS !UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_HANDLING build. * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent): 2020-12-11 Tim Horton <timothy_horton@apple.com> Trackpad and Mouse scroll events on iPad only fire "pointermove" -- not "wheel" https://bugs.webkit.org/show_bug.cgi?id=210071 <rdar://problem/54616853> 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 <bfulgham@apple.com> Expose API for enabling/disabling Private Click Measurement https://bugs.webkit.org/show_bug.cgi?id=219791 <rdar://problem/70502198> 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 <peng.liu6@apple.com> [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 <cdumez@apple.com> [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 <don.olmstead@sony.com> [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 <Hironori.Fujii@sony.com> [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 <jiewen_tan@apple.com> [WebAuthn] Adopt new UI for the Platform Authenticator makeCredential flow https://bugs.webkit.org/show_bug.cgi?id=219709 <rdar://problem/72154774> 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 <pvollan@apple.com> [macOS] Remove access to com.apple.MTLCompilerService in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219774 <rdar://problem/70497100> 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 <pvollan@apple.com> [macOS] Remove Mobile Asset access from the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219738 <rdar://problem/60650074> 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 <don.olmstead@sony.com> [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 $<TARGET_OBJECTS:${framework}> by ports. * CMakeLists.txt: * PlatformFTW.cmake: * PlatformPlayStation.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: 2020-12-11 Commit Queue <commit-queue@webkit.org> 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 <cgarcia@igalia.com> 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 <bfulgham@apple.com> [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 <rdar://problem/70464431> 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 <don.olmstead@sony.com> [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 <pvollan@apple.com> [iOS] Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219733 <rdar://problem/70628137> 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 <pvollan@apple.com> [macOS] Add telemetry for notification message filtering in sandbox https://bugs.webkit.org/show_bug.cgi?id=219684 <rdar://problem/69819260> 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 <commit-queue@webkit.org> 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 <achristensen@webkit.org> Accept click measurement data from hosting application https://bugs.webkit.org/show_bug.cgi?id=219763 <rdar://problem/72121094> 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 <peng.liu6@apple.com> [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 <aestes@apple.com> [Mac] Create a format reader plug-in for WebM https://bugs.webkit.org/show_bug.cgi?id=218908 <rdar://problem/71373264> 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 <cdumez@apple.com> [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 <pvollan@apple.com> [macOS] Deny mach-lookup to the service 'com.apple.SystemConfiguration.configd' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219680 <rdar://problem/69019138> 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 <pvollan@apple.com> [macOS] Create sandbox extension for AppleAVDUserClient when Media in GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=219740 <rdar://problem/70496905> 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 <pvollan@apple.com> [macOS] Add telemetry for notification message filtering in sandbox https://bugs.webkit.org/show_bug.cgi?id=219684 <rdar://problem/69819260> 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 <pvollan@apple.com> [iOS] Add missing endpoint in sandbox message filter https://bugs.webkit.org/show_bug.cgi?id=219731 <rdar://problem/71566760> 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 <pvollan@apple.com> [macOS] The development WebContent XPC service is missing a required entitlement https://bugs.webkit.org/show_bug.cgi?id=219730 <rdar://problem/72145560> 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 <andresg_22@apple.com> 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 <sihui_liu@apple.com> REGRESSION (r270574): [iOS] ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::~SpeechRecognitionRemoteRealtimeMediaSourceManager https://bugs.webkit.org/show_bug.cgi?id=219745 <rdar://problem/72184764> Reviewed by Youenn Fablet. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): Remove SpeechRecognitionRemoteRealtimeMediaSourceManager from MessageReceiverMap before destroying it. 2020-12-10 Timothy Hatcher <timothy@apple.com> 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 <don.olmstead@sony.com> [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 <peng.liu6@apple.com> [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 <achristensen@webkit.org> 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 <don.olmstead@sony.com> [CMake] Use TARGET_PROPERTY to set includes for executables https://bugs.webkit.org/show_bug.cgi?id=219743 Reviewed by Michael Catanzaro. Use $<TARGET_PROPERTY:WebKit,INCLUDE_DIRECTORIES> for all executables being built alongside WebKit. This simplifies the includes for those targets. * CMakeLists.txt: 2020-12-10 Chris Dumez <cdumez@apple.com> 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 <youenn@apple.com> 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 <graouts@webkit.org> 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 <jiewen_tan@apple.com> 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 <jiewen_tan@apple.com> [WebAuthn] Adopt new UI for the Security Key makeCredential flow https://bugs.webkit.org/show_bug.cgi?id=219708 <rdar://problem/72154735> 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 <pvollan@apple.com> [macOS] Remove com.apple.PowerManagement.control from WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=219685 <rdar://problem/70497033> 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 <peng.liu6@apple.com> [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 <bburg@apple.com> [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<RemoteWebInspectorProxy> 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 <said@apple.com> [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 <pvollan@apple.com> [macOS] Allow mach-lookup of com.apple.relatived.tempest in WebKit GPU process https://bugs.webkit.org/show_bug.cgi?id=219701 <rdar://problem/71980348> Reviewed by Darin Adler. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: 2020-12-09 Wenson Hsieh <wenson_hsieh@apple.com> 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 <achristensen@webkit.org> Fix clicking on links in PDFs on Big Sur after r266654 https://bugs.webkit.org/show_bug.cgi?id=219665 <rdar://problem/72080683> 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 <wenson_hsieh@apple.com> [Concurrent display lists] Support playback of display list items with cached resources https://bugs.webkit.org/show_bug.cgi?id=218614 <rdar://problem/71326662> 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 <kkinnunen@apple.com> Implement RemoteWebGLBackend https://bugs.webkit.org/show_bug.cgi?id=217216 <rdar://problem/69876258> 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<WebCore::GraphicsContextGLAttributes>::encode): (IPC::ArgumentCoder<WebCore::GraphicsContextGLAttributes>::decode): (IPC::ArgumentCoder<WebCore::GraphicsContextGL::ActiveInfo>::encode): (IPC::ArgumentCoder<WebCore::GraphicsContextGL::ActiveInfo>::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<CertificateInfo>::encode): (IPC::ArgumentCoder<CertificateInfo>::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 <bfulgham@apple.com> REGRESSION(r269647) [Cocoa] Consume GPU sandbox extensions early in Web page creation flow https://bugs.webkit.org/show_bug.cgi?id=219659 <rdar://problem/72058396> 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 <cgarcia@igalia.com> 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 <stephan.szabo@sony.com> [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 <pvollan@apple.com> [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 <rniwa@webkit.org> iOS build fix after r270573. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): 2020-12-09 Per Arne Vollan <pvollan@apple.com> Remove access to com.apple.audio.toolbox.reporting.service https://bugs.webkit.org/show_bug.cgi?id=219638 <rdar://problem/71638615> 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 <sihui_liu@apple.com> Implement audio capture for SpeechRecognition on iOS https://bugs.webkit.org/show_bug.cgi?id=219371 <rdar://problem/71824049> 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 <kkinnunen@apple.com> 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<type, number of elements>. 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<CertificateInfo>::encode): (IPC::ArgumentCoder<CertificateInfo>::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 <wenson_hsieh@apple.com> [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 <webkit.org/b/218614>, 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 <peng.liu6@apple.com> [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 <cdumez@apple.com> Potential crash under [WKRemoteObjectEncoder encodeObject:forKey:] when the object graph contains a cycle https://bugs.webkit.org/show_bug.cgi?id=219620 <rdar://71551776> 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 <simon.fraser@apple.com> 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<ScrollingStateFrameScrollingNode>::encode): (ArgumentCoder<ScrollingStateFrameScrollingNode>::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 <pvollan@apple.com> [macOS] Deny mach-lookup to the service 'com.apple.assertiond.processassertionconnection' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219637 <rdar://problem/69019269> 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 <achristensen@webkit.org> 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 <pvollan@apple.com> [macOS] Create sandbox extension for audio service when Media in GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=219540 <rdar://problem/71978050> 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 <cdumez@apple.com> [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 <rhost@apple.com> Add target to create /usr/local to work around XBS Bug <rdar://problem/20388650> 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 <said@apple.com> [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 <bfulgham@apple.com> Add sandbox telemetry for likely unused features https://bugs.webkit.org/show_bug.cgi?id=219544 <rdar://71985678> 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 <wenson_hsieh@apple.com> 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 <pvollan@apple.com> [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 <rdar://problem/69019399> 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 <don.olmstead@sony.com> [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 <timothy_horton@apple.com> 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 <cdumez@apple.com> [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 <commit-queue@webkit.org> 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 <lmoura@igalia.com> 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 <jh718.park@samsung.com> 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 <samuel.thibault@ens-lyon.org> [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 <lmoura@igalia.com> 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 <wenson_hsieh@apple.com> [Concurrent display lists] Synchronize display list rendering across remote image buffers https://bugs.webkit.org/show_bug.cgi?id=219091 <rdar://problem/71747695> 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 <Hironori.Fujii@sony.com> 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 <said@apple.com> [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 <wenson_hsieh@apple.com> [iOS] Cancel image extraction when navigating https://bugs.webkit.org/show_bug.cgi?id=219559 <rdar://problem/71997004> 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 <jer.noble@apple.com> [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 <jer.noble@apple.com> [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 <said@apple.com> [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 <wilander@apple.com> PCM: Switch to 8+4 bits for source IDs and trigger values respectively https://bugs.webkit.org/show_bug.cgi?id=219519 <rdar://problem/70470036> 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 <commit-queue@webkit.org> 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 <bburg@apple.com> 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<JSC::JSValue, ExceptionDetails> 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 <katherine_cheney@apple.com> Create API to enable/disable text interaction gestures in WKWebView https://bugs.webkit.org/show_bug.cgi?id=217784 <rdar://problem/63406241> 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 <aroben@apple.com> 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 <said@apple.com> [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<Ref<NativeImage>>::encode): Deleted. (IPC::ArgumentCoder<Ref<NativeImage>>::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 <pvollan@apple.com> [macOS] Deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219541 <rdar://problem/68878604> 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 <drousso@apple.com> [iOS] Provide a context menu action to perform accessibility image extraction https://bugs.webkit.org/show_bug.cgi?id=219524 <rdar://problem/69969613> 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 <peng.liu6@apple.com> [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 <kkinnunen@apple.com> GPU Process WindowServer blocking prevents CGL https://bugs.webkit.org/show_bug.cgi?id=219431 <rdar://problem/71893390> 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 <simon.fraser@apple.com> Only the first wheel event in a gesture should be cancelable https://bugs.webkit.org/show_bug.cgi?id=218764 <rdar://problem/71248946> 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 <achristensen@webkit.org> 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 <aroben@apple.com> 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 <cdumez@apple.com> 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 <bfulgham@apple.com> [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 <rdar://problem/70463873> 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 <said@apple.com> [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 <cdumez@apple.com> 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 <achristensen@webkit.org> 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 <cdumez@apple.com> 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 <timothy_horton@apple.com> GPU Process: Sandbox violations under IOSurface::maximumSize in the Web Content process https://bugs.webkit.org/show_bug.cgi?id=219484 <rdar://problem/71603808> 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 <mrobinson@igalia.com> 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 <timothy_horton@apple.com> 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 <timothy_horton@apple.com> 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 <bfulgham@apple.com> [macOS] WebContent sandbox; remove AppleIntelMEUserClient https://bugs.webkit.org/show_bug.cgi?id=219012 <rdar://problem/70462796> 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 <wenson_hsieh@apple.com> Unreviewed, fix the iOS build after r270362 * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView createHighlightInCurrentGroupWithRange:]): (-[WKContentView createHighlightInNewGroupWithRange:]): 2020-12-02 Megan Gardner <megan_gardner@apple.com> 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 <bfulgham@apple.com> [iOS] Silence sandbox warning for unneeded sysctl-read of "hw.tbfrequency_compat" https://bugs.webkit.org/show_bug.cgi?id=219414 <rdar://problem/71740719> 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 <wenson_hsieh@apple.com> Entire image elements are sometimes selected after ending a image extraction interaction https://bugs.webkit.org/show_bug.cgi?id=219435 <rdar://problem/71897557> 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 <wenson_hsieh@apple.com> Context menu should be shown after a long timeout following image extraction https://bugs.webkit.org/show_bug.cgi?id=219415 <rdar://problem/71872600> 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 <timothy_horton@apple.com> 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 <peng.liu6@apple.com> [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 <wenson_hsieh@apple.com> [iOS] Support image extraction interactions for accessibility https://bugs.webkit.org/show_bug.cgi?id=219398 <rdar://problem/70744914> 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 <pvollan@apple.com> [macCatalyst] Embedded YouTube videos fail to play https://bugs.webkit.org/show_bug.cgi?id=219412 <rdar://problem/71869657> 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 <pvollan@apple.com> [macOS] Deny mach lookup of 'com.apple.webinspector' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219386 <rdar://problem/60932734> 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 <bfulgham@apple.com> [macOS] Add telemetry for sandbox rules we believe are unused https://bugs.webkit.org/show_bug.cgi?id=219141 <rdar://problem/71569084> 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 <krollin@apple.com> Consolidate header postprocessing scripts https://bugs.webkit.org/show_bug.cgi?id=219388 <rdar://problem/71840357> 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 <katherine_cheney@apple.com> ITP logging mixes up the UI process ITP state with the Settings ITP state https://bugs.webkit.org/show_bug.cgi?id=219359 <rdar://problem/71808489> 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 <alex@igalia.com> [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 <timothy_horton@apple.com> 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 <pvollan@apple.com> [macOS] Adopt SPI to prevent establishing XPC connections to Launch Services https://bugs.webkit.org/show_bug.cgi?id=219173 <rdar://problem/71595536> 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 <timothy_horton@apple.com> 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 <Hironori.Fujii@sony.com> [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 <simon.fraser@apple.com> Pass OptionSet<EventHandling> 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 <timothy_horton@apple.com> 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 <cdumez@apple.com> sessionStorage should not be cloned when a window is opened with rel=noopener https://bugs.webkit.org/show_bug.cgi?id=218804 <rdar://problem/71286606> Reviewed by Alex Christensen. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchCreatePage): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-11-30 Youenn Fablet <youenn@apple.com> 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 <antti@apple.com> 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 <mazander@apple.com> 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 <pvollan@apple.com> [macOS] Set application information in the Networking process on behalf of the WebContent process https://bugs.webkit.org/show_bug.cgi?id=218052 <rdar://problem/70586405> 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 <pvollan@apple.com> [macOS] Issue sandbox extension to icon services when starting a drag operation https://bugs.webkit.org/show_bug.cgi?id=219159 <rdar://problem/71585876> 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 <Hironori.Fujii@sony.com> 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 <Hironori.Fujii@sony.com> [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 <don.olmstead@sony.com> 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 <don.olmstead@sony.com> 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 <wenson_hsieh@apple.com> 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 <wenson_hsieh@apple.com> 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 <aperez@igalia.com> 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 <yoshiaki.jitsukawa@sony.com> [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<Ref<WebCore::Font>> class. 2020-11-26 Wenson Hsieh <wenson_hsieh@apple.com> Calling waitForAndDispatchImmediately<M> 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<N>` 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 <lmoura@igalia.com> [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 <lmoura@igalia.com> [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 <Hironori.Fujii@sony.com> [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<GPUProcess>): (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<FontAttributes>::encodePlatformData): Deleted. (IPC::ArgumentCoder<FontAttributes>::decodePlatformData): Deleted. (IPC::ArgumentCoder<Ref<Font>>::encodePlatformData): Deleted. (IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): Deleted. * Shared/win/WebCoreArgumentCodersWin.cpp: Added. (IPC::ArgumentCoder<FontAttributes>::encodePlatformData): (IPC::ArgumentCoder<FontAttributes>::decodePlatformData): (IPC::ArgumentCoder<Ref<Font>>::encodePlatformData): (IPC::ArgumentCoder<Ref<Font>>::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 <youenn@apple.com> https://collab-project.github.io/videojs-record/demo/video-only.html is not working https://bugs.webkit.org/show_bug.cgi?id=219258 <rdar://problem/69759808> 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 <yoshiaki.jitsukawa@sony.com> [PlayStation] Enable ResourceLoadStatistics https://bugs.webkit.org/show_bug.cgi?id=219292 Reviewed by Fujii Hironori. * PlatformPlayStation.cmake: 2020-11-21 Sihui Liu <sihui_liu@apple.com> Implement audio capture for SpeechRecognition on macOS https://bugs.webkit.org/show_bug.cgi?id=218855 <rdar://problem/71331001> 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 <simon.fraser@apple.com> 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<ScrollingStateFrameScrollingNode>::encode): 2020-11-21 Simon Fraser <simon.fraser@apple.com> 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 <jiewen_tan@apple.com> [WebAuthn] Implement SPI for AuthenticationServices.Framework https://bugs.webkit.org/show_bug.cgi?id=218893 <rdar://problem/71364731> 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 <katherine_cheney@apple.com> PCM: Persist pending ad clicks and attributions so they can survive browser restart https://bugs.webkit.org/show_bug.cgi?id=219134 <rdar://problem/70470129> 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 <simon.fraser@apple.com> 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 <simon.fraser@apple.com> 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 <ryanhaddad@apple.com> 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 <ryanhaddad@apple.com> Unreviewed, fix the build with recent SDKs. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): 2020-11-20 Philippe Normand <pnormand@igalia.com> 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 <wenson_hsieh@apple.com> REGRESSION (r259151): The "Convert Text to Traditional Chinese" services menu action is broken https://bugs.webkit.org/show_bug.cgi?id=219190 <rdar://problem/71438389> 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 <Hironori.Fujii@sony.com> [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 <dvh@apple.com> 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 <bfulgham@apple.com> 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 <cdumez@apple.com> Web Inspector: Unable to Show JavaScript Console in empty tab in Safari Technology Preview https://bugs.webkit.org/show_bug.cgi?id=211590 <rdar://problem/63000159> 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 <pvollan@apple.com> [macOS] Issue sandbox extension to Web Inspector service https://bugs.webkit.org/show_bug.cgi?id=219041 <rdar://problem/71495287> 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 <pvollan@apple.com> [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 <rdar://problem/71500898> 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 <JPEW.hacker@gmail.com> [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 <cgarcia@igalia.com> 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 <megan_gardner@apple.com> 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 <wenson_hsieh@apple.com> 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 <wenson_hsieh@apple.com> [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 <cdumez@apple.com> 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 <darin@apple.com> 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 <simon.fraser@apple.com> 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 <wenson_hsieh@apple.com> 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 <pvollan@apple.com> [macOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=219090 <rdar://problem/71522043> 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 <cdumez@apple.com> [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 (<rdar://problem/71499731>). * 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 <weinig@apple.com> 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 <timothy_horton@apple.com> 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 <cdumez@apple.com> [iOS] ASSERTION FAILED: Completion handler should always be called under WebKit::GPUProcess::didReceiveMessage https://bugs.webkit.org/show_bug.cgi?id=219055 <rdar://problem/71508223> 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 <cdumez@apple.com> 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 <cdumez@apple.com> [macOS] Stop using RunLoopType=_WebKit starting in Big Sur https://bugs.webkit.org/show_bug.cgi?id=219052 <rdar://problem/61742969> 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 <pvollan@apple.com> [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 <rdar://problem/71439885> 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 <sihui_liu@apple.com> 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 <saagar@saagarjha.com> 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 <bfulgham@apple.com> [macOS] Remove access to the unused AppleSNBFBUserClient IOKit class https://bugs.webkit.org/show_bug.cgi?id=219014 <rdar://problem/70463873> 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 <cdumez@apple.com> [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 <peng.liu6@apple.com> [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 <pvollan@apple.com> [macOS] Perform AX TCC check in the UI process https://bugs.webkit.org/show_bug.cgi?id=218870 <rdar://problem/71339830> 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 <bburg@apple.com> [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 <timothy_horton@apple.com> 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 <timothy_horton@apple.com> REGRESSION (r269824): YouTube media control bar sometimes flickers https://bugs.webkit.org/show_bug.cgi?id=219017 <rdar://problem/71454799> 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 <bfulgham@apple.com> [macOS] Remove access to the unused AppleIntelMEUserClient IOKit class https://bugs.webkit.org/show_bug.cgi?id=219012 <rdar://problem/70462796> 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 <pvollan@apple.com> [macOS] Create sandbox extension for the power log service on internal installs https://bugs.webkit.org/show_bug.cgi?id=218984 <rdar://problem/58488936> 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 <weinig@apple.com> 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 <wilander@apple.com> NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking() redacts the cookie name in log output on customer builds https://bugs.webkit.org/show_bug.cgi?id=218997 <rdar://problem/71460604> 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 <cdumez@apple.com> [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 <bfulgham@apple.com> [macOS] Remove remote tcp capability from WebContent Sandbox https://bugs.webkit.org/show_bug.cgi?id=218999 <rdar://problem/70355789> 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 <drousso@apple.com> 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 <https://developer.apple.com/documentation/uniformtypeidentifiers>. * 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 <don.olmstead@sony.com> 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 <pvollan@apple.com> [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 <megan_gardner@apple.com> Add menu support for app highlights for books https://bugs.webkit.org/show_bug.cgi?id=218879 <rdar://problem/71352113> 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 <trevor_s@apple.com> 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 <cgarcia@igalia.com> 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 <kkinnunen@apple.com> 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 <drousso@apple.com> [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 <rdar://problem/67823088> 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 <zdobersek@igalia.com> [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 <timothy_horton@apple.com> 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 <zdobersek@igalia.com> 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 <sihui_liu@apple.com> Implement basic permission check for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=218476 <rdar://problem/71222638> 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 <cdumez@apple.com> [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 <cdumez@apple.com> [GPUProcess] Add basic low memory handling in the GPUProcess https://bugs.webkit.org/show_bug.cgi?id=218926 <rdar://problem/70300888> 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 <katherine_cheney@apple.com> Can't login to Microsoft Teams https://bugs.webkit.org/show_bug.cgi?id=218778 <rdar://problem/36331568> 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 <weinig@apple.com> 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 <ggaren@apple.com> 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 <pvollan@apple.com> [macOS] Issue sandbox extension to the WebContent process for com.apple.lskdd https://bugs.webkit.org/show_bug.cgi?id=218920 <rdar://problem/69168801> 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 <csaavedra@igalia.com> 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 <achristensen@webkit.org> 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 <darin@apple.com> 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 <simon.fraser@apple.com> Force wheel event listeners on the root to be passive https://bugs.webkit.org/show_bug.cgi?id=218842 <rdar://problem/71312668> 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 <eric.carlson@apple.com> 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 <magomez@igalia.com> [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 <kkinnunen@apple.com> 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 <youenn@apple.com> 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 <achristensen@webkit.org> 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 <timothy_horton@apple.com> 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 <said@apple.com> [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 <pvollan@apple.com> [iOS] IOKit sandbox violation when enabling all GPU runtime flags https://bugs.webkit.org/show_bug.cgi?id=218820 <rdar://problem/71296116> 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 <cdumez@apple.com> [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 <cdumez@apple.com> ASSERTION FAILED: isValidIdentifier(m_identifier) seen with TestWebKitAPI.GPUProcess.WebProcessTerminationAfterTooManyGPUProcessCrashes https://bugs.webkit.org/show_bug.cgi?id=218856 <rdar://problem/71331809> 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 <youenn@apple.com> 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 <dpino@igalia.com> [GTK] Unreviewed, non-unified build fix. * WebProcess/Gamepad/WebGamepadProvider.cpp: Add missing Logging.h header. 2020-11-12 Zalan Bujtas <zalan@apple.com> 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 <said@apple.com> [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 <zdobersek@igalia.com> 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 <exalm7659@gmail.com> [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 <bburg@apple.com> REGRESSION(r267411): Unable to "Start Element Selection" with Web Inspector closed https://bugs.webkit.org/show_bug.cgi?id=218838 <rdar://problem/71158215> 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 <said@apple.com> [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 <cdumez@apple.com> 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 <wilander@apple.com> 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 <rdar://problem/71094296> 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 <peng.liu6@apple.com> 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 <timothy_horton@apple.com> 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 <wenson_hsieh@apple.com> 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 <said@apple.com> [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<Ref<NativeImage>>::encode): (IPC::ArgumentCoder<Ref<NativeImage>>::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 <cdumez@apple.com> Terminate WebProcesses if GPUProcess crashes more than twice in 30 seconds https://bugs.webkit.org/show_bug.cgi?id=218811 <rdar://problem/71292424> 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 <bburg@apple.com> [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing https://bugs.webkit.org/show_bug.cgi?id=217783 <rdar://problem/69968787> 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 <achristensen@webkit.org> 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 <cdumez@apple.com> [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 <achristensen@webkit.org> 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 <achristensen@webkit.org> Don't look in keychain for SecKeyRef after deserializing SecIdentityRef https://bugs.webkit.org/show_bug.cgi?id=218809 <rdar://problem/69394018> 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<WebCore::Credential>::encodePlatformData): (IPC::ArgumentCoder<WebCore::Credential>::decodePlatformData): 2020-11-11 Sihui Liu <sihui_liu@apple.com> REGRESSION (r269348): ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::SpeechRecognitionServer::~SpeechRecognitionServer https://bugs.webkit.org/show_bug.cgi?id=218770 <rdar://problem/71252234> Reviewed by Youenn Fablet. Remove SpeechRecognitionServer from MessageReceiverMap before it is destroyed. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): 2020-11-11 Chris Dumez <cdumez@apple.com> REGRESSION (r269657): ASSERTION FAILED: Completion handler should always be called under WebKit::GPUProcessProxy::~GPUProcessProxy https://bugs.webkit.org/show_bug.cgi?id=218807 <rdar://problem/71285627> 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 <wenson_hsieh@apple.com> [Concurrent display lists] Add an initial implementation of concurrent display list rendering https://bugs.webkit.org/show_bug.cgi?id=218426 <rdar://problem/71167220> 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 <webkit.org/b/218406>, 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 <commit-queue@webkit.org> 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 <corentin.noel@collabora.com> [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 <commit-queue@webkit.org> 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 <pvollan@apple.com> [macOS] Enforce message filtering in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=218756 <rdar://problem/71240766> 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 <cdumez@apple.com> Webkit incorrectly setting visibilityState to "prerender" when opening link in new tab https://bugs.webkit.org/show_bug.cgi?id=215851 <rdar://problem/67817100> 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 <timothy_horton@apple.com> 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 <darin@apple.com> 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 <wilander@apple.com> 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 <rdar://problem/71094296> 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 <simon.fraser@apple.com> 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 <cdumez@apple.com> 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 <bfulgham@apple.com> [macOS] Allow IOGLESBundleName for Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218774 <rdar://problem/67473780> 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 <bfulgham@apple.com> [macOS] Allow IOGLESBundleName for Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218774 <rdar://problem/67473780> 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 <said@apple.com> [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 <pvollan@apple.com> [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 <pvollan@apple.com> [macCatalyst] Add entitlement for message filtering https://bugs.webkit.org/show_bug.cgi?id=218768 <rdar://problem/71247464> 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 <youenn@apple.com> 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 <wenson_hsieh@apple.com> REGRESSION (r269525): Many layout tests crash when run under ASan https://bugs.webkit.org/show_bug.cgi?id=218733 <rdar://problem/71206273> 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 <cdumez@apple.com> [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 <cgarcia@igalia.com> [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 <cgarcia@igalia.com> [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 <cgarcia@igalia.com> [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 <wenson_hsieh@apple.com> 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 <said@apple.com> [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<Ref<NativeImage>>::encode): (IPC::ArgumentCoder<Ref<NativeImage>>::decode): (IPC::encodeNativeImage): Deleted. (IPC::decodeNativeImage): Deleted. (IPC::encodeOptionalNativeImage): Deleted. (IPC::decodeOptionalNativeImage): Deleted. (IPC::ArgumentCoder<NativeImagePtr>::encode): Deleted. (IPC::ArgumentCoder<NativeImagePtr>::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 <cdumez@apple.com> 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 <peng.liu6@apple.com> 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 <wenson_hsieh@apple.com> 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 <zalan@apple.com> 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 <zalan@apple.com> 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 <pvollan@apple.com> [macOS] System sounds should be played in the UI process https://bugs.webkit.org/show_bug.cgi?id=218405 <rdar://problem/70898846> 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 <pvollan@apple.com> [Cocoa] Diagnostic service sandbox violation loading any webpage https://bugs.webkit.org/show_bug.cgi?id=218710 <rdar://problem/71124931> 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 <drousso@apple.com> autofocus of text input should not select text https://bugs.webkit.org/show_bug.cgi?id=218585 <rdar://problem/60130704> 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 <pvollan@apple.com> [macOS] Set preference for overridden languages in the WebContent process after entering the sandbox. https://bugs.webkit.org/show_bug.cgi?id=218097 <rdar://problem/70586545> 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 <jh718.park@samsung.com> 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 <zdobersek@igalia.com> [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 <lmoura@igalia.com> [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 <wenson_hsieh@apple.com> 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 <peng.liu6@apple.com> 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 <jiewen_tan@apple.com> [WebAuthn] [iOS] WebAuthn process doesn't start on iOS devices https://bugs.webkit.org/show_bug.cgi?id=218479 <rdar://problem/70560399> 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 <wenson_hsieh@apple.com> 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 <pvollan@apple.com> [macOS] Add IOKIt message filtering https://bugs.webkit.org/show_bug.cgi?id=218657 <rdar://problem/71118545> 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 <wenson_hsieh@apple.com> 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 <weinig@apple.com> 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 <akeerthi@apple.com> [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 <achristensen@webkit.org> Fix build with different unified source arrangement. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 2020-11-06 Wenson Hsieh <wenson_hsieh@apple.com> 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 <achristensen@webkit.org> 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 <wenson_hsieh@apple.com> 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<Ref<WebCore::ImageData>>::encode): (IPC::ArgumentCoder<Ref<WebCore::ImageData>>::decode): 2020-11-06 Wenson Hsieh <wenson_hsieh@apple.com> [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 <tsavell@apple.com> 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 <wenson_hsieh@apple.com> 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 <bfulgham@apple.com> [macOS] Allow IOAVDHEVCDecodeCapabilities on Intel https://bugs.webkit.org/show_bug.cgi?id=218639 <rdar://problem/71100188> 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 <mcrha@redhat.com> [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 <mcatanzaro@gnome.org> [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 <said@apple.com> [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<ImageBuffer> 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 <bfulgham@apple.com> [macOS] Remove mdnsresponder access from WebKit processes https://bugs.webkit.org/show_bug.cgi?id=218633 <rdar://problem/69133548> 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 <achristensen@webkit.org> Add null checks effectively in UserInputBridge https://bugs.webkit.org/show_bug.cgi?id=218622 <rdar://problem/70724960> Reviewed by Wenson Hsieh. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::stopLoadingFrame): (WebKit::WebPage::stopLoading): (WebKit::WebPage::reload): 2020-11-05 Brent Fulgham <bfulgham@apple.com> [macOS] Remove mdnsresponder access from WebKit processes https://bugs.webkit.org/show_bug.cgi?id=218633 <rdar://problem/69133548> 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 <wilander@apple.com> PCM: Switch to JSON report format https://bugs.webkit.org/show_bug.cgi?id=218634 <rdar://problem/70469923> 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 <bburg@apple.com> [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing https://bugs.webkit.org/show_bug.cgi?id=217783 <rdar://problem/69968787> 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 <pvollan@apple.com> [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 <ryanhaddad@apple.com> Unreviewed, fix the build with recent SDKs. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::platformInvalidate): 2020-11-05 Don Olmstead <don.olmstead@sony.com> 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 <ryanhaddad@apple.com> Unreviewed, fix the build with recent SDKs. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::kill): 2020-11-05 Brent Fulgham <bfulgham@apple.com> [iOS] Remove redundant rule using never-granted extension https://bugs.webkit.org/show_bug.cgi?id=218596 <rdar://problem/66581246> 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 <bfulgham@apple.com> [iOS] Remove redundant rule for shared-preference.read-write https://bugs.webkit.org/show_bug.cgi?id=218594 <rdar://problem/66581796> 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 <darin@apple.com> 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 <achristensen@webkit.org> Store WeakPtr<Frame> 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 <achristensen@webkit.org> 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 <cgarcia@igalia.com> 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 <jiewen_tan@apple.com> [WebAuthn] Determine an AAGUID for the platform authenticators https://bugs.webkit.org/show_bug.cgi?id=217945 <rdar://problem/70811618> 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 <cgarcia@igalia.com> 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 <said@apple.com> [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 <akeerthi@apple.com> [Contact Picker API] Add support for picker UI on iOS https://bugs.webkit.org/show_bug.cgi?id=218189 <rdar://problem/69862277> 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 <cdumez@apple.com> 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 <cdumez@apple.com> 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 <rdar://problem/70159546> 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 <said@apple.com> [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 <ddkilzer@apple.com> WebKit should remove unused debug variant support <https://webkit.org/b/218315> <rdar://problem/70785369> 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 <wenson_hsieh@apple.com> 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 <luming_yin@apple.com> [watchOS] Don't allow managed preference to enable legacy sync XHRs on watchOS https://bugs.webkit.org/show_bug.cgi?id=218548 <rdar://problem/68417252> 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 <dino@apple.com> WKContentView might get KVO notifications it doesn't expect https://bugs.webkit.org/show_bug.cgi?id=218558 <rdar://problem/71031491> 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 <youenn@apple.com> 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 <sihui_liu@apple.com> Set up basic infrastructure for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=218216 <rdar://problem/70703788> 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 <bfulgham@apple.com> [macOS] remove sysctl.oidfmt. access https://bugs.webkit.org/show_bug.cgi?id=218524 <rdar://problem/70353722> Reviewed by Per Arne Vollan. Access to "sysctl.oidfmt." was needed due to a bug <rdar://problem/64208532>. 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 <rini_patel@apple.com> [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 <wenson_hsieh@apple.com> 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 <wenson_hsieh@apple.com> 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 <webkit.org/b/218406>. * 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 <stephan.szabo@sony.com> [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 <said@apple.com> [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 <wenson_hsieh@apple.com> 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 <simon.fraser@apple.com> 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 <bfulgham@apple.com> [macOS] Adopt additional QuartzCore entitlement to reduce accessible endpoints https://bugs.webkit.org/show_bug.cgi?id=218466 <rdar://problem/55790037> 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 <youenn@apple.com> 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 <youenn@apple.com> 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 <clord@igalia.com> [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 <aperez@igalia.com> [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 <rniwa@webkit.org> 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 <drousso@apple.com> guard UIScribbleInteraction class property observing behind a LOA check https://bugs.webkit.org/show_bug.cgi?id=218463 <rdar://problem/70747966> 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 <james.savage@apple.com> 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 <akeerthi@apple.com> [iOS] Link Contacts.framework during build https://bugs.webkit.org/show_bug.cgi?id=218289 <rdar://problem/70770410> 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 <cdumez@apple.com> Crash under ProcessThrottler::setAssertionType() https://bugs.webkit.org/show_bug.cgi?id=218448 <rdar://problem/67419221> 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 <bfulgham@apple.com> [macOS] Remove unneeded shmem access to ColorSync https://bugs.webkit.org/show_bug.cgi?id=218395 <rdar://problem/70354916> 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 <darin@apple.com> 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<ComposedTree>. 2020-11-02 David Kilzer <ddkilzer@apple.com> Fix link error with WebKit.framework Undefined symbols for architecture x86_64: "JSC::GenericTypedArrayView<JSC::Uint8Adaptor>::create(WTF::RefPtr<JSC::ArrayBuffer, WTF::RawPtrTraits<JSC::ArrayBuffer>, WTF::DefaultRefDerefTraits<JSC::ArrayBuffer> >&&, 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 <JavaScriptCore/GenericTypedArrayViewInlines.h> to fix linker error with some builds of WebKit. - See also WebProcess/GPU/media/RemoteLegacyCDMSession.cpp. 2020-11-02 Youenn Fablet <youenn@apple.com> 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 <weinig@apple.com> 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 <simon.fraser@apple.com> 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 <bburg@apple.com> Web Inspector: move InspectorFrontendAPIDispatcher to WebCore, clean up uses https://bugs.webkit.org/show_bug.cgi?id=217835 <rdar://problem/70384407> 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 <bfulgham@apple.com> Correct sandbox violations in GPU Process https://bugs.webkit.org/show_bug.cgi?id=218356 <rdar://problem/70574999> 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 <simon.fraser@apple.com> 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<ScrollingStateNode>::encode): (ArgumentCoder<ScrollingStateNode>::decode): (ArgumentCoder<ScrollingStateScrollingNode>::encode): (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode): (ArgumentCoder<ScrollingStateOverflowScrollProxyNode>::encode): (ArgumentCoder<ScrollingStateScrollingNode>::decode): (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode): (ArgumentCoder<ScrollingStateOverflowScrollProxyNode>::decode): (ArgumentCoder<ScrollingStateFixedNode>::encode): (ArgumentCoder<ScrollingStateFixedNode>::decode): (ArgumentCoder<ScrollingStateStickyNode>::encode): (ArgumentCoder<ScrollingStateStickyNode>::decode): (ArgumentCoder<ScrollingStatePositionedNode>::encode): (ArgumentCoder<ScrollingStatePositionedNode>::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 <akeerthi@apple.com> [Cocoa] Remove soft linking of NetworkExtension.framework https://bugs.webkit.org/show_bug.cgi?id=218314 <rdar://problem/70785239> 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 <cdumez@apple.com> Regression(PSON): Back/forward navigation may hang https://bugs.webkit.org/show_bug.cgi?id=216611 <rdar://problem/68992714> 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 <jiewen_tan@apple.com> [WebAuthn] Make WebContent process talk to the WebAuthn process for WebAuthn requests https://bugs.webkit.org/show_bug.cgi?id=218070 <rdar://problem/70384404> 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 <pvollan@apple.com> [macOS] Add required entitlement for message filtering https://bugs.webkit.org/show_bug.cgi?id=218342 <rdar://problem/70810567> 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 <achristensen@webkit.org> Don't look in the keychain for a preferred client certificate in the network process https://bugs.webkit.org/show_bug.cgi?id=218322 <rdar://problem/64931374> 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 <said@apple.com> 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 <ryanhaddad@apple.com> 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 <pvollan@apple.com> [macOS] Add telemetry for IOKit use https://bugs.webkit.org/show_bug.cgi?id=218343 <rdar://problem/70811875> 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 <clord@igalia.com> [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 <youenn@apple.com> 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 <clord@igalia.com> [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 <wilander@apple.com> PCM: Accept ad click data when the link opens a new window https://bugs.webkit.org/show_bug.cgi?id=214176 <rdar://problem/65358005> 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 <said@apple.com> [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 <timothy_horton@apple.com> macCatalyst WebGL on Apple Silicon devices is using a software renderer https://bugs.webkit.org/show_bug.cgi?id=218303 <rdar://problem/70587571> 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 <weinig@apple.com> 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 <akeerthi@apple.com> [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 <aperez@igalia.com> [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 <achristensen@webkit.org> Use _CFURLConnectionSetFrameworkStubs for SecItemShim instead of DYLD_INTERPOSE on Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218269 <rdar://problem/70491533> 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 <said@apple.com> 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 <timothy_horton@apple.com> Adopt the UIPointerInteraction API https://bugs.webkit.org/show_bug.cgi?id=218266 <rdar://problem/70732850> 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 <cdumez@apple.com> [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 <bburg@apple.com> [Cocoa] Introduce _WKInspectorConfiguration for customizing local and remote Web Inspectors https://bugs.webkit.org/show_bug.cgi?id=217896 <rdar://problem/70355910> 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 <sabouhallawa@apple.com> [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 <achristensen@webkit.org> 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 <weinig@apple.com> 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 <cgarcia@igalia.com> 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 <tetsuharu.ohzeki@gmail.com> 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 <sabouhallawa@apple.com> [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 <achristensen@webkit.org> Add null checks and smart pointers in PDF and Plugin code https://bugs.webkit.org/show_bug.cgi?id=218144 <rdar://problem/69931543> 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 <youenn@apple.com> Add support for VP9 Profile 2 (10-bit color) in WebRTC https://bugs.webkit.org/show_bug.cgi?id=217673 <rdar://problem/70283885> Reviewed by Eric Carlson. * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::pixelBufferPool): 2020-10-26 Zan Dobersek <zdobersek@igalia.com> 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 <rniwa@webkit.org> 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 <eric.carlson@apple.com> [Media in GPU Process] in-band metadata cues sometimes crash https://bugs.webkit.org/show_bug.cgi?id=218106 <rdar://problem/70226170> Reviewed by Jer Noble. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::encodePlatformData): SerializedPlatformDataCueValue::nativeValue() is a RetainPtr<>. 2020-10-23 Miguel Gomez <magomez@igalia.com> [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 <mcatanzaro@gnome.org> [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 <akeerthi@apple.com> [Contact Picker API] Add skeleton implementation of ContactsManager.select() https://bugs.webkit.org/show_bug.cgi?id=218050 <rdar://problem/69862186> 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 <rniwa@webkit.org> 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 <eric.carlson@apple.com> UIClient isn't notified when page muted state changes https://bugs.webkit.org/show_bug.cgi?id=218085 <rdar://problem/70462420> 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 <youenn@apple.com> Introduce worklet destinations and allow to fetch modules with CORS based on destination https://bugs.webkit.org/show_bug.cgi?id=218019 <rdar://problem/70526201> 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 <linkgoron@gmail.com> 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 <akeerthi@apple.com> [iOS] Prevent presentation of input peripherals when focusing form controls with a validation message https://bugs.webkit.org/show_bug.cgi?id=218004 <rdar://problem/70507678> 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, <select> popovers have a strange flashing behavior when presented alongside a validation message, and context menus can fail to present entirely. In order to address these issues, we should never attempt to present both a validation message and an input peripheral. Instead, we can prevent the presentation of input peripherals when the focused control is presenting a validation message. This behavior matches macOS. Note that we still present the keyboard for controls that have a keyboard view, since the keyboard area does overlap the area where a validation message is presented. * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/FocusedElementInformation.h: Added isFocusingWithValidationMessage to the struct, so that the UIProcess knows that the element gained focus due to the presentation of a validation message. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): Prevent an input view from being shown if the control does not present a keyboard and was focused with a validation message. (-[WKContentView _elementDidBlur]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2020-10-22 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: handle key events with non-ASCII unicode code point https://bugs.webkit.org/show_bug.cgi?id=217950 Reviewed by Carlos Alberto Lopez Perez. We are assuming that key events are limited to ASCII, but they contain a unicode code point. Fixes: imported/w3c/webdriver/tests/perform_actions/key_events.py::test_printable_key_sends_correct_events[\xe0-] imported/w3c/webdriver/tests/perform_actions/key_events.py::test_printable_key_sends_correct_events[\u0416-] imported/w3c/webdriver/tests/perform_actions/key_events.py::test_printable_key_sends_correct_events[\u2603-] imported/w3c/webdriver/tests/perform_actions/key_events.py::test_printable_key_sends_correct_events[\uf6c2-] * UIProcess/Automation/SimulatedInputDispatcher.h: Use UChar32 instead of char for CharKey. * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Handle Charkey as a unicode code point. * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Ditto. 2020-10-21 Ryosuke Niwa <rniwa@webkit.org> Move function definitions in JSIPCBinding.h into cpp file https://bugs.webkit.org/show_bug.cgi?id=218065 Reviewed by Wenson Hsieh. Added JSIPCBinding.cpp and moved the code from JSIPCBinding.h to JSIPCBinding.cpp. No new tests since there is no behavior change. * Platform/IPC/JSIPCBinding.cpp: Added. (IPC::jsValueForDecodedStringArgumentValue): Moved from .h. (IPC::jsValueForDecodedArgumentValue<String>): Ditto. (IPC::jsValueForDecodedArgumentValue<URL>): Ditto. (IPC::jsValueForDecodedArgumentValue<RegistrableDomain>): Ditto. (IPC::jsValueForDecodedNumericArgumentValue): Ditto. (IPC::jsValueForDecodedArgumentValue<double>): Ditto. (IPC::jsValueForDecodedArgumentValue<float>): Ditto. (IPC::jsValueForDecodedArgumentValue<int8_t>): Ditto. (IPC::jsValueForDecodedArgumentValue<int16_t>): Ditto. (IPC::jsValueForDecodedArgumentValue<int32_t>): Ditto. (IPC::jsValueForDecodedArgumentValue<int64_t>): Ditto. (IPC::jsValueForDecodedArgumentValue<uint8_t>): Ditto. (IPC::jsValueForDecodedArgumentValue<uint16_t>): Ditto. (IPC::jsValueForDecodedArgumentValue<uint32_t>): Ditto. (IPC::jsValueForDecodedArgumentValue<uint64_t>): Ditto. (IPC::jsValueForDecodedArgumentRect): Ditto. (IPC::jsValueForDecodedArgumentValue<IntRect>): Ditto. (IPC::jsValueForDecodedArgumentValue<FloatRect>): Ditto. * Platform/IPC/JSIPCBinding.h: (IPC::jsValueForDecodedArgumentValue): * Sources.txt: * WebKit.xcodeproj/project.pbxproj: 2020-10-21 Ryosuke Niwa <rniwa@webkit.org> IPC testing API should have the capability to observe messages being sent and received https://bugs.webkit.org/show_bug.cgi?id=217870 Reviewed by Darin Adler. Added IPC.addIncomingMessageListener and IPC.addOutgoingMessageListener which allows JavaScript to observe IPC messages being sent or received by WebContent process. We use the generated code added in r268503 to decode the IPC arguments. Tests: TestWebKitAPI.IPCTestingAPI.CanInterceptAlert TestWebKitAPI.IPCTestingAPI.CanInterceptHasStorageAccess TestWebKitAPI.IPCTestingAPI.CanInterceptFindString * Platform/IPC/Connection.cpp: (IPC::Connection::sendMessage): Added the code to invoke MessageObserver::willSendMessage. Also remove any stale MessageObserver as neded. (IPC::Connection::addMessageObserver): Added. (IPC::Connection::dispatchMessage): Added the code to invoke MessageObserver::didReceiveMessage. Also remove any stale MessageObserver as neded. * Platform/IPC/Connection.h: (IPC::Connection::MessageObserver): Added. A pure virtual interface for observing IPC messages. * Platform/IPC/JSIPCBinding.h: (IPC::jsValueForDecodedStringArgumentValue): Extracted from jsValueForDecodedArgumentValue<String>. Now takes the type name as an argument. (IPC::jsValueForDecodedArgumentValue<URL>): Use "URL" as the type name. (IPC::jsValueForDecodedArgumentValue<RegistrableDomain>): Use "RegistrableDomain" as the type name. (IPC::jsValueForDecodedArgumentValue<OptionSet<U>>): Added. Specializations for OptionSet<U> * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSMessageListener): Added. Implements IPC::MessageObserver. (WebKit::IPCTestingAPI::JSIPC::staticFunctions): (WebKit::IPCTestingAPI::createTypeError): Moved. (WebKit::IPCTestingAPI::JSIPC::addMessageListener): Added. (WebKit::IPCTestingAPI::JSIPC::addIncomingMessageListener): Added. (WebKit::IPCTestingAPI::JSIPC::addOutgoingMessageListener): Added. (WebKit::IPCTestingAPI::JSMessageListener::JSMessageListener): Added. (WebKit::IPCTestingAPI::JSMessageListener::didReceiveMessage): Added. (WebKit::IPCTestingAPI::JSMessageListener::willSendMessage): Added. (WebKit::IPCTestingAPI::JSMessageListener::jsDescriptionFromDecoder): Added. 2020-10-21 Aditya Keerthi <akeerthi@apple.com> Remove unused UIDocumentMenuViewController SPI declarations https://bugs.webkit.org/show_bug.cgi?id=218053 Reviewed by Tim Horton. UIDocumentMenuViewController is deprecated and its last use was removed in r258092. * Platform/spi/ios/UIKitSPI.h: 2020-10-21 Alex Christensen <achristensen@webkit.org> Don't crash when deallocating WKWebView during TLS handshake https://bugs.webkit.org/show_bug.cgi?id=218025 <rdar://problem/70225969> Reviewed by Tim Horton. NetworkProcessProxy::didReceiveAuthenticationChallenge would sometimes dereference an unchecked Optional<SecurityOriginData> which would result in a null dereference crash. Also, sometimes Connection::initializeSendSource would assert because it was trying to set up a cancel handler for a send port that had not been successfully set up yet. I added a test that reproduces both of these issues most of the time. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::initializeSendSource): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): 2020-10-21 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: add support for wheel actions https://bugs.webkit.org/show_bug.cgi?id=217174 Reviewed by Brian Burg. * UIProcess/Automation/Automation.json: Add scroll delta to action state. * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputSourceState::emptyStateForSourceType): Initialize scrollDelta for wheel actions. (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): Handle SimulatedInputSourceType::Wheel. * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::WebAutomationSession): Add SimulatedInputSourceType::Wheel. (WebKit::WebAutomationSession::terminate): Handle pending wheel events. (WebKit::WebAutomationSession::willShowJavaScriptDialog): Ditto. (WebKit::WebAutomationSession::wheelEventsFlushedForPage): Ditto. (WebKit::WebAutomationSession::willClosePage): Ditto. (WebKit::WebAutomationSession::isSimulatingUserInteraction const): Return true if there are pending wheel events too. (WebKit::WebAutomationSession::simulateWheelInteraction): Handle the wheel action. (WebKit::simulatedInputSourceTypeFromProtocolSourceType): Handle Inspector::Protocol::Automation::InputSourceType::Wheel. (WebKit::WebAutomationSession::performInteractionSequence): Initialize the scroll delta for wheel action. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateWheelInteraction): Synthesize a wheel event. * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: (WebKit::WebAutomationSession::platformSimulateWheelInteraction): Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::isProcessingWheelEvents const): Return whether page has pending wheel events. (WebKit::WebPageProxy::didReceiveEvent): Notify automation that pending wheel events have been processed. * UIProcess/WebPageProxy.h: * config.h: 2020-10-20 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Some WebAudio layout tests generate strange noises https://bugs.webkit.org/show_bug.cgi?id=217921 Reviewed by Eric Carlson. RemoteAudioDestination::render() should not return `noErr` unless we can provide the requested samples to the provided AudioBufferList. Otherwise, the audio output unit of CoreAudio will output the samples in the AudioBufferList, which might be invalid data at the beginning of a rendering. We have observed that happens in some layout tests and some WebAudio example pages. Currently, RemoteAudioDestination::render() always returns `noErr` in the render thread (immediately), but the AudioBufferList (ioData) is updated in the main thread (later). This patch fixes that by only setting the bounds of CARingBuffer in the completion handler of sendWithAsyncReply() in the main thread, and fetching AudioBuffer(s) from the CARingBuffer in the render thread. Also, RemoteAudioDestination tracks the progress of fetching, so RemoteAudioDestinationProxy does not need to send `startFrame` and `numberOfFramesToRender` to RemoteAudioDestination in response to a buffer request. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::render): Only return `noErr` if the function renders the requested sample successfully. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::requestBuffer): Remove unused parameters. (WebKit::RemoteAudioDestinationProxy::renderOnRenderingThead): Ditto. * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: Ditto. * WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in: Ditto. 2020-10-20 Chris Dumez <cdumez@apple.com> Drop legacy code using AssertionServices https://bugs.webkit.org/show_bug.cgi?id=217787 <rdar://problem/70160942> Reviewed by Darin Adler. Drop legacy code using AssertionServices as this framework is deprecated in favor of RunningBoard. All our code has been ported to RunningBoard already. * Configurations/WebKit.xcconfig: * Platform/spi/ios/AssertionServicesSPI.h: Removed. * Shared/Cocoa/ProcessTaskStateObserver.h: Removed. * Shared/Cocoa/ProcessTaskStateObserver.mm: Removed. * UIProcess/ApplicationStateTracker.mm: * UIProcess/ProcessAssertion.h: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager init]): (-[WKProcessAssertionBackgroundTaskManager _hasBackgroundTask]): (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): (-[WKProcessAssertionBackgroundTaskManager assertion:didInvalidateWithError:]): (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]): * WebKit.xcodeproj/project.pbxproj: * WebProcess/cocoa/WebProcessCocoa.mm: 2020-10-20 Sam Weinig <weinig@apple.com> Tweak WebPreferences*.yaml "exposed" key to only indicate that the key should not be changeable by the frontend https://bugs.webkit.org/show_bug.cgi?id=217918 Reviewed by Darin Adler. Update to use new "exposed" prefix bindings and use default value explicitly when updating settings for non-exposed preferences. * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesGetterSetters.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb: * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb: 2020-10-20 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: add support for right variations of virtual keys https://bugs.webkit.org/show_bug.cgi?id=217819 Reviewed by Brian Burg. Instead of using a HashSet the pressed virtual keys are now stored in a HashMap where the key is the normalized virtual key and the value is the raw virtual key. * UIProcess/Automation/Automation.json: * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::normalizedVirtualKey): (WebKit::WebAutomationSession::performInteractionSequence): * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::keyCodeForVirtualKey): (WebKit::modifiersForKeyCode): * UIProcess/Automation/mac/WebAutomationSessionMac.mm: (WebKit::keyCodeForVirtualKey): * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: (WebKit::keyCodeForVirtualKey): (WebKit::modifiersForKeyCode): 2020-10-19 Peng Liu <peng.liu6@apple.com> Two feature flag names are incorrect https://bugs.webkit.org/show_bug.cgi?id=217913 Reviewed by Eric Carlson. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultCaptureAudioInGPUProcessEnabled): The correct feature flag is gpu_process_media. (WebKit::defaultVP9SWDecoderEnabledOnBattery): The correct feature flag is sw_vp9_decoder_on_battery. 2020-10-19 Chris Dumez <cdumez@apple.com> [GPU Process] RemoteAudioDestination::render() should not need to dispatch to the main thread to do IPC https://bugs.webkit.org/show_bug.cgi?id=217920 Reviewed by Alex Christensen. RemoteAudioDestination::render() should not need to dispatch to the main thread to do IPC as this is bad for performance and IPC::Connection::sendWithAsyncReply() already does locking internally for thread-safety. The only thing that was preventing us from calling sendWithAsyncReply() from the audio rendering thread was a threading assertion in CompletionHandler that made sure that the completion handler was always called on the thread the completion handler was constructed on. To avoid this issue, I added a paramater to the CompletionHandler constructor allowing the caller to indicate it expects the completion handler to get called on the main thread. I am now using this new flag in sendWithAsyncReply() and at its call site in RemoteAudioDestination::render(). No new tests, no Web-facing behavior change. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::render): * Platform/IPC/Connection.h: (IPC::Connection::sendWithAsyncReply): 2020-10-19 Said Abou-Hallawa <sabouhallawa@apple.com> [GPU Process] Clean the DisplayList recording of the NativeImage https://bugs.webkit.org/show_bug.cgi?id=217573 Reviewed by Simon Fraser. Support encoding and decoding NativeImagePtr directly. * Scripts/webkit/messages.py: * Shared/WebCoreArgumentCoders.cpp: (IPC::encodeNativeImage): (IPC::encodeOptionalNativeImage): (IPC::ArgumentCoder<NativeImagePtr>::encode): (IPC::ArgumentCoder<NativeImagePtr>::decode): (IPC::ArgumentCoder<NativeImageHandle>::encode): Deleted. (IPC::ArgumentCoder<NativeImageHandle>::decode): Deleted. * Shared/WebCoreArgumentCoders.h: * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::paint): 2020-10-18 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] sluggish page scrolling for wheel events since r268499 https://bugs.webkit.org/show_bug.cgi?id=217850 Reviewed by Simon Fraser. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): Include WheelEventProcessingSteps::MainThreadForScrolling to processingSteps for !ENABLE(SCROLLING_THREAD). 2020-10-17 David Kilzer <ddkilzer@apple.com> REGRESSION (r191637): Fix -Wmisleading-indentation warnings in open source clang <https://webkit.org/b/217882> Reviewed by Tim Horton. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::accessibilityAttributeValue): - Fix indentation of source to match what it is doing. 2020-10-16 Said Abou-Hallawa <sabouhallawa@apple.com> [GPU Process] Introduce RemoteResourceCacheProxy to manage the resources in the GPU Process https://bugs.webkit.org/show_bug.cgi?id=217554 Reviewed by Simon Fraser. RemoteResourceCache will be responsible for caching the remote resources. RemoteRenderingBackend will delegate all the resource caching to its RemoteResourceCache. We can get rid of RemoteImageBufferMessageHandler because all it does is is sending messages to WebProcess. Removing it will simplify the interface of RemoteImageBuffer. Sending the messages will be moved to RemoteRenderingBackend. Rename flushDrawingContext() to flushDisplayList() because the name is confusing. This function flushes a DisplayList to the context. No DrawingContext is involved here and there is another function with the same name which does not take any argument. Rename ImageBufferFlushIdentifier to DisplayListFlushIdentifier to make more general name and be ready for GPU DOM rendering. Rename the RemoteRenderingBackendProxy messages: CreateImageBufferBackend and CommitImageBufferFlushContext to be ImageBufferBackendWasCreated and FlushDisplayListWasCommitted. We need to include passive verbs in them to reflect that the actions were taken place in the GPU Process. They are sent only to inform the Web Process with the current state. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::RemoteImageBuffer): (WebKit::RemoteImageBuffer::apply): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::gpuConnectionToWebProcess const): (WebKit::RemoteRenderingBackend::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackend::flushDisplayListWasCommitted): (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::flushDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackend::getImageData): We should call the completion handler even if the ImageBuffer was not found. (WebKit::RemoteRenderingBackend::releaseRemoteResource): (WebKit::RemoteRenderingBackend::flushImageBufferDrawingContext): Deleted. (WebKit::RemoteRenderingBackend::flushImageBufferDrawingContextAndCommit): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.h: (WebKit::RemoteRenderingBackend::renderingBackendIdentifier const): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * GPUProcess/graphics/RemoteResourceCache.cpp: Renamed from Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandler.cpp. (WebKit::RemoteResourceCache::cacheImageBuffer): (WebKit::RemoteResourceCache::cachedImageBuffer): (WebKit::RemoteResourceCache::releaseRemoteResource): * GPUProcess/graphics/RemoteResourceCache.h: Renamed from Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandler.h. * Scripts/webkit/messages.py: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/DisplayListFlushIdentifier.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/ImageBufferFlushIdentifier.h. * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp: (WebKit::RemoteImageBufferMessageHandlerProxy::waitForImageBufferBackendWasCreated): (WebKit::RemoteImageBufferMessageHandlerProxy::waitForFlushDisplayListWasCommitted): (WebKit::RemoteImageBufferMessageHandlerProxy::flushDisplayList): (WebKit::RemoteImageBufferMessageHandlerProxy::flushDisplayListAndWaitCommit): (WebKit::RemoteImageBufferMessageHandlerProxy::commitFlushContext): (WebKit::RemoteImageBufferMessageHandlerProxy::waitForCreateImageBufferBackend): Deleted. (WebKit::RemoteImageBufferMessageHandlerProxy::waitForCommitImageBufferFlushContext): Deleted. (WebKit::RemoteImageBufferMessageHandlerProxy::flushDrawingContext): Deleted. (WebKit::RemoteImageBufferMessageHandlerProxy::flushDrawingContextAndWaitCommit): Deleted. * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::waitForImageBufferBackendWasCreated): (WebKit::RemoteRenderingBackendProxy::waitForFlushDisplayListWasCommitted): (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): (WebKit::RemoteRenderingBackendProxy::waitForCreateImageBufferBackend): Deleted. (WebKit::RemoteRenderingBackendProxy::waitForCommitImageBufferFlushContext): Deleted. (WebKit::RemoteRenderingBackendProxy::createImageBufferBackend): Deleted. (WebKit::RemoteRenderingBackendProxy::commitImageBufferFlushContext): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: 2020-10-16 Wenson Hsieh <wenson_hsieh@apple.com> Add system trace points for flushing remote image buffers https://bugs.webkit.org/show_bug.cgi?id=217853 Reviewed by Simon Fraser. Add trace points to capture drawing context flushes. This encapsulates time spent encoding display lists in preparation for IPC. * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp: (WebKit::RemoteImageBufferMessageHandlerProxy::flushDrawingContext): (WebKit::RemoteImageBufferMessageHandlerProxy::flushDrawingContextAndWaitCommit): 2020-10-16 Devin Rousso <drousso@apple.com> Web Inspector: rename `Highlight` so it doesn't conflict with CSS `Highlight` https://bugs.webkit.org/show_bug.cgi?id=217858 Reviewed by Megan Gardner. No new tests as there is no behavior change since this is purely a rename. * Scripts/webkit/messages.py: * Shared/WebCoreArgumentCoders.h: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<InspectorOverlay::Highlight>::encode): Added. (IPC::ArgumentCoder<InspectorOverlay::Highlight>::decode): Added. (IPC::ArgumentCoder<Highlight>::encode): Deleted. (IPC::ArgumentCoder<Highlight>::decode): Deleted. * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::showInspectorHighlight): * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _showInspectorHighlight:]): * UIProcess/WebPageProxy.messages.in: * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::showInspectorHighlight): * UIProcess/PageClient.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showInspectorHighlight): * UIProcess/Inspector/ios/WKInspectorHighlightView.h: * UIProcess/Inspector/ios/WKInspectorHighlightView.mm: (-[WKInspectorHighlightView _layoutForNodeHighlight:offset:]): (-[WKInspectorHighlightView _layoutForNodeListHighlight:]): (-[WKInspectorHighlightView _layoutForRectsHighlight:]): (-[WKInspectorHighlightView update:]): 2020-10-16 Ryosuke Niwa <rniwa@webkit.org> IPC testing API should expose whether a given IPC message has sync reply or not https://bugs.webkit.org/show_bug.cgi?id=217861 Reviewed by Darin Adler. This patch adds IPC.messages.*.isSync to indicate whether a given IPC message has a sync reply or not. Test: TestWebKitAPI.IPCTestingAPI.AlertIsSyncMessage * Platform/IPC/MessageArgumentDescriptions.h: * Scripts/webkit/messages.py: (generate_js_value_conversion_function): Fixed a typo. (generate_js_argument_descriptions): Ditto. (generate_message_argument_description_implementation): Generate messageIsSync function. * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::JSIPC::wrapperClass): Updated the class name to match the implementation. (WebKit::IPCTestingAPI::JSIPC::messages): Added isSync as a boolean property on message description. 2020-10-16 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Use CARingBuffer to transfer audio data of an audio destination from a web process to the GPU Process https://bugs.webkit.org/show_bug.cgi?id=217715 Reviewed by Jer Noble. The current implementation of RemoteAudioDestination essentially runs the AudioDestinationCocoa in the GPU process, which is not good because we are adding AudioWorklet stuff into AudioDestinationCocoa, but the AudioWorklet stuff is irrelevant to the GPU process. What really needs to run in the GPU process (for Cocoa platforms at least) is the audio output unit. This patch adds WebCore::AudioOutputUnitAdaptor and WebCore::AudioUnitRenderer to implement that. With this patch, RemoteAudioDestination in the GPU process is an AudioUnitRenderer and it embeds an AudioOutputUnitAdaptor like AudioDestinationCocoa does in the Web process. Essentially, we run AudioOutputUnitAdaptor remotely from the AudioDestinationCocoa's perspective. Also, in the current implementation, the RemoteAudioDestinationProxy in a Web process transfers audio data to the RemoteAudioDestination in the GPU process with IPC messages (RemoteAudioBusData). This is not efficient because of the large number of IPC messages for audio samples. With this patch, RemoteAudioDestinationProxy (Web process) transfers audio samples to RemoteAudioDestination(GPU process) with a CARingBuffer providing shared buffers for the Web process and the GPU process. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::create): (WebKit::RemoteAudioDestination::~RemoteAudioDestination): (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::start): (WebKit::RemoteAudioDestination::stop): (WebKit::RemoteAudioDestination::isPlaying const): (WebKit::RemoteAudioDestination::RemoteAudioDestination): (WebKit::RemoteAudioDestination::storage): (WebKit::RemoteAudioDestination::render): (WebKit::RemoteAudioDestinationManager::createAudioDestination): (WebKit::RemoteAudioDestinationManager::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::isPlaying): Deleted. (WebKit::RemoteAudioDestination::framesPerBuffer const): Deleted. * GPUProcess/media/RemoteAudioDestinationManager.h: (WebKit::RemoteAudioDestinationManager::didReceiveSyncMessageFromWebProcess): * GPUProcess/media/RemoteAudioDestinationManager.messages.in: Add a message AudioSamplesStorageChanged to support using CARingBuffer to transmit audio samples to the GPU process. * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/RemoteAudioBusData.h: Removed. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::stop): (WebKit::RemoteAudioDestinationProxy::requestBuffer): (WebKit::RemoteAudioDestinationProxy::renderOnRenderingThead): (WebKit::RemoteAudioDestinationProxy::storageChanged): (WebKit::RemoteAudioDestinationProxy::renderBuffer): Deleted. (WebKit::RemoteAudioDestinationProxy::didChangeIsPlaying): Deleted. * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: RemoteAudioDestinationProxy is a subclass of AudioDestinationCocoa. It pulls audio samples from the WebAudio side and use a CARingBuffer to push audio samples to the audio output unit (managed by RemoteAudioDestination) in the GPU process. * WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in: Add a message RequestBuffer, which can be used by RemoteAudioDestination to ask for (pull) audio samples. * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::pushSamples): A minor fix to get rid of a type conversion. 2020-10-16 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Add an experimental feature flag: WebAuthenticationModernEnabled https://bugs.webkit.org/show_bug.cgi?id=217843 <rdar://problem/70384187> Reviewed by Brent Fulgham. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebAuthenticationModernEnabled): (WKPreferencesGetWebAuthenticationModernEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: 2020-10-16 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Remove experimental feature flag: WebAuthenticationLocalAuthenticatorEnabled https://bugs.webkit.org/show_bug.cgi?id=217796 <rdar://problem/70358912> Reviewed by Brent Fulgham. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebAuthenticationLocalAuthenticatorEnabled): Deleted. (WKPreferencesGetWebAuthenticationLocalAuthenticatorEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::filterTransports const): (WebKit::WebCore::isFeatureEnabled): Deleted. 2020-10-16 Said Abou-Hallawa <sabouhallawa@apple.com> [GPU Process] Exchange RemoteImageBuffer and RemoteImageBufferProxy https://bugs.webkit.org/show_bug.cgi?id=217809 Reviewed by Simon Fraser. The names of the GPU rendering classes have been confusing. RemoteImageBuffer should be the real object in the GPU Process because it owns the backend. And RemoteImageBufferProxy should be a proxy to this object in the Web Process. So we are going to exchange the following classes: -- RemoteImageBuffer <-> RemoteImageBufferProxy -- RemoteRenderingBackend <-> RemoteRenderingBackendProxy -- RemoteImageBufferMessageHandler <-> RemoteImageBufferMessageHandlerProxy * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createRenderingBackend): (WebKit::GPUConnectionToWebProcess::releaseRenderingBackend): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/graphics/PlatformRemoteImageBuffer.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h. * GPUProcess/graphics/RemoteImageBuffer.h: Renamed from Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h. (WebKit::RemoteImageBuffer::create): (WebKit::RemoteImageBuffer::RemoteImageBuffer): (WebKit::RemoteImageBuffer::~RemoteImageBuffer): (WebKit::RemoteImageBuffer::apply): * GPUProcess/graphics/RemoteImageBufferMessageHandler.cpp: Renamed from Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp. (WebKit::RemoteImageBufferMessageHandler::RemoteImageBufferMessageHandler): (WebKit::RemoteImageBufferMessageHandler::createBackend): (WebKit::RemoteImageBufferMessageHandler::commitFlushContext): * GPUProcess/graphics/RemoteImageBufferMessageHandler.h: Renamed from Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h. (WebKit::RemoteImageBufferMessageHandler::backend): * GPUProcess/graphics/RemoteRenderingBackend.cpp: Renamed from Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.cpp. (WebKit::RemoteRenderingBackend::create): (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::~RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::messageSenderConnection const): (WebKit::RemoteRenderingBackend::messageSenderDestinationID const): (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::releaseRemoteResource): (WebKit::RemoteRenderingBackend::getImageData): (WebKit::RemoteRenderingBackend::flushImageBufferDrawingContext): (WebKit::RemoteRenderingBackend::flushImageBufferDrawingContextAndCommit): (WebKit::RemoteRenderingBackend::gpuConnectionToWebProcess const): * GPUProcess/graphics/RemoteRenderingBackend.h: Renamed from Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.h. (WebKit::RemoteRenderingBackend::renderingBackendIdentifier const): * GPUProcess/graphics/RemoteRenderingBackend.messages.in: Renamed from Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in. * GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: Renamed from Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBufferProxy.h. * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp: Removed. * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp: Added. (WebKit::RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy): (WebKit::RemoteImageBufferMessageHandlerProxy::~RemoteImageBufferMessageHandlerProxy): (WebKit::RemoteImageBufferMessageHandlerProxy::getImageData const): (WebKit::RemoteImageBufferMessageHandlerProxy::waitForCreateImageBufferBackend): (WebKit::RemoteImageBufferMessageHandlerProxy::waitForCommitImageBufferFlushContext): (WebKit::RemoteImageBufferMessageHandlerProxy::flushDrawingContext): (WebKit::RemoteImageBufferMessageHandlerProxy::flushDrawingContextAndWaitCommit): (WebKit::RemoteImageBufferMessageHandlerProxy::commitFlushContext): * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h. (WebKit::RemoteImageBufferMessageHandlerProxy::remoteResourceIdentifier const): (WebKit::RemoteImageBufferMessageHandlerProxy::isPendingFlush const): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h. (WebKit::RemoteImageBufferProxy::create): (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): (WebKit::RemoteImageBufferProxy::putImageData): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.cpp. (WebKit::RemoteRenderingBackendProxy::create): (WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy): (WebKit::RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy): (WebKit::RemoteRenderingBackendProxy::messageSenderConnection const): (WebKit::RemoteRenderingBackendProxy::messageSenderDestinationID const): (WebKit::RemoteRenderingBackendProxy::waitForCreateImageBufferBackend): (WebKit::RemoteRenderingBackendProxy::waitForCommitImageBufferFlushContext): (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): (WebKit::RemoteRenderingBackendProxy::createImageBufferBackend): (WebKit::RemoteRenderingBackendProxy::commitImageBufferFlushContext): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h. (WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::ensureRemoteRenderingBackendProxy const): (WebKit::WebChromeClient::createImageBuffer const): (WebKit::WebChromeClient::ensureRemoteRenderingBackend const): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-10-16 Eric Carlson <eric.carlson@apple.com> [GPU Process] Implement VideoPlaybackMetrics https://bugs.webkit.org/show_bug.cgi?id=217439 <rdar://problem/60179370> Reviewed by Jer Noble. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::outOfBandTrackSources): (WebKit::RemoteMediaPlayerProxy::updateCachedState): (WebKit::RemoteMediaPlayerProxy::setShouldUpdatePlaybackMetrics): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::videoPlaybackQualityMetrics): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerState.h: (WebKit::RemoteMediaPlayerState::encode const): (WebKit::RemoteMediaPlayerState::decode): 2020-10-16 Eric Carlson <eric.carlson@apple.com> [GPU Process] Implement mediaPlayerGetRawCookies https://bugs.webkit.org/show_bug.cgi?id=217739 <rdar://problem/70313370> Reviewed by Youenn Fablet. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerGetRawCookies const): * GPUProcess/media/RemoteMediaPlayerProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::getRawCookies const): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: 2020-10-16 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Implement a dummy WebAuthnProcess https://bugs.webkit.org/show_bug.cgi?id=217559 <rdar://problem/70168749> Reviewed by Brent Fulgham. Previous patch r268248 introduces a new daemon to handle all WebAuthn requests. However, after more deeper investigations, the daemon story is not very compelling for WebKit. Here are the two major road blockers: 1) The major one is on macOS. New daemons cannot be installed without a system update. It means relocatable Safari (e.g. STP) and staged Safari on downlevel OSes will not get this feature. And relocatable STP can only utilize the system daemon. This seems a bummer especially for the STP case given it is heavily used to test latest web features. 2) Additional plumbing is needed for testing and engineering builds. This problem is specific to WebKit and is on both macOS and iOS. WebKit doesn't build roots to test engineering builds, which is required to update the plist on the above location. Hence, a separate configuration is needed to generate a different plist that points to the right engineering binary and additional scripts will be needed to ask launchd to load the plist before running any tests. Some extra exercises are probably needed to not confuse launchd about the engineering binary and system binary as well. Given the above constraints, a new architecture is proposed to make the daemon a WebKit XPC service/process instead and leave the launchd event handler to a new Safari daemon. The launchd related feature is only on iOS and therefore it really doesn't make sense to overcome all the above macOS constraints. Having different architectures on iOS (a daemon) and on macOS (a XPC service) accordingly will introduce tons of overhead for maintainance as well. That's why relying on a Safari daemon to do the job is the most reasonable option. This patch therefore focuses on making the WebAuthn process happen and removes the WebAuthn daemon. * CMakeLists.txt: * Configurations/WebAuthnService.xcconfig: Renamed from Source/WebKit/Configurations/WebAuthenticationAgent.xcconfig. * Configurations/WebKit.xcconfig: * Daemons/WebAuthenticationAgent/WebAuthenticationAgent.entitlements: Removed. * Daemons/WebAuthenticationAgent/com.apple.webkit.WebAuthenticationAgent.plist: Removed. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: Paperwork for building the new WebAuthn process. * Platform/ExtraPrivateSymbolsForTAPI.h: * Shared/AuxiliaryProcess.h: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceEventHandler): * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::processStorageClass): (WebKit::sandboxDirectory): Paperwork for introducing the new WebAuthn process. Mostly copied from GPU process. * Sources.txt: * SourcesCocoa.txt: Paperwork for building the new WebAuthn process. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::getLaunchOptions): * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::serviceName): (WebKit::shouldLeakBoost): * UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp: Added. (WebKit::WebAuthnProcessProxy::singleton): (WebKit::WebAuthnProcessProxy::WebAuthnProcessProxy): (WebKit::WebAuthnProcessProxy::getLaunchOptions): (WebKit::WebAuthnProcessProxy::connectionWillOpen): (WebKit::WebAuthnProcessProxy::processWillShutDown): (WebKit::WebAuthnProcessProxy::getWebAuthnProcessConnection): (WebKit::WebAuthnProcessProxy::webAuthnProcessCrashed): (WebKit::WebAuthnProcessProxy::didClose): (WebKit::WebAuthnProcessProxy::didReceiveInvalidMessage): (WebKit::WebAuthnProcessProxy::didFinishLaunching): (WebKit::WebAuthnProcessProxy::updateProcessAssertion): * UIProcess/WebAuthentication/WebAuthnProcessProxy.h: Added. * UIProcess/WebAuthentication/WebAuthnProcessProxy.messages.in: Added. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::getWebAuthnProcessConnection): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getWebAuthnProcessConnection): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-OSX.plist: Copied from Source/WebKit/Daemons/WebAuthenticationAgent/Info.plist. * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: Renamed from Source/WebKit/Daemons/WebAuthenticationAgent/Info.plist. * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnServiceEntryPoint.mm: Copied from Source/WebKit/Daemons/WebAuthenticationAgent/main.mm. (WebKit::WebAuthnServiceInitializerDelegate::WebAuthnServiceInitializerDelegate): (WebKit::initializeAuxiliaryProcess<WebAuthnProcess>): (WEBAUTHEN_SERVICE_INITIALIZER): * WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp: Added. (WebKit::WebAuthnConnectionToWebProcess::create): (WebKit::WebAuthnConnectionToWebProcess::WebAuthnConnectionToWebProcess): (WebKit::WebAuthnConnectionToWebProcess::~WebAuthnConnectionToWebProcess): (WebKit::WebAuthnConnectionToWebProcess::didClose): (WebKit::WebAuthnConnectionToWebProcess::didReceiveInvalidMessage): * WebAuthnProcess/WebAuthnConnectionToWebProcess.h: Copied from Source/WebKit/Daemons/WebAuthenticationAgent/main.mm. (WebKit::WebAuthnConnectionToWebProcess::connection): (WebKit::WebAuthnConnectionToWebProcess::WebAuthnProcessProcess): (WebKit::WebAuthnConnectionToWebProcess::webProcessIdentifier const): * WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in: Added. * WebAuthnProcess/WebAuthnProcess.cpp: Added. (WebKit::WebAuthnProcess::WebAuthnProcess): (WebKit::WebAuthnProcess::~WebAuthnProcess): (WebKit::WebAuthnProcess::createWebAuthnConnectionToWebProcess): (WebKit::WebAuthnProcess::removeWebAuthnConnectionToWebProcess): (WebKit::WebAuthnProcess::connectionToWebProcessClosed): (WebKit::WebAuthnProcess::shouldTerminate): (WebKit::WebAuthnProcess::didClose): (WebKit::WebAuthnProcess::lowMemoryHandler): (WebKit::WebAuthnProcess::initializeWebAuthnProcess): (WebKit::WebAuthnProcess::prepareToSuspend): (WebKit::WebAuthnProcess::processDidResume): (WebKit::WebAuthnProcess::resume): (WebKit::WebAuthnProcess::processDidTransitionToForeground): (WebKit::WebAuthnProcess::processDidTransitionToBackground): (WebKit::WebAuthnProcess::webProcessConnection const): * WebAuthnProcess/WebAuthnProcess.h: Added. * WebAuthnProcess/WebAuthnProcess.messages.in: Added. * WebAuthnProcess/WebAuthnProcessCreationParameters.cpp: Copied from Source/WebKit/Daemons/WebAuthenticationAgent/main.mm. (WebKit::WebAuthnProcessCreationParameters::encode const): (WebKit::WebAuthnProcessCreationParameters::decode): * WebAuthnProcess/WebAuthnProcessCreationParameters.h: Copied from Source/WebKit/Daemons/WebAuthenticationAgent/main.mm. * WebAuthnProcess/ios/WebAuthnProcessIOS.mm: Copied from Source/WebKit/Daemons/WebAuthenticationAgent/main.mm. (WebKit::WebAuthnProcess::initializeProcess): (WebKit::WebAuthnProcess::initializeProcessName): (WebKit::WebAuthnProcess::initializeSandbox): * WebAuthnProcess/mac/WebAuthnProcessMac.mm: Added. (WebKit::WebAuthnProcess::initializeProcess): (WebKit::WebAuthnProcess::initializeProcessName): (WebKit::WebAuthnProcess::initializeSandbox): Paperwork for introducing the new WebAuthn process. Mostly copied from GPU process. * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: Added. The sandbox profile is originally from the GPU Process with IOKit related rules removed. Will tighten it again after the process is fully functional. * WebKit.xcodeproj/project.pbxproj: Paperwork for building the new WebAuthn process. * WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp: Copied from Source/WebKit/Daemons/WebAuthenticationAgent/main.mm. (WebKit::WebAuthnProcessConnection::WebAuthnProcessConnection): (WebKit::WebAuthnProcessConnection::~WebAuthnProcessConnection): (WebKit::WebAuthnProcessConnection::didClose): (WebKit::WebAuthnProcessConnection::didReceiveInvalidMessage): * WebProcess/WebAuthentication/WebAuthnProcessConnection.h: Renamed from Source/WebKit/Daemons/WebAuthenticationAgent/main.mm. (WebKit::WebAuthnProcessConnection::create): (WebKit::WebAuthnProcessConnection::connection): * WebProcess/WebAuthentication/WebAuthnProcessConnection.messages.in: Added. * WebProcess/WebAuthentication/WebAuthnProcessConnectionInfo.h: Added. (WebKit::WebAuthnProcessConnectionInfo::identifier const): (WebKit::WebAuthnProcessConnectionInfo::releaseIdentifier): (WebKit::WebAuthnProcessConnectionInfo::encode const): (WebKit::WebAuthnProcessConnectionInfo::decode): * WebProcess/WebProcess.cpp: (WebKit::getWebAuthnProcessConnection): (WebKit::WebProcess::ensureWebAuthnProcessConnection): (WebKit::WebProcess::webAuthnProcessConnectionClosed): * WebProcess/WebProcess.h: (WebKit::WebProcess::existingWebAuthnProcessConnection): Paperwork for introducing the new WebAuthn process. Mostly copied from GPU process. 2020-10-16 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Remove the "alg" field in the attestation statement https://bugs.webkit.org/show_bug.cgi?id=217720 <rdar://problem/70349734> Reviewed by Brent Fulgham. This old field was used in an unreleased old attestation statement format and is not used by the final attestation statement format that will be added to the spec: https://github.com/w3c/webauthn/pull/1491. Therefore, remove it to resolve confusion. Covered by existing tests. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): 2020-10-16 Youenn Fablet <youenn@apple.com> Add support for GPUProcess WebAudio media element providers https://bugs.webkit.org/show_bug.cgi?id=217704 Reviewed by Eric Carlson. Introduce RemoteAudioSourceProviderManager which receives IPC messages from GPU process for web audio data. RemoteAudioSourceProviderManager sends it to the identified RemoteAudioSourceProvider. Introduce RemoteAudioSourceProviderProxy which is a client to the AV AudioSourceProviderAVFObjC. RemoteAudioSourceProviderProxy will send IPC messages to RemoteAudioSourceProviderManager to send audio data and description. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: Added. (WebKit::RemoteAudioSourceProviderProxy::create): (WebKit::RemoteAudioSourceProviderProxy::RemoteAudioSourceProviderProxy): (WebKit::RemoteAudioSourceProviderProxy::createRingBuffer): (WebKit::RemoteAudioSourceProviderProxy::newAudioSamples): (WebKit::RemoteAudioSourceProviderProxy::storageChanged): * GPUProcess/media/RemoteAudioSourceProviderProxy.h: Added. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::~RemoteMediaPlayerProxy): (WebKit::RemoteMediaPlayerProxy::createAudioSourceProvider): (WebKit::RemoteMediaPlayerProxy::setShouldEnableAudioSourceProvider): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::audioSourceProviderManager): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/media/RemoteAudioSourceProvider.cpp: (WebKit::RemoteAudioSourceProvider::create): (WebKit::RemoteAudioSourceProvider::RemoteAudioSourceProvider): (WebKit::RemoteAudioSourceProvider::close): (WebKit::RemoteAudioSourceProvider::hasNewClient): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: Added. (WebKit::RemoteAudioSourceProviderManager::RemoteAudioSourceProviderManager): (WebKit::RemoteAudioSourceProviderManager::~RemoteAudioSourceProviderManager): (WebKit::RemoteAudioSourceProviderManager::setConnection): (WebKit::RemoteAudioSourceProviderManager::addProvider): (WebKit::RemoteAudioSourceProviderManager::removeProvider): (WebKit::RemoteAudioSourceProviderManager::dispatchToThread): (WebKit::RemoteAudioSourceProviderManager::audioStorageChanged): (WebKit::RemoteAudioSourceProviderManager::audioSamplesAvailable): (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::RemoteAudio): (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage): (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::audioSamplesAvailable): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: Added. (WebKit::RemoteAudioSourceProviderManager::create): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.messages.in: Added. * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: 2020-10-15 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Move AppAttestInternal related code from WKA to OpenSource https://bugs.webkit.org/show_bug.cgi?id=217790 <rdar://problem/59613406> Reviewed by Brent Fulgham. Covered by manual testing. * Platform/spi/Cocoa/AppAttestSPI.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/AppAttestInternalSoftLink.mm. * SourcesCocoa.txt: * UIProcess/WebAuthentication/Cocoa/AppAttestInternalSoftLink.h: Added. * UIProcess/WebAuthentication/Cocoa/AppAttestInternalSoftLink.mm: Added. * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::getAttestation const): * UIProcess/WebAuthentication/Cocoa/LocalService.mm: (WebKit::LocalService::isAvailable): * WebKit.xcodeproj/project.pbxproj: 2020-10-15 David Kilzer <ddkilzer@apple.com> v2: WebKit::XPCServiceEventHandler block should call exit() on the main thread <https://webkit.org/b/217773> <rdar://problem/70275659> Reviewed by Geoff Garen. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceEventHandler): - Use NSRunLoop instead of libdispatch to run code on the main thread since libdispatch can randomly pick a new main thread when exit() is called on the original main thread. 2020-10-15 Tim Horton <timothy_horton@apple.com> iPhone apps and iPad apps linked before iOS 13 running on macOS get desktop UA unexpectedly https://bugs.webkit.org/show_bug.cgi?id=217798 <rdar://problem/70254509> Reviewed by Wenson Hsieh. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommended): Share more of the code with iOS, for compatibility and consistency's sake: iOS apps running on macOS should use the mobile UA if they are iPhone-only, or if they were linked on an SDK earlier than iOS 13. This matches their behavior on iPad. 2020-10-15 Per Arne Vollan <pvollan@apple.com> [macOS] Issue temporary sandbox extension to the Launch Services daemon https://bugs.webkit.org/show_bug.cgi?id=217781 <rdar://problem/70350924> Reviewed by Brent Fulgham. To support blocking of the Launch Services daemon in the WebContent process, issue temporary sandbox extension to this service on macOS. * 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): * WebProcess/com.apple.WebProcess.sb.in: 2020-10-15 Per Arne Vollan <pvollan@apple.com> [macOS] Add telemetry for distributed notification service https://bugs.webkit.org/show_bug.cgi?id=217762 <rdar://problem/70341045> Reviewed by Brent Fulgham. Add telemetry with backtrace for the distributed notification service on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2020-10-15 David Kilzer <ddkilzer@apple.com> PDFPlugin.mm:2303:139: error: type 'SEL _Nullable' cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing] <https://webkit.org/b/217791> <rdar://problem/70349804> Reviewed by Tim Horton. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::handleContextMenuEvent): - Use `!!` to convert result to `bool`. 2020-10-15 Aditya Keerthi <akeerthi@apple.com> Crash in -[WKDateTimePicker setDateTimePickerToInitialValue] https://bugs.webkit.org/show_bug.cgi?id=217763 <rdar://problem/68635008> Reviewed by Wenson Hsieh. Crash occurs due to the use of an autoreleased NSString in setDateTimePickerToInitialValue. To fix, make the variable a RetainPtr. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker setDateTimePickerToInitialValue]): 2020-10-15 Chris Lord <clord@igalia.com> [GTK][WPE] Add support for smooth scrolling animation with async scrolling https://bugs.webkit.org/show_bug.cgi?id=210382 Reviewed by Carlos Garcia Campos. Add hasPreciseScrollingDeltas to GTK/WPE wheel events. No new tests needed. * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): * Shared/WebWheelEvent.cpp: (WebKit::WebWheelEvent::WebWheelEvent): (WebKit::WebWheelEvent::encode const): (WebKit::WebWheelEvent::decode): * Shared/WebWheelEvent.h: * Shared/WebWheelEventCoalescer.cpp: (WebKit::WebWheelEventCoalescer::canCoalesce): (WebKit::WebWheelEventCoalescer::coalesce): * Shared/gtk/NativeWebWheelEventGtk.cpp: (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): * Shared/libwpe/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): 2020-10-15 Youenn Fablet <youenn@apple.com> Introduce a RemoteAudioSourceProvider to receive audio samples for web audio from GPUProcess https://bugs.webkit.org/show_bug.cgi?id=217710 Reviewed by Eric Carlson. Make use of WebAudioSourceProviderAVFObjC to implement RemoteAudioSourceProvider. RemoteAudioSourceProvider currently implements an AudioSourceProvider but it is not yet connected to GPUProcess media players. This will be implemented in a follow-up. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::~MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::audioSourceProvider): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteAudioSourceProvider.cpp: Added. (WebKit::RemoteAudioSourceProvider::create): (WebKit::RemoteAudioSourceProvider::RemoteAudioSourceProvider): (WebKit::RemoteAudioSourceProvider::~RemoteAudioSourceProvider): (WebKit::RemoteAudioSourceProvider::close): (WebKit::RemoteAudioSourceProvider::hasNewClient): (WebKit::RemoteAudioSourceProvider::audioSamplesAvailable): (WebKit::RemoteAudioSourceProvider::logChannel const): * WebProcess/GPU/media/RemoteAudioSourceProvider.h: Added. * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: 2020-10-15 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, mid October 2020, take two https://bugs.webkit.org/show_bug.cgi?id=217734 Unreviewed build fix. * UIProcess/WebProcessProxy.cpp: Add missing WebPreferencesKeys.h header. 2020-10-14 Brent Fulgham <bfulgham@apple.com> [iOS] Allow additional sysctl reads needed by image decoding https://bugs.webkit.org/show_bug.cgi?id=217733 <rdar://problem/68649171> Reviewed by Per Arne Vollan. Telemetry on iOS 14 shows that we are hitting some sandbox violations during image decoding. We should grant access to hw.byteorder, hw.cachelinesize_compat, and hw.vectorunit. We should silence warnings about hw.cpufrequency_compat since it is not needed in web-facing use cases. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-10-14 Ryosuke Niwa <rniwa@webkit.org> Unreviewed build fix for non-Cocoa platforms & release builds. * Platform/IPC/Connection.cpp: (IPC::Connection::dispatchSyncMessage): 2020-10-14 Ryosuke Niwa <rniwa@webkit.org> IPC testing JS API should expose a reply and describe the list of arguments for each message https://bugs.webkit.org/show_bug.cgi?id=217565 Reviewed by Geoffrey Garen. This patch makes IPC.sendMessage and IPC.sendSyncMessage decode the reply. IPC.sendSyncMessage now returns a dictionary with two keys: "buffer" and "arguments", the first of which returns ArrayBuffer of the decoded message reply and the second of which is an array of decoded arguments where there was an appropriate JS binding code existed for the argument type. IPC.sendMessage now returns a Promise which can either resolve with the same dictionary as IPC.sendSyncMessage or reject when the decoding fails. In addition, this patch exposes a dictionary describing each IPC message argument's type and parameter name. In order to add these two functionalities, this patch adds a new step in generate-message-receiver.py to generate MessageArgumentDescriptions.cpp, which contains functions which know how to decode arguments of any IPC message and create a JS dictionary describing it as well as functions that return descriptions of arguments or reply arguments. Finally, this patch adds encoders for a few types found to be very common after r268239 had been landed. Tests: TestWebKitAPI.IPCTestingAPI.DecodesReplyArgumentsForPrompt TestWebKitAPI.IPCTestingAPI.DecodesReplyArgumentsForAsyncMessage TestWebKitAPI.IPCTestingAPI.DescribesArguments * CMakeLists.txt: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Platform/IPC/Decoder.h: (IPC::Decoder::buffer const): * Platform/IPC/JSIPCBinding.h: Added. (jsValueForDecodedArgumentValue): Added. A template function to construct a JS value for a given C++ value. (jsValueForDecodedNumericArgumentValue): Added. A helper for constructing a JS value for numeric values. (jsValueForDecodedArgumentRect): Added. Ditto for IntRect and FloatRect. (DecodedArgumentJSValueConverter): Added. A helper class to construct JS values for a tuple of values using partial template specializations. (DecodedArgumentJSValueConverter::convert): Added. (jsValueForArgumentTuple): Added. A helper to construct a JS array for the decoded IPC arguments. (jsValueForDecodedArguments): Added. * Platform/IPC/MessageArgumentDescriptions.h: Added. (IPC::ArgumentDescription): Added. * Scripts/generate-message-receiver.py: (main): Generate MessageArgumentDescriptions.cpp. * Scripts/webkit/messages.py: (headers_for_type): Removed the special case for PaymentMethodUpdate now that it's in its own header. Also added made webrtc::WebKitEncodedFrameInfo include LibWebRTCEnumTraits.h as it uses webrtc::VideoFrameType. (collect_header_conditions_for_receiver): Extracted from generate_message_handler. (generate_header_includes_from_conditions): Ditto. (generate_message_handler): (generate_js_value_conversion_function): Added. (generate_js_argument_descriptions): Added. (generate_message_argument_description_implementation): Added. * Shared/ApplePay/ApplePayPaymentSetupFeaturesWebKit.h: Fixed a bug that we were not forward declaring NSArray. * SourcesCocoa.txt: Added MessageArgumentDescriptions.cpp as a non-unified cpp file as its size is around 1MB. * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSIPC::staticValues): Added the session ID and page ID as static variables. (WebKit::IPCTestingAPI::encodePointType): Added. (WebKit::IPCTestingAPI::encodeRectType): Fixed the bug was that this code wasn't checking for any exceptions. (WebKit::IPCTestingAPI::encodeNumericType): Renamed from encodeIntegralType since this function is now used to encode double and float, not just integral types. (WebKit::IPCTestingAPI::encodeArgument): Added the support for IntPoint, FloatPoint, URL, RegistrableDomain, double, and float all of which turned out to be in the top 20 most common types. (WebKit::IPCTestingAPI::jsResultFromReplyDecoder): Added. (WebKit::IPCTestingAPI::JSIPC::sendMessage): Added the code to return Promise when there is a reply and resolve it with the JS object describing the decoded argument. We use messageReplyArgumentDescriptions to figure out whether there is a reply or not. (WebKit::IPCTestingAPI::JSIPC::sendSyncMessage): Decode the reply and return a JS object which describes it. (WebKit::IPCTestingAPI::JSIPC::frameID): Renamed from frameIdentifier to be consistent. (WebKit::IPCTestingAPI::JSIPC::pageID): Added. (WebKit::IPCTestingAPI::JSIPC::sessionID): Added. (WebKit::IPCTestingAPI::createJSArrayForArgumentDescriptions): Added. (WebKit::IPCTestingAPI::JSIPC::messages): Added the code to generate descriptions for arguments. 2020-10-14 Chris Dumez <cdumez@apple.com> REGRESSION(r268423) SHOULD NEVER BE REACHED: GPUConnectionToWebProcess::didReceiveMessage(IPC::Connection &, IPC::Decoder &) https://bugs.webkit.org/show_bug.cgi?id=217730 <rdar://problem/70308112> Reviewed by Geoffrey Garen. r268423 added support for registering IPC WorkQueueMessageReceivers & ThreadMessageReceivers with a given identifier. When receiving an IPC message, we would look up the key [ReceiverName, ID] in the receiver map and pass the message to this receiver. This introduced a crash because of an existing ThreadMessageReceiver (RemoteAudioMediaStreamTrackRenderer) was registering itself as a message receiver without an identifier (ID=0). However, the IPC senders on GPU process side would pass a non-0 identifier when sending the IPC. As a result, we would fail to look up the receiver in the map when receiving those IPC messages. While existing code should probably be fixed so that senders and receivers agree on on identifier, I have decided to fix the issue in this patch at IPC::Connection level. When receiving an IPC message, we first check if there is a "global" receiver in the map by looking up key [ReceiverName, 0]. If there is, we pass the IPC to this one. If there isn't, we look up the key [ReceiverName, ID] in the map and use the more specific receiver. The reason I chose to fix it this way is that the code in MessageReceiverMap (which is used for receivers that are not using a WorkQueue or a Thread) behaves in this fashion. I believe it is good to have consistency between all kinds of receivers. No new tests, covered by existing test that is crashing on the bots. * Platform/IPC/Connection.cpp: (IPC::Connection::threadMessageReceiver): (IPC::Connection::workQueueMessageReceiver): (IPC::Connection::dispatchMessageToWorkQueueReceiver): (IPC::Connection::dispatchMessageToThreadReceiver): * Platform/IPC/Connection.h: 2020-10-14 Simon Fraser <simon.fraser@apple.com> Scrolls in the passive handler region should be reported as handled promptly https://bugs.webkit.org/show_bug.cgi?id=217718 Reviewed by Tim Horton. The UI process will enqueue wheel events to send later if the WebContent process doesn't promptly respond that it has handled the previous event. When scrolling in the passive event region, we want the WebContent process to appear responsive, so respond to the UI process when we've scrolled (which is before the event has been dispatched for DOM events). Hard to test because CPU-constrained bots don't send wheel events in a predictable way. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::wheelEvent): 2020-10-14 Ryosuke Niwa <rniwa@webkit.org> Enabling IPC testing API should prevent the termination of WebContent process which sends an invalid IPC https://bugs.webkit.org/show_bug.cgi?id=217698 Reviewed by Geoffrey Garen. A part of this was landed in r268431 but this patch formally disables UI process' default behavior to terminate a Web process upon receiving an invalid message from it. Tests: IPCTestingAPI.CanSendInvalidAsyncMessageWithoutTermination IPCTestingAPI.CanSendInvalidMessageWithoutTermination * Platform/IPC/Connection.cpp: (IPC::Connection::dispatchSyncMessage): Disable the debug assertion if the IPC testing API is enabled. * Platform/IPC/Connection.h: (IPC::Connection::setIgnoreInvalidMessageForTesting): Added. (IPC::Connection::ignoreInvalidMessageForTesting const): Added. (IPC::Connection::m_ignoreInvalidMessageForTesting): Added. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): Set the flag on WebProcessProxy to trigger the behavior. (WebKit::WebPageProxy::launchProcess): Ditto. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didReceiveInvalidMessage): Use the flag on Connection instead of reaching out to the default page group. (WebKit::WebProcessProxy::setIgnoreInvalidMessageForTesting): Added. Remember the fact we've enabled IPC testing API in a member variable and propagate the flag to Connection if a Web process is already running. (WebKit::WebProcessProxy::didFinishLaunching): Propagte the flag to the newly launched Web process. * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::m_ignoreInvalidMessageForTesting): Added. 2020-10-14 Per Arne Vollan <pvollan@apple.com> [macOS] Issue sandbox extension to additional icon service when attachment element is enabled. https://bugs.webkit.org/show_bug.cgi?id=217706 <rdar://problem/70291100> Reviewed by Brent Fulgham. Issue sandbox extension to 'com.apple.iconservices.store' when attachment element is enabled on macOS. * 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/WebPageProxy.cpp: (WebKit::attachmentElementServices): (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: * WebProcess/com.apple.WebProcess.sb.in: 2020-10-14 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r268431 and r268443. https://bugs.webkit.org/show_bug.cgi?id=217728 Broke debug builds of GTK, WinCairo and Playstation ports Reverted changesets: "IPC testing JS API should expose a reply and describe the list of arguments for each message" https://bugs.webkit.org/show_bug.cgi?id=217565 https://trac.webkit.org/changeset/268431 "IPC testing JS API should expose a reply and describe the list of arguments for each message" https://bugs.webkit.org/show_bug.cgi?id=217565 https://trac.webkit.org/changeset/268443 2020-10-14 Don Olmstead <don.olmstead@sony.com> Non-unified build fixes, mid October 2020 https://bugs.webkit.org/show_bug.cgi?id=217721 Reviewed by Yusuke Suzuki. * NetworkProcess/Downloads/DownloadManager.cpp: * UIProcess/Downloads/DownloadProxyMap.cpp: 2020-10-14 Devin Rousso <drousso@apple.com> REGRESSION (r268384): ASSERTION FAILED: _startCount > 1 in -[WKMouseDeviceObserver stop] https://bugs.webkit.org/show_bug.cgi?id=217684 <rdar://problem/70272646> Reviewed by Tim Horton. The `ASSERT` was incorrect in that it's possible for `_startCount` to be equal to `1`. Also add a check to make sure `_startCount` doesn't overflow. * UIProcess/ios/WKMouseDeviceObserver.mm: (-[WKMouseDeviceObserver stop]): * UIProcess/ios/WKStylusDeviceObserver.mm: (-[WKStylusDeviceObserver stop]): 2020-10-14 Sergio Villar Senin <svillar@igalia.com> [GLIB] Fix linking error for systems not providing <sys/memfd.h> https://bugs.webkit.org/show_bug.cgi?id=217514 Reviewed by Carlos Garcia Campos. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: Unconditionally check for <sys/mman.h> which should always exist instead of <sys/memfd.h>. Also define the fallback with syscall() only for linux systems (as it requires <linux/memfd.h>). 2020-10-14 Kate Cheney <katherine_cheney@apple.com> Remove ResourceLoadStatistics telemetry https://bugs.webkit.org/show_bug.cgi?id=217665 <rdar://problem/69748988> Reviewed by Sam Weinig. Telemetry calculation in ITP is unused, very complicated, a potential privacy risk, and it causes flaky tests. We should remove it. No new tests. Existing ITP tests will check for no behavior change. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::makeMedianWithUIQuery): Deleted. (WebKit::buildQueryStartAndEnd): Deleted. (WebKit::makeMedianWithoutUIQuery): Deleted. (WebKit::getMedianOfPrevalentResourcesWithUserInteraction): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResources const): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResourcesWithUI const): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::getTopPrevelentResourceDaysSinceUI const): Deleted. (WebKit::getMedianOfPrevalentResourceWithoutUserInteraction): Deleted. (WebKit::getNumberOfPrevalentResourcesInTopResources): Deleted. (WebKit::makeStatisticQuery): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::getNumberOfPrevalentResourcesWithoutUI const): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::calculateTelemetryData const): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore): (WebKit::ResourceLoadStatisticsMemoryStore::calculateAndSubmitTelemetry const): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::setShouldSubmitTelemetry): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::performDailyTasks): (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry): Deleted. (WebKit::WebResourceLoadStatisticsStore::submitTelemetry): Deleted. (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp: Removed. * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.h: Removed. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::submitTelemetry): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::notifyPageStatisticsTelemetryFinished): Deleted. * NetworkProcess/NetworkSession.h: * SourcesCocoa.txt: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsSubmitTelemetry): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::submitTelemetry): Deleted. (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsTelemetryFinished): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::notifyPageStatisticsTelemetryFinished): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::submitTelemetry): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * PlatformFTW.cmake: * SourcesGTK.txt: * PlatformPlayStation.cmake: * PlatformWin.cmake: * SourcesWPE.txt: 2020-10-14 Kate Cheney <katherine_cheney@apple.com> Remove _WKWebViewCategory from WKWebViewConfiguration https://bugs.webkit.org/show_bug.cgi?id=217679 <rdar://problem/70260337> Reviewed by Sam Weinig. This property is not used in any meaningful way. Its original purpose was to categorize WKWebViews for app-bound domains, but this is now done using the isNavigatingToAppBoundDomain property on WebPageProxy. We should remove it. No new tests, behavior confirmed by existing tests. * Shared/WebViewCategory.h: Removed. * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::webViewCategory const): Deleted. (API::PageConfiguration::setWebViewCategory): Deleted. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (toWebKitWebViewCategory): Deleted. (toWKWebViewCategory): Deleted. (-[WKWebViewConfiguration _webViewCategory]): Deleted. (-[WKWebViewConfiguration _setWebViewCategory:]): Deleted. * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): * WebKit.xcodeproj/project.pbxproj: 2020-10-14 Joonghun Park <jh718.park@samsung.com> Unreviewed. Fix the build warning below since r268312. warning: control reaches end of non-void function [-Wreturn-type] No new tests, no new behaviors. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::numberOfConnectedGamepadsForTesting): 2020-10-14 Joonghun Park <jh718.park@samsung.com> Unreviewed. Fix the build warning below since r222233. warning: redundant move in return statement [-Wredundant-move] No new tests, no new behaviors. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::decode): 2020-10-13 Julian Gonzalez <julian_a_gonzalez@apple.com> Null dereference in PDFPlugin::snapshot() https://bugs.webkit.org/show_bug.cgi?id=217668 Reviewed by Ryosuke Niwa. Add a null pointer check in PDFPlugin's snapshot method to prevent a crash if the backing store's size isn't sufficient for the ShareableBitmap. Test: plugins/pdf-plugin-null-onloaddeddata.html * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::snapshot): 2020-10-12 Ryosuke Niwa <rniwa@webkit.org> IPC testing JS API should expose a reply and describe the list of arguments for each message https://bugs.webkit.org/show_bug.cgi?id=217565 Reviewed by Geoffrey Garen. This patch makes IPC.sendMessage and IPC.sendSyncMessage decode the reply. IPC.sendSyncMessage now returns a dictionary with two keys: "buffer" and "arguments", the first of which returns ArrayBuffer of the decoded message reply and the second of which is an array of decoded arguments where there was an appropriate JS binding code existed for the argument type. IPC.sendMessage now returns a Promise which can either resolve with the same dictionary as IPC.sendSyncMessage or reject when the decoding fails. In addition, this patch exposes a dictionary describing each IPC message argument's type and parameter name. In order to add these two functionalities, this patch adds a new step in generate-message-receiver.py to generate MessageArgumentDescriptions.cpp, which contains functions which know how to decode arguments of any IPC message and create a JS dictionary describing it as well as functions that return descriptions of arguments or reply arguments. Finally, this patch adds encoders for a few types found to be very common after r268239 had been landed. Tests: TestWebKitAPI.IPCTestingAPI.DecodesReplyArgumentsForPrompt TestWebKitAPI.IPCTestingAPI.DecodesReplyArgumentsForAsyncMessage TestWebKitAPI.IPCTestingAPI.DescribesArguments * CMakeLists.txt: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Platform/IPC/Decoder.h: (IPC::Decoder::buffer const): * Platform/IPC/JSIPCBinding.h: Added. (jsValueForDecodedArgumentValue): Added. A template function to construct a JS value for a given C++ value. (jsValueForDecodedNumericArgumentValue): Added. A helper for constructing a JS value for numeric values. (jsValueForDecodedArgumentRect): Added. Ditto for IntRect and FloatRect. (DecodedArgumentJSValueConverter): Added. A helper class to construct JS values for a tuple of values using partial template specializations. (DecodedArgumentJSValueConverter::convert): Added. (jsValueForArgumentTuple): Added. A helper to construct a JS array for the decoded IPC arguments. (jsValueForDecodedArguments): Added. * Platform/IPC/MessageArgumentDescriptions.h: Added. (IPC::ArgumentDescription): Added. * Scripts/generate-message-receiver.py: (main): Generate MessageArgumentDescriptions.cpp. * Scripts/webkit/messages.py: (headers_for_type): Removed the special case for PaymentMethodUpdate now that it's in its own header. Also added made webrtc::WebKitEncodedFrameInfo include LibWebRTCEnumTraits.h as it uses webrtc::VideoFrameType. (collect_header_conditions_for_receiver): Extracted from generate_message_handler. (generate_header_includes_from_conditions): Ditto. (generate_message_handler): (generate_js_value_conversion_function): Added. (generate_js_argument_descriptions): Added. (generate_message_argument_description_implementation): Added. * Shared/ApplePay/ApplePayPaymentSetupFeaturesWebKit.h: Fixed a bug that we were not forward declaring NSArray. * SourcesCocoa.txt: Added MessageArgumentDescriptions.cpp as a non-unified cpp file as its size is around 1MB. * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSIPC::staticValues): Added the session ID and page ID as static variables. (WebKit::IPCTestingAPI::encodePointType): Added. (WebKit::IPCTestingAPI::encodeRectType): Fixed the bug was that this code wasn't checking for any exceptions. (WebKit::IPCTestingAPI::encodeNumericType): Renamed from encodeIntegralType since this function is now used to encode double and float, not just integral types. (WebKit::IPCTestingAPI::encodeArgument): Added the support for IntPoint, FloatPoint, URL, RegistrableDomain, double, and float all of which turned out to be in the top 20 most common types. (WebKit::IPCTestingAPI::jsResultFromReplyDecoder): Added. (WebKit::IPCTestingAPI::JSIPC::sendMessage): Added the code to return Promise when there is a reply and resolve it with the JS object describing the decoded argument. We use messageReplyArgumentDescriptions to figure out whether there is a reply or not. (WebKit::IPCTestingAPI::JSIPC::sendSyncMessage): Decode the reply and return a JS object which describes it. (WebKit::IPCTestingAPI::JSIPC::frameID): Renamed from frameIdentifier to be consistent. (WebKit::IPCTestingAPI::JSIPC::pageID): Added. (WebKit::IPCTestingAPI::JSIPC::sessionID): Added. (WebKit::IPCTestingAPI::createJSArrayForArgumentDescriptions): Added. (WebKit::IPCTestingAPI::JSIPC::messages): Added the code to generate descriptions for arguments. 2020-10-13 Ellie Epskamp-Hunt <eepskamphunt@apple.com> Expose a property on WKWebView to know if it's being inspected. https://bugs.webkit.org/show_bug.cgi?id=217629 rdar://70073369 Reviewed by Brian Burg. Move an existing property from WKWebViewPrivateForTesting to WKWebViewPrivate so Safari can know when a web view is being inspected. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _isBeingInspected]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _hasInspectorFrontend]): Deleted. 2020-10-13 Chris Dumez <cdumez@apple.com> WebAudio tests are crashing in debug when enabling the GPU process https://bugs.webkit.org/show_bug.cgi?id=217663 Reviewed by Geoff Garen. WebAudio tests were crashing in debug when enabling the GPU process because it did audio processing on the WebContent process's main thread. To address the issue, I made RemoteAudioDestinationProxy a ThreadMessageReceiver so that it receives IPC on an audio thread instead of the main thread. IPC messages are processed directly on the AudioWorklet thread when active or on an audio thread constructed by RemoteAudioDestinationProxy otherwise. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::RemoteAudioDestination): Use a PushPullFIFO structure in render() to avoid hanging the audio rendering thread on a semaphore. Hanging the rendering thread was terrible for performance and was also a source of deadlock since the underlying framework is holding a lock while render() is called. We could process a RemoteAudioDestination::CreateAudioDestination sync IPC on the main thread and deadlock on that lock. * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/webrtc/NetworkRTCProvider.h: * WebProcess/Network/webrtc/LibWebRTCNetwork.h: * WebProcess/cocoa/RemoteCaptureSampleManager.h: Use ThreadMessageReceiverRefCounted instead of ThreadMessageReceiver since those classes do not provide their own RefCounting. * Platform/IPC/Connection.cpp: (IPC::Connection::addWorkQueueMessageReceiver): (IPC::Connection::removeWorkQueueMessageReceiver): (IPC::Connection::addThreadMessageReceiver): (IPC::Connection::removeThreadMessageReceiver): (IPC::Connection::processIncomingMessage): (IPC::Connection::dispatchMessageToWorkQueueReceiver): (IPC::Connection::dispatchMessageToThreadReceiver): * Platform/IPC/Connection.h: (IPC::Connection::ThreadMessageReceiver::ref): (IPC::Connection::ThreadMessageReceiver::deref): - Add support for passing a destinationID when registering a WorkQueueMessageReceiver or a ThreadMessageReceiver, similarly to regular MessageReceivers. This was needed here since The GPUProcess sends IPC messages to the RemoteAudioDestinationProxy with a given destinationID and since RemoteAudioDestinationProxy is now a ThreadMessageReceiver. - Stop having ThreadMessageReceiver subclass ThreadSafeRefCounted since RemoteAudioDestinationProxy already subclasses ThreadSafeRefCounted indirectly. A new ThreadMessageReceiverRefCounted class was added for convenience for existing code that relied on its refcounting. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::~RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::stop): (WebKit::RemoteAudioDestinationProxy::renderBuffer): (WebKit::RemoteAudioDestinationProxy::didChangeIsPlaying): (WebKit::RemoteAudioDestinationProxy::dispatchToThread): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: Use a PushPullFIFO container in render() to avoid handing the audio rendering thread on a semaphore while the Render IPC is getting processed by the WebProcess. 2020-10-13 Per Arne Vollan <pvollan@apple.com> [iOS 14] Hang in -[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] https://bugs.webkit.org/show_bug.cgi?id=217183 <rdar://problem/69916673> Reviewed by Geoffrey Garen. Dispatch this work on a non-main thread, in order to avoid blocking the main thread. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]): 2020-10-13 Keith Rollin <krollin@apple.com> Remove leftover MACOSX_DEPLOYMENT_TARGET_macosx support https://bugs.webkit.org/show_bug.cgi?id=217649 <rdar://problem/70236877> Reviewed by Darin Adler. Bug 42796 introduced MACOSX_DEPLOYMENT_TARGET_<PLATFORM> as "support for compiling WebKit against iOS SDKs". Support for the iOS part of this feature was later removed in several changes, including Bug 139212, Bug 139463 and Bug 144762. However, vestiges have remained for five or six years in the form of MACOSX_DEPLOYMENT_TARGET_macosx. The inclusion of the platform in MACOSX_DEPLOYMENT_TARGET is no longer needed and can be removed. This changes brings most projects in conformance with other projects that don't support including the platform in MACOSX_DEPLOYMENT_TARGET, including WebEditingTester, gtest, WebKitTestRunner, MiniBrowser, and TestWebKitAPI. Along the way, remove a couple of left-over references to macOS 10.16, and a couple of places where [sdk=macosx*] was still being used. With this change, initialization of MACOSX_DEPLOYMENT_TARGET should be consistent across all projects, with two exceptions: WebKitLauncher (which hardcodes it to 10.12) and libwebrtc's copy of googletest (which hardcodes it to 10.4). The reasons for these hard-coded values is not apparent, so leave them be. * Configurations/DebugRelease.xcconfig: 2020-10-13 Simon Fraser <simon.fraser@apple.com> Plumb OptionSet<WheelEventProcessingSteps> through the wheel event handling code https://bugs.webkit.org/show_bug.cgi?id=217660 Reviewed by Tim Horton. Async scrolling in passive wheel event regions will require that the main thread event handling code knows that the scrolling thread did the scrolling. To propagate this information, plumb OptionSet<WheelEventProcessingSteps> through. No behavior change. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): (WebKit::EventDispatcher::dispatchWheelEventViaMainThread): (WebKit::EventDispatcher::dispatchWheelEvent): * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::handleWheelEvent): (WebKit::WebPage::wheelEvent): * WebProcess/WebPage/WebPage.h: 2020-10-13 Alex Christensen <achristensen@webkit.org> Allow legacy custom scheme registration on non-main threads https://bugs.webkit.org/show_bug.cgi?id=217656 <rdar://problem/70228036> Reviewed by Brady Eidson. r267802 was quite necessary, but it exposed an internal client calling our API on a background thread, which crashes now. Make it not crash. There is a race condition in their registration, but there already was. * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (+[WKBrowsingContextController registerSchemeForCustomProtocol:]): (+[WKBrowsingContextController unregisterSchemeForCustomProtocol:]): 2020-10-13 Kimmo Kinnunen <kkinnunen@apple.com> Cocoa: Make WebGLLayer not dependent on GraphicsContextGLOpenGL https://bugs.webkit.org/show_bug.cgi?id=217212 <rdar://problem/69876022> Reviewed by Dean Jackson. Removed unneeded inclusions of GraphicsContextGLOpenGL.h. The file is now using non-public headers. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/mac/WebPageMac.mm: 2020-10-12 Devin Rousso <drousso@apple.com> CSS "any-pointer:fine" media query false on iPad/Pencil https://bugs.webkit.org/show_bug.cgi?id=212580 <rdar://problem/63813283> Reviewed by Wenson Hsieh. Use `+[UIScribbleInteraction isPencilInputExpected]` as a proxy for the presence of stylus devices as there's no way of directly querying for connected stylus devices (especially if there is no active connection). When the value is changed to `YES`, notify all WebProcess immediately. When the value is changed to `NO`, use an `NSTimer` to delay notifying all WebProcess for 10min in case the user starts using their stylus again. For live-on/tweaking purposes this 10min timeout can be adjusted before the UIProcess is created with the `WKStylusDeviceObserverChangeTimeInterval` key in `NSUserDefaults`. * UIProcess/ios/WKStylusDeviceObserver.h: Added. * UIProcess/ios/WKStylusDeviceObserver.mm: Added. (+[WKStylusDeviceObserver sharedInstance]): (-[WKStylusDeviceObserver init]): (-[WKStylusDeviceObserver setHasStylusDevice:]): (-[WKStylusDeviceObserver start]): (-[WKStylusDeviceObserver stop]): (-[WKStylusDeviceObserver observeValueForKeyPath:ofObject:change:context:]): (-[WKStylusDeviceObserver startChangeTimer:]): (-[WKStylusDeviceObserver changeTimerFired:]): Use ObjC KVO to listen for changes to `+[UIScribbleInteraction isPencilInputExpected]`. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::notifyHasStylusDeviceChanged): Added. * UIProcess/ios/WebProcessProxyIOS.mm: (WebKit::WebProcessProxy::platformInitialize): (WebKit::WebProcessProxy::platformDestroy): Tell the shared `WKStylusDeviceObserver` to start listening when creating the WebProcess. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * Shared/WebProcessCreationParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): Use the current state of the shared `WKStylusDeviceObserver` when creating WebProcess instead of sending a `SetHasStylusDevice` message immediately after the WebProcess is created. * WebProcess/WebProcess.messages.in: * WebProcess/WebProcess.h: (WebKit::WebProcess::hasStylusDevice const): Added. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setHasStylusDevice): Added. (WebKit::WebProcess::initializeWebProcess): Update style (including `any-pointer`) whenever stylus devices change. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::hasStylusDevice): Added. (WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const): Include `fine` when there is a stylus device. * UIProcess/ios/WKMouseDeviceObserver.h: * UIProcess/ios/WKMouseDeviceObserver.mm: (-[WKMouseDeviceObserver start]): (-[WKMouseDeviceObserver stop]): (-[WKMouseDeviceObserver dealloc]): Removed. Drive-by: use a count of `start`/`stop` instead of `WebProcessProxy::allProcesses` size. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2020-10-12 Darin Adler <darin@apple.com> Eliminate some "using namespace WebCore" cases in global scope https://bugs.webkit.org/show_bug.cgi?id=217644 Reviewed by Tim Horton. * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: * WebProcess/Automation/WebAutomationSessionProxy.cpp: Move "using namespace WebCore" inside WebKit namespace. 2020-10-12 Tim Horton <timothy_horton@apple.com> Fix the macCatalyst build ("reference to 'Rect' is ambiguous") https://bugs.webkit.org/show_bug.cgi?id=217642 <rdar://problem/70224629> Reviewed by Wenson Hsieh. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker initWithView:datePickerMode:]): (-[WKDateTimePicker shouldPresentGregorianCalendar:]): (-[WKDateTimePicker controlBeginEditing]): (-[WKDateTimeInputControl initWithView:]): An earlier unified source's `using namespace WebCore` inside `namespace WebKit` and then WKDateTimeInputControl's `using namespace WebKit` in the global namespace resulted in once-again conflicting definitions of `Rect` between CSS code and MacTypes.h. 2020-10-12 Andy Estes <aestes@apple.com> Unreviewed build fix after r268367. * Configurations/WebKit.xcconfig: Corrected the definition of WK_PDFKIT_LDFLAGS_maccatalyst. 2020-10-12 Tim Horton <timothy_horton@apple.com> Cursor window is transparent - but not hidden - when `cursor: none` is specified https://bugs.webkit.org/show_bug.cgi?id=217639 <rdar://problem/70006186> Reviewed by Simon Fraser. * Platform/spi/mac/AppKitSPI.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::setCursor): Adopt new AppKit SPI to actually hide the cursor when we set it to the "none" shape. This hiding lives until the next time the app-global cursor shape is changed by any client.] We'll re-set it the next time we set the "none" shape. This is important, because on some platforms, hiding the cursor is a performance improvement over simply making it transparent. 2020-10-12 Said Abou-Hallawa <sabouhallawa@apple.com> [GPU Process]: Replace "ImageBufferIdentifier" by a generic identifier named "RemoteResourceIdentifier" https://bugs.webkit.org/show_bug.cgi?id=217550 Reviewed by Simon Fraser. GPU Process needs a universal identifier for drawing cached resources and drawing buffers and layers. The meaning of RemoteResourceIdentifier will depend on the context it is used in. * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp: (WebKit::RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy): (WebKit::RemoteImageBufferMessageHandlerProxy::createBackend): (WebKit::RemoteImageBufferMessageHandlerProxy::commitFlushContext): * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h: * GPUProcess/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): (WebKit::RemoteRenderingBackendProxy::getImageData): (WebKit::RemoteRenderingBackendProxy::flushImageBufferDrawingContext): (WebKit::RemoteRenderingBackendProxy::flushImageBufferDrawingContextAndCommit): (WebKit::RemoteRenderingBackendProxy::releaseImageBuffer): Deleted. * GPUProcess/graphics/RemoteRenderingBackendProxy.h: * GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in: * Scripts/webkit/messages.py: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp: (WebKit::RemoteImageBufferMessageHandler::RemoteImageBufferMessageHandler): (WebKit::RemoteImageBufferMessageHandler::~RemoteImageBufferMessageHandler): (WebKit::RemoteImageBufferMessageHandler::getImageData const): (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext): (WebKit::RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit): * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h: (WebKit::RemoteImageBufferMessageHandler::remoteResourceIdentifier const): (WebKit::RemoteImageBufferMessageHandler::imageBufferIdentifier const): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::releaseRemoteResource): (WebKit::RemoteRenderingBackend::createImageBufferBackend): (WebKit::RemoteRenderingBackend::commitImageBufferFlushContext): (WebKit::RemoteRenderingBackend::releaseImageBuffer): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackend.h: * WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in: 2020-10-12 Luming Yin <luming_yin@apple.com> [macOS] Workaround for MAC_OS_X_VERSION_MAJOR incorrectly including minor version when building with Xcode 12 on macOS Big Sur SUs https://bugs.webkit.org/show_bug.cgi?id=217602 rdar://70194453 Reviewed by Darin Adler. The previous workaround turns out to be ineffective because we can't set the value of TARGET_MAC_OS_X_VERSION_MAJOR based on a previous value of itself. Introduce a new variable TARGET_MAC_OS_X_VERSION_MAJOR to determine whether we need to explicitly adjust MAC_OS_X_VERSION_MAJOR to 110000. * Configurations/DebugRelease.xcconfig: 2020-10-12 Andy Estes <aestes@apple.com> [macCatalyst] Enable WKPDFView https://bugs.webkit.org/show_bug.cgi?id=217403 <rdar://problem/48217791> Reviewed by Tim Horton. * Configurations/WebKit.xcconfig: Linked PDFKit.framework when building for the Catalyst variant on Big Sur or later. 2020-10-12 Youenn Fablet <youenn@apple.com> Add support for MediaRecorder bitrate getters https://bugs.webkit.org/show_bug.cgi?id=217383 Reviewed by Eric Carlson. Pipe up bit rates through IPC * GPUProcess/webrtc/RemoteMediaRecorder.h: (WebKit::RemoteMediaRecorder::audioBitRate const): (WebKit::RemoteMediaRecorder::videoBitRate const): * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::createRecorder): * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): 2020-10-12 Luming Yin <luming_yin@apple.com> [macOS] Workaround for MAC_OS_X_VERSION_MAJOR incorrectly including minor version when building with Xcode 12 on macOS Big Sur SUs https://bugs.webkit.org/show_bug.cgi?id=217602 rdar://70194453 Reviewed by Darin Adler. Due to a bug in Xcode (rdar://70185899), Xcode 12.0 and Xcode 12.1 Beta incorrectly includes the minor release number in MAC_OS_X_VERSION_MAJOR, which causes Debug and Release builds of WebKit to be misconfigured when building on macOS Big Sur SUs, leading to webpages failing to load. To work around the Xcode bug, when the MAC_OS_X_VERSION_MAJOR includes the minor version number, drop the minor version number by explicitly setting TARGET_MAC_OS_X_VERSION_MAJOR to 110000. Note: This change should be reverted after <rdar://70185899> is resolved. * Configurations/DebugRelease.xcconfig: 2020-10-12 Alex Christensen <achristensen@webkit.org> DownloadProxy::cancel should take a CompletionHandler https://bugs.webkit.org/show_bug.cgi?id=217547 Reviewed by Youenn Fablet. This paves the way for a new download cancel API that looks like this: - (void)cancelByProducingResumeData:(void (^)(NSData *resumeData))completionHandler; In order to do this, we push the legacy didCancel client call into the legacy API implementations. The resume data will be accessible through this completion handler and the didFail callback instead of querying the DownloadProxy wrapper for it, so I renamed it to legacyResumeData. No change in behavior, as verified by existing tests. * UIProcess/API/APIDownloadClient.h: (API::DownloadClient::legacyDidCancel): (API::DownloadClient::didCancel): Deleted. * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): * UIProcess/API/C/WKDownload.cpp: (WKDownloadGetResumeData): (WKDownloadCancel): * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload cancel]): (-[_WKDownload resumeData]): * UIProcess/API/glib/WebKitDownload.cpp: (webkit_download_cancel): * UIProcess/API/glib/WebKitDownloadClient.cpp: * UIProcess/Cocoa/LegacyDownloadClient.h: * UIProcess/Cocoa/LegacyDownloadClient.mm: (WebKit::LegacyDownloadClient::legacyDidCancel): (WebKit::LegacyDownloadClient::didCancel): Deleted. * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::cancel): (WebKit::DownloadProxy::didFail): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::legacyResumeData const): (WebKit::DownloadProxy::client): (WebKit::DownloadProxy::resumeData const): Deleted. 2020-10-11 Sam Weinig <weinig@apple.com> [Preferences] Introduce string based SPI for WKPreferences to allow tests to change internal behavior without always adding additional SPI https://bugs.webkit.org/show_bug.cgi?id=217582 Reviewed by Darin Adler. Add SPI for setting any WebKit preference using the key as defined in the WebPreferences*.yaml files. This will allow adding testing of non-default behavior that we don't necessarily want to expose via its own API or SPI. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Scripts/PreferencesTemplates/WebPreferencesGetterSetters.cpp.erb: Added. * WebKit.xcodeproj/project.pbxproj: Add new generated file, WebPreferencesGetterSetters.cpp. * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: Moved getter/setter definitions to WebPreferencesGetterSetters.cpp.erb * UIProcess/WebPreferences.cpp: * UIProcess/WebPreferences.h: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetBoolValueForKey): (WKPreferencesSetDoubleValueForKey): (WKPreferencesSetUInt32ValueForKey): (WKPreferencesSetStringValueForKey): * UIProcess/API/C/WKPreferencesRefPrivate.h: Expose new SPI. 2020-10-11 Luming Yin <luming_yin@apple.com> Strip patch version from TARGET_MAC_OS_X_VERSION_MAJOR when building for macOS Big Sur or later https://bugs.webkit.org/show_bug.cgi?id=217594 rdar://70188497 Reviewed by Darin Adler. To ensure successful Mac Catalyst WebKit builds, strip the patch version from TARGET_MAC_OS_X_VERSION_MAJOR by using two `base:`s on MACOSX_DEPLOYMENT_TARGET. * Configurations/Base.xcconfig: 2020-10-11 Michael Catanzaro <mcatanzaro@gnome.org> -Wreorder in MediaPlayerPrivateRemote.cpp https://bugs.webkit.org/show_bug.cgi?id=217590 Reviewed by Eric Carlson. Reorder initializer list to avoid misleading initialization order. It might be nicer to actually reorder the member variables in the class itself, which would probably be safe, but that would be a behavior change and I'd rather avoid changing behavior. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): 2020-10-11 Luming Yin <luming_yin@apple.com> Ignore deployment suffix and identifier when computing major OS version for macOS Big Sur and newer https://bugs.webkit.org/show_bug.cgi?id=217584 rdar://70168426 Reviewed by Darin Adler. Stop using MACOSX_DEPLOYMENT_TARGET:suffix:identifier to compute major OS versions. Only use the deployment target base for macOS Big Sur and newer. Keep the manual definitions for legacy versions of macOS. * Configurations/Base.xcconfig: 2020-10-10 Sam Weinig <weinig@apple.com> Use WebPreference definitions from shared configuration files in WebCore (Part 1) https://bugs.webkit.org/show_bug.cgi?id=217551 Reviewed by Darin Adler. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::sendViewportAttributesChanged): Add explicit type to support layoutFallbackWidth now being an unsigned int in Settings (it was already an unsigned int at the WebKit level). 2020-10-10 Adrian Perez de Castro <aperez@igalia.com> [GTK] Build broken with ENABLE_GAMEPAD enabled https://bugs.webkit.org/show_bug.cgi?id=217226 Reviewed by Darin Adler. * UIProcess/Gamepad/UIGamepadProvider.h: Mark class as final, because the destructor is final itself. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::numberOfConnectedGamepadsForTesting): Reorganize PLATFORM(MAC) guards to use GameControllerGamepadProvider only on macOS, as it is unavailable on other ports. * WebProcess/Gamepad/WebGamepadProvider.h: Mark class as final, because the destructor is final itself. 2020-10-09 Wenson Hsieh <wenson_hsieh@apple.com> [GPU Process] Add additional support for painting video elements to 2D contexts https://bugs.webkit.org/show_bug.cgi?id=217532 Reviewed by Tim Horton. See WebCore/ChangeLog for more details. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::shouldUseRemoteRenderingFor): 2020-10-09 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Enable audio routing arbitration on Mac https://bugs.webkit.org/show_bug.cgi?id=217528 Reviewed by Eric Carlson. Use the audio routing arbitration implementation in the Web process and UI process before moving AudioSessionRoutingArbitratorProxy to the GPU process (which will require some sandbox changes). * WebProcess/GPU/media/RemoteAudioSession.cpp: (WebKit::RemoteAudioSession::setCategory): (WebKit::RemoteAudioSession::category const): * WebProcess/GPU/media/RemoteAudioSession.h: 2020-10-09 Ryan Haddad <ryanhaddad@apple.com> Promote WKWebView media playback SPI to API https://bugs.webkit.org/show_bug.cgi?id=217335 Unreviewed build fix for macCatalyst. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::isUserFacingChanged): 2020-10-09 Simon Fraser <simon.fraser@apple.com> Refactor wheel event coalescing into its own class https://bugs.webkit.org/show_bug.cgi?id=217523 Reviewed by Sam Weinig. WebPageProxy had some confusing code for coalescing wheel events, first added in r116466. To prepare this code for partial re-use in another place, factor it into its own class, WebWheelEventCoalescer. WebWheelEventCoalescer holds a queue of pending NativeWebWheelEvents, and a queue of sequences of NativeWebWheelEvents, where each sequence has been coalesced into a single WebWeelEvent which was sent to the Web Process. When the UI process receives a message back from the Web Process, it calls takeOldestEventBeingProcessed() which removes the first sequence from m_eventsBeingProcessed. This code has to track NativeWebWheelEvents, because we need to dig the NSEvent out of the NativeWebWheelEvent at this stage. * Platform/Logging.h: Add a WheelEvents log channel. * Shared/NativeWebWheelEvent.h: * Shared/WebWheelEventCoalescer.cpp: Added. (WebKit::operator<<): (WebKit::WebWheelEventCoalescer::canCoalesce): (WebKit::WebWheelEventCoalescer::coalesce): (WebKit::WebWheelEventCoalescer::shouldDispatchEventNow const): (WebKit::WebWheelEventCoalescer::nextEventToDispatch): (WebKit::WebWheelEventCoalescer::shouldDispatchEvent): (WebKit::WebWheelEventCoalescer::takeOldestEventBeingProcessed): (WebKit::WebWheelEventCoalescer::clear): * Shared/WebWheelEventCoalescer.h: Added. (WebKit::WebWheelEventCoalescer::hasEventsBeingProcessed const): * Sources.txt: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handleWheelEvent): (WebKit::WebPageProxy::wheelEventCoalescer): (WebKit::WebPageProxy::didReceiveEvent): (WebKit::WebPageProxy::resetStateAfterProcessExited): (WebKit::canCoalesce): Deleted. (WebKit::coalesce): Deleted. (WebKit::coalescedWheelEvent): Deleted. (WebKit::WebPageProxy::processNextQueuedWheelEvent): Deleted. (WebKit::WebPageProxy::shouldProcessWheelEventNow const): Deleted. * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: 2020-10-09 Per Arne Vollan <pvollan@apple.com> [GPU Process] Use correct GPU runtime settings when creating the dynamic IOKit sandbox extensions for the WebContent process https://bugs.webkit.org/show_bug.cgi?id=217491 <rdar://problem/70066087> Reviewed by Youenn Fablet. Currently, the creation of the dynamic IOKit sandbox extensions for the WebContent process is incorrectly using the same GPU runtime settings as when creating Media related dynamic mach-lookup extensions. There are several other GPU runtime flags that needs to be checked before creating the extensions. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-10-09 Chris Fleizach <cfleizach@apple.com> AX: Mark malware safe browser as a header for VoiceOver https://bugs.webkit.org/show_bug.cgi?id=217505 Reviewed by Sam Weinig. Mark this UI element as a header for VoiceOver on iOS. * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (makeLabel): 2020-10-09 Alex Christensen <achristensen@webkit.org> Change RELEASE_ASSERT to ASSERT in networkProcessesSet https://bugs.webkit.org/show_bug.cgi?id=217524 <rdar://problem/70115841> Reviewed by Tim Horton. * UIProcess/Network/NetworkProcessProxy.cpp: 2020-10-09 Per Arne Vollan <pvollan@apple.com> [macOS] Issue sandbox extension for icon service when attachment element is enabled https://bugs.webkit.org/show_bug.cgi?id=217483 <rdar://problem/70099680> Reviewed by Brent Fulgham. This has previously been done on iOS, and should be done on macOS as well. * 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/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebProcessProxy.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/com.apple.WebProcess.sb.in: 2020-10-09 Alex Christensen <achristensen@webkit.org> Merge DownloadProxy::DidReceiveResponse and DownloadProxy::DecideDestinationWithSuggestedFilename into one message https://bugs.webkit.org/show_bug.cgi?id=217519 Reviewed by Youenn Fablet. No change in behavior. The current API has them as separate callbacks so we can have them as separate messages, but future API probably won't, so let's merge them. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::findPendingDownloadLocation): * UIProcess/API/APIDownloadClient.h: (API::DownloadClient::didReceiveAuthenticationChallenge): (API::DownloadClient::decideDestinationWithSuggestedFilename): (API::DownloadClient::didReceiveResponse): Deleted. * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): * UIProcess/Cocoa/LegacyDownloadClient.h: * UIProcess/Cocoa/LegacyDownloadClient.mm: (WebKit::LegacyDownloadClient::decideDestinationWithSuggestedFilename): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): (WebKit::DownloadProxy::didReceiveResponse): Deleted. * UIProcess/Downloads/DownloadProxy.h: * UIProcess/Downloads/DownloadProxy.messages.in: 2020-10-09 Kate Cheney <katherine_cheney@apple.com> Promote WKWebView media playback SPI to API https://bugs.webkit.org/show_bug.cgi?id=217335 <rdar://problem/63406100> Reviewed by Jer Noble. Currently the only way to interact with video in WKWebView is by injecting JavaScript into a page. It would be useful to promote various media playback SPI to API to make this easier for clients, including adding completion handlers to the new API calls. Along with this, we should add new API to check for media playback state. This patch keeps the SPI around for compatibility. * Shared/API/Cocoa/WebKit.h: * Shared/MediaPlaybackState.h: Added. * UIProcess/API/Cocoa/WKMediaPlaybackState.h: Added. * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView closeAllMediaPresentations]): (-[WKWebView pauseAllMediaPlayback:]): (-[WKWebView suspendAllMediaPlayback:]): (-[WKWebView resumeAllMediaPlayback:]): (toWKMediaPlaybackState): (-[WKWebView requestMediaPlaybackState:]): (-[WKWebView _closeAllMediaPresentations]): (-[WKWebView _stopAllMediaPlayback]): (-[WKWebView _suspendAllMediaPlayback]): (-[WKWebView _resumeAllMediaPlayback]): * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController _showPhishingAlert]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestMediaPlaybackState): (WebKit::WebPageProxy::pauseAllMediaPlayback): (WebKit::WebPageProxy::suspendAllMediaPlayback): (WebKit::WebPageProxy::resumeAllMediaPlayback): (WebKit::WebPageProxy::stopAllMediaPlayback): Deleted. * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::requestMediaPlaybackState): (WebKit::WebPage::pauseAllMediaPlayback): (WebKit::WebPage::suspendAllMediaPlayback): (WebKit::WebPage::resumeAllMediaPlayback): (WebKit::WebPage::stopAllMediaPlayback): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-10-09 Alex Christensen <achristensen@webkit.org> Use sendWithAsyncReply for NetworkProcess::CancelDownload https://bugs.webkit.org/show_bug.cgi?id=217420 Reviewed by Youenn Fablet. This paves the way for a good download API that has a completion handler when you call cancel that gives you the resume data if it can. Currently you have to call cancel on the download, wait for didCancel on the delegate, then get the resume data from the download again. This has the side effect of DownloadMonitor cancellations calling didFailWithError instead of didCancel, which makes sense and shouldn't cause any problems in practice. Safari is the only API client that uses this, and it behaves similarly in didCancel and didFailWithError. * NetworkProcess/Downloads/Download.cpp: (WebKit::Download::cancel): (WebKit::Download::didCancel): * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::cancelDownload): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/DownloadMonitor.cpp: (WebKit::DownloadMonitor::timerFired): * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::cancel): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm: (-[WKDownloadProgress performCancel]): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::cancelDownload): (WebKit::NetworkProcess::findPendingDownloadLocation): (WebKit::NetworkProcess::pendingDownloadCanceled): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::createData): (WebKit::DownloadProxy::cancel): (WebKit::DownloadProxy::didCancel): Deleted. * UIProcess/Downloads/DownloadProxy.h: * UIProcess/Downloads/DownloadProxy.messages.in: 2020-10-09 Youenn Fablet <youenn@apple.com> Switch Allow/Don't Allow buttons in getUserMedia prompt https://bugs.webkit.org/show_bug.cgi?id=217513 <rdar://problem/70134429> Reviewed by Eric Carlson. Return NotAllowedError instead of SecurityError in case user denies with default prompt. Make sure to have the Allow button in iOS prompt on the right instead of the left. Tested in MiniBrowser and MobileMiniBrowser. * UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm: (WebKit::UserMediaPermissionRequestProxy::doDefaultAction): 2020-10-09 Youenn Fablet <youenn@apple.com> Implement TCC checks in UserMediaPermissionRequestManagerProxy https://bugs.webkit.org/show_bug.cgi?id=217508 <rdar://problem/70129993> Reviewed by Eric Carlson. TCC checks must be done before asking the page client to decide whether to grant or not camera and/or microphone. This ensures that, should the default action be done (default prompt), for instance in case the WKWebView application does not provide any delegate, the TCC checks will happen before the default prompt. For that reason, we move the TCC checks from UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest to UserMediaPermissionRequestManagerProxy::requestSystemValidation. Manually tested in Safari and MiniBrowser. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): (WebKit::requestUserMediaAuthorizationForFrame): Deleted. (WebKit::requestAVCaptureAccessForMediaType): Deleted. * UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm: (WebKit::requestAVCaptureAccessForMediaType): (WebKit::UserMediaPermissionRequestManagerProxy::requestSystemValidation): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): (WebKit::UserMediaPermissionRequestManagerProxy::decidePolicyForUserMediaPermissionRequest): (WebKit::UserMediaPermissionRequestManagerProxy::requestSystemValidation): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::preferences const): 2020-10-08 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Implement a dummy WebAuthenticationAgent https://bugs.webkit.org/show_bug.cgi?id=217401 <rdar://problem/70012011> Reviewed by Darin Adler. Part 1. This patch introduces a new dummy WebAuthenticationAgent where in the future it will take over all WebAuthn operations from the UI Process such that we can isolate high privileged entitlements to this standalone daemon and therefore are able offer WebAuthn to third party WKWebView clients. One of the future feautres will require this new process to listen to LaunchEvents, which only daemons can do. That's why it is implemented as a user agent instead of a XPC service. This is the first part of establishing such a dummy daemon. What it does is to set up a new build target for the daemon and hook it up with WebKit's build system. One can manually load the launchd plist and load the daemon to verify this change. Commands are: launchctl load /to/your/path/com.apple.webkit.WebAuthenticationAgent.plist launchctl start com.apple.webkit.WebAuthenticationAgent.Development Covered by manual tests. * Configurations/WebAuthenticationAgent.xcconfig: Added. Somehow the executable has a suffix .Development for debug/release builds. Will fix that in the later part. * Daemons/WebAuthenticationAgent/Info.plist: Added. * Daemons/WebAuthenticationAgent/WebAuthenticationAgent.entitlements: Added. * Daemons/WebAuthenticationAgent/com.apple.webkit.WebAuthenticationAgent.plist: Added. The executable location is hardcoded for now. It will be fixed in Part 2 to dynamically point to the right binary. * Daemons/WebAuthenticationAgent/main.mm: Added. (main): * WebKit.xcodeproj/project.pbxproj: Not sure why libWTF.a is needed. Will fix that in the later part. 2020-10-08 Chris Fleizach <cfleizach@apple.com> AX: Website Warning page is inaccessible https://bugs.webkit.org/show_bug.cgi?id=217489 Reviewed by Zalan Bujtas. If we have a safe browsing window, we need to use that instead of the content view. * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::accessibilityAttributeValue): 2020-10-08 Alex Christensen <achristensen@webkit.org> REGRESSION (r267763): SHOULD NEVER BE REACHED in WebKit::contentRuleListsFromIdentifier https://bugs.webkit.org/show_bug.cgi?id=217499 There was an invalid assertion. NBD. * UIProcess/WebProcessProxy.cpp: (WebKit::contentRuleListsFromIdentifier): 2020-10-08 Ryosuke Niwa <rniwa@webkit.org> Make it possible to send an arbitrary IPC message from JavaScript https://bugs.webkit.org/show_bug.cgi?id=217423 <rdar://problem/69969351> Reviewed by Geoffrey Garen. This patch introduces the JavaScript API (window.IPC) to send IPC out of WebContent process. The feature is compiled in under ASAN and Debug builds and can be enabled at runtime. window.IPC has two methods: sendMessage and sendSyncMessage which sends an async and sync IPC respectively. It takes the destination process name (UI, GPU, or Networking), the destination ID (e.g. WebPageProxy ID), message ID, timeout for sendSyncMessage, and optionally IPC message arguments. The message arguments can be passed in as a TypedArray or ArrayBuffer, or a JavaScript array that recursively describes encoded objects. Each object can be either a TypedArray or ArrayBuffer, which will be treated as encoded message, an array which will be encoded as a Vector with each item within the array encoded recursively, or a dictionary which describes a specific type. When a specific type is described via a dictionary, "value" is encoed based on "type" as follows: - When "type" is "String", "value" is encoded as a WTF::String, treating null or undefined as a null string. - When "type" is "bool", "int8_t", "int16_t", "int32_t", "int64_t", "uint8_t", "uint16_t", "uint32_t", or "uint64_t", "value" (which can be BigInt or a number) is encoded as the respective C++ type. - When "type" is "RGBA", "value" is used as PackedColor::RGBA to construct WebCore::Color to be encoded. - When "type" is "IntRect" or "FloatRect", "x", "y", "width", and "height" are treated as respective values of IntRect or FloatRect C++ objects, and the constructed *Rect is encoded. - When "type" is "FrameInfoData", the context object's WebFrame's FrameInfoData is encoded. The list of IPC messages are exposed on window.IPC.messages, and VisitedLinkStore ID, WebPageProxy ID, and frame identifiers are also exposed as static variables on window.IPC. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): Inject the API if enabled. * WebProcess/WebPage/IPCTestingAPI.cpp: Added. (WebKit::IPCTestingAPI::JSIPC::create): Added. (WebKit::IPCTestingAPI::JSIPC::webFrame): Added. (WebKit::IPCTestingAPI::JSIPC::JSIPC): Added. (WebKit::IPCTestingAPI::JSIPC::wrapperClass): Added. (WebKit::IPCTestingAPI::JSIPC::unwrap): Added. (WebKit::IPCTestingAPI::JSIPC::toWrapped): Added. (WebKit::IPCTestingAPI::JSIPC::initialize): Added. (WebKit::IPCTestingAPI::JSIPC::finalize): Added. (WebKit::IPCTestingAPI::JSIPC::staticFunctions): Added. (WebKit::IPCTestingAPI::JSIPC::staticValues): Added. (WebKit::IPCTestingAPI::convertToUint64): Added. (WebKit::IPCTestingAPI::processTargetFromArgument): Added. (WebKit::IPCTestingAPI::destinationIDFromArgument): Added. (WebKit::IPCTestingAPI::messageIDFromArgument): Added. (WebKit::IPCTestingAPI::encodeTypedArray): Added. (WebKit::IPCTestingAPI::createTypeError): Added. (WebKit::IPCTestingAPI::encodeRectType): Added. (WebKit::IPCTestingAPI::encodeIntegralType): Added. (WebKit::IPCTestingAPI::VectorEncodeHelper::encode const): Added. (WebKit::IPCTestingAPI::encodeArgument): Added. (WebKit::IPCTestingAPI::JSIPC::sendMessage): Added. (WebKit::IPCTestingAPI::JSIPC::sendSyncMessage): Added. (WebKit::IPCTestingAPI::JSIPC::visitedLinkStoreID): Added. (WebKit::IPCTestingAPI::JSIPC::webPageProxyID): Added. (WebKit::IPCTestingAPI::JSIPC::frameIdentifier): Added. (WebKit::IPCTestingAPI::JSIPC::retrieveID): Added. (WebKit::IPCTestingAPI::JSIPC::messages): Added. (WebKit::IPCTestingAPI::inject): * WebProcess/WebPage/IPCTestingAPI.h: Added. * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::ipcTestingAPIEnabled const): (WebKit::WebPage::webPageProxyID const): (WebKit::WebPage::visitedLinkTableID const): 2020-10-08 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Cannot activate or deactivate an audio session https://bugs.webkit.org/show_bug.cgi?id=217492 Reviewed by Eric Carlson. No new tests, covered by existing tests. * WebProcess/GPU/media/RemoteAudioSession.cpp: (WebKit::RemoteAudioSession::tryToSetActiveInternal): 2020-10-08 Hector Lopez <hector_i_lopez@apple.com> Unreviewed, reverting r268155. This reverts r268155 becasue it broke internal builds Reverted changeset: "[WebAuthn] Implement a dummy WebAuthenticationAgent" https://bugs.webkit.org/show_bug.cgi?id=217401 https://trac.webkit.org/changeset/268155 2020-10-08 Alex Christensen <achristensen@webkit.org> REGRESSION (r267763): [ iOS wk2 ] http/tests/in-app-browser-privacy/non-app-bound-domain-does-not-get-app-bound-session.html is a constant failure https://bugs.webkit.org/show_bug.cgi?id=217386 Reviewed by Brent Fulgham. Use SPI instead of NSUserDefaults to turn on test mode for app browser privacy. This is more reliable with the timing change of when a WebsiteDataStore's parameters are sent to the network process. * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration enableInAppBrowserPrivacyForTesting]): (-[_WKWebsiteDataStoreConfiguration setEnableInAppBrowserPrivacyForTesting:]): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): (WebKit::WebsiteDataStore::ensureAppBoundDomains const): * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::enableInAppBrowserPrivacyForTesting const): (WebKit::WebsiteDataStoreConfiguration::setEnableInAppBrowserPrivacyForTesting): 2020-10-08 Chris Dumez <cdumez@apple.com> Crash under WebKit::WebProcessCache::clear() https://bugs.webkit.org/show_bug.cgi?id=217480 Reviewed by Geoffrey Garen. Protect |process| in the responsiveness check lambda in WebProcessCache::addProcessIfPossible(). If we fail to do so and WebProcessCache::clear() gets called while the responsiveness check is pending, the WebProcessProxy destructor may get called while clear() clears m_pendingAddRequests, which would resolve the responsiveness check with responsive=false, and cause the lambda to try and remove the entry from m_pendingAddRequests (while clear() is clearing it). * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): 2020-10-08 David Quesada <david_quesada@apple.com> WKWebViewConfiguration._shouldRelaxThirdPartyCookieBlocking should be available on iOS https://bugs.webkit.org/show_bug.cgi?id=217443 rdar://problem/69900089 Reviewed by Youenn Fablet. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _setShouldRelaxThirdPartyCookieBlocking:]): Allow this method to be used by Safari and SafariViewService on iOS-family platforms. 2020-10-08 Peng Liu <peng.liu6@apple.com> RemoteAudioSession::category() returns an incorrect value after category changing https://bugs.webkit.org/show_bug.cgi?id=217459 Reviewed by Youenn Fablet. No new tests, covered by existing tests. * WebProcess/GPU/media/RemoteAudioSession.cpp: (WebKit::RemoteAudioSession::setCategory): Update `m_configuration.category` and `m_configuration.routeSharingPolicy` so that RemoteAudioSession::category() will return the correct value. * WebProcess/GPU/media/RemoteAudioSession.h: 2020-10-08 Aditya Keerthi <akeerthi@apple.com> [iOS] Blurring a text input and focusing a date input changes the scrollable area https://bugs.webkit.org/show_bug.cgi?id=217325 <rdar://problem/69979171> Reviewed by Wenson Hsieh. iOS 14 changed the presentation style of date/time pickers on iPhones. Previously, date/time pickers would show up in the keyboard view. Now, pickers are shown in UIContextMenus. When the change was made, shouldShowKeyboardForElement in WKContentViewInteraction was not updated to reflect the new behavior, and continued to return true for date/time inputs. This inaccuracy led to WKContentView ignoring the UIKeyboardWillHideNotification when blurring a text input and focusing a date input, since it assumed the keyboard would stay presented. Consequently, the UIScrollView adjustments made when presenting the keyboard for the text input are not reverted when presenting the date picker, leading to a permanent change in the scrollable area. To fix, update shouldShowKeyboardForElement to return false for date/time inputs. Note that the original patch which changed the behavior correctly updated [WKContentView requiresAccessoryView] but did not update shouldShowKeyboardForElement. To prevent a similar mistake from happening again, the logic which determines which input types have a keyboard view was moved into elementTypeRequiresAccessoryView. Test: fast/forms/ios/constant-scroll-area-when-moving-focus-between-fields.html * UIProcess/ios/WKContentViewInteraction.mm: (elementTypeRequiresAccessoryView): (-[WKContentView requiresAccessoryView]): (shouldShowKeyboardForElement): 2020-10-08 Per Arne Vollan <pvollan@apple.com> [macOS] Deny access to performance analysis service in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=217452 <rdar://problem/68878318> Reviewed by Youenn Fablet. It has been confirmed that mach-lookup to 'com.apple.PerformanceAnalysis.animationperfd' can be denied in the WebContent process on macOS. Test: fast/sandbox/sandbox-mach-lookup.html * WebProcess/com.apple.WebProcess.sb.in: 2020-10-08 Saagar Jha <saagar@saagarjha.com> Replace unqualified use of PlatformDisplayID in WebViewImpl https://bugs.webkit.org/show_bug.cgi?id=217422 Reviewed by Youenn Fablet. WebViewImpl utilizes things from WebCore but doesn't use the namespace, instead choosing to qualify each reference. However, there is one use of WebCore::PlatformDisplayID that doesn't use the the namespace qualifier. Usually this "works" because the code is in the WebKit namespace, and other files that get included above this one often contain code of the form namespace WebKit { using WebCore; // code } which hides the issue by making PlatformDisplayID visible to this file as well without the prefix. If we use auto none of this matters because it'll deduce the prefix even if WebViewImpl.mm ends up near the top of a unified source file, before another file with the using declaration shows up. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::windowDidChangeScreen): Replace PlatformDisplayID with auto. 2020-10-07 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove the build warning below since r238330. warning: unused variable ‘connectionIdentifier’ [-Wunused-variable] No new tests, no new behaviors. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::updateConnection): 2020-10-07 Keith Rollin <krollin@apple.com> Update post-processing rules for headers to not unnecessarily change timestamps https://bugs.webkit.org/show_bug.cgi?id=217371 <rdar://problem/69992230> Reviewed by Darin Adler. Under XCBuild, the scripts employed in custom build rules can be invoked in innocuous situations. A common example is when the user is building from the command-line and they change the `make` output from stdout to a file, or vice-versa. Changing the output changes the setting of the COLOR_DIAGNOSTICS environment variable, which is enough to cause XCBuild to think something is different and that the custom build rule needs to be invoked. For the script's part, nothing significant has changed, yet it post-processes the header files, causing their modification dates to change, causing downstream rebuilds to occur. Fix this problem by adopting an approach that doesn't modify the post-processed header files unless their contents actually change. No new tests -- this is a build change only. * Scripts/postprocess-header-rule: 2020-10-07 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Implement a dummy WebAuthenticationAgent https://bugs.webkit.org/show_bug.cgi?id=217401 <rdar://problem/70012011> Reviewed by Darin Adler. Part 1. This patch introduces a new dummy WebAuthenticationAgent where in the future it will take over all WebAuthn operations from the UI Process such that we can isolate high privileged entitlements to this standalone daemon and therefore are able offer WebAuthn to third party WKWebView clients. One of the future feautres will require this new process to listen to LaunchEvents, which only daemons can do. That's why it is implemented as a user agent instead of a XPC service. This is the first part of establishing such a dummy daemon. What it does is to set up a new build target for the daemon and hook it up with WebKit's build system. One can manually load the launchd plist and load the daemon to verify this change. Commands are: launchctl load /to/your/path/com.apple.webkit.WebAuthenticationAgent.plist launchctl start com.apple.webkit.WebAuthenticationAgent.Development Covered by manual tests. * Configurations/WebAuthenticationAgent.xcconfig: Added. Somehow the executable has a suffix .Development for debug/release builds. Will fix that in the later part. * Daemons/WebAuthenticationAgent/Info.plist: Added. * Daemons/WebAuthenticationAgent/WebAuthenticationAgent.entitlements: Added. * Daemons/WebAuthenticationAgent/com.apple.webkit.WebAuthenticationAgent.plist: Added. The executable location is hardcoded for now. It will be fixed in Part 2 to dynamically point to the right binary. * Daemons/WebAuthenticationAgent/main.mm: Added. (main): * WebKit.xcodeproj/project.pbxproj: Not sure why libWTF.a is needed. Will fix that in the later part. 2020-10-07 Devin Rousso <drousso@apple.com> Add missing `#define` for `PENCILKIT_TEXT_INPUT` flag https://bugs.webkit.org/show_bug.cgi?id=217436 <rdar://problem/69720219> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView _shouldSimulateKeyboardInputOnTextInsertion]): Change from `ENABLE` to `HAVE`. 2020-10-07 Wenson Hsieh <wenson_hsieh@apple.com> [GPU Process] Support CanvasRenderingContext2D.drawImage() with HTMLVideoElement https://bugs.webkit.org/show_bug.cgi?id=217339 <rdar://problem/69409029> Reviewed by Darin Adler. Implements support for painting the current video frame into a canvas 2D graphics context. See below (and Source/WebCore/ChangeLog) for more details. * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h: (WebKit::RemoteImageBufferMessageHandlerProxy::backend): * GPUProcess/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::apply): Refactor `apply` so that it treats `PutImageData` and `PaintFrameForMedia` as special cases, and otherwise returns `false` by default. Implement `apply` in the case where the display list item is `PaintFrameForMedia` by using the `MediaPlayerIdentifier` to look up the platform `MediaPlayer` instance, and then calling `GraphicsContext::paintFrameForMedia` with this `MediaPlayer`. * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::gpuConnectionToWebProcess const): * GPUProcess/graphics/RemoteRenderingBackendProxy.h: 2020-10-07 Youenn Fablet <youenn@apple.com> Add support for BlobEvent.timecode https://bugs.webkit.org/show_bug.cgi?id=217379 Reviewed by Eric Carlson. Exchange timecode through IPC. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::fetchData): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::fetchData): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-10-07 Youenn Fablet <youenn@apple.com> Add support for MediaRecorder pause/resume https://bugs.webkit.org/show_bug.cgi?id=217375 Reviewed by Eric Carlson. Add IPC support for sending pause/resume orders. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::pause): (WebKit::RemoteMediaRecorder::resume): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::pauseRecording): (WebKit::MediaRecorderPrivate::resumeRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-10-07 Per Arne Vollan <pvollan@apple.com> [macOS] Remove 'com.apple.cookied' from the WebContent process sandbox. https://bugs.webkit.org/show_bug.cgi?id=206088 <rdar://problem/58489040> Reviewed by Darin Adler. It has been confirmed that access to the cookied service can be removed from the WebContent process. Test: fast/sandbox/sandbox-mach-lookup.html * WebProcess/com.apple.WebProcess.sb.in: 2020-10-07 Aditya Keerthi <akeerthi@apple.com> zappos.com: Dropdown - 'Quantity' option size different https://bugs.webkit.org/show_bug.cgi?id=217395 <rdar://problem/60261396> Reviewed by Tim Horton. The select element used in this instance uses a custom font (Open Sans) with a 16px font size. When presenting the select dropdown a call to WebPopupMenuProxyMac::showPopupMenu is made with those attributes. However, since Open Sans is not a system font, the call to [NSFont fontWithDescriptor:size:] returns nil. This results in the presented view falling back to the default font size, which is smaller than the expected 16px size, leading to smaller options. While other browsers do not honor custom fonts in their select dropdowns, they do honor the font size. Consequently, this dropdown appears different in Safari. To fix, ensure that the font size is always honored if the corresponding attribute is present. * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::showPopupMenu): 2020-10-07 Youenn Fablet <youenn@apple.com> Make sure to fire the correct set of events in case MediaRecorder stream has track changes https://bugs.webkit.org/show_bug.cgi?id=217316 Reviewed by Eric Carlson. Make sure to not set audio/video tracks if the recorder was stopped. * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): (WebKit::MediaRecorderPrivate::~MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::stopRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-10-06 Peng Liu <peng.liu6@apple.com> [Media in GPU process] Don't use 'id' as a parameter or variable name https://bugs.webkit.org/show_bug.cgi?id=206189 Reviewed by Tim Horton. Mass rename `id` to `identifier`. No new tests, no functional change. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::create): (WebKit::RemoteAudioDestination::RemoteAudioDestination): (WebKit::RemoteAudioDestinationManager::deleteAudioDestination): (WebKit::RemoteAudioDestinationManager::startAudioDestination): (WebKit::RemoteAudioDestinationManager::stopAudioDestination): * GPUProcess/media/RemoteAudioDestinationManager.messages.in: * GPUProcess/media/RemoteAudioTrackProxy.cpp: (WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy): (WebKit::RemoteAudioTrackProxy::configuration): * GPUProcess/media/RemoteAudioTrackProxy.h: * GPUProcess/media/RemoteCDMFactoryProxy.cpp: (WebKit::RemoteCDMFactoryProxy::addProxy): (WebKit::RemoteCDMFactoryProxy::removeProxy): (WebKit::RemoteCDMFactoryProxy::addInstance): (WebKit::RemoteCDMFactoryProxy::removeInstance): (WebKit::RemoteCDMFactoryProxy::getInstance): (WebKit::RemoteCDMFactoryProxy::addSession): (WebKit::RemoteCDMFactoryProxy::removeSession): * GPUProcess/media/RemoteCDMFactoryProxy.messages.in: * GPUProcess/media/RemoteCDMInstanceProxy.messages.in: * GPUProcess/media/RemoteCDMProxy.messages.in: * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp: (WebKit::RemoteLegacyCDMFactoryProxy::addProxy): (WebKit::RemoteLegacyCDMFactoryProxy::removeProxy): (WebKit::RemoteLegacyCDMFactoryProxy::addSession): (WebKit::RemoteLegacyCDMFactoryProxy::removeSession): (WebKit::RemoteLegacyCDMFactoryProxy::getSession const): * GPUProcess/media/RemoteLegacyCDMFactoryProxy.messages.in: * GPUProcess/media/RemoteLegacyCDMProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::deleteMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::getProxy): * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): * GPUProcess/media/RemoteMediaResource.cpp: (WebKit::RemoteMediaResource::create): (WebKit::RemoteMediaResource::RemoteMediaResource): * GPUProcess/media/RemoteMediaResourceManager.cpp: (WebKit::RemoteMediaResourceManager::responseReceived): (WebKit::RemoteMediaResourceManager::redirectReceived): (WebKit::RemoteMediaResourceManager::dataSent): (WebKit::RemoteMediaResourceManager::dataReceived): (WebKit::RemoteMediaResourceManager::accessControlCheckFailed): (WebKit::RemoteMediaResourceManager::loadFailed): (WebKit::RemoteMediaResourceManager::loadFinished): * GPUProcess/media/RemoteMediaResourceManager.messages.in: * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy): (WebKit::RemoteTextTrackProxy::configuration): * GPUProcess/media/RemoteTextTrackProxy.h: * GPUProcess/media/RemoteVideoTrackProxy.cpp: (WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy): (WebKit::RemoteVideoTrackProxy::configuration): * GPUProcess/media/RemoteVideoTrackProxy.h: * 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/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::remoteTextTrackConfigurationChanged): (WebKit::MediaPlayerPrivateRemote::removeRemoteVideoTrack): (WebKit::MediaPlayerPrivateRemote::remoteVideoTrackConfigurationChanged): * WebProcess/GPU/media/RemoteCDM.cpp: (WebKit::RemoteCDM::create): (WebKit::RemoteCDM::RemoteCDM): (WebKit::RemoteCDM::createInstance): * WebProcess/GPU/media/RemoteCDMFactory.cpp: (WebKit::RemoteCDMFactory::createCDM): (WebKit::RemoteCDMFactory::removeSession): * WebProcess/GPU/media/RemoteCDMInstance.cpp: (WebKit::RemoteCDMInstance::create): (WebKit::RemoteCDMInstance::RemoteCDMInstance): (WebKit::RemoteCDMInstance::createSession): * WebProcess/GPU/media/RemoteCDMInstanceSession.cpp: (WebKit::RemoteCDMInstanceSession::create): (WebKit::RemoteCDMInstanceSession::RemoteCDMInstanceSession): * WebProcess/GPU/media/RemoteLegacyCDM.cpp: (WebKit::RemoteLegacyCDM::create): (WebKit::RemoteLegacyCDM::RemoteLegacyCDM): (WebKit::RemoteLegacyCDM::createSession): (WebKit::RemoteLegacyCDM::setPlayerId): * WebProcess/GPU/media/RemoteLegacyCDMFactory.cpp: (WebKit::RemoteLegacyCDMFactory::createCDM): (WebKit::RemoteLegacyCDMFactory::addSession): (WebKit::RemoteLegacyCDMFactory::removeSession): * WebProcess/GPU/media/RemoteLegacyCDMSession.cpp: (WebKit::RemoteLegacyCDMSession::create): (WebKit::RemoteLegacyCDMSession::RemoteLegacyCDMSession): * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::deleteRemoteMediaPlayer): * WebProcess/GPU/media/RemoteMediaResourceProxy.cpp: (WebKit::RemoteMediaResourceProxy::RemoteMediaResourceProxy): * WebProcess/GPU/media/TextTrackPrivateRemote.cpp: (WebKit::TextTrackPrivateRemote::updateConfiguration): * WebProcess/GPU/media/VideoTrackPrivateRemote.cpp: (WebKit::VideoTrackPrivateRemote::updateConfiguration): 2020-10-06 Devin Rousso <drousso@apple.com> Move platform logic for CSS `hover` and `pointer` media queries outside of WebCore https://bugs.webkit.org/show_bug.cgi?id=217413 Reviewed by Tim Horton. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::hoverSupportedByPrimaryPointingDevice const): Added. (WebKit::WebChromeClient::pointerCharacteristicsOfPrimaryPointingDevices const): Added. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevices const): Added. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevices const): Added. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevices const): Added. * WebProcess/WebPage/playstation/WebPagePlayStation.cpp: (WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevices const): Added. * WebProcess/WebPage/win/WebPageWin.cpp: (WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevices const): Added. * WebProcess/WebPage/wpe/WebPageWPE.cpp: (WebKit::WebPage::hoverSupportedByPrimaryPointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfPrimaryPointingDevices const): Added. Provide a way for WebCore to get information about the primary pointing device. Refactor logic in `WebCore::anyHoverEvaluate` and `WebCore::anyPointerEvaluate` to move platform code into the respective `WebPage` file. 2020-10-06 Chris Dumez <cdumez@apple.com> Reloading a view in its processTerminationHandler does not work reliably when using related views https://bugs.webkit.org/show_bug.cgi?id=217407 Reviewed by Geoff Garen. Related web views share the same WebContent process. When this process crashes, we iterate over the list of WebPageProxy objects sharing this process and let them know that their process has crashed. This causes the WebPageProxy to reset its state (so that it is aware it no longer has a running process) and to notify the client application. Because we were notifying the client application synchronously, the client could trigger a load in the view synchronously while we are still iterating over the WebPageProxy objects. When triggering a load in a web view that has no running process, we normally relaunch one. However, in the case of related web views, the view uses its related webview's process, relaunching it if necessary. The 'relaunching if necessary' part was not reliably happening here because the related web view may not have been notified yet that its WebProcess has crashed (since we are still iterating over the pages to notify them). To address the issue, we now notify the client asynchronously of the process termination. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchProcessDidTerminate): 2020-10-06 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] The seekable attribute of HTMLMediaElement has an incorrect value https://bugs.webkit.org/show_bug.cgi?id=217410 Reviewed by Eric Carlson. Covered by existing tests. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged): Update the state variables related to the `seekable` attribute when the media player is ready. (WebKit::RemoteMediaPlayerProxy::updateCachedState): Add a missing state variable setting. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::seekable const): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: Instead of overriding seekable() here, we should use MediaPlayerPrivateInterface::seekable(), which has the correct behavior. 2020-10-06 Devin Rousso <drousso@apple.com> CSS hover and "pointer: fine" media queries do not evaluate to true with iOS 13.4 mouse support https://bugs.webkit.org/show_bug.cgi?id=209292 <rdar://problem/60663124> Reviewed by Tim Horton. On iOS, the primary pointer will always be touch input, so the `hover`/`pointer` media query should never change. If a mouse is connected, however, `any-hover`/`any-pointer` should change as now there is at least one device that supports `hover`/`fine`. Note that in the case of `any-pointer` this means that both `coarse` and `fine` will apply. Catalyst assumes that there is always a mouse connected. Spec: https://drafts.csswg.org/mediaqueries-4/#any-input * UIProcess/ios/WKMouseDeviceObserver.h: Added. * UIProcess/ios/WKMouseDeviceObserver.mm: Added. (+[WKMouseDeviceObserver sharedInstance]): (-[WKMouseDeviceObserver dealloc]): (-[WKMouseDeviceObserver start]): (-[WKMouseDeviceObserver stop]): (-[WKMouseDeviceObserver mousePointerDevicesDidChange:]): (-[WKMouseDeviceObserver _setHasMouseDeviceForTesting:]): Use `BackBoardServices` to listen for mouse devices changes and notify all WebProcess. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::WebProcessProxy): (WebKit::WebProcessProxy::platformInitialize): Added. (WebKit::WebProcessProxy::~WebProcessProxy): (WebKit::WebProcessProxy::platformDestroy): Added. * UIProcess/ios/WebProcessProxyIOS.mm: (WebKit::WebProcessProxy::platformInitialize): Added. (WebKit::WebProcessProxy::platformDestroy): Added. (WebKit::WebProcessProxy::notifyHasMouseDeviceChanged): Added. Tell the shared `WKMouseDeviceObserver` to start listening for mouse device changes when creating the WebProcess so that the shared `WKMouseDeviceObserver` knows to notify all instances when mouse devices change. Make `allProcesses` into a `private static` member function so that it can also be used in `UIProcess/ios/WebProcessProxyIOS.mm`. * Shared/WebProcessCreationParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Use the current state of the shared `WKMouseDeviceObserver` when creating WebProcess instead of sending a `SetHasMouseDevice` message immediately after the WebProcess is created. * WebProcess/WebProcess.messages.in: * WebProcess/WebProcess.h: (WebKit::WebProcess::hasMouseDevice const): Added. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setHasMouseDevice): Added. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Update style (including `any-hover` and `any-pointer`) whenever mouse devices change. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::hoverSupportedByAnyAvailablePointingDevice const): Added. (WebKit::WebChromeClient::pointerCharacteristicsOfAllAvailablePointingDevices const): Added. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const): Added. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::hasMouseDevice): Added. (WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const): Added. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const): Added. * WebProcess/WebPage/playstation/WebPagePlayStation.cpp: (WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const): Added. * WebProcess/WebPage/win/WebPageWin.cpp: (WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const): Added. * WebProcess/WebPage/wpe/WebPageWPE.cpp: (WebKit::WebPage::hoverSupportedByAnyAvailablePointingDevice const): Added. (WebKit::WebPage::pointerCharacteristicsOfAllAvailablePointingDevices const): Added. Provide a way for WebCore to get the current state of whether there are any mouse devices. Refactor logic in `WebCore::anyHoverEvaluate` and `WebCore::anyPointerEvaluate` to move platform code into the respective `WebPage` file. * Configurations/WebKit.xcconfig: * Platform/spi/ios/BackBoardServicesSPI.h: * Platform/spi/ios/BaseBoardSPI.h: Added. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2020-10-06 Simon Fraser <simon.fraser@apple.com> Redundant rendering updates can be scheduled from inside Page::updateRendering() https://bugs.webkit.org/show_bug.cgi?id=216726 Reviewed by Tim Horton. Schedule for layer flush. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): 2020-10-06 Alex Christensen <achristensen@webkit.org> Use sendWithAsyncReply to evaluate JavaScript in a WebPage https://bugs.webkit.org/show_bug.cgi?id=217351 Reviewed by Youenn Fablet. No change in meaningful behavior, but complexity is removed. * UIProcess/API/C/WKPage.cpp: (WKPageRunJavaScriptInMainFrame): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptInMainFrame): (WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld): (WebKit::WebPageProxy::scriptValueCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): (WebKit::WebPage::runJavaScriptInFrameInScriptWorld): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-10-06 Per Arne Vollan <pvollan@apple.com> [Cocoa] The WebContent development XPC service is not allowed to connect to the XPC endpoint in the Networking process https://bugs.webkit.org/show_bug.cgi?id=217389 <rdar://problem/68585497> Reviewed by Brent Fulgham. The WebContent development XPC service is not allowed to connect to the XPC endpoint in the Networking process, because this requires a private entitlement. The WebContent development XPC service is not allowed to have private entitlements. The WebContent process needs to connect to the XPC endpoint in the Networking process in order to receive the Launch Services database XPC object. This patch addresses this issue by allowing platform binaries to connect to the XPC endpoint. * Shared/Cocoa/XPCEndpoint.mm: (WebKit::XPCEndpoint::XPCEndpoint): 2020-10-06 Wenson Hsieh <wenson_hsieh@apple.com> Rename MediaPlayerPrivateRemoteIdentifier to MediaPlayerIdentifier https://bugs.webkit.org/show_bug.cgi?id=217397 Reviewed by Tim Horton. Mass rename `MediaPlayerPrivateRemoteIdentifier` to `WebCore::MediaPlayerIdentifier`. See WebCore/ChangeLog for more details. * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp: (WebKit::RemoteLegacyCDMFactoryProxy::createCDM): * GPUProcess/media/RemoteLegacyCDMFactoryProxy.h: * GPUProcess/media/RemoteLegacyCDMFactoryProxy.messages.in: * GPUProcess/media/RemoteLegacyCDMProxy.cpp: (WebKit::RemoteLegacyCDMProxy::create): (WebKit::RemoteLegacyCDMProxy::RemoteLegacyCDMProxy): (WebKit::RemoteLegacyCDMProxy::setPlayerId): * GPUProcess/media/RemoteLegacyCDMProxy.h: * GPUProcess/media/RemoteLegacyCDMProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::deleteMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::didReceivePlayerMessage): (WebKit::RemoteMediaPlayerManagerProxy::didReceiveSyncPlayerMessage): (WebKit::RemoteMediaPlayerManagerProxy::getProxy): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): * GPUProcess/media/RemoteMediaPlayerProxy.h: * Scripts/webkit/messages.py: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::identifier const): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteLegacyCDM.cpp: (WebKit::RemoteLegacyCDM::setPlayerId): * WebProcess/GPU/media/RemoteLegacyCDM.h: * WebProcess/GPU/media/RemoteLegacyCDMFactory.cpp: (WebKit::RemoteLegacyCDMFactory::createCDM): * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer): (WebKit::RemoteMediaPlayerManager::deleteRemoteMediaPlayer): (WebKit::RemoteMediaPlayerManager::findRemotePlayerId): (WebKit::RemoteMediaPlayerManager::didReceivePlayerMessage): * WebProcess/GPU/media/RemoteMediaPlayerManager.h: * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): 2020-10-06 Alex Christensen <achristensen@webkit.org> Move ownership of DownloadClient from WebProcessPool to DownloadProxy https://bugs.webkit.org/show_bug.cgi?id=217399 Reviewed by Tim Horton. To keep binary compatibility, the WebProcessPool has a nullable DownloadClient that is used if it has been set. This will allow us to get a DownloadClient from elsewhere, such as having the API Download object have its own delegate or having the WKWebsiteDataStore have a delegate, which are two of the solutions I've considered. We definitely don't want it on the WebProcessPool, though. * SourcesCocoa.txt: * UIProcess/API/APIDownloadClient.h: * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setDownloadDelegate:]): * UIProcess/API/glib/WebKitDownloadClient.cpp: (attachDownloadClientToContext): * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextDispose): * UIProcess/Cocoa/LegacyDownloadClient.h: Renamed from Source/WebKit/UIProcess/Cocoa/DownloadClient.h. * UIProcess/Cocoa/LegacyDownloadClient.mm: Renamed from Source/WebKit/UIProcess/Cocoa/DownloadClient.mm. (WebKit::LegacyDownloadClient::LegacyDownloadClient): (WebKit::LegacyDownloadClient::didStart): (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::didCancel): (WebKit::LegacyDownloadClient::willSendRequest): (WebKit::LegacyDownloadClient::takeActivityToken): (WebKit::LegacyDownloadClient::releaseActivityTokenIfNecessary): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::DownloadProxy): (WebKit::DownloadProxy::cancel): (WebKit::DownloadProxy::invalidate): (WebKit::DownloadProxy::processDidClose): (WebKit::DownloadProxy::didStart): (WebKit::DownloadProxy::didReceiveAuthenticationChallenge): (WebKit::DownloadProxy::willSendRequest): (WebKit::DownloadProxy::didReceiveResponse): (WebKit::DownloadProxy::didReceiveData): (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): (WebKit::DownloadProxy::didCreateDestination): (WebKit::DownloadProxy::didFinish): (WebKit::DownloadProxy::didFail): (WebKit::DownloadProxy::didCancel): (WebKit::DownloadProxy::~DownloadProxy): Deleted. * UIProcess/Downloads/DownloadProxy.h: * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::createDownloadProxy): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::WebProcessPool): (WebKit::WebProcessPool::setLegacyDownloadClient): (WebKit::WebProcessPool::setDownloadClient): Deleted. * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2020-10-06 Youenn Fablet <youenn@apple.com> Enable video capture in WebProcess by default on MacOS https://bugs.webkit.org/show_bug.cgi?id=217385 <rdar://problem/69999542> Reviewed by Sam Weinig. Manually tested in MiniBrowser. * Shared/WebPreferencesDefaultValues.cpp: * Shared/WebPreferencesDefaultValues.h: 2020-10-06 Simon Fraser <simon.fraser@apple.com> Rename scheduleTimedRenderingUpdate() to scheduleRenderingUpdate() everywhere https://bugs.webkit.org/show_bug.cgi?id=217367 Reviewed by Alex Christensen. The previously named scheduleImmediateRenderingUpdate() is no more, so all rendering updates that WebCore knows about are of the timed variety. So just call them scheduleRenderingUpdate() everywhere. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): 2020-10-06 Adrian Perez de Castro <aperez@igalia.com> REGRESSION(r267399): [WPE] Build broken with ENABLE_ACCESSIBILITY=OFF https://bugs.webkit.org/show_bug.cgi?id=217380 Reviewed by Philippe Normand. Before the ATK::Bridge target got introduced in r267399 a couple of CMake variables were used, which were empty when the accessility support was disabled and nothing was being added to the WebKit and WPEToolingBackends targets. Now that an imported target is used it is needed to add it as a dependency conditionally to avoid using an undefined target name. No new tests needed. * PlatformWPE.cmake: Use the ATK::Bridge target only when ENABLE_ACCESSIBILITY is set. 2020-10-06 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, early October 2020 edition, take two https://bugs.webkit.org/show_bug.cgi?id=217344 Unreviewed build fix. * UIProcess/WebProcessProxy.cpp: Add missing WebAutomationSession.h header. 2020-10-05 Sihui Liu <sihui_liu@apple.com> Break reference cycle with NSURLSessionDataTask in NetworkDataTaskCocoa https://bugs.webkit.org/show_bug.cgi?id=217347 <rdar://problem/69483575> Reviewed by Geoffrey Garen. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking): 2020-10-05 Simon Fraser <simon.fraser@apple.com> Use the "triggerRenderingUpdate" terminology in ChromeClient https://bugs.webkit.org/show_bug.cgi?id=217355 Reviewed by Tim Horton. ChromeClient confusingly had both scheduleRenderingUpdate() and scheduleTimedRenderingUpdate(). The former is for triggering an update soon, and the latter is a normal schedule, used by SVGImages because they have their own Page. Rename the one that the WebKits have to implement to triggerRenderingUpdate(). * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::triggerRenderingUpdate): (WebKit::WebChromeClient::scheduleRenderingUpdate): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-10-05 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION(r267915): Many layout tests are asserting under ~CompletionHandler() https://bugs.webkit.org/show_bug.cgi?id=217345 <rdar://problem/69973775> Reviewed by Tim Horton. I did *not* intend to schedule an async task after every single image load in r267915. Apart from triggering assertions on various tests, this also causes us to send excessive IPC messages to the UI process when loading images, which can't be good for performance. Fix this by only calling into `computeAndSendEditDragSnapshot()` when we've finished loading all dropped image elements. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::didFinishLoadingImageForElement): 2020-10-05 Brady Eidson <beidson@apple.com> Change a PDF RELEASE_ASSERT to an early return. rdar://problem/69805240 and https://bugs.webkit.org/show_bug.cgi?id=217346 Reviewed by Tim Horton. No new tests (Wish they were possible) * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::installPDFDocument): This release assert is getting hit regularly. Change to an early return while we continue tracking this down. 2020-10-05 Alex Christensen <achristensen@webkit.org> Make DownloadID an ObjectIdentifier https://bugs.webkit.org/show_bug.cgi?id=203962 Reviewed by Youenn Fablet and Geoffrey Garen. Also deprecate the unused WKDownloadGetID because this identifier is internal. * NetworkProcess/Downloads/Download.cpp: (WebKit::Download::Download): (WebKit::Download::didReceiveData): (WebKit::Download::didFinish): (WebKit::Download::didFail): (WebKit::Download::didCancel): (WebKit::Download::messageSenderDestinationID const): * NetworkProcess/Downloads/DownloadID.h: (WebKit::DownloadID::DownloadID): Deleted. (WebKit::DownloadID::operator== const): Deleted. (WebKit::DownloadID::operator!= const): Deleted. (WebKit::DownloadID::downloadID const): Deleted. (IPC::ArgumentCoder<WebKit::DownloadID>::encode): Deleted. (IPC::ArgumentCoder<WebKit::DownloadID>::decode): Deleted. (WTF::DownloadIDHash::hash): Deleted. (WTF::DownloadIDHash::equal): Deleted. (WTF::HashTraits<WebKit::DownloadID>::emptyValue): Deleted. (WTF::HashTraits<WebKit::DownloadID>::constructDeletedValue): Deleted. (WTF::HashTraits<WebKit::DownloadID>::isDeletedValue): Deleted. * NetworkProcess/Downloads/DownloadMonitor.cpp: (WebKit::DownloadMonitor::applicationWillEnterForeground): (WebKit::DownloadMonitor::applicationDidEnterBackground): (WebKit::DownloadMonitor::timerFired): * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::messageSenderDestinationID const): * NetworkProcess/Downloads/PendingDownload.h: * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTask::setPendingDownloadID): (WebKit::NetworkDataTask::isDownload const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::pendingDownloadCanceled): (WebKit::NetworkProcess::findPendingDownloadLocation): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::convertToDownload): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): (-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]): (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]): (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge): * Scripts/webkit/messages.py: * Shared/Authentication/AuthenticationManager.h: * UIProcess/API/C/WKDownload.cpp: (WKDownloadGetID): * UIProcess/API/C/WKDownload.h: * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::DownloadProxy): (WebKit::generateDownloadID): Deleted. * UIProcess/Downloads/DownloadProxy.h: * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::createDownloadProxy): (WebKit::DownloadProxyMap::downloadFinished): (WebKit::DownloadProxyMap::invalidate): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::startDownload): (WebKit::WebFrame::convertMainResourceLoadToDownload): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.h: 2020-10-05 Alex Christensen <achristensen@webkit.org> Fix tvOS and watchOS build * NetworkProcess/NetworkProcess.cpp: I noticed it was broken in an EWS build, and it is missing this include. 2020-10-05 Simon Fraser <simon.fraser@apple.com> Rename DrawingArea::scheduleRenderingUpdate() https://bugs.webkit.org/show_bug.cgi?id=217337 Reviewed by Tim Horton. DrawingArea::scheduleRenderingUpdate() always schedules an "immediate" update (either on a zero-delay timer, or in the current runloop). To make this more clear, change the terminology to "triggerRenderingUpdate()." * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::scheduleRenderingUpdate): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::triggerRenderingUpdate): (WebKit::DrawingAreaCoordinatedGraphics::scheduleRenderingUpdate): Deleted. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: (WebKit::RemoteLayerTreeDisplayRefreshMonitor::requestRefreshCallback): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer): (WebKit::RemoteLayerTreeDrawingArea::updateGeometry): (WebKit::RemoteLayerTreeDrawingArea::setExposedContentRect): (WebKit::RemoteLayerTreeDrawingArea::triggerRenderingUpdate): (WebKit::RemoteLayerTreeDrawingArea::didUpdate): (WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID): (WebKit::RemoteLayerTreeDrawingArea::scheduleRenderingUpdate): Deleted. * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::scheduleTreeStateCommit): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::scheduleFullEditorStateUpdate): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::triggerRenderingUpdate): (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer): (WebKit::TiledCoreAnimationDrawingArea::setShouldScaleViewToFitDocument): (WebKit::TiledCoreAnimationDrawingArea::addTransactionCallbackID): (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange): (WebKit::TiledCoreAnimationDrawingArea::scheduleRenderingUpdate): Deleted. 2020-10-05 Eric Carlson <eric.carlson@apple.com> Disable media capture if an app's entitlements won't allow access to capture devices https://bugs.webkit.org/show_bug.cgi?id=217319 <rdar://problem/69956112> Reviewed by Youenn Fablet. No new tests, tested manually with MiniBrowser and Safari. * UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm: (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureAudio): If the app is sandboxed, check for the entitlement required for audio capture. Don't bother checking for usage string if TCC has already authorized capture. (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureVideo): Ditto for video capture. * UIProcess/Cocoa/WebPreferencesCocoa.mm: (WebKit::WebPreferences::platformInitializeStore): Initialize `mediaDevicesEnabled` manually because its default value is always `false` in the WebProcess and may be `true` in the UIProcess. WebPreferences assumes the default will always be the same in both processes, and so has an optimization that only sends values to the WebProcess if they differ from the default value. This means if the default in the UIProcess is true it won't be pushed to the WebProcess, so capture won't work. * Platform/spi/ios/TCCSPI.h: Update TCCAccessPreflightResult. 2020-10-05 Alex Christensen <achristensen@webkit.org> Use sendWithAsyncReply for DecideDestinationWithSuggestedFilename https://bugs.webkit.org/show_bug.cgi?id=209195 Reviewed by Tim Horton. This makes the download flow more clear. No change in behavior. * NetworkProcess/Downloads/DownloadID.h: * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::downloadDestinationDecided): (WebKit::DownloadManager::cancelDownload): (WebKit::DownloadManager::willDecidePendingDownloadDestination): Deleted. (WebKit::DownloadManager::continueDecidePendingDownloadDestination): Deleted. * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::findPendingDownloadLocation): (WebKit::NetworkProcess::continueDecidePendingDownloadDestination): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * Scripts/webkit/messages.py: * Shared/Authentication/AuthenticationManager.h: * UIProcess/API/APIDownloadClient.h: * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync): Deleted. * UIProcess/Downloads/DownloadProxy.h: * UIProcess/Downloads/DownloadProxy.messages.in: 2020-10-05 David Kilzer <ddkilzer@apple.com> Make NetscapePlugInStreamLoaderClient a weak pointer on NetscapePlugInStreamLoader <https://webkit.org/b/217237> <rdar://problem/69776714> Reviewed by Alex Christensen. Making NetscapePlugInStreamLoaderClient inherit from CanMakeWeakPtr<> caused PDFPlugin to fail to compile because one of its parent classes already inherited from CanMakeWeakPtr<>. To fix this, extract a PDFPluginStreamLoaderClient class from PDFPlugin and link the lifetime of PDFPluginStreamLoaderClient to PDFPlugin. After moving the NetscapePlugInStreamLoaderClient virtual methods from PDFPlugin to PDFPluginStreamLoaderClient, add some simple methods to PDFPlugin so that PDFPluginStreamLoaderClient doesn't access the instance variables directly. Also make use of these new methods in other parts of PDFPlugin. * WebProcess/Plugins/PDF/PDFPlugin.h: (WebKit::PDFPlugin::documentFinishedLoading): Add. (WebKit::PDFPlugin::identifierForLoader): Add. (WebKit::PDFPlugin::removeOutstandingByteRangeRequest): Add. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient): Add class. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::PDFPlugin): (WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel): (WebKit::PDFPlugin::getResourceBytesAtPosition): (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::willSendRequest): Move from PDFPlugin. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveResponse): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveData): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didFail): Ditto. (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didFinishLoading): Ditto. (WebKit::PDFPlugin::byteRangeRequestForLoader): (WebKit::PDFPlugin::forgetLoader): (WebKit::PDFPlugin::willSendRequest): Move to PDFPluginStreamLoaderClient. (WebKit::PDFPlugin::didReceiveResponse): Ditto. (WebKit::PDFPlugin::didReceiveData): Ditto. (WebKit::PDFPlugin::didFail): Ditto. (WebKit::PDFPlugin::didFinishLoading): Ditto. 2020-10-05 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r267763) [SOUP] Some tests flaky crashing in NetworkSessionSoup::soupSession() https://bugs.webkit.org/show_bug.cgi?id=217163 Reviewed by Alex Christensen. Remove code to set the SoupSession on DNSResolveQueue. * NetworkProcess/NetworkProcess.cpp: 2020-10-05 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r267986. https://bugs.webkit.org/show_bug.cgi?id=217329 Introduced layout test failures Reverted changeset: "[Cocoa] Reduce time waiting for Launch Services database" https://bugs.webkit.org/show_bug.cgi?id=217253 https://trac.webkit.org/changeset/267986 2020-10-05 Aditya Keerthi <akeerthi@apple.com> [Contact Picker API] Introduce bindings for the Contact Picker API https://bugs.webkit.org/show_bug.cgi?id=216793 <rdar://problem/69317957> Reviewed by Wenson Hsieh. Added a new experimental feature flag. See WebCore Changelog for more details. * Shared/WebPreferencesExperimental.yaml: 2020-10-05 Per Arne Vollan <pvollan@apple.com> [Cocoa] Reduce time waiting for Launch Services database https://bugs.webkit.org/show_bug.cgi?id=217253 <rdar://problem/68585497> Reviewed by Brent Fulgham. Currently, the WebContent process is waiting up to 5 seconds for the Launch Services database to be updated. This is too long, since the process may be considered unresponsive by the system. This patch also addresses an issue where the required entitlement 'com.apple.private.webkit.use-xpc-endpoint' is missing from the WebContent development XPC service. This entitlement is required in order to receive the Launch Services database XPC object in the WebContent process. * Scripts/process-entitlements.sh: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2020-10-05 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r267602): editing/selection/ios/select-all-in-readonly-input-does-not-overflow.html fails https://bugs.webkit.org/show_bug.cgi?id=217321 Reviewed by Dean Jackson. Fixes an existing test by restoring the commented-out code. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _selectionClipRect]): 2020-10-05 Nitzan Uziely <nitzan@testim.io> WebDriver Input clear/value commands fails when target is inside shadow dom https://bugs.webkit.org/show_bug.cgi?id=209233 Reviewed by Brian Burg. Fixed nodeIsElement which would return true for non-element nodes, which caused an exception to be thrown when getComputedStyle was called on non shadow elements. Fixed computeElementLayout to consider shadow root descendants as descendants when executing elementsAtPoint. Test for WPT (https://github.com/web-platform-tests/wpt/pull/25962) * UIProcess/Automation/atoms/ElementDisplayed.js: (isShown.nodeIsElement): (isShown.enclosingNodeOrSelfMatchingPredicate): (isShown.enclosingElementOrSelfMatchingPredicate): * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::computeElementLayout): 2020-10-05 John Wilander <wilander@apple.com> Storage Access API: Enable per-page storage access scope and align test cases https://bugs.webkit.org/show_bug.cgi?id=217077 <rdar://problem/69017878> Reviewed by Brent Fulgham. It was decided in https://github.com/privacycg/storage-access/issues/3 that browsers should grant storage access for all same-site resources on the whole page, not just the requesting iframe. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::hasStorageAccess): Added a call to WebPage::hasPageLevelStorageAccess() and an early return if it returns true. (WebKit::WebPage::clearPageLevelStorageAccess): New function to clear the webpage's m_domainsWithPageLevelStorageAccess map. * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::clearResourceLoadStatistics): Now clears all webpages' page level storage access maps. 2020-10-05 Sam Weinig <weinig@apple.com> Remove support for enabling subpixel CSSOM values, it's off by default everywhere and known to be not-compatible with the web https://bugs.webkit.org/show_bug.cgi?id=217300 Reviewed by Simon Fraser. Deprecate SPI for enabling subpixel CSSOM values. It is not web compatible. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetSubpixelCSSOMElementMetricsEnabled): (WKPreferencesGetSubpixelCSSOMElementMetricsEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setSubpixelCSSOMElementMetricsEnabled:]): (-[WKPreferences _subpixelCSSOMElementMetricsEnabled]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2020-10-05 Alex Christensen <achristensen@webkit.org> Unify linkedOnOrAfter duplicate code and use SPI/WebCoreTestSupport instead of NSUserDefaults https://bugs.webkit.org/show_bug.cgi?id=217239 Reviewed by Darin Adler. * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: * Shared/Cocoa/CompletionHandlerCallChecker.mm: (WebKit::shouldThrowExceptionForDuplicateCompletionHandlerCall): * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::determineITPState): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::InitializeWebKit2): * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultPassiveTouchListenersAsDefaultOnDocument): * SourcesCocoa.txt: * UIProcess/API/C/WKPage.cpp: (WKPageReload): * UIProcess/API/Cocoa/WKProcessPool.mm: (+[WKProcessPool _setLinkedOnOrAfterEverythingForTesting]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (shouldAllowSettingAnyXHRHeaderFromFileURLs): (shouldRestrictBaseURLSchemes): (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView _setupPageConfiguration:]): (-[WKWebView reload]): (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview): (-[WKWebViewConfiguration init]): * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore init]): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _computedObscuredInset]): * UIProcess/API/mac/WKWebViewMac.mm: (-[WKWebView _web_dragDestinationActionForDraggingInfo:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController inspectorWKWebViewReload:]): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableOrZoomedMainFrame const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): * UIProcess/WebProcessProxy.cpp: (WebKit::isMainThreadOrCheckDisabled): * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _shouldUseContextMenus]): (applicationIsKnownToIgnoreMouseEvents): * UIProcess/ios/WKScrollView.mm: (-[WKScrollView _systemContentInset]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommended): * WebKit.xcodeproj/project.pbxproj: * WebProcess/cocoa/WebProcessCocoa.mm: 2020-10-05 Simon Fraser <simon.fraser@apple.com> Clean up "rendering update" terminology in DrawingArea https://bugs.webkit.org/show_bug.cgi?id=217307 Reviewed by Tim Horton. DrawingArea doesn't know about "immediate" vs. "normal" rendering updates; for it, all requests are for immediate rendering updates; the only difference is whether layer tree freezing is respected. This is the first step to correcting the naming; scheduleImmediateRenderingUpdate() doesn't have to be exposed at all. A future patch will rename DrawingArea::scheduleRenderingUpdate() to make it clear that it's not about timed updates. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setLayerTreeStateIsFrozen): (WebKit::RemoteLayerTreeDrawingArea::startRenderingUpdateTimer): (WebKit::RemoteLayerTreeDrawingArea::scheduleRenderingUpdate): (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange): (WebKit::RemoteLayerTreeDrawingArea::scheduleImmediateRenderingUpdate): Deleted. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::scheduleRenderingUpdate): (WebKit::TiledCoreAnimationDrawingArea::scheduleImmediateRenderingUpdate): Deleted. 2020-10-05 Per Arne Vollan <pvollan@apple.com> [GPU Process] Make it possible to dynamically block IOKit in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=217129 <rdar://problem/69466039> Reviewed by Geoffrey Garen. We need to be able to enable IOKit blocking via the WebContent sandbox dynamically. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::gpuIOKitClasses): (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-10-04 Lauro Moura <lmoura@igalia.com> webkitpy: Update messages reference files after r267916 https://bugs.webkit.org/show_bug.cgi?id=217304 Reviewed by Simon Fraser. Covered by existing tests. * Scripts/test-legacyMessageReceiver.cpp: * Scripts/testMessageReceiver.cpp: 2020-10-04 Brian Burg <bburg@apple.com> [Cocoa] Add WKUIDelegate SPI to inform clients when a _WKInspector is about to close https://bugs.webkit.org/show_bug.cgi?id=217233 Reviewed by Timothy Hatcher and Devin Rousso. This is complementary to _webView:didAttachLocalInspector: and works similarly. Clients need to be careful in depending on this during teardown, because it won't come if the UIDelegate has already been cleared out while the inspected page is being closed. API test: WKInspectorDelegate.WillCloseLocalInspector * UIProcess/API/APIUIClient.h: (API::UIClient::willCloseLocalInspector): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::willCloseLocalInspector): * UIProcess/Inspector/WebInspectorProxy.h: * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::closeFrontendPageAndWindow): Add a guard for reentrant calls to close(). 2020-10-03 Yusuke Suzuki <ysuzuki@apple.com> [JSC] Introduce JITOperationList to validate JIT-caged pointers https://bugs.webkit.org/show_bug.cgi?id=217261 Reviewed by Saam Barati. * Shared/API/c/WKString.cpp: (WKStringCopyJSString): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): * Shared/WebKitJITOperations.cpp: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp. (WebKit::populateJITOperations): * Shared/WebKitJITOperations.h: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: 2020-10-03 Myles C. Maxfield <mmaxfield@apple.com> [GPU Process] Support drawing text in 2D canvas with font features https://bugs.webkit.org/show_bug.cgi?id=206118 Reviewed by Wenson Hsieh. Simply serialize and deserialize all the non-derived data in Font and PlatformFontData. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<Ref<Font>>::encodePlatformData): (IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<Ref<Font>>::encode): (IPC::ArgumentCoder<Ref<Font>>::decode): * Shared/WebCoreArgumentCoders.h: 2020-10-03 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Web process is not allowed to set the AudioSession category https://bugs.webkit.org/show_bug.cgi?id=217236 Reviewed by Eric Carlson. We disabled setting the audio session category in the Web process when media is playing in the GPU Process (r257367). But since RemoteAudioSession and RemoteAudioSessionProxy are working now in the Web process and GPU process, we need to allow setting the audio session category in the Web process. This patch also includes an optimization to reduce the IPC traffic of the audio session category changes. * GPUProcess/media/RemoteAudioSessionProxy.cpp: (WebKit::RemoteAudioSessionProxy::setCategory): * GPUProcess/media/RemoteAudioSessionProxyManager.cpp: (WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess): We need to check the category and policy in RemoteAudioSessionProxy instead of RemoteAudioSessionProxyManager. Otherwise, the change will be ignored. * WebProcess/GPU/media/RemoteAudioSession.cpp: (WebKit::RemoteAudioSession::setCategory): Only send RemoteAudioSessionProxy::SetCategory message if the category or the policy is changed. * WebProcess/GPU/media/RemoteAudioSession.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): Revert the change in r257367. 2020-10-02 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: add support for same site cookies https://bugs.webkit.org/show_bug.cgi?id=217222 Reviewed by Brian Burg. * UIProcess/Automation/Automation.json: Add CookieSameSitePolicy enum and sameSite member to Cookie object. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::toProtocolSameSitePolicy): Convert WebCore same site policy to inspector protocol value. (WebKit::toWebCoreSameSitePolicy): Convert inspector protocol same site policy to WebCore value. (WebKit::buildObjectForCookie): Add sameSite. (WebKit::WebAutomationSession::addSingleCookie): Set sameSite policy to cookie. 2020-10-02 Carlos Garcia Campos <cgarcia@igalia.com> WebDriver: several issues when switching to new browser context https://bugs.webkit.org/show_bug.cgi?id=217217 Reviewed by Brian Burg. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::didDestroyFrame): Remove the frame references from maps. (WebKit::WebAutomationSession::navigationOccurredForFrame): Only clear the frame references from the maps for the frames in the given frame's page. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didDestroyFrame): Notify automation session about frame being destroyed. 2020-10-02 Simon Fraser <simon.fraser@apple.com> Move WebEvent subclass declarations to their own files https://bugs.webkit.org/show_bug.cgi?id=217259 Reviewed by Tim Horton. Make new header files for WebMouseEvent, WebKeyboardEvent, WebWheelEvent, WebTouchEvent and fix the fallout. * Scripts/webkit/messages.py: * Shared/API/c/WKSharedAPICast.h: * Shared/NativeWebGestureEvent.h: * Shared/NativeWebKeyboardEvent.h: * Shared/NativeWebMouseEvent.h: * Shared/NativeWebTouchEvent.h: * Shared/NativeWebWheelEvent.h: * Shared/NavigationActionData.h: * Shared/WebEvent.cpp: (WebKit::WebTouchEvent::allTouchPointsAreReleased const): Deleted. * Shared/WebEvent.h: (WebKit::WebMouseEvent::button const): Deleted. (WebKit::WebMouseEvent::buttons const): Deleted. (WebKit::WebMouseEvent::position const): Deleted. (WebKit::WebMouseEvent::globalPosition const): Deleted. (WebKit::WebMouseEvent::deltaX const): Deleted. (WebKit::WebMouseEvent::deltaY const): Deleted. (WebKit::WebMouseEvent::deltaZ const): Deleted. (WebKit::WebMouseEvent::clickCount const): Deleted. (WebKit::WebMouseEvent::eventNumber const): Deleted. (WebKit::WebMouseEvent::menuTypeForEvent const): Deleted. (WebKit::WebMouseEvent::force const): Deleted. (WebKit::WebMouseEvent::syntheticClickType const): Deleted. (WebKit::WebWheelEvent::position const): Deleted. (WebKit::WebWheelEvent::globalPosition const): Deleted. (WebKit::WebWheelEvent::delta const): Deleted. (WebKit::WebWheelEvent::wheelTicks const): Deleted. (WebKit::WebWheelEvent::granularity const): Deleted. (WebKit::WebWheelEvent::directionInvertedFromDevice const): Deleted. (WebKit::WebWheelEvent::phase const): Deleted. (WebKit::WebWheelEvent::momentumPhase const): Deleted. (WebKit::WebWheelEvent::hasPreciseScrollingDeltas const): Deleted. (WebKit::WebWheelEvent::scrollCount const): Deleted. (WebKit::WebWheelEvent::unacceleratedScrollingDelta const): Deleted. (WebKit::WebKeyboardEvent::text const): Deleted. (WebKit::WebKeyboardEvent::unmodifiedText const): Deleted. (WebKit::WebKeyboardEvent::key const): Deleted. (WebKit::WebKeyboardEvent::code const): Deleted. (WebKit::WebKeyboardEvent::keyIdentifier const): Deleted. (WebKit::WebKeyboardEvent::windowsVirtualKeyCode const): Deleted. (WebKit::WebKeyboardEvent::nativeVirtualKeyCode const): Deleted. (WebKit::WebKeyboardEvent::macCharCode const): Deleted. (WebKit::WebKeyboardEvent::handledByInputMethod const): Deleted. (WebKit::WebKeyboardEvent::preeditUnderlines const): Deleted. (WebKit::WebKeyboardEvent::preeditSelectionRange const): Deleted. (WebKit::WebKeyboardEvent::commands const): Deleted. (WebKit::WebKeyboardEvent::isAutoRepeat const): Deleted. (WebKit::WebKeyboardEvent::isKeypad const): Deleted. (WebKit::WebKeyboardEvent::isSystemKey const): Deleted. (WebKit::WebPlatformTouchPoint::WebPlatformTouchPoint): Deleted. (WebKit::WebPlatformTouchPoint::identifier const): Deleted. (WebKit::WebPlatformTouchPoint::location const): Deleted. (WebKit::WebPlatformTouchPoint::phase const): Deleted. (WebKit::WebPlatformTouchPoint::state const): Deleted. (WebKit::WebPlatformTouchPoint::setRadiusX): Deleted. (WebKit::WebPlatformTouchPoint::radiusX const): Deleted. (WebKit::WebPlatformTouchPoint::setRadiusY): Deleted. (WebKit::WebPlatformTouchPoint::radiusY const): Deleted. (WebKit::WebPlatformTouchPoint::setRotationAngle): Deleted. (WebKit::WebPlatformTouchPoint::rotationAngle const): Deleted. (WebKit::WebPlatformTouchPoint::setForce): Deleted. (WebKit::WebPlatformTouchPoint::force const): Deleted. (WebKit::WebPlatformTouchPoint::setAltitudeAngle): Deleted. (WebKit::WebPlatformTouchPoint::altitudeAngle const): Deleted. (WebKit::WebPlatformTouchPoint::setAzimuthAngle): Deleted. (WebKit::WebPlatformTouchPoint::azimuthAngle const): Deleted. (WebKit::WebPlatformTouchPoint::setTouchType): Deleted. (WebKit::WebPlatformTouchPoint::touchType const): Deleted. (WebKit::WebTouchEvent::WebTouchEvent): Deleted. (WebKit::WebTouchEvent::touchPoints const): Deleted. (WebKit::WebTouchEvent::position const): Deleted. (WebKit::WebTouchEvent::isPotentialTap const): Deleted. (WebKit::WebTouchEvent::isGesture const): Deleted. (WebKit::WebTouchEvent::gestureScale const): Deleted. (WebKit::WebTouchEvent::gestureRotation const): Deleted. (WebKit::WebTouchEvent::canPreventNativeGestures const): Deleted. (WebKit::WebTouchEvent::setCanPreventNativeGestures): Deleted. (WebKit::WebPlatformTouchPoint::id const): Deleted. (WebKit::WebPlatformTouchPoint::screenPosition const): Deleted. (WebKit::WebPlatformTouchPoint::position const): Deleted. (WebKit::WebPlatformTouchPoint::radius const): Deleted. (WebKit::WebPlatformTouchPoint::setState): Deleted. * Shared/WebEventConversion.cpp: * Shared/WebKeyboardEvent.cpp: * Shared/WebKeyboardEvent.h: Added. (WebKit::WebKeyboardEvent::text const): (WebKit::WebKeyboardEvent::unmodifiedText const): (WebKit::WebKeyboardEvent::key const): (WebKit::WebKeyboardEvent::code const): (WebKit::WebKeyboardEvent::keyIdentifier const): (WebKit::WebKeyboardEvent::windowsVirtualKeyCode const): (WebKit::WebKeyboardEvent::nativeVirtualKeyCode const): (WebKit::WebKeyboardEvent::macCharCode const): (WebKit::WebKeyboardEvent::handledByInputMethod const): (WebKit::WebKeyboardEvent::preeditUnderlines const): (WebKit::WebKeyboardEvent::preeditSelectionRange const): (WebKit::WebKeyboardEvent::commands const): (WebKit::WebKeyboardEvent::isAutoRepeat const): (WebKit::WebKeyboardEvent::isKeypad const): (WebKit::WebKeyboardEvent::isSystemKey const): * Shared/WebMouseEvent.cpp: * Shared/WebMouseEvent.h: Added. (WebKit::WebMouseEvent::button const): (WebKit::WebMouseEvent::buttons const): (WebKit::WebMouseEvent::position const): (WebKit::WebMouseEvent::globalPosition const): (WebKit::WebMouseEvent::deltaX const): (WebKit::WebMouseEvent::deltaY const): (WebKit::WebMouseEvent::deltaZ const): (WebKit::WebMouseEvent::clickCount const): (WebKit::WebMouseEvent::eventNumber const): (WebKit::WebMouseEvent::menuTypeForEvent const): (WebKit::WebMouseEvent::force const): (WebKit::WebMouseEvent::syntheticClickType const): * Shared/WebTouchEvent.cpp: (WebKit::WebTouchEvent::allTouchPointsAreReleased const): * Shared/WebTouchEvent.h: Added. (WebKit::WebPlatformTouchPoint::WebPlatformTouchPoint): (WebKit::WebPlatformTouchPoint::identifier const): (WebKit::WebPlatformTouchPoint::location const): (WebKit::WebPlatformTouchPoint::phase const): (WebKit::WebPlatformTouchPoint::state const): (WebKit::WebPlatformTouchPoint::setRadiusX): (WebKit::WebPlatformTouchPoint::radiusX const): (WebKit::WebPlatformTouchPoint::setRadiusY): (WebKit::WebPlatformTouchPoint::radiusY const): (WebKit::WebPlatformTouchPoint::setRotationAngle): (WebKit::WebPlatformTouchPoint::rotationAngle const): (WebKit::WebPlatformTouchPoint::setForce): (WebKit::WebPlatformTouchPoint::force const): (WebKit::WebPlatformTouchPoint::setAltitudeAngle): (WebKit::WebPlatformTouchPoint::altitudeAngle const): (WebKit::WebPlatformTouchPoint::setAzimuthAngle): (WebKit::WebPlatformTouchPoint::azimuthAngle const): (WebKit::WebPlatformTouchPoint::setTouchType): (WebKit::WebPlatformTouchPoint::touchType const): (WebKit::WebTouchEvent::WebTouchEvent): (WebKit::WebTouchEvent::touchPoints const): (WebKit::WebTouchEvent::position const): (WebKit::WebTouchEvent::isPotentialTap const): (WebKit::WebTouchEvent::isGesture const): (WebKit::WebTouchEvent::gestureScale const): (WebKit::WebTouchEvent::gestureRotation const): (WebKit::WebTouchEvent::canPreventNativeGestures const): (WebKit::WebTouchEvent::setCanPreventNativeGestures): (WebKit::WebPlatformTouchPoint::id const): (WebKit::WebPlatformTouchPoint::screenPosition const): (WebKit::WebPlatformTouchPoint::position const): (WebKit::WebPlatformTouchPoint::radius const): (WebKit::WebPlatformTouchPoint::setState): * Shared/WebWheelEvent.cpp: (WebKit::WebWheelEvent::WebWheelEvent): * Shared/WebWheelEvent.h: Added. (WebKit::WebWheelEvent::position const): (WebKit::WebWheelEvent::globalPosition const): (WebKit::WebWheelEvent::delta const): (WebKit::WebWheelEvent::wheelTicks const): (WebKit::WebWheelEvent::granularity const): (WebKit::WebWheelEvent::directionInvertedFromDevice const): (WebKit::WebWheelEvent::phase const): (WebKit::WebWheelEvent::momentumPhase const): (WebKit::WebWheelEvent::hasPreciseScrollingDeltas const): (WebKit::WebWheelEvent::scrollCount const): (WebKit::WebWheelEvent::unacceleratedScrollingDelta const): * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebPlatformTouchPointIOS.cpp: * Shared/ios/WebTouchEventIOS.cpp: * Shared/mac/NativeWebGestureEventMac.mm: * Shared/mac/WebEventFactory.h: * Shared/mac/WebGestureEvent.h: * UIProcess/API/APINavigationClient.h: * UIProcess/API/APIPolicyClient.h: * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/WebPageProxy.cpp: * UIProcess/ios/WKMouseGestureRecognizer.mm: * WebKit.xcodeproj/project.pbxproj: * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h: * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: * WebProcess/Plugins/PDF/PDFPlugin.mm: * WebProcess/Plugins/PluginProxy.cpp: * WebProcess/Plugins/PluginView.cpp: * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/PageBanner.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/ios/WebPageIOS.mm: * WebProcess/WebPage/mac/WebPageMac.mm: 2020-10-02 Wenson Hsieh <wenson_hsieh@apple.com> [ iOS ] ASSERTION FAILED: ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree https://bugs.webkit.org/show_bug.cgi?id=217203 <rdar://problem/69864747> Reviewed by Tim Horton. Refactor logic that removes drop placeholder attributes such that it runs as an asynchronously task rather than underneath the scope of `didFinishLoadingImageForElement`. This is because the image load client call may occur in the middle of a rendering update, during which it is not safe to change element attribute values, since that may trigger script execution. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::didFinishLoadingImageForElement): 2020-10-02 Kate Cheney <katherine_cheney@apple.com> Multiple calls to suspend media playback for the same page may result in resuming media playback too soon https://bugs.webkit.org/show_bug.cgi?id=217228 rdar://problem/69709346 Reviewed by Eric Carlson. Calls to suspend/resume media playback should always be called in pairs. The current implementation resumes media playback on the first call to resumeAllMediaPlayback even if multiple calls to suspendAllMediaPlayback have been made. This patch adds a counter to track how many calls to suspendAllMediaPlayback have occurred, and only resumes once the counter reaches 0. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _suspendMediaPlaybackCounter]): SPI for test purposes. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendAllMediaPlayback): (WebKit::WebPageProxy::resumeAllMediaPlayback): Never let the counter get below 0. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::suspendMediaPlaybackCounter): 2020-10-02 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r267817. Broke two tests on Mac Reverted changeset: "Storage Access API: Enable per-page storage access scope and align test cases" https://bugs.webkit.org/show_bug.cgi?id=217077 https://trac.webkit.org/changeset/267817 2020-10-02 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Remove requiresTextTrackRepresentation in RemoteMediaPlayerState https://bugs.webkit.org/show_bug.cgi?id=217230 Reviewed by Jer Noble. A Web process can figure out whether the fullscreen/picture-in-picture subtitle layer (for text track representation) is required by itself, so it does not need to get the information from the GPU process. * WebProcess/GPU/media/RemoteMediaPlayerState.h: (WebKit::RemoteMediaPlayerState::encode const): (WebKit::RemoteMediaPlayerState::decode): 2020-10-02 Brian Burg <bburg@apple.com> [Cocoa] Web Inspector: add an ObjC protocol for extension support https://bugs.webkit.org/show_bug.cgi?id=217191 <rdar://problem/69797960> Reviewed by Timothy Hatcher. * UIProcess/API/Cocoa/_WKInspector.h: 2020-10-02 Wenson Hsieh <wenson_hsieh@apple.com> [GPU Process] fast/canvas/canvas-createPattern-video-loading.html times out https://bugs.webkit.org/show_bug.cgi?id=217227 Reviewed by Eric Carlson. Even after supporting `createPattern` with video elements using the GPU process for both media and canvas rendering, we still fail this test due to a security error that is thrown when consulting `CanvasRenderingContext::wouldTaintOrigin`. This, in turn, is due to the fact that we never attempt to update cached `wouldTaintDocumentSecurityOrigin` state on `MediaPlayerPrivateRemote`, so it remains `true`. This change will be covered by fast/canvas/canvas-createPattern-video-loading.html, which should now fail with a text diff instead of timing out due to lack of support for creating a `CanvasPattern` out of a video element. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::updateCachedState): 2020-10-02 Sam Weinig <weinig@apple.com> Remove code behind ENABLE(MEDIA_SESSION), no ports enable it https://bugs.webkit.org/show_bug.cgi?id=216831 Reviewed by Alex Christensen. Removes all code in ENABLE(MEDIA_SESSION) and all media session related SPI. It was never enabled and nothing ever adopted it. * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Remove media session related files. * Shared/API/APIObject.h: * Shared/API/c/WKBase.h: * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebMediaSessionMetadata.cpp: Removed. * Shared/WebMediaSessionMetadata.h: Removed. * UIProcess/API/APIUIClient.h: * UIProcess/API/C/WKAPICast.h: * UIProcess/API/C/WKContext.cpp: * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKMediaSessionFocusManager.cpp: Removed. * UIProcess/API/C/WKMediaSessionFocusManager.h: Removed. * UIProcess/API/C/WKMediaSessionMetadata.cpp: Removed. * UIProcess/API/C/WKMediaSessionMetadata.h: Removed. * UIProcess/API/C/WKPage.cpp: * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/C/WKPageUIClient.h: * UIProcess/WebMediaSessionFocusManager.cpp: Removed. * UIProcess/WebMediaSessionFocusManager.h: Removed. * UIProcess/WebMediaSessionFocusManagerClient.cpp: Removed. * UIProcess/WebMediaSessionFocusManagerClient.h: Removed. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: * UIProcess/WebProcessPool.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Remove all code in ENABLE(MEDIA_SESSION). 2020-10-02 Karl Rackler <rackler@apple.com> Unreviewed, reverting r267796. This change is breaking the build on AzulE debug bots. Reverted changeset: "Remove code behind ENABLE(MEDIA_SESSION), no ports enable it" https://bugs.webkit.org/show_bug.cgi?id=216831 https://trac.webkit.org/changeset/267796 2020-10-02 Alexander Mikhaylenko <alexm@gnome.org> [GTK] WPE and backend versions are mixed up in webkit://gpu https://bugs.webkit.org/show_bug.cgi?id=217210 Reviewed by Adrian Perez de Castro. * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleGPU): 2020-10-02 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r267864. https://bugs.webkit.org/show_bug.cgi?id=217220 Added broken tests Reverted changeset: "[GPU Process] Support drawing text in 2D canvas with font features" https://bugs.webkit.org/show_bug.cgi?id=206118 https://trac.webkit.org/changeset/267864 2020-10-01 Myles C. Maxfield <mmaxfield@apple.com> [GPU Process] Support drawing text in 2D canvas with font features https://bugs.webkit.org/show_bug.cgi?id=206118 Reviewed by Wenson Hsieh. Simply serialize and deserialize all the non-derived data in Font and PlatformFontData. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<Ref<Font>>::encodePlatformData): (IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<Ref<Font>>::encode): (IPC::ArgumentCoder<Ref<Font>>::decode): * Shared/WebCoreArgumentCoders.h: 2020-10-01 Chris Dumez <cdumez@apple.com> Add basic infrastructure for AudioWorklet https://bugs.webkit.org/show_bug.cgi?id=217153 Reviewed by Sam Weinig. Update RemoteAudioDestinationProxy to match what was done in AudioDestinationCocoa. RemoteAudioDestinationProxy is used when the GPU process is enabled. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::start): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::create): (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::stop): (WebKit::RemoteAudioDestinationProxy::renderBuffer): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/WebMediaStrategy.cpp: (WebKit::WebMediaStrategy::createAudioDestination): * WebProcess/GPU/media/WebMediaStrategy.h: 2020-10-01 Adrian Perez de Castro <aperez@igalia.com> and Don Olmstead <don.olmstead@sony.com> Non-unified build fixes, early October 2020 edition https://bugs.webkit.org/show_bug.cgi?id=217165 Reviewed by Yusuke Suzuki. * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: 2020-10-01 Eric Carlson <eric.carlson@apple.com> Prevent media capture unless the application has correct data for system permission prompt https://bugs.webkit.org/show_bug.cgi?id=217104 <rdar://problem/69761929> Reviewed by Darin Adler. Tested manually with MiniBrowser. * SourcesCocoa.txt: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::requestAVCaptureAccessForMediaType): Renamed from requestAccessForMediaType. (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Deny requests of the application is not permitted to capture. Restructure logic to make it easier to understand. (WebKit::requestAccessForMediaType): Deleted. * UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm: Added. (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureAudio): Check for required Info.plist string. (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureVideo): Ditto. * UIProcess/Cocoa/WebPageProxyCocoa.mm: Update for unified build. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureAudio): (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureVideo): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * WebKit.xcodeproj/project.pbxproj: 2020-10-01 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Enable IPC message handlers of RemoteAudioSession https://bugs.webkit.org/show_bug.cgi?id=217144 Reviewed by Jer Noble. This patch enables the RemoteAudioSession in the Web process to handle IPC messages from the GPU process. It also fixes a bug preventing the audio playback to start. No new tests, no functional change. * GPUProcess/media/RemoteAudioSessionProxyManager.cpp: (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess): Don't interrupt the audio session trying to start. * GPUProcess/media/RemoteAudioSessionProxyManager.messages.in: Removed. * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): Clean-up. * WebProcess/GPU/media/RemoteAudioSession.cpp: (WebKit::RemoteAudioSession::RemoteAudioSession): (WebKit::RemoteAudioSession::~RemoteAudioSession): We need to remove the "destinationID" parameter, otherwise, RemoteAudioSession won't receive the IPC messages. * WebProcess/GPU/media/RemoteAudioSession.h: Clean-up. * WebProcess/GPU/media/WebMediaStrategy.h: Clean-up. 2020-10-01 Youenn Fablet <youenn@apple.com> MediaRecorder should support MediaRecorderOptions.mimeType https://bugs.webkit.org/show_bug.cgi?id=215018 <rdar://problem/66681508> Reviewed by Eric Carlson. Update code to pass mimeType as part of startRecording callback. * GPUProcess/webrtc/RemoteMediaRecorder.h: (WebKit::RemoteMediaRecorder::mimeType const): * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::createRecorder): * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-10-01 Youenn Fablet <youenn@apple.com> MediaRecorder should support isTypeSupported https://bugs.webkit.org/show_bug.cgi?id=216856 <rdar://problem/69767695> Reviewed by Darin Adler. Stop passing mimeType for each data blob. Instead, compute it on WebProcess side. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::fetchData): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::fetchData): (WebKit::MediaRecorderPrivate::mimeType const): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-09-30 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Enable IPC message handlers of RemoteMediaSessionHelper https://bugs.webkit.org/show_bug.cgi?id=217152 Reviewed by Eric Carlson. * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp: (WebKit::RemoteMediaSessionHelper::RemoteMediaSessionHelper): 2020-09-30 John Wilander <wilander@apple.com> Storage Access API: Enable per-page storage access scope and align test cases https://bugs.webkit.org/show_bug.cgi?id=217077 <rdar://problem/69017878> Reviewed by Brent Fulgham. It was decided in https://github.com/privacycg/storage-access/issues/3 that browsers should grant storage access for all same-site resources on the whole page, not just the requesting iframe. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::hasStorageAccess): Added a call to WebPage::hasPageLevelStorageAccess() and an early return if it returns true. 2020-09-30 Wenson Hsieh <wenson_hsieh@apple.com> [GPU Process] Canvas layout tests occasionally crash the web process under PutImageData::apply https://bugs.webkit.org/show_bug.cgi?id=217140 Reviewed by Tim Horton. When destroying a `RemoteImageBuffer`, logic exists in the superclass (`DisplayList::ImageBuffer`) that attempts to flush any remaining display list items. However, this currently doesn't work as intended, since we've already finished destroying the subclass, so the superclass' call to `flushDrawingContext()` calls `DisplayList:: ImageBuffer::flushDrawingContext()` rather than `RemoteImageBuffer::flushDrawingContext()`. Rather than flushing display list items to the GPU process, this has the effect of attempting to replay these display list items to the drawing context (which is backed by a `DisplayList` anyways), so this ends up having no tangible effect. However, if one of these display list items happens to be `PutImageData`, we'll end up hitting an assertion due to being unable to apply it without a `Delegate`. To fix this, hoist the call to `flushDrawingContext()` out to `~RemoteImageBuffer()`, rather than `~DisplayList::ImageBuffer()`. * WebProcess/GPU/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::~RemoteImageBuffer): 2020-09-30 Per Arne Vollan <pvollan@apple.com> [macOS] Deny mach-lookup to the analytics service in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=217137 <rdar://problem/69019193> Reviewed by Brent Fulgham. Only internal OS variants should have access to the 'com.apple.analyticsd' service. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::diagnosticServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-09-30 Alex Christensen <achristensen@webkit.org> REGRESSION[267763] RELEASE_ASSERT in allNetworkProcesses hit when registering legacy protocol handlers before instantiating any WebKit objects https://bugs.webkit.org/show_bug.cgi?id=217142 <rdar://problem/69778879> Reviewed by Brady Eidson. RELEASE_ASSERT(RunLoop::isMain()) was crashing because WTF::initializeMainThread hadn't been called. This wasn't a problem before r267763 because the assertion did not exist. Rather than remove the assertion (which I think is important to have) let's just initialize WebKit threading at these SPI entry points. This unfortunately can't be tested with our current infrastructure because TestsController's constructor calls initializeMainThread. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::registerGlobalURLSchemeAsHavingCustomProtocolHandlers): (WebKit::WebProcessPool::unregisterGlobalURLSchemeAsHavingCustomProtocolHandlers): 2020-09-30 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r267788. Broke internal builds. Reverted changeset: "MediaRecorder should support isTypeSupported" https://bugs.webkit.org/show_bug.cgi?id=216856 https://trac.webkit.org/changeset/267788 2020-09-30 Sam Weinig <weinig@apple.com> Remove code behind ENABLE(MEDIA_SESSION), no ports enable it https://bugs.webkit.org/show_bug.cgi?id=216831 Reviewed by Alex Christensen. Removes all code in ENABLE(MEDIA_SESSION) and all media session related SPI. It was never enabled and nothing ever adopted it. * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Remove media session related files. * Shared/API/APIObject.h: * Shared/API/c/WKBase.h: * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: * Shared/WebMediaSessionMetadata.cpp: Removed. * Shared/WebMediaSessionMetadata.h: Removed. * UIProcess/API/APIUIClient.h: * UIProcess/API/C/WKAPICast.h: * UIProcess/API/C/WKContext.cpp: * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKMediaSessionFocusManager.cpp: Removed. * UIProcess/API/C/WKMediaSessionFocusManager.h: Removed. * UIProcess/API/C/WKMediaSessionMetadata.cpp: Removed. * UIProcess/API/C/WKMediaSessionMetadata.h: Removed. * UIProcess/API/C/WKPage.cpp: * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/C/WKPageUIClient.h: * UIProcess/WebMediaSessionFocusManager.cpp: Removed. * UIProcess/WebMediaSessionFocusManager.h: Removed. * UIProcess/WebMediaSessionFocusManagerClient.cpp: Removed. * UIProcess/WebMediaSessionFocusManagerClient.h: Removed. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: * UIProcess/WebProcessPool.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Remove all code in ENABLE(MEDIA_SESSION). 2020-09-30 Brian Burg <bburg@apple.com> Web Inspector: exempt API::SharedJSContext from remote inspection and automatic inspection https://bugs.webkit.org/show_bug.cgi?id=217109 <rdar://problem/69386559> Reviewed by Mark Lam. We have seen occasional unexpected spins underneath pauseWaitingForRemoteInspection() waiting for this JSContext. Since it does not evaluate JavaScript and is WebKit-internal, simply disable remote inspection for the JSContext. * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm: (API::SharedJSContext::ensureContext): 2020-09-30 Tim Horton <timothy_horton@apple.com> REGRESSION (r265009): Web Share API can no longer be invoked if a previous invocation was dismissed using the close button https://bugs.webkit.org/show_bug.cgi?id=216913 <rdar://problem/69659878> Reviewed by Darin Adler. No new tests; not able to test without UI tests that actually use UIActivityViewController. * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithShareDataArray:inRect:]): -presentationControllerDidDismiss is not called if the UIActivityViewController is programmatically dismissed, so we need to revert to observing completion via UIActivityViewController's -completionWithItemsHandler. In order to avoid regressing bug 214894 by doing so, we also need to make sure that we're actually not presented anymore, as -completionWithItemsHandler can be called multiple times before the share sheet is actually dismissed. 2020-09-30 Youenn Fablet <youenn@apple.com> MediaRecorder should support isTypeSupported https://bugs.webkit.org/show_bug.cgi?id=216856 Reviewed by Darin Adler. Stop passing mimeType for each data blob. Instead, compute it on WebProcess side. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::fetchData): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::fetchData): (WebKit::MediaRecorderPrivate::mimeType const): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-09-30 Myles C. Maxfield <mmaxfield@apple.com> [GPU Process] Remove FontHandle https://bugs.webkit.org/show_bug.cgi?id=217076 Reviewed by Wenson Hsieh. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<Ref<Font>>::encodePlatformData): (IPC::ArgumentCoder<Ref<Font>>::decodePlatformData): (IPC::ArgumentCoder<FontHandle>::encodePlatformData): Deleted. (IPC::ArgumentCoder<FontHandle>::decodePlatformData): Deleted. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<Ref<Font>>::encode): (IPC::createFont): (IPC::ArgumentCoder<Ref<Font>>::decode): (IPC::ArgumentCoder<FontHandle>::encode): Deleted. (IPC::ArgumentCoder<FontHandle>::decode): Deleted. * Shared/WebCoreArgumentCoders.h: 2020-09-29 Sam Weinig <weinig@apple.com> [Preferences] Adopt shared preferences configuration and script in WebKit https://bugs.webkit.org/show_bug.cgi?id=217075 Reviewed by Darin Adler. * Shared/WebPreferences.yaml: Removed. * Shared/WebPreferencesDebug.yaml: Removed. * Shared/WebPreferencesExperimental.yaml: Removed. * Shared/WebPreferencesInternal.yaml: Removed. * Scripts/GeneratePreferences.rb: Removed. * WebKit.xcodeproj/project.pbxproj: Remove yaml preferences and preference generator in favor of shared one in WTF. * CMakeLists.txt: * DerivedSources.make: Update preference generation to use the shared script and preference files. * Configurations/BaseTarget.xcconfig: Add new variable, WTF_BUILD_SCRIPTS_DIR, that points to directory where the shared generator and preference files live for use as input to the generation. * DerivedSources-input.xcfilelist: Update for new location of script and preference files. * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb: Port support for multiple conditionally-defined defaultValues from WebKitLegacy, keeping the same DEFAULT_VALUE_FOR_* macro naming and using the macro definitions in place of existing <%= @pref.defaultValue %> idiom. Also updates for rename from @internalDebugFeatures to @internalFeatures. * Shared/WebPreferencesDefaultValues.cpp: * Shared/WebPreferencesDefaultValues.h: Remove defaults that are now fully specified in the preference files. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): Replace removed DEFAULT_APPLE_PAY_ENABLED, with the now generated DEFAULT_VALUE_FOR_ApplePayEnabled. 2020-09-29 Wenson Hsieh <wenson_hsieh@apple.com> [GPU Process] RemoteImageBufferProxy should ensure the state stack of the context is cleared before destruction https://bugs.webkit.org/show_bug.cgi?id=208876 Reviewed by Tim Horton. When running canvas layout tests in debug WebKit, the assertion in `~GraphicsContext()` which verifies that `m_stack.isEmpty()` fires. This occurs because the matching call to restore may still be buffered in the web process when the remote image buffer proxy in the GPU process is destroyed; however, this may also occur if the web process terminates without having sent the matching calls to restore the graphics context. We can fix both of these scenarios by manually unwinding the context's state stack when destroying the `RemoteImageBufferProxy`. Original patch by Said Abou-Hallawa. * GPUProcess/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): 2020-09-29 Stephan Szabo <stephan.szabo@sony.com> [PlayStation] Build fix for GPU Process after r267725 https://bugs.webkit.org/show_bug.cgi?id=217098 Unreviewed build fix. Update playstation specific code for signature changes in the above. Fix MediaPlayerPrivateRemote constructor when RELEASE_LOG_DISABLED was specified. * GPUProcess/media/playstation/RemoteMediaPlayerProxyPlayStation.cpp: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: 2020-09-29 Alex Christensen <achristensen@webkit.org> Move NetworkProcessProxy ownership from WebProcessPool to WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=216041 Reviewed by Brady Eidson. This patch moves the things on WebProcessPool associated with NetworkProcessProxy ownership and moves them to WebsiteDataStore. It's pretty mechanical, but it reaches its fingers into a lot of things. Some comments on interesting parts are below. Why am I doing this? I'm glad you asked. WKWebView had a fundamental cookie problem before this change. It had a WKWebsiteDataStore that could point to a cookie store on disk that could be used in multiple network processes at the same time. This led to problems with cookies being received over the network in those different processes being unable to be shared until they were written to disk, something that does not happen immediately, especially on iOS. This problem is even worse with session cookies, which should be kept in memory and never be written to disk. Those processes did not use shared memory to share the cookies. They just didn't share them, which led to cookie incorrectness. This was unfortunately the default configuration if you call [[WKWebView alloc] init] more than once, which many developers do. There was also occasional cookie corruption and loss from multiple processes writing cookies to the same file. All these problems can be worked around by doing what Safari does: manually setting the WKProcessPool of all WKWebViewConfigurations to the same process pool to only use one network process. This is not intuitive or well documented, and even though I have spent the majority of WWDC labs for the last 3 years telling developers to do it, most developers do not. The default behavior should not lead to cookie incorrectness, corruption, or loss. This accomplishes that. A bigger problem that can't really be worked around well is what we were doing in our WKHTTPCookieStore API. Many developers call setCookie:completionHandler: to "log in" the user by setting a cookie, then in the completion handler, they open a WKWebView to their page and expect the cookie to be sent. Before this change, we would not know which process pool to set the cookie in so we would guess. If there were no process pools, we would start writing to disk and hope it writes fast enough. We can't wait for it to complete because it causes hangs like rdar://problem/66961066. This solution allows to start the network process of that WebsiteDataStore and set the cookie in that process. We now know that is the only process this WebsiteDataStore will ever use. Now, users will be able to actually be logged in all the time in such apps. * NetworkProcess/Cookies/WebCookieManager.cpp: (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy): (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy): * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp: (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm: (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp: (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::ensureSession): (WebKit::NetworkProcess::storageSession const): (WebKit::NetworkProcess::forEachNetworkStorageSession): (WebKit::NetworkProcess::defaultStorageSession const): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::close): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): (WebKit::saveCookies): (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Deleted. * NetworkProcess/curl/NetworkProcessCurl.cpp: (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Deleted. * NetworkProcess/mac/RemoteNetworkingContext.mm: (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Deleted. * Platform/IPC/Attachment.h: * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::encode const): (WebKit::WebsiteDataStoreParameters::decode): * Shared/WebsiteDataStoreParameters.h: * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::HTTPCookieStore): (API::HTTPCookieStore::~HTTPCookieStore): (API::HTTPCookieStore::cookies): (API::HTTPCookieStore::cookiesForURL): (API::HTTPCookieStore::setCookies): (API::HTTPCookieStore::deleteCookie): (API::HTTPCookieStore::deleteAllCookies): (API::HTTPCookieStore::setHTTPCookieAcceptPolicy): (API::HTTPCookieStore::registerObserver): (API::HTTPCookieStore::cookieManagerDestroyed): (API::HTTPCookieStore::registerForNewProcessPoolNotifications): Deleted. (API::HTTPCookieStore::unregisterForNewProcessPoolNotifications): Deleted. * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/C/WKContext.cpp: (WKContextSetUseSeparateServiceWorkerProcess): (WKContextSetPrimaryWebsiteDataStore): (WKContextGetCookieManager): Deleted. (WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting): Deleted. (WKContextTerminateNetworkProcess): Deleted. (WKContextGetNetworkProcessIdentifier): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/C/WKPage.cpp: (WKPageGetWebsiteDataStore): * UIProcess/API/C/WKPage.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreTerminateNetworkProcess): (WKWebsiteDataStoreGetNetworkProcessIdentifier): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setUseSeparateServiceWorkerProcess:]): (-[WKProcessPool _terminateNetworkProcess]): Deleted. (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]): Deleted. (-[WKProcessPool _sendNetworkProcessPrepareToSuspend:]): Deleted. (-[WKProcessPool _sendNetworkProcessDidResume]): Deleted. (-[WKProcessPool _networkProcessIdentifier]): Deleted. (-[WKProcessPool _makeNextNetworkProcessLaunchFailForTesting]): Deleted. (-[WKProcessPool _synthesizeAppIsBackground:]): Deleted. (-[WKProcessPool _setAllowsAnySSLCertificateForServiceWorker:]): Deleted. (-[WKProcessPool _networkProcessHasEntitlementForTesting:]): Deleted. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _networkProcessHasEntitlementForTesting:]): (-[WKWebsiteDataStore _terminateNetworkProcess]): (-[WKWebsiteDataStore _sendNetworkProcessPrepareToSuspend:]): (-[WKWebsiteDataStore _sendNetworkProcessWillSuspendImminently]): (-[WKWebsiteDataStore _sendNetworkProcessDidResume]): (-[WKWebsiteDataStore _synthesizeAppIsBackground:]): (-[WKWebsiteDataStore _networkProcessIdentifier]): (+[WKWebsiteDataStore _makeNextNetworkProcessLaunchFailForTesting]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/glib/WebKitCookieManager.cpp: (_WebKitCookieManagerPrivate::cookieManager const): (_WebKitCookieManagerPrivate::~_WebKitCookieManagerPrivate): (webkitCookieManagerCreate): (webkit_cookie_manager_set_persistent_storage): (webkit_cookie_manager_set_accept_policy): (webkit_cookie_manager_get_accept_policy): (webkit_cookie_manager_add_cookie): (webkit_cookie_manager_get_cookies): (webkit_cookie_manager_delete_cookie): * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextConstructed): (webkit_web_context_prefetch_dns): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/AuxiliaryProcessProxy.h: * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::updateProcessSuppressionState): (WebKit::WebProcessPool::platformInitialize): (WebKit::WebProcessPool::platformInitializeNetworkProcess): (WebKit::WebProcessPool::networkProcessHasEntitlementForTesting): Deleted. (WebKit::WebProcessPool::xpcEndpointMessage const): Deleted. (WebKit::WebProcessPool::sendNetworkProcessXPCEndpointToWebProcess): Deleted. * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::cancel): (WebKit::DownloadProxy::publishProgress): (WebKit::DownloadProxy::didReceiveAuthenticationChallenge): (WebKit::DownloadProxy::willSendRequest): (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync): * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::DownloadProxyMap): (WebKit::DownloadProxyMap::applicationDidEnterBackground): (WebKit::DownloadProxyMap::applicationWillEnterForeground): (WebKit::DownloadProxyMap::createDownloadProxy): (WebKit::DownloadProxyMap::downloadFinished): (WebKit::DownloadProxyMap::invalidate): * UIProcess/Downloads/DownloadProxyMap.h: * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp: (WebKit::LegacyCustomProtocolManagerProxy::startLoading): (WebKit::LegacyCustomProtocolManagerProxy::stopLoading): (WebKit::LegacyCustomProtocolManagerProxy::invalidate): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::allNetworkProcesses): (WebKit::defaultProcess): (WebKit::NetworkProcessProxy::defaultNetworkProcess): (WebKit::NetworkProcessProxy::terminate): (WebKit::NetworkProcessProxy::didTerminate): (WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess): (WebKit::anyProcessPoolAlwaysRunsAtBackgroundPriority): (WebKit::anyProcessPoolShouldTakeUIBackgroundAssertion): (WebKit::NetworkProcessProxy::NetworkProcessProxy): (WebKit::NetworkProcessProxy::~NetworkProcessProxy): (WebKit::NetworkProcessProxy::getLaunchOptions): (WebKit::NetworkProcessProxy::createDownloadProxy): (WebKit::NetworkProcessProxy::networkProcessCrashed): (WebKit::NetworkProcessProxy::didReceiveMessage): (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): (WebKit::NetworkProcessProxy::didFinishLaunching): (WebKit::NetworkProcessProxy::setDomainsWithUserInteraction): (WebKit::NetworkProcessProxy::addSession): (WebKit::NetworkProcessProxy::removeSession): (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID): (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess): (WebKit::anyProcessPoolHasForegroundWebProcesses): (WebKit::anyProcessPoolHasBackgroundWebProcesses): (WebKit::NetworkProcessProxy::updateProcessAssertion): (WebKit::NetworkProcessProxy::hasSession const): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxyCocoa.mm: (WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const): * UIProcess/WebCookieManagerProxy.cpp: (WebKit::WebCookieManagerProxy::WebCookieManagerProxy): (WebKit::WebCookieManagerProxy::~WebCookieManagerProxy): (WebKit::WebCookieManagerProxy::getHostnamesWithCookies): (WebKit::WebCookieManagerProxy::deleteCookiesForHostnames): (WebKit::WebCookieManagerProxy::deleteAllCookies): (WebKit::WebCookieManagerProxy::deleteCookie): (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince): (WebKit::WebCookieManagerProxy::setCookies): (WebKit::WebCookieManagerProxy::getAllCookies): (WebKit::WebCookieManagerProxy::getCookies): (WebKit::WebCookieManagerProxy::startObservingCookieChanges): (WebKit::WebCookieManagerProxy::stopObservingCookieChanges): (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy): (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy): (WebKit::WebCookieManagerProxy::supplementName): Deleted. (WebKit::WebCookieManagerProxy::create): Deleted. (WebKit::WebCookieManagerProxy::processPoolDestroyed): Deleted. (WebKit::WebCookieManagerProxy::processDidClose): Deleted. (WebKit::WebCookieManagerProxy::refWebContextSupplement): Deleted. (WebKit::WebCookieManagerProxy::derefWebContextSupplement): Deleted. * UIProcess/WebCookieManagerProxy.h: (WebKit::WebCookieManagerProxy::create): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setControlledByAutomation): (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess): (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride): (WebKit::WebPageProxy::preconnectTo): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::logFrameNavigation): (WebKit::WebPageProxy::dumpAdClickAttribution): (WebKit::WebPageProxy::clearAdClickAttribution): (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting): (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting): (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::urlSchemesWithCustomProtocolHandlers): (WebKit::WebProcessPool::WebProcessPool): (WebKit::WebProcessPool::~WebProcessPool): (WebKit::WebProcessPool::languageChanged): (WebKit::WebProcessPool::sendMemoryPressureEvent): (WebKit::WebProcessPool::networkProcessCrashed): (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): (WebKit::WebProcessPool::removeFromServiceWorkerProcesses): (WebKit::WebProcessPool::tryTakePrewarmedProcess): (WebKit::WebProcessPool::initializeNewWebProcess): (WebKit::WebProcessPool::processDidFinishLaunching): (WebKit::WebProcessPool::createWebPage): (WebKit::WebProcessPool::updateServiceWorkerUserAgent): (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): (WebKit::WebProcessPool::download): (WebKit::WebProcessPool::resumeDownload): (WebKit::WebProcessPool::registerURLSchemeAsSecure): (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy): (WebKit::WebProcessPool::registerURLSchemeAsLocal): (WebKit::WebProcessPool::registerURLSchemeAsNoAccess): (WebKit::WebProcessPool::registerGlobalURLSchemeAsHavingCustomProtocolHandlers): (WebKit::WebProcessPool::unregisterGlobalURLSchemeAsHavingCustomProtocolHandlers): (WebKit::WebProcessPool::setCacheModel): (WebKit::WebProcessPool::setCacheModelSynchronouslyForTesting): (WebKit::WebProcessPool::createDownloadProxy): (WebKit::WebProcessPool::terminateServiceWorkers): (WebKit::WebProcessPool::serviceWorkerProcesses): (WebKit::WebProcessPool::updateProcessAssertions): (WebKit::WebProcessPool::isServiceWorkerPageID const): (WebKit::WebProcessPool::setUseSeparateServiceWorkerProcess): (WebKit::WebProcessPool::hasServiceWorkerForegroundActivityForTesting const): (WebKit::WebProcessPool::hasServiceWorkerBackgroundActivityForTesting const): (WebKit::WebProcessPool::setLegacyCustomProtocolManagerClient): Deleted. (WebKit::WebProcessPool::networkingProcessConnection): Deleted. (WebKit::WebProcessPool::ensureNetworkProcess): Deleted. There seems to be a lot of code removal here, but most of it was duplicate code with WebsiteDataStore::parameters which is used instead. That which was not duplicate was moved to NetworkProcessProxy::sendCreationParametersToNewProcess. This was the hardest part of this patch. (WebKit::WebProcessPool::getNetworkProcessConnection): Deleted. (WebKit::WebProcessPool::networkProcessIdentifier): Deleted. (WebKit::WebProcessPool::synthesizeAppIsBackground): Deleted. (WebKit::WebProcessPool::sendSyncToNetworkingProcess): Deleted. (WebKit::WebProcessPool::clearCachedCredentials): Deleted. (WebKit::WebProcessPool::terminateNetworkProcess): Deleted. (WebKit::WebProcessPool::sendNetworkProcessPrepareToSuspendForTesting): Deleted. (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting): Deleted. (WebKit::WebProcessPool::sendNetworkProcessDidResume): Deleted. (WebKit::WebProcessPool::flushCookies): Deleted. (WebKit::WebProcessPool::didCommitCrossSiteLoadWithDataTransfer): Deleted. * UIProcess/WebProcessPool.h: (WebKit::WebProcessPool::sendToNetworkingProcess): Deleted. (WebKit::WebProcessPool::sendToNetworkingProcessRelaunchingIfNecessary): Deleted. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setWebsiteDataStore): (WebKit::WebProcessProxy::getNetworkProcessConnection): (WebKit::WebProcessProxy::didFinishLaunching): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::networkProcessHasEntitlementForTesting): (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToWebProcess): (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToAllWebProcesses): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::forEachWebsiteDataStore): (WebKit::WebsiteDataStore::WebsiteDataStore): (WebKit::WebsiteDataStore::~WebsiteDataStore): (WebKit::WebsiteDataStore::registerWithSessionIDMap): (WebKit::WebsiteDataStore::existingDataStoreForSessionID): (WebKit::WebsiteDataStore::networkProcess): (WebKit::WebsiteDataStore::networkProcess const): (WebKit::WebsiteDataStore::fetchDataAndApply): (WebKit::WebsiteDataStore::removeData): (WebKit::WebsiteDataStore::setServiceWorkerTimeoutForTesting): (WebKit::WebsiteDataStore::resetServiceWorkerTimeoutForTesting): (WebKit::WebsiteDataStore::setMaxStatisticsEntries): (WebKit::WebsiteDataStore::setPruneEntriesDownTo): (WebKit::WebsiteDataStore::setGrandfatheringTime): (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval): (WebKit::WebsiteDataStore::dumpResourceLoadStatistics): (WebKit::WebsiteDataStore::isPrevalentResource): (WebKit::WebsiteDataStore::isGrandfathered): (WebKit::WebsiteDataStore::setPrevalentResource): (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode): (WebKit::WebsiteDataStore::isVeryPrevalentResource): (WebKit::WebsiteDataStore::setVeryPrevalentResource): (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): (WebKit::WebsiteDataStore::setSubframeUnderTopFrameDomain): (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder): (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameDomain): (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder): (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo): (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom): (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo): (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom): (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo): (WebKit::WebsiteDataStore::clearPrevalentResource): (WebKit::WebsiteDataStore::resetParametersToDefaultValues): (WebKit::WebsiteDataStore::submitTelemetry): (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent): (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary): (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate): (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing): (WebKit::WebsiteDataStore::statisticsDatabaseHasAllTables): (WebKit::WebsiteDataStore::setLastSeen): (WebKit::WebsiteDataStore::domainIDExistsInDatabase): (WebKit::WebsiteDataStore::mergeStatisticForTesting): (WebKit::WebsiteDataStore::insertExpiredStatisticForTesting): (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned): (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest): (WebKit::WebsiteDataStore::getAllStorageAccessEntries): (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction): (WebKit::WebsiteDataStore::logUserInteraction): (WebKit::WebsiteDataStore::hasHadUserInteraction): (WebKit::WebsiteDataStore::isRelationshipOnlyInDatabaseOnce): (WebKit::WebsiteDataStore::clearUserInteraction): (WebKit::WebsiteDataStore::setGrandfathered): (WebKit::WebsiteDataStore::setUseITPDatabase): (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting): (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting): (WebKit::WebsiteDataStore::deleteCookiesForTesting): (WebKit::WebsiteDataStore::hasLocalStorageForTesting const): (WebKit::WebsiteDataStore::hasIsolatedSessionForTesting const): (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting): (WebKit::WebsiteDataStore::setThirdPartyCookieBlockingMode): (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldEnbleSameSiteStrictEnforcementForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsToSameSiteStrictCookiesForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyHostCNAMEDomainForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsThirdPartyCNAMEDomainForTesting): (WebKit::WebsiteDataStore::syncLocalStorage): (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::processPools const): (WebKit::WebsiteDataStore::allowSpecificHTTPSCertificateForHost): (WebKit::WebsiteDataStore::getNetworkProcessConnection): (WebKit::WebsiteDataStore::networkProcessCrashed): (WebKit::WebsiteDataStore::terminateNetworkProcess): (WebKit::WebsiteDataStore::sendNetworkProcessPrepareToSuspendForTesting): (WebKit::WebsiteDataStore::sendNetworkProcessWillSuspendImminentlyForTesting): (WebKit::WebsiteDataStore::sendNetworkProcessDidResume): (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): (WebKit::WebsiteDataStore::setStatisticsTestingCallback): (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode): (WebKit::WebsiteDataStore::isResourceLoadStatisticsEphemeral const): (WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): (WebKit::WebsiteDataStore::flushCookies): (WebKit::WebsiteDataStore::setAllowsAnySSLCertificateForWebSocket): (WebKit::WebsiteDataStore::clearCachedCredentials): (WebKit::WebsiteDataStore::parameters): (WebKit::WebsiteDataStore::getLocalStorageDetails): (WebKit::WebsiteDataStore::resetQuota): (WebKit::WebsiteDataStore::networkProcessHasEntitlementForTesting): (WebKit::WebsiteDataStore::renameOriginInWebsiteData): (WebKit::WebsiteDataStore::hasAppBoundSession const): (WebKit::WebsiteDataStore::clearAppBoundSession): (WebKit::WebsiteDataStore::forwardAppBoundDomainsToITPIfInitialized): (WebKit::WebsiteDataStore::setAppBoundDomainsForITP): (WebKit::WebsiteDataStore::updateBundleIdentifierInNetworkProcess): (WebKit::WebsiteDataStore::clearBundleIdentifierInNetworkProcess): (WebKit::WebsiteDataStore::makeNextNetworkProcessLaunchFailForTesting): (WebKit::WebsiteDataStore::shouldMakeNextNetworkProcessLaunchFailForTesting): (WebKit::WebsiteDataStore::maybeRegisterWithSessionIDMap): Deleted. (WebKit::WebsiteDataStore::existingNonDefaultDataStoreForSessionID): Deleted. (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations): Deleted. (WebKit::WebsiteDataStore::isAssociatedProcessPool const): Deleted. (WebKit::WebsiteDataStore::pendingCookies const): Deleted. (WebKit::WebsiteDataStore::addPendingCookie): Deleted. (WebKit::WebsiteDataStore::removePendingCookie): Deleted. (WebKit::WebsiteDataStore::clearPendingCookies): Deleted. (WebKit::WebsiteDataStore::didCreateNetworkProcess): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/WebsiteData/curl/WebsiteDataStoreCurl.cpp: (WebKit::WebsiteDataStore::setNetworkProxySettings): * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: (WebKit::WebsiteDataStore::platformSetNetworkParameters): (WebKit::WebsiteDataStore::setPersistentCredentialStorageEnabled): * UIProcess/glib/WebProcessProxyGLib.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): * UIProcess/soup/WebCookieManagerProxySoup.cpp: (WebKit::WebCookieManagerProxy::setCookiePersistentStorage): * UIProcess/soup/WebProcessPoolSoup.cpp: (WebKit::WebProcessPool::platformInitializeNetworkProcess): (WebKit::WebProcessPool::setIgnoreTLSErrors): (WebKit::WebProcessPool::setNetworkProxySettings): * WebProcess/Network/NetworkProcessConnectionInfo.h: 2020-09-29 Tim Horton <timothy_horton@apple.com> Enable the Web Share Level 2 feature wherever Web Share is enabled https://bugs.webkit.org/show_bug.cgi?id=217105 Reviewed by Beth Dakin. No new tests; there are already tests that enable this. * Shared/WebPreferencesExperimental.yaml: 2020-09-29 Aditya Keerthi <akeerthi@apple.com> [macCatalyst] Focus rings are not painted https://bugs.webkit.org/show_bug.cgi?id=217073 <rdar://problem/46794111> Reviewed by Darin Adler. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Ensure that a default focus ring color is specified on macCatalyst. 2020-09-29 Alex Christensen <achristensen@webkit.org> Remove plist-based ResourceLoadStatistics storage, which has been replaced by database-based storage https://bugs.webkit.org/show_bug.cgi?id=217063 Reviewed by John Wilander. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::setPersistentStorage): Deleted. (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded): Deleted. (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp: Removed. * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h: Removed. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords): (WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession): (WebKit::WebResourceLoadStatisticsStore::populateMemoryStoreFromDisk): (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setUseITPDatabase): Deleted. * NetworkProcess/NetworkProcess.h: (WebKit::NetworkProcess::isITPDatabaseEnabled const): Deleted. * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::destroyResourceLoadStatistics): (WebKit::NetworkSession::flushAndDestroyPersistentStore): Deleted. * NetworkProcess/NetworkSession.h: * Shared/WebPreferencesInternal.yaml: * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetIsITPDatabaseEnabled): Deleted. (WKPreferencesGetIsITPDatabaseEnabled): Deleted. * UIProcess/API/C/WKPreferencesRef.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsResetToConsistentState): (WKWebsiteDataStoreSetUseITPDatabase): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _isITPDatabaseEnabled]): Deleted. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _setUseITPDatabase:completionHandler:]): Deleted. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setUseITPDatabase): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setUseITPDatabase): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/ios/ResourceLoadStatisticsPersistentStorageIOS.mm: Removed. * WebKit.xcodeproj/project.pbxproj: 2020-09-29 Chris Dumez <cdumez@apple.com> Add stubs for AudioWorklet https://bugs.webkit.org/show_bug.cgi?id=217059 Reviewed by Eric Carlson. Add experimental feature flag for AudioWorklet API. * Shared/WebPreferencesExperimental.yaml: 2020-09-29 Per Arne Vollan <pvollan@apple.com> [macOS] Deny access to 'com.apple.awdd' in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=216975 Reviewed by Darin Adler. This has already been done on iOS in <https://trac.webkit.org/changeset/254376>, and should be done on macOS as well. * WebProcess/com.apple.WebProcess.sb.in: 2020-09-29 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Stop using the default website data store for the inspector https://bugs.webkit.org/show_bug.cgi?id=217034 Reviewed by Michael Catanzaro. The GTK should never use the default website data store. Use a dedicated website data store for the inspector with its own configuration to store persistent data. * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::inspectorWebsiteDataStore): (WebKit::WebInspectorProxy::platformCreateFrontendPage): 2020-09-28 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Use VideoLayerManager to manage layers of MediaPlayerPrivateRemote https://bugs.webkit.org/show_bug.cgi?id=216995 Reviewed by Eric Carlson. This patch removes the remote hosting layer in the GPU process for video fullscreen and picture-in-picture. We don't need to keep a layer in the GPU process for video fullscreen and picture-in-picture because no rendering will be done for that layer. We don't need EnterFullscreen, ExitFullscreen and SetVideoFullscreenFrameFenced IPC messages after removing the layer because the RemoteMediaPlayerPrivateRemote in the web process can deal with the video presentation mode change. * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): (WebKit::RemoteMediaPlayerProxy::enterFullscreen): Deleted. (WebKit::RemoteMediaPlayerProxy::exitFullscreen): Deleted. (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenFrameFenced): Deleted. Remove unused IPC messages after removing the remote hosting layer for video fullscreen and picture-in-picture. * GPUProcess/media/gstreamer/RemoteMediaPlayerProxyGStreamer.cpp: (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): (WebKit::RemoteMediaPlayerProxy::enterFullscreen): Deleted. (WebKit::RemoteMediaPlayerProxy::exitFullscreen): Deleted. Ditto. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::~MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::prepareForPlayback): Remove the code related to the remote hosting layer for video fullscreen and picture-in-picture. (WebKit::MediaPlayerPrivateRemote::platformLayer const): (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenLayer): Use VideoLayerManager to manage the layer. (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame): Ditto. (WebKit::MediaPlayerPrivateRemote::requiresTextTrackRepresentation const): Ditto. (WebKit::MediaPlayerPrivateRemote::setTextTrackRepresentation): Ditto. (WebKit::MediaPlayerPrivateRemote::syncTextTrackBounds): Ditto. (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrameFenced): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: Need to move the Logger up in the data members so that other members can use it in the constructor, e.g., VideoLayerManager. * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::createVideoFullscreenLayer): (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame): Deleted. (WebKit::MediaPlayerPrivateRemote::setTextTrackRepresentation): Deleted. (WebKit::MediaPlayerPrivateRemote::syncTextTrackBounds): Deleted. Simplify the implementation by managing layers with VideoLayerManager. 2020-09-28 Eric Carlson <eric.carlson@apple.com> [GPUP] Out-of-band TextTracks https://bugs.webkit.org/show_bug.cgi?id=217062 <rdar://problem/68739969> Reviewed by Jer Noble. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::outOfBandTrackSources): * GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h: (WebKit::RemoteMediaPlayerProxyConfiguration::encode const): (WebKit::RemoteMediaPlayerProxyConfiguration::decode): * Scripts/webkit/messages.py: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer): * WebProcess/GPU/media/RemoteMediaPlayerManager.h: 2020-09-28 Devin Rousso <drousso@apple.com> [iOS] unable to airplay directly loaded fullscreen video https://bugs.webkit.org/show_bug.cgi?id=216858 <rdar://problem/68746321> Reviewed by Eric Carlson. It's possible that `MediaPlayerPrivate::wirelessVideoPlaybackDisabled` is queried before a "real" `MediaPlayerPrivate` (i.e. not `NullMediaPlayerPrivate`) is initialized through one of the registered `MediaPlayerFactory` "engine"s. It's further possible that the value returned by `MediaPlayerPrivate::wirelessVideoPlaybackDisabled` will change as the new "real" `MediaPlayerPrivate` may have different logic. In this case, the `MediaPlayer` doesn't update its client (and therefore nothing "up" the tree, including the client's clients) with the new `MediaPlayerPrivate::wirelessVideoPlaybackDisabled` value, meaning that the old value will still be used. Add piping such that when the `MediaPlayerFactory` "engine" changes, the `MediaPlayer` notifies its client (which is further piped "up" the tree to the client's clients) which eventually causes `MediaPlayerPrivate::wirelessVideoPlaybackDisabled` to be re-evaluated. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::playbackControlsMediaEngineChanged): Added. * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionManager::mediaEngineChanged): Added. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _wirelessVideoPlaybackDisabled]): Added. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabled): Added. Create additional functions for piping data to tests. 2020-09-28 Youenn Fablet <youenn@apple.com> Make sure our calls to AVCaptureDevice requestAccessForMediaType do processing on the main thread https://bugs.webkit.org/show_bug.cgi?id=216974 Reviewed by Darin Adler. The completion handler to [AVCaptureDeviceClass requestAccessForMediaType:] may sometimes be called in a background thread on iOS. Make sure to hop to the main thread if that is the case. Also make sure to ref/weakref lambda captured variables. * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::requestAccessForMediaType): (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): 2020-09-27 Lauro Moura <lmoura@igalia.com> REGRESSION(r267688) [GTK] Many compositing timeouts https://bugs.webkit.org/show_bug.cgi?id=217044 Reviewed by Darin Adler. Especulative fix by adding missing finalize step to updateRendering (or calling isolatedUpdateRendering). Covered by existing tests. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState): Call finalizeUpdateRendering. (WebKit::DrawingAreaCoordinatedGraphics::display): Ditto. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::flushAndRenderLayers): Call isolatedUpdateRendering instead of updateRendering on the corePage(). 2020-09-25 Simon Fraser <simon.fraser@apple.com> WebKitLegacy should call Page::finalizeRenderingUpdate() https://bugs.webkit.org/show_bug.cgi?id=216958 Reviewed by Tim Horton. dynamicViewportSizeUpdate() needs to call isolatedUpdateRendering() because it isn't followed by a finalizeRenderingUpdate(). * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): 2020-09-27 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] WebSocket: cookies set in request don't appear in the inspector https://bugs.webkit.org/show_bug.cgi?id=217012 Reviewed by Michael Catanzaro. Cookies are set by libsoup and we are notifying about the handshake being sent before the cookie header is added to the request. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::WebSocketTask): Connect to SoupMessage::starting to notify the web process the handshake request has been sent. 2020-09-26 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Do not set site for cookies twice in case of redirection https://bugs.webkit.org/show_bug.cgi?id=217010 Reviewed by Michael Catanzaro. ResourceRequest::updateSoupMessage() already fills the same site information, but we are duplicating the code in NetworkDataTaskSoup::continueHTTPRedirection(). * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Do not set same site information here, it will be done again in NetworkDataTaskSoup::createRequest(). 2020-09-25 Hoa Dinh <dvh@apple.com> Add -[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:] to provide a way to allow app link https://bugs.webkit.org/show_bug.cgi?id=216977 Reviewed by Alex Christensen. The method -[WKWebView _loadRequest:shouldOpenExternalURLs:] would only allow opening external or not. It wasn't providing the ability to allow external URL but not app links. This patch adds -[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:]. The parameters value for shouldOpenExternalURLsPolicy has the same meaning than WebCore::ShouldOpenExternalURLsPolicy. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _loadRequest:shouldOpenExternalURLsPolicy:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added enum _WKShouldOpenExternalURLsPolicy, 2020-09-25 Alex Christensen <achristensen@webkit.org> Unreviewed, reverting r267608. Caused API test failures Reverted changeset: "Move NetworkProcessProxy ownership from WebProcessPool to WebsiteDataStore" https://bugs.webkit.org/show_bug.cgi?id=216041 https://trac.webkit.org/changeset/267608 2020-09-25 Tim Horton <timothy_horton@apple.com> Crunchyroll playback controls do not work on iPad with trackpad https://bugs.webkit.org/show_bug.cgi?id=217000 <rdar://problem/66362029> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (applicationIsKnownToIgnoreMouseEvents): Add it to the list. 2020-09-25 Alex Christensen <achristensen@webkit.org> Move NetworkProcessProxy ownership from WebProcessPool to WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=216041 Reviewed by Brady Eidson. This patch moves the things on WebProcessPool associated with NetworkProcessProxy ownership and moves them to WebsiteDataStore. It's pretty mechanical, but it reaches its fingers into a lot of things. Some comments on interesting parts are below. Why am I doing this? I'm glad you asked. WKWebView had a fundamental cookie problem before this change. It had a WKWebsiteDataStore that could point to a cookie store on disk that could be used in multiple network processes at the same time. This led to problems with cookies being received over the network in those different processes being unable to be shared until they were written to disk, something that does not happen immediately, especially on iOS. This problem is even worse with session cookies, which should be kept in memory and never be written to disk. Those processes did not use shared memory to share the cookies. They just didn't share them, which led to cookie incorrectness. This was unfortunately the default configuration if you call [[WKWebView alloc] init] more than once, which many developers do. There was also occasional cookie corruption and loss from multiple processes writing cookies to the same file. All these problems can be worked around by doing what Safari does: manually setting the WKProcessPool of all WKWebViewConfigurations to the same process pool to only use one network process. This is not intuitive or well documented, and even though I have spent the majority of WWDC labs for the last 3 years telling developers to do it, most developers do not. The default behavior should not lead to cookie incorrectness, corruption, or loss. This accomplishes that. A bigger problem that can't really be worked around well is what we were doing in our WKHTTPCookieStore API. Many developers call setCookie:completionHandler: to "log in" the user by setting a cookie, then in the completion handler, they open a WKWebView to their page and expect the cookie to be sent. Before this change, we would not know which process pool to set the cookie in so we would guess. If there were no process pools, we would start writing to disk and hope it writes fast enough. We can't wait for it to complete because it causes hangs like rdar://problem/66961066. This solution allows to start the network process of that WebsiteDataStore and set the cookie in that process. We now know that is the only process this WebsiteDataStore will ever use. Now, users will be able to actually be logged in all the time in such apps. * NetworkProcess/Cookies/WebCookieManager.cpp: (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy): (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy): * NetworkProcess/Cookies/WebCookieManager.h: * NetworkProcess/Cookies/WebCookieManager.messages.in: * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp: (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm: (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp: (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::ensureSession): (WebKit::NetworkProcess::storageSession const): (WebKit::NetworkProcess::forEachNetworkStorageSession): (WebKit::NetworkProcess::defaultStorageSession const): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::close): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): (WebKit::saveCookies): (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Deleted. * NetworkProcess/curl/NetworkProcessCurl.cpp: (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Deleted. * NetworkProcess/mac/RemoteNetworkingContext.mm: (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Deleted. * Platform/IPC/Attachment.h: * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::encode const): (WebKit::WebsiteDataStoreParameters::decode): * Shared/WebsiteDataStoreParameters.h: * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::HTTPCookieStore): (API::HTTPCookieStore::~HTTPCookieStore): (API::HTTPCookieStore::cookies): (API::HTTPCookieStore::cookiesForURL): (API::HTTPCookieStore::setCookies): (API::HTTPCookieStore::deleteCookie): (API::HTTPCookieStore::deleteAllCookies): (API::HTTPCookieStore::setHTTPCookieAcceptPolicy): (API::HTTPCookieStore::registerObserver): (API::HTTPCookieStore::cookieManagerDestroyed): (API::HTTPCookieStore::registerForNewProcessPoolNotifications): Deleted. (API::HTTPCookieStore::unregisterForNewProcessPoolNotifications): Deleted. * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/C/WKContext.cpp: (WKContextSetUseSeparateServiceWorkerProcess): (WKContextSetPrimaryWebsiteDataStore): (WKContextGetCookieManager): Deleted. (WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting): Deleted. (WKContextTerminateNetworkProcess): Deleted. (WKContextGetNetworkProcessIdentifier): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/C/WKPage.cpp: (WKPageGetWebsiteDataStore): * UIProcess/API/C/WKPage.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreTerminateNetworkProcess): (WKWebsiteDataStoreGetNetworkProcessIdentifier): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setUseSeparateServiceWorkerProcess:]): (-[WKProcessPool _terminateNetworkProcess]): Deleted. (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]): Deleted. (-[WKProcessPool _sendNetworkProcessPrepareToSuspend:]): Deleted. (-[WKProcessPool _sendNetworkProcessDidResume]): Deleted. (-[WKProcessPool _networkProcessIdentifier]): Deleted. (-[WKProcessPool _makeNextNetworkProcessLaunchFailForTesting]): Deleted. (-[WKProcessPool _synthesizeAppIsBackground:]): Deleted. (-[WKProcessPool _setAllowsAnySSLCertificateForServiceWorker:]): Deleted. (-[WKProcessPool _networkProcessHasEntitlementForTesting:]): Deleted. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _networkProcessHasEntitlementForTesting:]): (-[WKWebsiteDataStore _terminateNetworkProcess]): (-[WKWebsiteDataStore _sendNetworkProcessPrepareToSuspend:]): (-[WKWebsiteDataStore _sendNetworkProcessWillSuspendImminently]): (-[WKWebsiteDataStore _sendNetworkProcessDidResume]): (-[WKWebsiteDataStore _synthesizeAppIsBackground:]): (-[WKWebsiteDataStore _networkProcessIdentifier]): (+[WKWebsiteDataStore _makeNextNetworkProcessLaunchFailForTesting]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/glib/WebKitCookieManager.cpp: (_WebKitCookieManagerPrivate::cookieManager const): (_WebKitCookieManagerPrivate::~_WebKitCookieManagerPrivate): (webkitCookieManagerCreate): (webkit_cookie_manager_set_persistent_storage): (webkit_cookie_manager_set_accept_policy): (webkit_cookie_manager_get_accept_policy): (webkit_cookie_manager_add_cookie): (webkit_cookie_manager_get_cookies): (webkit_cookie_manager_delete_cookie): * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextConstructed): (webkit_web_context_prefetch_dns): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::deleteAllCookies): * UIProcess/AuxiliaryProcessProxy.h: * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::updateProcessSuppressionState): (WebKit::WebProcessPool::platformInitialize): (WebKit::WebProcessPool::platformInitializeNetworkProcess): (WebKit::WebProcessPool::networkProcessHasEntitlementForTesting): Deleted. (WebKit::WebProcessPool::xpcEndpointMessage const): Deleted. (WebKit::WebProcessPool::sendNetworkProcessXPCEndpointToWebProcess): Deleted. * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::cancel): (WebKit::DownloadProxy::publishProgress): (WebKit::DownloadProxy::didReceiveAuthenticationChallenge): (WebKit::DownloadProxy::willSendRequest): (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync): * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::DownloadProxyMap): (WebKit::DownloadProxyMap::applicationDidEnterBackground): (WebKit::DownloadProxyMap::applicationWillEnterForeground): (WebKit::DownloadProxyMap::createDownloadProxy): (WebKit::DownloadProxyMap::downloadFinished): (WebKit::DownloadProxyMap::invalidate): * UIProcess/Downloads/DownloadProxyMap.h: * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp: (WebKit::LegacyCustomProtocolManagerProxy::startLoading): (WebKit::LegacyCustomProtocolManagerProxy::stopLoading): (WebKit::LegacyCustomProtocolManagerProxy::invalidate): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::allNetworkProcesses): (WebKit::defaultProcess): (WebKit::NetworkProcessProxy::defaultNetworkProcess): (WebKit::NetworkProcessProxy::terminate): (WebKit::NetworkProcessProxy::didTerminate): (WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess): (WebKit::anyProcessPoolAlwaysRunsAtBackgroundPriority): (WebKit::anyProcessPoolShouldTakeUIBackgroundAssertion): (WebKit::NetworkProcessProxy::NetworkProcessProxy): (WebKit::NetworkProcessProxy::~NetworkProcessProxy): (WebKit::NetworkProcessProxy::getLaunchOptions): (WebKit::NetworkProcessProxy::createDownloadProxy): (WebKit::NetworkProcessProxy::networkProcessCrashed): (WebKit::NetworkProcessProxy::didReceiveMessage): (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): (WebKit::NetworkProcessProxy::didFinishLaunching): (WebKit::NetworkProcessProxy::setDomainsWithUserInteraction): (WebKit::NetworkProcessProxy::addSession): (WebKit::NetworkProcessProxy::removeSession): (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID): (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess): (WebKit::anyProcessPoolHasForegroundWebProcesses): (WebKit::anyProcessPoolHasBackgroundWebProcesses): (WebKit::NetworkProcessProxy::updateProcessAssertion): (WebKit::NetworkProcessProxy::hasSession const): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxyCocoa.mm: (WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const): * UIProcess/WebCookieManagerProxy.cpp: (WebKit::WebCookieManagerProxy::WebCookieManagerProxy): (WebKit::WebCookieManagerProxy::~WebCookieManagerProxy): (WebKit::WebCookieManagerProxy::getHostnamesWithCookies): (WebKit::WebCookieManagerProxy::deleteCookiesForHostnames): (WebKit::WebCookieManagerProxy::deleteAllCookies): (WebKit::WebCookieManagerProxy::deleteCookie): (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince): (WebKit::WebCookieManagerProxy::setCookies): (WebKit::WebCookieManagerProxy::getAllCookies): (WebKit::WebCookieManagerProxy::getCookies): (WebKit::WebCookieManagerProxy::startObservingCookieChanges): (WebKit::WebCookieManagerProxy::stopObservingCookieChanges): (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy): (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy): (WebKit::WebCookieManagerProxy::supplementName): Deleted. (WebKit::WebCookieManagerProxy::create): Deleted. (WebKit::WebCookieManagerProxy::processPoolDestroyed): Deleted. (WebKit::WebCookieManagerProxy::processDidClose): Deleted. (WebKit::WebCookieManagerProxy::refWebContextSupplement): Deleted. (WebKit::WebCookieManagerProxy::derefWebContextSupplement): Deleted. * UIProcess/WebCookieManagerProxy.h: (WebKit::WebCookieManagerProxy::create): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setControlledByAutomation): (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess): (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride): (WebKit::WebPageProxy::preconnectTo): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::logFrameNavigation): (WebKit::WebPageProxy::dumpAdClickAttribution): (WebKit::WebPageProxy::clearAdClickAttribution): (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting): (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting): (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::urlSchemesWithCustomProtocolHandlers): (WebKit::WebProcessPool::WebProcessPool): (WebKit::WebProcessPool::~WebProcessPool): (WebKit::WebProcessPool::languageChanged): (WebKit::WebProcessPool::sendMemoryPressureEvent): (WebKit::WebProcessPool::networkProcessCrashed): (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): (WebKit::WebProcessPool::removeFromServiceWorkerProcesses): (WebKit::WebProcessPool::tryTakePrewarmedProcess): (WebKit::WebProcessPool::initializeNewWebProcess): (WebKit::WebProcessPool::processDidFinishLaunching): (WebKit::WebProcessPool::createWebPage): (WebKit::WebProcessPool::updateServiceWorkerUserAgent): (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): (WebKit::WebProcessPool::download): (WebKit::WebProcessPool::resumeDownload): (WebKit::WebProcessPool::registerURLSchemeAsSecure): (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy): (WebKit::WebProcessPool::registerURLSchemeAsLocal): (WebKit::WebProcessPool::registerURLSchemeAsNoAccess): (WebKit::WebProcessPool::registerGlobalURLSchemeAsHavingCustomProtocolHandlers): (WebKit::WebProcessPool::unregisterGlobalURLSchemeAsHavingCustomProtocolHandlers): (WebKit::WebProcessPool::setCacheModel): (WebKit::WebProcessPool::setCacheModelSynchronouslyForTesting): (WebKit::WebProcessPool::createDownloadProxy): (WebKit::WebProcessPool::terminateServiceWorkers): (WebKit::WebProcessPool::serviceWorkerProcesses): (WebKit::WebProcessPool::updateProcessAssertions): (WebKit::WebProcessPool::isServiceWorkerPageID const): (WebKit::WebProcessPool::setUseSeparateServiceWorkerProcess): (WebKit::WebProcessPool::hasServiceWorkerForegroundActivityForTesting const): (WebKit::WebProcessPool::hasServiceWorkerBackgroundActivityForTesting const): (WebKit::WebProcessPool::setLegacyCustomProtocolManagerClient): Deleted. (WebKit::WebProcessPool::networkingProcessConnection): Deleted. (WebKit::WebProcessPool::ensureNetworkProcess): Deleted. There seems to be a lot of code removal here, but most of it was duplicate code with WebsiteDataStore::parameters which is used instead. That which was not duplicate was moved to NetworkProcessProxy::sendCreationParametersToNewProcess. This was the hardest part of this patch. (WebKit::WebProcessPool::getNetworkProcessConnection): Deleted. (WebKit::WebProcessPool::networkProcessIdentifier): Deleted. (WebKit::WebProcessPool::synthesizeAppIsBackground): Deleted. (WebKit::WebProcessPool::sendSyncToNetworkingProcess): Deleted. (WebKit::WebProcessPool::clearCachedCredentials): Deleted. (WebKit::WebProcessPool::terminateNetworkProcess): Deleted. (WebKit::WebProcessPool::sendNetworkProcessPrepareToSuspendForTesting): Deleted. (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting): Deleted. (WebKit::WebProcessPool::sendNetworkProcessDidResume): Deleted. (WebKit::WebProcessPool::flushCookies): Deleted. (WebKit::WebProcessPool::didCommitCrossSiteLoadWithDataTransfer): Deleted. * UIProcess/WebProcessPool.h: (WebKit::WebProcessPool::sendToNetworkingProcess): Deleted. (WebKit::WebProcessPool::sendToNetworkingProcessRelaunchingIfNecessary): Deleted. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setWebsiteDataStore): (WebKit::WebProcessProxy::getNetworkProcessConnection): (WebKit::WebProcessProxy::didFinishLaunching): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::networkProcessHasEntitlementForTesting): (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToWebProcess): (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToAllWebProcesses): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::forEachWebsiteDataStore): (WebKit::WebsiteDataStore::WebsiteDataStore): (WebKit::WebsiteDataStore::~WebsiteDataStore): (WebKit::WebsiteDataStore::registerWithSessionIDMap): (WebKit::WebsiteDataStore::existingDataStoreForSessionID): (WebKit::WebsiteDataStore::networkProcess): (WebKit::WebsiteDataStore::networkProcess const): (WebKit::WebsiteDataStore::fetchDataAndApply): (WebKit::WebsiteDataStore::removeData): (WebKit::WebsiteDataStore::setServiceWorkerTimeoutForTesting): (WebKit::WebsiteDataStore::resetServiceWorkerTimeoutForTesting): (WebKit::WebsiteDataStore::setMaxStatisticsEntries): (WebKit::WebsiteDataStore::setPruneEntriesDownTo): (WebKit::WebsiteDataStore::setGrandfatheringTime): (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval): (WebKit::WebsiteDataStore::dumpResourceLoadStatistics): (WebKit::WebsiteDataStore::isPrevalentResource): (WebKit::WebsiteDataStore::isGrandfathered): (WebKit::WebsiteDataStore::setPrevalentResource): (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode): (WebKit::WebsiteDataStore::isVeryPrevalentResource): (WebKit::WebsiteDataStore::setVeryPrevalentResource): (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): (WebKit::WebsiteDataStore::setSubframeUnderTopFrameDomain): (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder): (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameDomain): (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder): (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo): (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom): (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo): (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom): (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo): (WebKit::WebsiteDataStore::clearPrevalentResource): (WebKit::WebsiteDataStore::resetParametersToDefaultValues): (WebKit::WebsiteDataStore::submitTelemetry): (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent): (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary): (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate): (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing): (WebKit::WebsiteDataStore::statisticsDatabaseHasAllTables): (WebKit::WebsiteDataStore::setLastSeen): (WebKit::WebsiteDataStore::domainIDExistsInDatabase): (WebKit::WebsiteDataStore::mergeStatisticForTesting): (WebKit::WebsiteDataStore::insertExpiredStatisticForTesting): (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned): (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest): (WebKit::WebsiteDataStore::getAllStorageAccessEntries): (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction): (WebKit::WebsiteDataStore::logUserInteraction): (WebKit::WebsiteDataStore::hasHadUserInteraction): (WebKit::WebsiteDataStore::isRelationshipOnlyInDatabaseOnce): (WebKit::WebsiteDataStore::clearUserInteraction): (WebKit::WebsiteDataStore::setGrandfathered): (WebKit::WebsiteDataStore::setUseITPDatabase): (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting): (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting): (WebKit::WebsiteDataStore::deleteCookiesForTesting): (WebKit::WebsiteDataStore::hasLocalStorageForTesting const): (WebKit::WebsiteDataStore::hasIsolatedSessionForTesting const): (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting): (WebKit::WebsiteDataStore::setThirdPartyCookieBlockingMode): (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldEnbleSameSiteStrictEnforcementForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsToSameSiteStrictCookiesForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyHostCNAMEDomainForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsThirdPartyCNAMEDomainForTesting): (WebKit::WebsiteDataStore::syncLocalStorage): (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::processPools const): (WebKit::WebsiteDataStore::allowSpecificHTTPSCertificateForHost): (WebKit::WebsiteDataStore::getNetworkProcessConnection): (WebKit::WebsiteDataStore::networkProcessCrashed): (WebKit::WebsiteDataStore::terminateNetworkProcess): (WebKit::WebsiteDataStore::sendNetworkProcessPrepareToSuspendForTesting): (WebKit::WebsiteDataStore::sendNetworkProcessWillSuspendImminentlyForTesting): (WebKit::WebsiteDataStore::sendNetworkProcessDidResume): (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): (WebKit::WebsiteDataStore::setStatisticsTestingCallback): (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode): (WebKit::WebsiteDataStore::isResourceLoadStatisticsEphemeral const): (WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): (WebKit::WebsiteDataStore::flushCookies): (WebKit::WebsiteDataStore::setAllowsAnySSLCertificateForWebSocket): (WebKit::WebsiteDataStore::clearCachedCredentials): (WebKit::WebsiteDataStore::parameters): (WebKit::WebsiteDataStore::getLocalStorageDetails): (WebKit::WebsiteDataStore::resetQuota): (WebKit::WebsiteDataStore::networkProcessHasEntitlementForTesting): (WebKit::WebsiteDataStore::renameOriginInWebsiteData): (WebKit::WebsiteDataStore::hasAppBoundSession const): (WebKit::WebsiteDataStore::clearAppBoundSession): (WebKit::WebsiteDataStore::forwardAppBoundDomainsToITPIfInitialized): (WebKit::WebsiteDataStore::setAppBoundDomainsForITP): (WebKit::WebsiteDataStore::updateBundleIdentifierInNetworkProcess): (WebKit::WebsiteDataStore::clearBundleIdentifierInNetworkProcess): (WebKit::WebsiteDataStore::makeNextNetworkProcessLaunchFailForTesting): (WebKit::WebsiteDataStore::shouldMakeNextNetworkProcessLaunchFailForTesting): (WebKit::WebsiteDataStore::maybeRegisterWithSessionIDMap): Deleted. (WebKit::WebsiteDataStore::existingNonDefaultDataStoreForSessionID): Deleted. (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations): Deleted. (WebKit::WebsiteDataStore::isAssociatedProcessPool const): Deleted. (WebKit::WebsiteDataStore::pendingCookies const): Deleted. (WebKit::WebsiteDataStore::addPendingCookie): Deleted. (WebKit::WebsiteDataStore::removePendingCookie): Deleted. (WebKit::WebsiteDataStore::clearPendingCookies): Deleted. (WebKit::WebsiteDataStore::didCreateNetworkProcess): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/WebsiteData/curl/WebsiteDataStoreCurl.cpp: (WebKit::WebsiteDataStore::setNetworkProxySettings): * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: (WebKit::WebsiteDataStore::platformSetNetworkParameters): (WebKit::WebsiteDataStore::setPersistentCredentialStorageEnabled): * UIProcess/glib/WebProcessProxyGLib.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): * UIProcess/soup/WebCookieManagerProxySoup.cpp: (WebKit::WebCookieManagerProxy::setCookiePersistentStorage): * UIProcess/soup/WebProcessPoolSoup.cpp: (WebKit::WebProcessPool::platformInitializeNetworkProcess): (WebKit::WebProcessPool::setIgnoreTLSErrors): (WebKit::WebProcessPool::setNetworkProxySettings): * WebProcess/Network/NetworkProcessConnectionInfo.h: 2020-09-24 Dean Jackson <dino@apple.com> WebGL should use GLES in iOS apps running on Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=216722 <rdar://problem/68976337> Reviewed by Tim Horton. * Configurations/WebKit.xcconfig: Remove OpenGL linking. * UIProcess/mac/HighPerformanceGPUManager.mm: Renamed to .mm. Use the PAL soft-linked OpenGL API. 2020-09-25 Peng Liu <peng.liu6@apple.com> Replace the usages of (IPC::Attachment fencePort) with IPC::MachPort https://bugs.webkit.org/show_bug.cgi?id=207683 Reviewed by Daniel Bates. No new tests, no functional change. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setVideoLayerFrame): Replace the IPC::Attachment argument with a MachSendRight. * WebProcess/cocoa/VideoFullscreenManager.h: * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced): r232451 adds a check for mach port disposition, which is not necessary now. Because ArgumentCoder<MachSendRight>::decode() provides the check. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setTopContentInset): Replace the IPC::Attachment argument with a MachSendRight. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setTopContentInsetFenced): Ditto. r232451 adds a check for mach port disposition, which is not necessary now. Because ArgumentCoder<MachSendRight>::decode() provides the check. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-09-25 Wenson Hsieh <wenson_hsieh@apple.com> Tweak the names of the GPU process audio/video capture internal feature flags https://bugs.webkit.org/show_bug.cgi?id=216992 Reviewed by Tim Horton. Keep all 6 of the GPU process feature flags together by adjusting the human readable names of `CaptureAudioInGPUProcessEnabled` and `CaptureVideoInGPUProcessEnabled` to start with "GPU Process:", after <https://trac.webkit.org/r267516>. * Shared/WebPreferencesInternal.yaml: 2020-09-25 Yusuke Suzuki <ysuzuki@apple.com> [JSC] Introduce JSC_DECLARE_HOST_FUNCTION / JSC_DEFINE_HOST_FUNCTION to make host function definition easy-to-scanned for JIT-caging https://bugs.webkit.org/show_bug.cgi?id=216966 Reviewed by Saam Barati. * WebProcess/Plugins/Netscape/JSNPMethod.cpp: (WebKit::JSC_DEFINE_HOST_FUNCTION): (WebKit::callMethod): Deleted. * WebProcess/Plugins/Netscape/JSNPObject.cpp: (WebKit::JSC_DEFINE_HOST_FUNCTION): (WebKit::callNPJSObject): Deleted. (WebKit::constructWithConstructor): Deleted. 2020-09-25 Antoine Quint <graouts@webkit.org> Add an experimental feature flag for CSS individual transform properties https://bugs.webkit.org/show_bug.cgi?id=216271 <rdar://problem/68914539> Reviewed by Dean Jackson. * Shared/WebPreferencesExperimental.yaml: 2020-09-25 Per Arne Vollan <pvollan@apple.com> [macOS] Deny access to diagnosticd in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=216929 <rdar://problem/58496834> Reviewed by Darin Adler. After the change-set <https://trac.webkit.org/changeset/267498> landed, an extension to diagnostics is issued when required, so the unconditional rule can be removed from the WebContent sandbox. * WebProcess/com.apple.WebProcess.sb.in: 2020-09-25 Youenn Fablet <youenn@apple.com> Implement default behavior for getUserMedia requests in case where there is no delegate set https://bugs.webkit.org/show_bug.cgi?id=216968 Reviewed by Eric Carlson. In case page UIDelegate is not set, make the getUserMedia request do its default action. In case there is a UIDelegate but no getUserMedia specific delegates, make the getUserMedia request do its default action. Default action is deny for getDisplayMedia and for non cocoa ports. For cocoa ports, a prompt is shown. Manually tested with MiniBrowser and MobileMiniBrowser. * SourcesCocoa.txt: * UIProcess/API/APIUIClient.h: (API::UIClient::decidePolicyForUserMediaPermissionRequest): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::requestUserMediaAuthorizationForFrame): * UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm: Renamed from Source/WebKit/UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.mm. (WebKit::alertMessageText): (WebKit::UserMediaPermissionRequestProxy::doDefaultAction): * UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.h: Removed. * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::doDefaultAction): * UIProcess/UserMediaPermissionRequestProxy.h: * WebKit.xcodeproj/project.pbxproj: 2020-09-25 Youenn Fablet <youenn@apple.com> Introduce WKWebViewConfiguration mediaCaptureEnabled https://bugs.webkit.org/show_bug.cgi?id=216872 Reviewed by Alex Christensen. Add a new boolean configuration to enable/disable mediaDevices exposure. Value is off by default. A future patch will remove the mediaDevices WebPreferences based API, given there is no need to enable/disable mediaDevices during the lifetime of a page. Covered by existing tests. * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::setMediaDevicesEnabled): (API::PageConfiguration::mediaDevicesEnabled const): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setupPageConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _mediaDevicesEnabled]): (-[WKWebViewConfiguration _setMediaDevicesEnabled:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: 2020-09-25 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, late September 2020 edition https://bugs.webkit.org/show_bug.cgi?id=216950 Unreviewed build fix. * NetworkProcess/NetworkSessionCreationParameters.cpp: Arrange guards to include WebCoreArgumentCoders.h with USE(SOUP). * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: Add missing WebCoreArgumentCoders.h include. 2020-09-24 Brian Burg <bburg@apple.com> REGRESSION(iOS WebDriver): action chains with 'Touch' pointerType don't work on Mac https://bugs.webkit.org/show_bug.cgi?id=216937 <rdar://problem/69149171> Reviewed by Darin Adler. Before iOS WebDriver shipped, 'Touch' was unconditionally aliased to 'Mouse.' Make sure the aliasing happens for macOS so the command doesn't fail frivolously. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::performInteractionSequence): Alias 'Touch' to 'Mouse' when touch is not available and mouse is. This is the case for macOS. 2020-09-24 Kate Cheney <katherine_cheney@apple.com> CrashTracer: com.apple.WebKit.Networking in NetworkSession::firstPartyHostCNAMEDomain() code https://bugs.webkit.org/show_bug.cgi?id=216934 <rdar://problem/69216768> Reviewed by Alex Christensen. Add a check for a valid key. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::firstPartyHostCNAMEDomain): 2020-09-24 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, fix the build for recent SDKs. rdar://69394018 * Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): 2020-09-24 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Move proxy settings from WebKitContext to WebKitWebsiteDataManager https://bugs.webkit.org/show_bug.cgi?id=216927 Reviewed by Alex Christensen. Make proxy settings per session instead of global to the network process. The web context API now simply forwards the request to the website data manager. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::platformInitializeNetworkProcess): (WebKit::NetworkProcess::setNetworkProxySettings): * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::NetworkSessionSoup): (WebKit::NetworkSessionSoup::setProxySettings): * NetworkProcess/soup/NetworkSessionSoup.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_set_network_proxy_settings): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewConstructed): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkit_website_data_manager_set_network_proxy_settings): * UIProcess/API/gtk/WebKitNetworkProxySettings.h: * UIProcess/API/gtk/WebKitWebContext.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitNetworkProxySettings.h: * UIProcess/API/wpe/WebKitWebContext.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::networkProxySettings const): * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: (WebKit::WebsiteDataStore::platformSetNetworkParameters): (WebKit::WebsiteDataStore::setNetworkProxySettings): * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/soup/WebProcessPoolSoup.cpp: (WebKit::WebProcessPool::platformInitializeNetworkProcess): (WebKit::WebProcessPool::setNetworkProxySettings): Deleted. 2020-09-24 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r267502): [GTK][WPE] ephemeral WebKitWebsiteDataManager ignores TLS errors by default https://bugs.webkit.org/show_bug.cgi?id=216919 Reviewed by Adrian Perez de Castro. Initialize ignoreTLSErrors on website data store for ephemeral sessions. * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerConstructed): 2020-09-24 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r267502) [GLIB] Make WTR ignoreTLSErrors https://bugs.webkit.org/show_bug.cgi?id=216911 Reviewed by Adrian Perez de Castro. I forgot to initialize ignoreTLSErrors in network session parameters. * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: (WebKit::WebsiteDataStore::platformSetNetworkParameters): 2020-09-23 Peng Liu <peng.liu6@apple.com> Add feature flags for GPU Process features https://bugs.webkit.org/show_bug.cgi?id=216901 Reviewed by Tim Horton. Add feature flags for the following GPU Process features: - 2D canvas in GPU process - WebGL in GPU process - DOM rendering in GPU Process Also, clean up some related feature/function names. * FeatureFlags/WebKit.plist: Add keys for the GPU process features and sort all keys. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultUseGPUProcessForCanvasRenderingEnabled): (WebKit::defaultUseGPUProcessForDOMRenderingEnabled): (WebKit::defaultUseGPUProcessForMediaEnabled): (WebKit::defaultUseGPUProcessForWebGLEnabled): (WebKit::defaultCaptureAudioInGPUProcessEnabled): (WebKit::defaultCaptureVideoInGPUProcessEnabled): (WebKit::defaultWebRTCCodecsInGPUProcess): (WebKit::defaultUseGPUProcessForMedia): Deleted. (WebKit::defaultRenderCanvasInGPUProcessEnabled): Deleted. * Shared/WebPreferencesDefaultValues.h: * Shared/WebPreferencesInternal.yaml: Add preferences and corresponding default values. * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Rename useGPUProcessForMedia to useGPUProcessForMediaEnabled. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): Use useGPUProcessForCanvasRenderingEnabled instead of renderCanvasInGPUProcessEnabled. * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::updatePreferences): Use useGPUProcessForMediaEnabled instead of useGPUProcessForMedia. * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Ditto. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): Ditto. (WebKit::WebPage::updatePreferences): Ditto. 2020-09-23 Chris Dumez <cdumez@apple.com> Turn off the legacy prefixed WebAudio API https://bugs.webkit.org/show_bug.cgi?id=216886 Reviewed by Sam Weinig. Turn off the legacy prefixed WebAudio API, now that the modern unprefixed API has been enabled in r267488. * Shared/WebPreferencesInternal.yaml: 2020-09-23 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Move TLS errors API from WebKitContext to WebKitWebsiteDataManager https://bugs.webkit.org/show_bug.cgi?id=216822 Reviewed by Alex Christensen. Make TLS errors policy per session instead of global to the network process. The web context API now simply forwards the request to the website data manager. The website data manager created for an ephemeral web view will inherit the network settings from the web context website data manager. This ensures backwards compatibility, but it's also convenient, since it's the desired behavior in most of the cases. Apps can still change the network settings of the web view by getting the website data manager. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::platformInitializeNetworkProcess): (WebKit::NetworkProcess::setIgnoreTLSErrors): * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::NetworkSessionSoup): (WebKit::webSocketAcceptCertificateCallback): (WebKit::webSocketMessageNetworkEventCallback): (WebKit::NetworkSessionSoup::createWebSocketTask): (WebKit::NetworkSessionSoup::setIgnoreTLSErrors): * NetworkProcess/soup/NetworkSessionSoup.h: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextConstructed): (webkit_web_context_set_tls_errors_policy): (webkit_web_context_get_tls_errors_policy): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewConstructed): (webkit_web_view_class_init): (webkitWebViewLoadFailedWithTLSErrors): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerConstructed): (webkitWebsiteDataManagerGetDataStore): (webkit_website_data_manager_set_tls_errors_policy): (webkit_website_data_manager_get_tls_errors_policy): * UIProcess/API/gtk/WebKitWebContext.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebContext.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::ignoreTLSErrors const): * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: (WebKit::WebsiteDataStore::setIgnoreTLSErrors): * UIProcess/soup/WebProcessPoolSoup.cpp: (WebKit::WebProcessPool::platformInitializeNetworkProcess): (WebKit::WebProcessPool::setIgnoreTLSErrors): Deleted. 2020-09-23 Per Arne Vollan <pvollan@apple.com> [macOS] Issue sandbox extension for the diagnostic daemon https://bugs.webkit.org/show_bug.cgi?id=216834 <rdar://problem/58496834> Reviewed by Brent Fulgham. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::isInternalInstall): (WebKit::agxCompilerClasses): (WebKit::diagnosticServices): (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): * WebProcess/com.apple.WebProcess.sb.in: 2020-09-23 Fujii Hironori <Hironori.Fujii@sony.com> Remove ENABLE_SVG_FONTS macro https://bugs.webkit.org/show_bug.cgi?id=216850 Reviewed by Don Olmstead. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::maximumBufferingTime): 2020-09-23 Per Arne Vollan <pvollan@apple.com> [macOS] Change name of client decoder entitlement https://bugs.webkit.org/show_bug.cgi?id=216670 <rdar://problem/69101997> Reviewed by Darin Adler. The client decoder entitlement landed in <https://trac.webkit.org/changeset/266613/webkit> has changed name, and should be updated. * Scripts/process-entitlements.sh: 2020-09-23 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Implement caption support in video fullscreen and PiP https://bugs.webkit.org/show_bug.cgi?id=208752 Reviewed by Eric Carlson. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::syncTextTrackBounds): Deleted. * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: Remove syncTextTrackBounds() because the GPU process does not need to deal with the text track bounds. * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): Add a missing IPC message receiver. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenLayer): Set the flag m_requiresTextTrackRepresentation when changing video presentation mode. (WebKit::MediaPlayerPrivateRemote::requiresTextTrackRepresentation const): Deleted. (WebKit::MediaPlayerPrivateRemote::setTextTrackRepresentation): Deleted. (WebKit::MediaPlayerPrivateRemote::syncTextTrackBounds): Deleted. Move the implementation of those functions to MediaPlayerPrivateRemoteCocoa. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: Add the flag m_requiresTextTrackRepresentation and add a reference to the layer used to render text track (in fullscreen or picture-in-picture). * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame): (WebKit::MediaPlayerPrivateRemote::setTextTrackRepresentation): (WebKit::MediaPlayerPrivateRemote::syncTextTrackBounds): Those functions share a similar implementation as VideoLayerManagerObjC. 2020-09-23 Per Arne Vollan <pvollan@apple.com> [macOS] Start collecting telemetry from a set of XPC services <https://bugs.webkit.org/show_bug.cgi?id=216797> Reviewed by Brent Fulgham. * WebProcess/com.apple.WebProcess.sb.in: 2020-09-23 Chris Dumez <cdumez@apple.com> Turn on the modern unprefixed WebAudio API https://bugs.webkit.org/show_bug.cgi?id=216885 Reviewed by Eric Carlson. Turn on the modern unprefixed WebAudio API now that we support most of the API besides AudioWorklet and now that we have a good pass rate on WPT tests. * Shared/WebPreferencesExperimental.yaml: 2020-09-23 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r267403. Caused 50+ Crashes on iOS Debug Reverted changeset: "Move Media in GPU Process flag from internal to experimental" https://bugs.webkit.org/show_bug.cgi?id=216473 https://trac.webkit.org/changeset/267403 2020-09-23 Youenn Fablet <youenn@apple.com> Add support for HTMLMediaElement.setSinkId https://bugs.webkit.org/show_bug.cgi?id=216696 Reviewed by Eric Carlson. Add internal flag to enable/disable user gesture requirement for setting audio output device, and for per media element setting of audio output device. * Shared/WebPreferencesExperimental.yaml: * Shared/WebPreferencesInternals.yaml: 2020-09-22 Wenson Hsieh <wenson_hsieh@apple.com> [GPU Process] fast/canvas/canvas-blend-image.html and fast/canvas/canvas-blend-solid.html fail on macOS https://bugs.webkit.org/show_bug.cgi?id=216860 Reviewed by Said Abou-Hallawa. These two tests disable accelerated drawing for canvas elements; when using the GPU process, this causes us to use `ImageBufferShareableBitmapBackend` as the back-end for the image buffer backing the canvas element. On both macOS and iOS, the image buffer is backed by BGRA image data. However, we override `backendColorFormat()` and return `ColorFormat::BGRA` only for `PLATFORM(IOS_FAMILY)`, causing `putImageData` and `getImageData` to result in flipped red and blue channels on macOS, which subsequently causes these two layout tests to fail. Fix these tests by removing the `PLATFORM(IOS_FAMILY)` guard. * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: 2020-09-22 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r267421. https://bugs.webkit.org/show_bug.cgi?id=216864 Broke a test on macOS Reverted changeset: "[macOS] Start collecting telemetry from a set of XPC services" https://bugs.webkit.org/show_bug.cgi?id=216797 https://trac.webkit.org/changeset/267421 2020-09-22 Lauro Moura <lmoura@igalia.com> [GTK] REGRESSION(r267398): several hidpi tests are failing https://bugs.webkit.org/show_bug.cgi?id=216830 Reviewed by Adrian Perez de Castro. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setCustomDeviceScaleFactor): Remove check for removed define. 2020-09-22 Peng Liu <peng.liu6@apple.com> [Media in GPU Process] Add missing IPC message receivers https://bugs.webkit.org/show_bug.cgi?id=216829 Reviewed by Jer Noble. Add missing IPC message receivers and clean up some macro usages. Also remove the empty RemoteMediaPlayerManager.messages.in. No new tests, no functional change. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::dispatchMessage): (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h: (WebKit::RemoteMediaSessionHelperProxy::didReceiveMessageFromWebProcess): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in: Removed. 2020-09-22 Per Arne Vollan <pvollan@apple.com> [macOS] Start collecting telemetry from a set of XPC services <https://bugs.webkit.org/show_bug.cgi?id=216797> Reviewed by Brent Fulgham. * WebProcess/com.apple.WebProcess.sb.in: 2020-09-22 Youenn Fablet <youenn@apple.com> Implement a default prompt for getUserMedia https://bugs.webkit.org/show_bug.cgi?id=216821 Reviewed by Eric Carlson. Move preferences used by WebRTC develop menu to internals. This allows having them in MiniBrowser. Enable video capture in UIProcess by default for non Safari applications. Add support for a getUserMedia prompt, very similar to iOS current prompt. Use the prompt in case the application does not implement any of the two delegates. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultCaptureVideoInUIProcessEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/WebPreferencesExperimental.yaml: * Shared/WebPreferencesInternal.yaml: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::requestUserMediaAuthorizationForFrame): (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): * UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.h: Added. * UIProcess/Cocoa/WKUserMediaCaptureAccessAlert.mm: Added. (WebKit::visibleDomain): (WebKit::alertMessageText): (WebKit::presentUserMediaCaptureAccessAlert): * WebKit.xcodeproj/project.pbxproj: 2020-09-22 Brady Eidson <beidson@apple.com> Crashtracer inside PDFPlugin::createScrollbar. <rdar://problem/69256031> and https://bugs.webkit.org/show_bug.cgi?id=216810 Reviewed by Tim Horton. To quote Tim from r264945: No new tests; timing is such that I can't reproduce without inserting intentional delays into the main thread hops, which is further than I'm willing to go for a test. This is a speculative fix due to the aforementioned reproducibility issue. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::installPDFDocument): With all the past fixes in place, its apparent the plug-in HAS been torn down, and it's somewhat common to bypass the other "hasBeenDestroyed" checks. So put an explicit check here followed by an explicit release assert. 2020-09-22 Brian Burg <bburg@apple.com> [Cocoa] _WKInspectorDelegate should handle showing external resources https://bugs.webkit.org/show_bug.cgi?id=216334 Reviewed by Devin Rousso. WebKit clients need a way to control the loading and presentation of external resources that are linked in Web Inspector's user interface. Rename InspectorFrontendHost.openInNewTab to openURLExternally. Change the implementation to forward the request to UIProcess rather than the inspected WebProcess. When a navigation is triggered in WKInspectorViewController's WKWebView, allow the delegate to open the requested resource. Otherwise, redirect the navigation to the inspected WebView or open it using NSWorkspace (for the remote case). New API test: WKInspectorDelegate.OpenURLExternally. * UIProcess/API/Cocoa/_WKInspectorPrivateForTesting.h: Added. * UIProcess/API/Cocoa/_WKInspectorTesting.mm: Added. (snippetToOpenURLExternally): (-[_WKInspector _openURLExternallyForTesting:useFrontendAPI:]): Add some helpers for writing API tests. * UIProcess/API/APIInspectorClient.h: (API::InspectorClient::openURLExternally): * UIProcess/API/Cocoa/_WKInspectorDelegate.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: * UIProcess/Inspector/Cocoa/InspectorDelegate.h: * UIProcess/Inspector/Cocoa/InspectorDelegate.mm: (WebKit::InspectorDelegate::setDelegate): (WebKit::InspectorDelegate::InspectorClient::openURLExternally): Add new delegate method to _WKInspectorDelegate. * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: * UIProcess/Inspector/RemoteWebInspectorProxy.h: * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::openURLExternally): (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally): (WebKit::RemoteWebInspectorProxy::openInNewTab): Deleted. (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted. * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformURLExternally): (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted. * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally): (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted. * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp: (WebKit::RemoteWebInspectorProxy::platformOpenURLExternally): (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab): Deleted. Rename openInNewTab to openURLExternally. In some cases the client may not choose to present a new tab, so the name is no longer accurate. * UIProcess/Inspector/WebInspectorProxy.messages.in: * UIProcess/Inspector/WebInspectorProxy.h: * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::inspectorWindow const): (WebKit::WebInspectorProxy::openURLExternally): (WebKit::WebInspectorProxy::evaluateInFrontendForTesting): * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (-[WKWebInspectorProxyObjCAdapter inspectorViewController:openURLExternally:]): Add some helpers for writing API tests. Add an IPC message for evaluating a JavaScript expression in the frontend page. Also, add a message receiver for the OpenURLExternally message which passes the request to the API layer. * UIProcess/Inspector/mac/WKInspectorViewController.h: * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]): Call the delegate method if a navigation inside the inspector WKWebView is an external URL. Specifically the request is to load something other than the Web Inspector's main HTML page. * WebProcess/Inspector/WebInspector.cpp: (WebKit::WebInspector::openInNewTab): Deleted. * WebProcess/Inspector/WebInspector.h: * WebProcess/Inspector/WebInspector.messages.in: No need to handle this message anymore in the inspected WebProcess. * WebProcess/Inspector/RemoteWebInspectorUI.h: * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::openURLExternally): (WebKit::RemoteWebInspectorUI::openInNewTab): Deleted. * WebProcess/Inspector/WebInspectorUI.messages.in: * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::updateConnection): (WebKit::WebInspectorUI::closeWindow): (WebKit::WebInspectorUI::openURLExternally): (WebKit::WebInspectorUI::evaluateInFrontendForTesting): (WebKit::WebInspectorUI::openInNewTab): Deleted. When we need to open the URL externally, send an IPC message to UIProcess. The old implementation triggered the navigation from the inspected WebProcess. That approach is no longer desirable. Remove the unneeded IPC connection. * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: (WebKit::WebInspectorFrontendAPIDispatcher::evaluateExpressionForTesting): Fulfill the request to evaluate the expression in the frontend page. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Some files were added. 2020-09-22 Per Arne Vollan <pvollan@apple.com> [macOS] Start collecting telemetry from message filtering <https://bugs.webkit.org/show_bug.cgi?id=216803> Reviewed by Darin Adler. Start collecting telemetry for message filtering in the WebContent sandbox on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2020-09-22 Youenn Fablet <youenn@apple.com> Move Media in GPU Process flag from internal to experimental https://bugs.webkit.org/show_bug.cgi?id=216473 <rdar://problem/69318786> Reviewed by Eric Carlson. No change of behavior. * Shared/WebPreferencesExperimental.yaml: * Shared/WebPreferencesInternal.yaml: 2020-09-21 Youenn Fablet <youenn@apple.com> Enable MediaRecorder by default on iOS https://bugs.webkit.org/show_bug.cgi?id=216664 Reviewed by Darin Adler. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultMediaRecorderEnabled): 2020-09-21 Adrian Perez de Castro <aperez@igalia.com> [CMake] Use imported targets in find module for the ATK SPI2 bridge dependency https://bugs.webkit.org/show_bug.cgi?id=216773 Reviewed by Don Olmstead. No new tests needed. * PlatformWPE.cmake: Use the ATK::Bridge imported target. 2020-09-21 Adrian Perez de Castro <aperez@igalia.com> [GTK] Bump cairo version to support HiDPI https://bugs.webkit.org/show_bug.cgi?id=133378 Reviewed by Carlos Garcia Campos. Remove conditional compilation around cairo_{g,s}et_device_scale() as there is no need to support older versions of Cairo which lack the functions. The minimum version of Cairo being required by CMake is 1.14.0, which already includes them. * Shared/cairo/ShareableBitmapCairo.cpp: (WebKit::ShareableBitmap::paint): use cairo_surface_set_device_scale() directly. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseTakeViewSnapshot): Ditto. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Ditto. (WebKit::AcceleratedBackingStoreWayland::downloadTexture): Ditto. * UIProcess/gtk/AcceleratedBackingStoreX11.cpp: (WebKit::AcceleratedBackingStoreX11::update): Ditto. 2020-09-21 Tim Horton <timothy_horton@apple.com> paper.io ad close buttons cannot be iteracted with via trackpad on iPad https://bugs.webkit.org/show_bug.cgi?id=216812 <rdar://problem/68738585> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (applicationIsKnownToIgnoreMouseEvents): 2020-09-21 Timothy Hatcher <timothy@apple.com> Add some WKWebProcessPlugInFrame SPI needed by Safari. https://bugs.webkit.org/show_bug.cgi?id=216809 rdar://problem/69336928 Reviewed by Brian Weinstein. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: (+[WKWebProcessPlugInFrame lookUpFrameFromJSContext:]): Added. (-[WKWebProcessPlugInFrame _securityOrigin]): Added. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h: 2020-09-21 Andres Gonzalez <andresg_22@apple.com> Make accessibility isolated tree a non-experimental feature. https://bugs.webkit.org/show_bug.cgi?id=216792 Reviewed by Chris Fleizach. Promote accessibility isolated tree from an experimental feature to a non-experimental one. This avoids the problem where a user can turn off the feature through the Safari > Develop > Experimental Features submenu, while the accessibility request are still coming on a secondary thread, which leads to random crashes. * Shared/WebPreferences.yaml: * Shared/WebPreferencesExperimental.yaml: 2020-09-21 Basuke Suzuki <basuke.suzuki@sony.com> [WinCairo][PlayStation] Support different instances of listener client. https://bugs.webkit.org/show_bug.cgi?id=216733 Reviewed by Don Olmstead. Follows the change of RemoteInspectorSocketEndpoint::Client interface change. No new tests because there's no behaivior change. * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::didClose): * UIProcess/Inspector/socket/RemoteInspectorClient.h: 2020-09-21 Youenn Fablet <youenn@apple.com> [iOS] MediaRecorder incorrect screen orientation handling https://bugs.webkit.org/show_bug.cgi?id=198912 <rdar://problem/51802521> Reviewed by Eric Carlson. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::videoSampleAvailable): 2020-09-21 Keith Miller <keith_miller@apple.com> Functions should consistently enumerate length before name https://bugs.webkit.org/show_bug.cgi?id=216789 Reviewed by Yusuke Suzuki. JSNPMethod inherits from InternalFunction which now sets length by default. I chose 0 because it looks like this function doesn't directly look at any arguments and I doubt anyone is looking at the length anyway. * WebProcess/Plugins/Netscape/JSNPMethod.cpp: (WebKit::JSNPMethod::finishCreation): 2020-09-20 Darin Adler <darin@apple.com> Next step towards eliminating deprecated legacy positions https://bugs.webkit.org/show_bug.cgi?id=216751 Reviewed by Sam Weinig. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::selectWithGesture): (WebKit::WebPage::extendSelection): (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary): (WebKit::WebPage::requestAutocorrectionData): (WebKit::WebPage::applyAutocorrectionInternal): (WebKit::focusedElementPositionInformation): (WebKit::dataDetectorLinkPositionInformation): (WebKit::WebPage::requestDocumentEditingContext): Replaced calls to createLegacyEditingPosition with calls to makeDeprecatedLegacyPosition or makeContainerOffsetPosition. 2020-09-21 Wenson Hsieh <wenson_hsieh@apple.com> Adjust the human readable names some GPU process internal feature flags https://bugs.webkit.org/show_bug.cgi?id=216794 Reviewed by Darin Adler. Change the human readable names so that all the GPU-process-specific internal features start are of the form "Use GPU Process…". * Shared/WebPreferencesInternal.yaml: 2020-09-21 James Savage <james.savage@apple.com> WKWebView Swift overlay has mis-annotated nullability for evaluateJavaScript <http://webkit.org/b/216198> <rdar://problem/68035950> Reviewed by Darin Adler. Due to a mistranslation of evaluateJavaScript, we are vending an API which does not expect to receive nil as a valid result value. This change fixes the crash, but does not yet fix the API to have the correct signature. That will come in a later patch. To fix the crash, we need to produce a valid Result<Any, Error> to pass back to clients. Fortunately, instead of inventing something clever, we can just use nil. It's valid to box optional values into Any, and clients can technically retrieve them with the right dynamic cast as well. Since client code must be using dynamic casting to convert the result Any to a usable type, and because in the case where we now return a new value at runtime we would have previously crashed, this shouldn't have any binary compatibility impact either. To better validate these changes, I also add new unit tests for the conversion of JavaScript results into Swift values, including a test for the deprecated API. * SwiftOverlay/SwiftOverlay/ObjectiveCBlockConversions.swift: Added. For clarity I'm factoring helper methods into a single namespace, as it also makes a nice place to document their expectations. (ObjectiveCBlockConversion.exclusive.exclusive(_:)): This is renamed from the free function, makeResultHandler(_:). It still has the same fatalError (now precondition) as before, but hopefully a better name to clarify that it expects exactly-one value. (ObjectiveCBlockConversions.boxingNilAsAnyForCompatibility(_:)): This is a variant of exclusive(_:) that makes the tradeoff of boxing any nil values as Any to avoid crashing. This is still safe, since as mentioned our clients will need to cast the value they recieve to do anything with it, and since the deprecated API expects `Any`, no one could have been successfully comparing it to `nil` today anyways. * SwiftOverlay/Tests/JavaScriptToSwiftTypeConversions.swift: Added. (JavaScriptToSwiftConversions.setUp): Construct a new web view, and add it to a window so that it is in an expected state. I'm using about:blank as the URL, since page content doesn't matter for these tests and I want the web content to be ready immediately. (JavaScriptToSwiftConversions.tearDown): Just perform some window cleanup. (JavaScriptToSwiftConversions.evaluateJavaScript(_:andExpect:)): Helper method to evaluate script and check its result. I'm using String.debugDescription because it escapes quotes and special characters which makes the readout easier to parse. (JavaScriptToSwiftConversions.testNull): JavaScript's null is actually mapped to NSNull, not nil. (JavaScriptToSwiftConversions.testInteger): Some standard type coercion tests. The underlying value for all number types should be NSNumber, so this is actually check against a float or integer type without issue. (JavaScriptToSwiftConversions.testDecimal): Ditto. (JavaScriptToSwiftConversions.testBoolean): Ditto. (JavaScriptToSwiftConversions.testString): Ditto. (JavaScriptToSwiftConversions.testArray): Ditto. (JavaScriptToSwiftConversions.testDictionary): Ditto, only you can't evaluate an object literal directly so I need to store it in a temporary location first. (JavaScriptToSwiftConversions.testUndefined): Test our boxing of nil. The exact value matters less than not crashing at all. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added new files to project. I kept the new test file and helper files within the SwiftOverlay group, because they do not contribute any API. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: (WKWebView.callAsyncJavaScript(_:arguments:in:in:completionHandler:)): Switch to a conversion which does not trap on nil. (WKWebView.createPDF(_:completionHandler:)): Updated to use new helper method name. (WKWebView.createWebArchiveData(_:)): Ditto. (WKWebView.evaluateJavaScript(_:in:in:completionHandler:Error:)): See above. (makeResultHandler(_:): This has been subsumed by ObjCBlockConversions. 2020-09-21 Kate Cheney <katherine_cheney@apple.com> Allow about:blank subframe loads for non app-bound top frames https://bugs.webkit.org/show_bug.cgi?id=216715 <rdar://problem/69070720> Reviewed by Darin Adler. In the original implementation of App Bound Domains, any loads using certain protocols like about: were automatically considered app-bound. When a subframe loads about:blank for example, this forces web views into app-bound mode even if the top frame is not app-bound, which should not be the case. These special protocols inherit security origins from their top-frame loads, so we can refer to those to determine whether subframe loads should be considered app-bound. For about: loads in a main frame there is no behavior change and WKWebViews will still automatically be considered app-bound in this case. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): (WebKit::WebPageProxy::decidePolicyForNavigationAction): Refer to the security origin if the subframe load is one of the special protocols caught by the shouldTreatURLProtocolAsAppBound() function. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::schemeOrDomainIsAppBound): (WebKit::WebsiteDataStore::beginAppBoundDomainCheck): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-09-20 Simon Fraser <simon.fraser@apple.com> Sort the project file. * WebKit.xcodeproj/project.pbxproj: 2020-09-19 Sam Weinig <weinig@apple.com> Remove runtime setting for enabling/disabling the CrossOriginResourcePolicy API https://bugs.webkit.org/show_bug.cgi?id=216561 Reviewed by Darin Adler. Remove runtime setting for enabling/disabling CrossOriginResourcePolicy. It has been enabled by default for a while and there are no known reasons one would need to disable it. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetCrossOriginResourcePolicyEnabled): (WKPreferencesGetCrossOriginResourcePolicyEnabled): * UIProcess/API/C/WKPreferencesRef.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): 2020-09-18 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data https://bugs.webkit.org/show_bug.cgi?id=216718 <rdar://problem/69150358> Reviewed by Tim Horton. Test: CopyHTML.WriteRichTextSelectionToPasteboard * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::dataSelectionForPasteboard): After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0, due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead, use `ipcHandle.dataSize`. 2020-09-18 Megan Gardner <megan_gardner@apple.com> Remove unneeded respondsToSelector staging for keyboard. https://bugs.webkit.org/show_bug.cgi?id=216421 Staging needed for dual work in UIKit in 2019, no longer needed. Reviewed by Tim Horton. No behavior change, covered by existing tests. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView insertText:]): (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): (-[WKContentView _interpretKeyEvent:isCharEvent:]): 2020-09-18 Sihui Liu <sihui_liu@apple.com> REGRESSION (r266634): fast/selectors/text-field-selection-stroke-color.html and fast/selectors/text-field-selection-window-inactive-stroke-color.html are flaky failures with pixel noise https://bugs.webkit.org/show_bug.cgi?id=216394 <rdar://problem/68679551> Reviewed by Tim Horton. In WebKitTestRunner, we reset the states and load about:blank page between tests. The resetting may cause some activity state changes of web page, like WindowIsActive. Before r266634, these changes will be dispatched quickly enough (before runloop waits or when runloop exits) to web process, so web process can do rendering with updated activity state. After r266634, dispatch of the changes may be delayed (until CATransaction commits). Page activity state can affect scrollability (in FrameView::computeScrollability()) and scrollability can affect tiling size (in TileController::computeTileSize()). Different tilings may cause the tiny pixel difference we see in the test results. To fix this, create an SPI for sending out activity state updates in next runloop cycle and adopt it in WTR. * UIProcess/API/C/WKPage.cpp: (WKPageDispatchActivityStateUpdateForTesting): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchActivityStateUpdateForTesting): * UIProcess/WebPageProxy.h: 2020-09-18 Alex Christensen <achristensen@webkit.org> WKWebView._tryClose should return whether it succeeded or not https://bugs.webkit.org/show_bug.cgi?id=216660 Reviewed by Tim Horton. The return value of WKPageTryClose is used by Safari. In order to migrate to WKWebView _tryClose, we need to expose this return value. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _tryClose]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2020-09-18 Sihui Liu <sihui_liu@apple.com> Webpages flash when getting closed https://bugs.webkit.org/show_bug.cgi?id=216131 <rdar://problem/62264106> Reviewed by Chris Dumez. Closing a page in web process will detach root CA layer and clears content in view immediately. If this happens in web process before transaction, which contains view hierachy change or layer change, is committed in UI process, we would see a white flash. To try fixing this issue, we explicitly delay sending the close message to next runloop cycle. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): * UIProcess/WebProcessProxy.cpp: (WebKit::m_shutdownPreventingScopeCounter): (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess): * UIProcess/WebProcessProxy.h: remove class ScopePreventingShutdown and use RefCounter to prevent process shutdown. (WebKit::WebProcessProxy::shutdownPreventingScope): (WebKit::WebProcessProxy::ScopePreventingShutdown::ScopePreventingShutdown): Deleted. (WebKit::WebProcessProxy::ScopePreventingShutdown::~ScopePreventingShutdown): Deleted. (WebKit::WebProcessProxy::makeScopePreventingShutdown): Deleted. 2020-09-18 Youenn Fablet <youenn@apple.com> Add internal flag to enable/disable H264 hardware encoder https://bugs.webkit.org/show_bug.cgi?id=216534 Reviewed by Eric Carlson. * Shared/WebPreferencesInternal.yaml: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2020-09-18 Youenn Fablet <youenn@apple.com> Hash deviceIds in WebProcess instead of UIProcess to allow audio output device IDs in WebProcess https://bugs.webkit.org/show_bug.cgi?id=216693 Reviewed by Eric Carlson. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): * UIProcess/UserMediaPermissionRequestManagerProxy.h: 2020-09-18 Youenn Fablet <youenn@apple.com> Unified build fixes in media code https://bugs.webkit.org/show_bug.cgi?id=216691 Reviewed by Sam Weinig. Add missing includes and/or missing undef. No change of behavior. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: * WebProcess/WebPage/WebPageOverlay.h: * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: * WebProcess/cocoa/RemoteRealtimeMediaSource.h: 2020-09-18 Noam Rosenthal <noam@webkit.org> Enable paint timing by default https://bugs.webkit.org/show_bug.cgi?id=211736 Reviewed by Simon Fraser. * Shared/WebPreferencesExperimental.yaml: PaintTimingEnabled default to true. 2020-09-18 Youenn Fablet <youenn@apple.com> XHR.timeout is affected by long tasks https://bugs.webkit.org/show_bug.cgi?id=216266 <rdar://problem/68908150> Reviewed by Alex Christensen. Go to network process to know whether a load is finished or not. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::isResourceLoadFinished): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::isResourceLoadFinished): * WebProcess/Network/WebLoaderStrategy.h: 2020-09-18 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Epiphany does not make connections in Incognito Mode after clearing .cache https://bugs.webkit.org/show_bug.cgi?id=216430 Reviewed by Adrian Perez de Castro. The problem is that when using an ephemeral context, the download is started before the ephemeral session has been registered in the network process, so it's just ignored. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createDownloadProxy): Pass the given WebsiteDataStore to ensureNetworkProcess(). 2020-09-18 Youenn Fablet <youenn@apple.com> Enable MediaRecorder by default on MacOS https://bugs.webkit.org/show_bug.cgi?id=216663 Reviewed by Eric Carlson. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultMediaRecorderEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/WebPreferencesExperimental.yaml: 2020-09-17 Sam Weinig <weinig@apple.com> Remove runtime setting for enabling/disabling the UserTiming and ResourceTiming APIs https://bugs.webkit.org/show_bug.cgi?id=216556 Reviewed by Darin Adler. Remove runtime setting for enabling/disabling UserTiming and ResourceTiming APIs. They have both been on for a while in WebKit2 and there aren't any known uses cases for disabling them. In addition to removing the setting, they are now enabled in LegacyWebKit as well. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetUserTimingEnabled): (WKPreferencesGetUserTimingEnabled): (WKPreferencesSetResourceTimingEnabled): (WKPreferencesGetResourceTimingEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: 2020-09-16 Darin Adler <darin@apple.com> Selection API: Introduce LiveRangeSelectionEnabled, off by default https://bugs.webkit.org/show_bug.cgi?id=216656 Reviewed by Sam Weinig. * Shared/WebPreferencesInternal.yaml: Added LiveRangeSelectionEnabled. 2020-09-17 Tim Horton <timothy_horton@apple.com> Per-app accent color overrides are broken https://bugs.webkit.org/show_bug.cgi?id=216674 <rdar://problem/67745464> Reviewed by Wenson Hsieh. No new tests; I've no idea how to write a test that would have caught this; any test I can imagine would have also written to _accentColor and worked fine. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::accentColor): AppKit changed the meaning of the IPI. Use the correct version. We still write to _accentColor; it is now purely an override. 2020-09-17 Kate Cheney <katherine_cheney@apple.com> Enable ITP in WKWebViews for apps with the full browser entitlement who are not linked to iOS 14.0 https://bugs.webkit.org/show_bug.cgi?id=216655 <rdar://problem/69081227> Reviewed by Brent Fulgham. Apps with the full browser entitlement who are not linked to iOS 14.0 should have ITP enabled in WKWebViews by default. No new tests, no way currently to test apps with different iOS versions. Tested manually. * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::determineITPStateInternal): Ignore the early return for the linked-on-or-after check if the app has the default browser entitlement so we still enable ITP based on the user's preference. 2020-09-17 David Kilzer <ddkilzer@apple.com> WebKit::XPCServiceEventHandler block should call exit() on the main thread <https://webkit.org/b/216594> <rdar://problem/68053217> Reviewed by Chris Dumez. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceEventHandler): - Call exit() on the main thread. I chose dispatch_sync() here so that if other crashes occur on the main thread, we will know if this background thread is waiting to call exit() at the same time. Also, if a different background thread calls exit() in the future with this block running on the main thread, we'll know where the block came from since the XPC handler thread will be waiting for the dispatch_sync() to return (instead of having a mysterious block calling exit() on the main thread and not knowing where it came from). - Add logging (including simulated crash logs) when either of these exit() code paths is taken. 2020-09-17 Hoa Dinh <dvh@apple.com> Rename ShouldAllowExternalSchemes to ShouldAllowExternalSchemesButNotAppLinks to clarify what this enum value is for. https://bugs.webkit.org/show_bug.cgi?id=216651 Reviewed by Alex Christensen. Rename ShouldAllowExternalSchemes to ShouldAllowExternalSchemesButNotAppLinks and reflects the change where it's used. Source/WebKit: * Shared/SessionState.cpp: (WebKit::isValidEnum): * UIProcess/API/APINavigationAction.h: * UIProcess/API/glib/WebKitWebViewSessionState.cpp: (toExternalURLsPolicy): (toWebCoreExternalURLsPolicy): * UIProcess/WebPageProxy.h: * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeSessionHistoryEntry): * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp: (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction): 2020-09-17 Sam Weinig <weinig@apple.com> We shouldn't need to specify a category for preferences now that they are split into separate files https://bugs.webkit.org/show_bug.cgi?id=216648 Reviewed by Tim Horton. Remove need / ability to specify a category in the yaml, rather, infer the category from which file it is in. * Scripts/GeneratePreferences.rb: * Shared/WebPreferencesDebug.yaml: * Shared/WebPreferencesExperimental.yaml: * Shared/WebPreferencesInternal.yaml: 2020-09-17 Antoine Quint <graouts@webkit.org> Remove the legacy animation code https://bugs.webkit.org/show_bug.cgi?id=216608 Reviewed by Dean Jackson. Since we now have a single animation engine, the runtime flags to optionally enable the Web Animations engine are not needed anymore and are now removed. * Shared/WebPreferencesExperimental.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebAnimationsEnabled): Deleted. (WKPreferencesGetWebAnimationsEnabled): Deleted. (WKPreferencesSetWebAnimationsCSSIntegrationEnabled): Deleted. (WKPreferencesGetWebAnimationsCSSIntegrationEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]): Deleted. (-[WKPreferences _webAnimationsCSSIntegrationEnabled]): Deleted. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): (WebKit::InjectedBundle::setWebAnimationsEnabled): Deleted. (WebKit::InjectedBundle::setWebAnimationsCSSIntegrationEnabled): Deleted. * WebProcess/InjectedBundle/InjectedBundle.h: 2020-09-17 Rob Buis <rbuis@igalia.com> Clean up lazy frame loading https://bugs.webkit.org/show_bug.cgi?id=216560 Reviewed by Youenn Fablet. Allow web preference to be consistent with lazy image loading. * Shared/WebPreferencesExperimental.yaml: 2020-09-17 Jer Noble <jer.noble@apple.com> Unified build fix for "redefinition of 'kCMVideoCodecType_VP9" https://bugs.webkit.org/show_bug.cgi?id=216205 Reviewed by Youenn Fablet. Wrap calls to WebCore VP9 functions in ENABLE(VP9) checks. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebProcess.cpp: * WebProcess/WebProcess.h: 2020-09-16 Sam Weinig <weinig@apple.com> WebPreferences.yaml is overwhelming, what if we split it up a bit https://bugs.webkit.org/show_bug.cgi?id=216627 Reviewed by Tim Horton. Split out experimental, internal and debug preferences into their own yaml files to add a bit of order. * CMakeLists.txt: * DerivedSources.make: * Shared/WebPreferences.yaml: * Shared/WebPreferencesDebug.yaml: Copied from Source/WebKit/Shared/WebPreferences.yaml. * Shared/WebPreferencesExperimental.yaml: Copied from Source/WebKit/Shared/WebPreferences.yaml. * Shared/WebPreferencesInternal.yaml: Copied from Source/WebKit/Shared/WebPreferences.yaml. * WebKit.xcodeproj/project.pbxproj: 2020-09-16 Kate Cheney <katherine_cheney@apple.com> Revert _setIgnoresAppBoundDomains SPI to compile for macOS https://bugs.webkit.org/show_bug.cgi?id=216628 <rdar://problem/69025655> Reviewed by Tim Horton. We need to give users of the _setIgnoresAppBoundDomains SPI time to convert uses to iOS only, so in the meantime we should still compile the SPI for macOS so we don't break anything. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _ignoresAppBoundDomains]): (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: 2020-09-16 Sam Weinig <weinig@apple.com> Remove runtime setting for enabling/disabling CSS shadow parts https://bugs.webkit.org/show_bug.cgi?id=216567 Reviewed by Tim Horton. Remove runtime setting for enabling/disabling CSS shadow parts. It is on by default and there is no known reason one would need to disable it. * Shared/WebPreferences.yaml: 2020-09-16 Sam Weinig <weinig@apple.com> Remove runtime setting for enabling/disabling the isSecureContext API? https://bugs.webkit.org/show_bug.cgi?id=216562 Reviewed by Darin Adler. Remove runtime setting for enabling/disabling the the isSecureContext attribute. on window and the worker global scope. There is no known reason one would need to disable it. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetIsSecureContextAttributeEnabled): (WKPreferencesGetIsSecureContextAttributeEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2020-09-16 Youenn Fablet <youenn@apple.com> RemoteSampleBufferDisplayLayer should process its IPC messages from a background thread https://bugs.webkit.org/show_bug.cgi?id=216475 Reviewed by Eric Carlson. Use a process wide work queue to process all track video renderer messages in a background thread. This queue is shared by all RemoteSampleBufferDisplayLayerManager and RemoteSampleBufferDisplayLayer objects, which are per web process. Since LocalSampleBufferDisplayLayer must currently be created in main thread, hop to main thread to create/delete renderers. We update messages.py to support WantsAsyncDispatchMessage, which removes the sync handling with dispatchMessage. This allows RemoteSampleBufferDisplayLayerManager to also handle messages from RemoteSampleBufferDisplayLayer. Update RemoteSampleBufferDisplayLayerManager accordingly as well. Covered by webrtc/video.html with GPU process enabled. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::dispatchMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::videoMediaStreamTrackRendererQueue): * GPUProcess/GPUProcess.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: (WebKit::RemoteAudioMediaStreamTrackRendererManager::dispatchMessage): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: (WebKit::RemoteSampleBufferDisplayLayerManager::RemoteSampleBufferDisplayLayerManager): (WebKit::RemoteSampleBufferDisplayLayerManager::~RemoteSampleBufferDisplayLayerManager): (WebKit::RemoteSampleBufferDisplayLayerManager::close): (WebKit::RemoteSampleBufferDisplayLayerManager::dispatchToThread): (WebKit::RemoteSampleBufferDisplayLayerManager::dispatchMessage): (WebKit::RemoteSampleBufferDisplayLayerManager::createLayer): (WebKit::RemoteSampleBufferDisplayLayerManager::releaseLayer): * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in: * Scripts/webkit/messages.py: * SourcesCocoa.txt: 2020-09-16 Alex Christensen <achristensen@webkit.org> Move TLS certificate bypass SPI from WebProcessPool to WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=216585 Reviewed by Geoffrey Garen. It will eventually be replaced by WKNavigationDelegate's didReceiveAuthenticationChallenge in rdar://30655740 but the SPI needs to continue to exist somewhere until that is complete. In the meantime, it needs to be moved from the WebProcessPool for https://bugs.webkit.org/show_bug.cgi?id=216041 and rdar://problem/68942815 tracks Safari's adoption of the SPI introduced here, which I will fix within an hour of landing this. * UIProcess/API/C/WKContext.cpp: (WKContextAllowSpecificHTTPSCertificateForHost): * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKProcessGroup.mm: (-[WKProcessGroup _setAllowsSpecificHTTPSCertificate:forHost:]): Deleted. * UIProcess/API/Cocoa/WKProcessGroupPrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setAllowsSpecificHTTPSCertificate:forHost:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _allowTLSCertificate:forHost:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_allow_tls_certificate_for_host): Use the default data store until this API can be replaced by API in a different place. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::allowSpecificHTTPSCertificateForHost): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::allowSpecificHTTPSCertificateForHost): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-09-16 Alex Christensen <achristensen@webkit.org> Remove unneeded HAVE_FOUNDATION_WITH_SAVE_COOKIES_WITH_COMPLETION_HANDLER https://bugs.webkit.org/show_bug.cgi?id=216572 Reviewed by Youenn Fablet. It's available everywhere we support. * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::saveCookies): (WebKit::NetworkProcess::platformFlushCookies): 2020-09-16 Youenn Fablet <youenn@apple.com> Move LibWebRTCCodecsProxy message handling out of the main thread https://bugs.webkit.org/show_bug.cgi?id=216531 Reviewed by Eric Carlson. Use a process wide work queue to process all LibWebRTCCodecsProxy messages in a background thread. This queue is shared by all LibWebRTCCodecsProxy objects, which are per web process. Covered by webrtc/video.html with GPU process enabled. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::~GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::dispatchMessage): (WebKit::GPUConnectionToWebProcess::libWebRTCCodecsProxy): Deleted. * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::libWebRTCCodecsQueue): * GPUProcess/GPUProcess.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: (WebKit::LibWebRTCCodecsProxy::create): (WebKit::LibWebRTCCodecsProxy::didReceiveMessageFromWebProcess): Deleted. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::LibWebRTCCodecsProxy): (WebKit::LibWebRTCCodecsProxy::~LibWebRTCCodecsProxy): (WebKit::LibWebRTCCodecsProxy::dispatchToThread): (WebKit::LibWebRTCCodecsProxy::close): 2020-09-16 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, early September 2020 edition https://bugs.webkit.org/show_bug.cgi?id=216599 Unreviewed build fix. Largely based on a patch by Lauro Moura <lmoura@igalia.com> * GPUProcess/media/RemoteCDMProxy.cpp: Add missing WebCore/SharedBuffer.h include. * GPUProcess/media/RemoteMediaResourceLoader.cpp: Add missing WebCore/ResourceError.h include. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: Add missing DataReference.h include. * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: (WebKit::WebDataListSuggestionsDropdownGtk::show): Add missing namespace to WebCore::monitorWorkArea() call. * WebProcess/Network/WebSocketChannelManager.cpp: Add missing WebCore/WebSocketIdentifier.h include. (WebKit::WebSocketChannelManager::didReceiveMessage): Add missing namespace to WebCore::WebSocketIdentifierType usage. 2020-09-15 Said Abou-Hallawa <sabouhallawa@apple.com> REGRESSION(r266677): ASSERTION FAILED in PaintFrequencyTracker::end() https://bugs.webkit.org/show_bug.cgi?id=216591 <rdar://problem/68635418> Reviewed by Simon Fraser. timestampForPaintFrequencyTracking() do not have to be in ChromeClient. RenderLayer can access it through its page(). No need to special case isSVGImageChromeClient() because we are going to track the painting that goes through Page::updateRendering(). This means all the painting of the SVG image RenderLayers will be tracked by the same timestamp. Currently we do not support compositing inside the SVG image which means there is only one RenderLayer per SVG image. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::timestampForPaintFrequencyTracking const): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-09-15 Aditya Keerthi <akeerthi@apple.com> [macOS] Date pickers should respect the document's color scheme https://bugs.webkit.org/show_bug.cgi?id=216514 <rdar://problem/68889548> Reviewed by Tim Horton. Use the appearance property of NSWindow to ensure the appearance of the contained NSDatePicker matches the value encoded in DateTimeChooserParameters. * UIProcess/mac/WebDateTimePickerMac.mm: (-[WKDateTimePicker initWithParams:inView:]): 2020-09-15 Alex Christensen <achristensen@webkit.org> Move local storage sync SPI from WebProcessPool to WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=216581 Reviewed by Geoffrey Garen. This move is needed for https://bugs.webkit.org/show_bug.cgi?id=216041 We no longer need to sync the legacy private browsing storage because it is no longer used by WebKitTestRunner. Thank goodness. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::clearLegacyPrivateBrowsingLocalStorage): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKContext.cpp: (WKContextSyncLocalStorage): Deleted. (WKContextClearLegacyPrivateBrowsingLocalStorage): Deleted. * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSyncLocalStorage): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::syncLocalStorage): Deleted. (WebKit::WebProcessPool::clearLegacyPrivateBrowsingLocalStorage): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::syncLocalStorage): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-09-15 Alex Christensen <achristensen@webkit.org> Move service worker testing timeout setting from WebProcessPool to WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=216578 Reviewed by Geoffrey Garen. This is needed for https://bugs.webkit.org/show_bug.cgi?id=216041 * UIProcess/API/C/WKContext.cpp: (WKContextSetServiceWorkerFetchTimeoutForTesting): Deleted. (WKContextResetServiceWorkerFetchTimeoutForTesting): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetServiceWorkerFetchTimeoutForTesting): (WKWebsiteDataStoreResetServiceWorkerFetchTimeoutForTesting): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setServiceWorkerTimeoutForTesting): Deleted. (WebKit::WebProcessPool::resetServiceWorkerTimeoutForTesting): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setServiceWorkerTimeoutForTesting): (WebKit::WebsiteDataStore::resetServiceWorkerTimeoutForTesting): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-09-15 Peng Liu <peng.liu6@apple.com> REGRESSION (r267053): ASSERTION FAILED: videoFullscreenManager->client() == &_videoFullscreenManagerProxyClient in [WKFullScreenWindowController _completedExitFullScreen] https://bugs.webkit.org/show_bug.cgi?id=216571 Reviewed by Jer Noble. It is possible that an element exits fullscreen before it completely enters fullscreen. In that case, the client of VideoFullscreenManagerProxy is nullptr. No new tests, fixing an assertion failure when running TestWebKitAPI.WKWebViewCloseAllMediaPresentations.ElementFullscreen. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _completedExitFullScreen]): 2020-09-15 Sam Weinig <weinig@apple.com> Remove runtime setting for enabling/disabling the fetch API https://bugs.webkit.org/show_bug.cgi?id=216519 Reviewed by Alex Christensen. Remove runtime setting for enabling/disabling the fetch API. There is no reason one needs to disable it now and it has been on by default for a long enough time. Also cleans up WKPreferencesRefPrivate.h/WKPreferences.cpp to move all the obsolete preferences to the bottom with a comment about removing them when possible. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesResetTestRunnerOverrides): (WKPreferencesSetPrivateBrowsingEnabled): (WKPreferencesGetPrivateBrowsingEnabled): (WKPreferencesSetIgnoreViewportScalingConstraints): (WKPreferencesGetIgnoreViewportScalingConstraints): (WKPreferencesSetWebRTCLegacyAPIEnabled): (WKPreferencesGetWebRTCLegacyAPIEnabled): (WKPreferencesSetNewBlockInsideInlineModelEnabled): (WKPreferencesGetNewBlockInsideInlineModelEnabled): (WKPreferencesSetLongMousePressEnabled): (WKPreferencesGetLongMousePressEnabled): (WKPreferencesSetAntialiasedFontDilationEnabled): (WKPreferencesGetAntialiasedFontDilationEnabled): (WKPreferencesSetHixie76WebSocketProtocolEnabled): (WKPreferencesGetHixie76WebSocketProtocolEnabled): (WKPreferencesSetApplicationChromeModeEnabled): (WKPreferencesGetApplicationChromeModeEnabled): (WKPreferencesSetInspectorUsesWebKitUserInterface): (WKPreferencesGetInspectorUsesWebKitUserInterface): (WKPreferencesSetFetchAPIEnabled): (WKPreferencesGetFetchAPIEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: 2020-09-15 Sam Weinig <weinig@apple.com> Remove runtime setting for enabling/disabling custom elements https://bugs.webkit.org/show_bug.cgi?id=216518 Reviewed by Tim Horton. Remove runtime setting for enabling/disabling custom elements. There is no reason one need to disable it now, and it has been on by default for a long enough time. * Shared/WebPreferences.yaml: 2020-09-15 Simon Fraser <simon.fraser@apple.com> REGRESSION (r267002): ASSERTION FAILED:[ iOS wk2 Debug ] !HashTranslator::equal(KeyTraits::emptyValue(), key) on compositing/ios/overflow-scroll-update-overlap.html https://bugs.webkit.org/show_bug.cgi?id=216520 <rdar://problem/68894931> Reviewed by Tim Horton. Avoid hash lookups with zero nodeIDs. * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const): (WebKit::RemoteScrollingCoordinator::isUserScrollInProgress const): (WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress const): 2020-09-15 Alex Christensen <achristensen@webkit.org> Move WKContextClearCachedCredentials SPI to WKWebsiteDataStoreClearCachedCredentials https://bugs.webkit.org/show_bug.cgi?id=216513 Reviewed by Chris Dumez. The credentials are owned by session anyways. This is needed for https://bugs.webkit.org/show_bug.cgi?id=216041 * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::clearCachedCredentials): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKContext.cpp: (WKContextClearCachedCredentials): Deleted. * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreClearCachedCredentials): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::clearCachedCredentials): * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::clearCachedCredentials): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-09-15 Alex Christensen <achristensen@webkit.org> Remove unused plumbing for setting whether the storage access API is enabled https://bugs.webkit.org/show_bug.cgi?id=216516 Reviewed by Youenn Fablet. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): (WebKit::NetworkProcess::setStorageAccessAPIEnabled): Deleted. * UIProcess/API/C/WKContext.cpp: (WKContextSetStorageAccessAPIEnabled): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKCookieManager.cpp: (WKCookieManagerSetStorageAccessAPIEnabled): Deleted. * UIProcess/API/C/WKCookieManager.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _isStorageAccessAPIEnabled]): Deleted. (-[WKProcessPool _setStorageAccessAPIEnabled:]): Deleted. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setStorageAccessAPIEnabled): Deleted. * UIProcess/WebProcessPool.h: 2020-09-15 Alex Christensen <achristensen@webkit.org> Move WebSocket TLS bypass SPI from WebProcessPool to WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=216509 Reviewed by Youenn Fablet. After https://bugs.webkit.org/show_bug.cgi?id=216041 we will be unable to determine which WebsiteDataStore's NetworkProcess to add the TLS bypass to, so we need to move the SPI to the WebsiteDataStore object. This breaks off a piece of that large change into a small, easy-to-review change. * UIProcess/API/C/WKContext.cpp: (WKContextSetAllowsAnySSLCertificateForWebSocketTesting): Deleted. * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetAllowsAnySSLCertificateForWebSocketTesting): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _allowAnyTLSCertificateForWebSocketTesting]): Deleted. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setAllowsAnySSLCertificateForWebSocket): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setAllowsAnySSLCertificateForWebSocket): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-09-15 Aditya Keerthi <akeerthi@apple.com> [macOS] Update date picker appearance to match system date pickers https://bugs.webkit.org/show_bug.cgi?id=216517 <rdar://problem/68890678> Reviewed by Wenson Hsieh. System date pickers in macOS do not use NSVisualEffectView. Instead, use a solid background view with three rounded corners. * UIProcess/mac/WebDateTimePickerMac.mm: (-[WKDateTimePickerWindow initWithContentRect:styleMask:backing:defer:]): (-[WKDateTimePickerBackdropView drawRect:]): (-[WKDateTimePicker initWithParams:inView:]): 2020-09-15 Rob Buis <rbuis@igalia.com> Convert runtime flag to setting for lazy image loading https://bugs.webkit.org/show_bug.cgi?id=215610 Reviewed by Youenn Fablet. Remove lazy image loading runtime flag. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetLazyImageLoadingEnabled): Deleted. (WKPreferencesGetLazyImageLoadingEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: 2020-09-15 Youenn Fablet <youenn@apple.com> End of media capture should not be reported before 3 seconds of the start of capture https://bugs.webkit.org/show_bug.cgi?id=216415 <rdar://problem/68512358> Reviewed by Eric Carlson. Add support for delaying of end of capture notification to the application. This allows to ensure that a capture indicator stays for long enough for the user to notice it. A capture indicator should be visible to the user for at least three seconds. A timer is scheduled when starting a capture and there is no ongoing capture. As long as the timer is active, the capture state cannot be transitioned to no capture. Other transitions are allowed. Once the timer kicks in, any capture state update is done synchronously. Ensure to update the capture state when the timer kicks in. Note that even navigations will not allow transitioning the capture state sooner. This is done to ensure a page does not try to capture one frame before navigating to another page. In practice, very few pages should navigate quickly after starting capture. * UIProcess/API/C/WKPage.cpp: (WKPageGetMediaState): (WKPageSetMediaCaptureReportingDelayForTesting): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _mediaCaptureState]): * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _mediaCaptureReportingDelayForTesting]): (-[WKWebView _setMediaCaptureReportingDelayForTesting:]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updatePlayingMediaDidChange): (WebKit::WebPageProxy::updateReportedMediaCaptureState): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::reportedMediaCaptureState const): (WebKit::WebPageProxy::mediaCaptureReportingDelay const): (WebKit::WebPageProxy::setMediaCaptureReportingDelay): 2020-09-15 Youenn Fablet <youenn@apple.com> Enable VP9 in GPUProcess if page needs it https://bugs.webkit.org/show_bug.cgi?id=216472 Reviewed by Eric Carlson. In case a page is using GPUProcess for media, send the VP9 parameters to GPUProcess. GPUProcess will enable VP9 decoders based on that input. Covered by LayoutTests/media/vp9.html with GPU process enabled. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::enableVP9Decoders): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::enableVP9Decoders): * GPUProcess/GPUProcess.h: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::updateParameters): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2020-09-14 Sam Weinig <weinig@apple.com> Remove runtime setting for enabling/disabling ShadowDOM https://bugs.webkit.org/show_bug.cgi?id=216511 Reviewed by Ryosuke Niwa. Remove runtime setting for enabling/disabling ShadowDOM. There is no reason one need to disable it now, and it has been on by default for a long enough time. * Shared/WebPreferences.yaml: 2020-09-14 Aditya Keerthi <akeerthi@apple.com> [macOS] Do not dismiss date picker when a value is selected https://bugs.webkit.org/show_bug.cgi?id=216515 <rdar://problem/68889944> Reviewed by Darin Adler. The calendar presented when activating a date input should not be dismissed after the user selects a date. This matches the behavior of date pickers in Calendar.app. * UIProcess/mac/WebDateTimePickerMac.mm: (WebKit::WebDateTimePickerMac::didChooseDate): 2020-09-14 Peng Liu <peng.liu6@apple.com> Returning to element fullscreen from PiP is not stable under stress tests https://bugs.webkit.org/show_bug.cgi?id=216287 Reviewed by Jer Noble. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: (WebKit::VideoFullscreenManagerProxyClient::~VideoFullscreenManagerProxyClient): (WebKit::VideoFullscreenManagerProxy::setClient): (WebKit::VideoFullscreenManagerProxy::client const): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::didExitPictureInPicture): (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture): (WebKit::VideoFullscreenManagerProxy::hasVideoInPictureInPictureDidChange): (WebKit::VideoFullscreenManagerProxy::fullscreenMayReturnToInline): (WebKit::VideoFullscreenModelContext::prepareToExitFullscreen): Deleted. Add the interface VideoFullscreenManagerProxyClient, which is used by WKFullScreenWindowController to implement the support of "returning to element fullscreen from PiP". Using VideoFullscreenModelClient for that purpose is not a good idea because the instance observed by VideoFullscreenModelClient may be destroyed when a video element is exiting picture-in-picture if we don't call VideoFullscreenManagerProxy::addClientForContext() and VideoFullscreenManagerProxy::removeClientForContext() properly. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController initWithWebView:]): (-[WKFullScreenWindowController dealloc]): (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController _completedExitFullScreen]): (-[WKFullScreenWindowController videoControlsManagerDidChange]): (-[WKFullScreenWindowController prepareToExitPictureInPicture]): (-[WKFullScreenWindowController didExitPictureInPicture]): (-[WKFullScreenWindowController _videoFullscreenManager]): (WKFullScreenWindowControllerVideoFullscreenModelClient::setParent): Deleted. (WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): Deleted. (WKFullScreenWindowControllerVideoFullscreenModelClient::interface const): Deleted. (-[WKFullScreenWindowController willEnterPictureInPicture]): Deleted. (-[WKFullScreenWindowController failedToEnterPictureInPicture]): Deleted. Use VideoFullscreenManagerProxyClient instead of VideoFullscreenModelClient to implement the support of "returning to element fullscreen from PiP" on iOS. A user can "return to element fullscreen from PiP" by clicking the "return to fullscreen" button on the PiP window, or by clicking the "fullscreen" button on the page. This patch adds support for the latter case. * UIProcess/mac/WKFullScreenWindowController.h: * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController initWithWindow:webView:page:]): (-[WKFullScreenWindowController dealloc]): (-[WKFullScreenWindowController videoControlsManagerDidChange]): (-[WKFullScreenWindowController didExitPictureInPicture]): (-[WKFullScreenWindowController windowDidEnterFullScreen:]): (-[WKFullScreenWindowController _videoFullscreenManager]): (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setParent): Deleted. (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): Deleted. (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::interface const): Deleted. Use VideoFullscreenManagerProxyClient instead of VideoFullscreenModelClient to implement the support of "exiting fullscreen after entering PiP" on Mac. We may implement the support of "returning to element fullscreen from PiP" on Mac in the future. 2020-09-14 Alex Christensen <achristensen@webkit.org> Move cookie flushing SPI from WKProcessPool to WKHTTPCookieStore https://bugs.webkit.org/show_bug.cgi?id=216493 Reviewed by Chris Dumez. In order for https://bugs.webkit.org/show_bug.cgi?id=216041 to be possible, our interface for flushing cookies to disk can't be on the WKProcessPool. It should be with the other cookie operations, in WKHTTPCookieStore. AuxiliaryProcessProxy::sendWithAsyncReply takes care of the background assertion, so we remove that code from NetworkProcessProxy::syncAllCookies. rdar://problem/68872711 tracks adoption in Safari, which I will land within an hour of landing this to avoid cookie regressions. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::syncAllCookies): (WebKit::NetworkProcess::didSyncAllCookies): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::syncAllCookies): * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::syncCookies): * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: (-[WKHTTPCookieStore _flushCookiesToDiskWithCompletionHandler:]): * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _syncNetworkProcessCookies]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::syncAllCookies): (WebKit::NetworkProcessProxy::didSyncAllCookies): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::syncCookies): (WebKit::WebProcessPool::syncNetworkProcessCookies): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::syncCookies): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-09-14 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo][MediaFoundation] r264188 introduced linker warning: LNK4199: /DELAYLOAD:mf.dll ignored; no imports found from mf.dll https://bugs.webkit.org/show_bug.cgi?id=214170 Reviewed by Alex Christensen. * PlatformWin.cmake: 2020-09-14 Devin Rousso <drousso@apple.com> Web Inspector: docking buttons don't work when already docked if window is too small https://bugs.webkit.org/show_bug.cgi?id=216488 <rdar://problem/68242717> Reviewed by Timothy Hatcher. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::attach): (WebKit::WebInspectorProxy::attachAvailabilityChanged): If Web Inspector is already attached, it can re-attach with a different configuration. 2020-09-14 Dean Jackson <dino@apple.com> Enable WebGL2 by default https://bugs.webkit.org/show_bug.cgi?id=216464 <rdar://problem/68811378> Reviewed by Sam Weinig. Our WebGL2 implementation is in good enough shape that we should enable it by default for broader testing. Remove "defaultWebGL2Enabled" since it wasn't being used anywhere. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebGL2Enabled): Deleted. * Shared/WebPreferencesDefaultValues.h: 2020-09-14 Youenn Fablet <youenn@apple.com> RemoteAudioMediaStreamTrackRenderer should process its IPC messages from a background thread https://bugs.webkit.org/show_bug.cgi?id=216474 Reviewed by Eric Carlson. Register RemoteAudioMediaStreamTrackRendererManager as a thread message receiver for both RemoteAudioMediaStreamTrackRenderer and RemoteAudioMediaStreamTrackRendererManager messages. All processing is sent to a high priority work queue. Given AudioMediaStreamTrackRendererUnit is not fully thread safe, we use a single WorkQueue for the whole GPUProcess. All operations will happen in this thread, while in WebProcess, create/start/stop/release are main thread. We no longer compile the generated RemoteAudioMediaStreamTrackRendererManager::didReceiveMessage and instead implement our own version to handle manager and renderer messages. Covered by WebRTC audio tests run with GPU process enabled. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::~GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::dispatchMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::audioMediaStreamTrackRendererQueue): * GPUProcess/GPUProcess.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: (WebKit::RemoteAudioMediaStreamTrackRendererManager::RemoteAudioMediaStreamTrackRendererManager): (WebKit::RemoteAudioMediaStreamTrackRendererManager::~RemoteAudioMediaStreamTrackRendererManager): (WebKit::RemoteAudioMediaStreamTrackRendererManager::close): (WebKit::RemoteAudioMediaStreamTrackRendererManager::dispatchToThread): (WebKit::RemoteAudioMediaStreamTrackRendererManager::didReceiveMessage): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * SourcesCocoa.txt: 2020-09-13 Simon Fraser <simon.fraser@apple.com> Overflow:scroll rubberbanding is interrupted by post-layout scrolling https://bugs.webkit.org/show_bug.cgi?id=216463 <rdar://problem/67095741> Reviewed by Darin Adler. When rubberbanding overflow:scroll RenderLayer has an overscrolled scroll offset. If RenderLayer::updateScrollInfoAfterLayout() happens when in this state, it can clamp the scroll offset, causing the rubberband to collapse which interferes with the user interaction. This happend on Gmail when composing a reply. Fix by tracking the rubberbanding state in the scrolling tree, and having RenderLayer query this state via the ScrollingCoordinator. RenderLayer::updateScrollInfoAfterLayout() already tested isRubberBandInProgress(). This is similar to how isUserScrollInProgress() and isScrollSnapInProgress() work. This patch also fixes the tracking of rubberbanding state. Previously setMainFrameIsRubberBanding() was just based on when the timer was started and stopped, which did not match the implementation of ScrollController::isRubberBandInProgress(). Now ScrollController correctly notifies its clients when the rubberbanding state changes by updating that state whenever any of the conditions consulted in isRubberBandInProgressInternal() change. * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::isRubberBandInProgress const): (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged): 2020-09-13 Wenson Hsieh <wenson_hsieh@apple.com> Add a key to the text manipulation userInfo dictionary indicating whether the translated item is on-screen https://bugs.webkit.org/show_bug.cgi?id=216452 <rdar://problem/68785397> Reviewed by Darin Adler. Add `_WKTextManipulationTokenUserInfoVisibilityKey` and set its value to the value of the `isVisible` member in `ManipulationTokenInfo`. See WebCore ChangeLog for more details. * UIProcess/API/Cocoa/WKWebView.mm: (createUserInfo): * UIProcess/API/Cocoa/_WKTextManipulationToken.h: * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: 2020-09-13 Pablo Saavedra <psaavedra@igalia.com> [GTK][WPE] Build fails when -DENABLE_SERVICE_WORKER=OFF https://bugs.webkit.org/show_bug.cgi?id=216455 Unreviewed build fix. * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): (toWebKitWebsiteDataTypes): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (toWebsiteDataTypes): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): 2020-09-11 Alex Christensen <achristensen@webkit.org> Move _setCookieAcceptPolicy to WKHTTPCookieStore https://bugs.webkit.org/show_bug.cgi?id=216375 Reviewed by Geoffrey Garen. It is only used by Safari, which I am changing along with this in rdar://problem/68659937 I need it to not be on the process pool for https://bugs.webkit.org/show_bug.cgi?id=216041 and because the cookie store's job is to manage cookie storage. The fact that it was on the process pool is just a historical artifact of us trying to make it global. WKContextUseTestingNetworkSession has had its important parts replaced by WKWebsiteDataStoreConfigurationSetTestingSessionEnabled but it was still being used to determinte whether the UI process should persist the cookie accept policy. We don't need this any more because we send a message to the network process and let it manage the cookie accept policy. * UIProcess/API/C/WKContext.cpp: (WKContextUseTestingNetworkSession): Deleted. * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: (-[WKHTTPCookieStore _setCookieAcceptPolicy:completionHandler:]): * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _setCookieAcceptPolicy:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebCookieManagerProxy.cpp: (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::useTestingNetworkSession): Deleted. * UIProcess/WebProcessPool.h: 2020-09-11 Ben Nham <nham@apple.com> Fix undeclared identifier issue due to clashes in soft link headers https://bugs.webkit.org/show_bug.cgi?id=216412 Reviewed by Geoffrey Garen. Use the workaround constant kPALFigPhotoContainerFormat_JFIF instead of the enum value kFigPhotoContainerFormat_JFIF. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-09-11 Jer Noble <jer.noble@apple.com> [iOS] Add Experimental setting to disable calling PID Inheritance API. https://bugs.webkit.org/show_bug.cgi?id=216387 <rdar://problem/66286777> Reviewed by Eric Carlson. * Shared/WebPreferences.yaml: 2020-09-11 Kate Cheney <katherine_cheney@apple.com> Followup to Bug 215027: address comments to improve APP_BOUND_DOMAINS macro use https://bugs.webkit.org/show_bug.cgi?id=216373 <rdar://problem/68645704> Reviewed by Darin Adler. Use a local variable to avoid awkward #if ENABLE() macro placement. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::swServerForSession): 2020-09-10 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove the build warning below since r266885. warning: redundant move in return statement [-Wredundant-move] Because return statement already returns rvalue reference, we don't need WTFMove at return. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::getSessionPermissions): 2020-09-10 Ben Nham <nham@apple.com> Disable hardware JPEG decoding on x86 Mac https://bugs.webkit.org/show_bug.cgi?id=216377 Reviewed by Geoff Garen. In Big Sur, ImageIO uses hardware JPEG decoding automatically for certain JPEGs. This caused a small regression in our battery life benchmark since the one-time setup cost for the decoder (~20-30 ms per process) was higher than the per-decode win we got from the HW decoder. For now, we're reverting to the Catalina behavior of not using hardware JPEG on x86 Macs by calling a MediaToolbox SPI. (The tradeoffs for Apple Silicon are different so we use ImageIO's default heuristics on that architecture.) We plan to revisit this decision once we move to a GPUProcess world. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-09-10 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r266842 and r266883. Causes some assertions to be hit in debug builds Reverted changesets: "Some WebAudio tests give different output on different machines" https://bugs.webkit.org/show_bug.cgi?id=216371 https://trac.webkit.org/changeset/266842 "Unreviewed Windows build fix after r266842." https://trac.webkit.org/changeset/266883 2020-09-09 Brian Burg <bburg@apple.com> Web Inspector: _WKInspectorDelegate should be attached to _WKInspector not WKWebView https://bugs.webkit.org/show_bug.cgi?id=215961 Reviewed by Devin Rousso. Move _WKInspectorDelegate to be a property of _WKInspector. If there is no _WKInspector available (i.e. for iOS), the delegate cannot be set. As part of this change, move -didAttachLocalInspector: back to UIDelegatePrivate. This delegate method is called just as the inspector is shown, so there would be no way to act upon this message if it were part of _WKInspectorDelegate. Now, -didAttachLocalInspector: is the designated time to attach _WKInspectorDelegate. Covered by existing API tests. * UIProcess/API/APIInspectorClient.h: (API::InspectorClient::browserDomainEnabled): (API::InspectorClient::browserDomainDisabled): (API::InspectorClient::didAttachLocalInspector): Deleted. * UIProcess/API/APIUIClient.h: (API::UIClient::didAttachLocalInspector): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView _inspectorDelegate]): Deleted. (-[WKWebView _setInspectorDelegate:]): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/_WKInspector.h: * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector dealloc]): Added. (-[_WKInspector delegate]): Added. (-[_WKInspector setDelegate:]): Added. Since _WKInspector/WebInspectorProxy is always created internally instead of via ObjC initializer, we need to initialize ivars before using them, as there is no other place for them to be initialized. * UIProcess/API/Cocoa/_WKInspectorDelegate.h: * UIProcess/API/Cocoa/_WKInspectorInternal.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::didAttachLocalInspector): * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp: (WebKit::InspectorBrowserAgent::enable): (WebKit::InspectorBrowserAgent::disable): * UIProcess/Inspector/Cocoa/InspectorDelegate.h: * UIProcess/Inspector/Cocoa/InspectorDelegate.mm: (WebKit::InspectorDelegate::InspectorDelegate): (WebKit::InspectorDelegate::setDelegate): (WebKit::InspectorDelegate::InspectorClient::browserDomainEnabled): (WebKit::InspectorDelegate::InspectorClient::browserDomainDisabled): (WebKit::InspectorDelegate::InspectorClient::didAttachLocalInspector): Deleted. * UIProcess/Inspector/WebInspectorProxy.h: (WebKit::WebInspectorProxy::inspectorClient): * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::WebInspectorProxy): (WebKit::WebInspectorProxy::setInspectorClient): (WebKit::WebInspectorProxy::openLocalInspectorFrontend): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::inspectorClient): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::WebPageProxy): (WebKit::WebPageProxy::setInspectorClient): Deleted. Similar to the Cocoa SPI, move InspectorClient from WebPageProxy to WebInspectorProxy. 2020-09-10 Devin Rousso <drousso@apple.com> Web Inspector: modernize generated backend protocol code https://bugs.webkit.org/show_bug.cgi?id=216302 <rdar://problem/68547649> Reviewed by Brian Burg. Previously, the inspector protocol was expressed in code in a somewhat confusing way: - the error string was the first argument - required parameters were `T` or `const T&` - optional parameters were `const T*` - enum parameters were the underlying type requiring the backend dispatcher handler to process it instead of it being preprocessed - required returns were `T&` - optional returns were `T*` This doesn't really make for easy/obvious reading of code since the order of arguments is not weird (e.g. error string first), and that there are references/pointers to primitive types. This patch cleans up the generated inspector protocol code to be: - required parameters are `T` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<T>&&` - enum parameters are preprocessed and passed to the backend dispatcher handler if valid - synchronous commands return `Expected<X, ErrorString>` using the same types/rules above where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<String>`. Also use `Protocol` objects/`typedefs` wherever possible to further relate the protocol JSON and the actual backend dispatcher handler implementation. * UIProcess/Automation/Automation.json: `CoordinateSystem` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` enum value now that enums are processed before being passed to backend dispacher handlers to preserve functionality. * UIProcess/Inspector/Agents/InspectorBrowserAgent.h: * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp: * UIProcess/Automation/WebAutomationSessionMacros.h: * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/WebAutomationSession.cpp: * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Elided backend dispatcher handler changes describe above. * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::setTargetList): `JSON` classes now use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently known to exist. 2020-09-10 Chris Dumez <cdumez@apple.com> Unreviewed Windows build fix after r266842. * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::setHardwareSampleRateOverride): 2020-09-10 Sihui Liu <sihui_liu@apple.com> REGRESSION(r266634): [macOS release] 4 layout tests became flaky failures https://bugs.webkit.org/show_bug.cgi?id=216275 <rdar://problem/68515242> Reviewed by Tim Horton. After r266634, activity state changes caused by adding/removing view will not be dispatched to web process until transaction is committed in UI process. To make sure web process picks up the changes, we need to invoke the callbacks after activity state changes are dispatched. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _doAfterActivityStateUpdate:]): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addActivityStateUpdateCompletionHandler): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchActivityStateChange): * UIProcess/WebPageProxy.h: 2020-09-10 Chris Dumez <cdumez@apple.com> Some WebAudio tests give different output on different machines https://bugs.webkit.org/show_bug.cgi?id=216371 Reviewed by Alex Christensen. Add InjectedBundle SPI to set the hardware sample rate. * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleSetHardwareSampleRateOverride): * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::setHardwareSampleRateOverride): * WebProcess/InjectedBundle/InjectedBundle.h: 2020-09-10 Sihui Liu <sihui_liu@apple.com> REGRESSION(r266634): fast/animation/request-animation-frame-throttling-lowPowerMode.html is flaky https://bugs.webkit.org/show_bug.cgi?id=216261 <rdar://problem/68513429> Reviewed by Tim Horton. r266634 makes a behavior change that when there is an activity state change, TiledCoreAnimationDrawingArea schedules a rendering update. This breaks timed rendering update from ScriptedAnimationController in the test. If rendering update happens before timer fires, the callback of ScriptedAnimationController will be invoked earlier than expected, thus more callbacks executed in the same time frame. To fix this, let's only schedule rendering update when we need to handle activity state change callbacks, as before r266634, where we don't schedule activity state timer if there is no callback. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange): 2020-09-10 Tim Horton <timothy_horton@apple.com> Upstream additional linked-on-or-after version checks https://bugs.webkit.org/show_bug.cgi?id=216365 Reviewed by Sam Weinig. * UIProcess/Cocoa/VersionChecks.h: 2020-09-10 Adrian Perez de Castro <aperez@igalia.com> [CMake] Use imported targets in find module for libseccomp https://bugs.webkit.org/show_bug.cgi?id=216329 Reviewed by Don Olmstead. * PlatformGTK.cmake: Remove unneeded usage of LIBSECCOMP_INCLUDE_DIRS. * PlatformWPE.cmake: Take the Libseccomp::Libseccomp imported target into use. 2020-09-10 Aditya Keerthi <akeerthi@apple.com> [macOS] Add editability to input type=datetime-local https://bugs.webkit.org/show_bug.cgi?id=216311 Reviewed by Devin Rousso. * UIProcess/mac/WebDateTimePickerMac.mm: (-[WKDateTimePicker initWithParams:inView:]): Move initialization that relies on DateTimeChooserParameters to updatePicker: to reduce code duplication. (-[WKDateTimePicker updatePicker:]): (-[WKDateTimePicker dateFormatStringForType:value:]): datetime-local inputs can have three different formats. The default contains hour and minute fields, but second and millisecond fields may also be present. Update this method to return the appropriate format string based on the current value of the input. (-[WKDateTimePicker initialDateForEmptyValue]): The initial value displayed on the picker when the input's value is empty should match the user's system time. Since the date picker maintains UTC time, return [NSDate date] with an appropriate offset. 2020-09-10 Kate Cheney <katherine_cheney@apple.com> Clean up App-Bound Domains code to only compile for iOS with its own macro https://bugs.webkit.org/show_bug.cgi?id=215027 <rdar://problem/63688232> Reviewed by Darin Adler. App-bound domains code should only be compiled on iOS, so this patch adds additional '#if ENABLE()' checks to ensure that. Additionally, for clarity this patch creates a new APP_BOUND_DOMAINS macro and replaces existing IOS_FAMILY checks for App-Bound Domains code with this new macro. LoadParameters, PolicyDecision and WKPreferences will be in another patch, this one is huge already. No new tests, behavior should not change so testing is covered by all existing App-Bound Domains layout and API tests. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::swServerForSession): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.h: * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::NetworkSessionCocoa::sessionWrapperForTask): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::filterAppBoundCookies): * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::ignoresAppBoundDomains const): (API::PageConfiguration::setIgnoresAppBoundDomains): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreHasAppBoundSession): (WKWebsiteDataStoreSetAppBoundDomainsForTesting): (WKWebsiteDataStoreClearAppBoundSession): (WKWebsiteDataStoreReinitializeAppBoundDomains): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _isNavigatingToAppBoundDomain:]): Deleted. (-[WKWebView _isForcedIntoAppBoundMode:]): Deleted. Moved to WKWebViewIOS. * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration limitsNavigationsToAppBoundDomains]): (-[WKWebViewConfiguration setLimitsNavigationsToAppBoundDomains:]): (-[WKWebViewConfiguration _ignoresAppBoundDomains]): (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Moved App-Bound Domain functions to the part of the file that only compiles on iOS and removed macos tags for WK_API_AVAILABLE, because both the API and SPI are iOS only. * UIProcess/API/Cocoa/WKWebViewPrivate.h: Moved App-Bound Domain functions to the part of the file that only compiles on iOS. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _appBoundDomains:]): (-[WKWebsiteDataStore _appBoundSchemes:]): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _isNavigatingToAppBoundDomain:]): (-[WKWebView _isForcedIntoAppBoundMode:]): Moved these from WKWebView. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getAppBoundDomains): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadData): (WebKit::shouldTreatURLProtocolAsAppBound): (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess): (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride): (WebKit::WebPageProxy::preconnectTo): Now that m_isNavigatingToAppBoundDomain is iOS only, I changed WebPageProxy::preconnectTo to call the isNavigatingToAppBoundDomain() function, which is available on all platforms but returns WTF::nullopt unless the platform is iOS. (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isNavigatingToAppBoundDomain const): isNavigatingToAppBoundDomain() is used very frequently, it is cleaner to have two functions -- one for iOS which returns the actual value and one for non-iOS platforms which returns WTF::nullopt -- rather than have #if ENABLE(APP_BOUND_DOMAIN) checks everywhere. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::download): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::appBoundDomainQueue): (WebKit::WebsiteDataStore::platformInitialize): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): (WebKit::WebsiteDataStore::renameOriginInWebsiteData): * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): (WebKit::WebLoaderStrategy::loadResourceSynchronously): (WebKit::WebLoaderStrategy::startPingLoad): (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::sendH2Ping): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebPage/WebFrame.cpp: * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::loadRequest): (WebKit::WebPage::loadDataImpl): (WebKit::WebPage::didReceivePolicyDecision): (WebKit::WebPage::runJavaScript): (WebKit::WebPage::updatePreferences): Only check for the m_limitsNavigationsToAppBoundDomains flag if the platform is iOS. Otherwise it should always be false, because it will never be enabled on a non-iOS platform. * WebProcess/WebPage/WebPage.h: 2020-09-09 Tim Horton <timothy_horton@apple.com> macCatalyst: Form controls behave strangely (like iPhone) in macOS-idiom apps https://bugs.webkit.org/show_bug.cgi?id=216326 Reviewed by Wenson Hsieh. * Shared/UserInterfaceIdiom.h: * Shared/UserInterfaceIdiom.mm: (WebKit::userInterfaceIdiomIsPad): (WebKit::currentUserInterfaceIdiomIsPadOrMac): (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac): (WebKit::currentUserInterfaceIdiomIsPad): Deleted. (WebKit::setCurrentUserInterfaceIdiomIsPad): Deleted. * Shared/ios/WebPreferencesDefaultValuesIOS.mm: (WebKit::defaultTextAutosizingUsesIdempotentMode): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/ios/SmartMagnificationController.mm: (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKFormInputSession setAccessoryViewCustomButtonTitle:]): (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): (-[WKContentView _zoomToRevealFocusedElement]): (-[WKContentView requiresAccessoryView]): (-[WKContentView _updateAccessory]): (shouldShowKeyboardForElement): (-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]): * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (WebKit::WebDataListSuggestionsDropdownIOS::show): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingSupported): * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: (-[WKAirPlayRoutePicker show:fromRect:]): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]): * UIProcess/ios/forms/WKFormColorControl.mm: (-[WKFormColorControl initWithView:]): * UIProcess/ios/forms/WKFormColorPicker.mm: (-[WKColorPicker initWithView:inPopover:]): (-[WKColorPicker drawSelectionIndicatorForColorButton:]): * UIProcess/ios/forms/WKFormSelectControl.mm: (-[WKFormSelectControl initWithView:]): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Rename currentUserInterfaceIdiomIsPad to currentUserInterfaceIdiomIsPadOrMac, and force it to YES on macCatalyst since internally we use it to distinguish between iPhone and iPad behavior, and (for our behaviors, at least) macCatalyst should always follow iPad. We should clean this up, and make all callers make their iPhone vs. iPad vs. macOS decisions more explicit. 2020-09-09 Wenson Hsieh <wenson_hsieh@apple.com> Text copied and pasted from Mac Catalyst apps appears larger than expected https://bugs.webkit.org/show_bug.cgi?id=215971 <rdar://problem/65768907> Reviewed by Tim Horton. Various pieces of platform logic in Mac Catalyst depend on the user interface idiom (i.e. Mac or iPad) of the app, as well as the application-wide "scale factor". In the context of this bug, NSAttributedString to RTF data conversion methods in `UIFoundation` consult the scale factor of `UIiOSMacIdiomManager` to determine whether to emit 0 (standard) or 1 (iOS) for the `\cocoatextscaling` attribute. The fact that the web process' scale factor may be out of sync with the UI process' scale factor leads to copied RTF data in the web process appearing either larger or smaller than expected, due to an incorrect `NSTextScalingType` value. To mitigate this (as well as any other issues), we add a mechanism for the UI process to forward the global scale factor and user interface idiom to the web process inside of the web process creation parameters, and then use new UIKit SPI to override the scale factor and idiom within the web process. * Scripts/process-entitlements.sh: Add a new entitlement needed to use `_UIApplicationCatalystRequestViewServiceIdiomAndScaleFactor`. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Use `_UIApplicationCatalystUserInterfaceIdiom` and `_UIApplicationCatalystScaleFactor` to grab the global user interface idiom and scale factor, respectively. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Override the idiom and scale factor in the web process with the idiom and scale factor from the UI process, using the new SPI `_UIApplicationCatalystRequestViewServiceIdiomAndScaleFactor`. As this function hasn't landed yet, we soft link the function for now to avoid causing the web process to instantly crash on any builds without the fix for <rdar://problem/68524148>. 2020-09-09 Brady Eidson <beidson@apple.com> Make sure WKWebsiteDataStore operations reuse existing process pools even when all WKWebViews have closed. <rdar://problem/62978295> and https://bugs.webkit.org/show_bug.cgi?id=216317 Reviewed by Geoffrey Garen. Covered by new API test. When WebsiteDataStores are gathering all the NetworkProcesses they might need to message, they miss some obvious candidates if there are no longer any related WKWebViews. Fix that by tracking which sessions a NetworkProcess knows about. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::addSession): (WebKit::NetworkProcessProxy::hasSession const): (WebKit::NetworkProcessProxy::removeSession): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::isAssociatedProcessPool const): 2020-09-09 Chris Dumez <cdumez@apple.com> Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess https://bugs.webkit.org/show_bug.cgi?id=216195 Reviewed by Simon Fraser. Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess, now that the DisplayLink has been moved to the UIProcess due to sandboxing. After a DisplayLink no longer has any clients, we keep it firing up to 20 times without any clients in case a new client gets added shortly after. The idea was to avoid killing and respawning too many threads when adding and removing clients in quick succession. However, now that the DisplayLink lives in the UIProcess side and sends IPC to the WebProcesses every time it fires, it makes a lot more sense to implement this logic in the UIProcess side, to avoid sending unnecessary IPC to processes that do not care about it. * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::addObserver): (WebKit::DisplayLink::removeObserver): (WebKit::DisplayLink::removeObservers): (WebKit::DisplayLink::displayLinkCallback): (WebKit::DisplayLink::hasObservers const): Deleted. * UIProcess/mac/DisplayLink.h: 2020-09-08 Chris Dumez <cdumez@apple.com> Regression(r260614) Power usage has increased due to extra thread hopping https://bugs.webkit.org/show_bug.cgi?id=216296 <rdar://problem/67719299> Reviewed by Simon Fraser. Power usage has increased after r260614 due to extra thread hopping. To recover, we now process the DisplayWasRefreshed IPC to a background queue if there is scrolling going on and responsiveness is thus critical. In the common case, where the user is not scrolling, we keep processing the IPC on the main thread, like before r260614. This avoids extra thread hopping and saves power. * UIProcess/WebPageProxy.cpp: (WebKit::ScrollingObserver::willSendWheelEvent): (WebKit::ScrollingObserver::ScrollingObserver): (WebKit::ScrollingObserver::singleton): (WebKit::WebPageProxy::sendWheelEvent): * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::displayLinkCallback): * UIProcess/mac/DisplayLink.h: (WebKit::DisplayLink::setShouldSendIPCOnBackgroundQueue): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::notifyScrollingTreesDisplayWasRefreshed): (WebKit::EventDispatcher::displayWasRefreshed): * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::displayWasRefreshed): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-09-08 Megan Gardner <megan_gardner@apple.com> Removed unneeded respondsToSelector checks on UIWKTextInteractionAssistant in WKContentViewInteraction. https://bugs.webkit.org/show_bug.cgi?id=216204 Reviewed by Wenson Hsieh. Over the years, we have had many selection and text interaction assistants, that may not have all responded to the selectors we expect them to. This has left many respondsToSelector checks around that should be removed, as they are unnecessary and an unneeded performance hit. No behavior change, covered by existing tests. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _willStartScrollingOrZooming]): (-[WKContentView _didEndScrollingOrZooming]): 2020-09-08 Lauro Moura <lmoura@igalia.com> NetworkProcess: Check for invalid handle before writing salt file https://bugs.webkit.org/show_bug.cgi?id=216285 Reviewed by Sihui Liu. Covered by existing tests. Fixes crashes in GTK/WPE after r266742. * NetworkProcess/cache/NetworkCacheData.cpp: (WebKit::NetworkCache::readOrMakeSalt): 2020-09-08 Brady Eidson <beidson@apple.com> Crashtracer inside PDFPlugin::createScrollbar. <rdar://problem/68474062> and https://bugs.webkit.org/show_bug.cgi?id=216286 Reviewed by Tim Horton. To quote Tim from r264945: No new tests; timing is such that I can't reproduce without inserting intentional delays into the main thread hops, which is further than I'm willing to go for a test. This is a speculative fix due to the aforementioned reproducibility issue. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): Plugin hasn't been destroyed, and there's still a PluginView, but the PluginView isn't in a frame. So null check that. 2020-09-08 Alex Christensen <achristensen@webkit.org> Null check m_layerHostingContext in TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded https://bugs.webkit.org/show_bug.cgi?id=216282 <rdar://problem/64933878> Reviewed by Tim Horton. There's no reason to dereference null here. Let's not crash. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded): 2020-09-08 Youenn Fablet <youenn@apple.com> Tighten checks when creating an audio buffer list https://bugs.webkit.org/show_bug.cgi?id=216237 <rdar://problem/68271376> Reviewed by Geoffrey Garen. Add message checks to verify that no message integer overflows happen when processing audio buffer list messages. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::audioTrackRendererManager): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::RemoteAudioMediaStreamTrackRenderer): (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesAvailable): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: (WebKit::RemoteAudioMediaStreamTrackRendererManager::RemoteAudioMediaStreamTrackRendererManager): (WebKit::RemoteAudioMediaStreamTrackRendererManager::createRenderer): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): (WebKit::RemoteMediaRecorder::audioSamplesAvailable): * GPUProcess/webrtc/RemoteMediaRecorder.h: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable): 2020-09-08 Tim Horton <timothy_horton@apple.com> iOS: <attachment>'s QuickLook thumbnails can appear squished https://bugs.webkit.org/show_bug.cgi?id=216209 <rdar://problem/67817706> Reviewed by Wenson Hsieh. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::convertPlatformImageToBitmap): Propagate an image of the same aspect ratio that QuickLook provided, instead of squishing it to square. * UIProcess/QuickLookThumbnailLoader.mm: (-[WKQLThumbnailLoadOperation start]): Only request full thumbnails; we do not want the icon form, since <attachment> already has one without QuickLook's help; if we can't get a full thumbnail, we'll just leave it alone. 2020-09-08 Sihui Liu <sihui_liu@apple.com> Remove storage WorkQueue in NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=216199 Reviewed by Youenn Fablet. The only meaningful usage of this WorkQueue is iterating IndexedDB directories and collecting origins, while there can be some IDB thread accessing the same directories. To remove the race, Let's just drop this WorkQueue and fetch origins via WebIDBServer. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::getOrigins): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::addSessionStorageQuotaManager): (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): (WebKit::NetworkProcess::addIndexedDatabaseSession): (WebKit::NetworkProcess::addServiceWorkerSession): (WebKit::NetworkProcess::ensurePathExists): Deleted. (WebKit::NetworkProcess::postStorageTask): Deleted. (WebKit::NetworkProcess::performNextStorageTask): Deleted. (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion): Deleted. (WebKit::NetworkProcess::indexedDatabaseOrigins): Deleted. * NetworkProcess/NetworkProcess.h: 2020-09-08 Peng Liu <peng.liu6@apple.com> Clean up functions and state variables related to the picture-in-picture implementation https://bugs.webkit.org/show_bug.cgi?id=215972 Reviewed by Jer Noble. This patch adds an optional FloatSize parameter to the VideoFullscreenManager::DidEnterFullscreen message. Also, it enables the picture-in-picture and fullscreen events when a video element enters picture-in-picture from the fullscreen mode. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::didEnterFullscreen): (WebKit::VideoFullscreenModelContext::prepareToExitFullscreen): (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::willExitPictureInPicture): (WebKit::VideoFullscreenModelContext::didExitPictureInPicture): (WebKit::VideoFullscreenManagerProxy::ensureClientForContext): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::didEnterFullscreen): Use ensureClientForContext() instead of addClientForContext() in setupFullscreenWithID() to avoid leaking VideoFullscreenInterfaceAVKit instances. Iterate a copy of the HashSet of VideoFullscreenModelClient pointers because a callback may remove the client itself during the iteration. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController prepareToExitPictureInPicture]): * UIProcess/mac/WKFullScreenWindowController.h: * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController didExitPictureInPicture]): Fix leaking of VideoFullscreenInterfaceMac. * WebProcess/cocoa/VideoFullscreenManager.h: * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::fullscreenModeChanged): We need to change the fullscreen mode in the VideoFullscreenInterfaceContext instance as well. (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Call didExitFullscreenOrPictureInPicture() instead of didStopBeingFullscreenElement(), which is for the FullscreenManager. 2020-09-08 Mike Gorse <mgorse@suse.com> [GTK] AcceleratedBackingStoreWayland might erroneously try to use SHM with older wpebackend-fdo https://bugs.webkit.org/show_bug.cgi?id=216254 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::tryInitializeSHM): Return false for wpebackend-fdo < 1.7.0. 2020-09-08 Pablo Saavedra <psaavedra@igalia.com> [GLIB] RemoteInspectorServer is not started if WebKitWebContext is not created already created https://bugs.webkit.org/show_bug.cgi?id=216120 Reviewed by Carlos Garcia Campos. Added a WebKit/UIProcess/API/glib/WebKitInitialize what implements its own webkitInitialize() to ensure the inspector server is initialized as early as possible, before other api calls that would depend on the inspector server being running. The RemoteInspectorServer initialization is not longer asociated to the initialization of the WebProcessPoolGLib. The webkitInitialize() extends the shared InitializeWebKit2(); and also includes the initialization of the RemoteInspectorServer so the initialization of the remote inspector server can be now triggered by the initialization of many other API objects too: WebKitInputMethodContext, WebKitSettings, WebKitUserContentManager, WebKitWebContext, WebKitWebsiteDataManager, WebKitUserContentFilterStore, WebKitWebViewBase. * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/API/glib/WebKitInitialize.cpp: Added. (WebKit::initializeRemoteInspectorServer): (WebKit::webkitInitialize): * UIProcess/API/glib/WebKitInitialize.h: Added. * UIProcess/API/glib/WebKitInputMethodContext.cpp: (webkit_input_method_context_class_init): * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_class_init): * UIProcess/API/glib/WebKitUserContentFilterStore.cpp: (webkit_user_content_filter_store_class_init): * UIProcess/API/glib/WebKitUserContentManager.cpp: * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_class_init): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkit_website_data_manager_class_init): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkit_web_view_base_class_init): * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitialize): (WebKit::initializeRemoteInspectorServer): Deleted. 2020-09-07 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r266645. https://bugs.webkit.org/show_bug.cgi?id=216251 Caused MotionMark regression Reverted changeset: "Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess" https://bugs.webkit.org/show_bug.cgi?id=216195 https://trac.webkit.org/changeset/266645 2020-09-07 Mike Gorse <mgorse@suse.com> Build failure; cannot find seccomp.h https://bugs.webkit.org/show_bug.cgi?id=216226 Reviewed by Darin Adler. No new tests (build fix only). * PlatformGTK.cmake: Add LIBSECCOMP_INCLUDE_DIRS to WebKit_SYSTEM_INCLUDE_DIRECTORIES. 2020-09-05 Wenson Hsieh <wenson_hsieh@apple.com> [MotionMark] RenderLayer::paintLayerContents spends ~5% of the time in MonotonicTime::now() in Multiply https://bugs.webkit.org/show_bug.cgi?id=216190 Reviewed by Darin Adler. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::timestampForPaintFrequencyTracking const): In WebKit2, we can assume (with the exception of SVG pages) that we must've performed a rendering update prior to tracking painting frequencies. As such, we can use the page's rendering update timestamp instead of the real current time (`MonotonicTime::now()`). Note that in WebKit1, it is possible for any client to force a synchronous paint of the page before the page has performed a rendering update, which triggers assertions in `SinglePaintFrequencyTracking::end()`. As such, we stick with `MonotonicTime::now()` in WebKit1. * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-09-05 Sam Weinig <weinig@apple.com> [WebIDL] Realign our IDL extended attribute names with those specified in WebIDL https://bugs.webkit.org/show_bug.cgi?id=216194 Reviewed by Darin Adler. * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp: (WebKit::InjectedBundleScriptWorld::disableOverrideBuiltinsBehavior): Update for new name WebCore::DOMWrapperWorld. 2020-09-04 Alex Christensen <achristensen@webkit.org> Move PDF heads-up display to UI process on macOS https://bugs.webkit.org/show_bug.cgi?id=215780 <rdar://problem/58715847> Reviewed by Tim Horton. This has many benefits including the one in the radar, testability, and moving WebKit-specific code from PDFKit to WebKit. Now that the HUD is displayed in the UI process instead of in the web content, zooming in keeps the HUD the same size. A 3d-transformed iframe with a PDF in it now shows the HUD in the place you can click on it, instead of in the transformed PDF. Also, moving the mouse to the HUD within the first 3 seconds prevents it from hiding, which it does when the mouse leaves the HUD. The rest of the behavior I think should be the same. Most users should not notice any difference. Functionality covered by API tests, the first tests for PDF content interaction! * Scripts/webkit/messages.py: * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/mac/WKView.mm: (-[WKView _createPDFHUD:rect:]): (-[WKView _pdfHUD:changedLocation:]): (-[WKView _removePDFHUD:]): (-[WKView _removeAllPDFHUDs]): * UIProcess/API/mac/WKWebViewMac.mm: (-[WKWebView mouseMoved:]): (-[WKWebView mouseDown:]): (-[WKWebView mouseUp:]): (-[WKWebView _createPDFHUD:rect:]): (-[WKWebView _pdfHUD:changedLocation:]): (-[WKWebView _removePDFHUD:]): (-[WKWebView _removeAllPDFHUDs]): * UIProcess/API/mac/WKWebViewPrivateForTestingMac.h: * UIProcess/API/mac/WKWebViewTestingMac.mm: (-[WKWebView pdfHUDs]): * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::createPDFHUD): (WebKit::WebViewImpl::updatePDFHUDLocation): (WebKit::WebViewImpl::removePDFHUD): (WebKit::WebViewImpl::removeAllPDFHUDs): * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::processDidTerminate): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): Deleted. (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): Deleted. * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::createPDFHUD): (WebKit::PageClientImpl::updatePDFHUDLocation): (WebKit::PageClientImpl::removePDFHUD): (WebKit::PageClientImpl::removeAllPDFHUDs): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::createPDFHUD): (WebKit::WebPageProxy::removePDFHUD): (WebKit::WebPageProxy::updatePDFHUDLocation): (WebKit::WebPageProxy::pdfZoomIn): (WebKit::WebPageProxy::pdfZoomOut): (WebKit::WebPageProxy::pdfSaveToPDF): (WebKit::WebPageProxy::pdfOpenWithPreview): * WebKit.xcodeproj/project.pbxproj: * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (-[WKPDFLayerControllerDelegate openWithNativeApplication]): (-[WKPDFLayerControllerDelegate saveToPDF]): (WebKit::PDFPlugin::PDFPlugin): (WebKit::PDFPlugin::~PDFPlugin): (WebKit::PDFPlugin::frameForHUD const): (WebKit::PDFPlugin::calculateSizes): (WebKit::PDFPlugin::convertFromPDFViewToRootView const): (WebKit::PDFPlugin::visibilityDidChange): (WebKit::PDFPlugin::zoomIn): (WebKit::PDFPlugin::zoomOut): (WebKit::PDFPlugin::save): (WebKit::PDFPlugin::openWithPreview): * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::zoomPDFIn): (WebKit::WebPage::zoomPDFOut): (WebKit::WebPage::savePDF): (WebKit::WebPage::openPDFWithPreview): (WebKit::WebPage::createPDFHUD): (WebKit::WebPage::updatePDFHUDLocation): (WebKit::WebPage::removePDFHUD): 2020-09-04 Chris Dumez <cdumez@apple.com> handleXPCEndpointMessages does not check XPC object is an xpc_endpoint_t https://bugs.webkit.org/show_bug.cgi?id=216196 <rdar://problem/68198293> Reviewed by Per Arne Vollan. Add a check to have sure the XPC object is indeed an xpc_endpoint_t before using it. * WebProcess/cocoa/HandleXPCEndpointMessages.mm: (WebKit::handleXPCEndpointMessages): 2020-09-04 Chris Dumez <cdumez@apple.com> Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess https://bugs.webkit.org/show_bug.cgi?id=216195 Reviewed by Simon Fraser. Move lazy DisplayLink tear down logic from the WebProcess to the UIProcess, now that the DisplayLink has been moved to the UIProcess due to sandboxing. After a DisplayLink no longer has any clients, we keep it firing up to 20 times without any clients in case a new client gets added shortly after. The idea was to avoid killing and respawning too many threads when adding and removing clients in quick succession. However, now that the DisplayLink lives in the UIProcess side and sends IPC to the WebProcesses every time it fires, it makes a lot more sense to implement this logic in the UIProcess side, to avoid sending unnecessary IPC to processes that do not care about it. * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::addObserver): (WebKit::DisplayLink::removeObserver): (WebKit::DisplayLink::removeObservers): (WebKit::DisplayLink::displayLinkCallback): (WebKit::DisplayLink::hasObservers const): Deleted. * UIProcess/mac/DisplayLink.h: 2020-09-04 Sihui Liu <sihui_liu@apple.com> Webpages flash when switching between windows https://bugs.webkit.org/show_bug.cgi?id=216012 Reviewed by Tim Horton. Based on patches from Tim Horton. To avoid flash, we need to make sure view to be selected updates its content before UI process commits its transaction. We did this by making UI process block until receiving a reply DidUpdateActivityState from web process. However, web process did not make sure the reply would be sent after normal rendering update and corresponding transasction commit. Instead, it flushed transactions in progress and replied. To fix this, now we make web process reply in transaction commit handler after rendering update, if there is an active transaction. In the switching case, view to be unselected will detach from root layer in its web process, which makes its content empty. This change is independent from the UI process commit, so we want this to happen after UI process commits (which submits the view hierachy change). Otherwise, empty content(white flash) on the unselected view will be displayed. To fix this, we let UI process send the activity state change message in transaction commit handler, if there is an active transaction. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::scheduleActivityStateUpdate): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setSuppressVisibilityUpdates): (WebKit::WebPageProxy::activityStateDidChange): (WebKit::WebPageProxy::dispatchActivityStateChange): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRendering): (WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacks): (WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacksIfNeeded): (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange): (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired): Deleted. 2020-09-04 Per Arne Vollan <pvollan@apple.com> [macOS] Add client decoder entitlement https://bugs.webkit.org/show_bug.cgi?id=216175 <rdar://problem/67532128> Reviewed by Brent Fulgham. Add client decoder entitlement in the WebContent process on macOS. * Scripts/process-entitlements.sh: 2020-09-04 Youenn Fablet <youenn@apple.com> MediaRecorder timeslice parameter causing internal error on longer videos https://bugs.webkit.org/show_bug.cgi?id=216076 <rdar://problem/68209422> Reviewed by Eric Carlson. Test: http/wpt/fetch/blob-range.html * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::readData): readData can be re-entrant so we need to reset m_currentItemReadSize before consuming data. 2020-09-04 Aditya Keerthi <akeerthi@apple.com> REGRESSION (r241734): [iOS] Changing the value of a select element and tapping on another results in two changes https://bugs.webkit.org/show_bug.cgi?id=216077 Reviewed by Darin Adler. r241734 added a call to [self _endEditing] in [WKContentView _elementDidBlur] to ensure that any open form controls are dismissed when using the keyboard to change focus. [self _endEditing] calls [_inputPeripheral endEditing], which eventually calls [WKFormControl controlEndEditing]. However, if the focus is changed by tapping on another form control, a a gesture recognizer calls [_inputPeripheral endEditing]. Consequently, changing the focused element by tapping results in two calls to [WKFormControl controlEndEditing]. First from the gesture recognizer, and then from [WKContentView _elementDidBlur]. For certain form controls on iPhone, such as the select element, controlEndEditing is responsible for updating the element's value in the WebProcess. Note that the same is not true on iPad, as controlEndEditing simply dismisses a popover. Now, the first call to [WKSelectSinglePicker controlEndEditing] correctly updates the expected select element. However, when tapping on another select element, the second call to [WKSelectSinglePicker controlEndEditing] also attempts to update the value of the focused element. By this time, the focused element in the WebProcess is the second select element. Consequently, changing the value in one select element and then tapping another results in updates to both elements. To fix this issue, while preserving the intent of r241734, we should prevent callers from being able to end editing in a control twice. Note that WKFormPeripheralBase already keeps track of the editing state of a control in a boolean variable _editing. If the control has finished being edited, _editing is set to false. This patch adds an early return to [WKFormPeripheralBase endEditing] if _editing is false, ensuring controlEndEditing is never called twice. For parity, also ensure that controlBeginEditing can only be called if the control is not already being edited. Test: fast/forms/ios/select-picker-change-and-focus-another-select.html * UIProcess/ios/forms/WKFormPeripheralBase.mm: (-[WKFormPeripheralBase beginEditing]): Early return if control is already being edited. (-[WKFormPeripheralBase endEditing]): Early return if control is not being edited. 2020-09-04 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] UI process sometimes crashes under -[WKSharingServicePickerDelegate sharingService:didShareItems:] https://bugs.webkit.org/show_bug.cgi?id=216167 <rdar://problem/68287449> Reviewed by Anders Carlsson. It's not clear what causes the array of items in this delegate method to be empty, but we should at least be robust against this scenario and avoid crashing the application process. * UIProcess/mac/WKSharingServicePickerDelegate.mm: (-[WKSharingServicePickerDelegate sharingService:didShareItems:]): 2020-09-04 Kate Cheney <katherine_cheney@apple.com> WebProcessProxy::checkURLReceivedFromWebProcess() does not always need to check the back/forward list https://bugs.webkit.org/show_bug.cgi?id=216109 <rdar://problem/59867349> Reviewed by Brady Eidson. We should not need to check the back/forward list when setting a pasteboard URL because any valid pasteboard URL will be handled by one of the other if-statements in WebProcessProxy::checkURLReceivedFromWebProcess(), therefore checking again is a waste of time. This also hardens the process against potential abuse by preventing the possibility of an invalid URL in the back/forward list being saved in the pasteboard property list. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::setPasteboardURL): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess): * UIProcess/WebProcessProxy.h: 2020-09-03 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Unexpected User-Agent on redirect https://bugs.webkit.org/show_bug.cgi?id=191858 Reviewed by Youenn Fablet. Clear the user agent on new request after a redirect to ensure a new one is computed taking into account the quirks if needed. Also ensure quirks are applied for downloads started in the UI process. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Clear the user agent on new request. * UIProcess/API/glib/WebKitDownloadClient.cpp: * UIProcess/WebPageProxy.h: Add userAgentForURL(). * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::download): Use userAgentForURL() instead of userAgent(). * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebPageProxy::userAgentForURL): Implement it to apply quirks if needed. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::userAgentForURL): Just return the web page user agent. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::userAgentForURL): Ditto. * UIProcess/playstation/WebPageProxyPlayStation.cpp: (WebKit::WebPageProxy::userAgentForURL): Ditto. * UIProcess/win/WebPageProxyWin.cpp: (WebKit::WebPageProxy::userAgentForURL): Ditto. * UIProcess/wpe/WebPageProxyWPE.cpp: (WebKit::WebPageProxy::userAgentForURL): Ditto. 2020-09-02 Darin Adler <darin@apple.com> Remove EAffinity, UPSTREAM, DOWNSTREAM, SEL_DEFAULT_AFFINITY, and VisibleSelection::selectionType https://bugs.webkit.org/show_bug.cgi?id=216102 Reviewed by Sam Weinig. * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: (API::InjectedBundle::EditorClient::shouldChangeSelectedRange): Use Affinity. * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: (WebKit::toAPI): Dito. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Ditto. * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto. * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Ditto. * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto. * WebProcess/WebCoreSupport/WebEditorClient.h: Ditto. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::insertDictatedTextAsync): Rely on default affinity. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Ditto. (WebKit::WebPage::setCompositionAsync): Ditto. (WebKit::WebPage::deleteSurrounding): Ditto. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::didConcludeEditDrag): Use Affinity. (WebKit::WebPage::selectPositionAtBoundaryWithDirection): Ditto. (WebKit::WebPage::moveSelectionAtBoundaryWithDirection): Ditto. (WebKit::WebPage::selectTextWithGranularityAtPoint): Ditto. (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary): Ditto. (WebKit::WebPage::updateSelectionWithExtentPoint): Ditto. (WebKit::WebPage::replaceSelectedText): Ditto. (WebKit::WebPage::replaceDictatedText): Ditto. (WebKit::WebPage::applyAutocorrectionInternal): Ditto. (WebKit::WebPage::updateSelectionWithDelta): Ditto. 2020-09-02 John Wilander <wilander@apple.com> Remove custom domain from SameSite=strict jail protection https://bugs.webkit.org/show_bug.cgi?id=216083 <rdar://problem/68220223> Reviewed by Alex Christensen. No new tests. This was a site-specific opt-in rule. The feature itself has tests. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::shouldEnforceSameSiteStrictForSpecificDomain const): 2020-09-01 Darin Adler <darin@apple.com> Remove comparePositions and make VisiblePosition improvements https://bugs.webkit.org/show_bug.cgi?id=215982 Reviewed by Sam Weinig. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): Use <= instead of comparePositions. 2020-09-02 Timothy Horton <timothy_horton@apple.com> iPad + Trackpad: JW Library highlighting and edit menus don't appear https://bugs.webkit.org/show_bug.cgi?id=216086 Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (applicationIsKnownToIgnoreMouseEvents): Add JW Library to the list. 2020-09-02 Youenn Fablet <youenn@apple.com> Introduce a ThreadableWebSocketChannel identifier https://bugs.webkit.org/show_bug.cgi?id=216034 Reviewed by Alex Christensen. * NetworkProcess/NetworkConnectionToWebProcess.cpp: * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkSocketChannel.h: * NetworkProcess/NetworkSocketStream.h: * Scripts/webkit/messages.py: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::WebSocketChannel): * WebProcess/Network/WebSocketChannel.h: (WebKit::WebSocketChannel::identifier const): Deleted. * WebProcess/Network/WebSocketChannelManager.h: * WebProcess/Network/WebSocketIdentifier.h: Removed. * WebProcess/Network/WebSocketProvider.cpp: (WebKit::WebSocketProvider::createSocketStreamHandle): * WebProcess/Network/WebSocketProvider.h: * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::create): (WebKit::WebSocketStream::WebSocketStream): * WebProcess/Network/WebSocketStream.h: 2020-09-02 Aditya Keerthi <akeerthi@apple.com> [macOS] Update date picker when the inner control is edited https://bugs.webkit.org/show_bug.cgi?id=216004 Reviewed by Wenson Hsieh. * UIProcess/mac/WebDateTimePickerMac.mm: (WebKit::WebDateTimePickerMac::showDateTimePicker): If showDateTimePicker is called while a picker is already being displayed, call updatePicker: rather than showPicker:. (-[WKDateTimePicker initWithParams:inView:]): The NSDatePicker and NSDateFormatter should use a UTC timezone. This is necessary as all double values passed into WKDateTimePicker are UTC timestamps. This has no effect on the value returned to the WebProcess on user selection, as a timezone-agnostic format string is used. (-[WKDateTimePicker updatePicker:]): Set the date value of the owned NSDatePicker to the value in the DateTimeChooserParameters. 2020-09-01 Hector Lopez <hector_i_lopez@apple.com> Unreviewed, reverting r266408. Revision caused constant crashes on iOS and macOS Reverted changeset: "Convert runtime flag to setting for lazy image loading" https://bugs.webkit.org/show_bug.cgi?id=215610 https://trac.webkit.org/changeset/266408 2020-09-01 Kate Cheney <katherine_cheney@apple.com> Pass the correct data size for the SharedMemory::Handle in WebCompiledContentRuleListData::encode https://bugs.webkit.org/show_bug.cgi?id=216049 <rdar://problem/60758278> Reviewed by Alex Christensen. No new tests, validated by existing API tests. * Shared/WebCompiledContentRuleListData.cpp: (WebKit::WebCompiledContentRuleListData::encode const): 2020-09-01 Kate Cheney <katherine_cheney@apple.com> WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle() https://bugs.webkit.org/show_bug.cgi?id=211002 <rdar://problem/60103950> Reviewed by Wenson Hsieh. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::getPasteboardBufferForType): (WebKit::WebPasteboardProxy::readBufferFromPasteboard): Check result of SharedMemory::createHandle() and return early on failure. 2020-09-01 Hector Lopez <hector_i_lopez@apple.com> Unreviewed, reverting r266384. Revision is causing 5 API faliures/timeouts and build failures on macOS Reverted changeset: "Webpages flash when switching between windows" https://bugs.webkit.org/show_bug.cgi?id=216012 https://trac.webkit.org/changeset/266384 2020-09-01 Per Arne Vollan <pvollan@apple.com> [iOS] AGX compiler service sandbox violation https://bugs.webkit.org/show_bug.cgi?id=216042 <rdar://problem/68111667> Reviewed by Brent Fulgham. For a set of devices, mach-lookup sandbox violations have been observed for an AGX compiler service. For these devices, we currently issue an extension for one AGX compiler service, but this is not sufficient since there is a similar service name that needs to be added as well. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::agxCompilerServices): (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-09-01 Rob Buis <rbuis@igalia.com> Convert runtime flag to setting for lazy image loading https://bugs.webkit.org/show_bug.cgi?id=215610 Reviewed by Youenn Fablet. Remove lazy image loading runtime flag. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetLazyImageLoadingEnabled): Deleted. (WKPreferencesGetLazyImageLoadingEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: 2020-09-01 Tim Horton <timothy_horton@apple.com> Some apps linked beyond iOS 13.4 don't respect mouse events, only touch events https://bugs.webkit.org/show_bug.cgi?id=216021 <rdar://problem/64830335> Reviewed by Wenson Hsieh. * UIProcess/Cocoa/VersionChecks.h: * UIProcess/ios/WKContentViewInteraction.mm: (applicationIsKnownToIgnoreMouseEvents): (-[WKContentView shouldUseMouseGestureRecognizer]): Remove Feedly from the list, they are no longer affected. Add a once-per-app-launch error-level log message to warn developers of the impending behavior change. Add three new apps with a later linked-on target. 2020-09-01 Megan Gardner <megan_gardner@apple.com> Switch to class method for smart insert/delete https://bugs.webkit.org/show_bug.cgi?id=215871 <rdar://problem/67281776> Reviewed by Darin Adler. No process changes. Covered by existing tests. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/TextCheckerIOS.mm: (WebKit::TextChecker::isSmartInsertDeleteEnabled): 2020-09-01 Tim Horton <timothy_horton@apple.com> Upstream PencilKit text input support https://bugs.webkit.org/show_bug.cgi?id=216030 Reviewed by Anders Carlsson. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView _shouldSimulateKeyboardInputOnTextInsertion]): (-[WKContentView setUpScribbleInteraction]): (-[WKContentView cleanUpScribbleInteraction]): (-[WKContentView _textInputContextByScribbleIdentifier:]): (-[WKContentView _elementForTextInputContextIsFocused:]): (-[WKContentView indirectScribbleInteraction:requestElementsInRect:completion:]): (-[WKContentView indirectScribbleInteraction:isElementFocused:]): (-[WKContentView indirectScribbleInteraction:focusElementIfNeeded:referencePoint:completion:]): (-[WKContentView indirectScribbleInteraction:frameForElement:]): (-[WKContentView indirectScribbleInteraction:willBeginWritingInElement:]): (-[WKContentView indirectScribbleInteraction:didFinishWritingInElement:]): 2020-09-01 Alex Christensen <achristensen@webkit.org> Fix crash during WebPage constructor https://bugs.webkit.org/show_bug.cgi?id=216028 <rdar://problem/67781279> Reviewed by Timothy Hatcher. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::ensureNetworkProcessConnection): 2020-09-01 Youenn Fablet <youenn@apple.com> Enable inspection of WebSocket when opening Web Inspector in the middle of the connection like done for the legacy WebSocket implementation https://bugs.webkit.org/show_bug.cgi?id=215928 Reviewed by Devin Rousso. Implement inspector related API and add additional messages for WebSocket frames. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::close): (WebKit::WebSocketChannel::didClose): (WebKit::WebSocketChannel::didSendHandshakeRequest): (WebKit::WebSocketChannel::didReceiveHandshakeResponse): (WebKit::WebSocketChannel::clientHandshakeRequest const): (WebKit::WebSocketChannel::serverHandshakeResponse const): (WebKit::WebSocketChannel::handshakeMode const): * WebProcess/Network/WebSocketChannel.h: 2020-09-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Do not use the default WebsiteDataStore for downloads https://bugs.webkit.org/show_bug.cgi?id=216001 Reviewed by Adrian Perez de Castro. Use the web context one instead. * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextStartDownload): 2020-08-31 Sihui Liu <sihui_liu@apple.com> Webpages flash when switching between windows https://bugs.webkit.org/show_bug.cgi?id=216012 Reviewed by Darin Adler. Based on patches from Tim Horton. To avoid flash, we need to make sure view to be selected updates its content before UI process commits its transaction. We did this by making UI process block until receiving a reply DidUpdateActivityState from web process. However, web process did not make sure the reply would be sent after normal rendering update and corresponding transasction commit. Instead, it flushed transactions in progress and replied. To fix this, now we make web process reply in transaction commit handler after rendering update. In the switching case, view to be unselected will detach from root layer in its web process, which makes its content empty. This change is independent from the UI process commit, so we want this to happen after UI process commits (which submits the view hierachy change). Otherwise, empty content(white flash) on the unselected view will be displayed. To fix this, we let UI process send the activity state update message in transaction commit handler. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::scheduleActivityStateUpdate): * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::setSuppressVisibilityUpdates): (WebKit::WebPageProxy::activityStateDidChange): (WebKit::WebPageProxy::dispatchActivityStateChange): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacksIfNeeded): (WebKit::TiledCoreAnimationDrawingArea::updateRendering): (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange): (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired): Deleted. 2020-08-31 Tim Horton <timothy_horton@apple.com> Upstream support for image picker confirmation and downscaling https://bugs.webkit.org/show_bug.cgi?id=215997 Reviewed by Anders Carlsson. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showRunOpenPanel:frameInfo:resultListener:]): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): (-[WKFileUploadPanel _configureImagePicker:]): Deleted. 2020-08-31 Sam Weinig <weinig@apple.com> Many settings in RuntimeEnabledSettings should autogenerated Settings: Part 1 https://bugs.webkit.org/show_bug.cgi?id=215981 Reviewed by Darin Adler. This moves an initial chunk of RuntimeEnabledSettings settings to Settings.yaml, focusing on settings that don't require substantial refactoring or new features to work in Settings.yaml. In WebKit, this means mostly removing now unnecessary use of the webcoreBinding key in WebPreferences.yaml and removing now superfluous cases in InjectedBundle::overrideBoolPreferenceForTestRunner. * Shared/WebPreferences.yaml: Removing now unnecessary use of the webcoreBinding key and fix indentation of a few cases. * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Remove now superfluous cases, as each boolean Settings based setting gets handled automatically. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Remove explicit setting of setInteractiveFormValidationEnabled now that we don't have the RuntimeEnabledSettings variant being set by the generator. 2020-08-31 Hector Lopez <hector_i_lopez@apple.com> Unreviewed, reverting r266350. Revision is causing a constant crash on both macOS and iOS Reverted changeset: "Convert runtime flag to setting for lazy image loading" https://bugs.webkit.org/show_bug.cgi?id=215610 https://trac.webkit.org/changeset/266350 2020-08-31 Rob Buis <rbuis@igalia.com> Convert runtime flag to setting for lazy image loading https://bugs.webkit.org/show_bug.cgi?id=215610 Reviewed by Youenn Fablet. Remove lazy image loading runtime flag. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetLazyImageLoadingEnabled): Deleted. (WKPreferencesGetLazyImageLoadingEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: 2020-08-31 Youenn Fablet <youenn@apple.com> [Cocoa] Disable sniffing for WebSocket handshakes https://bugs.webkit.org/show_bug.cgi?id=215932 Reviewed by Darin Adler. Covered by http/tests/websocket/tests/hybi/handshake-error.html no longer timing out with NSURLSession WebSocket code path. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::createWebSocketTask): 2020-08-30 Tim Horton <timothy_horton@apple.com> Remove unused editable image code https://bugs.webkit.org/show_bug.cgi?id=215991 Reviewed by Simon Fraser. * DerivedSources.make: * Platform/spi/ios/PencilKitSPI.h: Removed. * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/FocusedElementInformation.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::drawInContext): * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties): (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const): (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode): * Shared/WebPreferences.yaml: * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setupPageConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _setEditableImagesEnabled:]): Deleted. (-[WKWebViewConfiguration _editableImagesEnabled]): Deleted. * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setupScrollAndContentViews]): (-[WKWebView _stylusTapGestureShouldCreateEditableImage]): Deleted. * UIProcess/PageClient.h: (WebKit::PageClient::createDrawingView): Deleted. * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: (WebKit::RemoteLayerTreeHost::layerWillBeRemoved): (WebKit::RemoteLayerTreeHost::clearLayers): (WebKit::RemoteLayerTreeHost::makeNode): * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: (WebKit::RemoteLayerTreeHost::makeNode): (WebKit::RemoteLayerTreeHost::createEmbeddedView): Deleted. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (-[WKEmbeddedView initWithEmbeddedViewID:]): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::willUpdateAttachmentAttributes): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::editableImageController): Deleted. * UIProcess/ios/EditableImageController.h: Removed. * UIProcess/ios/EditableImageController.messages.in: Removed. * UIProcess/ios/EditableImageController.mm: Removed. * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createDrawingView): Deleted. * UIProcess/ios/PencilKitSoftLink.h: Removed. * UIProcess/ios/PencilKitSoftLink.mm: Removed. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView gestureRecognizerShouldBegin:]): (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): (-[WKContentView _elementDidBlur]): (-[WKContentView _stylusSingleTapRecognized:]): Deleted. (-[WKContentView _drawingCoordinator]): Deleted. * UIProcess/ios/WKDrawingCoordinator.h: Removed. * UIProcess/ios/WKDrawingCoordinator.mm: Removed. * UIProcess/ios/WKDrawingView.h: Removed. * UIProcess/ios/WKDrawingView.mm: Removed. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::handleStylusSingleTapAtPoint): Deleted. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::associateEditableImageWithAttachment): Deleted. (WebKit::WebChromeClient::didCreateEditableImage): Deleted. (WebKit::WebChromeClient::didDestroyEditableImage): Deleted. * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp: (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView): Deleted. * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: (WebKit::PlatformCALayerRemote::createForEmbeddedView): Deleted. (WebKit::PlatformCALayerRemote::embeddedViewID const): Deleted. * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::layerDidEnterContext): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::isAssistableElement): (WebKit::WebPage::getFocusedElementInformation): (WebKit::WebPage::handleStylusSingleTapAtPoint): Deleted. 2020-08-28 Tim Horton <timothy_horton@apple.com> Sites built with flambe.js don't work with trackpad on iPad https://bugs.webkit.org/show_bug.cgi?id=215954 Reviewed by Wenson Hsieh. New API Test: iOSMouseSupport.MouseTimestampTimebase * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer createMouseEventWithType:]): Use the timestamp property on UITouch instead of GSCurrentEventTimestamp(). This property is in the same units as mach_absolute_time/MonotonicTime. Previously, treating a monotonic time as wall time resulted in it getting clamped to 0, breaking sites that depend on it. 2020-08-28 Per Arne Vollan <pvollan@apple.com> [macOS] Fix iokit-get-properties sandbox violations https://bugs.webkit.org/show_bug.cgi?id=215925 Reviewed by Brent Fulgham. Add iokit-property to WebContent sandbox that should have been a part of r266282. * WebProcess/com.apple.WebProcess.sb.in: 2020-08-28 Darin Adler <darin@apple.com> Remove almost all the remaining uses of live ranges https://bugs.webkit.org/show_bug.cgi?id=215755 Reviewed by Sam Weinig. * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp: (webkit_dom_range_compare_boundary_points): Update for rename of compareBoundaryPointsForBindings. (webkit_dom_range_intersects_node): Removed exception handling. (webkit_dom_range_get_text): Use plainText. * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm: (-[WKDOMRange initWithDocument:]): Tightened up into a one-liner. (-[WKDOMRange text]): Use plainText. (-[WKDOMRange textRects]): Stopped using Range::ownerDocument. * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: (WebKit::InjectedBundleRangeHandle::document): Stopped using Range::ownerDocument. (WebKit::InjectedBundleRangeHandle::boundingRectInWindowCoordinates const): Ditto. (WebKit::InjectedBundleRangeHandle::renderedImage): Ditto. (WebKit::InjectedBundleRangeHandle::text const): Use plainText. * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::getPlatformEditorState const): Use contains. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): Use intersects. 2020-08-28 Alex Christensen <achristensen@webkit.org> REGRESSION(r266187): ARGUMENT BAD: WebIconUtilities.mm(138) : RetainPtr<UIImage> WebKit::iconForFile(NSURL *) file, [file isFileURL] https://bugs.webkit.org/show_bug.cgi?id=215931 Reviewed by Wenson Hsieh. It's possible for JavaScript to make a filename that doesn't convert to a file URL, such as the empty string. When this happens, we would've returned null for the icon later anyways, but adding a null check prevents an assertion. Covered by 7 existing tests which would have hit that assertion. * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::createIconForFiles): 2020-08-28 Youenn Fablet <youenn@apple.com> Enable TransformStream by default https://bugs.webkit.org/show_bug.cgi?id=215891 Reviewed by Darin Adler. * Shared/WebPreferences.yaml: 2020-08-28 Per Arne Vollan <pvollan@apple.com> [macOS] Fix iokit-get-properties sandbox violations https://bugs.webkit.org/show_bug.cgi?id=215925 Reviewed by Darin Adler. A few iokit properties needs to be added to the WebContent process' sandbox after observing these being in use. * WebProcess/com.apple.WebProcess.sb.in: 2020-08-27 John Wilander <wilander@apple.com> Remove the feature flag for capped cookies set in 3rd-party CNAME cloaked HTTP responses and add ITP debug logging https://bugs.webkit.org/show_bug.cgi?id=215902 <rdar://problem/66699731> Reviewed by Brent Fulgham. This change removes the feature flag, effectively turning the feature on. It also adds log output of cookie names that have been capped when ITP Debug Mode is enabled. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode): Now sets the flag in WebCore::NetworkStorageSession through the new function WebCore::NetworkStorageSession::setResourceLoadStatisticsDebugLoggingEnabled(). * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::resetParametersToDefaultValues): (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::setFirstPartyHostCNAMEDomain): (WebKit::NetworkSession::firstPartyHostCNAMEDomain): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::setCNAMECloakingMitigationEnabled): Deleted. (WebKit::NetworkSession::cnameCloakingMitigationEnabled const): Deleted. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::updateFirstPartyInfoForSession): (WebKit::NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking): * Shared/ResourceLoadStatisticsParameters.h: (WebKit::ResourceLoadStatisticsParameters::encode const): (WebKit::ResourceLoadStatisticsParameters::decode): * Shared/WebPreferences.yaml: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): 2020-08-27 Devin Rousso <drousso@apple.com> [iOS] provide a way to get previously inserted alternatives for the selected text https://bugs.webkit.org/show_bug.cgi?id=215816 <rdar://problem/66646042> Reviewed by Darin Adler. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView alternativesForSelectedText]): * UIProcess/WebPageProxy.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::platformDictationAlternatives): Added. * UIProcess/PageClient.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::dictationAlternatives): (WebKit::PageClientImplCocoa::platformDictationAlternatives): Added. Provide a way to get the raw `NSTextAlternatives *` for a given `WebCore::DictationContext`. * Shared/EditorState.h: * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPlatformEditorState const): Include a `Vector<WebCore::DictationContext>` as part of the `EditorState` that contains all of the `WebCore::DictationContext` that exist in the currently selected range (or the range of the word containing the cursor if nothing is selected). * Platform/spi/ios/UIKitSPI.h: 2020-08-27 Jer Noble <jer.noble@apple.com> REGRESSION(r264710): Initializing the AVPlayer Obj-C class at process start up causes a regression in power-use tests https://bugs.webkit.org/show_bug.cgi?id=215861 Reviewed by Eric Carlson. Calling +instancesRespondToSelector: will cause the underyling Obj-C class to be initialized, which in the case of AVPlayer does a bunch of work which shows up on power-use tests. Because the API being checked for will always exist in macOS 11, and that code is already protected by a HAVE(AVPLAYER_VIDEORANGEOVERRIDE) pragma, just return early here without running the +instancesRespondToSelector: check. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updatePageScreenProperties): 2020-08-27 Chris Dumez <cdumez@apple.com> Unreviewed, add missing double quote in r266216. * WebProcess/com.apple.WebProcess.sb.in: 2020-08-27 Kate Cheney <katherine_cheney@apple.com> syntax error in "DELETE FROM StorageAccessUnderTopFrameDomains" https://bugs.webkit.org/show_bug.cgi?id=215813 <rdar://problem/67743521> Reviewed by Darin Adler. Delete unnecessary code. ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions() is not needed. User interaction and storage access will be cleared for expired statistics in ResourceLoadStatisticsDatabaseStore::hasHadUnexpiredRecentUserInteraction(), which exactly matches behavior in the memory store. If we clear the expired statistics before setting the local var oldestUserInteraction, then that var will likely always be equal to zero, and the check for if (!parameters().isRunningTest && now - oldestUserInteraction < parameters().minimumTimeBetweenDataRecordsRemoval) will always be false. The only reason we did not notice this extra code is because the SQLite query in clearExpiredUserInteractions() was incorrect, causing an early return. So the function never worked properly. Fixing the query revealed incorrect behavior. No new tests, behavior should not change because this code was not being run due to the SQLite error. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): (WebKit::ResourceLoadStatisticsDatabaseStore::findExpiredUserInteractions const): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredUserInteractions): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::statisticsExpirationTime const): Deleted. 2020-08-27 Youenn Fablet <youenn@apple.com> Add support for TransformStream https://bugs.webkit.org/show_bug.cgi?id=215607 Reviewed by Alex Christensen. Add a runtime flag for TransformStream, off by default. * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2020-08-26 Per Arne Vollan <pvollan@apple.com> [macOS] Stop logging sandbox violations of com.apple.CoreDisplay.Notification https://bugs.webkit.org/show_bug.cgi?id=215869 Reviewed by Darin Adler. On macOS, stop logging mach-lookup sandbox violations of com.apple.CoreDisplay.Notification for performance reasons. No new tests, since there is no change in behavior. The service was already being denied in the sandbox. * WebProcess/com.apple.WebProcess.sb.in: 2020-08-26 Kate Cheney <katherine_cheney@apple.com> Resource Load Statistics data summary does not report data which is held up in the web content process. https://bugs.webkit.org/show_bug.cgi?id=215822 <rdar://problem/66682044> Reviewed by Chris Dumez. No new tests, this fixes a timing bug that is flaky to reproduce, so I was unable to write a test case. Non-regressed behavior is confirmed with existing API testing. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): Most of the time, the completion handler will be an empty function, but we should handle it in the network process so we fix the case where we wait to send the full data summary until the update has finished. (WebKit::WebResourceLoadStatisticsStore::aggregatedThirdPartyData): Delete extra space. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::sendResourceLoadStatisticsDataImmediately): * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary): Don't ask the network process for data until any lingering data in the web content process has been sent first. * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleResourceLoadStatisticsNotifyObserver): * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::WebResourceLoadObserver): (WebKit::WebResourceLoadObserver::~WebResourceLoadObserver): (WebKit::WebResourceLoadObserver::updateCentralStatisticsStore): * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::flushResourceLoadStatistics): (WebKit::WebProcess::sendResourceLoadStatisticsDataImmediately): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-08-26 Andres Gonzalez <andresg_22@apple.com> Buttons with aria-haspopup attribute are not exposed to accessibility clients as form controls. https://bugs.webkit.org/show_bug.cgi?id=215866 Reviewed by Chris Fleizach. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleSyntheticClick): isARIAControl false implies isARIAInput false, thus removed the || isARIAInput call. 2020-08-26 Aditya Keerthi <akeerthi@apple.com> [iOS] Disabled options in the multi-select picker should not be selectable https://bugs.webkit.org/show_bug.cgi?id=201458 <rdar://problem/55018179> Reviewed by Wenson Hsieh. WKMultipleSelectPicker is displayed when a <select multiple> or a <select> with an <optgroup> is activated. Due to <rdar://problem/18745253>, group rows and disabled rows were selectable in the picker. r175266 added a workaround for this issue, preventing group rows from being selectable. However, the workaround did not account for disabled rows, which means that it is possible to select disabled options in the multi-select picker. To fix this behavior, the same fix that was applied to group rows is now applied to disabled rows. `pickerView:row:column:checked:` resets the style for the associated view if `item.disabled` is true. Test: fast/forms/ios/disabled-options-in-multi-select-picker.html * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKMultipleSelectPicker pickerView:row:column:checked:]): 2020-08-26 Youenn Fablet <youenn@apple.com> Enable WritableStream by default https://bugs.webkit.org/show_bug.cgi?id=149842 Reviewed by Alex Christensen. Implementation is now ready and is up to date with the latest specification. * Shared/WebPreferences.yaml: 2020-08-26 Chris Dumez <cdumez@apple.com> REGRESSION (r265908): Crash under Blob::arrayBuffer() / Blob::text() in stress GC https://bugs.webkit.org/show_bug.cgi?id=215832 <rdar://problem/67741677> Reviewed by Ryosuke Niwa. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload): 2020-08-26 Youenn Fablet <youenn@apple.com> enumerateDevices should expose audiooutput devices that are tied to an audio input device https://bugs.webkit.org/show_bug.cgi?id=215806 Reviewed by Eric Carlson. Introduce an experimental flag (off by default) to cover speaker selection, including exposing speaker devices to web pages. Update UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList to only expose speakers that are tied to a microphone that is exposed. This aligns with https://w3c.github.io/mediacapture-output/#privacy-obtaining-consent. * GPUProcess/GPUConnectionToWebProcess.cpp: * Shared/WebPreferences.yaml: * UIProcess/API/C/WKMockMediaDevice.cpp: (WKAddMockMediaDevice): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetExposeSpeakersEnabled): (WKPreferencesGetExposeSpeakersEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::isMicrophoneDevice): (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: (WebKit::sourceTypeFromDeviceType): (WebKit::RemoteRealtimeMediaSource::RemoteRealtimeMediaSource): (WebKit::RemoteRealtimeMediaSource::~RemoteRealtimeMediaSource): * WebProcess/cocoa/UserMediaCaptureManager.h: 2020-08-25 Tim Horton <timothy_horton@apple.com> Web Share API Level 2 functions even when its experimental feature flag is disabled https://bugs.webkit.org/show_bug.cgi?id=215831 <rdar://problem/67760687> Reviewed by Darin Adler. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showShareSheet): If the Web Content process sends us files, but the Level 2 feature flag is disabled, something fishy is happening, so fire a MESSAGE_CHECK. 2020-08-25 Ryosuke Niwa <rniwa@webkit.org> HashMap<Ref<T>>::take should return RefPtr<T> https://bugs.webkit.org/show_bug.cgi?id=215830 Reviewed by Darin Adler. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestinationManager::deleteAudioDestination): * NetworkProcess/NetworkResourceLoadMap.cpp: (WebKit::NetworkResourceLoadMap::take): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::willClosePage): * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::taskCompleted): * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted): (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasDenied): 2020-08-25 Tim Horton <timothy_horton@apple.com> Web Share API can share non-HTTP(S) URLs https://bugs.webkit.org/show_bug.cgi?id=215823 <rdar://problem/62083130> Reviewed by Wenson Hsieh. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showShareSheet): Ensure that only HTTP family or data: URLs are shared. 2020-08-25 Megan Gardner <megan_gardner@apple.com> Trying to lookup when WebView is in a popover causes process to hang. Fix for Legacy WebView. https://bugs.webkit.org/show_bug.cgi?id=215792 Reviewed by Tim Horton. Update code based on Darin's suggestion for mirror fix in legacy webkit. * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::getContextMenuFromItems): 2020-08-25 Carlos Alberto Lopez Perez <clopez@igalia.com> [WPE][Qt] Fix qt-wpe-minibrowser on Debian10 https://bugs.webkit.org/show_bug.cgi?id=215730 Reviewed by Philippe Normand. QWheelEvent position is not available on Qt < 5.14. Use posF instead in that case. Tested with Qt 5.11 No new tests, is a build fix. * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp: (WPEQtViewBackend::dispatchWheelEvent): 2020-08-25 Jer Noble <jer.noble@apple.com> [Mac] REGRESSION(r262322): Focusable elements are focused when exiting from video fullscreen mode. https://bugs.webkit.org/show_bug.cgi?id=215660 <rdar://problem/65263150> Reviewed by Darin Adler. API Test: Fullscreen.Focus. The default behavior of NSWindow is to change its -keyViewSelectionDirection to NSSelectingNext when activating and changing the firstResponder. This causes WKWebView to change it's focus in response to becoming first responder. The cheap fix is to ensure WKWebView is already the firstResponder when the window is activated. Then NSWindow won't try to change the firstResponder in response to activation. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): 2020-08-25 Alex Christensen <achristensen@webkit.org> Clean up deprecated and unused SPI to set HSTS storage on ProcessPoolConfiguration https://bugs.webkit.org/show_bug.cgi?id=215788 Reviewed by Chris Dumez. After rdar://problem/65047971 this is no longer needed because the replacement on WebsiteDataStoreConfiguration has been adopted. The selector on _WKProcessPoolConfiguration had already been deprecated, and is left for now to allow easier debugging with OSes that use it still. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::platformInitializeNetworkProcess): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]): (-[_WKProcessPoolConfiguration hstsStorageDirectory]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): 2020-08-25 Eric Carlson <eric.carlson@apple.com> [macOS] Update audio arbitration manager when audio transport changes https://bugs.webkit.org/show_bug.cgi?id=215781 <rdar://problem/65920613> Reviewed by Jer Noble. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _audioRoutingArbitrationUpdateTime]): * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: (WebKit::AudioSessionRoutingArbitratorProxy::arbitrationUpdateTime const): * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory): 2020-08-25 Youenn Fablet <youenn@apple.com> Add support for MediaRecorder bitrate options https://bugs.webkit.org/show_bug.cgi?id=214973 Reviewed by Eric Carlson. Serialize options when creating remote media recorder. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::create): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::createRecorder): * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): * WebProcess/GPU/webrtc/MediaRecorderProvider.h: 2020-08-25 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Initialize HSTS storage directory from network session initialization https://bugs.webkit.org/show_bug.cgi?id=215802 Reviewed by Alex Christensen. Instead of network process initialization, since it's not actually a global setting. * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::platformInitializeNetworkProcess): Remove code to initialize HSTS storage. * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::NetworkSessionSoup): Call SoupNetworkSession::setHSTSPersistentStorage() if the path is not mpety. * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextConstructed): Remove the ode to set the HSTS storage directory as process pool configuration. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): Initialize hstsStorageDirectory in default network session parameters. 2020-08-24 Brady Eidson <beidson@apple.com> CrashTracer: com.apple.WebKit.WebContent at com.apple.WebKit: WebKit::PDFPlugin::createScrollbar <rdar://problem/67473335> and https://bugs.webkit.org/show_bug.cgi?id=215787 Reviewed by Tim Horton. To quote Tim from r264945: No new tests; timing is such that I can't reproduce without inserting intentional delays into the main thread hops, which is further than I'm willing to go for a test. This is a speculative fix due to the aforementioned reproducibility issue. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel): Check on the main thread whenever this is called, instead of when deciding to dispatch to the main thread. (WebKit::PDFPlugin::threadEntry): We can't do this check on the background thread when considering the dispatch to the main thread, as the flag might've changed by then. Let's *just* check it on the main thread. (WebKit::PDFPlugin::adoptBackgroundThreadDocument): We can't do the check on the background thread when (WebKit::PDFPlugin::updateScrollbars): This is where the crash itself is. All of the Obj-C code in here is safe to do after destroy(), up until the very end when we get into pluginView() derefencing. So it seems prudent to add another check here. (WebKit::PDFPlugin::documentDataDidFinishLoading): In addition to receivedNonLinearizedPDFSentinel and adoptBackgroundThreadDocument, this is the final of the (3) calls that end up calling installPDFDocument, so for added coverage it seems like a prudent place to add the check. 2020-08-24 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the internal iOS 13.4 build The -_selectionClipRect SPI method isn't declared in any private headers on iOS 13.4 and prior. This isn't a problem when building with a non-internal SDK since the SPI is declared in the `!USE(APPLE_INTERNAL_SDK)` section in `UIKitSPI.h`, but on internal builds of iOS 13.4, this declaration is absent from both the internal SDK and `UIKitSPI.h`. To fix the build, simply declare it in the IPI section — once we stop supporting iOS 13.4 as a build target, this can be moved back into the non-internal section only. * Platform/spi/ios/UIKitSPI.h: 2020-08-24 Alex Christensen <achristensen@webkit.org> Implement Request/Response consuming as FormData https://bugs.webkit.org/show_bug.cgi?id=215671 Reviewed by Darin Adler. * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish): Add a fast path that allows non-blob FormData responses from service workers to not hang. This part is covered by this layout test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-custom-response.https.html 2020-08-24 Alex Christensen <achristensen@webkit.org> Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory https://bugs.webkit.org/show_bug.cgi?id=213048 Reviewed by Youenn Fablet. This uses CFNetwork SPI introduced in rdar://problem/50109631 to allow HSTS storage per NSURLSession. To be complete, I also deprecated our UI process HSTS state removal attempt SPIs, WKContextResetHSTSHosts and WKContextResetHSTSHostsAddedAfterDate, which had their last use removed in rdar://problem/64220838. I manually verified that this new SPI puts HSTS data in the specified location, and I also verified that HSTS state querying and removal works with the new CFNetwork SPI as it did with the old one. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::hstsStorage const): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * UIProcess/API/C/mac/WKContextPrivateMac.h: * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextResetHSTSHosts): (WKContextResetHSTSHostsAddedAfterDate): * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration hstsStorageDirectory]): (-[_WKWebsiteDataStoreConfiguration setHSTSStorageDirectory:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::privateBrowsingSession): Deleted. (WebKit::WebProcessPool::resetHSTSHosts): Deleted. (WebKit::WebProcessPool::resetHSTSHostsAddedAfterDate): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resolvedHSTSStorageDirectory const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2020-08-24 Aditya Keerthi <akeerthi@apple.com> [macOS] Show picker for date and datetime-local input types https://bugs.webkit.org/show_bug.cgi?id=214946 Reviewed by Darin Adler and Wenson Hsieh. Created WKDateTimePicker as a wrapper around NSDatePicker. The picker is displayed in its own NSWindow, ensuring the view is always above the page. WebPageProxy and WKDateTimePicker communicate through WebDateTimePickerMac, in order for the picker to be initialized with the correct initial, minimum, and maximum date, and so that the chosen date can be sent back to the WebProcess. Added IPC messages to enable communication between the UIProcess and the WebProcess necessary for showing and hiding the picker. * Sources.txt: * SourcesCocoa.txt: * UIProcess/PageClient.h: * UIProcess/WebDateTimePicker.cpp: Added. (WebKit::WebDateTimePicker::WebDateTimePicker): (WebKit::WebDateTimePicker::~WebDateTimePicker): (WebKit::WebDateTimePicker::endPicker): * UIProcess/WebDateTimePicker.h: Added. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showDateTimePicker): (WebKit::WebPageProxy::endDateTimePicker): (WebKit::WebPageProxy::didChooseDate): (WebKit::WebPageProxy::didEndDateTimePicker): (WebKit::WebPageProxy::closeOverlayedViews): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::createDateTimePicker): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::createDateTimePicker): * UIProcess/mac/WebDateTimePickerMac.h: Added. * UIProcess/mac/WebDateTimePickerMac.mm: Added. (WebKit::WebDateTimePickerMac::create): (WebKit::WebDateTimePickerMac::~WebDateTimePickerMac): (WebKit::WebDateTimePickerMac::WebDateTimePickerMac): (WebKit::WebDateTimePickerMac::endPicker): (WebKit::WebDateTimePickerMac::showDateTimePicker): (WebKit::WebDateTimePickerMac::didChooseDate): (-[WKDateTimePickerWindow initWithContentRect:styleMask:backing:defer:]): (-[WKDateTimePickerWindow canBecomeKeyWindow]): (-[WKDateTimePickerWindow hasKeyAppearance]): (-[WKDateTimePickerWindow shadowOptions]): (-[WKDateTimePicker initWithParams:inView:]): (-[WKDateTimePicker showPicker:]): (-[WKDateTimePicker invalidate]): (-[WKDateTimePicker didChooseDate:]): (-[WKDateTimePicker dateFormatStringForType:]): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createDateTimeChooser): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebDateTimeChooser.cpp: Added. (WebKit::WebDateTimeChooser::WebDateTimeChooser): (WebKit::WebDateTimeChooser::didChooseDate): (WebKit::WebDateTimeChooser::didEndChooser): (WebKit::WebDateTimeChooser::endChooser): (WebKit::WebDateTimeChooser::showChooser): * WebProcess/WebCoreSupport/WebDateTimeChooser.h: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setActiveDateTimeChooser): (WebKit::WebPage::didChooseDate): (WebKit::WebPage::didEndDateTimePicker): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-08-24 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, late August 2020 edition https://bugs.webkit.org/show_bug.cgi?id=215768 Unreviewed build fix. * UIProcess/WebURLSchemeTask.cpp: Add missing SharedBufferDataReference.h header. 2020-08-24 Youenn Fablet <youenn@apple.com> Cocoa WebSocketTask should expose WebSocket server extensions https://bugs.webkit.org/show_bug.cgi?id=215696 Reviewed by Darin Adler. Send back to WebProcess the value of server WebSocket extensions. * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: (WebKit::WebSocketTask::didConnect): 2020-08-24 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK4 build * PlatformGTK.cmake: * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: (webkitAuthenticationDialogInitialize): * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: (webkitScriptDialogImplConstructed): (webkit_script_dialog_impl_class_init): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseEvent): (webkit_web_view_base_class_init): * UIProcess/API/gtk/WebKitWebViewDialog.cpp: (webkitWebViewDialogConstructed): (webkitWebViewDialogSetChild): * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp: (webkit_inspector_window_init): * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: (WebKit::WebDataListSuggestionsDropdownGtk::show): * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebPageProxy::bindAccessibilityTree): * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::showPopupMenu): 2020-08-23 Wenson Hsieh <wenson_hsieh@apple.com> Programmatic selection of text in a text field causes the highlight overlay to spill out https://bugs.webkit.org/show_bug.cgi?id=215647 <rdar://problem/67404979> Reviewed by Darin Adler. UIKit consults the SPI method `-_selectionClipRect` on WKContentView to determine the maximum bounds in which it is allowed to show text selection UI (i.e. the text caret view, selection highlight views, and selection grabbers). Normally, when contentEditable elements and editable text form controls are focused, we plumb the bounds of the focused element to the UI process via `focusedElementRect` in editor state's post layout data. However, in this case, the selection is inside a readonly text field that is *not* focused; this causes us to return `CGRectNull` from `-_selectionClipRect`, which means that UIKit selection UI is not clipped at all and instead overflows the bounds of the input element. To fix this, rearrange some logic in `WebPage::getPlatformEditorState` in `WebPageIOS.mm` such that we compute and send the selection clipping rect if the selection is inside a text form control, even if it is not the focused element. In doing this, we also rename some confusingly-named members in `EditorState::PostLayoutData` (see below for more detail). Test: editing/selection/ios/select-all-in-readonly-input-does-not-overflow.html * Platform/spi/ios/UIKitSPI.h: Add a declaration for `-_selectionClipRect`. * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): (WebKit::operator<<): * Shared/EditorState.h: Split the existing rect member `focusedElementRect` into two: `selectionClipRect` on iOS, and `selectionBoundingRect` on macOS. Previously, `focusedElementRect` was set to the focused element's bounding rect on iOS (as expected), but on macOS, we set to the bounds of the ranged or caret selection; we proceed to use this rect to mean the bounds of the selection anyways in macOS-specific code, so it makes more sense to just move this into the macOS-specific section. Additionally, after the below change in WebPageIOS, `focusedElementRect` is no longer specific to the focused element, so rename it instead to `selectionClipRect` instead. In `WKContentViewInteraction.mm`, this rect is effectively only used in two ways: as the selection clip rect for UIKit, and to determine if the selection would be completely clipped anyways (in which case we suppress UIKit text interactions), so `selectionClipRect` is a name that is suitable for both purposes. * UIProcess/API/mac/WKWebViewTestingMac.mm: (-[WKWebView _candidateRect]): * UIProcess/Cocoa/WebViewImpl.mm: Rename `focusedElementRect` to `selectionBoundingRect` on macOS. (WebKit::WebViewImpl::handleRequestedCandidates): * UIProcess/ios/WKContentViewInteraction.mm: Rename `focusedElementRect` to `selectionClipRect` on iOS. (WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo): (-[WKContentView _selectionClipRect]): Change this to not require a focused element when returning the selection clip rect, and instead return the editor state's selection clip rect as long as it is not empty. (-[WKContentView _updateSelectionAssistantSuppressionState]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPlatformEditorState const): Refactor this code to compute and send selectionClipRect as long as the selection is inside a form control or editing host (not just when there is a focused element). Also leave a drive-by FIXME about using the focused element (instead of the selection container node) when computing the caret color. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::getPlatformEditorState const): 2020-08-19 Darin Adler <darin@apple.com> Move node geometry functions from Range to RenderObject https://bugs.webkit.org/show_bug.cgi?id=215677 Reviewed by Zalan Bujtas. * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: (WebKit::InjectedBundleRangeHandle::boundingRectInWindowCoordinates const): Call unionRectIgnoringZeroRects(RenderObject::absoluteBorderAndTextRects). (WebKit::InjectedBundleRangeHandle::renderedImage): Call unionRectIgnoringZeroRects(RenderObject::absoluteBorderAndTextRects). * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestEvasionRectsAboveSelection): Call unionRect(RenderObject::absoluteTextRects). (WebKit::WebPage::requestDocumentEditingContext): Call unionRect(RenderObject::absoluteTextRects). 2020-08-17 Darin Adler <darin@apple.com> Create documentOrder function, start refactoring to use it instead of Range::compare functions https://bugs.webkit.org/show_bug.cgi?id=215551 Reviewed by Chris Dumez. * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm: (-[WKDOMRange rangeByExpandingToWordBoundaryByCharacters:inDirection:]): Use makeDeprecatedLegacyPosition instead of Range::start/endPosition. This was the only place in the WebKit framework still using Range::start/endPosition and over time we would like to move from makeDeprecatedLegacyPosition to makeContainerOffsetPosition, so it's good to have it be explicit here rather than hidden inside the Range class. 2020-08-22 Philippe Normand <pnormand@igalia.com> [GTK][WPE] Compilation warnings with clang/gcc 10 https://bugs.webkit.org/show_bug.cgi?id=215699 Reviewed by Darin Adler. * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::doneWithTouchEvent): Use null input touch event enum value for touch event handling. 2020-08-21 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Unable to copy text from the function browser panel in Numbers https://bugs.webkit.org/show_bug.cgi?id=215740 <rdar://problem/65189303> Reviewed by Darin Adler. On some versions of Xcode, using Interface Builder to set up WKWebViews causes the WKWebView to contain two WKFlippedViews as subviews; one of these is created and added in the normal initialization path of the web view underneath WebViewImpl's constructor, and the other is created and added underneath the superclass (NSView's) `-initWithCoder:` implementation. This causes issues when hit-testing WKWebView using the `-hitTest:` method, which is expected to return the WKWebView itself instead of the inner WKFlippedView. The logic that tries to implement this behavior is in `WebViewImpl::hitTest`, which calls into WKWebView's `-hitTest:` method and returns the WKWebView if the hit- tested view ended up being equal to the `m_layerHostingView`. Since we end up with two layer hosting views (only one of which is the real `m_layerHostingView`), we fail the check and end up returning the other WKFlippedView. In the context of this bug, this erroneous hit-test causes AppKit to ask if the WKFlippedView can become the first responder upon mousedown (which it cannot), and so the window's first responder remains the same (instead of changing to WKWebView). To fix this, adjust the constructor of WebViewImpl to avoid making an extra layer hosting view in the case where decoding the WKWebView already initialized and placed the layer hosting view, and just use the existing one instead. Test: WKWebView.HitTestAfterInitializingFromCoder * UIProcess/Cocoa/WebViewImpl.mm: (-[WKFlippedView initWithFrame:]): (-[WKFlippedView initWithCoder:]): (-[WKFlippedView _commonInitialize]): Override both designated initialization codepaths so that we call the `-_commonInitialize` helper, which sets the autoresizing mask. This was previously called immediately after creating the WKFlippedView in the constructor of WebViewImpl. (WebKit::WebViewImpl::WebViewImpl): 2020-08-21 Andy Estes <aestes@apple.com> IPC::encodeSharedBuffer combines SharedBuffer data segments when copying to SharedMemory https://bugs.webkit.org/show_bug.cgi?id=215737 <rdar://problem/67568099> Reviewed by Darin Adler. IPC::encodeSharedBuffer called SharedBuffer::data() when copying data into SharedMemory, requiring the SharedBuffer to combine its data segments. This can be avoided by using SharedMemory::copyBuffer() instead. * Platform/SharedMemory.cpp: (WebKit::SharedMemory::copyBuffer): Modernized to use auto and range-based for loops. * Shared/WebCoreArgumentCoders.cpp: (IPC::encodeSharedBuffer): Used SharedMemory::copyBuffer() to create a copy of the buffer in a new SharedMemory. Calling this function does not combine the buffer's data segments. * Platform/SharedMemory.h: Added a FIXME for how SharedMemory's factory functions could be improved. 2020-08-21 Jiten Mehta <jmehta@apple.com> Use closeReason provided in didCloseWithCode delegate for the NSURLSessionWebSocket code path https://bugs.webkit.org/show_bug.cgi?id=215519 Reviewed by Youenn Fablet. Covered by existing protocol tests with NSURLSession code path enabled. http/tests/websocket/tests/hybi/workers/close-code-and-reason.html * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:webSocketTask:didCloseWithCode:reason:]): 2020-08-21 Andy Estes <aestes@apple.com> REGRESSION (r257667): 1.9x more CPU time in IPC::SharedBufferDataReference decoding during Netflix playback https://bugs.webkit.org/show_bug.cgi?id=215232 <rdar://problem/66637920> Reviewed by Geoff Garen. Prior to r257667, an IPC message defined a IPC::SharedBufferDataReference argument to allow its sender to easily encode SharedBuffer data as a DataReference. SharedBufferDataReference cost the same to encode as a DataReference -- both copied data into the Encoder -- but did so by iterating over the SharedBuffer's data segments rather than combining them into a contiguous allocation. The message argument was received as a decoded IPC::DataReference, which stores a pointer into the IPC::Decoder's buffer rather than making a copy. In r257667, IPC::SharedBufferDataReference switched its encoder to use IPC::ArgumentCoder's SharedBuffer specialization, which works by allocating a SharedMemory buffer, copying SharedBuffer data into it, creating a SharedMemory::IPCHandle from it, and encoding the handle. It makes only one copy like the old encoder did, but pays the added cost of combining SharedBuffer data segments prior to copying by needlessly calling SharedBuffer::data() (this should be fixed independently). Since this serialization could no longer be decoded by DataReference's decoder, SharedBufferDataReference implemented a decoder, also in terms of ArgumentCoder's SharedBuffer specialization. It works by mapping a SharedMemory buffer from a decoded SharedMemory::IPCHandle and copying that buffer into a new SharedBuffer. This copy is a cost that the old decoder did not incur, but in some cases the message receiver would have made such a copy anyway and can instead just ref the decoded SharedBuffer. In other cases though, the receiver either made no copies or couldn't use the decoded SharedBuffer to avoid making its own copy so creating the SharedBuffer was pure added cost. There are additional costs from allocating, mapping, and deleting shared memory and Mach send rights, but they are offset by savings due to smaller Encoder and Decoder buffers. The additional SharedBuffer combining and copying is not offset elsewhere, and on net makes sending and receiving IPC::SharedBufferDataReferences use up to 2x more CPU time when playing a video on netflix.com in Safari. Resolve this slowdown by reverting the argument encoding changes made to IPC::SharedBufferDataReference in r257667. For compatibility with code added after r257667, the current IPC::SharedBufferDataReference was copied to IPC::SharedBufferCopy and retains the behavior of copying into a SharedBuffer when decoded. IPC::SharedBufferDataReference now has the pre-r257667 behavior of decoding to an IPC::DataReference. Messages added after r257667 whose receivers were designed to handle a SharedBuffer were changed to use IPC::SharedBufferCopy, and all other receivers of messages with IPC::SharedBufferDataReference arguments were changed to handle an IPC::DataReference. * GPUProcess/media/RemoteCDMInstanceProxy.cpp: * GPUProcess/media/RemoteCDMInstanceProxy.h: * GPUProcess/media/RemoteCDMInstanceProxy.messages.in: * GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp: * GPUProcess/media/RemoteCDMInstanceSessionProxy.h: * GPUProcess/media/RemoteCDMInstanceSessionProxy.messages.in: * GPUProcess/media/RemoteCDMProxy.cpp: * GPUProcess/media/RemoteCDMProxy.h: * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: * GPUProcess/media/RemoteLegacyCDMSessionProxy.h: * GPUProcess/media/RemoteLegacyCDMSessionProxy.messages.in: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::platformRegisterAttachment): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::registerAttachmentIdentifierFromData): (WebKit::WebPageProxy::platformRegisterAttachment): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/gtk/WebPasteboardProxyGtk.cpp: * WebProcess/GPU/media/RemoteCDMInstance.cpp: * WebProcess/GPU/media/RemoteCDMInstanceSession.cpp: * WebProcess/GPU/media/RemoteCDMInstanceSession.h: * WebProcess/GPU/media/RemoteCDMInstanceSession.messages.in: * WebProcess/GPU/media/RemoteLegacyCDMSession.cpp: * WebProcess/GPU/media/RemoteLegacyCDMSession.h: * WebProcess/GPU/media/RemoteLegacyCDMSession.messages.in: * WebProcess/WebCoreSupport/WebEditorClient.cpp: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Replaced IPC::SharedBufferDataReference with IPC::SharedBufferCopy. * NetworkProcess/NetworkResourceLoader.cpp: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in: * WebProcess/Network/WebResourceLoader.cpp: * WebProcess/Network/WebResourceLoader.h: * WebProcess/Network/WebResourceLoader.messages.in: * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: Removed the DidReceiveSharedBuffer message and reverted the DidReceiveData message back to taking an IPC::SharedBufferDataReference. * Platform/IPC/Encoder.h: Made Encoder::reserve(size_t) public so SharedBufferCopy::encode(Encoder&) can call it. * Platform/IPC/HandleMessage.h: Restored the CodingType specialization that decodes SharedBufferDataReference arguments as DataReferences. * Platform/IPC/SharedBufferCopy.cpp: * Platform/IPC/SharedBufferCopy.h: Copied from SharedBufferDataReference.h. Implemented the interface and decoding behavior that SharedBufferDataReference had between r257667 and this change. * Platform/IPC/SharedBufferDataReference.cpp: * Platform/IPC/SharedBufferDataReference.h: Reverted to the pre-r257667 interface and decoding behvior. * Scripts/webkit/messages.py: Removed an unneeded special case. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: Added SharedBuffer{Copy,DataReference}.cpp. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dataCallback): (WebKit::WebPageProxy::finishedLoadingIcon): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: Used `const IPC::DataReference&` in message receiver signatures for SharedBufferDataReference arguments. * UIProcess/WebURLSchemeTask.cpp: * WebProcess/GPU/media/RemoteAudioBusData.h: * WebProcess/GPU/media/RemoteCDM.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: Removed unused includes. 2020-08-20 Peng Liu <peng.liu6@apple.com> Mac Catalyst Apps require "playsinline" attribute to support playing videos in the inline mode https://bugs.webkit.org/show_bug.cgi?id=215724 Reviewed by Tim Horton. Currently WebKit::currentUserInterfaceIdiomIsPad() returns NO on Mac Catalyst apps. Therefore, the behavior of Mac Catalyst apps regarding the inline media playback support is not consistent with iPad apps. This patch removes the usage of WebKit::currentUserInterfaceIdiomIsPad() to decide the settings of the inline media playback support on Mac Catalyst apps. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): 2020-08-20 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Debug crashes in backdrop filter tests https://bugs.webkit.org/show_bug.cgi?id=215209 Reviewed by Adrian Perez de Castro. * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp: (WebKit::CompositingCoordinator::~CompositingCoordinator): Use invalidateCoordinator() instead of setCoordinator() that has been removed. (WebKit::CompositingCoordinator::createGraphicsLayer): Use setCoordinatorIncludingSubLayersIfNeeded() instead of attaching the layer directly. (WebKit::CompositingCoordinator::attachLayer): Do not call setCoordinator(), the caller is expected to set the coordinator. 2020-08-20 Per Arne Vollan <pvollan@apple.com> [macOS] Web pages are not responding correctly to changes in "Reduce motion" setting https://bugs.webkit.org/show_bug.cgi?id=215664 Reviewed by Darin Adler. This happens because there is a race between the preference change and notification being received in the WebContent process. This race is usually won by the notification, which then reads the wrong preference value when being handled. This bug was introduced when access to the preference daemon was closed in the WebContent process, and preferences were updated from the UI process. This patch addresses this issue by re-posting the notification when the preference value is updated in the WebContent process. API test: WebKit.AccessibilityReduceMotion * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::reduceMotionPreferenceKey): (WebKit::dispatchSimulatedNotificationsForPreferenceChange): 2020-08-20 James Savage <james.savage@apple.com> Could not find module 'WebKit' for target 'armv7-apple-ios' <https://bugs.webkit.org/show_bug.cgi?id=215190> <rdar://problem/65642049> Reviewed by Brady Eidson. The config changes here got added to the wrong config file. They need to be for the overlay, not its tests. * SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: * SwiftOverlay/Configurations/WebKitSwiftOverlayTests.xcconfig: 2020-08-20 Aditya Keerthi <akeerthi@apple.com> Add runtime setting for editable components in date/time inputs https://bugs.webkit.org/show_bug.cgi?id=215705 Reviewed by Wenson Hsieh. Added DateTimeInputsEditableComponentsEnabled as a runtime setting. This setting is enabled by default on macOS. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.h: 2020-08-20 Chris Dumez <cdumez@apple.com> Sandbox violation when calling [NSHTTPCookieStorage sharedHTTPCookieStorage] from the WebProcess https://bugs.webkit.org/show_bug.cgi?id=215701 <rdar://problem/67069826> Reviewed by Geoffrey Garen. The sandbox does not allow calling [NSHTTPCookieStorage sharedHTTPCookieStorage] from the WebProcess. createPrivateStorageSession() was calling [NSHTTPCookieStorage sharedHTTPCookieStorage] to retrieve the cookieAcceptPolicy and createPrivateStorageSession() is used by the cookie cache in the WebProcess. To address the issue, we now allow the caller of createPrivateStorageSession() to provide the cookieAcceptPolicy and we have the cookie cache retrieve the cookieAcceptPolicy from the NetworkProcessConnection. * WebProcess/Network/NetworkProcessConnection.h: (WebKit::NetworkProcessConnection::cookieAcceptPolicy const): * WebProcess/WebPage/Cocoa/WebCookieCacheCocoa.mm: (WebKit::WebCookieCache::inMemoryStorageSession): 2020-08-20 Youenn Fablet <youenn@apple.com> Align console log message of new WebSocket code path with the legacy code path https://bugs.webkit.org/show_bug.cgi?id=215695 Reviewed by Alex Christensen. No observable change of behavior from the page. Console log messages appear in expected.txt files when NSURLSession code path is enabled. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::connect): (WebKit::WebSocketChannel::didReceiveMessageError): * WebProcess/Network/WebSocketChannel.h: 2020-08-20 Lauro Moura <lmoura@igalia.com> REGRESSION(r265856) [GTK][WPE] hybi websockets tests failing https://bugs.webkit.org/show_bug.cgi?id=215679 Reviewed by Carlos Garcia Campos. r265856 changed WebSocketChannel to expect AbnormalClosure when the closing handshake is not received. Covered by existing tests. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::didFail): 2020-08-20 Youenn Fablet <youenn@apple.com> WebSocketTask::close should correctly compute reason byte size in UTF-8 https://bugs.webkit.org/show_bug.cgi?id=215645 Reviewed by Darin Adler. Covered by http/tests/websocket/tests/hybi/close.html with NSURLSession code path enabled. * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: (WebKit::WebSocketTask::close): Instead of calling sizeInBytes, we should just get the utf8 CString and gets its size directly. 2020-08-19 Fujii Hironori <Hironori.Fujii@sony.com> IPC message can't be decoded due to uninitialized NavigationActionData member variables with the latest MSVC https://bugs.webkit.org/show_bug.cgi?id=215662 Reviewed by Darin Adler. WinCairo WebKit2 is crashing in AuxiliaryProcess::didReceiveInvalidMessage if it is compiled by the latest MSVC (Visual Studio 2019 16.7) with optimizer (/O2). LockHistory is a bool based enum type. NavigationActionData doesn't initialize the member variable of it. IPC::Encoder converts a LockHistory value to the underlying type bool. The uninitialized value is converted 0 or 1 in GCC, Clang and old MSVC. However, the latest MSVC doesn't convert and IPC::Decoder detects an invalid enum value. * Shared/NavigationActionData.h: Added initializes for userGestureTokenIdentifier, lockHistory and lockBackForwardList. 2020-08-19 Brady Eidson <beidson@apple.com> Improperly linearized PDFs show up as blank gray on Big Sur. rdar://problem/67117968 and https://bugs.webkit.org/show_bug.cgi?id=215683 Reviewed by Darin Adler. Will add a new test once an in-house expert helps us construct an example PDF that we will have the legal right to commit. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::threadEntry): When PDFKit indicates a PDFDocument is *improperly* linearized (as opposed to not linearized at all), we failed to appopriately notify the main thread that it needs to start handling the PDF. Failure to create a PDFDocument is equivalent to receiving the "nonlinearized sentinel", so adding that call fixes this issue. 2020-08-19 Simon Fraser <simon.fraser@apple.com> Fix possible crash when webAnimationsCSSIntegrationEnabled is false https://bugs.webkit.org/show_bug.cgi?id=215668 <rdar://problem/67402003> Reviewed by Dean Jackson. When webAnimationsCSSIntegrationEnabled is false, GraphicsLayerCA::setupAnimation() doesn't set a timing function on the animation, causing a null de-ref when the animation is being encoded. Fix the encoder to handle null timing functions. Test: animations/legacy-encoding-timing-function.html * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::PlatformCAAnimationRemote::Properties::encode const): (WebKit::PlatformCAAnimationRemote::Properties::decode): 2020-08-19 Alex Christensen <achristensen@webkit.org> Fix null pointer crashes in network process after r265835 https://bugs.webkit.org/show_bug.cgi?id=215626 <rdar://problem/67268892> Call the correct CompletionHandler. completionHandler has already been moved from at this point. This crash was being hit in the test, but the test recovered from it. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge): 2020-08-19 Kate Cheney <katherine_cheney@apple.com> Third party domains are not stored in the case of back/forward navigations https://bugs.webkit.org/show_bug.cgi?id=215595 <rdar://problem/66642893> Reviewed by Chris Dumez. This patch adds the ability to retrieve loaded third party domains from the page synchronously to be stored in the CachedPage in the case of a back/forward navigation. It also changes the functions loadedThirdPartyDomains and getLoadedThirdPartyDomains to loadedSubresourceDomains and getLoadedSubresourceDomains respectively based on the conversation from https://bugs.webkit.org/show_bug.cgi?id=215595. * UIProcess/API/C/WKPage.cpp: (WKPageLoadedSubresourceDomains): (WKPageClearLoadedSubresourceDomains): (WKPageLoadedThirdPartyDomains): Deleted. (WKPageClearLoadedThirdPartyDomains): Deleted. * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _loadedSubresourceDomainsFor:completionHandler:]): (-[WKWebsiteDataStore _clearLoadedSubresourceDomainsFor:]): (-[WKWebsiteDataStore _loadedThirdPartyDomainsFor:completionHandler:]): Deleted. (-[WKWebsiteDataStore _clearLoadedThirdPartyDomainsFor:]): Deleted. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::getLoadedSubresourceDomains): (WebKit::WebPageProxy::clearLoadedSubresourceDomains): (WebKit::WebPageProxy::loadedThirdPartyDomains): Deleted. (WebKit::WebPageProxy::clearLoadedThirdPartyDomains): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::loadedSubresourceDomains const): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): (WebKit::WebPage::didLoadFromRegistrableDomain): (WebKit::WebPage::getLoadedSubresourceDomains): (WebKit::WebPage::clearLoadedSubresourceDomains): (WebKit::WebPage::loadedThirdPartyDomains): Deleted. (WebKit::WebPage::clearLoadedThirdPartyDomains): Deleted. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::loadedSubresourceDomains const): * WebProcess/WebPage/WebPage.messages.in: 2020-08-19 Chris Dumez <cdumez@apple.com> REGRESSION (r261407): Sharing rich links from Twitter/Netflix via Messages is unreliable https://bugs.webkit.org/show_bug.cgi?id=215656 <rdar://problem/67087352> Reviewed by Tim Horton. The WKWebView._clientNavigationsRunAtForegroundPriority SPI was not working for the MessagesViewService because the view is unparented and PageClient::isApplicationVisible() would not work return accurate results when [view window] returns nil. It is very unfortunate to have to rely on the view or the view's window to determine application visibility so this patch fixes this. We now rely on UIKit's visibility endowment to determine if the UIProcess is visible, using RunningBoard API. I have verified that the visibility endowment properly gets propagated from the host application to the view service when the application is a view service and I have verified that this detects the MessagesViewService as visible for the use-case at <rdar://problem/67087352>, which causes the WKWebView._clientNavigationsRunAtForegroundPriority SPI to work as intended. Note that when the application does not have the visibility endowment, we still allow it to take a foreground assertion for client navigations if the process is allowed to run in the background for an extended period of time, according to RunningBoard. This allows the SPI to work for daemons (like maild) which rely on it. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::canTakeForegroundAssertions): (WebKit::PageClientImpl::isApplicationVisible): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::shouldForceForegroundPriorityForClientNavigation const): 2020-08-19 Youenn Fablet <youenn@apple.com> WebSocketChannel::didClose should correctly compute whether a closing handshake was received https://bugs.webkit.org/show_bug.cgi?id=215644 Reviewed by Darin Adler. Covered by LayoutTests/http/tests/websocket/tests/hybi/close-code-and-reason.html with NSURLSession code path enabled. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::didClose): As noted by Jiten Mehta, absence of closing handshake from the server is notified by WebSocketChannel::CloseEventCodeAbnormalClosure. Update check accordingly. 2020-08-18 Alex Christensen <achristensen@webkit.org> WKWebViews using fastServerTrustEvaluationEnabled should only allow legacy TLS for main resource loads https://bugs.webkit.org/show_bug.cgi?id=215626 <rdar://problem/67268892> Reviewed by Darin Adler. We have introduced public API webView:authenticationChallenge:shouldAllowDeprecatedTLS: in WKNavigationDelegate to allow applications to choose whether to allow TLS 1.0 or 1.1 connections. We don't want to break this API or break existing third party apps that load pages that load third party subresources that use TLS 1.0 or 1.1. However, we do want Safari, which uses fastServerTrustEvaluationEnabled SPI, to silently fail subresource loads that use TLS 1.0 or 1.1. This matches the current behavior of Chrome and Firefox, which was not implemented in those other browsers when we decided to ask about subresources. Covered by an API test. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge): 2020-08-18 Jer Noble <jer.noble@apple.com> [Mac] Unhandled keyDown: events cause a system beep in full screen mode https://bugs.webkit.org/show_bug.cgi?id=215596 <rdar://problem/65823962> Reviewed by Darin Adler. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController noResponderFor:]): 2020-08-18 Youenn Fablet <youenn@apple.com> NetworkSocketChannel should delay sending back error message as done by NetworkSocketStream https://bugs.webkit.org/show_bug.cgi?id=215563 Reviewed by Alex Christensen. Apply same policy as NetworkSocketStream in case of WebSocket connection error. Covered by http/tests/websocket/tests/hybi/closed-port-delay.html with NSURLSession WebSocket code path. * NetworkProcess/NetworkSocketChannel.cpp: (WebKit::NetworkSocketChannel::NetworkSocketChannel): (WebKit::NetworkSocketChannel::didClose): (WebKit::NetworkSocketChannel::didReceiveMessageError): (WebKit::NetworkSocketChannel::sendDelayedError): * NetworkProcess/NetworkSocketChannel.h: 2020-08-17 Chris Dumez <cdumez@apple.com> AudioContext.getOutputTimestamp() is missing https://bugs.webkit.org/show_bug.cgi?id=215591 Reviewed by Darin Adler. * GPUProcess/media/RemoteAudioDestinationManager.cpp: * WebProcess/GPU/media/RemoteAudioBusData.h: (WebKit::RemoteAudioBusData::encode const): (WebKit::RemoteAudioBusData::decode): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::renderBuffer): 2020-08-17 Per Arne Vollan <pvollan@apple.com> Assert failure after r265715 https://bugs.webkit.org/show_bug.cgi?id=215592 Reviewed by Darin Adler. The change set r265715 introduced an assert failure in AuthenticationManager::initializeConnection. This happens because after r265715 the new XPC event handler set in AuthenticationManager::initializeConnection, will no longer be called on the main thread. This patch addresses this issue by dispatching this work on the main thread. No new tests, covered by existing tests. * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm: (WebKit::AuthenticationManager::initializeConnection): 2020-08-17 Per Arne Vollan <pvollan@apple.com> [Cocoa] Avoid waiting for Launch Services on every load https://bugs.webkit.org/show_bug.cgi?id=215569 Reviewed by Darin Adler. Currently, we are waiting for the Launch Services database to be present on every load in the WebContent process. It should be sufficient to wait only on the first load. Since we now are waiting only once per WebContent process, increase the maximum wait time from 1s to 5s. No new tests, covered by existing tests. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2020-08-17 Jer Noble <jer.noble@apple.com> [Mac] Add Experimental Feature preference for SW VP9 https://bugs.webkit.org/show_bug.cgi?id=215043 <rdar://problem/66400034> Reviewed by Darin Adler. Follow up fix: during a rebase, a line deletion was dropped which causes the SW decoder to always be registered regardless of the new setting. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): (WebKit::WebProcess::enableVP9SWDecoder): 2020-08-17 Youenn Fablet <youenn@apple.com> Remove message check in WebSocketTask::readNextMessage https://bugs.webkit.org/show_bug.cgi?id=215561 Reviewed by Alex Christensen. This if check was added as a workaround to cases where both error and message were null. This is no longer the case as per running existing tests with NSURLSession WebSocket code path on BigSur. * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: (WebKit::WebSocketTask::readNextMessage): 2020-08-17 Youenn Fablet <youenn@apple.com> Remove Cocoa WebSocketTask::send workaround https://bugs.webkit.org/show_bug.cgi?id=215564 Reviewed by Alex Christensen. Covered by existing tests run in Debug. * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: (WebKit::WebSocketTask::sendString): (WebKit::WebSocketTask::sendData): 2020-08-17 David Kilzer <ddkilzer@apple.com> Clean up DragApplicationFlags after switch to OptionSet<> <https://webkit.org/b/215349> Reviewed by Darin Adler. Change WebCore::DragApplicationFlags to an enum class. * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::drop): - Switch to use OptionSet<WebCore::DragApplicationFlags>. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::applicationFlagsForDrag): * WebProcess/WebPage/WebPage.h: - Update forward declaration. 2020-08-17 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Remove support for NPAPI plugins https://bugs.webkit.org/show_bug.cgi?id=215503 Reviewed by Darin Adler. * PlatformGTK.cmake: * PluginProcess/unix/PluginControllerProxyUnix.cpp: Removed. * PluginProcess/unix/PluginProcessMainUnix.cpp: Removed. * PluginProcess/unix/PluginProcessUnix.cpp: Removed. * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp: Removed. * Shared/Plugins/unix/PluginSearchPath.cpp: Removed. * Shared/Plugins/unix/PluginSearchPath.h: Removed. * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/API/glib/WebKitMimeInfo.cpp: (webkit_mime_info_ref): (webkit_mime_info_unref): (webkit_mime_info_get_mime_type): (webkit_mime_info_get_description): (webkit_mime_info_get_extensions): * UIProcess/API/glib/WebKitMimeInfoPrivate.h: Removed. * UIProcess/API/glib/WebKitPlugin.cpp: (webkit_plugin_get_name): (webkit_plugin_get_description): (webkit_plugin_get_path): (webkit_plugin_get_mime_info_list): * UIProcess/API/glib/WebKitPluginPrivate.h: Removed. * UIProcess/API/glib/WebKitSettings.cpp: (webKitSettingsSetProperty): (webKitSettingsGetProperty): (webkit_settings_class_init): (webkit_settings_get_enable_plugins): (webkit_settings_set_enable_plugins): * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_set_additional_plugins_directory): (webkit_web_context_get_plugins): (webkit_web_context_get_plugins_finish): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewLoadFail): * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): (toWebKitWebsiteDataTypes): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (toWebsiteDataTypes): * UIProcess/API/gtk/WebKitError.h: * UIProcess/API/gtk/WebKitMimeInfo.h: * UIProcess/API/gtk/WebKitPlugin.h: * UIProcess/API/gtk/WebKitSettings.h: * UIProcess/API/gtk/WebKitWebContext.h: * UIProcess/API/gtk/WebKitWebsiteData.h: * UIProcess/API/wpe/WebKitError.h: * UIProcess/API/wpe/WebKitMimeInfo.h: * UIProcess/API/wpe/WebKitPlugin.h: * UIProcess/API/wpe/WebKitSettings.h: * UIProcess/API/wpe/WebKitWebContext.h: * UIProcess/API/wpe/WebKitWebsiteData.h: * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bubblewrapSpawn): * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Plugins/gtk/PluginInfoCache.cpp: Removed. * UIProcess/Plugins/gtk/PluginInfoCache.h: Removed. * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp: Removed. * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp: Removed. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/gtk/WebPageProxyGtk.cpp: * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp: Removed. * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.h: Removed. * WebProcess/Plugins/Netscape/unix/PluginProxyUnix.cpp: Removed. * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp: Removed. * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h: Removed. * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginView.cpp: * WebProcess/Plugins/PluginView.h: 2020-08-17 Youenn Fablet <youenn@apple.com> Set Sec-WebSocket-Protocol for WebSocket NSURLSession code path https://bugs.webkit.org/show_bug.cgi?id=215456 <rdar://problem/66996369> Reviewed by Alex Christensen. Covered by existing protocol tests with NSURLSession code path enabled. http/tests/websocket/tests/hybi/set-protocol.html, http/tests/websocket/tests/hybi/workers/multiple-subprotocols.html Code change originating from Jiten Mehta. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::createWebSocketTask): Set Sec-WebSocket-Protocol to support WebSocket protocol negotiation. 2020-08-17 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r265725) [GTK][WPE] Several http/tests timeout/failures https://bugs.webkit.org/show_bug.cgi?id=215542 Reviewed by Sergio Villar Senin. The problem is that ShareableResource is now using the dataSize member of IPCHandle to encode/decode the resource size, but SharedMemoryUnix is not encoding/decoding dataSize. * Platform/unix/SharedMemoryUnix.cpp: (WebKit::SharedMemory::IPCHandle::encode const): (WebKit::SharedMemory::IPCHandle::decode): 2020-08-14 Simon Fraser <simon.fraser@apple.com> Scrolling sync changes in r261985 regressed CPU usage by ~2 ms/s https://bugs.webkit.org/show_bug.cgi?id=215529 <rdar://problem/66866163> Reviewed by Geoff Garen. r261985 added two code paths that wake up the scrolling thread on every rendering update (triggered by displayDidRefresh()). One is a ping from the EventDispatcher thread, the other is a wake-and-block from the main thread. If the scrolling thread isn't active (no wheel events received recently), we can avoid both of these to reduce the number of CPU core wakeups. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-08-15 Tim Horton <timothy_horton@apple.com> Live Web Content processes do not respect accent color if dynamically changed to "multicolor" https://bugs.webkit.org/show_bug.cgi?id=215523 <rdar://problem/63941133> Reviewed by Wenson Hsieh. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::setPreferenceValue): The NSUserDefaults syncing mechanism does not propagate defaults that are deleted or changed to nil. Allow nil, and fix up an assert that would fire for the same reason. 2020-08-14 Alex Christensen <achristensen@webkit.org> Revert r263551 https://bugs.webkit.org/show_bug.cgi?id=215530 <rdar://problem/66961066> Reviewed by Geoffrey Garen. I was hoping to fix many developers' bugs, but it caused hangs and more hangs, so back to the status quo. https://bugs.webkit.org/show_bug.cgi?id=203547 will fix this the right way in the hopefully-not-too-distant future. * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::setCookies): (API::HTTPCookieStore::registerForNewProcessPoolNotifications): (API::HTTPCookieStore::flushDefaultUIProcessCookieStore): * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: (API::HTTPCookieStore::flushDefaultUIProcessCookieStore): 2020-08-14 Kate Cheney <katherine_cheney@apple.com> Convert remaining SharedMemory::Handle to SharedMemory::IPCHandle https://bugs.webkit.org/show_bug.cgi?id=215471 <rdar://problem/67024177> Reviewed by David Kilzer. Use the new struct for sending SharedMemory::Handle objects via IPC, so we can include the exact size of data (SharedMemory::Handle::size() rounds up to the nearest page), and verify these sizes match when decoding. In many cases, the size is not sent as a separate argument via IPC, so we can initialize the IPCHandle object with SharedMemory::Handle::size(). We can remove the additional size parameter when it exists, because we are now passing IPCHandle which should include the size value. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: Send SharedMemory::IPCHandle object instead of SharedMemory::Handle over IPC. * NetworkProcess/ServiceWorker/WebSWOriginStore.cpp: (WebKit::WebSWOriginStore::sendStoreHandle): Since no additional size parameter is being sent in this function, we can use handle.size() as the IPCHandle::dataSize parameter. * Platform/SharedMemory.h: Remove encode/decode functions in SharedMemory::Handle. * Platform/cocoa/SharedMemoryCocoa.cpp: (WebKit::SharedMemory::Handle::encode const): Deleted. (WebKit::SharedMemory::Handle::decode): Deleted. * Platform/unix/SharedMemoryUnix.cpp: (WebKit::SharedMemory::IPCHandle::encode const): (WebKit::SharedMemory::IPCHandle::decode): * Platform/win/SharedMemoryWin.cpp: (WebKit::SharedMemory::IPCHandle::encode const): (WebKit::SharedMemory::IPCHandle::decode): (WebKit::SharedMemory::Handle::encode const): Deleted. (WebKit::SharedMemory::Handle::decode): Deleted. Remove SharedMemory::Handle encode/decode functions so we will not ever send a SharedMemory::Handle object over IPC accidentally in the future. * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::Handle::encode const): (WebKit::ShareableBitmap::Handle::decode): Keep m_size here because it is an IntSize object and is useful to check width/height parameters in the SharableBitmap object. * Shared/ShareableResource.cpp: (WebKit::ShareableResource::Handle::encode const): (WebKit::ShareableResource::Handle::decode): * Shared/WebCompiledContentRuleListData.cpp: (WebKit::WebCompiledContentRuleListData::encode const): (WebKit::WebCompiledContentRuleListData::decode): * Shared/WebCoreArgumentCoders.cpp: (IPC::encodeSharedBuffer): (IPC::decodeSharedBuffer): * Shared/WebHitTestResultData.cpp: (WebKit::WebHitTestResultData::encode const): (WebKit::WebHitTestResultData::decode): More cases of converting between SharedMemory::Handle and SharedMemory::IPCHandle when encoding/decoding. * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: * UIProcess/VisitedLinkStore.cpp: (WebKit::VisitedLinkStore::sendStoreHandleToProcess): * WebProcess/GPU/media/RemoteAudioBusData.h: (WebKit::RemoteAudioBusData::encode const): (WebKit::RemoteAudioBusData::decode): Since no additional size parameter is being sent in this function, we can use handle.size() as the IPCHandle::dataSize parameter. * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::storageChanged): * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::storageChanged): * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::setSWOriginTableSharedMemory): * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWClientConnection.messages.in: * WebProcess/WebPage/VisitedLinkTableController.cpp: (WebKit::VisitedLinkTableController::setVisitedLinkTable): * WebProcess/WebPage/VisitedLinkTableController.h: * WebProcess/WebPage/VisitedLinkTableController.messages.in: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::audioStorageChanged): * WebProcess/cocoa/RemoteCaptureSampleManager.h: * WebProcess/cocoa/RemoteCaptureSampleManager.messages.in: More cases of converting between SharedMemory::Handle and SharedMemory::IPCHandle when encoding/decoding. 2020-08-14 Per Arne Vollan <pvollan@apple.com> [Cocoa] Avoid changing XPC target queue inside XPC event handler https://bugs.webkit.org/show_bug.cgi?id=215460 Reviewed by Darin Adler. In WebProcess::handleXPCEndpointMessages we currently change the XPC target queue for the XPC bootstrap connection while under the XPC event handler. This sometimes causes simulated crashes on iOS and should be avoided. According to the documentation in https://developer.apple.com/documentation/xpc/1448786-xpc_connection_set_target_queue?language=objc, there does not seem to be anything saying this is a programming error, but the simulated crash claims otherwise. This patch addresses this issue by changing the initial target queue for the XPC bootstrap connection from the main thread queue to a queue on a secondary thread. The WebKit initializer function needs to be called on the main thread, which is done by synchronously dispatching the call on the main thread. This patch also stops changing the event handler for the bootstrap connection, but instead adds the additional XPC handling to the current event handler. No new tests, since this is covered by existing tests. The handling of the Launch Services XPC endpoint message that this patch changes, is used to receive the Launch Services database from the Networking process. The Launch Services database is used in MIME type mapping APIs, and many tests would fail if this database was not received in the WebContent process. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceEventHandler): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): * WebProcess/WebProcess.h: * WebProcess/cocoa/HandleXPCEndpointMessages.h: Added. * WebProcess/cocoa/HandleXPCEndpointMessages.mm: Added. (WebKit::handleXPCEndpointMessages): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::handleXPCEndpointMessages const): Deleted. 2020-08-14 Kate Cheney <katherine_cheney@apple.com> Convert SharedMemory::Handle to SharedMemory::IPCHandle WebPage image/pasteboard functions https://bugs.webkit.org/show_bug.cgi?id=215478 <rdar://problem/67024582> Reviewed by Chris Dumez. Convert SharedMemory::Handle objects to SharedMemory::IPCHandle objects which automatically verify the size of data being sent. We can remove the additional size parameter being sent in many IPC messages along with the handle, now that both are stored in the IPCHandle struct. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::setPromisedDataForImage): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::getPasteboardBufferForType): No longer need size check, this is done in the IPCHandle::decode() function. (WebKit::WebPasteboardProxy::setPasteboardBufferForType): (WebKit::WebPasteboardProxy::readBufferFromPasteboard): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebPasteboardProxy.cpp: (WebKit::WebPasteboardProxy::readBufferFromPasteboard): * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::saveImageToLibrary): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::dataSelectionForPasteboard): No longer need size check, this is done in the IPCHandle::decode() function. (WebKit::WebPageProxy::setPromisedDataForImage): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::writeItemsToPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::bufferForType): (WebKit::WebPlatformStrategies::setBufferForType): (WebKit::WebPlatformStrategies::readBufferFromPasteboard): No longer need size check, this is done in the IPCHandle::decode() function. * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getDataSelectionForPasteboard): (WebKit::WebPage::performActionOnElement): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::getDataSelectionForPasteboard): 2020-08-14 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, revert r265213 and r265441 https://bugs.webkit.org/show_bug.cgi?id=215089 This logging is no longer needed, since the test seems to be passing reliably in internal automation now. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView selectAllForWebView:]): 2020-08-13 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Notify the web process on drag leave https://bugs.webkit.org/show_bug.cgi?id=215373 Reviewed by Adrian Perez de Castro. We missed this when implemented drag and drop support for GTK4. * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::leave): Call dragExited() and resetCurrentDragInformation() on WebPageProxy. 2020-08-13 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Do not accept drag operations when the matched target list is empty https://bugs.webkit.org/show_bug.cgi?id=215372 Reviewed by Adrian Perez de Castro. Do not initialize m_selectionData if we don't have valid targets. * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::accept): (WebKit::DropTarget::leaveTimerFired): 2020-08-13 Brady Eidson <beidson@apple.com> (WK2 only) gamepad mapping stops being reported as “standard” in new tabs. rdar://problem/66946505 and https://bugs.webkit.org/show_bug.cgi?id=215486 Reviewed by Tim Horton. Covered by new API test. Get rid of the premature optimization that was "full gamepaddata" vs "condensed gamepaddata" In practice, the actual button and axis values are larger than the mapping and id, so not much IPC was being saved. * Shared/Gamepad/GamepadData.cpp: * Shared/Gamepad/GamepadData.h: * UIProcess/Gamepad/UIGamepad.cpp: (WebKit::UIGamepad::gamepadData const): (WebKit::UIGamepad::condensedGamepadData const): Deleted. (WebKit::UIGamepad::fullGamepadData const): Deleted. * UIProcess/Gamepad/UIGamepad.h: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::snapshotGamepads): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gamepadConnected): 2020-08-13 Kate Cheney <katherine_cheney@apple.com> Create SharedMemory::IPCHandle object to validate the size of SharedMemory::Handle objects sent over IPC https://bugs.webkit.org/show_bug.cgi?id=215288 <rdar://problem/60870795> Reviewed by David Kilzer. Part 1 of a multi-patch plan to convert all SharedMemory::Handle objects being sent over IPC to use SharedMemory::IPCHandle objects instead. * Platform/SharedMemory.h: (WebKit::SharedMemory::IPCHandle::IPCHandle): * Platform/cocoa/SharedMemoryCocoa.cpp: (WebKit::SharedMemory::IPCHandle::encode const): (WebKit::SharedMemory::IPCHandle::decode): Validate the size of the data sent in the IPCHandle::decode() function. * Platform/unix/SharedMemoryUnix.cpp: (WebKit::SharedMemory::IPCHandle::encode const): (WebKit::SharedMemory::IPCHandle::decode): * Platform/win/SharedMemoryWin.cpp: Implement IPCHandle encode and decode for all platforms for when we remove SharedMemory::Handle encode/decode functions. 2020-08-13 Adrian Perez de Castro <aperez@igalia.com> Unreviewed non-unified build fix. No new tests needed. * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::requestEnterFullScreen): Add missing WebCore:: namespace prefix to usage of WebCore::FullscreenManager. 2020-08-13 Chris Dumez <cdumez@apple.com> REGRESSION (r260684): Messages YouTube inline video: after Multitasking away and Back, Audio is heard but icon indicates "muted" https://bugs.webkit.org/show_bug.cgi?id=215453 <rdar://problem/66136673> Reviewed by Tim Horton. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setIsDoingSnapshotSequence): (WebKit::WebPageProxy::setShouldFireEvents): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKApplicationStateTrackingView.mm: (-[WKApplicationStateTrackingView _willBeginSnapshotSequence]): (-[WKApplicationStateTrackingView _didCompleteSnapshotSequence]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setIsDoingSnapshotSequence): (WebKit::WebPage::setShouldFireEvents): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-08-13 Per Arne Vollan <pvollan@apple.com> Unreviewed, reverting r265520. Invalid sandbox change Reverted changeset: "[macOS] Deny access to directory for compiled WebKit sandboxes" https://bugs.webkit.org/show_bug.cgi?id=215384 https://trac.webkit.org/changeset/265520 2020-08-12 Keith Rollin <krollin@apple.com> Remove the need for defining USE_NEW_BUILD_SYSTEM https://bugs.webkit.org/show_bug.cgi?id=215439 Reviewed by Darin Adler. When building WebKit for XCBuild, we currently require that the external build system (such as the Makefile, build-webkit, etc.) defines the USE_NEW_BUILD_SYSTEM=YES build setting. This build setting controls parts of our build instructions that are sensitive to when XCBuild or the Legacy build system are being used. Notably, we need to know when to use our custom “copy and modify” scripts with copying certain header files (used with the Legacy build system) vs. using the enhanced Copy Headers build phase that’s enabled with APPLY_RULES_IN_COPY_HEADERS=YES (introduced with and used by XCBuild). The choice of which method to copy headers is used is controlled by USE_NEW_BUILD_SYSTEM. There is no built-in build setting that we can probe to help us determine which approach to take when copying and modifying headers, which is why we need to define USE_NEW_BUILD_SYSTEM ourselves. But it turns out that we can *detect* which build system is being used by taking advantage of a subtle difference between the two systems. As noted in: https://developer.apple.com/documentation/xcode-release-notes/build-system-release-notes-for-xcode-10 “When an .xcconfig file contains multiple assignments of the same build setting, later assignments using $(inherited) or $(<setting_name>) will inherit from earlier assignments in the .xcconfig. The legacy build system caused every use of $(inherited) or $(<setting_name>) skip any other values defined within the .xcconfig.” This difference can be exploited as follows: WK_WHICH_BUILD_SYSTEM = not_ WK_WHICH_BUILD_SYSTEM = $(inherited)legacy WK_USE_NEW_BUILD_SYSTEM = $(WK_USE_NEW_BUILD_SYSTEM_$(WK_WHICH_BUILD_SYSTEM)) WK_USE_NEW_BUILD_SYSTEM_legacy = NO WK_USE_NEW_BUILD_SYSTEM_not_legacy = YES We can then use WK_USE_NEW_BUILD_SYSTEM where we used to use the externally-defined USE_NEW_BUILD_SYSTEM. No new tests -- no new or changed functionality. * Configurations/Base.xcconfig: * Configurations/WebKit.xcconfig: * WebKit.xcodeproj/project.pbxproj: 2020-08-12 Alex Christensen <achristensen@webkit.org> Fail preconnect requests to deprecated TLS instead of allowing application to show warning https://bugs.webkit.org/show_bug.cgi?id=215424 <rdar://problem/66784116> Reviewed by Geoffrey Garen. Preconnecting is just a suggestion, so if the content really wants to load something from the deprecated TLS server, we will see the warning when the load actually happens. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): 2020-08-12 Brent Fulgham <bfulgham@apple.com> [iOS] Allow additional iokit-get-property to support HEIF images https://bugs.webkit.org/show_bug.cgi?id=215431 <rdar://problem/66760775> Reviewed by Per Arne Vollan. Allow the WebContent process to read the HEVCCanDecodeTileToCanvas property. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-08-12 Per Arne Vollan <pvollan@apple.com> [macOS] Fix iokit get property sandbox violation https://bugs.webkit.org/show_bug.cgi?id=215430 <rdar://problem/65290967> Reviewed by Brent Fulgham. The WebContent process' sandbox on macOS needs to allow querying the iokit property "acoustic-id". * WebProcess/com.apple.WebProcess.sb.in: 2020-08-12 Peng Liu <peng.liu6@apple.com> Add the support to return to element fullscreen from picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=215305 Reviewed by Jer Noble. This patch replaces WKFullScreenViewControllerVideoFullscreenModelClient with WKFullScreenWindowControllerVideoFullscreenModelClient. We need to do that because the instance of WKFullScreenViewControllerVideoFullscreenModelClient will be destroyed after the container element exits fullscreen while the video element enters picture-in-picture. The instance of WKFullScreenWindowControllerVideoFullscreenModelClient will always exist when the WKFullScreenWindowController instance is alive, so that it can receive callbacks from the VideoFullscreenInterfaceAVKit instance to implement the "return to element fullscreen from picture-in-picture" feature. This patch supports the following transitions: element fullscreen -> picture-in-picture (through user gestures) element fullscreen -> picture-in-picture (through the PiP button) picture-in-picture -> element fullscreen (when the tab is visible) picture-in-picture -> element fullscreen (when the tab is invisible) picture-in-picture -> element fullscreen (when the browser is in background) picture-in-picture -> inline (when the browser is in foreground) exit picture-in-picture when the browser is in background * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::fullscreenWillReturnToInline): (WebKit::VideoFullscreenModelContext::prepareToExitFullscreen): Notify clients to prepare for the stop of fullscreen/picture-in-picture. (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): Fix issues that increase the client count unnecessarily. (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): Call m_page->fullscreenMayReturnToInline() earlier. (WebKit::VideoFullscreenManagerProxy::fullscreenMayReturnToInline): Ditto. (WebKit::VideoFullscreenManagerProxy::fullscreenWillReturnToInline): Notify VideoFullscreenManager to prepare for exiting picture-in-picture or video fullscreen and report the destination rectangle of the exit picture-in-picture or video fullscreen animations. * UIProcess/WebFullScreenManagerProxy.cpp: (WebKit::WebFullScreenManagerProxy::requestEnterFullScreen): * UIProcess/WebFullScreenManagerProxy.h: Add a function requestEnterFullScreen() so that we can request an element to enter fullscreen from the UI process side. * UIProcess/ios/fullscreen/WKFullScreenViewController.h: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController initWithWebView:]): (-[WKFullScreenViewController dealloc]): (-[WKFullScreenViewController videoControlsManagerDidChange]): (-[WKFullScreenViewController setAnimatingViewAlpha:]): (-[WKFullScreenViewController _cancelAction:]): (WKFullScreenViewControllerVideoFullscreenModelClient::setParent): Deleted. (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface): Deleted. (WKFullScreenViewControllerVideoFullscreenModelClient::interface const): Deleted. (-[WKFullScreenViewController willEnterPictureInPicture]): Deleted. (-[WKFullScreenViewController didEnterPictureInPicture]): Deleted. (-[WKFullScreenViewController failedToEnterPictureInPicture]): Deleted. Minor clean-ups and remove code related to WKFullScreenViewControllerVideoFullscreenModelClient. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (WKFullScreenWindowControllerVideoFullscreenModelClient::setParent): (WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface): (WKFullScreenWindowControllerVideoFullscreenModelClient::interface const): (-[WKFullScreenWindowController initWithWebView:]): (-[WKFullScreenWindowController dealloc]): (-[WKFullScreenWindowController enterFullScreen]): (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController requestEnterFullScreen]): (-[WKFullScreenWindowController requestExitFullScreen]): (-[WKFullScreenWindowController _completedExitFullScreen]): (-[WKFullScreenWindowController videoControlsManagerDidChange]): (-[WKFullScreenWindowController willEnterPictureInPicture]): (-[WKFullScreenWindowController didEnterPictureInPicture]): (-[WKFullScreenWindowController failedToEnterPictureInPicture]): (-[WKFullScreenWindowController prepareToExitPictureInPicture]): (-[WKFullScreenWindowController didExitPictureInPicture]): Add WKFullScreenWindowControllerVideoFullscreenModelClient and implement the support to "restore fullscreen from picture-in-picture". * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::enterFullScreenForElement): (WebKit::WebFullScreenManager::requestEnterFullScreen): * WebProcess/FullScreen/WebFullScreenManager.h: * WebProcess/FullScreen/WebFullScreenManager.messages.in: Add the interface requestEnterFullScreen() and the corresponding IPC message. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::prepareForVideoFullscreen): * WebProcess/WebCoreSupport/WebChromeClient.h: Add the interface to prepare for video fullscreen standby. The web process can use this interface to create a VideoFullscreenManager instance to avoid the scenario that an IPC message comes from the VideoFullscreenManagerProxy but the VideoFullscreenManager instance is not constructed yet. * WebProcess/cocoa/VideoFullscreenManager.h: * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::fullscreenWillReturnToInline): (WebKit::VideoFullscreenManager::fullscreenMayReturnToInline): Deleted. Rename fullscreenMayReturnToInline() to fullscreenWillReturnToInline(). In the UI process side, fullscreenMayReturnToInline() is used by VideoFullscreenManagerProxy to notify applications regarding UI changes (e.g., switch browser tabs). 2020-08-12 Wenson Hsieh <wenson_hsieh@apple.com> WebPageProxy::registerEditCommand should be robust against invalid undo step identifiers https://bugs.webkit.org/show_bug.cgi?id=215412 <rdar://problem/66296820> Reviewed by Tim Horton. Add a `MESSAGE_CHECK` to avoid ever creating a `WebEditCommandProxy` with an invalid command identifier. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::registerEditCommand): 2020-08-12 Youenn Fablet <youenn@apple.com> Refresh WritableStream up to spec https://bugs.webkit.org/show_bug.cgi?id=215267 Reviewed by Geoff Garen. * Shared/WebPreferences.yaml: Add a dedicated runtime flag, off by default. 2020-08-12 Youenn Fablet <youenn@apple.com> Enable H264 low latency code path by default for MacOS https://bugs.webkit.org/show_bug.cgi?id=215371 Reviewed by Eric Carlson. Covered by existing tests, in particular platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebRTCH264LowLatencyEncoderEnabled): 2020-08-12 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r261570): [GTK] Fails to send drop event to JavaScript https://bugs.webkit.org/show_bug.cgi?id=215032 Reviewed by Darin Adler. Handle custom data in drag and drop operations. * UIProcess/API/gtk/DragSourceGtk3.cpp: (WebKit::DragSource::DragSource): (WebKit::DragSource::begin): * UIProcess/API/gtk/DragSourceGtk4.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::accept): (WebKit::DropTarget::dataReceived): * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::accept): 2020-08-11 Jer Noble <jer.noble@apple.com> [Mac] Add Experimental Feature preference for SW VP9 https://bugs.webkit.org/show_bug.cgi?id=215043 <rdar://problem/66400034> Reviewed by Beth Dakin. * FeatureFlags/WebKit.plist: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): * Shared/WebPageCreationParameters.h: * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultVP9SWDecoderEnabledOnBattery): * Shared/WebPreferencesDefaultValues.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): (WebKit::WebProcess::enableVP9SWDecoder): * WebProcess/WebProcess.h: 2020-08-11 Brady Eidson <beidson@apple.com> Add a "use stored credentials" setting to WKWebView. <rdar://problem/63308019> and https://bugs.webkit.org/show_bug.cgi?id=215388 Reviewed by Geoff Garen. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::preconnectTo): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _canUseCredentialStorage]): (-[WKWebView _setCanUseCredentialStorage:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preconnectTo): (WebKit::WebPageProxy::setCanUseCredentialStorage): (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::canUseCredentialStorage): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::setCanUseCredentialStorage): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-08-11 Per Arne Vollan <pvollan@apple.com> [macOS] Deny access to directory for compiled WebKit sandboxes https://bugs.webkit.org/show_bug.cgi?id=215384 Reviewed by Brent Fulgham. A WebKit process on macOS should not be allowed access to the directory containing compiled sandboxes after entering the sandbox itself. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-08-11 Tim Horton <timothy_horton@apple.com> iOS: Scrolling and touch events sporadically stop working after navigating https://bugs.webkit.org/show_bug.cgi?id=215368 <rdar://problem/65801531> Reviewed by Wenson Hsieh. Test: fast/events/touch/ios/touch-event-stall-after-navigating-with-pending-asynchronous-touch-start.html WebPageProxy::handlePreventableTouchEvent keeps a counter of the number of outstanding "preventable" touch events that it is waiting to hear from the Web Content process about. This counter is incremented when the event is dispatched to the Web Content process's EventHandler queue, and decremented when the reply (whether it was handled or not) comes back from the Web Content process. While the counter is non-zero, all deferrable gestures remain deferred (and when it returns to zero, the WKDeferringGestureRecognizer gate is lifted, and events are allowed to flow). This means that it is very important that every event eventually reply about its handling status. Before this change, when the Web Content process is navigating, and reaches didCommitLoad, it cleared all queued touch events, without replying to to the UI process. Thus, there is a small window of time in which an incoming touch event will end up in the queue, *not* get dispatched/replied, and then get dropped on the floor in didCommitLoad. Most events do not meet this fate, because they are handled promptly, and commitLoad/didCommitLoad tend to be very quick. However, if the Web Content process ends up spending any significant amount of time under commitLoad (say, in an unload handler, or in media frameworks), any incoming touch events during that time will get lost, and the UI process' count of outstanding events will end up getting stuck non-zero. Fix this by always pretending that the page ate any events that were outstanding when didCommitLoad occurs, instead of just dropping them on the floor. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::doneWithTouchEvent): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::takeQueuedTouchEventsForPage): (WebKit::EventDispatcher::clearQueuedTouchEventsForPage): Deleted. (WebKit::EventDispatcher::getQueuedTouchEventsForPage): Deleted. Also, rename getQueuedTouchEventsForPage to takeQueuedTouchEventsForPage, since it removes the queue from EventDispatcher's set. * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::touchEventSync): (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::cancelAsynchronousTouchEvents): 2020-08-11 Philippe Normand <pnormand@igalia.com> [GStreamer] gst-full standalone library support https://bugs.webkit.org/show_bug.cgi?id=215262 Reviewed by Xabier Rodriguez-Calvar. Disable missing-plugins handling when gst-full is in use. The plugin installer doesn't make much sense for this scenario. * PlatformWPE.cmake: * UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp: (webkitInstallMissingMediaPluginsPermissionRequestAllow): (webkitInstallMissingMediaPluginsPermissionRequestDeny): (webkit_install_missing_media_plugins_permission_request_get_description): * UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequestPrivate.h: * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewRequestInstallMissingMediaPlugins): * UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp: * UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.h: * UIProcess/gstreamer/WebPageProxyGStreamer.cpp: (WebKit::WebPageProxy::requestInstallMissingMediaPlugins): 2020-08-10 Chris Dumez <cdumez@apple.com> AuxiliaryProcess::didReceiveInvalidMessage() for WebPage::PerformDragControllerAction IPC https://bugs.webkit.org/show_bug.cgi?id=215341 <rdar://problem/59344091> Reviewed by Alex Christensen. DragApplicationFlags is an enum containing flags. It was being sent over IPC as a DragApplicationFlags instead of an OptionSet<DragApplicationFlags>, and thus would fail enum value validation when decoding when more than one flag is set. * Scripts/webkit/messages.py: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DragData>::decode): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::applicationFlagsForDrag): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performDragControllerAction): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-08-10 David Kilzer <ddkilzer@apple.com> Use RefPtr for WebKit::WebOpenPanelResultListenerProxy <https://webkit.org/b/215252> <rdar://problem/65753821> Reviewed by Geoffrey Garen. Unable to create an API test for this. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::runOpenPanel): - Use RefPtr<WebOpenPanelResultListenerProxy> when passing `listener` into the block. 2020-08-10 Wenson Hsieh <wenson_hsieh@apple.com> Add more logging to diagnose editing/selection/ios/select-all-non-editable-text-using-keyboard.html https://bugs.webkit.org/show_bug.cgi?id=215089 <rdar://problem/66282806> Reviewed by Tim Horton. Remove some unnecessary declarations that were only used for debug logging in WebKitTestRunner, and add some more logging to check whether the web view is even getting a call to select all from UIKit. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView selectAllForWebView:]): 2020-08-10 Sihui Liu <sihui_liu@apple.com> Always suspend IDB work when network process is prepared to suspend https://bugs.webkit.org/show_bug.cgi?id=215239 <rdar://problem/65690450> Reviewed by Geoffrey Garen. We do not suspend IDB work in the network process when there is an ongoing transaction because the network process is going to ask the UI process to hold a background process assertion for it. However, it is possible that the request from the network process does not reach the UI process in time: RunningBoard may already decide to suspend the network process after app is backgrounded and UI process drops the foreground assertion for the network process. In this case, IDB in the network process would continue its transaction and the network process will be killed when it becomes suspened for holding database file locks. A network process crash can lead to a worse result than suspending IDB work, which aborts ongoing transactions, because it will destroy all database connections and transaction. Therefore, let's just suspend IDB work when the network process receives prepareToSuspend message. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::suspend): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::prepareToSuspend): 2020-08-10 Per Arne Vollan <pvollan@apple.com> Add required entitlement for Catalyst https://bugs.webkit.org/show_bug.cgi?id=215244 Reviewed by Darin Adler. The entitlement 'com.apple.private.webkit.use-xpc-endpoint' should be added to the WebContent process on Catalyst as well, since it is needed on all Apple platforms. This entitlement is needed to support direct XPC communication between WebKit processes, which is used to send the Launch Services database to the WebContent process from the Networking process. Also, add some more logging related to this, to detect if it takes a long time for the WebContent process to receive the database. * Scripts/process-entitlements.sh: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2020-08-09 Said Abou-Hallawa <sabouhallawa@apple.com> [macOS] Drag/drop an image of a unsupported format to an file input element should convert it to a supported format https://bugs.webkit.org/show_bug.cgi?id=212482 <rdar://problem/63731672> Reviewed by Darin Adler. Move ImageUtilities.h and ImageUtilitiesCG.cpp from WebKit to WebCore. Use the image transcoding functions and shared WorkQueue from WebCore. * Platform/ImageUtilities.h: Removed. * Platform/cg: Removed. * SourcesCocoa.txt: * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithImageTranscoding): (WebKit::m_transcodingQueue): Deleted. * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: 2020-08-08 Wenson Hsieh <wenson_hsieh@apple.com> [ iOS wk2 ] editing/pasteboard/paste-without-nesting.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=215218 <rdar://problem/66628493> Reviewed by Darin Adler. This test writes to the system pasteboard using `document.execCommand("Copy")`, and then immediately reads from the system pasteboard by triggering `document.execCommand("Paste")`. On rare occasions, this fails on iOS, where IPC messages for writing content to the pasteboard (e.g. `WebPasteboardProxy::WriteWebContentToPasteboard`) are asynchronous, but the IPC message to get the pasteboard change count before pasting (`GetPasteboardChangeCount`) is synchronous. This means that `Connection` may end up dispatching the sync `GetPasteboardChangeCount` IPC message before dispatching `WriteWebContentToPasteboard`, which causes the pasteboard read to fail, because the contents on the pasteboard have changed after starting to read from the pasteboard. Note that this is not a problem on macOS since all pasteboard writing IPC is synchronous. Instead of turning all of the async iOS pasteboard writing messages synchronous as well, we can fix this by adding a mechanism in `WebProcess` to keep track of outgoing async pasteboard write messages; then, before attempting to grab the change count when we start reading, wait for any of these pending async writes to finish before we continue. In a future patch, we could actually adopt this same mechanism in `SetPasteboardTypes` and neighboring IPC messages to turn these all asynchronous. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::writeURLToPasteboard): (WebKit::WebPasteboardProxy::writeWebContentToPasteboard): (WebKit::WebPasteboardProxy::writeImageToPasteboard): (WebKit::WebPasteboardProxy::writeStringToPasteboard): Call `didWriteToPasteboardAsynchronously` after we finish writing to the pasteboard asynchronously. * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::changeCount): Before accessing changeCount, wait until any asynchronous calls to write to the system pasteboard have finished. (WebKit::WebPlatformStrategies::writeToPasteboard): Right before we send an async message to the UI process to write to the system pasteboard, notify `WebProcess` so that it can keep track of pending clipboard writes. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::willWriteToPasteboardAsynchronously): (WebKit::WebProcess::didWriteToPasteboardAsynchronously): (WebKit::WebProcess::waitForPendingPasteboardWritesToFinish): Wait for a maximum of 1 second for any outgoing pasteboard writing messages to return to the web process. 2020-08-07 Chris Dumez <cdumez@apple.com> baseLatency attribute is missing on AudioContext interface https://bugs.webkit.org/show_bug.cgi?id=215277 Reviewed by Eric Carlson. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::framesPerBuffer const): (WebKit::RemoteAudioDestinationManager::createAudioDestination): * GPUProcess/media/RemoteAudioDestinationManager.h: * GPUProcess/media/RemoteAudioDestinationManager.messages.in: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-08-07 John Wilander <wilander@apple.com> Experimental: Cap the expiry of persistent cookies set in 3rd-party CNAME cloaked HTTP responses https://bugs.webkit.org/show_bug.cgi?id=215201 <rdar://problem/57454633> Reviewed by Brent Fulgham. Also reviewed and commented on by Chris Dumez, Jiten Mehta, Sam Weinig, and Alex Christensen. This experimental feature is off by default. CNAME cloaking means a host resolves to a a different domain, potentially a third-party domain, as part of DNS resolution. This patch makes WebKit::NetworkDataTaskCocoa capture any CNAME cloaking for the first party host and stores it in a table in the WebKit::NetworkSession. It then checks first party subresource loads to see if they resolve to a different domain and if so, compare that domain to both the first party domain and its CNAME cloaking domain, if there is one. If there's a mismatch, it's deemed a case of third-party CNAME cloaking and any cookies set in the response of the cloaked subresource load will have their expiry capped to 7 days. The cases for capping expiry look like this (and are backed by test cases): First-party host | First-party subdomain | Capped expiry ------------------|----------------------------|-------------- No CNAME cloaking | No CNAME cloaking | No No CNAME cloaking | First-party CNAME cloaking | No No CNAME cloaking | Third-party CNAME cloaking | Yes CNAME cloaking | No CNAME cloaking | No CNAME cloaking | Matching CNAME cloaking | No CNAME cloaking | First-party CNAME cloaking | No CNAME cloaking | Third-party CNAME cloaking | Yes This patch makes use of two new CFNetwork SPIs on NSURLSessionTask: - _cookieTransformCallback - _resolvedCNAMEChain * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::resetParametersToDefaultValues): This reset now covers the new CNAME cloaking member variables. (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest): This function now also enables the CNAME cloaking code. (WebKit::NetworkProcess::setFirstPartyHostCNAMEDomainForTesting): (WebKit::NetworkProcess::setThirdPartyCNAMEDomainForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: New IPC to forward test configuration. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): Now picks up the flag for this feature. (WebKit::NetworkSession::setFirstPartyHostCNAMEDomain): This is called from NetworkDataTaskCocoa::updateFirstPartyInfoForTaskAndSession() when there is CNAME cloaking for the first party host. This is done to make it possible to not cap the expiry of cookies if subsequent subresource loads have CNAME cloaking that matches the first-party host's CNAME cloaking. This happens when whole websites are hosted on edge networks. This function is also used by the test infrastructure to mock the DNS resolution for a first-party host. (WebKit::NetworkSession::firstPartyHostCNAMEDomain): This returns any captured CNAME cloaking for a host, if there is one. (WebKit::NetworkSession::resetCNAMEDomainData): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::setCNAMECloakingMitigationEnabled): (WebKit::NetworkSession::cnameCloakingMitigationEnabled const): (WebKit::NetworkSession::setThirdPartyCNAMEDomainForTesting): This test functions allows us to mock the DNS resolution for a subresource. (WebKit::NetworkSession::thirdPartyCNAMEDomainForTesting const): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::hasCNAMEAndCookieTransformSPI): (WebKit::lastCNAMEDomain): (WebKit::NetworkDataTaskCocoa::updateFirstPartyInfoForSession): This is called by NetworkDataTaskCocoa::didReceiveResponse() to capture any CNAME cloaking for the first-party host. (WebKit::NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking): This is called in the NetworkDataTaskCocoa constructor and in NetworkDataTaskCocoa::willPerformHTTPRedirection() and sets the new _cookieTransformCallback SPI property on the task which will check the response for any third-party CNAME cloaking and cap the expiry of incoming cookies accordingly. (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): This now calls NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking(). (WebKit::NetworkDataTaskCocoa::didReceiveResponse): This now calls NetworkDataTaskCocoa::updateFirstPartyInfoForTaskAndSession(). (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): This now calls NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking(). * Shared/ResourceLoadStatisticsParameters.h: Now holds a WebCore::CNAMECloakingMitigationEnabled flag. (WebKit::ResourceLoadStatisticsParameters::encode const): (WebKit::ResourceLoadStatisticsParameters::decode): * Shared/WebPreferences.yaml: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyHostCNAMEDomainForTesting): Used to mock CNAME resolution data. (WKWebsiteDataStoreSetResourceLoadStatisticsThirdPartyCNAMEDomainForTesting): Used to mock CNAME resolution data. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setFirstPartyHostCNAMEDomainForTesting): (WebKit::NetworkProcessProxy::setThirdPartyCNAMEDomainForTesting): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): Now handles the WebCore::CNAMECloakingMitigationEnabled flag. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): Now handles the WebCore::CNAMECloakingMitigationEnabled flag. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyHostCNAMEDomainForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsThirdPartyCNAMEDomainForTesting): (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-08-07 Wenson Hsieh <wenson_hsieh@apple.com> Remove UIScriptController.removeAllDynamicDictionaries() https://bugs.webkit.org/show_bug.cgi?id=215207 Reviewed by Sam Weinig. See Tools/ChangeLog for more detail. * Platform/spi/ios/UIKitSPI.h: 2020-08-06 Kenneth Russell <kbr@chromium.org> Implement createImageBitmap(ImageData) https://bugs.webkit.org/show_bug.cgi?id=183438 Reviewed by Dean Jackson. Add "AlphaPremultiplication destFormat" argument to putImageData, to handle creation of non-premultiplied ImageBitmaps from ImageData. * GPUProcess/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::putImageData): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: * WebProcess/GPU/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::putImageData): 2020-08-06 David Kilzer <ddkilzer@apple.com> WTF::makeString() should handle enum values <https://webkit.org/b/214906> Reviewed by Sam Weinig. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendMessage): * Shared/Cocoa/AuxiliaryProcessCocoa.mm: (WebKit::AuxiliaryProcess::didReceiveInvalidMessage): - Update to take advantage of enum support in WTF::makeString(). 2020-08-06 Jer Noble <jer.noble@apple.com> [Mac,WK2] REGRESSION(r262322): ScreenTime overlay is hidden in fullscreen mode https://bugs.webkit.org/show_bug.cgi?id=215222 <rdar://problem/65871844> Reviewed by Eric Carlson. During a refactor, a call to -[NSWindow setAutodisplay:YES] was dropped (in addition to a call to NSEnableScreenUpdates(), but that has a 1s timeout so its effects aren't persistent). This meant all NSViews added to that window need -display called on them explicitly in order to paint, and so subviews like the ScreenTime overlay is never drawn. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): 2020-08-06 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r265328. Broke 17 MediaRecorder tests. Reverted changeset: "Add support for MediaRecorder bitrate options" https://bugs.webkit.org/show_bug.cgi?id=214973 https://trac.webkit.org/changeset/265328 2020-08-06 Youenn Fablet <youenn@apple.com> Add support for MediaRecorder bitrate options https://bugs.webkit.org/show_bug.cgi?id=214973 Reviewed by Eric Carlson. Serialize options when creating remote media recorder. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::create): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::createRecorder): * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): * WebProcess/GPU/webrtc/MediaRecorderProvider.h: 2020-08-06 Adrian Perez de Castro <aperez@igalia.com> [WPE][GTK] Wrong argument order for clone syscall seccomp filter on s390x https://bugs.webkit.org/show_bug.cgi?id=215212 Reviewed by Michael Catanzaro. Patch based on this Flatpak pull request: https://github.com/flatpak/flatpak/pull/3777 No new tests needed. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::setupSeccomp): Add preprocessor guard to choose the correct clone() system call argument on S390. 2020-08-06 James Savage <james.savage@apple.com> Could not find module 'WebKit' for target 'armv7-apple-ios' <https://bugs.webkit.org/show_bug.cgi?id=215190> <rdar://problem/65642049> Reviewed by Brady Eidson. * SwiftOverlay/Configurations/WebKitSwiftOverlayTests.xcconfig: Define SWIFT_MODULE_ONLY_ARCHS to emit other architectures. 2020-08-05 Tim Horton <timothy_horton@apple.com> Remove all references to non-existent 10.16 https://bugs.webkit.org/show_bug.cgi?id=215202 Reviewed by Wenson Hsieh. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: * Scripts/process-entitlements.sh: * WebProcess/com.apple.WebProcess.sb.in: 2020-08-05 Per Arne Vollan <pvollan@apple.com> [Cocoa] Sandbox extension token not cleared from memory https://bugs.webkit.org/show_bug.cgi?id=215136 Reviewed by Geoffrey Garen. As a security mitigation, an invalidated sandbox extension should have its token cleared from memory. No new tests, covered by existing tests. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::m_length): (WebKit::SandboxExtensionImpl::~SandboxExtensionImpl): 2020-08-05 Per Arne Vollan <pvollan@apple.com> [Cocoa] Remove obsolete sandbox extension after r264178 https://bugs.webkit.org/show_bug.cgi?id=215154 Reviewed by Brent Fulgham. After r264178, the code related to issuing an extension to com.apple.lsd.mapdb is obsolete, and should be removed. No new tests, covered by existing tests. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * 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): * WebProcess/com.apple.WebProcess.sb.in: 2020-08-05 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Keyboard shortcuts and arrow key scrolling stop working after navigating via swipe gesture https://bugs.webkit.org/show_bug.cgi?id=215137 <rdar://problem/65082979> Reviewed by Tim Horton. The process of starting a navigation swipe gesture causes the first responder (in this case, WKContentView) to resign. Subsequently, nothing makes the content view first responder again once the navigation gesture ends, even if the gesture is cancelled and we don't end up navigating. This results in several symptoms, two of which are that keyboard shortcuts stop working, and pressing arrow keys does not scroll the web view after ending the swipe gesture. To mitigate this, add a mechanism to have the web view remember that our content view was first responder before calling `-startInteractiveTransition:`; after ending the interactive transition (i.e. swipe gesture), we then restore the web view's content view as first responder if it is not already first responder (and it is also parented, which is not the case when swiping back to close a newly opened tab in Safari). Test: NavigationSwipeTests.RestoreFirstResponderAfterNavigationSwipe NavigationSwipeTests.DoNotBecomeFirstResponderAfterNavigationSwipeIfWebViewIsUnparented * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _navigationGestureDidBegin]): (-[WKWebView _navigationGestureDidEnd]): 2020-08-04 Brent Fulgham <bfulgham@apple.com> Unreviewed build fix after r265263 https://bugs.webkit.org/show_bug.cgi?id=215139 <rdar://problem/66501746> * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-08-04 Devin Rousso <drousso@apple.com> "DoubleDown Casino" respin button stops working with trackpad https://bugs.webkit.org/show_bug.cgi?id=215146 <rdar://problem/64668138> Reviewed by Tim Horton. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shouldUseMouseGestureRecognizer]): 2020-08-04 Per Arne Vollan <pvollan@apple.com> [iOS] Issue a temporary extension to the MobileGestalt daemon when the MobileGestalt cache is invalid https://bugs.webkit.org/show_bug.cgi?id=214965 Unreviewed, address review comments. Add comment explaining why a set of MobileGestalt queries are performed when starting up the WebContent process on iOS. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-08-04 Per Arne Vollan <pvollan@apple.com> [iOS] Check that Accessibility is enabled when receiving the enable Accessibility notification https://bugs.webkit.org/show_bug.cgi?id=215112 <rdar://problem/66498397> Reviewed by Youenn Fablet. As a security mitigation, return early when handling this notification if Accessibility is not enabled. API test: WebKit.AccessibilityHasNoPreferencesServiceAccessWhenPostingNotification * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): 2020-08-04 Brent Fulgham <bfulgham@apple.com> Limit 'com.apple.webkit.microphone' use to macOS and MacCatalyst https://bugs.webkit.org/show_bug.cgi?id=215139 <rdar://problem/66501746> Reviewed by Eric Carlson. We only need the 'com.apple.webkit.microphone' Sandbox Extension at startup on macOS and MacCatalyst (and even on those platforms, only until <rdar://problem/29448368> is fixed). We should not issue this extension on the iOS family of targets. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-08-04 Per Arne Vollan <pvollan@apple.com> [iOS Simulator] Assert under WebPage::platformDidReceiveLoadParameters https://bugs.webkit.org/show_bug.cgi?id=215108 Reviewed by Youenn Fablet. This asserts because it appears that the WebContent and Networking process do not have the required entitlement com.apple.private.webkit.use-xpc-endpoint on the iOS Simulator. Add the entitlement for simulator. No new tests, covered by existing tests. * Resources/ios/XPCService-embedded-simulator.entitlements: 2020-08-03 Wenson Hsieh <wenson_hsieh@apple.com> Allow -accessoryDone to blur the focused element on iPad when AutoFilling strong passwords https://bugs.webkit.org/show_bug.cgi?id=215105 <rdar://problem/65143984> Reviewed by Tim Horton. `-accessoryDone` is now used to dismiss the strong password AutoFill keyboard after choosing a password on iOS, due to how it hides the keyboard without causing the content view to resign first responder; being stuck in a state where the content view is not first responder causes several issues when choosing strong passwords on iOS, such as keyboard shortcuts no longer working. On iPad, to ensure that `-accessoryDone` actually dismisses the keyboard, we need to additionally teach `-endEditingAndUpdateFocusAppearanceWithReason:` (when given `EndEditingReasonAccessoryDone`) to allow the focused element to blur when dismissing the strong password input view. Test: KeyboardInputTests.TestWebViewAccessoryDoneDuringStrongPasswordAssistance * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): Refactor this logic into a local helper lambda with early returns, instead of using a single if statement. 2020-08-03 Youenn Fablet <youenn@apple.com> Move user gesture propagation over promise behind a feature flag https://bugs.webkit.org/show_bug.cgi?id=215014 Reviewed by Eric Carlson. Add a preference, on by default. * Shared/WebPreferences.yaml: 2020-08-03 Alex Christensen <achristensen@webkit.org> Null check parentProcessConnection when creating a NetworkDataTaskCocoa https://bugs.webkit.org/show_bug.cgi?id=215109 <rdar://problem/64853922> Reviewed by Chris Dumez. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::sessionWrapperForTask): Null check parentProcessConnection. Otherwise, we can dereference null and crash between disconnecting with the parent process and terminating, which isn't the worst time to crash because we are trying to terminate anyways. But we may as well not crash. 2020-08-03 Wenson Hsieh <wenson_hsieh@apple.com> Remove the ENABLE_DATA_INTERACTION feature flag https://bugs.webkit.org/show_bug.cgi?id=215091 Reviewed by Megan Gardner. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/DragDropInteractionState.mm: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]): * UIProcess/ios/WebPageProxyIOS.mm: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: 2020-08-03 Tim Horton <timothy_horton@apple.com> Fix the macCatalyst build * UIProcess/EndowmentStateTracker.mm: (WebKit::EndowmentStateTracker::stateFromEndowments): 2020-08-03 Per Arne Vollan <pvollan@apple.com> Finalize the list of MobileGestalt queries needed to populate the in-memory cache in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=215095 <rdar://problem/66034080> Reviewed by Geoffrey Garen. When the MobileGestalt cache is invalid, we issue a temporary extension to the MobileGestalt daemon for the WebContent process, which will populate the in-memory cache by doing a set of MobileGestalt queries before revoking the extension. This patch finalizes the list of MobileGestalt queries needed to populate the in-memory cache in the WebContent process on iOS before revoking the temporary extension to com.apple.mobilegestalt.xpc. This list was compiled by querying every possible MobileGestalt key after the temporary extension was revoked, and make a note of all queries that were contacting the MobileGestalt daemon to get the answer. The added queries in this patch should make the list complete, and ensures that all cachable values are in the in-memory cache before revoking the extension, since every possible MobileGestalt query was tested. This again means that users that have an invalid MobileGestalt cache, will have access to the exact same MobileGestalt values, as those users who have a valid MobileGestalt cache. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-08-03 Wenson Hsieh <wenson_hsieh@apple.com> [iOS 14] editing/selection/ios/select-all-non-editable-text-using-keyboard.html sometimes times out https://bugs.webkit.org/show_bug.cgi?id=215089 <rdar://problem/66282806> Reviewed by Tim Horton. * Platform/spi/ios/UIKitSPI.h: 2020-08-03 Devin Rousso <drousso@apple.com> should be able to request an editing context for a given region of a given input https://bugs.webkit.org/show_bug.cgi?id=215042 <rdar://problem/65561491> Reviewed by Wenson Hsieh. Right now, it's only possible to request an editing context for either an entire input element or a particular rect of the page. It should be possible to request an editing context for a particular rect within a given input element as well (e.g. get one paragraph or the currently selected text in a `<textarea>` instead of the entire thing). * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): 2020-08-03 Kate Cheney <katherine_cheney@apple.com> doesParentProcessHaveITPEnabled() check should match behavior in determineITPStateInternal() check https://bugs.webkit.org/show_bug.cgi?id=215031 <rdar://problem/66384618> Reviewed by Brent Fulgham. Checking ITP state from a WebKit child process should have the same behavior as checking it from the UI process. In order to do this, we must pass the value of hasRequestedCrossWebsiteTrackingPermission to the network process to know if an application has included the NSCrossWebsiteTrackingUsageDescription value in their Info.plist. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::activateSessionCleanup): * Shared/Cocoa/DefaultWebBrowserChecks.h: * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::hasRequestedCrossWebsiteTrackingPermission): (WebKit::doesParentProcessHaveITPEnabled): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): 2020-08-03 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, early August 20202 edition https://bugs.webkit.org/show_bug.cgi?id=215082 Unreviewed build fix. * WebProcess/WebPage/FindController.h: Add missing inclusion of WebCore/SimpleRange.h. 2020-08-02 Darin Adler <darin@apple.com> Remove some member functions of Range and many calls to createLiveRange https://bugs.webkit.org/show_bug.cgi?id=215070 Reviewed by Sam Weinig. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: (-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Use makeSimpleRange. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (API::PageOverlayClientImpl::actionContextForResultAtPoint): Ditto. * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm: (-[WKDOMRange textRects]): Ditto. * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm: (-[WKDOMTextIterator initWithRange:]): Ditto. * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: (WebKit::InjectedBundleRangeHandle::renderedImage): Ditto. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::performDictionaryLookupAtLocation): Remove createLiveRange. (WebKit::WebPage::performDictionaryLookupForSelection): Ditto. * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): Ditto. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPlatformEditorState const): Ditto. (WebKit::WebPage::computeAndSendEditDragSnapshot): Ditto. (WebKit::WebPage::getRectsForGranularityWithSelectionOffset): Ditto. (WebKit::WebPage::getRectsAtSelectionOffsetWithText): Ditto. (WebKit::WebPage::requestAutocorrectionData): Ditto. 2020-08-01 Darin Adler <darin@apple.com> Fix and further refine makefile rule for WebKit messages generated files https://bugs.webkit.org/show_bug.cgi?id=215064 Reviewed by Sam Weinig. * DerivedSources-output.xcfilelist: Updated for a file that was omitted because of a typo in the makefile. * DerivedSources.make: Fix "addsufix" typo and reorganized things a bit. 2020-08-01 Keith Rollin <krollin@apple.com> Prevent multiple invocations of generate-message-receiver.py https://bugs.webkit.org/show_bug.cgi?id=215054 Reviewed by Darin Adler. WebKit/DerivedSources.make is written such that generate-message-receiver.py can be invoked N times, where N is the value passed to -j. This results in the N invocations of generate-message-receiver.py trying trying to generate the same set of files at the same time, possibly leading to their being corrupted. We have reports of generated files starting with a 4K block of NULs, and this contention may be causing it. Address this by using a "pattern rule" in the makefile, which is documented in GNU make's documentation as the approach to take when there is one build rule that creates multiple outputs, as is the case here. See also <https://bugs.webkit.org/show_bug.cgi?id=166814> and <http://trac.webkit.org/changeset/210507>. No new tests -- no new or changed functionality. * DerivedSources.make: 2020-08-01 Darin Adler <darin@apple.com> Remove Range::create and many more uses of live ranges https://bugs.webkit.org/show_bug.cgi?id=215004 Reviewed by Sam Weinig. * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp: (API::PageOverlayClientImpl::actionContextForResultAtPoint): Return a structure that includes a SimpleRange. * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: (WebKit::InjectedBundleNodeHandle::visibleRange): Use makeSimpleRange. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Use SimpleRange. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection): Use SimpleRange. (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection): Ditto. (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection): Ditto. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::characterIndexForPointAsync): Remove makeSimpleRange. (WebKit::WebPage::deleteSurrounding): Use makeSimpleRange. * WebProcess/WebPage/WebPageOverlay.cpp: (WebKit::WebPageOverlay::actionContextForResultAtPoint): Use return value instead of out argument. * WebProcess/WebPage/WebPageOverlay.h: Update for above. * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::getPlatformEditorState const): Use makeSimpleRange. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::computeEditableRootHasContentAndPlainText): Use makeSimpleRange. (WebKit::WebPage::getRectsForGranularityWithSelectionOffset): Removed unneeded null checks that are already done by makeSimpleRange. (WebKit::WebPage::getRectsAtSelectionOffsetWithText): Use makeSimpleRange. (WebKit::WebPage::requestDictationContext): Ditto. (WebKit::WebPage::autocorrectionContext): Ditto. (WebKit::linkIndicatorPositionInformation): Use makeRangeSelectingNodeContents. (WebKit::dataDetectorLinkPositionInformation): Ditto. (WebKit::WebPage::requestDocumentEditingContext): Use makeSimpleRange. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performImmediateActionHitTestAtLocation): Update for change to the actionContextForResultAtPoint return value. 2020-08-01 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r265171. https://bugs.webkit.org/show_bug.cgi?id=215060 broke 2 mac api tests Reverted changeset: "[Mac] Add Experimental Feature preference for SW VP9" https://bugs.webkit.org/show_bug.cgi?id=215043 https://trac.webkit.org/changeset/265171 2020-08-01 Megan Gardner <megan_gardner@apple.com> Unable to select multiple lines of vertical text correctly https://bugs.webkit.org/show_bug.cgi?id=213671 <rdar://problem/53753636> Reviewed by Darin Adler. In order to make for a better text selection experience, we pulled the selection position down to be on the last line selectable, rather than snap the selection to a single position. This made for a better selection experience on small text, but we failed to take vertical text into account, and a user is locked into only selecting vertical text that ends below the other anchor point of the selection. We should have the same behavior for vertical text, but correctly calculated for X instead of Y. This does not fix all cases, but it fixes the most glaring cases. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): 2020-07-31 Jer Noble <jer.noble@apple.com> [Mac] Add Experimental Feature preference for SW VP9 https://bugs.webkit.org/show_bug.cgi?id=215043 <rdar://problem/66400034> Reviewed by Beth Dakin. * FeatureFlags/WebKit.plist: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): * Shared/WebPageCreationParameters.h: * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultVP9SWDecoderEnabledOnBattery): * Shared/WebPreferencesDefaultValues.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): (WebKit::WebProcess::enableVP9SWDecoder): * WebProcess/WebProcess.h: 2020-07-31 Chris Dumez <cdumez@apple.com> Launch time regression due to EndowmentStateTracker initialization in WebPageProxy constructor https://bugs.webkit.org/show_bug.cgi?id=215029 <rdar://problem/66362333> Reviewed by Geoffrey Garen. EndowmentStateTracker was expensive and in a critical code path during MobileSafari app launch. Since this code is new, this was a net app launch time regression. To address the regression, the following changes were made: 1. We only need the EndowmentStateTracker to monitor if the app is user-facing or not, so that we can suspend / resume media playback as needed. As a result, it is unnecessary to start monitoring user-facing state changes as soon as the WebPageProxy is constructed. Instead, we now wait until media plays on the page for the first time. 2. It turns out that over 70% of CPU time in the EndowmentStateTracker constructor was spent getting the current endownment for the process. As a result, I updated the code to lazy populate those until they are requested for the first time. 3. The remaining 30% of CPU time in the EndowmentStateTracker constructor was spent constructing the RBSProcessMonitor. I moved the initialization of the RBSProcessMonitor from the constructor to EndowmentStateTracker::addClient() so that we only construct a monitor when we actually have our first client. 4. All this code was actually only useful for Catalyst app and was therefore doing work on iOS for no reason. I properly #ifdef'd out this code so that it now only applies to Catalyst apps. * UIProcess/EndowmentStateTracker.h: (WebKit::EndowmentStateTracker::isVisible const): (WebKit::EndowmentStateTracker::isUserFacing const): * UIProcess/EndowmentStateTracker.mm: (WebKit::EndowmentStateTracker::stateFromEndowments): (WebKit::EndowmentStateTracker::registerMonitorIfNecessary): (WebKit::EndowmentStateTracker::addClient): (WebKit::EndowmentStateTracker::ensureState const const): (WebKit::EndowmentStateTracker::setState): (WebKit::EndowmentStateTracker::EndowmentStateTracker): Deleted. (WebKit::EndowmentStateTracker::setIsUserFacing): Deleted. (WebKit::EndowmentStateTracker::setIsVisible): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::m_transcodingQueue): (WebKit::WebPageProxy::updatePlayingMediaDidChange): * UIProcess/WebPageProxy.h: 2020-07-31 Chris Dumez <cdumez@apple.com> Drop ProcessAssertion::Client and replace with a simple invalidation handler https://bugs.webkit.org/show_bug.cgi?id=214976 Reviewed by Brady Eidson. ProcessAssertion had a Client class with 2 functions: (1) one to indicate that the assertion was invalidated (2) one to indicate that the UI assertion is about to expire While ProcessAssertion is used in several places, only the ProcessThrottler ever sets itself as a client. The reason is that other call sites use assertion types that do not expire. Also, (2) only makes sense for ProcessAndUIAssertion, not for ProcessAssertion. Only the ProcessThrottler is using a ProcessAndUIAssertion. I think a better design is to have a simple invalidation handler on the ProcessAssertion, that the call site can set if they are interested in invalidation. Similarly, I added a UIAssertion expiration handler on ProcessAndUIAssertion so that the ProcessThrottler can know if the UIAssertion is about to expire. This new design also matches more closely the system process assertion API that ProcessAssertion / ProcessAndUIAssertion are wrapping. This patch also fixes a bug found by Youenn Fablet where the ProcessThrottler would only set its invalidation handler in didConnectToProcess(), instead of doing it every time a new ProcessAssertion is created in setAssertionType(). The assertion type can change (e.g. from foreground to background) after the process has launched. * UIProcess/ProcessAssertion.h: (WebKit::ProcessAssertion::setInvalidationHandler): (WebKit::ProcessAssertion::Client::~Client): Deleted. (WebKit::ProcessAssertion::setClient): Deleted. (WebKit::ProcessAssertion::client): Deleted. * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::setAssertionType): (WebKit::ProcessThrottler::didConnectToProcess): * UIProcess/ProcessThrottler.h: * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::ProcessAssertion::processAssertionWasInvalidated): (WebKit::ProcessAndUIAssertion::uiAssertionWillExpireImminently): 2020-07-31 Jiewen Tan <jiewen_tan@apple.com> SOAuthorizationSession::dismissViewController could crash on calling WebPageProxy::platformWindow https://bugs.webkit.org/show_bug.cgi?id=214816 <rdar://problem/65681530> Reviewed by Youenn Fablet. pageClient() called in WebPageProxy::platformWindow() could be null. Therefore, platformWindow() needs to check m_pageClient instead. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::platformWindow): 2020-07-31 Youenn Fablet <youenn@apple.com> Update service worker if certificate info does not match when soft updating https://bugs.webkit.org/show_bug.cgi?id=214988 Reviewed by Alex Christensen. Make sure service worker soft updater gathers certificate info. * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp: (WebKit::ServiceWorkerSoftUpdateLoader::loadFromNetwork): (WebKit::ServiceWorkerSoftUpdateLoader::didReceiveResponse): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost): 2020-07-31 Sihui Liu <sihui_liu@appe.com> -[WKWebsiteDataStore _renameOrigin:] needs to support IndexedDB renames https://bugs.webkit.org/show_bug.cgi?id=214905 <rdar://problem/66247978> Reviewed by Alex Christensen. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::renameOrigin): * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::renameOriginInWebsiteData): * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _renameOrigin:to:forDataOfTypes:completionHandler:]): 2020-07-31 Ryan Haddad <ryanhaddad@apple.com> Unreviewed Catalyst build fix. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: I should have added the include here. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: 2020-07-31 Per Arne Vollan <pvollan@apple.com> [iOS] Issue a temporary extension to the MobileGestalt daemon when the MobileGestalt cache is invalid https://bugs.webkit.org/show_bug.cgi?id=214965 Reviewed by Geoffrey Garen. When the MobileGestalt cache is invalid, some MG queries will fail in the WebContent process, since it has no access to the daemon. This can be fixed by issuing a temporary extension to the daemon, and having the WebContent process query all relevant MG values while holding the extension. This will bring the values into the in-memory cache, which will be valid after the extension to the daemon has been revoked. We will still attempt to rebuild the MG cache if invalid, but since we now have a workaround for when the cache is invalid, we can do this on a secondary thread to avoid blocking the main thread. We also only attempt to rebuild once now, instead of every time a WebContent process is started. Additionally, add IOKit property read access to "platform-name", since that is needed by a MG query. No new tests, since testing this depends on having an invalid cache, which is rare, and non-trivial to enforce in the test environment. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitialize): (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-07-31 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Mouse wheel events on horizontal scrollbar not correctly handled when AC mode is forced https://bugs.webkit.org/show_bug.cgi?id=207113 Reviewed by Adrian Perez de Castro. Move the direction swap to the UI process before passing the event to the web process. WebHitTestResultData::isScrollbar is now an enum with values No, Verttical, Horizontal. When a wheel event is received in the widget we check whether we should invert the direction or not. * Shared/API/glib/WebKitHitTestResult.cpp: (webkitHitTestResultCreate): (webkitHitTestResultCompare): * Shared/WebHitTestResultData.cpp: (WebKit::WebHitTestResultData::WebHitTestResultData): * Shared/WebHitTestResultData.h: * UIProcess/API/APIHitTestResult.h: (API::HitTestResult::isScrollbar const): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewMouseTargetChanged): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (shouldInvertDirectionForScrollEvent): (webkitWebViewBaseScrollEvent): (webkitWebViewBaseScroll): (webkitWebViewBaseSetMouseIsOverScrollbar): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: 2020-07-30 Alex Christensen <achristensen@webkit.org> Optimize WebsiteDataStoreConfiguration::copy https://bugs.webkit.org/show_bug.cgi?id=215012 <rdar://problem/64263406> Reviewed by Brady Eidson. The WebsiteDataStoreConfiguration constructor does some read/write heavy things. We only want to do these things if we are not just going to overwrite the strings with strings from another WebsiteDataStoreConfiguration. No change in behavior, just making things faster. * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration): (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::create): 2020-07-30 Ryan Haddad <ryanhaddad@apple.com> Unreviewed second attempt to fix Catalyst build after r265084. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: 2020-07-30 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Two taps are required to choose a country/region when creating an account on ea.com https://bugs.webkit.org/show_bug.cgi?id=214984 <rdar://problem/66261490> Reviewed by Devin Rousso. On the desktop version of the account creation page on ea.com, tapping a custom selection menu element programmatically focuses a real `select` element that is positioned far outside the viewport. As a result, on iPad, we still attempt to show a popover for this focused select at the element location. This popover is not visible to the user, but on iOS 13, it still steals modal focus from the web view, which means that an additional tap anywhere in the window is required to dismiss the (invisible) popover before the user can choose one of the options in the custom in-page menu that is shown. Furthermore, upon choosing one of these options, the page programmatically focuses the offscreen select again. This causes us to re-present the offscreen popover, which requires yet another tap to dismiss on iOS 13. However, on iOS 14, this actually results in a crash when attempting to scroll the popover's inner UITableView to the selected row. To fix both the crash on iOS 14 and the multiple redundant taps required to dismiss the popover on iOS 13, avoid showing popovers altogether if the popover's presentation rect is outside the bounds of the content view, since we cannot reasonably expect a user to interact with such a popover anyways. Test: fast/forms/ios/repeatedly-focus-offscreen-select.html * UIProcess/ios/forms/WKFormPopover.mm: (-[WKRotatingPopover presentPopoverAnimated:]): 2020-07-30 Jer Noble <jer.noble@apple.com> [Cocoa] Adopt -[AVContentKeyRequest willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:] https://bugs.webkit.org/show_bug.cgi?id=214659 <rdar://problem/63555006> Reviewed by Darin Adler. Support clients in the GPU process asking for (and receiving updates to) the current displayID. * GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp: (WebKit::RemoteCDMInstanceSessionProxy::displayIDChanged): * GPUProcess/media/RemoteCDMInstanceSessionProxy.h: * GPUProcess/media/RemoteCDMInstanceSessionProxy.messages.in: 2020-07-30 Antoine Quint <graouts@webkit.org> [ iOS ] webanimations/accelerated-animation-with-easing.html is still flaky https://bugs.webkit.org/show_bug.cgi?id=214327 <rdar://problem/65569237> Reviewed by Dean Jackson. When we fixed bug 213495 in r263506, we started calling PlatformCAAnimation::setTimingFunction() to set the animation-wide timing function of CSS Animations and JS-originated animations alike. However, we neglected to update PlatformCAAnimationRemote, used on iOS, to be able to handle both animation-wide timing functions as well as keyframe-specific timing functions. This patch adds a new "timingFunction" member to PlatformCAAnimationRemote::Properties to allow for this and this new member is used in setTimingFunction() and copyTimingFunctionFrom(). Finally, after the animation is decoded in the UI process, we call -[CAKeyframeAnimation setTimingFunction:] inside addAnimationToLayer() to use this animation-wide timing function. This fixes the test added originally in r263506 which would only work flakily, a symptom of this missing implementation on iOS. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::encodeTimingFunction): (WebKit::decodeTimingFunction): (WebKit::PlatformCAAnimationRemote::Properties::encode const): (WebKit::PlatformCAAnimationRemote::Properties::decode): (WebKit::PlatformCAAnimationRemote::setTimingFunction): (WebKit::PlatformCAAnimationRemote::copyTimingFunctionFrom): (WebKit::addAnimationToLayer): (WebKit::operator<<): 2020-07-30 Jer Noble <jer.noble@apple.com> [Cocoa] Make DecoderTest run against .mp4 files; add rate-limiting. https://bugs.webkit.org/show_bug.cgi?id=214807 Reviewed by Darin Adler. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): 2020-07-30 Tim Horton <timothy_horton@apple.com> Web content gets stuck in an inactive state (no cursor updates or text insertion caret) when activating a tab with a thumbnail visible https://bugs.webkit.org/show_bug.cgi?id=214962 <rdar://problem/65670984> Reviewed by Wenson Hsieh. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setThumbnailView): When WKThumbnailView is unparented, invalidate all activity state bits. We do this because many of the functions that compute activity state bits use the WKThumbnailView's window while it is parented. When it is unparented, and we switch back to using the WKWebView's window, we mustn't get stuck with activity state bits from WKThumbnailView's window. This was particularly problematic in the case of the WKThumbnailViews used for tab hover previews, because that window is not key, so we'd get stuck with the inactive-window state, resulting in a lack of cursor updates, a hidden text caret, the wrong selection color, etc. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::isViewWindowActive): While writing the API test for this, I noticed that isViewWindowActive returns YES if there is no key window AND WKWebView is unparented ([NSApp keyWindow] == activeWindow() == nil). This seems completely insane (how can the window be active if it doesn't exist?), and breaks the test, so ensure that we only say YES if we actually have a window. 2020-07-30 Peng Liu <peng.liu6@apple.com> ASSERTION FAILED: !isInRoutingArbitrationForArbitrator(proxy) in WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator https://bugs.webkit.org/show_bug.cgi?id=214904 Reviewed by Jer Noble. Only add an AudioSessionRoutingArbitratorProxy to the WeakHashSet (m_arbitrators) if the routing arbitration is completed successfully. * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator): 2020-07-30 Per Arne Vollan <pvollan@apple.com> Remember to check entitlement before communicating over XPC https://bugs.webkit.org/show_bug.cgi?id=214825 Reviewed by Brent Fulgham. Remember to check entitlement before communicating over XPC with another WebKit process. This needs to be done to make sure that it really is a WebKit process on the other end. * NetworkProcess/NetworkProcess.cpp: (WebKit::m_messagePortChannelRegistry): * Shared/Cocoa/XPCEndpoint.mm: (WebKit::XPCEndpoint::XPCEndpoint): * Shared/Cocoa/XPCEndpointClient.mm: (WebKit::XPCEndpointClient::setEndpoint): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::handleXPCEndpointMessages const): 2020-07-30 Kate Cheney <katherine_cheney@apple.com> REGRESSION (r264925): run-safari --debug no longer works https://bugs.webkit.org/show_bug.cgi?id=214947 <rdar://problem/66297850> Reviewed by Darin Adler. Removing these APIs in WebKit caused older versions of Safari to break. We should add back in empty functions to make this work. No new tests. Manually verified this fix. * Shared/API/c/WKRenderLayer.cpp: Added. (WKRenderLayerGetTypeID): (WKRenderLayerGetRenderer): (WKRenderLayerCopyRendererName): (WKRenderLayerCopyElementTagName): (WKRenderLayerCopyElementID): (WKRenderLayerGetElementClassNames): (WKRenderLayerGetAbsoluteBounds): (WKRenderLayerIsClipping): (WKRenderLayerIsClipped): (WKRenderLayerIsReflection): (WKRenderLayerGetCompositingLayerType): (WKRenderLayerGetBackingStoreMemoryEstimate): (WKRenderLayerGetNegativeZOrderList): (WKRenderLayerGetNormalFlowList): (WKRenderLayerGetPositiveZOrderList): (WKRenderLayerGetFrameContentsLayer): * Shared/API/c/WKRenderLayer.h: Added. * Shared/API/c/WKRenderObject.cpp: Added. (WKRenderObjectGetTypeID): (WKRenderObjectCopyName): (WKRenderObjectCopyTextSnippet): (WKRenderObjectGetTextLength): (WKRenderObjectCopyElementTagName): (WKRenderObjectCopyElementID): (WKRenderObjectGetElementClassNames): (WKRenderObjectGetAbsolutePosition): (WKRenderObjectGetFrameRect): (WKRenderObjectGetChildren): * Shared/API/c/WKRenderObject.h: Added. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageCopyRenderTree): (WKBundlePageCopyRenderLayerTree): * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: 2020-07-30 Darin Adler <darin@apple.com> Further reduction in the use of live ranges, particularly in headers https://bugs.webkit.org/show_bug.cgi?id=214793 Reviewed by Sam Weinig. * Shared/API/c/mac/WKWebArchiveRef.cpp: (WKWebArchiveCreateFromRange): Use makeSimpleRange. * Shared/APIWebArchive.h: Use SimpleRange. * Shared/APIWebArchive.mm: (API::WebArchive::create): Take SimpleRange. * Shared/EditingRange.cpp: (WebKit::EditingRange::toRange): Don't call createLiveRange. (WebKit::EditingRange::fromRange): Take SimpleRange. * Shared/EditingRange.h: Updated for above. * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Take SimpleRange, String, StyleProperties instead of Range, StringImpl, CSSStyleDeclaration. * WebProcess/InjectedBundle/API/glib/WebKitWebEditor.cpp: String instead of StringImpl. * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm: (-[WKDOMDocument createDocumentFragmentWithText:]): Use SimpleRange. * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm: (-[WKDOMRange rangeByExpandingToWordBoundaryByCharacters:inDirection:]): Use SimpleRange and createLiveRange. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Updated for changes to bundle editor client. * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: (WebKit::InjectedBundleRangeHandle::create): Deleted. Moved the code into InjectedBundleRangeHandle::getOrCreate. (WebKit::createHandle): Added. Makes a handle for a SimpleRange. * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h: Updated for above. * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: (WebKit::createHandle): Added. Makes a handle for a CSSStyleDeclaration. (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for changes to bundle editor client. (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto. (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto. (WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto. (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto. (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto. (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto. (WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto. (WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto. (WebKit::InjectedBundlePageEditorClient::didChange): Ditto. (WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto. (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto. (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto. (WebKit::InjectedBundlePageEditorClient::performTwoStepDrop): Ditto. * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Updated for above. * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::shouldDeleteRange): Updated to call new revised bundle editor client. (WebKit::WebEditorClient::shouldBeginEditing): Ditto. (WebKit::WebEditorClient::shouldEndEditing): Ditto. (WebKit::WebEditorClient::shouldInsertNode): Ditto. (WebKit::WebEditorClient::shouldInsertText): Ditto. (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto. (WebKit::WebEditorClient::shouldApplyStyle): Ditto. (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto. (WebKit::WebEditorClient::getClientPasteboardData): Ditto. (WebKit::WebEditorClient::performTwoStepDrop): Ditto. (WebKit::insertionPointFromCurrentSelection): Use SimpleRange. * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::replaceMatches): Use SimpleRange. (WebKit::FindController::findString): Updated for change to Page::findTextMatches function. (WebKit::FindController::findStringMatches): Ditto. (WebKit::FindController::getImageForFindMatch): Use SimpleRange. (WebKit::FindController::selectFindMatch): Ditto. * WebProcess/WebPage/FindController.h: Updated for above. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::getMarkedRangeAsync): Do not call createLiveRange. (WebKit::WebPage::getSelectedRangeAsync): Ditto. (WebKit::WebPage::characterIndexForPointAsync): Call makeSimpleRange. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::plainTextForContext): Changed overloads a bit to work better with Optional<SimpleRange> and removed the ones that explicitly take a Range, updating callers to compensate. (WebKit::plainTextForDisplay): Ditto. (WebKit::WebPage::getPlatformEditorState const): Use SimpleRange. (WebKit::WebPage::getSelectionContext): Ditto. (WebKit::WebPage::didConcludeEditDrag): Ditto. (WebKit::WebPage::handleStylusSingleTapAtPoint): Ditto. (WebKit::WebPage::selectWithGesture): Ditto. (WebKit::rangeForPointInRootViewCoordinates): Return SimpleRange. (WebKit::rangeAtWordBoundaryForPosition): Ditto. (WebKit::WebPage::updateSelectionWithTouches): Use SimpleRange. (WebKit::WebPage::selectWithTwoTouches): Ditto. (WebKit::WebPage::extendSelection): Ditto. (WebKit::WebPage::selectWordBackward): Ditto. (WebKit::WebPage::moveSelectionByOffset): Ditto. (WebKit::WebPage::getRectsForGranularityWithSelectionOffset): Ditto. (WebKit::WebPage::selectPositionAtPoint): Ditto. (WebKit::WebPage::selectPositionAtBoundaryWithDirection): Ditto. (WebKit::WebPage::moveSelectionAtBoundaryWithDirection): Ditto. (WebKit::WebPage::rangeForGranularityAtPoint): Ditto. (WebKit::WebPage::selectTextWithGranularityAtPoint): Ditto. (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary): Ditto. (WebKit::WebPage::updateSelectionWithExtentPoint): Ditto. (WebKit::WebPage::replaceSelectedText): Ditto. (WebKit::WebPage::replaceDictatedText): Ditto. (WebKit::WebPage::requestAutocorrectionData): Ditto. (WebKit::WebPage::applyAutocorrectionInternal): Ditto. (WebKit::WebPage::autocorrectionContext): Ditto. (WebKit::dataDetectorLinkPositionInformation): Ditto. (WebKit::WebPage::updateSelectionWithDelta): Ditto. (WebKit::WebPage::focusTextInputContextAndPlaceCaret): Ditto. 2020-07-30 Alex Christensen <achristensen@webkit.org> Remove non-inclusive terminology from WebKit variable names and test-only SPI https://bugs.webkit.org/show_bug.cgi?id=214941 Reviewed by Michael Catanzaro. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::addOriginAccessAllowListEntry): (WebKit::NetworkConnectionToWebProcess::removeOriginAccessAllowListEntry): (WebKit::NetworkConnectionToWebProcess::resetOriginAccessAllowLists): (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry): Deleted. (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry): Deleted. (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists): Deleted. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/API/glib/WebKitUserContent.cpp: (_WebKitUserStyleSheet::_WebKitUserStyleSheet): (webkit_user_style_sheet_new): (webkit_user_style_sheet_new_for_world): (_WebKitUserScript::_WebKitUserScript): (webkit_user_script_new): (webkit_user_script_new_for_world): * UIProcess/API/glib/WebKitWebContext.cpp: (pathIsBlocked): (webkit_web_context_add_path_to_sandbox): (pathIsBlacklisted): Deleted. * UIProcess/API/gtk/WebKitUserContent.h: * UIProcess/API/wpe/WebKitUserContent.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::setupSeccomp): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setFontAllowList): * UIProcess/WebProcessPool.h: * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleAddOriginAccessAllowListEntry): (WKBundleRemoveOriginAccessAllowListEntry): (WKBundleResetOriginAccessAllowLists): (WKBundleAddOriginAccessWhitelistEntry): Deleted. (WKBundleRemoveOriginAccessWhitelistEntry): Deleted. (WKBundleResetOriginAccessWhitelists): Deleted. * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::addOriginAccessAllowListEntry): (WebKit::InjectedBundle::removeOriginAccessAllowListEntry): (WebKit::InjectedBundle::resetOriginAccessAllowLists): (WebKit::InjectedBundle::addOriginAccessWhitelistEntry): Deleted. (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry): Deleted. (WebKit::InjectedBundle::resetOriginAccessWhitelists): Deleted. * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-07-15 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Enable API tests https://bugs.webkit.org/show_bug.cgi?id=214344 Reviewed by Adrian Perez de Castro. Use a custom KeyEvent struct to pass to the IM filter as a fake GdkEvent to be able to test input methods with GTK4. * UIProcess/API/glib/InputMethodFilter.h: * UIProcess/API/gtk/InputMethodFilterGtk.cpp: (WebKit::InputMethodFilter::platformEventKeyIsKeyPress const): (WebKit::InputMethodFilter::filterKeyEvent): * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::start): (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::stop): 2020-07-30 Brady Eidson <beidson@apple.com> Refactor HID gamepad code to be much less fragile and much easier to hack on. https://bugs.webkit.org/show_bug.cgi?id=214910 Reviewed by Darin Adler. * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): * Shared/Gamepad/GamepadData.h: * UIProcess/Gamepad/UIGamepad.h: * WebProcess/Gamepad/WebGamepad.cpp: (WebKit::WebGamepad::axisValues const): (WebKit::WebGamepad::buttonValues const): (WebKit::WebGamepad::updateValues): * WebProcess/Gamepad/WebGamepad.h: 2020-07-30 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r265043. https://bugs.webkit.org/show_bug.cgi?id=214959 Will re-land after Safari 14 branching Reverted changeset: "Enable paint timing by default" https://bugs.webkit.org/show_bug.cgi?id=211736 https://trac.webkit.org/changeset/265043 2020-07-29 Megan Gardner <megan_gardner@apple.com> Highlight color does not switch after being set it system preferences. https://bugs.webkit.org/show_bug.cgi?id=214938 <rdar://problem/65270586> Reviewed by Tim Horton. After the changes to the sandbox and how defaults are being transferred to the web process (https://trac.webkit.org/changeset/258064/webkit), the highlight color was not being updated immediately. We need to send the proper notification after setting the defaults so that the color cache is invalidated after it is actually set and we do not end up with a stale value. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::userHighlightColorPreferenceKey): (WebKit::dispatchSimulatedNotificationsForPreferenceChange): 2020-07-29 Kate Cheney <katherine_cheney@apple.com> Migrate App-Bound Domains code from WebKit Additions https://bugs.webkit.org/show_bug.cgi?id=214889 <rdar://problem/66075857> Reviewed by Brent Fulgham. No new tests, this is just code migration and will be tested by existing App-Bound Domains tests. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::activateSessionCleanup): (WebKit::NetworkSessionCocoa::sessionWrapperForTask): * Shared/Cocoa/DefaultWebBrowserChecks.h: Added. * Shared/Cocoa/DefaultWebBrowserChecks.mm: Added. Holds all functions related to full browser checks and App-Bound Domains. (WebKit::shouldBeTreatedAsFullBrowser): (WebKit::getAppBoundDomainsTesting): These functions allow us to treat our test runners as full browsers while triggering non-browser mode for testing other App-Bound Domains functionality. (WebKit::isInWebKitChildProcess): (WebKit::hasRequestedCrossWebsiteTrackingPermission): (WebKit::determineITPStateInternal): (WebKit::determineITPState): (WebKit::doesAppHaveITPEnabled): (WebKit::doesParentProcessHaveITPEnabled): (WebKit::hasProhibitedUsageStrings): (WebKit::isParentProcessAFullWebBrowser): (WebKit::isFullWebBrowser): * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::filterAppBoundCookies): * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::PageConfiguration): (): Deleted. * UIProcess/WebPageProxy.cpp: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::WebProcessPool): (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::createNewWebProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::addTestDomains const): (WebKit::WebsiteDataStore::ensureAppBoundDomains const): * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: 2020-07-29 Jer Noble <jer.noble@apple.com> REGRESSION(r264476): Calling systemHasAC() regresses launch time performance https://bugs.webkit.org/show_bug.cgi?id=214907 <rdar://problem/66191430> Reviewed by Eric Carlson. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-07-29 Darin Adler <darin@apple.com> Improve range idioms and other changes to prepare the way for more reduction in live range use https://bugs.webkit.org/show_bug.cgi?id=214882 Reviewed by Sam Weinig. * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: (WKBundleNodeHandleGetRenderRect): Emptied out this unused function and added ASSERT_NOT_REACHED. Later, we can delete this once we deal with any link-time dependencies. I believe Safari may link with this but never calls it. (WKBundleNodeHandleCopyVisibleRange): Ditto. (WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled): Ditto. (WKBundleNodeHandleGetHTMLInputElementAutoFilled): Ditto. (WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled): Ditto. (WKBundleNodeHandleGetHTMLInputElementAutoFillAvailable): Ditto. (WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds): Ditto. (WKBundleNodeHandleCopyHTMLTableCellElementCellAbove): Ditto. (WKBundleNodeHandleCopyHTMLFrameElementContentFrame): Ditto. (WKBundleNodeHandleGetHTMLInputElementAutofilled): Ditto. (WKBundleNodeHandleSetHTMLInputElementAutofilled): Ditto. (WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled): Ditto. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions): Simplify with makeSimpleRange. * WebProcess/WebPage/glib/WebPageGLib.cpp: Added include of "Range.h", may not be needed right now, but highly likely to be needed after future live range work. * WebProcess/WebPage/ios/WebPageIOS.mm: Ditto. (WebKit::WebPage::selectWithGesture): Simplify with makeSimpleRange. (WebKit::WebPage::requestDocumentEditingContext): Ditto. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): Use auto for range to prepare for possible change of type from live range to SimpleRange. 2020-07-29 Noam Rosenthal <noam@webkit.org> Enable paint timing by default https://bugs.webkit.org/show_bug.cgi?id=211736 Reviewed by Simon Fraser. * Shared/WebPreferences.yaml: PaintTimingEnabled default to true. 2020-07-29 Adrian Perez de Castro <aperez@igalia.com> Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.29.2 release * wpe/NEWS: Add release notes for 2.29.2. 2020-07-29 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r265018. https://bugs.webkit.org/show_bug.cgi?id=214917 Broke various ios-wk2 tests. Reverted changeset: "Migrate App-Bound Domains code from WebKit Additions" https://bugs.webkit.org/show_bug.cgi?id=214889 https://trac.webkit.org/changeset/265018 2020-07-29 Youenn Fablet <youenn@apple.com> TestWebKitAPI.WebKit.QuotaDelegate flaky times out https://bugs.webkit.org/show_bug.cgi?id=214842 Reviewed by Geoffrey Garen. Add some release logging. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::requestStorageSpace): 2020-07-29 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Update OptionsGTK.cmake and NEWS for 2.29.4 release * gtk/NEWS: Add release notes for 2.29.4. 2020-07-28 Kate Cheney <katherine_cheney@apple.com> Migrate App-Bound Domains code from WebKit Additions https://bugs.webkit.org/show_bug.cgi?id=214889 <rdar://problem/66075857> Reviewed by Brent Fulgham. No new tests, this is just code migration and will be tested by existing App-Bound Domains tests. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::activateSessionCleanup): (WebKit::NetworkSessionCocoa::sessionWrapperForTask): * Shared/Cocoa/DefaultWebBrowserChecks.h: Added. * Shared/Cocoa/DefaultWebBrowserChecks.mm: Added. Holds all functions related to full browser checks and App-Bound Domains. (WebKit::shouldBeTreatedAsFullBrowser): (WebKit::getAppBoundDomainsTesting): These functions allow us to treat our test runners as full browsers while triggering non-browser mode for testing other App-Bound Domains functionality. (WebKit::isInWebKitChildProcess): (WebKit::hasRequestedCrossWebsiteTrackingPermission): (WebKit::determineITPStateInternal): (WebKit::determineITPState): (WebKit::doesAppHaveITPEnabled): (WebKit::doesParentProcessHaveITPEnabled): (WebKit::hasProhibitedUsageStrings): (WebKit::isParentProcessAFullWebBrowser): (WebKit::isFullWebBrowser): * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::filterAppBoundCookies): * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::PageConfiguration): (): Deleted. * UIProcess/WebPageProxy.cpp: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::WebProcessPool): (WebKit::WebProcessPool::ensureNetworkProcess): (WebKit::WebProcessPool::createNewWebProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::addTestDomains const): (WebKit::WebsiteDataStore::ensureAppBoundDomains const): * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: 2020-07-28 Tim Horton <timothy_horton@apple.com> Web Share API Level 2: Can only perform one share action per share sheet invocation https://bugs.webkit.org/show_bug.cgi?id=214894 Reviewed by Wenson Hsieh. No new tests; our WKShareSheet testing mechanism intentionally bypasses actually presenting the share sheet, which is the only way to test this. WKShareSheet assumes that UIActivityViewController's completionWithItemsHandler is only called once, when the share sheet is dismissed, and uses it to clean up the temporary file written to disk, and send the success state to the API. However, it is actually called per share action, of which an arbitrary number can be performed per UIActivityViewController invocation. Defer cleanup until the share sheet is actually dismissed (which we observe using UIAdaptivePresentationControllerDelegate's -presentationControllerDidDismiss: callback), and respond to the Web Share API with success if *any* attempted share action succeeded. * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithParameters:inRect:completionHandler:]): (-[WKShareSheet presentWithShareDataArray:inRect:]): (-[WKShareSheet sharingServicePicker:didChooseSharingService:]): (-[WKShareSheet sharingService:didFailToShareItems:error:]): (-[WKShareSheet sharingService:didShareItems:]): (-[WKShareSheet presentationControllerDidDismiss:]): (-[WKShareSheet dismiss]): Fold dispatchDidDismiss and _didCompleteWithSuccess into -dismiss, so we only have one "dismiss if needed and also do the requisite cleanup" path. -dismiss should only be called when it is no longer possible to do additional sharing actions for the current share sheet invocation. (-[WKShareSheet _didCompleteWithSuccess:]): Deleted. (-[WKShareSheet dispatchDidDismiss]): Deleted. 2020-07-28 Timothy Hatcher <timothy@apple.com> Web Inspector: Don't allow docking to a hidden web view https://bugs.webkit.org/show_bug.cgi?id=214886 Reviewed by Devin Rousso. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::attach): Call platformCanAttach() since it can do a live check. (WebKit::WebInspectorProxy::detach): Return early if already attached, otherwise asserts later. * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformCanAttach): Return flase when the web view is hidden. 2020-07-28 Alex Christensen <achristensen@webkit.org> Add null checks in ResourceLoader https://bugs.webkit.org/show_bug.cgi?id=214786 <rdar://problem/61106685> Reviewed by Youenn Fablet. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::getResourceBytesAtPosition): 2020-07-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Support for backdrop-filter https://bugs.webkit.org/show_bug.cgi?id=169988 Reviewed by Adrian Perez de Castro. Set the backdrop layer if changed when updating the scene state. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::updateSceneState): 2020-07-28 Youenn Fablet <youenn@apple.com> Disable low latency code path for H264 constrained baseline https://bugs.webkit.org/show_bug.cgi?id=214830 Reviewed by Eric Carlson. Enable low latency code path on iOS. Manually tested. * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebRTCH264LowLatencyEncoderEnabled): * Shared/WebPreferencesDefaultValues.h: 2020-07-27 Kate Cheney <katherine_cheney@apple.com> Handle full browser apps that try to use prohibited Info.plist strings https://bugs.webkit.org/show_bug.cgi?id=214852 <rdar://problem/66023860> Reviewed by Brent Fulgham. Full-web browsing applications which also use prohibited Info.plist strings should be restricted from using certain powerful APIs like JavaScript injection. These apps will have the equivalent privileges of an app that opts into App-Bound Domains with an empty WKAppBoundDomains key. No new tests. Writing a test for this would require being able to change TestWebKitAPI's Info.plist between tests, which we do not support. I manually tested this by adding a prohibited string to the TestWebKitAPI Info.plist then verified that restricted APIs, like JS injection, were blocked. * UIProcess/WebPageProxy.cpp: (isFullWebBrowser): (hasProhibitedUsageStrings): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): We do not need to set m_isNavigatingToAppBoundDomain in the case where a full web browser does not use prohibited strings. In this case, we want m_isNavigatingToAppBoundDomain to stay as WTF::nullopt so no API restriction is enabled. 2020-07-27 David Kilzer <ddkilzer@apple.com> WebKit::setCrashReportApplicationSpecificInformation() should also log to WTFLogAlways() <https://webkit.org/b/214756> <rdar://problem/66085705> Reviewed by Darin Adler. This also makes the following changes: - Renames setCrashReportApplicationSpecificInformation() to logAndSetCrashLogMessage(). - Replaces _WKSetCrashReportApplicationSpecificInformation() with WebKit::logAndSetCrashLogMessage(). - Calls WTF::setCrashLogMessage() in DumpRenderTree and WebKitTestRunner to avoid new WTFLogAlways() calls, which broke internal tests and caused the first patch to be rolled out. - Changes WebKit::logAndSetCrashLogMessage() to take a const char* argument instead of CFStringRef. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendMessage): (IPC::readFromMachPort): - Update call to logAndSetCrashLogMessage() to pass const char* value. * Platform/cocoa/WKCrashReporter.h: (WebKit::logAndSetCrashLogMessage): - Rename from setCrashReportApplicationSpecificInformation(). - Update function signature to use `const char*`. * Platform/cocoa/WKCrashReporter.mm: (WebKit::logAndSetCrashLogMessage): - Rename from setCrashReportApplicationSpecificInformation(). - Update function signature to use `const char*`. - Call WTFLogAlways() in addition to setting the Application Specific Information. * Shared/Cocoa/AuxiliaryProcessCocoa.mm: (WebKit::AuxiliaryProcess::didReceiveInvalidMessage): - Update call to logAndSetCrashLogMessage() to pass const char* value. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): - Update call to logAndSetCrashLogMessage() instead of both WTFLogAlways() and _WKSetCrashReportApplicationSpecificInformation(). * WebKit.xcodeproj/project.pbxproj: - Remove WebProcessCocoa.h from the project. * WebProcess/cocoa/WebProcessCocoa.h: Remove. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::_WKSetCrashReportApplicationSpecificInformation): Delete. 2020-07-27 Tim Horton <timothy_horton@apple.com> Occasional crashes under PDFPlugin::createScrollbar and PDFPlugin::updateScrollbars https://bugs.webkit.org/show_bug.cgi?id=214845 <rdar://problem/59293598> Reviewed by Brady Eidson. No new tests; timing is such that I can't reproduce without inserting intentional delays into the main thread hops, which is further than I'm willing to go for a test. This is a speculative fix due to the aforementioned reproducibility issue. * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::destroy): Keep track of when destroy() has been called. (WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel): (WebKit::PDFPlugin::threadEntry): If the PDFPlugin is destroyed (explicit destroy(), not the destructor, which won't run since we're protecting `this`) during the window in which the PDF thread is dispatching to the main thread, just ignore the callback. We don't want to run it, because many of the things we depend on (like PluginView) are disconnected at this point. (WebKit::PDFPlugin::scrollbarStyleChanged): It appears that in some much rarer case, even before the PDF thread existed, WebScrollerImpPairDelegate could call us back after being destroy()'d but before being deallocated. Use the new bit to guard scrollbarStyleChanged(). 2020-07-27 Megan Gardner <megan_gardner@apple.com> Trying to lookup when WebView is in a popover causes process to hang. https://bugs.webkit.org/show_bug.cgi?id=214773 <rdar://problem/52317762> Reviewed by Devin Rousso. The Lookup framework does not populate the menus that it vends with the option to 'lookup' words that are selected in popovers. WebKit should follow the pattern and not put the item in the menu as Lookup is not able to handle this situation. Also if Lookup is disabled via defaults, we should not show it in the menu. * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::getContextMenuFromItems): 2020-07-27 Kate Cheney <katherine_cheney@apple.com> Remove API::Object::Type::RenderLayer and API::Object::Type::RenderObject https://bugs.webkit.org/show_bug.cgi?id=214772 <rdar://problem/52734803> Reviewed by Simon Fraser. These APIs are no longer used, so we should remove them. * Shared/API/APIObject.h: * Shared/API/c/WKBase.h: * Shared/API/c/WKRenderLayer.cpp: Removed. * Shared/API/c/WKRenderLayer.h: Removed. * Shared/API/c/WKRenderObject.cpp: Removed. * Shared/API/c/WKRenderObject.h: Removed. * Shared/UserData.cpp: (WebKit::UserData::encode): (WebKit::UserData::decode): * Shared/WebRenderLayer.cpp: Removed. * Shared/WebRenderLayer.h: Removed. * Shared/WebRenderObject.cpp: Removed. * Shared/WebRenderObject.h: Removed. * Sources.txt: * UIProcess/API/C/WKAPICast.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageCopyRenderTree): Deleted. (WKBundlePageCopyRenderLayerTree): Deleted. * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: 2020-07-27 Youenn Fablet <youenn@apple.com> Check m_connection in NetworkRTCProvider::createResolver/stopResolver https://bugs.webkit.org/show_bug.cgi?id=214818 Reviewed by Eric Carlson. We need to check for m_connection when hopping to main thread as the NetworkRTCProvider might already be closed. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createResolver): (WebKit::NetworkRTCProvider::stopResolver): 2020-07-27 Adrian Perez de Castro <aperez@igalia.com> [GTK] GeoclueGeolocationProvider uses very low accuracy setting (city) as default geolocation API https://bugs.webkit.org/show_bug.cgi?id=214566 Reviewed by Carlos Garcia Campos. No new tests needed. * UIProcess/geoclue/GeoclueGeolocationProvider.cpp: (WebKit::GeoclueGeolocationProvider::requestAccuracyLevel): Use GeoclueAccuracySteetLevel when high accuracy was not requested. 2020-07-27 Carlos Garcia Campos <cgarcia@igalia.com> [WPE][GTK] Add API to support "Privacy Report" https://bugs.webkit.org/show_bug.cgi?id=213493 Reviewed by Adrian Perez de Castro. Add WebKitITPFirstParty and WebKitITPThirdParty boxed types to expose the data returned by the ITP summary. * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (_WebKitITPFirstParty::_WebKitITPFirstParty): (webkitITPFirstPartyCreate): (webkit_itp_first_party_ref): (webkit_itp_first_party_unref): (webkit_itp_first_party_get_domain): (webkit_itp_first_party_get_website_data_access_allowed): (webkit_itp_first_party_get_last_update_time): (_WebKitITPThirdParty::_WebKitITPThirdParty): (_WebKitITPThirdParty::~_WebKitITPThirdParty): (webkitITPThirdPartyCreate): (webkit_itp_third_party_ref): (webkit_itp_third_party_unref): (webkit_itp_third_party_get_domain): (webkit_itp_third_party_get_first_parties): (webkit_website_data_manager_get_itp_summary): (webkit_website_data_manager_get_itp_summary_finish): * UIProcess/API/gtk/WebKitAutocleanups.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitAutocleanups.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-07-27 Youenn Fablet <youenn@apple.com> Fix null pointer crash in NetworkRTCProvider::createServerTCPSocket https://bugs.webkit.org/show_bug.cgi?id=214796 Reviewed by Darin Adler. In case of creating a TCP socket, NetworkRTCProvider will hop to the main thread before creating the socket. In that case, NetworkRTCProvider may actually be closed between the time of receiving the message and hoping to the main thread. Protect from this by adding nullptr checks. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createServerTCPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): 2020-07-25 Simon Fraser <simon.fraser@apple.com> Scroll Snap broken when using RTL layout https://bugs.webkit.org/show_bug.cgi?id=193671 <rdar://problem/47457471> Reviewed by Wenson Hsieh. There were various places in the scroll snapping code which confused scroll offsets (zero-based) with scroll positions (relative to scroll origin, can be negative). This broke snapping in `direction: rtl` content. The computation of snap locations in updateSnapOffsetsForScrollableArea() was also broken in RTL; we need to snap the right edge of boxes to the right edge of the scroller for the 'start' alignment. (Snapping for LTR boxes in an RTL scroller is poorly defined; for now, follow Gecko.) * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (WebKit::dump): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _updateVisibleContentRects]): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::shouldSnapForMainFrameScrolling const): (WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling const): (WebKit::RemoteScrollingCoordinatorProxy::hasActiveSnapPoint const): (WebKit::RemoteScrollingCoordinatorProxy::nearestActiveContentInsetAdjustedSnapOffset const): (WebKit::RemoteScrollingCoordinatorProxy::nearestActiveContentInsetAdjustedSnapPoint const): Deleted. 2020-07-26 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r264690): [ iOS wk2 ] editing/selection/shift-click-includes-existing-selection.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=214688 <rdar://problem/65993683> Reviewed by Darin Adler. Remove logging added in r264882, r264890, r264892, and r264896. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _singleTapIdentified:]): (-[WKContentView _singleTapRecognized:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::commitPotentialTap): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleSyntheticClick): 2020-07-22 Darin Adler <darin@apple.com> Stop using live ranges in SpellChecker.h and TextCheckingHelper.h https://bugs.webkit.org/show_bug.cgi?id=214648 Reviewed by Sam Weinig. * WebProcess/WebCoreSupport/WebEditorClient.cpp: Added an include of Range.h, no longer pulled in indirectly by another header. 2020-07-26 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, partially revert r264896. https://bugs.webkit.org/show_bug.cgi?id=214688 This logging is no longer needed. * Platform/spi/ios/UIKitSPI.h: 2020-07-26 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, add even more logging to try and diagnose a flaky test https://bugs.webkit.org/show_bug.cgi?id=214688 <rdar://problem/65993683> Add another IPI declaration on UIApplication. * Platform/spi/ios/UIKitSPI.h: 2020-07-25 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r264690): [ iOS wk2 ] editing/selection/shift-click-includes-existing-selection.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=214688 <rdar://problem/65993683> Reviewed by Tim Horton. Add an SPI declaration on UIApplication. * Platform/spi/ios/UIKitSPI.h: 2020-07-24 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r264690): [ iOS wk2 ] editing/selection/shift-click-includes-existing-selection.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=214688 <rdar://problem/65993683> Reviewed by Megan Gardner. Add more logging to try and see why this test is failing on some post-commit iOS bots. In particular, these logs should test a theory that it's possible for `UIScriptControllerIOS::singleTapAtPointWithModifiers` to try and synthesize and send HID events for the tap before GraphicsServices has registered the fact that a modifier key is being held, which would lead to a regular tap instead of a shift-tap in this test. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _singleTapIdentified:]): (-[WKContentView _singleTapRecognized:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::commitPotentialTap): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleSyntheticClick): 2020-07-24 Brady Eidson <beidson@apple.com> Hard code some MFi controller devices instead of dynamically managing HID vs GameController.framework. rdar://problem/65961406 and https://bugs.webkit.org/show_bug.cgi?id=214664 Reviewed by Tim Horton. Add more test-only SPI to monitor the state of connected gamepads. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _numberOfConnectedGamepadsForTesting]): (-[WKProcessPool _numberOfConnectedHIDGamepadsForTesting]): (-[WKProcessPool _numberOfConnectedGameControllerFrameworkGamepadsForTesting]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::numberOfConnectedGamepadsForTesting): * UIProcess/WebProcessPool.h: 2020-07-24 Devin Rousso <drousso@apple.com> Followup, adopt more descriptive symbol image name for non-LTR https://bugs.webkit.org/show_bug.cgi?id=214764 <rdar://problem/64000059> Reviewed by Tim Horton. * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction imageForElementActionType:]): 2020-07-24 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r264858. Caused spurious CRASHING TEST logging during layout test runs Reverted changeset: "WebKit::setCrashReportApplicationSpecificInformation() should also log to WTFLogAlways()" https://bugs.webkit.org/show_bug.cgi?id=214756 https://trac.webkit.org/changeset/264858 2020-07-24 Tadeu Zagallo <tzagallo@apple.com> WKStringGetMaximumUTF8CStringSize should cast before arithmetic https://bugs.webkit.org/show_bug.cgi?id=214750 <rdar://problem/65884455> Reviewed by Mark Lam. When the string is long enough, the multiplication can result in an integer overflow. Test: js/throw-large-string-oom.html * Shared/API/c/WKString.cpp: (WKStringGetMaximumUTF8CStringSize): 2020-07-24 Devin Rousso <drousso@apple.com> Adopt more descriptive symbol image name https://bugs.webkit.org/show_bug.cgi?id=214764 <rdar://problem/64000059> Reviewed by Dean Jackson. * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction imageForElementActionType:]): 2020-07-24 Kate Cheney <katherine_cheney@apple.com> CrashTracer: com.apple.WebKit.WebContent at com.apple.WebKit: WebKit::WebFrame::shouldEnableInAppBrowserPrivacyProtections https://bugs.webkit.org/show_bug.cgi?id=214745 <rdar://66018965> Reviewed by Chris Dumez. We should stop iterating if the frame is null, even if it is not the main frame, to avoid calling functions on a null frame. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::shouldEnableInAppBrowserPrivacyProtections): 2020-07-24 David Kilzer <ddkilzer@apple.com> WebKit::setCrashReportApplicationSpecificInformation() should also log to WTFLogAlways() <https://webkit.org/b/214756> Reviewed by Chris Dumez. * Platform/cocoa/WKCrashReporter.mm: (WebKit::setCrashReportApplicationSpecificInformation): - Also output the log information via WTFLogAlways() in case Application Specific Information is overwritten or is not included in the crash log. 2020-07-24 Chris Dumez <cdumez@apple.com> Crash under PreconnectTask::start() https://bugs.webkit.org/show_bug.cgi?id=214747 <rdar://problem/65989668> Reviewed by Geoffrey Garen. All user of PreconnectTask construct a PreconnectTask and then call start() on it. start() dereferences m_networkLoad unconditionally. However, the PreconnectTask constructor may return early and not initialize m_networkLoad if there is not NetworkSession for the given sessionID. To address the issue, update call sites to pass in a valid NetworkSession, so that the PreconnectTask now always initializes m_networkLoad. No new tests, we do not know how to reproduce, likely due to a race between a preconnect request being issued and a network session getting destroyed. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::sendH2Ping): (WebKit::NetworkConnectionToWebProcess::preconnectTo): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/PreconnectTask.cpp: (WebKit::PreconnectTask::PreconnectTask): * NetworkProcess/PreconnectTask.h: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::SpeculativeLoadManager::preconnectForSubresource): 2020-07-24 David Kilzer <ddkilzer@apple.com> [IPC hardening] Add nullptr checks for WebPage::m_activeColorChooser <https://webkit.org/b/214699> <rdar://problem/65850975> Reviewed by Darin Adler. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didEndColorPicker): (WebKit::WebPage::didChooseColor): - Add nullptr check before dereferencing m_activeColorChooser. 2020-07-24 David Kilzer <ddkilzer@apple.com> Add/Update CRASH_WITH_INFO() for invalid IPC message logging <https://webkit.org/b/214713> Reviewed by Anders Carlsson. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendMessage): - Simplify logging by removing CString and using IPC::MessageName enum value instead of hash. * Shared/Cocoa/AuxiliaryProcessCocoa.mm: (WebKit::AuxiliaryProcess::didReceiveInvalidMessage): - Add IPC::MessageName enum value to setCrashReportApplicationSpecificInformation() output. - Change CRASH() to CRASH_WITH_INFO() and pass IPC::MessageName enum value. 2020-07-24 Youenn Fablet <youenn@apple.com> Use one socket server for the whole network process instead of one socket server per web process connection https://bugs.webkit.org/show_bug.cgi?id=214593 Reviewed by Alex Christensen. Instead of a socket server per web process, we will only create one for all web processes. Conversely, we do the same for the network manager. This should allow to reduce our use of sockets in network process and hopefully reduce the occurence of sockets fd above FD_SETSIZE. Covered by existing tests. * NetworkProcess/webrtc/NetworkRTCMonitor.cpp: (WebKit::networkManager): (WebKit::NetworkManagerWrapper::addListener): (WebKit::NetworkManagerWrapper::removeListener): (WebKit::NetworkManagerWrapper::onNetworksChanged): (WebKit::NetworkRTCMonitor::~NetworkRTCMonitor): (WebKit::NetworkRTCMonitor::startUpdatingIfNeeded): (WebKit::NetworkRTCMonitor::stopUpdating): (WebKit::NetworkRTCMonitor::onNetworksChanged): * NetworkProcess/webrtc/NetworkRTCMonitor.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::rtcNetworkThread): (WebKit::NetworkRTCProvider::NetworkRTCProvider): (WebKit::NetworkRTCProvider::close): (WebKit::NetworkRTCProvider::createSocket): (WebKit::NetworkRTCProvider::createUDPSocket): (WebKit::NetworkRTCProvider::createServerTCPSocket): (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::sendToSocket): (WebKit::NetworkRTCProvider::closeSocket): (WebKit::NetworkRTCProvider::setSocketOption): (WebKit::NetworkRTCProvider::addSocket): (WebKit::NetworkRTCProvider::takeSocket): (WebKit::NetworkRTCProvider::newConnection): (WebKit::NetworkRTCProvider::callOnRTCNetworkThread): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::connection): 2020-07-23 Wenson Hsieh <wenson_hsieh@apple.com> Tapping QuickType suggestions for a misspelled word does nothing in Mail compose https://bugs.webkit.org/show_bug.cgi?id=214705 <rdar://problem/58320785> Reviewed by Tim Horton. In WebKit2-based editing contexts on iOS (such as Mail compose), tapping on a misspelled word will result in QuickType suggestions in the input accessory row either showing up blank (i.e. with no suggestions), or will show suggestions that are contextual to the text selection prior to selecting the misspelled word. Subsequently, attempting to choose of these suggestions results in no text being inserted. This happens for a couple of reasons: 1. UIKit doesn't attempt to re-request the autocorrection context after tapping on a misspelled word. UIKit just uses `-selectWordForReplacement` to extend the selection over the misspelled word, which doesn't currently fire any of the selection change callbacks on UIInputDelegate. As a result, UIKit will instead believe that the selection is collapsed to the start or end of the misspelled word. 2. Upon attempting to compute text suggestions for QuickType, `-[UIKeyboardImpl replacementsFromSelectedText]` uses `-textInRange:` to grab the currently selected text, which (in WKContentView) is currently hard-coded to always return `nil`. We address (1) by bookending `-selectWordForReplacement` with calls to `-beginSelectionChange` and `-endSelectionChange`, and address (2) by teaching `-textInRange:` to return the current text selection, only in the case where the given `UITextRange` is equal to the current ranged selection. Test: SelectionTests.SelectedTextAfterSelectingWordForReplacement * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::extendSelection): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView textInRange:]): Special-case the scenario where the input text range is exactly the same as `self.selectedTextRange` by returning the currently selected text that is cached on EditorState. In all other cases, continue to return `nil`. (-[WKContentView selectedTextRange]): Cache the current selected text range on WKContentView, such that repeated calls to selectedTextRange when the selection has not changed does not require a new WKTextRange to be constructed every time. (-[WKContentView _selectionChanged]): Invalidate the cached selected text range whenever the selection has changed. (-[WKContentView selectWordForReplacement]): Use the completion callback added below to bookend this method with `-(begin|end)SelectionChange`. (-[WKContentView _updateChangedSelection:]): Invalidate the cached selected text range whenever we're about to tell UIKit to repaint the selection. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::extendSelection): Add an optional completion callback to `extendSelection`. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::extendSelection): 2020-07-23 Peng Liu <peng.liu6@apple.com> Safari Related Leaked Assertions after Playing YouTube Video https://bugs.webkit.org/show_bug.cgi?id=214706 Reviewed by Jer Noble. A 10 second grace period before removing the activity token was introduced in r252692. However, some websites, e.g., youtube.com, requests the video element to play the next video 10 seconds after completing the current one (when the Safari is in the background). That can lead to a race condition between the web process and the UI process. They may send IPC messages to each other at the same time: 1) The web process sends a WebPageProxy::IsPlayingMediaDidChange message to the UI process to notify that video/audio is playing, so the UI process will take a MediaPlayback assertion. 2) The UI process sends a WebProcess::PrepareToSuspend message to the web process, which will suspend the web process. Eventually, the web process will suspend, which means no video/audio playback. But the UI process believes that there is a web process playing video/audio, so it will take a MediaPlayback assertion. This patch fixes the race condition by ignoring the WebPageProxy::IsPlayingMediaDidChange message in the UIProcess if the process throttler believes that the process should not be running, so that the MediaPlayback assertion will not be created. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::isPlayingMediaDidChange): 2020-07-23 Per Arne Vollan <pvollan@apple.com> Crash in block in WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver https://bugs.webkit.org/show_bug.cgi?id=214702 Reviewed by Chris Dumez. Calling xpc_connection_send_message in the block in WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver will sometimes crash because the XPC connection object is invalid. The block is called on a secondary thread, and the m_connections member variable needs to be protected by a lock. Also, make sure the XPC connections objects in m_connections are valid by retaining them when captured in a block. This is done by redeclaring a local XPC connection variable as an OSObjectPtr instead of a raw XPC connection object. No new tests, since I have not been able to reproduce this issue. * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h: * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm: (WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver): (WebKit::LaunchServicesDatabaseObserver::startObserving): (WebKit::LaunchServicesDatabaseObserver::handleEvent): * Shared/Cocoa/XPCEndpoint.mm: (WebKit::XPCEndpoint::XPCEndpoint): 2020-07-23 Brian Burg <bburg@apple.com> Web Inspector: developerExtrasEnabled should be respected when opening local Web Inspector (part 2) https://bugs.webkit.org/show_bug.cgi?id=214669 Reviewed by Devin Rousso and Joseph Pecoraro. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::save): (WebKit::WebInspectorProxy::append): Add missing check for developerExtrasEnabled. 2020-07-23 Sihui Liu <sihui_liu@appe.com> Allow IndexedDB in third-party frames https://bugs.webkit.org/show_bug.cgi?id=214583 <rdar://problem/61278487> Reviewed by Geoffrey Garen. Do no append extra space to displayName if host is empty. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::fetchDataAndApply): 2020-07-23 David Quesada <david_quesada@apple.com> Unable to present file upload picker after interactively dismissing a previously opened picker https://bugs.webkit.org/show_bug.cgi?id=209613 rdar://problem/60931009 Reviewed by Daniel Bates. -[<UIDocumentPickerViewController> documentPickerWasCancelled:] doesn't get called if you dismiss the view controller using the interactive swipe dismissal gesture added in iOS 13. As a result, the web view will continue to think it's showing a file picker after dismissing it this way, meaning you can't present any other file pickers from the same web view. Fix this by implementing UIAdaptivePresentationControllerDelegate in WKFileUploadPanel to cancel and tear down the file picker operation when the view controller is interactively dismised. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel showFilePickerMenu]): (-[WKFileUploadPanel presentationControllerDidDismiss:]): 2020-07-23 Aditya Keerthi <akeerthi@apple.com> [macOS] Datalist dropdown scrollbar position does not match visible region https://bugs.webkit.org/show_bug.cgi?id=214656 Reviewed by Wenson Hsieh. Currently, the content insets for the dropdown are set on an NSScrollView's contentView, rather than the NSScrollView itself. On the latest macOS, this results in accurate state within the NSScrollView, leading to an inaccurate scrollbar position. To fix, set the content insets directly on the NSScrollView. However, on older macOS, setting content insets on the NSScrollView causes the view to start out slightly scrolled (by a value equal to the top inset). This issue is solved by preserving the existing behavior (setting insets on the contentView) on older macOS. Also, set the style of the embedded NSTableView to NSTableViewStyleFullWidth, to ensure the view respects the insets we specify. No new tests, as the change is purely visual and affects native UI. * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: (-[WKDataListSuggestionTableView initWithElementRect:]): (-[WKDataListSuggestionsController initWithInformation:inView:]): 2020-07-23 David Kilzer <ddkilzer@apple.com> [IPC hardening] WebKit::ArgumentCoder<BlobPart>::decode() and encode() should use enum BlobPart::Type <https://webkit.org/b/214665> <rdar://problem/65777948> Reviewed by Darin Adler. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<BlobPart>::encode): - Change BlobPart::Type enums to use fully qualified name. - Encode using WebCore::BlobPart::Type value. - Change break statements to early return statements. - Add ASSERT_NOT_REACHED() to catch bugs. (IPC::ArgumentCoder<BlobPart>::decode): - Change BlobPart::Type enums to use fully qualified name. - Decode using Optional<WebCore::BlobPart::Type> variable. - Change break statements to early return statements. - Remove default: label, move `return WTF::nullopt` to the end of the method, and add ASSERT_NOT_REACHED() to catch bugs. 2020-07-23 David Kilzer <ddkilzer@apple.com> [IPC hardening] FilterOperation decode/encode should use early returns <https://webkit.org/b/214667> <rdar://problem/65946400> Reviewed by Darin Adler. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<FilterOperation>::encode): - Change break statements to early return statements. - Add ASSERT_NOT_REACHED() to catch bugs. (IPC::decodeFilterOperation): - Change break statements to early return statements. - Remove call to `decoder.markInvalid()` since it is redundant. - Return `false` from FilterOperation::APPLE_INVERT_LIGHTNESS label to match FilterOperation::NONE and FilterOperation::REFERENCE. - Add ASSERT_NOT_REACHED() to catch bugs. - Change final return statement from `true` to `false` since valid decoding returns `true` earlier. 2020-07-23 Brady Eidson <beidson@apple.com> Add Gamepad tests that exercise the native frameworks <rdar://problem/65343674> and https://bugs.webkit.org/show_bug.cgi?id=214188 Reviewed by Tim Horton. Add some testing-only SPI for TestWebKitAPI. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _numberOfConnectedGamepadsForTesting]): (-[WKProcessPool _setUsesOnlyHIDGamepadProviderForTesting:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/Gamepad/UIGamepadProvider.h: (WebKit::UIGamepadProvider::numberOfConnectedGamepads const): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::numberOfConnectedGamepadsForTesting): (WebKit::WebProcessPool::setUsesOnlyHIDGamepadProviderForTesting): * UIProcess/WebProcessPool.h: 2020-07-22 Jer Noble <jer.noble@apple.com> [Cocoa] Add feature flag for WebM & VP9 https://bugs.webkit.org/show_bug.cgi?id=214672 <rdar://problem/65959506> Reviewed by Beth Dakin. * FeatureFlags/WebKit.plist: * Shared/WebPreferences.yaml: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultVP9DecoderEnabled): (WebKit::defaultWebMParserEnabled): * Shared/WebPreferencesDefaultValues.h: 2020-07-22 Conrad Shultz <conrad_shultz@apple.com> Update macOS Version macros https://bugs.webkit.org/show_bug.cgi?id=214653 Reviewed by Tim Horton. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2020-07-22 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo][32bit] ConnectionWin.cpp(327): error C2664: 'BOOL RegisterWaitForSingleObject(...)': cannot convert argument 3 from 'void (__cdecl *)(...)' to 'WAITORTIMERCALLBACK' https://bugs.webkit.org/show_bug.cgi?id=214658 Reviewed by Darin Adler. __cdecl and __stdcall calling conventions don't match. <https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions> * Platform/IPC/Connection.h: Added WINAPI to Connection::EventListener::callback method. 2020-07-22 David Kilzer <ddkilzer@apple.com> Follow-up: [IPC hardening] WebKit::ObjCObjectGraph::decode() and encode() should use enum ObjCType type <https://webkit.org/b/214618> <rdar://problem/65777899> Unreviewed fix to get rid of extra namespace blocks. * Shared/mac/ObjCObjectGraph.mm: (enum class WebKit::ObjCType): - Move enum class definition back to its original location. (WTF::EnumTraits<WebKit::ObjCType>): - Move to the end of the file. Noticed this worked in ColorSpaceData.mm. 2020-07-22 David Kilzer <ddkilzer@apple.com> [IPC hardening] WebKit::ObjCObjectGraph::decode() and encode() should use enum ObjCType type <https://webkit.org/b/214618> <rdar://problem/65777899> Unreviewed fix to include the better header. * Shared/mac/ObjCObjectGraph.mm: - Switch #include from OptionSet.h to EnumTraits.h. 2020-07-22 Jer Noble <jer.noble@apple.com> Unreviewed build fix after r264710; add a HAVE_AVPLAYER_VIDEORANGEOVERRIDE guard. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updatePageScreenProperties): 2020-07-22 Jer Noble <jer.noble@apple.com> [macOS] Adopt AVPlayer.videoRangeOverride https://bugs.webkit.org/show_bug.cgi?id=213902 <rdar://problem/63953509> Reviewed by Youenn Fablet. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::screenPropertiesDidChange): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updatePageScreenProperties): 2020-07-21 Simon Fraser <simon.fraser@apple.com> Scrolling tesla.com on iPad is not smooth https://bugs.webkit.org/show_bug.cgi?id=214627 <rdar://problem/65568979> Reviewed by Tim Horton. This is the iOS equivalent of the fix in r264203; if the user is scrolling (or we're animating for scroll snap), layout should not trigger scroll position changes via computation of the current snap location. To fix this, we need to send data from the UI process to the web process about which scrolling tree nodes the user is scrolling. That's done via RemoteScrollingUIState, which will, in the long term, become a more general UI -> WebProcess scrolling state updating mechanism. For now, it just keeps track of nodes undergoing scroll snap and user scrolls (only the latter is hooked up for now). * Shared/RemoteLayerTree/RemoteScrollingUIState.cpp: Added. (WebKit::RemoteScrollingUIState::encode const): (WebKit::RemoteScrollingUIState::decode): (WebKit::RemoteScrollingUIState::addNodeWithActiveScrollSnap): (WebKit::RemoteScrollingUIState::removeNodeWithActiveScrollSnap): (WebKit::RemoteScrollingUIState::addNodeWithActiveUserScroll): (WebKit::RemoteScrollingUIState::removeNodeWithActiveUserScroll): * Shared/RemoteLayerTree/RemoteScrollingUIState.h: Added. (WebKit::RemoteScrollingUIState::changes const): (WebKit::RemoteScrollingUIState::clearChanges): (WebKit::RemoteScrollingUIState::nodesWithActiveScrollSnap const): (WebKit::RemoteScrollingUIState::nodesWithActiveUserScrolls const): * SourcesCocoa.txt: * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::RemoteScrollingCoordinatorProxy): (WebKit::RemoteScrollingCoordinatorProxy::sendUIStateChangedIfNecessary): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::scrollingTreeNodeWillStartPanGesture): (WebKit::RemoteScrollingTree::scrollingTreeNodeWillStartScroll): (WebKit::RemoteScrollingTree::scrollingTreeNodeDidEndScroll): * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const): (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture): (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll): (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart const): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd const): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture const): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::isUserScrollInProgress const): (WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress const): (WebKit::RemoteScrollingCoordinator::scrollingStateInUIProcessChanged): 2020-07-22 David Kilzer <ddkilzer@apple.com> [IPC hardening] WebKit::ObjCObjectGraph::decode() and encode() should use enum ObjCType type <https://webkit.org/b/214618> <rdar://problem/65777899> Reviewed by Youenn Fablet. * Shared/mac/ObjCObjectGraph.h: - Drive-by fix to use #pragma once. This is included in some plain C++ source files. * Shared/mac/ObjCObjectGraph.mm: (WebKit::ObjCType): - Move enum definition to the top of the file so that the EnumTraits<> can be defined after it, but before it's used. (WTF::EnumTraits<WebKit::ObjCType>): Add. - Define so that IPC::Decoder and IPC::Encoder can validate enum values. (WebKit::ObjCObjectGraph::encode): - Encode using WebKit::ObjCType value. - Add ObjCType::Null label so that default: label can be removed. Change break statements to early return statements. - Move ASSERT_NOT_REACHED() to the end of the method. (WebKit::ObjCObjectGraph::decode): - Decode using WebKit::ObjCType value. - Change break statements to early return statements. - Remove default: label, and move `return false` to the end of the method. Add ASSERT_NOT_REACHED(). 2020-07-22 Megan Gardner <megan_gardner@apple.com> Tapped DataDetected links present sub-menus from the wrong location. https://bugs.webkit.org/show_bug.cgi?id=214628 <rdar://problem/64808642> When getting the positionInformation associated with presenting DataDetectors UI we were not indicating that we need the linkIndicator data. This caused the resulting CGRect to not be filled out, and we were returning a zeroed out CGRect to the DataDetectors framework for the location that it should present the subMenu from. Setting this bit ensures that all the necessary data is calculated and returned when a DataDetector link is tapped. Reviewed by Wenson Hsieh. * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::showDataDetectorsUIForElement): 2020-07-22 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] ITP: use the database store unconditionally https://bugs.webkit.org/show_bug.cgi?id=214590 Reviewed by Adrian Perez de Castro. The memory store is now considered legacy. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): Use FileSystem::pathByAppendingComponent() to create the database path. (WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase): Ensure the directory exists before trying to open the database. * UIProcess/soup/WebProcessPoolSoup.cpp: (WebKit::WebProcessPool::platformInitializeNetworkProcess): Always enable the ITP databae by default. 2020-07-19 Darin Adler <darin@apple.com> Remove live ranges from Editor.h and EditorClient.h https://bugs.webkit.org/show_bug.cgi?id=214261 Reviewed by Sam Weinig. * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView rectForPage:]): Use NSZeroRect. * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::shouldDeleteRange): Updated for live range changes and also removed gratuitous call to notImplemented since the function is implemented. (WebKit::WebEditorClient::shouldBeginEditing): Ditto. (WebKit::WebEditorClient::shouldEndEditing): Ditto. (WebKit::WebEditorClient::shouldInsertNode): Ditto. (WebKit::WebEditorClient::shouldInsertText): Ditto. (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto. (WebKit::WebEditorClient::shouldApplyStyle): Ditto. (WebKit::WebEditorClient::shouldMoveRangeAfterDelete): Ditto. (WebKit::WebEditorClient::didBeginEditing): Ditto. (WebKit::WebEditorClient::didEndEditing): Ditto. (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto. (WebKit::WebEditorClient::getClientPasteboardData): Ditto. (WebKit::WebEditorClient::performTwoStepDrop): Ditto. (WebKit::WebEditorClient::overflowScrollPositionChanged): Ditto. (WebKit::WebEditorClient::subFrameScrollPositionChanged): Ditto. (WebKit::WebEditorClient::setInputMethodState): Ditto. * WebProcess/WebCoreSupport/WebEditorClient.h: Updated for changes to EditorClient. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::getMarkedRangeAsync): Updated to reduce the use of local values and live ranges. (WebKit::WebPage::getSelectedRangeAsync): Ditto. (WebKit::WebPage::characterIndexForPointAsync): Ditto. (WebKit::WebPage::firstRectForCharacterRangeAsync): Ditto. (WebKit::WebPage::setCompositionAsync): Ditto. * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::getPlatformEditorState const): Ditto. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPlatformEditorState const): Ditto. (WebKit::WebPage::selectWithGesture): Ditto. (WebKit::WebPage::autocorrectionContext): Ditto. (WebKit::focusedElementPositionInformation): Ditto. (WebKit::WebPage::requestDocumentEditingContext): Ditto. 2020-07-21 Jer Noble <jer.noble@apple.com> [Cocoa] Add experimental MSE WebM parser https://bugs.webkit.org/show_bug.cgi?id=214529 <rdar://problem/65782467> Reviewed by Eric Carlson. Add an Experimental setting to enable the MSE WebM parser (off by default). * Shared/WebPreferences.yaml: 2020-07-21 Tim Horton <timothy_horton@apple.com> watchOS: Web Content process crashes when it tries to open files https://bugs.webkit.org/show_bug.cgi?id=214614 <rdar://problem/65900517> Reviewed by Darin Adler. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Allow reading kern.maxfilesperproc, as it is allowed on macOS and in the Network process sandbox, and libc needs it. 2020-07-21 Per Arne Vollan <pvollan@apple.com> [macOS] Layout tests exiting early with crashes https://bugs.webkit.org/show_bug.cgi?id=214612 <rdar://problem/65897905> Reviewed by Brent Fulgham. This is caused by the WebContent process making a syscall not allowed by the sandbox. * WebProcess/com.apple.WebProcess.sb.in: 2020-07-21 David Kilzer <ddkilzer@apple.com> WebKit::ColorSpaceData::decode() does not need default: case <https://webkit.org/b/214587> <rdar://problem/65777868> Reviewed by Darin Adler. * Shared/mac/ColorSpaceData.mm: (WebKit::ColorSpaceData::decode): - Remove default: case and add ASSERT_NOT_REACHED() and move `return false;` to bottom of the method. 2020-07-21 James Savage <james.savage@apple.com> Unable to call WKScriptMessageHandlerWithReply's replyHandler with a nil errorMessage in Swift https://bugs.webkit.org/show_bug.cgi?id=214581 <rdar://problem/65639342> Reviewed by Brady Eidson. * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: Modify the block signature to allow nil for either argument. 2020-07-21 Kate Cheney <katherine_cheney@apple.com> Frequent Network error messages: "ResourceLoadStatisticsDatabaseStore::topPrevalentResourceWithUserInteractionDaysSinceUserInteractionStatement query failed to step, error message: no more rows available" https://bugs.webkit.org/show_bug.cgi?id=214597 <rdar://65884740> Reviewed by John Wilander. We should not log an error message when no rows are returned when running telemetry queries, because this is not an error. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::getMedianOfPrevalentResourcesWithUserInteraction): (WebKit::ResourceLoadStatisticsDatabaseStore::getTopPrevelentResourceDaysSinceUI const): Remove unnecessary error logging and only check for telemetry results if the query returns a row. 2020-07-21 Youenn Fablet <youenn@apple.com> NetworkConnectionToWebProcess should not handle NetworkRTCProvider messages https://bugs.webkit.org/show_bug.cgi?id=214547 Reviewed by Alex Christensen. Normally NetworkRTCProvider is created when starting to monitor the network. In case network process is crashing though, there might be requests to open RTC socket on the new network process which has not started to monitor the network. In that case, we will go through NetworkConnectionToWebProcess as NetworkRTCProvider is not yet created. To properly handle this case, on web process side, we send an IPC message to explictly create the NetworkRTCProvider. Once done, we set the IPC connection to the socket factory which will start sending messages to open sockets if needed. Until its connection is set, the socket factory will buffer messages to open sockets. Covered by test no longer crashing in debug. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): (WebKit::NetworkConnectionToWebProcess::createRTCProvider): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * WebProcess/Network/webrtc/LibWebRTCNetwork.cpp: (WebKit::LibWebRTCNetwork::setAsActive): (WebKit::LibWebRTCNetwork::setConnection): (WebKit::LibWebRTCNetwork::setSocketFactoryConnection): * WebProcess/Network/webrtc/LibWebRTCNetwork.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::setConnection): (WebKit::LibWebRTCSocketFactory::createServerTcpSocket): (WebKit::LibWebRTCSocketFactory::createUdpSocket): (WebKit::LibWebRTCSocketFactory::createClientTcpSocket): (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: 2020-07-21 Youenn Fablet <youenn@apple.com> Fetch/XHR loads done by extensions should opt out of response sanitisation done in network process https://bugs.webkit.org/show_bug.cgi?id=214588 <rdar://problem/65060560> Reviewed by Alex Christensen. Send to network process the CORS disabling patterns. Disable sanitization for fetch/xhr loads whose pages have a matching pattern. Covered by API test. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::setCORSDisablingPatterns): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::shouldDisableCORSForRequestTo const): (WebKit::NetworkProcess::setCORSDisablingPatterns): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::shouldSanitizeResponse): (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible): * WebProcess/WebPage/WebPage.cpp: (WebKit::parseAndAllowAccessToCORSDisablingPatterns): (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::~WebPage): (WebKit::WebPage::updateCORSDisablingPatterns): (WebKit::WebPage::synchronizeCORSDisablingPatternsWithNetworkProcess): * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::ensureNetworkProcessConnection): 2020-07-21 Eric Carlson <eric.carlson@apple.com> Use AVRoutePickerView when available for choosing AirPlay devices https://bugs.webkit.org/show_bug.cgi?id=213497 <rdar://problem/58610662> Reviewed by Jer Noble. * UIProcess/WebPageProxy.h: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::platformView const): Add new override. 2020-07-21 Jer Noble <jer.noble@apple.com> [Cocoa] Adopt VTRegisterSupplementalVideoDecoderIfAvailable https://bugs.webkit.org/show_bug.cgi?id=214585 <rdar://problem/65863651> Reviewed by Youenn Fablet. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): 2020-07-21 Michael Catanzaro <mcatanzaro@gnome.org> [GTK] WebKitSettings:enable-private-browsing missing G_PARAM_DEPRECATED https://bugs.webkit.org/show_bug.cgi?id=214554 Reviewed by Carlos Garcia Campos. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_class_init): 2020-07-21 Adrian Perez de Castro <aperez@igalia.com> Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.29.1 release * wpe/NEWS: Add release notes for 2.29.1. 2020-07-21 Carlos Garcia Campos <cgarcia@igalia.com> Fix ITP data summary when using the memory store and blocking all third-party cookies https://bugs.webkit.org/show_bug.cgi?id=214401 Reviewed by Michael Catanzaro. The memory store behaves differently than the database one, it only includes prevalent resources in the list, while the database store includes all resources when cooking blocking policy is All. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::aggregatedThirdPartyData const): Only check isPrevalentResource if third party cookie blocking mode is not All to decide whether to include the domain in the report. 2020-07-21 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Prepare unit tests for GTK4 https://bugs.webkit.org/show_bug.cgi?id=214251 Reviewed by Adrian Perez de Castro. Make it possible to test input methods. * UIProcess/API/glib/InputMethodFilter.h: * UIProcess/API/gtk/InputMethodFilterGtk.cpp: (WebKit::InputMethodFilter::filterKeyEvent): Added to receive the key event properties instead of the GdkEvent. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeMouseEvent): Create a GdkEvent for right clicks since it's needed by GTK3 API. (webkitWebViewBaseSynthesizeKeyEvent): Send key press and release events to the IM filter. 2020-07-20 Megan Gardner <megan_gardner@apple.com> Add OK button to Date/Time form controls. https://bugs.webkit.org/show_bug.cgi?id=214195 <rdar://problem/65006000> Reviewed by Darin Adler. Add 'OK' button to add clarity to UI, and increase the default size of the control to ensure space for both buttons. Also fixed a crash that happened when closing the control before the animation completed. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimeContextMenuViewController preferredContentSize]): (-[WKDateTimePicker contextMenuInteraction:configurationForMenuAtLocation:]): (-[WKDateTimePicker contextMenuInteraction:willDisplayMenuForConfiguration:animator:]): (-[WKDateTimePicker contextMenuInteraction:willEndForConfiguration:animator:]): (-[WKDateTimePicker ok:]): 2020-07-20 Adrian Perez de Castro <aperez@igalia.com> Non unified build fixes, midsummer 2020 edition https://bugs.webkit.org/show_bug.cgi?id=213616 Unreviewed build fix. * NetworkProcess/soup/WebSocketTaskSoup.cpp: Add missing inclusion of NetworkProcess.h 2020-07-20 Brian Burg <bburg@apple.com> Web Inspector: developerExtrasEnabled should be respected when opening local Web Inspector https://bugs.webkit.org/show_bug.cgi?id=214573 <rdar://problem/65848496> Reviewed by David Kilzer. Ensure that WKPreferences.developerExtrasEnabled is true prior to opening a Web Inspector window. This matches the check in WebCore when deciding to show "Inspect Element" menu item. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::connect): (WebKit::WebInspectorProxy::openLocalInspectorFrontend): 2020-07-20 Adrian Perez de Castro <aperez@igalia.com> [WPE] WebPopupItem should always be forward declared as struct https://bugs.webkit.org/show_bug.cgi?id=214569 Unreviewed build fix. No new tests needed. * UIProcess/API/wpe/WebKitWebViewClient.h: Forward-declare WebPopupItem as a struct. 2020-07-20 Alex Christensen <achristensen@webkit.org> REGRESSION(r263551) Main thread often hangs while saving cookies https://bugs.webkit.org/show_bug.cgi?id=214564 <rdar://problem/65779712> Reviewed by Geoffrey Garen. I had assumed that CFNetwork wouldn't write cookies on the main thread, but I was wrong. That change caused spins, so let's just do the work on the WebsiteDataStore's queue instead. * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: (API::HTTPCookieStore::flushDefaultUIProcessCookieStore): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::dispatchOnQueue): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-07-20 David Kilzer <ddkilzer@apple.com> WebPageProxyIdentifier parameter of WebPageProxy::CreateNewPage() should not be Optional <https://webkit.org/b/214542> <rdar://problem/65768644> Reviewed by Darin Adler. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createNewPage): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::createNewPage): * UIProcess/WebPageProxy.messages.in: - Remove Optional<> wrapper for WebPageProxyIdentifier parameter since the value is used unconditionally. 2020-07-20 Adrian Perez de Castro <aperez@igalia.com> Some classes have final destructors but are non-final https://bugs.webkit.org/show_bug.cgi?id=214549 Reviewed by Youenn Fablet. No new tests needed. * NetworkProcess/ServiceWorker/WebSWServerConnection.h: Mark WebSWServerConnection class as final. * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h: Ditto. 2020-07-20 Carlos Garcia Campos <cgarcia@igalia.com> valgrind claims uninitialized memory when opening inspector (WebKit::InspectorBrowserAgent::enable(WTF::String&)) https://bugs.webkit.org/show_bug.cgi?id=209468 Reviewed by Michael Catanzaro. Initialize m_targetAgent. * UIProcess/Inspector/WebPageInspectorController.h: 2020-07-19 Sam Weinig <weinig@apple.com> Rename Color::transparent to Color::transparentBlack to more clearly state what it is https://bugs.webkit.org/show_bug.cgi?id=214522 Reviewed by Darin Adler. * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties): * UIProcess/API/ios/WKWebViewIOS.mm: (scrollViewBackgroundColor): (-[WKWebView _setOpaqueInternal:]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setDrawsBackground): * UIProcess/WebPageProxy.cpp: (WebKit::m_transcodingQueue): * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: (webkitWebPageDidReceiveMessage): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::snapshotNode): * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): Color::transparent to Color::transparentBlack. 2020-07-19 Sam Weinig <weinig@apple.com> Remove ColorBuilder https://bugs.webkit.org/show_bug.cgi?id=214521 Reviewed by Darin Adler. * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::showPaintRect): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::drawRect): Update for rename from colorWithAlpha to colorWithAlphaByte. 2020-07-19 Michael Catanzaro <mcatanzaro@gnome.org> Enable cross-platform release logging in ResourceLoadStatisticsDatabaseStore.cpp https://bugs.webkit.org/show_bug.cgi?id=214538 Reviewed by Darin Adler. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 2020-07-18 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r264563. https://bugs.webkit.org/show_bug.cgi?id=214518 Broke the watchOS build Reverted changeset: "Add OK button to Date/Time form controls." https://bugs.webkit.org/show_bug.cgi?id=214195 https://trac.webkit.org/changeset/264563 2020-07-18 Rob Buis <rbuis@igalia.com> Only use enum classes in HTTPParsers https://bugs.webkit.org/show_bug.cgi?id=214451 Reviewed by Darin Adler. Adjust to XFrameOptionsDisposition change. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): 2020-07-17 Sam Weinig <weinig@apple.com> Remove final vestigates of SimpleColor https://bugs.webkit.org/show_bug.cgi?id=214439 Reviewed by Simon Fraser. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::drawInContext): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _tapHighlightColorForFastClick:]): * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::showPaintRect): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::drawRect): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::paintSnapshotAtSize): * WebProcess/WebPage/ios/FindControllerIOS.mm: Replace remaining makeSimpleColor() uses. 2020-07-17 Megan Gardner <megan_gardner@apple.com> Add OK button to Date/Time form controls. https://bugs.webkit.org/show_bug.cgi?id=214195 <rdar://problem/65006000> Reviewed by Darin Adler. Add 'OK' button to add clarity to UI, and increase the default size of the control to ensure space for both buttons. Also fixed a crash that happened when closing the control before the animation completed. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimeContextMenuViewController preferredContentSize]): (-[WKDateTimePicker contextMenuInteraction:configurationForMenuAtLocation:]): (-[WKDateTimePicker contextMenuInteraction:willDisplayMenuForConfiguration:animator:]): (-[WKDateTimePicker contextMenuInteraction:willEndForConfiguration:animator:]): (-[WKDateTimePicker ok:]): 2020-07-17 Lauro Moura <lmoura@igalia.com> [GTK] fast/events/context-activated-by-key-event.html is crashing https://bugs.webkit.org/show_bug.cgi?id=199444 Reviewed by Michael Catanzaro. GTK supports showing the context menu for keyboard events. In these cases there may be no pending mouse events, causing the assert to fail. Covered by existing tests. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContextMenu): 2020-07-17 Per Arne Vollan <pvollan@apple.com> Add Launch Services database update logging https://bugs.webkit.org/show_bug.cgi?id=214500 Reviewed by Geoffrey Garen. Log if the WebContent process is waiting a considerable amount of time for the initial update of the Launch Services database. No new tests, since this patch is not introducing any behavior change. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2020-07-17 Brent Fulgham <bfulgham@apple.com> Remove logging for necessary sysctl call https://bugs.webkit.org/show_bug.cgi?id=214497 <rdar://problem/65737636> Reviewed by Per Arne Vollan. We discovered that kern.proc.pid is needed in SecTaskCopyDebugDescription, so we can remove that telemetry and logging. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-07-17 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Cache the PIN to improve NFC user experience https://bugs.webkit.org/show_bug.cgi?id=213900 <rdar://problem/60073622> Reviewed by Brent Fulgham. Cache the PIN to improve NFC user experience. Users might not hold the NFC key against the NFC scanner all the time while entering the PIN. Therefore, we cache the PIN from the previous connection and immediately return the cached PIN to the current connection such that users don't need to enter the PIN again. The only downside for this optimization is that a wrong PIN could be used if the user switch to another authenticator for the new connection. Given there is no UUID to identify a particular authenticator, there is nothing we can do to resolve the issue. The probability of the issue, however, should be rare. Covered by new API tests. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::authenticatorStatusUpdated): (WebKit::AuthenticatorManager::requestPin): Where the above logic is implemented. * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm: (WebKit::NfcConnection::transact const): Adds a comment. * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential): (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion): Adds a field for the cached PIN. 2020-07-17 Per Arne Vollan <pvollan@apple.com> [iOS] Crash under WebProcess::handleXPCEndpointMessages https://bugs.webkit.org/show_bug.cgi?id=214490 Reviewed by Chris Dumez. According to crash logs, it seems possible that the parent process XPC connection can be null. Add a null check, and also check that the connection XPC object really is an XPC connection object. No new tests, since I have not been able to reproduce this issue. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::handleXPCEndpointMessages const): 2020-07-17 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Use MediaOnly user gesture https://bugs.webkit.org/show_bug.cgi?id=213595 <rdar://problem/64946612> Reviewed by Brent Fulgham. MediaOnly user gesture is more flexible than regular user gesture. For example, it can be propagated through XHR. A common use case for WebAuthn is to call the API within XHR events, which could be triggered by user activated events initially. By using MediaOnly user gesture, it allows developer to keep using this XHR model. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): 2020-07-17 David Kilzer <ddkilzer@apple.com> [IPC hardening] Add nullptr checks to WebKit::WebInspectorProxy::platformStartWindowDrag() <https://webkit.org/b/214436> <rdar://problem/59645910> Reviewed by Brent Fulgham. * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformStartWindowDrag): - Add nullptr checks. 2020-07-17 Simon Fraser <simon.fraser@apple.com> Make ScrollbarControlSize an enum class https://bugs.webkit.org/show_bug.cgi?id=199325 Reviewed by Sam Weinig. Make ScrollbarControlSize an enum class, and make some RenderScrollbar methods const. * UIProcess/win/WebPopupMenuProxyWin.cpp: (WebKit::WebPopupMenuProxyWin::showPopupMenu): (WebKit::WebPopupMenuProxyWin::calculatePositionAndSize): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): 2020-07-17 Tim Horton <timothy_horton@apple.com> Add a addition point for extra user media sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=214445 <rdar://problem/65148262> Reviewed by Per Arne Vollan. * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::willCreateMediaStream): (WebKit::UserMediaProcessManager::revokeSandboxExtensionsIfNeeded): * WebProcess/com.apple.WebProcess.sb.in: 2020-07-17 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r264477. Broke the internal build Reverted changeset: "Use AVRoutePickerView when available for choosing AirPlay devices" https://bugs.webkit.org/show_bug.cgi?id=213497 https://trac.webkit.org/changeset/264477 2020-07-16 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Add a console message: "User gesture is required to use the platform authenticator." https://bugs.webkit.org/show_bug.cgi?id=214380 <rdar://problem/65300587> Reviewed by Devin Rousso. Covered by existing tests. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): 2020-07-16 Per Arne Vollan <pvollan@apple.com> XPC connection should be suspended before setting target queue https://bugs.webkit.org/show_bug.cgi?id=214427 Reviewed by Darin Adler. According to system logs, an active XPC connection should be suspended before setting a new target queue. No new tests, since there should be no behavior change introduced by this patch. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::handleXPCEndpointMessages const): 2020-07-16 Fujii Hironori <Hironori.Fujii@sony.com> [WTF] Remove the unnecessary inner class DefaultHash<T>::Hash https://bugs.webkit.org/show_bug.cgi?id=214389 Reviewed by Darin Adler. * NetworkProcess/Downloads/DownloadID.h: * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheKey.h: * Platform/IPC/MessageReceiverMap.h: * Platform/IPC/StringReference.h: * Shared/CallbackID.h: * UIProcess/API/cpp/WKRetainPtr.h: 2020-07-16 Takashi Komori <Takashi.Komori@sony.com> [WinCairo][CURL] NetworkProcess consumes CPU resource greedily https://bugs.webkit.org/show_bug.cgi?id=214383 Reviewed by Fujii Hironori. Add PolicyAction::Ignore handling routine in NetworkDataTaskCurl::invokeDidReceiveResponse() If we don't cancel the ignored requests the worker thread for curl scheduler goes busy-looping because the fds of the requests continue to be monitored. No tests needed as existing tests cover this change. * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): 2020-07-16 Tim Horton <timothy_horton@apple.com> iPad cursor is sometimes slow to change to I-beam (e.g. on reddit.com) https://bugs.webkit.org/show_bug.cgi?id=214424 <rdar://problem/59503572> Reviewed by Wenson Hsieh. No new tests, just an optimization. * Shared/ios/InteractionInformationRequest.h: * Shared/ios/InteractionInformationRequest.cpp: (WebKit::InteractionInformationRequest::encode const): (WebKit::InteractionInformationRequest::decode): (WebKit::InteractionInformationRequest::isValidForRequest): (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest): 'const'-ify these getters * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::positionInformation): Make it possible to disable computation of the 'nodeAtPositionHasDoubleClickHandler' property, because it can be quite expensive for some web content. We will still compute it by default, but high-rate interaction information requests (like those for the cursor) can optionally disable it. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView requestAsynchronousPositionInformationUpdate:]): (-[WKContentView _hasValidOutstandingPositionInformationRequest:]): (-[WKContentView _positionInformationDidChange:]): When position information updates come in, only clear the outstanding request if the reply is valid for that request; otherwise, the outstanding request is definitely still outstanding, and we've probably just sent multiple requests. A more formal mechanism that actually keeps track of all requests might be more appropriate here in the future, but this helps us avoid re-requesting position information for the same point repeatedly, just because old (stale) updates are coming in. (-[WKContentView _cursorInteraction:regionForLocation:defaultRegion:completion:]): Instead of requesting an interaction information update for every cursor update, and then dropping them on the floor when they return, if a new request was sent, simply coalesce all requests that come in while we have an outstanding one. This avoids a great deal of unnecessary (and ignored) work when the Web Content process is responding to requests at a slower rate than the cursor interaction is trying to retrieve new regions. 2020-07-16 Megan Gardner <megan_gardner@apple.com> Selection is not always clearing when tapping. https://bugs.webkit.org/show_bug.cgi?id=214326 <rdar://problem/65069201> Reviewed by Wenson Hsieh. In r262280 we stopped the UIWKGestureOneFingerTap gesture from starting if the tap was not inside the current selection. That caused the selection to not always be cleared, especially when tapping on an element that could create an overlay in which the selection was supposed to be obscured. We short circuited this gesture because it used to cause a sync IPC message to be sent to the web process, but that code has subsequently changed, so allowing the gesture to start and clear the selection in all cases is no longer a performance concern, so changing the behavior back to allowing the gesture to always start, even if the touch is not inside the selection rect. Test: editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): 2020-07-16 Eric Carlson <eric.carlson@apple.com> Use AVRoutePickerView when available for choosing AirPlay devices https://bugs.webkit.org/show_bug.cgi?id=213497 <rdar://problem/58610662> Reviewed by Jer Noble. * UIProcess/WebPageProxy.h: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::platformView const): Add new override. 2020-07-16 Jer Noble <jer.noble@apple.com> [Cocoa] Add MediaCapabilities support for SW VP9 decoder. https://bugs.webkit.org/show_bug.cgi?id=214316 Reviewed by Eric Carlson. Pass the system AC state to the WebContent process at creation time, and also create a power state listener so the WebProcess can be updated dynamically. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::WebProcessPool::registerNotificationObservers): * UIProcess/WebProcessPool.cpp: * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::powerSourceDidChange): 2020-07-16 Per Arne Vollan <pvollan@apple.com> [macOS] Add syscall to WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=214394 <rdar://problem/65638758> Reviewed by Darin Adler. Add required syscall to WebContent process on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2020-07-16 Chris Dumez <cdumez@apple.com> Unreviewed, fix logging added in r264414 that was incorrectly marked as "error" logging. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2020-07-16 Tuomas Karkkainen <tuomas.webkit@apple.com> ASAN builds of WebKit should not freeze when an EXC_RESOURCE is delivered https://bugs.webkit.org/show_bug.cgi?id=214346 Reviewed by Mark Lam. When the WebContent process allocates 1000 MB of memory or starts 32 threads, it receives an EXC_RESOURCE. This requires iterating all the mappings of the process. For the case of a process instrumented with AddressSanitizer, the mappings total 20 terabytes, and cause the process to "freeze" for several minutes. Setting the sysctl debug.toggle_address_reuse to 1 causes the EXC_RESOURCE mechanism to skip iteration of all the mappings. With this patch, setting the environment variable DISABLE_FREEZING_ON_EXC_RESOURCE will set the sysctl mentioned above for WebContent and Networking processes. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: 2020-07-15 Per Arne Vollan <pvollan@apple.com> Unreviewed, revert part of r264385. The change set r264385 speculatively added two messages to the mach-kernel-endpoint filter on iOS. These messages are not needed, and should be removed. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-07-15 Darin Adler <darin@apple.com> Remove a few more uses of the terms black/white list https://bugs.webkit.org/show_bug.cgi?id=214371 Reviewed by Alex Christensen. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::shouldPlugInAutoStartFromOrigin): Reworded a comment. 2020-07-15 Devin Rousso <drousso@apple.com> should represent `TextPlaceholderElement` as an `NSTextAttachmentCharacter` instead of a `\n` https://bugs.webkit.org/show_bug.cgi?id=214331 <rdar://problem/64779558> Reviewed by Wenson Hsieh. * Platform/spi/ios/UIKitSPI.h: Add missing SPI declarations. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView removeTextPlaceholder:willInsertText:completionHandler:]): Drive-by: ensure that the `completionHandler` is always called. 2020-07-15 Simon Fraser <simon.fraser@apple.com> itsnicethat.com page is sometimes non-scrollable https://bugs.webkit.org/show_bug.cgi?id=214362 <rdar://problem/65431127> Reviewed by Tim Horton. This page uses 'clip-path: inset(1px); on a 1px x 1px element to hit descendants from hit-testing and compositing code turns this into a layer mask using a CAShapeLayer. Our layer/view hit-testing code failed to check for masking; if a layer has a mask, it needs to be handled like -masksToBounds, in that points outside the mask should never hit descendant layers. Make a -_web_maskContainsPoint: to test whether the point is inside the mask layer, and _web_maskMayIntersectRect: which does approximate testing using path bounds intersection (this is used for editable regions). Also convert some hard-coded winding rule strings to use the CA constants. * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer): * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::collectDescendantViewsAtPoint): (WebKit::collectDescendantViewsInRect): 2020-07-15 Chris Dumez <cdumez@apple.com> Improve navigation policy decision release logging to help better diagnose issues https://bugs.webkit.org/show_bug.cgi?id=214368 Reviewed by Alex Christensen. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceivePolicyDecision): 2020-07-15 Chris Dumez <cdumez@apple.com> [WK2] Make establishing a connection between the WebProcess and the Network process more robust https://bugs.webkit.org/show_bug.cgi?id=214307 <rdar://problem/64592340> Reviewed by Alex Christensen. Make establishing a connection between the WebProcess and the Network process more robust. When the network process is crashy, it is not uncommon for the WebProcess to fail to establish a connection to the network process. Previously, we would try twice and then give up by calling CRASH(). I have tweaked the logic so that we now try 10 times and wait 100 ms between each attempt to make a best effort at establishing the connection. I also updated the logic to exit cleanly instead of crashing if the IPC connection to the UIProcess becomes invalid (i.e. the UIProcess has severed the connection because this WebProcess is no longer needed). * WebProcess/WebProcess.cpp: (WebKit::getNetworkProcessConnection): (WebKit::WebProcess::ensureNetworkProcessConnection): 2020-07-15 Rob Buis <rbuis@igalia.com> Building AccessibilitySupportSPI with the macOS Big Sur public SDK fails https://bugs.webkit.org/show_bug.cgi?id=214237 Reviewed by Alex Christensen. Need to include HIServicesSPI.h for _AXUIElementRequestServicedBySecondaryAXThread. * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: 2020-07-15 Brady Eidson <beidson@apple.com> Update a WKPreferences API comment. https://bugs.webkit.org/show_bug.cgi?id=214360 Rubberstamped by Tim Horton * UIProcess/API/Cocoa/WKPreferences.h: 2020-07-15 Lauro Moura <lmoura@igalia.com> [SOUP] Artificial delay to WebSocket connection to mitigate port scanning attacks https://bugs.webkit.org/show_bug.cgi?id=214293 Reviewed by Carlos Garcia Campos. r264306 added an artificial delay when NetworkSocketStream closed due to closed ports but Soup-based ports use another code path and were still returning immediately. SOUP WebSocket errors do not distinguish closed ports separately, so this commit checks for connections that finished with NOT_WEBSOCKET errors. Covered by existing tests. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::randomClosedPortDelay): Move the delay calculation here to be shared between the different code paths. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::didFailSocketStream): Use the shared delay. (WebKit::randomDelay): Deleted. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::WebSocketTask): Add a oneShot timer with random duration when failing to connect to something that is not a WebSocket. (WebKit::WebSocketTask::delayFailTimerFired): 2020-07-14 Per Arne Vollan <pvollan@apple.com> [iOS] Add missing messages to message filter in WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=214334 <rdar://problem/65529952> Reviewed by Brent Fulgham. Allow some messages which are required in the message filter in the WebContent process on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-07-14 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r264101): Sharing a link attaches an image instead of the URL https://bugs.webkit.org/show_bug.cgi?id=214329 <rdar://problem/65513607> Reviewed by Tim Horton and Devin Rousso. r264101 added logic that attempts to share an activated (i.e. long-pressed) element as an image, if the image URL scheme for the element is equal to "data" (ignoring case sensitivity). However, in the case where the image URL is nil, the call to `[element.imageURL.scheme caseInsensitiveCompare:@"data"]` is 0, which (conveniently) is equal to `NSOrderedSame`. This causes us to incorrectly proceed by sharing the element as an image. Fix this by going through URL::protocolIsData(), so we don't end up with 0 (`NSOrderedSame`) when `element.imageURL.scheme` is `nil`. Test: ShareSheetTests.ShareAnchorElementAsURL * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): 2020-07-14 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] The completion handler in -handleKeyWebEvent:withCompletionHandler: is sometimes never called https://bugs.webkit.org/show_bug.cgi?id=214295 <rdar://problem/60539389> Reviewed by Devin Rousso. This is a speculative fix for <rdar://problem/60539389>, wherein hardware key commands seemingly stop working in a web page that is (presumably) otherwise responsive. It's possible that the bug exercises a scenario in which the completion handler in `-[WKContentView handleKeyWebEvent:withCompletionHandler:]` is never invoked, which subsequently leads to the keyboard task queue being backed up with key events. This can happen in several ways. For instance, if the web process is swapped or terminates in the middle of handling a key event, the key event queue will be cleared, but the UI process will still retain the (uncalled) completion handler for that key event. Additionally, `WebPageProxy::handleKeyboardEvent` may not even have attempted to propagate the event to the web process, in which case we shouldn't be saving the completion handler and waiting for a response. Test: KeyboardInputTests.HandleKeyEventsInCrashedOrUninitializedWebProcess KeyboardInputTests.HandleKeyEventsWhileSwappingWebProcess * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handleKeyboardEvent): Make this return a `bool` indicating whether the key event was sent to the web process. If not, then we should immediately invoke the completion handler in -handleKeyWebEvent:withCompletionHandler: below, instead of stashing the Objective-C block and waiting for a response from the web process (which is presumably not running). * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _cancelPendingKeyEventHandler]): When the web process terminates or swaps in the middle of handling a key event, go ahead and invoke the key event completion handler early with the queued event, since we aren't going to receive a response from the web process anyways. (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): 2020-07-14 Simon Fraser <simon.fraser@apple.com> Flashes of incorrect scroll position when zooming on quip https://bugs.webkit.org/show_bug.cgi?id=214273 <rdar://problem/59385421> Reviewed by Tim Horton. Quip uses a non-scrollable "body { overflow:hidden }")" page, but aggressively scrolls to 0,0 if it gets a scroll event and top/left are non-zero. Panning is necessarily allowed on overflow:hidden pages, so to avoid programmatic scrolls yanking the content to 0,0 during interaction, ignore them if the page is non-scrollable yet zoomed. When refusing such a scroll, we have to inform the web process to avoid mismatched ui/web process state, and work around the fact that WebPageProxy::updateVisibleContentRects() would bail if the update appeared to be the same as the last one. Test: fast/scrolling/ios/programmatic-scroll-while-zoomed.html * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _updateScrollViewForTransaction:]): (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]): (-[WKWebView _scheduleForcedVisibleContentRectUpdate]): (-[WKWebView _updateVisibleContentRects]): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const): (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableOrZoomedMainFrame const): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::updateVisibleContentRects): 2020-07-14 Kate Cheney <katherine_cheney@apple.com> [ macOS iOS ] http/tests/resourceLoadStatistics/telemetry-generation-basic-functionality-database.html is a rare flaky failure https://bugs.webkit.org/show_bug.cgi?id=212165 <rdar://problem/63462045> Reviewed by Brent Fulgham. Test was flaking because of multiple async calls to submit telemetry, which happen when a new ITP store is created and again when the test makes an SPI call. If the first telemetry call is reported after the test sets notifyPagesWhenTelemetryWasCaptured but before the SPI call to capture telemetry is submitted, the test will receive the wrong data. To fix this, we should simplify by removing the separate function to tell ITP to report telemetry, and instead always report when the testing SPI call is made. No new tests, will fix flaky tests. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::calculateAndSubmitTelemetry const): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::calculateAndSubmitTelemetry const): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::submitTelemetry): Pass in new enum value to indicate when the telemetry call is coming from the testing SPI. (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenTelemetryWasCaptured): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp: (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit): (WebKit::WebResourceLoadStatisticsTelemetry::submitTelemetry): (WebKit::WebResourceLoadStatisticsTelemetry::setNotifyPagesWhenTelemetryWasCaptured): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.h: Remove static bool variable notifyPagesWhenTelemetryWasCaptured and rely on the submitTelemetry function call to let us know when to report telemetry. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setNotifyPagesWhenTelemetryWasCaptured): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setNotifyPagesWhenTelemetryWasCaptured): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: Remove setNotifyPagesWhenTelemetryWasCaptured function. 2020-07-14 Daniel Bates <dabates@apple.com> [iOS] Sometimes unable to type Japanese on docs.google.com https://bugs.webkit.org/show_bug.cgi?id=214272 <rdar://problem/59449972> Reviewed by Wenson Hsieh. Tell the web process to restore the selection of the focused element when re-focusing it on page activation. When resigning first responder the text interaction assistant is deactivated and calls back into WKContentView's -clearSelection, which clears the focused element and tells the web process to clear the selection. Keep in mind that the focused element in the web process is not changed. When the WKContentView subsequently becomes first responder the web process messages the UI process to tell it to start assistance (aka focus) for focused element. However the selection is not restored and thus the editor state the UI process has, and is even sent up until there is a selection change, mismatches with the focused element information it also has. To match Mac, key events are only passed to the input manager if an editable element is focused (see <https://bugs.webkit.org/show_bug.cgi?id=199122>). So, key events are not passed to the input manager when in this state. To prevent this, restore the selection of the focused element when the element is re-focused because the page became active again. Selection restoration is driven by the UI process (not the web process) because element re- focusing may be denied by the embedding client. In this case, selection should not be restored because UI assistance was not started. For the same reason, I do not restore it in -becomeFirstResponderForWebView. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _didCommitLoadForMainFrame]): Clear out the flag. See below for more details. (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): Pass the key to the input manager if the _treatAsContentEditableUntilNextEditorStateUpdate is YES. (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): If this request is a result of the page activating (aka focus activity change) into an editable field (i.e. mayContainSelectableText() resturns YES) and assistance is not being suppressed then tell the web process to restore the selection. As part of this I tell the text interaction assistant to activate even though -becomeFirstResponderForWebView was called beforehand because -becomeFirstResponderForWebView only activates it if there is a non-empty selection. (Note the page having an empty selection could have been a result of -clearSelection having been called though the page could have done it programmatically as well). I also set a new flag to YES and schedule a full editor state update to ensure this flag is cleared. The flag is so that key events that come in between now and the next editor state update are passed to the input manager. (-[WKContentView _didUpdateEditorState]): Clear out the flag. See above for more details. 2020-07-14 Fujii Hironori <Hironori.Fujii@sony.com> Unreviewed non-unified build fixes * NetworkProcess/NetworkSocketStream.cpp: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreGetAllStorageAccessEntries): * UIProcess/WebContextMenuProxy.cpp: * UIProcess/WebOpenPanelResultListenerProxy.h: 2020-07-13 Chris Dumez <cdumez@apple.com> Add more logging for navigation policy decisions on UIProcess side https://bugs.webkit.org/show_bug.cgi?id=214277 Reviewed by Geoffrey Garen. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2020-07-13 Ryan Haddad <ryanhaddad@apple.com> Remove live ranges from Document.h, AlternativeTextController.h, DictionaryLookup.h, and WebPage.h https://bugs.webkit.org/show_bug.cgi?id=214109 Unreviewed Catalyst build fix. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::dictionaryPopupInfoForRange): 2020-07-13 Kate Cheney <katherine_cheney@apple.com> Followup to bug 213143: Add artificial delay to WebSocket connections to mitigate port scanning attacks https://bugs.webkit.org/show_bug.cgi?id=213143 Reviewed by Darin Adler. Convert min and max millisecond values from double/int to Seconds. No new tests, behavior should not change. * NetworkProcess/NetworkSocketStream.cpp: (WebKit::randomDelay): 2020-07-13 Eric Carlson <eric.carlson@apple.com> Impossible to pause playback of MediaStream video track https://bugs.webkit.org/show_bug.cgi?id=214262 <rdar://problem/65483729> Reviewed by Jer Noble. * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp: (WebKit::RemoteSampleBufferDisplayLayer::play): (WebKit::RemoteSampleBufferDisplayLayer::pause): * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in: * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp: (WebKit::SampleBufferDisplayLayer::play): (WebKit::SampleBufferDisplayLayer::pause): * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h: 2020-07-13 Sam Weinig <weinig@apple.com> Replace single argument makeSimpleColor uses with their implementation https://bugs.webkit.org/show_bug.cgi?id=214240 Reviewed by Darin Adler. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorToWebCoreColor): Replace makeSimpleColor with convertToComponentBytes. 2020-07-13 Per Arne Vollan <pvollan@apple.com> Crash under WebKit::LaunchServicesDatabaseManager::didConnect() https://bugs.webkit.org/show_bug.cgi?id=214263 Reviewed by Darin Adler. There is a crash under WebKit::LaunchServicesDatabaseManager::didConnect() when trying to send a message to an invalid connection. No new tests, since I have not been able to reproduce. * WebProcess/cocoa/LaunchServicesDatabaseManager.mm: (WebKit::LaunchServicesDatabaseManager::didConnect): 2020-07-13 Brent Fulgham <bfulgham@apple.com> REGRESSION (r262538): Nullptr Deref in WTF::Detail::CallableWrapper<WebKit::WebResourceLoadStatisticsStore::performDailyTasks()::$_66, void>::call https://bugs.webkit.org/show_bug.cgi?id=214264 <rdar://problem/65093949> Reviewed by Darin Adler. A new type check was added outside of the protecting nullptr check. This introduced a new nullptr dereference bug. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::performDailyTasks): 2020-07-13 Kate Cheney <katherine_cheney@apple.com> Add artificial delay to WebSocket connections to mitigate port scanning attacks https://bugs.webkit.org/show_bug.cgi?id=213143 <rdar://problem/64308927> Reviewed by Alex Christensen. When establishing web socket connections, closed ports typically return an error more quickly than open ports due to the additional time it takes open ports to perform a TLS handshake. This patch adds a delay to the closed-port case to prevent distinguishing these cases. Test: http/tests/websocket/tests/hybi/closed-port-delay.html * NetworkProcess/NetworkSocketStream.cpp: (WebKit::NetworkSocketStream::NetworkSocketStream): (WebKit::randomDelay): Add a random delay between 10 and 100ms before sending IPC. (WebKit::NetworkSocketStream::sendDelayedFailMessage): (WebKit::NetworkSocketStream::didFailSocketStream): Only delay for the proper error code indicating the connection was refused for a closed port. * NetworkProcess/NetworkSocketStream.h: 2020-07-13 Zan Dobersek <zdobersek@igalia.com> [GTK][WPE] WTR and API-tests timing out after r264283 https://bugs.webkit.org/show_bug.cgi?id=214244 Reviewed by Carlos Garcia Campos. r264283 broke local file loads at least for GTK and WPE ports due to additionally-introduced ENABLE(SANDBOX_EXTENSIONS) build guards. This patch reverts to using the sandboxing code without these guards, relying instead on no-op SandboxExtension implementations for ports not yet providing the system-specific sandboxing functionality. Uses of the audit token functionality (only available on Cocoa platforms) gain HAVE(AUDIT_TOKEN) guards. Overall the changes keep the r264283-enabled code running where viable while unbreaking local file loading for other ports. * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load): 2020-07-12 Said Abou-Hallawa <sabouhallawa@apple.com> [macOS]: A HEIF image, selected from the OpenPanel, should be converted to an accepted MIME type https://bugs.webkit.org/show_bug.cgi?id=213347 <rdar://problem/57258464> Reviewed by Darin Adler. Transcode the images given the list of the selected file and the allowed MIME types. Only selected files whose MIME types do not exist in the allowed MIME types will be transcoded. Right now, this only will apply to the HEIF images on macOS. * Platform/ImageUtilities.h: Renamed from Source/WebKit/Platform/cg/CGUtilities.h. * Platform/Logging.h: * Platform/cg/CGUtilities.cpp: Removed. * Platform/cg/ImageUtilitiesCG.cpp: Added. (WebKit::transcodeImage): (WebKit::findImagesForTranscoding): (WebKit::transcodeImages): Implement a function that transcodes images among a set of files given the allowedMIMETypes. The destination MIME type of these images is the first MIME type in the allowedMIMETypes which CG supports encoding to. * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::paint): Call drawNativeImage() after renaming paintImage() to drawNativeImage(). * SourcesCocoa.txt: * UIProcess/API/C/WKOpenPanelParametersRef.cpp: (WKOpenPanelParametersCopyAllowedMIMETypes): * UIProcess/API/C/WKOpenPanelParametersRef.h: * UIProcess/API/C/WKOpenPanelResultListener.cpp: (WKOpenPanelResultListenerChooseFiles): * UIProcess/API/C/WKOpenPanelResultListener.h: Transfer the list of the allowed MIME types from the OpenPanel to the file chooser listener. * UIProcess/WebPageProxy.cpp: (WebKit::m_transcodingQueue): (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithImageTranscoding): Transcode the images in a work queue so the UI process is not blocked. Once the transcoding finishes, the message will be sent to the WebPage. (WebKit::WebPageProxy::didChooseFilesForOpenPanel): * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: 2020-07-12 Darin Adler <darin@apple.com> REGRESSION (r261152): 9 blocks of critical sandboxing code disabled because they are guarded with HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_AUDIT_TOKEN) https://bugs.webkit.org/show_bug.cgi?id=214233 Reviewed by Per Arne Vollan. * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): Remove #if HAVE. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): Ditto. (WebKit::WebPageProxy::loadRequestWithNavigationShared): Ditto. (WebKit::WebPageProxy::loadFile): Ditto. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shouldSendPendingMessage): Ditto. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load): Ditto. 2020-07-11 Darin Adler <darin@apple.com> Remove live ranges from AccessibilityObject.h, AccessibilityObjectInterface.h, AccessibilityRenderObject.h, AXIsolatedObject.h https://bugs.webkit.org/show_bug.cgi?id=214215 Reviewed by Sam Weinig. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): Use nested if for start and end so we don't do the work on end if the test fails on start. 2020-07-10 Brent Fulgham <bfulgham@apple.com> [iOS] Prompt for requestStorageAccess is inverted in WKWebView https://bugs.webkit.org/show_bug.cgi?id=214198 <rdar://problem/65369725> Reviewed by Darin Adler. The labels for "allow" and "deny" StorageAccess API were inverted in the WKWebView implementation. * UIProcess/Cocoa/WKStorageAccessAlert.mm: (WebKit::presentStorageAccessAlert): 2020-07-10 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Prevent SPI clients from making the minimum layout height or width negative https://bugs.webkit.org/show_bug.cgi?id=214199 <rdar://problem/64109242> Reviewed by Tim Horton. It's an error in the embedding client to override the minimum layout size with a negative width or height (in this case, Mail on iOS). This happens when double tapping on a contact pill in the "To:" line in Mail compose, which causes the top content inset of the web view's scroll view to increase such that Mail's logic for overriding layout width ends up passing a negative height. After a recent change (<https://trac.webkit.org/r261874>), this now results in the web view immediately scrolling to an incorrect content offset when rotating into landscape mode after double tapping a contact. Fix this by clamping the overridden layout size to a minimum of (0, 0), to prevent SPI clients from triggering subtle bugs like this in the future. Test: WebKit.OverrideMinimumLayoutSizeWithNegativeHeight * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]): 2020-07-08 Darin Adler <darin@apple.com> Remove live ranges from Document.h, AlternativeTextController.h, DictionaryLookup.h, and WebPage.h https://bugs.webkit.org/show_bug.cgi?id=214109 Reviewed by Sam Weinig. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (-[WKWebProcessPlugInBrowserContextController selectedRange]): Updated since WebPage::currentSelectionAsRange returns SimpleRange. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::performDictionaryLookupAtLocation): Updated since DictionaryLookup::rangeAtHitTestResult returns SimpleRange. (WebKit::WebPage::performDictionaryLookupForSelection): Updated since DictionaryLookup::rangeForSelection returns SimpleRange. (WebKit::WebPage::performDictionaryLookupForRange): Take SimpleRange. (WebKit::WebPage::dictionaryPopupInfoForRange): Ditto. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::currentSelectionAsRange): Return SimpleRange. * WebProcess/WebPage/WebPage.h: Use SimpleRange instead of live ranges. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::selectWithGesture): Updated since m_startingGestureRange is SimpleRange. (WebKit::WebPage::clearSelection): Ditto. (WebKit::WebPage::rangeForGranularityAtPoint): Return SimpleRange. (WebKit::WebPage::selectTextWithGranularityAtPoint): Update since rangeForGranularityAtPoint returns SimpleRange. (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary): Use SimpleRange. (WebKit::WebPage::updateSelectionWithExtentPoint): Use auto. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performImmediateActionHitTestAtLocation): Update since lookupTextAtLocation returns SimpleRange. (WebKit::WebPage::lookupTextAtLocation): Return SimpleRange. 2020-07-10 Brady Eidson <beidson@apple.com> Limit MultiGamepadProvider to Catalina and Big Sur. https://bugs.webkit.org/show_bug.cgi?id=214190 Unreviewed build fix. * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): 2020-07-10 Brent Fulgham <bfulgham@apple.com> [IPC hardening] Use MESSAGE_CHECK in WebPageProxy::setColorPickerColor() https://bugs.webkit.org/show_bug.cgi?id=214168 <rdar://problem/58632672> Reviewed by David Kilzer. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setColorPickerColor): Replace ASSERT with MESSAGE_CHECK. 2020-07-10 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Flush the cairo surface after painting when using software https://bugs.webkit.org/show_bug.cgi?id=214177 Reviewed by Adrian Perez de Castro. This is similar to bug #210636 but it happens under wayland when using GTK4. It's good idea to flush always after painting in any case, so we do ity in case of GTK3 as well. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): Call cairo_surface_flush() after drawing. (WebKit::AcceleratedBackingStoreWayland::paint): Ditto. 2020-07-10 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK4 build * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (fileChooserDialogResponseCallback): (webkitWebViewRunFileChooser): * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): 2020-07-09 Brady Eidson <beidson@apple.com> Multiplex the HID and GameController gamepad providers on Mac. <rdar://problem/63192532> and https://bugs.webkit.org/show_bug.cgi?id=214126 Reviewed by Tim Horton. * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm: (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): 2020-07-09 Tim Horton <timothy_horton@apple.com> "ESPN Fantasy Sports" does not respond to mouse events, only touch events https://bugs.webkit.org/show_bug.cgi?id=214165 <rdar://problem/64671543> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shouldUseMouseGestureRecognizer]): Add a bundle check. 2020-07-09 Brent Fulgham <bfulgham@apple.com> [macOS] Adopt the WebKit-specific PAC key and entitlements https://bugs.webkit.org/show_bug.cgi?id=214162 <rdar://problem/65099687> Reviewed by Geoffrey Garen. Add the relevant entitlements for PAC use and exceptions on macOS. This will be ignored on Intel, but will be a great thing on Apple Silicon! * Scripts/process-entitlements.sh: 2020-07-09 Per Arne Vollan <pvollan@apple.com> Move XPCEndpoint and XPCEndpointClient classes from WebCore to WebKit https://bugs.webkit.org/show_bug.cgi?id=214099 Reviewed by Alex Christensen. * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h: * Shared/Cocoa/XPCEndpoint.h: Copied from Source/WebCore/platform/cocoa/XPCEndpoint.h. * Shared/Cocoa/XPCEndpoint.mm: Copied from Source/WebCore/platform/cocoa/XPCEndpoint.mm. (WebCore::XPCEndpoint::XPCEndpoint): Deleted. (WebCore::XPCEndpoint::sendEndpointToConnection): Deleted. (WebCore::XPCEndpoint::endpoint const): Deleted. * Shared/Cocoa/XPCEndpointClient.h: Copied from Source/WebCore/platform/cocoa/XPCEndpointClient.h. (WebCore::XPCEndpointClient::~XPCEndpointClient): Deleted. * Shared/Cocoa/XPCEndpointClient.mm: Copied from Source/WebCore/platform/cocoa/XPCEndpointClient.mm. (WebCore::XPCEndpointClient::setEndpoint): Deleted. (WebCore::XPCEndpointClient::connection): Deleted. * UIProcess/Network/NetworkProcessProxyCocoa.mm: * WebKit.xcodeproj/project.pbxproj: * WebProcess/cocoa/LaunchServicesDatabaseManager.h: * WebProcess/cocoa/LaunchServicesDatabaseManager.mm: * WebProcess/cocoa/WebProcessCocoa.mm: 2020-07-09 Zalan Bujtas <zalan@apple.com> [iOS] Conversation view messages in Mail are too small and scrollable https://bugs.webkit.org/show_bug.cgi?id=214157 <rdar://problem/64788069> Reviewed by Wenson Hsieh. Revert the drive-by contentSize set optimization introduced in r262721. iOS Mail relies on this delayed/late setContentSize call on WKScrollView (see rdar://problem/65277759). * UIProcess/ios/WKScrollView.mm: (-[WKScrollView _setContentSizePreservingContentOffsetDuringRubberband:]): 2020-07-09 Lauro Moura <lmoura@igalia.com> [GTK] Remaining build fix after r264179 Like last revision, avoid "missing binary operator before(" errors when WPE libraries are not installed. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::paint): 2020-07-09 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r259840): Pressing Esc or ⌘+"." does not dismiss time picker on iOS https://bugs.webkit.org/show_bug.cgi?id=214122 <rdar://problem/64940487> Reviewed by Tim Horton. Prior to r259840, when presenting context menus for certain input types (i.e. "time" and "datetime-local") on iOS, UIKit would tell the presented view controller's view (a `UIDatePicker` in this case) to become first responder. As a result, `WKContentView` would resign first responder, which (by default) blurs the focused element and dismisses the context menu. The result is thats time pickers would immediately dismiss upon presentation. To mitigate this, r259840 adopted the existing active focus retaining mechanism to temporarily decouple WKContentView's first responder status from the currently focused form element. However, this also causes `-endEditingAndUpdateFocusAppearanceWithReason:` to bail, due to `self.webView._retainingActiveFocusedState` returning `YES`. This means that codepaths meant to immediately dismiss UI for the focused element (for example, when pressing Escape on a hardware keyboard on iOS) will not be able to dismiss UI. To fix this, push the flag that keeps track of whether we're relinquishing first responder to the focused element down into `WKContentView`, and have `WKContentView` automatically stop relinquishing first responder to the focused element in `-[WKContentView accessoryDone]`. Fixes an existing test: fast/forms/ios/dismiss-picker-using-keyboard.html * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView accessoryDone]): Stop relinquishing focus to the focused element, so that form elements that require first responder can be dismissed when triggering `-accessoryDone` (e.g. when pressing the Esc key on a hardware keyboard). (-[WKContentView startRelinquishingFirstResponderToFocusedElement]): (-[WKContentView stopRelinquishingFirstResponderToFocusedElement]): Renamed from `-preserveFocus` and `-releaseFocus`, respectively. Also, made these methods idempotent using a new `BOOL` flag, `_isRelinquishingFirstResponderToFocusedElement`. (-[WKContentView preserveFocus]): Deleted. (-[WKContentView releaseFocus]): Deleted. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker controlBeginEditing]): (-[WKDateTimePicker controlEndEditing]): Use the renamed WKContentView methods, and also remove the `_preservingFocus` flag. * UIProcess/ios/forms/WKFormPopover.mm: (-[WKRotatingPopover presentPopoverAnimated:]): (-[WKRotatingPopover dismissPopoverAnimated:]): Use the renamed WKContentView methods. 2020-07-09 Brent Fulgham <bfulgham@apple.com> [iOS] Stop telemetry collection for the 'hw.cpu64bit_capable' sysctl https://bugs.webkit.org/show_bug.cgi?id=214148 <rdar://problem/65222086> Reviewed by Per Arne Vollan. Telemetry shows that SQLite3 on iOS-based builds needs read access to the 'hw.cpu64bit_capable' sysctl. We can stop logging this. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-07-09 Lauro Moura <lmoura@igalia.com> [GTK] Buildfix when WPEBackend-fdo is not available Using the && operator for WPE_FDO_CHECK_VERSION was giving the "missing binary operator before(" error as the macro was not defined when the backend is not installed, like in the LTS/Debian vanilla bots. Unreviewed build fix. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): 2020-07-09 Per Arne Vollan <pvollan@apple.com> [Cocoa] Update Launch Services database in the WebContent process from the Network process https://bugs.webkit.org/show_bug.cgi?id=213794 Reviewed by Brent Fulgham. To be able to deny mach lookup access to the Launch Services database mapping service in the WebContent process, the database needs to be sent from the Networking process to the WebContent process, represented by an xpc object. The Networking process is chosen instead of the UI process, since WebKit is controlling the sandbox of the Networking process. There is already a direct connection between the Networking process and the WebContent process, but this is a CoreIPC connection. Since the database is represented by an xpc object, an xpc connection is requiered to transfer the database. This patch creates a direct xpc connection between the Networking process and the WebContent process, by creating an xpc endpoint in the Networking process, sending this to the UI process over the bootstrap xpc connection, and then providing each WebContent process with this endpoint by sending it over the bootstrap xpc connection between the UI process and the WebContent process. This endpoint has to be sent via the xpc connections to the UI process, since the already existing direct connection between the Networking process and the WebContent process is a lower level CoreIPC connection, which does not support transferring xpc objects like the xpc endpoint. When the WebContent process receives the endpoint, it will create an xpc connection from the endpoint, which will create a direct connection with the Networking process. A message is then sent over the connection to request the database xpc object. When the Networking process receives this message, it checks the entitlement of the remote end to make sure it is communicating with a WebContent process, and then sends the database if the entitlement check succeeds. When the WebContent process receives this message, it performs an entitlement check as well, and if successful, the database object is consumed. Consuming this database object, will make sure UTI to MIME type mapping is working correctly in the WebContent process. For the UI process to be able to pick up xpc messages on the bootstrap connection, a new virtual method, handleXPCEvent, is added to the ProcessLauncher Client class. This way, a ProcessLauncher client will be able to pick up xpc messages from the xpc bootstrap connection. Previously the event handler for the bootstrap connection in the UI process would handle only xpc error messages. It has now been expanded to handle normal messages, which are being forwarded to the ProcessLauncher client. In this case the client is the Network process proxy, which will check the message received, and if it turns out to be a message containing an xpc endpoint, the message will be forwarded to all Web processes. The ProcessLauncher client can be expanded to handle any xpc message, but right not the Network process proxy only handles the xpc endpoint message. The handleXPCEvent virtual method return a RefPtr to an XPCEventHandler, which is captured in the event handler of the bootstrap xpc connection. No new tests, since there already exist tests for this. UTI to MIME type mapping is being used in WebKit and underlying framework, and many tests would fail if this mapping was not working. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeConnection): * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h: Added. * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm: Added. (WebKit::LaunchServicesDatabaseObserver::singleton): (WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver): (WebKit::LaunchServicesDatabaseObserver::startObserving): (WebKit::LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointMessageNameKey const): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointMessageName const): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointNameKey const): (WebKit::LaunchServicesDatabaseObserver::handleEvent): * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Scripts/process-entitlements.sh: * Shared/Cocoa/LaunchServicesDatabaseXPCConstants.h: Added. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: * SourcesCocoa.txt: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::xpcEndpointMessage const): (WebKit::WebProcessPool::sendNetworkProcessXPCEndpointToWebProcess): * UIProcess/Cocoa/XPCEventHandler.h: Added. (WebKit::XPCEventHandler::~XPCEventHandler): * UIProcess/Launcher/ProcessLauncher.h: (WebKit::ProcessLauncher::Client::xpcEventHandler const): * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxyCocoa.mm: Added. (WebKit::NetworkProcessProxy::xpcEventHandler const): (WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const): (WebKit::NetworkProcessProxy::XPCEventHandler::XPCEventHandler): (WebKit::NetworkProcessProxy::XPCEventHandler::~XPCEventHandler): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didFinishLaunching): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): * WebProcess/WebProcess.h: * WebProcess/cocoa/LaunchServicesDatabaseManager.h: Added. * WebProcess/cocoa/LaunchServicesDatabaseManager.mm: Added. (WebKit::LaunchServicesDatabaseManager::singleton): (WebKit::LaunchServicesDatabaseManager::handleEvent): (WebKit::LaunchServicesDatabaseManager::didConnect): (WebKit::LaunchServicesDatabaseManager::waitForDatabaseUpdate): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::handleXPCEndpointMessages const): (WebKit::WebProcess::platformInitializeWebProcess): 2020-07-09 Eric Carlson <eric.carlson@apple.com> Reset AVSystemController_PIDToInheritApplicationStateFrom when mediaserverd dies https://bugs.webkit.org/show_bug.cgi?id=214112 <rdar://problem/65229214> Reviewed by Jer Noble. * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp: (WebKit::RemoteMediaSessionHelperProxy::providePresentingApplicationPID): Don't bother tracking whether or not providePresentingApplicationPID has been called, the session helper already does that. * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h: 2020-07-09 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Occasional crash under -[UIView _setViewDelegate:] when presenting date and time pickers https://bugs.webkit.org/show_bug.cgi?id=214120 <rdar://problem/65246918> Reviewed by Darin Adler. This crash happens when attempting to present a date picker (`<input type=date>`) immediately after dismissing it. We encounter an Objective-C exception thrown by UIKit, due to the `WKDateTimeContextMenuViewController`'s view (the `UIDatePicker`) being presented while it is still owned by the preview view controller. We often avoid this crash because the `WKDateTimeContextMenuViewController` is usually only owned by `WKDateTimePicker`, so when we set `_viewController` to a new instance of `WKDateTimeContextMenuViewController`, the old view controller is destroyed, and thus no longer owns the `UIDatePicker` view. However, it's possible for anything (e.g. animation blocks in UIKit) to cause the old view controller to live past the creation of the new view controller. If this happens, when we go and call `-setView:` on the new view controller with the date picker view, the date picker view may still be the view of the old controller, and we end up crashing. To fix this, explicitly unload the old view controller's view before attempting to create the new view controller. Test: fast/forms/ios/show-and-dismiss-date-input.html * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker contextMenuInteraction:configurationForMenuAtLocation:]): (-[WKDateTimePicker contextMenuInteraction:willDisplayMenuForConfiguration:animator:]): (-[WKDateTimePicker contextMenuInteraction:willEndForConfiguration:animator:]): Make it possible to test date and time picker presentation and dismissal by calling into the private testing- only subclassing hooks on `WKWebView` when we finish presenting and dismissing the date picker context menu. (-[WKDateTimePicker removeContextMenuInteraction]): 2020-07-09 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Add support for shm buffers in AcceleratedBackingStoreWayland when using the WPE renderer https://bugs.webkit.org/show_bug.cgi?id=214135 Reviewed by Žan Doberšek. It's available since wpe-fdo 1.7.0. This makes accelerated compositing work in platforms where EGL_WL_bind_wayland_display is not available. It can also be forced with the environment variable LIBGL_ALWAYS_SOFTWARE. * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): Use AcceleratedBackingStoreWayland::checkRequirements() instead of calling wpe_fdo_initialize_for_egl_display() again. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::tryInitializeEGL): Moved EGL specific initialization here. (WebKit::tryInitializeSHM): Added SHM initialization. (WebKit::AcceleratedBackingStoreWayland::checkRequirements): Try to initialize EGL first and then SHM if EGL failed. (WebKit::AcceleratedBackingStoreWayland::AcceleratedBackingStoreWayland): Create a EGL exportable only when using EGL implementation. (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland): Release EGL resources only when using EGL implementation. (WebKit::AcceleratedBackingStoreWayland::unrealize): Ditto. (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext): Return early when not using EGL implementation. (WebKit::AcceleratedBackingStoreWayland::update): Add implementation for the SHM case. (WebKit::AcceleratedBackingStoreWayland::displayImage): Renamed. (WebKit::AcceleratedBackingStoreWayland::displayBuffer): SHM implementation, copy the shm buffer into a cairo image surface. (WebKit::AcceleratedBackingStoreWayland::tryEnsureTexture): (WebKit::AcceleratedBackingStoreWayland::downloadTexture): (WebKit::AcceleratedBackingStoreWayland::snapshot): Handle the SHM case. (WebKit::AcceleratedBackingStoreWayland::paint): Ditto. * UIProcess/gtk/AcceleratedBackingStoreWayland.h: 2020-07-09 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r264148. https://bugs.webkit.org/show_bug.cgi?id=214136 Introduced layout test failures Reverted changeset: "[Cocoa] Update Launch Services database in the WebContent process from the Network process" https://bugs.webkit.org/show_bug.cgi?id=213794 https://trac.webkit.org/changeset/264148 2020-07-09 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Add support for HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain https://bugs.webkit.org/show_bug.cgi?id=213954 Reviewed by Michael Catanzaro. Use ExclusivelyFromMainDocumentDomain for WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY instead of OnlyFromMainDocumentDomain. * UIProcess/API/glib/WebKitCookieManager.cpp: (toWebKitCookieAcceptPolicy): (toHTTPCookieAcceptPolicy): * UIProcess/WebProcessPool.h: 2020-07-08 Per Arne Vollan <pvollan@apple.com> [Cocoa] Update Launch Services database in the WebContent process from the Network process https://bugs.webkit.org/show_bug.cgi?id=213794 Reviewed by Brent Fulgham. To be able to deny mach lookup access to the Launch Services database mapping service in the WebContent process, the database needs to be sent from the Networking process to the WebContent process, represented by an xpc object. The Networking process is chosen instead of the UI process, since WebKit is controlling the sandbox of the Networking process. There is already a direct connection between the Networking process and the WebContent process, but this is a CoreIPC connection. Since the database is represented by an xpc object, an xpc connection is requiered to transfer the database. This patch creates a direct xpc connection between the Networking process and the WebContent process, by creating an xpc endpoint in the Networking process, sending this to the UI process over the bootstrap xpc connection, and then providing each WebContent process with this endpoint by sending it over the bootstrap xpc connection between the UI process and the WebContent process. This endpoint has to be sent via the xpc connections to the UI process, since the already existing direct connection between the Networking process and the WebContent process is a lower level CoreIPC connection, which does not support transferring xpc objects like the xpc endpoint. When the WebContent process receives the endpoint, it will create an xpc connection from the endpoint, which will create a direct connection with the Networking process. A message is then sent over the connection to request the database xpc object. When the Networking process receives this message, it checks the entitlement of the remote end to make sure it is communicating with a WebContent process, and then sends the database if the entitlement check succeeds. When the WebContent process receives this message, it performs an entitlement check as well, and if successful, the database object is consumed. Consuming this database object, will make sure UTI to MIME type mapping is working correctly in the WebContent process. For the UI process to be able to pick up xpc messages on the bootstrap connection, a new virtual method, handleXPCEvent, is added to the ProcessLauncher Client class. This way, a ProcessLauncher client will be able to pick up xpc messages from the xpc bootstrap connection. Previously the event handler for the bootstrap connection in the UI process would handle only xpc error messages. It has now been expanded to handle normal messages, which are being forwarded to the ProcessLauncher client. In this case the client is the Network process proxy, which will check the message received, and if it turns out to be a message containing an xpc endpoint, the message will be forwarded to all Web processes. The ProcessLauncher client can be expanded to handle any xpc message, but right not the Network process proxy only handles the xpc endpoint message. The handleXPCEvent virtual method return a RefPtr to an XPCEventHandler, which is captured in the event handler of the bootstrap xpc connection. No new tests, since there already exist tests for this. UTI to MIME type mapping is being used in WebKit and underlying framework, and many tests would fail if this mapping was not working. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeConnection): * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h: Added. * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm: Added. (WebKit::LaunchServicesDatabaseObserver::singleton): (WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver): (WebKit::LaunchServicesDatabaseObserver::startObserving): (WebKit::LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointMessageNameKey const): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointMessageName const): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointNameKey const): (WebKit::LaunchServicesDatabaseObserver::handleEvent): * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Scripts/process-entitlements.sh: * Shared/Cocoa/LaunchServicesDatabaseXPCConstants.h: Added. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: * SourcesCocoa.txt: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::xpcEndpointMessage const): (WebKit::WebProcessPool::sendNetworkProcessXPCEndpointToWebProcess): * UIProcess/Cocoa/XPCEventHandler.h: Added. (WebKit::XPCEventHandler::~XPCEventHandler): * UIProcess/Launcher/ProcessLauncher.h: (WebKit::ProcessLauncher::Client::xpcEventHandler const): * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxyCocoa.mm: Added. (WebKit::NetworkProcessProxy::xpcEventHandler const): (WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const): (WebKit::NetworkProcessProxy::XPCEventHandler::XPCEventHandler): (WebKit::NetworkProcessProxy::XPCEventHandler::~XPCEventHandler): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didFinishLaunching): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): * WebProcess/WebProcess.h: * WebProcess/cocoa/LaunchServicesDatabaseManager.h: Added. * WebProcess/cocoa/LaunchServicesDatabaseManager.mm: Added. (WebKit::LaunchServicesDatabaseManager::singleton): (WebKit::LaunchServicesDatabaseManager::handleEvent): (WebKit::LaunchServicesDatabaseManager::didConnect): (WebKit::LaunchServicesDatabaseManager::waitForDatabaseUpdate): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::handleXPCEndpointMessages const): (WebKit::WebProcess::platformInitializeWebProcess): 2020-07-08 Brady Eidson <beidson@apple.com> Aggressively prime GameController.framework gamepad provider. https://bugs.webkit.org/show_bug.cgi?id=214094 Reviewed by Darin Adler. * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): (WebKit::WebGamepadProvider::gamepadDisconnected): (WebKit::WebGamepadProvider::gamepadActivity): 2020-07-08 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r264132 and r264139. https://bugs.webkit.org/show_bug.cgi?id=214108 Introduced assert failure. Reverted changesets: "[Cocoa] Update Launch Services database in the WebContent process from the Network process" https://bugs.webkit.org/show_bug.cgi?id=213794 https://trac.webkit.org/changeset/264132 "Unreviewed build fix attempt after r264132." https://trac.webkit.org/changeset/264139 2020-07-08 Chris Dumez <cdumez@apple.com> ASSERTION FAILURE: Completion handlers not invalidated when WebPage::~WebPage() invoked navigating to docs.google.com and signing in https://bugs.webkit.org/show_bug.cgi?id=214098 <rdar://problem/64848288> Reviewed by Geoffrey Garen. Make sure the WebPage destructor calls its "markLayersAsVolatile" CompletionHandlers before destroying them. Change is covered by new API test. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _processWillSuspendForTesting:]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::~WebPage): 2020-07-08 Per Arne Vollan <pvollan@apple.com> [Cocoa] Update Launch Services database in the WebContent process from the Network process https://bugs.webkit.org/show_bug.cgi?id=213794 Reviewed by Brent Fulgham. To be able to deny mach lookup access to the Launch Services database mapping service in the WebContent process, the database needs to be sent from the Networking process to the WebContent process, represented by an xpc object. The Networking process is chosen instead of the UI process, since WebKit is controlling the sandbox of the Networking process. There is already a direct connection between the Networking process and the WebContent process, but this is a CoreIPC connection. Since the database is represented by an xpc object, an xpc connection is requiered to transfer the database. This patch creates a direct xpc connection between the Networking process and the WebContent process, by creating an xpc endpoint in the Networking process, sending this to the UI process over the bootstrap xpc connection, and then providing each WebContent process with this endpoint by sending it over the bootstrap xpc connection between the UI process and the WebContent process. This endpoint has to be sent via the xpc connections to the UI process, since the already existing direct connection between the Networking process and the WebContent process is a lower level CoreIPC connection, which does not support transferring xpc objects like the xpc endpoint. When the WebContent process receives the endpoint, it will create an xpc connection from the endpoint, which will create a direct connection with the Networking process. A message is then sent over the connection to request the database xpc object. When the Networking process receives this message, it checks the entitlement of the remote end to make sure it is communicating with a WebContent process, and then sends the database if the entitlement check succeeds. When the WebContent process receives this message, it performs an entitlement check as well, and if successful, the database object is consumed. Consuming this database object, will make sure UTI to MIME type mapping is working correctly in the WebContent process. For the UI process to be able to pick up xpc messages on the bootstrap connection, a new virtual method, handleXPCEvent, is added to the ProcessLauncher Client class. This way, a ProcessLauncher client will be able to pick up xpc messages from the xpc bootstrap connection. Previously the event handler for the bootstrap connection in the UI process would handle only xpc error messages. It has now been expanded to handle normal messages, which are being forwarded to the ProcessLauncher client. In this case the client is the Network process proxy, which will check the message received, and if it turns out to be a message containing an xpc endpoint, the message will be forwarded to all Web processes. The ProcessLauncher client can be expanded to handle any xpc message, but right not the Network process proxy only handles the xpc endpoint message. The handleXPCEvent virtual method return a RefPtr to an XPCEventHandler, which is captured in the event handler of the bootstrap xpc connection. No new tests, since there already exist tests for this. UTI to MIME type mapping is being used in WebKit and underlying framework, and many tests would fail if this mapping was not working. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeConnection): * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.h: Added. * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm: Added. (WebKit::LaunchServicesDatabaseObserver::singleton): (WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver): (WebKit::LaunchServicesDatabaseObserver::startObserving): (WebKit::LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointMessageNameKey const): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointMessageName const): (WebKit::LaunchServicesDatabaseObserver::xpcEndpointNameKey const): (WebKit::LaunchServicesDatabaseObserver::handleEvent): * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Scripts/process-entitlements.sh: * Shared/Cocoa/LaunchServicesDatabaseXPCConstants.h: Added. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: * SourcesCocoa.txt: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::xpcEndpointMessage const): (WebKit::WebProcessPool::sendNetworkProcessXPCEndpointToWebProcess): * UIProcess/Cocoa/XPCEventHandler.h: Added. (WebKit::XPCEventHandler::~XPCEventHandler): * UIProcess/Launcher/ProcessLauncher.h: (WebKit::ProcessLauncher::Client::xpcEventHandler const): * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxyCocoa.mm: Added. (WebKit::NetworkProcessProxy::xpcEventHandler const): (WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const): (WebKit::NetworkProcessProxy::XPCEventHandler::XPCEventHandler): (WebKit::NetworkProcessProxy::XPCEventHandler::~XPCEventHandler): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didFinishLaunching): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): * WebProcess/WebProcess.h: * WebProcess/cocoa/LaunchServicesDatabaseManager.h: Added. * WebProcess/cocoa/LaunchServicesDatabaseManager.mm: Added. (WebKit::LaunchServicesDatabaseManager::singleton): (WebKit::LaunchServicesDatabaseManager::handleEvent): (WebKit::LaunchServicesDatabaseManager::didConnect): (WebKit::LaunchServicesDatabaseManager::waitForDatabaseUpdate): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::handleXPCEndpointMessages const): (WebKit::WebProcess::platformInitializeWebProcess): 2020-07-08 Brent Fulgham <bfulgham@apple.com> [macOS] Silence spam reports about deprecated logging system https://bugs.webkit.org/show_bug.cgi?id=214090 <rdar://problem/63943836> Reviewed by Per Arne Vollan. Change the default 'block' behavior for 'com.apple.system.logger' to block "with no-report" so that we don't spend time generating backtraces when non-WebKit code attempts to use this deprecated logging system. * WebProcess/com.apple.WebProcess.sb.in: 2020-07-08 Sihui Liu <sihui_liu@appe.com> Network process crashes in WebKit::WebIDBServer::removeConnection https://bugs.webkit.org/show_bug.cgi?id=214071 <rdar://problem/64853929> Reviewed by Chris Dumez. In network process, WebIDBServer may be removed and destroyed before web process using the same session disconnects. Then a new WebIDBServer can be added before disconnection of web process and the new WebIDBServer does not have information about the web process connection. To solve this issue, now we only remove WebIDBServer when session is destroyed and there is no web process connection of that session. * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::removeWebIDBServerIfPossible): (WebKit::NetworkProcess::connectionToWebProcessClosed): * NetworkProcess/NetworkProcess.h: 2020-07-08 Andy Estes <aestes@apple.com> REGRESSION (r207558): [Mac] Context clicks on links sometimes result in navigations https://bugs.webkit.org/show_bug.cgi?id=213793 <rdar://problem/64294015> Reviewed by Tim Horton. WebPageProxy::showContextMenu was written with the assumption that WebContextMenuProxy::show would present a context menu and spin a nested run loop, blocking until the menu dismisses. Once WebContextMenuProxy::show returns, showContextMenu would send the WebPage::ContextMenuHidden message, telling the WebContent process that it's OK to resume processing mouse events. This assumption was invalidated in r207558 (and again in several subsequent changes), which added asynchronous APIs to WKPageContextMenuClient. If the context menu client provides context menu items asynchronously, WebContextMenuProxy::show would return -- and the WebContent process would resume processing mouse events -- before the context menu was even presented. Since context menu presentation is triggered by a mouse press event, it's possible that the corresponding mouse release event would be delivered after getContextMenuFromProposedMenuAsync was dispatched but before the client responded with menu items to present. If this happened, since mouse event processing was not disabled, the WebContent process would dispatch a DOM click event to the page, possibly triggering a navigation. Fix this by teaching WebPageProxy to defer sending WebPage::ContextMenuHidden until the context menu has been dismissed, even in cases where the context menu client provides menu items asynchronously. Also, take the opportunity to modernize WebContextMenuProxy and its subclasses by, e.g., moving duplicated subclass code into the base class, using the client pattern, and using WeakPtrs instead of raw pointers/references. New API tests: ContextMenuMouseEvents.* * UIProcess/API/APIContextMenuClient.h: (API::ContextMenuClient::showContextMenu): (API::ContextMenuClient::canShowContextMenu const): * UIProcess/API/C/WKPage.cpp: (WKPageSetPageContextMenuClient): Added canShowContextMenu to determine whether the client can show a context menu without actually showing it. * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::createContextMenuProxy): Passed page to WebContextMenuProxyWPE::create. * UIProcess/WebContextMenuListenerProxy.cpp: (WebKit::WebContextMenuListenerProxy::WebContextMenuListenerProxy): (WebKit::WebContextMenuListenerProxy::useContextMenuItems): (WebKit::WebContextMenuListenerProxy::invalidate): Deleted. Not needed now that m_client is a WeakPtr. * UIProcess/WebContextMenuListenerProxy.h: (WebKit::WebContextMenuListenerProxy::create): Rather than store a raw pointer to a WebContextMenuProxy, store a WeakPtr to a WebContextMenuListenerProxy::Client (which WebContextMenuProxy implements). * UIProcess/WebContextMenuProxy.cpp: (WebKit::WebContextMenuProxy::WebContextMenuProxy): Stored a WeakPtr to a WebPageProxy rather than storing a raw pointer to the same in each subclass. (WebKit::WebContextMenuProxy::proposedItems const): Added a virtual function to create proposed WebContextMenuItems from m_context's menu items. WebContextMenuProxyGtk overrides this to do something slightly different. (WebKit::WebContextMenuProxy::show): Added a base class implementation that creates a WebContextMenuListenerProxy and calls ContextMenuClient::getContextMenuFromProposedMenu. (WebKit::WebContextMenuProxy::useContextMenuItems): Added a base class implementation that performs the work previously done in WebPageProxy::showContextMenu. Calls showContextMenuWithItems, which now always synchronously presents the menu. * UIProcess/WebContextMenuProxy.h: Inherited from WebContextMenuListenerProxy::Client. (WebKit::WebContextMenuProxy::page const): Added for use by WKSharingServicePickerDelegate. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContextMenu): Moved code that assumes synchronous menu presentation to WebContextMenuProxy::useContextMenuItems. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::proposedItems const): Implemented GTK's special version that excludes ContextMenuItemTagShareMenu. (WebKit::WebContextMenuProxyGtk::show): Deleted. WebContextMenuProxy::show handles this now. (WebKit::WebContextMenuProxyGtk::append): (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems): (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk): * UIProcess/gtk/WebContextMenuProxyGtk.h: Moved m_page to WebContextMenuProxy. * UIProcess/mac/WKSharingServicePickerDelegate.mm: (-[WKSharingServicePickerDelegate sharingService:didShareItems:]): Changed now that WebContextMenuProxy::page returns a pointer. * UIProcess/mac/WebContextMenuProxyMac.h: (WebKit::WebContextMenuProxyMac::page const): Deleted. * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac): (WebKit::WebContextMenuProxyMac::~WebContextMenuProxyMac): No need to invalidate m_contextMenuListener now that it stores a WeakPtr to its WebContextMenuProxy. (WebKit::WebContextMenuProxyMac::contextMenuItemSelected): (WebKit::WebContextMenuProxyMac::showServicesMenu): (WebKit::WebContextMenuProxyMac::show): (WebKit::WebContextMenuProxyMac::showContextMenuWithItems): Overrode to handle service menus. (WebKit::WebContextMenuProxyMac::useContextMenuItems): Overrode to get the standard Mac menu items and dispatch ContextMenuClient::menuFromProposedMenu before showing the menu. (WebKit::WebContextMenuProxyMac::showContextMenu): Deleted. WebContextMenuProxy::show now handles this. * UIProcess/win/WebContextMenuProxyWin.cpp: (WebKit::WebContextMenuProxyWin::showContextMenuWithItems): (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin): (WebKit::WebContextMenuProxyWin::show): Deleted. WebContextMenuProxy::show now handles this. * UIProcess/win/WebContextMenuProxyWin.h: * UIProcess/wpe/WebContextMenuProxyWPE.h: Passed page to the WebContextMenuProxy ctor. 2020-07-08 Wenson Hsieh <wenson_hsieh@apple.com> autocapitalize="words" capitalizes every word's second character https://bugs.webkit.org/show_bug.cgi?id=148504 <rdar://problem/57814304> Reviewed by Tim Horton. This bug resurfaced in iOS 13 due to timing changes that caused a task added to UIKeyboardTaskQueue to no longer get dequeued after the next editor state update is received in the UI process; as a result, UIKit asks us for the context before the caret selection (i.e. `characterBeforeSelection`) before we have a chance to update it, which means that UIKeyboardImpl's autoshift state will always be off by one character whie typing. Note that solely deferring this update until after the next editor state update is received is insufficient to fix this bug, since the keyboard's shift state will still be incorrect when typing characters very quickly (or if the web process is unresponsive). Instead, completely address this bug by adding a mechanism for WKContentView to cache the last character in the string that is currently being inserted using `-insertText:`, and return it in `-_characterBeforeCaretSelection` until the next editor state update comes in with the real character before the selection. This way, we're able to respond to UIKit's requests immediately with a (reasonable) guess of what the character before the selection should be, and then follow it up with the actual up-to-date value from the web process during the next editor state update (invalidating the stale shift state if necessary). This cached last character should only be incorrect in the case where the page uses script to influence what was typed, or the typed character was never inserted at all (e.g. typing a newline character in a single line input element). Test: fast/forms/ios/autocapitalize-words.html * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _characterBeforeCaretSelection]): Use `_lastInsertedCharacterToOverrideCharacterBeforeSelection`, if it is set. (-[WKContentView _characterInRelationToCaretSelection:]): (-[WKContentView insertText:]): Update `_lastInsertedCharacterToOverrideCharacterBeforeSelection` and ensure an editor state update immediately after text is inserted, if we're currently editing an element with `autocapitalize="words"`. The editor state update could be unnecessarily expensive, so we don't want to do this unconditionally. Also, `autocapitalize="words"` is special in the sense that it is the only autocapitalization type where the platform (UIKit) will ask for the last character immediately and use it to unshift the keyboard. Even in the case of `autocapitalize="sentences"`, UIKit makes the decision to unshift using information from `kbd` instead. (-[WKContentView _elementDidBlur]): (-[WKContentView _selectionChanged]): Clear out `_lastInsertedCharacterToOverrideCharacterBeforeSelection` when the next editor state update is received, and invalidate the current keyboard shift state by calling `-clearShiftState`. This SPI method automatically schedules a shift state update, as well. Note the extra `_usingGestureForSelection` check here, which prevents the keyboard from autoshifting and unshifting while changing the selection via loupe gesture. 2020-07-07 Antoine Quint <graouts@webkit.org> [iOS] Sharing an <img> element with a base64-encoded URL shares the URL as raw text instead of an image https://bugs.webkit.org/show_bug.cgi?id=214042 <rdar://problem/56669102> Reviewed by Wenson Hsieh. In the case where the <img> element that was the target when the share sheet was brought has its data encoded as a base64 URL, we need to share the UIImage that was created as its snapshot as a file rather than the URL to avoid a base64 string to be shared instead of the image data. To support testing of this, we add a new optional WKShareSheet delegate to indicate that the share sheet will show and the provided activity items, which we forward to a new optional WKUIDelegatePrivate delegate method. API tests can thus be written to check the data provided to the share sheet. * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/WKShareSheet.h: * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithShareDataArray:inRect:]): * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shareSheet:willShowActivityItems:]): (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]): (-[WKContentView actionSheetAssistant:shareElementWithImage:rect:]): 2020-07-08 Philippe Normand <pnormand@igalia.com> [WPE][Qt] Deprecation warnings https://bugs.webkit.org/show_bug.cgi?id=214074 Reviewed by Carlos Garcia Campos. * UIProcess/API/wpe/qt/WPEQtView.cpp: (WPEQtView::updatePaintNode): Switch to new createTextureFromNativeObject API when building against Qt 5.15. * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp: (WPEQtViewBackend::dispatchWheelEvent): Switch to new WPE axis 2D event API. 2020-07-08 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Update OptionsGTK.cmake and NEWS for 2.29.3 release * gtk/NEWS: Add release notes for 2.29.3. 2020-07-07 Alex Christensen <achristensen@webkit.org> Modernize FindOptions IPC code https://bugs.webkit.org/show_bug.cgi?id=214063 Reviewed by Chris Dumez. Use callWithAsyncReply instead of GenericCallback. Use OptionSet<FindOptions> instead of FindOptions or uint32_t. No change in behavior. * Shared/API/c/WKSharedAPICast.h: (WebKit::toFindOptions): * Shared/WebFindOptions.h: (): Deleted. * UIProcess/API/Cocoa/WKWebView.mm: (toFindOptions): (-[WKWebView findString:withConfiguration:completionHandler:]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::findStringMatches): (WebKit::WebPageProxy::findString): (WebKit::WebPageProxy::countStringMatches): (WebKit::WebPageProxy::findStringCallback): Deleted. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::findString): * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/FindController.cpp: (WebKit::core): (WebKit::FindController::countStringMatches): (WebKit::FindController::updateFindUIAfterPageScroll): (WebKit::FindController::findString): (WebKit::FindController::findStringMatches): * WebProcess/WebPage/FindController.h: * WebProcess/WebPage/WebPage.messages.in: 2020-07-07 Sam Weinig <weinig@apple.com> Part 2 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them https://bugs.webkit.org/show_bug.cgi?id=213981 Reviewed by Darin Adler. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::paintSnapshotAtSize): * WebProcess/WebPage/ios/FindControllerIOS.mm: Make calls to makeSimpleColor more consistent. Use decimal rather than hex, don't pass unncessary 255 as the 4th argument. 2020-07-07 Alex Christensen <achristensen@webkit.org> Use sendWithAsyncReply instead of EditingRangeCallback https://bugs.webkit.org/show_bug.cgi?id=214056 Reviewed by Chris Dumez. No change in behavior. * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter initWithWebView:frameHandle:urlString:]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::selectedRangeWithCompletionHandler): (WebKit::WebViewImpl::markedRangeWithCompletionHandler): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::getMarkedRangeAsync): (WebKit::WebPageProxy::getSelectedRangeAsync): (WebKit::WebPageProxy::editingRangeCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-07-07 Brent Fulgham <bfulgham@apple.com> [macOS] Allow additional IOKit classes for Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=214021 Reviewed by Sam Weinig. <rdar://problem/63696732> Update two of the arm64-specific sandbox rules to include additional IOKit classes (and one IOKit property). * WebProcess/com.apple.WebProcess.sb.in: 2020-07-07 Sihui Liu <sihui_liu@appe.com> Network process crashes in WebKit::StorageManagerSet::deleteSessionStorageForOrigins https://bugs.webkit.org/show_bug.cgi?id=214050 Reviewed by Chris Dumez. In NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains, deleteSessionStorageForOrigins is called in a callback without checking if session still exists. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): 2020-07-07 Chris Dumez <cdumez@apple.com> WebContent process sometimes kills itself because it is receiving too much IPC from the UIProcess https://bugs.webkit.org/show_bug.cgi?id=214048 <rdar://problem/64844770> Reviewed by Darin Adler. There was logic in IPC::Connection::enqueueIncomingMessage() that would kill the XPC connection if too many IPC messages had been queued without the main thread processing them. The intention was to protect the UIProcess again a badly behavior WebProcess sending too much IPC and it would in effect terminate that WebProcess. However, the logic would actually apply too ALL IPC connections. In <rdar://problem/64844770>, we see that the WebProcess is stuck on a sync IPC and thus not processing other incoming IPCs. The UIProcess is sending it a lot of IPC so the WebProcess decides to kill its IPC connection, thus terminating itself, which does not make much sense. To address the issue, we now enable to killing on too much IPC behavior only if IPC message throttling is enabled for the IPC connection, which means it only impacts the UIProcess connections to its WebProcesses. * Platform/IPC/Connection.cpp: (IPC::Connection::enableIncomingMessagesThrottling): (IPC::Connection::enqueueIncomingMessage): * Platform/IPC/Connection.h: (IPC::Connection::isIncomingMessagesThrottlingEnabled const): 2020-07-07 Simon Fraser <simon.fraser@apple.com> Unable to scroll elcomerico.pe page until the page finishes loading https://bugs.webkit.org/show_bug.cgi?id=214027 <rdar://problem/64646259> Reviewed by Antti Koivisto. The same issue with non-invertible transforms existed on iOS. r248015 attempted to fix some instances of this, but failed to take into account the fact that a non-invertible transfrom should also prevent hit-testing of descendant views. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::collectDescendantViewsAtPoint): 2020-07-07 Alex Christensen <achristensen@webkit.org> Add WebCoreNSURLSession SPI to send HTTP/2 ping https://bugs.webkit.org/show_bug.cgi?id=214030 <rdar://problem/64495827> Reviewed by Jer Noble. The SPI to do this through CFNetwork requires setting a block on the task between construction and resumption. To allow this, I made PreconnectTask and NetworkLoad require a start() call, and I added start() calls everywhere they were implied with construction before. * NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::PendingDownload): * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::sendH2Ping): (WebKit::NetworkConnectionToWebProcess::preconnectTo): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::setH2PingCallback): * NetworkProcess/NetworkDataTask.h: * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::NetworkLoad): (WebKit::NetworkLoad::start): (WebKit::NetworkLoad::setH2PingCallback): (WebKit::NetworkLoad::initialize): Deleted. * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::startNetworkLoad): * NetworkProcess/PreconnectTask.cpp: (WebKit::PreconnectTask::setH2PingCallback): (WebKit::PreconnectTask::start): (WebKit::PreconnectTask::~PreconnectTask): Deleted. * NetworkProcess/PreconnectTask.h: * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp: (WebKit::ServiceWorkerSoftUpdateLoader::loadFromNetwork): * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp: (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad): * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::SpeculativeLoadManager::preconnectForSubresource): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::setH2PingCallback): * Shared/WebErrors.cpp: (WebKit::internalError): Deleted. * Shared/WebErrors.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::generateLoadIdentifier): (WebKit::WebLoaderStrategy::startPingLoad): (WebKit::WebLoaderStrategy::preconnectTo): (WebKit::generateLoadIdentifier): Deleted. * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::sendH2Ping): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-07-07 Brady Eidson <beidson@apple.com> Forward declare WKContentWorld in WKUserScript.h <rdar://problem/65164826> and https://bugs.webkit.org/show_bug.cgi?id=214046 Unreviewed. * UIProcess/API/Cocoa/WKUserScript.h: 2020-07-07 Brady Eidson <beidson@apple.com> Fix CrashTracer reported in PDFPlugin::ByteRangeRequest::maybeComplete. <rdar://problem/64884982> and https://bugs.webkit.org/show_bug.cgi?id=214026 Reviewed by Tim Horton. No new tests (CrashTracer with no reproduction) Due to the racy-ness of how PDFKit calls us on the background thread vs. what might be happening with the main thread, sometimes the main thread is asked to handle a data request either: - Before m_data is allocated or - After it is deallocated In either case it's okay to just not handle it. Despite understanding how to reproduce in theory, writing a test case has been elusive. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::ByteRangeRequest::maybeComplete): Null check m_data before doing anything with it. 2020-07-07 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r262680): [GTK] Crash in WebKit::DropTarget::didPerformAction https://bugs.webkit.org/show_bug.cgi?id=213885 Reviewed by Michael Catanzaro. Just compare if new operation is the same as the current one, the == operator of Optional already takes care of values being nullopt. * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::didPerformAction): * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::didPerformAction): 2020-07-07 Tomoki Imai <Tomoki.Imai@sony.com> [Win] Implement Pasteboard::writeCustomData for Web Inspector Console tab https://bugs.webkit.org/show_bug.cgi?id=213986 Reviewed by Fujii Hironori. * Shared/WebPreferencesDefaultValues.h: Turn DEFAULT_CUSTOM_PASTEBOARD_DATA_ENABLED on for Windows 2020-07-06 Simon Fraser <simon.fraser@apple.com> High CPU usage on Stash search results pages https://bugs.webkit.org/show_bug.cgi?id=214018 <rdar://problem/64832917> Reviewed by Tim Horton. Stash search results pages can contain a lot of overflow:scroll areas, so scrolling thread CA commits would take a long time because ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters() would open and close a CA commit for each scroller. Fix by not explicitly starting a CA commit, and only entering this code if a gesture is active and in the momentum phase. Also sprinkle BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS in more places that call into Core Animation. * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers): 2020-07-06 Simon Fraser <simon.fraser@apple.com> BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS should not have trailing semicolons https://bugs.webkit.org/show_bug.cgi?id=214019 Reviewed by Tim Horton. These macros are defined as: #define BEGIN_BLOCK_OBJC_EXCEPTIONS @try { #define END_BLOCK_OBJC_EXCEPTIONS } @catch(NSException *localException) { ReportBlockedObjCException(localException); } so they should not be used with trailing semicolons. * Shared/Cocoa/ArgumentCodersCocoa.mm: (IPC::decodeFontInternal): * Shared/Cocoa/CoreTextHelpers.mm: (WebKit::fontWithAttributes): * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: (WebKit::RemoteLayerTreePropertyApplier::applyProperties): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::updateFontManagerIfNeeded): * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: (-[WKScrollbarPartAnimation invalidate]): (-[WKScrollerImpDelegate cancelAnimations]): (-[WKScrollerImpDelegate invalidate]): (WebKit::ScrollerMac::updateValues): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView assignLegacyDataForContextMenuInteraction]): (-[WKContentView continueContextMenuInteractionWithDataDetectors:]): * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::showPopupMenu): * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::PlatformCAAnimationRemote::updateLayerAnimations): 2020-07-06 Brady Eidson <beidson@apple.com> Get rid of concept of "initial connected gamepads" https://bugs.webkit.org/show_bug.cgi?id=214010 Reviewed by Tim Horton. * Scripts/webkit/messages.py: * UIProcess/Gamepad/UIGamepadProvider.cpp: (WebKit::UIGamepadProvider::gamepadSyncTimerFired): (WebKit::UIGamepadProvider::platformGamepadConnected): (WebKit::UIGamepadProvider::platformGamepadInputActivity): (WebKit::UIGamepadProvider::setInitialConnectedGamepads): Deleted. * UIProcess/Gamepad/UIGamepadProvider.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::gamepadActivity): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gamepadConnected): (WebKit::WebProcessPool::setInitialConnectedGamepads): Deleted. * UIProcess/WebProcessPool.h: * WebProcess/Gamepad/WebGamepadProvider.cpp: (WebKit::WebGamepadProvider::gamepadConnected): (WebKit::WebGamepadProvider::gamepadActivity): * WebProcess/Gamepad/WebGamepadProvider.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::gamepadActivity): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::gamepadConnected): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-07-06 Chris Dumez <cdumez@apple.com> Regression(r249303) Crash under NetworkLoad::NetworkLoad() https://bugs.webkit.org/show_bug.cgi?id=214008 <rdar://problem/64853936> Reviewed by Alex Christensen. * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp: (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad): Do some hardening and fail the SpeculativeLoad if the network session is null, instead of dereferencing the network session unconditionally. The NetworkCache owns the NetworkCacheSpeculativeLoadManager and the NetworkCache is RefCounted so it may outlive its NetworkSession in theory and schedule speculative loads for a session that was just destroyed. * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad): (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry): * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h: Capture weakThis in a few lambda and check it when the lambda gets called. It looked unsafe so I decided to do some hardening. 2020-07-06 Peng Liu <peng.liu6@apple.com> REGRESSION (r261001): ASSERTION FAILED: m_clientCounts.contains(contextId) in WebKit::VideoFullscreenManagerProxy::removeClientForContext https://bugs.webkit.org/show_bug.cgi?id=212986 Reviewed by Jer Noble. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::removeClientForContext): Function removeClientForContext() could be called multiple times with the same contextId. We should bail out if m_clientCounts does not contain the contextId. 2020-07-06 Kate Cheney <katherine_cheney@apple.com> update-webkit-localizable-strings exits without writing localized strings because of an R"" string https://bugs.webkit.org/show_bug.cgi?id=213274 <rdar://problem/64427891> Reviewed by Darin Adler. Remove R"" string, use adjacent string literals instead. No new tests, functionality tested by existing tests, specifically (http/tests/resourceLoadStatistics/telemetry-generation-basic-functionality-database.html and http/tests/resourceLoadStatistics/telemetry-generation-advanced-functionality-database.html). * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::joinSubStatisticsForSorting): (WebKit::CompletionHandler<void): Deleted. 2020-07-06 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Unable to change focus between Google Docs windows by tapping https://bugs.webkit.org/show_bug.cgi?id=213985 <rdar://problem/57083267> Reviewed by Darin Adler. When putting two Google Docs windows side-by-side on iPad, it's currently not possible to change the window to which keyboard input is routed. In native views (e.g. two side-by-side Notes windows), this is normally handled by `UITextMultiTapRecognizer`, which is part of the `UITextSelectionInteraction`; tapping to place the text selection calls into `-[UITextInteractionAssistant setFirstResponderIfNecessaryActivatingSelection:]`, which updates the key window if needed. This doesn't apply to Google Docs because they instead use touch events to drive their own "text interaction"-like behaviors instead of relying on system gesture recognizers, which we suppress due to the fact that the selection is within a hidden contenteditable. But even in non-hidden editable areas, the initial tap to focus an editable element still doesn't automatically make the window key, since the editable text interaction gestures are still inactive when tapping to focus an editable element. This means two taps are currently required to change the key window when focusing two Safari windows side-by-side: the first tap to focus the element (via the synthetic click gesture), and the second tap to trigger the editable text interaction tap gesture that is used to set the selection. To fix both of these issues, make some minor adjustments to call `-makeKeyWindow` from WebKit when focusing editable elements. See below for more details. Test: editing/selection/ios/become-key-window-when-focusing-editable-area.html * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _webTouchEventsRecognized:]): For the case in Google Docs where a hidden editable element is used and tapping in the page does not result in the element being refocused, we additionally need to make sure that we make our window key anyways. Limit this hack to tap gestures, and only when there is a hidden focused editable element to emulate platform behavior of updating the key window based on the text tap gesture. (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): Make the content view's window key when focusing an editable element. (-[WKContentView hasHiddenContentEditable]): Consider the selection to be inside a hidden editable area if the `WebKit::FocusedElementIsTooSmall` flag is set as well. While this doesn't affect Google Docs, it does affect some other custom editors, such as Quip. (-[WKContentView mouseGestureRecognizerChanged:]): Additionally make the current window key when clicking in a hidden editable area with a trackpad on iOS. 2020-07-06 Sam Weinig <weinig@apple.com> Compile-time enable (but leave disabled at runtime by default) date/time input types on macOS to allow testing of cross platform (e.g. DOM) aspects of the controls https://bugs.webkit.org/show_bug.cgi?id=213949 Reviewed by Darin Adler. * Shared/FocusedElementInformation.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKFocusedElementInfo initWithFocusedElementInformation:isUserInitiated:userObject:]): (-[WKContentView requiresAccessoryView]): (-[WKContentView textInputTraits]): (mayContainSelectableText): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): Remove DateTime from the InputType enum. This should have been removed when datetime was removed. * Shared/WebPreferences.yaml: Add preferences for all the date/time related input types, and have them automatically link up with the newly added WebCore Settings of the same names (this is the default behavior if no explicit webcoreBinding: is provided). * Shared/WebPreferencesDefaultValues.h: Disable date/time input elements by default for non iOS/watchOS cocoa platforms. For non-Cocoa platforms (and iOS/watchOS), they are enabled by default, but only actually get enabled if the appropriate ENABLE_* macro is also set. 2020-07-06 Haelwenn (lanodan) Monnier <contact@hacktivis.me> BubblewrapLauncher.cpp: Add paths required for sndio https://bugs.webkit.org/show_bug.cgi?id=212524 Information about the paths currently ins't into the sndio documentation but it can be found in this email: http://www.sndio.org/arch/0077.html Reviewed by Adrian Perez de Castro. Manually tested, there is currently no automatic tests for it * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bindSndio): (WebKit::bubblewrapSpawn): 2020-07-06 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Change the cookies accept policy when ITP is enabled https://bugs.webkit.org/show_bug.cgi?id=213502 Reviewed by Michael Catanzaro. * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp: (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Use NetworkStorageSession::setCookieAcceptPolicy(). * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::setCookiePersistentStorage): Do not change the accept policy, it's now done by NetworkStorageSession when the new cookie jar is set. * UIProcess/API/glib/WebKitCookieManager.cpp: Update API docs. * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: Ditto. 2020-07-05 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r263960. https://bugs.webkit.org/show_bug.cgi?id=213980 Re-land, because r263959 somehow fixed the build issue caused by r263953 Reverted changeset: "Unreviewed, reverting r263953 and r263959." https://bugs.webkit.org/show_bug.cgi?id=213979 https://trac.webkit.org/changeset/263960 2020-07-05 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r263953 and r263959. https://bugs.webkit.org/show_bug.cgi?id=213979 Broke internal build Reverted changesets: "[Cocoa] Move almost all features from FeatureDefines.xcconfig to PlatformEnableCocoa.h" https://bugs.webkit.org/show_bug.cgi?id=212542 https://trac.webkit.org/changeset/263953 "[Cocoa] Remove FEATURE_DEFINES from the Cocoa/Xcode build system" https://bugs.webkit.org/show_bug.cgi?id=213976 https://trac.webkit.org/changeset/263959 2020-07-05 Darin Adler <darin@apple.com> [Cocoa] Remove FEATURE_DEFINES from the Cocoa/Xcode build system https://bugs.webkit.org/show_bug.cgi?id=213976 Reviewed by Sam Weinig. * Configurations/BaseTarget.xcconfig: Removed FEATURE_DEFINES, and added WK_ENABLE_EXPERIMENTAL_FEATURES, * Configurations/FeatureDefines.xcconfig: Removed everything except for ENABLE_WEB_RTC. 2020-07-05 Darin Adler <darin@apple.com> [Cocoa] Move almost all features from FeatureDefines.xcconfig to PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212542 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Delete everything except ENABLE_EXPERIMENTAL_FEATURES and ENABLE_WEBRTC. * Configurations/WebKit.xcconfig: Added include of WebKitTargetConditionals.xcconfig. 2020-07-05 Said Abou-Hallawa <sabouhallawa@apple.com> [macOS] Allow selecting HEIF images if the 'accept' attribute includes an image MIME type that the platform can transcode the HEIF to https://bugs.webkit.org/show_bug.cgi?id=212489 Reviewed by Darin Adler. Make WKOpenPanelParameters call allowedFileExtensions() and allowedMIMETypes() of MIMETypeRegistry via OpenPanelParameters. UIDelegate will get allowedMIMETypes() and pass it to WebOpenPanelResultListenerProxy which will pass it to WebPageProxy. In a following patch, WebPageProxy will use allowedMIMETypes to transcode the selected images before sending them to WebPage. * UIProcess/API/APIOpenPanelParameters.cpp: (API::OpenPanelParameters::allowedMIMETypes const): (API::OpenPanelParameters::allowedFileExtensions const): (API::OpenPanelParameters::mediaCaptureType const): Deleted. * UIProcess/API/APIOpenPanelParameters.h: (API::OpenPanelParameters::mediaCaptureType const): * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: (-[WKOpenPanelParameters _allowedFileExtensions]): (-[WKOpenPanelParameters _allowedFileExtensionsTitles]): Deleted. * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::runOpenPanel): * UIProcess/WebOpenPanelResultListenerProxy.cpp: (WebKit::WebOpenPanelResultListenerProxy::chooseFiles): * UIProcess/WebOpenPanelResultListenerProxy.h: (WebKit::WebOpenPanelResultListenerProxy::chooseFiles): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChooseFilesForOpenPanel): * UIProcess/WebPageProxy.h: 2020-07-04 Darin Adler <darin@apple.com> [Cocoa] Remove all features from FeatureDefines.xcconfig that are already mentioned in PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=213962 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Removed all features that were mentioned in PlatformEnableCocoa.h; the rules in that file now define whether they are enabled. 2020-07-04 Darin Adler <darin@apple.com> [Cocoa] Remove unconditional features from FeatureDefines.xcconfig, making sure they are covered in PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Removed features that are either unconditionally not enabled, or unconditionally enabled. Double checked that all the enabled ones are either in PlatformEnable.h or PlatformEnableCocoa.h. 2020-07-04 Sam Weinig <weinig@apple.com> Part 1 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them https://bugs.webkit.org/show_bug.cgi?id=213948 Reviewed by Darin Adler. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorFillFromWebCoreColor): * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::beginSwipeGesture): * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::animationValueFromKeyframeValue): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::getDocumentBackgroundColor): Adapt to use templatized toSRGBALossy<float/uint8_t>. 2020-07-03 Darin Adler <darin@apple.com> Make generate-unified-sources.sh not depend on features being listed in FEATURE_DEFINES environment variable https://bugs.webkit.org/show_bug.cgi?id=212420 Reviewed by Don Olmstead. * Scripts/generate-unified-sources.sh: Removed --feature-flags from the arguments passed to generate-unified-source-bundles.rb. Also removed many unneeded quotes. 2020-07-04 Darin Adler <darin@apple.com> Update comment in FeatureDefines.xcconfig since PlatformEnableCocoa.h should be used instead https://bugs.webkit.org/show_bug.cgi?id=213952 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: Updated comment. 2020-07-04 Youenn Fablet <youenn@apple.com> Enable VTB required low latency code path https://bugs.webkit.org/show_bug.cgi?id=210609 <rdar://problem/61890332> Reviewed by Darin Adler. Add a runtime flag to enable/disable the low latency code path. * Shared/WebPreferences.yaml: 2020-07-03 Youenn Fablet <youenn@apple.com> MediaRecorder should support peer connection remote video tracks https://bugs.webkit.org/show_bug.cgi?id=213924 Reviewed by Darin Adler. Pass a boolean instead of width/height for the video track. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::create): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::createRecorder): * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-07-03 Sam Weinig <weinig@apple.com> Remove support for ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE https://bugs.webkit.org/show_bug.cgi?id=213932 Reviewed by Darin Adler. Removes support for non-standard <input type="datetime">, currently being guarded by the macro ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE. This macro, was added back in 2013 as a temporary measure to support some engines who shipped support for <input type="datetime">. It is currently not enabled for any ports so now seems like as good a time as any to remove it. * Configurations/FeatureDefines.xcconfig: 2020-07-03 Sam Weinig <weinig@apple.com> Add "-Wliteral-conversion" warning to Xcode based builds and fix the issues it finds https://bugs.webkit.org/show_bug.cgi?id=213931 Reviewed by Darin Adler. * Configurations/Base.xcconfig: Add -Wliteral-conversion. 2020-07-03 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r263882. https://bugs.webkit.org/show_bug.cgi?id=213933 Broke the build Reverted changeset: "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory" https://bugs.webkit.org/show_bug.cgi?id=213048 https://trac.webkit.org/changeset/263882 2020-07-03 Michael Catanzaro <mcatanzaro@gnome.org> [WPE][GTK] Bubblewrap sandbox should not attempt to bind empty paths https://bugs.webkit.org/show_bug.cgi?id=202880 Reviewed by Carlos Garcia Campos. If an empty path is set in LD_LIBRARY_PATH (e.g. /foo::/bar), we wind up passing --ro-bind-try --ro-bind-try to bwrap, where the second --ro-bind-try is treated as the source path to mount, and the next flag we pass gets treated as the destination path. The web process crashes with this confusing error: bwrap: Can't create file at /.flatpak-info: Read-only file system * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bindIfExists): 2020-07-03 Youenn Fablet <youenn@apple.com> Allow registering VP9 as a VT decoder https://bugs.webkit.org/show_bug.cgi?id=213837 <rdar://problem/64984881> Reviewed by Jer Noble. Add a runtime flag to enable registration of VP9 as a VT decoder. Register conditionally this decoder on creation of page based on this flag. Test: media/vp9.html * Scripts/GeneratePreferences.rb: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebPreferences.yaml: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP9Decoder): * WebProcess/WebProcess.h: 2020-07-03 Youenn Fablet <youenn@apple.com> MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 <rdar://problem/63601298> Reviewed by Eric Carlson. Update implementation to do initialization as part of startRecording. * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::releaseRecorder): Remove ASSERT as recorder creation in WebProcess is always ok while creation in GPUProcess may fail and m_recorders may not be populated. * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-07-03 Said Abou-Hallawa <sabouhallawa@apple.com> Change the names of MIMETypeRegistry methods to comply with webkit naming style https://bugs.webkit.org/show_bug.cgi?id=213912 Reviewed by Youenn Fablet. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::didSendRequest): * UIProcess/API/Cocoa/APIAttachmentCocoa.mm: (API::mimeTypeInferredFromFileExtension): (API::Attachment::setFileWrapperAndUpdateContentType): * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: (-[WKOpenPanelParameters _allowedFileExtensions]): * UIProcess/API/glib/WebKitURISchemeRequest.cpp: (webkitURISchemeRequestReadCallback): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::fileCanBeAcceptedForUpload): * UIProcess/Plugins/PluginInfoStore.cpp: (WebKit::PluginInfoStore::findPlugin): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel presentWithParameters:resultListener:]): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::objectContentType): 2020-07-03 Alexander Mikhaylenko <alexm@gnome.org> [GTK4] Support kinetic scrolling https://bugs.webkit.org/show_bug.cgi?id=213791 Reviewed by Carlos Garcia Campos. GtkEventControllerScroll skips the last event and exposes it in a separate signal. Normally one would add the KINETIC flag and listen to decelerate signal, but since WebKit already has code for calculating the velocity for GTK3, just use the same code path as scroll signal handler. * Shared/gtk/NativeWebWheelEventGtk.cpp: (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): * Shared/gtk/WebEventFactory.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseScrollEnd): (webkitWebViewBaseConstructed): 2020-07-02 Alex Christensen <achristensen@webkit.org> Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory https://bugs.webkit.org/show_bug.cgi?id=213048 Reviewed by Youenn Fablet. This uses CFNetwork SPI introduced in rdar://problem/50109631 to allow HSTS storage per NSURLSession. To be complete, I also deprecated our UI process HSTS state removal attempt SPIs, WKContextResetHSTSHosts and WKContextResetHSTSHostsAddedAfterDate, which had their last use removed in rdar://problem/64220838. I manually verified that this new SPI puts HSTS data in the specified location, and I also verified that HSTS state querying and removal works with the new CFNetwork SPI as it did with the old one. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::hstsStorage const): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * UIProcess/API/C/mac/WKContextPrivateMac.h: * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextResetHSTSHosts): (WKContextResetHSTSHostsAddedAfterDate): * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration hstsStorageDirectory]): (-[_WKWebsiteDataStoreConfiguration setHSTSStorageDirectory:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::privateBrowsingSession): Deleted. (WebKit::WebProcessPool::resetHSTSHosts): Deleted. (WebKit::WebProcessPool::resetHSTSHostsAddedAfterDate): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resolvedHSTSStorageDirectory const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2020-07-02 Alex Christensen <achristensen@webkit.org> Update Mac CMake build * PlatformMac.cmake: 2020-07-02 Kate Cheney <katherine_cheney@apple.com> Custom URL schemes should be treated as app-bound https://bugs.webkit.org/show_bug.cgi?id=213889 <rdar://problem/64804671> Reviewed by Brent Fulgham. For applications which opt-in to App-Bound Domains, allow specification of app-bound custom URL schemes. All content loaded using an app-bound scheme will have access to otherwise restricted APIs. A custom scheme is specified by a colon at the end of a string in the WKAppBoundDomains list. Custom schemes are included in the count of 10 app-bound domains. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _appBoundSchemes:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: SPI for testing. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::appBoundSchemes): (WebKit::WebsiteDataStore::initializeAppBoundDomains): Change variable name from appBoundDomains to appBoundData now that more than domains can be specified in the Info.plist. (WebKit::WebsiteDataStore::ensureAppBoundDomains const): Return both domains and schemes to avoid code duplication, at the expense of occasionally returning an unused parameter if only domains or only schemes are needed. (WebKit::WebsiteDataStore::beginAppBoundDomainCheck): (WebKit::WebsiteDataStore::getAppBoundDomains const): (WebKit::WebsiteDataStore::getAppBoundSchemes const): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-07-02 Austin Blackwood <ablackwoood@apple.com> Crash in +[UIViewController _viewControllerForFullScreenPresentationFromView:] when WKContentView is deallocated https://bugs.webkit.org/show_bug.cgi?id=213867 Reviewed by Darin Adler. +[UIViewController _viewControllerForFullScreenPresentationFromView:] asserts that the view parameter is non-nil. WKFileUploadPanel passes its view (a weak pointer to the WKContentView), which may have already been nil'd out when the content view tries to dismiss the panel in its own dealloc. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel dismiss]): Check for nil. 2020-07-02 Chris Dumez <cdumez@apple.com> FloatingPointEnvironment::saveMainThreadEnvironment() is not called for macOS Catalyst apps on Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=213897 <rdar://problem/64607098> Reviewed by Darin Adler. FloatingPointEnvironment::saveMainThreadEnvironment() is not called for macOS Catalyst apps on Apple Silicon This causes crashes because FloatingPointEnvironment::propagateMainThreadEnvironment() is called for worker threads for such apps on this platform. * Shared/ios/AuxiliaryProcessIOS.mm: (WebKit::AuxiliaryProcess::initializeSandbox): Drop some dead code for PLATFORM(MACCATALYST) since the whole file is protected with !PLATFORM(MACCATALYST). Mac Catalyst uses AuxiliaryProcessMac.mm instead. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::AuxiliaryProcess::platformInitialize): Call FloatingPointEnvironment::saveMainThreadEnvironment() on AuxiliaryProcessMac.mm since this platformInitialize() is used for Mac Catalyst and Catalyst apps may now run on Apple Silicon / ARM. Note that FloatingPointEnvironment::saveMainThreadEnvironment() is a no-op on platforms where it is not needed. 2020-07-02 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r263633, r263651, and r263671. Still seeing MediaRecorder test crashes after re-landing r263633 Reverted changesets: "MediaRecorder stopRecorder() returns empty Blob after first use" https://bugs.webkit.org/show_bug.cgi?id=212274 https://trac.webkit.org/changeset/263633 "MediaRecorder.start() Method is Ignoring the "timeslice" Parameter" https://bugs.webkit.org/show_bug.cgi?id=202233 https://trac.webkit.org/changeset/263651 "Support MediaRecorder.onstart" https://bugs.webkit.org/show_bug.cgi?id=213720 https://trac.webkit.org/changeset/263671 2020-07-02 Chris Dumez <cdumez@apple.com> Crash under WebKit::NetworkProcessProxy::updateProcessAssertion() https://bugs.webkit.org/show_bug.cgi?id=213891 <rdar://problem/65017909> Reviewed by Alex Christensen. The crash was due to NetworkProcessProxy::updateProcessAssertion() re-entering while in the middle of the `m_activityFromWebProcesses = nullptr;` assignment. Calling the ProcessThrottler::BackgroundActivity destructor, could cause updateProcessAssertion() to get called again, in which case we may dereference m_activityFromWebProcesses and crash. To address the issue, use `std::exchange(m_activityFromWebProcesses, nullptr);` instead, so that m_activityFromWebProcesses becomes null BEFORE the BackgroundActivity destructor gets called. updateProcessAssertion() will still re-enter but m_activityFromWebProcesses will be nullptr and updateProcessAssertion() will do the right thing. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::updateProcessAssertion): 2020-07-02 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK4 build * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: (webkitScriptDialogImplConstructed): * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk): * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::createPopupMenu): 2020-07-01 Said Abou-Hallawa <sabouhallawa@apple.com> MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types https://bugs.webkit.org/show_bug.cgi?id=213826 Reviewed by Darin Adler. Replace extensionsForMIMEType() with MIMETypeRegistry::getExtensionsForMIMEType(). * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: (-[WKOpenPanelParameters _allowedFileExtensions]): 2020-07-01 Lauro Moura <lmoura@igalia.com> [SOUP] Build fix after r263797 for older soup versions. Build was failing in LTS distributions due to -fpermissive Unreviewed build fix. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::sendString): 2020-07-01 Said Abou-Hallawa <sabouhallawa@apple.com> Allow the File object to be created with a replacement file https://bugs.webkit.org/show_bug.cgi?id=213825 Reviewed by Darin Adler. The UIProcess passes a list of strings which represents the replacement paths along with a list to the original paths to the WebProcess. The WebProcess passes these two list to FileChooser which creates the File objects and register the Blobs. The WebProcess registers the Blobs in the NetworkProcess which creates BlobDataFileReference objects with both the original path and the replacement path. The WebProcess unregisters the Blobs from the NetworkProcess which deletes the corresponding BlobDataFileReference from its registry. Upon destroying the BlobDataFileReference, the replacement file should be deleted. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL): (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcessPlatformStrategies.cpp: (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry): * Shared/BlobDataFileReferenceWithSandboxExtension.cpp: (WebKit::BlobDataFileReferenceWithSandboxExtension::BlobDataFileReferenceWithSandboxExtension): * Shared/BlobDataFileReferenceWithSandboxExtension.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChooseFilesForOpenPanel): * WebProcess/FileAPI/BlobRegistryProxy.cpp: (WebKit::BlobRegistryProxy::registerFileBlobURL): * WebProcess/FileAPI/BlobRegistryProxy.h: * WebProcess/WebPage/WebOpenPanelResultListener.cpp: (WebKit::WebOpenPanelResultListener::didChooseFiles): * WebProcess/WebPage/WebOpenPanelResultListener.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChooseFilesForOpenPanel): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-07-01 Tim Horton <timothy_horton@apple.com> Swipe snapshot is removed too early when swiping away from a page that is still loading https://bugs.webkit.org/show_bug.cgi?id=213763 <rdar://problem/64576811> Reviewed by Darin Adler. Test: http/tests/swipe/swipe-back-with-outstanding-load-cancellation.html When swiping back from a page that is still loading, when the swipe commits, and we start navigating back to the previous page, the unfinished forward navigation is cancelled. This cancellation resulted in a "didFailLoadForMainFrame" making it to ViewGestureController, which took it as an indication that the navigation *it* was interested in (the back navigation) had failed, and immediately removed the snapshot. Instead of listening to any random navigation's load notifications, keep track of the navigation started by goToBackForwardItem, and only listen to notifications from it, ignoring the others. This requires a bunch of plumbing to get the navigation from WebPageProxy to ViewGestureController, but is otherwise fairly trivial. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseDidFinishLoadForMainFrame): (webkitWebViewBaseDidFailLoadForMainFrame): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _didFinishNavigation:]): (-[WKWebView _didFailNavigation:]): (-[WKWebView _didFinishLoadForMainFrame]): Deleted. (-[WKWebView _didFailLoadForMainFrame]): Deleted. * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/API/wpe/PageClientImpl.h: * UIProcess/PageClient.h: * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::didReachNavigationTerminalState): (WebKit::ViewGestureController::willEndSwipeGesture): (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState): Deleted. * UIProcess/ViewGestureController.h: (WebKit::ViewGestureController::didFinishNavigation): (WebKit::ViewGestureController::didFailNavigation): (WebKit::ViewGestureController::didFinishLoadForMainFrame): Deleted. (WebKit::ViewGestureController::didFailLoadForMainFrame): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::willEndSwipeGesture): (WebKit::ViewGestureController::resetState): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::resetState): * UIProcess/playstation/PageClientImpl.cpp: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFailNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. (WebKit::PageClientImpl::didFailLoadForMainFrame): Deleted. * UIProcess/playstation/PageClientImpl.h: * UIProcess/win/PageClientImpl.cpp: (WebKit::PageClientImpl::didFinishNavigation): (WebKit::PageClientImpl::didFinishLoadForMainFrame): Deleted. * UIProcess/win/PageClientImpl.h: 2020-07-01 Brent Fulgham <bfulgham@apple.com> [iOS] Allow the WebContent sandbox to check the 'hw.product' sysctl https://bugs.webkit.org/show_bug.cgi?id=213861 <rdar://problem/64988957> Reviewed by Per Arne Vollan. Telemetry shows that we need to read the 'hw.product' sysctl in the font subsystem, primarily to enable certain font features (for various products) in different locales. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-07-01 Tim Horton <timothy_horton@apple.com> Upstream application accent color support https://bugs.webkit.org/show_bug.cgi?id=213859 Reviewed by Wenson Hsieh. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::accentColor): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::setAccentColor): Plumb accent color to the Web Content process so that it is used when deciding the colors of selection and form controls. 2020-07-01 Keith Miller <keith_miller@apple.com> Add WebXR to WebKit.plist preferences, off by default https://bugs.webkit.org/show_bug.cgi?id=213860 <rdar://64411568> Reviewed by Tim Horton. Right now we look for "WebXR" in the plist, however, it's not in the file. It so happens that, *I think*, we fall back to false for missing keys. We should have an entry for readability and consistency, though. No tests needed because this shouldn't change behavior. * FeatureFlags/WebKit.plist: 2020-07-01 Chris Dumez <cdumez@apple.com> Regression(r259242) WebKit no longer does client navigations at foreground priority for extensions https://bugs.webkit.org/show_bug.cgi?id=213852 <rdar://problem/63300428> Reviewed by Alex Christensen. r259242 tried to address a ASSERT(window) debug assertion hit in applicationType() by only calling applicationType() when the window is non-null and assuming the process is an application when the window is null. However, this is not correct for extensions. The first thing isApplicationVisible() does is call _UIApplicationIsExtension() to determine if we are an extension. It does not need the window to make this determination. As a result, I have reverted r259242 and simply dropped the ASSERT(window) assertion in isApplicationVisible() instead. This fixes the regression tracked by <rdar://problem/63300428> by reverting the change that caused it (r259242) and drops the assertion that was hit before r259242. * UIProcess/ApplicationStateTracker.mm: (WebKit::applicationType): * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::isApplicationVisible): 2020-07-01 Daniel Bates <dabates@apple.com> [iOS] Implement support for UIWKDocumentRequestSpatialAndCurrentSelection https://bugs.webkit.org/show_bug.cgi?id=213704 <rdar://problem/59738878> Reviewed by Wenson Hsieh. Implement support for the new request type UIWKDocumentRequestSpatialAndCurrentSelection. Requests of this type return the contents inside the range that covers both the specified rect and the current selection, if there is one. The flag UIWKDocumentRequestSpatialAndCurrentSelection was added in <rdar://problem/64867540>. * Platform/spi/ios/UIKitSPI.h: Same thing I did in TestWebKitAPI/ios/UIKitSPI.h. See Tools ChangeLog for why. * Shared/DocumentEditingContext.h: * UIProcess/ios/WKContentViewInteraction.mm: (toWebDocumentRequestOptions): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): 2020-07-01 Chris Dumez <cdumez@apple.com> Crash under IPC::isValidMessageName() https://bugs.webkit.org/show_bug.cgi?id=213751 <rdar://problem/64773416> Reviewed by Geoffrey Garen. This is a speculative fix for the crashes tracked by <rdar://problem/64773416>. The suspicion is that the compiler optimizes the code for IPC::isValidMessageName() because its parameter is of type MessageName. It may therefore assume the parameter is a valid MessageName enum value, which is ironic because the purpose of this function is to check whether or not the enum value is valid. To address the issue, I got rid of the #ifdefs in MessageName enum so that the enum values have an underlying value in the range [0, MessageName::Last]. I then updated the isValidEnum template specialization to verify that the input integer is indeed in the range [0, MessageName::Last] before casting it to a MessageName and calling IPC::isValidMessageName(). * Scripts/webkit/messages.py: 2020-07-01 Kate Cheney <katherine_cheney@apple.com> WKUserScripts injecting into all frames seem to violate app-bound domains https://bugs.webkit.org/show_bug.cgi?id=213816 <rdar://problem/64872296> Reviewed by Brady Eidson. Patch to make app-bound domain checks on a per-frame basis instead of per-page-based-on-main-frame. This will prevent WKUserScripts from being injected in subframes when the main frame is app-bound. Now, all ancestors of a frame must be app-bound in order for a frame to evaluate user script. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): Move 'isMainFrame' check to be inside of the check for m_limitsNavigationsToAppBoundDomains. The navigation should fail if the main frame is not app-bound and the WKWebView is marked with the limitsNavigationToAppBoundDomains flag, but non-app-bound subframe loads are allowed to continue. (WebKit::WebPageProxy::decidePolicyForNavigationAction): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isTopFrameNavigatingToAppBoundDomain const): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::download): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): (WebKit::WebLoaderStrategy::loadResourceSynchronously): (WebKit::WebLoaderStrategy::startPingLoad): (WebKit::WebLoaderStrategy::preconnectTo): For reporting loads to the Network Process, we only care if the main frame is app bound, so we need to store that info in the WebPage and WebPageProxy. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::shouldEnableInAppBrowserPrivacyProtections const): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::startDownload): (WebKit::WebFrame::convertMainResourceLoadToDownload): (WebKit::WebFrame::shouldEnableInAppBrowserPrivacyProtections): (WebKit::WebFrame::isTopFrameNavigatingToAppBoundDomain const): * WebProcess/WebPage/WebFrame.h: (WebKit::WebFrame::setIsNavigatingToAppBoundDomain): (WebKit::WebFrame::isNavigatingToAppBoundDomain const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): (WebKit::WebPage::loadDataImpl): (WebKit::WebPage::didReceivePolicyDecision): (WebKit::WebPage::runJavaScript): (WebKit::WebPage::setIsNavigatingToAppBoundDomain): (WebKit::WebPage::shouldEnableInAppBrowserPrivacyProtections): Deleted. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::needsInAppBrowserPrivacyQuirks): (WebKit::WebPage::isNavigatingToAppBoundDomain const): Deleted. Move all app-bound domain logic from the WebPage to the WebFrame now that checks are on a per-frame basis. 2020-07-01 Youenn Fablet <youenn@apple.com> Make NetworkSendQueue use CString instead of String for UTF-8 data https://bugs.webkit.org/show_bug.cgi?id=213714 Reviewed by Darin Adler. Update code to use CString/DataReference to transmit WebSocket text messages. * NetworkProcess/NetworkSocketChannel.cpp: (WebKit::NetworkSocketChannel::sendString): * NetworkProcess/NetworkSocketChannel.h: * NetworkProcess/NetworkSocketChannel.messages.in: * NetworkProcess/WebSocketTask.h: (WebKit::WebSocketTask::sendString): * NetworkProcess/cocoa/WebSocketTaskCocoa.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: (WebKit::WebSocketTask::sendString): * NetworkProcess/soup/WebSocketTaskSoup.h: * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::sendString): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): (WebKit::WebSocketChannel::send): 2020-07-01 James Savage <james.savage@apple.com> Fix Swift overlay build after r263727. https://bugs.webkit.org/show_bug.cgi?id=213823. Unreviewed, follow up build fix. * SwiftOverlay/Tests/WebKitTests.swift: (WebKitTests.testAPI): Fix tests to refer to new parameter name. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: (callAsyncJavaScript(_:arguments:in:in:completionHandler:Error:)): Use the imported ObjC name that the compiler expects. (evaluateJavaScript(_:in:in:completionHandler:Error:)): Ditto. 2020-07-01 Youenn Fablet <youenn@apple.com> Make NetworkRTCProvider receive IPC messages from a background thread https://bugs.webkit.org/show_bug.cgi?id=213557 Reviewed by Geoffrey Garen. To ensure webrtc packets do not get blocked on the main thread, we process WebProcess IPC message directly in the socket thread. For new sockets, we still go through the main thread, to check suspension or proxy values. For sending packets/setting options/closing sockets, we stay in the background thread. * DerivedSources-output.xcfilelist: * DerivedSources.make: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::sendTo): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): (WebKit::NetworkRTCProvider::close): (WebKit::NetworkRTCProvider::createSocket): (WebKit::NetworkRTCProvider::createUDPSocket): (WebKit::NetworkRTCProvider::createServerTCPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::sendToSocket): (WebKit::NetworkRTCProvider::closeSocket): (WebKit::NetworkRTCProvider::setSocketOption): (WebKit::NetworkRTCProvider::addSocket): (WebKit::NetworkRTCProvider::takeSocket): (WebKit::NetworkRTCProvider::newConnection): (WebKit::NetworkRTCProvider::dispatchToThread): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::didReceiveNetworkRTCMonitorMessage): * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * NetworkProcess/webrtc/NetworkRTCSocket.cpp: Removed. * NetworkProcess/webrtc/NetworkRTCSocket.h: Removed. * NetworkProcess/webrtc/NetworkRTCSocket.messages.in: Removed. * SourcesCocoa.txt: * SourcesGTK.txt: * SourcesWPE.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::SendTo): (WebKit::LibWebRTCSocket::Close): (WebKit::LibWebRTCSocket::SetOption): (WebKit::LibWebRTCSocket::suspend): 2020-06-30 Sam Weinig <weinig@apple.com> Split Color serialization out of Color classes https://bugs.webkit.org/show_bug.cgi?id=213820 Reviewed by Darin Adler. Adopt ColorSerialization.h serialization functions. * UIProcess/API/Cocoa/WKWebView.mm: (dictionaryRepresentationForEditorState): * UIProcess/Cocoa/WebViewImpl.mm: (-[WKTextTouchBarItemController _wkChangeColor:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _setTextColorForWebView:sender:]): * UIProcess/ios/forms/WKFormColorPicker.mm: (-[WKColorPicker setControlValueFromUIColor:]): * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: (WebKit::PDFPluginTextAnnotation::createAnnotationElement): 2020-06-30 Geoffrey Garen <ggaren@apple.com> [Cocoa] [GTK] RunLoop::Timer::isActive() is incorrect for timers while they are firing https://bugs.webkit.org/show_bug.cgi?id=213771 Unreviewed assertion fix. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::timeOutTimerFired): Removed this ASSERT. One-shot timers are not active while they are firing. 2020-06-30 Wenson Hsieh <wenson_hsieh@apple.com> Several key event tests in fast/events/ios are failing after <rdar://problem/62197116> https://bugs.webkit.org/show_bug.cgi?id=213821 <rdar://problem/64821309> Reviewed by Megan Gardner. Add an SPI method declaration. * Platform/spi/ios/UIKitSPI.h: 2020-06-30 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Remove whitelistedRpId https://bugs.webkit.org/show_bug.cgi?id=213817 <rdar://problem/60108131> Reviewed by Geoffrey Garen. Remove the whitelist such that we can test the attestation service in a wider range. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticatorInternal::whitelistedRpId): Deleted. 2020-06-30 Brady Eidson <beidson@apple.com> Fix Swift overlay build after r263727. <rdar://problem/64962370> and https://bugs.webkit.org/show_bug.cgi?id=213823 Reviewed by Darin Adler. No new tests (No behavior change). Adapt the Swift overlay refinemnt to handle the inFrame: argument for these methods. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: (callAsyncJavaScript(_:arguments:in:in:completionHandler:Error:)): (evaluateJavaScript(_:in:in:completionHandler:Error:)): (callAsyncJavaScript(_:arguments:in:completionHandler:Error:)): Deleted. (evaluateJavaScript(_:in:completionHandler:Error:)): Deleted. 2020-06-30 Brady Eidson <beidson@apple.com> App-bound JavaScript and Navigation failures should have specific error codes. <rdar://problem/64940268> and https://bugs.webkit.org/show_bug.cgi?id=213808 Reviewed by Tim Hatcher. (Informally by Kate Cheney) * UIProcess/API/Cocoa/WKError.h: * UIProcess/API/Cocoa/WKError.mm: (localizedDescriptionForErrorCode): * UIProcess/API/Cocoa/WKWebView.mm: (nsErrorFromExceptionDetails): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::errorForUnpermittedAppBoundDomainNavigation): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): 2020-06-30 Per Arne Vollan <pvollan@apple.com> [macOS] Connections to the preference daemon are established before entering the sandbox https://bugs.webkit.org/show_bug.cgi?id=213379 Reviewed by Darin Adler. On macOS, connections to the preference daemon are established before entering the sandbox. These connections also persist after entering the sandbox and denying access to the preference daemon. There should not be attempts to connect to the preference daemon before entering the sandbox, since these attempts will not be stopped by the sandbox. This patch moves code that connects to the preference daemon to be executed after the sandbox has been entered. That includes code to prevent connections to the Dock and code to initialize WebKit logging. Also, instead of calling [NSBundle bundleForClass:], call [NSBundle bundleWithIdentifier:], since calling [NSBundle bundleForClass:] will connect to the preference daemon. Finally, allow the syscall SYS_gethostuuid, since that is needed by CoreFoundation when there is no access to the preference daemon. No new tests. This should be covered by existing tests. It would be nice to have a test to make sure that there are no connections to the preference daemon just before entering the sandbox, but I am not aware of how to implement this. * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::NetworkProcess::initializeSandbox): * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::initialize): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::webKit2Bundle): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2020-06-30 Brent Fulgham <bfulgham@apple.com> Partially revert r257135 now that the underlying bug is resolved https://bugs.webkit.org/show_bug.cgi?id=213814 <rdar://problem/59859573> Reviewed by Per Arne Vollan. This patch is a partial revert of the code change in Bug 208033, where a temporary workaround was added for a bug in an underlying framework. Now that the bug has been fixed, we can remove this workaround. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::gpuProcessSessionParameters): 2020-06-30 Brent Fulgham <bfulgham@apple.com> [macOS] Stop blocking two audio-related user client classes https://bugs.webkit.org/show_bug.cgi?id=213807 <rdar://problem/64874902> Reviewed by Per Arne Vollan. Restore IOAudioControlUserClient and IOAudioEngineUserClient since we find them being actively used on macOS for some media playback purposes. * WebProcess/com.apple.WebProcess.sb.in: 2020-06-30 Peng Liu <peng.liu6@apple.com> Enable the support of FULLSCREEN_API in WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=213774 Reviewed by Youenn Fablet. Replace the definition of ENABLE_FULLSCREEN_API in FeatureDefines.xcconfig with the one in PlatformEnableCocoa.h. We have to do that because WebKitTestRunner does not have a FeatureDefines.xcconfig but it uses "ENABLE(FULLSCREEN_API)" to conditionally compile code to test the element fullscreen API. WebKitTestRunner can use the macro defined in PlatformEnableCocoa.h. * Configurations/FeatureDefines.xcconfig: 2020-06-30 Daniel Bates <dabates@apple.com> [iOS] Editable regions causes ~1% slowdown in PLT5 https://bugs.webkit.org/show_bug.cgi?id=213659 <rdar://problem/64361390> Reviewed by Simon Fraser. Fix up RemoteLayerTreeViews now that the editable region is an Optional<>. Have the UI process message the web process to enable editable region on the first invocation of _requestTextInputContextsInRect, which is good indicator that there would be benefit to computing it as a typical client that calls it will call it many times. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::mayContainEditableElementsInRect): Fix up the logic now that there may be not be an editable region sent over in the last event region update. If there isn't one then we don't know if there are editable elements in the rect of not. So, return true, which could turn out to be a false positive if there aren't any editable elements in the rect. The caller will have to message the web process to find out the real answer if they want it. Just to clarify, it's OK for this function to have false positives, but it must never have false negatives. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::textInputContextsInRect): Enable editable region. If it's already enabled then doing so again does nothing. 2020-06-30 Peng Liu <peng.liu6@apple.com> Scrunching a video to PiP can result in broken animation and leave Safari in a bad state https://bugs.webkit.org/show_bug.cgi?id=213175 Reviewed by Jer Noble. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _completedExitFullScreen]): Update _exitRequested after exiting fullscreen to make sure the following enter fullscreen request can be processed. (-[WKFullScreenWindowController _dismissFullscreenViewController]): Make sure _completedExitFullScreen function will always execute. (-[WKFullScreenWindowController _interactivePinchDismissChanged:]): Remove a function call which corrupts the state machine under stress test. 2020-06-30 Antoine Quint <graouts@webkit.org> [iOS] Crash under WebKit::WebPage::getFocusedElementInformation() https://bugs.webkit.org/show_bug.cgi?id=213798 <rdar://problem/62754594> Reviewed by Wenson Hsieh. Since LabelableElement::labels() returns a RefPtr<NodeList>, ensure we get a value before attempting to read data from it. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2020-06-30 Andy Estes <aestes@apple.com> [Xcode] Enable the "My Mac (Mac Catalyst)" destination in WebKit Xcode projects https://bugs.webkit.org/show_bug.cgi?id=213740 Reviewed by Darin Adler. * Configurations/Base.xcconfig: Set SUPPORTS_MACCATALYST to YES to tell Xcode that this project supports building for Mac Catalyst. 2020-06-30 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r263724. https://bugs.webkit.org/show_bug.cgi?id=213781 Reverted changeset: "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory" https://bugs.webkit.org/show_bug.cgi?id=213048 https://trac.webkit.org/changeset/263724 2020-06-30 Youenn Fablet <youenn@apple.com> Add VP9 WebRTC codec runtime flag https://bugs.webkit.org/show_bug.cgi?id=213724 Reviewed by Eric Carlson. * Shared/WebPreferences.yaml: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2020-06-29 Brady Eidson <beidson@apple.com> JavaScript cannot be injected into iframes <rdar://problem/54168946> and https://bugs.webkit.org/show_bug.cgi?id=213556 Reviewed by Geoff Garen. This adds a few mechanisms: - Allows for WKUserScripts to have a target content world - Allows "evaluateJavaScript" and "callAsyncJavaScript" to target a specific frame - Allows for the completion handlers of those methods to be able to distinguish failure-due-to-missing-frame. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<ExceptionDetails>::encode): (IPC::ArgumentCoder<ExceptionDetails>::decode): * Shared/WebCoreArgumentCoders.h: * UIProcess/API/Cocoa/WKError.h: * UIProcess/API/Cocoa/WKError.mm: (localizedDescriptionForErrorCode): * UIProcess/API/Cocoa/WKUserScript.h: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]): (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:inContentWorld:]): * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView evaluateJavaScript:inFrame:inContentWorld:completionHandler:]): (-[WKWebView callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]): (nsErrorFromExceptionDetails): (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): (-[WKWebView callAsyncJavaScript:arguments:inContentWorld:completionHandler:]): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): 2020-06-29 Alex Christensen <achristensen@webkit.org> Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory https://bugs.webkit.org/show_bug.cgi?id=213048 Reviewed by Youenn Fablet. This uses CFNetwork SPI introduced in rdar://problem/50109631 to allow HSTS storage per NSURLSession. To be complete, I also deprecated our UI process HSTS state removal attempt SPIs, WKContextResetHSTSHosts and WKContextResetHSTSHostsAddedAfterDate, which had their last use removed in rdar://problem/64220838. I manually verified that this new SPI puts HSTS data in the specified location, and I also verified that HSTS state querying and removal works with the new CFNetwork SPI as it did with the old one. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::hstsStorage const): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::hostNamesWithHSTSCache const): (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): (WebKit::NetworkProcess::clearHSTSCache): (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. * UIProcess/API/C/mac/WKContextPrivateMac.h: * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextResetHSTSHosts): (WKContextResetHSTSHostsAddedAfterDate): * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration hstsStorageDirectory]): (-[_WKWebsiteDataStoreConfiguration setHSTSStorageDirectory:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::privateBrowsingSession): Deleted. (WebKit::WebProcessPool::resetHSTSHosts): Deleted. (WebKit::WebProcessPool::resetHSTSHostsAddedAfterDate): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resolvedHSTSStorageDirectory const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2020-06-29 Tim Horton <timothy_horton@apple.com> Adopt adjusted symbol image names https://bugs.webkit.org/show_bug.cgi?id=213768 <rdar://problem/64472257> Reviewed by Andy Estes. * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction imageForElementActionType:]): 2020-06-29 Guowei Yang <guowei_yang@apple.com> Adding Experimental Feature Flags for CoreImage backed SVG/CSS Filters https://bugs.webkit.org/show_bug.cgi?id=213578 Reviewed by Darin Adler, Simon Fraser, Myles C. Maxfield. Preparing to implement CoreImage backed filter rendering Needs Compiler guards and experimental feature guard. * Shared/WebPreferences.yaml: added feature flag definition 2020-06-29 Peng Liu <peng.liu6@apple.com> Video spills over PiP screen a little when using Picture in Picture https://bugs.webkit.org/show_bug.cgi?id=213658 Reviewed by Eric Carlson. Add the video content dimensions to the IPC message VideoFullscreenManagerProxy::SetupFullscreenWithID. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): 2020-06-29 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r262004. <rdar://problem/64540215> Revert r262004 as it is not OK to have a data vault in TMPDIR. Reverted changeset: "[WK2] WebKit abandons compiled sandbox profiles" https://bugs.webkit.org/show_bug.cgi?id=212177 https://trac.webkit.org/changeset/262004 2020-06-29 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Remove ENABLE_STREAMS_API compilation flag https://bugs.webkit.org/show_bug.cgi?id=213728 Reviewed by Sam Weinig. * Configurations/FeatureDefines.xcconfig: * Shared/WebPreferences.yaml: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 2020-06-29 Per Arne Vollan <pvollan@apple.com> [iOS] Temporarily open up sandbox for mapping of Launch Services database https://bugs.webkit.org/show_bug.cgi?id=213756 <rdar://problem/64707000> Reviewed by Brent Fulgham. Address review comments. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-29 Per Arne Vollan <pvollan@apple.com> [iOS] Temporarily open up sandbox for mapping of Launch Services database https://bugs.webkit.org/show_bug.cgi?id=213756 <rdar://problem/64707000> Reviewed by Brent Fulgham. Temporarily open up sandbox for mapping of Launch Services database in the WebContent process on iOS. This is just a short term fix, and access to the service will be closed again soon. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-29 Chris Dumez <cdumez@apple.com> Unreviewed, rebaseline messages.py tests. * Scripts/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/MessageNames.h: (WTF::isValidEnum): * Scripts/test-superclassMessagesReplies.h: 2020-06-29 David Kilzer <ddkilzer@apple.com> Crash in NetworkProcessProxy::getNetworkProcessConnection() lambda due to missing Optional<> value check <https://webkit.org/b/213700> <rdar://problem/64852903> Reviewed by Darin Adler. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::getGPUProcessConnection): - Rename `connectionIdentifier` to `identifier`. - Return early from the lamba if `identifier` does not contain a value. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getNetworkProcessConnection): - Ditto. 2020-06-29 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] editing/selection/ios/select-text-after-changing-focus.html sometimes fails https://bugs.webkit.org/show_bug.cgi?id=213745 Work towards <rdar://problem/64808138> Reviewed by Tim Horton. This test first taps an input field to focus it, taps a button below the input field to focus the button and dismiss the keyboard, and finally long presses to select a word below the button. On recent iOS 14 builds, this test occasionally fails due to recent changes in UIKit that may cause the callout bar appearance callback to fire after focusing the input field. If this happens, we end up showing the callout bar with a single option to "Select All" (despite the field being empty), and the subsequent tap that's intended to hit the button instead hit-tests to this callout bar item. The tests subsequently times out waiting for the keyboard to dismiss, which never happens because the input field remains focused. Showing the "Select All" callout bar option in empty text fields is inconsistent with the rest of the platform (iOS), and appears to have been unintentionally introduced in iOS 12 by <https://trac.webkit.org/r231726>. While it's still unknown which exact system changes caused this test to begin timing out, we can at least fix it by addressing this existing regression in behavior. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformActionForWebView:withSender:]): Check `-hasContent` here, instead of just checking if the selection is a caret. Note that we don't need to check whether the selection is none separately, since `-hasContent` will always return `NO` if there is no selection. 2020-06-29 Sam Weinig <weinig@apple.com> Remove remaining makeSimpleColorFrom* variants https://bugs.webkit.org/show_bug.cgi?id=213706 Reviewed by Darin Adler. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorToWebCoreColor): Use makeSimpleColor(SRGBA { ... }) rather than makeSimpleColorFromFloats. * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::showPaintRect): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::drawRect): Use makeSimpleColor rather than makeSimpleColorFromFloats, allowing for constant expression creation of SimpleColors. 2020-06-29 Youenn Fablet <youenn@apple.com> Send WebRTC packets received from network process to web process from a background thread https://bugs.webkit.org/show_bug.cgi?id=213548 Reviewed by Eric Carlson. Make LibWebRTCSocketClient take a ref to an IPC connection at creation time. Use this connection from the RTC network thread to send received packets to improve performances. Covered by existing tests. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createSocket): (WebKit::NetworkRTCProvider::createUDPSocket): (WebKit::NetworkRTCProvider::createServerTCPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): (WebKit::NetworkRTCProvider::wrapNewTCPConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: 2020-06-29 Elliot <CheeseEBoi@mailo.com> [GTK] Dark mode for GTK themes that end with -Dark https://bugs.webkit.org/show_bug.cgi?id=213465 Reviewed by Carlos Garcia Campos. WebKitGtk has support for automatic detection of dark mode when it comes to GTK themes with the "-dark" and ":dark" suffixes. However, when using GTK themes that end with "-Dark" or ":Dark", this is not the case. This affects many themes like "Arc" and "Flat-Remix". * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::effectiveAppearanceIsDark const): (WebKit::PageClientImpl::themeName const): 2020-06-29 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Add webkit_authentication_request_get_security_origin https://bugs.webkit.org/show_bug.cgi?id=213596 Reviewed by Michael Catanzaro. Returns the security origin for the authentication protection space. * UIProcess/API/glib/WebKitAuthenticationRequest.cpp: (webkit_authentication_request_get_security_origin): * UIProcess/API/gtk/WebKitAuthenticationRequest.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitAuthenticationRequest.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-06-29 Alexander Mikhaylenko <alexm@gnome.org> [GTK4] Context menu is misaligned https://bugs.webkit.org/show_bug.cgi?id=213703 Reviewed by Carlos Garcia Campos. Set halign on the context menu popover to the same value other context menus in GTK use, like in GtkEntry. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::createMenuWidget): Set halign for the context menu to 'start'. 2020-06-28 Chris Dumez <cdumez@apple.com> Fix thread-safety issue in webProcessPoolHighDynamicRangeDidChangeCallback() https://bugs.webkit.org/show_bug.cgi?id=213689 <rdar://problem/64443996> Reviewed by Darin Adler. webProcessPoolHighDynamicRangeDidChangeCallback() gets called on a background thread so we need to make sure we dispatch to the main thread before we iterate over the process pools. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::webProcessPoolHighDynamicRangeDidChangeCallback): 2020-06-28 Geoffrey Garen <ggaren@apple.com> Rename initializeThreading to initialize https://bugs.webkit.org/show_bug.cgi?id=213674 Reviewed by Mark Lam. * Shared/API/c/WKString.cpp: (WKStringCopyJSString): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): 2020-06-28 Daniel Bates <dabates@apple.com> [iOS] Clean up visible position comparisons in WebPage::requestDocumentEditingContext() https://bugs.webkit.org/show_bug.cgi?id=213701 Reviewed by Geoffrey Garen. Use std::min and std::max when the result needs to be copied instead of doing the comparison by hand to make the code a tiny bit more clear. Also, don't copy a VisiblePosition when doing the min/max in-place. Both of these things are unlikely to effect code generation. If they do, the latter makes things a tiny bit more efficient. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): 2020-06-28 Youenn Fablet <youenn@apple.com> MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 <rdar://problem/63601298> Reviewed by Eric Carlson. Update implementation to do initialization as part of startRecording. * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::releaseRecorder): Remove ASSERT as recorder creation in WebProcess is always ok while creation in GPUProcess may fail and m_recorders may not be populated. * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-06-28 Philippe Normand <pnormand@igalia.com> Unreviewed GTK/WPE Debug build fix after r263589. * Platform/Logging.h: Define a log category for Memory Pressure. 2020-06-27 Daniel Bates <dabates@apple.com> Revert r262654 because it caused <rdar://problem/64664156>. Moreover it is no longer necessary as the embedding client changes selection through a different SPI after focusing. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _didCommitLoadForMainFrame]): (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): 2020-06-26 David Kilzer <ddkilzer@apple.com> Crash at WebKit: __62-[WKContentView(WKInteraction) resignFirstResponderForWebView]_block_invoke <https://webkit.org/b/213666> <rdar://problem/64238661> Reviewed by Darin Adler. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView resignFirstResponderForWebView]): - Speculative fix to return early if there are no queued key events available by the time the block runs. 2020-06-26 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Layout tests sometimes assert under -[WKContentView hasContent] https://bugs.webkit.org/show_bug.cgi?id=213656 <rdar://problem/64818648> Reviewed by Tim Horton. Make it safe to invoke `-[WKContentView hasContent]` when post-layout data is not present, and there is no ranged or caret selection. Some editing layout tests on iOS tend to hit the post-layout data assertion due to the callout bar presentation callback firing while we reset the test harness to a consistent state (and spin the runloop while doing so). * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView hasContent]): 2020-06-26 Pablo Saavedra <psaavedra@igalia.com> [GTK][WPE] Fix the matching of an empty value in getCgroupControllerPath() when only cgroupsV2 hierarchy is found https://bugs.webkit.org/show_bug.cgi?id=213646 Reviewed by Adrian Perez de Castro. * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::getCgroupFile): (WebKit::getCgroupControllerPath): (WebKit::systemMemoryUsedAsPercentage): 2020-06-26 Jason Lawrence <lawrence.j@apple.com> Unreviewed, reverting r263511, r263514, and r263565. r263511 caused MediaRecorder test crashes on internal testers. Reverted changesets: "MediaRecorder stopRecorder() returns empty Blob after first use" https://bugs.webkit.org/show_bug.cgi?id=212274 https://trac.webkit.org/changeset/263511 "Unreviewed iOS build fix after r263511." https://trac.webkit.org/changeset/263514 "MediaRecorder.start() Method is Ignoring the "timeslice" Parameter" https://bugs.webkit.org/show_bug.cgi?id=202233 https://trac.webkit.org/changeset/263565 2020-06-26 Geoffrey Garen <ggaren@apple.com> Initializing the main thread should initialize the main run loop https://bugs.webkit.org/show_bug.cgi?id=213637 Reviewed by Anders Carlsson. * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): (WebKit::InitializeWebKit2): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): 2020-06-26 Chris Dumez <cdumez@apple.com> [iOS] Network process is crashing when launching TJMaxx app due to invalid NetworkProcess::DestroySession IPC message https://bugs.webkit.org/show_bug.cgi?id=213625 <rdar://problem/64737890> Reviewed by Alex Christensen. The app is calling [WKWebsiteDataStore init] despite the method being marked as unavailable in WKWebsiteDataStore.h. As a result, they end up with a WKWebsiteDataStore object whose internal _websiteDataStore is bad because its constructor was never called. When [WKWebsiteDataStore dealloc] gets called later own, it calls the ~WebsiteDataStore() destructor for _websiteDataStore but its m_sessionID is 0 because we never called the constructor. This causes us to send a NetworkProcess::DestroySession IPC with a sessionID that is 0, which is not valid so the NetworkProcess crashes. To address the issue, we now provide an implementation of [WKWebsiteDataStore init] which raises an exception, behind a linked-on-after check. To keep the app working, [WKWebsiteDataStore init] returns a new ephemeral data store until rebuilt with the new SDK. * UIProcess/API/Cocoa/WKWebsiteDataStore.h: Mark "new" as unavailable, otherwise [WKWebsiteDataStore new] builds. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore init]): Raise an exception with latest SDK, a new ephemeral data store otherwise. * UIProcess/Cocoa/VersionChecks.h: Add linked-on-after check. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::~WebsiteDataStore): Add a release assertion to make sure that m_sessionID is always valid when the destructor is called. 2020-06-26 Stephan Szabo <stephan.szabo@sony.com> [WinCairo] Cannot build without resource load statistics https://bugs.webkit.org/show_bug.cgi?id=213534 Reviewed by Don Olmstead. Build fix for !ENABLE(RESOURCE_LOAD_STATISTICS) * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: * UIProcess/WebsiteData/WebsiteDataStore.cpp: 2020-06-25 Alex Christensen <achristensen@webkit.org> WKHTTPCookieStore.setCookie should flush the cookies to disk before calling completion handler when we are using the UIProcess's default cookie storage https://bugs.webkit.org/show_bug.cgi?id=213636 Reviewed by Brady Eidson. This fixes a race condition that many, many third party developers run into, causing them to not be logged in when they thought they did. * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::saveCookies): * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::setCookies): (API::HTTPCookieStore::registerForNewProcessPoolNotifications): (API::HTTPCookieStore::flushDefaultUIProcessCookieStore): * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: (API::HTTPCookieStore::flushDefaultUIProcessCookieStore): 2020-06-25 Megan Gardner <megan_gardner@apple.com> Upstream date/time picker style https://bugs.webkit.org/show_bug.cgi?id=213630 Reviewed by Wenson Hsieh. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker datePickerStyle]): 2020-06-25 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r263545. Patch will need refining Reverted changeset: "[iOS] Network process is crashing when launching TJMaxx app due to invalid NetworkProcess::DestroySession IPC message" https://bugs.webkit.org/show_bug.cgi?id=213625 https://trac.webkit.org/changeset/263545 2020-06-25 Chris Dumez <cdumez@apple.com> [iOS] Network process is crashing when launching TJMaxx app due to invalid NetworkProcess::DestroySession IPC message https://bugs.webkit.org/show_bug.cgi?id=213625 <rdar://problem/64737890> Reviewed by Geoffrey Garen. The app is calling [WKWebsiteDataStore init] despite the method being marked as unavailable in WKWebsiteDataStore.h. As a result, they end up with a WKWebsiteDataStore object whose internal _websiteDataStore is bad because its constructor was never called. When [WKWebsiteDataStore dealloc] gets called later own, it calls the ~WebsiteDataStore() destructor for _websiteDataStore but its m_sessionID is 0 because we never called the constructor. This causes us to send a NetworkProcess::DestroySession IPC with a sessionID that is 0, which is not valid so the NetworkProcess crashes. To address the issue, we now provide an implementation of [WKWebsiteDataStore init] which returns nil behind a linked-on-after check (since this crashes the app). To keep the app working, [WKWebsiteDataStore init] returns the default data store until rebuilt with the new SDK. Note that I tried returning a new ephemeral data store instead but this was getting the app in a bad state. * UIProcess/API/Cocoa/WKWebsiteDataStore.h: Mark "new" as unavailable, otherwise [WKWebsiteDataStore new] builds. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore init]): Return nil with latest SDK, the default data store otherwise. * UIProcess/Cocoa/VersionChecks.h: Add linked-on-after check. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::~WebsiteDataStore): Add a release assertion to make sure that m_sessionID is always valid when the destructor is called. 2020-06-25 Daniel Bates <dabates@apple.com> [iOS] -_requestTextInputContextsInRect cannot find empty Quip spreadsheet title https://bugs.webkit.org/show_bug.cgi?id=213564 <rdar://problem/59355847> Reviewed by Simon Fraser. Check if the search rect intersects the interaction rect, even if it's empty, so long as there is an assisted element. If there isn't an assisted element just do what we do now. Otherwise, if the interaction rect is empty then this means the focused element is an empty inline and it's not tracked in the editable region (see WebCore ChangeLog entry for more details). In this case, just ask the web process directly to find the contexts. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): 2020-06-25 Kate Cheney <katherine_cheney@apple.com> Allow service workers for web browsers https://bugs.webkit.org/show_bug.cgi?id=213573 <rdar://problem/64712630> Reviewed by Brent Fulgham. Allows applications with the full web-browser entitlement to use service workers. * NetworkProcess/ios/NetworkProcessIOS.mm: (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setupPageConfiguration:]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const): 2020-06-25 Youenn Fablet <youenn@apple.com> MediaRecorder stopRecorder() returns empty Blob after first use https://bugs.webkit.org/show_bug.cgi?id=212274 <rdar://problem/63601298> Reviewed by Eric Carlson. Update implementation to do initialization as part of startRecording. * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: (WebKit::RemoteMediaRecorderManager::releaseRecorder): Remove ASSERT as recorder creation in WebProcess is always ok while creation in GPUProcess may fail and m_recorders may not be populated. * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-06-24 James Savage <james.savage@apple.com> Upstream iPadOS 13.0 multi-window support https://bugs.webkit.org/show_bug.cgi?id=213590 Reviewed by Alexey Proskuryakov. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): Always construct a UIWindow using the expected UIWindowScene. (makeWindowFromView): Deleted. 2020-06-24 David Kilzer <ddkilzer@apple.com> Use ObjectIdentifier<>instead of WebCore::nextPlaybackTargetClientContextId() in Document.cpp <https://webkit.org/b/213546> <rdar://problem/61803576> Reviewed by Youenn Fablet. Switch from uint64_t to WebCore::PlaybackTargetClientContextIdentifier for contextId values. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): - Add WebCore::PlaybackTargetClientContextIdentifier to list. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::addPlaybackTargetPickerClient): (WebKit::WebPageProxy::removePlaybackTargetPickerClient): (WebKit::WebPageProxy::showPlaybackTargetPicker): (WebKit::WebPageProxy::playbackTargetPickerClientStateDidChange): (WebKit::WebPageProxy::setPlaybackTarget): (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange): (WebKit::WebPageProxy::setShouldPlayToPlaybackTarget): (WebKit::WebPageProxy::playbackTargetPickerWasDismissed): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::addPlaybackTargetPickerClient): (WebKit::WebChromeClient::removePlaybackTargetPickerClient): (WebKit::WebChromeClient::showPlaybackTargetPicker): (WebKit::WebChromeClient::playbackTargetPickerClientStateDidChange): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::playbackTargetSelected const): (WebKit::WebPage::playbackTargetAvailabilityDidChange): (WebKit::WebPage::setShouldPlayToPlaybackTarget): (WebKit::WebPage::playbackTargetPickerWasDismissed): 2020-06-24 David Kilzer <ddkilzer@apple.com> [IPC] Use WebKit::LayerHostingContextID instead of uint32_t for videoLayerID <https://webkit.org/b/213576> <rdar://problem/61806253> Reviewed by Darin Adler. Use WebKit::LayerHostingContextID instead of uint32_t as type for videoLayerID since the value comes from LayerHostingContext::contextID() in VideoFullscreenManager::enterVideoFullscreenForVideoElement(). * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): 2020-06-24 Tim Horton <timothy_horton@apple.com> Cannot play back any video on Apple Silicon devices https://bugs.webkit.org/show_bug.cgi?id=213584 <rdar://problem/64714596> Reviewed by Per Arne Vollan. * WebProcess/com.apple.WebProcess.sb.in: An unfortunate and incorrect refactoring caused some of the sandbox exceptions to get dropped on the floor. 2020-06-24 Simon Fraser <simon.fraser@apple.com> REGRESSION (r260276): Scrolling through shelves on music.apple.com is not smooth https://bugs.webkit.org/show_bug.cgi?id=213572 <rdar://problem/64306590> Reviewed by Wenson Hsieh. The scroll position for an overflow:scroll element with scroll-snap could jump around during scrolling, if layout triggered a call to ScrollableArea::updateScrollSnapState(). The crux of the issue is that isScrollSnapInProgress() returned false for overflow:scrollers which are scrolling asynchronously. Fix by extending the existing ScrollingTree::isScrollSnapInProgress() to track all scrolling nodes by storing a HashSet<ScrollingNodeID> rather than just a flag for the main frame. RenderLayer::isScrollSnapInProgress() then consults the ScrollingCoordinator, which consults the scrolling tree for this state. Add the ability to test via internals.isScrollSnapInProgress(). * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::isScrollSnapInProgress const): 2020-06-24 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r263295. https://bugs.webkit.org/show_bug.cgi?id=213577 Introduced logging regression Reverted changeset: "[macOS] Connections to the preference daemon are established before entering the sandbox" https://bugs.webkit.org/show_bug.cgi?id=213379 https://trac.webkit.org/changeset/263295 2020-06-24 David Kilzer <ddkilzer@apple.com> Use ObjectIdentifier<> instead of uint64_t for context IDs in VideoFullscreenManagerProxy <https://webkit.org/b/212392> <rdar://problem/61799040> Reviewed by Youenn Fablet. Switch from uint64_t to WebKit::PlaybackSessionContextIdentifier for contextId values. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): - Add WebKit::PlaybackSessionContextIdentifier to list. * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: (WebKit::PlaybackSessionManagerProxy::controlsManagerContextId const): * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionManagerProxy::createModelAndInterface): (WebKit::PlaybackSessionManagerProxy::ensureModelAndInterface): (WebKit::PlaybackSessionManagerProxy::ensureModel): (WebKit::PlaybackSessionManagerProxy::ensureInterface): (WebKit::PlaybackSessionManagerProxy::addClientForContext): (WebKit::PlaybackSessionManagerProxy::removeClientForContext): (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID): (WebKit::PlaybackSessionManagerProxy::clearPlaybackControlsManager): (WebKit::PlaybackSessionManagerProxy::currentTimeChanged): (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged): (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged): (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged): (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged): (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged): (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged): (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged): (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged): (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged): (WebKit::PlaybackSessionManagerProxy::mutedChanged): (WebKit::PlaybackSessionManagerProxy::volumeChanged): (WebKit::PlaybackSessionManagerProxy::durationChanged): (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged): (WebKit::PlaybackSessionManagerProxy::rateChanged): (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged): (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const): (WebKit::PlaybackSessionManagerProxy::play): (WebKit::PlaybackSessionManagerProxy::pause): (WebKit::PlaybackSessionManagerProxy::togglePlayState): (WebKit::PlaybackSessionManagerProxy::beginScrubbing): (WebKit::PlaybackSessionManagerProxy::endScrubbing): (WebKit::PlaybackSessionManagerProxy::seekToTime): (WebKit::PlaybackSessionManagerProxy::fastSeek): (WebKit::PlaybackSessionManagerProxy::beginScanningForward): (WebKit::PlaybackSessionManagerProxy::beginScanningBackward): (WebKit::PlaybackSessionManagerProxy::endScanning): (WebKit::PlaybackSessionManagerProxy::selectAudioMediaOption): (WebKit::PlaybackSessionManagerProxy::selectLegibleMediaOption): (WebKit::PlaybackSessionManagerProxy::togglePictureInPicture): (WebKit::PlaybackSessionManagerProxy::toggleMuted): (WebKit::PlaybackSessionManagerProxy::setMuted): (WebKit::PlaybackSessionManagerProxy::setVolume): (WebKit::PlaybackSessionManagerProxy::setPlayingOnSecondScreen): - Remove MESSAGE_CHECK_CONTEXTID() since it is now redundant. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext): (WebKit::VideoFullscreenManagerProxy::requestRouteSharingPolicyAndContextUID): (WebKit::VideoFullscreenManagerProxy::createModelAndInterface): (WebKit::VideoFullscreenManagerProxy::ensureModelAndInterface): (WebKit::VideoFullscreenManagerProxy::ensureModel): (WebKit::VideoFullscreenManagerProxy::ensureInterface): (WebKit::VideoFullscreenManagerProxy::findInterface): (WebKit::VideoFullscreenManagerProxy::addClientForContext): (WebKit::VideoFullscreenManagerProxy::removeClientForContext): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setHasVideo): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): (WebKit::VideoFullscreenManagerProxy::setInlineRect): (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): (WebKit::VideoFullscreenManagerProxy::requestFullscreenMode): (WebKit::VideoFullscreenManagerProxy::requestUpdateInlineRect): (WebKit::VideoFullscreenManagerProxy::requestVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::returnVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::didSetupFullscreen): (WebKit::VideoFullscreenManagerProxy::willExitFullscreen): (WebKit::VideoFullscreenManagerProxy::didExitFullscreen): (WebKit::VideoFullscreenManagerProxy::didEnterFullscreen): (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::setVideoLayerFrame): (WebKit::VideoFullscreenManagerProxy::setVideoLayerGravity): (WebKit::VideoFullscreenManagerProxy::fullscreenModeChanged): (WebKit::VideoFullscreenManagerProxy::fullscreenMayReturnToInline): - Remove MESSAGE_CHECK_CONTEXTID() since it is now redundant. * WebKit.xcodeproj/project.pbxproj: - Add PlaybackSessionContextIdentifier.h to the project. * WebProcess/cocoa/PlaybackSessionContextIdentifier.h: Add. * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.messages.in: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext): (WebKit::PlaybackSessionManager::createModelAndInterface): (WebKit::PlaybackSessionManager::ensureModelAndInterface): (WebKit::PlaybackSessionManager::ensureModel): (WebKit::PlaybackSessionManager::ensureInterface): (WebKit::PlaybackSessionManager::removeContext): (WebKit::PlaybackSessionManager::addClientForContext): (WebKit::PlaybackSessionManager::removeClientForContext): (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager): (WebKit::PlaybackSessionManager::clearPlaybackControlsManager): (WebKit::PlaybackSessionManager::contextIdForMediaElement): (WebKit::PlaybackSessionManager::durationChanged): (WebKit::PlaybackSessionManager::currentTimeChanged): (WebKit::PlaybackSessionManager::bufferedTimeChanged): (WebKit::PlaybackSessionManager::playbackStartedTimeChanged): (WebKit::PlaybackSessionManager::rateChanged): (WebKit::PlaybackSessionManager::seekableRangesChanged): (WebKit::PlaybackSessionManager::canPlayFastReverseChanged): (WebKit::PlaybackSessionManager::audioMediaSelectionOptionsChanged): (WebKit::PlaybackSessionManager::legibleMediaSelectionOptionsChanged): (WebKit::PlaybackSessionManager::externalPlaybackChanged): (WebKit::PlaybackSessionManager::audioMediaSelectionIndexChanged): (WebKit::PlaybackSessionManager::legibleMediaSelectionIndexChanged): (WebKit::PlaybackSessionManager::wirelessVideoPlaybackDisabledChanged): (WebKit::PlaybackSessionManager::mutedChanged): (WebKit::PlaybackSessionManager::volumeChanged): (WebKit::PlaybackSessionManager::isPictureInPictureSupportedChanged): (WebKit::PlaybackSessionManager::play): (WebKit::PlaybackSessionManager::pause): (WebKit::PlaybackSessionManager::togglePlayState): (WebKit::PlaybackSessionManager::beginScrubbing): (WebKit::PlaybackSessionManager::endScrubbing): (WebKit::PlaybackSessionManager::seekToTime): (WebKit::PlaybackSessionManager::fastSeek): (WebKit::PlaybackSessionManager::beginScanningForward): (WebKit::PlaybackSessionManager::beginScanningBackward): (WebKit::PlaybackSessionManager::endScanning): (WebKit::PlaybackSessionManager::selectAudioMediaOption): (WebKit::PlaybackSessionManager::selectLegibleMediaOption): (WebKit::PlaybackSessionManager::handleControlledElementIDRequest): (WebKit::PlaybackSessionManager::togglePictureInPicture): (WebKit::PlaybackSessionManager::toggleMuted): (WebKit::PlaybackSessionManager::setMuted): (WebKit::PlaybackSessionManager::setVolume): (WebKit::PlaybackSessionManager::setPlayingOnSecondScreen): (WebKit::nextContextId): Delete. - Replace with PlaybackSessionContextIdentifier::generate(). * WebProcess/cocoa/VideoFullscreenManager.h: (WebKit::VideoFullscreenInterfaceContext::create): * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext): (WebKit::VideoFullscreenManager::createModelAndInterface): (WebKit::VideoFullscreenManager::ensureModelAndInterface): (WebKit::VideoFullscreenManager::ensureModel): (WebKit::VideoFullscreenManager::ensureInterface): (WebKit::VideoFullscreenManager::removeContext): (WebKit::VideoFullscreenManager::addClientForContext): (WebKit::VideoFullscreenManager::removeClientForContext): (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): (WebKit::VideoFullscreenManager::hasVideoChanged): (WebKit::VideoFullscreenManager::videoDimensionsChanged): (WebKit::VideoFullscreenManager::requestFullscreenMode): (WebKit::VideoFullscreenManager::fullscreenModeChanged): (WebKit::VideoFullscreenManager::requestUpdateInlineRect): (WebKit::VideoFullscreenManager::requestVideoContentLayer): (WebKit::VideoFullscreenManager::returnVideoContentLayer): (WebKit::VideoFullscreenManager::didSetupFullscreen): (WebKit::VideoFullscreenManager::willExitFullscreen): (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didExitFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): (WebKit::VideoFullscreenManager::setVideoLayerGravityEnum): (WebKit::VideoFullscreenManager::fullscreenMayReturnToInline): (WebKit::VideoFullscreenManager::requestRouteSharingPolicyAndContextUID): (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced): 2020-06-24 Alex Christensen <achristensen@webkit.org> REGRESSION(r262341) Use UTF-8 to decode CFURLRefs from IPC https://bugs.webkit.org/show_bug.cgi?id=213565 <rdar://problem/64408924> Reviewed by Darin Adler. My assumption that all valid CFURLRefs are ASCII was incorrect. Some of them are UTF-8 encoded non-ASCII. Using kCFStringEncodingUTF8 covers both. Test: fast/url/navigate-non-ascii.html * Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): 2020-06-24 Umar Iqbal <uiqbal@apple.com> We should resurrect the older patch that collects some statistics of web API calls https://bugs.webkit.org/show_bug.cgi?id=213319 Reviewed by Brent Fulgham. + Enabled ENABLE_WEB_API_STATISTICS flag + Removed .string() from mainFrameRegistrableDomain to append it to topFrameRegistrableDomainsWhichAccessedWebAPIs because topFrameRegistrableDomainsWhichAccessedWebAPIs is a HashSet of WebCore::RegistrableDomain * Configurations/FeatureDefines.xcconfig: * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::logFontLoad): (WebKit::WebResourceLoadObserver::logCanvasRead): (WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure): (WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed): (WebKit::WebResourceLoadObserver::logScreenAPIAccessed): 2020-06-24 Andy Estes <aestes@apple.com> [iOS] Open element actions sometimes result in a hover instead of a click https://bugs.webkit.org/show_bug.cgi?id=213530 <rdar://problem/64176707> Reviewed by Darin Adler. _WKElementAction implements a standard action handler for _WKElementActionTypeOpen that attempts a synthetic click at the interaction location, expecting this click to start a navigation to the interaction node's target URL. Synthetic clicks are subject to content change observing, however, and if ContentChangeObserver detects a meaningful visible change after dispatching a mousemove event at the interaction location then WebPage will refrain from dispatching the mousedown and mouseup events that would have started a navigation. While this behavior is necessary to support hover menus, it doesn't make sense when the user is interacting with a context menu. Since the system might display a preview of the target URL found at the interaction location, users expect the "Open" action to navigate to that same URL rather than merely display a hover menu. This change opts synthetic clicks from the open action out of content change observing by ensuring that an interaction is started when handling _WKElementActionTypeOpen (like we do for "Copy" and "Save Image"), then checking if WebPage::m_interactionNode matches the node found in WebPage::attemptSyntheticClick. If it does, WebPage now bypasses content change observing and completes a synthetic click. New API test: ElementActionTests.OpenLinkWithHoverMenu * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): Changed to call -[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:] in the handlers for _WKElementActionTypeCopy, _WKElementActionTypeOpen, _WKElementActionTypeSaveImage, and _WKElementActionTypeShare. * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): Added to handle the subset of standard element actions that flow through WKActionSheetAssistantDelegate. Used a boolean parameter to decide whether the delegate should start and stop an interaction when handling the action. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _highlightLongPressRecognized:]): (-[WKContentView actionSheetAssistant:openElementAtLocation:]): Renamed -_attemptClickAtLocation:modifierFlags: to -_attemptSyntheticClickAtLocation:modifierFlags:. (-[WKContentView _attemptSyntheticClickAtLocation:modifierFlags:]): Changed to call WebPageProxy::attemptSyntheticClick instead of WebPageProxy::handleTap. (-[WKContentView _simulateElementAction:atLocation:]): Set _layerTreeTransactionIdAtLastInteractionStart to better simulate context menu interactions. * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::attemptSyntheticClick): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::attemptSyntheticClick): Renamed handleTap to attemptSyntheticClick. If the node responding to clicks matches the node found on interaction start (m_interactionNode), call WebPage::completeSyntheticClick directly. 2020-06-24 Tim Horton <timothy_horton@apple.com> Fix the build once RBSProcessLimitations.h is introduced https://bugs.webkit.org/show_bug.cgi?id=213562 Reviewed by Wenson Hsieh. * Platform/spi/ios/RunningBoardServicesSPI.h: We can't forward-declare Objective-C SPI if it actually exists without inspiring duplicate definition errors. 2020-06-24 Alex Christensen <achristensen@webkit.org> Remove now-invalid assertion after r263441 https://bugs.webkit.org/show_bug.cgi?id=213527 The alternative service storage directory is now null when HTTP/3 is disabled, not just in private browsing. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 2020-06-24 Jer Noble <jer.noble@apple.com> REGRESSION (r263328): Crash in bool WTF::WeakHashSet<WebKit::AudioSessionRoutingArbitratorProxy, WTF::EmptyCounter>::contains<WebKit::AudioSessionRoutingArbitratorProxy> const https://bugs.webkit.org/show_bug.cgi?id=213526 <rdar://problem/64591777> Reviewed by Eric Carlson. Clear the m_routingArbitrator before WebProcessPool::disconnectProcess(), not after. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): 2020-06-24 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Update OptionsGTK.cmake and NEWS for 2.29.2 release * gtk/NEWS: Add release notes for 2.29.2. 2020-06-24 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Add API to allow applications to handle the HTTP authentication credential storage https://bugs.webkit.org/show_bug.cgi?id=213177 Reviewed by Michael Catanzaro. Add API to disable the internal credential storage support when building with libsecret. And add new API to WebKitAuthenticationRequest to allow applications to use their own credentials storage: * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::persistentCredentialStorageEnabled const): (WebKit::NetworkDataTaskSoup::authenticate): (WebKit::NetworkDataTaskSoup::continueAuthenticate): (WebKit::NetworkDataTaskSoup::didGetHeaders): * NetworkProcess/soup/NetworkDataTaskSoup.h: * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::setPersistentCredentialStorageEnabled): * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::NetworkSessionSoup): * NetworkProcess/soup/NetworkSessionSoup.h: * UIProcess/API/glib/WebKitAuthenticationRequest.cpp: (webkitAuthenticationRequestDispose): (webkit_authentication_request_class_init): (webkitAuthenticationRequestCreate): (webkitAuthenticationRequestDidAuthenticate): (webkitAuthenticationRequestGetProposedCredential): (webkit_authentication_request_can_save_credentials): (webkit_authentication_request_set_can_save_credentials): (webkit_authentication_request_get_proposed_credential): (webkit_authentication_request_set_proposed_credential): (webkit_authentication_request_authenticate): (webkit_authentication_request_cancel): * UIProcess/API/glib/WebKitAuthenticationRequestPrivate.h: * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewCompleteAuthenticationRequest): (webkitWebViewLoadChanged): (webkitWebViewLoadFailed): (webkitWebViewLoadFailedWithTLSErrors): (webkitWebViewHandleAuthenticationChallenge): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkit_website_data_manager_set_persistent_credential_storage_enabled): (webkit_website_data_manager_get_persistent_credential_storage_enabled): * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: (webkitAuthenticationDialogInitialize): * UIProcess/API/gtk/WebKitAuthenticationRequest.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitAuthenticationRequest.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::persistentCredentialStorageEnabled const): * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: (WebKit::WebsiteDataStore::platformSetNetworkParameters): (WebKit::WebsiteDataStore::setPersistentCredentialStorageEnabled): * UIProcess/soup/WebProcessPoolSoup.cpp: (WebKit::WebProcessPool::platformInitializeNetworkProcess): 2020-06-24 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Do not set the default configuration again when creating the WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=213340 Reviewed by Michael Catanzaro. WebsiteDataStoreConfiguration already initializes on construction with the default paths, so we only need to override the ones set by the user. * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetDataStore): 2020-06-23 Alex Christensen <achristensen@webkit.org> Make HTTP/3 experimental feature work on iOS and only create storage directory if enabled https://bugs.webkit.org/show_bug.cgi?id=213527 Reviewed by Geoffrey Garen. Reading the experimental feature wasn't working on iOS because the user defaults prefix is different. Also, only resolve and create the directory if it is enabled. This should help with startup time, which has to wait for all directories to be resolved and created. See rdar://problem/64263228 which this should help with. We also respect the system default unless explicitly turned on, which should make it easier for CFNetwork to change things. I added an API test that verifies that the default alt-svc storage directory is not created when we don't want it to be. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): (WebKit::WebsiteDataStore::http3Enabled): 2020-06-23 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r244633): Mail flashes when copying text in an email https://bugs.webkit.org/show_bug.cgi?id=213529 <rdar://problem/55025522> Reviewed by Tim Horton. When copying a text selection in Mail conversation view, Mail uses injected bundle hooks to supply additional metadata before writing to the pasteboard. Grabbing this data involves temporarily expanding any collapsed blockquotes that appear in the mail message, before re-collapsing them after we finish gathering data to be written to the pasteboard. Prior to r244633, the size of the document while expanding collapsed content would not be propagated to the WKWebView, since intrinsic content size changes were batched and sent ahead of the next drawing area flush. After r244633, however, updates are now sent every time the layout size changes. This was done to ensure that the intrinsic content size was always up to date before sending the first layout milestone to the UI process. To preserve the intent of r244633 (with respect to the first layout milestone) as well as intrinsic content size behavior prior to r244633 after performing layout, we reintroduce the mechanism for batching intrinsic size updates until the next flush, but keep the out-of-band mechanism for immediately sending an up-to-date intrinsic size to the UI process before firing the first layout milestone. Test: WebKit.AutoLayoutBatchesUpdatesWhenInvalidatingIntrinsicContentSize * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::intrinsicContentsSizeChanged const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded): If we have a pending intrinsic content size update, clear it out here so that an out-of-band call to updateIntrinsicContentSizeIfNeeded doesn't get overridden by an older intrinsic content size that was previously scheduled. (WebKit::WebPage::flushPendingIntrinsicContentSizeUpdate): Add a helper method to send any pending intrinsic content size update. (WebKit::WebPage::scheduleIntrinsicContentSizeUpdate): Add a helper method to schedule an intrinsic content size update for the next tiled drawing area flush. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): 2020-06-23 Andy Estes <aestes@apple.com> [Apple Pay] WebPaymentCoordinatorProxy can be destroyed without dismissing its authorization presenter https://bugs.webkit.org/show_bug.cgi?id=213423 <rdar://problem/60416221> Reviewed by Youenn Fablet. When a website completes a payment session, WebPaymentCoordinatorProxy would set its m_state to Idle by calling didReachFinalState, but would wait to call hidePaymentUI until the payment authorization presenter calls its presenterDidFinish callback. This allows the presenter to display a final message to the user before dismissing. As a catch-all, ~WebPaymentCoordinatorProxy would call hidePaymentUI, but only if m_state wasn't Idle. If a WebPaymentCoordinatorProxy was destroyed after a website completed a payment session but before the presenter called presenterDidFinish, hidePaymentUI would never be called. This patch addresses this by simplifying the logic for completing or canceling a payment session. It's based on the following observations: 1. With the exception of the case described above, every caller of didReachFinalState would also call hidePaymentUI immediately beforehand. That means that we can move the calls to hidePaymentUI inside didReachFinalState. For the completePaymentSession case, rather than call didReachFinalState without dismissing the UI, we enter a new Completing state, then call didReachFinalState either in ~WebPaymentCoordinatorProxy or presenterDidFinish. 2. didCancelPaymentSession is really a special case of didReachFinalState that also sends the DidCancelPaymentSession message to cancel active sessions in the web process. We can teach didReachFinalState to send this message when necessary and remove didCancelPaymentSession. 3. PaymentAuthorizationPresenter stored a "did reach final state" boolean on payment completion and passed this value back to the client in the presenterDidFinish callback. WebPaymentCoordinatorProxy used this to determine whether to cancel an active session by calling didCancelPaymentSession or clean up a completed session by calling hidePaymentUI. With the addition of the Completing state and the merging of didCancelPaymentSession and hidePaymentUI into didReachFinalState, we can get rid of this final state tracking in PaymentAuthorizationPresenter and unconditionally call didReachFinalState in the presenterDidFinish callback. No new tests possible. A manual test case is described in <rdar://problem/60416221>. * Platform/cocoa/PaymentAuthorizationPresenter.h: Removed the didReachFinalState argument from Client::presenterDidFinish. * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Changed to call -[WKPaymentAuthorizationDelegate completePaymentSession:errors:]. * Platform/cocoa/WKPaymentAuthorizationDelegate.h: * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Removed the _didReachFinalState ivar. (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:]): Renamed from -completePaymentSession:errors:didReachFinalState:. Stopped setting _didReachFinalState. (-[WKPaymentAuthorizationDelegate invalidate]): Changed to call -completePaymentSession:errors:. (-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Ditto. (-[WKPaymentAuthorizationDelegate _didFinish]): Stopped passing the value of _didReachFinalState to PaymentAuthorizationPresenter::Client::presenterDidFinish. (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Renamed to -completePaymentSession:errors:. * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Replaced calls to didCancelPaymentSession with didReachFinalState. (WebKit::WebPaymentCoordinatorProxy::completePaymentSession): Set m_state to Completing rather than call didReachFinalState. (WebKit::WebPaymentCoordinatorProxy::abortPaymentSession): Removed call to hidePaymentUI since didReachFinalState was already being called. (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Replaced call to didCancelPaymentSession with didReachFinalState. (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Called didReachFinalState unconditionally now that the didReachFinalState boolean has been removed. (WebKit::WebPaymentCoordinatorProxy::canBegin const): Returned false for State::Completing. (WebKit::WebPaymentCoordinatorProxy::canCancel const): Ditto. (WebKit::WebPaymentCoordinatorProxy::canCompletePayment const): Ditto. (WebKit::WebPaymentCoordinatorProxy::canAbort const): Ditto. (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Added an early return if m_state is already Idle. Sent the DidCancelPaymentSession message if canCancel is true. Called platformHidePaymentUI before clearing m_authorizationPresenter and setting m_state to Idle. (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Deleted. * Shared/ApplePay/WebPaymentCoordinatorProxy.h: (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Added a PaymentSessionError&& arg. (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Deleted. * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Replaced call to hidePaymentUI with didReachFinalState. * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: (WebKit::WebPaymentCoordinatorProxy::platformHidePaymentUI): Renamed from hidePaymentUI. Stopped clearing m_authorizationPresenter since didReachFinalState now does that. (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Renamed to platformHidePaymentUI. * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Removed call to hidePaymentUI since didReachFinalState was already being called. (WebKit::WebPaymentCoordinatorProxy::platformHidePaymentUI): Renamed from hidePaymentUI. Stopped clearing m_authorizationPresenter since didReachFinalState now does that. (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Renamed to platformHidePaymentUI. 2020-06-23 Chris Dumez <cdumez@apple.com> Remove a lot of unnecessary calls to Ref::copyRef() https://bugs.webkit.org/show_bug.cgi?id=213533 Reviewed by Darin Adler. Remove a lot of unnecessary calls to Ref::copyRef() now that Ref is copyable. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::requestResource): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::CompletionHandler<void): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess): (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal): (WebKit::ResourceLoadStatisticsMemoryStore::clear): (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::removeDataRecords): (WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData): (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains): (WebKit::ResourceLoadStatisticsStore::removeAllStorageAccess): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::loadPing): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): (WebKit::NetworkProcess::renameOriginInWebsiteData): * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::readCachesFromDisk): (WebKit::CacheStorage::Engine::fetchDirectoryEntries): (WebKit::CacheStorage::Engine::clearAllCaches): (WebKit::CacheStorage::Engine::clearCachesForOrigin): (WebKit::CacheStorage::Engine::clearCachesForOriginFromDirectories): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::clearDiskCache): * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::clearDiskCache): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsResetToConsistentState): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _takeViewSnapshot]): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::resolveChildFrameHandle): (WebKit::WebAutomationSession::resolveParentFrameHandle): (WebKit::WebAutomationSession::computeElementLayout): (WebKit::WebAutomationSession::selectOptionElement): (WebKit::WebAutomationSession::setFilesForInputFileUpload): (WebKit::WebAutomationSession::getAllCookies): (WebKit::WebAutomationSession::deleteSingleCookie): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::performMouseInteraction): (WebKit::WebAutomationSession::takeScreenshot): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handleSynchronousMessage): (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): (WebKit::WebProcessPool::seedResourceLoadStatisticsForTesting): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setMaxStatisticsEntries): (WebKit::WebsiteDataStore::setPruneEntriesDownTo): (WebKit::WebsiteDataStore::setGrandfatheringTime): (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval): (WebKit::WebsiteDataStore::setPrevalentResource): (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode): (WebKit::WebsiteDataStore::setVeryPrevalentResource): (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): (WebKit::WebsiteDataStore::setSubframeUnderTopFrameDomain): (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameDomain): (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo): (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom): (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo): (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom): (WebKit::WebsiteDataStore::clearPrevalentResource): (WebKit::WebsiteDataStore::resetParametersToDefaultValues): (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent): (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary): (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate): (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing): (WebKit::WebsiteDataStore::setLastSeen): (WebKit::WebsiteDataStore::mergeStatisticForTesting): (WebKit::WebsiteDataStore::insertExpiredStatisticForTesting): (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned): (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest): (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured): (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction): (WebKit::WebsiteDataStore::logUserInteraction): (WebKit::WebsiteDataStore::clearUserInteraction): (WebKit::WebsiteDataStore::setGrandfathered): (WebKit::WebsiteDataStore::setUseITPDatabase): (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting): (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting): (WebKit::WebsiteDataStore::deleteCookiesForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting): (WebKit::WebsiteDataStore::setThirdPartyCookieBlockingMode): (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldEnbleSameSiteStrictEnforcementForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting): (WebKit::WebsiteDataStore::setResourceLoadStatisticsToSameSiteStrictCookiesForTesting): (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources): (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode): (WebKit::WebsiteDataStore::resetQuota): (WebKit::WebsiteDataStore::clearAppBoundSession): (WebKit::WebsiteDataStore::renameOriginInWebsiteData): (WebKit::WebsiteDataStore::forwardAppBoundDomainsToITPIfInitialized): (WebKit::WebsiteDataStore::setAppBoundDomainsForITP): (WebKit::WebsiteDataStore::updateBundleIdentifierInNetworkProcess): (WebKit::WebsiteDataStore::clearBundleIdentifierInNetworkProcess): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::markAllLayersVolatile): 2020-06-23 Fujii Hironori <Hironori.Fujii@sony.com> [curl] Unreviewed build fix for r263407 https://bugs.webkit.org/show_bug.cgi?id=213409 <rdar://problem/64654646> * NetworkProcess/curl/NetworkDataTaskCurl.h: Include <wtf/MonotonicTime.h>. 2020-06-23 Alex Christensen <achristensen@webkit.org> Expose already-available WKNavigationAction.request.HTTPBody through the API https://bugs.webkit.org/show_bug.cgi?id=179077 Reviewed by Brady Eidson. When this bug was written, we needed to serialize the HTTP body to the UI process to expose it through the API. The controversial part of this was done in r237639, so this just exposes the data that is already available. Verified by an API test. * UIProcess/API/Cocoa/WKNavigationAction.mm: (-[WKNavigationAction request]): 2020-06-23 Alex Christensen <achristensen@webkit.org> Remove unnecessary Timer from NetworkDataTask https://bugs.webkit.org/show_bug.cgi?id=213409 Reviewed by Youenn Fablet. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::NetworkDataTask): (WebKit::NetworkDataTask::scheduleFailure): (WebKit::NetworkDataTask::failureTimerFired): Deleted. * NetworkProcess/NetworkDataTask.h: * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::resume): * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::resume): 2020-06-22 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Add API to configure and handle DOM cache to WebKitWebsiteDataManager https://bugs.webkit.org/show_bug.cgi?id=213337 Reviewed by Adrian Perez de Castro. The default path is always used even for apps setting a base data directory. We should handle WebsiteDataType::DOMCache to configure the directory and allow to fetch and clear it. * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): (toWebKitWebsiteDataTypes): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetProperty): (webkitWebsiteDataManagerSetProperty): (webkitWebsiteDataManagerConstructed): (webkit_website_data_manager_class_init): (webkitWebsiteDataManagerGetDataStore): (webkit_website_data_manager_get_dom_cache_directory): (toWebsiteDataTypes): * UIProcess/API/gtk/WebKitWebsiteData.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebsiteData.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID): GTK and WPE ports don't use the default website data store, so only use it when it already exists. Use the process pool website data store instead. 2020-06-22 John Wilander <wilander@apple.com> Storage Access API: Add the capability to call the Storage Access API as a quirk, on behalf of websites that should be doing it themselves https://bugs.webkit.org/show_bug.cgi?id=213418 <rdar://problem/64549429> Reviewed by Alex Christensen. These changes are for forwarding ITP's knowledge of user interaction for specific quirks domains to the WebKit::WebProcessPool where it in turn can be distributed to all existing and new Web Content processes. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::needsUserInteractionQuirk const): (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * Shared/WebProcessDataStoreParameters.h: (WebKit::WebProcessDataStoreParameters::encode const): (WebKit::WebProcessDataStoreParameters::decode): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setDomainsWithUserInteraction): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::webProcessDataStoreParameters): (WebKit::WebProcessPool::setDomainsWithUserInteraction): * UIProcess/WebProcessPool.h: * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::hasHadUserInteraction const): * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setWebsiteDataStoreParameters): (WebKit::WebProcess::setDomainsWithUserInteraction): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-06-22 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] WebPageProxy::setPromisedDataForImage should sanitize its filename https://bugs.webkit.org/show_bug.cgi?id=213486 <rdar://problem/56522262> Reviewed by Megan Gardner. Ensure that the filename passed into WebPageProxy::setPromisedDataForImage is sanitized in the UI process prior to being used as a suggested filename when writing a dragged image to the pasteboard. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::setPromisedDataForImage): 2020-06-22 Tim Horton <timothy_horton@apple.com> WebEx can not share video from Safari on arm64 https://bugs.webkit.org/show_bug.cgi?id=213481 Reviewed by Dean Jackson. * UIProcess/UserMediaProcessManager.cpp: (WebKit::needsAppleCameraService): (WebKit::UserMediaProcessManager::willCreateMediaStream): (WebKit::UserMediaProcessManager::revokeSandboxExtensionsIfNeeded): Pass sandbox extension for "com.apple.applecamerad" to the Web Content process after the user allows camera access, when running on hardware which requires it. * WebProcess/com.apple.WebProcess.sb.in: Make it possible to dynamically extend the sandbox as above. 2020-06-22 Tim Horton <timothy_horton@apple.com> Cannot play back encrypted media on arm64 https://bugs.webkit.org/show_bug.cgi?id=213483 Reviewed by Jer Noble and Per Arne Vollan. * WebProcess/com.apple.WebProcess.sb.in: Extend the sandbox as necessary for encrypted media support. 2020-06-22 Michael Catanzaro <mcatanzaro@gnome.org> [WPE][GTK] Public API should not allow trying to register a special URI scheme https://bugs.webkit.org/show_bug.cgi?id=209900 <rdar://problem/61200217> Reviewed by Adrian Perez de Castro Epiphany prior to 3.36 registers a scheme handler for ftp. This introduced criticals. Let's use g_warning() instead, and avoid hardcoding the list of disallowed schemes. * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_register_uri_scheme): 2020-06-22 Tim Horton <timothy_horton@apple.com> dlopen() always fails on arm64, cannot load soft-linked libraries https://bugs.webkit.org/show_bug.cgi?id=213480 Reviewed by Alexey Proskuryakov and Per Arne Vollan. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): Expose the auxiliary process' CPU family as a parameter to the sandbox profile, so that it can be used to predicate sandbox expressions. * WebProcess/com.apple.WebProcess.sb.in: Allow mremap_encrypted from the Web Content process, because the arm64 dlopen() needs it. 2020-06-22 Tim Horton <timothy_horton@apple.com> Update macOS version macros https://bugs.webkit.org/show_bug.cgi?id=213484 Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/Version.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2020-06-22 Tim Horton <timothy_horton@apple.com> sysctl() fails due to sandbox violation https://bugs.webkit.org/show_bug.cgi?id=213482 Reviewed by Maciej Stachowiak. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: Extend the sandbox as necessary to make sysctl calls work. 2020-06-22 Antoine Quint <graouts@webkit.org> WebKit fails to leave audio routing arbitration during navigation, closing. https://bugs.webkit.org/show_bug.cgi?id=213426 <rdar://problem/64395051> Unreviewed build fix for an unannotated switch fall-through between switch labels. * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _audioRoutingArbitrationStatus]): 2020-06-21 Jer Noble <jer.noble@apple.com> WebKit fails to leave audio routing arbitration during navigation, closing. https://bugs.webkit.org/show_bug.cgi?id=213426 <rdar://problem/64395051> Reviewed by Eric Carlson. Add testing SPIs to verify whether a WebPage successfully entered or left audio routing arbitration. Notify the Arbitration proxy when the page is shut down, which ensures arbitration will end if the client closes the WKWebView. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _audioRoutingArbitrationStatus]): * UIProcess/API/mac/WKWebViewTestingMac.mm: * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: (WebKit::AudioSessionRoutingArbitratorProxy::arbitrationStatus const): * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate): (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory): (WebKit::AudioSessionRoutingArbitratorProxy::endRoutingArbitration): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::audioSessionRoutingArbitrator): 2020-06-21 Michael Catanzaro <mcatanzaro@gnome.org> [WPE][GTK] Specify underlying storage type for InputMethodState::Hint https://bugs.webkit.org/show_bug.cgi?id=213401 Reviewed by Carlos Garcia Campos. Using unsigned types for flags enums seems nice to do. * Shared/glib/InputMethodState.h: 2020-06-21 Michael Catanzaro <mcatanzaro@gnome.org> [WPE][GTK] Add autocleanup for WebKitWebsitePolicies https://bugs.webkit.org/show_bug.cgi?id=213399 Reviewed by Carlos Garcia Campos. Add missing autocleanups. * UIProcess/API/gtk/WebKitAutocleanups.h: * UIProcess/API/wpe/WebKitAutocleanups.h: 2020-06-20 Jiewen Tan <jiewen_tan@apple.com> [AppSSO] Should do null check on m_page in dismissViewController() https://bugs.webkit.org/show_bug.cgi?id=213415 <rdar://problem/59672418> Reviewed by Alexey Proskuryakov. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::dismissViewController): 2020-06-20 Jer Noble <jer.noble@apple.com> RecoveryOS: PAL::getAVPlayerLayerClass() will crash when AVFoundation is missing https://bugs.webkit.org/show_bug.cgi?id=213437 <rdar://problem/64563064> Reviewed by Eric Carlson. Check PAL::isAVFoundationAvailable() before calling PAL::getAVPlayerLayerClass(); * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::clone const): 2020-06-20 Jer Noble <jer.noble@apple.com> REGRESSION(r259219): Sleep assertion remains active if WKWebView is closed or WebContent process crashes https://bugs.webkit.org/show_bug.cgi?id=213434 <rdar://problem/57541662> Reviewed by Eric Carlson. Tests: TestWebKitAPI tests: SleepDisabler.Basic SleepDisabler.Pause SleepDisabler.Mute SleepDisabler.Unmute SleepDisabler.DisableAudioTrack SleepDisabler.Loop SleepDisabler.ChangeSrc SleepDisabler.Load SleepDisabler.Unload SleepDisabler.Navigate SleepDisabler.NavigateBack SleepDisabler.Reload SleepDisabler.Close SleepDisabler.Crash Ensure the SleepDisablers are cleared when the WebProcess closes or crashes. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2020-06-20 Brent Fulgham <bfulgham@apple.com> [iOS, macOS] Allow access to the container manager to support Mail InjectedBundle https://bugs.webkit.org/show_bug.cgi?id=213357 <rdar://problem/63837247> Reviewed by Darin Adler. The Mail Injected Bundle requires access to the container manager to support certain OS operations. We do not need this access for web browsing, and should limit this access to this one case. This patch creates a dynamic mach extension to the container manager for this single use case. It also denies the non-extension access case with a backtrace so we can see if any other clients are hitting this. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * 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): * WebProcess/com.apple.WebProcess.sb.in: 2020-06-19 Chris Dumez <cdumez@apple.com> [Cocoa] Delay issuing ManagedSession & Network Extension sandbox extensions until a load is actually issued https://bugs.webkit.org/show_bug.cgi?id=213414 <rdar://problem/64548684> Reviewed by Per Arne Vollan. Delay issuing ManagedSession & Network Extension sandbox extensions until a load is actually issued. This is a Safari launch time optimization since the checks needed to decide whether or not to issue the extensions are expensive and there is no reason to issue them as soon as the process launches (especially in the case of a prewarmed process). * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::addPlatformLoadParameters): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::hasNetworkExtensionSandboxAccess const): (WebKit::WebProcessProxy::markHasNetworkExtensionSandboxAccess): (WebKit::WebProcessProxy::hasManagedSessionSandboxAccess const): (WebKit::WebProcessProxy::markHasManagedSessionSandboxAccess): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-06-19 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r263287. Caused tests to exit early with crashes on Catalina. Reverted changeset: "[iOS, macOS] Allow access to the container manager to support Mail InjectedBundle" https://bugs.webkit.org/show_bug.cgi?id=213357 https://trac.webkit.org/changeset/263287 2020-06-19 Chris Dumez <cdumez@apple.com> Crash under WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount() https://bugs.webkit.org/show_bug.cgi?id=213417 <rdar://problem/63477676> Reviewed by Darin Adler. Make sure |this| is still alive in ProcessAndUIAssertion::processAssertionWasInvalidated() after calling ProcessAssertion::processAssertionWasInvalidated() and before calling updateRunInBackgroundCount(). Calling ProcessAssertion::processAssertionWasInvalidated() notifies the client and the client may destroy the assertion as a result. * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated): 2020-06-19 Kate Cheney <katherine_cheney@apple.com> com.apple.WebKit.Networking crash: suspended with locked system files (observations.db) https://bugs.webkit.org/show_bug.cgi?id=213391 <rdar://problem/64494167> Reviewed by Chris Dumez. ITP is the only database that attempts to close when NetworkProcess::didClose() is called. This causes the network process to sometimes crash if the database is still closing when checking for locked system files. Instead, we should only flush the memory store to disk when calling NetworkProcess::didClose (in the memory store case), and only close the database when the network session is destroyed. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession): (WebKit::WebResourceLoadStatisticsStore::destroyResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: Split into two functions, one to flush and destroy the persistent store, and one to destroy the memory or database store. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): Only flush the persistent store here, as described above. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::flushAndDestroyPersistentStore): * NetworkProcess/NetworkSession.h: 2020-06-19 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Provide a _WKWebAuthenticationPanelUpdatePINInvalid update to UI clients if the returned PIN from the client is not valid https://bugs.webkit.org/show_bug.cgi?id=213404 <rdar://problem/64543894> Reviewed by Brent Fulgham. Provide a _WKWebAuthenticationPanelUpdatePINInvalid update to UI clients if the returned PIN from the client is not valid such that clients can reuse the same logic to handle invalid pin from the authenticator. This change makes their life easier. Covered by API tests. * UIProcess/API/APIWebAuthenticationPanelClient.h: (API::WebAuthenticationPanelClient::requestPin const): * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: (WebKit::WebAuthenticationPanelClient::requestPin const): Now, only null strings are intepreted as cancels. * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived): (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived): (WebKit::CtapAuthenticator::continueGetPinTokenAfterRequestPin): (WebKit::CtapAuthenticator::continueRequestAfterGetPinToken): This patch also removes potential null pointer dereferences. 2020-06-19 Per Arne Vollan <pvollan@apple.com> [macOS] Connections to the preference daemon are established before entering the sandbox https://bugs.webkit.org/show_bug.cgi?id=213379 Reviewed by Darin Adler. On macOS, connections to the preference daemon are established before entering the sandbox. These connections also persist after entering the sandbox and denying access to the preference daemon. There should not be attempts to connect to the preference daemon before entering the sandbox, since these attempts will not be stopped by the sandbox. This patch moves code that connects to the preference daemon to be executed after the sandbox has been entered. That includes code to prevent connections to the Dock and code to initialize WebKit logging. Also, instead of calling [NSBundle bundleForClass:], call [NSBundle bundleWithIdentifier:], since calling [NSBundle bundleForClass:] will connect to the preference daemon. Finally, allow the syscall SYS_gethostuuid, since that is needed by CoreFoundation when there is no access to the preference daemon. No new tests. This should be covered by existing tests. It would be nice to have a test to make sure that there are no connections to the preference daemon just before entering the sandbox, but I am not aware of how to implement this. * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::NetworkProcess::initializeSandbox): * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::initialize): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::webKit2Bundle): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2020-06-19 Chris Dumez <cdumez@apple.com> Avoid initializing RenderTheme singleton unnecessarily in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=213406 Reviewed by Per Arne Vollan. Avoid initializing RenderTheme singleton unnecessarily in the UIProcess. Instead, introduce a static function to get the focus ring color on iOS. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-06-19 Chris Dumez <cdumez@apple.com> Unreviewed build fix after r263288. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-06-19 Chris Dumez <cdumez@apple.com> Use ASCIILiteral more for SandboxExtension functions https://bugs.webkit.org/show_bug.cgi?id=213400 Reviewed by Per Arne Vollan. Use ASCIILiteral more for SandboxExtension functions. Functions like createHandleForMachLookup() / createHandleForIOKitClassExtension() don't need to take in Strings, ASCIILiteral is enough. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::createHandlesForResources): (WebKit::SandboxExtension::createReadOnlyHandlesForFiles): (WebKit::SandboxExtension::createHandleForGenericExtension): (WebKit::SandboxExtension::createHandleForMachLookup): (WebKit::SandboxExtension::createHandlesForMachLookup): (WebKit::SandboxExtension::createHandleForIOKitClassExtension): (WebKit::SandboxExtension::createHandlesForIOKitClassExtensions): * Shared/SandboxExtension.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::mediaRelatedMachServices): (WebKit::nonBrowserServices): (WebKit::diagnosticServices): (WebKit::agxCompilerClasses): (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::singleton): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon): (WebKit::WebPageProxy::creationParameters): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::grantAccessToAssetServices): 2020-06-19 Brent Fulgham <bfulgham@apple.com> [iOS, macOS] Allow access to the container manager to support Mail InjectedBundle https://bugs.webkit.org/show_bug.cgi?id=213357 <rdar://problem/63837247> Reviewed by Darin Adler. The Mail Injected Bundle requires access to the container manager to support certain OS operations. We do not need this access for web browsing, and should limit this access to this one case. This patch creates a dynamic mach extension to the container manager for this single use case. It also denies the non-extension access case with a backtrace so we can see if any other clients are hitting this. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * 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): * WebProcess/com.apple.WebProcess.sb.in: 2020-06-19 Andres Gonzalez <andresg_22@apple.com> AX: web process crash in AXObjectCache::postNotification. https://bugs.webkit.org/show_bug.cgi?id=213398 Reviewed by Chris Fleizach. AXObjectCache was being instantiated on the AX secondary thread. Therefore the timers for the different delayed notifications where initialized with the secondary thread. When postNotification was triggered on the main thread as it should, and the timer was accessed, the timer would assert/crash for being accessed in a thread different than where it was created. This change guaranties that AXObjectCache is always created on the main thread. * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm: (-[WKAccessibilityWebPageObjectBase axObjectCache]): (-[WKAccessibilityWebPageObjectBase accessibilityPluginObject]): (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]): (-[WKAccessibilityWebPageObjectBase setWebPage:]): (-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]): (-[WKAccessibilityWebPageObjectBase setRemoteParent:]): 2020-06-19 Chris Fleizach <cfleizach@apple.com> AX: Make isolated tree enablement status dependent on client preference https://bugs.webkit.org/show_bug.cgi?id=213355 <rdar://problem/64506577> Reviewed by Zalan Bujtas. We don't want the isolated tree mode in all clients (like Mail or Dictionary). As a result, we can set this setting to off and allow safari and mini browser turn on more directly. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setAccessibilityIsolatedTreeEnabled:]): (-[WKPreferences _accessibilityIsolatedTreeEnabled]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): (WebKit::InjectedBundle::setAccessibilityIsolatedTreeEnabled): * WebProcess/InjectedBundle/InjectedBundle.h: 2020-06-19 Rob Buis <rbuis@igalia.com> Enable referrer policy attribute support by default https://bugs.webkit.org/show_bug.cgi?id=213285 Reviewed by Youenn Fablet. Enable referrer policy attribute support by default by flipping the switch. * Shared/WebPreferences.yaml: 2020-06-19 Youenn Fablet <youenn@apple.com> LibWebRTCSocketClient::sendTo is too verbose in case of error https://bugs.webkit.org/show_bug.cgi?id=213380 Reviewed by Eric Carlson. Only log error message if the error code is different from the previous one. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::sendTo): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: 2020-06-19 Chris Dumez <cdumez@apple.com> Web Inspector: RemoteInspector::singleton() slows down MobileSafari launch https://bugs.webkit.org/show_bug.cgi?id=213381 <rdar://problem/64533003> Reviewed by Darin Adler. RemoteInspector::singleton() is expensive according to traces. It was called in WebProcessPool::initializeNewWebProcess() which happens on MobileSafari launch because we prewarm a WebProcess. However, there is no reason to initialize remote Web Inspector at this point. Per associated comment, Remote Web Inspector needs to be initialized once there is a sub process hosting one of our Web View. As a result, I moved the initialization call to WebPageProxy::initializeWebPage() which is when we actually send the IPC to the WebProcess to create the WebPage that is backing the UI-side WebView. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::initializeWebPage): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::initializeNewWebProcess): 2020-06-19 Chris Dumez <cdumez@apple.com> Move Prefixed WebAudio interfaces behind their own feature flag https://bugs.webkit.org/show_bug.cgi?id=213356 Reviewed by Darin Adler. * Shared/WebPreferences.yaml: 2020-06-19 Rob Buis <rbuis@igalia.com> Enable stale-while-revalidate support by default https://bugs.webkit.org/show_bug.cgi?id=213286 Reviewed by Youenn Fablet. Enable stale-while-revalidate support for Mac/GTK/WPE by changing the default to true. Note that platforms that do not support speculative loads, which s-w-r relies on, will not see any change in bahavior. * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 2020-06-19 Alexander Mikhaylenko <alexm@gnome.org> REGRESSION(r253360): [GTK] Page starts loading during animation in back/forward gesture https://bugs.webkit.org/show_bug.cgi?id=205650 Reviewed by Carlos Garcia Campos. r253360 changed the swipe gesture to start loading the page during the gesture, relying on freezing the layer tree state to prevent unwanted redraws. However, it was implemented for AC mode, but didn't prevent redraws in non-accelerated mode. Add a simple check to skip redraws in this case. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::display): Skip drawing if layer tree state is frozen. 2020-06-19 Carlos Garcia Campos <cgarcia@igalia.com> Add support for fetching registrable domains with resource load statistics https://bugs.webkit.org/show_bug.cgi?id=213291 Reviewed by Adrian Perez de Castro and Youenn Fablet. WebsiteDataStore::fetchData() doesn't return anything for resource load statistics because NetworkProcess::fetchWebsiteData() doesn't handle WebsiteDataType::ResourceLoadStatistics. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::allDomains const): Query all registrable domains from database. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::allDomains const): Return all registrable domains in memory map. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::registrableDomains): Get the list of registrable domains. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): Handle WebsiteDataType::ResourceLoadStatistics. * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::encode const): Encode registrableDomainsWithResourceLoadStatistics. (WebKit::WebsiteData::decode): Decode registrableDomainsWithResourceLoadStatistics. * Shared/WebsiteData/WebsiteData.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreRemoveITPDataForDomain): Use WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain() instead of the display name. * UIProcess/WebsiteData/WebsiteDataRecord.cpp: (WebKit::WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain): Add the given registrable domain to the list. * UIProcess/WebsiteData/WebsiteDataRecord.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::fetchDataAndApply): Handle registrable domains with resource load statistics. (WebKit::WebsiteDataStore::removeData): Use resourceLoadStatisticsRegistrableDomains instead of the display name. 2020-06-18 David Kilzer <ddkilzer@apple.com> Use fastMalloc/fastFree in WebCoreArgumentCodersMac.mm <https://webkit.org/b/213325> Reviewed by Darin Adler. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createArchiveList): (IPC::createCFURLRequestFromSerializableRepresentation): 2020-06-18 Tim Horton <timothy_horton@apple.com> Remove some vestiges of the 32-bit Plugin Process https://bugs.webkit.org/show_bug.cgi?id=213361 Reviewed by Dan Bernstein. We haven't launched 32-bit plugins for a while, but there are some build system complications and random references in the code that we can get rid of. * WebKit.xcodeproj/project.pbxproj: * Configurations/PluginService.xcconfig: Renamed from Source/WebKit/Configurations/PluginService.64.xcconfig. No need for .64 in the name anymore, since it's the only one. We do have to leave the .64 in the product name because there are other things in the system that depend on this. * PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.Info.plist: Renamed from Source/WebKit/PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.64.Info.plist. No need for .64 in the name anymore. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::getLaunchOptions): * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::serviceName): * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): There need only be one ProcessType for the plugin process now! * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp: (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bubblewrapSpawn): * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::ProcessLauncher::launchProcess): GTK WebKit appears to also only launch 64-bit plugin processes. 2020-06-18 Megan Gardner <megan_gardner@apple.com> Workaround for UIKit layout bug in time picker. https://bugs.webkit.org/show_bug.cgi?id=213346 <rdar://problem/64042277> Reviewed by Tim Horton. There is a bug in the layout of UIKit that needs to be fixed. Until then, this workaround should give us a view that is viable. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView resignFirstResponderForWebView]): * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimeContextMenuViewController preferredContentSize]): 2020-06-18 David Kilzer <ddkilzer@apple.com> [IPC hardening] OptionSet<> values should be validated <https://webkit.org/b/213199> <rdar://problem/64369963> Reviewed by Anders Carlsson. Summary: - Add WTF::EnumTraits<> for all OptionSet<> enums. - Specify unsigned backing types for enum classes. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSession.h: * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder<OptionSet<T>>::encode): (IPC::ArgumentCoder<OptionSet<T>>::decode): - Add WTF::isValidOptionSet() checks. * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.h: - Replace <wtf/EnumTraits.h> with <wtf/OptionSet.h> since the latter now includes the former. * Platform/IPC/MessageFlags.h: * Shared/DocumentEditingContext.h: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: * Shared/WebEvent.h: * Shared/WebsiteAutoplayQuirk.h: * Shared/WebsiteData/WebsiteData.h: * Shared/WebsiteData/WebsiteDataFetchOption.h: * Shared/WebsiteData/WebsiteDataType.h: * Shared/ios/GestureTypes.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessManager.h: * UIProcess/WebProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebProcess.h: 2020-06-18 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Add API to configure and handle service worker registrations to WebKitWebsiteDataManager https://bugs.webkit.org/show_bug.cgi?id=213290 Reviewed by Michael Catanzaro. The default path is always used even for apps setting a base data directory. We should handle WebsiteDataType::ServiceWorkerRegistrations to configure the directory and allow to fetch and clear them. * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): (toWebKitWebsiteDataTypes): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetProperty): (webkitWebsiteDataManagerSetProperty): (webkitWebsiteDataManagerConstructed): (webkit_website_data_manager_class_init): (webkitWebsiteDataManagerGetDataStore): (webkit_website_data_manager_get_service_worker_registrations_directory): (toWebsiteDataTypes): * UIProcess/API/gtk/WebKitWebsiteData.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebsiteData.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-06-18 Yuri Chornoivan <yurchor@ukr.net> Unreviewed. Fix a typo introduced in r263085 * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkit_website_data_manager_class_init): 2020-06-17 Chris Dumez <cdumez@apple.com> Add experimental feature flag for modern & unprefixed WebAudio API https://bugs.webkit.org/show_bug.cgi?id=213268 Reviewed by Jer Noble. Add experimental feature flag for modern & unprefixed WebAudio API, off by default. * Shared/WebPreferences.yaml: 2020-06-17 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Shift-tab in a bullet list in Mail Compose jumps back to Subject field https://bugs.webkit.org/show_bug.cgi?id=213320 <rdar://problem/63831962> Reviewed by Tim Horton. See WebCore/ChangeLog for more detail. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::handleKeyEventByRelinquishingFocusToChrome): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleEditingKeyboardEvent): Hoist logic for relinquishing focus as a result of shift+tab from EventHandler to WebPage, so that it is the default behavior when processing a "keypress" event that corresponds to shift+tab in an editable web view on Cocoa platforms. If we do end up relinquishing focus, then we consider the keypress event to be handled. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::handleEditingKeyboardEvent): 2020-06-17 Beth Dakin <bdakin@apple.com> Remove references to blacklist/whitelist in the old C API https://bugs.webkit.org/show_bug.cgi?id=213322 Reviewed by Tim Horton. * UIProcess/API/C/WKPageGroup.cpp: (WKPageGroupAddUserStyleSheet): (WKPageGroupAddUserScript): * UIProcess/API/C/WKPageGroup.h: * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: 2020-06-17 Alex Christensen <achristensen@webkit.org> Null check plugin.m_data before using it in PDFPlugin::ByteRangeRequest::completeUnconditionally https://bugs.webkit.org/show_bug.cgi?id=213305 <rdar://problem/60349279> Reviewed by Brady Eidson. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::ByteRangeRequest::completeUnconditionally): 2020-06-17 Darryl Pogue <darryl@dpogue.ca> IndexedDB: Support IDBFactory databases method https://bugs.webkit.org/show_bug.cgi?id=211043 Reviewed by Youenn Fablet. Plumbing for returning a list of IDB databases and versions. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::getAllDatabaseNamesAndVersions): (WebKit::WebIDBServer::getAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/IndexedDB/WebIDBServer.messages.in: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::getAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToServer::getAllDatabaseNames): Deleted. (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNames): Deleted. * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in: 2020-06-16 Simon Fraser <simon.fraser@apple.com> REGRESSION (r255037): Broken position while comparing watch bands on www.apple.com/shop/studio/apple-watch https://bugs.webkit.org/show_bug.cgi?id=213282 <rdar://problem/63862940> Reviewed by Antti Koivisto. If a scrolling tree commit has a requested scroll position update for a node, we need to call applyLayerPositons() to set the UIScrollView's contentOffset. Often the layer tree commit will contain a boundsOrigin change for the layer in question (which is equivalent to setting the UIScrollView's contentOffset), but some combinations of user and programmatic scrolling result in no boundsOrigin change, revealing the bug. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): 2020-06-16 Kate Cheney <katherine_cheney@apple.com> Check for inAppBrowserPrivacyEnabled flag in WebsiteDataStore::initializeAppBoundDomains is expensive and calls a non-static function WebsiteDataStore::parameters(). https://bugs.webkit.org/show_bug.cgi?id=213261 <rdar://problem/64317084> Reviewed by Brent Fulgham. There are two bugs here. First, WebsiteDataStore::parameters() does a lot of work aside from returning the parameters, making this an expensive call just to check the value of one flag. Second, appBoundDomains() is a static hashset, and initializing the hashset should not rely on non-static functions. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Remove flag, it is no longer used here. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): Save the flag value in a member variable so we can use that later when checking app-bound domains. Rename to something more descriptive. (WebKit::WebsiteDataStore::initializeAppBoundDomains): Remove the check for the non-static runtime flag. (WebKit::WebsiteDataStore::ensureAppBoundDomains const): Enable test mode quirks. We must do it in two places in case the initialization hasn't happened by the time we call ensureAppBoundDomains. * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-06-16 Mark Lam <mark.lam@apple.com> Make Options::useJIT() be the canonical source of truth on whether we should use the JIT. https://bugs.webkit.org/show_bug.cgi?id=212556 <rdar://problem/63780436> Reviewed by Saam Barati. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::isJITEnabled): 2020-06-16 David Kilzer <ddkilzer@apple.com> REGRESSION (r262994): Web Inspector is killed when context-clicking anywhere <https://webkit.org/b/213224> <rdar://problem/64383320> Reviewed by Darin Adler. * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.h: - Include <WebCore/ContextMenuItem.h> since the definition of the custom WTF::isValidEnum<WebCore::ContextMenuAction> function is needed. * Scripts/webkit/messages.py: (generate_message_names_header): - Change the third typename in the template for WTF::isValidEnum<IPC::MessageName>() to avoid partial template specialization errors from other implementations like WTF::isValidEnum<WebCore::ContextMenuAction>(). - Also replace hard-coded "IPC::MessageName" names with template values. 2020-06-16 Chris Dumez <cdumez@apple.com> Stop calling userPreferredLanguages() in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=213214 <rdar://problem/64317593> Reviewed by Darin Adler. Follow-up to r263094 to address post-landing feedback from Darin. Use makeVector() functionality in WTF to convert the NSArray into a Vector instead of doing it by hand. Also mark the NeverDestroyed variable as static const to avoid leaking. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::platformOverrideLanguages const): 2020-06-16 Alex Christensen <achristensen@webkit.org> Provide alternatively-named WKBrowsingContextGroup SPI https://bugs.webkit.org/show_bug.cgi?id=213229 Reviewed by Tim Horton. This is unfortunately still used. In order to try to convince the user to make the smallest change possible, make newly named SPI that behaves identically. Doubly-deprecate the old SPI and implement it in terms of the new during the transition period. * UIProcess/API/Cocoa/WKBrowsingContextGroup.h: * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm: (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]): (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:includeMatchPatternStrings:excludeMatchPatternStrings:mainFrameOnly:]): (-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]): (-[WKBrowsingContextGroup addUserScript:baseURL:includeMatchPatternStrings:excludeMatchPatternStrings:injectionTime:mainFrameOnly:]): 2020-06-16 Youenn Fablet <youenn@apple.com> Loads triggered by an opaque stylesheet should not be visible to service workers https://bugs.webkit.org/show_bug.cgi?id=213246 Reviewed by Alex Christensen. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): In case the load is triggered from an opaque response, set service worker mode to none. 2020-06-16 Charlie Turner <cturner@igalia.com> [GTK] Disable video autoplay https://bugs.webkit.org/show_bug.cgi?id=184845 Reviewed by Carlos Garcia Campos. * PlatformGTK.cmake: Add new source files to the build. * PlatformWPE.cmake: Ditto. * SourcesGTK.txt: Ditto. * SourcesWPE.txt: Ditto. * UIProcess/API/glib/WebKitPolicyDecision.cpp: (webkit_policy_decision_use_with_policies): : Add an API to respond to navigation decisions with policies. * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextCreatePageForWebView): Plumb in the default website policies that are associated with the web view. * UIProcess/API/glib/WebKitWebContextPrivate.h: * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewConstructed): (webkitWebViewSetProperty): (webkitWebViewGetProperty): (webkit_web_view_class_init): (webkit_web_view_get_website_policies): * UIProcess/API/glib/WebKitWebsitePolicies.cpp: Added. (_WebKitWebsitePoliciesPrivate::_WebKitWebsitePoliciesPrivate): (webkitWebsitePoliciesGetWebsitePolicies): (webkitWebsitePoliciesGetPoliciesData): (webkitWebsitePoliciesGetProperty): (webkitWebsitePoliciesSetAutoplayPolicy): (webkitWebsitePoliciesSetProperty): (webkit_website_policies_class_init): (webkit_website_policies_new): (webkit_website_policies_new_with_policies): (webkit_website_policies_get_autoplay_policy): * UIProcess/API/glib/WebKitWebsitePoliciesPrivate.h: Added. * UIProcess/API/gtk/WebKitPolicyDecision.h: * UIProcess/API/gtk/WebKitWebView.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (webkit_web_view_new_with_related_view): * UIProcess/API/gtk/WebKitWebsitePolicies.h: Added. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitPolicyDecision.h: * UIProcess/API/wpe/WebKitWebView.h: * UIProcess/API/wpe/WebKitWebsitePolicies.h: Added. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-06-16 Chris Dumez <cdumez@apple.com> Stop calling userPreferredLanguages() in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=213214 <rdar://problem/64317593> Reviewed by Per Arne Vollan. Stop calling userPreferredLanguages() in the UIProcess since this can be slow and may keep the main thread busy. Nowadays, the WebProcess is able to call it by itself anyway. The sandbox is allowing it. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::languageChanged): (WebKit::WebProcessPool::initializeNewWebProcess): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): (WebKit::WebProcess::userPreferredLanguagesChanged const): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-06-16 Truitt Savell <tsavell@apple.com> Unreviewed, reverting r263079. Broke Internal builds. Reverted changeset: "IndexedDB: Support IDBFactory databases method" https://bugs.webkit.org/show_bug.cgi?id=211043 https://trac.webkit.org/changeset/263079 2020-06-16 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Add API to configure and enable resource load statistics https://bugs.webkit.org/show_bug.cgi?id=177943 Reviewed by Michael Catanzaro. * UIProcess/API/glib/WebKitWebsiteData.cpp: (recordContainsSupportedDataTypes): (toWebKitWebsiteDataTypes): * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: (webkitWebsiteDataManagerGetProperty): (webkitWebsiteDataManagerSetProperty): (webkitWebsiteDataManagerConstructed): (webkit_website_data_manager_class_init): (webkitWebsiteDataManagerGetDataStore): (webkit_website_data_manager_get_itp_directory): (webkit_website_data_manager_set_itp_enabled): (webkit_website_data_manager_get_itp_enabled): (toWebsiteDataTypes): * UIProcess/API/gtk/WebKitWebsiteData.h: * UIProcess/API/gtk/WebKitWebsiteDataManager.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebsiteData.h: * UIProcess/API/wpe/WebKitWebsiteDataManager.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/glib/WebsiteDataStoreGLib.cpp: (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): 2020-06-16 Darryl Pogue <darryl@dpogue.ca> IndexedDB: Support IDBFactory databases method https://bugs.webkit.org/show_bug.cgi?id=211043 Reviewed by Youenn Fablet. Plumbing for returning a list of IDB databases and versions. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::getAllDatabaseNamesAndVersions): (WebKit::WebIDBServer::getAllDatabaseNames): Deleted. * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/IndexedDB/WebIDBServer.messages.in: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::getAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNamesAndVersions): (WebKit::WebIDBConnectionToServer::getAllDatabaseNames): Deleted. (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNames): Deleted. * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h: * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in: 2020-06-15 Pavel Feldman <pavel.feldman@gmail.com> Web Inspector: introduce request interception https://bugs.webkit.org/show_bug.cgi?id=207446 Reviewed by Devin Rousso. This change introduces network request interception to the Network protocol domain. It adds Network.interceptWithRequest notification that can be continued, modified or fulfilled. NetworkStage enum can now have 'request' and 'response' values. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoad): 2020-06-15 Brent Fulgham <bfulgham@apple.com> [macOS] Update sandboxes to reduce logging for media-related operations https://bugs.webkit.org/show_bug.cgi?id=213210 <rdar://problem/64376237> Reviewed by Per Arne Vollan. Ongoing testing has uncovered a set of additional services and IOKit properties that we should allow without logging. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-06-15 Alex Christensen <achristensen@webkit.org> Provide alternatively-named SPI for user style sheets and scripts https://bugs.webkit.org/show_bug.cgi?id=213206 Reviewed by Brady Eidson. Test-only SPI was just renamed. SPI used by other projects was deprecated with a replacement so we can remove the old names soon. _WKUserContentWorld/WKContentWorld was tied up in this, and rather than provide replacement SPI with deprecated _WKUserContentWorld, this will move some SPI from _WKUserContentWorld to WKContentWorld too. The most heavy user of _WKUserContentWorld is TestWebKitAPI and we'll remove it soon. * UIProcess/API/C/WKContext.cpp: (WKContextSetFontAllowList): (WKContextSetFontWhitelist): Deleted. * UIProcess/API/C/WKContextPrivate.h: * UIProcess/API/Cocoa/WKUserContentController.mm: (-[WKUserContentController _removeAllUserScriptsAssociatedWithContentWorld:]): (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithContentWorld:]): (-[WKUserContentController _addScriptMessageHandler:name:contentWorld:]): (-[WKUserContentController _removeAllUserScriptsAssociatedWithUserContentWorld:]): Deleted. (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithUserContentWorld:]): Deleted. * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:associatedURL:contentWorld:deferRunningUntilNotification:]): * UIProcess/API/Cocoa/WKUserScriptPrivate.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:baseURL:level:contentWorld:]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setFontAllowList): (WebKit::WebProcessPool::setFontWhitelist): Deleted. * UIProcess/WebProcessPool.h: 2020-06-15 Alex Christensen <achristensen@webkit.org> Add SPI to preconnect to a server https://bugs.webkit.org/show_bug.cgi?id=213109 <rdar://problem/64184412> Reviewed by Geoff Garen. Covered by API tests. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _preconnectToServer:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preconnectTo): * UIProcess/WebPageProxy.h: 2020-06-15 Keith Miller <keith_miller@apple.com> Signal handlers should have a two phase installation. https://bugs.webkit.org/show_bug.cgi?id=213160 Reviewed by Mark Lam. Put back old WASM fast memory installation. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2020-06-15 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> Suppress compiler warnings https://bugs.webkit.org/show_bug.cgi?id=213034 Reviewed by Darin Adler. Convert to std:size_t to compare equal data types. * NetworkProcess/cache/NetworkCacheData.cpp: (WebKit::NetworkCache::readOrMakeSalt): 2020-06-15 Chris Dumez <cdumez@apple.com> Revert r260856 as it seems to have regressed PLT on iOS https://bugs.webkit.org/show_bug.cgi?id=213194 <rdar://problem/64331458> Unreviewed, revert r260856 due to regression. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): * NetworkProcess/NetworkProcess.h: * Shared/WebSQLiteDatabaseTracker.cpp: Added. (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker): (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker): (WebKit::WebSQLiteDatabaseTracker::setIsSuspended): (WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction): (WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction): (WebKit::WebSQLiteDatabaseTracker::setIsHoldingLockedFiles): * Shared/WebSQLiteDatabaseTracker.h: Added. * SourcesCocoa.txt: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::setIsHoldingLockedFiles): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebProcess.cpp: (WebKit::m_webSQLiteDatabaseTracker): (WebKit::WebProcess::prepareToSuspend): (WebKit::WebProcess::processDidResume): * WebProcess/WebProcess.h: 2020-06-15 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Add API to expose UIClient::requestStorageAccessConfirm https://bugs.webkit.org/show_bug.cgi?id=210422 Reviewed by Michael Catanzaro. Add WebKitWebsiteDataAccessPermissionRequest to ask for permission to the user using the existing permission request API. * PlatformGTK.cmake: * PlatformWPE.cmake: * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequest.cpp: Added. (webkitWebsiteDataAccessPermissionRequestAllow): (webkitWebsiteDataAccessPermissionRequestDeny): (webkit_permission_request_interface_init): (webkitWebsiteDataAccessPermissionRequestDispose): (webkit_website_data_access_permission_request_class_init): (webkitWebsiteDataAccessPermissionRequestCreate): (webkit_website_data_access_permission_request_get_requesting_domain): (webkit_website_data_access_permission_request_get_current_domain): * UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequestPrivate.h: Added. * UIProcess/API/gtk/WebKitWebsiteDataAccessPermissionRequest.h: Added. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: * UIProcess/API/gtk/webkit2.h: * UIProcess/API/wpe/WebKitWebsiteDataAccessPermissionRequest.h: Added. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/API/wpe/docs/wpe-docs.sgml: * UIProcess/API/wpe/webkit.h: 2020-06-14 Sam Weinig <weinig@apple.com> [WPT] html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html fails due to lack of caching of Plugin objects https://bugs.webkit.org/show_bug.cgi?id=213185 Reviewed by Darin Adler. * UIProcess/Plugins/PluginInfoStore.h: Add missing #include that is now needed due to pruning of unnecessary #includes in WebCore. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::pluginSupportsExtension): Update to use new webVisibleMimeTypes() rather than the clunky getWebVisibleMimesAndPluginIndices(). 2020-06-14 David Kilzer <ddkilzer@apple.com> [IPC hardening] Return type of -[NSCoder validateClassSupportsSecureCoding:] is incorrect <https://webkit.org/b/213161> <rdar://problem/64050085> Reviewed by Darin Adler. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (validateClass): - Fix return type of -[NSCoder validateClassSupportsSecureCoding:]. Throw an NSException in case the method ever returns NO without throwing its own NSException. (Currently this method does throw an NSException instead of returning NO.) 2020-06-14 Carlos Garcia Campos <cgarcia@igalia.com> [SOUP] Disable HSTS for requests when cookies will be blocked by ITP https://bugs.webkit.org/show_bug.cgi?id=210739 Reviewed by Michael Catanzaro. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::shouldAllowHSTSProtocolUpgrade const): 2020-06-13 Richard Houle <rhoule@apple.com> Fix Overrelease in makeFailureSetForAllTextManipulationItems https://bugs.webkit.org/show_bug.cgi?id=213165 <rdar://problem/61389164> Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebView.mm: (makeFailureSetForAllTextManipulationItems): 2020-06-13 Wenson Hsieh <wenson_hsieh@apple.com> [Mac Catalyst] Color inputs and selects fail to display popovers when clicked https://bugs.webkit.org/show_bug.cgi?id=213157 <rdar://problem/64004135> Reviewed by Tim Horton. In Mac Catalyst, presenting popovers using `UIPopoverController` causes the first responder to change. This means that the WKContentView will resign first responder, which in turn causes the currently presented popover to be dismissed. This means that popovers for color inputs and select elements will be dismissed immediately after presentation. To mitigate this, adapt the approach taken in r259840 to `WKColorPopover` and `WKSelectPopover` by teaching the base class (`WKRotatingPopover`) to temporarily preserve the focused element in light of first responder changes while presenting a popover on Mac Catalyst. * UIProcess/ios/forms/WKFormPopover.mm: (-[WKRotatingPopover presentPopoverAnimated:]): (-[WKRotatingPopover dismissPopoverAnimated:]): 2020-06-13 Sam Weinig <weinig@apple.com> Extended Color: Experiment with strongly typed ColorComponents https://bugs.webkit.org/show_bug.cgi?id=212396 Reviewed by Darin Adler. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorFillFromWebCoreColor): * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::beginSwipeGesture): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::getDocumentBackgroundColor): Update to call toSRGBALossy() rather than toSRGBAComponentsLossy(). 2020-06-13 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> Remove FileError.h https://bugs.webkit.org/show_bug.cgi?id=213119 Reviewed by Chris Dumez. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): 2020-06-12 Brian Burg <bburg@apple.com> Automation.computeElementLayout should return iframe-relative element rects (when coordinate system is 'Page') https://bugs.webkit.org/show_bug.cgi?id=213139 <rdar://problem/55042445> Reviewed by Devin Rousso. Automation.computeElementLayout has two coordinate systems it can use, LayoutViewport (used for hit testing) and Page (used for Get Element Rect). Since Get Element Rect expects coordinates relative to the current browsing context, make the mode simpler by reporting the bounds from Element::boundingClientRect() which are frame-relative. Covered by existing WPT suite. The semantics of this command are under review, as the remote end steps seem to describe a different result than what the non-normative text does. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::computeElementLayout): 2020-06-12 David Kilzer <ddkilzer@apple.com> [IPC hardening] Check enum values in IPC::Decoder::decodeEnum() an IPC::Encoder::encodeEnum() <https://webkit.org/b/211988> <rdar://problem/63137695> Reviewed by Darin Adler. Replace decodeEnum() with decode() and encodeEnum() with operator<<(). * GPUProcess/media/TextTrackPrivateRemoteConfiguration.h: (WebKit::TextTrackPrivateRemoteConfiguration::encode const): * GPUProcess/media/TrackPrivateRemoteConfiguration.h: (WebKit::TrackPrivateRemoteConfiguration::encode const): * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * Platform/IPC/Decoder.h: (IPC::Decoder::decode): (IPC::Decoder::operator>>): - Make use of std::underlying_type_t<>. (IPC::Decoder::decodeEnum): Delete. - Replace with calls to decode(). * Platform/IPC/Encoder.h: (IPC::Encoder::operator<<): (IPC::Encoder::encode): - Make use of WTF::enumToUnderlyingType<>. (IPC::Encoder::encodeEnum): Delete. - Replace with calls to operator<<(). * Shared/Cocoa/ArgumentCodersCocoa.mm: (IPC::decodeObject): * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode): (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode): (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::encode): (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::decode): * Shared/ContextMenuContextData.cpp: (WebKit::ContextMenuContextData::encode const): (WebKit::ContextMenuContextData::decode): * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/LoadParameters.cpp: (WebKit::LoadParameters::encode const): (WebKit::LoadParameters::decode): * Shared/NavigationActionData.cpp: (WebKit::NavigationActionData::encode const): (WebKit::NavigationActionData::decode): * Shared/PlatformPopupMenuData.cpp: (WebKit::PlatformPopupMenuData::encode const): (WebKit::PlatformPopupMenuData::decode): * Shared/Plugins/PluginProcessCreationParameters.cpp: (WebKit::PluginProcessCreationParameters::encode const): (WebKit::PluginProcessCreationParameters::decode): * Shared/PrintInfo.cpp: (WebKit::PrintInfo::encode const): (WebKit::PrintInfo::decode): * Shared/RTCPacketOptions.cpp: (WebKit::RTCPacketOptions::encode const): (WebKit::RTCPacketOptions::decode): * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const): (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode): (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const): (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode): * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder<ScrollingStateNode>::encode): (ArgumentCoder<RequestedScrollData>::encode): (ArgumentCoder<RequestedScrollData>::decode): (WebKit::RemoteScrollingCoordinatorTransaction::decode): * Shared/SessionState.cpp: (WebKit::HTTPBody::Element::encode const): (WebKit::HTTPBody::Element::decode): (WebKit::PageState::encode const): (WebKit::PageState::decode): * Shared/TouchBarMenuItemData.cpp: (WebKit::TouchBarMenuItemData::encode const): (WebKit::TouchBarMenuItemData::decode): * Shared/UserData.cpp: (WebKit::UserData::encode): (WebKit::UserData::decode): * Shared/WebContextMenuItemData.cpp: (WebKit::WebContextMenuItemData::encode const): (WebKit::WebContextMenuItemData::decode): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<LinearTimingFunction>::encode): (IPC::ArgumentCoder<CubicBezierTimingFunction>::encode): (IPC::ArgumentCoder<CubicBezierTimingFunction>::decode): (IPC::ArgumentCoder<StepsTimingFunction>::encode): (IPC::ArgumentCoder<SpringTimingFunction>::encode): (IPC::ArgumentCoder<PluginInfo>::encode): (IPC::ArgumentCoder<PluginInfo>::decode): (IPC::ArgumentCoder<ProtectionSpace>::encode): (IPC::ArgumentCoder<ProtectionSpace>::decode): (IPC::ArgumentCoder<Credential>::encode): (IPC::ArgumentCoder<Credential>::decode): (IPC::ArgumentCoder<Cursor>::encode): (IPC::ArgumentCoder<Cursor>::decode): (IPC::ArgumentCoder<ResourceError>::encode): (IPC::ArgumentCoder<ResourceError>::decode): (IPC::ArgumentCoder<DragData>::encode): (IPC::ArgumentCoder<DragData>::decode): (IPC::ArgumentCoder<CompositionUnderline>::encode): (IPC::ArgumentCoder<CompositionUnderline>::decode): (IPC::ArgumentCoder<FileChooserSettings>::encode): (IPC::ArgumentCoder<FileChooserSettings>::decode): (IPC::ArgumentCoder<TextCheckingRequestData>::encode): (IPC::ArgumentCoder<TextCheckingRequestData>::decode): (IPC::ArgumentCoder<TextCheckingResult>::encode): (IPC::ArgumentCoder<TextCheckingResult>::decode): (IPC::ArgumentCoder<UserStyleSheet>::encode): (IPC::ArgumentCoder<UserStyleSheet>::decode): (IPC::ArgumentCoder<ScrollableAreaParameters>::encode): (IPC::ArgumentCoder<ScrollableAreaParameters>::decode): (IPC::ArgumentCoder<FilterOperation>::encode): (IPC::decodeFilterOperation): (IPC::ArgumentCoder<FontAttributes>::encode): (IPC::ArgumentCoder<FontAttributes>::decode): (IPC::ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::encode): (IPC::ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::decode): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPopupItem.cpp: (WebKit::WebPopupItem::encode const): (WebKit::WebPopupItem::decode): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::Entry::encode const): (WebKit::WebsiteData::Entry::decode): * Shared/curl/WebCoreArgumentCodersCurl.cpp: (IPC::ArgumentCoder<ResourceError>::encodePlatformData): (IPC::ArgumentCoder<ResourceError>::decodePlatformData): (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): * Shared/glib/InputMethodState.cpp: (WebKit::InputMethodState::encode const): (WebKit::InputMethodState::decode): * Shared/glib/UserMessage.cpp: (WebKit::UserMessage::encode const): (WebKit::UserMessage::decode): * Shared/mac/ColorSpaceData.mm: (WebKit::ColorSpaceData::encode const): (WebKit::ColorSpaceData::decode): * Shared/mac/SecItemRequestData.cpp: (WebKit::SecItemRequestData::encode const): (WebKit::SecItemRequestData::decode): * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder<WebCore::ResourceRequest>::encodePlatformData): (IPC::ArgumentCoder<WebCore::ResourceRequest>::decodePlatformData): (IPC::ArgumentCoder<WebCore::CertificateInfo>::encode): (IPC::ArgumentCoder<WebCore::CertificateInfo>::decode): * Shared/soup/WebCoreArgumentCodersSoup.cpp: (IPC::ArgumentCoder<SoupNetworkProxySettings>::encode): (IPC::ArgumentCoder<SoupNetworkProxySettings>::decode): * WebProcess/GPU/media/RemoteMediaPlayerState.h: (WebKit::RemoteMediaPlayerState::encode const): (WebKit::RemoteMediaPlayerState::decode): * WebProcess/Network/NetworkProcessConnectionInfo.h: (WebKit::NetworkProcessConnectionInfo::decode): * WebProcess/Plugins/Plugin.cpp: (WebKit::Plugin::Parameters::encode const): (WebKit::Plugin::Parameters::decode): * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::PlatformCAAnimationRemote::KeyframeValue::encode const): (WebKit::PlatformCAAnimationRemote::KeyframeValue::decode): (WebKit::PlatformCAAnimationRemote::Properties::encode const): (WebKit::PlatformCAAnimationRemote::Properties::decode): 2020-06-12 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Focusing selects and color inputs should not bring up the software keyboard https://bugs.webkit.org/show_bug.cgi?id=213149 <rdar://problem/64312450> Reviewed by Darin Adler. After <trac.webkit.org/r261658>, we now opt into bringing up the software keyboard when focusing color inputs and select elements. This is due to the changes in `-_shouldShowAutomaticKeyboardUIIgnoringInputMode`, which were intended to make us return `NO` for date and time inputs, but also unintentionally makes us return `YES` on iPadOS. This patch fixes the bug by returning `!WebKit::currentUserInterfaceIdiomIsPad()` instead, and additionally preserves the existing behavior of now showing a color picker for `<input type="color" readonly>` on iPhone. Test: fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView becomeFirstResponderForWebView]): (-[WKContentView resignFirstResponderForWebView]): (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): 2020-06-12 Alex Christensen <achristensen@webkit.org> Make API tests tolerant of our relatively new use of WebPageProxy::preconnectTo https://bugs.webkit.org/show_bug.cgi?id=213144 Reviewed by Geofferey Garen. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): (WebKit::NetworkSessionCocoa::taskServerConnectionSucceeded): (WebKit::NetworkSessionCocoa::taskReceivedBytes): Deleted. Fix our logic that remembers successful client certificate connections. If a task completes with no error (like a preconnect task does), consider that a successful connection. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): Remove the check to not preconnect to loopback addresses. This was making our tests different than the real internet and prevented me from landing a perfectly good test in https://bugs.webkit.org/show_bug.cgi?id=213109 2020-06-12 Per Arne Vollan <pvollan@apple.com> [iOS] Preferences are not being observed if the process pool is being created after activation https://bugs.webkit.org/show_bug.cgi?id=213145 Reviewed by Brent Fulgham. If the app is creating the Web process pool after being activated, preferences will not be observed until the app is being backgrounded and then foregrounded again, since the preference observer is initialized when handling the app activation notification. No new tests, since an API test would make sense in this case, but API tests aren't run on iOS. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-06-12 Takashi Komori <Takashi.Komori@sony.com> [Curl] Implement functions to use ResourceLoadStatistics. https://bugs.webkit.org/show_bug.cgi?id=207692 Reviewed by Don Olmstead. Implement functions which are required to implement ResourceLoadStatistics for Curl port. In NetworkDataTaskCurl.cpp we check if we should block cookies and block if needed. Tests: http/tests/resourceLoadStatistics/ * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): (WebKit::NetworkDataTaskCurl::createCurlRequest): (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCurl::blockCookies): (WebKit::NetworkDataTaskCurl::unblockCookies): (WebKit::NetworkDataTaskCurl::shouldBlockCookies): (WebKit::NetworkDataTaskCurl::isThirdPartyRequest): * NetworkProcess/curl/NetworkDataTaskCurl.h: * NetworkProcess/curl/NetworkSessionCurl.cpp: (WebKit::NetworkSessionCurl::NetworkSessionCurl): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreGetAllStorageAccessEntries): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): 2020-06-12 Antoine Quint <graouts@webkit.org> Double tap to zoom out doesn't work after upgrading to iOS 13 https://bugs.webkit.org/show_bug.cgi?id=205158 <rdar://problem/205158> Reviewed by Wenson Hsieh. Test: fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html In order to determine whether a significant zoom to happen, we should use the current page scale factor and not the initial page scale factor. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]): 2020-06-12 Alex Christensen <achristensen@webkit.org> Add WKUserScript initializer SPI with alternative names https://bugs.webkit.org/show_bug.cgi?id=213096 Reviewed by Youenn Fablet. And deprecate the existing ones so we can remove them soon. * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:associatedURL:contentWorld:deferRunningUntilNotification:]): * UIProcess/API/Cocoa/WKUserScriptPrivate.h: 2020-06-12 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK4 build * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeKeyEvent): 2020-06-11 Sam Weinig <weinig@apple.com> Document.currentScript does not work for SVGScriptElements https://bugs.webkit.org/show_bug.cgi?id=213104 Reviewed by Yusuke Suzuki. * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: (webkit_dom_document_get_current_script): Update to account for change in Document::currentScript() now returning an Element* that can be either an HTMLScriptElement or an SVGScriptElement. To keep API compatibility, only return non-null for HTMLScriptElements. 2020-06-12 Charlie Turner <cturner@igalia.com> [GTK] Add an internal API to run javascript without forced user gestures https://bugs.webkit.org/show_bug.cgi?id=212969 Reviewed by Carlos Garcia Campos. To be used by tests in a follow-up commit. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewRunJavaScriptWithParams): Factor out the glue to run JavaScript in the page. (webkitWebViewRunJavascriptWithoutForcedUserGestures): Add a new internal API for use by tests. (webkit_web_view_run_javascript): Modified to use factored out glue. * UIProcess/API/glib/WebKitWebViewInternal.h: Added. Place to keep API test-specific internal APIs. 2020-06-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make WebDriver work https://bugs.webkit.org/show_bug.cgi?id=212316 Reviewed by Adrian Perez de Castro. Fix UIClient::setWindowFrame to wait for surface size-changed signal after resizing the window and implement maximize, minimize and restore windows for GTK4. * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (surfaceStateChangedCallback): (webkitWebViewMonitorWindowState): (webkitWebViewMaximizeWindow): (webkitWebViewMinimizeWindow): (webkitWebViewRestoreWindow): 2020-06-11 David Kilzer <ddkilzer@apple.com> [IPC] Add WTF::EnumTraits<> for every enum type used in IPC <https://webkit.org/b/213093> Reviewed by Darin Adler. Summary: - Change underlying type of enum class to `bool` when there are only two values. In some cases, reorder the two values so the mapping to 0 and 1 makes more sense. Converting every enum to an enum class is not a goal of this patch, so some two-value enums stil have WTF::EnumTraits<> defined as noted below. - Add WTF::EnumTraits<> for the remaining enum types that are used by IPC::Encoder::encodeEnum() and IPC::Decoder::decodeEnum() so that WTF::isValidEnum<>() checks may be added next. - Add #include <WebCore/LibWebRTCEnumTraits.h> as needed. * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.h: * NetworkProcess/NetworkLoadParameters.h: * Shared/API/APIObject.h: * Shared/ContextMenuContextData.h: * Shared/DrawingAreaInfo.h: * Shared/FocusedElementInformation.h: * Shared/PrintInfo.h: (WTF::EnumTraits<WebKit::PrintInfo::PrintMode>): - Define this since PrintMode is not an enum class. * Shared/RTCPacketOptions.cpp: * Shared/SessionState.h: * Shared/TouchBarMenuItemData.h: * Shared/WebEvent.h: * Shared/WebPopupItem.cpp: (WebKit::WebPopupItem::WebPopupItem): - Fix reference to WebPopupItem::Type enum. * Shared/WebPopupItem.h: (WebKit::WebPopupItem::Type): - Convert from enum to enum class. * Shared/WebsiteData/WebsiteDataType.h: * Shared/glib/InputMethodState.h: * Shared/glib/UserMessage.h: * Shared/mac/ColorSpaceData.mm: * Shared/mac/SecItemRequestData.h: * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::populate): - Fix reference to WebPopupItem::Type enum. * WebProcess/Plugins/Plugin.cpp: * WebProcess/WebCoreSupport/WebPopupMenu.cpp: (WebKit::WebPopupMenu::populateItems): - Fix reference to WebPopupItem::Type enum. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: 2020-06-11 Alex Christensen <achristensen@webkit.org> Re-enable download resume tests https://bugs.webkit.org/show_bug.cgi?id=213098 <rdar://problem/63512518> Reviewed by Geoffrey Garen. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]): 2020-06-11 Beth Dakin <bdakin@apple.com> Replace instances of whitelist in WebCore with allowlist https://bugs.webkit.org/show_bug.cgi?id=213068 Reviewed by Tim Horton. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry): (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry): (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<UserStyleSheet>::encode): (IPC::ArgumentCoder<UserStyleSheet>::decode): * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::addOriginAccessWhitelistEntry): (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry): (WebKit::InjectedBundle::resetOriginAccessWhitelists): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-06-11 Jonathan Bedard <jbedard@apple.com> WebKit: Guard requestDocumentContext with HAVE(UI_WK_DOCUMENT_CONTEXT) https://bugs.webkit.org/show_bug.cgi?id=213076 <rdar://problem/64254698> Reviewed by Tim Horton. No new tests, behavior unchanged. * Platform/spi/ios/UIKitSPI.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _requestDocumentContext:completionHandler:]): Guard requestDocumentContext with HAVE(UI_WK_DOCUMENT_CONTEXT). (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Ditto. 2020-06-11 Jonathan Bedard <jbedard@apple.com> WebKit: Add UIKit SPI for watchOS and tvOS https://bugs.webkit.org/show_bug.cgi?id=213077 <rdar://problem/64255131> Reviewed by Tim Horton. No new tests, behavior unchanged. * Platform/spi/ios/UIKitSPI.h: 2020-06-11 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for DragSourceAction <https://webkit.org/b/212885> <rdar://problem/64094134> Reviewed by Darin Adler. Summary: - Convert argument parameters from uint64_t to OptionSet<DragSourceAction>. - Convert DragSourceAction to OptionSet<DragSourceAction>. * Scripts/webkit/messages.py: - Map DragSourceAction enum to DragActions.h header. * UIProcess/WebPageProxy.h: * UIProcess/ios/DragDropInteractionState.h: * UIProcess/ios/DragDropInteractionState.mm: (WebKit::shouldUseDragImageToCreatePreviewForDragSource): (WebKit::shouldUseVisiblePathToCreatePreviewForDragSource): (WebKit::shouldUseTextIndicatorToCreatePreviewForDragSource): (WebKit::canUpdatePreviewForActiveDragSource): (WebKit::DragDropInteractionState::anyActiveDragSourceIs const): (WebKit::DragDropInteractionState::stageDragItem): (WebKit::DragDropInteractionState::hasStagedDragSource const): (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _startDrag:item:]): (-[WKContentView _allowedDragSourceActions]): (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::requestDragStart): (WebKit::WebPageProxy::requestAdditionalItemsForDragSession): * WebProcess/WebCoreSupport/WebDragClient.cpp: (WebKit::WebDragClient::dragSourceActionMaskForPoint): * WebProcess/WebCoreSupport/WebDragClient.h: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::allowedDragSourceActions const): * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDragStart): (WebKit::WebPage::requestAdditionalItemsForDragSession): 2020-06-11 Eric Carlson <eric.carlson@apple.com> [Cocoa] MediaUsageManagerCocoa should use a different USVideoUsage initializer https://bugs.webkit.org/show_bug.cgi?id=213058 Reviewed by Jer Noble. No new tests, tested manually. * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: (WebKit::MediaUsageManagerCocoa::reset): Drive-by fix: don't call -stop unless the element was playing. (WebKit::MediaUsageManagerCocoa::updateMediaUsage): Use a different initializer so we can pass in the state. 2020-06-11 ChangSeok Oh <changseok@webkit.org> [GTK] Implement button-press-event, button-release-event, and absolute-axis-event of GAMEPAD API. https://bugs.webkit.org/show_bug.cgi?id=133850 Reviewed by Carlos Garcia Campos. * UIProcess/Gamepad/UIGamepadProvider.cpp: Add the OS(LINUX) guard. * UIProcess/Gamepad/gtk/UIGamepadProviderGtk.cpp: (WebKit::getWebPageProxy): Build fix. WebKitWebViewBase is used, not WebKitWebViewPrivate. * UIProcess/Gamepad/manette/UIGamepadProviderManette.cpp: Add the OS(LINUX) guard. 2020-06-10 Said Abou-Hallawa <sabouhallawa@apple.com> [macOS]: The File Picker of the <input> file element should show the selection filter https://bugs.webkit.org/show_bug.cgi?id=212485 Reviewed by Darin Adler. Add two private helpers to WKOpenPanelParameters. * UIProcess/API/Cocoa/WKOpenPanelParameters.mm: (-[WKOpenPanelParameters _allowedFileExtensions]): Returns an array of strings representing the allowed extensions. (-[WKOpenPanelParameters _allowedFileExtensionsDescription]): Returns a string representing a description for the allowed extensions. * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h: 2020-06-10 Beth Dakin <bdakin@apple.com> Replace instances of blacklist in WebCore with blocklist https://bugs.webkit.org/show_bug.cgi?id=213064 Reviewed by Tim Horton. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<UserStyleSheet>::encode): (IPC::ArgumentCoder<UserStyleSheet>::decode): 2020-06-10 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] editing/pasteboard/dom-paste tests consistently time out https://bugs.webkit.org/show_bug.cgi?id=213061 <rdar://problem/64211161> Reviewed by Darin Adler. On recent versions of iOS, system changes have moved the timing of the call to `-requestAutocorrectionContextWithCompletionHandler:` when focusing an editable element. This results in a consistently reproducible deadlock between the UI process and web process if a page tries to request programmatic clipboard access during the click event (importantly, in the same runloop as element focus). What ends up happening is that the autocorrection context is requested by the UI process shortly after the (unbounded) sync IPC message for the DOM paste arrives, so we end up waiting forever for the sync-IPC-blocked web process to respond. Normally this just results in a 1 second hang, and the DOM paste proceeds as normal. However these layout tests purposefully opt out of sync IPC timeouts (precisely so that we can catch bugs like this). See below for more details. * UIProcess/ios/WKContentViewInteraction.h: Keep track of the most recent autocorrection context that arrived in the UI process. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): Clear out the autocorrection context, in case the web process crashes. (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): If the autocorrection context is requested while handling a DOM paste, we know that the latest autocorrection context must be up to date, since the autocorrection context is computed and sent immediately before a DOM paste request. Use this to immediately invoke the completion handler, without any sync IPC back to the web process. (-[WKContentView _handleAutocorrectionContext:]): 2020-06-10 Hiro (mzp) Mizuno <mzp@apple.com> [iOS] Option + Forward Delete should delete next word https://bugs.webkit.org/show_bug.cgi?id=213062 rdar://64225458 Reviewed by Daniel Bates. Implement support for pressing Option + Forward Delete to delete the next word. This makes text editing in WebKit more closely match the platform conventions. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformAction:withSender:]): Handle _deleteForwardByWord. (-[WKContentView _deleteForwardByWord]): Added. 2020-06-10 Geoffrey Garen <ggaren@apple.com> Some style improvements to main thread code https://bugs.webkit.org/show_bug.cgi?id=213051 Reviewed by Darin Adler. Updated for rename. * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): (WebKit::InitializeWebKit2): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): 2020-06-10 Jonathan Bedard <jbedard@apple.com> WebKit:Add PepperUICoreSPI.h (Follow-up fix 2) https://bugs.webkit.org/show_bug.cgi?id=212996 <rdar://problem/64182627> Unreviewed build fix. * UIProcess/ios/forms/WKNumberPadViewController.mm: (-[WKNumberPadViewController addContentViewAnimations:]): Correct APPLE_INTERNAL_SDK macro. * UIProcess/ios/forms/WKQuickboardListViewController.mm: (-[WKQuickboardListViewController initWithDelegate:]): Ditto. 2020-06-10 Jonathan Bedard <jbedard@apple.com> WebKit:Add PepperUICoreSPI.h (Follow-up fix) https://bugs.webkit.org/show_bug.cgi?id=212996 <rdar://problem/64182627> Unreviewed build fix. * Platform/spi/watchos/PepperUICoreSPI.h: Add PUICPickerView headers. 2020-06-10 David Kilzer <ddkilzer@apple.com> REGRESSION (r262858): Fix macOS build when building EndowmentStateTracker.mm * UIProcess/EndowmentStateTracker.mm: - Move #if PLATFORM(IOS_FAMILY) to fix macOS build. 2020-06-10 Per Arne Vollan <pvollan@apple.com> [Cocoa] Return early from preference change notification handler if there is no observer https://bugs.webkit.org/show_bug.cgi?id=213050 Reviewed by Darin Adler. Currently, the observer member is checked inside the loop iterating over all the keys, but this check should be moved outside of the loop. No new tests, since this is not a change in behavior. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]): 2020-06-10 Brady Eidson <beidson@apple.com> Crash growing a CFData with incremental PDF loading. <rdar://problem/63670403> and https://bugs.webkit.org/show_bug.cgi?id=213035 Reviewed by Alex Christensen. No test - No reliable way to trigger. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::ensureDataBufferLength): When you call CFDataCreateMutable with a size other than 0, your data object can never grow beyond that size. And, in fact, CFData will crash on purpose when this is attempted. So always create our mutable CFDatas with size 0 even if we immediately plan to grow them. 2020-06-10 Jonathan Bedard <jbedard@apple.com> WebKit: Add ClockKitSPI.h https://bugs.webkit.org/show_bug.cgi?id=212994 <rdar://problem/64181092> Reviewed by Wenson Hsieh. No new tests, behavior unchanged. * Platform/spi/watchos: Added. * Platform/spi/watchos/ClockKitSPI.h: Added. * UIProcess/ios/forms/WKTimePickerViewController.mm: Import ClockKitSPI.h and UIKitSPI.h. * WebKit.xcodeproj/project.pbxproj: Include ClockKitSPI. 2020-06-10 Brian Burg <bburg@apple.com> WebDriver on non-iOS ports cannot perform ActionChain which has scrolling down to the element and click it https://bugs.webkit.org/show_bug.cgi?id=208232 <rdar://problem/59859491> Reviewed by Devin Rousso. * UIProcess/Automation/mac/WebAutomationSessionMac.mm: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): The provided coordinates are in LayoutViewport coordinate system, which does not take topContentInset into account. Add back in the topContentInset when translating to flipped window coordinates. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::computeElementLayout): The calculations of element bounds and IVCP have an incorrect handling of root coordinates as contents/absolute coordinates. Add the missing conversion. 2020-06-10 Brent Fulgham <bfulgham@apple.com> [iOS] Update sandbox rules for correct sanitizer paths in current OS releases https://bugs.webkit.org/show_bug.cgi?id=213040 <rdar://problem/64187043> Reviewed by Per Arne Vollan. Update the sandbox rules on iOS platforms to allow access to the new system locations for Asan libraries. * 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-06-10 Jer Noble <jer.noble@apple.com> Catalyst WebKit apps continue to play audio after quitting https://bugs.webkit.org/show_bug.cgi?id=212981 <rdar://problem/57089471> Reviewed by Chris Dumez. RunningBoard will track whether a process (and it's associated child processes) are "user-visible" by granting those processes an "endowment", similar to the existing endowment for application visibility. Track changes to these endowments using a RBSProcessMonitor, and for Catalyst apps, react to losing the "user-visible" endowment by suspending all media playback. Move all the endowment-related code into a new class, EndowmentStateTracker, which is a singleton object that can have mulitple WebPageProxy clients. Update references to the previously global static isApplicationForeground() function to refer to EndowmentStateTracker instead. Drive-by fix: move some iOS-only functions in WebPageProxy.cpp into WebPageProxyIOS.mm. * UIProcess/ApplicationStateTracker.h: * UIProcess/ApplicationStateTracker.mm: (WebKit::ApplicationStateTracker::ApplicationStateTracker): (WebKit::isApplicationForeground): Deleted. * UIProcess/EndowmentStateTracker.h: Added. (WebKit::EndowmentStateTracker::isVisible const): (WebKit::EndowmentStateTracker::isUserFacing const): * UIProcess/EndowmentStateTracker.mm: Added. (WebKit::handleForPID): (WebKit::EndowmentStateTracker::isApplicationForeground): (WebKit::EndowmentStateTracker::isApplicationUserFacing): (WebKit::EndowmentStateTracker::singleton): (WebKit::EndowmentStateTracker::EndowmentStateTracker): (WebKit::EndowmentStateTracker::addClient): (WebKit::EndowmentStateTracker::removeClient): (WebKit::EndowmentStateTracker::setIsUserFacing): (WebKit::EndowmentStateTracker::setIsVisible): * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::~WebPageProxy): (WebKit::WebPageProxy::processWillBecomeSuspended): Deleted. (WebKit::WebPageProxy::processWillBecomeForeground): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::isApplicationVisible): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::processWillBecomeSuspended): (WebKit::WebPageProxy::processWillBecomeForeground): (WebKit::WebPageProxy::isUserFacingChanged): (WebKit::WebPageProxy::isVisibleChanged): * WebKit.xcodeproj/project.pbxproj: 2020-06-10 Antoine Quint <graouts@webkit.org> Subframes should not autosize independently https://bugs.webkit.org/show_bug.cgi?id=212984 <rdar://problem/64175493> Reviewed by Simon Fraser. Ensure we only call FrameView::enableSizeToContentAutoSizeMode() for the main frame. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): 2020-06-10 Jonathan Bedard <jbedard@apple.com> WebKit:Add PepperUICoreSPI.h https://bugs.webkit.org/show_bug.cgi?id=212996 <rdar://problem/64182627> Reviewed by Tim Horton. No new tests, behavior unchanged. * Platform/spi/watchos: Added. * Platform/spi/watchos/PepperUICoreSPI.h: Added. * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: Include PepperUICoreSPI header. * UIProcess/ios/WKScrollView.mm: Ditto. * UIProcess/ios/forms/WKDatePickerViewController.mm: Remove headers duplicated in PepperUICoreSPI.h. * UIProcess/ios/forms/WKFocusedFormControlView.mm: Ditto. * UIProcess/ios/forms/WKNumberPadView.mm: Include PepperUICoreSPI header. * UIProcess/ios/forms/WKNumberPadViewController.h: Remove headers duplicated in PepperUICoreSPI.h. * UIProcess/ios/forms/WKNumberPadViewController.mm: Ditto. (-[WKNumberPadViewController addContentViewAnimations:]): Limit addAnimation to Internal builds. * UIProcess/ios/forms/WKQuickboardListViewController.h: Include PepperUICoreSPI header. * UIProcess/ios/forms/WKQuickboardListViewController.mm: Remove headers duplicated in PepperUICoreSPI.h. (-[WKQuickboardListViewController initWithDelegate:]): * UIProcess/ios/forms/WKSelectMenuListViewController.mm: Remove headers duplicated in PepperUICoreSPI.h. * UIProcess/ios/forms/WKTextInputListViewController.mm: Ditto. * WebKit.xcodeproj/project.pbxproj: Add PepperUICoreSPI.h. 2020-06-10 Per Arne Vollan <pvollan@apple.com> [iOS] Add entitlement for PAC exceptions https://bugs.webkit.org/show_bug.cgi?id=213027 <rdar://problem/63985737> Reviewed by Brent Fulgham. On iOS, add entitlement for PAC exceptions. * Scripts/process-entitlements.sh: 2020-06-10 James Savage <james.savage@apple.com> Swift Overlay API refinements https://bugs.webkit.org/show_bug.cgi?id=212939 <rdar://problem/64140013> Reviewed by Darin Adler. This patch cleans up some inconsistencies in the various Swift projections, and modifies JavaScript evaluation callbacks to be optional to account for scripts which may not evaluate to a useful result (such as ones that simply modify the DOM without reporting a status). It also standardizes on using completionHandler as an argument label to match the rest of WebKit API, and the majority of the Swift API refinements. It also fixes a module issue where the WebKit.h umbrella was missing an import of WKScriptReplyWithMessageHandler.h, making the type unusable from Swift source files/ * Shared/API/Cocoa/WebKit.h: Add missing header. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: (callAsyncJavaScript(_:arguments:in:completionHandler:)): Rename completion argument, and make optional. Note: Optional closures are implicitly @escaping, making the annotation redundant and incompatible, so it must be removed. In Swift, Optional.map()'s closure is invoked iff the Optional contains some value, and the result of that transform is returned, else nil is propagated. This allows us to apply the closure transform if the client value is non-nil, without using intermediary variables or if/let. (evaluateJavaScript(_:in:completionHandler:)): Ditto. * SwiftOverlay/Tests/WebKitTests.swift: (WebKitTests.testAPI): Update names to reflect changes. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything (Catalyst).xcscheme: Ensure that the unit test files get built as part of Build & Run, so that any changes to names get flagged without even running the tests. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything.xcscheme: Ditto. 2020-06-10 Kate Cheney <katherine_cheney@apple.com> ASSERTION FAILED: suspendedState == State::Running in WebKit::WebResourceLoadStatisticsStore::suspend https://bugs.webkit.org/show_bug.cgi?id=213031 <rdar://problem/64131092> Reviewed by Chris Dumez. There is a race condition if two calls are made to WebResourceLoadStatisticsStore::suspend() simultanously. WebResourceLoadStatisticsStore::resume() notifies the background thread to continue and releases a lock, then sometimes the second call to suspend obtains the lock and updates the suspendedState variable before the background thread resumes and checks the result. This patch allows the suspendedState to be either State::Running or State::WillSuspend to account for this. No new tests, this should fix http/wpt/service-workers/service-worker-spinning-fetch.https.html. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): (WebKit::WebResourceLoadStatisticsStore::suspend): 2020-06-10 Alex Christensen <achristensen@webkit.org> Revert r259770 https://bugs.webkit.org/show_bug.cgi?id=210097 <rdar://problem/64175992> * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2020-06-10 Alex Christensen <achristensen@webkit.org> Add some null checks in PDFPlugin::updatePageAndDeviceScaleFactors https://bugs.webkit.org/show_bug.cgi?id=213009 <rdar://problem/63756100> Reviewed by Chris Dumez. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors): 2020-06-09 Fujii Hironori <Hironori.Fujii@sony.com> Unreviewed, reverting r262791. WinCairo WebKit1 is crashing. Reverted changeset: "[Curl] Implement functions to use ResourceLoadStatistics." https://bugs.webkit.org/show_bug.cgi?id=207692 https://trac.webkit.org/changeset/262791 2020-06-09 Tim Horton <timothy_horton@apple.com> Stop using the wrong LaunchServices SPI for getting an app's localized name https://bugs.webkit.org/show_bug.cgi?id=213003 <rdar://problem/64169000> Reviewed by Sam Weinig. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): 2020-06-09 Mark Lam <mark.lam@apple.com> Disambiguate the OverridesGetPropertyNames structure flag https://bugs.webkit.org/show_bug.cgi?id=212909 <rdar://problem/63823557> Reviewed by Saam Barati. * WebProcess/Plugins/Netscape/JSNPObject.h: 2020-06-09 Dean Jackson <dino@apple.com> Stop using discriminatory names for WebGL and Plugin blocking https://bugs.webkit.org/show_bug.cgi?id=213000 Reviewed by Simon Fraser. * Shared/Plugins/Netscape/mac/PluginInformationMac.mm: (WebKit::getPlatformPluginModuleInformation): * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextIsPlugInUpdateAvailable): (WKContextShouldBlockWebGL): (WKContextShouldSuggestBlockWebGL): * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: (WebKit::PluginInfoStore::defaultLoadPolicyForPlugin): 2020-06-09 Brian Burg <bburg@apple.com> [Cocoa] Element Send Keys can hang when an automation window becomes unfocused https://bugs.webkit.org/show_bug.cgi?id=212985 <rdar://problem/56354471> Reviewed by Devin Rousso. * UIProcess/Automation/mac/WebAutomationSessionMac.mm: (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Make sure to focus the window and set first responder so sending keys doesn't hang. 2020-06-09 Jonathan Bedard <jbedard@apple.com> WebKit: Import NSURLConnectionSPI.h instead of CFNSURLConnection.h https://bugs.webkit.org/show_bug.cgi?id=212980 <rdar://problem/64172694> Unreviewed build fix. No new tests, behavior unchanged. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: 2020-06-09 Dean Jackson <dino@apple.com> REGRESSION: [Safari Mojave for High Sierra] Accessing some of the featured pages on apple.com causes the webpage to crash https://bugs.webkit.org/show_bug.cgi?id=212940 Reviewed by Tim Horton. The code to use the singleton for a SwitchingGPUClient was assuming it has always been set, which was not the case when ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) was not true. * WebProcess/cocoa/WebProcessCocoa.mm: Set the singleton unconditionally. (WebKit::WebProcess::platformInitializeProcess): 2020-06-09 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r260820): [macCatalyst] Web process crashes when uploading a file https://bugs.webkit.org/show_bug.cgi?id=212976 <rdar://problem/64033186> Reviewed by Tim Horton. On Mac Catalyst, we attempt to take a sandbox extension for `com.apple.frontboard.systemappservices` when uploading a file; this service does not exist in Catalyst, and we consequently encounter a release assertion under `WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon`. Fix this by introducing `HAVE(FRONTBOARD_SYSTEM_APP_SERVICES)`, and using it to guard codepaths that attempt to grab a mach extension to this service. (As a followup, we should consider adopting this in other places that currently reference `com.apple.frontboard.systemappservices`). * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon): 2020-06-09 Jonathan Bedard <jbedard@apple.com> WebKit: Support watchOS and tvOS in xcconfigs https://bugs.webkit.org/show_bug.cgi?id=212977 <rdar://problem/64170532> Reviewed by Tim Horton. No new tests, behavior unchanged. * Configurations/Base.xcconfig: Add tvOS and watchOS major version macros. * Configurations/BaseTarget.xcconfig: Include tvOS and watchOS framework stubs. * Configurations/BaseXPCService.xcconfig: Generalize excluded files for all embedded platforms. * Configurations/GPUService.xcconfig: Generalize INFOPLIST for embedded platforms. * Configurations/NetworkService.xcconfig: Ditto. * Configurations/WebContentService.xcconfig: Ditto. 2020-06-09 Alex Christensen <achristensen@webkit.org> Expose PDF file URL in shouldAllowPDFToOpenFromFrame SPI https://bugs.webkit.org/show_bug.cgi?id=212974 Reviewed by Tim Horton. * UIProcess/API/APIUIClient.h: (API::UIClient::confirmPDFOpening): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::confirmPDFOpening): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): 2020-06-09 Takashi Komori <Takashi.Komori@sony.com> [Curl] Implement functions to use ResourceLoadStatistics. https://bugs.webkit.org/show_bug.cgi?id=207692 Reviewed by Don Olmstead. Implement functions which are required to implement ResourceLoadStatistics for Curl port. In NetworkDataTaskCurl.cpp we check if we should block cookies and block if needed. Tests: http/tests/resourceLoadStatistics/ * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): (WebKit::NetworkDataTaskCurl::createCurlRequest): (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): (WebKit::NetworkDataTaskCurl::blockCookies): (WebKit::NetworkDataTaskCurl::unblockCookies): (WebKit::NetworkDataTaskCurl::shouldBlockCookies): (WebKit::NetworkDataTaskCurl::isThirdPartyRequest): * NetworkProcess/curl/NetworkDataTaskCurl.h: * NetworkProcess/curl/NetworkSessionCurl.cpp: (WebKit::NetworkSessionCurl::NetworkSessionCurl): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreGetAllStorageAccessEntries): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): 2020-06-09 Lauro Moura <lmoura@igalia.com> [WebDriver][WPE] Follow up WPE fix after r262703 https://bugs.webkit.org/show_bug.cgi?id=212948 Reviewed by Carlos Garcia Campos. Covered by existing tests. * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: (WebKit::WebAutomationSession::platformWebModifiersFromRaw): 2020-06-08 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for IPC::CFType <https://webkit.org/b/212921> <rdar://problem/64134506> Reviewed by Darin Adler. Summary: - Convert IPC::CFType to enum class. - Rule for new enum names is to remove "Ref" suffix from the actual type name. - Special enum CFType::Null renamed to CFType::Nullptr to differentiate from CFType::CFNull objects. * Shared/cf/ArgumentCodersCF.cpp: (IPC::tokenNullTypeRef): Delete. (IPC::tokenNullptrTypeRef): Add. - Rename tokenNullTypeRef() to tokenNullptrTypeRef(). (IPC::CFType): - Convert to enum class. (IPC::typeFromCFTypeRef): (IPC::encode): - Switch from encodeEnum() to operator<<(). (IPC::decode): - Switch from decodeEnum() to decode(). (WTF::EnumTraits<IPC::CFType>): Add. * Shared/cf/ArgumentCodersCF.h: (IPC::tokenNullTypeRef): Delete. (IPC::tokenNullptrTypeRef): Add. - Rename tokenNullTypeRef() to tokenNullptrTypeRef(). * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder<WebCore::ResourceRequest>::encodePlatformData): (IPC::ArgumentCoder<WebCore::ResourceRequest>::decodePlatformData): - Switch to use tokenNullptrTypeRef(). * mac/WebKit2.order: - Update symbol name after renaming tokenNullTypeRef(). 2020-06-08 Kate Cheney <katherine_cheney@apple.com> ResourceLoadStatisticsDatabaseStore::domainIDFromString failed, error message: bad parameter or other API misuse https://bugs.webkit.org/show_bug.cgi?id=212916 <rdar://problem/64127238> Reviewed by Sihui Liu. Make sure m_domainIDFromStringStatement is accessed in a separate scope in ensureResourceStatisticsForRegistrableDomain() so it will be reset before being used again. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const): Add debug assert to ensure that tests catch this case. (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain const): 2020-06-08 Chris Dumez <cdumez@apple.com> Turn some WebPageProxy logging into error logging https://bugs.webkit.org/show_bug.cgi?id=212922 <rdar://problem/63894722> Reviewed by Geoffrey Garen. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::processDidTerminate): (WebKit::WebPageProxy::dispatchProcessDidTerminate): (WebKit::WebPageProxy::tryReloadAfterProcessTermination): (WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive): (WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground): 2020-06-08 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for DragOperation <https://webkit.org/b/212870> <rdar://problem/64069940> Reviewed by Darin Adler. * Scripts/webkit/messages.py: - Remove FIXME now that it's not needed. * Shared/API/Cocoa/_WKDragActionsInternal.h: (WebKit::coreDragOperationMask): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::kit): * UIProcess/ios/WKContentViewInteraction.mm: (dropOperationForWebCoreDragOperation): (coreDragOperationForUIDropOperation): (-[WKContentView dragDataForDropSession:dragDestinationAction:]): 2020-06-08 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r262685. https://bugs.webkit.org/show_bug.cgi?id=212914 caused flakey crashes in an iOS test Reverted changeset: "Clear WebPageProxy event state between tests" https://bugs.webkit.org/show_bug.cgi?id=212864 https://trac.webkit.org/changeset/262685 2020-06-08 Sam Weinig <weinig@apple.com> Extended Color: Unify rounding / clamping conversions between 0-1 float components and 0-255 byte components https://bugs.webkit.org/show_bug.cgi?id=212871 Reviewed by Simon Fraser. * UIProcess/API/ios/WKWebViewIOS.mm: (scrollViewBackgroundColor): Replaces uses of colorWithAlphaUsingAlternativeRounding() with colorWithAlpha(). 2020-06-08 Richard Houle <rhoule@apple.com> Links in NSAttributedString passed to -[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:] are ignored https://bugs.webkit.org/show_bug.cgi?id=212801 <rdar://problem/63027631> Reviewed by Alex Christensen. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): Call the new detailsWithLinks implementation, asserting if an URL is non nil. (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]): Ditto. (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]): Pass the URL to the completion handler when appropriate. * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2020-06-08 Per Arne Vollan <pvollan@apple.com> [Cocoa] Adopt read-only mode for preferences in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=212411 Reviewed by Darin Adler. Change name of HAVE define to match SPI name. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): 2020-06-08 Per Arne Vollan <pvollan@apple.com> [Cocoa] CFPrefs synchronization does not always work for global preference changes https://bugs.webkit.org/show_bug.cgi?id=212783 Reviewed by Tim Horton. In CFPrefs direct mode, synchronization of global preference changes from the UI process to the WebContent process does not always work. This is caused by the KVO notification being sent to all or some of the NSUserDefault objects, which leads us to believe a non-global preference was changed. Since a global preference change always leads to some NSUserDefaults object receiving the notification, we can work around this by checking if the preference being changed really belongs to the domain of the NSUserDefaults object, or if it is a global preference. Also, stop creating NSUserDefaults object for the global domain, since this is an error according to the docs. API test: WebKit.GlobalPreferenceChangesUsingDefaultsWrite * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::notifyPreferencesChanged): 2020-06-08 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Hit-testing on icloud.com is offset after closing a tab https://bugs.webkit.org/show_bug.cgi?id=212890 <rdar://problem/58775297> Reviewed by Simon Fraser. After tapping to create a new tab on the icloud.com settings page (with no other tabs open) and then closing the new tab, all hit-testing on the page is offset by -33px until the page is reloaded. This bug appears to be a corner case triggered by a combination of the following three changes: - <https://trac.webkit.org/r170463> - <https://trac.webkit.org/r245006> - <rdar://problem/53660458> (which is an iOS-specific Safari change) We start on icloud.com's settings page. When closing the newly created tab, Safari hides the tab bar, causing both the top content inset and top obscured inset to decrease by 33 points. When applying the top content inset change, Safari (after <rdar://problem/53660458>) temporarily sets `_automaticContentOffsetAdjustmentEnabled` on `WKScrollView` to `NO`, which means that the scroll view doesn't automatically adjust its content offset to -70; instead, it remains at -103 (the content offset when the tab bar is shown). Because of this, during the next remote layer tree commit where the content size changes, `-_setContentSizePreservingContentOffsetDuringRubberband:` will believe that we're currently rubber-banding by 33px, and therefore try to adjust the content offset of the scroll view to be -103 instead of allowing it to be adjusted back to -70 (see r170463 and `-_restoreContentOffsetWithRubberbandAmount:`). This results in the scroll position on the page (`document.scrollingElement.scrollTop`) reporting -33, even though the top of the page is flush with the bottom of Safari's browser chrome. Finally, because `WKScrollView` is made unscrollable due to `overflow: hidden;` (r245006), we end up permanently stuck in this state until the next page load, rather than the next remote layer tree commit that causes any scrolling. To fix this, add an additional restriction on the rubberbanding offset restoration code in `-_setContentSizePreservingContentOffsetDuringRubberband:`, such that we only try to preserve the current rubberbanded offset if we're actually rubberbanding (that is, dragging or bouncing against the edge of the scroll view). Note that when rubberbanding against the top of the scroll view on iPad using a trackpad, the `-isDragging` property is also true, which matches behavior when panning via touch. Test: ScrollViewInsetTests.ChangeInsetWithoutAutomaticAdjustmentWhileWebProcessIsUnresponsive * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKScrollView.mm: (-[WKScrollView _setContentSizePreservingContentOffsetDuringRubberband:]): Also, split out the `CGSizeEqualToSize(currentContentSize, contentSize)` case into a separate early return that skips the call to `-setContentSize:` altogether. 2020-06-08 Andy Estes <aestes@apple.com> [Apple Pay] Remove -respondsToSelector: check before calling -[PKPaymentRequest setBoundInterfaceIdentifier:] https://bugs.webkit.org/show_bug.cgi?id=212884 <rdar://problem/64090963> Reviewed by Youenn Fablet. * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Relied on the definition of HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER to ensure that PKPaymentRequest will respond to -setBoundInterfaceIdentifier:. 2020-06-08 Andy Estes <aestes@apple.com> [Apple Pay] Remove ENABLE_APPLE_PAY_SETUP, ENABLE_APPLE_PAY_SESSION_V7, and HAVE_PASSKIT_PAYMENT_SETUP https://bugs.webkit.org/show_bug.cgi?id=212883 <rdar://problem/64090763> Reviewed by Youenn Fablet. These macros evaluate to true whenever ENABLE(APPLE_PAY) is true on platforms supported by trunk WebKit, so we can either remove them or replace them with ENABLE(APPLE_PAY). * Shared/ApplePay/ApplePayPaymentSetupFeatures.mm: * Shared/ApplePay/ApplePayPaymentSetupFeaturesWebKit.h: * Shared/ApplePay/PaymentSetupConfiguration.mm: * Shared/ApplePay/PaymentSetupConfigurationWebKit.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.h: 2020-06-08 youenn fablet <youenn@apple.com> [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=206582 <rdar://problem/58985368> Reviewed by Eric Carlson. Enable RemoteMediaRecorder only for systems supporting AVAssetWriterDelegate. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): 2020-06-07 Lauro Moura <lmoura@igalia.com> [WebDriver] Allow platform-dependent modifier keys conversion to WebEvent::Modifier https://bugs.webkit.org/show_bug.cgi?id=212848 Reviewed by Brian Burg. WebEvent::Modifier flags does not map directly to the platform flags, so we can't directly convert the modifier flags to the OptionSet. Covered by existing WebDriver tests. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::simulateMouseInteraction): Use platform-specific method to convert the modifiers. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: Added conversion from GDK modifier mask to WebEvent::Modifier. (WebKit::WebAutomationSession::platformWebModifiersFromRaw): * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Added conversion from NSModifierFlag to WebEvent::Modifier. (WebKit::WebAutomationSession::platformWebModifiersFromRaw): * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: Added conversion from wpe_input_keyboard_modifier to WebEvent::Modifier. (WebKit::WebAutomationSession::platformWebModifiersFromRaw): 2020-06-07 Lauro Moura <lmoura@igalia.com> [WPE] Behave like GDK_CURRENT_TIME when the timestamp is zero https://bugs.webkit.org/show_bug.cgi?id=212797 WebDriver tests come with zero timestamp. So behave like GDK_CURRENT_TIME and assume zero timestamp == WallTime::now(). Reviewed by Carlos Garcia Campos. Covered by existing tests. * Shared/libwpe/WebEventFactory.cpp: (WebKit::wallTimeForEventTime): 2020-06-07 Philippe Normand <pnormand@igalia.com> Remove ENABLE_VIDEO_TRACK ifdef guards https://bugs.webkit.org/show_bug.cgi?id=212568 Reviewed by Youenn Fablet. * Configurations/FeatureDefines.xcconfig: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::dispatchMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::textTrackSetMode): (WebKit::RemoteMediaPlayerProxy::notifyTrackModeChanged): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in: * Shared/WebPreferences.yaml: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::tracksChanged): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::updatePreferences): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp: * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h: * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.messages.in: * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp: * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::maximumBufferingTime): 2020-06-06 Simon Fraser <simon.fraser@apple.com> Clear WebPageProxy event state between tests https://bugs.webkit.org/show_bug.cgi?id=212864 Reviewed by Anders Carlsson. Make sure that event state doesn't leak between tests via events queued in WebPageProxy. * UIProcess/API/C/WKPage.cpp: (WKPageClearEventState): * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetStateAfterProcessExited): (WebKit::WebPageProxy::clearEventState): * UIProcess/WebPageProxy.h: 2020-06-06 Rob Buis <rbuis@igalia.com> Move URL scheme check to NetworkLoadChecker https://bugs.webkit.org/show_bug.cgi?id=191924 Reviewed by Joseph Pecoraro. Reduce includes for CustomHeaderFields, I guess these were needed at some point but not anymore. * Shared/WebsitePoliciesData.cpp: 2020-06-06 David Kilzer <ddkilzer@apple.com> Use OptionSet<DragOperation> for mask values <https://webkit.org/b/212605> Reviewed by Darin Adler. In broad strokes: - Replace use of DragOperation with OptionSet<DragOperation> or Optional<DragOperation>. - Rename function parameters and local variables to denote use of mask values. - Remove DragOperationNone enum value. - Replace DragOperationEvery enum value with anyDragOperation(). * Platform/spi/ios/UIKitSPI.h: (UIDragOperation): - Remove unused (and misnamed) UIDragOperation enum typedef. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): (headers_for_type): - Add support for WebCore::DragOperation enum. * Shared/API/Cocoa/_WKDragActionsInternal.h: (WebKit::coreDragOperationMask): Add conversion function. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DragData>::encode): (IPC::ArgumentCoder<DragData>::decode): - Update to encode/decode OptionSet<DragOperation>. * UIProcess/API/gtk/DragSource.h: (WebKit::DragSource::begin): * UIProcess/API/gtk/DragSourceGtk3.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DragSourceGtk4.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DropTarget.h: * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::didPerformAction): (WebKit::DropTarget::leaveTimerFired): * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::didPerformAction): * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::startDrag): * UIProcess/API/gtk/PageClientImpl.h: (WebKit::PageClientImpl::startDrag): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseStartDrag): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: (webkitWebViewBaseStartDrag): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::sendDragEndToPage): (WebKit::WebViewImpl::draggingEntered): (WebKit::kit): Add conversion function. (WebKit::WebViewImpl::draggingUpdated): (WebKit::WebViewImpl::draggingExited): (WebKit::WebViewImpl::performDragOperation): - Make use of coreDragOperationMask() conversion function. * UIProcess/PageClient.h: (WebKit::WebViewImpl::startDrag): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didPerformDragControllerAction): - Remove MESSAGE_CHECK now that we're using the actual type. (WebKit::WebPageProxy::startDrag): (WebKit::WebPageProxy::dragEnded): (WebKit::WebPageProxy::resetCurrentDragInformation): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::didPerformDragControllerAction): (WebKit::WebPageProxy::dragEnded): (WebKit::WebPageProxy::startDrag): (WebKit::WebPageProxy::currentDragOperation const): * UIProcess/WebPageProxy.messages.in: (WebPageProxy::DidPerformDragControllerAction): (WebPageProxy::StartDrag): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _didHandleDragStartRequest:]): (dropOperationForWebCoreDragOperation): (coreDragOperationForUIDropOperation): Add conversion function. - Note that this was not being converted from UIDropOperation to WebCore::DragOperation previously, and UIDropOperationMove (0x3) was not being properly converted to DragOperationMove (0x16). (-[WKContentView dragDataForDropSession:dragDestinationAction:]): (-[WKContentView _didPerformDragOperation:]): (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]): (-[WKContentView dragInteraction:session:didEndWithOperation:]): (-[WKContentView dropInteraction:sessionDidEnd:]): * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp: (WebKit::WebDragClient::startDrag): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performDragControllerAction): (WebKit::WebPage::dragEnded): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::performDragControllerAction): (WebKit::WebPage::dragEnded): * WebProcess/WebPage/WebPage.messages.in: (WebPage::PerformDragControllerAction): (WebPage::DragEnded): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestAdditionalItemsForDragSession): 2020-06-06 Devin Rousso <drousso@apple.com> Web Inspector: unify the naming scheme for agents used by instrumentation https://bugs.webkit.org/show_bug.cgi?id=212859 Reviewed by Timothy Hatcher. Inspector agents fall into one of three categories: - "persistent" when Web Inspector is connected - "enabled" when that agent is `enable`d, such as if the corresponding tab is visible - "tracking" when that agent is part of a timeline recording. The only exception to this is the Console agent, as that exists regardless of whether Web Inspector is connected as it needs to preserve messages logged before Web Inspector connects. Also remove the "Inspector" prefix from getter/setter methods as it adds confusion if that agent also has subclasses (e.g. `InspectorRuntimeAgent` and `PageRuntimeAgent`). * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp: * UIProcess/Inspector/WebInspectorProxy.cpp: * UIProcess/Inspector/WebPageInspectorController.h: Simple naming changes elided to avoid a long ChangeLog. 2020-06-05 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for AutocapitalizeType <https://webkit.org/b/212846> <rdar://problem/64042825> Reviewed by Darin Adler. Summary: - Move AutocapitalizeType into WebCore namespace. - Convert AutocapitalizeType to an enum class. - Add WTF::EnumTraits<AutocapitalizeType> for IPC. * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): - Stop using decodeEnum() and encodeEnum() now that WTF::EnumTraits<AutocapitalizeType> exists. * Shared/FocusedElementInformation.h: * Shared/glib/InputMethodState.cpp: (WebKit::InputMethodState::addHintsForAutocapitalizeType): * Shared/glib/InputMethodState.h: * UIProcess/ios/WKContentViewInteraction.mm: (toUITextAutocapitalize): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2020-06-05 Brent Fulgham <bfulgham@apple.com> [iOS] Silence telemetry generated during download operations https://bugs.webkit.org/show_bug.cgi?id=212854 <rdar://problem/63909414> Reviewed by Per Arne Vollan. Remove reporting and telemetry for the 'com.apple.ProgressReporting' service from the Network Process sandbox, since this is a critical part of supplying download status to the WebKit UI. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-06-05 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r262619, r262625, and r262641. Caused mediarecorder layout test crashes. Reverted changesets: "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder" https://bugs.webkit.org/show_bug.cgi?id=206582 https://trac.webkit.org/changeset/262619 "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder" https://bugs.webkit.org/show_bug.cgi?id=206582 https://trac.webkit.org/changeset/262625 "Unreviewed, silence deprecation warning to fix build with latest SDK." https://trac.webkit.org/changeset/262641 2020-06-05 Kate Cheney <katherine_cheney@apple.com> ITP SQLite Database should only vacuum once per day https://bugs.webkit.org/show_bug.cgi?id=212712 <rdar://problem/63939711> Reviewed by Brent Fulgham. Followup to https://trac.webkit.org/changeset/262538/webkit. We should run incremental auto vacuum, not a full vacuum, once per-day, because it is less expensive. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::performDailyTasks): 2020-06-05 Daniel Bates <dabates@apple.com> -_focusTextInputContext should reposition the caret if called for an already focused text input context https://bugs.webkit.org/show_bug.cgi?id=212830 <rdar://problem/64032956> Reviewed by Wenson Hsieh. Update the code based on new feedback: the caret should now be re-positioned when -_focusTextInputContext is called on an already assisted text input context. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _didCommitLoadForMainFrame]): Reset state. See below for why. (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): I cannot simply remove the early return in -_focusTextInputContext that detects if the specified text input context is already focused because it could effect user-visible responsiveness due to an Apple internal client invoking this function more times than necessary with the same point during a text interaction. See <rdar://problem/59430806>. That radar represents a correctness issue. I didn't actually evaluate whether responsiveness is affected by this patch, but I would feel more confident that there would be 0 impact when removing the early branch after that radar is fixed without the need to even perform a responsiveness analysis. Note that there is already a comment about that radar at the top of this function. 2020-06-05 Alex Christensen <achristensen@webkit.org> Fix PDF opening after r262592 https://bugs.webkit.org/show_bug.cgi?id=212795 * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): As Darin mentioned and I was about to discover, my last-minute switching things around got the boolean condition backwards. We want to do nothing if we're not allowed to open the PDF, and we want to open the PDF if we are allowed to.s 2020-06-05 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for PluginLoadClientPolicy <https://webkit.org/b/212827> <rdar://problem/64030431> Reviewed by Alex Christensen. Summary: - Update for renamed PluginLoadClientPolicy enums. - Update to make PluginLoadClientPolicy type work with IPC. - Replace uint8_t with strongly-typed PluginLoadClientPolicy. * Scripts/webkit/messages.py: * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: (WebKit::NetscapePluginModule::getPluginInfo): * Shared/WebProcessCreationParameters.h: * UIProcess/API/C/WKAPICast.h: (WebKit::toWKPluginLoadClientPolicy): (WebKit::toPluginLoadClientPolicy): * UIProcess/API/Cocoa/WKProcessPool.mm: (toPluginLoadClientPoliciesHashMap): (policiesHashMapToDictionary): (isPluginLoadClientPolicyAcceptable): Delete. - Replace with WTF::isValidEnum<WebCore::PluginLoadClientPolicy>(). * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setPluginLoadClientPolicy): (WebKit::WebProcessPool::resetPluginLoadClientPolicies): * UIProcess/WebProcessPool.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::pluginInfo): * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::webVisiblePluginInfo): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setPluginLoadClientPolicy): (WebKit::WebProcess::resetPluginLoadClientPolicies): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-06-05 Alex Christensen <achristensen@webkit.org> Update header documentation for WKPreferences.fraudulentWebsiteWarningEnabled https://bugs.webkit.org/show_bug.cgi?id=212843 <rdar://problem/64010164> Reviewed by Geoffrey Garen. * UIProcess/API/Cocoa/WKPreferences.h: 2020-06-05 Brent Fulgham <bfulgham@apple.com> [iOS] Remove message filtering telemetry for expected case https://bugs.webkit.org/show_bug.cgi?id=212841 <rdar://problem/63893460> Reviewed by Per Arne Vollan. Remove unintentional telemetry being captured for expected behavior. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-05 Per Arne Vollan <pvollan@apple.com> [Cocoa] Adopt read-only mode for preferences in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=212411 <rdar://problem/63640788> Reviewed by Darin Adler. The WebContent process should never write preferences. Adopt read-only mode for preferences. This will fix some sandbox violations when the UI process is notifying the WebContent process about preference changes. When notified, the WebContent process will use the preferences API to write those preferences in-process, but there should be no attempt at writing these new values to disk, which this patch will ensure. No new tests, since this is fixing a benign sandbox violation. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): 2020-06-05 Per Arne Vollan <pvollan@apple.com> [iOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=212837 <rdar://problem/63830368> Reviewed by Darin Adler. Add required message to message filter in the iOS WebContent sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-05 Peng Liu <peng.liu6@apple.com> REGRESSION (r262456?): [macOS] media/picture-in-picture/picture-in-picture-api tests are flaky timeouts https://bugs.webkit.org/show_bug.cgi?id=212762 Reviewed by Eric Carlson. The Picture-in-Picture implementation expects the two callbacks HTMLVideoElement::didBecomeFullscreenElement() and HTMLVideoElement::setVideoFullscreenFrame() to come in order. So we need to remove the dispatch_async() and call HTMLVideoElement::didBecomeFullscreenElement() directly. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): 2020-06-05 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes, early summer 2020 edition https://bugs.webkit.org/show_bug.cgi?id=212819 Unreviewed build fix. * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Add missing WebCore:: namespace to a couple of uses of WebCore::FloatSize. * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: Add missing Logging.h header. 2020-06-05 Andy Estes <aestes@apple.com> [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) https://bugs.webkit.org/show_bug.cgi?id=212541 <rdar://problem/63781452> Reviewed by Darin Adler. APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled. * Configurations/FeatureDefines.xcconfig: 2020-06-05 youenn fablet <youenn@apple.com> [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=206582 <rdar://problem/58985368> Reviewed by Eric Carlson. Enable RemoteMediaRecorder only for systems supporting AVAssetWriterDelegate. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp: * GPUProcess/webrtc/RemoteMediaRecorderManager.h: * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): 2020-06-05 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r262184): [GTK] Two fast/forms tests are crashing https://bugs.webkit.org/show_bug.cgi?id=212747 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::handleKeyPress): Return early if the menu has already been closed. 2020-06-05 Youenn Fablet <youenn@apple.com> Generate code to set the runtime settings for a service worker process https://bugs.webkit.org/show_bug.cgi?id=212467 Reviewed by Alex Christensen. Split the code generated to handle web preference changes to have one method for process wide flags and one for page settings. Make the process wide flag method static and reuse it in WebSWContextManagerConnection. Covered by existing tests. * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: 2020-06-04 David Kilzer <ddkilzer@apple.com> [IPC] Adopt enum class for PluginProcessType and PluginProcessSandboxPolicy <https://webkit.org/b/212758> Reviewed by Darin Adler. * PluginProcess/mac/PluginProcessMac.mm: (WebKit::PluginProcess::platformInitializePluginProcess): * Scripts/webkit/messages.py: * Shared/Plugins/PluginProcessAttributes.h: (WebKit::PluginProcessType): Convert to enum class. (WebKit::PluginProcessSandboxPolicy): Ditto. * UIProcess/Plugins/PluginProcessManager.cpp: (WebKit::PluginProcessManager::fetchWebsiteData): (WebKit::PluginProcessManager::deleteWebsiteData): (WebKit::PluginProcessManager::deleteWebsiteDataForHostNames): * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::didFinishLaunching): * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::findPlugin): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createPlugin): (WebKit::WebPage::canPluginHandleResponse): 2020-06-04 Alex Christensen <achristensen@webkit.org> Add WKUIDelegate SPI to confirm before opening a PDF https://bugs.webkit.org/show_bug.cgi?id=212795 <rdar://problem/58715847> Reviewed by Tim Horton. * UIProcess/API/APIUIClient.h: (API::UIClient::confirmPDFOpening): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::confirmPDFOpening): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication): (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::openWithNativeApplication): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::savePDFToTemporaryFolderAndOpenWithNativeApplication): * WebProcess/WebPage/WebPage.h: 2020-06-04 Chris Dumez <cdumez@apple.com> UIProcess may crash after its prewarmed WebProcess gets terminated https://bugs.webkit.org/show_bug.cgi?id=212790 <rdar://problem/63696191> Reviewed by Geoffrey Garen. Query WebProcessProxy::isDummyProcessProxy() because trying to look up the process in m_dummyProcessProxies. The key for m_dummyProcessProxies is a sessionID but not all processes have a sessionID. In particular, prewarmed web processes have no associated WebsiteDataStore and thus not sessionID. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::disconnectProcess): 2020-06-04 Brent Fulgham <bfulgham@apple.com> Reduce telemetry and report generation for WebContent Process sandbox https://bugs.webkit.org/show_bug.cgi?id=212779 <rdar://problem/63769879> Reviewed by Per Arne Vollan. This patch cleans up a set of telemetry and reports generated during normal WebKit operation. Now that we understand the uses of these XPC services, we can reduce the logging traffic. This is important to do now, since generating the telemetry and reports has a non-zero power cost. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-06-04 Jiewen Tan <jiewen_tan@apple.com> Disable CFNetwork AppSSO interception for Mac Catalyst https://bugs.webkit.org/show_bug.cgi?id=212787 <rdar://problem/63738783> Reviewed by Chris Dumez. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 2020-06-04 Brent Fulgham <bfulgham@apple.com> Reduce telemetry and report generation for Network Process sandbox https://bugs.webkit.org/show_bug.cgi?id=212778 <rdar://problem/63891745> Reviewed by Per Arne Vollan. This patch cleans up a set of telemetry and reports generated during normal WebKit operation. Now that we understand the uses of these XPC services, we can reduce the logging traffic. This is important to do now, since telemetry and report generation has battery life and performance impact. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-06-04 Jacob Uphoff <jacob_uphoff@apple.com> Unreviewed, reverting r262546. This commit caused internal build failures Reverted changeset: "[Cocoa] Adopt read-only mode for preferences in the WebContent process" https://bugs.webkit.org/show_bug.cgi?id=212411 https://trac.webkit.org/changeset/262546 2020-06-04 Chris Dumez <cdumez@apple.com> [iOS] Drop DependentProcessLink ProcessAssertion as it creates power leaks https://bugs.webkit.org/show_bug.cgi?id=212768 <rdar://problem/62408828> Reviewed by Alex Christensen. Drop DependentProcessLink ProcessAssertion since it creates a process assertion cycle between the UIProcess and the WebContent process and leads to power leaks. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/ProcessAssertion.h: * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::assertionName const): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didSetAssertionType): * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::runningBoardNameForAssertionType): (WebKit::flagsForAssertionType): (WebKit::toBKSProcessAssertionReason): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-06-04 Brent Fulgham <bfulgham@apple.com> Revise sandbox to support network stack telemetry without sandbox violation reports https://bugs.webkit.org/show_bug.cgi?id=212720 <rdar://problem/63895783> Reviewed by Per Arne Vollan. Telemetry captured for various networking configurations has revealed a handful of mach service connections that should be allowed in the Network Process to support troubleshooting and field diagnostics. This patch revises the sandbox to avoid logging these accesses during normal operation. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Do not generate traces for 'com.apple.diagnosticd'. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Ditto. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Allow 'com.apple.osanalytics.osanalyticshelper' to be used on internal development builds. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Update to handle both 'diagnosticd' and 'osanalyticshelper' as optional services for internal builds. (WebKit::WebProcessCreationParameters::decode): Ditto. * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::diagnosticServices): Ditto. (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Ditto. 2020-06-04 Per Arne Vollan <pvollan@apple.com> [Cocoa] Adopt read-only mode for preferences in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=212411 <rdar://problem/63640788> Reviewed by Darin Adler. The WebContent process should never write preferences. Adopt read-only mode for preferences. This will fix some sandbox violations when the UI process is notifying the WebContent process about preference changes. When notified, the WebContent process will use the preferences API to write those preferences in-process, but there should be no attempt at writing these new values to disk, which this patch will ensure. No new tests, since this is fixing a benign sandbox violation. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): 2020-06-04 Per Arne Vollan <pvollan@apple.com> [iOS] The WebContent process should be allowed to consume an extension to the runningboard service https://bugs.webkit.org/show_bug.cgi?id=212753 <rdar://problem/63948859> Reviewed by Chris Dumez. The WebContent process on iOS is failing to consume an extension to the runningboard service, because it is not allowed to do so. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-06-04 Tim Horton <timothy_horton@apple.com> Work around broken system version macro https://bugs.webkit.org/show_bug.cgi?id=212726 Reviewed by Dan Bernstein. * Configurations/DebugRelease.xcconfig: 2020-06-04 Andy Estes <aestes@apple.com> [watchOS] Re-enable content filtering in the simulator build https://bugs.webkit.org/show_bug.cgi?id=212711 <rdar://problem/63938350> Reviewed by Wenson Hsieh. * Configurations/FeatureDefines.xcconfig: 2020-06-04 Kate Cheney <katherine_cheney@apple.com> ITP SQLite Database should only vacuum once per day https://bugs.webkit.org/show_bug.cgi?id=212712 <rdar://problem/63939711> Reviewed by Brent Fulgham. Currently the SQLite Database runs a vacuum command each time statistics are processed. This is probably too frequent, because the database rarely needs to delete large amounts of data. We can cut this down to once a day. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::performDailyTasks): 2020-06-04 Youenn Fablet <youenn@apple.com> Minor optimisation to RemoteAudioBusData::decode https://bugs.webkit.org/show_bug.cgi?id=212692 Reviewed by Eric Carlson. * WebProcess/GPU/media/RemoteAudioBusData.h: (WebKit::RemoteAudioBusData::decode): Use releaseNonNull to remove some count churn. 2020-06-03 Wenson Hsieh <wenson_hsieh@apple.com> [watchOS] fast/events/watchos/change-focus-during-change-event.html crashes https://bugs.webkit.org/show_bug.cgi?id=212722 <rdar://problem/60633339> Reviewed by Andy Estes. When HAVE(QUICKBOARD_COLLECTION_VIEWS) is enabled, the codepath that's used to simulate interacting with the select menu view controller on watchOS will crash, since it tries to pretend that the user has selected an item in a table view section (`PUICQuickboardListSectionTextOptions`) that only exists when Quickboard collection views are disabled. Fix the crash by adjusting the testing codepath to select the item in the first section when HAVE(QUICKBOARD_COLLECTION_VIEWS) is defined. * UIProcess/ios/forms/WKSelectMenuListViewController.mm: (-[WKSelectMenuListViewController selectItemAtIndex:]): 2020-06-03 Jer Noble <jer.noble@apple.com> [iOS] Hide the PiP button in fullscreen mode if PiP is disabled in preferences https://bugs.webkit.org/show_bug.cgi?id=212699 <rdar://problem/60391437> Reviewed by Eric Carlson. In r260474, we hid the PiP button in fullscreen when PiP was unsupported on the current device; we must also hide the PiP button when clients have disabled PiP via preferences. * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController videoControlsManagerDidChange]): 2020-06-03 Kate Cheney <katherine_cheney@apple.com> Any active sqlite transactions for the ITP database should be aborted when the network process suspends. https://bugs.webkit.org/show_bug.cgi?id=212608 <rdar://problem/60540768> Reviewed by Chris Dumez. Calls to WebResourceLoadStatisticsStore::suspend() should abort any active SQLite transactions. Unfinished transactions will hold the lock of a database file and could cause the network process to crash when suspending. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::~ResourceLoadStatisticsDatabaseStore): Store all ResourceLoadStatisticsDatabaseStore instances in a static HashSet so existing transactions can be aborted when the process is preparing to suspend. (WebKit::ResourceLoadStatisticsDatabaseStore::interrupt): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::suspend): 2020-06-03 Chris Dumez <cdumez@apple.com> WebProcessPool::notifyPreferencesChanged() is unsafely called on a background thread https://bugs.webkit.org/show_bug.cgi?id=212697 <rdar://problem/63876652> Reviewed by Per Arne Vollan. Make sure we dispatch to the main thread in [WKPreferenceObserver preferenceDidChange] before we iterate over the process pools and call WebProcessPool::notifyPreferencesChanged() on each one. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKPreferenceObserver preferenceDidChange:key:encodedValue:]): 2020-06-03 Brent Fulgham <bfulgham@apple.com> [iOS] Reduce sandbox logging by permitting necessary sysctl https://bugs.webkit.org/show_bug.cgi?id=212710 <rdar://problem/63900239> Reviewed by Per Arne Vollan. Telemetry indicates that we need to access "sysctl.name2oid" in the Network process during error handling for HTTP connections. Allow this access and avoid generating unnecessary logging for this case. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-06-03 Youenn Fablet <youenn@apple.com> Add more logging related to service worker fetch event handling https://bugs.webkit.org/show_bug.cgi?id=212632 <rdar://problem/63913271> Unreviewed. Build fix. * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse): 2020-06-03 Alex Christensen <achristensen@webkit.org> Pass WebPageProxyIdentifier to PreconnectTask https://bugs.webkit.org/show_bug.cgi?id=212648 Reviewed by Chris Dumez. Otherwise, AuthenticationManager::didReceiveAuthenticationChallenge sometimes returned early because there was no pageID. Observed connecting to real websites from my home wifi. Unable to test using local servers because connecting happens too fast. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preconnectTo): 2020-06-03 Rob Buis <rbuis@igalia.com> Make generated C++ code use modern C++ https://bugs.webkit.org/show_bug.cgi?id=190714 Reviewed by Jonathan Bedard. Replace typedef usage by alias-declaration. * Scripts/test-legacyMessages.h: * Scripts/test-superclassMessages.h: * Scripts/testMessages.h: * Scripts/webkit/messages.py: 2020-06-03 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] WTR: Forward key events to the active popup menu https://bugs.webkit.org/show_bug.cgi?id=212690 Reviewed by Adrian Perez de Castro. I forgot to remove the ifdefs when added support for popup menus in r262414. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeKeyEvent): 2020-06-03 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Fix input methods https://bugs.webkit.org/show_bug.cgi?id=212317 Reviewed by Adrian Perez de Castro. Stop using GdkEvent to synthesize compositing events, add a specific NativeWebKeyboardEvent constructor for them. * Shared/NativeWebKeyboardEvent.h: * Shared/gtk/NativeWebKeyboardEventGtk.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp: (webkitInputMethodContextImplGtkSetClientWidget): (webkitInputMethodContextImplGtkSetClientWindow): Deleted. * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseRealize): (webkitWebViewBaseUnrealize): (webkitWebViewBaseKeyPressEvent): (webkitWebViewBaseKeyReleaseEvent): (webkitWebViewBaseFocusEnter): (webkitWebViewBaseFocusLeave): (webkitWebViewBaseKeyPressed): (webkitWebViewBaseKeyReleased): (toplevelWindowIsActiveChanged): (webkitWebViewBaseSynthesizeCompositionKeyPress): 2020-06-03 Santosh Mahto <santosh.mahto@collabora.com> [GTK4] Implement file chooser https://bugs.webkit.org/show_bug.cgi?id=212322 Reviewed by Carlos Garcia Campos. Port FileChooser to gtk4, Now FileChooser uses undeprecated api's. Covered by existing tests. * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (fileChooserDialogResponseCallback): (webkitWebViewRunFileChooser): 2020-06-03 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Implement emoji chooser https://bugs.webkit.org/show_bug.cgi?id=212330 Reviewed by Adrian Perez de Castro. GtkEmojiChooser is public API in GTK4, so just use that instead of our own. * UIProcess/API/gtk/WebKitEmojiChooser.cpp: (emojiActivated): Close the popover before emitting emoji-picked for consistency with GTK. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate): (_WebKitWebViewBasePrivate::releaseEmojiChooserTimerFired): (webkitWebViewBaseDispose): (emojiChooserClosed): (webkitWebViewBaseShowEmojiChooser): 2020-06-03 Youenn Fablet <youenn@apple.com> Add more logging related to service worker fetch event handling https://bugs.webkit.org/show_bug.cgi?id=212632 Reviewed by Chris Dumez. Add logging to identify the page ID and frame ID used by a service worker. Add logging to identify what is happening in the case of a response being buffered for navigation purposes. * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient): (WebKit::WebSWContextManagerConnection::installServiceWorker): (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse): * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: (WebKit::WebServiceWorkerFetchTaskClient::didFail): (WebKit::WebServiceWorkerFetchTaskClient::didFinish): (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse): 2020-06-02 Chris Dumez <cdumez@apple.com> [iOS] WKProcessAssertionBackgroundTaskManager incorrectly ignores expiration notifications for daemons https://bugs.webkit.org/show_bug.cgi?id=212619 Reviewed by Alex Christensen. WKProcessAssertionBackgroundTaskManager was incorrectly ignoring process assertion expiration notifications for daemons, because it was relying on visibility to make decisions. For daemons (or ViewServices), we would not get application visibility notifications and would therefore always assume the app is visible. As a result, _handleBackgroundTaskExpiration would think it received an outdated expiration notification for a visible app and would simply re-take the assertion right away. To address the issue, we now rely on a RunningBoard API that lets us know if the suspension timer has been started or not (and how much remains on the timer). If the suspension timer is not active when get receive the expiration notification, we know it is an outdated notification and we ignore it (release and re-take assertion right away). This can happen if we did not have time to process the expiration notification before suspended and thus only get it upon resuming. It can also happen if the user re-activates the app right after the expiration notice has been sent. * Platform/spi/ios/RunningBoardServicesSPI.h: * UIProcess/ios/ProcessAssertionIOS.mm: (processHasActiveRunTimeLimitation): (-[WKProcessAssertionBackgroundTaskManager init]): (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread]): (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]): 2020-06-02 Christopher Reid <chris.reid@sony.com> REGRESSION[r260844]: [GTK][WPE] Inspector GResource no longer updated after WebInspectorUI file updates https://bugs.webkit.org/show_bug.cgi?id=212583 Reviewed by Adrian Perez de Castro. Add a cmake dependency on inspector resource stamp so the Glib Inspector resources rebuild when the stamp is updated. * InspectorGResources.cmake: 2020-06-02 Keith Rollin <krollin@apple.com> Revert FEATURES_DEFINES related changes https://bugs.webkit.org/show_bug.cgi?id=212664 <rdar://problem/63893033> Reviewed by Andy Estes. Bug 262310, Bug 262311, Bug 262318, and Bug 262331 involve changes to FEATURE_DEFINES and how the values there relate to those found in the Platform*.h files. Those changes break XCBuild (by removing the .xcfilelist related to UnifiedSources and the process for generating them), and so are being reverted. * Configurations/FeatureDefines.xcconfig: 2020-06-02 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r262424. Caused webkitpy test failure Reverted changeset: "Make generated C++ code use modern C++" https://bugs.webkit.org/show_bug.cgi?id=190714 https://trac.webkit.org/changeset/262424 2020-06-02 Peng Liu <peng.liu6@apple.com> Stressing webkitSetPresentationMode leads to wrong inline video dimensions https://bugs.webkit.org/show_bug.cgi?id=202425 Reviewed by Eric Carlson. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): 2020-06-02 Kate Cheney <katherine_cheney@apple.com> Assert network process is not suspended when trying to merge new ITP data https://bugs.webkit.org/show_bug.cgi?id=212663 <rdar://problem/63892899> Reviewed by Chris Dumez. Add a debug assert to check if statistics are being merged into the ITP database after prepareToSuspend() has been called. If this assert is hit, it means the ITP database thread is not being stopped when the process is suspended. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): 2020-06-02 Per Arne Vollan <pvollan@apple.com> REGRESSION(r261387): Introduced sandbox violations https://bugs.webkit.org/show_bug.cgi?id=212634 Reviewed by Darin Adler. The change set r261387 introduced some new mach lookup sandbox violations, when attempting to close Launch Services connections that were not open. Fix this by only attempting to close open connections, and do it while holding the extension to the database mapping service. No new tests, since this patch is fixing benign sandbox violations. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-06-02 Youenn Fablet <youenn@apple.com> Allow using web processes for service workers even though they loaded about URLs https://bugs.webkit.org/show_bug.cgi?id=212464 Reviewed by Chris Dumez. Before the patch, a web process that loads about:blank will not be able to run service workers. A web process that is running service workers and is loading an about:blank page will also kill its service workers. To prevent this, do not take into account about:blank URLs for the computation of the registrable domain of a process. Covered by API tests. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame): 2020-06-02 Tim Horton <timothy_horton@apple.com> macCatalyst: WKWebView's tint color is not propagated to Web Content process https://bugs.webkit.org/show_bug.cgi?id=212630 Reviewed by Anders Carlsson. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: 2020-06-02 Tim Horton <timothy_horton@apple.com> REGRESSION (r258949): Dynamic user accent color changes are not respected by WKWebView https://bugs.webkit.org/show_bug.cgi?id=212628 <rdar://problem/63436275> Reviewed by Per Arne Vollan. Two issues with the "CFPrefs Direct Mode" mechanism caused dynamic changes to the user accent color preference to not be respected anymore: - the default change, when synchronized to the Web Content process, was written into the wrong domain, because of bug 212627. - AppKit caches the resolved accent color; the cache is invalidated when the a CoreUI notification is posted. Since we synchronize preferences ourselves, the ordering of the default change and notification are no longer guaranteed, so AppKit sometimes reads and re-caches the old accent color. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::userAccentColorPreferenceKey): (WebKit::shouldWriteToAppDomainForPreferenceKey): (WebKit::WebProcess::notifyPreferencesChanged): To fix the first problem, write the default into the standardUserDefaults. This is just a workaround, we need a more general solution to this problem for all global preferences. We know it's OK in this case, because AppKit happens to read from standardUserDefaults. (WebKit::dispatchSimulatedNotificationsForPreferenceChange): To fix the second problem, re-emit the notification once we have synchronized the preference to the Web Content process. 2020-06-02 Rob Buis <rbuis@igalia.com> Make generated C++ code use modern C++ https://bugs.webkit.org/show_bug.cgi?id=190714 Reviewed by Sam Weinig. Replace typedef usage by alias-declaration. * Scripts/webkit/messages.py: 2020-06-02 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Implement data list drop down menu https://bugs.webkit.org/show_bug.cgi?id=212333 Reviewed by Adrian Perez de Castro. Use a GtkPopover for GTK4 instead of a GtkMenu. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createDataListSuggestionsDropdown): * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk): (WebKit::WebDataListSuggestionsDropdownGtk::~WebDataListSuggestionsDropdownGtk): (WebKit::WebDataListSuggestionsDropdownGtk::show): * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h: 2020-06-02 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make popup menus work https://bugs.webkit.org/show_bug.cgi?id=211178 Reviewed by Adrian Perez de Castro. Use a GtkPopover for GTK4 instead of a GtkMenu. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::createPopupMenuProxy): * UIProcess/API/gtk/WebKitPopupMenu.cpp: (WebKit::WebKitPopupMenu::WebKitPopupMenu): (WebKit::menuCloseCallback): (WebKit::WebKitPopupMenu::showPopupMenu): (WebKit::WebKitPopupMenu::hidePopupMenu): (WebKit::WebKitPopupMenu::cancelTracking): (WebKit::WebKitPopupMenu::activateItem): * UIProcess/API/gtk/WebKitPopupMenu.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSizeAllocate): Iterate children and call check_resize on every native one. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback): (WebKit::WebPopupMenuProxyGtk::createPopupMenu): (WebKit::WebPopupMenuProxyGtk::showPopupMenu): (WebKit::WebPopupMenuProxyGtk::hidePopupMenu): (WebKit::WebPopupMenuProxyGtk::treeViewRowActivatedCallback): Deleted. * UIProcess/gtk/WebPopupMenuProxyGtk.h: 2020-06-01 Chris Dumez <cdumez@apple.com> Fix thread-safety issue in [WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration] https://bugs.webkit.org/show_bug.cgi?id=212615 <rdar://problem/63569049> Reviewed by Geoffrey Garen. [WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration] may get called on a background thread by RunningBoard. When this happened it would check the _applicationIsBackgrounded flag on a background thread, which was not safe, it would also call _releaseBackgroundTask on the background thread which definitely was not safe and could lead to crashes such as the one in the radar. To address the issue, we now call callOnMainRunLoopAndWait() as soon as _handleBackgroundTaskExpiration gets called and run the whole implementation on the main thread. Previously, we were already doing a dispatch_sync() to the main thread but only for part of the implementation. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread]): 2020-06-01 Brent Fulgham <bfulgham@apple.com> Remove unused WebContent process sandbox syscall https://bugs.webkit.org/show_bug.cgi?id=212609 <rdar://problem/63764590> Reviewed by Per Arne Vollan. After further testing we have determined that the syscall added in Bug 206260 is not always enabled. Check if the Sandbox recognizes the rule before using it. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-06-01 David Kilzer <ddkilzer@apple.com> Don't use casts to convert between WebCore::DragDestinationAction and {Web,WK}DragDestinationAction types <https://webkit.org/b/212507> Reviewed by Darin Adler. * Shared/API/Cocoa/_WKDragActionsInternal.h: Add. (WebKit::coreDragDestinationActionMask): - Add conversion function to avoid casting. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::draggingEntered): (WebKit::WebViewImpl::draggingUpdated): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dragDataForDropSession:dragDestinationAction:]): - Make use of coreDragDestinationActionMask() conversion function. - Extract `dragOperationMask` varible for future updates. * WebKit.xcodeproj/project.pbxproj: - Add _WKDragActionsInternal.h to project. 2020-06-01 Alex Christensen <achristensen@webkit.org> Fix Glib build after r262391 https://bugs.webkit.org/show_bug.cgi?id=212604 * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextConstructed): 2020-06-01 Alex Christensen <achristensen@webkit.org> Revert r250312 https://bugs.webkit.org/show_bug.cgi?id=212604 <rdar://problem/63779241> Reviewed by Tim Horton. r250312 was a step towards a network process singleton. We aren't there yet, so revert it until we are. There was something trying to keep HSTS storages separate, so let them keep trying. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]): (-[_WKProcessPoolConfiguration hstsStorageDirectory]): * UIProcess/LegacyGlobalSettings.h: (WebKit::LegacyGlobalSettings::setHSTSStorageDirectory): Deleted. (WebKit::LegacyGlobalSettings::hstsStorageDirectory const): Deleted. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): 2020-06-01 Chris Dumez <cdumez@apple.com> ASSERTION FAILURE (r220931): !m_function in ~CompletionHandler() after switch tabs https://bugs.webkit.org/show_bug.cgi?id=212537 <rdar://problem/63766838> Reviewed by Alex Christensen. When WebPage::markAllLayersVolatile(), it would destroy m_pageMarkingLayersAsVolatileCounter, which may not have called its completion handler yet. As a result, we would hit an assertion in the CompletionHandler destructor. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::callVolatilityCompletionHandlers): (WebKit::WebPage::markLayersVolatile): (WebKit::WebPage::cancelMarkLayersVolatile): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::markLayersVolatile): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::prepareToSuspend): (WebKit::WebProcess::markAllLayersVolatile): (WebKit::WebProcess::cancelMarkAllLayersVolatile): * WebProcess/WebProcess.h: 2020-06-01 Sam Weinig <weinig@apple.com> Extended Color: Replace Color constructors taking numeric values with type specific factory functions https://bugs.webkit.org/show_bug.cgi?id=212576 Reviewed by Tim Horton. Replaces all remaining implicit and explicit uses of the Color constructors taking numeric values with explicit calls to makeSimpleColor/makeSimpleColorFromFloats/makeExtendedColor, giving us a consistent way to create colors. Also addes use constexpr SimpleColors where possible. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::drawInContext): * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorToWebCoreColor): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _tapHighlightColorForFastClick:]): * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::showPaintRect): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::drawRect): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::paintSnapshotAtSize): * WebProcess/WebPage/ios/FindControllerIOS.mm: (WebKit::FindIndicatorOverlayClientIOS::drawRect): (WebKit::highlightColor): Deleted. 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add printing support https://bugs.webkit.org/show_bug.cgi?id=212320 Reviewed by Adrian Perez de Castro. Printing API hasn't changed, the only problem was that we were using gtk_dialog_run() and gdk threads deprecated API. * UIProcess/API/gtk/WebKitPrintOperation.cpp: (webkitPrintOperationRunDialog): Remove GTK4 ifdefs. * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::print): Use g_idle_add_full() instead of gdk threads deprecated API. 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Wheel events are always handled by the main frame view https://bugs.webkit.org/show_bug.cgi?id=212593 Reviewed by Adrian Perez de Castro. It's not possible scroll other scrollable areas with the mouse wheel. This is because we are using the given x, y delta in the scroll signal as the position. In GTK4 the scroll event doesn't include a position, so we have to use the last motion event. * Shared/NativeWebWheelEvent.h: * Shared/gtk/NativeWebWheelEventGtk.cpp: (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): Add wheelTicks parameter. * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): New create function that receives the wheelTicks. * Shared/gtk/WebEventFactory.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseScroll): Use the x, y parameters as the delta and take the position from the last motion event. 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Monitor root window to update activity state https://bugs.webkit.org/show_bug.cgi?id=212581 Reviewed by Adrian Perez de Castro. To update ActivityState::IsInWindow and ActivityState::WindowIsActive. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (toplevelWindowStateEvent): (webkitWebViewBaseSetToplevelOnScreenWindow): (webkitWebViewBaseDispose): (toplevelWindowIsActiveChanged): (toplevelWindowStateChanged): (toplevelWindowRealized): (toplevelWindowUnrealized): (webkitWebViewBaseRoot): (webkitWebViewBaseUnroot): (webkit_web_view_base_class_init): 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Fix pointer lock in X11 https://bugs.webkit.org/show_bug.cgi?id=212592 Reviewed by Adrian Perez de Castro. I forgot to forward the motion events for X11 in GTK4. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (MotionEvent::MotionEvent): Add a constructor that receives the positions and state. (webkitWebViewBaseMotion): Notify the pointer lock manager about the event. Also save the last motion event and compute the movement delta. 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make inspector work https://bugs.webkit.org/show_bug.cgi?id=212321 Reviewed by Adrian Perez de Castro. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseRemoveDialog): Added instead of the generic webkitWebViewBaseRemoveChild that has been removed. (webkitWebViewBaseRemoveWebInspector): Just unparent the inspector view instead of caling webkitWebViewBaseRemoveChild. (webkitWebViewBaseDispose): Use specific functions to remove the children. (webkitWebViewBaseSnapshot): Call gtk_widget_snapshot_child() on inspector view if present. (webkitWebViewBaseRemoveChild): Deleted. * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformSave): Remove GTK4 ifdefs. * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformSave): Ditto. * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp: (webkit_inspector_window_init): Show title buttons in inspector window. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): Use the texture size instead of the view size, since it's different when the inspector is attached. 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> REGRESSION(r262184): fast/forms/implicit-submission.html is crashing https://bugs.webkit.org/show_bug.cgi?id=212520 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::activateSelectedItem): Return early if the popup has already been closed. 2020-06-01 Rob Buis <rbuis@igalia.com> Rename ResourceResponseBase::isHTTP to isInHTTPFamily https://bugs.webkit.org/show_bug.cgi?id=208782 Reviewed by Sam Weinig. Adapt to API change. * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::makeStoreDecision): * WebProcess/Plugins/PluginView.cpp: (WebKit::buildHTTPHeaders): 2020-06-01 Michael Catanzaro <mcatanzaro@gnome.org> [WPE][GTK] pthread_create() fails with EPERM in the second WebKitWebProcess with sandbox on https://bugs.webkit.org/show_bug.cgi?id=212380 Reviewed by Adrian Perez de Castro. Dereference scmp_arg_cmp before use. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::setupSeccomp): 2020-05-30 Alex Christensen <achristensen@webkit.org> Deprecate WKBundlePostSynchronousMessage https://bugs.webkit.org/show_bug.cgi?id=212536 Reviewed by Anders Carlsson. * WebProcess/InjectedBundle/API/c/WKBundle.h: 2020-05-30 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] WebDriver: stop using GdkEvent API in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=212465 Reviewed by Adrian Perez de Castro. Use the new internal API to synthesize events. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeKeyEvent): Add type parameter, since WebDriver can send press and release events separately. Also add a parameter to indicate that keyval should be translated according to current state that is required by WebDriver. * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::documentLoadedForFrame): Call resetClickCount(). (WebKit::WebAutomationSession::updateClickCount): Update the click count for the given button position and maximum time and distance. (WebKit::WebAutomationSession::resetClickCount): Reset the click count. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Use webkitWebViewBaseSynthesizeMouseEvent(). (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Use webkitWebViewBaseSynthesizeKeyEvent(). (WebKit::WebAutomationSession::platformSimulateKeySequence): Ditto. (WebKit::doMouseEvent): Deleted. (WebKit::doMotionEvent): Deleted. (WebKit::doKeyStrokeEvent): Deleted. * UIProcess/gtk/KeyBindingTranslator.cpp: Add missing key shortcuts to predefined list. 2020-05-29 Alex Christensen <achristensen@webkit.org> Use correct encoding when converting a WTF::URL to CFURLRef https://bugs.webkit.org/show_bug.cgi?id=212486 Reviewed by Darin Adler. * Shared/API/c/cf/WKURLCF.mm: (WKURLCopyCFURL): * Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): 2020-05-29 Peng Liu <peng.liu6@apple.com> Replace callOnMainThread() with callOnMainRunLoop() in AudioSessionRoutingArbitratorProxyCocoa.mm https://bugs.webkit.org/show_bug.cgi?id=212553 Reviewed by Chris Dumez. Use callOnMainRunLoop() instead of callOnMainThread() in the UIProcess. Also move m_setupArbitrationOngoing flag to the end of the completion handler. No new tests, no functional change. * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator): 2020-05-29 Brent Fulgham <bfulgham@apple.com> [Cocoa] Improve logging quality for non-ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=212551 <rdar://problem/62461099> Reviewed by David Kilzer. In Bug 209522 I switched normal mode logging to use the same privacy-protecting mode we use for ephemeral sessions. This had the unintended consequence of removing network load data used to investigate networking issues. This patch adopts the more fine-grained logging provided by the low-level 'nw_context_privacy_level' setting. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): Adopt 'nw_context_privacy_level' setting. 2020-05-29 Andy Estes <aestes@apple.com> [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4) https://bugs.webkit.org/show_bug.cgi?id=212541 Reviewed by Darin Adler. APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled. * Configurations/FeatureDefines.xcconfig: 2020-05-29 Dean Jackson <dino@apple.com> iOS build fix. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): 2020-05-29 Jer Noble <jer.noble@apple.com> [Mac,WK2] Fullscreen animation missing a few frames at beginning https://bugs.webkit.org/show_bug.cgi?id=212156 <rdar://problem/54799415> Reviewed by Eric Carlson. When starting the enter fullscreen animation, ensure that the fullscreen window is ordered front, and on top of the content, as well as having all the animations configured so that their starting state is in place before calling -[NSWindow enterFullscreenMode:]. Move all the window creation code into -beganEnterFullScreenWithInitialFrame:finalFrame: from _startEnterFullScreenAnimationWithDuration:. Re-use the existing zoomAnimation() and maskAnimation() utility methods, but give the animations a very long duration (since there is no explicit way to start and stop a CAAnimation). This initial animation will be replaced with the final one inside -_startEnterFullScreenAnimationWithDuration:. Separately, explictly disable implicit animations of the fullscreen window during -orderIn: and -orderOut:. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController initWithWindow:webView:page:impl:]): (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): 2020-05-29 Jan-Michael Brummer <jan.brummer@tabos.org> [GTK][WPE] API for WebView audio mute support https://bugs.webkit.org/show_bug.cgi?id=176119 Reviewed by Michael Catanzaro. Test implemented in TestWebKitWebView. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewSetProperty): (webkitWebViewGetProperty): (webkit_web_view_class_init): (webkit_web_view_set_is_muted): (webkit_web_view_is_muted): * UIProcess/API/gtk/WebKitWebView.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebView.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isAudioMuted const): 2020-05-29 Darin Adler <darin@apple.com> Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Rubber-stamped by Simon Fraser. * Configurations/FeatureDefines.xcconfig: Add back ENABLE_CSS_CONIC_GRADIENTS, removed by accident. 2020-05-29 Peng Liu <peng.liu6@apple.com> ASSERT NOT REACHED in IPC::takeAsyncReplyHandler under WebKit::AudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory https://bugs.webkit.org/show_bug.cgi?id=212533 Reviewed by Chris Dumez. When the m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting flag is set, sendWithAsyncReply() may actually send the message synchronously. Therefore, we have to set the async reply handler before actually sending the message. No new tests, fixing test crashes due to assertion failures. * Platform/IPC/Connection.h: (IPC::Connection::sendWithAsyncReply): 2020-05-27 Darin Adler <darin@apple.com> Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h https://bugs.webkit.org/show_bug.cgi?id=212418 Reviewed by Andy Estes. * Configurations/FeatureDefines.xcconfig: Removed 83 of the 119 things defined in this file. There are 36 more that are slightly more complex that we can remove carefully later. 2020-05-29 Darin Adler <darin@apple.com> [Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig https://bugs.webkit.org/show_bug.cgi?id=212451 Reviewed by Sam Weinig. * DerivedSources.make: Use ":=" when calling $(shell) to make sure the same shell command is not invoked over and over again. 2020-05-29 Keith Rollin <krollin@apple.com> Revert switch to XCBuild https://bugs.webkit.org/show_bug.cgi?id=212530 <rdar://problem/63764632> Unreviewed build fix. Bug 209890 enabled the use of XCBuild by default. Since then, some build issues have shown up. While addressing them, temporarily turn off the use of XCBuild by default. * Configurations/WebKit.xcconfig: * WebKit.xcodeproj/project.pbxproj: 2020-05-29 Devin Rousso <drousso@apple.com> Web Inspector: add ITML debuggable/target type https://bugs.webkit.org/show_bug.cgi?id=203300 <rdar://problem/56545896> Reviewed by Joseph Pecoraro and Brian Burg. * UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h: * UIProcess/API/Cocoa/_WKInspectorDebuggableInfoInternal.h: (fromWKInspectorDebuggableType): (toWKInspectorDebuggableType): * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (legacyDebuggableTypeToModernDebuggableType): * UIProcess/socket/RemoteInspectorProtocolHandler.cpp: (WebKit::parseDebuggableTypeFromString): 2020-05-29 Simon Fraser <simon.fraser@apple.com> Prepare for async scrolling in passive wheel event handler regions https://bugs.webkit.org/show_bug.cgi?id=212455 Reviewed by Tim Horton. Clarify the processing for wheel events by adding OptionSet<WheelEventProcessingSteps>, which will, in future, allow us to describe the processing for an event in the passive event handler region which does scrolling on the scrolling thread, and is then sent to the main thread for DOM event dispatch. Removed ScrollingEventResult, which conflated "handled" with "send to another thread". The thread sending behavior is now encoded in the WheelEventProcessingSteps, and we can just use a bool for handled. Scrolling tree and node handleWheelEvent() functions return a WheelEventHandlingResult, which is a tuple of OptionSet<WheelEventProcessingSteps> and 'handled', allowing for a node with background-attachment:fixed to add the "send to main thread" processing step. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent): * 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: * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-05-29 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Implement HTTP auth dialog https://bugs.webkit.org/show_bug.cgi?id=212319 Reviewed by Sergio Villar Senin. * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: (webkitAuthenticationDialogDestroy): (okButtonClicked): (cancelButtonClicked): (authenticationCancelled): (webkitAuthenticationDialogInitialize): (webkitAuthenticationDialogMap): (webkitAuthenticationDialogDispose): (webkitAuthenticationDialogNew): * UIProcess/API/gtk/WebKitAuthenticationDialog.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (webkitWebViewAuthenticate): 2020-05-29 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Implement script dialogs https://bugs.webkit.org/show_bug.cgi?id=212318 Reviewed by Adrian Perez de Castro. Adapt to the GTK4 API and theme changes. * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: (webkitScriptDialogImplClose): (webkitScriptDialogImplKeyPressed): (webkitScriptDialogImplMap): (webkitScriptDialogImplConstructed): (webkitScriptDialogImplDispose): (webkit_script_dialog_impl_class_init): (webkitScriptDialogImplAddButton): (webkitScriptDialogImplNew): (webkitScriptDialogImplSetEntryText): * UIProcess/API/gtk/WebKitScriptDialogImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseAddDialog): (webkitWebViewBaseRemoveChild): (webkitWebViewBaseSnapshot): * UIProcess/API/gtk/WebKitWebViewDialog.cpp: (webkitWebViewDialogSnapshot): (webkitWebViewDialogSizeAllocate): (webkitWebViewDialogConstructed): (webkit_web_view_dialog_class_init): (webkitWebViewDialogSetChild): (webkitWebViewDialogGetChild): * UIProcess/API/gtk/WebKitWebViewDialog.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (webkitWebViewScriptDialog): 2020-05-29 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r261812): editing/async-clipboard/clipboard-item-get-type-basic.html is flaky https://bugs.webkit.org/show_bug.cgi?id=212281 <rdar://problem/63554912> Reviewed by Tim Horton. Declare `-delegateSupportsImagePaste` on UIKeyboardImpl. * Platform/spi/ios/UIKitSPI.h: 2020-05-28 Peng Liu <peng.liu6@apple.com> Clean up WebKit.xcodeproj/project.pbxproj https://bugs.webkit.org/show_bug.cgi?id=212491 Reviewed by Tim Horton. A follow-up patch to add AudioSessionRoutingArbitratorProxyCocoa.mm to the unified build. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Add AudioSessionRoutingArbitratorProxyCocoa.mm to the unified build. * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: Fix a unified build failure. 2020-05-28 Megan Gardner <megan_gardner@apple.com> Avoid unnecessary sync IPC messages when togging the callout bar for selections. https://bugs.webkit.org/show_bug.cgi?id=212508 The loupe gesture only needs to be activated and evaluated if the tap is inside an existing selectionView. We can do that test in the UIProcess without resorting to a sync IPC message. Doing that evaluation locally will eliminate unnecessary hangs in the UIProcess. Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _pointIsInsideSelectionRect:outBoundingRect:]): (-[WKContentView _shouldToggleSelectionCommandsAfterTapAt:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): 2020-05-28 Tim Horton <timothy_horton@apple.com> Fix the macOS build * WebKit.xcodeproj/project.pbxproj: Can't have this file in both the Xcode target and SourcesCocoa.txt... 2020-05-28 Lauro Moura <lmoura@igalia.com> [GTK][WPE] Buildfix after r262242 Unreviewed build fix. * Shared/glib/ArgumentCodersGLib.cpp: (IPC::decode): 2020-05-28 Jonathan Bedard <jbedard@apple.com> watchOS: Upstream WKNumberPadView https://bugs.webkit.org/show_bug.cgi?id=212499 <rdar://problem/63736073> Reviewed by Wenson Hsieh. * UIProcess/ios/forms/WKNumberPadView.h: Moved from WebKitAdditions. * UIProcess/ios/forms/WKNumberPadView.mm: Ditto. 2020-05-28 Jonathan Bedard <jbedard@apple.com> watchOS: Upstream WKTextInputListViewController https://bugs.webkit.org/show_bug.cgi?id=212495 <rdar://problem/63733949> Reviewed by Wenson Hsieh. * UIProcess/ios/forms/WKTextInputListViewController.h: Moved from WebKitAdditions. * UIProcess/ios/forms/WKTextInputListViewController.mm: Ditto. 2020-05-28 Simon Fraser <simon.fraser@apple.com> Simplify EventDispatcher wheel event dispatch https://bugs.webkit.org/show_bug.cgi?id=212490 Reviewed by Tim Horton. The various cross-thread bounces and completion lambdas in EventDispatcher::wheelEvent() and ScrollingTree code made the logic very hard to follow. Moving the ScrollingThread::dispatch() into EventHandler code simplifies things a little, and allows for removal of the hokey "try to handle" ScrollingTree function, as well as the clunky completion function. Now, EventHandler call shouldHandleWheelEventSynchronously(), then does the ScrollingThread::dispatch() which allows the lambda to easily call back into EventHandler for the main thread dispatch. RemoteScrollingCoordinatorProxy/RemoteLayerTree code is unused at present, and will need work. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent): * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::tryToHandleWheelEvent): Deleted. * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): (WebKit::EventDispatcher::dispatchWheelEventViaMainThread): * WebProcess/WebPage/EventDispatcher.h: 2020-05-28 Peng Liu <peng.liu6@apple.com> Clean up WebKit.xcodeproj/project.pbxproj https://bugs.webkit.org/show_bug.cgi?id=212491 Reviewed by Simon Fraser. Remove the references to deleted files and merge duplicated folders. * WebKit.xcodeproj/project.pbxproj: 2020-05-28 Kate Cheney <katherine_cheney@apple.com> Minimum user interaction time in ResourceLoadStatistics should handle the case of -1 https://bugs.webkit.org/show_bug.cgi?id=212445 <rdar://problem/63696470> Reviewed by John Wilander. Tests: http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-statistics-with-no-user-interaction-database.html http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-statistics-with-no-user-interaction.html Adds a getter for mostRecentUserInteractionTime which returns WTF::nullopt if the timestamp is -1. Then does not consider this case in calculating the minimum timestamp. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::getMostRecentUserInteractionTime): (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): Flip sign to be less than, so we hold off on deleting data if the oldest interaction was less than the minimum time between removal. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::getMostRecentUserInteractionTime): (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): Flip sign to be less than, so we hold off on deleting data if the oldest interaction was less than the minimum time between removal. * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: 2020-05-28 Megan Gardner <megan_gardner@apple.com> Do not send a second sync request for positition information to the web process if we have not recieved information since the previous sync request. https://bugs.webkit.org/show_bug.cgi?id=212289 <rdar://problem/58494578> Reviewed by Tim Horton. If we have sent a sync requests to the web process for position information, and timed out, and have not received a message with position information in the interim, do not send another sync request. The web process is likely still hung, and there is no reason to hang the UIProcess again if we suspect that it is unlikely that we will receive a reply. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView ensurePositionInformationIsUpToDate:]): (-[WKContentView _positionInformationDidChange:]): 2020-05-28 Youenn Fablet <youenn@apple.com> ReadableByteStream should be enabled/disabled in service workers as done in pages https://bugs.webkit.org/show_bug.cgi?id=212466 Reviewed by Alex Christensen. Introduce a WebPreference for readable byte stream. Use it for enabling it in web processes running service workers as per the given store. * Shared/WebPreferences.yaml: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): 2020-05-28 Michael Catanzaro <mcatanzaro@gnome.org> [WPE][GTK] GVariant decoding must copy the serialized data https://bugs.webkit.org/show_bug.cgi?id=212441 Reviewed by Carlos Garcia Campos. I tracked this down to ArgumentCodersGLib.cpp. The problem is that we construct a GVariant using g_variant_new_from_data(), which does not copy or take ownership of the data, so here we accidentally create the GVariant using data we don't own. (Here, the data is owned by the Decoder itself in its internal m_buffer.) Anyway, this is fixable by manually copying and freeing it with the GDestroyNotify parameter, but it's easier to switch to g_variant_new_from_bytes() because GBytes takes ownership when constructed. * Shared/glib/ArgumentCodersGLib.cpp: (IPC::decode): 2020-05-28 Youenn Fablet <youenn@apple.com> RemoteAudio::audioSamplesAvailable should check for m_buffer to be null https://bugs.webkit.org/show_bug.cgi?id=212462 <rdar://problem/63627642> Reviewed by Eric Carlson. * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable): m_buffer is initialized by a StorageChanged IPC message which might not always be successful, for instance if the shared memory mapping fails. Return early if m_buffer is not yet initialized properly. 2020-05-28 Youenn Fablet <youenn@apple.com> RealtimeIncomingVideoSourceCocoa::OnFrame should use video frame timestamp https://bugs.webkit.org/show_bug.cgi?id=212402 Reviewed by Eric Carlson. * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp: (WebKit::RemoteSampleBufferDisplayLayer::enqueueSample): * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: 2020-05-27 Keith Rollin <krollin@apple.com> Add output file specifications to "Copy Custom WebContent Resources to Framework Private Headers" build phase in WebKit/WebContent https://bugs.webkit.org/show_bug.cgi?id=212452 <rdar://problem/63700546> Reviewed by Timothy Hatcher. The "Copy Custom WebContent Resources to Framework Private Headers" build phase in the WebContent target of the WebKit project doesn't advertise the files that it produces. This has consequences on later build phases that consume those files. In particular, XCBuild is left not knowing where those files are coming from, and it fails saying that those files don't exist. Fix this by adding the output files to the "output files" section of the custom build phase. No new tests -- this is just a build fix. * WebKit.xcodeproj/project.pbxproj: 2020-05-27 Tim Horton <timothy_horton@apple.com> REGRESSION (PSON): Resizing WKWebView during cross-site navigation results in the page laying out at the wrong size https://bugs.webkit.org/show_bug.cgi?id=212434 <rdar://problem/51621621> Reviewed by Chris Dumez. New API test: ProcessSwap.ResizeWebViewDuringCrossSiteProvisionalNavigation. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::swapToProvisionalPage): Set m_hasRunningProcess before calling setDrawingArea, instead of immediately after, so that setDrawingArea can call methods that check m_hasRunningProcess. (WebKit::WebPageProxy::setDrawingArea): When swapping DrawingAreas, push the current view size down. DrawingArea is initially created with a size, but the size can change while the DrawingArea is still provisional. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::viewSize): Simplify this implementation now that we don't ever need to support WKContentView outside of WKWebView (since 2014 or so). 2020-05-27 Michael Catanzaro <mcatanzaro@gnome.org> REGRESSION(r260318): [WPE][GTK] Uninitialized memory read in MemoryPressureMonitor https://bugs.webkit.org/show_bug.cgi?id=212412 Reviewed by Adrian Perez de Castro. I think this is a false-positive, but let's suppress the warning by zero-initializing this buffer. * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::systemMemoryUsedAsPercentage): 2020-05-27 Kate Cheney <katherine_cheney@apple.com> App-bound sessions should be for iOS only https://bugs.webkit.org/show_bug.cgi?id=212426 <rdar://problem/63678147> Reviewed by Darin Adler. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::SessionWrapper::initialize): (WebKit::NetworkSessionCocoa::sessionWrapperForTask): 2020-05-27 Lauro Moura <lmoura@igalia.com> [WPE] Avoid possible WTR event timing going back in time and fix conversion from s to ms https://bugs.webkit.org/show_bug.cgi?id=212338 Reviewed by Michael Catanzaro. When converting the input timestamps to WallTime, we must somehow adjust them to give meaningful timestamps (due to Dom::Event conversion from timestamp wall time to the time origin from document loading). As WPE timestamps are just intended to be compared among themselves, we use the first processed event as the origin, comparing the following events to it to get an actual time. Test: fast/events/monotonic-event-time.html * Shared/libwpe/WebEventFactory.cpp: (WebKit::wallTimeForEventTime): 2020-05-27 Kate Cheney <katherine_cheney@apple.com> Make sure bundle identifier testing override is set in the network process https://bugs.webkit.org/show_bug.cgi?id=212288 <rdar://problem/63539061> Reviewed by Chris Dumez. Set the bundle identifier in the network process if a layout test updates it. This value usually only gets updated when a new network process is initialized, which does not happen for every test. So it should be set/cleared as needed. No new tests, will fix http/tests/in-app-browser-privacy/ tests. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::updateBundleIdentifierInNetworkProcess): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreUpdateBundleIdentifierInNetworkProcess): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::updateBundleIdentifierInNetworkProcess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::updateBundleIdentifierInNetworkProcess): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-05-27 Per Arne Vollan <pvollan@apple.com> Unreviewed, reverting r260840. This patch is no longer needed after preferences root cause has been fixed. Reverted changeset: "[Cocoa] Global preferences are not accessible in the WebContent process when CFPrefs direct mode is enabled" https://bugs.webkit.org/show_bug.cgi?id=211075 https://trac.webkit.org/changeset/260840 2020-05-27 Michael Catanzaro <mcatanzaro@gnome.org> Unreviewed, fix -Wcomment build warning after r261986 https://bugs.webkit.org/show_bug.cgi?id=211950 <rdar://problem/63482718> If we replace the /* with /* then GCC won't complain that it looks like a comment. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_class_init): 2020-05-27 Brent Fulgham <bfulgham@apple.com> Adjust HTTP3 label to the more correct HTTP/3 https://bugs.webkit.org/show_bug.cgi?id=212416 <rdar://problem/63514072> Reviewed by Darin Adler. No new tests. No change in behavior. * Shared/WebPreferences.yaml: Correct label. 2020-05-27 Devin Rousso <drousso@apple.com> Web Inspector: replace `featureGuard` and `availability` with a combined `condition` that accepts any macro https://bugs.webkit.org/show_bug.cgi?id=210014 Reviewed by Brian Burg. Previously, the generated InspectorBackendCommands.js would include code for things that the backend doesn't actually support. By using actual macros and preprocessing that file, we can ensure that the frontend doesn't incorrectly think that something is supported by the page being inspected: - the `Canvas` commands and events related to shader programs/pipelines should only exist when the corresponding context type exists, namely `ENABLE(WEBGL)` and `ENABLE(WEBGPU)`. - iOS doesn't support showing rulers, so create a variant of `DOM.setInspectModeEnabled` that only exists for `PLATFORM(IOS_FAMILY)` that doesn't have the `showRulers` optional parameter, as well as removing `Page.setShowRulers` entirely. - setting the forced appearance should only be possible if dark mode is supported. - web archives only exist if CF is used. * Configurations/FeatureDefines.xcconfig: Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h. * DerivedSources.make: * PlatformMac.cmake: Remove `platform` as it is handled by `condition`. * UIProcess/Automation/Automation.json: 2020-05-27 Zalan Bujtas <zalan@apple.com> [Quirk] Remove stackoverflow.com desktop content quirk. https://bugs.webkit.org/show_bug.cgi?id=212414 Reviewed by Antti Koivisto. Mobile content is fixed now. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommendedForRequest): 2020-05-27 Chris Dumez <cdumez@apple.com> Crash under WebNotificationManager::removeNotificationFromContextMap() https://bugs.webkit.org/show_bug.cgi?id=212410 <rdar://63496726> Reviewed by Alex Christensen. Protect the notification object in WebNotificationManager::didDestroyNotification() since removing it from m_notificationIDMap will deref it and may end up destroying the notification object otherwise. Test: http/tests/notifications/crash-on-navigation.html * WebProcess/Notifications/WebNotificationManager.cpp: (WebKit::WebNotificationManager::didDestroyNotification): 2020-05-27 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. [GTK] Make webkitWebViewBaseSnapshot static * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSnapshot): 2020-05-27 David Kilzer <ddkilzer@apple.com> Use OptionSet<DragDestinationAction> for mask values <https://webkit.org/b/212115> <rdar://problem/63423380> Reviewed by Alex Christensen. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DragData>::encode): (IPC::ArgumentCoder<DragData>::decode): - Switch from decodeEnum() and encodeEnum() to modern equivalents that check for valid enum values. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::draggingEntered): (WebKit::WebViewImpl::draggingUpdated): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dragDataForDropSession:dragDestinationAction:]): * WebProcess/WebCoreSupport/WebDragClient.cpp: (WebKit::WebDragClient::willPerformDragDestinationAction): 2020-05-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make PointerLock work https://bugs.webkit.org/show_bug.cgi?id=212314 Reviewed by Adrian Perez de Castro. Use XLib API for warp and grab, since they are no longer available in GTK4. The grab was not actuially needed under Wayland. Also stop using GdkEvent to keep track of motion events and create the PointerLockManager to be able to test pointer lock and movement delta. * Shared/NativeWebMouseEvent.h: * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Use FloatSize instead of FloatPoint for movement delta. * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebMouseEvent): Ditto. * Shared/gtk/WebEventFactory.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (MotionEvent::MotionEvent): Helper struct to keep track of motion events without using GdkEvent. (MotionEvent::delta): Return the movement delta for the given current event. (webkitWebViewBaseHandleMouseEvent): Use MotionEvent instead of GdkEvent. (webkitWebViewBaseMotionNotifyEvent): Pass the event coordinates to the pointer lock manager since that's the only thing needed. (webkitWebViewBaseRequestPointerLock): Use MotionEvent instead of GdkEvent. (webkitWebViewBaseDidLosePointerLock): Remove GTK4 ifdefs. (webkitWebViewBaseSynthesizeMouseEvent): Forward the event to the pointer lock manager if present. Also keep track of the motion event and set the movement delta. * UIProcess/gtk/PointerLockManager.cpp: (WebKit::PointerLockManager::create): Receive event information as parameters instead of using GdkEvent. (WebKit::PointerLockManager::PointerLockManager): Ditto. (WebKit::PointerLockManager::~PointerLockManager): (WebKit::PointerLockManager::lock): Remove the grab. (WebKit::PointerLockManager::unlock): Remove the ungrab. (WebKit::PointerLockManager::handleMotion): Use NativeWebMouseEvent constructor taking all information as parameters. * UIProcess/gtk/PointerLockManager.h: * UIProcess/gtk/PointerLockManagerWayland.cpp: (WebKit::PointerLockManagerWayland::PointerLockManagerWayland): Receive event information as parameters instead of using GdkEvent. (WebKit::PointerLockManagerWayland::lock): Hide the cursor. (WebKit::PointerLockManagerWayland::unlock): Unhide the cursor. * UIProcess/gtk/PointerLockManagerWayland.h: * UIProcess/gtk/PointerLockManagerX11.cpp: (WebKit::PointerLockManagerX11::PointerLockManagerX11): Receive event information as parameters instead of using GdkEvent. (WebKit::PointerLockManagerX11::lock): Use XGrabPointer. (WebKit::PointerLockManagerX11::unlock): Use XUngrabPointer. (WebKit::PointerLockManagerX11::didReceiveMotionEvent): Use XWarpPointer. * UIProcess/gtk/PointerLockManagerX11.h: 2020-05-27 Philippe Normand <pnormand@igalia.com> Unreviewed, build warning fix after r261986 * UIProcess/API/glib/WebKitSettings.cpp: A colon is needed after the transfer annotation. 2020-05-27 Peng Liu <peng.liu6@apple.com> VideoFullscreenInterfaceAVKit is leaking when a video element enters and exits fullscreen/picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=212293 VideoFullscreenManagerProxy::ensureInterface() makes sure a fullscreen interface object exists (an object will be created if it does not exit). That means an extra object will be created by an IPC message from the Web process after the original video fullscreen interface object has been destroyed (thats happens when a video element is returning to inline from fullscreen or picture-in-picture). Reviewed by Youenn Fablet. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setHasVideo): Don't call VideoFullscreenInterface[AVKit|Mac]::hasVideoChanged() before the instance of VideoFullscreenInterface[AVKit|Mac] is ready. (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): Don't call VideoFullscreenInterface[AVKit|Mac]::videoDimensionsChanged() after the instance of VideoFullscreenInterface[AVKit|Mac] is destroyed. 2020-05-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WTR] EventSender: stop using GdkEvent API in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=212298 Reviewed by Adrian Perez de Castro. Add internal API to WebKitWebViewBase to synthesize events, because with GTK4 it's not possible to create events. In the case of layout tests, the web view is always the target of the events, so we don't really need to send the events to GTK to process them. * Shared/NativeWebKeyboardEvent.h: Add new constructor that doesn't receive a GdkEvent. * Shared/NativeWebMouseEvent.h: Ditto. * Shared/NativeWebWheelEvent.h: Ditto. * Shared/gtk/NativeWebKeyboardEventGtk.cpp: (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent): Create without a GdkEvent. * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Ditto. * Shared/gtk/NativeWebWheelEventGtk.cpp: (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): Ditto. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::doneWithKeyEvent): Return early if event doesn't have a GdkEvent. (WebKit::PageClientImpl::doneWithTouchEvent): Ditto. (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Ditto. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (toWebKitModifiers): (webkitWebViewBaseSynthesizeMouseEvent): (webkitWebViewBaseSynthesizeKeyEvent): (toWebKitWheelEventPhase): (webkitWebViewBaseSynthesizeWheelEvent): * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: Added. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::activePopupMenu const): Return the active popup menu proxy. * UIProcess/gtk/KeyBindingTranslator.cpp: (WebKit::handleKeyBindingsForMap): Make it generic by receiving the map as parameter. (WebKit::handleCustomKeyBindings): Call handleKeyBindingsForMap() passing the custom key bindings map. (WebKit::KeyBindingTranslator::commandsForKeyval): Get commands for the predefined key bindings. This is used only when synthesizing key events since we don't have a GdkEVent to forward to the GtkTextView. * UIProcess/gtk/KeyBindingTranslator.h: * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::popupMenuWidget): Take a ref of the GdkWindow when creating the GdkEvent, since the event will unref it on destroy. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::handleKeyPress): Handle a key press event from its keyval and timestamp. (WebKit::WebPopupMenuProxyGtk::activateSelectedItem): Activate the currently selected item. (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback): Call handleKeyPress(). (WebKit::WebPopupMenuProxyGtk::typeAheadFindIndex): Receive a keyval and timestamp instead of a GdkEvent. (WebKit::WebPopupMenuProxyGtk::typeAheadFind): Ditto. * UIProcess/gtk/WebPopupMenuProxyGtk.h: 2020-05-27 Keith Rollin <krollin@apple.com> Enable the use of XCBuild by default in Apple builds https://bugs.webkit.org/show_bug.cgi?id=209890 <rdar://problem/44182078> Unreviewed build fix. Check the value of XCODE_VERSION_ACTUAL rather than XCODE_VERSION_MAJOR when determining whether to use the XCBuild or non-XCBuild method of running header post-processing scripts. No new tests -- this is a build fix. * WebKit.xcodeproj/project.pbxproj: 2020-05-26 Zan Dobersek <zdobersek@igalia.com> Unreviewed WPE build fix after r262155. * UIProcess/API/wpe/WebKitColor.cpp: (webkit_color_parse): Use CSSParser::parseColor() to do the color parsing. 2020-05-26 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo] Unreviewed clang-cl build fix after r262158 https://bugs.webkit.org/show_bug.cgi?id=211883 std::unique_ptr<WebCore::TextureMapper> can't delete an incomplete type TextureMapper. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.h: 2020-05-26 Andy Estes <aestes@apple.com> Fix the engineering build on internal SDKs * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Silenced a deprecation warning. 2020-05-26 Fujii Hironori <Hironori.Fujii@sony.com> [WinCairo][WK2] Use GraphicsLayerTextureMapper for Accelerated Compositing mode https://bugs.webkit.org/show_bug.cgi?id=211883 Reviewed by Don Olmstead. GraphicsLayerTextureMapper is a simple GraphicsLayer implementation using TextureMapper which is used for WinCairo WebKit1. Add a new LayerTreeHost implementation for GraphicsLayerTextureMapper by copying WinCairo WebKit1's AcceleratedCompositingContext. Windows WebKitTestRunner can't capture the window content for pixel dump tests yet. * PlatformWin.cmake: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/win/WebView.cpp: (WebKit::WebView::WebView): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect): (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: Added. (WebKit::LayerTreeHost::prepareForRendering): (WebKit::LayerTreeHost::compositeLayersToContext): (WebKit::LayerTreeHost::flushPendingLayerChanges): (WebKit::LayerTreeHost::layerFlushTimerFired): (WebKit::LayerTreeHost::LayerTreeHost): (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): (WebKit::LayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush): (WebKit::LayerTreeHost::scheduleLayerFlush): (WebKit::LayerTreeHost::cancelPendingLayerFlush): (WebKit::LayerTreeHost::setRootCompositingLayer): (WebKit::LayerTreeHost::setViewOverlayRootLayer): (WebKit::LayerTreeHost::setNonCompositedContentsNeedDisplay): (WebKit::LayerTreeHost::scrollNonCompositedContents): (WebKit::LayerTreeHost::flushAndRenderLayers): (WebKit::LayerTreeHost::forceRepaint): (WebKit::LayerTreeHost::forceRepaintAsync): (WebKit::LayerTreeHost::sizeDidChange): (WebKit::LayerTreeHost::pauseRendering): (WebKit::LayerTreeHost::resumeRendering): (WebKit::LayerTreeHost::graphicsLayerFactory): (WebKit::LayerTreeHost::contentsSizeChanged): (WebKit::LayerTreeHost::didChangeViewportAttributes): (WebKit::LayerTreeHost::setIsDiscardable): (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged): (WebKit::LayerTreeHost::createDisplayRefreshMonitor): (WebKit::LayerTreeHost::window): (WebKit::LayerTreeHost::enabled): (WebKit::LayerTreeHost::paintContents): (WebKit::LayerTreeHost::deviceScaleFactor const): (WebKit::LayerTreeHost::applyDeviceScaleFactor): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.h: Added. (WebKit::LayerTreeHost::layerTreeContext const): (WebKit::LayerTreeHost::displayID const): * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::nativeWindowHandle): * WebProcess/win/WebProcessMainWin.cpp: 2020-05-25 Darin Adler <darin@apple.com> Eliminate Color constructors that take strings, moving color parsing entirely into the CSS parser https://bugs.webkit.org/show_bug.cgi?id=212296 Reviewed by Sam Weinig. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetComposition): Use WebCore::CSSParser::parseColor. 2020-05-26 Peng Liu <peng.liu6@apple.com> ASSERTION FAILED: m_clientCounts.contains(contextId) - WebKit::VideoFullscreenManagerProxy::removeClientForContext() https://bugs.webkit.org/show_bug.cgi?id=212308 Refactor the implementation of the callback hasVideoInPictureInPictureDidChange(). Reviewed by Jer Noble. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture): (WebKit::VideoFullscreenModelContext::didExitPictureInPicture): (WebKit::VideoFullscreenManagerProxy::hasVideoInPictureInPictureDidChange): Add this function to wrap m_page->uiClient().hasVideoInPictureInPictureDidChange(). (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): Remove the call to hasVideoInPictureInPictureDidChange() because it is too early to do so. (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): Add a call to hasVideoInPictureInPictureDidChange() on Mac as well. This fixes the timeout of TestWebKitAPI.PictureInPicture.ExitPiPOnSuspendVideoElement on Mac. (WebKit::VideoFullscreenManagerProxy::fullscreenModeChanged): Remove the call to hasVideoInPictureInPictureDidChange() because it is not necessary. 2020-05-26 Keith Rollin <krollin@apple.com> Enable the use of XCBuild by default in Apple builds https://bugs.webkit.org/show_bug.cgi?id=209890 <rdar://problem/44182078> Reviewed by Darin Adler. Switch from the "legacy" Xcode build system to the "new" build system (also known as "XCBuild"). Switching to the new system speeds up builds by a small percentage, better validates projects for build-related issues (such as dependency cycles), lets WebKit benefit from future improvements in XCBuild such as those coming from the underlying llbuild open source project, and prepares us for any other tools built for this new ecosystem. Specific changes: - Remove Xcode project and workspace settings that selected the Build system, allowing the default to take hold (which is currently the New build system). - Updated webkitdirs.pm with a terser check for Xcode version. - Update build-webkit and Makefile.shared to be explicit when using the old build system (no longer treat it as a default or fall-back configuration). - Update various xcconfig files similarly to treat the default as using the new build system. - Update various post-processing build steps to check for Xcode 11.4 and to no longer treat the default as using the old build system. * Configurations/WebKit.xcconfig: * WebKit.xcodeproj/project.pbxproj: 2020-05-26 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Fix context menu https://bugs.webkit.org/show_bug.cgi?id=212344 Reviewed by Adrian Perez de Castro. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSizeAllocate): Call gtk_native_check_resize() on the popover to make it appear. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::destroyMenuWidget): There's no gtk_widget_destroy() in GTK4 so we can just unparent it. (WebKit::bindModelToMenuWidget): Do not set the action namespace because that's not possible in GTK4. (WebKit::WebContextMenuProxyGtk::append): Use group.name again for the action name passed to g_menu_item_set_action_and_target_value(). (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk): Use destroyMenuWidget(). 2020-05-25 Alex Christensen <achristensen@webkit.org> Expose more network metrics to WebCoreNSURLSession https://bugs.webkit.org/show_bug.cgi?id=212359 <rdar://problem/62909440> Reviewed by Darin Adler. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): 2020-05-24 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Use the name SimpleColor consistently https://bugs.webkit.org/show_bug.cgi?id=212337 Reviewed by Anders Carlsson. * UIProcess/ios/WKContentViewInteraction.mm: (compositionHighlights): Update for new name of CompositionHighlight::defaultCompositionFillColor. 2020-05-24 Rob Buis <rbuis@igalia.com> Remove NetworkProcess/FileAPI https://bugs.webkit.org/show_bug.cgi?id=212335 Reviewed by Sam Weinig. Remove NetworkProcess/FileAPI, the only file it contains is unused. It seems this could have been removed in r248593. * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: Removed. 2020-05-24 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Stop allowing direct access to the underlying SimpleColor (it is almost always incorrect with respect to extended colors) https://bugs.webkit.org/show_bug.cgi?id=212184 Reviewed by Dean Jackson. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::animationValueFromKeyframeValue): Use toSRGBASimpleColorLossy() to get access to color components. 2020-05-24 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Remove unused file since r261570 I forgot to remove DragAndDropHandler.h. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/gtk/DragAndDropHandler.h: Removed. 2020-05-23 Charlie Turner <cturner@igalia.com> Error sending IPC message: Broken pipe https://bugs.webkit.org/show_bug.cgi?id=206052 Reviewed by Adrian Perez de Castro. The Connection implementation on *nix was not handling socket shutdowns gracefully, this was leading to many IPC error messages being printed. It looks like the "errors" were actually application issues, trying to send messages during socket shutdown sequences, rather than more serious message drop problems. Unclear how to autotest this, but manual testing opening lots of tabs definitely hits these codepaths. * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::Connection::readyReadHandler): Handle ECONNRESET by cleanly closing the connection. (IPC::Connection::sendOutputMessage): Ditto, also handle the wrinkle that for "reasons", Linux can return EPIPE when it means ECONNRESET. 2020-05-22 James Savage <james.savage@apple.com> Create Swift overlay for WebKit framework https://bugs.webkit.org/show_bug.cgi?id=211270 <rdar://problem/60549174> Reviewed by Brady Eidson. Provides Swift-only overlay methods for our NS_REFINED_FOR_SWIFT API. The overlay does not provide different API than its Objective-C counterparts, so overlay testing focuses on ensuring that the overlay produces the expected interface, and provides the expected mappings to and from ObjC. The overlay is defined in a separate Xcode project (from WebKit) by recommendation from the Swift team. Due to build system constraints this project cannot be a sibbling of WebKit.xcodeproj, and must live in a subdirectory. However, because it generally acts as part of the WebKit framework, it still uses the same Version.xcconfig and source file locations as standard WebKit sources. * SwiftOverlay/Configurations/Base.xcconfig: Added. Set some default warnings and product configuration. * SwiftOverlay/Configurations/WebKitSwiftOverlay-maccatalyst.xcconfig: Added. Override SDK configurations to build for Catalyst. * SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Added. These flags were all provided by the Xcode template. * SwiftOverlay/Configurations/WebKitSwiftOverlayTests-maccatalyst.xcconfig: Added. See above. * SwiftOverlay/Configurations/WebKitSwiftOverlayTests.xcconfig: Added. See above. * SwiftOverlay/SwiftOverlay/install-swiftmodules.sh: Added. Provided by the Swift team. * SwiftOverlay/Tests/WebKitSwiftOverlayTests-Info.plist: Added. * SwiftOverlay/Tests/WebKitTests.swift: Added. (WebKitTests.testAPI): This ensures that the function names come through as we expect them to. It also ensures that the functions were correctly set to public visiblity. (WebKitTests.testWKPDFConfigurationRect): This does the same as the above, but also exercises the null <-> nil conversion, and that regular values are correctly round tripped to Objective-C. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything (Catalyst).xcscheme: Added. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything.xcscheme: Added. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: Added. (WKPDFConfiguration.rect): Provide mapping of CGRect.null to nil for Swift. (WKWebView.callAsyncJavaScript(_:arguments:in:completion:)): Provide a Result in the completion handler, and default value for arguments. (WKWebView.evaluateJavaScript(_:in:completion:)): Ditto. (WKWebView.createPDF(configuration:completionHandler:)): Provide a Swift function that takes a Result<Data, Error> instead of (Data?, Error?) tuple. Provide a default value for the configuration. (WKWebView.createWebArchiveData(completionHandler:)): See above. (WKWebView.find(_:configuration:completionHandler:)): See above. 2020-05-22 Chris Dumez <cdumez@apple.com> RELEASE_ASSERT() that InitializeWebKit2() is getting called on the main thread https://bugs.webkit.org/show_bug.cgi?id=212283 Reviewed by Alex Christensen. RELEASE_ASSERT() that InitializeWebKit2() is getting called on the main thread, behind a linked-on-after check. In r217137, we tried to add a dispatch_sync() to the main thread to work around the issue but it was a hack and it can cause deadlocks. It is best to force developers to fix their code by crashing. * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): (WebKit::InitializeWebKit2): * UIProcess/Cocoa/VersionChecks.h: 2020-05-22 Alex Christensen <achristensen@webkit.org> Make download resume workaround forgiving of changes in CFNetwork https://bugs.webkit.org/show_bug.cgi?id=212273 Reviewed by Geoffrey Garen. They broke my workaround. See rdar://problem/63512518 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]): 2020-05-22 Wenson Hsieh <wenson_hsieh@apple.com> [IPC] Add support for specifying `Async WantsConnection` in message files https://bugs.webkit.org/show_bug.cgi?id=212276 Reviewed by Alex Christensen. Augments the IPC message receiver generation script to allow for "Async WantsConnection" in `.message.in` files. Currently, specifying this in a message causes the `connection` argument to be passed twice when handling the IPC message. This is because normal async IPC messages without replies normally don't have the `IPC::Connection` argument, and use the overloaded `handleMessage(Connection& connection, ...)` version of `handleMessage` when `WantsConnection` is specified. However, in the `Async` reply case, we already pass in the `IPC::Connection`. Instead of overloading the method signature, we introduce a different method instead, named `handleMessageAsyncWantsConnection`, which forwards the given `IPC::Connection` along to the member function. Test: TestAsyncMessageWithConnection * Platform/IPC/HandleMessage.h: (IPC::handleMessageAsyncWantsConnection): Add another variant of the message receiver template, for the case where the message receiver wants a connection. This is similar to handleMessageSynchronousWantsConnection, above. * Scripts/test-superclassMessageReceiver.cpp: (Messages::WebPage::TestAsyncMessageWithConnection::callReply): (Messages::WebPage::TestAsyncMessageWithConnection::cancelReply): (Messages::WebPage::TestAsyncMessageWithConnection::send): (WebKit::WebPage::didReceiveMessage): * Scripts/test-superclassMessages.h: (Messages::WebPage::TestAsyncMessageWithConnection::name): (Messages::WebPage::TestAsyncMessageWithConnection::asyncMessageReplyName): (Messages::WebPage::TestAsyncMessageWithConnection::TestAsyncMessageWithConnection): (Messages::WebPage::TestAsyncMessageWithConnection::arguments const): * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: * Scripts/webkit/test-superclass.messages.in: 2020-05-22 Tim Horton <timothy_horton@apple.com> Excessive hang time in iOS Safari under waitForDidUpdateActivityState https://bugs.webkit.org/show_bug.cgi?id=212272 <rdar://problem/62787789> Reviewed by Andy Estes. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState): Make the view state change timeout equivalent on iOS and macOS. We believe that it is preferable to paint white than block the UI process main thread for half a second. Reduce the timeout on iOS to be the same as it has been for years on macOS. 2020-05-22 Alex Christensen <achristensen@webkit.org> Add SPI to unblock third party cookies from WKWebViews with ResourceLoadStatistics turned on https://bugs.webkit.org/show_bug.cgi?id=212058 <rdar://problem/60595539> Reviewed by John Wilander. This value makes NetworkDataTaskCocoa::blockCookies() not do anything for certain WKWebViews. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::blockCookies): (WebKit::NetworkDataTaskCocoa::unblockCookies): (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::setAllowAllThirdPartyCookies): (API::PageConfiguration::allowAllThirdPartyCookies const): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _allowAllThirdPartyCookies]): (-[WKWebViewConfiguration _setAllowAllThirdPartyCookies:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::addParametersShared): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2020-05-22 Chris Dumez <cdumez@apple.com> Regression(r254859) DOM storage event gets fired at the frame that caused the storage modification https://bugs.webkit.org/show_bug.cgi?id=211503 <rdar://problem/62983284> Reviewed by Maciej Stachowiak. r254859 refactored StorageAreaMap's dispatchSessionStorageEvent() & dispatchLocalStorageEvent() to share more code by moving that code to a new framesForEventDispatching() static function. However, framesForEventDispatching() was always using the session storage no matter the call site. It should be using the local storage when called from dispatchLocalStorageEvent(). Test: storage/domstorage/events/storage-event-not-in-originator.html * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::framesForEventDispatching): (WebKit::StorageAreaMap::dispatchSessionStorageEvent): (WebKit::StorageAreaMap::dispatchLocalStorageEvent): 2020-05-22 Tim Horton <timothy_horton@apple.com> REGRESSION (r261978): Cannot click on links with trackpad on iPad https://bugs.webkit.org/show_bug.cgi?id=212262 Reviewed by Andy Estes. No new tests; our current WKMouseGestureRecognizer testing strategy unfortunately bypasses this particular problem. * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]): (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]): (-[WKMouseGestureRecognizer _hoverExited:withEvent:]): (-[WKMouseGestureRecognizer _hoverCancelled:withEvent:]): Don't call super in any of the hover callbacks now that we derive from UIHoverGestureRecognizer. We want to wholly own the state of the gesture, including differences from UIHoverGestureRecognizer behavior such as remaining in the recognizing state while the trackpad button is pressed. We don't need any of the code in the default implementation, so just override it entirely. This returns behavior to what it was like before r261978. 2020-05-21 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Move Color coder definitions to Color to allow for future encaspulation improvements https://bugs.webkit.org/show_bug.cgi?id=212247 Reviewed by Simon Fraser. Move IPC encoder/decoder definitions from WebKit down into Color itself to move closer to making Color::rgb() private. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<Color>::encode): Deleted. (IPC::ArgumentCoder<Color>::decode): Deleted. * Shared/WebCoreArgumentCoders.h: 2020-05-21 Peng Liu <peng.liu6@apple.com> Fix issues of the Picture-in-Picture API under stress tests https://bugs.webkit.org/show_bug.cgi?id=212191 Reviewed by Eric Carlson. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::enterFullscreen): Mock the behavior of the VideoFullscreenInterface[AVKit|Mac] regarding the Picture-in-Picture mode support. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): Add callbacks for the end of entering/exiting fullscreen. 2020-05-21 Tyler Wilcock <twilco.o@protonmail.com> Fix misspelling -- m_releaseNetwrokActivityTimer --> m_releaseNetworkActivityTimer https://bugs.webkit.org/show_bug.cgi?id=212237 Reviewed by Simon Fraser. No new tests required -- simply fixing a misspelling. * UIProcess/Cocoa/NavigationState.h: Rename m_releaseNetwrokActivityTimer to m_releaseNetworkActivityTimer * UIProcess/Cocoa/NavigationState.mm: Rename m_releaseNetwrokActivityTimer to m_releaseNetworkActivityTimer (WebKit::NavigationState::NavigationState): (WebKit::NavigationState::releaseNetworkActivity): (WebKit::NavigationState::didChangeIsLoading): 2020-05-21 Sam Weinig <weinig@apple.com> Extended Color Cleanup: Remove trivial uses of Color::rgb() https://bugs.webkit.org/show_bug.cgi?id=212231 Reviewed by Darin Adler. * UIProcess/API/ios/WKWebViewIOS.mm: (scrollViewBackgroundColor): Replace colorWithOverrideAlpha() with Color::colorWithAlphaUsingAlternativeRounding() to avoid unnecessary use of Color::rgb() 2020-05-21 Alex Christensen <achristensen@webkit.org> Use an OptionSet instead of uint8_t for MessageFlags https://bugs.webkit.org/show_bug.cgi?id=212230 <rdar://problem/63496543> Reviewed by Darin Adler. I also reduce the encoding size of OptionSet. * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder<OptionSet<T>>::encode): (IPC::ArgumentCoder<OptionSet<T>>::decode): * Platform/IPC/Decoder.cpp: (IPC::Decoder::isSyncMessage const): (IPC::Decoder::shouldDispatchMessageWhenWaitingForSyncReply const): (IPC::Decoder::shouldUseFullySynchronousModeForTesting const): * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.cpp: (IPC::Encoder::isSyncMessage const): (IPC::Encoder::shouldDispatchMessageWhenWaitingForSyncReply const): (IPC::Encoder::setIsSyncMessage): (IPC::Encoder::setShouldDispatchMessageWhenWaitingForSyncReply): (IPC::Encoder::setFullySynchronousModeForTesting): (IPC::Encoder::messageFlags): (IPC::Encoder::messageFlags const): * Platform/IPC/Encoder.h: * Platform/IPC/MessageFlags.h: (): Deleted. 2020-05-21 John Wilander <wilander@apple.com> Storage Access API: Allow configurable storage access scope https://bugs.webkit.org/show_bug.cgi?id=212114 <rdar://problem/63423063> Reviewed by Alex Christensen. The scope of storage access as per-frame or per-page was discussed in the standards process here: https://github.com/privacycg/storage-access/issues/3 The decision was to have per-page storage access by default. Recent feedback from Google and conversation with Mozilla suggest that we might want to support the caller choosing the scope. This patch adds support for different scope configurations while keeping the existing default as per-frame. A later patch will switch the default and add test cases for per-page scope. Most of the changes is piping through the new enum WebCore::StorageAccessScope from the call side to encode per-frame and per-page access, and piping through the new struct WebCore::RequestStorageAccessResult on the return side which carries full information about the storage access request result. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::CompletionHandler<void): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess): (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener): (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral): (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessEphemeral): (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInStorageSession): Renamed from WebResourceLoadStatisticsStore::grantStorageAccess() to reduce confusion since we already have another function called WebResourceLoadStatisticsStore::grantStorageAccess(). (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::requestStorageAccess): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * Scripts/webkit/messages.py: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::requestStorageAccess): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::requestStorageAccess): * WebProcess/WebPage/WebPage.h: 2020-05-21 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> [PlayStation] Add minimal WKView API to enable TestWebKitAPI https://bugs.webkit.org/show_bug.cgi?id=211868 Reviewed by Alex Christensen. Enable TestWebKitAPI * Platform/IPC/Connection.h: * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::Connection::platformInvalidate): (IPC::Connection::open): Add SocketMonitor to monitor received messages. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: Add PlayStation specific members: WebProcess and NetworkProcess paths, and user ID. * UIProcess/Launcher/ProcessLauncher.h: Add PlayStation specific members: Process path and user ID. * NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp. (loadLibraryOrExit): (main): * PlatformPlayStation.cmake: * Shared/API/c/playstation/WKEventPlayStation.cpp: Added. (WKKeyboardEventMake): (WKMouseEventMake): (WKWheelEventMake): * Shared/API/c/playstation/WKEventPlayStation.h: Added. * UIProcess/API/C/playstation/WKAPICastPlayStation.h: (WebKit::toAPI<>): (WebKit::toImpl<>): * UIProcess/API/C/playstation/WKContextConfigurationPlayStation.cpp: Copied from Tools\TestWebKitAPI\playstation\PlatformUtilitiesPlayStation.cpp. (WKContextConfigurationSetWebProcessPath): (WKContextConfigurationCopyWebProcessPath): (WKContextConfigurationSetNetworkProcessPath): (WKContextConfigurationCopyNetworkProcessPath): (WKContextConfigurationSetUserId): (WKContextConfigurationGetUserId): * UIProcess/API/C/playstation/WKContextConfigurationPlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h. * UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp: Added. (WKPageHandleKeyboardEvent): (WKPageHandleMouseEvent): (WKPageHandleWheelEvent): * UIProcess/API/C/playstation/WKPagePrivatePlayStation.h: Copied from Source\WebKit\UIProcess\API\C\playstation\WKView.h. * UIProcess/API/C/playstation/WKView.cpp: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp. (WKViewCreate): (WKViewGetPage): * UIProcess/API/C/playstation/WKView.h: * UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp: (WebKit::defaultProcessPath): (WebKit::ProcessLauncher::launchProcess): (WebKit::ProcessLauncher::terminateProcess): (WebKit::ProcessLauncher::platformInvalidate): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getLaunchOptions): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getLaunchOptions): * UIProcess/playstation/PageClientImpl.cpp: Added. (WebKit::PageClientImpl::PageClientImpl): (WebKit::PageClientImpl::createDrawingAreaProxy): (WebKit::PageClientImpl::setViewNeedsDisplay): (WebKit::PageClientImpl::requestScroll): (WebKit::PageClientImpl::viewScrollPosition): (WebKit::PageClientImpl::viewSize): (WebKit::PageClientImpl::isViewWindowActive): (WebKit::PageClientImpl::isViewFocused): (WebKit::PageClientImpl::isViewVisible): (WebKit::PageClientImpl::isViewInWindow): (WebKit::PageClientImpl::processDidExit): (WebKit::PageClientImpl::didRelaunchProcess): (WebKit::PageClientImpl::pageClosed): (WebKit::PageClientImpl::preferencesDidChange): (WebKit::PageClientImpl::toolTipChanged): (WebKit::PageClientImpl::didCommitLoadForMainFrame): (WebKit::PageClientImpl::handleDownloadRequest): (WebKit::PageClientImpl::didChangeContentSize): (WebKit::PageClientImpl::setCursor): (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves): (WebKit::PageClientImpl::didChangeViewportProperties): (WebKit::PageClientImpl::registerEditCommand): (WebKit::PageClientImpl::clearAllEditCommands): (WebKit::PageClientImpl::canUndoRedo): (WebKit::PageClientImpl::executeUndoRedo): (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): (WebKit::PageClientImpl::convertToDeviceSpace): (WebKit::PageClientImpl::convertToUserSpace): (WebKit::PageClientImpl::screenToRootView): (WebKit::PageClientImpl::rootViewToScreen): (WebKit::PageClientImpl::accessibilityScreenToRootView): (WebKit::PageClientImpl::rootViewToAccessibilityScreen): (WebKit::PageClientImpl::doneWithKeyEvent): (WebKit::PageClientImpl::createPopupMenuProxy): (WebKit::PageClientImpl::enterAcceleratedCompositingMode): (WebKit::PageClientImpl::exitAcceleratedCompositingMode): (WebKit::PageClientImpl::updateAcceleratedCompositingMode): (WebKit::PageClientImpl::fullScreenManagerProxyClient): (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider): (WebKit::PageClientImpl::navigationGestureDidBegin): (WebKit::PageClientImpl::navigationGestureWillEnd): (WebKit::PageClientImpl::navigationGestureDidEnd): (WebKit::PageClientImpl::willRecordNavigationSnapshot): (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot): (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame): (WebKit::PageClientImpl::didFinishLoadForMainFrame): (WebKit::PageClientImpl::didFailLoadForMainFrame): (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame): (WebKit::PageClientImpl::didChangeBackgroundColor): (WebKit::PageClientImpl::isPlayingAudioWillChange): (WebKit::PageClientImpl::isPlayingAudioDidChange): (WebKit::PageClientImpl::refView): (WebKit::PageClientImpl::derefView): (WebKit::PageClientImpl::didRestoreScrollPosition): (WebKit::PageClientImpl::userInterfaceLayoutDirection): (WebKit::PageClientImpl::requestDOMPasteAccess): * UIProcess/playstation/PageClientImpl.h: Added. * UIProcess/playstation/WebProcessPoolPlayStation.cpp: (WebKit::WebProcessPool::platformInitialize): * UIProcess/playstation/PlayStationWebView.cpp: Copied from Source\WebKit\UIProcess\playstation\WebProcessPoolPlayStation.cpp. (WebKit::PlayStationWebView::create): (WebKit::PlayStationWebView::PlayStationWebView): (WebKit::PlayStationWebView::~PlayStationWebView): (WebKit::PlayStationWebView::isActive const): (WebKit::PlayStationWebView::isFocused const): (WebKit::PlayStationWebView::isVisible const): * UIProcess/playstation/PlayStationWebView.h: Copied from Source\WebKit\WebProcess\InjectedBundle\playstation\InjectedBundlePlayStation.cpp. (WebKit::PlayStationWebView::page): * WebProcess/EntryPoint/playstation/WebProcessMain.cpp: Copied from Tools\TestWebKitAPI\playstation\main.cpp. (loadLibraryOrExit): (main): * WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp: (WebKit::InjectedBundle::initialize): (WebKit::InjectedBundle::setBundleParameter): * WebProcess/WebPage/AcceleratedSurface.cpp: (WebKit::AcceleratedSurface::create): 2020-05-21 Chris Dumez <cdumez@apple.com> Address post review comments from Mitz after r262004. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::sandboxDataVaultParentDirectory): 2020-05-21 Chris Dumez <cdumez@apple.com> [WK2] WebKit abandons compiled sandbox profiles https://bugs.webkit.org/show_bug.cgi?id=212177 <rdar://problem/54613619> Reviewed by Saam Barati. WebKit generates new compiled sandbox profiles whenever sandbox profiles are updated or whenever webkit directories change (which is super common for WebKitTestRunner). Previous compiled sandbox profiles do not get deleted and therefore may accumulate. To address the issue, we now save compiled sandbox profiles under _CS_DARWIN_USER_TEMP_DIR instead of _CS_DARWIN_USER_CACHE_DIR. The system takes care of deleting the files under _CS_DARWIN_USER_TEMP_DIR upon reboot or if they have not been accessed for 3 days. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::sandboxDataVaultParentDirectory): 2020-05-21 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the iOS 13.4 build after r261978 * Platform/spi/ios/UIKitSPI.h: Only declare `_UIHoverEventRespondable` if HAVE(UI_HOVER_EVENT_RESPONDABLE) is defined. * UIProcess/ios/WKMouseGestureRecognizer.mm: If `_UIHoverEventRespondable` is not present, fall back to declaring internal methods on `UIHoverGestureRecognizer`. 2020-05-21 Yoshiaki JITSUKAWA <yoshiaki.jitsukawa@sony.com> [ConnectionUnix] Set MSG_NOSIGNAL to avoid SIGPIPE https://bugs.webkit.org/show_bug.cgi?id=211719 Reviewed by Don Olmstead. Set MSG_NOSIGNAL to sendmsg()/resvmsg() in order to avoid SIGPIPE when the other process disappears. * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::readBytesFromSocket): (IPC::Connection::sendOutputMessage): 2020-05-21 Enrique Ocaña González <eocanha@igalia.com> [GStreamer][GTK][WPE] Expose and honor the media content types requiring hardware support setting https://bugs.webkit.org/show_bug.cgi?id=211950 Reviewed by Adrian Perez de Castro. Expose mediaContentTypesRequiringHardwareSupport as a setting on WPE and WebKitGTK. * UIProcess/API/glib/WebKitSettings.cpp: (_WebKitSettingsPrivate::_WebKitSettingsPrivate): (webKitSettingsSetProperty): (webKitSettingsGetProperty): (webkit_settings_class_init): (webkit_settings_get_media_content_types_requiring_hardware_support): (webkit_settings_set_media_content_types_requiring_hardware_support): * UIProcess/API/gtk/WebKitSettings.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: * UIProcess/API/wpe/WebKitSettings.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-05-20 Darin Adler <darin@apple.com> Dictation context should be an object identifier, not a type-punned pointer https://bugs.webkit.org/show_bug.cgi?id=212174 Reviewed by Anders Carlsson. * Scripts/webkit/messages.py: Added DictationContext to the list of types that are not C++ classes. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<DictationAlternative>::encode): Updated for change to DictationAlternative structure. (IPC::ArgumentCoder<DictationAlternative>::decode): Ditto. * UIProcess/Cocoa/PageClientImplCocoa.h: Use DictationContext instead of uint64_t. * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::addDictationAlternatives): Ditto. (WebKit::PageClientImplCocoa::removeDictationAlternatives): Ditto. (WebKit::PageClientImplCocoa::dictationAlternatives): Ditto. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::insertDictatedTextAsync): Ditto. * UIProcess/PageClient.h: Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showDictationAlternativeUI): Ditto. (WebKit::WebPageProxy::removeDictationAlternatives): Ditto. (WebKit::WebPageProxy::dictationAlternatives): Ditto. * UIProcess/WebPageProxy.h: Ditto. * UIProcess/WebPageProxy.messages.in: Ditto. * UIProcess/ios/PageClientImplIOS.h: Ditto. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showDictationAlternativeUI): Ditto. * UIProcess/mac/PageClientImplMac.h: Ditto. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::showDictationAlternativeUI): Ditto. * UIProcess/mac/WebPageProxyMac.mm: Removed unneeded include of DictationAlternative.h. * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: Use DictationContext instead of uint64_t. Also marked class final and made everything private. * WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp: (WebKit::WebAlternativeTextClient::removeDictationAlternatives): Ditto. (WebKit::WebAlternativeTextClient::showDictationAlternativeUI): Ditto. (WebKit::WebAlternativeTextClient::dictationAlternatives): Ditto. 2020-05-20 Tim Horton <timothy_horton@apple.com> WKMouseGestureRecognizer should be implemented without using UIKit internals https://bugs.webkit.org/show_bug.cgi?id=212173 <rdar://problem/61163726> Reviewed by Wenson Hsieh. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): * UIProcess/ios/WKMouseGestureRecognizer.h: * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]): (-[WKMouseGestureRecognizer initWithTarget:action:]): Deleted. (-[WKMouseGestureRecognizer setView:]): Deleted. (-[WKMouseGestureRecognizer _wantsHoverEvents]): Deleted. (-[WKMouseGestureRecognizer canPreventGestureRecognizer:]): Deleted. (-[WKMouseGestureRecognizer canBePreventedByGestureRecognizer:]): Deleted. Reimplement WKMouseGestureRecognizer as a UIHoverGestureRecognizer subclass, so we can decouple ourselves a bit from UIKit internals. 2020-05-20 Per Arne Vollan <pvollan@apple.com> [iOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=212100 <rdar://problem/63407155> Reviewed by Brent Fulgham. A message needs to be added to the message filter in the WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-20 Sam Weinig <weinig@apple.com> Replace Color::getHSL() with sRGBToHSL to ensure it at least gives somewhat sensible results for ExtendedColors and reduce code duplication https://bugs.webkit.org/show_bug.cgi?id=212143 Reviewed by Simon Fraser. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _updateScrollViewBackground]): Switch to using Color::lightness(). 2020-05-20 Megan Gardner <megan_gardner@apple.com> Hide password echo when screen is being captured. https://bugs.webkit.org/show_bug.cgi?id=212060 <rdar://problem/47653578> Reviewed by Wenson Hsieh. Use the UIScreen state and notification to determine if the screen is being shared or captured. This flag is for all capture methods, Air Play, Screen Recording, etc. If the screen is being captured, turn off the password echo to prevent the password from being leaked. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): (-[WKContentView _screenCapturedDidChange:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setIsScreenCaptured): * WebProcess/WebCoreSupport/WebEditorClient.h: * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: (WebKit::WebEditorClient::isScreenCaptured const): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::isScreenCaptured const): * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::setIsScreenCaptured): 2020-05-20 ChangSeok Oh <changseok@webkit.org> [GTK] Implement connected and disconnected events of GAMEPAD API with libmanette https://bugs.webkit.org/show_bug.cgi?id=133854 Reviewed by Carlos Garcia Campos. This patch brings initial GAMEPAD API support to the gtk port. We use libmanette, a simple GObject game controller library to handle gamepad connection and input. * SourcesGTK.txt: * UIProcess/Gamepad/UIGamepadProvider.cpp: Add a build flag to void default interface * UIProcess/Gamepad/gtk/UIGamepadProviderGtk.cpp: Added to retrieve WebPageProxy to which a gamepad connects. The returned WebPageProxy handles input events from the gamepad. (WebKit::getWebPageProxy): (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput): * UIProcess/Gamepad/manette/UIGamepadProviderManette.cpp: Added. (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider): (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput): (WebKit::UIGamepadProvider::platformStopMonitoringInput): (WebKit::UIGamepadProvider::platformStartMonitoringInput): 2020-05-20 Kate Cheney <katherine_cheney@apple.com> Support operating dates in ResourceLoadStatisticsDatabaseStore https://bugs.webkit.org/show_bug.cgi?id=212034 <rdar://problem/63349242> Reviewed by Brent Fulgham. Tests: http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-database.html http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed.html http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed-database.html http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html Patch to support Operating Dates in the ResourceLoadStatisticsDatabaseStore. Moves functions out of ResourceLoadStatisticsStore now that each store needs its own implementation. Adds a new function for testing which inserts an expired statistic and makes sure the proper behavior occurs depending on additional parameters. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::createTableQueries): (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::getLeastRecentOperatingDate): (WebKit::ResourceLoadStatisticsDatabaseStore::mergeOperatingDates): (WebKit::ResourceLoadStatisticsDatabaseStore::includeTodayAsOperatingDateIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::hasStatisticsExpired const): (WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting): Migrated Operating Dates functions from ResourceLoadStatisticsStore and implemented them using SQLite instead of a vector. Functionality is identical to the original in-memory implementation. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore): (WebKit::ResourceLoadStatisticsMemoryStore::mergeOperatingDates): (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary): (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const): (WebKit::ResourceLoadStatisticsMemoryStore::insertExpiredStatisticForTesting): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: Migrated Operating Dates functions from ResourceLoadStatisticsStore now that the database store does not use them. * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp: (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk): Spelling error. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore): (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains): (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const): Deleted. (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates): Deleted. (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary): Deleted. (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: (WebKit::OperatingDate::year const): (WebKit::OperatingDate::month const): (WebKit::OperatingDate::monthDay const): These functions should be public now that they are needed outside of this file after migrating OperatingDates functions. (WebKit::ResourceLoadStatisticsStore::parameters const): (WebKit::ResourceLoadStatisticsStore::operatingDates const): Deleted. (WebKit::ResourceLoadStatisticsStore::clearOperatingDates): Deleted. Moved OperatingDates functions to the memory store. Moved operatingDatesWindow constexpr variables to the header file so that the database and memory stores can both use them. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::insertExpiredStatisticForTesting): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::insertExpiredStatisticForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetStatisticsExpiredStatistic): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::insertExpiredStatisticForTesting): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::mergeStatisticForTesting): (WebKit::WebsiteDataStore::insertExpiredStatisticForTesting): * UIProcess/WebsiteData/WebsiteDataStore.h: Function to add expired statistic to the ITP store. 2020-05-20 Chris Dumez <cdumez@apple.com> Deprecate WKBundlePageSetPolicyClient() Injected bundle C API https://bugs.webkit.org/show_bug.cgi?id=212166 Reviewed by Alex Christensen. Deprecate WKBundlePageSetPolicyClient() Injected bundle C API. Approving navigations from the injected bundle can lead to WebProcess terminations like in <rdar://problem/60340647> because the WebProcess is not in a position to do sandbox checks when navigating to file URLs. * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 2020-05-20 Simon Fraser <simon.fraser@apple.com> Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization https://bugs.webkit.org/show_bug.cgi?id=212159 Reviewed by Tim Horton. Plumb an Optional<unsigned> down windowScreenDidChange, which contains the nominal display refresh rate (as frames per second) if available. On macOS, we get this from CVDisplayLinkGetNominalOutputVideoRefreshPeriod(). To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink that doesn't get any observers, but that DisplayLink will very likely get used as soon as we schedule a rendering update. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::nominalFramesPerSecondForDisplay): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::windowDidChangeScreen): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::windowScreenDidChange): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.h: * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::DisplayLink): (WebKit::DisplayLink::nominalFramesPerSecond const): * UIProcess/mac/DisplayLink.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::windowScreenDidChange): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-05-20 Myles C. Maxfield <mmaxfield@apple.com> [iPadOS] -webkit-text-size-adjust:percentage doesn't work in native apps https://bugs.webkit.org/show_bug.cgi?id=212122 <rdar://problem/54560875> Reviewed by Wenson Hsieh. * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::encode const): (WebKit::WebsitePoliciesData::decode): (WebKit::WebsitePoliciesData::applyToDocumentLoader): * Shared/WebsitePoliciesData.h: * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies): 2020-05-20 Kate Cheney <katherine_cheney@apple.com> REGRESSION (r261892) [ Mac Debug ] 4 API tests failing related to ResourceLoadStatistics https://bugs.webkit.org/show_bug.cgi?id=212153 <rdar://problem/63452541> Reviewed by Sihui Liu. Accidentally deleted necessary reset() call for a SQLite statement when converting stored statements to SQLiteStatementAutoResetScope in https://trac.webkit.org/changeset/261892/webkit. This statement is used in a loop with multiple bind() calls so it must be reset. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema): 2020-05-20 Eric Carlson <eric.carlson@apple.com> Update some media logging https://bugs.webkit.org/show_bug.cgi?id=212109 <rdar://problem/63424816> Unreviewed, remove a change unintentionally included in r261899. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _interactivePinchDismissChanged:]): 2020-05-20 Andy Estes <aestes@apple.com> [Mac] UI processes spin when creating the "Share" context menu item https://bugs.webkit.org/show_bug.cgi?id=212137 <rdar://problem/54498394> Reviewed by Wenson Hsieh. On Mac, WebKit has been using the +[NSMenuItem standardShareMenuItemForItems:] SPI to create the "Share" context submenu and menu item. This call performs synchronous IPC and can result in UI process spins. Where available, switch to using the asynchronous -[NSSharingServicePicker getMenuWithCompletion:] SPI instead. This method only creates the submenu, not the menu item, so when using this new method we must create the "Share" menu item ourselves. * UIProcess/mac/WebContextMenuProxyMac.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::getStandardShareMenuItem): (WebKit::WebContextMenuProxyMac::getShareMenuItem): (WebKit::WebContextMenuProxyMac::getContextMenuFromItems): (WebKit::WebContextMenuProxyMac::getContextMenuItem): (WebKit::WebContextMenuProxyMac::showContextMenuWithItems): (WebKit::WebContextMenuProxyMac::createShareMenuItem): Deleted. (WebKit::WebContextMenuProxyMac::createContextMenuFromItems): Deleted. (WebKit::WebContextMenuProxyMac::createContextMenuItem): Deleted. 2020-05-20 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK4 build with GTK 3.98.4 * PlatformGTK.cmake: * UIProcess/API/gtk/WebKitPrintOperation.cpp: (webkitPrintOperationRunDialog): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseAddDialog): (webkitWebViewBaseRemoveChild): (webkitWebViewBaseContainerForall): (webkitWebViewBaseAddWebInspector): (webkitWebViewBaseRemoveWebInspector): (webkitWebViewBaseDispose): (webkitWebViewBaseSizeAllocate): (webkitWebViewBaseConstructed): (webkit_web_view_base_class_init): * UIProcess/API/gtk/WebKitWebViewBase.h: Removed. * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): (WebKit::RemoteWebInspectorProxy::platformSave): * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformCreateFrontendWindow): (WebKit::WebInspectorProxy::platformAttach): (WebKit::WebInspectorProxy::platformDetach): (WebKit::WebInspectorProxy::platformSave): * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk): 2020-05-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add support for drag and drop operations https://bugs.webkit.org/show_bug.cgi?id=211779 Reviewed by Adrian Perez de Castro. * UIProcess/API/gtk/DragSource.h: * UIProcess/API/gtk/DragSourceGtk4.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DropTarget.h: * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::~DropTarget): (WebKit::DropTarget::accept): (WebKit::DropReadAsyncData::DropReadAsyncData): (WebKit::DropTarget::loadData): (WebKit::DropTarget::didLoadData): (WebKit::DropTarget::enter): (WebKit::DropTarget::update): (WebKit::DropTarget::didPerformAction): (WebKit::DropTarget::leave): (WebKit::DropTarget::drop): 2020-05-19 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r258919): fast/events/ios/key-events-comprehensive/key-events-control tests are failing https://bugs.webkit.org/show_bug.cgi?id=212124 <rdar://problem/60893744> Reviewed by Tim Horton. After the changes in r258919, WKContentView's text input traits report that we're in a single line input, even when there is no editable focused element. This prevents UIKit from allowing WebKit to handle the `CTRL + M` key command, which is interpreted at the system level as inserting a line break in a multi-line editable area. It seems odd to consider ourselves in a single line input when there isn't even an editable element focused element; for now, we can fix these failing tests by just going with the default value for the text input traits' `setIsSingleLineDocument` property, but not explicitly setting it to either `NO` or `YES` when no element is focused. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textInputTraits]): 2020-05-19 Sam Weinig <weinig@apple.com> Remove almost always incorrect Color::getRGBA https://bugs.webkit.org/show_bug.cgi?id=212059 Reviewed by Darin Adler and Simon Fraser. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorFillFromWebCoreColor): * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::beginSwipeGesture): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::getDocumentBackgroundColor): Replace Color::getRGBA with Color::toSRGBAComponentsLossy() 2020-05-19 Simon Fraser <simon.fraser@apple.com> Use an ObjectIdentifier<> for DisplayLink observer IDs https://bugs.webkit.org/show_bug.cgi?id=212112 Reviewed by Per Arne Vollan. Replace unsigned observerID with DisplayLinkObserverID, which is a typesafe ObjectIdentifier<>. Use PlatformDisplayID in more places. * Scripts/webkit/messages.py: * Shared/DisplayLinkObserverID.h: Copied from Source/WebKit/UIProcess/mac/DisplayLink.h. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::startDisplayLink): (WebKit::WebProcessPool::stopDisplayLink): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::addObserver): (WebKit::DisplayLink::removeObserver): * UIProcess/mac/DisplayLink.h: * UIProcess/mac/WebProcessProxyMac.mm: (WebKit::WebProcessProxy::startDisplayLink): (WebKit::WebProcessProxy::stopDisplayLink): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/mac/DrawingAreaMac.cpp: (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac): 2020-05-19 Alex Christensen <achristensen@webkit.org> Add _WKDownloadDelegate callback including totalBytesWritten https://bugs.webkit.org/show_bug.cgi?id=212110 <rdar://problem/63358981> Reviewed by Geoffrey Garen. Without this new callback, after resuming a download, a client has no way to tell whether the download was successfully resumed by a server that has proper etag and range request support or whether the download began at the beginning again. A client was guessing that the download did not restart, causing incorrect reported download sizes when the download did restart. Luckily, the data on disk was not corrupted, just the UI. This allows us to fix the UI. Testing covered by expanding the API test for resuming downloads. * NetworkProcess/Downloads/Download.cpp: (WebKit::Download::didReceiveData): * NetworkProcess/Downloads/Download.h: * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::writeDownload): * NetworkProcess/NetworkDataTaskBlob.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]): * UIProcess/API/APIDownloadClient.h: (API::DownloadClient::didReceiveData): * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): * UIProcess/API/Cocoa/_WKDownloadDelegate.h: * UIProcess/Cocoa/DownloadClient.h: * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::DownloadClient): (WebKit::DownloadClient::didReceiveResponse): (WebKit::DownloadClient::didReceiveData): * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::didReceiveData): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::expectedContentLength const): Deleted. (WebKit::DownloadProxy::setExpectedContentLength): Deleted. (WebKit::DownloadProxy::bytesLoaded const): Deleted. (WebKit::DownloadProxy::setBytesLoaded): Deleted. * UIProcess/Downloads/DownloadProxy.messages.in: 2020-05-19 Kate Cheney <katherine_cheney@apple.com> ITP database should finalize all prepared statements before closing https://bugs.webkit.org/show_bug.cgi?id=211929 <rdar://problem/63246945> Reviewed by John Wilander. No new tests, behavior confirmed by existing tests. Convert all SQLite statement objects to be unique pointers to better manage the lifetime of each statement object. Only initialize and prepare an object when it is needed instead of preparing all objects at once. Set each statement to null before closing the database because ~SQLiteStatement() will finalize the statement. This patch removes all reset() commands now that we initialize each statement using SQLiteStatementAutoResetScope. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::close): (WebKit::ResourceLoadStatisticsDatabaseStore::getScopedStatement const): Function to initialize and prepare a statement. (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationship): This function is not used and can be deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::isMigrationNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const): (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const): (WebKit::ResourceLoadStatisticsDatabaseStore::merge): (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic): (WebKit::CompletionHandler<void): (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: Updated all statement variables to end with "Statement" to follow the established pattern. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore): 2020-05-19 Per Arne Vollan <pvollan@apple.com> [iOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=212100 <rdar://problem/63407155> Reviewed by Andy Estes. A message needs to be added to the message filter in the WebContent sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-19 Kate Cheney <katherine_cheney@apple.com> Revert WebKitTestRunner to reset ITP to the memory store between all tests. https://bugs.webkit.org/show_bug.cgi?id=212094 <rdar://problem/63405806> Reviewed by Chris Dumez. Changing this in https://bugs.webkit.org/show_bug.cgi?id=211637 caused test flakiness. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsResetToConsistentState): 2020-05-19 Simon Fraser <simon.fraser@apple.com> Push a PlatformDisplayID to scrolling trees, and allow the scrolling thread to get displayDidRefresh notifications https://bugs.webkit.org/show_bug.cgi?id=211034 Reviewed by Sam Weinig. Prep work for webkit.org/b210884. Have EventDispatcher call displayDidRefresh() on each scrolling tree it knows about. It calls this on the EventDispatcher thread; the scrolling tree is responsible for bouncing that to the scrolling thread. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::displayDidRefreshOnScrollingThread): (WebKit::EventDispatcher::displayWasRefreshed): * WebProcess/WebPage/EventDispatcher.h: 2020-05-19 Wenson Hsieh <wenson_hsieh@apple.com> [macOS] Drag and drop within a contenteditable area duplicates attachment-backed images https://bugs.webkit.org/show_bug.cgi?id=212075 <rdar://problem/62434146> Reviewed by Andy Estes. When the attachment API is enabled, starting a drag on an attachment-element-backed image within a contenteditable area sometimes causes the ranged selection to collapse. This is because `WebViewImpl::startDrag` has a separate codepath for starting a drag with attachment metadata that doesn't invoke `NSView`'s deprecated `-dragImage:at:offset:event:pasteboar:source:slideBack:` method, but instead uses `-beginDraggingSessionWithItems:event:source:`. While the former spins the runloop until the end of the drag session, the latter does not and returns immediately after beginning the drag. As a result, `WebPageProxy::didStartDrag()` is actually invoked after the drag ends when dragging non-attachment content, whereas `WebPageProxy::didStartDrag()` is invoked immediately after beginning the drag when starting a drag in an attachment or attachment-backed image element. This call to `didStartDrag()` is used to inform the web process that dragging has begun, and sets the `m_isStartingDrag` flag on `WebPage` to false. As a result, `m_isStartingDrag` is true over the course of the drag session when dragging non-attachment elements, but it's only true while starting the drag when dragging attachments. This flag is consulted in `WebPage::mouseEvent()` to determine whether we should avoid handling the incoming mouse event when beginning a drag. This prevents these incoming mouse events from triggering selection changes while dragging (for more details, refer to <http://trac.webkit.org/r176687>). Now, if we combine this with the fact that mouse events can be queued up in the UI process (refer to <https://trac.webkit.org/r230817>), it's possible to end up handling these queued mouse events in the web process after `m_isStartingDrag` has been set back to false when dragging an attachment. This doesn't happen when dragging non-attachment content, since we don't call `didStartDrag()` until the drag has already ended, so any queued mouse events are sent to the web process and immediately dropped on the floor since `m_isStartingDrag` is true. To address this, we make a couple of minor adjustments: 1. Invoke `didStartDrag()` right before calling into `-dragImage:at:offset:event:pasteboar:source:slideBack:`, so that we don't wait until the drag ends to set `m_isStartingDrag` to false. This makes the behavior of both codepaths for starting a drag (attachment and non-attachment) consistent, and also makes it consistent with iOS. 2. In `didStartDrag()`, discard any queued mouse events to prevent them from being handled by the page (e.g. causing the selection to change immediately after starting the drag). We already have identical logic to do this when showing a context menu, so we can factor this out into a private `WebPageProxy` helper and call it from both places. Test: WKAttachmentTestsMac.DraggingAttachmentBackedImagePreservesRangedSelection * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::startDrag): Invoke `didStartDrag()` earlier when starting a drag using the deprecated method, such that we don't wait until the drag ends to set `m_isStartingDrag` to false in the web process. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::discardQueuedMouseEvents): Refactor logic to discard all queued mouse events into a separate private helper. (WebKit::WebPageProxy::didStartDrag): Use the above helper to empty queued mouse events when starting a drag. (WebKit::WebPageProxy::showContextMenu): * UIProcess/WebPageProxy.h: 2020-05-19 Andy Estes <aestes@apple.com> [Apple Pay] Add testing and logging for ApplePaySetup https://bugs.webkit.org/show_bug.cgi?id=211972 <rdar://problem/63291965> Reviewed by Alex Christensen. * Shared/ApplePay/PaymentSetupConfiguration.mm: (WebKit::toPlatformConfiguration): (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration): * Shared/ApplePay/PaymentSetupConfigurationWebKit.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::getSetupFeatures): (WebKit::WebPaymentCoordinator::beginApplePaySetup): * WebProcess/ApplePay/WebPaymentCoordinator.h: 2020-05-19 Brent Fulgham <bfulgham@apple.com> REGRESSION(r243149): createMediaElementSource not working https://bugs.webkit.org/show_bug.cgi?id=211394 <rdar://problem/62866132> Reviewed by Per Arne Vollan. I removed access to some Audio services in r243149, because we believed they were already blocked by a global deny command. However, Sandbox rules override generic rules with explicit rules, so the imported sandbox rules were not being blocked. This patch re-adds the rules needed to support these audio routines on iOS hardware. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::mediaRelatedMachServices): 2020-05-19 Chris Dumez <cdumez@apple.com> [iOS] Port Foreground process assertion to RunningBoard https://bugs.webkit.org/show_bug.cgi?id=211795 <rdar://problem/61831863> Reviewed by Geoffrey Garen. Port Foreground process assertion to RunningBoard now that <rdar://problem/62614429> has been fixed. * Configurations/WebKit.xcconfig: * UIProcess/ProcessAssertion.h: * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::runningBoardNameForAssertionType): (WebKit::ProcessAssertion::ProcessAssertion): (WebKit::ProcessAssertion::~ProcessAssertion): (WebKit::ProcessAssertion::isValid const): 2020-05-19 Andy Estes <aestes@apple.com> [Apple Pay] Add testing and logging for ApplePaySetup https://bugs.webkit.org/show_bug.cgi?id=211972 <rdar://problem/63291965> Reviewed by Alex Christensen. * Shared/ApplePay/PaymentSetupConfiguration.mm: (WebKit::toPlatformConfiguration): (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration): * Shared/ApplePay/PaymentSetupConfigurationWebKit.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::getSetupFeatures): (WebKit::WebPaymentCoordinator::beginApplePaySetup): * WebProcess/ApplePay/WebPaymentCoordinator.h: 2020-05-19 Michael Catanzaro <mcatanzaro@gnome.org> [GTK] Add WEBKIT_EDITING_COMMAND_PASTE_AS_PLAIN_TEXT https://bugs.webkit.org/show_bug.cgi?id=212038 Reviewed by Carlos Garcia Campos. * UIProcess/API/gtk/WebKitEditingCommands.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitEditingCommands.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2020-05-18 David Kilzer <ddkilzer@apple.com> Replace TextIndicatorOptions with OptionSet<TextIndicatorOption> <https://webkit.org/b/212051> <rdar://problem/63368556> Reviewed by Simon Fraser. Use OptionSet<TextIndicatorOption> everywhere TextIndicatorOptions was previously used, plus: - Make TextIndicatorOption an enum class. Remove "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes TextIndicatorOption::Bar. - Remove TextIndicatorOptionDefault because OptionSet<> initializes to zero. - Replace static variables (including two globals in WebCore) with constexpr variables. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<TextIndicatorData>::encode): (IPC::ArgumentCoder<TextIndicatorData>::decode): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::dictionaryPopupInfoForRange): * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindIndicator): * WebProcess/WebPage/ios/FindControllerIOS.mm: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::insertDroppedImagePlaceholders): (WebKit::WebPage::computeAndSendEditDragSnapshot): (WebKit::linkIndicatorPositionInformation): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performImmediateActionHitTestAtLocation): 2020-05-18 Andy Estes <aestes@apple.com> http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds https://bugs.webkit.org/show_bug.cgi?id=212000 <rdar://problem/63323082> Reviewed by Youenn Fablet. * Configurations/FeatureDefines.xcconfig: * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * Shared/WebCoreArgumentCoders.h: 2020-05-18 Tim Horton <timothy_horton@apple.com> Rare crash under -[WKContentView resignFirstResponderForWebView] https://bugs.webkit.org/show_bug.cgi?id=212050 <rdar://problem/60187111> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView resignFirstResponderForWebView]): Reorganize this block so that it always takes a strong reference /before/ null checking and using the pointer. Also, add a _page null check. This is a speculative fix for an unreproducible low-rate crash. In theory the existing time-of-check race here should not be a problem, since WKWebView is supposed to be freed on the main thread, and this code runs on the main thread, but we have ample evidence of WKWebView being freed off the main thread in various clients. 2020-05-18 David Kilzer <ddkilzer@apple.com> Use default initializers in TextIndicatorData <https://webkit.org/b/212039> <rdar://problem/63355619> Reviewed by Alex Christensen. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<TextIndicatorData>::encode): (IPC::ArgumentCoder<TextIndicatorData>::decode): - Switch from decodeEnum() and encodeEnum() to modern equivalents that check for valid enum values. 2020-05-18 Wenson Hsieh <wenson_hsieh@apple.com> Replace uses of +self with +class https://bugs.webkit.org/show_bug.cgi?id=212041 Reviewed by Darin Adler. * Shared/API/Cocoa/_WKFrameHandle.mm: (-[_WKFrameHandle isEqual:]): (-[_WKFrameHandle initWithCoder:]): * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::allocFileWrapperInstance const): (WebKit::PageClientImplCocoa::serializableFileWrapperClasses const): * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (+[WKTransformView layerClass]): (+[WKSimpleBackdropView layerClass]): Deleted. (+[WKShapeView layerClass]): Deleted. (-[WKRemoteView initWithFrame:contextID:]): Deleted. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::resetScrollViewDelegate): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView selectFormAccessoryPickerRow:]): (-[WKContentView selectFormPopoverTitle]): 2020-05-18 Alex Christensen <achristensen@webkit.org> WebPageProxy::DidCommitLoadForFrame should use FrameLoadType instead of casting to/from uint32_t for IPC https://bugs.webkit.org/show_bug.cgi?id=212028 <rdar://problem/63343021> Reviewed by David Kilzer. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::didCommitLoadForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): 2020-05-18 Wenson Hsieh <wenson_hsieh@apple.com> Single selection <select> with <optgroups> shows multiple selected options https://bugs.webkit.org/show_bug.cgi?id=199485 <rdar://problem/52757531> Reviewed by Megan Gardner. Fixes a long-standing bug in WKMultipleSelectPicker. Prior to this patch, we rely on the delegate method `-pickerView:row:column:checked:` to be called twice whenever an item is selected: one time for the item that is no longer checked, and another for the newly checked item. This method is responsible for updating the cached `FocusedElementInformation` that determines the data model for the select menu, with the expectation that the unchecked item would be updated to have `isSelected = false;`, and the new checked item would have `isSelected` `= true;`. However, `-pickerView:row:column:checked:` is only called for visible item cells. This means that if the user checks an item, scrolls the select menu items down so that the checked item is offscreen, and then checks a different item, we only get notified that the new item is checked, and as a result, fail to uncheck the previous item. To address this, tweak our logic for handling a single select so that when an item is checked, we additionally update the previously checked item to not be selected. Also, fix what seems to be a bug in the logic for updating `_singleSelectionIndex`, which is currently updated even when the item is unchecked. It seems to work out at the moment, because `-pickerView:row:column:checked:` seems to be called with `checked := YES` after the previous item was unchecked (assuming that it was visible). Test: fast/forms/ios/no-stale-checked-items-in-select-picker.html * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView selectFormAccessoryHasCheckedItemAtRow:]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView selectFormAccessoryHasCheckedItemAtRow:]): Add plumbing for a new testing hook. * UIProcess/ios/forms/WKFormSelectControl.h: * UIProcess/ios/forms/WKFormSelectControl.mm: (-[WKFormSelectControl selectFormAccessoryHasCheckedItemAtRow:]): * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]): (-[WKMultipleSelectPicker pickerView:row:column:checked:]): (-[WKMultipleSelectPicker selectRow:inComponent:extendingSelection:]): Also, fix an existing bug in this testing helper method that crashed the test runner due to calling an unimplemented selector. Instead of trying to invoke `-pickerView:didSelectRow:inComponent:`, we should be using `-pickerView:row:column:checked:` instead for multiple select pickers (which, somewhat confusingly, are still used for single select elements that have `optgroup`s.) (-[WKMultipleSelectPicker selectFormAccessoryHasCheckedItemAtRow:]): 2020-05-18 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Unexpected capitalization of next word after repositioning caret https://bugs.webkit.org/show_bug.cgi?id=211969 <rdar://problem/62605526> Reviewed by Alex Christensen. The changes in r242551 refactored synchronous autocorrection context request logic such that it uses `waitForAndDispatchImmediately` instead of `sendSync`, in order to make it interruptible by unbounded sync IPC sent from the web process. If the UI process receives sync IPC, it will immediately cancel the autocorrection context request (returning an empty context), before proceeding to handle the incoming sync IPC. In a more recent version of iOS, other changes around spellchecking have caused the synchronous message `WebPageProxy::checkTextOfParagraph` to be sent from the web process in such a way that it now frequently coincides with the synchronous autocorrection context request being sent from the UI process. The result is that we now frequently end up cancelling autocorrection requests early by responding with empty contexts. This manifests in the keyboard sometimes losing information about its autocapitalization context and believing that it is in an empty text field, which reverts to default autocorrection suggestions and autocapitalizes the software keyboard. To fix this, instead of using the `InterruptWaitingIfSyncMessageArrives` option when waiting for the IPC response, add and use a new flag that allows us to process an incoming sync IPC message if we're waiting for the sync message response. We use this new IPC flag when waiting synchronously for HandleAutocorrectionContext. Test: editing/selection/ios/changing-selection-does-not-trigger-autocapitalization.html * Platform/IPC/Connection.cpp: (IPC::Connection::processIncomingMessage): If the new IPC flag is set and the incoming message is synchronous, allow it to immediately dispatch the sync message by enqueueing it and then waking up `m_waitForMessageCondition` so that it can process the message. * Platform/IPC/Connection.h: * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): Use `DispatchIncomingSyncMessagesWhileWaiting` instead of `InterruptWaitingIfSyncMessageArrives`. 2020-05-18 Lauro Moura <lmoura@igalia.com> webkitpy: Update test data after r261776 https://bugs.webkit.org/show_bug.cgi?id=212008 Reviewed by Alex Christensen. Covered by existing tests. * Scripts/test-legacyMessageReceiver.cpp: * Scripts/test-legacyMessages.h: (Messages::WebPage::DidCreateWebProcessConnection::DidCreateWebProcessConnection): * Scripts/webkit/messages_unittest.py: * Scripts/webkit/test-legacy.messages.in: 2020-05-18 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Update OptionsGTK.cmake and NEWS for 2.29.1 release * gtk/NEWS: Add release notes for 2.29.1. 2020-05-18 Carlos Garcia Campos <cgarcia@igalia.com> Move iOS files from Source/WebKit/Sources.txt to Source/WebKit/SourcesCocoa.txt https://bugs.webkit.org/show_bug.cgi?id=212014 Unreviewed. Move platform specific files to the platform sources file. * Sources.txt: * SourcesCocoa.txt: 2020-05-18 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] "ASSERTION FAILED: !m_adoptionIsRequired" when double clicking on a word https://bugs.webkit.org/show_bug.cgi?id=211957 Reviewed by Adrian Perez de Castro. Remove WebSelectionData wrapper since we can just encode/decode WebCore::SelectionData. * Shared/WebCoreArgumentCoders.h: * Shared/gtk/ArgumentCodersGtk.cpp: (IPC::ArgumentCoder<SelectionData>::decode): Use modern decoder. * Shared/gtk/ArgumentCodersGtk.h: * Shared/gtk/WebSelectionData.cpp: Removed. * Shared/gtk/WebSelectionData.h: Removed. * SourcesGTK.txt: * UIProcess/API/gtk/DragSource.h: * UIProcess/API/gtk/DragSourceGtk3.cpp: (WebKit::DragSource::DragSource): (WebKit::DragSource::begin): * UIProcess/API/gtk/DragSourceGtk4.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DropTarget.h: * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::accept): (WebKit::DropTarget::enter): (WebKit::DropTarget::update): (WebKit::DropTarget::leaveTimerFired): (WebKit::DropTarget::drop): * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::startDrag): * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseStartDrag): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::performDragControllerAction): (WebKit::WebPageProxy::startDrag): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/gtk/Clipboard.h: * UIProcess/gtk/ClipboardGtk3.cpp: (WebKit::WriteAsyncData::WriteAsyncData): (WebKit::Clipboard::write): * UIProcess/gtk/ClipboardGtk4.cpp: (WebKit::Clipboard::write): * UIProcess/gtk/WebPasteboardProxyGtk.cpp: (WebKit::WebPasteboardProxy::writeToClipboard): (WebKit::WebPasteboardProxy::writeCustomData): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::writeToClipboard): * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp: (WebKit::WebDragClient::startDrag): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performDragControllerAction): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-05-18 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Add WebKitContextMenuItemType for paste as plaintext https://bugs.webkit.org/show_bug.cgi?id=177638 Reviewed by Michael Catanzaro. Add WEBKIT_CONTEXT_MENU_ACTION_PASTE_AS_PLAIN_TEXT. * Shared/API/glib/WebKitContextMenuActions.cpp: (webkitContextMenuActionGetActionTag): (webkitContextMenuActionGetForContextMenuItem): (webkitContextMenuActionGetLabel): * UIProcess/API/gtk/WebKitContextMenuActions.h: * UIProcess/gtk/KeyBindingTranslator.cpp: 2020-05-17 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Move to new Pasteboard API https://bugs.webkit.org/show_bug.cgi?id=177633 Reviewed by Adrian Perez de Castro. Enable custom pasteboard data. * Shared/WebPreferencesDefaultValues.h: * Shared/gtk/ArgumentCodersGtk.cpp: (IPC::ArgumentCoder<SelectionData>::encode): (IPC::ArgumentCoder<SelectionData>::decode): * UIProcess/WebPasteboardProxy.cpp: * UIProcess/gtk/ClipboardGtk3.cpp: (WebKit::Clipboard::write): Add support for writing URI list and custom data. * UIProcess/gtk/ClipboardGtk4.cpp: (WebKit::Clipboard::write): Ditto. * UIProcess/gtk/WebPasteboardProxyGtk.cpp: (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): (WebKit::WebPasteboardProxy::writeCustomData): 2020-05-16 Andy Estes <aestes@apple.com> REGRESSION (r260717): installmentConfiguration member is no longer available on ApplePayPaymentRequest https://bugs.webkit.org/show_bug.cgi?id=211911 <rdar://problem/63236367> Reviewed by Tim Horton. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode): (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode): (IPC::finishDecoding): Deleted. (IPC::finishEncoding): Deleted. 2020-05-16 Yury Semikhatsky <yurys@chromium.org> [GTK] Do not leak pages created by window.open https://bugs.webkit.org/show_bug.cgi?id=211970 Reviewed by Carlos Garcia Campos. Previously webkitWebViewCreateNewPage created unbalanced refence to WebPageProxy and returned it as a raw pointer. That raw pointer was later wrapped in a RefPtr in WebKitUIClient. This change ensures that all refs are balanced by returnin RefPtr instead of a raw pointer. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewCreateNewPage): * UIProcess/API/glib/WebKitWebViewPrivate.h: 2020-05-15 Alex Christensen <achristensen@webkit.org> Use enum serialization instead of casting to/from uint32_t https://bugs.webkit.org/show_bug.cgi?id=211885 Reviewed by Geoffrey Garen. * Scripts/webkit/messages.py: * Shared/DocumentEditingContext.h: * Shared/ios/GestureTypes.h: * UIProcess/API/C/WKAPICast.h: (WebKit::toWebGLLoadPolicy): (WebKit::toAPI): * UIProcess/Cocoa/NavigationState.mm: (WebKit::toWebCoreWebGLLoadPolicy): (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::webGLPolicyForURL): (WebKit::WebPageProxy::resolveWebGLPolicyForURL): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView selectForWebView:]): (toUIWKSelectionFlags): (toSelectionFlags): (toWKTextGranularity): (toWKSelectionDirection): (selectionChangedWithGesture): (selectionChangedWithTouch): (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]): (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]): (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]): (-[WKContentView selectWordForReplacement]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::gestureCallback): (WebKit::WebPageProxy::touchesCallback): (WebKit::WebPageProxy::selectWithGesture): (WebKit::WebPageProxy::updateSelectionWithTouches): (WebKit::WebPageProxy::selectTextWithGranularityAtPoint): (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection): (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection): (WebKit::WebPageProxy::selectWithTwoTouches): (WebKit::WebPageProxy::extendSelection): (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset): * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm: (-[WKDOMRange rangeByExpandingToWordBoundaryByCharacters:inDirection:]): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::webGLPolicyForURL const): (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::webGLPolicyForURL): (WebKit::WebPage::resolveWebGLPolicyForURL): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPlatformEditorState const): (WebKit::WebPage::getSelectionContext): (WebKit::WebPage::selectWithGesture): (WebKit::rangeAtWordBoundaryForPosition): (WebKit::WebPage::updateSelectionWithTouches): (WebKit::WebPage::selectWithTwoTouches): (WebKit::WebPage::extendSelection): (WebKit::WebPage::selectWordBackward): (WebKit::WebPage::moveSelectionByOffset): (WebKit::WebPage::getRectsForGranularityWithSelectionOffset): (WebKit::WebPage::selectPositionAtBoundaryWithDirection): (WebKit::WebPage::moveSelectionAtBoundaryWithDirection): (WebKit::WebPage::rangeForGranularityAtPoint): (WebKit::WebPage::selectTextWithGranularityAtPoint): (WebKit::WebPage::beginSelectionInDirection): (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary): (WebKit::WebPage::requestDictationContext): (WebKit::WebPage::applyAutocorrectionInternal): (WebKit::WebPage::autocorrectionContext): (WebKit::dataDetectorLinkPositionInformation): (WebKit::moveByGranularityRespectingWordBoundary): (WebKit::WebPage::requestDocumentEditingContext): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::webGLPolicyForURL): (WebKit::WebPage::resolveWebGLPolicyForURL): 2020-05-15 Alex Christensen <achristensen@webkit.org> [iOS Simulator] TestWebKitAPI._WKDownload.Resume is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=211786 Reviewed by Geoffrey Garen. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]): 2020-05-15 Alex Christensen <achristensen@webkit.org> Regression (iOS 13.4, r249142): WKWebView.loading is never reset after a Back navigation in an iframe https://bugs.webkit.org/show_bug.cgi?id=211449 Reviewed by Geoffrey Garen. Always call clearPendingAPIRequest in WebPageProxy::didStartProvisionalLoadForFrameShared. r249142 regressed this and caused more "loading appears to continue forever" bugs fixed in r249890. This should fix both, by removing the problematic half of r249142. Covered by an API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): 2020-05-15 Adrian Perez de Castro <aperez@igalia.com> [GTK3] Bring back usage of GtkMenu for context menus https://bugs.webkit.org/show_bug.cgi?id=211557 Reviewed by Carlos Garcia Campos. * UIProcess/API/glib/WebKitWebView.cpp: (contextMenuDismissed): Removed. (webkitWebViewPopulateContextMenu): Use WebContextMenuProxyGtk::widgetDismissedSignal and move the code from contextMenuDismissed() into an inline lambda. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (activeContextMenuClosed): Removed. (webkitWebViewBaseSetActiveContextMenuProxy): Use WebContextMenuProxyGtk::widgetDismissedSignal and move the code from activeContextMenuClosed() into an inline lambda. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: Add helper functions to manipulate the actual widget used for context menus depending on whether GTK3 or GTK4 is being used. The GTK3 versions bring back bits of code removed in r260889. (WebKit::createMenuWidget): Added. (WebKit::popupMenuWidget): Added. (WebKit::popdownMenuWidget): Added. (WebKit::menuWidgetHasItems): Added. (WebKit::bindModelToMenuWidget): Added. (WebKit::WebContextMenuProxyGtk::populate): Use context menu widget helper functions. (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems): Ditto. (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk): Ditto. Also handle the signal triggered when the context menu is dismissed and arrange to call webkitWebViewContextMenuDismissed() and webkitWebViewBaseContextMenuDismissed(). (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk): Use helper functions. * UIProcess/gtk/WebContextMenuProxyGtk.h: Add WebContextMenuProxyGtk::widgetDismissedSignal constant. 2020-05-14 Kate Cheney <katherine_cheney@apple.com> Attribute non-network loads and loads with html strings as automatically app-bound https://bugs.webkit.org/show_bug.cgi?id=211913 <rdar://problem/63157801 Reviewed by Brent Fulgham. Move logic from WebsiteDataStoreCocoa to WebPageProxy to check for special app-bound protocols and set m_limitsNavigationToAppBoundDomains to force these WebViews into app-bound mode. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _isForcedIntoAppBoundMode:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: Testing SPI to see whether m_limitsNavigationsToAppBoundDomains was set. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadData): Check for html string loads and force WebView into app-bound mode if needed. No need to worry about setting this variable even if the app hasn't opted in because setIsNavigatingToAppBoundDomainAndCheckIfPermitted does an early return before checking this variable if WKAppBoundDomains does not exist. (WebKit::shouldTreatURLProtocolAsAppBound): Adds javascript protocols to this check. (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): Check for special protocols here and force WebView into app-bound mode. (WebKit::WebPageProxy::isForcedIntoAppBoundModeTesting): * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::beginAppBoundDomainCheck): (WebKit::shouldTreatURLProtocolAsAppBound): Deleted. 2020-05-14 Timothy Hatcher <timothy@apple.com> Add baseURL version of _WKUserStyleSheet forWKWebView. https://bugs.webkit.org/show_bug.cgi?id=211926 rdar://problem/62074675 Reviewed by Devin Rousso. * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:baseURL:level:userContentWorld:]): Added. (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:level:userContentWorld:]): Clean up WebCore::UserStyleSheet initializer. (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:]): Ditto. (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): Ditto. (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): Ditto. (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:level:userContentWorld:]): Ditto. 2020-05-14 John Wilander <wilander@apple.com> Add quirk for cookie blocking latch mode aolmail.com redirecting to aol.com under aol.com https://bugs.webkit.org/show_bug.cgi?id=211925 <rdar://problem/61901041> Reviewed by Brent Fulgham. No new tests. Just a new quirk for a pair of domains added by request. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::needsFirstPartyCookieBlockingLatchModeQuirk const): 2020-05-14 Chris Dumez <cdumez@apple.com> Regression(r261163) Causes crashes on builds without libwebrtc.dylib https://bugs.webkit.org/show_bug.cgi?id=211924 <rdar://problem/63206792> Reviewed by Jer Noble. * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::NetworkProcessConnection): 2020-05-14 Timothy Hatcher <timothy@apple.com> Add sourceURL to _evaluateJavaScript: so the scripts appear in Web Inspector. https://bugs.webkit.org/show_bug.cgi?id=211904 rdar://problem/62074376 Reviewed by Devin Rousso. Added sourceURL version of _evaluateJavaScript: that passes the sourceURL to RunJavaScriptParameters. If the sourceURL is invalid, generate a unique user script URL so the source code errors are not showing up with the frame's document URL and bogus locations. * UIProcess/API/C/WKPage.cpp: (WKPageRunJavaScriptInMainFrame): pass API::UserScript::generateUniqueURL() for the sourceURL. * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]): Clean up WebCore::UserScript initializer. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): Ditto. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): Ditto. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:contentWorld:]): Ditto. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:]): Ditto. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:deferRunningUntilNotification:]): Ditto. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): Renamed to add sourceURL. (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): Added sourceURL. (-[WKWebView _evaluateJavaScript:withSourceURL:inFrame:inContentWorld:completionHandler:]): Added. Pass sourceURL through. (-[WKWebView evaluateJavaScript:completionHandler:]): Call new method with sourceURL as nil. (-[WKWebView evaluateJavaScript:inContentWorld:completionHandler:]): Ditto. (-[WKWebView callAsyncJavaScript:arguments:inContentWorld:completionHandler:]): Ditto. (-[WKWebView _callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]): Ditto. (-[WKWebView _evaluateJavaScript:inFrame:inContentWorld:completionHandler:]): Ditto. * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2020-05-14 Chris Dumez <cdumez@apple.com> WebsiteDataStore functions should only send IPC to WebProcesses that are associated with its session https://bugs.webkit.org/show_bug.cgi?id=211917 Reviewed by Alex Christensen. WebsiteDataStore functions should only send IPC to WebProcesses that are associated with its session. setResourceLoadStatisticsEnabled() / clearResourceLoadStatisticsInWebProcesses() were talking to all WebProcesses, even those associated with other sessions, which was wrong. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::clearResourceLoadStatistics): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses): 2020-05-14 Daniel Bates <dabates@apple.com> [iOS] Remove dead dictation code https://bugs.webkit.org/show_bug.cgi?id=211871 Reviewed by Wenson Hsieh. UIKit has long removed all callers that would call -nextUnperturbedDictationResultBoundaryFromPosition and -previousUnperturbedDictationResultBoundaryFromPosition. So, remove the implementations. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView previousUnperturbedDictationResultBoundaryFromPosition:]): Deleted. (-[WKContentView nextUnperturbedDictationResultBoundaryFromPosition:]): Deleted. 2020-05-14 Brady Eidson <beidson@apple.com> Crash in PDFPlugin::ensureDataBufferLength <rdar://problem/62932155> and https://bugs.webkit.org/show_bug.cgi?id=211818 Reviewed by Tim Horton. There's some currently unreproducible case(s) where a range request finishes while there's no m_data to append it to. It's fair hardening to handle that case. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::getResourceBytesAtPositionMainThread): Handle null m_data. (WebKit::PDFPlugin::ensureDataBufferLength): Ditto. 2020-05-14 Per Arne Vollan <pvollan@apple.com> [iOS] Update message filtering rules in the WebContent process' sandbox https://bugs.webkit.org/show_bug.cgi?id=211188 Reviewed by Brent Fulgham. Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS. Messages that have not been observed being in use, should be denied. No new tests, covered by existing tests. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-14 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixed, mid May 2020 edition https://bugs.webkit.org/show_bug.cgi?id=211859 Unreviewed build fix. * UIProcess/gtk/Clipboard.cpp: Add missing includes for <mutex>, wtf/NeverDestroyed.h, and wtf/text/WTFString.h. * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Add missing SharedBufferDataReference.h include. * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Add missing namespace to usage of the WebCore::SharedBuffer type. 2020-05-13 David Kilzer <ddkilzer@apple.com> [IPC] Use templates to reduce duplicate code in IPC::Decoder and IPC::Encoder classes <https://webkit.org/b/211861> <rdar://problem/62360390> Reviewed by Alex Christensen. In broad strokes, this change fixes the following issues: - Change `unsigned` type to `size_t` for `alignment` parameters for consistency on 32-bit platforms. - Templatize Encoder::encode(), Decoder::decode() and Decoder::operator>>() methods to reduce duplicate code. This deleted code in source files, added template methods to header files, and required a few changes to existing templates in header files to disambiguate std::is_arithmetic parameter types. - Use `typename E` for all template methods that handle enum types. - Use `typename T` for all other template method types. - Move WARN_UNUSED_RETURN to same line as `bool` return type. - Add FIXME comments to validate enum values. * Platform/IPC/Decoder.cpp: (IPC::roundUpToAlignment): (IPC::Decoder::alignBufferPosition): (IPC::Decoder::bufferIsLargeEnoughToContain const): (IPC::Decoder::decodeFixedLengthData): (IPC::decodeValueFromBuffer): Delete. (IPC::Decoder::getOptional): Delete. (IPC::Decoder::operator>>): Delete. (IPC::Decoder::decode): Delete. * Platform/IPC/Decoder.h: (IPC::Decoder::decode): (IPC::Decoder::operator>>): (IPC::Decoder::decodeEnum): * Platform/IPC/Encoder.cpp: (IPC::roundUpToAlignment): (IPC::Encoder::grow): (IPC::Encoder::encodeFixedLengthData): (IPC::copyValueToBuffer): Delete. (IPC::Encoder::encode): Delete. * Platform/IPC/Encoder.h: 2020-05-13 Devin Rousso <drousso@apple.com> Web Inspector: `RuntimeEnabledFeatures` should also be enabled when remotely inspecting https://bugs.webkit.org/show_bug.cgi?id=211874 Reviewed by Timothy Hatcher. * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::enableFrontendFeatures): Added. (WebKit::WebInspectorUI::WebInspectorUI): * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::RemoteWebInspectorUI): 2020-05-13 Megan Gardner <megan_gardner@apple.com> Unreviewed Build Fix. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::setMouseEventPolicy): * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker dealloc]): (-[WKDateTimePicker controlBeginEditing]): (-[WKDateTimePicker controlEndEditing]): 2020-05-13 Kate Cheney <katherine_cheney@apple.com> SHOULD NEVER BE REACHED in WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary https://bugs.webkit.org/show_bug.cgi?id=211637 <rdar://problem/63031185> Reviewed by John Wilander. No new tests, behavior confirmed by existing tests. Stop reseting ITP to use the memory store between tests. This results in consecutive calls to NetworkSession::recreateResourceLoadStatisticStore if two database tests occur in a row, which can set the m_resourceLoadStatistics object before a previous call to WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore is done. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreStatisticsResetToConsistentState): 2020-05-13 Megan Gardner <megan_gardner@apple.com> Change Date/Time popovers to contextMenus. https://bugs.webkit.org/show_bug.cgi?id=211825 <rdar://problem/63102524> Reviewed by Wenson Hsieh. Update the Date/Time picker to use UIContextMenus instead of popovers. Removed all the unneeded popover code. Renamed WKFormInputControl to WKDateTimeInputControl because it was only used for date and time controls, unneccessary abstraction. We need to ensure the poisition information is up to date before presenting the context menu, or the position it will be presented from can be stale. * SourcesCocoa.txt: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): (-[WKContentView requiresAccessoryView]): (-[WKContentView _updateAccessory]): (mayContainSelectableText): (createInputPeripheralWithView): (-[WKContentView inputLabelText]): (-[WKContentView _removeContextMenuViewIfPossible]): (-[WKContentView inputLabelTextForViewController:]): (-[WKContentView formInputControl]): (-[WKContentView setTimePickerValueToHour:minute:]): (-[WKContentView timePickerValueHour]): (-[WKContentView timePickerValueMinute]): * UIProcess/ios/forms/WKDateTimeInputControl.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKFormInputControl.h. * UIProcess/ios/forms/WKDateTimeInputControl.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm. (-[WKDateTimeContextMenuViewController init]): (-[WKDateTimeContextMenuViewController preferredContentSize]): (-[WKDateTimePicker initWithView:datePickerMode:]): (-[WKDateTimePicker contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): (-[WKDateTimePicker _contextMenuInteraction:styleForMenuWithConfiguration:]): (-[WKDateTimePicker contextMenuInteraction:configurationForMenuAtLocation:]): (-[WKDateTimePicker contextMenuInteraction:willEndForConfiguration:animator:]): (-[WKDateTimePicker removeContextMenuInteraction]): (-[WKDateTimePicker ensureContextMenuInteraction]): (-[WKDateTimePicker showDateTimePicker]): (-[WKDateTimePicker reset:]): (-[WKDateTimePicker calendarType]): (-[WKDateTimePicker dealloc]): (-[WKDateTimePicker setDateTimePickerToInitialValue]): (-[WKDateTimePicker controlBeginEditing]): (-[WKDateTimePicker viewController]): (-[WKDateTimePicker controlEndEditing]): (-[WKDateTimeInputControl initWithView:]): (-[WKDateTimeInputControl setTimePickerHour:minute:]): (-[WKDateTimeInputControl dateTimePickerCalendarType]): (-[WKDateTimeInputControl timePickerValueHour]): (-[WKDateTimeInputControl timePickerValueMinute]): * WebKit.xcodeproj/project.pbxproj: 2020-05-13 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix tvOS and watchOS builds after r261638 `-[UIPasteboard itemProviders]` is not present on watchOS and tvOS. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _writePromisedAttachmentToPasteboard:]): 2020-05-13 Timothy Horton <timothy_horton@apple.com> Build fix. * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: 2020-05-13 Jer Noble <jer.noble@apple.com> Replace isNullFunctionPointer with real weak-linking support https://bugs.webkit.org/show_bug.cgi?id=211751 Reviewed by Sam Weinig. Use the new WTF_WEAK_LINK_FORCE_IMPORT macro. * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): 2020-05-13 Tim Horton <timothy_horton@apple.com> Add SPI for reverting to touch events for iPad trackpad interactions https://bugs.webkit.org/show_bug.cgi?id=211824 <rdar://problem/61363084> Reviewed by Megan Gardner. New Test: IOSMouseSupport.WebsiteMouseEventPolicies Plumb a "mouse event policy" WKWebpagePreference, which has two values: - Default, which means that WebKit decides whether or not indirect pointing devices send mouse or touch events. - SynthesizeTouchEvents, which ensures that WebKit will always send touch events from indirect pointing devices. This value is only available on platforms that implement touch events. We use the WKWebpagePreferences mechanism in order to make it easy to implement it as a "per-site" quirk, but unlike most WKWebpagePreferences, it turns around and changes UI process state (the enablement of the WKMouseGestureRecgonizer). * Scripts/webkit/messages.py: * Shared/WebsitePoliciesData.cpp: (WebKit::WebsitePoliciesData::encode const): (WebKit::WebsitePoliciesData::decode): (WebKit::WebsitePoliciesData::applyToDocumentLoader): * Shared/WebsitePoliciesData.h: * UIProcess/API/APIWebsitePolicies.cpp: (API::WebsitePolicies::copy const): (API::WebsitePolicies::data): * UIProcess/API/APIWebsitePolicies.h: * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (WebKit::mouseEventPolicy): (WebKit::coreMouseEventPolicy): (-[WKWebpagePreferences _setMouseEventPolicy:]): (-[WKWebpagePreferences _mouseEventPolicy]): * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/PageClient.h: (WebKit::PageClient::setMouseEventPolicy): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::didCommitLoadForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::setMouseEventPolicy): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shouldUseMouseGestureRecognizer]): (-[WKContentView setUpMouseGestureRecognizer]): (-[WKContentView _configureMouseGestureRecognizer]): (-[WKContentView _setMouseEventPolicy:]): * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer setEnabled:]): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): 2020-05-13 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] "Copy" context menu action for attachment element does not work in Mail https://bugs.webkit.org/show_bug.cgi?id=211817 <rdar://problem/58043110> Reviewed by Tim Horton. Implements support for copying an attachment element, via context menu actions. To achieve this, we first refactor code in WebCore that is currently responsible for converting an attachment element into a PromisedAttachmentInfo, which provides a handle to an UI-process-side API attachment object. We then use this helper in WebKit to send PromisedAttachmentInfo back to the UI process when handling the copy action from the context menu on iOS. On iOS, we then take this promised attachment info in the UI process, map it to an API::Attachment object, and use the file handle to create and write an NSItemProvider to the general pasteboard. (In the future, similar logic could be implemented on macOS as well to handle copying attachment elements by implementing a version of writePromisedAttachmentToPasteboard in PageClientImplMac. Currently, we fall back to treating this case as if we're copying a text selection containing a single attachment element). * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: Add a new helper function to simulate an element action (_WKElementActionType) for an element at the given location. This is used by the new API test. * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _simulateElementAction:atLocation:]): * UIProcess/PageClient.h: (WebKit::PageClient::writePromisedAttachmentToPasteboard): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::writePromisedAttachmentToPasteboard): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: Add an IPC message for the UI process to receive a PromisedAttachmentInfo, and copy it to the system pasteboard if it maps to an actual API::Attachment. For now, we only support copying data if the attachment is backed by a file wrapper in the UI process (as opposed to blob data written by the web process). * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::writePromisedAttachmentToPasteboard): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (createItemProvider): Create a helper function to convert PromisedAttachmentInfo into an NSItemProvider. This is similar to `-_prepareToDragPromisedAttachment:`, but with a couple differences: (1) we only create an NSItemProvider instead of going through `WebItemProviderRegistrationInfoList`; (2) since there's no opportunity to clean up temporary after pasting, serialize the attachment data using `-serializedRepresentation`, and provide the attachment data instead of a file URL. Ideally, we would offer the data directly to the pasteboard so that even if Mail terminates, the contents of the pasteboard can still be provided when pasting; however, it doesn't seem like we can do this while being able to offer a suggested name for the item we're writing. Some other apps work around this limitation by writing the file name as plain text on the pasteboard, but this doesn't work then attempting to copy a plain text file that has a file name. (-[WKContentView _writePromisedAttachmentToPasteboard:]): (-[WKContentView _simulateElementAction:atLocation:]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::performActionOnElement): 2020-05-13 Per Arne Vollan <pvollan@apple.com> [iOS] Update message filtering rules in the WebContent process' sandbox https://bugs.webkit.org/show_bug.cgi?id=211188 Reviewed by Brent Fulgham. Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS. Messages that have not been observed being in use, should be denied. No new tests, covered by existing tests. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-13 Per Arne Vollan <pvollan@apple.com> [iOS] In CFPrefs direct mode, the WebContent sandbox needs to allow access to plist files https://bugs.webkit.org/show_bug.cgi?id=211782 Reviewed by Brent Fulgham. Since preference files will be read directly in CFPrefs direct mode, the WebContent sandbox on iOS needs to allow reading these files. No new tests. There is API test coverage for this in PreferenceChanges.mm, but these tests are only run on simulator, not device. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-13 Peng Liu <peng.liu6@apple.com> Add the feature flags plist file back https://bugs.webkit.org/show_bug.cgi?id=211816 Reviewed by Jer Noble. Add the WebKit.plist file to the WebKit project and use it instead of the one from the WebKitAdditions. * FeatureFlags/WebKit.plist: Added. * WebKit.xcodeproj/project.pbxproj: 2020-05-13 Youenn Fablet <youenn@apple.com> Allow WebAudioBufferList to dynamically change its number of frames https://bugs.webkit.org/show_bug.cgi?id=211720 Reviewed by Eric Carlson. * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable): * WebProcess/cocoa/RemoteCaptureSampleManager.h: 2020-05-13 Per Arne Vollan <pvollan@apple.com> Unreviewed compile fix after r261584. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-05-13 Chris Dumez <cdumez@apple.com> REGRESSION (r261254): Broke Apple Pay on macOS https://bugs.webkit.org/show_bug.cgi?id=211826 <rdar://problem/63161750> Reviewed by Alex Christensen. r261254 dropped the code needed to add the WebPaymentCoordinatorProxy as an IPC message receiver. This patch re-introduces the code in order to address the regression. No new tests, tested manually on https://applepaydemo.apple.com. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): * UIProcess/WebPageProxy.h: 2020-05-13 Zan Dobersek <zdobersek@igalia.com> REGRESSION(r260571): RequestedScrollPosition doesn't have its scroll change applied to layers anymore https://bugs.webkit.org/show_bug.cgi?id=211374 Reviewed by Carlos Garcia Campos. Use WebPage::finalizeRenderingUpdate() to perform the compositing state flush and the scrolling tree layer positioning, instead of doing things half-baked by manually invoking the FrameView method. Additional WebPage calls (updateRendering(), flushPendingEditorStateUpdate()) are moved into CompositingCoordinator::flushPendingLayerChanges() from the LayerTreeHost::layerFlushTimerFired() method for consistency. The additional CompositingCoordinator::syncDisplayState() method call is removed -- this call triggered any necessary layout, but that's already done through WebPage::updateRendering(). CompositingCoordinator::flushPendingLayerChanges() doesn't rely on the FrameView flush return value since that's not available anymore -- instead, true is returned always. * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp: (WebKit::CompositingCoordinator::flushPendingLayerChanges): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): 2020-05-13 Per Arne Vollan <pvollan@apple.com> Unreviewed compile fix after r261584. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 2020-05-13 Tomoki Imai <Tomoki.Imai@sony.com> Selected element on Web Inspector is not highlighted with CPU Rendering. https://bugs.webkit.org/show_bug.cgi?id=195933 Reviewed by Devin Rousso. Since WebInspectorClient::drawHighlight was not called while non accelerated compositing mode, we cannot see element highlight on web inspector. This patch adds WebInspectorClient::drawHighlight call in WebPage::drawRect, which draws webpage image while non accelerated compositing mode, to overlay the highlight. WebInspectorClient::highlight and WebInspectorClient::hideHighlight currently requests re-paint whole web page, but it should be able to optimize by only updating dirty rects in the future. * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::highlight): If it's not acceleratedCompositingEnabled, then just request repaint. (WebKit::WebInspectorClient::hideHighlight): If it's not acceleratedCompositingEnabled, then just request repaint. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::drawRect): Draw inspector overlay here if it's not accelerated compositing mode. 2020-05-13 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK debug build after r261554 Remove writeToClipboard that receives a const SelectionData& that is no longer used. * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: * WebProcess/WebCoreSupport/WebPlatformStrategies.h: 2020-05-12 Peng Liu <peng.liu6@apple.com> Add the feature flag plist file parser https://bugs.webkit.org/show_bug.cgi?id=211457 Reviewed by Tim Horton. WebKit needs to parse the feature flags plist by itself in some cases. * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm: Added. (WebKit::featureFlagEnabled): * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled): (WebKit::defaultUseGPUProcessForMedia): (WebKit::defaultRenderCanvasInGPUProcessEnabled): (WebKit::defaultCaptureAudioInGPUProcessEnabled): (WebKit::defaultCaptureVideoInGPUProcessEnabled): (WebKit::defaultWebRTCCodecsInGPUProcess): (WebKit::defaultWebGL2Enabled): (WebKit::defaultWebGPUEnabled): (WebKit::defaultInAppBrowserPrivacy): (WebKit::defaultIncrementalPDFEnabled): (WebKit::defaultWebXREnabled): * Shared/WebPreferencesDefaultValues.h: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2020-05-12 Alex Christensen <achristensen@webkit.org> Give some NetworkLoadMetrics to WebCoreNSURLSession's delegate https://bugs.webkit.org/show_bug.cgi?id=211759 <rdar://problem/62909440> Reviewed by Jer Noble. This also reduces duplicate lookups in RemoteMediaResourceManager * GPUProcess/media/RemoteMediaResource.cpp: (WebKit::RemoteMediaResource::loadFinished): * GPUProcess/media/RemoteMediaResource.h: * GPUProcess/media/RemoteMediaResourceManager.cpp: (WebKit::RemoteMediaResourceManager::responseReceived): (WebKit::RemoteMediaResourceManager::redirectReceived): (WebKit::RemoteMediaResourceManager::dataSent): (WebKit::RemoteMediaResourceManager::dataReceived): (WebKit::RemoteMediaResourceManager::accessControlCheckFailed): (WebKit::RemoteMediaResourceManager::loadFailed): (WebKit::RemoteMediaResourceManager::loadFinished): * GPUProcess/media/RemoteMediaResourceManager.h: * GPUProcess/media/RemoteMediaResourceManager.messages.in: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): * WebProcess/GPU/media/RemoteMediaResourceProxy.cpp: (WebKit::RemoteMediaResourceProxy::loadFinished): * WebProcess/GPU/media/RemoteMediaResourceProxy.h: 2020-05-12 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Don't assume extensions always exist https://bugs.webkit.org/show_bug.cgi?id=211760 <rdar://problem/61217642> Reviewed by Brent Fulgham. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::WebCore::processGoogleLegacyAppIdSupportExtension): * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::processGoogleLegacyAppIdSupportExtension): 2020-05-12 Chris Dumez <cdumez@apple.com> [WK2] Neuter WKFrameIsFrameSet() / WKPageGetFrameSetLargestFrame() C API https://bugs.webkit.org/show_bug.cgi?id=211808 Reviewed by Darin Adler. Neuter WKFrameIsFrameSet() / WKPageGetFrameSetLargestFrame() C API. This is only SPI and is only used for slightly different printing behavior in Safari. Framesets are no longer supported in HTML5 and are now super rare. Support for this C API adds quite a bit of code complexity and crashes such as <rdar://problem/60322282>, it just does not seem worth it anymore. * UIProcess/API/C/WKFrame.cpp: (WKFrameIsFrameSet): * UIProcess/API/C/WKPage.cpp: (WKPageGetFrameSetLargestFrame): * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::didCommitLoad): * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::setIsFrameSet): Deleted. (WebKit::WebFrameProxy::isFrameSet const): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::frameDidBecomeFrameSet): Deleted. (WebKit::WebPageProxy::frameSetLargestFrameChanged): Deleted. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::focusedFrame const): (WebKit::WebPageProxy::frameSetLargestFrame const): Deleted. * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::contentsSizeChanged const): (WebKit::findLargestFrameInFrameSet): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidBecomeFrameset): Deleted. * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-05-12 Per Arne Vollan <pvollan@apple.com> [iOS] Rebuild MobileGestalt cache if needed https://bugs.webkit.org/show_bug.cgi?id=211739 Reviewed by Darin Adler. This patch was written by Geoff Garen and myself. Rebuild the MobileGestalt cache in the UI process if the MobileGestalt cache is stale. This should be done before starting a new WebContent process. If the cache is not rebuilt, every MobileGestalt query in the WebContent process will fail, since access to the daemon is denied. No new tests, since testing this is not trivial. It would involve deleting the MobileGestalt cache and making sure it is rebuilt afterwards. This could be an API test, but API tests are not supported on iOS devices. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-05-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Rework drag and drop handling in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=211723 Reviewed by Adrian Perez de Castro. Split DragAndDropHelper class into DragSource and DropTarget classes. This separates the source and destination parts making it easier to follow. This patch also adds PageClient::didPerformDragControllerAction() to notify back the view when an operation is done to update the result. * SourcesGTK.txt: * UIProcess/API/gtk/DragSource.h: Added. * UIProcess/API/gtk/DragSourceGtk3.cpp: Added. (WebKit::DragSource::DragSource): (WebKit::DragSource::~DragSource): (WebKit::DragSource::begin): * UIProcess/API/gtk/DropTarget.h: Added. * UIProcess/API/gtk/DropTargetGtk3.cpp: Added. (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::~DropTarget): (WebKit::DropTarget::accept): (WebKit::DropTarget::enter): (WebKit::DropTarget::update): (WebKit::DropTarget::dataReceived): (WebKit::DropTarget::didPerformAction): (WebKit::DropTarget::leaveTimerFired): (WebKit::DropTarget::leave): (WebKit::DropTarget::drop): * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::startDrag): (WebKit::PageClientImpl::didPerformDragControllerAction): * UIProcess/API/gtk/PageClientImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseConstructed): (webkit_web_view_base_class_init): (webkitWebViewBaseStartDrag): (webkitWebViewBaseDidPerformDragControllerAction): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/PageClient.h: (WebKit::PageClient::didPerformDragControllerAction): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didPerformDragControllerAction): * UIProcess/gtk/DragAndDropHandler.cpp: Removed. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performDragControllerAction): * WebProcess/WebPage/gtk/WebPageGtk.cpp: 2020-05-12 Jacob Uphoff <jacob_uphoff@apple.com> Unreviewed, reverting r261557. This commit caused testing to exit early due to too many crashes on macOS Catalina Asan Reverted changeset: "Allow WebAudioBufferList to dynamically change its number of frames" https://bugs.webkit.org/show_bug.cgi?id=211720 https://trac.webkit.org/changeset/261557 2020-05-12 Per Arne Vollan <pvollan@apple.com> Unreviewed crash fix. Use correct global name for icon service in RELEASE_ASSERT. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon): 2020-05-12 Youenn Fablet <youenn@apple.com> Allow WebAudioBufferList to dynamically change its number of frames https://bugs.webkit.org/show_bug.cgi?id=211720 Reviewed by Eric Carlson. * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable): * WebProcess/cocoa/RemoteCaptureSampleManager.h: 2020-05-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add support for clipboard operations https://bugs.webkit.org/show_bug.cgi?id=211561 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/Clipboard.h: * UIProcess/gtk/ClipboardGtk4.cpp: (WebKit::Clipboard::Clipboard): (WebKit::Clipboard::type const): (WebKit::Clipboard::formats): (WebKit::ReadTextAsyncData::ReadTextAsyncData): (WebKit::Clipboard::readText): (WebKit::ReadFilePathsAsyncData::ReadFilePathsAsyncData): (WebKit::Clipboard::readFilePaths): (WebKit::ReadBufferAsyncData::ReadBufferAsyncData): (WebKit::Clipboard::readBuffer): (WebKit::Clipboard::write): (WebKit::Clipboard::clear): 2020-05-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Rework clipboard handling in preparation for GTK4 https://bugs.webkit.org/show_bug.cgi?id=211511 Reviewed by Adrian Perez de Castro. Use async APIs to avoid blocking the UI process during the communication with the clipboard. In GTK4 only async APIs are available. Add Clipboard class to handle the communication with the clipboard with the GTK implementation in ClipboardGtk3 and ClipboardGtk4 files. * Shared/gtk/WebSelectionData.cpp: (WebKit::WebSelectionData::WebSelectionData): Add constructor receivnig an rvalue reference. * Shared/gtk/WebSelectionData.h: * SourcesGTK.txt: * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/gtk/Clipboard.cpp: Added. (WebKit::clipboard): (WebKit::primary): (WebKit::Clipboard::get): * UIProcess/gtk/Clipboard.h: Added. * UIProcess/gtk/ClipboardGtk3.cpp: Added. (WebKit::Clipboard::Clipboard): (WebKit::isPrimaryClipboard): (WebKit::Clipboard::type const): (WebKit::FormatsAsyncData::FormatsAsyncData): (WebKit::Clipboard::formats): (WebKit::ReadTextAsyncData::ReadTextAsyncData): (WebKit::Clipboard::readText): (WebKit::ReadFilePathsAsyncData::ReadFilePathsAsyncData): (WebKit::Clipboard::readFilePaths): (WebKit::ReadBufferAsyncData::ReadBufferAsyncData): (WebKit::Clipboard::readBuffer): (WebKit::Clipboard::write): (WebKit::Clipboard::clear): * UIProcess/gtk/ClipboardGtk4.cpp: Added. (WebKit::Clipboard::Clipboard): (WebKit::Clipboard::type const): (WebKit::Clipboard::formats): (WebKit::Clipboard::readText): (WebKit::Clipboard::readFilePaths): (WebKit::Clipboard::readBuffer): (WebKit::Clipboard::write): (WebKit::Clipboard::clear): * UIProcess/gtk/WebPasteboardProxyGtk.cpp: (WebKit::WebPasteboardProxy::getTypes): (WebKit::WebPasteboardProxy::readText): (WebKit::WebPasteboardProxy::readFilePaths): (WebKit::WebPasteboardProxy::readBuffer): (WebKit::WebPasteboardProxy::writeToClipboard): (WebKit::WebPasteboardProxy::clearClipboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::types): (WebKit::WebPlatformStrategies::readTextFromClipboard): (WebKit::WebPlatformStrategies::readFilePathsFromClipboard): (WebKit::WebPlatformStrategies::readBufferFromClipboard): (WebKit::WebPlatformStrategies::writeToClipboard): (WebKit::WebPlatformStrategies::clearClipboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: 2020-05-12 Youenn Fablet <youenn@apple.com> Introduce a RealtimeMediaSource video sample observer https://bugs.webkit.org/show_bug.cgi?id=211718 Reviewed by Eric Carlson. * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy): * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::~MediaRecorderPrivate): (WebKit::MediaRecorderPrivate::videoSampleAvailable): (WebKit::MediaRecorderPrivate::stopRecording): (WebKit::MediaRecorderPrivate::sampleBufferUpdated): Deleted. * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2020-05-12 Mark Lam <mark.lam@apple.com> Wasm::enableFastMemory() was called too late. https://bugs.webkit.org/show_bug.cgi?id=211773 Reviewed by Yusuke Suzuki. Previously, we were calling Wasm::enableFastMemory() in WebProcess::initializeWebProcess(). By then, it is too late because the JSC::Config and WTF::Config have already been frozen. There is nothing special about Wasm::enableFastMemory() that it needs to be called this late. This patch moves it into JSC::initializeThreading() where it belongs. This change also make the initialization of Wasm fast memory consistent with how we have always done it for the jsc shell i.e. it is initialized at the end of JSC::initializeThreading(). * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2020-05-11 Darin Adler <darin@apple.com> Fix problems caught by replacing WTF::Optional with std::optional https://bugs.webkit.org/show_bug.cgi?id=211703 Reviewed by Chris Dumez. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::plainTextForContext): Clarified ambiguous overload resolution by writing the conversion from a live range to a SimpleRange out explicitly. Also fixed a typo where there was a missing "&" in a "const&" argument. 2020-05-11 Simon Fraser <simon.fraser@apple.com> [ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=211747 Reviewed by Tim Horton. Add an option to monitorWheelEvents to reset latching. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 2020-05-11 Kate Cheney <katherine_cheney@apple.com> Fail navigations to non app-bound domains after use of app-bound APIs https://bugs.webkit.org/show_bug.cgi?id=211647 <rdar://problem/62978159> Reviewed by Brent Fulgham. A lot of this patch is deleting the unnecessary variable/function hasNavigatedAwayFromAppBoundDomain now that navigating away from an app-bound domain is not possible. To address the bug, this sets the default isNavigatingToAppBoundDomain value to be WTF::nullopt. This will allow app-bound behaviors until a navigation has been attempted, in which case it will fail or will update isNavigatingToAppBoundDomain to the correct value. * Shared/LoadParameters.cpp: (WebKit::LoadParameters::encode const): (WebKit::LoadParameters::decode): * Shared/LoadParameters.h: * Shared/PolicyDecision.h: (WebKit::PolicyDecision::encode const): (WebKit::PolicyDecision::decode): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared): (WebKit::WebPageProxy::hasNavigatedAwayFromAppBoundDomain const): Deleted. Remove hasNavigatedAwayFromAppBoundDomain. (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): Check for new m_hasExecutedAppBoundBehaviorBeforeNavigation parameter and fail the navigation if a WebView has used app-bound behavior then tries to navigate to a non app-bound domain. (WebKit::WebPageProxy::decidePolicyForNavigationAction): Update error message to be more general now that more than one error can occur. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::setHasExecutedAppBoundBehaviorBeforeNavigation): * UIProcess/WebPageProxy.messages.in: New parameter to indicate a WebView has used app-bound APIs before navigating. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): (WebKit::WebFrameLoaderClient::shouldEnableInAppBrowserPrivacyProtections): (WebKit::WebFrameLoaderClient::hasNavigatedAwayFromAppBoundDomain): Deleted. (WebKit::WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks const): Deleted. * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Combined two functions into a simpler function: shouldEnableInAppBrowserPrivacyProtections(). * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::updatePreferences): Store the special app-bound domain flag to gate the service worker API. This should be stored separately from m_isNavigatingToAppBoundDomain, because in the WebPage constructor we don't yet know whether the WKAppBoundDomains key exists. (WebKit::WebPage::loadRequest): (WebKit::WebPage::loadDataImpl): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::didReceivePolicyDecision): Remove hasNavigatedAwayFromAppBoundDomain. (WebKit::WebPage::runJavaScript): (WebKit::WebPage::setIsNavigatingToAppBoundDomain): (WebKit::WebPage::shouldEnableInAppBrowserPrivacyProtections): If m_needsInAppBrowserPrivacyQuirks are on for testing, don't enable protections. Only notify the WebPageProxy of app-bound behavior if a navigation has not occured and we know the webView is not app-bound (in order to limit IPC). (WebKit::m_isNavigatingToAppBoundDomain): Deleted. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::isNavigatingToAppBoundDomain const): (WebKit::WebPage::setIsNavigatingToAppBoundDomain): Deleted. (WebKit::WebPage::hasNavigatedAwayFromAppBoundDomain const): Deleted. (WebKit::WebPage::setHasNavigatedAwayFromAppBoundDomain): Deleted. (WebKit::WebPage::needsInAppBrowserPrivacyQuirks const): Deleted. 2020-05-11 Wenson Hsieh <wenson_hsieh@apple.com> Remove some unnecessary indirection when getting Document’s Editor https://bugs.webkit.org/show_bug.cgi?id=211744 Reviewed by Geoffrey Garen. See WebCore ChangeLog for more information. No change in behavior. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::performActionOnElement): 2020-05-11 Simon Fraser <simon.fraser@apple.com> Fix possible crash in ViewGestureController on macOS https://bugs.webkit.org/show_bug.cgi?id=211745 Reviewed by Tim Horton. When ViewGestureController::resetState() clears m_swipeCancellationTracker, it should set it to canceled so that any pending -trackSwipeEventWithOptions:... which is holding a reference to the WKSwipeCancellationTracker knows to stop. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::resetState): (WebKit::ViewGestureController::reset): 2020-05-11 Peng Liu <peng.liu6@apple.com> Enable the mock video presentation mode in related layout tests and fix test failures https://bugs.webkit.org/show_bug.cgi?id=211645 Reviewed by Darin Adler. Fix the mistake in VideoFullscreenManager::supportsVideoFullscreen() introduced in r202274. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::supportsVideoFullscreen const): 2020-05-11 Per Arne Vollan <pvollan@apple.com> [iOS] Update message filtering rules in the WebContent process' sandbox https://bugs.webkit.org/show_bug.cgi?id=211188 <rdar://problem/60922910> Reviewed by Brent Fulgham. Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS. Messages that have not been observed being in use, should be denied. No new tests, covered by existing tests. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-11 Chris Dumez <cdumez@apple.com> [iOS] WKWebView.evaluateJavaScript should run at foreground priority when app is foreground https://bugs.webkit.org/show_bug.cgi?id=211734 Reviewed by Darin Adler. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld): 2020-05-11 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION (r253267): issues on touchstart/touchend/touchmove (pointerdown/pointerup/pointermove) events https://bugs.webkit.org/show_bug.cgi?id=211521 <rdar://problem/62942374> Reviewed by Darin Adler. As a brief refresher, deferring gesture recognizers allow us to handle otherwise blocking touch events asynchronously by having all preventable native gesture recognizers require the deferring gesture recognizer to fail; we only fail the deferring gesture recognizer once the web process has handled the touch event, and did not call `preventDefault()`. These additional failure requirements can cause preventable gestures to be linked together in the same gesture dependency subgraph; since each subgraph is reset only once all gestures in the subgraph have failed or ended, this might cause some gestures to be reset after a delay (rather than being reset immediately). To mitigate this, we divide the set of preventable gestures into multiple (currently, 2) subgraphs: one for gestures that are reset after a delay, and another for gestures that are immediately resettable. This way, immediately resettable gestures are able to reset and recognize again, without having to wait for other slower preventable gesture recognizers to reset. When fast-clicking is disabled (e.g. when loading a desktop web page on a mobile form factor, or when the viewport has been zoomed in), the blocking synthetic double tap gesture recognizer (that is, `WKContentView`'s `_doubleTapGestureRecognizer`) is enabled, and adds itself as a dynamic failure requirement to the content view's synthetic single tap gesture recognizer (`_singleTapGestureRecognizer`). In terms of the gesture dependency graph, this causes the single tap gesture to form an edge with the double tap gesture, which ends up uniting both deferring gesture recognizers under the same subgraph. This means UIWebTouchEventsGestureRecognizer, which should be one of the gestures in the immediately resettable subgraph, is now connected to the rest of the delayed resettable gestures, meaning that it cannot recognize until "slowly resettable" gestures such as the tap-and-half text selection gesture have also been reset. This delay causes touch events to be dropped, as is the case in this bug. To fix this, simply quarantine the single tap and double tap gestures inside their own subgraph by introducing a separate deferring gesture recognizer for them. When fast-clicking is enabled, this does not hinder the ability for the single tap gesture to fire in rapid succession, since the double tap gesture is disabled (and thus, not a part of the graph at all). when fast-clicking is disabled, then the double tap gesture will prevent the single tap gesture from being immediately reset anyways, due to the direct failure requirement between the double and single tap gesture. Doing this ensures that no other immediately resettable gesture (`UIWebTouchEventsGestureRecognizer` included) is accidentally blocked from immediately resetting due to being linked to the delayed resettable gestures by way of the synthetic single and double tap gestures. Test: fast/events/touch/ios/tap-and-half-when-viewport-is-not-responsive.html * UIProcess/ios/WKContentViewInteraction.h: Add a dedicated deferring gesture recognizer for the synthetic single tap and double tap gesture recognizers. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): Use -_deferringGestureRecognizers instead of hard-coding logic for each deferring gesture. (-[WKContentView _removeDefaultGestureRecognizers]): Ditto. (-[WKContentView _addDefaultGestureRecognizers]): Ditto. (-[WKContentView _deferringGestureRecognizers]): We now have 3 distinct deferring gestures; instead of handling the three deferring gestures individually in various places in this file, group them all behind a getter that returns an array of deferring gestures, and use this instead. (-[WKContentView _doneDeferringNativeGestures:]): Ditto. (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Ditto. (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): Partition the synthetic single tap and double tap gestures into their own subgraph. 2020-05-11 Per Arne Vollan <pvollan@apple.com> Unreviewed, reverting r261296. Rolling r260769 back in, since this was not causing a regression. Reverted changeset: "Unreviewed, reverting r260769." https://bugs.webkit.org/show_bug.cgi?id=211578 https://trac.webkit.org/changeset/261296 2020-05-11 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the watchOS build after r261457 Put -[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:] behind a USE(UICONTEXTMENU) compiler guard; currently, it is declared everywhere, but only implemented if ENABLE(DATA_DETECTION) && USE(UICONTEXTMENU). However, WKContentView only invokes it behind code that is guarded by USE(UICONTEXTMENU). * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:]): 2020-05-11 Philippe Normand <pnormand@igalia.com> [GTK] Media and audio permission request unit tests are timing out https://bugs.webkit.org/show_bug.cgi?id=158257 Reviewed by Carlos Garcia Campos. Add new private API to disable secure capture device contexts. This is needed for the API tests. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewSetMediaCaptureRequiresSecureConnection): * UIProcess/API/glib/WebKitWebViewPrivate.h: 2020-05-10 Basuke Suzuki <basuke.suzuki@sony.com> Add ENABLE_PERIODIC_MEMORY_MONITOR flag. https://bugs.webkit.org/show_bug.cgi?id=211704 Reviewed by Yusuke Suzuki. No new tests because there's no behavior change. Replace PLATFORM() macros with ENABLE() macro. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2020-05-10 Michael Catanzaro <mcatanzaro@gnome.org> REGRESSION(r261270): Broke build with python3 https://bugs.webkit.org/show_bug.cgi?id=211699 Reviewed by Yusuke Suzuki. Remove the problematic print statement. It causes the script to fail. If fixed, it spams the build output. We only print messages during the build when there are problems to be fixed. * Scripts/generate-message-receiver.py: (main): 2020-05-10 Tim Horton <timothy_horton@apple.com> Clicking a tel:// link on iPad with a trackpad presents different UI than tapping on it https://bugs.webkit.org/show_bug.cgi?id=211686 <rdar://problem/57941589> Reviewed by Wenson Hsieh. Previously, iOS WebKit had code in handleTap, handleTwoFingerTapAtPoint, and commitPotentialTap, which introspected the hit element /before/ dispatching the tap (or synthetic click) to the DOM, short circuiting all normal event handling machinery in order to prevent the default action and present the Data Detectors UI for the given link. There's one immediate problem with this, which is that there is no similar code in the direct click event handler path, which we now use for trackpad/mouse input on iPad. There's also a secondary problem (which we have not seen in practice), which is that pages cannot preventDefault to avoid launching the Data Detectors UI on a link, like they could to prevent an ordinary link from being followed. In order to resolve both issues and reduce duplication of logic, move the code that introspects the element and invokes Data Detectors UI from high-level WebKit event dispatch code (where it doesn't really belong) down to WebCore's default click event handler for anchors, right next to the code that would ordinarily cause a navigation. This way, no matter how we get here, whether by synthetic click or real click, we'll invoke the Data Detectors UI. One alternative considered at length: we could actually let the navigation happen, and instead handle the switch in navigation policy code, but there are a few reasons that did not seem ideal: 1) We'd need to plumb platform-specific data structures through a ton of FrameLoader code. 2) Clients often block non-HTTP(S) navigations, so in order to keep the feature functional, we'd have to disregard the client's policy decision, defeating much of the purpose of making use of the navigation mechanism in the first place. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showDataDetectorsUIForPositionInformation): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::showDataDetectorsUIForPositionInformation): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::showDataDetectorsUIForElement): Plumb showDataDetectorsUIForPositionInformation from iOS WebKit's ChromeClient implementation all the way to WKContentView. * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant showDataDetectorsUIForPositionInformation:]): (-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]): (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): (-[WKActionSheetAssistant showDataDetectorsSheet]): Deleted. Make it possible to push InteractionInformationAtPosition into WKActionSheetAssistant, instead of having it always pull a fresh one upon invocation, so that we can use the position information passed along with the showDataDetectorsUIForPositionInformation message. (-[WKActionSheetAssistant _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]): (-[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:]): Fix an existing bug where Data Detectors context menus would show extra default actions, by moving our implementation of the -_contextMenuInteraction:overrideSuggestedActionsForConfiguration: delegate here, sharing it with WKContentViewInteraction. In a future patch, we should reconsider having three separate UIContextMenuInteractions. Also, remove the contextMenuPresentationLocationForActionSheetAssistant: delegate, since it will be wrong in the case of pushed-in position information, and instead use the position information's original hit test point. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showDataDetectorsUI]): (-[WKContentView _showDataDetectorsUIForPositionInformation:]): (-[WKContentView _actionForLongPressFromPositionInformation:]): (-[WKContentView _didNotHandleTapAsClick:]): (-[WKContentView dataDetectionContextForPositionInformation:]): (-[WKContentView dataDetectionContextForActionSheetAssistant:positionInformation:]): (-[WKContentView _showDataDetectorsSheet]): Deleted. (-[WKContentView currentPositionInformation]): Deleted. (-[WKContentView dataDetectionContextForActionSheetAssistant:]): Deleted. Instead of exposing an unnecessary -currentPositionInformation getter on WKActionSheetAssistant, provide it as an argument to the WKActionSheetAssistantDelegate methods that actually need it. (-[WKContentView contextMenuPresentationLocationForActionSheetAssistant:]): Deleted. (-[WKContentView _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]): Adopt WKActionSheetAssistant's suggestedActions mechanism so we can share code. * UIProcess/ios/WKPDFView.mm: (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]): (-[WKPDFView dataDetectionContextForActionSheetAssistant:positionInformation:]): (-[WKPDFView dataDetectionContextForActionSheetAssistant:]): Deleted. Adapt to some WKActionSheetAssistantDelegate changes. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleTap): (WebKit::WebPage::handleTwoFingerTapAtPoint): (WebKit::WebPage::commitPotentialTap): Remove the aforementioned short-circuiting paths for Data Detectors links. 2020-05-09 David Kilzer <ddkilzer@apple.com> Attempt #2 to fix internal iOS build * UIProcess/ios/WKMouseGestureRecognizer.mm: - Use ALLOW_DEPRECATED_IMPLEMENTATIONS_{BEGIN,END}. 2020-05-09 David Kilzer <ddkilzer@apple.com> Attemp to fix internal iOS build * Platform/spi/ios/UIKitSPI.h: - Define @class UIHoverEvent using header if available, else fall back to local class definition. - Define methods separately from class definition. * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer setView:]): - Use new method if it is available. 2020-05-09 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r261389. https://bugs.webkit.org/show_bug.cgi?id=211678 Introduced page loading regression. (Requested by perarne on #webkit). Reverted changeset: "[iOS] Update message filtering rules in the WebContent process' sandbox" https://bugs.webkit.org/show_bug.cgi?id=211188 https://trac.webkit.org/changeset/261389 2020-05-09 David Kilzer <ddkilzer@apple.com> Adapt LocalCurrentGraphicsContext for iOS <https://webkit.org/b/211660> Reviewed by Darin Adler. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::convertPlatformImageToBitmap): - Use LocalCurrentGraphicsContext for both iOS and Mac code paths. * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: - Switch from PLATFORM(MAC) and PLATFORM(IOS_FAMIY) to USE(APPKIT) to separate platform code. (WebKit::convertDragImageToBitmap): (WebKit::convertImageToBitmap): Delete. (WebKit::convertCGImageToBitmap): Delete. - Combine Mac-specific convertImageToBitmap() and iOS-specific convertCGImageToBitmap() into a single method using DragImage type and special-casing one line of code. (WebKit::WebDragClient::startDrag): (WebKit::WebDragClient::didConcludeEditDrag): - Combine iOS and Mac methods into a singe method. 2020-05-09 David Quesada <david_quesada@apple.com> Remove HAVE_UI_SCROLL_VIEW_INDICATOR_FLASHING_SPI https://bugs.webkit.org/show_bug.cgi?id=211662 rdar://problem/63048713 Reviewed by Darin Adler. Remove this platform conditional and unconditionally use -[UIScrolView _flashScrollIndicatorsForAxes: persistingPreviousFlashes:]. All supported platforms with UIScrollView have this SPI, and the conditional was excluding Mac Catalyst, making WKKeyboardScrollViewAnimator send a message to its scroll view that is no longer implemented. * Platform/spi/ios/UIKitSPI.h: Remove the declaration of the now unused -_flashScrollIndicatorsPersistingPreviousFlashes:. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (axesForDelta): (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]): 2020-05-08 David Kilzer <ddkilzer@apple.com> Remove empty directories from from svn.webkit.org repository <https://webkit.org/b/211644> Reviewed by Darin Adler. * UIProcess/API/win: Removed. 2020-05-08 Chris Dumez <cdumez@apple.com> Regression(r210945): No attachment when sharing to mail https://bugs.webkit.org/show_bug.cgi?id=211651 <rdar://problem/63040170> Reviewed by Tim Horton. When failing to determine foreground state, the code before r210945 was assuming 'foreground', while the code in r210945 assume 'background'. This causes things to not render properly when we fail to determine the foreground state. This patch merely restores pre-r210945 behavior. I will investigate why we are unable to determinate the host application PID for the MailCompositionService. * UIProcess/ApplicationStateTracker.mm: (WebKit::isApplicationForeground): 2020-05-08 Nikos Mouchtaris <nmouchtaris@apple.com> Implement web-share v2 for files https://bugs.webkit.org/show_bug.cgi?id=209265 Reviewed by Andy Estes. Added support for passing file objects over IPC and sharing of files to share sheet. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<Vector<RawFile>>::encode): (IPC::ArgumentCoder<Vector<RawFile>>::decode): (IPC::ArgumentCoder<ShareDataWithParsedURL>::encode): (IPC::ArgumentCoder<ShareDataWithParsedURL>::decode): * Shared/WebCoreArgumentCoders.h: * UIProcess/Cocoa/ShareableFileWrite.h: Added. * UIProcess/Cocoa/ShareableFileWrite.mm: Added. (+[WKShareableFileWrite getSharingDirectoryPath]): (+[WKShareableFileWrite getFileDirectoryForSharing]): (+[WKShareableFileWrite removeFileDirectoryForSharing]): (+[WKShareableFileWrite setQuarantineInformationForFilePath:]): (+[WKShareableFileWrite applyQuarantineSandboxAndDownloadFlagsToFileAtPath:]): (+[WKShareableFileWrite createFilename:]): (+[WKShareableFileWrite writeFileToShareableURL:data:]): * UIProcess/Cocoa/WKShareSheet.mm: (-[WKShareSheet presentWithParameters:inRect:completionHandler:]): (-[WKShareSheet _didCompleteWithSuccess:]): * WebKit.xcodeproj/project.pbxproj: 2020-05-08 Brent Fulgham <bfulgham@apple.com> Revise sandbox to stop logging some commonly-used properties https://bugs.webkit.org/show_bug.cgi?id=211636 <rdar://problem/63014244> Reviewed by Per Arne Vollan. Further living on and testing has shown a handful of sysctl entries that are in regular use, and do not need to be logged or considered for removal. This patch has no change in behavior, just reduces logging. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2020-05-08 Chris Dumez <cdumez@apple.com> Make WKWebViewConfiguration._alwaysRunsAtForegroundPriority an alias for _clientNavigationsRunAtForegroundPriority https://bugs.webkit.org/show_bug.cgi?id=211632 Reviewed by Darin Adler. Make WKWebViewConfiguration._alwaysRunsAtForegroundPriority an alias for _clientNavigationsRunAtForegroundPriority. _alwaysRunsAtForegroundPriority is a frequent source of process assertion leaks that get blamed on WebKit. Clients are using this in order to be able to do loads in background views so _clientNavigationsRunAtForegroundPriority should suffice and is not leak prone since the process assertion is released after the navigation has completed. * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::alwaysRunsAtForegroundPriority const): Deleted. (API::PageConfiguration::setAlwaysRunsAtForegroundPriority): Deleted. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _alwaysRunsAtForegroundPriority]): (-[WKWebViewConfiguration _setAlwaysRunsAtForegroundPriority:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::updateThrottleState): (WebKit::WebPageProxy::resetStateAfterProcessExited): * UIProcess/WebPageProxy.h: 2020-05-08 Alex Christensen <achristensen@webkit.org> Revert r260390 https://bugs.webkit.org/show_bug.cgi?id=210759 <rdar://problem/62608140> r260390 was intended to stop hitting some assertions in ~PendingFrameLoad, but it seems to have caused a regression. Reverting it and removing the invalid assertions. * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::~PendingFrameLoad): (WebKit::NetworkCache::SpeculativeLoadManager::~SpeculativeLoadManager): 2020-05-08 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] caret appears in the middle of a search field when field is focused on agoda.com https://bugs.webkit.org/show_bug.cgi?id=211591 <rdar://problem/60605873> Reviewed by Antoine Quint. The main search field on the mobile version of this website begins offscreen, with a CSS transform that moves it to the far right; tapping the button element that (visually) has a search-field-like appearance on the front page programmatically focuses the real offscreen search field, and animates it onscreen by changing the CSS transform attribute to remove the x-axis translation. On iOS, the caret rect is computed and sent to the UI process via editor state updates; however, the editor state is computed immediately after focusing the input field. As such, the caret rect at this moment is computed in the middle of the animation, leaving it stuck in an unpredictable location. To fix this, add plumbing to call into the WebKit client layer when an animation has ended. On iOS, if the selection is visible (i.e. a ranged selection, or editable caret), then check to see whether the element that has finished animating contains either endpoint of the selection. If so, then schedule a followup editor state update to push updated selection information to the UI process. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::animationDidFinishForElement): * WebProcess/WebCoreSupport/WebChromeClient.h: Add a new client hook for when animations end. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::animationDidFinishForElement): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: Add logic to schedule a new editor state update if needed, after an animation ends that might affect either the start or end of the selection. (WebKit::WebPage::animationDidFinishForElement): 2020-05-08 David Kilzer <ddkilzer@apple.com> REGRESSION (r260228): Linker warning about limitsNavigationsToAppBoundDomains property overriding instance methods from class <https://webkit.org/b/211393> Reviewed by Brent Fulgham. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration limitsNavigationsToAppBoundDomains]): (-[WKWebViewConfiguration setLimitsNavigationsToAppBoundDomains:]): - Move from WKPrivate category to main category to fix linker warnings. 2020-05-08 Chris Dumez <cdumez@apple.com> REGRESSION(r259209) Webview's pending URL is null after restoring session state https://bugs.webkit.org/show_bug.cgi?id=211626 <rdar://problem/62992262> Reviewed by Alex Christensen. The issue was that WebPageProxy::goToBackForwardItem() would behave differently whether the page has a running process or not. In particular, when the page did not have a running process, goToBackForwardItem() would return early and call launchProcessWithItem() instead. Unlike goToBackForwardItem(), launchProcessWithItem() would fail to set the pending API request. To address the issue, I am getting rid of launchProcessWithItem() and merging its logic into goToBackForwardItem() instead. Both methods shared a lot of code anyway and having 2 separate code paths that may diverge is error prone. Change is covered by new API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::launchProcessWithItem): Deleted. * UIProcess/WebPageProxy.h: 2020-05-08 Alex Christensen <achristensen@webkit.org> WKWebView.title should be safe browsing warning's title during a safe browsing warning https://bugs.webkit.org/show_bug.cgi?id=211403 Reviewed by Tim Horton. Add a new property to PageLoadState, which allows the title to be set underneath it. That way, once the safe browsing warning is closed, we can update the title to what it would've been, including any changes that happened while the warning was open. Covered by an API test. I also manually verified this fixes rdar://problem/56201982 * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::commitChanges): (WebKit::PageLoadState::reset): (WebKit::PageLoadState::didCommitLoad): (WebKit::PageLoadState::title const): (WebKit::PageLoadState::setTitleFromSafeBrowsingWarning): * UIProcess/PageLoadState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): 2020-05-08 Per Arne Vollan <pvollan@apple.com> [iOS] Update message filtering rules in the WebContent process' sandbox https://bugs.webkit.org/show_bug.cgi?id=211188 Reviewed by Brent Fulgham. Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS. Messages that have not been observed being in use should be denied. No new tests, covered by existing tests. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-08 Chris Dumez <cdumez@apple.com> Turn processDidBecomeUnresponsive logging into error logging https://bugs.webkit.org/show_bug.cgi?id=211629 Reviewed by Youenn Fablet. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::processDidBecomeUnresponsive): 2020-05-08 Per Arne Vollan <pvollan@apple.com> [Cocoa] Close connections to Launch Services after revoking extension https://bugs.webkit.org/show_bug.cgi?id=211594 Reviewed by Brent Fulgham. In <https://trac.webkit.org/changeset/258915/webkit>, connections to the Launch Services database mapping services were denied, by creating a temporary extension. After revoking this extension in the WebContent process, it is important to close any open connections to Launch Services initiated by the mapping. No new tests, covered by existing UTI/MIME type tests. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-05-08 Youenn Fablet <youenn@apple.com> Handle remote audio capture IPC messages in a background thread https://bugs.webkit.org/show_bug.cgi?id=211583 Reviewed by Eric Carlson. We introduce RemoteCaptureSampleManager which is responsible to get remote capture sample IPC messages and treat them from a background thread. It is currently used to handle audio capture IPC messages. We move UserMediaCaptureManager::Source in its own file and rename it to RemoteRealtimeMediaSource. Covered by existing tests. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * PlatformMac.cmake: * SourcesCocoa.txt: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: * WebKit.xcodeproj/project.pbxproj: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: Added. (WebKit::RemoteCaptureSampleManager::RemoteCaptureSampleManager): (WebKit::RemoteCaptureSampleManager::~RemoteCaptureSampleManager): (WebKit::RemoteCaptureSampleManager::setConnection): (WebKit::RemoteCaptureSampleManager::addSource): (WebKit::RemoteCaptureSampleManager::removeSource): (WebKit::RemoteCaptureSampleManager::dispatchToThread): (WebKit::RemoteCaptureSampleManager::storageChanged): (WebKit::RemoteCaptureSampleManager::audioSamplesAvailable): * WebProcess/cocoa/RemoteCaptureSampleManager.h: Added. * WebProcess/cocoa/RemoteCaptureSampleManager.messages.in: Added. * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: Added. (WebKit::RemoteRealtimeMediaSource::RemoteRealtimeMediaSource): (WebKit::RemoteRealtimeMediaSource::~RemoteRealtimeMediaSource): (WebKit::RemoteRealtimeMediaSource::whenReady): (WebKit::RemoteRealtimeMediaSource::didFail): (WebKit::RemoteRealtimeMediaSource::setAsReady): (WebKit::RemoteRealtimeMediaSource::clone): (WebKit::RemoteRealtimeMediaSource::setCapabilities): (WebKit::RemoteRealtimeMediaSource::setSettings): (WebKit::RemoteRealtimeMediaSource::remoteAudioSamplesAvailable): (WebKit::RemoteRealtimeMediaSource::remoteVideoSampleAvailable): (WebKit::RemoteRealtimeMediaSource::connection): (WebKit::RemoteRealtimeMediaSource::startProducingData): (WebKit::RemoteRealtimeMediaSource::stopProducingData): (WebKit::RemoteRealtimeMediaSource::setShouldApplyRotation): (WebKit::RemoteRealtimeMediaSource::capabilities): (WebKit::RemoteRealtimeMediaSource::applyConstraints): (WebKit::RemoteRealtimeMediaSource::applyConstraintsSucceeded): (WebKit::RemoteRealtimeMediaSource::applyConstraintsFailed): (WebKit::RemoteRealtimeMediaSource::hasEnded): (WebKit::RemoteRealtimeMediaSource::stopBeingObserved): (WebKit::RemoteRealtimeMediaSource::requestToEnd): * WebProcess/cocoa/RemoteRealtimeMediaSource.h: Added. (WebKit::RemoteRealtimeMediaSource::identifier const): (WebKit::RemoteRealtimeMediaSource::settings const): (WebKit::RemoteRealtimeMediaSource::setShouldCaptureInGPUProcess): (WebKit::RemoteRealtimeMediaSource::shouldCaptureInGPUProcess const): * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::createCaptureSource): (WebKit::UserMediaCaptureManager::cloneSource): (WebKit::UserMediaCaptureManager::cloneVideoSource): (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource): (WebKit::UserMediaCaptureManager::AudioFactory::setShouldCaptureInGPUProcess): (WebKit::UserMediaCaptureManager::VideoFactory::createVideoCaptureSource): (WebKit::UserMediaCaptureManager::DisplayFactory::createDisplayCaptureSource): * WebProcess/cocoa/UserMediaCaptureManager.h: * WebProcess/cocoa/UserMediaCaptureManager.messages.in: 2020-05-08 Youenn Fablet <youenn@apple.com> Video capture does not get unmuted in case of tab switch on iOS https://bugs.webkit.org/show_bug.cgi?id=211509 Reviewed by Eric Carlson. Remove no longer needed code. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::VideoFactory::setActiveSource): * WebProcess/cocoa/UserMediaCaptureManager.h: 2020-05-08 Carlos Garcia Campos <cgarcia@igalia.com> Unreviewed. Fix GTK4 build after r261370 * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp: (webkitScriptDialogIsUserHandled): 2020-05-08 Lauro Moura <lmoura@igalia.com> [WPE][WebDriver] Implement user prompt support https://bugs.webkit.org/show_bug.cgi?id=207372 Reviewed by Carlos Garcia Campos. Provide a default implementation for WebDriver dialog commands. This implementation will mimic the expected browser behavior of accepting/dismissing the dialogs, while not exposing any new API. * UIProcess/API/glib/WebKitScriptDialogPrivate.h: - Expose new private function to check whether the dialog is using a default implementation or is handled by the user. * UIProcess/API/glib/WebKitWebView.cpp: - Avoid default WebDriver behavior if the dialog is user-handled. (webkitWebViewSetCurrentScriptDialogUserInput): (webkitWebViewAcceptCurrentScriptDialog): (webkitWebViewDismissCurrentScriptDialog): * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp: (webkitScriptDialogIsUserHandled): - Return whether the dialog is user handled. * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp: - Added basic behavior for the WebDriver dialog callbacks for WPE. (webkitScriptDialogAccept): (webkitScriptDialogDismiss): (webkitScriptDialogSetUserInput): (webkitScriptDialogIsUserHandled): * UIProcess/API/wpe/WebKitWebViewWPE.cpp: (webkitWebViewScriptDialog): - Hold a dialog ref if the webview is controlled by automation and ends up calling the default "script-dialog" event handler. 2020-05-07 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Roll back newly created credentials if an error occurs https://bugs.webkit.org/show_bug.cgi?id=183530 <rdar://problem/43357305> Reviewed by Brent Fulgham. We should clean up any newly created credentials if an error occurs before the relying party registers the identity. Otherwise we are left with a dangling credential. Covered by API tests. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification): (WebKit::LocalAuthenticator::receiveException const): 2020-05-07 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r261252. Reland r260684 now that a proper fix has landed in Reader Reverted changeset: "REGRESSION (r260684): Reader background is lost after multitasking" https://bugs.webkit.org/show_bug.cgi?id=211533 https://trac.webkit.org/changeset/261252 2020-05-07 Megan Gardner <megan_gardner@apple.com> Build Fix for MacCatalyst https://bugs.webkit.org/show_bug.cgi?id=211601 Reviewed by Tim Horton. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _removeContextMenuViewIfPossible]): 2020-05-07 Chris Dumez <cdumez@apple.com> Crash under WebKit::XPCServiceMain https://bugs.webkit.org/show_bug.cgi?id=211600 <rdar://problem/62875458> Reviewed by Darin Adler. Made the following changes: - Crash under strcmp() could in theory happen if expectedBundleVersion.UTF8String was null, which could happen if expectedBundleVersion was null. I now use higher level String types for the versions, make sure they are not null and use String comparison to compare them. - Call CRASH() instead of __builtin_trap(), to guarantee that we crash with a SIGTRAP (see comment next to CRASH() macro). - Move CRASH() call to a crashDueWebKitFrameworkVersionMismatch() never inlined function to make it clear when it crashes due to a framework version mismatch and distinguish from proper crashes. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::crashDueWebKitFrameworkVersionMismatch): (WebKit::XPCServiceMain): 2020-05-07 Youenn Fablet <youenn@apple.com> Remove AudioMediaStreamTrackRenderer::muted https://bugs.webkit.org/show_bug.cgi?id=211289 Reviewed by Eric Carlson. muted is unnecessary since we are using start/stop instead. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: 2020-05-07 Don Olmstead <don.olmstead@sony.com> Remove unused USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) https://bugs.webkit.org/show_bug.cgi?id=211582 Reviewed by Fujii Hironori. After r261264 all ports implemented USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::ThreadedCompositor): (WebKit::m_displayRefreshMonitor): (WebKit::ThreadedCompositor::invalidate): (WebKit::ThreadedCompositor::sceneUpdateFinished): (WebKit::ThreadedCompositor::displayRefreshMonitor): * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h: * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp: * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createDisplayRefreshMonitor const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::createDisplayRefreshMonitor): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::createDisplayRefreshMonitor): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged): * WebProcess/WebPage/DrawingArea.cpp: * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: * WebProcess/WebPage/mac/DrawingAreaMac.cpp: 2020-05-07 Darin Adler <darin@apple.com> Add some missing null checks for DocumentLoader https://bugs.webkit.org/show_bug.cgi?id=211544 rdar://62843516 Reviewed by Anders Carlsson. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Add a null check before calling DocumentLoader::response. 2020-05-07 Darin Adler <darin@apple.com> Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code https://bugs.webkit.org/show_bug.cgi?id=211525 Reviewed by Anders Carlsson. * UIProcess/Cocoa/WebViewImpl.mm: Use NSTextInputContextSPI.h. (WebKit::WebViewImpl::validAttributesForMarkedText): Removed USE(INSERTION_UNDO_GROUPING) from the macOS-specific code here. (WebKit::WebViewImpl::insertText): Ditto. * UIProcess/PageClient.h: Ditto. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::registerInsertionUndoGrouping): Deleted. This function is not needed at all on iOS. * UIProcess/mac/PageClientImplMac.h: Removed USE(INSERTION_UNDO_GROUPING). * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::registerInsertionUndoGrouping): Ditto. 2020-05-07 Chris Dumez <cdumez@apple.com> Drop dead platformPrepareToSuspend / platformProcessDidResume in NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=211579 Reviewed by Geoffrey Garen. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): * NetworkProcess/NetworkProcess.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformPrepareToSuspend): Deleted. (WebKit::NetworkProcess::platformProcessDidResume): Deleted. * NetworkProcess/curl/NetworkProcessCurl.cpp: (WebKit::NetworkProcess::platformPrepareToSuspend): Deleted. (WebKit::NetworkProcess::platformProcessDidResume): Deleted. * NetworkProcess/soup/NetworkProcessSoup.cpp: (WebKit::NetworkProcess::platformPrepareToSuspend): Deleted. (WebKit::NetworkProcess::platformProcessDidResume): Deleted. 2020-05-07 Megan Gardner <megan_gardner@apple.com> ContextMenu: entire webpage pops and disappears to generate preview of embedded image https://bugs.webkit.org/show_bug.cgi?id=211272 <rdar://problem/62482013> Reviewed by Tim Horton. The ActionSheetAssistant is always around, so using the presence of one to determine if we need to remove the _contextMenuHintContainerView is incorrect and causes it to be around on the next invocation of the context menu, and causing the failure of the creation of a new preview, which then will default to popping the whole page. We need to ask the ActionSheetAssistant if it is actively showing anything, and then correctly clean up the _contextMenuHintContainerView after the end of the interactions for FileUploadMenu and ActionSheetAssistant are done with their interactions. * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant removeContextMenuInteraction]): (-[WKActionSheetAssistant hasContextMenuInteraction]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView removeContextMenuViewIfPossibleForActionSheetAssistant:]): (-[WKContentView _canRemoveContextMenuView]): (-[WKContentView _removeContextMenuViewIfPossible]): (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel removeContextMenuInteraction]): 2020-05-07 Chris Dumez <cdumez@apple.com> Simplify several IPC sending call sites in the UIProcess https://bugs.webkit.org/show_bug.cgi?id=211575 Reviewed by Alex Christensen. Simplify several IPC sending call sites in the UIProcess by leveraging the fact that WebPageProxy subclasses IPC::MessageSender. * UIProcess/Cocoa/TextCheckingController.mm: (WebKit::TextCheckingController::replaceRelativeToSelection): (WebKit::TextCheckingController::removeAnnotationRelativeToSelection): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::performDictionaryLookupAtLocation): (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection): (WebKit::WebPageProxy::insertDictatedTextAsync): (WebKit::WebPageProxy::speakingErrorOccurred): (WebKit::WebPageProxy::boundaryEventOccurred): (WebKit::WebPageProxy::voicesDidChange): * UIProcess/GeolocationPermissionRequestManagerProxy.cpp: (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision): * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::setDiagnosticLoggingAvailable): * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::setDiagnosticLoggingAvailable): * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::remoteFileReplaceContentsCallback): * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::fileReplaceContentsCallback): * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: (WebKit::RemoteWebInspectorProxy::platformSave): (WebKit::RemoteWebInspectorProxy::platformAppend): * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformSave): (WebKit::WebInspectorProxy::platformAppend): * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp: (WebKit::NotificationPermissionRequestManagerProxy::createRequest): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged): (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::collapseSelection): * UIProcess/WebFullScreenManagerProxy.cpp: (WebKit::WebFullScreenManagerProxy::willEnterFullScreen): (WebKit::WebFullScreenManagerProxy::didEnterFullScreen): (WebKit::WebFullScreenManagerProxy::willExitFullScreen): (WebKit::WebFullScreenManagerProxy::didExitFullScreen): (WebKit::WebFullScreenManagerProxy::setAnimatingFullScreen): (WebKit::WebFullScreenManagerProxy::requestExitFullScreen): (WebKit::WebFullScreenManagerProxy::saveScrollPosition): (WebKit::WebFullScreenManagerProxy::restoreScrollPosition): (WebKit::WebFullScreenManagerProxy::setFullscreenInsets): (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDuration): (WebKit::WebFullScreenManagerProxy::setFullscreenControlsHidden): * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebPageProxy::getCenterForZoomGesture): * UIProcess/ios/SmartMagnificationController.mm: (WebKit::SmartMagnificationController::handleSmartMagnificationGesture): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView ensurePositionInformationIsUpToDate:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::handleTwoFingerTapAtPoint): (WebKit::WebPageProxy::handleStylusSingleTapAtPoint): (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens): (WebKit::WebPageProxy::willStartUserTriggeredZooming): (WebKit::WebPageProxy::potentialTapAtPosition): (WebKit::WebPageProxy::commitPotentialTap): (WebKit::WebPageProxy::cancelPotentialTap): (WebKit::WebPageProxy::tapHighlightAtPosition): (WebKit::WebPageProxy::handleTap): (WebKit::WebPageProxy::didRecognizeLongPress): (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint): (WebKit::WebPageProxy::inspectorNodeSearchMovedToPosition): (WebKit::WebPageProxy::inspectorNodeSearchEndedAtPosition): (WebKit::WebPageProxy::blurFocusedElement): (WebKit::WebPageProxy::setIsShowingInputViewForFocusedElement): (WebKit::WebPageProxy::setFocusedElementValue): (WebKit::WebPageProxy::setFocusedElementValueAsNumber): (WebKit::WebPageProxy::setFocusedElementSelectedIndex): (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF): (WebKit::WebPageProxy::contentSizeCategoryDidChange): (WebKit::WebPageProxy::generateSyntheticEditingCommand): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::handleMagnificationGestureEvent): (WebKit::ViewGestureController::handleSmartMagnificationGesture): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::windowAndViewFramesChanged): (WebKit::WebPageProxy::setMainFrameIsScrollable): (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync): (WebKit::WebPageProxy::fontAtSelection): (WebKit::WebPageProxy::stringSelectionForPasteboard): (WebKit::WebPageProxy::dataSelectionForPasteboard): (WebKit::WebPageProxy::readSelectionFromPasteboard): (WebKit::WebPageProxy::replaceSelectionWithPasteboardData): (WebKit::WebPageProxy::sendComplexTextInputToPlugin): (WebKit::WebPageProxy::uppercaseWord): (WebKit::WebPageProxy::lowercaseWord): (WebKit::WebPageProxy::capitalizeWord): (WebKit::WebPageProxy::setSmartInsertDeleteEnabled): (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens): (WebKit::WebPageProxy::shouldDelayWindowOrderingForEvent): (WebKit::WebPageProxy::acceptsFirstMouse): 2020-05-07 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260769. https://bugs.webkit.org/show_bug.cgi?id=211578 Introduced regressions related to sharing (Requested by perarne on #webkit). Reverted changeset: "[Cocoa] After r258891, r255119 can be reverted" https://bugs.webkit.org/show_bug.cgi?id=211083 https://trac.webkit.org/changeset/260769 2020-05-07 Chris Dumez <cdumez@apple.com> [iOS] AuxiliaryProcessProxy::sendWithAsyncReply() should prevent auxiliary process suspension while processing the IPC https://bugs.webkit.org/show_bug.cgi?id=209928 Reviewed by Youenn Fablet. AuxiliaryProcessProxy::sendWithAsyncReply() should prevent auxiliary process suspension on iOS while processing the IPC. If the process is suspended either before or during the IPC, this could result in hangs. This is a speculative fix for the flaky timeouts we see on many tests on iOS only. We know that missing activities with sendWithAsyncReply has caused test timeouts in the past (Bug 211421). * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::sendMessage): * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::getGPUProcessConnection): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getNetworkProcessConnection): (WebKit::NetworkProcessProxy::setUseITPDatabase): (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources): (WebKit::NetworkProcessProxy::resetParametersToDefaultValues): (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent): (WebKit::NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting): (WebKit::NetworkProcessProxy::setAppBoundDomainsForResourceLoadStatistics): (WebKit::NetworkProcessProxy::setShouldDowngradeReferrerForTesting): (WebKit::NetworkProcessProxy::setThirdPartyCookieBlockingMode): (WebKit::NetworkProcessProxy::setShouldEnbleSameSiteStrictEnforcementForTesting): (WebKit::NetworkProcessProxy::setFirstPartyWebsiteDataRemovalModeForTesting): (WebKit::NetworkProcessProxy::sendPrepareToSuspend): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::PluginProcessProxy): * UIProcess/Plugins/PluginProcessProxy.h: * UIProcess/ProcessThrottler.h: (WebKit::ProcessThrottler::Activity::Activity): (WebKit::ProcessThrottler::Activity::isQuietActivity const): (WebKit::ProcessThrottler::Activity::invalidate): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): * UIProcess/WebBackForwardCacheEntry.cpp: (WebKit::WebBackForwardCacheEntry::~WebBackForwardCacheEntry): * UIProcess/WebCookieManagerProxy.cpp: (WebKit::WebCookieManagerProxy::getHostnamesWithCookies): (WebKit::WebCookieManagerProxy::deleteCookie): (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince): (WebKit::WebCookieManagerProxy::setCookies): (WebKit::WebCookieManagerProxy::getAllCookies): (WebKit::WebCookieManagerProxy::getCookies): (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy): (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::getProcessDisplayName): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setThirdPartyCookieBlockingMode): (WebKit::WebProcessProxy::fetchWebsiteData): (WebKit::WebProcessProxy::deleteWebsiteData): (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins): (WebKit::WebProcessProxy::sendPrepareToSuspend): (WebKit::WebProcessProxy::activePagesDomainsForTesting): (WebKit::WebProcessProxy::establishServiceWorkerContext): * UIProcess/WebProcessProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::insertTextPlaceholder): (WebKit::WebPageProxy::removeTextPlaceholder): (WebKit::WebPageProxy::requestAutocorrectionData): (WebKit::WebPageProxy::requestEvasionRectsAboveSelection): (WebKit::WebPageProxy::updateSelectionWithDelta): (WebKit::WebPageProxy::requestDocumentEditingContext): (WebKit::WebPageProxy::insertDroppedImagePlaceholders): 2020-05-07 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] REGRESSION(r260996): Pressing <Tab> in an HTTP authentication dialog makes the dialog lose focus https://bugs.webkit.org/show_bug.cgi?id=211555 Reviewed by Philippe Normand. Bring back webkitWebViewBaseFocus to GTK3. I made it GTK4 only by mistake in r260996. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseFocus): (webkit_web_view_base_class_init): 2020-05-07 Philippe Normand <pnormand@igalia.com> [GTK] Build warning fixes Rubber-stamped by Žan Doberšek. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseGrabFocus): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::getGPUProcessConnection): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getNetworkProcessConnection): 2020-05-07 Youenn Fablet <youenn@apple.com> Sending WebRTC network packets should not go through the main thread https://bugs.webkit.org/show_bug.cgi?id=211291 Reviewed by Eric Carlson. Following on receiving RTC packets from a background thread, we also send RTC packets from a background thread. Creation of the sockets also happens in a background thread. LibWebRTCNetwork is getting the connection whenever a new connection to network process is created. It will then hop to the RTC network thread to set the IPC connection to the libwebrtc socket factory. At creation of the socket, we get the IPC connection to the network process and keep a ref in the RTC socket. In case network process crashed and the IPC connection of the RTC network is null, we hop to the main thread to create a new IPC connection. This will fail the creation of the socket (as well as new ones as well) as long as the IPC connection to network process is not valid again. Covered by existing tests. * WebProcess/Network/webrtc/LibWebRTCNetwork.cpp: (WebKit::LibWebRTCNetwork::setAsActive): (WebKit::LibWebRTCNetwork::setConnection): (WebKit::LibWebRTCNetwork::dispatchToThread): * WebProcess/Network/webrtc/LibWebRTCNetwork.h: (WebKit::LibWebRTCNetwork::connection): (WebKit::LibWebRTCNetwork::isActive const): * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: (WebKit::LibWebRTCProvider::startedNetworkThread): * WebProcess/Network/webrtc/LibWebRTCProvider.h: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::SendTo): (WebKit::LibWebRTCSocket::Close): (WebKit::LibWebRTCSocket::SetOption): (WebKit::LibWebRTCSocket::suspend): * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::setConnection): (WebKit::LibWebRTCSocketFactory::connection): (WebKit::LibWebRTCSocketFactory::createServerTcpSocket): (WebKit::LibWebRTCSocketFactory::createUdpSocket): (WebKit::LibWebRTCSocketFactory::createClientTcpSocket): (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): (WebKit::LibWebRTCSocketFactory::addSocket): (WebKit::LibWebRTCSocketFactory::removeSocket): (WebKit::LibWebRTCSocketFactory::forSocketInGroup): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: 2020-05-07 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Stop using the GtkWidget.destroy vfunc https://bugs.webkit.org/show_bug.cgi?id=211553 Reviewed by Carlos Garcia Campos. No new tests needed. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseDestroy): Removed. (webkitWebViewBaseDispose): Bring in the code from the removed function, adapt to use g_clear_pointer() to destroy the nested dialog. (webkit_web_view_base_class_init): Do not set the GtkWidget.destroy vfunc. 2020-05-07 Philippe Normand <pnormand@igalia.com> [WPE][Qt] Enable by default https://bugs.webkit.org/show_bug.cgi?id=211517 Reviewed by Adrian Perez de Castro. * PlatformWPE.cmake: Fix WPEQt build. 2020-05-06 Alex Christensen <achristensen@webkit.org> Fix webkitpy tests after r261254 https://bugs.webkit.org/show_bug.cgi?id=211112 test.messages.in was accidentally deleted instead of moved, and messages_unittest.py needed to be told of the new locations of results. The rest is just running the generator to update results. * Scripts/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/MessageNames.h: * Scripts/testMessageReceiver.cpp: (Messages::WebPage::GetPluginProcessConnection::send): (Messages::WebPage::TestMultipleAttributes::send): (WebKit::WebPage::didReceiveMessage): (WebKit::WebPage::didReceiveSyncMessage): * Scripts/testMessages.h: (Messages::WebPage::messageReceiverName): (Messages::WebPage::LoadURL::name): (Messages::WebPage::LoadURL::LoadURL): (Messages::WebPage::LoadURL::arguments const): (Messages::WebPage::LoadSomething::name): (Messages::WebPage::LoadSomething::LoadSomething): (Messages::WebPage::LoadSomething::arguments const): (Messages::WebPage::TouchEvent::name): (Messages::WebPage::TouchEvent::TouchEvent): (Messages::WebPage::TouchEvent::arguments const): (Messages::WebPage::AddEvent::name): (Messages::WebPage::AddEvent::AddEvent): (Messages::WebPage::AddEvent::arguments const): (Messages::WebPage::LoadSomethingElse::name): (Messages::WebPage::LoadSomethingElse::LoadSomethingElse): (Messages::WebPage::LoadSomethingElse::arguments const): (Messages::WebPage::DidReceivePolicyDecision::name): (Messages::WebPage::DidReceivePolicyDecision::DidReceivePolicyDecision): (Messages::WebPage::DidReceivePolicyDecision::arguments const): (Messages::WebPage::Close::name): (Messages::WebPage::Close::arguments const): (Messages::WebPage::PreferencesDidChange::name): (Messages::WebPage::PreferencesDidChange::PreferencesDidChange): (Messages::WebPage::PreferencesDidChange::arguments const): (Messages::WebPage::SendDoubleAndFloat::name): (Messages::WebPage::SendDoubleAndFloat::SendDoubleAndFloat): (Messages::WebPage::SendDoubleAndFloat::arguments const): (Messages::WebPage::SendInts::name): (Messages::WebPage::SendInts::SendInts): (Messages::WebPage::SendInts::arguments const): (Messages::WebPage::CreatePlugin::name): (Messages::WebPage::CreatePlugin::CreatePlugin): (Messages::WebPage::CreatePlugin::arguments const): (Messages::WebPage::RunJavaScriptAlert::name): (Messages::WebPage::RunJavaScriptAlert::RunJavaScriptAlert): (Messages::WebPage::RunJavaScriptAlert::arguments const): (Messages::WebPage::GetPlugins::name): (Messages::WebPage::GetPlugins::GetPlugins): (Messages::WebPage::GetPlugins::arguments const): (Messages::WebPage::GetPluginProcessConnection::name): (Messages::WebPage::GetPluginProcessConnection::GetPluginProcessConnection): (Messages::WebPage::GetPluginProcessConnection::arguments const): (Messages::WebPage::TestMultipleAttributes::name): (Messages::WebPage::TestMultipleAttributes::arguments const): (Messages::WebPage::TestParameterAttributes::name): (Messages::WebPage::TestParameterAttributes::TestParameterAttributes): (Messages::WebPage::TestParameterAttributes::arguments const): (Messages::WebPage::TemplateTest::name): (Messages::WebPage::TemplateTest::TemplateTest): (Messages::WebPage::TemplateTest::arguments const): (Messages::WebPage::SetVideoLayerID::name): (Messages::WebPage::SetVideoLayerID::SetVideoLayerID): (Messages::WebPage::SetVideoLayerID::arguments const): (Messages::WebPage::DidCreateWebProcessConnection::name): (Messages::WebPage::DidCreateWebProcessConnection::DidCreateWebProcessConnection): (Messages::WebPage::DidCreateWebProcessConnection::arguments const): (Messages::WebPage::InterpretKeyEvent::name): (Messages::WebPage::InterpretKeyEvent::InterpretKeyEvent): (Messages::WebPage::InterpretKeyEvent::arguments const): (Messages::WebPage::DeprecatedOperation::name): (Messages::WebPage::DeprecatedOperation::DeprecatedOperation): (Messages::WebPage::DeprecatedOperation::arguments const): (Messages::WebPage::ExperimentalOperation::name): (Messages::WebPage::ExperimentalOperation::ExperimentalOperation): (Messages::WebPage::ExperimentalOperation::arguments const): (Messages::None::messageReceiverName): Deleted. * Scripts/testMessagesReplies.h: * Scripts/webkit/messages_unittest.py: * Scripts/webkit/test.messages.in: Added. 2020-05-06 Megan Gardner <megan_gardner@apple.com> Context Menus presented from the wrong location when presented from sub-frames https://bugs.webkit.org/show_bug.cgi?id=211537 <rdar://problem/60390846> Reviewed by Tim Horton. The calculation for bounds for selection Information did not take frames into account, so if a frame was used, the location would not be correct in the context of the whole page, so the presentation location ended up being way off. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel showDocumentPickerMenu]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::boundsPositionInformation): (WebKit::selectionPositionInformation): 2020-05-06 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260689. https://bugs.webkit.org/show_bug.cgi?id=211542 "Caused regressions deleting text and filling password fields" (Requested by ddkilzer on #webkit). Reverted changeset: "WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle()" https://bugs.webkit.org/show_bug.cgi?id=211002 https://trac.webkit.org/changeset/260689 2020-05-06 Zalan Bujtas <zalan@apple.com> [ContentObservation] Shutterstock search bar is not activated on the first tap https://bugs.webkit.org/show_bug.cgi?id=211529 <rdar://problem/58843932> Reviewed by Simon Fraser. Shutterstock has a “initial click” action which converts some “actionable” elements (<a>) to some other “actionable” elements (<button>). If this initial click also happens to be on an element that triggers content observation (input), we see those changes as actionable content and not proceed with the click event (stay at hover). Any subsequent click works as expected. It’s very difficult to eliminate such false positives since all we see is that some "actionable" content is going away while some "actionable" content is being created. This quirk ensures that the first tap on the page does not trigger content observation. (It also means that any hover menu gets submitted on the first tap, but apparently the Shutterstock top menu bar works fine with click events.) * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didStartPageTransition): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleSyntheticClick): 2020-05-06 Wenson Hsieh <wenson_hsieh@apple.com> Use CocoaColor in more places instead of platform defines https://bugs.webkit.org/show_bug.cgi?id=211527 Reviewed by Darin Adler and Tim Horton. Use CocoaColor (added in r261247) in more places, and also introduce `CocoaFont.h` and use it to simplify some existing code that uses platform ifdefs for UIFont, NSFont, UIFontDescriptor and NSFontDescriptor. No change in behavior. * Platform/cocoa/CocoaColor.h: * Platform/cocoa/CocoaFont.h: Copied from Source/WebKit/Platform/cocoa/CocoaColor.h. * Platform/cocoa/CocoaImage.h: Change `@class`es to `OBJC_CLASS`, so that this header can be safely imported in C++ code. * Shared/Cocoa/ArgumentCodersCocoa.mm: (IPC::typeFromObject): (IPC::isSerializableValue): (IPC::encodeFontInternal): (IPC::encodeObject): (IPC::platformColorClass): Deleted. (IPC::platformFontClass): Deleted. * Shared/Cocoa/CoreTextHelpers.h: * Shared/Cocoa/CoreTextHelpers.mm: (WebKit::fontWithAttributes): * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: * UIProcess/Cocoa/WKSafeBrowsingWarning.h: * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (fontOfSize): (colorForItem): (-[WKSafeBrowsingBox setSafeBrowsingBackgroundColor:]): (-[WKSafeBrowsingWarning showDetailsClicked]): (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::updateFontManagerIfNeeded): * WebKit.xcodeproj/project.pbxproj: 2020-05-06 Alex Christensen <achristensen@webkit.org> Reduce IPC overhead for message receiver name and message name to 2 bytes https://bugs.webkit.org/show_bug.cgi?id=211112 Reviewed by Chris Dumez. * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveInvalidMessage): * GPUProcess/GPUConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): (WebKit::NetworkConnectionToWebProcess::didReceiveInvalidMessage): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didReceiveMessage): (WebKit::NetworkProcess::didReceiveSyncMessage): * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Deleted. (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Deleted. * Platform/IPC/Connection.cpp: (IPC::Connection::WaitForMessageState::WaitForMessageState): (IPC::Connection::addWorkQueueMessageReceiver): (IPC::Connection::removeWorkQueueMessageReceiver): (IPC::Connection::dispatchWorkQueueMessageReceiverMessage): (IPC::Connection::addThreadMessageReceiver): (IPC::Connection::removeThreadMessageReceiver): (IPC::Connection::dispatchThreadMessageReceiverMessage): (IPC::Connection::createSyncMessageEncoder): (IPC::Connection::sendMessage): (IPC::Connection::waitForMessage): (IPC::Connection::sendSyncMessage): (IPC::Connection::waitForSyncReply): (IPC::Connection::processIncomingMessage): (IPC::Connection::dispatchSyncMessage): (IPC::Connection::dispatchDidReceiveInvalidMessage): (IPC::Connection::dispatchMessage): (IPC::Connection::dispatchMessageToWorkQueueReceiver): (IPC::Connection::dispatchMessageToThreadReceiver): (IPC::Connection::dispatchIncomingMessages): * Platform/IPC/Connection.h: (IPC::Connection::send): (IPC::Connection::sendWithAsyncReply): (IPC::Connection::sendSync): (IPC::Connection::waitForAndDispatchImmediately): * Platform/IPC/Decoder.cpp: * Platform/IPC/Decoder.h: (IPC::Decoder::messageReceiverName const): (IPC::Decoder::messageName const): (IPC::Decoder::decode): (IPC::Decoder::operator>>): * Platform/IPC/Encoder.cpp: (IPC::Encoder::Encoder): (IPC::Encoder::encodeHeader): * Platform/IPC/Encoder.h: * Platform/IPC/HandleMessage.h: (IPC::handleMessageAsync): * Platform/IPC/MessageReceiverMap.cpp: (IPC::MessageReceiverMap::addMessageReceiver): (IPC::MessageReceiverMap::removeMessageReceiver): (IPC::MessageReceiverMap::dispatchMessage): (IPC::MessageReceiverMap::dispatchSyncMessage): * Platform/IPC/MessageReceiverMap.h: * Platform/IPC/MessageSender.h: * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::open): (IPC::Connection::sendMessage): (IPC::Connection::sendOutgoingMessage): (IPC::Connection::receiveSourceEventHandler): * Platform/IPC/cocoa/MachMessage.cpp: (IPC::MachMessage::create): (IPC::MachMessage::MachMessage): * Platform/IPC/cocoa/MachMessage.h: (IPC::MachMessage::messageReceiverName const): (IPC::MachMessage::messageName const): * PluginProcess/WebProcessConnection.cpp: (WebKit::WebProcessConnection::didReceiveInvalidMessage): * PluginProcess/WebProcessConnection.h: * Scripts/Makefile: * Scripts/generate-message-receiver.py: (main): * Scripts/webkit/LegacyMessages-expected.h: Removed. * Scripts/webkit/LegacyMessagesReplies-expected.h: Removed. * Scripts/webkit/MessageNames.cpp: Added. (IPC::description): * Scripts/webkit/MessageNames.h: Added. (IPC::receiverName): (WTF::isValidEnum): * Scripts/webkit/MessageReceiver-expected.cpp: Removed. * Scripts/webkit/MessageReceiverSuperclass-expected.cpp: Removed. * Scripts/webkit/Messages-expected.h: Removed. * Scripts/webkit/MessagesReplies-expected.h: Removed. * Scripts/webkit/MessagesRepliesSuperclassReplies-expected.h: Removed. * Scripts/webkit/MessagesSuperclass-expected.h: Removed. * Scripts/webkit/messages.py: * Scripts/webkit/test-legacy-messages.in: Removed. * Scripts/webkit/test-legacy.messages.in: Copied from Source/WebKit/Scripts/webkit/test-legacy-messages.in. * Scripts/webkit/test-legacyMessageReceiver.cpp: Added. (Messages::WebPage::GetPluginProcessConnection::send): (Messages::WebPage::TestMultipleAttributes::send): (WebKit::WebPage::didReceiveWebPageMessage): (WebKit::WebPage::didReceiveSyncWebPageMessage): * Scripts/webkit/test-legacyMessages.h: Added. (Messages::WebPage::messageReceiverName): (Messages::WebPage::LoadURL::name): (Messages::WebPage::LoadURL::LoadURL): (Messages::WebPage::LoadURL::arguments const): (Messages::WebPage::LoadSomething::name): (Messages::WebPage::LoadSomething::LoadSomething): (Messages::WebPage::LoadSomething::arguments const): (Messages::WebPage::TouchEvent::name): (Messages::WebPage::TouchEvent::TouchEvent): (Messages::WebPage::TouchEvent::arguments const): (Messages::WebPage::AddEvent::name): (Messages::WebPage::AddEvent::AddEvent): (Messages::WebPage::AddEvent::arguments const): (Messages::WebPage::LoadSomethingElse::name): (Messages::WebPage::LoadSomethingElse::LoadSomethingElse): (Messages::WebPage::LoadSomethingElse::arguments const): (Messages::WebPage::DidReceivePolicyDecision::name): (Messages::WebPage::DidReceivePolicyDecision::DidReceivePolicyDecision): (Messages::WebPage::DidReceivePolicyDecision::arguments const): (Messages::WebPage::Close::name): (Messages::WebPage::Close::arguments const): (Messages::WebPage::PreferencesDidChange::name): (Messages::WebPage::PreferencesDidChange::PreferencesDidChange): (Messages::WebPage::PreferencesDidChange::arguments const): (Messages::WebPage::SendDoubleAndFloat::name): (Messages::WebPage::SendDoubleAndFloat::SendDoubleAndFloat): (Messages::WebPage::SendDoubleAndFloat::arguments const): (Messages::WebPage::SendInts::name): (Messages::WebPage::SendInts::SendInts): (Messages::WebPage::SendInts::arguments const): (Messages::WebPage::CreatePlugin::name): (Messages::WebPage::CreatePlugin::CreatePlugin): (Messages::WebPage::CreatePlugin::arguments const): (Messages::WebPage::RunJavaScriptAlert::name): (Messages::WebPage::RunJavaScriptAlert::RunJavaScriptAlert): (Messages::WebPage::RunJavaScriptAlert::arguments const): (Messages::WebPage::GetPlugins::name): (Messages::WebPage::GetPlugins::GetPlugins): (Messages::WebPage::GetPlugins::arguments const): (Messages::WebPage::GetPluginProcessConnection::name): (Messages::WebPage::GetPluginProcessConnection::GetPluginProcessConnection): (Messages::WebPage::GetPluginProcessConnection::arguments const): (Messages::WebPage::TestMultipleAttributes::name): (Messages::WebPage::TestMultipleAttributes::arguments const): (Messages::WebPage::TestParameterAttributes::name): (Messages::WebPage::TestParameterAttributes::TestParameterAttributes): (Messages::WebPage::TestParameterAttributes::arguments const): (Messages::WebPage::TemplateTest::name): (Messages::WebPage::TemplateTest::TemplateTest): (Messages::WebPage::TemplateTest::arguments const): (Messages::WebPage::SetVideoLayerID::name): (Messages::WebPage::SetVideoLayerID::SetVideoLayerID): (Messages::WebPage::SetVideoLayerID::arguments const): (Messages::WebPage::DidCreateWebProcessConnection::name): (Messages::WebPage::DidCreateWebProcessConnection::DidCreateWebProcessConnection): (Messages::WebPage::DidCreateWebProcessConnection::arguments const): (Messages::WebPage::InterpretKeyEvent::name): (Messages::WebPage::InterpretKeyEvent::InterpretKeyEvent): (Messages::WebPage::InterpretKeyEvent::arguments const): (Messages::WebPage::DeprecatedOperation::name): (Messages::WebPage::DeprecatedOperation::DeprecatedOperation): (Messages::WebPage::DeprecatedOperation::arguments const): (Messages::WebPage::ExperimentalOperation::name): (Messages::WebPage::ExperimentalOperation::ExperimentalOperation): (Messages::WebPage::ExperimentalOperation::arguments const): * Scripts/webkit/test-legacyMessagesReplies.h: Added. * Scripts/webkit/test-messages.in: Removed. * Scripts/webkit/test-superclass-messages.in: Removed. * Scripts/webkit/test-superclass.messages.in: Copied from Source/WebKit/Scripts/webkit/test-superclass-messages.in. * Scripts/webkit/test-superclassMessageReceiver.cpp: Added. (Messages::WebPage::TestAsyncMessage::callReply): (Messages::WebPage::TestAsyncMessage::cancelReply): (Messages::WebPage::TestAsyncMessage::send): (Messages::WebPage::TestAsyncMessageWithNoArguments::callReply): (Messages::WebPage::TestAsyncMessageWithNoArguments::cancelReply): (Messages::WebPage::TestAsyncMessageWithNoArguments::send): (Messages::WebPage::TestAsyncMessageWithMultipleArguments::callReply): (Messages::WebPage::TestAsyncMessageWithMultipleArguments::cancelReply): (Messages::WebPage::TestAsyncMessageWithMultipleArguments::send): (Messages::WebPage::TestSyncMessage::send): (Messages::WebPage::TestSynchronousMessage::send): (WebKit::WebPage::didReceiveMessage): (WebKit::WebPage::didReceiveSyncMessage): * Scripts/webkit/test-superclassMessages.h: Added. (Messages::WebPage::messageReceiverName): (Messages::WebPage::LoadURL::name): (Messages::WebPage::LoadURL::LoadURL): (Messages::WebPage::LoadURL::arguments const): (Messages::WebPage::TestAsyncMessage::name): (Messages::WebPage::TestAsyncMessage::asyncMessageReplyName): (Messages::WebPage::TestAsyncMessage::TestAsyncMessage): (Messages::WebPage::TestAsyncMessage::arguments const): (Messages::WebPage::TestAsyncMessageWithNoArguments::name): (Messages::WebPage::TestAsyncMessageWithNoArguments::asyncMessageReplyName): (Messages::WebPage::TestAsyncMessageWithNoArguments::arguments const): (Messages::WebPage::TestAsyncMessageWithMultipleArguments::name): (Messages::WebPage::TestAsyncMessageWithMultipleArguments::asyncMessageReplyName): (Messages::WebPage::TestAsyncMessageWithMultipleArguments::arguments const): (Messages::WebPage::TestSyncMessage::name): (Messages::WebPage::TestSyncMessage::TestSyncMessage): (Messages::WebPage::TestSyncMessage::arguments const): (Messages::WebPage::TestSynchronousMessage::name): (Messages::WebPage::TestSynchronousMessage::TestSynchronousMessage): (Messages::WebPage::TestSynchronousMessage::arguments const): * Scripts/webkit/test-superclassMessagesReplies.h: Added. * Scripts/webkit/test.messages.in: Added. * Scripts/webkit/testMessageReceiver.cpp: Added. * Scripts/webkit/testMessages.h: Added. (Messages::None::messageReceiverName): * Scripts/webkit/testMessagesReplies.h: Added. * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::addMessageReceiver): (WebKit::AuxiliaryProcess::removeMessageReceiver): (WebKit::AuxiliaryProcess::didReceiveInvalidMessage): * Shared/AuxiliaryProcess.h: (WebKit::AuxiliaryProcess::addMessageReceiver): (WebKit::AuxiliaryProcess::removeMessageReceiver): * Shared/Cocoa/AuxiliaryProcessCocoa.mm: (WebKit::AuxiliaryProcess::didReceiveInvalidMessage): * SourcesCocoa.txt: * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::addMessageReceiver): (WebKit::AuxiliaryProcessProxy::removeMessageReceiver): (WebKit::AuxiliaryProcessProxy::logInvalidMessage): * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::addMessageReceiver): (WebKit::AuxiliaryProcessProxy::removeMessageReceiver): (WebKit::AuxiliaryProcessProxy::send): (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Deleted. (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Deleted. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::didReceiveInvalidMessage): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didReceiveInvalidMessage): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::didReceiveInvalidMessage): * UIProcess/Plugins/PluginProcessProxy.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didReceiveMessage): * UIProcess/SuspendedPageProxy.cpp: (WebKit::messageNamesToIgnoreWhileSuspended): (WebKit::SuspendedPageProxy::didReceiveMessage): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::didReceiveInvalidMessage): (WebKit::WebProcessPool::addMessageReceiver): (WebKit::WebProcessPool::removeMessageReceiver): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shouldSendPendingMessage): (WebKit::WebProcessProxy::didReceiveInvalidMessage): * UIProcess/WebProcessProxy.h: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::didReceiveInvalidMessage): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/Inspector/WebInspector.h: * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didReceiveInvalidMessage): * WebProcess/Network/NetworkProcessConnection.h: * WebProcess/Plugins/PluginProcessConnection.cpp: (WebKit::PluginProcessConnection::didReceiveInvalidMessage): * WebProcess/Plugins/PluginProcessConnection.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRendering): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::didReceiveMessage): 2020-05-06 Chris Dumez <cdumez@apple.com> REGRESSION (r260684): Reader background is lost after multitasking https://bugs.webkit.org/show_bug.cgi?id=211533 <rdar://problem/62941837> Unreviewed, revert r260684 due to regression. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setShouldFireResizeEvents): * UIProcess/WebPageProxy.h: * UIProcess/ios/WKApplicationStateTrackingView.mm: (-[WKApplicationStateTrackingView _willBeginSnapshotSequence]): (-[WKApplicationStateTrackingView _didCompleteSnapshotSequence]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setShouldFireResizeEvents): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-05-06 Kate Cheney <katherine_cheney@apple.com> ResourceLoadStatistics data summary call should create a web process pool if one doesn't exist https://bugs.webkit.org/show_bug.cgi?id=211520 <rdar://problem/59869619> Reviewed by Chris Dumez. Ensures that a process pool and network process exist when requesting resource load statistics data. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary): 2020-05-06 Keith Rollin <krollin@apple.com> Better surfacing of the presenting parent PID in the Network process https://bugs.webkit.org/show_bug.cgi?id=211495 <rdar://problem/62917205> Reviewed by Youenn Fablet. In Bug 205295, NetworkResourceLoader logging was improved, with one of the changes being that the PID of parent process that invoked the Network process was logged at the start of NetworkResourceLoader::start(). However, there was an execution path that skipped calling start() (NetworkConnectionToWebProcess::scheduleResourceLoad -> NetworkResourceLoader::startWithServiceWorker -> serviceWorkerDidNotHandle -> restartNetworkLoad -> startNetworkLoad), and so the the logging would not show the parent PID. This logging is needed for diagnostic purposes, so tweak the logging a little bit more in order to ensure we emit it. In this change, logging is added to various loading-related NetworkConnectionToWebProcess entry points (not just scheduleResourceLoad) in order to (a) ensure we emit the logging we want and (b) to give a clearer picture of what operations are being invoked in the Network process. No new tests -- no new or changed functionality. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::hasUploadStateChanged): (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences): (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad): (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad): (WebKit::NetworkConnectionToWebProcess::loadPing): (WebKit::NetworkConnectionToWebProcess::preconnectTo): (WebKit::NetworkConnectionToWebProcess::serverToContextConnectionNoLongerNeeded): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::start): 2020-05-06 Wenson Hsieh <wenson_hsieh@apple.com> Cut and paste from Google Doc to Notes in several (non-Latin) languages doesn't work https://bugs.webkit.org/show_bug.cgi?id=211498 <rdar://problem/56675345> Reviewed by Darin Adler. Add a new header to allow Cocoa code to reason about UIColors and NSColors on iOS and macOS (respectively) without requiring platform ifdefs. A followup patch will adopt this in several places in WebKit, where we currently need ifdefs for iOS and macOS. * Platform/cocoa/CocoaColor.h: Added. * WebKit.xcodeproj/project.pbxproj: 2020-05-06 Antoine Quint <graouts@apple.com> pointermove event sometimes has incorrect pointerType of 'mouse' on touch interactions https://bugs.webkit.org/show_bug.cgi?id=210716 <rdar://problem/62084817> Reviewed by Darin Adler. Set the SyntheticClickType to OneFingerTap when creating a synthetic "mousemove" event for a synthetic "click" event as part of a tap. On top of being more indicative of the actual action that triggered the synthetic event, it also has the added quality that it will not yield a "pointermove" event. Test: pointerevents/ios/click-no-pointermove.html * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::dispatchSyntheticMouseMove): 2020-05-06 John Wilander <wilander@apple.com> Exempt app-bound domains from ITP's website data deletion and third-party cookie blocking between themselves https://bugs.webkit.org/show_bug.cgi?id=210674 <rdar://problem/61950767> Reviewed by Chris Dumez. This change forwards information about app-bound domains to ITP and web processes so that they can be exempt from website data deletion and third-party cookie blocking between themselves. App-bound domains are configured statically and apply to all website data stores. Therefore the setting needs to be forwarded to all website data stores and ITP functionality in all network and web content processes. This is done through the new static function WebsiteDataStore::setAppBoundDomainsForITPIfInitialized(). Since app-bound domains are loaded lazily from disk and on a background thread, this patch forwards them in ResourceLoadStatisticsParameters if they've already been loaded. Then every time app-bound domains are updated, they are forwarded to ITP. This ensures that ITP will have them as soon as possible. Setting app-bound domains for the purposes of ITP automatically switches ITP's cookie blocking policy to the new WebCore::ThirdPartyCookieBlockingMode::AllExceptBetweenAppBoundDomains. This is done in WebResourceLoadStatisticsStore::setAppBoundDomains(). The C API changes are for test purposes. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::setAppBoundDomains): (WebKit::ResourceLoadStatisticsStore::resetParametersToDefaultValues): (WebKit::ResourceLoadStatisticsStore::shouldExemptFromWebsiteDataDeletion const): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: (WebKit::ResourceLoadStatisticsStore::standaloneApplicationDomain const): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setAppBoundDomains): (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setAppBoundDomainsForResourceLoadStatistics): (WebKit::NetworkProcess::setThirdPartyCookieBlockingMode): (WebKit::NetworkProcess::setShouldBlockThirdPartyCookiesForTesting): Deleted. Renamed setThirdPartyCookieBlockingMode. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Shared/ResourceLoadStatisticsParameters.h: (WebKit::ResourceLoadStatisticsParameters::encode const): (WebKit::ResourceLoadStatisticsParameters::decode): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetAppBoundDomainsForTesting): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setAppBoundDomainsForResourceLoadStatistics): (WebKit::NetworkProcessProxy::setThirdPartyCookieBlockingMode): (WebKit::NetworkProcessProxy::setShouldBlockThirdPartyCookiesForTesting): Deleted. Renamed setThirdPartyCookieBlockingMode. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setThirdPartyCookieBlockingMode): (WebKit::WebProcessProxy::setShouldBlockThirdPartyCookiesForTesting): Deleted. Renamed setThirdPartyCookieBlockingMode. * UIProcess/WebProcessProxy.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::initializeAppBoundDomains): (WebKit::WebsiteDataStore::ensureAppBoundDomains const): (WebKit::WebsiteDataStore::appBoundDomainsIfInitialized): This function allows fetching of app-bound domains without triggering the lazy loading. This is just to allow speculative configuration of ITP right when it's created — if any app-bound domains are already configured, forward them to ITP via ResourceLoadStatisticsParameters. (WebKit::WebsiteDataStore::setAppBoundDomainsForTesting): This function is Cocoa-specific and only accepts localhost and 127.0.0.1 to be configured as app-bound domains. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting): (WebKit::WebsiteDataStore::setThirdPartyCookieBlockingMode): (WebKit::WebsiteDataStore::parameters): (WebKit::WebsiteDataStore::forwardAppBoundDomainsToITPIfInitialized): (WebKit::WebsiteDataStore::setAppBoundDomainsForITP): * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setThirdPartyCookieBlockingMode): (WebKit::WebProcess::setShouldBlockThirdPartyCookiesForTesting): Deleted. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2020-05-06 Daniel Bates <dabates@apple.com> [iOS] ASSERTION FAILED: !(_keyboardFlags & WebEventKeyboardInputModifierFlagsChanged) in -[WebEvent charactersIgnoringModifiers] when pressing modifier on PDF https://bugs.webkit.org/show_bug.cgi?id=211472 Reviewed by Darin Adler. Do not ask for event character string for a flags changed event: they don't have one. Test: fast/events/ios/pdf-modifer-key-down-crash.html * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]): 2020-05-06 Brent Fulgham <bfulgham@apple.com> [MacCatalyst] Processes should check for network entitlement as we do for macOS apps https://bugs.webkit.org/show_bug.cgi?id=211474 <rdar://problem/61182060> Reviewed by Alexey Proskuryakov. We should make the same entitlement checks in MacCatalyst as we do for macOS. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::checkEntitlements): 2020-05-06 Darin Adler <darin@apple.com> Eliminate checks of USE(DICTATION_ALTERNATIVES) in Cocoa-specific code https://bugs.webkit.org/show_bug.cgi?id=211460 Reviewed by Anders Carlsson. * UIProcess/Cocoa/PageClientImplCocoa.h: Remove USE(DICTATION_ALTERNATIVES). Also remove unnecessary use of RetainPtr. * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::PageClientImplCocoa): Ditto. (WebKit::PageClientImplCocoa::pageClosed): Ditto. (WebKit::PageClientImplCocoa::dictationAlternatives): Ditto. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::insertDictatedTextAsync): Ditto. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::validAttributesForMarkedText): Ditto. (WebKit::WebViewImpl::insertText): Ditto. * UIProcess/PageClient.h: Ditto. * UIProcess/ios/PageClientImplIOS.h: Ditto. * UIProcess/ios/PageClientImplIOS.mm: Ditto. * UIProcess/ios/WKContentViewInteraction.mm: Ditto. * UIProcess/mac/PageClientImplMac.h: Ditto. * UIProcess/mac/PageClientImplMac.mm: Ditto. * WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp: Ditto. 2020-05-06 Lauro Moura <lmoura@igalia.com> [GTK] Cleanup KeyBindingTranslator on WebView disposal https://bugs.webkit.org/show_bug.cgi?id=211465 Reviewed by Carlos Garcia Campos. Fixes assertion in debug mode when a test failed and the widget followed a destruction pattern where KeyBindingTranslator would be destroyed before the container widget is cleaned up. Also renamed the method from 'destroyed' to 'invalidate' to try to better convey the action being performed on the KeyBindingTranslator. Covered by existing tests. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseContainerRemove): Update method name. (webkitWebViewBaseDispose): Cleanup keyBindingTranslator when disposing this widget. * UIProcess/gtk/KeyBindingTranslator.h: (WebKit::KeyBindingTranslator::invalidate): Renamed from destroyed. (WebKit::KeyBindingTranslator::destroyed): Deleted. 2020-05-06 Darin Adler <darin@apple.com> Reduce HAVE(HOSTED_CORE_ANIMATION) https://bugs.webkit.org/show_bug.cgi?id=211423 Reviewed by Anders Carlsson. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Removed redundant #if checking both HAVE(HOSTED_CORE_ANIMATION) and !PLATFORM(IOS_FAMILY). * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::platformInitializePluginProcess): Removed unnecessary HAVE(HOSTED_CORE_ANIMATION) check in code that is only compiled for macOS. 2020-05-05 David Kilzer <ddkilzer@apple.com> Fix deprecated NSGraphicsContext methods using 'graphicsPort' <https://webkit.org/b/211481> Reviewed by Darin Adler. - Replace uses of -graphicsPort with -CGContext. - Replace uses of -graphicsContextWithGraphicsPort:flipped: with -graphicsContextWithCGContext:flipped:. - Remove ALLOW_DEPRECATED_DECLARATIONS_{BEGIN,END} if possible. * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _drawPDFDocument:page:atPoint:]): (-[WKPrintingView _drawPreview:]): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::drawPDFPage): 2020-05-05 Zalan Bujtas <zalan@apple.com> [Quirk] Job listing page goes blank when scrolling on stackoverflow.com https://bugs.webkit.org/show_bug.cgi?id=211480 <rdar://problem/62558405> Reviewed by Wenson Hsieh. Add the option of returning "use desktop web content" on any configuration when the host application asks for content recommendation. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommendedForRequest): (WebKit::desktopClassBrowsingRecommended): (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies): 2020-05-05 Chris Dumez <cdumez@apple.com> Crash under _LSSetApplicationInformationItem() https://bugs.webkit.org/show_bug.cgi?id=211478 <rdar://problem/62201314> Reviewed by Alex Christensen. Given the crashes, I suspect it is not actually safe to call _LSSetApplicationInformationItem() from a non main-thread like it was done in r238289. We still run the code asynchronously to address the issue that r238289 was trying to fix but we now call _LSSetApplicationInformationItem() on the main thread. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateActivePages): (WebKit::setProcessNameQueue): Deleted. 2020-05-05 Peng Liu <peng.liu6@apple.com> Update WebKitTestRunner to support running multiple video fullscreen and Picture-in-Picture tests simultaneously https://bugs.webkit.org/show_bug.cgi?id=203723 Reviewed by Jer Noble. When the flag MockVideoPresentationModeEnabled is true, the VideoFullscreenManagerProxy in the UI process will mock the behavior of the VideoFullscreenInterface[Mac|AVKit]. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: (WebKit::VideoFullscreenManagerProxy::setMockVideoPresentationModeEnabled): * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen): (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive): (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): (WebKit::VideoFullscreenManagerProxy::setHasVideo): (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): (WebKit::VideoFullscreenManagerProxy::enterFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): (WebKit::VideoFullscreenManagerProxy::setInlineRect): (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::setMockVideoPresentationModeEnabled): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockVideoPresentationModeEnabled): (WebKit::WebChromeClient::setUpPlaybackControlsManager): (WebKit::WebChromeClient::clearPlaybackControlsManager): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/cocoa/VideoFullscreenManager.h: 2020-05-05 Per Arne Vollan <pvollan@apple.com> Unreviewed fix for MotionMark regression. Revert minor part of r260017. Remove telemetry from IOKit filtering allow rules. This telemetry is causing higher CPU usage on the system, and is not needed, since we have already confirmed these messages are being used. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-05-05 Daniel Bates <dabates@apple.com> Should show selection highlight during text interaction https://bugs.webkit.org/show_bug.cgi?id=211362 <rdar://problem/59191873> Reviewed by Wenson Hsieh. Break out text interaction tracking into its own ivar instead of using the WebKit::InteractionIsHappening selection suppression reason so that I can key off it to only disallow zooming to reveal the focused element during a text interaction. The selection suppression machinery does more than this. It also deactivates selection assistance, painting of highlights, etc, which I don't want. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): Reset state. (-[WKContentView becomeFirstResponderForWebView]): Activate selection assistant during a text interaction if the selection assistant is not being suppressed. (-[WKContentView _zoomToRevealFocusedElement]): Early return if called during a text interaction. The function -_didFinishTextInteractionInTextInputContext will trigger the zoom after the interaction completes. (-[WKContentView _didCommitLoadForMainFrame]): Reset state. (-[WKContentView _willBeginTextInteractionInTextInputContext:]): (-[WKContentView _didFinishTextInteractionInTextInputContext:]): Update state. While I am here, text interaction is considered a gesture so also update _usingGestureForSelection. This means that the selection view will be updated immediately on a selection change during a text interaction instead of waiting until the next layer tree commit occurs. 2020-05-05 Kate Cheney <katherine_cheney@apple.com> Check for app-bound domains should confirm WKAppBoundDomains key exists when checking for default app-bound protocols. https://bugs.webkit.org/show_bug.cgi?id=211451 <rdar://problem/62715316 Reviewed by Brent Fulgham. Checks for WKAppBoundDomains key before treating a protocol as app-bound. This is a regression in expected behavior after making In-App Browser privacy opt-in based on the presence of the key. Also moves the check for special protocols inside of the completion handler for ensureAppBoundDomains to make sure the check for the key has finished. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::beginAppBoundDomainCheck): Added a comment to clarify why we need to check for both an empty app-bound domains list and the presence of the key for testing purposes. 2020-05-05 Timothy Horton <timothy_horton@apple.com> "Essential Skeleton" does not respond to mouse events, only touch events https://bugs.webkit.org/show_bug.cgi?id=211439 <rdar://problem/62694519> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shouldUseMouseGestureRecognizer]): Add a quirk. 2020-05-05 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> Compile GPUProcess in WPE port as experimental feature https://bugs.webkit.org/show_bug.cgi?id=211442 Reviewed by Don Olmstead. Enable GPU Process in WPE. This is compilation only. No new tests required. * PlatformWPE.cmake: Add Platform/generic include directory. * SourcesWPE.txt: Add related source files. 2020-05-05 Youenn Fablet <youenn@apple.com> Remove LegacySchemeRegistry::canServiceWorkersHandleURLScheme https://bugs.webkit.org/show_bug.cgi?id=211170 Reviewed by Alex Christensen. Remove unused parameters since they are no longer being set in UIProcess. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): * NetworkProcess/NetworkProcessCreationParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2020-05-05 Darin Adler <darin@apple.com> Remove now-uneeded HAVE macros related to PDF https://bugs.webkit.org/show_bug.cgi?id=211435 Reviewed by Anders Carlsson. * Platform/spi/ios/PDFKitSPI.h: Removed HAVE(PDFHOSTVIEWCONTROLLER_SNAPSHOTTING). * UIProcess/ios/WKPDFView.mm: (-[WKPDFView web_initWithFrame:webView:mimeType:]): Removed HAVE(PDF_HOST_VIEW_CONTROLLER_WITH_BACKGROUND_COLOR). (+[WKPDFView web_requiresCustomSnapshotting]): Removed HAVE(PDFHOSTVIEWCONTROLLER_SNAPSHOTTING). (-[WKPDFView web_snapshotRectInContentViewCoordinates:snapshotWidth:completionHandler:]): Ditto. 2020-05-05 Youenn Fablet <youenn@apple.com> Receiving WebRTC network packets should not go through the main thread https://bugs.webkit.org/show_bug.cgi?id=211290 Reviewed by Alex Christensen. Instead of going to main thread before going to rtc network thread, we register a message receiver and dispatch directly to rtc network thread. This ensures rtc packets are not blocked if main thread is busy. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createSocket): (WebKit::NetworkRTCProvider::createServerTCPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): (WebKit::NetworkRTCProvider::newConnection): (WebKit::NetworkRTCProvider::closeListeningSockets): * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::NetworkProcessConnection): (WebKit::NetworkProcessConnection::didReceiveMessage): * WebProcess/Network/webrtc/LibWebRTCNetwork.cpp: Added * WebProcess/Network/webrtc/LibWebRTCNetwork.h: (WebKit::LibWebRTCNetwork::connection): (WebKit::LibWebRTCNetwork::~LibWebRTCNetwork): (WebKit::LibWebRTCNetwork::networkProcessCrashed): (WebKit::LibWebRTCNetwork::setConnection): (WebKit::LibWebRTCNetwork::dispatchToThread): (WebKit::LibWebRTCNetwork::signalAddressReady): (WebKit::LibWebRTCNetwork::signalReadPacket): (WebKit::LibWebRTCNetwork::signalSentPacket): (WebKit::LibWebRTCNetwork::signalConnect): (WebKit::LibWebRTCNetwork::signalClose): (WebKit::LibWebRTCNetwork::signalNewConnection): * WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in: Added. * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: * WebProcess/Network/webrtc/WebRTCSocket.cpp: Removed. * WebProcess/Network/webrtc/WebRTCSocket.h: Removed. 2020-05-05 Tim Horton <timothy_horton@apple.com> Excessive error logging from daemons trying to use WebKit, under -[UIDevice currentDevice] https://bugs.webkit.org/show_bug.cgi?id=211397 <rdar://problem/61635403> Reviewed by Simon Fraser. * Shared/UserInterfaceIdiom.mm: (WebKit::userInterfaceIdiomIsPad): Adjust userInterfaceIdiomIsPad so that in daemons, it consults only MobileGestalt, which returns the actual hardware model, and does not try to use UIDevice. UIDevice is more accurate for applications because it will report that the device is an iPhone when called inside an iPhone app running on iPad, but it cannot be used in daemons that do not have a UIApplication. For the behaviors we gate on this bit, it makes sense to use iPhone behaviors on iPad in the iPhone app jail, so we continue using UIDevice if possible. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): Make use of the new mechanism instead of going straight to MobileGestalt, for the aforementioned reasons. 2020-05-04 Tim Horton <timothy_horton@apple.com> Relax WKRemoteObjectRegistry signature validation for bool-equivalent types https://bugs.webkit.org/show_bug.cgi?id=211419 Reviewed by Saam Barati. * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm: (blockSignaturesAreCompatible): (replyBlockSignature): (-[_WKRemoteObjectRegistry _invokeMethod:]): (validateReplyBlockSignature): Deleted. Relax reply block signature validation slightly, considering signed char and BOOL, which are equivalent and sometimes substituted for each other, to be equal. This is still stricter than NSXPC's validation, but this is one of the exceptions that they make. 2020-05-04 Darin Adler <darin@apple.com> [Mac] Remove __MAC_OS_X_VERSION_MIN_REQUIRED checks for versions older than 10.14 https://bugs.webkit.org/show_bug.cgi?id=211420 Reviewed by Alex Christensen. * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): Remove __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Ditto. * PluginProcess/mac/PluginProcessMac.mm: (WebKit::PluginProcess::platformInitializePluginProcess): Ditto. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): Ditto. * UIProcess/mac/ServicesController.mm: (WebKit::hasCompatibleServicesForItems): Ditto. * UIProcess/mac/WebProcessProxyMac.mm: (WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Ditto. 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(SANDBOX_ISSUE_MACH/READ_EXTENSION_TO_PROCESS_BY_AUDIT_TOKEN) https://bugs.webkit.org/show_bug.cgi?id=211427 Reviewed by Alex Christensen. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::sandboxExtensionForType): Remove #if HAVE. 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(AUTHORIZATION_STATUS_FOR_MEDIA_TYPE) https://bugs.webkit.org/show_bug.cgi?id=211426 Reviewed by Alex Christensen. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Remove HAVE(AUTHORIZATION_STATUS_FOR_MEDIA_TYPE). 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(ACCESSIBILITY_SUPPORT) https://bugs.webkit.org/show_bug.cgi?id=211425 Reviewed by Alex Christensen. * Platform/spi/Cocoa/AccessibilitySupportSPI.h: Remove HAVE(ACCESSIBILITY_SUPPORT) and now-unnecessary C include guards. 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(SEC_TRUST_EVALUATE_WITH_ERROR) https://bugs.webkit.org/show_bug.cgi?id=211429 Reviewed by Alex Christensen. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _EVOrganizationName]): Remove HAVE(SEC_TRUST_EVALUATE_WITH_ERROR). 2020-05-04 Kate Cheney <katherine_cheney@apple.com> REGRESSION (r260791?): Assert not reached in ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary() and ResourceLoadStatisticsDatabaseStore::addMissingTablesIfNecessary() https://bugs.webkit.org/show_bug.cgi?id=211305 <rdar://problem/62737871> Reviewed by Alex Christensen. This patch adds a busy timeout for the ITP database to allow for some concurrency flexibility when running many WebKitTestRunner tests, which recreate the ITP database store very often to test both the memory and database stores. With the timeout, an attempt to write to the database when another thread is holding the lock will keep attempting to insert for 5 seconds as long as the statement execution returns SQLITE_BUSY. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase): 2020-05-04 Alex Christensen <achristensen@webkit.org> TestWebKitAPI.WebKit.CustomDisplayName is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=211299 Reviewed by Chris Dumez. Use a serial queue instead of a concurrent queue to set the web process's display name to prevent race conditions. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::setProcessNameQueue): (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateActivePages): 2020-05-04 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Header bars no longer have title and subtitle properties https://bugs.webkit.org/show_bug.cgi?id=211412 Reviewed by Carlos Garcia Campos. No new tests needed. * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp: For GTK4 use a vertical box as title widget, with two labels acting as title and subtitle. (webkit_inspector_window_init): (webkitInspectorWindowSetSubtitle): 2020-05-04 Chris Dumez <cdumez@apple.com> [iOS] Make sure TestController::statisticsResetToConsistentState() does not hang due to process suspension https://bugs.webkit.org/show_bug.cgi?id=211421 Reviewed by Maciej Stachowiak. We have evidence of hangs in TestController::statisticsResetToConsistentState() on iOS and we suspect it is due to process suspension. To address the issue, this patch updates the IPCs being sent as a result of a call to statisticsResetToConsistentState() to take a background assertion while waiting for the IPC response. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setUseITPDatabase): (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources): (WebKit::NetworkProcessProxy::resetParametersToDefaultValues): (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent): (WebKit::NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting): (WebKit::NetworkProcessProxy::setShouldDowngradeReferrerForTesting): (WebKit::NetworkProcessProxy::setShouldBlockThirdPartyCookiesForTesting): (WebKit::NetworkProcessProxy::setShouldEnbleSameSiteStrictEnforcementForTesting): (WebKit::NetworkProcessProxy::setFirstPartyWebsiteDataRemovalModeForTesting): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setShouldBlockThirdPartyCookiesForTesting): 2020-05-04 Wenson Hsieh <wenson_hsieh@apple.com> Tapping to focus editable elements should start caret selection at word boundary https://bugs.webkit.org/show_bug.cgi?id=211409 <rdar://problem/62869098> Reviewed by Megan Gardner. See WebCore/ChangeLog for more details. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::selectWithGesture): Rewrite this using the new VisibleUnits helper function, `wordBoundaryForPositionWithoutCrossingLine`. 2020-05-04 Darin Adler <darin@apple.com> Make __IPHONE_OS_VERSION_MIN_REQUIRED checks against old versions explicit about watchOS and tvOS https://bugs.webkit.org/show_bug.cgi?id=211402 Reviewed by Alexey Proskuryakov. * NetworkProcess/NetworkActivityTracker.h: Move from __IPHONE_OS_VERSION_MIN_REQUIRED to !PLATFORM(APPLETV). There was already an explicit watchOS case here. * Platform/spi/ios/UIKitSPI.h: Move from __IPHONE_OS_VERSION_MIN_REQUIRED to PLATFORM(IOS) in one place, and in the other removed the conditional entirely. THe one place here that does PLATFORM(IOS) is for a property that is not on watchOS and tvOS at this time, related to dragging. Decided not to add a comment about it. * Shared/WebPreferencesDefaultValues.h: Move from __IPHONE_OS_VERSION_MIN_REQUIRED to !PLATFORM(APPLETV). There was already an explicit watchOS case here. * UIProcess/API/ios/WKWebViewIOS.mm: (contentOffsetBoundedInValidRange): Move from __IPHONE_OS_VERSION_MIN_REQUIRED to !PLATFORM(WATCHOS) && !PLATFORM(APPLETV). (-[WKWebView activeViewLayoutSize:]): Ditto. (-[WKWebView _updateScrollViewInsetAdjustmentBehavior]): Ditto. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (-[WKChildScrollView initWithFrame:]): Ditto. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]): Ditto. (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]): Ditto. * UIProcess/ios/WKScrollView.h: Ditto. * UIProcess/ios/WKScrollView.mm: (-[WKScrollView initWithFrame:]): Ditto. 2020-05-04 Peng Liu <peng.liu6@apple.com> Fix the mistake on macro HAVE_SYSTEM_FEATURE_FLAGS https://bugs.webkit.org/show_bug.cgi?id=211416 Reviewed by Tim Horton. We should use "#if HAVE(SYSTEM_FEATURE_FLAGS)" instead of "#if HAVE(HAVE_SYSTEM_FEATURE_FLAGS)". And we have to use the function _os_feature_enabled_impl() instead of the macro os_feature_enabled() because WebKit is a namespace and cannot be used in os_feature_enabled(). * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled): (WebKit::defaultUseGPUProcessForMedia): (WebKit::defaultRenderCanvasInGPUProcessEnabled): (WebKit::defaultCaptureAudioInGPUProcessEnabled): (WebKit::defaultCaptureVideoInGPUProcessEnabled): (WebKit::defaultWebRTCCodecsInGPUProcess): (WebKit::defaultWebGL2Enabled): (WebKit::defaultWebGPUEnabled): (WebKit::defaultInAppBrowserPrivacy): (WebKit::defaultIncrementalPDFEnabled): (WebKit::defaultWebXREnabled): 2020-05-04 Brent Fulgham <bfulgham@apple.com> [macOS] Eliminate SecurityServer and OCSPD from the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=211417 <rdar://problem/46235370> Reviewed by Per Arne Vollan. We can now re-block access to these services. * WebProcess/com.apple.WebProcess.sb.in: 2020-05-04 Timothy Horton <timothy_horton@apple.com> Unreviewed, reverting r261117. Broke lots of API tests Reverted changeset: "Excessive error logging from daemons trying to use WebKit, under -[UIDevice currentDevice]" https://bugs.webkit.org/show_bug.cgi?id=211397 https://trac.webkit.org/changeset/261117 2020-05-04 Darin Adler <darin@apple.com> [Cocoa] Remove a few unneeded __IPHONE_OS_VERSION_MIN_REQUIRED checks https://bugs.webkit.org/show_bug.cgi?id=211383 Reviewed by Alexey Proskuryakov. * UIProcess/ios/forms/WKAirPlayRoutePicker.h: Removed a check against iOS 11, in code that already explicitly checks for watchOS and tvOS. 2020-05-04 Darin Adler <darin@apple.com> Remove HAVE(IOSURFACE) checks in Cocoa-platform-specific code https://bugs.webkit.org/show_bug.cgi?id=211389 Reviewed by Alexey Proskuryakov. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::encodeFrame): Remove HAVE(IOSURFACE) since this is Cocoa-specific code. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::ensureBackingStore): Ditto. (WebKit::RemoteLayerBackingStore::clearBackingStore): Ditto. (WebKit::RemoteLayerBackingStore::encode const): Ditto. (WebKit::RemoteLayerBackingStore::decode): Ditto. (WebKit::RemoteLayerBackingStore::bytesPerPixel const): Ditto. (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): Ditto. (WebKit::RemoteLayerBackingStore::display): Ditto. (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): Ditto. (WebKit::RemoteLayerBackingStore::setBufferVolatility): Ditto. (WebKit::RemoteLayerBackingStore::Buffer::discard): Ditto. (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): Ditto. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _takeViewSnapshot]): Ditto. (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): Ditto. * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: Ditto. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): Ditto. * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: (WebKit::recursivelyMapIOSurfaceBackingStore): Ditto. (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore): Ditto. * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: Ditto. * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: Ditto. * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::sampleBufferUpdated): Ditto. * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: (WebKit::LibWebRTCProvider::createDecoderFactory): Ditto. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Ditto. (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable): Ditto. 2020-05-04 David Kilzer <ddkilzer@apple.com> Use default constructor and default initializer for SecItemRequestData <https://webkit.org/b/211399> <rdar://problem/62861551> Reviewed by Darin Adler. * Shared/mac/SecItemRequestData.cpp: - Remove default constructor implementation. * Shared/mac/SecItemRequestData.h: - Use default constructor for class. - Use default initializer for m_type. 2020-05-04 Brent Fulgham <bfulgham@apple.com> REGRESSION (r259470): Accessibility Stereo to Mono is not working https://bugs.webkit.org/show_bug.cgi?id=211408 <rdar://problem/62847299> Reviewed by Per Arne Vollan. The changes in r259470 regressed our Accessibility features. We need to do a rollout of that change to restore proper behavior. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-05-04 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Implement +[_WKWebAuthenticationPanel clearAllLocalAuthenticatorCredentials] https://bugs.webkit.org/show_bug.cgi?id=211369 <rdar://problem/60246635> Reviewed by Brent Fulgham. Adds a new SPI for UI clients to clear all existing credentials from the keychain. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (+[_WKWebAuthenticationPanel clearAllLocalAuthenticatorCredentials]): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::clearAllCredentials): * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::createCredentialPrivateKey const): 2020-05-04 Tim Horton <timothy_horton@apple.com> Excessive error logging from daemons trying to use WebKit, under -[UIDevice currentDevice] https://bugs.webkit.org/show_bug.cgi?id=211397 <rdar://problem/61635403> Reviewed by Simon Fraser. * Shared/UserInterfaceIdiom.mm: (WebKit::userInterfaceIdiomIsPad): Adjust userInterfaceIdiomIsPad so that in daemons, it consults only MobileGestalt, which returns the actual hardware model, and does not try to use UIDevice. UIDevice is more accurate for applications because it will report that the device is an iPhone when called inside an iPhone app running on iPad, but it cannot be used in daemons that do not have a UIApplication. For the behaviors we gate on this bit, it makes sense to use iPhone behaviors on iPad in the iPhone app jail, so we continue using UIDevice if possible. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): Make use of the new mechanism instead of going straight to MobileGestalt, for the aforementioned reasons. 2020-05-04 Chris Dumez <cdumez@apple.com> Stop hard-coding get-task-allow entitlement for simulator builds https://bugs.webkit.org/show_bug.cgi?id=211392 Reviewed by Geoffrey Garen. Stop hard-coding get-task-allow entitlement for simulator builds and let Xcode inject it as needed. * Configurations/BaseXPCService.xcconfig: * Resources/ios/XPCService-embedded-simulator.entitlements: 2020-05-04 Brent Fulgham <bfulgham@apple.com> REGRESSION (JazzkonE): ResourceLoadStatisticsDatabaseStore checks 'hasHadUserInteraction' without ensuring the domain has been added to the ITP database (211388) https://bugs.webkit.org/show_bug.cgi?id=211388 <rdar://problem/62849919> Reviewed by John Wilander. A spurious log entry is created if we check 'hasHadUserInteraction' before inserting a row for the domain being checked (if that domain had not previosly been observed). This patch changes the order of the two commands to avoid this possibility. This makes the database implementation behave like the in-memory version. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction): 2020-05-04 Alex Christensen <achristensen@webkit.org> Reduce AlternativeService assertion to debug-only assert https://bugs.webkit.org/show_bug.cgi?id=211263 <rdar://problem/61354813> Reviewed by Chris Dumez. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): This is asserting sometimes. No need to crash. Reduce to debug-only assert. 2020-05-04 Said Abou-Hallawa <sabouhallawa@apple.com> Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler https://bugs.webkit.org/show_bug.cgi?id=204713 Reviewed by Simon Fraser. Create an IPC message on the DrawingArea to send a message from the WebProcess to the UIProcess to setPreferredFramesPerSecond of the DisplayRefreshMonitor. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (-[WKOneShotDisplayLinkHandler setPreferredFramesPerSecond:]): (WebKit::RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond): Set the preferredFramesPerSecond of the CADisplayLink. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: (WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond): Forward the call to RemoteLayerTreeDrawingArea. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond): Send the IPC message from the WebProcess to the UIProcess. 2020-05-04 Alex Christensen <achristensen@webkit.org> TestWebKitAPI.WebKit.CustomDisplayName is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=211299 Reviewed by Chris Dumez. Sometimes the task queued in WebProcess::updateProcessName happens after the one in WebProcess::updateActivePages. Schedule them on the same queue so they happen in deterministic order so we get reliable process names eventually. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateActivePages): 2020-05-04 Brent Fulgham <bfulgham@apple.com> Remove unneeded check for Apple Media Services https://bugs.webkit.org/show_bug.cgi?id=211391 <rdar://problem/62853199> Reviewed by Per Arne Vollan. Earlier in the development cycle we added an entitlement check for AppleMediaServices, that we now realize we do not need. Since this is a non-zero performance cost, remove this check. * UIProcess/WebPageProxy.cpp: 2020-05-04 Devin Rousso <drousso@apple.com> Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode https://bugs.webkit.org/show_bug.cgi?id=209763 Reviewed by Brian Burg. Generalize the `setMockCaptureDevicesEnabledOverride` to be `setDeveloperPreferenceOverride` that uses an enum `WebCore::InspectorClient::DeveloperPreference` to know what to do. Communicate with the NetworkProcess (from the WebProcess via the UIProcess) in the case of: - `AdClickAttributionDebugModeEnabled` - `ITPDebugModeEnabled` * WebProcess/Inspector/WebInspectorClient.h: * WebProcess/Inspector/WebInspectorClient.cpp: (WebKit::WebInspectorClient::setDeveloperPreferenceOverride): Added. (WebKit::WebInspectorClient::setMockCaptureDevicesEnabledOverride): Deleted. * WebProcess/Inspector/WebInspector.h: * WebProcess/Inspector/WebInspector.cpp: (WebKit::WebInspector::setDeveloperPreferenceOverride): Added. (WebKit::WebInspector::setMockCaptureDevicesEnabledOverride): Deleted. * UIProcess/Inspector/WebInspectorProxy.messages.in: * UIProcess/Inspector/WebInspectorProxy.h: * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::setDeveloperPreferenceOverride): Added. (WebKit::WebInspectorProxy::setMockCaptureDevicesEnabledOverride): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): Added. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setAdClickAttributionDebugMode): Added. * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setAdClickAttributionDebugMode): Added. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode): 2020-05-04 Chris Dumez <cdumez@apple.com> [iOS] Unable to take RunningBoard process assertions in the iOS Simulator https://bugs.webkit.org/show_bug.cgi?id=211254 <rdar://problem/62674074> Reviewed by Geoffrey Garen. Add com.apple.runningboard.assertions.webkit entitlement to iOS Simulator builds so that we can take RunningBoard assertions on those platforms too. While doing this, I found that we were not adding the entitlements properly for simulator builds. For simulator builds, entitlements go into an __entitlements section of the binary, rather than in the signature. Use CODE_SIGN_ENTITLEMENTS directive in xcconfig so that XCode does the right thing for simulator builds. * Configurations/BaseXPCService.xcconfig: * Resources/ios/XPCService-embedded-simulator.entitlements: Added. * Scripts/process-entitlements.sh: 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneded HAVE(WINDOW_SERVER_OCCLUSION_NOTIFICATIONS) https://bugs.webkit.org/show_bug.cgi?id=211380 Reviewed by Sam Weinig. * UIProcess/mac/WindowServerConnection.h: Don't check HAVE(WINDOW_SERVER_OCCLUSION_NOTIFICATIONS) in this Mac-only header. Also removed #pragma once in this header that is only included from .mm files. * UIProcess/mac/WindowServerConnection.mm: Wrapped the whole file in PLATFORM(MAC) because this is macOS-specific code that may be compiled on iOS family platforms. Could wrap it in HAVE(WINDOW_SERVER) instead, but we don't have anything like that and PageClientImplMac.mm, the client of this code, uses PLATFORM(MAC). (WebKit::registerOcclusionNotificationHandler): Ditto. (WebKit::WindowServerConnection::WindowServerConnection): Ditto. 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(UI_REMOTE_VIEW) https://bugs.webkit.org/show_bug.cgi?id=211382 Reviewed by Alex Christensen. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: (WebKit::createRemoteView): Deleted. (WebKit::RemoteLayerTreeHost::makeNode): After researching to be sure the method is present in the relevant versions of iOS 13, changed this code to use the initWithFrame:pid:contextID: method without doing a selector check, and also without a HAVE(UI_REMOTE_VIEW) conditional. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: Removed the HAVE(UI_REMOTE_VIEW) conditional. 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(MENU_CONTROLLER_SHOW_HIDE_API) https://bugs.webkit.org/show_bug.cgi?id=211381 Reviewed by Alex Christensen. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _handleDOMPasteRequestWithResult:]): Use hideMenuFromView: directly. (-[WKContentView _requestDOMPasteAccessWithElementRect:originIdentifier:completionHandler:]): Use showMenuFromView: directly. (-[WKContentView showGlobalMenuControllerInRect:]): Deleted. (-[WKContentView hideGlobalMenuController]): Deleted. 2020-05-04 Darin Adler <darin@apple.com> Remove now-unneeded HAVE(VOUCHERS) https://bugs.webkit.org/show_bug.cgi?id=211379 Reviewed by Alex Christensen. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): Remove HAVE(VOUCHERS) checks from this Cocoa-only source file. 2020-05-04 Alex Christensen <achristensen@webkit.org> TestWebKitAPI.WebKit.CustomDisplayName is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=211299 Reviewed by Darin Adler. The application name is being set on a background queue, but there's nothing actually keeping the NSString alive. This may fix some timeouts we were seeing. I wonder why ASAN or guard malloc didn't catch this yet. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): 2020-05-04 Darin Adler <darin@apple.com> Remove no-longer-needed HAVE(UISCENE) https://bugs.webkit.org/show_bug.cgi?id=211376 Reviewed by Chris Dumez. * Platform/spi/ios/UIKitSPI.h: Don't check HAVE(UISCENE) any more in this iOS-family-only source file; it's always true. * UIProcess/ApplicationStateTracker.h: Ditto. * UIProcess/ApplicationStateTracker.mm: (WebKit::ApplicationStateTracker::ApplicationStateTracker): Ditto. (WebKit::ApplicationStateTracker::~ApplicationStateTracker): Ditto. * UIProcess/ios/WKContentView.mm: (-[WKContentView interfaceOrientation]): Ditto. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textEffectsWindow]): Ditto. 2020-05-04 Yusuke Suzuki <ysuzuki@apple.com> Unreviewed, speculative build fix for r261071 https://bugs.webkit.org/show_bug.cgi?id=211274 * UIProcess/Cocoa/WebPageProxyCocoa.mm: 2020-05-04 Emilio Cobos Álvarez <emilio@crisal.io> Put lh / rlh units behind a flag until bug 211351 is sorted out. https://bugs.webkit.org/show_bug.cgi?id=211356 Reviewed by Antti Koivisto. * Shared/WebPreferences.yaml: Define the runtime flag. 2020-05-03 David Kilzer <ddkilzer@apple.com> Use LocalCurrentGraphicsContext in WebKit::convertPlatformImageToBitmap() <https://webkit.org/b/211274> Reviewed by Darin Adler. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::convertPlatformImageToBitmap): - Use LocalCurrentGraphicsContext to replace code. 2020-05-03 David Kilzer <ddkilzer@apple.com> Use default initializers and default constructors in WebEvent.h <https://webkit.org/b/211354> Reviewed by Daniel Bates. * Shared/WebEvent.h: (WebKit::WebWheelEvent): (WebKit::WebKeyboardEvent): (WebKit::WebPlatformTouchPoint): (WebKit::WebTouchEvent): - Change empty constructors to use `default`. - Use default initializers to make sure all fields are initialized. 2020-05-02 Simon Fraser <simon.fraser@apple.com> handleWheelEventPhase() should include the relevant ScrollingNodeID https://bugs.webkit.org/show_bug.cgi?id=211315 Reviewed by Tim Horton. handleWheelEventPhase() is used to send information about wheel event phases to the main thread, which make their way to ScrollAnimatorMac::handleWheelEventPhase() and are used to update the state of overlay scrollbars. In order to talk to the correct set of scrollbars with overflow:scroll, we need to send along the ScrollingNodeID and map that to the appropriate ScrollableArea. Will be tested by future overlay scrollbar tests. * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::handleWheelEventPhase): * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: 2020-05-02 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Re-inject key press events not handled by the web process https://bugs.webkit.org/show_bug.cgi?id=211286 Reviewed by Adrian Perez de Castro. Use gdk_display_put_event() since gtk_main_do_event() is no longer available in GTK4. Also stop forwarding key release events in GTK3 case, this only makes sense for key press events and we were re-injecting every release event since they are not handled by web elements in most of the cases. * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::doneWithKeyEvent): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseKeyPressEvent): (webkitWebViewBaseKeyReleaseEvent): (webkitWebViewBaseKeyPressed): 2020-05-02 Adrian Perez de Castro <aperez@igalia.com> [GTK] Specify action group name when binding context menu models https://bugs.webkit.org/show_bug.cgi?id=211288 Reviewed by Carlos Garcia Campos. No new tests needed. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::append): Use the action name directly for the menu item. (WebKit::WebContextMenuProxyGtk::populate): Indicate the action group name when binding the menu model, which automatically adds the group name as action name prefix without needing to specify it by hand when adding menu items. 2020-05-02 Devin Rousso <drousso@apple.com> [CSS Easing 1] implement `jump-*` step positions https://bugs.webkit.org/show_bug.cgi?id=211271 Reviewed by Dean Jackson. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<StepsTimingFunction>::encode): (IPC::ArgumentCoder<StepsTimingFunction>::decode): 2020-05-01 Tim Horton <timothy_horton@apple.com> Books sometimes ends up with blank pages, especially after adjusting font size https://bugs.webkit.org/show_bug.cgi?id=211265 <rdar://problem/59898144> Reviewed by Darin Adler. A few problems: - There is short time during page creation where a WKWebView created with _clipsToVisibleRect=YES would not yet have sent its viewExposedRect to the Web Content process, and if we end up constructing tiles during that time, we can make way too many, bogging down the process (or crashing). Fix this by always keeping track of the viewExposedRect (on WebPageProxy, instead of the somewhat-more-transient DrawingAreaProxy) and sending it to the Web Content process in the WebPage creation parameters, to entirely remove this window. - Even when the viewExposedRect successfully gets to the Web Content process, it can still end up wildly wrong: the DrawingArea was tasked with watching scrolling changes, applying the scroll offset to the viewExposedRect, and pushing it to FrameView in content coordinates. It turns out that this was all unnecessary, as we need viewExposedRect in root view coordinates (same space as visibleContentRect, which we intersect it with), and we just didn't notice because all clients of _clipsToVisibleRect: expand the view to its layout size and insert a scrolling view outside the web view, and so don't use our scrolling. Avoid this conversion and complexity entirely; I tested Mail and Books where there is no impact (other than fixing the original bug), and also a custom test app with a scrollable WKWebView inside a NSScrollView, which improved significantly. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Plumb view exposed rect via WebPage creation parameters. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::updateViewExposedRect): Send viewExposedRect changes to WebPageProxy instead of DrawingAreaProxy. * UIProcess/DrawingAreaProxy.cpp: (WebKit::DrawingAreaProxy::didChangeViewExposedRect): (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired): (WebKit::DrawingAreaProxy::setViewExposedRect): Deleted. * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::viewExposedRect const): Deleted. * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::didChangeViewExposedRect): (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation const): (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator): (WebKit::RemoteLayerTreeDrawingAreaProxy::setViewExposedRect): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setViewExposedRect): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::viewExposedRect const): Maintain viewExposedRect on WebPageProxy instead of DrawingAreaProxy, so that we can always store it even if we don't have a DrawingAreaProxy yet (or change DrawingAreaProxies) and can send it in WebPage creation parameters. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea): (WebKit::RemoteLayerTreeDrawingArea::setViewExposedRect): (WebKit::RemoteLayerTreeDrawingArea::updateRendering): (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): Deleted. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::updateRendering): (WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect): (WebKit::TiledCoreAnimationDrawingArea::scroll): Deleted. (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Deleted. Plumb viewExposedRect directly to FrameView, instead of trying to apply the root view -> contents mapping ourselves and pushing updates. 2020-05-01 David Kilzer <ddkilzer@apple.com> [IPC hardening] Refactor createMessageDecoder() for clarity <https://webkit.org/b/211322> Reviewed by Darin Adler. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::createMessageDecoder): - Rename `numDescriptors` to `numberOfPortDescriptors` to match variable name in sendOutgoingMessage(). - Add new `numberOfAttachments` variable to make it clear that one port descriptor is left for an out-of-line message body. - Add FIXME about another issue. 2020-05-01 Alex Christensen <achristensen@webkit.org> Add SPI to move localStorage to a different domain https://bugs.webkit.org/show_bug.cgi?id=209260 <rdar://problem/60285683> Reviewed by Brady Eidson. Covered by an API test. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::renameDomainInWebsiteData): (WebKit::NetworkProcess::getLocalStorageOriginDetails): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/WebStorage/LocalStorageNamespace.cpp: (WebKit::LocalStorageNamespace::renameDomain): * NetworkProcess/WebStorage/LocalStorageNamespace.h: * NetworkProcess/WebStorage/StorageArea.cpp: (WebKit::StorageArea::close): * NetworkProcess/WebStorage/StorageArea.h: * NetworkProcess/WebStorage/StorageManager.cpp: (WebKit::StorageManager::renameDomain): * NetworkProcess/WebStorage/StorageManager.h: * NetworkProcess/WebStorage/StorageManagerSet.cpp: (WebKit::StorageManagerSet::renameDomain): * NetworkProcess/WebStorage/StorageManagerSet.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _renameDomain:to:forDataOfTypes:completionHandler:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::renameDomainInWebsiteData): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::renameDomainInWebsiteData): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-05-01 Chris Dumez <cdumez@apple.com> [iOS] ProcessThrottler fails to re-take ProcessAssertion if the previous one was invalidated https://bugs.webkit.org/show_bug.cgi?id=211297 <rdar://problem/62542463> Reviewed by Jer Noble. Our ProcessAssertions may get invalidated upon backgrounding of the app. When the app becomes foreground and the ProcessThrottler tries to take a Foreground assertion as a result, it would incorrectly think it already had such assertion and not do anything, even though the previous one is no longer valid. As a result, the child processes would stay suspended even though the app was foregrounded. To address the issue, add a isValid() method to ProcessAssertion() and check it in ProcessThrottler::setAssertionType() to determine if we need to re-take an assertion or not. We also invalidate all pending ProcessThrottler activities upon ProcessAssertion invalidation for good measure. This way, the holders of these activities will be able to rely on Activity::isValid() to determine if they need to re-take their activities or not. * Platform/spi/ios/AssertionServicesSPI.h: * Platform/spi/ios/RunningBoardServicesSPI.h: * UIProcess/ProcessAssertion.cpp: (WebKit::ProcessAssertion::isValid const): * UIProcess/ProcessAssertion.h: (WebKit::ProcessAssertion::validity const): Deleted. * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::setAssertionType): (WebKit::ProcessThrottler::assertionWasInvalidated): * UIProcess/ProcessThrottler.h: * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::ProcessAssertion::processAssertionWasInvalidated): (WebKit::ProcessAssertion::isValid const): (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount): 2020-05-01 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r261015. Seems to have broken clean builds Reverted changeset: "[iOS] Unable to take RunningBoard process assertions in the iOS Simulator" https://bugs.webkit.org/show_bug.cgi?id=211254 https://trac.webkit.org/changeset/261015 2020-05-01 David Kilzer <ddkilzer@apple.com> [IPC hardening] createMessageDecoder() needs a validity check <https://webkit.org/b/211260> <rdar://problem/61914087> Reviewed by Darin Adler. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::createMessageDecoder): - Add validity check and early return for `numDescriptors`. 2020-05-01 Devin Rousso <drousso@apple.com> Web Inspector: Browser: crash when handling `disable` https://bugs.webkit.org/show_bug.cgi?id=211251 Reviewed by Daniel Bates. * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp: (WebKit::InspectorBrowserAgent::disable): If the inspected page crashed, we won't have a `WebInspectorProxy` anymore. 2020-05-01 Per Arne Vollan <pvollan@apple.com> [iOS] Every running WebContent process should be granted access to frontboard services when Accessibility is enabled https://bugs.webkit.org/show_bug.cgi?id=211238 Reviewed by Daniel Bates. Currently, every WebContent process is granted access to frontboard services if Accessibility is enabled at the time of startup. However, WebContent processes running at the time when Accessibility is enabled are not granted access, which is a bug. API test: WebKit.AccessibilityHasFrontboardServiceAccess * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::sendMessage): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::unblockServicesRequiredByAccessibility): (WebKit::WebProcess::unblockAccessibilityServer): Deleted. 2020-05-01 Chris Dumez <cdumez@apple.com> [iOS] Unable to take RunningBoard process assertions in the iOS Simulator https://bugs.webkit.org/show_bug.cgi?id=211254 <rdar://problem/62674074> Reviewed by Tim Horton. * Configurations/BaseXPCService.xcconfig: Use this directive to add our entitlements: CODE_SIGN_ENTITLEMENTS = $(WK_PROCESSED_XCENT_FILE); instead of using: OTHER_CODE_SIGN_FLAGS = --entitlements $(WK_PROCESSED_XCENT_FILE); This is important because entitlements are added differently for iOS Simulator builds, so that they only apply inside the simulator (and not for the host system). If we use CODE_SIGN_ENTITLEMENTS, then XCode does the right thing on all platforms. * Scripts/process-entitlements.sh: Add com.apple.runningboard.assertions.webkit entitlement to iOS Simulator builds. 2020-05-01 Don Olmstead <don.olmstead@sony.com> [GTK] Add additional exports to support hidden visibility https://bugs.webkit.org/show_bug.cgi?id=211246 Reviewed by Michael Catanzaro. * WebProcess/InjectedBundle/API/glib/WebKitWebExtensionPrivate.h: 2020-05-01 Per Arne Vollan <pvollan@apple.com> [iOS] Update message filtering rules in the WebContent process' sandbox https://bugs.webkit.org/show_bug.cgi?id=211188 <rdar://problem/60922910> Reviewed by Brent Fulgham. Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS. Messages that have not been observed being in use, should be denied. No new tests, covered by existing tests. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::sendMessage): 2020-05-01 Peng Liu <peng.liu6@apple.com> A PiP window doesn’t actually dismiss after the browser navigates to a different page within the same domain https://bugs.webkit.org/show_bug.cgi?id=211257 Reviewed by Jer Noble. Add the support of exitVideoFullscreenToModeWithoutAnimation() in iOS, so that the Web process can request the UI process to close the PiP window without exchanging IPC messages back and forth. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebChromeClient.h: Only stop the watchdog timer if it is active. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): 2020-05-01 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260920. https://bugs.webkit.org/show_bug.cgi?id=211292 Sandbox compile error is no longer an issue (Requested by perarne on #webkit). Reverted changeset: "Unreviewed sandbox compile fix." https://trac.webkit.org/changeset/260920 2020-05-01 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Move focus out of the web view when tab is pressed and there isn't a next element to focus https://bugs.webkit.org/show_bug.cgi?id=211283 Reviewed by Adrian Perez de Castro. Implement API::UIClient::takeFocus() that is called when WebCore wants to focus the chrome. * UIProcess/API/glib/WebKitUIClient.cpp: 2020-05-01 David Kilzer <ddkilzer@apple.com> REGRESSION (r260214): Leak of _WKTextInputContext in -[WKContentView _isTextInputContextFocused:] <https://webkit.org/b/211276> <rdar://problem/62696724> Reviewed by Daniel Bates. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): - Use RetainPtr<> to pass the copy of _WKTextInputContext into the block to fix the leak. 2020-05-01 Saam Barati <sbarati@apple.com> We can't cast toLength result to unsigned https://bugs.webkit.org/show_bug.cgi?id=211205 <rdar://problem/62625562> Reviewed by Yusuke Suzuki. * WebProcess/Plugins/Netscape/NPJSObject.cpp: (WebKit::NPJSObject::hasProperty): (WebKit::NPJSObject::getProperty): (WebKit::NPJSObject::removeProperty): 2020-05-01 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Disable arrow on context menu popover https://bugs.webkit.org/show_bug.cgi?id=211241 Reviewed by Carlos Garcia Campos. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk): Disable the menu popover arrow. 2020-04-30 Ross Kirsling <ross.kirsling@sony.com> TriState should be an enum class and use "Indeterminate" instead of "Mixed" https://bugs.webkit.org/show_bug.cgi?id=211268 Reviewed by Mark Lam. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::validateCommand): * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::getPlatformEditorState const): 2020-04-30 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Require user gestures for LocalAuthenticator https://bugs.webkit.org/show_bug.cgi?id=182893 <rdar://problem/43357293> Reviewed by Brent Fulgham. Covered by API tests. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::filterTransports const): (WebKit::AuthenticatorManager::getTransports const): Checks UserGesture here. Since filterTransports will be overrided in mock testings, all mock tests don't require user gestures. * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential): (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion): * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in: * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): Adds user gesture corresponding fields. 2020-04-30 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the Mac Catalyst build after r260979 The presence of `_contextMenuInteraction` is conditional not only on `USE(UICONTEXTMENU)`, but also `HAVE(LINK_PREVIEW)`. Guard logic in `-deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:` with the latter as well. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): 2020-04-30 Simon Fraser <simon.fraser@apple.com> Clean up some EventHandler coordinate-related naming and fix ScrollableArea::lastKnownMousePosition() conversions https://bugs.webkit.org/show_bug.cgi?id=211259 Reviewed by Zalan Bujtas. * Shared/WebEvent.h: (WebKit::WebMouseEvent::position const): * Shared/WebMouseEvent.cpp: (WebKit::WebMouseEvent::WebMouseEvent): * WebProcess/Plugins/PDF/PDFPlugin.h: 2020-04-30 David Kilzer <ddkilzer@apple.com> [iOS] Fix confusing idiom for releasing _selectionRects in -[WKTextRange dealloc] <https://webkit.org/b/211269> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKTextRange dealloc]): - Switch to more common idiom to release an instance variable. This fixes a false positive warning from the clang static analyzer about releasing a variable not owned by the caller. 2020-04-30 Wenson Hsieh <wenson_hsieh@apple.com> REGRESSION: Double tap dispatches one click event on iOS 13.4 when it would dispatch two on iOS 13.3 https://bugs.webkit.org/show_bug.cgi?id=211179 <rdar://problem/62594779> Reviewed by Tim Horton. https://trac.webkit.org/r253267 introduced deferring gesture recognizers as a way to handle preventable (non- passive) touchstart events without blocking the UI process. These deferring gesture recognizers work by having other gesture recognizers at or below WKWebView (with few exceptions) require the failure of these deferring gestures. These gestures transition to possible state when beginning a touch inside a non-passive touch event handling region, and transition to either failed or ended state (depending on whether `preventDefault()` was called) after the web content process finished handling the touch event. However, this means that the resulting dependency graph now has an edge between each gesture under WKWebView and one of the deferring gesture recognizers, due to these new failure requirements. Since gestures that have been recognized or have failed don't get reset until all other gestures in the same dependency subgraph have also recognized or failed, some gestures (such as the synthetic single tap gesture recognizer in this bug) might not be resetting as soon after ending as they did before, since they may be connected to other gesture recognizers that are still in possible state by way of the failure requirements added by the new deferring gestures. I was already aware of this problem in r253267, and attempted to solve this by bisecting the gesture dependency graph into two subgraphs: one containing all the one-finger multi-tap gestures that are reset after a lengthy delay, and another containing everything else. To do this, I added two different deferring gesture recognizers: one for immediately resettable gestures (meant for gestures in the latter subgraph), and another for gestures that are reset after a delay (meant for gestures in the former subgraph). Unfortunately, unrelated changes around text interactions in UIKit in iOS 13.4 caused the tap-and-a-half gesture for selecting a range of text to now have a delayed reset; this means that gestures in the "immediately resettable" gesture subgraph are all forced to wait on the tap-and-a-half text interaction gesture before resetting, which causes the bug here, since the synthetic single tap gesture is in this "immediately resettable" gesture subgraph. To mitigate this, this patch pushes the tap-and-a-half text selection gesture, along with the loupe gesture, context menu relationship gesture, and drag lift gestures (i.e. the other gestures that are connected to the tap-and-a-half gesture via failure requirements) out of the "immediately resettable" subgraph, and into the "delayed" subgraph. Test: fast/events/touch/ios/two-click-events-after-double-tap-with-touch-handler.html * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): 2020-04-30 Brent Fulgham <bfulgham@apple.com> REGRESSION (r260932): ASSERTION FAILED: ok in webkit::SandboxExtension::consumePermanently for 3 tests https://bugs.webkit.org/show_bug.cgi?id=211253 <rdar://problem/62673727> Reviewed by Per Arne Vollan. In r260932 I added an assertion to confirm that a sandbox extension was successfully consumed. This triggered three test failures because those tests attempt to pass a sandbox extension from the WebContent process to the UIProcess. After speaking with the Sandbox team, I learned that an unsandboxed program that attempts to consume a valid sandbox extension will return 0. Sandboxed processes either receive -1 (for error), or a handle representing the newly added extension (so that it can be removed when no longer needed). Since the TestWebKitAPI (and WebKitTestRunner) processes are not sandboxed they receive a zero return value here. We should recognize this as a valid and expected result. We should also consider making some form of sandboxed driver for WebKit. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::consume): Recognize a 0 handle as valid. 2020-04-30 Jiewen Tan <jiewen_tan@apple.com> [WebAuthn] Optimize LocalAuthenticator https://bugs.webkit.org/show_bug.cgi?id=183534 <rdar://problem/43357408> Reviewed by Brent Fulgham. This patch implements the following small optimizations: 1. Replacing local constants with ones from FidoConstants.h; 2. Merging m_assertionResponses and m_existingCredentials by replacing HashSet with Vector in Authenticator::Observer::selectAssertionResponse; 3. Using Base64 encoded strings as the keys of the HashSet in produceHashSet() instead of the old casting hack; 4. Invaliding the LAContext in LocalConnection::~LocalConnection() such that any displaying LocalAuthentication dialogs can be dismissed after the object is destroyed; 5. Sorting existing credentials according to LRU before returning to UI clients; 6. Improving the LocalAuthentication dialog titles for iOS. * UIProcess/WebAuthentication/Authenticator.h: * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::selectAssertionResponse): * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::produceHashSet): (WebKit::LocalAuthenticatorInternal::toNSData): (WebKit::LocalAuthenticatorInternal::getExistingCredentials): (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::getAssertion): (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification): * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: (WebKit::LocalConnection::filterResponses const): * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::WebCore::bundleName): (WebKit::LocalConnection::~LocalConnection): (WebKit::LocalConnection::verifyUser): (WebKit::LocalConnection::verifyUser const): Deleted. * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::verifyUser): (WebKit::MockLocalConnection::filterResponses const): (WebKit::MockLocalConnection::verifyUser const): Deleted. * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived): (WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived): * UIProcess/WebAuthentication/fido/CtapAuthenticator.h: 2020-04-30 Kate Cheney <katherine_cheney@apple.com> Change default of "inAppBrowserPrivacyQuirks" testing toggle to use it for tests only https://bugs.webkit.org/show_bug.cgi?id=211209 <rdar://problem/62619659> Reviewed by Brent Fulgham. No new tests, behavior confirmed by existing tests. * Shared/WebPreferences.yaml: 2020-04-30 Devin Rousso <drousso@apple.com> Unreviewed, add missing parenthesis * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handleMediaEvent): 2020-04-30 Chris Dumez <cdumez@apple.com> [iOS][WK2] Add timeout for "Client navigation" foreground assertion https://bugs.webkit.org/show_bug.cgi?id=211202 Reviewed by Alex Christensen. Add a 30s timeout for "Client navigation" foreground assertion. Foreground assertions do not timeout at RunningBoard level and we thus need to make sure we release them to avoid power leaks. * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): * UIProcess/API/APINavigation.h: (API::Navigation::setClientNavigationActivity): (API::Navigation::setForegroundActivity): Deleted. * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::TimedActivity::TimedActivity): (WebKit::ProcessThrottler::TimedActivity::operator=): (WebKit::ProcessThrottler::TimedActivity::activityTimedOut): (WebKit::ProcessThrottler::TimedActivity::updateTimer): * UIProcess/ProcessThrottler.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): 2020-04-30 Alex Christensen <achristensen@webkit.org> Add SPI to change a WKWebView's CORS disabling pattern after initialization https://bugs.webkit.org/show_bug.cgi?id=211211 <rdar://problem/61837474> Reviewed by Chris Dumez. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _corsDisablingPatterns]): (-[WKWebView _setCORSDisablingPatterns:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::corsDisablingPatterns const): * WebProcess/WebPage/WebPage.cpp: (WebKit::parseAndAllowAccessToCORSDisablingPatterns): (WebKit::m_isNavigatingToAppBoundDomain): (WebKit::WebPage::updateCORSDisablingPatterns): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-04-30 Daniel Bates <dabates@apple.com> [iOS] Implement -markedTextRange https://bugs.webkit.org/show_bug.cgi?id=211148 <rdar://problem/57865890> Reviewed by Wenson Hsieh. Return the UITextRange-like object for the marked text range. Clients can use this range to access the selection rects or query for the caret rect at the start or end of the range, if desired. * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): Encode and decode the marked text selection rects and caret rects at the state and end of the marked text range. This is the same information that we compute in order to implement -selectedTextRange. I thought about collecting these details into class and having editor state hold two instances of it: one for selected text and one for marked text. However I decided against it because this class is unlikely to find use outside of what is needed to implement -selectedTextRange and -markedTextRange. This is because only those functions require such details so as to return an opaque UITextRange-derived object that can be passed to- or its sub-objects can be passed to WKContentView's -caretRectForPosition and -selectionRectsForRange. Literally, WKContentView does not support other UITextInput functions that operate on UITextRange or UITextPosition. I didn't pursue fixing this in general because 1) I don't need it to solve my problem and 2) UIWKDocumentContext SPI seems to be the new general-purpose solution. (WebKit::operator<<): Pretty print all the new marked text details we collect. While I am here, use Vector::isEmpty() instead of Vector::size() to check if there are selection rects. * Shared/EditorState.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textFirstRect]): (-[WKContentView textLastRect]): Update code now that the marked text rects are in the post layout data sub-object. (-[WKContentView _scaledCaretRectForSelectionStart:]): Extracted from -selectedTextRange. (-[WKContentView _scaledCaretRectForSelectionEnd:]): Ditto. (-[WKContentView selectedTextRange]): Write in terms of -_scaledCaretRectForSelectionStart and -_scaledCaretRectForSelectionEnd. Also modernize the code while I am here. (-[WKContentView markedTextRange]): Added. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPlatformEditorState const): Collect the marked text rects and the caret rects at the start and end of the range. 2020-04-30 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4][X11] Add support for rendering web view contents https://bugs.webkit.org/show_bug.cgi?id=211189 Reviewed by Adrian Perez de Castro. Use GdkDisplayX11::xevent signal instead of filtering events that is no longer available in GTK4. GdkVisual no longer exists either, so we get the X visual from the PlatformDisplay. * UIProcess/gtk/AcceleratedBackingStoreX11.cpp: (WebKit::XDamageNotifier::add): (WebKit::XDamageNotifier::remove): (WebKit::XDamageNotifier::filterXDamageEvent): (WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11): (WebKit::AcceleratedBackingStoreX11::update): (WebKit::AcceleratedBackingStoreX11::snapshot): * WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp: (WebKit::AcceleratedSurfaceX11::AcceleratedSurfaceX11): (WebKit::AcceleratedSurfaceX11::createPixmap): 2020-04-30 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add support click events https://bugs.webkit.org/show_bug.cgi?id=211175 Reviewed by Adrian Perez de Castro. Handle button pressed and released events using a GtkGestureClick. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (ClickCounter::currentClickCountForGdkButtonEvent): (webkitWebViewBaseButtonPressed): (webkitWebViewBaseButtonReleased): (webkitWebViewBaseConstructed): (webkitWebViewBaseResetClickCounter): 2020-04-29 Simon Fraser <simon.fraser@apple.com> Use initializers in PlatformMouseEvent and WebEvent https://bugs.webkit.org/show_bug.cgi?id=211217 Reviewed by Tim Horton. Use initializers im WebEvent. * Shared/WebEvent.h: * Shared/WebMouseEvent.cpp: 2020-04-29 Brent Fulgham <bfulgham@apple.com> Improve SandboxExtension::HandleArray to reduce boilerplate https://bugs.webkit.org/show_bug.cgi?id=211103 <rdar://problem/62533632> Reviewed by Per Arne Vollan. There are a number of boilerplate patterns needed when using SandboxExtension::HandleArray. We could make these simpler and less error prone by improving the class. This patch: 1. Adds convenience methods to create and consume HandleArrays. 2. Updates uses of HandleArray to use the convenience methods. Tested by existing tests. * Platform/IPC/FormDataReference.h: (IPC::FormDataReference::decode): * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtension::createHandlesForFiles): (WebKit::SandboxExtension::createHandlesForMachLookup): (WebKit::SandboxExtension::consumePermanently): * Shared/SandboxExtension.h: (WebKit::createHandlesForFiles): (WebKit::SandboxExtension::consumePermanently): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::unblockPreferenceServiceIfNeeded): * UIProcess/WebPageProxy.cpp: * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::getPathnamesForType): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::extendSandboxForFilesFromOpenPanel): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::unblockPreferenceService): 2020-04-29 Chris Dumez <cdumez@apple.com> REGRESSION(r260791) Network process fails to suspend promptly https://bugs.webkit.org/show_bug.cgi?id=211207 <rdar://problem/62620454> Reviewed by Alex Christensen. After r260791, all WebResourceLoadStatisticsStore instances share a single WorkQueue. As a result, the logic to suspend WebResourceLoadStatisticsStore's WorkQueues in NetworkProcess::prepareToSuspend() needs to get updated to reflect this. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::suspend): (WebKit::WebResourceLoadStatisticsStore::resume): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): 2020-04-29 Adrian Perez de Castro <aperez@igalia.com> REGRESSION(r260889): TestContextMenu:/webkit/WebKitWebView/populate-menu no longer passes https://bugs.webkit.org/show_bug.cgi?id=211203 Reviewed by Aakash Jain. No new tests needed. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk): Attach the correct action group to the popover widget, instead of a temporary which will always be empty. 2020-04-29 David Kilzer <ddkilzer@apple.com> REGRESSION (r246395): Leak of ARQuickLookPreviewItem and ARQuickLookWebKitItem in -[_WKPreviewControllerDataSource previewController:previewItemAtIndex:] <https://webkit.org/b/211197> <rdar://problem/62612483> Reviewed by Darin Adler. * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]): - Use RetainPtr<> and adoptNS() to fix leaks. 2020-04-29 Per Arne Vollan <pvollan@apple.com> Unreviewed sandbox compile fix. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-29 Alex Christensen <achristensen@webkit.org> Add WKNavigationDelegate API shouldAllowDeprecatedTLS https://bugs.webkit.org/show_bug.cgi?id=210981 <rdar://problem/61742976> Reviewed by Geoffrey Garen. * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::shouldAllowLegacyTLS): 2020-04-29 Chris Dumez <cdumez@apple.com> [iOS][WK2] Temporarily stop using RunningBoard for the foreground process assertion https://bugs.webkit.org/show_bug.cgi?id=211196 <rdar://problem/62535822> Reviewed by Tim Horton. Temporarily stop using RunningBoard for the foreground process assertion. On recent iOS builds, there are issues where this assertion can time out after 30 seconds, even though the process is still foreground. * Configurations/WebKit.xcconfig: * UIProcess/ProcessAssertion.h: * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::runningBoardNameForAssertionType): (WebKit::ProcessAssertion::ProcessAssertion): (WebKit::ProcessAssertion::~ProcessAssertion): 2020-04-29 Youenn Fablet <youenn@apple.com> Set _STAttributionDisplayName to iOS WebContent Info plist https://bugs.webkit.org/show_bug.cgi?id=210772 <rdar://problem/62075201> Reviewed by Eric Carlson. Set _STAttributionDisplayName to 'Website' value. * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: 2020-04-29 Kate Cheney <katherine_cheney@apple.com> Refactor layout tests after updates to In-App Browser Privacy https://bugs.webkit.org/show_bug.cgi?id=211146 <rdar://problem/62524127> Reviewed by Brent Fulgham. Tests: http/tests/in-app-browser-privacy/app-bound-domain-gets-app-bound-session.html http/tests/in-app-browser-privacy/non-app-bound-domain-does-not-get-app-bound-session.html Removes setInAppBrowserPrivacyEnabled, which is no longer needed by layout tests. Setting this in TestOptions is enough. getWebViewCategory is not needed because this patch deletes the only test which uses it. Lastly, adds a new function to clear app-bound sessions now that multiple tests are checking for them. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::clearAppBoundSession): (WebKit::NetworkProcess::setInAppBrowserPrivacyEnabled): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::clearAppBoundSession): (WebKit::NetworkSession::setInAppBrowserPrivacyEnabled): Deleted. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::appBoundSession): (WebKit::NetworkSessionCocoa::clearAppBoundSession): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreClearAppBoundSession): (WKWebsiteDataStoreSetInAppBrowserPrivacyEnabled): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _getWebViewCategoryFor:completionHandler:]): Deleted. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::clearAppBoundSession): (WebKit::NetworkProcessProxy::setInAppBrowserPrivacyEnabled): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::clearAppBoundSession): (WebKit::WebsiteDataStore::setInAppBrowserPrivacyEnabled): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-04-29 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> [GPUP][GTK] compile GPUProcess in GTK port https://bugs.webkit.org/show_bug.cgi?id=208814 Reviewed by Don Olmstead. Enable GPUProcess compilation in WebKitGTK as an experimental feature No new tests required. * GPUProcess/GPUConnectionToWebProcess.cpp: guard UserMediaCaptureManagerProxy for Cocoa platform only. (WebKit::GPUConnectionToWebProcess::dispatchMessage): guard messages from UserMediaCaptureManagerProxy for Cocoa platform, moving up this guard from video track messages. (WebKit::GPUConnectionToWebProcess::mediaKeyStorageDirectory): removed guard for this function of ENCRYPTED_MEDIA leaving only LEGACY_ENCRYPTED_MEDIA, since it's were it is defined. (WebKit::GPUConnectionToWebProcess::setOrientationForMediaCapture): guard the content of this function for Cocoa platform, since it is calling a UserMediaCaptureManagerProxy object. * GPUProcess/GPUProcess.cpp: Replace the included header to match with the used symbols in file. * GPUProcess/gstreamer/GPUProcessGStreamer.cpp: Added. (WebKit::GPUProcess::initializeProcess): Empty function. (WebKit::GPUProcess::initializeProcessName): Empty function. (WebKit::GPUProcess::initializeSandbox): Empty function. * GPUProcess/gstreamer/GPUProcessMainGStreamer.cpp: Added. (WebKit::initializeAuxiliaryProcess<GPUProcess>): New function. (WebKit::GPUProcessMain): New function. * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp: changed guard for this file from ENCRYPTED_MEDIA to LEGACY_ENCRYPTED_MEDIA to match with its header file. * GPUProcess/media/gstreamer/RemoteMediaPlayerProxyGStreamer.cpp: Added. (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): New function that raises noImplemented() (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): New function that raises noImplemented() (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): New function that raises noImplemented() (WebKit::RemoteMediaPlayerProxy::enterFullscreen): New function that raises noImplemented() (WebKit::RemoteMediaPlayerProxy::exitFullscreen): New function that raises noImplemented() * PlatformGTK.cmake: add Platform/generic header directory. * SourcesGTK.txt: Add the new files and GPUProcess/media/RemoteAudioDestinationManager.cpp * WebProcess/GPU/GPUProcessConnection.cpp: guard UserMediaCaptureManager for Cocoa platform only. (WebKit::GPUProcessConnection::dispatchMessage): guard messages from UserMediaCaptureManager for Cocoa platform, moving up this guard applied also for video track. * WebProcess/GPU/media/RemoteCDM.cpp: include missing header GPUProcessConnection.h * WebProcess/GPU/media/gstreamer/VideoLayerRemoteGStreamer.cpp: Added. (WebKit::createVideoLayerRemote): New function that raises noImplemented() 2020-04-29 Claudio Saavedra <csaavedra@igalia.com> [GTK4] Unreviewed compile-warning fixes * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSetEnableBackForwardNavigationGesture): (webkitWebViewBaseWillSwapWebProcess): 2020-04-29 Rob Buis <rbuis@igalia.com> Make PolicyChecker an inner class of FrameLoader https://bugs.webkit.org/show_bug.cgi?id=211138 Reviewed by Alex Christensen. Adapt to PolicyChecker::ShouldContinue change. * GPUProcess/media/RemoteMediaResource.cpp: (WebKit::RemoteMediaResource::responseReceived): * GPUProcess/media/RemoteMediaResource.h: * GPUProcess/media/RemoteMediaResourceManager.cpp: (WebKit::RemoteMediaResourceManager::responseReceived): * GPUProcess/media/RemoteMediaResourceManager.h: * GPUProcess/media/RemoteMediaResourceManager.messages.in: * Scripts/webkit/messages.py: * WebProcess/GPU/media/RemoteMediaResourceProxy.cpp: (WebKit::RemoteMediaResourceProxy::responseReceived): * WebProcess/GPU/media/RemoteMediaResourceProxy.h: 2020-04-29 Adrian Perez de Castro <aperez@igalia.com> [GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup() https://bugs.webkit.org/show_bug.cgi?id=170553 Reviewed by Carlos Garcia Campos. Replace GtkMenuShell with a GtkPopoverMenu for context menus. The former is not available at all in GTK4, and the later allows for simplifying the positioning code: it is enough to provide a point in WebKitWebView widget where to place the popup, and GTK takes care of everything. This removes the custom positioning code (as it is not needed anymore), which did GdkScreen-relative calculations that GTK4 does not support. No new tests needed. * Shared/glib/WebContextMenuItemGlib.h: * UIProcess/API/glib/WebKitWebView.cpp: (contextMenuDismissed): Change parameter from GtkMenuShell to GtkMenuShell to GtkWidget. (webkitWebViewPopulateContextMenu): Connect to the GtkPopover::closed signal instead of GtkMenuShell::deactivate. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (activeContextMenuClosed): Renamed from activeContextMenuUnmapped(), changed parameter from GtkMenuShell to GtkWidget, and compare with WebContextMenuProxyGtk::gtkWidget(). (activeContextMenuUnmapped): Renamed to activeContextMenuClosed(). (webkitWebViewBaseSetActiveContextMenuProxy): Connect to the GtkPopover::closed signal instead of GtkMenuShell::deactivate. (webkitWebViewBaseGetActiveContextMenuProxy): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: * UIProcess/gtk/WebContextMenuProxyGtk.cpp: Arrange to use GtkPopoverMenu instead of GtkMenuShell. * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::populate): (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems): Simplify using m_context.menuLocation() to obtain the location where to make the context menu popup next to, which allows removing the ::menuPositionFunction() callback as well. (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk): (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk): * UIProcess/gtk/WebContextMenuProxyGtk.h: Remove declarations for ::menuPositionFunction() and ::m_popupPosition, which are now unneeded. (WebKit::WebContextMenuProxyGtk::gtkWidget const): Renamed from ::gtkMenu(), and made it return a GtkWidget. 2020-04-29 Commit Queue <commit-queue@webkit.org> Unreviewed, reverting r260650. https://bugs.webkit.org/show_bug.cgi?id=211172 It is breaking internal bots (Requested by youenn on #webkit). Reverted changeset: "Call STDynamicActivityAttributionPublisher in the WebProcess" https://bugs.webkit.org/show_bug.cgi?id=210772 https://trac.webkit.org/changeset/260650 2020-04-29 Devin Rousso <drousso@apple.com> Web Inspector: Uncaught Exception: SyntaxError: Unexpected identifier 'E'. Expected either a closing ']' or a ',' following an array element. https://bugs.webkit.org/show_bug.cgi?id=211163 Reviewed by Joseph Pecoraro. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::updateFindString): * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::updateFindString): Use the newly exposed `JSON::Value::escapeString` to ensure that the `findString` will not throw a JavaScript exception when placed in the `InspectorFrontendAPI` call. 2020-04-28 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add support for key events https://bugs.webkit.org/show_bug.cgi?id=211128 Reviewed by Adrian Perez de Castro. Handle key-pressed and key-released events using a GtkEventControllerKey. To receive key events the widget needs to be focused, so also implement GtkWidgetClass::grab_focus and handle enter and leave focus events. GTK4 needs the widget used by the key bindings translator to be added to a parent to be able to forward key events, so it's now added as a child internal widget of the WebKitWeViewBase. * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebKeyboardEvent): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewChildIsInternalWidget): (webkitWebViewBaseContainerRemove): (webkitWebViewBaseContainerForall): (webkitWebViewBaseFocusEnter): (webkitWebViewBaseFocusLeave): (webkitWebViewBaseKeyPressed): (webkitWebViewBaseKeyReleased): (webkitWebViewBaseGrabFocus): (webkitWebViewBaseConstructed): (webkit_web_view_base_class_init): * UIProcess/gtk/KeyBindingTranslator.cpp: (WebKit::KeyBindingTranslator::KeyBindingTranslator): (WebKit::KeyBindingTranslator::~KeyBindingTranslator): (WebKit::handleCustomKeyBindings): (WebKit::KeyBindingTranslator::commandsForKeyEvent): * UIProcess/gtk/KeyBindingTranslator.h: (WebKit::KeyBindingTranslator::widget const): (WebKit::KeyBindingTranslator::destroyed): 2020-04-28 Wenson Hsieh <wenson_hsieh@apple.com> [Text manipulation] Add a userInfo dictionary to _WKTextManipulationToken https://bugs.webkit.org/show_bug.cgi?id=211151 <rdar://problem/62329534> Reviewed by Darin Adler. * UIProcess/API/Cocoa/WKWebView.mm: (createUserInfo): (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): (-[WKWebView _completeTextManipulation:completion:]): (-[WKWebView _completeTextManipulationForItems:completion:]): * UIProcess/API/Cocoa/_WKTextManipulationToken.h: * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: (-[_WKTextManipulationToken setUserInfo:]): (-[_WKTextManipulationToken userInfo]): Add a new `userInfo` dictionary to `_WKTextManipulationToken`, which contains several named `NSString` keys. (-[_WKTextManipulationToken isEqualToTextManipulationToken:includingContentEquality:]): (-[_WKTextManipulationToken _descriptionPreservingPrivacy:]): 2020-04-28 David Kilzer <ddkilzer@apple.com> REGRESSION (r260407): Over-release of NSGraphicsContext in WebKit::convertPlatformImageToBitmap() <https://webkit.org/b/211160> Reviewed by Darin Adler. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::convertPlatformImageToBitmap): Use retainPtr() instead of adoptNS() to fix the over-release. 2020-04-28 David Kilzer <ddkilzer@apple.com> IPC::Decoder::isValid() should just be a nullptr check <https://webkit.org/b/211152> <rdar://problem/62552699> Reviewed by Darin Adler. * Platform/IPC/Decoder.h: (IPC::Decoder::isValid const): Change to nullptr check. I reviewed the code in Decoder.{cpp,h}, and I didn't see m_bufferPos being set without a bounds check. Also added WARN_UNUSED_RETURN to make sure the result is always checked. 2020-04-28 Daniel Bates <dabates@apple.com> Move WebPage::textInputContextsInRect() to WebPageIOS.mm https://bugs.webkit.org/show_bug.cgi?id=211136 Reviewed by Eric Carlson. The function WebPage::textInputContextsInRect is very specific to a client on iOS. Although it's tempting to keep this cross-platform because its implementation does not make use of iOS-specific technologies it does a very specific operation, the result of which is a list of contexts to editable elements on the page. The contexts provide enough info for the specific iOS client, but not enough to ever be useful to any other client. Therefore move it to WebPageIOS.mm. Only Mac and iOS were ever using this function. The former only for testing purposes that have since been removed. A side effect of this change is that I also move WebPageProxy::textInputContextsInRect() from WebPageProxy.cpp to WebPageProxyIOS.mm. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::textInputContextsInRect): Deleted; moved to WebPageProxyIOS.mm. * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::textInputContextsInRect): Moved from WebPageProxy.cpp. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::textInputContextsInRect): Deleted; moved to WebPageIOS.mm. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::textInputContextsInRect): Moved from WebPage.cpp. 2020-04-28 Chris Dumez <cdumez@apple.com> [iOS][WK2] Drop process assertion logic for holding locked files https://bugs.webkit.org/show_bug.cgi?id=206910 Reviewed by Alex Christensen. Drop process assertion logic for holding locked files as it is causing issues and should no longer be needed. The intention of this code was that the Network Process would send a SetIsHoldingLockedFiles(bool) IPC to the UIProcess whenever there are pending SQLite transactions and the UIProcess would then take a process assertion on behalf of the WebProcess (or release it) to prevent / allow suspension. This approach has some issues: 1. It was noisy in terms of IPC 2. Because it relies on an IPC to the UIProcess to keep running, it was inherently racy 3. We already have logic to deal with suspension in the network / web processes. The UIProcess sends a PrepareForSuspension IPC to its child processes. In turn, those processes will make sure to suspend their database threads to prevent any further database work. The child processes would then respond to the PrepareForSuspension IPC to let the UIProcess know they are ready to suspend. The 2 approaches were conflicting, because after the PrepareForSuspension IPC is sent, the child process could process a transaction and send the SetIsHoldingLockedFiles() IPC to the UIProcess which would incorrectly cancel the suspension. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::NetworkProcess): (WebKit::m_messagePortChannelRegistry): Deleted. * NetworkProcess/NetworkProcess.h: * Shared/WebSQLiteDatabaseTracker.cpp: Removed. * Shared/WebSQLiteDatabaseTracker.h: Removed. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::didSetAssertionState): (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::setIsHoldingLockedFiles): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebProcess.cpp: (WebKit::m_nonVisibleProcessCleanupTimer): (WebKit::m_webSQLiteDatabaseTracker): Deleted. * WebProcess/WebProcess.h: 2020-04-28 Noam Rosenthal <noam@webkit.org> Implement FCP (first contentful paint) https://bugs.webkit.org/show_bug.cgi?id=208499 Reviewed by Simon Fraser. Add an experimental runtime flag for paint-timing (paintTimingEnabled). * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetPaintTimingEnabled): (WKPreferencesGetPaintTimingEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): 2020-04-28 Ross Kirsling <ross.kirsling@sony.com> [JSC] Align upon the name isCallable instead of isFunction https://bugs.webkit.org/show_bug.cgi?id=211140 Reviewed by Darin Adler. * WebProcess/Plugins/Netscape/NPJSObject.cpp: (WebKit::NPJSObject::hasMethod): 2020-04-28 Devin Rousso <drousso@apple.com> Web Inspector: find dialog does not populate search string from system find pasteboard https://bugs.webkit.org/show_bug.cgi?id=113588 <rdar://problem/19281466> Reviewed by Brian Burg. * UIProcess/Inspector/mac/WKInspectorWKWebView.h: * UIProcess/Inspector/mac/WKInspectorWKWebView.mm: (-[WKInspectorWKWebView dealloc]): Added. (-[WKInspectorWKWebView setInspectorWKWebViewDelegate:]): (-[WKInspectorWKWebView becomeFirstResponder]): Added. (-[WKInspectorWKWebView _handleWindowDidBecomeKey:]): Added. * UIProcess/Inspector/mac/WKInspectorViewController.h: * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController inspectorWKWebViewDidBecomeActive:]): Added. * UIProcess/Inspector/WebInspectorProxy.h: * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerDidBecomeActive:]): Added. (WebKit::WebInspectorProxy::didBecomeActive): Added. * UIProcess/Inspector/RemoteWebInspectorProxy.h: * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: (-[WKRemoteWebInspectorProxyObjCAdapter inspectorWKWebViewDidBecomeActive:]): Added. (WebKit::RemoteWebInspectorProxy::didBecomeActive): Added. Add a new delegate call chain that notifies the inspector proxy about when the inspector web view becomes active, at which point the inspector proxy can get the current find string and sent it to the inspector page. * WebProcess/Inspector/WebInspectorUI.messages.in: * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::updateFindString): Added. * WebProcess/Inspector/RemoteWebInspectorUI.messages.in: * WebProcess/Inspector/RemoteWebInspectorUI.h: * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::updateFindString): Added. Pass along the new find string to the frontend via `InspectorFrontendAPI.updateFindString`. 2020-04-28 Daniel Bates <dabates@apple.com> Remove unused WebPage::focusTextInputContext() https://bugs.webkit.org/show_bug.cgi?id=211135 Reviewed by Anders Carlsson. I accidentally forgot to remove the WebPage message and WebPage implementation that backed -_focusTextInputContext when I removed it in r260225. Now the implementation is unused. Let's remove it. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::focusTextInputContext): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-04-28 Christopher Reid <chris.reid@sony.com> [Win] Bundle Inspector Resources in Release builds https://bugs.webkit.org/show_bug.cgi?id=210942 Reviewed by Fujii Hironori. Move CMake logic for the inspector resource copy script to Source/WebInspectorUI so it can be shared with Win and other platforms. * InspectorGResources.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: 2020-04-28 David Kilzer <ddkilzer@apple.com> [MacCatalyst] Add missing symlinks to WebKit.frameworks <https://webkit.org/b/211102> <rdar://problem/62137758> Reviewed by Brent Fulgham. * WebKit.xcodeproj/project.pbxproj: (Make Frameworks Symbolic Link): - Update logic to run for macOS and macCatalyst builds. - Add output path. (Check For Inappropriate Objective-C Class Names): - Let Xcode have its way with the project file by adding a newline to the end of the script. (Check For Weak VTables and Externals): Ditto. (Add XPCServices symlink): - Update logic to run for macOS and macCatalyst builds. 2020-04-28 Kate Cheney <katherine_cheney@apple.com> Create a mechanism to add missing ITP Database tables when the schema is updated https://bugs.webkit.org/show_bug.cgi?id=211004 <rdar://problem/62261187> Reviewed by John Wilander. This patch updates the ITP database to better handle added tables to the schema. Currently the database store deletes and re-creates the database when any schema change is encountered. This is simple but would result in ITP data loss during schema updates, so this patch searches the schema for missing tables and adds any it finds. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::createTableQueries): Convert the tables array to a mapping of table names to their respective CREATE TABLE queries so we can add missing tables on the fly. (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase): Remove call to createSchema() from the constructor. It makes more sense to base this on whether the file is new as opposed to whether one table exists. (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::addMissingTablesIfNecessary): Checks for missing tables and adds them using a best-effort approach. Call createUniqueIndices() to call all CREATE UNIQUE INDEX queries, even though we may not need them all. It is much simpler than to associate each query with its table, and it doesn't hurt to call again. (WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary): Add missing tables instead of deleting the old database file. Changed the function name to reflect this. Deleted a FIXME which this patch addresses but added a new FIXME for migrating data when adding new columns, which this patch does not address. (WebKit::ResourceLoadStatisticsDatabaseStore::isCorrectTableSchema): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::openAndDropOldDatabaseIfNecessary): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::statisticsDatabaseHasAllTables): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::statisticsDatabaseHasAllTables): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _statisticsDatabaseHasAllTables:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::statisticsDatabaseHasAllTables): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::statisticsDatabaseHasAllTables): * UIProcess/WebsiteData/WebsiteDataStore.h: Added an SPI call to test that the database schema includes all tables. This tests the database is not dropped when a new table is added upon opening the database. 2020-04-28 Per Arne Vollan <pvollan@apple.com> [Cocoa] Global preferences are not accessible in the WebContent process when CFPrefs direct mode is enabled https://bugs.webkit.org/show_bug.cgi?id=211075 <rdar://problem/61866711> Reviewed by Brent Fulgham. Global preferences in the domain 'kCFPreferencesAnyApplication' are not readable in the WebContent process when CFPrefs direct mode is enabled. Fix this by transferring a select set of global preferences to the WebContent process on startup. API test: WebKit.GlobalPreferences * 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::setGlobalPreferences): (WebKit::WebProcess::platformInitializeWebProcess): 2020-04-28 Peng Liu <peng.liu6@apple.com> Remove the WebKit.plist for Feature Flags https://bugs.webkit.org/show_bug.cgi?id=210534 Unreviewed project file clean-up. A follow-up patch for r260599. Remove the reference to the WebKit.plist from project.pbxproj. * WebKit.xcodeproj/project.pbxproj: 2020-04-28 Alex Christensen <achristensen@webkit.org> Fix iOS API tests after r260790 https://bugs.webkit.org/show_bug.cgi?id=211093 * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::sendMessage): Only call the completion handler once. 2020-04-28 Jer Noble <jer.noble@apple.com> [Mac] Adopt kMTSupportNotification_ShouldPlayHDRVideoChanged notification https://bugs.webkit.org/show_bug.cgi?id=211028 Reviewed by Eric Carlson. Adopt a new notification which signals that the receiver should re-query for HDR support. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::webProcessPoolHighDynamicRangeDidChangeCallback): (WebKit::WebProcessPool::registerHighDynamicRangeChangeCallback): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::registerHighDynamicRangeChangeCallback): (WebKit::WebProcessPool::initializeNewWebProcess): * UIProcess/WebProcessPool.h: 2020-04-28 Adrian Perez de Castro <aperez@igalia.com> [GTK] Unreviewed build fix for Clang 10 * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp: (webkitInputMethodContextImplGtkGetPreedit): Use the "f" suffix to make constants float to prevent a narrowing double-to-float narrowing issue which Clang 10 considers an error. This only happens with GTK4 because GdkRGBA now has float members. Using float constants is fine with GTK3, because promoting floats to doubles never loses precision. 2020-04-28 Daniel Bates <dabates@apple.com> [iOS] Marked text editor state only needs to be set when layout is up-to-date https://bugs.webkit.org/show_bug.cgi?id=211087 Reviewed by Darin Adler. Organize the code to reflect reality: editor state only has marked text rects if layout is up-to-date. So, move these fields to from EditorState to EditorState::PostLayoutData. While I am in this area of the code I also moved the editor state originIdentifierForPasteboard to the top of the struct as it is aesthetically more pleasing to me to have the post layout data last. It likely also produces better bit packing though this wasn't my primary motivation. * Shared/EditorState.cpp: (WebKit::EditorState::encode const): (WebKit::EditorState::decode): (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): Move encoding and decoding of marked test fields from EditorState to EditorState::PostLayoutData. (WebKit::operator<<): Fix up code now that marked text fields are in PostLayoutData. * Shared/EditorState.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView textFirstRect]): Update code now that this data is in the post layout data struct. (-[WKContentView textLastRect]): Ditto. (-[WKContentView _updateChangedSelection:]): Ditto. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::convertContentToRootViewSelectionRects): Added. (WebKit::WebPage::getPlatformEditorState const): Update now that marked text fields are in the post layout data struct. Simplify the early return as well: only continue if we're not missing post layout data. If we're missing post layout data then we either do not have a frame view or layout is not up-to-data. Either way we don't want to do anything. I also stored the FrameView in a Ref<> to future proof the code should future code cause view detachment and destruction. Note that layout could cause this, but the code currently covers this case. So, taking a Ref<> is about future proofing. (WebKit::WebPage::getRectsForGranularityWithSelectionOffset): Update to use convertContentToRootViewSelectionRects(). (WebKit::WebPage::getRectsAtSelectionOffsetWithText): Ditto. (WebKit::WebPage::requestAutocorrectionData): Use Vector::map() to convert the selection rects to from content to root view FloatRects. (WebKit::WebPage::convertSelectionRectsToRootView): Deleted. 2020-04-28 Per Arne Vollan <pvollan@apple.com> [iOS] Fix sandbox violation when uploading a file https://bugs.webkit.org/show_bug.cgi?id=210937 Reviewed by Darin Adler. On iOS, the file chooser needs access to frontboard and icon services in the WebContent process. Create and consume extensions for these services when choosing files. When done, the extensions should be revoked. This patch also fixes an out-of-bounds array exception when running the test created for this patch. Additionally, the function thumbnailSizedImageForImage should return a RetainPtr<UIImage>, since it seems unsafe to not retain the UIImage after the image context is released in that function. Test: fast/forms/file/open-file-panel-crash.html * Shared/ios/WebIconUtilities.h: * Shared/ios/WebIconUtilities.mm: (WebKit::thumbnailSizedImageForImage): (WebKit::fallbackIconForFile): (WebKit::iconForImageFile): (WebKit::iconForVideoFile): (WebKit::iconForFile): * UIProcess/WebPageProxy.cpp: * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[_WKFileUploadItem displayImage]): (-[_WKImageFileUploadItem displayImage]): (-[_WKVideoFileUploadItem displayImage]): (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]): (-[WKFileUploadPanel imagePickerController:didFinishPickingMediaWithInfo:]): (-[WKFileUploadPanel imagePickerController:didFinishPickingMultipleMediaWithInfo:]): * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::createIconForFiles): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-04-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add support for motion events https://bugs.webkit.org/show_bug.cgi?id=211073 Reviewed by Adrian Perez de Castro. Handle enter, leave and motion events using a GtkEventControllerMotion. * Shared/NativeWebMouseEvent.h: * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebMouseEvent): * Shared/gtk/WebEventFactory.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseEnter): (webkitWebViewBaseMotion): (webkitWebViewBaseLeave): (webkitWebViewBaseConstructed): 2020-04-28 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes late April 2020 edition https://bugs.webkit.org/show_bug.cgi?id=211099 Unreviewed build fix. * NetworkProcess/NetworkLoad.cpp: Add mising WebCoreArgumentCoders.h header. * WebProcess/Automation/WebAutomationDOMWindowObserver.cpp: (WebKit::WebAutomationDOMWindowObserver::WebAutomationDOMWindowObserver): Add namespace to WebCore::DOMWindow usage. 2020-04-26 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Add support for scroll events https://bugs.webkit.org/show_bug.cgi?id=211045 Reviewed by Adrian Perez de Castro. Use an event controller to connect to scroll signal and get the GdkEvent. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseHandleWheelEvent): (webkitWebViewBaseScroll): (webkitWebViewBaseConstructed): 2020-04-28 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4][Wayland] Add support for rendering web view contents https://bugs.webkit.org/show_bug.cgi?id=211021 Reviewed by Adrian Perez de Castro. Implement GtkWidgetClass::snapshot and GtkWidgetClass::measure instead of GtkWidgetClass::draw and GtkWidgetClass::get_preferred_width|height. Add AcceleratedBackingStore::snapshot() pure virtual to be used with GTK4 instead of AcceleratedBackingStore::paint(), and implement it for Wayland. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSnapshot): Call AcceleratedBackingStore::snapshot(). (webkitWebViewBaseMeasure): Return the natural width/height for the WebView. (webkit_web_view_base_class_init): Add implementations for snapshot and measure vfuncs. * UIProcess/gtk/AcceleratedBackingStore.h: * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext): Always try to realize the context here, since that can fail too. (WebKit::AcceleratedBackingStoreWayland::tryEnsureTexture): Helper to share the code to prepare the texture. (WebKit::AcceleratedBackingStoreWayland::downloadTexture): Helper to share the code to download the texture. (WebKit::AcceleratedBackingStoreWayland::snapshot): Use gtk_snapshot_append_texture(). (WebKit::AcceleratedBackingStoreWayland::paint): Use new helpers. * UIProcess/gtk/AcceleratedBackingStoreWayland.h: * UIProcess/gtk/AcceleratedBackingStoreX11.cpp: (WebKit::AcceleratedBackingStoreX11::snapshot): * UIProcess/gtk/AcceleratedBackingStoreX11.h: * UIProcess/gtk/HardwareAccelerationManager.cpp: (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Force accelerated compositing mode for GTK4. 2020-04-27 Devin Rousso <drousso@apple.com> Web Inspector: Storage: can see third-party cookies https://bugs.webkit.org/show_bug.cgi?id=211092 <rdar://problem/62469078> Reviewed by Chris Dumez. Test: http/tests/inspector/page/get-cookies.html After r259649, Web Inspector no longer incorrectly bails when attempting to get cookies if the last resource loaded by a given frame does not have cookie access. We also need to check whether the resource we're attempting to get cookies for is first-party or third-party so as to reflect the current cookie policy. * WebProcess/WebPage/WebCookieJar.cpp: (WebKit::shouldBlockCookies): 2020-04-27 Brent Fulgham <bfulgham@apple.com> Follow-up change after r260798. Allow iOS to consume the 'com.apple.cfprefsd.agent' endpoint if issued by the UIProcess. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-27 Brent Fulgham <bfulgham@apple.com> [MacCatalyst] Dynamic access to accessibility services is incomplete https://bugs.webkit.org/show_bug.cgi?id=211100 <rdar://problem/62133491> Reviewed by Darin Adler. Testing of MacCatalyst-based apps shows that using dynamic sandbox extensions to support accessibility features is incomplete. In addition to the 'com.apple.cfprefsd.daemon' process needed on macOS and iOS, we also need access to 'com.apple.cfprefsd.agent'. This can only be tested manually in a MacCatlyst build, though existing accessibility tests will confirm no regressions in iOS and macOS. The changes are as follows: 1. Change WebProcessCreationParameters::preferencesExtensionHandle to a handle array. 2. Register (and unregister) for the accessibility enabled notification in MacCatalyst. 3. Open a connection 'com.apple.cfprefsd.agent' (in addition to the existing 'com.apple.cfprefsd.daemon') in MacCatalyst builds. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::unblockPreferenceServiceIfNeeded): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::unblockPreferenceService): * WebProcess/com.apple.WebProcess.sb.in: 2020-04-27 Wenson Hsieh <wenson_hsieh@apple.com> Prevent WebPasteboardProxy IPC messages from unconditionally requesting pasteboard types https://bugs.webkit.org/show_bug.cgi?id=211061 <rdar://problem/62088185> Reviewed by Tim Horton. Tighten IPC message handling in WebPasteboardProxy, such that a web content process is unable to arbitrarily request pasteboard types (and other metadata that depends on pasteboard types, such as the number of files on the pasteboard). This extends the mechanisms added in r259151 by distinguishing between allowing the web process to request type information from the pasteboard, and allowing the web process to request both types and data. In the case of drag and drop, the former is required by the web process from the moment the drag session enters the platform web view; however, the latter is required only after a drop is performed. We utilize this new check, `canAccessPasteboardTypes`, in seven existing IPC message handlers that either directly return the list of types, or return metadata from which pasteboard types may be deduced. See below for more details; covered by existing API and layout tests. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::grantAccessToCurrentTypes): (WebKit::WebPasteboardProxy::grantAccessToCurrentData): Split the pasteboard access check into two helpers: one to determine whether the web process is allowed to request pasteboard types, and another to determine whether the web process is allowed to request pasteboard data (in addition to types). (WebKit::WebPasteboardProxy::grantAccess): (WebKit::WebPasteboardProxy::revokeAccess): Refactor these to use `PasteboardAccessInformation`; see below for more details. (WebKit::WebPasteboardProxy::canAccessPasteboardTypes const): Return true as long as the accessType is nonnull; this is because either `Types` or `TypesAndData` is sufficient for access to pasteboard types. (WebKit::WebPasteboardProxy::canAccessPasteboardData const): (WebKit::WebPasteboardProxy::accessType const): Add a private helper method to return the access type (`nullopt` for no access, `PasteboardAccessType::Types` for access to types only, and `PasteboardAccessType::TypesAndData` for access to data in addition to types) for the given named pasteboard. (WebKit::WebPasteboardProxy::didModifyContentsOfPasteboard): Refactor this to use `PasteboardAccessInformation`. (WebKit::WebPasteboardProxy::getPasteboardTypes): (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType): Adopt canAccessPasteboardTypes here, and update the FIXME to state that we should really be using canAccessPasteboardData instead. This is blocked on refactoring some more drag and drop code, such that accessing the list of file names on the pasteboard isn't necessary before the drop is handled. (WebKit::WebPasteboardProxy::containsURLStringSuitableForLoading): (WebKit::WebPasteboardProxy::getNumberOfFiles): (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): (WebKit::WebPasteboardProxy::allPasteboardItemInfo): (WebKit::WebPasteboardProxy::informationForItemAtIndex): (WebKit::WebPasteboardProxy::getPasteboardItemsCount): (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType): Adopt the canAccessPasteboardTypes check in various places. (WebKit::WebPasteboardProxy::PasteboardAccessInformation::grantAccess): (WebKit::WebPasteboardProxy::PasteboardAccessInformation::revokeAccess): (WebKit::WebPasteboardProxy::PasteboardAccessInformation::accessType const): Introduce PasteboardAccessInformation, which replaces the current `std::pair<uint64_t, WeakHashSet<WebProcessProxy>>` that is used to represent which web processes are allowed to access certain changeCounts, for a given pasteboard name. Instead of maintaining a changeCount and set of processes, we now maintain a changeCount and list of (process, access type) pairs. Each item in this list tracks whether the process that has been granted access should be allowed to read only pasteboard types, or both types and data. (WebKit::WebPasteboardProxy::revokeAccessToAllData): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dragEntered): (WebKit::WebPageProxy::dragUpdated): When updating the drag session (i.e. as the user drags over the web view), ensure that the web content process is able to request pasteboard types. * UIProcess/WebPasteboardProxy.cpp: (WebKit::WebPasteboardProxy::allPasteboardItemInfo): (WebKit::WebPasteboardProxy::informationForItemAtIndex): (WebKit::WebPasteboardProxy::getPasteboardItemsCount): (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType): (WebKit::WebPasteboardProxy::containsURLStringSuitableForLoading): Update these method signatures. * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: Mark more IPC messages as `WantsConnection` so that we can use the `IPC::Connection` argument in the message handlers. 2020-04-27 Alex Christensen <achristensen@webkit.org> Stop waiting for a BinarySemaphore on the main thread in the NetworkProcess https://bugs.webkit.org/show_bug.cgi?id=211080 <rdar://problem/62377357> Reviewed by Darin Adler and Chris Dumez. There was an out-of-date comment suggesting we needed to use a semaphore, but we've since added these in the destructor: RELEASE_ASSERT(!m_statisticsStore); RELEASE_ASSERT(!m_persistentStorage); This indicates that flushAndDestroyPersistentStore is called before the destructor, at which time it is safe to add a reference to keep it alive. WebResourceLoadStatisticsStore is also marked as WTF::DestructionThread::Main so this should do everything we need. We also flush these databases to disk before closing like we did cookies. In order to keep tests working as they are, I needed to make recreateResourceLoadStatisticStore have a CompletionHandler and have all WebResourceLoadStatisticsStores share the same queue to serialize background tasks between WebResourceLoadStatisticsStores with and without database stores sequentially to avoid opening a SQLiteDatabase before the previous WebResourceLoadStatisticsStore had closed it. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::sharedStatisticsQueue): (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession): (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore): (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::~NetworkSession): (WebKit::NetworkSession::destroyResourceLoadStatistics): (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): (WebKit::NetworkSession::recreateResourceLoadStatisticStore): * NetworkProcess/NetworkSession.h: 2020-04-27 Alex Christensen <achristensen@webkit.org> Fix tests after r260764 https://bugs.webkit.org/show_bug.cgi?id=211093 Some tests were asserting in takeAsyncReplyHandler. Calling addAsyncReplyHandler before sending the message fixes it. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::sendMessage): 2020-04-27 Chris Dumez <cdumez@apple.com> [iOS][WK2] Drop "com.apple.WebKit.DatabaseActivity" UIKit background activity https://bugs.webkit.org/show_bug.cgi?id=211084 Reviewed by Geoffrey Garen. Drop "com.apple.WebKit.DatabaseActivity" UIKit background activity in the UIProcess now that local storage has been moved to the network process. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView _setUpSQLiteDatabaseTrackerClient]): Deleted. 2020-04-27 Ryan Haddad <ryanhaddad@apple.com> [Cocoa] stop using out arguments for document attributes when converting to attributed strings https://bugs.webkit.org/show_bug.cgi?id=211048 Unreviewed partial revert of r260739 to remove unexpected logging that broke Catalina-Release-WK2-Perf tests. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::updateTaskWithFirstPartyForSameSiteCookies): 2020-04-27 David Kilzer <ddkilzer@apple.com> REGRESSION (r219050): Remove more code only needed for building with OS X Yosemite <https://webkit.org/b/211088> <rdar://problem/62452487> Reviewed by Chris Dumez. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::receiveSourceEventHandler): * Platform/mac/MachUtilities.cpp: (setMachPortQueueLength): (machExceptionPort): Deleted. (setMachExceptionPort): Deleted. * Platform/mac/MachUtilities.h: - Delete unused code. 2020-04-27 Per Arne Vollan <pvollan@apple.com> [Cocoa] After r258891, r255119 can be reverted https://bugs.webkit.org/show_bug.cgi?id=211083 Unreviewed revert of r255119. * 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): 2020-04-27 Brent Fulgham <bfulgham@apple.com> Unreviewed MacCatalyst build fix after r260739. * UIProcess/Cocoa/TextCheckingController.mm: (WebKit::TextCheckingController::replaceRelativeToSelection): * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: 2020-04-27 Darin Adler <darin@apple.com> Another try at fixing the ENABLE(PLATFORM_DRIVEN_TEXT_CHECKING) build * UIProcess/Cocoa/TextCheckingController.mm: (WebKit::TextCheckingController::replaceRelativeToSelection): Convert an NSAttributedString to a WebCore::AttributedString using argument list syntax. 2020-04-27 Alex Christensen <achristensen@webkit.org> Fix assertion after r260709 https://bugs.webkit.org/show_bug.cgi?id=211007 <rdar://problem/62457303> * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performJavaScriptURLRequest): Not only did I spell javascript wrong, I should've used the special protocolIsJavaScript() method. 2020-04-27 Alex Christensen <achristensen@webkit.org> Reduce use of WebPageProxy::VoidCallback https://bugs.webkit.org/show_bug.cgi?id=210944 Reviewed by Darin Adler. Use sendWithAsyncReply and CompletionHandler<void()> instead. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _executeEditCommand:argument:completion:]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::becomeFirstResponder): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setInitialFocus): (WebKit::WebPageProxy::executeEditCommand): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::focusNextFocusedElement): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView pasteWithCompletionHandler:]): (-[WKContentView moveByOffset:]): (-[WKContentView _selectPositionAtPoint:stayingWithinFocusedElement:completionHandler:]): (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]): (-[WKContentView moveSelectionAtBoundary:inDirection:completionHandler:]): (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]): (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): (-[WKContentView accessoryTab:]): (-[WKContentView executeEditCommandWithCallback:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::selectTextWithGranularityAtPoint): (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection): (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection): (WebKit::WebPageProxy::selectPositionAtPoint): (WebKit::WebPageProxy::moveSelectionByOffset): (WebKit::WebPageProxy::focusNextFocusedElement): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::executeEditCommandWithCallback): (WebKit::WebPage::setInitialFocus): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::moveSelectionByOffset): (WebKit::WebPage::selectPositionAtPoint): (WebKit::WebPage::selectPositionAtBoundaryWithDirection): (WebKit::WebPage::moveSelectionAtBoundaryWithDirection): (WebKit::WebPage::selectTextWithGranularityAtPoint): (WebKit::WebPage::focusNextFocusedElement): 2020-04-27 Per Arne Vollan <pvollan@apple.com> Unreviewed sandbox compile fix. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-27 Philippe Normand <pnormand@igalia.com> [GTK] ENABLE(OPENGL) remmants... https://bugs.webkit.org/show_bug.cgi?id=211077 Reviewed by Adrian Perez de Castro. ENABLE(OPENGL) was renamed to ENABLE(GRAPHICS_CONTEXT_GL) in r254064 but not in all the code base... * UIProcess/gtk/HardwareAccelerationManager.cpp: (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): 2020-04-27 Daniel Bates <dabates@apple.com> Caret may be placed in the wrong spot for text input context that is a form control https://bugs.webkit.org/show_bug.cgi?id=210939 <rdar://problem/61943089> Reviewed by Darin Adler. Find the closest editable position in the element for the point using the newly introduced closestEditablePositionInElementForAbsolutePoint(). * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::focusTextInputContextAndPlaceCaret): 2020-04-27 Darin Adler <darin@apple.com> Fix ENABLE(PLATFORM_DRIVEN_TEXT_CHECKING) build * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Change "class AttributedString" to "struct AttributedString". 2020-04-27 Philippe Normand <pnormand@igalia.com> [WPE] about:gpu page is incomplete https://bugs.webkit.org/show_bug.cgi?id=211076 Reviewed by Adrian Perez de Castro. ENABLE(OPENGL) was renamed to ENABLE(GRAPHICS_CONTEXT_GL) in r254064 but not in all the code base... * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleGPU): 2020-04-26 Darin Adler <darin@apple.com> Replace more uses of live ranges with SimpleRange https://bugs.webkit.org/show_bug.cgi?id=211058 Reviewed by Antti Koivisto. * Shared/API/Cocoa/WKDataDetectorTypesInternal.h: (fromWKDataDetectorTypes): Updated since DataDetectorTypes is now an enum class. Also got rid of special "none" and "all" values. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: (-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Updated since DataDetection now takes a SimpleRange. * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales): Use SimpleRange. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::detectDataInAllFrames): Ditto. * WebProcess/WebPage/WebPage.h: Removed unneeded include of DataDetection.h. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performImmediateActionHitTestAtLocation): Use SimpleRange. 2020-04-27 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Make it possible to build with GTK4 without errors https://bugs.webkit.org/show_bug.cgi?id=210967 Reviewed by Adrian Perez de Castro. Add ifdefs when needed to make it possible to complete a build with GTK4. This way we can continue working on every feature individually and checking it actually works. Move public headers containing API specific to GTK3 and GTK4 into their own gtk3 and gtk4 directory. * PlatformGTK.cmake: * Shared/API/glib/WebKitContextMenuItem.cpp: * Shared/NativeWebKeyboardEvent.h: * Shared/NativeWebMouseEvent.h: * Shared/NativeWebWheelEvent.h: * Shared/glib/WebContextMenuItemGlib.cpp: (WebKit::WebContextMenuItemGlib::WebContextMenuItemGlib): (WebKit::WebContextMenuItemGlib::buildActionName const): (WebKit::WebContextMenuItemGlib::createActionIfNeeded): * Shared/glib/WebContextMenuItemGlib.h: * Shared/gtk/NativeWebKeyboardEventGtk.cpp: * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): * Shared/gtk/NativeWebTouchEventGtk.cpp: (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): * Shared/gtk/NativeWebWheelEventGtk.cpp: * Shared/gtk/WebEventFactory.cpp: (WebKit::buttonForEvent): (WebKit::WebEventFactory::createWebMouseEvent): (WebKit::WebEventFactory::createWebKeyboardEvent): (WebKit::WebEventFactory::createWebTouchEvent): * Shared/gtk/WebEventFactory.h: * SourcesGTK.txt: * UIProcess/API/C/WKNativeEvent.h: * UIProcess/API/glib/InputMethodFilter.cpp: (WebKit::InputMethodFilter::filterKeyEvent): * UIProcess/API/glib/InputMethodFilter.h: * UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp: (createGstInstallPluginsContext): * UIProcess/API/glib/WebKitPrivate.cpp: * UIProcess/API/glib/WebKitUIClient.cpp: (UIClient::setWindowFrameTimerFired): * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextGetProperty): (webkitWebContextSetProperty): (webkit_web_context_class_init): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewRunAsModal): (webkitWebViewPopulateContextMenu): * UIProcess/API/gtk/InputMethodFilterGtk.cpp: (WebKit::InputMethodFilter::platformEventKeyIsKeyPress const): * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::setViewNeedsDisplay): (WebKit::PageClientImpl::setCursor): (WebKit::PageClientImpl::doneWithKeyEvent): (WebKit::PageClientImpl::createPopupMenuProxy): (WebKit::PageClientImpl::createDataListSuggestionsDropdown): (WebKit::PageClientImpl::startDrag): (WebKit::PageClientImpl::doneWithTouchEvent): (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: * UIProcess/API/gtk/WebKitAuthenticationDialog.h: * UIProcess/API/gtk/WebKitEmojiChooser.cpp: * UIProcess/API/gtk/WebKitEmojiChooser.h: * UIProcess/API/gtk/WebKitInputMethodContextGtk.cpp: (webkit_input_method_context_filter_key_event): * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp: (webkitInputMethodContextImplGtkFilterKeyEvent): (webkitInputMethodContextImplGtkSetClientWindow): * UIProcess/API/gtk/WebKitPopupMenu.cpp: (WebKit::WebKitPopupMenu::WebKitPopupMenu): (WebKit::WebKitPopupMenu::showPopupMenu): (WebKit::WebKitPopupMenu::hidePopupMenu): (WebKit::WebKitPopupMenu::cancelTracking): * UIProcess/API/gtk/WebKitPopupMenu.h: * UIProcess/API/gtk/WebKitPrintOperation.cpp: * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp: (webkitScriptDialogAccept): (webkitScriptDialogDismiss): (webkitScriptDialogSetUserInput): * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: * UIProcess/API/gtk/WebKitScriptDialogImpl.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (ClickCounter::currentClickCountForGdkButtonEvent): (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate): (webkitWebViewBaseSetToplevelOnScreenWindow): (webkitWebViewBaseRealize): (webkitWebViewBaseContainerForall): (webkitWebViewBaseDispose): (webkitWebViewBaseConstructed): (webkitWebViewBaseSizeAllocate): (webkitWebViewBaseKeyPressEvent): (webkitWebViewBaseKeyReleaseEvent): (webkitWebViewBaseSetEnableBackForwardNavigationGesture): (webkitWebViewBaseBeginBackSwipeForTesting): (webkitWebViewBaseCompleteBackSwipeForTesting): (webkit_web_view_base_class_init): (webkitWebViewBaseWillSwapWebProcess): (webkitWebViewBaseDidExitWebProcess): (webkitWebViewBaseDidRelaunchWebProcess): (webkitWebViewBaseTakeViewSnapshot): (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame): (webkitWebViewBaseDidFinishLoadForMainFrame): (webkitWebViewBaseDidFailLoadForMainFrame): (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): (webkitWebViewBaseDidRestoreScrollPosition): (webkitWebViewBaseShowEmojiChooser): (webkitWebViewBaseRequestPointerLock): (webkitWebViewBaseDidLosePointerLock): (webkitWebViewBaseSynthesizeCompositionKeyPress): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/API/gtk/WebKitWebViewDialog.cpp: * UIProcess/API/gtk/WebKitWebViewDialog.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (webkitWebViewAuthenticate): (webkitWebViewScriptDialog): (webkitWebViewRunFileChooser): (webkitWebViewMaximizeWindow): (webkitWebViewMinimizeWindow): (webkitWebViewRestoreWindow): * UIProcess/API/gtk3/WebKitContextMenuItem.h: Copied from Source/WebKit/UIProcess/API/gtk/WebKitContextMenuItem.h. * UIProcess/API/gtk3/WebKitInputMethodContext.h: Copied from Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContext.h. * UIProcess/API/gtk4/WebKitContextMenuItem.h: Renamed from Source/WebKit/UIProcess/API/gtk/WebKitContextMenuItem.h. * UIProcess/API/gtk4/WebKitInputMethodContext.h: Renamed from Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContext.h. * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): (WebKit::WebAutomationSession::platformSimulateKeySequence): * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformSave): * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformSave): * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp: (webkit_inspector_window_init): (webkitInspectorWindowNew): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/cairo/BackingStoreCairo.cpp: (WebKit::BackingStore::createBackend): * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext): (WebKit::AcceleratedBackingStoreWayland::paint): * UIProcess/gtk/AcceleratedBackingStoreX11.cpp: (WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11): (WebKit::AcceleratedBackingStoreX11::update): * UIProcess/gtk/DragAndDropHandler.cpp: * UIProcess/gtk/DragAndDropHandler.h: * UIProcess/gtk/GestureController.cpp: * UIProcess/gtk/GestureController.h: * UIProcess/gtk/KeyBindingTranslator.cpp: (WebKit::KeyBindingTranslator::KeyBindingTranslator): (WebKit::KeyBindingTranslator::commandsForKeyEvent): * UIProcess/gtk/KeyBindingTranslator.h: * UIProcess/gtk/PointerLockManager.cpp: (WebKit::PointerLockManager::lock): (WebKit::PointerLockManager::unlock): * UIProcess/gtk/PointerLockManager.h: * UIProcess/gtk/PointerLockManagerWayland.cpp: (WebKit::PointerLockManagerWayland::lock): * UIProcess/gtk/PointerLockManagerX11.cpp: (WebKit::PointerLockManagerX11::didReceiveMotionEvent): * UIProcess/gtk/WebColorPickerGtk.cpp: * UIProcess/gtk/WebContextMenuProxyGtk.cpp: (WebKit::WebContextMenuProxyGtk::show): (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems): (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk): (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk): * UIProcess/gtk/WebContextMenuProxyGtk.h: * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h: * UIProcess/gtk/WebPageProxyGtk.cpp: * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: * UIProcess/gtk/WebPopupMenuProxyGtk.h: * WebProcess/Plugins/PluginController.h: * WebProcess/Plugins/PluginView.cpp: * WebProcess/Plugins/PluginView.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): (WebKit::WebPage::mainFrameDidLayout): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp: (WebKit::AcceleratedSurfaceX11::AcceleratedSurfaceX11): (WebKit::AcceleratedSurfaceX11::createPixmap): * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: (WebKit::WebPrintOperationGtk::print): 2020-04-27 Rob Buis <rbuis@igalia.com> Make loadURLIntoChildFrame private and non-exported https://bugs.webkit.org/show_bug.cgi?id=211051 Reviewed by Darin Adler. Adapt createFrame to strictly create a subframe and not load anything. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::createFrame): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-04-27 Ross Kirsling <ross.kirsling@sony.com> [JSC] CallData/ConstructData should include CallType/ConstructType https://bugs.webkit.org/show_bug.cgi?id=211059 Reviewed by Darin Adler. * WebProcess/Plugins/Netscape/JSNPObject.cpp: (WebKit::JSNPObject::getCallData): (WebKit::JSNPObject::getConstructData): * WebProcess/Plugins/Netscape/JSNPObject.h: * WebProcess/Plugins/Netscape/NPJSObject.cpp: (WebKit::NPJSObject::hasMethod): (WebKit::NPJSObject::construct): (WebKit::NPJSObject::invoke): 2020-04-27 Diego Pino Garcia <dpino@igalia.com> Unreviewed, reverting r260672. [GTK] WebInspector tests are timing out after r260672 Reverted changeset: "[Win] Bundle Inspector Resources in Release builds" https://bugs.webkit.org/show_bug.cgi?id=210942 https://trac.webkit.org/changeset/260672 2020-04-27 Diego Pino Garcia <dpino@igalia.com> Unreviewed, reverting r260696. Build fix after r260672, no needed since r260672 is also being reverted. Reverted changeset: "REGRESSION(210942): [GTK][WPE] Unreviewed, EWS build bots fail in compile-webkit step" https://bugs.webkit.org/show_bug.cgi?id=211014 https://trac.webkit.org/changeset/260696 2020-04-26 Darin Adler <darin@apple.com> [Cocoa] stop using out arguments for document attributes when converting to attributed strings https://bugs.webkit.org/show_bug.cgi?id=211048 Reviewed by Sam Weinig. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::updateTaskWithFirstPartyForSameSiteCookies): Use init instead of initWithString:@"". * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<WebCore::AttributedString>::encode): Moved here from AttributedString.mm. (IPC::ArgumentCoder<WebCore::AttributedString>::decode): Ditto. * Shared/DocumentEditingContext.h: Updated to use WebCore::AttributeString. * Shared/DocumentEditingContext.mm: (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::decode): Ditto. * Shared/WebCoreArgumentCoders.h: Added coder for WebCore::AttributedString. * Shared/mac/AttributedString.h: Removed. * Shared/mac/AttributedString.mm: Removed. * SourcesCocoa.txt: Removed AttributedString.mm. * UIProcess/API/Cocoa/WKWebView.mm: Updated to use WebCore::AttributedString. * UIProcess/Cocoa/TextCheckingController.mm: Ditto. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::attributedSubstringForProposedRange): Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::getContentsAsAttributedString): Ditto. * UIProcess/WebPageProxy.h: Ditto. * UIProcess/WebPageProxy.messages.in: Ditto. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync): Ditto. (WebKit::WebPageProxy::attributedStringForCharacterRangeCallback): Ditto. * WebKit.xcodeproj/project.pbxproj: Removed AttributedString.h and AttributedString.mm. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Updated to use WebCore::AttributedString. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: Ditto. * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection): Ditto. (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions): Ditto. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::dictionaryPopupInfoForRange): Updated since editingAttributedString returns a struct. (WebKit::WebPage::getContentsAsAttributedString): Updated to use SimpleRange and since attributedString returns a struct. * WebProcess/WebPage/WebPage.h: Updated to use WebCore::AttributedString. * WebProcess/WebPage/WebPage.messages.in: Ditto. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): Ditto. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): Ditto. (WebKit::WebPage::handleSelectionServiceClick): Ditto. 2020-04-26 Said Abou-Hallawa <sabouhallawa@apple.com> Rendering update steps should use Seconds for the timestamps https://bugs.webkit.org/show_bug.cgi?id=210990 Reviewed by Daniel Bates. * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp: (WebKit::CompositingCoordinator::timestamp const): 2020-04-26 Peng Liu <peng.liu6@apple.com> Remove unused class PlaybackSessionInterface https://bugs.webkit.org/show_bug.cgi?id=211031 Reviewed by Daniel Bates. * WebProcess/cocoa/PlaybackSessionManager.h: 2020-04-11 Darin Adler <darin@apple.com> Stop using live ranges in functions that return range of the selection https://bugs.webkit.org/show_bug.cgi?id=210396 Reviewed by Sam Weinig. * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: (WebKit::WebEditorClient::updateGlobalSelection): Remove use of live range. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::dictionaryPopupInfoForRange): Updated for changes to attributedString functions. (WebKit::WebPage::getContentsAsAttributedString): Ditto. * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): Use createLiveRange. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::getSelectedRangeAsync): Ditto. (WebKit::WebPage::currentSelectionAsRange): Ditto. * WebProcess/WebPage/WebPage.h: Change m_rangeForDropSnapshot to use a SimpleRange instead of a live range. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::plainTextForContext): Overloaded for SimpleRange and Optional<SimpleRange> as needed by code below. (WebKit::plainTextForDisplay): Ditto. (WebKit::WebPage::getPlatformEditorState const): Use createLiveRange. (WebKit::WebPage::getSelectionContext): Remove use of live range. (WebKit::WebPage::didConcludeDrop): Ditto. (WebKit::WebPage::didConcludeEditDrag): Use createLiveRange. (WebKit::WebPage::computeAndSendEditDragSnapshot): Ditto. (WebKit::WebPage::startAutoscrollAtPosition): Remove use of live range. (WebKit::WebPage::requestEvasionRectsAboveSelection): Use createLiveRange. (WebKit::WebPage::requestDictationContext): Remove use of live range. (WebKit::WebPage::replaceSelectedText): Use createLiveRange. (WebKit::WebPage::applyAutocorrectionInternal): Ditto. (WebKit::WebPage::autocorrectionContext): Remove use of live range. (WebKit::WebPage::requestDocumentEditingContext): Use createLiveRange. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::getPlatformEditorState const): Remove use of live range. (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): Updated for change to HTMLConverter functions. (WebKit::WebPage::handleSelectionServiceClick): Ditto. (WebKit::WebPage::performImmediateActionHitTestAtLocation): Remove use of live range. 2020-04-25 Alex Christensen <achristensen@webkit.org> Fix internal iOS build. https://bugs.webkit.org/show_bug.cgi?id=210521 * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformBeginApplePaySetup): 2020-04-25 Alex Christensen <achristensen@webkit.org> Move ApplePay code from WebKitAdditions to WebCore and WebKit https://bugs.webkit.org/show_bug.cgi?id=210521 2020-04-25 Alex Christensen <achristensen@webkit.org> Move ApplePay code from WebKitAdditions to WebCore and WebKit https://bugs.webkit.org/show_bug.cgi?id=210521 Reviewed by Andy Estes. * DerivedSources.make: * Scripts/webkit/messages.py: * Shared/ApplePay/ApplePayPaymentSetupFeatures.h: Added. (WebKit::PaymentSetupFeatures::platformFeatures const): * Shared/ApplePay/ApplePayPaymentSetupFeatures.mm: Added. (WebKit::PaymentSetupFeatures::PaymentSetupFeatures): (WebKit::PaymentSetupFeatures::encode const): (WebKit::PaymentSetupFeatures::decode): (WebKit::PaymentSetupFeatures::operator Vector<Ref<WebCore::ApplePaySetupFeature>> const): * Shared/ApplePay/PaymentSetupConfiguration.h: Added. (WebKit::PaymentSetupConfiguration::platformConfiguration const): * Shared/ApplePay/PaymentSetupConfiguration.mm: Added. (WebKit::toPlatformConfiguration): (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration): (WebKit::PaymentSetupConfiguration::encode const): (WebKit::PaymentSetupConfiguration::decode): * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: (WebKit::WebPaymentCoordinatorProxy::finishConstruction): Deleted. * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/ApplePay/cocoa/PaymentSetupConfiguration.mm: Added. (WebKitAdditions::toPlatformConfiguration): (WebKitAdditions::PaymentSetupConfiguration::PaymentSetupConfiguration): (WebKitAdditions::PaymentSetupConfiguration::encode const): (WebKitAdditions::PaymentSetupConfiguration::decode): * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::finishCreating): (WebKit::WebPaymentCoordinatorProxy::getSetupFeatures): (WebKit::WebPaymentCoordinatorProxy::beginApplePaySetup): (WebKit::WebPaymentCoordinatorProxy::endApplePaySetup): (WebKit::WebPaymentCoordinatorProxy::platformBeginApplePaySetup): (WebKit::WebPaymentCoordinatorProxy::platformEndApplePaySetup): * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::finishDecoding): (IPC::finishEncoding): (IPC::ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::encode): (IPC::ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::decode): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::getSetupFeatures): (WebKit::WebPaymentCoordinator::beginApplePaySetup): (WebKit::WebPaymentCoordinator::endApplePaySetup): * WebProcess/ApplePay/WebPaymentCoordinator.h: 2020-04-25 Darin Adler <darin@apple.com> [Cocoa] Deal with another round of Xcode upgrade checks https://bugs.webkit.org/show_bug.cgi?id=211027 Reviewed by Alexey Proskuryakov. * WebKit.xcodeproj/project.pbxproj: Bump the upgrade check version. Add a base localization. 2020-04-25 Alex Christensen <achristensen@webkit.org> Prepare to remove automatic URL->String conversion operators https://bugs.webkit.org/show_bug.cgi?id=211007 Reviewed by Darin Adler. * Shared/API/APIError.h: (API::Error::failingURL const): * Shared/API/c/WKSharedAPICast.h: (WebKit::toCopiedURLAPI): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (setUpPagePolicyClient): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::reportAnErrorURL): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::requestUserMediaAuthorizationForFrame): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::readURLFromPasteboard): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::cancel): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didExplicitOpenForFrame): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::createNewPage): * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: (-[WKWebProcessPlugInFrame URL]): * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::didReceiveResponse): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): (WebKit::PDFPlugin::openWithNativeApplication): * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performURLRequest): (WebKit::PluginView::performJavaScriptURLRequest): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect): (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::info const): * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::setItem): (WebKit::StorageAreaMap::removeItem): (WebKit::StorageAreaMap::clear): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::origin): 2020-04-25 Darin Adler <darin@apple.com> Move URL to use StringView when returning substrings of the URL https://bugs.webkit.org/show_bug.cgi?id=210431 Reviewed by Anders Carlsson. * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::checkRedirection): Use hasCredentials. (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const): Remove use of ASCIILiteral for setProtocol. * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Updated for password name change. (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): Ditto. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Updated for password name change. (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): Ditto. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Updated for password name change. (WebKit::NetworkDataTaskSoup::applyAuthenticationToRequest): Ditto. (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Ditto. (WebKit::NetworkDataTaskSoup::shouldAllowHSTSPolicySetting const): Use != to compare hosts, rather than hostsAreEqual. (WebKit::NetworkDataTaskSoup::shouldAllowHSTSProtocolUpgrade const): Refactored to use || to match the function above. * Shared/API/APIURL.h: (API::URL::host const): Removed validity check; WTF::URL::host returns null if the URL is invalid. (API::URL::protocol const): Ditto. (API::URL::path const): Ditto. (API::URL::lastPathComponent const): Ditto. Also added toString since WTF::URL::lastPathComponent now returns a StringView. * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didFinish): Use hasFragmentIdentifier. * UIProcess/DeviceIdHashSaltStorage.cpp: (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk): Refactored a bit and use fileURLWithFileSystemPath and updated since lastPathComponent returns a StringView. * UIProcess/Plugins/PluginInfoStore.cpp: (WebKit::pathExtension): Updated since lastPathComponent returns a StringView. Refactored a little. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): Use truncatedForUseAsBase. (WebKit::WebPageProxy::decidePolicyForNavigationAction): Use != to compare hosts, rather than hostsAreEqual. (WebKit::WebPageProxy::decidePolicyForNewWindowAction): Ditto. (WebKit::WebPageProxy::createNewPage): Ditto. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::assumeReadAccessToBaseURL): Use truncatedForUseAsBase. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::initializeAppBoundDomains): Don't use ASCIILiteral for argument to setProtocol. * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins): Use fileURLWithFileSystemPath, also refactored a bit. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::installPDFDocument): Updated since fragmentIdentifier returns a StringView. * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::searchWithGoogle): Streamlined the implementation a bit. * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): Updated since lastPathComponent returns a StringView. 2020-04-25 David Kilzer <ddkilzer@apple.com> IPC::Decoder::isInvalid() should be renamed to isValid() <https://webkit.org/b/211000> Reviewed by Darin Adler. Negative logic is more difficult to reason about than positive logic. * Platform/IPC/Connection.cpp: (IPC::Connection::dispatchMessage): (IPC::Connection::dispatchWorkQueueMessageReceiverMessage): (IPC::Connection::dispatchThreadMessageReceiverMessage): (IPC::Connection::dispatchSyncMessage): * Platform/IPC/Connection.h: (IPC::Connection::sendWithAsyncReply): * Platform/IPC/Decoder.cpp: (IPC::Decoder::create): * Platform/IPC/Decoder.h: (IPC::Decoder::isValid const): Rename from isInvalid() and invert logic. (IPC::Decoder::isInvalid const): Rename to isValid(). * Platform/IPC/MessageSender.h: * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply): - Change Decoder::isInvalid() to Decoder::isValid() and reverse the Boolean logic. 2020-04-25 Diego Pino Garcia <dpino@igalia.com> REGRESSION(210942): [GTK][WPE] EWS build bots fail in compile-webkit step https://bugs.webkit.org/show_bug.cgi?id=211014 Make command that generates 'InspectorGResourceBundle.xml' depend on target WebInspectorUI, instead of file 'inspector-resources.stamp'. * InspectorGResources.cmake: 2020-04-24 Diego Pino Garcia <dpino@igalia.com> [WPE][Debug] Unreviewed, fix build after r260063 https://bugs.webkit.org/show_bug.cgi?id=211009 r260063 removed include of WebProcess.h in WebSocketProvider.cpp, which broke unified builds in WPE Debug. * WebProcess/Network/WebSocketProvider.cpp: 2020-04-24 David Kilzer <ddkilzer@apple.com> WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle() <https://webkit.org/b/211002> Reviewed by Wenson Hsieh. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::getPasteboardBufferForType): (WebKit::WebPasteboardProxy::readBufferFromPasteboard): - Check result of SharedMemory::createHandle() and return early on failure. 2020-04-24 Chris Dumez <cdumez@apple.com> [iOS] Unable to sign up on twitter.com https://bugs.webkit.org/show_bug.cgi?id=211003 <rdar://problem/58804852> Reviewed by Darin Adler. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/ios/WKApplicationStateTrackingView.mm: (-[WKApplicationStateTrackingView _willBeginSnapshotSequence]): (-[WKApplicationStateTrackingView _didCompleteSnapshotSequence]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setShouldFireEvents): (WebKit::WebPage::setShouldFireResizeEvents): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-04-24 Christopher Reid <chris.reid@sony.com> [Win] Bundle Inspector Resources in Release builds https://bugs.webkit.org/show_bug.cgi?id=210942 Reviewed by Fujii Hironori. Move CMake logic for the inspector resource copy script to Source/WebInspectorUI so it can be shared with Win and other platforms. * InspectorGResources.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: 2020-04-24 Kate Cheney <katherine_cheney@apple.com> Removing website data for a domain should delete corresponding ITP entry https://bugs.webkit.org/show_bug.cgi?id=210864 <rdar://problem/59473193> Reviewed by John Wilander. Tests: http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-database.html http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration.html http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-mixed-statistics-entries-database.html http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-mixed-statistics-entries.html http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-database.html http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads.html In the database store: deletes domain from the ObservedDomains table when website data is deleted for that domain. This deletes every instance of the domainID in the database due to cascading deletions. In the memory store: deletes every instance of the domain in the statistics map, which will update the plist. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::removeDataForDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::domainIDExistsInDatabase): Needed a new function to check for the existence of domainID in any table. Existing queries rely on the ObservedDomains entry, which means testing using those could result in a false positive if the domainID was deleted from ObservedDomains but is floating around in another table. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::removeDataForDomain): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::domainIDExistsInDatabase): (WebKit::WebResourceLoadStatisticsStore::removeDataForDomain): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::domainIDExistsInDatabase): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): Pass RegistrableDomains vector to deleteWebsiteDataForOrigins, captured based on the WebsiteData display name. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreRemoveITPDataForDomain): (WKWebsiteDataStoreDoesStatisticsDomainIDExistInDatabase): * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins): (WebKit::NetworkProcessProxy::domainIDExistsInDatabase): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::removeData): (WebKit::WebsiteDataStore::domainIDExistsInDatabase): * UIProcess/WebsiteData/WebsiteDataStore.h: 2020-04-24 David Kilzer <ddkilzer@apple.com> Use CocoaImage platform abstraction for NSImage/UIImage <https://webkit.org/b/210974> Reviewed by Darin Adler. * Platform/cocoa/CocoaImage.h: Add. - Define CocoaImage here for cross-platform use. Don't use OBJC_CLASS() here because this is an Objective-C header. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): - Combine separate platform-specific methods into one method. * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: - Combine separate platform-specific instance variables into one instance variable. (-[_WKActivatedElementInfo image]): - Combine separate methods into one platform-specific method. * UIProcess/QuickLookThumbnailLoader.h: - Move cross-platform definition to CocoaImge.h. * UIProcess/QuickLookThumbnailLoader.mm: - Drive-by fix of soft-linking header include order. * WebKit.xcodeproj/project.pbxproj: - Add CocoaImage.h to the project. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm: (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:]): (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:width:]): - Combine separate platform-specific methods into one method. 2020-04-24 David Kilzer <ddkilzer@apple.com> IPC::Decoder should use create() pattern <https://webkit.org/b/210949> <rdar://problem/62144409> Reviewed by Geoffrey Garen. * Platform/IPC/Decoder.cpp: (IPC::Decoder::create): Add implementation. Returns nullptr if Decoder constructor returns an invalid object. (IPC::Decoder::Decoder): Mark invalid if m_buffer is not 64-bit aligned. (IPC::Decoder::unwrapForTesting): Switch to Decoder::create(). * Platform/IPC/Decoder.h: (IPC::Decoder::create): Add declaration. (IPC::Decoder::Decoder): Make explicit. (Can't be made private since we use std::unique_ptr<Decoder>.) * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::createMessageDecoder): Switch to Decoder::create(). 2020-04-24 Tim Horton <timothy_horton@apple.com> iPad: "Pocket City" interaction does not work with trackpad https://bugs.webkit.org/show_bug.cgi?id=210985 <rdar://problem/62273077> Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shouldUseMouseGestureRecognizer]): Add another app to the list who fall back to touch event synthesis until rebuilt. 2020-04-24 Alex Christensen <achristensen@webkit.org> SPI clients using fastServerTrustEvaluationEnabled need SPI to inform them of modern TLS negotiation https://bugs.webkit.org/show_bug.cgi?id=210533 Reviewed by Brady Eidson. * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTaskClient::didNegotiateModernTLS): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didNegotiateModernTLS): * NetworkProcess/NetworkLoad.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::didNegotiateModernTLS): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * UIProcess/API/APINavigationClient.h: (API::NavigationClient::didNegotiateModernTLS): * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::didNegotiateModernTLS): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didNegotiateModernTLS): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: 2020-04-24 Brian Burg <bburg@apple.com> Web Automation: timeout underneath Automation.evaluateJavaScriptFunction in Selenium test frame_switching_tests.py::testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs[Safari] https://bugs.webkit.org/show_bug.cgi?id=210162 <rdar://problem/60561009> Reviewed by Devin Rousso. When an iframe is detached from the DOM, it is no longer exposed as a browsing context and it's not possible to Evaluate JavaScript or perform other commands with it. This patch adds frame lifecycle monitoring so that pending script evaluations are cancelled with FrameNotFound as soon as the iframe is detached from the DOM. This change also avoids running more commands with the frame if it's detached from its DOMWindow and ready to be GC'd. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Automation/WebAutomationDOMWindowObserver.h: Added. * WebProcess/Automation/WebAutomationDOMWindowObserver.cpp: Added. (WebKit::WebAutomationDOMWindowObserver::WebAutomationDOMWindowObserver): (WebKit::WebAutomationDOMWindowObserver::~WebAutomationDOMWindowObserver): (WebKit::WebAutomationDOMWindowObserver::frame const): (WebKit::WebAutomationDOMWindowObserver::willDestroyGlobalObjectInCachedFrame): (WebKit::WebAutomationDOMWindowObserver::willDestroyGlobalObjectInFrame): (WebKit::WebAutomationDOMWindowObserver::willDetachGlobalObjectFromFrame): This class is a stripped-down copy of DOMWindowExtension, which is the only other client of DOMWindow::Observer interface. When a frame is detached, destroyed, or navigates (global object detached), then call the callback and unregister. * WebProcess/Automation/WebAutomationSessionProxy.h: * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::~WebAutomationSessionProxy): (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame): (WebKit::WebAutomationSessionProxy::willDestroyGlobalObjectForFrame): (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): (WebKit::WebAutomationSessionProxy::ensureObserverForFrame): For non-main frames, ensure we add a frame observer if we are about to evaluate JavaScript upon the frame. This acts as a watchdog in case the frame becomes detached while waiting for pending JS evaluations. When a frame is detached, the JS evaluation may or may not complete. (WebKit::WebAutomationSessionProxy::selectOptionElement): Fix hilarious typo. * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: * WebProcess/GPU/media/WebMediaStrategy.cpp: (WebKit::WebMediaStrategy::clearNowPlayingInfo): (WebKit::WebMediaStrategy::setNowPlayingInfo): Adding a new file seems to have exposed a few missing includes and namespace qualifiers. This is due to unified sources chunking. 2020-04-24 Alex Christensen <achristensen@webkit.org> Use sendWithAsyncReply for ShareSheet related messages https://bugs.webkit.org/show_bug.cgi?id=210828 <rdar://problem/61800730> Reviewed by Brent Fulgham. * Platform/IPC/MessageSender.cpp: We need to call addAsyncReplyHandler before sendMessage in case this is the first async message from this process. Otherwise the reply from the first message is dropped sometimes. * Shared/ShareSheetCallbackID.h: Removed. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showShareSheet): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::showShareSheet): (WebKit::nextShareSheetCallbackID): Deleted. (WebKit::WebPage::didCompleteShareSheet): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-04-24 Youenn Fablet <youenn@apple.com> and Luming Yin <luming_yin@apple.com> Call STDynamicActivityAttributionPublisher in the WebProcess https://bugs.webkit.org/show_bug.cgi?id=210772 <rdar://problem/62075201> Reviewed by Geoffrey Garen. Call STDynamicActivityAttributionPublisher in WebProcess to make use of the newly added plist entry. Use of a sandbox extension to protect this call. * Configurations/WebKit.xcconfig: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Scripts/process-entitlements.sh: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebKit.xcodeproj/project.pbxproj: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/InfoPlist.strings: Added. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-04-24 Simon Fraser <simon.fraser@apple.com> Move some post-renderingUpdate code into WebCore https://bugs.webkit.org/show_bug.cgi?id=210952 Reviewed by Antti Koivisto. Factor some code called by the various DrawingArea subclasses into Page::finalizeRenderingUpdate(), with some flags to control behavior that differs between drawing areas. ScrollingCoordinator::commitTreeStateIfNeeded() is a no-op for RemoteScrollingCoordinator so it's fine to always call it. * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRendering): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::finalizeRenderingUpdate): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): 2020-04-24 Chris Dumez <cdumez@apple.com> [iOS] Stop using legacy BKSApplicationStateMonitor https://bugs.webkit.org/show_bug.cgi?id=210945 Reviewed by Tim Horton. Stop using legacy BKSApplicationStateMonitor and use RunningBoard API instead. * Configurations/WebKit.xcconfig: Stop linking against ApplicationServices when using iOS 14 SDK now that we are fully transitioned to RunningBoard. * Platform/spi/ios/RunningBoardServicesSPI.h: * UIProcess/ApplicationStateTracker.h: * UIProcess/ApplicationStateTracker.mm: (WebKit::ApplicationStateTracker::ApplicationStateTracker): (WebKit::isApplicationForeground): (WebKit::ApplicationStateTracker::~ApplicationStateTracker): (WebKit::isBackgroundState): Deleted. * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::isApplicationVisible): 2020-04-23 Simon Fraser <simon.fraser@apple.com> Bounce displayWasRefreshed() via EventDispatcher https://bugs.webkit.org/show_bug.cgi?id=208778 Reviewed by Antti Koivisto. Allow the WebContent process to be notified of display refresh off the main thread, so other threads like the scrolling thread can respond without being blocked. Achieve this by having EventDispatcher receive the IPC message, then bounce it to the main thread. * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::displayLinkCallback): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::displayWasRefreshed): * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/EventDispatcher.messages.in: * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::displayWasRefreshed): 2020-04-23 David Kilzer <ddkilzer@apple.com> Clean up QuickLookThumbnailLoader <https://webkit.org/b/210814> Reviewed by Darin Adler. The following items are cleaned up: - Extract `using PlatformImage` into QuickLookThumbnailLoader.h, rename to `CocoaImage` and use to get rid of duplicate code. - Change `id` to `instancetype` for -init methods. - Add `atomic` keyword to @property definitions that were using it as the default. (Use of atomic properties is rare in WebKit, so being explicit avoids a scenario where it looks like `nonatomic` was left off by accident.) - Change @property definitions to `readonly` that are never written to outside of QuickLookThumbnailLoader.mm. - Delete unused @property definitions. - Change method declarations into read-only @property definitions. - Re-declare atomic read-only @property definitions in QuickLookThumbnailLoader.h as read-write definitions in QuickLookThumbnailLoader.mm if they are written to. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::convertPlatformImageToBitmap): * UIProcess/QuickLookThumbnailLoader.h: - Rename qlThumbnailGenerationQueue @property to just `queue`. - Remove `contentType` @property. It is not used anywhere. This also fixes a theoretical leak found by the clang static analyzer. - Remove `shouldWrite` @property. It is only used within QuickLookThumbnailLoader.mm. - Change `identifier` and `thumbnail` to @property declarations. * UIProcess/QuickLookThumbnailLoader.mm: - Change WKQLThumbnailLoadOperation._identifier type from NSMutableString to NSString. There was no reason for it to be mutable. (-[WKQLThumbnailQueueManager init]): (-[WKQLThumbnailQueueManager dealloc]): - Release `_queue` to fix theoretical leak found by the clang static analyzer. (-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]): (-[WKQLThumbnailLoadOperation initWithURL:identifier:]): (-[WKQLThumbnailLoadOperation start]): - Rename `req` to `request`. - Change separate #if macros to #if/#else since only one version of this code can be used at a time. (-[WKQLThumbnailLoadOperation thumbnail]): - Use CocoaImage to use one copy of the method. 2020-04-23 Megan Gardner <megan_gardner@apple.com> Long pressing attachments in Notes does not activate Context Menu. https://bugs.webkit.org/show_bug.cgi?id=210936 <rdar://problem/61171576> Reviewed by Tim Horton. Not having the ID available for notes makes their code to create the context menu and its items fail. We should probably be passing this information on for any element if we have it. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::selectionPositionInformation): 2020-04-23 Brent Fulgham <bfulgham@apple.com> Allow "kern.osversion" sysctl read https://bugs.webkit.org/show_bug.cgi?id=210929 <rdar://problem/62256013> Reviewed by Per Arne Vollan. Libdispatch checks "kern.osversion" as part of the code path we use for launching our XPC services. We already allow it for some services (Network Process), and should be doing so for our other helper processes. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-04-23 Peng Liu <peng.liu6@apple.com> Remove the WebKit.plist for Feature Flags https://bugs.webkit.org/show_bug.cgi?id=210534 Reviewed by Simon Fraser. * FeatureFlags/WebKit.plist: Removed. * WebKit.xcodeproj/project.pbxproj: 2020-04-23 Chris Dumez <cdumez@apple.com> [iOS] Crash on RunningBoard process assertion invalidation https://bugs.webkit.org/show_bug.cgi?id=210873 <rdar://problem/62194917> Unreviewed, nil out the observer only after we've removed it to fix crashes on the bots. * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::ProcessAssertion::~ProcessAssertion): 2020-04-23 Kate Cheney <katherine_cheney@apple.com> All ITP database tables should reference the ObservedDomains table on DELETE CASCADE https://bugs.webkit.org/show_bug.cgi?id=210874 <rdar://problem/62209438> Reviewed by Brady Eidson. This makes it easier to delete an ITP entry from the entire database. An entry shouldn't really exist outside of ObservedDomains anyways, because that table holds all data about the domain, so this is a good change to make regardless of the deletion use case. (WebKit::needsNewCreateTableSchema): Function to check for old CREATE TABLE queries. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::enableForeignKeys): Must enable foreign keys to use DELETE CASCADE. (WebKit::ResourceLoadStatisticsDatabaseStore::isMigrationNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary): Since this is a schema change that is executed when a table is created, we need to check if the current schema is out of date. If so, we can create new tables using the proper reference and migrate the data. (WebKit::ResourceLoadStatisticsDatabaseStore::openAndDropOldDatabaseIfNecessary): We only need to migrate the data if there were no issues with the schema (otherwise the entire database will already have been created with the correct CREATE TABLE queries). * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 2020-04-23 Don Olmstead <don.olmstead@sony.com> [CMake] CMAKE_BINARY_DIR should always be a PRIVATE include directory https://bugs.webkit.org/show_bug.cgi?id=196717 Reviewed by Michael Catanzaro. Include CMAKE_BINARY_DIR either directly or through WebKit_PRIVATE_INCLUDE_DIRECTORIES. * PlatformGTK.cmake: * PlatformWPE.cmake: 2020-04-23 Adrian Perez de Castro <aperez@igalia.com> Regression after r260359 ([GTK][WPE] lowWatermarkPages() in MemoryPressureMonitor.cpp only searches the "low" value inside the first "Node" section) https://bugs.webkit.org/show_bug.cgi?id=210916 Reviewed by Carlos Alberto Lopez Perez. Switch over to using a FileHandle type based on std::unique_ptr with a custom deleter and an utility function for opening files. This makes easier to follow the logic inside the polling loop for opening files and retrying when needed. This also fixes exiting the thread when the systemMemoryUsedAsPercentage() function would return -1, to loop restart instead to keep trying. Thanks to Pablo Saavedra for his help in making this patch. No new tests needed. * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::FileHandleDeleter::operator()): Add deleter to use with std::unique_ptr<>. (WebKit::tryOpeningForUnbufferedReading): Add utility function to open a file handle if needed and configuring its buffering upon opening. (WebKit::MemoryPressureMonitor::start): Use FileHandle to ensure that handles are always closed properly, and fix logic retry opening files on failure. 2020-04-23 Nikos Mouchtaris <nmouchtaris@apple.com> Soft link QuickLookThumbnailing framework https://bugs.webkit.org/show_bug.cgi?id=210894 Reviewed by Megan Gardner. Soft link QuickLookThumbnailing framework to solve build error. No new tests. Unnecessary. * Configurations/WebKit.xcconfig: * UIProcess/QuickLookThumbnailLoader.mm: (-[WKQLThumbnailLoadOperation initWithURL:identifier:]): (-[WKQLThumbnailLoadOperation start]): * UIProcess/QuickLookThumbnailingSPI.h: Added. * UIProcess/QuickLookThumbnailingSoftLink.h: Added. * UIProcess/QuickLookThumbnailingSoftLink.mm: Added. * WebKit.xcodeproj/project.pbxproj: 2020-04-23 Chris Dumez <cdumez@apple.com> [iOS] Port MediaPlayback process assertion to RunningBoard https://bugs.webkit.org/show_bug.cgi?id=210212 <rdar://problem/61476951> Reviewed by Geoff Garen. Port MediaPlayback process assertion to RunningBoard instead of the legacy BKSProcessAssertion. We can now #ifdef out the legacy BKSProcessAssertion on recent iOS builds. * UIProcess/ProcessAssertion.h: * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::runningBoardNameForAssertionType): (WebKit::ProcessAssertion::ProcessAssertion): (WebKit::ProcessAssertion::~ProcessAssertion): 2020-04-23 John Frankish <john.frankish@outlook.com> [GTK] Crash in cairo_surface_mark_dirty_rectangle() in accelerated compositing mode under X11 https://bugs.webkit.org/show_bug.cgi?id=210636 Reviewed by Carlos Garcia Campos. When cairo is configured to use xcb instead of xlib, it might use an image surface attached to the xlib one as snapshot. In that case a flush is needed to detach that snapshot after we have drawn the surface in the context. * UIProcess/gtk/AcceleratedBackingStoreX11.cpp: (WebKit::AcceleratedBackingStoreX11::paint): Call cairo_surface_flush() after drawing. 2020-04-23 Chris Dumez <cdumez@apple.com> Unreviewed, reverting r260133. We can use RunningBoard foreground assertion again now that <rdar://problem/61830390> has been fixed Reverted changeset: "REGRESSION (r259610): WebGL does not work at all on iOS (was: Google Maps tiles turn black after initial load)" https://trac.webkit.org/changeset/260133 2020-04-22 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r260553. Broke iOS and Catalina builds. Reverted changeset: "Soft link QuickLookThumbnailing framework" https://bugs.webkit.org/show_bug.cgi?id=210894 https://trac.webkit.org/changeset/260553 2020-04-22 Darin Adler <darin@apple.com> [Cocoa] Build with UChar as char16_t even in builds that use Apple's internal SDK https://bugs.webkit.org/show_bug.cgi?id=210845 Reviewed by Anders Carlsson. * Configurations/BaseTarget.xcconfig: Move ICU-configuring macros to Platform.h. * Platform/unix/EnvironmentUtilities.h: Removed unneeded includes. This sidesteps a problem with Apple's internal InstallAPI tool that happens if StringView.h is included and Platform.h is not included first. * UIProcess/API/cpp/WKRetainPtr.h: Removed unneeded includes, and used #pragma once. * UIProcess/Cocoa/PreferenceObserver.h: Moved most things out of the header, since they don't need to be there. * UIProcess/Cocoa/PreferenceObserver.mm: Moved them here including using a class extension for the data member of WKPreferenceObserver. * UIProcess/ios/fullscreen/FullscreenTouchSecheuristicParameters.h: Removed unneeded WTF prefix. 2020-04-22 Nikos Mouchtaris <nmouchtaris@apple.com> Soft link QuickLookThumbnailing framework https://bugs.webkit.org/show_bug.cgi?id=210894 Reviewed by Tim Horton. Soft link QuickLookThumbnailing framework to solve build error. No new tests. Unnecessary. * Configurations/WebKit.xcconfig: * UIProcess/QuickLookThumbnailLoader.mm: (-[WKQLThumbnailLoadOperation initWithURL:identifier:]): (-[WKQLThumbnailLoadOperation start]): * UIProcess/QuickLookThumbnailingSPI.h: Added. * UIProcess/QuickLookThumbnailingSoftLink.h: Added. * UIProcess/QuickLookThumbnailingSoftLink.mm: Added. * WebKit.xcodeproj/project.pbxproj: 2020-04-22 Daniel Bates <dabates@apple.com> Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region https://bugs.webkit.org/show_bug.cgi?id=210774 Reviewed by Dean Jackson. Expose two new enumerators to toggle touch action region and editable element region overlay painting. * UIProcess/API/C/WKPreferencesRef.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2020-04-22 Chris Dumez <cdumez@apple.com> [iOS] Expose -_webView:willGoToBackForwardListItem:inPageCache: https://bugs.webkit.org/show_bug.cgi?id=210878 <rdar://problem/62202276> Reviewed by Alex Christensen. Expose -_webView:willGoToBackForwardListItem:inPageCache: on iOS. * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem): 2020-04-22 Chris Dumez <cdumez@apple.com> [iOS] Crash on RunningBoard process assertion invalidation https://bugs.webkit.org/show_bug.cgi?id=210873 <rdar://problem/62194917> Reviewed by Darin Adler. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKRBSAssertionDelegate assertion:didInvalidateWithError:]): Capture a weak pointer to self and make sure we only access the invalidation handler on the main thread if |self| is still alive. (WebKit::ProcessAssertion::~ProcessAssertion): Null out the WKRBSAssertionDelegate's observer in the ProcessAssertion destructor, to make sure processAssertionWasInvalidated() cannot get called after the ProcessAssertion has been destroyed. 2020-04-22 David Kilzer <ddkilzer@apple.com> IPC::decodeSharedBuffer() should check the return value of SharedMemory::map() <https://webkit.org/b/210844> <rdar://problem/60773120> Reviewed by Geoffrey Garen. * Shared/WebCoreArgumentCoders.cpp: (IPC::decodeSharedBuffer): - Add nullptr check and early return. 2020-04-22 Brent Fulgham <bfulgham@apple.com> Switch from debug ASSERT to RELEASE_ASSERT in toNPJSObject https://bugs.webkit.org/show_bug.cgi?id=210823 <rdar://problem/61774056> Reviewed by David Kilzer. * WebProcess/Plugins/Netscape/NPJSObject.h: (WebKit::NPJSObject::toNPJSObject): 2020-04-22 Youenn Fablet <youenn@apple.com> Simplify SWServerWorker::whenActivated logic https://bugs.webkit.org/show_bug.cgi?id=210795 Reviewed by Alex Christensen. Improve logging and update code according whenActivated implementation. Add an early check for timeouts so that we return earlier in that case. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::createFetchTask): (WebKit::WebSWServerConnection::startFetch): 2020-04-21 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r260478. Caused TestWebKitAPI.WKAttachmentTests crashes on Catalina Reverted changeset: "Clean up QuickLookThumbnailLoader" https://bugs.webkit.org/show_bug.cgi?id=210814 https://trac.webkit.org/changeset/260478 2020-04-21 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r260410. Caused crashes in Safari Reverted changeset: "SPI clients using fastServerTrustEvaluationEnabled need SPI to inform them of modern TLS negotiation" https://bugs.webkit.org/show_bug.cgi?id=210533 https://trac.webkit.org/changeset/260410 2020-04-21 Ryan Haddad <ryanhaddad@apple.com> Unreviewed, reverting r260475. New assert caused layout tests to exit early on iOS and macOS Reverted changeset: "REGRESSION(r260410) Frequent Network process crashes" https://bugs.webkit.org/show_bug.cgi?id=210825 https://trac.webkit.org/changeset/260475 2020-04-21 David Kilzer <ddkilzer@apple.com> IPC::Encoder::reserve() can be private <https://webkit.org/b/210833> <rdar://problem/62124193> Reviewed by Darin Adler. * Platform/IPC/Encoder.h: (IPC::Encoder::reserve): - Move from public to private. 2020-04-21 Stephan Szabo <stephan.szabo@sony.com> [PlayStation] Fix GPU Process build for VIDEO_PRESENTATION_MODE changes https://bugs.webkit.org/show_bug.cgi?id=210836 Reviewed by Darin Adler. Build fix, no new tests. * GPUProcess/media/playstation/RemoteMediaPlayerProxyPlayStation.cpp: 2020-04-21 Peng Liu <peng.liu6@apple.com> Fix MACCATALYST build failures https://bugs.webkit.org/show_bug.cgi?id=210815 Reviewed by Tim Horton. * Configurations/FeatureDefines.xcconfig: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _isShowingVideoPictureInPicture]): (-[WKWebView _mayAutomaticallyShowVideoPictureInPicture]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::applicationDidBecomeActive): 2020-04-19 Darin Adler <darin@apple.com> [Cocoa] Use createNSArray in many more places that build NSArray objects from C++ collections https://bugs.webkit.org/show_bug.cgi?id=210702 Reviewed by Alex Christensen. * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toNSErrors): Use createNSArray and return a RetainPtr to cut down on autorelease. (WebKit::toPKShippingMethods): Ditto. (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Updated for RetainPtr. (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto. * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Use createNSArray. Also removed code to support platforms without -setThumbnailURLs: since we don't have those any more. * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: (WebKit::RemoteLayerTreePropertyApplier::updateChildren): Use createNSArray. * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: (coreCookiesToNSCookies); Ditto. * UIProcess/API/Cocoa/WKProcessPool.mm: (+[WKProcessPool _allProcessPoolsForTesting]): Ditto. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): Cut down on repeated code by adding a lambda to create a _WKTextManipulationItem and by using createNSArray. (wkTextManipulationErrors): Use createNSArray. Also tighten up the code that maps WebCore::TextManipulationController::ManipulationFailureType to the _WKTextManipulationItemError code. * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (-[WKWebpagePreferences _customHeaderFields]): Use createNSArray. * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm: (-[WKWebsiteDataRecord _originsStrings]): Ditto. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _getResourceLoadStatisticsDataSummary:]): Ditto. * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload redirectChain]): Ditto. * UIProcess/API/Cocoa/_WKFrameTreeNode.mm: (-[_WKFrameTreeNode childFrames]): Ditto. * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]): Ditto. * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.mm: (-[_WKResourceLoadStatisticsThirdParty underFirstParties]): Ditto. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]): Ditto. * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::didChangeBackForwardList): Ditto. * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm: (WebKit::RemoteLayerTreeScrollingPerformanceData::data): Ditto. * UIProcess/ios/DragDropInteractionState.mm: (WebKit::createTargetedDragPreview): Ditto. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _updateTapHighlight]): Removed uneeded RetainPtr local variable. Use createNSArray. Refactored to make the "all rectilinear" case more parallel to the general case. (-[WKContentView webSelectionRectsForSelectionRects:]): Use createNSArray. (wkTextSelectionRects): Ditto. (createTargetedPreview): Ditto. (-[WKContentView _presentationRectsForPreviewItemController:]): Ditto. * UIProcess/mac/WKTextFinderClient.mm: (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]): Use createNSArray. * UIProcess/mac/WKTextInputWindowController.mm: (-[WKTextInputView validAttributesForMarkedText]): Use +[NSArray arrayByAddingObject:]. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: (collectIcons): Use createNSArray. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Marked class here as final. Cut down on local variables a bit. Use createNSArray. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::addAnimationToLayer): Removed unnecessary use of RetainPtr. Use createNSArray. * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::WebBackForwardListProxy::WebBackForwardListProxy): Addd a FIXME about a problem I noticed, unrelated to the rest of the changes. * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): Use createNSArray. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::registerWithStateDumper): Ditto. (WebKit::activePagesOrigins): Ditto. 2020-04-21 David Kilzer <ddkilzer@apple.com> Clean up QuickLookThumbnailLoader <https://webkit.org/b/210814> Reviewed by Darin Adler. The following items are cleaned up: - Extract `using PlatformImage` into QuickLookThumbnailLoader.h, rename to `CocoaImage` and use to get rid of duplicate code. - Change `id` to `instancetype` for -init methods. - Add `atomic` keyword to @property definitions that were using it as the default. (Use of atomic properties is rare in WebKit, so being explicit avoids a scenario where it looks like `nonatomic` was left off by accident.) - Change @property definitions to `readonly` that are never written to outside of QuickLookThumbnailLoader.mm. - Delete unused @property definitions. - Change method declarations into read-only @property definitions. - Re-declare atomic read-only @property definitions in QuickLookThumbnailLoader.h as read-write definitions in QuickLookThumbnailLoader.mm if they are written to. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::convertPlatformImageToBitmap): * UIProcess/QuickLookThumbnailLoader.h: - Rename qlThumbnailGenerationQueue @property to just `queue`. - Remove `contentType` @property. It is not used anywhere. This also fixes a theoretical leak found by the clang static analyzer. - Remove `shouldWrite` @property. It is only used within QuickLookThumbnailLoader.mm. - Change `identifier` and `thumbnail` to @property declarations. * UIProcess/QuickLookThumbnailLoader.mm: - Change WKQLThumbnailLoadOperation._identifier type from NSMutableString to NSString. There was no reason for it to be mutable. (-[WKQLThumbnailQueueManager init]): (-[WKQLThumbnailQueueManager dealloc]): - Release `_queue` to fix theoretical leak found by the clang static analyzer. (-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]): (-[WKQLThumbnailLoadOperation initWithURL:identifier:]): (-[WKQLThumbnailLoadOperation start]): - Rename `req` to `request` and use RetainPtr<>. - Change separate #if macros to #if/#else since only one version of this code can be used at a time. (-[WKQLThumbnailLoadOperation thumbnail]): - Use CocoaImage to use one copy of the method. 2020-04-21 David Kilzer <ddkilzer@apple.com> Fix extra/missing #undef statements <https://webkit.org/b/210818> <rdar://problem/61973329> Reviewed by Chris Dumez. * UIProcess/Network/NetworkProcessProxy.cpp: - Remove #undef MESSAGE_CHECK_URL. It is no longer used. * UIProcess/WebPageProxy.cpp: - Add missing #undef MESSAGE_CHECK_COMPLETION. - Sort #undef in reverse order of #define. * UIProcess/mac/WebPageProxyMac.mm: - Add missing #undef MESSAGE_CHECK_WITH_RETURN_VALUE. - Sort #undef in reverse order of #define. 2020-04-21 Chris Dumez <cdumez@apple.com> REGRESSION(r260410) Frequent Network process crashes https://bugs.webkit.org/show_bug.cgi?id=210825 Reviewed by Alex Christensen. The webPageProxyID in the NetworkProcessProxy::DidNegotiateModernTLS() IPC was invalid because NetworkProcessProxy::preconnectTo() was failing to initialize NetworkLoadParameters::webPageProxyID. This patch addresses the issue. No new tests, added new assertion that would be tripped by existing tests. * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::NetworkLoad): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preconnectTo): 2020-04-21 Jer Noble <jer.noble@apple.com> PiP buttons shows up in element fullscreen when PiP is disabled in WKWebViewConfiguration https://bugs.webkit.org/show_bug.cgi?id=210813 Reviewed by Eric Carlson. Not currently testable; entering fullscreen never completes in the iOS TestWebKitAPI app because that process is not a UI Application. * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController videoControlsManagerDidChange]): 2020-04-21 Brent Fulgham <bfulgham@apple.com> [Cocoa] Don't bother compiling UpdateInfo since it's not used https://bugs.webkit.org/show_bug.cgi?id=210819 <rdar://problem/61774766> Reviewed by Darin Adler. Since we don't use the UpdateInfo class in Cocoa builds, let's not bother building it. * Shared/UpdateInfo.cpp: * Shared/UpdateInfo.h: * UIProcess/DrawingAreaProxy.h: 2020-04-21 Timothy Horton <timothy_horton@apple.com> One more build fix after r260407 * Configurations/WebKit.xcconfig: 2020-04-21 Chris Dumez <cdumez@apple.com> [iOS] Provide better names for ProcessThrottler process assertions https://bugs.webkit.org/show_bug.cgi?id=210808 Reviewed by Geoffrey Garen. Provide better names for ProcessThrottler process assertions, to facilitate debugging. * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/ProcessAssertion.cpp: (WebKit::ProcessAssertion::ProcessAssertion): * UIProcess/ProcessAssertion.h: * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::assertionName const): (WebKit::ProcessThrottler::setAssertionType): * UIProcess/ProcessThrottler.h: * UIProcess/ProcessThrottlerClient.h: * UIProcess/WebProcessProxy.h: * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::ProcessAssertion::ProcessAssertion): (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion): 2020-04-21 Daniel Bates <dabates@apple.com> [iOS] -_didFinishTextInteractionInTextInputContext should only zoom to reveal focused element if it changed https://bugs.webkit.org/show_bug.cgi?id=210697 <rdar://problem/60997530> Reviewed by Wenson Hsieh. Add a new state variable to use to track whether -_focusTextInputContext invoked during a text interaction actually focused an element. Then in -_didFinishTextInteractionInTextInputContext condition marking the page to reveal the focused element on this state. * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _willBeginTextInteractionInTextInputContext:]): Turn around and call the same function on the content view. (-[WKWebView _didFinishTextInteractionInTextInputContext:]): Ditto. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): Reset state. (-[WKContentView _didCommitLoadForMainFrame]): Ditto. (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): Update state to indicate whether the focusd element did change or not. I use bitwise ORing instead of strict assignment to update it because this function can be called multiple times by an internal Apple client during a text interaction (e.g. <rdar://problem/59430806>). I thought about making this a FIXME, but this function is otherwise capable of handling multiple invocations so I didn't. (-[WKContentView _willBeginTextInteractionInTextInputContext:]): Reset added state. (-[WKContentView _didFinishTextInteractionInTextInputContext:]): Check if state was set to indicate that a focus change happened. If so, do what we do now + reset state. Otherwise, do everything we do now except for marking the page as needing to reveal the focused element on the next editor state update. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::focusTextInputContextAndPlaceCaret): Check that the target is focusable before calling FocusController::setFocusedElement() because it ultimately calls Document::setFocusedElement() that can return true for a non-focusable element. I added a comment in Document.h to explain this subtlety. I also decided not to check the return value of FocusController::setFocusedElement(). Instead I am checking the more important condition that the focused element is the target element. Passing true to visiblePositionInFocusedNodeForPoint() will ultimately assert this to be true. Note that setFocusedElement() may not have done anything as m_focusedElement could have already been equal to the target element. This is OK and I still update the caret position. 2020-04-21 Timothy Hatcher <timothy@apple.com> Reset m_userScriptsNotified when web process crashes. https://bugs.webkit.org/show_bug.cgi?id=210807 Reviewed by Alex Christensen. * UIProcess/WebPageProxy.cpp: (WebPageProxy::resetStateAfterProcessExited): Set m_userScriptsNotified to false. 2020-04-21 Timothy Horton <timothy_horton@apple.com> Fix the build * Configurations/WebKit.xcconfig: 2020-04-21 David Kilzer <ddkilzer@apple.com> [IPC hardening] ShareableResource::create() should validate its parameters <https://webkit.org/b/210779> <rdar://problem/60887693> Reviewed by Chris Dumez. * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::store): * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::didFinishLoadForQuickLookDocumentInMainFrame): - Handle nullptr returned from ShareableResource::create(). * Shared/ShareableResource.cpp: (WebKit::ShareableResource::create): - Change to return RefPtr<>. - Validate parameters before calling constructor. Return nullptr on failure. (WebKit::ShareableResource::ShareableResource): - Remove assert and comment since checks are now done in ShareableResource::create(). * Shared/ShareableResource.h: (WebKit::ShareableResource::create): - Change to return RefPtr<>. 2020-04-21 Wenson Hsieh <wenson_hsieh@apple.com> [Cocoa] Tighten up some more IPC message checks in WebPasteboardProxy https://bugs.webkit.org/show_bug.cgi?id=210780 <rdar://problem/62088479> Reviewed by Alex Christensen. Adjust some existing IPC message checks in WebPasteboardProxy, and also introduces some new ones. See below for more details. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::didModifyContentsOfPasteboard): Move the `pasteboardName` check here out of `didModifyContentsOfPasteboard`, and into each call site, such that we bail and kill the web process before invoking `didModifyContentsOfPasteboard` in the case where the name is empty. (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType): (WebKit::WebPasteboardProxy::getPasteboardStringForType): (WebKit::WebPasteboardProxy::getPasteboardStringsForType): (WebKit::WebPasteboardProxy::getPasteboardBufferForType): (WebKit::WebPasteboardProxy::addPasteboardTypes): (WebKit::WebPasteboardProxy::setPasteboardTypes): (WebKit::WebPasteboardProxy::setPasteboardURL): (WebKit::WebPasteboardProxy::setPasteboardColor): (WebKit::WebPasteboardProxy::setPasteboardStringForType): Add message checks for empty pasteboard types. (WebKit::WebPasteboardProxy::setPasteboardBufferForType): (WebKit::WebPasteboardProxy::writeCustomData): (WebKit::WebPasteboardProxy::readStringFromPasteboard): (WebKit::WebPasteboardProxy::readBufferFromPasteboard): (WebKit::WebPasteboardProxy::writeURLToPasteboard): (WebKit::WebPasteboardProxy::writeWebContentToPasteboard): (WebKit::WebPasteboardProxy::writeImageToPasteboard): (WebKit::WebPasteboardProxy::writeStringToPasteboard): Add a message check for empty pasteboard types, but only when the string is also empty; this is because iOS clears pasteboard data by writing an empty pasteboard string and type. 2020-04-21 Adrian Perez de Castro <aperez@igalia.com> [GTK][CMake] Make gtk-unix-print a component of FindGTK.cmake https://bugs.webkit.org/show_bug.cgi?id=210792 Reviewed by Carlos Garcia Campos. No new tests needed. * PlatformGTK.cmake: Use the GTK::UnixPrint imported target. 2020-04-21 Philippe Normand <pnormand@igalia.com> [CMake] gst-build-backed build fails https://bugs.webkit.org/show_bug.cgi?id=210742 Reviewed by Xabier Rodriguez-Calvar. * PlatformWPE.cmake: 2020-04-21 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes late February 2020 edition https://bugs.webkit.org/show_bug.cgi?id=210767 Unreviewed build fix. * NetworkProcess/NetworkResourceLoadMap.h: Add missing wtf/Function.h header. 2020-04-20 Ross Kirsling <ross.kirsling@sony.com> Classes marked final should not use protected access specifier https://bugs.webkit.org/show_bug.cgi?id=210775 Reviewed by Daniel Bates. * Shared/API/APIDictionary.h: * WebProcess/GPU/media/TextTrackPrivateRemote.h: * WebProcess/Plugins/Netscape/JSNPMethod.h: * WebProcess/Plugins/Netscape/JSNPObject.h: 2020-04-20 Peng Liu <peng.liu6@apple.com> Fix build failures when video fullscreen and picture-in-picture is disabled https://bugs.webkit.org/show_bug.cgi?id=210777 Reviewed by Eric Carlson. Wrap video fullscreen and picture-in-picture related code with "#if ENABLE(VIDEO_PRESENTATION_MODE)". * Configurations/FeatureDefines.xcconfig: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenGravity): (WebKit::RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage): (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode): (WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged): (WebKit::RemoteMediaPlayerProxy::setBufferingPolicy): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::prepareForPlayback): 2020-04-20 Alex Christensen <achristensen@webkit.org> SPI clients using fastServerTrustEvaluationEnabled need SPI to inform them of modern TLS negotiation https://bugs.webkit.org/show_bug.cgi?id=210533 Reviewed by Brady Eidson. * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTaskClient::didNegotiateModernTLS): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::didNegotiateModernTLS): * NetworkProcess/NetworkLoad.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::didNegotiateModernTLS): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): * UIProcess/API/APINavigationClient.h: (API::NavigationClient::didNegotiateModernTLS): * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::didNegotiateModernTLS): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didNegotiateModernTLS): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: 2020-04-20 Kate Cheney <katherine_cheney@apple.com> App-bound domain behavior should abide by the limitsNavigationsToAppBoundDomains argument in WKWebView configuration https://bugs.webkit.org/show_bug.cgi?id=210769 <rdar://problem/62065241> Reviewed by Brent Fulgham. Changes app-bound domain behavior to be triggered by the value of limitsNavigationsToAppBoundDomains, a WebView configuration flag. If the WebView has this parameter set and is currently navigating to an app bound domain, then app-bound privileges will be granted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted): Update this function to return a boolean to indicate whether the navigation should fail. A failure should occur if a WebView has set the limitsNavigationsToAppBoundDomains flag and attempts to navigate away from an app-bound domain. If the limitsNavigationsToAppBoundDomains value has not been set to true, maintain non-app bound behavior regardless of whether the domain is app-bound or not. (WebKit::WebPageProxy::decidePolicyForNavigationAction): Check the result of setIsNavigatingToAppBoundDomainAndCheckIfPermitted and fail the navigation if needed, with both RELEASE logging and an appropriate error message. (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain): Deleted. * UIProcess/WebPageProxy.h: Renamed for clarity. 2020-04-20 Nikos Mouchtaris <nmouchtaris@apple.com> WK2 Quicklook for attachments https://bugs.webkit.org/show_bug.cgi?id=208891 Reviewed by Darin Adler. Allow attachment elements to render QuickLook thumbnail generated from contents of the file as its icon, rather than the default icons associated with each mime type. * Configurations/WebKit.xcconfig: Link QuickLook thumbnailing framework. * UIProcess/API/APIAttachment.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]): * UIProcess/Cocoa/WebPageProxyCocoa.mm: Create thumbnail request and add to queue. (WebKit::convertNSImageToBitmap): (WebKit::convertUIImageToBitmap): (WebKit::WebPageProxy::getQLThumbnailForGenerationRequestion): (WebKit::WebPageProxy::getQLThumbnailForFileWrapper): (WebKit::WebPageProxy::getQLThumbnailForAttachment): * UIProcess/QLThumbnailLoad.h: Added. * UIProcess/QLThumbnailLoad.mm: Added. Add code to request thumbnail for file data. (-[WKQLThumbnailQueueManager init]): (+[WKQLThumbnailQueueManager sharedInstance]): (-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]): (-[WKQLThumbnailLoadOperation initWithURL:identifier:]): (-[WKQLThumbnailLoadOperation start]): (-[WKQLThumbnailLoadOperation isAsynchronous]): (-[WKQLThumbnailLoadOperation isExecuting]): (-[WKQLThumbnailLoadOperation setExecuting:]): (-[WKQLThumbnailLoadOperation isFinished]): (-[WKQLThumbnailLoadOperation setFinished:]): * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateAttachmentIcon): Set thumbnail of attachment element * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Thumbnail request message. 2020-04-20 Kate Cheney <katherine_cheney@apple.com> Unreviewed macCatalyst build fix. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess): (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride): 2020-04-20 Simon Fraser <simon.fraser@apple.com> Scrolling with background-attachment: fixed needs to trigger repaints https://bugs.webkit.org/show_bug.cgi?id=193893 <rdar://problem/47587017> Reviewed by Dean Jackson. When scrolling an overflow scroll which has "background-atttachment:fixed" in the content, the node will have non-empty synchronous scrolling reasons. In this case we need to send the scroll to the main thread, and trigger a repaint on scroll. If handling the wheel event on the scrolling thread determines that the scroll must be sent to the main thread, EventDispatcher::wheelEvent() does so in the callback function. To trigger the repaint, RenderLayer::scrollTo() asks the composited layers backing whether the node has synchronous scrolling reasons; this is implemented by asking the scrolling coordinator. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-04-20 Megan Gardner <megan_gardner@apple.com> Date and Time form controls not showing correct initial values on immediate second invocation. https://bugs.webkit.org/show_bug.cgi?id=210613 Reviewed by Wenson Hsieh. Updating the webprocess with the newly picked time did not update the local store of that data in the UI process, so when the control was activated a second time, and we skipped the round trip to the webprocess to get the data we were certian we already had, we did not start the popover in the correct state. We now update the webprocess and the local UI stored variable at the same time. Test: fast/forms/ios/time-picker-value-change.html * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView timePickerValueHour]): (-[WKWebView timePickerValueMinute]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView updateValueAsNumberForViewController:]): (-[WKContentView updateValueForViewController:]): (-[WKContentView setTimePickerValueToHour:minute:]): (-[WKContentView timePickerValueHour]): (-[WKContentView timePickerValueMinute]): * UIProcess/ios/forms/WKFormInputControl.h: * UIProcess/ios/forms/WKFormInputControl.mm: (-[WKDateTimePicker hour]): (-[WKDateTimePicker minute]): (-[WKDateTimePicker _dateChangedSetAsNumber]): (-[WKDateTimePicker _dateChangedSetAsString]): (-[WKDateTimePicker setHour:minute:]): (-[WKFormInputControl setTimePickerHour:minute:]): (-[WKFormInputControl timePickerValueHour]): (-[WKFormInputControl timePickerValueMinute]): (-[WKDateTimePopover setHour:minute:]): (-[WKDateTimePopover hour]): (-[WKDateTimePopover minute]): 2020-04-20 Timothy Horton <timothy_horton@apple.com> Try to fix the macCatalyst build after r260366 * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h: 2020-04-20 Stephan Szabo <stephan.szabo@sony.com> Fix build when !ENABLE(RESOURCE_LOAD_STATISTICS) https://bugs.webkit.org/show_bug.cgi?id=210757 Reviewed by Ross Kirsling. Build fix, no new tests * NetworkProcess/NetworkDataTask.cpp: Add ENABLE(RESOURCE_LOAD_STATISTICS) around block using NetworkSession functions only declared when that is enabled. 2020-04-20 Alex Christensen <achristensen@webkit.org> When SpeculativeLoadManager is destroyed, properly clean up its PendingFrameLoads https://bugs.webkit.org/show_bug.cgi?id=210759 <rdar://problem/62056856> Reviewed by Darin Adler. Recent work on the resourceLoadStatistics layout tests increased the amount we swap out the WebsiteDataStore. When this happens, the NetworkSession is eventually destroyed in the NetworkProcess, sometimes when running the next test. An assertion was firing in the PendingFrameLoad destructor because it hadn't been marked as complete when it was destroyed. Rather than remove the assertion, when we destroy the SpeculativeLoadManager (which only happens when a WebsiteDataStore is destroyed) during a speculative pending frame load, just mark the pending frame load as complete because it is being cancelled. Marking the pending frame load as complete can tell the SpeculativeLoadManager to mutate m_pendingFrameLoads, which we don't want to do while iterating, so copy the RefPtrs into a Vector first then iterate that to get them all. This fixes an assertion that was sometimes hit in http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-database.html but only after running other tests that had initiated speculative pending frame loads. This was ostensibly started by r260322 but is quite unrelated. * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::SpeculativeLoadManager::~SpeculativeLoadManager): 2020-04-20 Stephan Szabo <stephan.szabo@sony.com> [PlayStation] Fix build after r260277 https://bugs.webkit.org/show_bug.cgi?id=210756 Reviewed by Don Olmstead. Build fix, no new tests. * PlatformPlayStation.cmake: 2020-04-20 Chris Dumez <cdumez@apple.com> Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess https://bugs.webkit.org/show_bug.cgi?id=210753 <rdar://problem/61896221> Reviewed by Geoffrey Garen. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::startPingLoad): Make sure NetworkResourceLoadParameters's webPageProxyID / webPageID / webFrameID are properly initialized before sending the IPC or IPC decoding will fail. 2020-04-20 David Kilzer <ddkilzer@apple.com> [IPC hardening] Use ObjectIdentifier<> for geolocationID <https://webkit.org/b/210680> <rdar://problem/58892340> Reviewed by Chris Dumez. Replace uses of uint64_t with GeolocationIdentifier. * Scripts/webkit/messages.py: * UIProcess/GeolocationIdentifier.h: Add. * UIProcess/GeolocationPermissionRequestManagerProxy.cpp: (WebKit::GeolocationPermissionRequestManagerProxy::createRequest): (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision): * UIProcess/GeolocationPermissionRequestManagerProxy.h: * UIProcess/GeolocationPermissionRequestProxy.cpp: (WebKit::GeolocationPermissionRequestProxy::GeolocationPermissionRequestProxy): * UIProcess/GeolocationPermissionRequestProxy.h: (WebKit::GeolocationPermissionRequestProxy::create): * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation): (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation): (WebKit::GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision): (WebKit::generateGeolocationID): Delete. - Replace with GeolocationIdentifier::generate(). * WebProcess/Geolocation/GeolocationPermissionRequestManager.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceiveGeolocationPermissionDecision): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-04-20 Chris Dumez <cdumez@apple.com> [iOS] Refactor WebKit media playback process assertion logic to minimize chances of leaking them https://bugs.webkit.org/show_bug.cgi?id=210670 Reviewed by Geoffrey Garen. Refactor WebKit media playback process assertion logic to minimize chances of leaking them. In particular, the following changes were made: 1. Instead of the WebProcessPool having a HashMap of media playback process assertions for the WebProcess, we now store the assertion on the WebProcessProxy object itself. This is less likely to get out of sync and leak. 2. Add a RefCounter to the WebProcessPool to count WebProcesses that have audible media. Whenever a WebProcess starts or stops playing audible media, it merely grabs a RefCounter token or releases it. The WebProcessPool relies on this counter to decide whether or not to take a media playback assertion on behalf of the UIProcess. Since this is token-based and the token is stored on the WebProcessProxy object, it makes it less likely to leak the assertion. 3. The WebProcessProxy object now has a AudibleMediaActivity data structure wrapping both its media playback assertion and its WebProcessWithAudibleMediaToken that it got from the WebProcessPool. When the WebProcess shuts down (normally or due to crash/termination), we make sure to clear this data structure. 4. Make sure that the WebProcessProxy updates its AudibleMediaActivity whenever a page is removed from the WebProcess. * UIProcess/WebPageProxy.cpp: * UIProcess/WebProcessPool.cpp: (WebKit::m_webProcessWithAudibleMediaCounter): (WebKit::WebProcessPool::disconnectProcess): (WebKit::WebProcessPool::webProcessWithAudibleMediaToken const): (WebKit::WebProcessPool::updateAudibleMediaAssertions): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::removeWebPage): (WebKit::WebProcessProxy::updateAudibleMediaAssertions): * UIProcess/WebProcessProxy.h: 2020-04-20 Kate Cheney <katherine_cheney@apple.com> <rdar://problem/62059046> Unreviewed macCatalyst build fix. * NetworkProcess/NetworkProcess.messages.in: 2020-04-20 Darin Adler <darin@apple.com> Use #import instead of #include in Objective-C and don't use #pragma once https://bugs.webkit.org/show_bug.cgi?id=210724 Reviewed by David Kilzer. * mac/MigrateHeadersFromWebKitLegacy.make: Delete stale MemoryMeasure.h forwarding header from incremental WebKit builds and ignore when generating new forwarding headers. * Platform/foundation/LoggingFoundation.mm: (WebKit::logLevelString): Use string directly instead of a named constant. * UIProcess/mac/WebColorPickerMac.h: Mark class final. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm: * NetworkProcess/cache/NetworkCacheDataCocoa.mm: * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm: * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: * NetworkProcess/webrtc/NetworkRTCProvider.mm: * Platform/spi/Cocoa/DeviceManagementSPI.h: * Platform/spi/Cocoa/LocalAuthenticationSPI.h: * Platform/spi/Cocoa/NearFieldSPI.h: * Platform/spi/Cocoa/SafeBrowsingSPI.h: * Platform/spi/mac/AppKitSPI.h: * Shared/API/Cocoa/RemoteObjectInvocation.mm: * Shared/API/Cocoa/WKMain.mm: * Shared/APIWebArchive.mm: * Shared/APIWebArchiveResource.mm: * Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.mm: * Shared/Cocoa/LoadParametersCocoa.mm: * Shared/Cocoa/SandboxInitialiationParametersCocoa.mm: * Shared/Cocoa/WKNSData.mm: * Shared/DocumentEditingContext.mm: * Shared/Plugins/mac/PluginSandboxProfile.mm: * Shared/RemoteLayerTree/WKAnimationDelegate.h: * Shared/UserInterfaceIdiom.mm: * Shared/ios/WebIconUtilities.mm: * Shared/mac/CodeSigning.mm: * Shared/mac/ColorSpaceData.mm: * Shared/mac/HangDetectionDisablerMac.mm: * Shared/mac/PDFKitImports.mm: * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm: * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm: * UIProcess/API/Cocoa/WKContentRuleList.mm: * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm: * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.mm: * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: * UIProcess/API/Cocoa/_WKApplicationManifest.h: * UIProcess/API/Cocoa/_WKAttachment.h: * UIProcess/API/Cocoa/_WKResourceLoadInfoInternal.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstPartyInternal.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdPartyInternal.h: * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.mm: * UIProcess/API/Cocoa/_WKUserContentFilter.mm: * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponseInternal.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h: * UIProcess/Authentication/mac/WebCredentialMac.mm: * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm: * UIProcess/Cocoa/IconLoadingDelegate.mm: * UIProcess/Cocoa/MediaUtilities.mm: * UIProcess/Cocoa/PreferenceObserver.h: * UIProcess/Cocoa/PreferenceObserver.mm: * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm: * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h: * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: * UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.h: * UIProcess/Cocoa/WKEditCommand.h: * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm: * UIProcess/Inspector/mac/WKInspectorViewController.h: * UIProcess/Inspector/mac/WKInspectorWKWebView.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: * UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.h: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: * UIProcess/ios/WKDeferringGestureRecognizer.h: * UIProcess/ios/WKHighlightLongPressGestureRecognizer.h: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: * UIProcess/ios/forms/WKDatePickerViewController.h: * UIProcess/ios/forms/WKDatePickerViewController.mm: * UIProcess/ios/forms/WKFocusedFormControlView.h: * UIProcess/ios/forms/WKFocusedFormControlView.mm: * UIProcess/ios/forms/WKFormColorPicker.mm: * UIProcess/ios/forms/WKNumberPadViewController.h: * UIProcess/ios/forms/WKNumberPadViewController.mm: * UIProcess/ios/forms/WKQuickboardListViewController.h: * UIProcess/ios/forms/WKQuickboardListViewController.mm: * UIProcess/ios/forms/WKSelectMenuListViewController.h: * UIProcess/ios/forms/WKTimePickerViewController.h: * UIProcess/ios/forms/WKTimePickerViewController.mm: * UIProcess/ios/fullscreen/WKFullScreenViewController.h: * UIProcess/ios/fullscreen/WKFullscreenStackView.h: * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: * UIProcess/mac/PageClientImplMac.mm: * UIProcess/mac/WKSharingServicePickerDelegate.h: * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: * WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.h: * WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm: * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp: * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.h: * WebProcess/WebPage/mac/PageBannerMac.mm: * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h: * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.h: * WebProcess/cocoa/WebProcessCocoa.mm: More #import, less #pragma once. 2020-04-20 Pablo Saavedra <psaavedra@igalia.com> [GTK][WPE] lowWatermarkPages() in MemoryPressureMonitor.cpp only searches the "low" value inside the first "Node" section https://bugs.webkit.org/show_bug.cgi?id=210345 Reviewed by Adrian Perez de Castro. * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::lowWatermarkPages): 2020-04-20 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][WPE] Enable resource load statistics https://bugs.webkit.org/show_bug.cgi?id=210184 Reviewed by Žan Doberšek. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): Pass page and frame identifiers to the constructor. (WebKit::NetworkDataTask::isThirdPartyRequest const): Moved from NetworkDataTaskCocoa.mm. (WebKit::NetworkDataTask::restrictRequestReferrerToOriginIfNeeded): Ditto. * NetworkProcess/NetworkDataTask.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Initialize m_frameID and m_pageID. (WebKit::NetworkDataTaskSoup::createRequest): Add WasBlockingCookies parameter. Call restrictRequestReferrerToOriginIfNeeded() and disable cookies in the soup message if cookies should be blocked. (WebKit::NetworkDataTaskSoup::clearRequest): Reset m_isBlockingCookies. (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Pass WasBlockingCookies to createRequest(). * NetworkProcess/soup/NetworkDataTaskSoup.h: * UIProcess/API/C/WKPage.cpp: (WKPageLoadedThirdPartyDomains): Added for tests. (WKPageClearLoadedThirdPartyDomains): Ditto. * UIProcess/API/C/WKPagePrivate.h: * UIProcess/glib/WebsiteDataStoreGLib.cpp: (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Use lowercase for consistency with other default directories. 2020-04-20 David Kilzer <ddkilzer@apple.com> REGRESSION (r259610): Leak of RBSAssertionInvalidationCallbackType due to missing -dealloc <https://webkit.org/b/210711> <rdar://problem/61993361> Reviewed by Geoffrey Garen. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKRBSAssertionDelegate dealloc]): Add. - Release _invalidationCallback to fix the leak. 2020-04-19 Brady Eidson <beidson@apple.com> Add WKScriptMessageHandler API that asynchronously responds with a promise. rdar://problem/57243492 and https://bugs.webkit.org/show_bug.cgi?id=206398 Reviewed by Andy Estes. Change webkit.messageHandlers.<name>.postMessage() to return a promise instead of undefined. Allow for that promise to be resolved by an asynchronous reply block up in the API client. This is like the spiritual opposite version of [WKWebView callAsyncFunction:...] And while we're adding a new script message handler variant, we're adding it sandboxed by WKContentWorld. * Shared/API/APISerializedScriptValue.h: * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm: (API::validateObject): (API::coreValueFromNSObject): (API::SerializedScriptValue::createFromNSObject): (API::SerializedScriptValue::wireBytesFromNSObject): Deleted. * UIProcess/API/Cocoa/WKScriptMessage.h: Now that script message handlers can be per-world, messages declare which world they were posted from. * UIProcess/API/Cocoa/WKScriptMessage.mm: (-[WKScriptMessage _initWithBody:webView:frameInfo:name:world:]): (-[WKScriptMessage world]): (-[WKScriptMessage _initWithBody:webView:frameInfo:name:]): Deleted. * UIProcess/API/Cocoa/WKScriptMessageInternal.h: * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: Added. Declare the new protocol for a script message handler that can reply to messages asynchronously. * UIProcess/API/Cocoa/WKUserContentController.h: * UIProcess/API/Cocoa/WKUserContentController.mm: (-[WKUserContentController _addScriptMessageHandler:]): (-[WKUserContentController addScriptMessageHandler:name:]): (-[WKUserContentController addScriptMessageHandler:contentWorld:name:]): (-[WKUserContentController addScriptMessageHandlerWithReply:contentWorld:name:]): (-[WKUserContentController removeScriptMessageHandlerForName:contentWorld:]): (-[WKUserContentController removeAllScriptMessageHandlersFromContentWorld:]): (-[WKUserContentController removeAllScriptMessageHandlers]): * UIProcess/API/Cocoa/WKUserContentControllerInternal.h: * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): Update for new shared API::SerializedScriptValue initialization. * UIProcess/API/glib/WebKitUserContentManager.cpp: * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp: * UIProcess/UserContent/WebScriptMessageHandler.h: * UIProcess/UserContent/WebUserContentControllerProxy.cpp: (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers): (WebKit::WebUserContentControllerProxy::didPostMessage): * UIProcess/UserContent/WebUserContentControllerProxy.h: * UIProcess/UserContent/WebUserContentControllerProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp: (webkit_dom_dom_window_webkit_message_handlers_post_message): * WebProcess/UserContent/WebUserContentController.cpp: (WebKit::WebUserContentController::removeAllUserScriptMessageHandlers): (WebKit::WebUserContentController::removeAllUserScriptMessageHandlersForWorlds): * WebProcess/UserContent/WebUserContentController.h: * WebProcess/UserContent/WebUserContentController.messages.in: 2020-04-19 David Kilzer <ddkilzer@apple.com> REGRESSION (r244091): Leak of TaskStateChangedCallbackType due to missing -dealloc <https://webkit.org/b/210710> <rdar://problem/61992856> Reviewed by Darin Adler. * Shared/Cocoa/ProcessTaskStateObserver.mm: (-[WKProcessTaskStateObserverDelegate dealloc]): Add. - Release _taskStateChangedCallback to fix the leak. 2020-04-19 David Kilzer <ddkilzer@apple.com> [IPC hardening] Use MESSAGE_CHECK in WebPageProxy::loadRecentSearches() and WebPageProxy::saveRecentSearches() <https://webkit.org/b/210683> <rdar://problem/59240446> Reviewed by Geoffrey Garen. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (MESSAGE_CHECK): Add. (MESSAGE_CHECK_COMPLETION): Add. (WebKit::WebPageProxy::saveRecentSearches): (WebKit::WebPageProxy::loadRecentSearches): - Replace boolean check of const String& with MESSAGE_CHECK. 2020-04-18 Darin Adler <darin@apple.com> Update header postprocessing version cutoff to keep Apple internal builds working https://bugs.webkit.org/show_bug.cgi?id=210708 Reviewed by Brady Eidson. * Configurations/WebKit.xcconfig: Update versions to make building with older Apple internal SDKs continue to work. * Shared/API/Cocoa/WKFoundation.h: * Shared/API/Cocoa/_WKFrameHandle.h: * Shared/API/Cocoa/_WKRemoteObjectInterface.h: * UIProcess/API/Cocoa/WKContentWorld.h: * UIProcess/API/Cocoa/WKFindConfiguration.h: * UIProcess/API/Cocoa/WKFindResult.h: * UIProcess/API/Cocoa/WKFrameInfoPrivate.h: * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKPDFConfiguration.h: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.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/_WKRemoteWebInspectorViewController.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: Because the way we do post-processing of headers in the legacy Xcode build system won't work once the files have been processed once, touch each file that has WK_MAC_TBA, WK_IOS_TBA, or WK_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED in it. Found something to change in each file. This is likely unnecessary in the new Xcode build system, but I wasn't able to test that locally. * WebKit.xcodeproj/project.pbxproj: (postprocess-header-rule): Added dependencies so that post-processing will be redone if Configurations/WebKit.xcconfig is touched, since that is where WK_FRAMEWORK_HEADER_POSTPROCESSING_DISABLED is set, or if Scripts/postprocess-header-rule is touched, since that is where the post-processing code is. If either of those files changes it could affect the output of post-processing. This should make a change like this work in the new Xcode build system without touching files as is done above. 2020-04-18 Brady Eidson <beidson@apple.com> Fix WebUserContentControllerProxy vs ContentWorld lifetime https://bugs.webkit.org/show_bug.cgi?id=210700 Reviewed by Alex Christensen. Covered by API test. WebUserContentControllerProxy currently keeps all of its associated API::ContentWorlds alive via RefPtrs. This is despite the fact that all of the associated WebScriptMessageHandlers, UserScripts, and UserStyleSheets already keep their associated API::ContentWorlds alive. It then decideds to tell WebProcesses to forget a content world after all of its clients are removed. Unfortunately, content worlds are used for more than just content controller stuff. They're used for direct JavaScript evaluation as well. So a client could: - Add a script message handler in a content world. - Evaluate JavaScript in that content world, setting up some persistent state. - Remove the script message handler. - Find that their persistent state from the JavaScript evaluation is gone from that world, even though they still retain a usable handle to that world. The only party who has any business managing the lifetime of an API::ContentWorld is the API::ContentWorld itself. Making this change is: 1 - Nice cleanup 2 - Fixes the above mentioned bug * UIProcess/API/APIContentWorld.cpp: (API::ContentWorld::worldForIdentifier): (API::ContentWorld::ContentWorld): (API::ContentWorld::sharedWorldWithName): (API::ContentWorld::~ContentWorld): (API::ContentWorld::addAssociatedUserContentControllerProxy): (API::ContentWorld::userContentControllerProxyDestroyed): * UIProcess/API/APIContentWorld.h: * UIProcess/UserContent/WebUserContentControllerProxy.cpp: (WebKit::WebUserContentControllerProxy::parameters const): (WebKit::WebUserContentControllerProxy::addContentWorld): (WebKit::WebUserContentControllerProxy::contentWorldDestroyed): (WebKit::WebUserContentControllerProxy::addUserScript): (WebKit::WebUserContentControllerProxy::removeUserScript): (WebKit::WebUserContentControllerProxy::removeAllUserScripts): (WebKit::WebUserContentControllerProxy::addUserStyleSheet): (WebKit::WebUserContentControllerProxy::removeUserStyleSheet): (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets): (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler): (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName): (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers): (WebKit::WebUserContentControllerProxy::addContentWorldUse): Deleted. (WebKit::WebUserContentControllerProxy::shouldSendRemoveContentWorldsMessage): Deleted. (WebKit::WebUserContentControllerProxy::removeContentWorldUses): Deleted. * UIProcess/UserContent/WebUserContentControllerProxy.h: 2020-04-18 David Kilzer <ddkilzer@apple.com> Attempt #4 to fix tvOS build Unreviewed. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): - Add #if ENABLE(VIDEO_PRESENTATION_MODE)/#endif to protect function defined in WebCore/PictureInPictureSupport.h. - See previous build fixes in r260307, r260308 and r260313. 2020-04-18 Alex Christensen <achristensen@webkit.org> Fix client certificate authentication when using non-default WKWebsiteDataStores https://bugs.webkit.org/show_bug.cgi?id=210681 Reviewed by Brady Eidson. NetworkProcessProxy was trying to keep a map of WebsiteDataStores, but it wasn't as accurate as the one WebsiteDataStore was maintaining. Use the latter map instead and client certificate authentication works. Otherwise, the credential isn't serialized correctly. I found this while working on <rdar://problem/60340449> but this was unrelated so I put it in a different change. This may fix <rdar://problem/60910392>. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID): 2020-04-18 Pablo Saavedra <psaavedra@igalia.com> [GTK][WPE] Replace evil strtok() calls with fscanf() in MemoryPressureMonitor.cpp https://bugs.webkit.org/show_bug.cgi?id=210346 Reviewed by Adrian Perez de Castro. * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::lowWatermarkPages): (WebKit::getCgroupControllerPath): (WebKit::systemMemoryUsedAsPercentage): (WebKit::CGroupMemoryController::getCgroupFileValue): 2020-04-18 Rob Buis <rbuis@igalia.com> Reduce parameter list of the FrameLoadRequest constructor https://bugs.webkit.org/show_bug.cgi?id=210668 Reviewed by Darin Adler. Adapt to API change. * WebProcess/Inspector/WebInspector.cpp: (WebKit::WebInspector::openInNewTab): * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performFrameLoadURLRequest): (WebKit::PluginView::loadURL): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadURLInFrame): (WebKit::WebPage::loadDataInFrame): (WebKit::WebPage::loadRequest): (WebKit::WebPage::loadDataImpl): 2020-04-18 David Kilzer <ddkilzer@apple.com> [IPC hardening] Use MESSAGE_CHECK in WebPasteboardProxy <https://webkit.org/b/210684> <rdar://problem/59906721> Reviewed by Wenson Hsieh. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: - Add missing #undef of MESSAGE_CHECK_COMPLETION and MESSAGE_CHECK_WITH_RETURN_VALUE. (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType): (WebKit::WebPasteboardProxy::getPasteboardStringForType): (WebKit::WebPasteboardProxy::getPasteboardStringsForType): (WebKit::WebPasteboardProxy::getPasteboardBufferForType): (WebKit::WebPasteboardProxy::setPasteboardStringForType): (WebKit::WebPasteboardProxy::setPasteboardBufferForType): (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): (WebKit::WebPasteboardProxy::readStringFromPasteboard): (WebKit::WebPasteboardProxy::readBufferFromPasteboard): - Replace existing code with MESSAGE_CHECK_COMPLETION macros. * UIProcess/WebPasteboardProxy.cpp: (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: - Add IPC::Connection to TypesSafeForDOMToReadAndWrite. 2020-04-17 Kate Cheney <katherine_cheney@apple.com> Enable service workers for app-bound domains https://bugs.webkit.org/show_bug.cgi?id=210451 <rdar://problem/61479474> Reviewed by Brent Fulgham. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::createFetchTask): (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad): (WebKit::NetworkConnectionToWebProcess::swConnection): (WebKit::NetworkConnectionToWebProcess::isServiceWorkerAllowed const): Deleted. * NetworkProcess/NetworkConnectionToWebProcess.h: Removed ASSERTS and service worker entitlement checks which are now done along with app-bound domain checks in SWServer.cpp. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::addWebsiteDataStore): Remove the check for parentProcessHasServiceWorkerEntitlement() before adding a serviceWorkerSession. This doesn't do anything except add an entry to a map, and simplifies the case where we need a session for app-bound instances which should have service workers but have no entitlement. Pass the entitlement and a new callback to request app-bound domains from the UI Process to the SWServer. This will make sure the server checks for the entitlement or list of app-bound domains before completing a load. (WebKit::NetworkProcess::registerSWServerConnection): Remove unnecessary ASSERT for entitlement. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/ios/NetworkProcessIOS.mm: (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const): (WebKit::NetworkProcess::disableServiceWorkerEntitlement): (WebKit::NetworkProcess::clearServiceWorkerEntitlementOverride): In order to test this thoroughly, TestWebKitAPI needed a way to temporarily disable the service worker entitlement. This function overrides the check for the entitlement if the bool is set, disabling the entitlement. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: WebPage needs to know if it is app-bound when created so it can update the service worker preferences key accordingly. * Shared/WebPreferences.yaml: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _serviceWorkerEntitlementDisabledForTesting]): (-[WKPreferences _setServiceWorkerEntitlementDisabledForTesting:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Disable entitlement for testing. * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::limitsNavigationsToAppBoundDomains const): (API::PageConfiguration::setLimitsNavigationsToAppBoundDomains): (API::PageConfiguration::limitsNavigationToAppBoundDomains const): Deleted. (API::PageConfiguration::setLimitsNavigationToAppBoundDomains): Deleted. (-[WKWebViewConfiguration limitsNavigationsToAppBoundDomains]): (-[WKWebViewConfiguration setLimitsNavigationsToAppBoundDomains:]): (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]): Deleted. (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]): Deleted. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: Inconsistent naming (Navigation vs Navigations). * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setupPageConfiguration:]): Check for entitlement or app-bound webview. (-[WKWebView _serviceWorkersEnabled:]): (-[WKWebView _clearServiceWorkerEntitlementOverride:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: Testing SPIs. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getAppBoundDomains): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: Sends the app-bound domains to the Network Process. * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::m_limitsNavigationToAppBoundDomains): Deleted. Naming inconsistency. (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess): (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride): * UIProcess/WebPageProxy.h: Disable entitlement for testing. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_isNavigatingToAppBoundDomain): Set this parameter in the constructor so it will be accurate when updating preferences. (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::clearServiceWorkerEntitlementOverride): * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const): (WebKit::WebPage::disableServiceWorkerEntitlement): (WebKit::WebPage::clearServiceWorkerEntitlementOverride): Disable entitlement for testing. 2020-04-17 Alex Christensen <achristensen@webkit.org> NetworkSessionCocoa should request client certificate only once per host/port https://bugs.webkit.org/show_bug.cgi?id=210626 <rdar://problem/60340449> Reviewed by Geoffrey Garen. NSURLSession creates more than one TCP connection to a server when using HTTP 1.1. Each TCP connection with TLS generates a didReceiveChallenge to do the server trust evaluation of the certificate chain. If the server requests a client certificate in the TLS handshake, it also generates a didReceiveChallenge to request client certificates as well. This is an implementation detail of our networking. We should not actually ask the WKNavigationDelegate for client certificates more than once per host/port. We should remember the credential and give it to NSURLSession immediately if we have used this credential in the past for a task that has received bytes (either a response or a redirect). If the TLS handshake fails, we should not reuse that same certificate automatically. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): (WebKit::NetworkSessionCocoa::clientCertificateSuggestedForHost): (WebKit::NetworkSessionCocoa::taskReceivedBytes): (WebKit::NetworkSessionCocoa::taskFailed): (WebKit::NetworkSessionCocoa::successfulClientCertificateForHost const): 2020-04-17 David Kilzer <ddkilzer@apple.com> Bug 210646: REGRESSION (r260112): createArchiveList() leaks malloc memory on early returns due to an error <https://webkit.org/b/210646> <rdar://problem/61928031> Reviewed by Darin Adler. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createArchiveList): - Move early returns for protocolProperties, protocolProperties and mimeType above memory allocation to fix the memory leak. 2020-04-17 Brady Eidson <beidson@apple.com> Pass sandbox extensions for back/forward list navigations after the policy is decided at process-swap time. <rdar://problem/59535167> and https://bugs.webkit.org/show_bug.cgi?id=210623 Reviewed by Geoff Garen. Covered by almost all existing tests, and a new API test. Instead of granting a sandbox extension when updating the back/forward cursor for a pending back/forward list traversal, do so after the client decides the policy. (Which is also along with a process swap in interesting cases) * Shared/PolicyDecision.h: (WebKit::PolicyDecision::encode const): (WebKit::PolicyDecision::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APINavigation.cpp: (API::Navigation::Navigation): * UIProcess/API/APINavigation.h: (API::Navigation::create): (API::Navigation::reloadItem const): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::backForwardGoToItem): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::createReloadNavigation): * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::launchProcessForReload): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::WebBackForwardListProxy::goToItem): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::SandboxExtensionTracker::didStartProvisionalLoad): 2020-04-17 David Kilzer <ddkilzer@apple.com> REGRESSION (r234105): [iOS] WKColorButton leaks a UIColor <https://webkit.org/b/210658> <rdar://problem/61938137> Reviewed by Darin Adler. * UIProcess/ios/forms/WKFormColorPicker.mm: (-[WKColorButton dealloc]): Add. - Release _color instance variable to fix leak. 2020-04-17 Per Arne Vollan <pvollan@apple.com> [iOS] Deny iokit open access of unused class in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=210669 Reviewed by Brent Fulgham. Telemetry shows that iokit open access of an iokit class can be removed from the WebContent sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-17 Chris Dumez <cdumez@apple.com> [iOS] Refactor WebKit uploads process assertion logic to minimize chances of leaking them https://bugs.webkit.org/show_bug.cgi?id=210664 <rdar://problem/61751982> Reviewed by Geoff Garen. To minimize chances of leaking "WebKit uploads" process assertion, the following refactoring was done: 1. WebKit upload assertions are now held by NetworkProcessProxy instead of the WebProcessPool. This makes more sense since uploads are tied to a particular network process. In base of a network process crash, we would not want those assertions to persist for example. 2. Store all upload assertions (UIProcess + NetworkProcess + WebProcesses) into a single UploadActivity data structure that can easily be cleared. Make sure we clear it on network process crash. 3. No longer on the WebProcess to send IPC whenever its has pending uploads or not. Instead, have the network process send such IPC. This makes more sense, especially now that all webkit upload process assertions are now stored on NetworkProcessProxy. It also makes it so that we deal properly with WebProcess crashes. In case of a WebProcess crash, its connection to the network process will get closed. NetworkConnectionToWebProcess::didClose() gets called and causes all NetworkResourceLoader objects for this connection to get destroyed. As a result, the network process will properly notify the UIProcess that this process no longer has any upload in progress. * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess): (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess): (WebKit::NetworkConnectionToWebProcess::hasUploadStateChanged): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkResourceLoadMap.cpp: (WebKit::NetworkResourceLoadMap::NetworkResourceLoadMap): (WebKit::NetworkResourceLoadMap::~NetworkResourceLoadMap): (WebKit::NetworkResourceLoadMap::add): (WebKit::NetworkResourceLoadMap::clear): (WebKit::NetworkResourceLoadMap::take): (WebKit::NetworkResourceLoadMap::setHasUpload): * NetworkProcess/NetworkResourceLoadMap.h: (WebKit::NetworkResourceLoadMap::hasUpload const): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::setWebProcessHasUploads): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/ProcessAssertion.cpp: (WebKit::ProcessAssertion::ProcessAssertion): * UIProcess/ProcessAssertion.h: (WebKit::ProcessAssertion::pid const): * UIProcess/WebProcessPool.cpp: * UIProcess/WebProcessPool.h: * UIProcess/WebProcessPool.messages.in: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): * UIProcess/WebProcessProxy.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): (WebKit::WebLoaderStrategy::remove): (WebKit::WebLoaderStrategy::loadResourceSynchronously): * WebProcess/Network/WebLoaderStrategy.h: 2020-04-17 Jer Noble <jer.noble@apple.com> Bring Fullscreen API + alert() behavior from iOS to macOS https://bugs.webkit.org/show_bug.cgi?id=210662 Reviewed by Eric Carlson. When a page is showing an alert(), all non-synchronous messages will be blocked until the sync XPC for alert() ends. And when exiting fullscreen, we block completing the fullscreen exit animation until a repaint XPC completes. So a page that is showing an alert() will never fully exit element fullscreen mode. On iOS, we fixed this behavior by exiting fullscreen mode whenever the page shows an alert() or prompt(). We should bring this behavior to macOS as well. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::runJavaScriptAlert): (WebKit::WebPageProxy::runJavaScriptConfirm): (WebKit::WebPageProxy::runJavaScriptPrompt): 2020-04-17 Don Olmstead <don.olmstead@sony.com> [CMake] Add WebKit::WebCore target https://bugs.webkit.org/show_bug.cgi?id=210445 Reviewed by Michael Catanzaro. Use the WebKit::WebCore target within the WebKit target. * CMakeLists.txt: * PlatformGTK.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: 2020-04-17 Simon Fraser <simon.fraser@apple.com> Turn async frame and overflow scrolling on by default on macOS https://bugs.webkit.org/show_bug.cgi?id=210661 rdar://problem/60420037 Reviewed by Tim Horton. Flip the plist value and the default value for macOS which is outside of the feature flag #ifdef. Testing keeps async overflow scrolling off by default, so this should not affect testing. This only impacts WebKit2. * FeatureFlags/WebKit.plist: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled): 2020-04-17 Per Arne Vollan <pvollan@apple.com> [iOS] Add telemetry to some mach lookup sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=210657 Reviewed by Darin Adler. Add telemetry in order to learn more about how some of the mach lookup extensions are being used in the WebContent process on iOS. No new tests, since this patch does not change any behavior. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-17 Youenn Fablet <youenn@apple.com> Validate socket in NetworkRTCProvider::wrapNewTCPConnection https://bugs.webkit.org/show_bug.cgi?id=210594 Reviewed by Eric Carlson. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::wrapNewTCPConnection): Add a null check in case the identifier does not relate to an existing pending socket. 2020-04-17 Peng Liu <peng.liu6@apple.com> Cleanup the macros for video fullscreen and picture-in-picture https://bugs.webkit.org/show_bug.cgi?id=210638 Reviewed by Eric Carlson. Replace some "#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))" and all "#if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))" with "#if ENABLE(VIDEO_PRESENTATION_MODE)". * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenGravity): (WebKit::RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage): (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode): (WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged): * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::viewDidLeaveWindow): (WebKit::WebPageProxy::exitFullscreenImmediately): * UIProcess/WebPageProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: * WebProcess/WebCoreSupport/WebChromeClient.cpp: * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::~WebPage): * WebProcess/WebPage/WebPage.h: * WebProcess/cocoa/VideoFullscreenManager.h: * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: 2020-04-17 Claudio Saavedra <csaavedra@igalia.com> [GTK] Update for GdkKeymap API changes https://bugs.webkit.org/show_bug.cgi?id=210642 Reviewed by Adrian Perez de Castro. No new tests needed. gdk_keymap_get_default() is deprecated in GTK+ 3.22, so use gdk_keymap_get_for_display() instead. Since in GTK4 this method is removed to gdk_display_get_keymap(), add a helper to GtkVersioning.h to avoid cluttering with ifdefs all over the place. * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::doKeyStrokeEvent): 2020-04-17 Antoine Quint <graouts@apple.com> Allow the UserStyleLevel to be set through _WKUserStyleSheet https://bugs.webkit.org/show_bug.cgi?id=210653 <rdar://problem/60506645> Reviewed by Tim Horton. Add a new _WKUserStyleLevel enum such that we may provide the specificity level of the backing UserStyleSheet, represented by the UserStyleLevel enum in WebCore. * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:level:userContentWorld:]): (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:level:userContentWorld:]): (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:userContentWorld:]): Deleted. * UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h: (API::toWebCoreUserStyleLevel): 2020-04-17 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][X11] REGRESSION(r259944): Wrong position of select popup menu in X11 https://bugs.webkit.org/show_bug.cgi?id=210603 Reviewed by Michael Catanzaro. gdk_window_move_to_rect expects the given rectangle in coordinates relative to the top-left corner of the window that the popup window is transient for. We were using screen coordinates. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Translate widget coordinates to window coordinates before passing the rectangle to gdk_window_move_to_rect(). 2020-04-17 David Kilzer <ddkilzer@apple.com> REGRESSION (r256756): -[WKUserDefaults initWithSuiteName:]: Instance variable used while 'self' is not set to the result of '[(super or self) init...]' <https://webkit.org/b/210647> <rdar://problem/61928289> Reviewed by Anders Carlsson. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKUserDefaults initWithSuiteName:]): - Call `[self initWithSuite:]` and set `self` to fix the clang static analyzer warning. - Fix camelCase of `suitename` parameter. 2020-04-17 Per Arne Vollan <pvollan@apple.com> [iOS] Deny iokit open access to graphics related classes https://bugs.webkit.org/show_bug.cgi?id=210616 Reviewed by Darin Adler. Deny iokit open access to graphics related classes in the WebContent process on iOS, but issue extensions for these for some devices which still need access to them. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::sandboxExtensionForType): (WebKit::SandboxExtension::createHandleForIOKitClassExtension): * Shared/SandboxExtension.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _setDeviceHasAGXCompilerServiceForTesting]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::deviceHasAGXCompilerService): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setDeviceHasAGXCompilerServiceForTesting const): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-04-17 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] UI process crash when entering compositing mode when WPE_RENDERER is enabled https://bugs.webkit.org/show_bug.cgi?id=209118 Reviewed by Michael Catanzaro. Check if EGL_WL_bind_wayland_display extension is available when using WPE_RENDERER, since we don't suport the SHM interface. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::checkRequirements): Return false if EGL_WL_bind_wayland_display is not present. 2020-04-17 Rob Buis <rbuis@igalia.com> Move allowPlugins to FrameLoader https://bugs.webkit.org/show_bug.cgi?id=205876 Reviewed by Darin Adler. 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-04-16 Peng Liu <peng.liu6@apple.com> Cleanup the usage of ENABLE_FULLSCREEN_API https://bugs.webkit.org/show_bug.cgi?id=210630 Reviewed by Daniel Bates. Replace "#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API" with "#if ENABLE(FULLSCREEN_API)". No new tests, no functional change * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetFullScreenClient): (WKBundlePageWillEnterFullScreen): (WKBundlePageDidEnterFullScreen): (WKBundlePageWillExitFullScreen): (WKBundlePageDidExitFullScreen): 2020-04-16 Kate Cheney <katherine_cheney@apple.com> Distinguish between an empty WKAppBoundDomains array and a missing entry https://bugs.webkit.org/show_bug.cgi?id=210628 <rdar://problem/61909669> Reviewed by Brent Fulgham. Currently we treat a missing WKAppBoundDomains key the same as an empty key, which is incorrect. Having the key present, even with no entries, should opt an app into app-bound domain behavior. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::initializeAppBoundDomains): (WebKit::WebsiteDataStore::beginAppBoundDomainCheck): 2020-04-16 Brent Fulgham <bfulgham@apple.com> Add a new 'limitNavigationsToAppBoundDomains' property to WKWebViewConfiguration https://bugs.webkit.org/show_bug.cgi?id=210620 <rdar://problem/61903225> Reviewed by Andy Estes. Follow-up fix. The property exposed by WKWebViewConfiguration should not use a local BOOL; it simply exposes the APIPageConfiguration value. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]): (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]): (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]): 2020-04-16 Brent Fulgham <bfulgham@apple.com> Switch NetworkProcess and NetworkProcessProxy messages to use CallbackID class https://bugs.webkit.org/show_bug.cgi?id=210566 <rdar://problem/61791784> Reviewed by David Kilzer. Instead of using the raw uint64_t type to represent callbacks, use the purpose built WebKit::CallbackID type. Tested by existing cases. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::fetchWebsiteData): (WebKit::NetworkProcessProxy::deleteWebsiteData): (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins): (WebKit::NetworkProcessProxy::didFetchWebsiteData): (WebKit::NetworkProcessProxy::didDeleteWebsiteData): (WebKit::NetworkProcessProxy::didDeleteWebsiteDataForOrigins): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: 2020-04-16 Timothy Horton <timothy_horton@apple.com> Try to fix the macCatalyst build * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (uiImageForImage): (createTargetedPreview): (createFallbackTargetedPreview): (-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]): 2020-04-16 David Kilzer <ddkilzer@apple.com> Re-land: [IPC Hardening] MachMessage::create() should use checked arithmetic <https://webkit.org/b/210572> <rdar://problem/61729947> Reviewed by Chris Dumez. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendOutgoingMessage): - Add nullptr check since MachMessage::create() can return an empty std::unique_ptr<> now. * Platform/IPC/cocoa/MachMessage.cpp: (IPC::MachMessage::create): - Use CheckedSize to compute the buffer size. 2020-04-16 Brent Fulgham <bfulgham@apple.com> Add a new 'limitNavigationsToAppBoundDomains' property to WKWebViewConfiguration https://bugs.webkit.org/show_bug.cgi?id=210620 <rdar://problem/61903225> Reviewed by Andy Estes. Provide a way for Developers to opt-in to AppBound domains through a new WKWebViewConfiguration property. This patch only creates the property and exposes the flag to the APIPageConfiguration and WebPageProxy. A separate patch will take action based on its value. * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::limitsNavigationToAppBoundDomains const): (API::PageConfiguration::setLimitsNavigationToAppBoundDomains): * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]): (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]): (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]): Keep the new property in sync with this internal flag. * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationToAppBoundDomains): * UIProcess/WebPageProxy.h: 2020-04-16 Sergio Villar Senin <svillar@igalia.com> Unreviewed build fix for non unified builds. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: Added missing include. 2020-04-16 Daniel Bates <dabates@apple.com> Remove unused -_focusTextInputContext https://bugs.webkit.org/show_bug.cgi?id=210619 Reviewed by Darin Adler. While this function was in the "SPI" header, there is no software at Apple that was using this funciton and I will assume no non-Apple software was using it either. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _focusTextInputContext:completionHandler:]): Deleted. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: 2020-04-16 Brent Fulgham <bfulgham@apple.com> [macOS] Switch unused IOKit classes from allow-with-report to deny-with-report https://bugs.webkit.org/show_bug.cgi?id=210136 <rdar://problem/61403216> Reviewed by Per Arne Vollan. After tracking telemetry for several weeks, we can now safely switch the default state of a number of IOKit classes from 'allow with telemetry' to 'deny with telemetry'. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-16 Daniel Bates <dabates@apple.com> Fix the iOS build when building without EDITABLE_REGION after r260192 (https://bugs.webkit.org/show_bug.cgi?id=210398) Have -_mayContainEditableElementsInRect compile-time conditionally call WebKit::mayContainEditableElementsInRect(). If ENABLE(EDITABLE_REGION) is not enabled then return NO. * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _mayContainEditableElementsInRect:]): 2020-04-16 David Kilzer <ddkilzer@apple.com> Rollout: [IPC Hardening] MachMessage::create() should use checked arithmetic <https://webkit.org/b/210572> <rdar://problem/61729947> Unreviewed rollout of r260160. Appears to have caused 8 API test failures on iOS. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendOutgoingMessage): * Platform/IPC/cocoa/MachMessage.cpp: (IPC::MachMessage::create): 2020-04-16 Brent Fulgham <bfulgham@apple.com> REGRESSION(r260081) Broke iOS PLT due to InjectedBundle initialization (edit) https://bugs.webkit.org/show_bug.cgi?id=210582 <rdar://problem/61838584> Reviewed by Darin Adler. The changes in r260081 began enforcing NSSecureCoding best practices, triggering a bug in InjectedBundleMac.mm, which is used by iOS as well. This patch does the following: 1. Delays parameter decoding until we use the appropriate InjectedBundle mechanism for expressing the valid classes to use in the Unarchiver. 2. Removes a temporary workaround needed to get PLT running on iOS again. This patch also moves the check of the CFBundleGetFunctionPointerForName slightly earlier so we can use a single function pointer check, and only invoke the parameter decoding if we are using the C API. If not, we delay parameter decoding until we have constructed the WKWebProcessPlugIn object so we can consume it's 'additionalClassesForParameterCoder' before calling its initialization method. * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::decodeBundleParameters): Remove temporary workaround needed to get PLT working again. Instead of using a debug assert, return as a decoding failure if the resulting object is not an NSDictionary. (WebKit::InjectedBundle::initialize): Delay decoding the bundle parameters on iOS until the Plugin's additionalClassesForParameterCoder method can be called. 2020-04-16 Daniel Bates <dabates@apple.com> [iOS] Add a way to focus a text input and place a caret https://bugs.webkit.org/show_bug.cgi?id=210611 <rdar://problem/61893062> Reviewed by Darin Adler. Add some IPI that will be used by code in WebKitAdditions to focus a text input context and place the caret in it. This will replace the existing -focusTextInput SPI, which I will remove in a subsequent commit. * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Fix up code style of signature while I am here. (-[WKWebView _focusTextInputContext:placeCaretAt:completionHandler:]): Added. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _isTextInputContextFocused:]): Added. (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): Added. (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Fix up code style of signature while I am here. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::focusTextInputContextAndPlaceCaret): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::focusTextInputContext): Use auto now that elementForContext() returns a RefPtr. (WebKit::WebPage::elementForContext const): Have it return a RefPtr instead of a raw pointer so callers don't have to remember to take out a ref of otherwise be mindful of the element's lifetime. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::removeTextPlaceholder): Use auto now that elementForContext() returns a RefPtr. (WebKit::WebPage::requestDocumentEditingContext): Ditto. (WebKit::WebPage::focusTextInputContextAndPlaceCaret): Added. 2020-04-16 Chris Dumez <cdumez@apple.com> Use safeRoundPage() instead of round_page() in SharedMemory https://bugs.webkit.org/show_bug.cgi?id=210608 <rdar://problem/60600443> Reviewed by Geoffrey Garen. Use new safeRoundPage() instead of round_page() in SharedMemory, to deal safely with overflows. * Platform/cocoa/SharedMemoryCocoa.cpp: (WebKit::SharedMemory::allocate): (WebKit::makeMemoryEntry): (WebKit::SharedMemory::~SharedMemory): (WebKit::SharedMemory::createHandle): 2020-04-16 Adrian Perez de Castro <aperez@igalia.com> Non-unified build fixes mid April 2020 edition https://bugs.webkit.org/show_bug.cgi?id=210599 Unreviewed build fix. * UIProcess/DeviceIdHashSaltStorage.cpp: Add missing Logging.h header. * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformSetForcedAppearance): Add missing WebCore:: namespace prefix. * UIProcess/linux/MemoryPressureMonitor.h: Add missing wtf/text/CString.h header. 2020-04-16 Daniel Bates <dabates@apple.com> REGRESSION (r259762): Should always hit test for editable elements if the WKWebView is fully editable https://bugs.webkit.org/show_bug.cgi?id=210558 <rdar://problem/61798347> Reviewed by Wenson Hsieh. If the entire WKWebView is marked editable (via SPI -[WKWebView _setEditable]) then always ask the web process to hit test the page because every element is considered editable. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): 2020-04-16 Daniel Bates <dabates@apple.com> Move -_requestTextInputContextsInRect to WKContentView to simplify implementation https://bugs.webkit.org/show_bug.cgi?id=210398 <rdar://problem/61656931> Reviewed by Darin Adler. -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates its implementation: it has to deal with coordinate space differences due to differences in what is the root view on Mac and iOS + it has to know about iOS's custom content views. While this function was in the "SPI" header, there is no software at Apple that was using these outside of WebKit, and I will assume no non-Apple software was using them either. Moving this function to WKContentView lets me simplify the implementation. * Platform/spi/ios/UIKitSPI.h: Add more forward declarations. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted. (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted. (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm. (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and calls the function of the same name on the WKContentView. It takes care to convert the specified rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates. (-[WKWebView _requestDocumentContext:completionHandler:]): Added. (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added. (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified. 2020-04-16 David Kilzer <ddkilzer@apple.com> [IPC Hardening] Use ObjectIdentifier<> for LegacyCustomProtocol <https://webkit.org/b/210580> <rdar://problem/61791686> Reviewed by Chris Dumez. Replace uses of uint64_t with LegacyCustomProtocolID. * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: (WebKit::LegacyCustomProtocolManager::didFailWithError): (WebKit::LegacyCustomProtocolManager::didLoadData): (WebKit::LegacyCustomProtocolManager::didReceiveResponse): (WebKit::LegacyCustomProtocolManager::didFinishLoading): (WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest): (WebKit::LegacyCustomProtocolManager::protocolForID): * NetworkProcess/CustomProtocols/LegacyCustomProtocolID.h: Add. * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp: (WebKit::LegacyCustomProtocolManager::addCustomProtocol): (WebKit::LegacyCustomProtocolManager::removeCustomProtocol): (WebKit::LegacyCustomProtocolManager::startLoading): (WebKit::LegacyCustomProtocolManager::stopLoading): (WebKit::generateCustomProtocolID): Delete. - Replace with LegacyCustomProtocolID::generate(). * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in: * Scripts/webkit/messages.py: * UIProcess/API/APICustomProtocolManagerClient.h: (API::CustomProtocolManagerClient::startLoading): (API::CustomProtocolManagerClient::stopLoading): * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h: * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm: (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]): (WebKit::LegacyCustomProtocolManagerClient::startLoading): (WebKit::LegacyCustomProtocolManagerClient::stopLoading): * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp: (WebKit::LegacyCustomProtocolManagerProxy::startLoading): (WebKit::LegacyCustomProtocolManagerProxy::stopLoading): (WebKit::LegacyCustomProtocolManagerProxy::wasRedirectedToRequest): (WebKit::LegacyCustomProtocolManagerProxy::didReceiveResponse): (WebKit::LegacyCustomProtocolManagerProxy::didLoadData): (WebKit::LegacyCustomProtocolManagerProxy::didFailWithError): (WebKit::LegacyCustomProtocolManagerProxy::didFinishLoading): * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h: - Remove unused typedef and instance variable. * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: - Add LegacyCustomProtocolID.h to project. 2020-04-16 Tim Horton <timothy_horton@apple.com> REGRESSION (r259898): WebKit-based Books views are all blank https://bugs.webkit.org/show_bug.cgi?id=210590 <rdar://problem/61791109> Reviewed by Chris Dumez. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::enterAcceleratedCompositingWithRootLayer): (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): (WebKit::WebViewImpl::setAcceleratedCompositingRootLayerAfterFlush): Deleted. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::enterAcceleratedCompositingMode): (WebKit::PageClientImpl::didFirstLayerFlush): The changes to setAcceleratedCompositingRootLayer in r259898 proved to be wrong in a second way (the first being fixed in r260104): when setAcceleratedCompositingRootLayer is called from updateAcceleratedCompositingMode, because the layer hosting mode changed (Books appears to use app-hosted layers), it incorrectly identified the root layer change as a process swap, resulting in the correct layer never being unhidden. This is enough mistakes that I'm going to try a different approach: put setAcceleratedCompositingRootLayer back to the way it was before, where it immediately updates the layer without any smarts, remove setAcceleratedCompositingRootLayerAfterFlush, because it's no longer necessary, and add enterAcceleratedCompositingWithRootLayer, which is specifically only called in the case where DrawingArea will for-sure send us a follow-up (didFirstLayerFlush) that will unhide the root layer. 2020-04-16 Eric Carlson <eric.carlson@apple.com> [macOS] Update ScreenTime as playback state changes https://bugs.webkit.org/show_bug.cgi?id=210518 <rdar://problem/61181092> Reviewed by Jer Noble. Add a manager that gets media element state changes, and a Cocoa-specific implementation that passes that state to ScreenTime. * Scripts/webkit/messages.py: * Sources.txt: * SourcesCocoa.txt: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::mediaUsageManager): (WebKit::WebPageProxy::addMediaUsageManagerSession): (WebKit::WebPageProxy::updateMediaUsageManagerSessionState): (WebKit::WebPageProxy::removeMediaUsageManagerSession): * UIProcess/Media/MediaUsageManager.cpp: Added. (WebKit::MediaUsageManager::create): (WebKit::reset): (WebKit::MediaUsageManager::addMediaSession): (WebKit::MediaUsageManager::removeMediaSession): (WebKit::MediaUsageManager::updateMediaUsage): * UIProcess/Media/MediaUsageManager.h: Added. * UIProcess/Media/cocoa/MediaUsageManagerCocoa.h: Added. (WebKit::MediaUsageManagerCocoa::SessionMediaUsage::SessionMediaUsage): * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: Added. (WebKit::usageTrackingAvailable): (WebKit::MediaUsageManager::create): (WebKit::MediaUsageManagerCocoa::~MediaUsageManagerCocoa): (WebKit::MediaUsageManagerCocoa::reset): (WebKit::MediaUsageManagerCocoa::addMediaSession): (WebKit::MediaUsageManagerCocoa::removeMediaSession): (WebKit::MediaUsageManagerCocoa::updateMediaUsage): * UIProcess/WebAuthentication/AuthenticatorManager.cpp: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::addMediaUsageManagerSession): (WebKit::WebChromeClient::updateMediaUsageManagerSessionState): (WebKit::WebChromeClient::removeMediaUsageManagerSession): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::addMediaUsageManagerSession): (WebKit::WebPage::updateMediaUsageManagerSessionState): (WebKit::WebPage::removeMediaUsageManagerSession): * WebProcess/WebPage/WebPage.h: 2020-04-16 David Kilzer <ddkilzer@apple.com> [IPC hardening] DrawingArea::updateBackingStoreState() is not used on Apple platforms <https://webkit.org/b/210585> <rdar://problem/61802011> Reviewed by Geoffrey Garen. * UIProcess/DrawingAreaProxy.h: * UIProcess/DrawingAreaProxy.messages.in: * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::updateBackingStoreState): * WebProcess/WebPage/DrawingArea.messages.in: - Use USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER) to protect code not used on Apple platforms. 2020-04-16 Carlos Alberto Lopez Perez <clopez@igalia.com> [GTK] MiniBrowser opens new windows too small causing failures on some WPT tests https://bugs.webkit.org/show_bug.cgi?id=210206 Reviewed by Carlos Garcia Campos. Provide the size of the default window (if is set) when windowRect is called before the window is shown. * UIProcess/API/glib/WebKitUIClient.cpp: 2020-04-16 Tomoki Imai <Tomoki.Imai@sony.com> TextureMapper renders video element with "object-fit: cover" incorrectly https://bugs.webkit.org/show_bug.cgi?id=210544 Reviewed by Žan Doberšek. Propagate GraphicsLayer::contentsClippingRect information to TextureMapperLayer to properly clip the outside of DOM element when the element has "object-fit: cover". Unfortunately, the test is disabled on WebKitGTK due to bug 177536, bug 163528. Test: compositing/video/video-object-fit.html * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::updateSceneState): 2020-04-15 Jer Noble <jer.noble@apple.com> REGRESSION (r260102): ASSERTION FAILED: m_arbitrators.contains(proxy) in WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator https://bugs.webkit.org/show_bug.cgi?id=210589 <rdar://problem/61844208> Reviewed by Eric Carlson. Protect against an assertion in the SharedArbitrator in case where a WebProcess is terminated before it can call endRoutingArbitration(). * UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp: (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate): * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::SharedArbitrator::isInRoutingArbitrationForArbitrator): (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator): (WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator): (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2020-04-15 Tim Horton <timothy_horton@apple.com> REGRESSION (r258337): Crash when right clicking on link that uses the system UI font with optimizeLegibility on Mojave https://bugs.webkit.org/show_bug.cgi?id=210575 <rdar://problem/61646717> Reviewed by Darin Adler. * Shared/Cocoa/ArgumentCodersCocoa.mm: (-[WKSecureCodingFontAttributeNormalizer archiver:willEncodeObject:]): (IPC::encodeSecureCodingInternal): The workaround introduced in r250640 and r251086 for archiving NSFonts with optical sizing attributes is still incomplete, which was recently revealed by making decoding failures more apparent (in r258337). Specifically, the workaround was not applied to fonts encoded inside NSAttributedStrings, which are encoded using a keyed archiver... only to fonts encoded directly with CoreIPC. Use a NSKeyedArchiver delegate to apply our fix-up to the optical sizing attribute when any NSFont is being encoded, and only on platforms that still exhibit the bug. * Shared/Cocoa/CoreTextHelpers.h: * Shared/Cocoa/CoreTextHelpers.mm: (WebKit::fontWithAttributes): (WebKit::fontDescriptorWithFontAttributes): Deleted. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::updateFontManagerIfNeeded): * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::showPopupMenu): Refactor fontDescriptorWithFontAttributes to just return a font since that's what all callers actually want. 2020-04-15 John Wilander <wilander@apple.com> Add SPI to configure WebsiteDataStores with a URL for standalone web applications and use it to disable first-party website data removal in ITP https://bugs.webkit.org/show_bug.cgi?id=209634 <rdar://problem/60943970> Reviewed by Alex Christensen. This change adds a new property to _WKWebsiteDataStoreConfiguration.h called standaloneApplicationURL with which the hosting application can inform the website data store that it's running as a standalone web application. This change also forwards an existing standaloneApplicationURL as a WebCore::RegistrableDomain into ITP so that explicit exemptions can be made to first parties of standalone web applications. The exemptions made here all for all of ITP's website data removal. This part of the change is covered by the new layout tests. Tests: http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion-database.html http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: (WebKit::ResourceLoadStatisticsStore::setStandaloneApplicationDomain): (WebKit::ResourceLoadStatisticsStore::standaloneApplicationDomain const): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setStandaloneApplicationDomain): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::forwardResourceLoadStatisticsSettings): * NetworkProcess/NetworkSession.h: * Shared/ResourceLoadStatisticsParameters.h: (WebKit::ResourceLoadStatisticsParameters::encode const): (WebKit::ResourceLoadStatisticsParameters::decode): * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration standaloneApplicationURL]): (-[_WKWebsiteDataStoreConfiguration setStandaloneApplication:]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureNetworkProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::standaloneApplicationURL const): (WebKit::WebsiteDataStoreConfiguration::setStandaloneApplicationURL): 2020-04-15 Chris Dumez <cdumez@apple.com> [IPC Hardening] MachMessage::messageSize() should use checked arithmetic https://bugs.webkit.org/show_bug.cgi?id=210567 <rdar://problem/61734355> Reviewed by Geoffrey Garen. Replace call to round_msg() call with a call to our new safeRoundMsg() which does the same alignment up but using checked arithmetic to protect against overflows. * Platform/IPC/cocoa/MachMessage.cpp: (IPC::safeRoundMsg): (IPC::MachMessage::messageSize): 2020-04-15 David Kilzer <ddkilzer@apple.com> [IPC Hardening] MachMessage::create() should use checked arithmetic <https://webkit.org/b/210572> <rdar://problem/61729947> Reviewed by Chris Dumez. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendOutgoingMessage): - Add nullptr check since MachMessage::create() can return an empty std::unique_ptr<> now. * Platform/IPC/cocoa/MachMessage.cpp: (IPC::MachMessage::create): - Use CheckedSize to compute the buffer size. 2020-04-15 Brent Fulgham <bfulgham@apple.com> Unreviewed PLT fix after r260081. * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::decodeBundleParameters): 2020-04-15 Ben Nham <nham@apple.com> DidFirstLayerFlush IPC can be head-of-line-blocked and delay first paint by 200+ ms on process swap https://bugs.webkit.org/show_bug.cgi?id=210571 Reviewed by Geoffrey Garen. When we process swap, the layer swap/unhiding for the new hosted layer is gated by the DidFirstLayerFlush IPC. But actually sending this IPC can be head-of-line blocked for an arbitrarily long time because we append it to the queue of messages for the main run loop to process. In some cases, e.g. for the NYT PLT content, this blocks first paint by 200 ms while the WebProcess main thread is busy doing other things (like executing deferred scripts). To fix this, use a CATransaction commit handler to send the IPC right after we commit. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded): 2020-04-15 Wenson Hsieh <wenson_hsieh@apple.com> Unreviewed, fix the watchOS and tvOS builds after r260146 Move some code for controlling the presentation of context menus on iOS behind USE(UICONTEXTMENU). * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKContentViewInteraction.mm: 2020-04-15 Peng Liu <peng.liu6@apple.com> Video elements don't return to the correct position when exiting fullscreen https://bugs.webkit.org/show_bug.cgi?id=210529 Reviewed by Jer Noble. Some web pages use the "resize" event handler to calculate the element size after they exit fullscreen, and the calculation is based on the container element size which might be affected by the fullscreen mode. We need to call WebPageProxy::setNeedsDOMWindowResizeEvent() to fire the "resize" event in the repaint callback after the exiting fullscreen process is completed and the possible layout change due to exiting fullscreen is done. Otherwise the size calculation might be wrong. * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _completedExitFullScreen]): * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setNeedsDOMWindowResizeEvent): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-04-15 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Some pages indefinitely zoom in and out due to idempotent text autosizing https://bugs.webkit.org/show_bug.cgi?id=210551 <rdar://problem/56820674> Reviewed by Tim Horton. On a non-responsive web page with one or lines of non-wrapping text of a specific length (just under 1920px), it's possible for the combination of idempotent text autosizing heuristics and viewport shrink-to-fit to cause the single line of text to grow and shrink in size indefinitely, and additionally cause the initial scale to thrash between multiple values indefinitely. This manifests in the entire page repeatedly zooming in and out immediately after page load. Consider the following scenario: (1) A viewport configuration change (e.g. due to parsing the viewport meta tag) schedules the timer to reset idempotent text autosizing. Let's suppose the page has a really long line of non-wrapping 12px text that is below 1920px wide. (2) The timer fires, invalidating styles and recomputing text autosizing given the current initial scale. The current initial scale is below 1, since ViewportConfiguration will attempt to shrink to fit the page to avoid horizontal scrolling. This causes text autosizing to boost the long line of text to a larger value (let's say 17px). (3) The next time we perform style recomputation and layout, we discover that the content width of the page is now larger than 1920px, which is the maximum width which we'll attempt to shrink to fit; when computing initial scale, we give up trying to shrink down to avoid making the inital scale too small, and instead just keep it at 1. (4) This change in viewport configuration then schedules another idempotent text autosizing reset. When this timer fires, it sees that the initial scale is now 1, which means that the text is no longer boosted, so we make the single line of text small again (12px). (5) After the next style recomputation and layout, this causes the content width of the page to dip below the 1920px threshold, causing the initial scale to dip below 1 again. As detailed above, this schedules another idempotent text autosizing update, which now boosts font size once again, and the cycle continues. To fix this, instead of consulting the initial scale (`ViewportConfiguration::initialScale()`) when computing the boosted font size for idempotent text autosizing, we can instead ask for the initial scale ignoring content size (`ViewportConfiguration::initialScaleIgnoringContentSize()`). This prevents changes in content size due to idempotent autosizing from affecting the idempotent autosizing heuristic (through the different initial scale), and ensures that this method of text autosizing actually remains idempotent. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded): (WebKit::WebPage::viewportConfigurationChanged): 2020-04-14 Megan Gardner <megan_gardner@apple.com> Data Detected Actions sheets are presented from odd locations. https://bugs.webkit.org/show_bug.cgi?id=210531 <rdar://problem/60941346> Reviewed by Wenson Hsieh. Use the existing context menu targeted preview code to ensure that the data detected menus are presented in a good location. * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): 2020-04-15 Per Arne Vollan <pvollan@apple.com> [iOS] Potential crash under WebProcess::platformInitializeWebProcess https://bugs.webkit.org/show_bug.cgi?id=210547 Reviewed by Brent Fulgham. If the UI process fails to issue an extension to the runningboard service, the WebContent process will crash while trying to consume this extension. No new tests, since the test runners are unsandboxed, so issuing the extension will always succeed. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-04-15 Brent Fulgham <bfulgham@apple.com> [Cocoa] Remove generic parameter serialization fallback https://bugs.webkit.org/show_bug.cgi?id=210509 <rdar://problem/55522650> Reviewed by Geoffrey Garen. Tested by BundleFormDelegate parameter serialization tests... * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setInputDelegate:]): * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::elementDidFocus): 2020-04-15 Chris Dumez <cdumez@apple.com> REGRESSION (r259610): WebGL does not work at all on iOS (was: Google Maps tiles turn black after initial load) <rdar://problem/61794480> Unreviewed, partial revert of r259610 because it broke Google Maps. Stop using RunningBoard for the "Foreground" assertion because it fails to give the target GPU access. * UIProcess/ios/ProcessAssertionIOS.mm: (WebKit::runningBoardNameForAssertionType): 2020-04-15 Carlos Garcia Campos <cgarcia@igalia.com> [GTK4] Fix use of gtk init functions https://bugs.webkit.org/show_bug.cgi?id=210550 Reviewed by Adrian Perez de Castro. Include GtkVersioning.h instead of gtk.h * WebProcess/gtk/WebProcessMainGtk.cpp: 2020-04-15 Peng Liu <peng.liu6@apple.com> Adopt interface AVAudioRoutingArbiter for Mac https://bugs.webkit.org/show_bug.cgi?id=210167 Reviewed by Jer Noble. A follow-up patch to fix a build error. * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator): 2020-04-15 Adrian Perez de Castro <aperez@igalia.com> [GTK4] Provide an alternative to gtk_widget_{get,is}_toplevel() https://bugs.webkit.org/show_bug.cgi?id=210463 Reviewed by Carlos Garcia Campos. * UIProcess/API/glib/WebKitUIClient.cpp: Adapt to take into account that GTK4 does not provide the GtkWidget.configure-event signal. 2020-04-15 Said Abou-Hallawa <sabouhallawa@apple.com> Unreviewed, reverting r259891. Causes significant iOS MotionMark regression Reverted changeset: "Switch unused IOKit classes from allow-with-report to deny- with-report" https://bugs.webkit.org/show_bug.cgi?id=210136 https://trac.webkit.org/changeset/259891 2020-04-14 Megan Gardner <megan_gardner@apple.com> File Upload Menus presented from odd locations. https://bugs.webkit.org/show_bug.cgi?id=210523 <rdar://problem/60390846> Use the existing context menu targeted preview code to ensure that the file menus are presented in a good location. Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): 2020-04-14 David Kilzer <ddkilzer@apple.com> dictionaryValueOfType() in WebCoreArgumentCodersMac.mm can be replaced with dynamic_cf_cast<>() <https://webkit.org/b/210456> Reviewed by Darin Adler. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::dictionaryValueOfType): Delete. (IPC::extractDictionaryValue): Add. - Use dynamic_cf_cast<>() in place of manually checking the CFTypeID of each object. (IPC::createArchiveList): - Call new extractDictionaryValue() template function to verify values are the correct types in the dictionary and to set the output variables. 2020-04-14 David Kilzer <ddkilzer@apple.com> Use CFArrayGetValues() in createArchiveList() in WebCoreArgumentCodersMac.mm <https://webkit.org/b/210519> Reviewed by Darin Adler. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createArchiveList): - Use CFArrayGetValues() to copy array more efficiently. 2020-04-14 Tim Horton <timothy_horton@apple.com> REGRESSION (r259898): Tabs occasionally go blank and get stuck that way https://bugs.webkit.org/show_bug.cgi?id=210520 <rdar://problem/61776830> Reviewed by Simon Fraser. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): setThumbnailView calls setAcceleratedCompositingRootLayer in order to reconnect the existing root layer. After r259898, this would cause us to go down the process-swap path, and hide the root layer, and nothing would ever come along and fix it. If setAcceleratedCompositingRootLayer is called with the existing root layer, that cannot be a process swap, so ignore it and proceed as before. 2020-04-14 Jer Noble <jer.noble@apple.com> Adopt interface AVAudioRoutingArbiter for Mac https://bugs.webkit.org/show_bug.cgi?id=210167 <rdar://problem/59113994> Reviewed by Eric Carlson. Add a new cross-process object pair, AudioSessionRouterAbitrator/Proxy which passes routing arbitration commands from WebContent -> UIProcess. Because the UIProcess can represent multiple WebContent processes, it must track all outstanding arbitration requests globally. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): * Sources.txt: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::mediaRelatedMachServices): * UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp: Added. (WebKit::AudioSessionRoutingArbitratorProxy::AudioSessionRoutingArbitratorProxy): (WebKit::AudioSessionRoutingArbitratorProxy::~AudioSessionRoutingArbitratorProxy): (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory): (WebKit::AudioSessionRoutingArbitratorProxy::leaveRoutingArbitration): * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: Added. (WebKit::AudioSessionRoutingArbitratorProxy::category const): (WebKit::AudioSessionRoutingArbitratorProxy::destinationId): * UIProcess/Media/AudioSessionRoutingArbitratorProxy.messages.in: Added. * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: Added. (WebKit::SharedArbitrator::sharedInstance): (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator): (WebKit::SharedArbitrator::leaveRoutingArbitrationForArbitrator): (WebKit::AudioSessionRoutingArbitratorProxy::AudioSessionRoutingArbitratorProxy): (WebKit::AudioSessionRoutingArbitratorProxy::~AudioSessionRoutingArbitratorProxy): (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory): (WebKit::AudioSessionRoutingArbitratorProxy::leaveRoutingArbitration): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::WebProcessProxy): * UIProcess/WebProcessProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_processDisplayName): * WebProcess/WebProcess.cpp: * WebProcess/cocoa/AudioSessionRoutingArbitrator.cpp: Added. (WebKit::AudioSessionRoutingArbitrator::AudioSessionRoutingArbitrator): (WebKit::AudioSessionRoutingArbitrator::supplementName): (WebKit::AudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory): (WebKit::AudioSessionRoutingArbitrator::leaveRoutingAbritration): * WebProcess/cocoa/AudioSessionRoutingArbitrator.h: Added. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource): * WebProcess/com.apple.WebProcess.sb.in: 2020-04-14 David Kilzer <ddkilzer@apple.com> createArchiveList() in WebCoreArgumentCodersMac.mm should do more validity checks <https://webkit.org/b/210448> <rdar://problem/61677029> Reviewed by Darin Adler. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createArchiveList): Add more validity checks. 2020-04-14 Brent Fulgham <bfulgham@apple.com> Do more checking before reusing precompiled sandbox https://bugs.webkit.org/show_bug.cgi?id=210304 <rdar://problem/61155623> Reviewed by Darin Adler. We recently discovered that the system sandbox framework version does not always change when breaking changes in the sandbox format are made. This can lead to the precompiled version of a sandbox not working properly when a sandbox version changes. To guard against this, make the following changes: 1. Compare the SANDBOX_BUILD_ID in place when the sandbox was compiled to the value on the current system. SANDBOX_BUILD_ID, which is a GUID, is always regenerated when the sandbox framework is rebuilt. 2. Compare the OS version in place when the sandbox was compiled to the value on the current system. This will trigger us recompiling sandboxes even when the sandbox framework did not change, but this is a small performance cost that would only happen after a software update. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::compileAndCacheSandboxProfile): (WebKit::tryApplyCachedSandbox): 2020-04-14 Per Arne Vollan <pvollan@apple.com> [iOS] Content filtering needs access to the frontboard service https://bugs.webkit.org/show_bug.cgi?id=210505 Reviewed by Geoffrey Garen. Content filtering in the WebContent process needs access to the frontboard service on iOS. Issue an extension to this service when content filtering is enabled. API test: WebKit.WebFilterFeatureHasFrontboardServiceAccess * 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): 2020-04-14 Wenson Hsieh <wenson_hsieh@apple.com> [iPadOS] Wikipedia articles lay out incorrectly in 1/3 multitasking window https://bugs.webkit.org/show_bug.cgi?id=210501 <rdar://problem/54856323> Reviewed by Tim Horton. Apply the viewport quirk if needed; see WebCore/ChangeLog for more details. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): 2020-04-14 Brent Fulgham <bfulgham@apple.com> InjectedBundle parameters often need initialization function called before unarchiving https://bugs.webkit.org/show_bug.cgi?id=189709 <rdar://problem/44573653> Reviewed by Ryosuke Niwa. Handle the case where the InjectedBundle parameters do not successfully decode because they contain an unexpected class from the embedding program. If this happens, try decoding the bundle parameters after the bundle initialiation function runs, which gives the embedding program the opportunity to register additional classes that are safe for serialization. Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need to be serialized by the InjectedBundle. Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'. Revise 'initialize' to call this new method. * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::initialize): Use the new method. (WebKit::InjectedBundle::decodeBundleParameters): Added. (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete 'classesForCoder' method to unarchive the passed bundle parameters, rather than the NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the NSDictionary object may itself hold other kinds of objects. * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h: (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added. 2020-04-14 Wenson Hsieh <wenson_hsieh@apple.com> Address review comments after r260035 https://bugs.webkit.org/show_bug.cgi?id=210440 Reviewed by David Kilzer. Omit unused argument names. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetIgnoreViewportScalingConstraints): (WKPreferencesGetIgnoreViewportScalingConstraints): 2020-04-14 Megan Gardner <megan_gardner@apple.com> YouTube sometimes navigates unexpectedly when invoking a context menu on a video link. https://bugs.webkit.org/show_bug.cgi?id=210467 <rdar://problem/58841584> Reviewed by Tim Horton. Cancel any outstanding touches tracked by WebTouchEventsGestureRecognizer, so that we dispatch `touchcancel` to the page instead of `touchend`, so that the page does not misinterpret context menu invocation as a tap. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): 2020-04-14 Youenn Fablet <youenn@apple.com> Do not process RTC Network messages coming from NetworkProcess if LibWebRTCNetwork is not active https://bugs.webkit.org/show_bug.cgi?id=207376 <rdar://problem/59238611> Unreviewed. Post-commit review update, change variable name to network. No change of behavior. * WebProcess/Network/NetworkProcessConnection.cpp: (WebKit::NetworkProcessConnection::didReceiveMessage): 2020-04-14 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Bring back support for rendering scrollbars using the system appearance https://bugs.webkit.org/show_bug.cgi?id=209805 Reviewed by Michael Catanzaro. Add WebKitWebContext:use-system-appearance-for-scrollbars property. It's enabled by default to keep backwards compatibility. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Encode useSystemAppearanceForScrollbars. (WebKit::WebProcessCreationParameters::decode): Decode useSystemAppearanceForScrollbars. * Shared/WebProcessCreationParameters.h: * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): Copy m_useSystemAppearanceForScrollbars; * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextGetProperty): (webkitWebContextSetProperty): (webkitWebContextConstructed): (webkit_web_context_class_init): (webkit_web_context_set_use_system_appearance_for_scrollbars): (webkit_web_context_get_use_system_appearance_for_scrollbars): * UIProcess/API/gtk/WebKitWebContext.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): Initialize useSystemAppearanceForScrollbars parameter. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/glib/WebProcessGLib.cpp: (WebKit::WebProcess::platformInitializeWebProcess): Call setUseSystemAppearanceForScrollbars to set useSystemAppearanceForScrollbars parameter. (WebKit::WebProcess::setUseSystemAppearanceForScrollbars): Call ScrollbarThemeGtk::setUseSystemAppearance(). 2020-04-14 Youenn Fablet <youenn@apple.com> WebSocketChannel should remove itself from its manager map https://bugs.webkit.org/show_bug.cgi?id=210424 Reviewed by Alex Christensen. WebSocketChannelManager was never removing any entry from its map. To fix this, the manager is now keeping a WeakPtr to each channel. When the channel is destroyed, it will remove itself from its channel manager. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::WebSocketChannel): (WebKit::WebSocketChannel::~WebSocketChannel): * WebProcess/Network/WebSocketChannel.h: * WebProcess/Network/WebSocketChannelManager.cpp: (WebKit::WebSocketChannelManager::addChannel): (WebKit::WebSocketChannelManager::createWebSocketChannel): Deleted. * WebProcess/Network/WebSocketChannelManager.h: (WebKit::WebSocketChannelManager::removeChannel): * WebProcess/Network/WebSocketProvider.cpp: (WebKit::WebSocketProvider::createWebSocketChannel): 2020-04-14 Youenn Fablet <youenn@apple.com> Add logging in case of WebRTC socket error https://bugs.webkit.org/show_bug.cgi?id=210428 Reviewed by Eric Carlson. Add some release logging in case of error when sending, setting option or closing a socket. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::sendTo): (WebKit::LibWebRTCSocketClient::close): (WebKit::LibWebRTCSocketClient::setOption): 2020-04-13 David Kilzer <ddkilzer@apple.com> Replace use of Checked<size_t, RecordOverflow> with CheckedSize <https://webkit.org/b/210461> Reviewed by Mark Lam. * Platform/IPC/cocoa/MachMessage.cpp: (IPC::MachMessage::messageSize): * Platform/IPC/cocoa/MachMessage.h: * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::increaseBufferedAmount): 2020-04-13 Per Arne Vollan <pvollan@apple.com> [iOS] Update message filters in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=210455 Reviewed by Geoffrey Garen. Update message filters in the WebContent sandbox on iOS with required messages. No new tests, since this patch should not introduce a behavior change. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-13 Brent Fulgham <bfulgham@apple.com> Add roblox.com to the desktop class quirks list https://bugs.webkit.org/show_bug.cgi?id=210452 <rdar://problem/58859657> Reviewed by Zalan Bujtas. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommendedForRequest): 2020-04-13 Wenson Hsieh <wenson_hsieh@apple.com> Remove the "IgnoreViewportScalingConstraints" debug WebKit feature https://bugs.webkit.org/show_bug.cgi?id=210440 Reviewed by Tim Horton. Remove the internal WebKit2 feature; this was introduced around iOS 9 to unconditionally force pages to shrink to fit if they specified a responsive viewport, to avoid horizontal scrolling. Nowadays, this behavior is instead controlled by the `-[WKWebView _allowsViewportShrinkToFit]` SPI, which ensures that this shrink-to-fit preference is updated in sync with the visible content rect update lifecycle; it is currently used by Safari to scale web pages down to fit in smaller multitasking viewports. In contrast, this preference has no internal clients. Instead of maintaining two different ways for clients to control shrink-to-fit behavior, remove support for the preference and make it a no-op. * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetIgnoreViewportScalingConstraints): (WKPreferencesGetIgnoreViewportScalingConstraints): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: Remove this redundant mechanism for shrinking web pages down to fit. (WebKit::WebPage::updateVisibleContentRects): 2020-04-13 Per Arne Vollan <pvollan@apple.com> [iOS] Remove unused UTType swizzler code https://bugs.webkit.org/show_bug.cgi?id=210435 Unreviewed rollout of r258120. * 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): 2020-04-13 Kate Cheney <katherine_cheney@apple.com> Turn all instances of NavigatingToAppBoundDomain into Optionals https://bugs.webkit.org/show_bug.cgi?id=210363 <rdar://problem/61612861> Reviewed by Brent Fulgham. NavigatingToAppBoundDomain should be an Optional when passed to the Network Process to distinguish the case of an empty app-bound domain list versus an actual app-bound domain navigation. An empty list and an app-bound navigation should have the same behavior in NetworkSessionCocoa, but we will need distinguished behavior in the future. * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::startDownload): * NetworkProcess/Downloads/DownloadManager.h: (WebKit::DownloadManager::startDownload): * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::startDownload): (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload): * NetworkProcess/NetworkConnectionToWebProcess.h: (WebKit::NetworkConnectionToWebProcess::startDownload): * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::preconnectTo): (WebKit::NetworkProcess::downloadRequest): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::decode): * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/cache/AsyncRevalidation.cpp: (WebKit::NetworkCache::AsyncRevalidation::AsyncRevalidation): * NetworkProcess/cache/AsyncRevalidation.h: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::startAsyncRevalidationIfNeeded): (WebKit::NetworkCache::Cache::retrieve): * NetworkProcess/cache/NetworkCache.h: * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp: (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad): * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad): (WebKit::NetworkCache::SpeculativeLoadManager::preconnectForSubresource): (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource): (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry): (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation): * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::sessionWrapperForTask): We should treat an empty WKAppBoundDomains list like an app-bound domain navigation in the network session, so this sets NavigatingToAppBoundDomain to Yes if the Optional is WTF::nullopt. (WebKit::NetworkSessionCocoa::appBoundSession): Deleted. (WebKit::NetworkSessionCocoa::isolatedSession): Deleted. (WebKit::NetworkSessionCocoa::hasIsolatedSession const): Deleted. (WebKit::NetworkSessionCocoa::clearIsolatedSessions): Deleted. (WebKit::NetworkSessionCocoa::invalidateAndCancel): Deleted. (WebKit::NetworkSessionCocoa::clearCredentials): Deleted. (WebKit::certificatesMatch): Deleted. (WebKit::NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost): Deleted. (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge): Deleted. (WebKit::NetworkSessionCocoa::deviceManagementPolicyMonitor): Deleted. (WebKit::NetworkSessionCocoa::createWebSocketTask): Deleted. (WebKit::NetworkSessionCocoa::addWebSocketTask): Deleted. (WebKit::NetworkSessionCocoa::removeWebSocketTask): Deleted. (WebKit::NetworkSessionCocoa::hostNamesWithAlternativeServices const): Deleted. (WebKit::NetworkSessionCocoa::deleteAlternativeServicesForHostNames): Deleted. (WebKit::NetworkSessionCocoa::clearAlternativeServices): Deleted. * Shared/LoadParameters.h: * Shared/PolicyDecision.h: (WebKit::PolicyDecision::decode): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain): Set this to WTF::nullopt instead of NavigatingToAppBoundDomain::Yes so the two cases are distinguished. (WebKit::WebPageProxy::isNavigatingToAppBoundDomainTesting): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isNavigatingToAppBoundDomain const): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::download): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::startDownload): (WebKit::WebFrame::convertMainResourceLoadToDownload): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadDataImpl): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::setIsNavigatingToAppBoundDomain): (WebKit::WebPage::isNavigatingToAppBoundDomain const): 2020-04-13 David Kilzer <ddkilzer@apple.com> Fix clang static analyzer warnings about unused instance variables in WebIconDatabase, WKView <https://webkit.org/b/210427> Reviewed by Alex Christensen. * UIProcess/API/Cocoa/WKView.h: (WKView._unused): - Use WK_UNUSED_INSTANCE_VARIABLE to ignore unused instance variable. 2020-04-13 David Kilzer <ddkilzer@apple.com> Add WARN_UNUSED_RETURN to decode methods in Source/WebKit <https://webkit.org/b/210423> <rdar://problem/61715582> Reviewed by Alex Christensen. * GPUProcess/GPUProcessCreationParameters.h: * NetworkProcess/Downloads/DownloadID.h: (IPC::ArgumentCoder<WebKit::DownloadID>::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cache/NetworkCacheKey.h: (WebKit::NetworkCache::DataKey::decode): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::decodeRecordMetaData): (WebKit::NetworkCache::decodeRecordHeader): * Platform/SharedMemory.h: * PluginProcess/PluginCreationParameters.h: * Shared/API/APIData.h: * Shared/API/APIError.h: * Shared/API/APIFrameHandle.h: * Shared/API/APIGeometry.h: * Shared/API/APINumber.h: (API::Number::decode): * Shared/API/APIPageGroupHandle.h: * Shared/API/APIPageHandle.h: * Shared/API/APIURL.h: (API::URL::decode): * Shared/API/APIURLRequest.h: * Shared/API/APIURLResponse.h: * Shared/API/Cocoa/RemoteObjectInvocation.h: * Shared/Cocoa/ArgumentCodersCocoa.h: * Shared/ContextMenuContextData.h: * Shared/Databases/IndexedDB/WebIDBResult.h: * Shared/EditorState.h: * Shared/FocusedElementInformation.h: * Shared/FontInfo.h: * Shared/LayerTreeContext.h: * Shared/LoadParameters.h: * Shared/OptionalCallbackID.h: (WebKit::OptionalCallbackID::decode): * Shared/PlatformPopupMenuData.h: * Shared/Plugins/PluginProcessCreationParameters.h: * Shared/PrintInfo.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h: * Shared/SessionState.h: * Shared/ShareableBitmap.h: * Shared/ShareableResource.h: * Shared/TouchBarMenuData.h: * Shared/UpdateInfo.h: * Shared/VisibleContentRectUpdateInfo.h: * Shared/WebEvent.h: * Shared/WebHitTestResultData.h: * Shared/WebNavigationDataStore.h: (WebKit::WebNavigationDataStore::decode): * Shared/WebPreferencesStore.h: * Shared/WebProcessCreationParameters.h: * Shared/WebsiteData/WebsiteData.h: * Shared/cf/ArgumentCodersCF.h: * Shared/gtk/ArgumentCodersGtk.cpp: (IPC::decodeImage): (IPC::decodeGKeyFile): * Shared/gtk/ArgumentCodersGtk.h: * Shared/gtk/WebSelectionData.h: * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationRequest.h: * Shared/mac/ColorSpaceData.h: * Shared/mac/ObjCObjectGraph.h: * Shared/mac/SecItemRequestData.h: * Shared/mac/WebGestureEvent.h: * UIProcess/Cocoa/SessionStateCoding.h: * UIProcess/LegacySessionStateCoding.h: * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::decodeSessionHistoryEntryData): (WebKit::decodeSessionHistoryEntry): (WebKit::decodeSessionHistoryEntries): (WebKit::decodeV0SessionHistory): (WebKit::decodeV1SessionHistory): (WebKit::decodeSessionHistory): * WebProcess/GPU/GPUProcessConnectionInfo.h: (WebKit::GPUProcessConnectionInfo::decode): * WebProcess/GPU/media/RemoteAudioBusData.h: (WebKit::RemoteAudioBusData::decode): * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: * WebProcess/Network/NetworkProcessConnectionInfo.h: (WebKit::NetworkProcessConnectionInfo::decode): * WebProcess/Plugins/Plugin.h: - Add WARN_UNUSED_RETURN to all decode functions. 2020-04-13 Per Arne Vollan <pvollan@apple.com> [iOS] Add message filtering to all iokit open rules https://bugs.webkit.org/show_bug.cgi?id=210352 Reviewed by Sam Weinig. Apply message filtering with reports and telemetry to all iokit-open rules in the WebContent process' sandbox on iOS to gain a better understanding of which iokit-open rules we can investigate. No new tests, since adding telemetry will not introduce a change in behavior. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-13 Joonghun Park <jh718.park@samsung.com> Unreviewed. Remove redundant move in return statement. Return statement already returns rvalue, so we don't need move here. This patch removes the build warning below since r259922. warning: redundant move in return statement [-Wredundant-move] * NetworkProcess/cache/NetworkCacheCoders.cpp: (WTF::Persistence::Coder<WebCore::HTTPHeaderMap>::decode): 2020-04-13 Michael Catanzaro <mcatanzaro@gnome.org> Fix various build warnings https://bugs.webkit.org/show_bug.cgi?id=210429 Reviewed by Mark Lam. Use private-code instead of deprecated code command to build the Wayland protocol. * PlatformGTK.cmake: 2020-04-12 Darin Adler <darin@apple.com> Fix some strange uses of start/endOfDocument https://bugs.webkit.org/show_bug.cgi?id=210408 Reviewed by Wenson Hsieh. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::replaceDictatedText): Pass the document to startOfDocument, rather than getting the documentelement, because the function works on any node, so there's no reason to write code to get a particular one. (WebKit::WebPage::applyAutocorrectionInternal): Ditto. 2020-04-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Use gdk_window_move_to_rect() to position popup menus https://bugs.webkit.org/show_bug.cgi?id=210069 Reviewed by Michael Catanzaro. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::showPopupMenu): 2020-04-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK] Page is not drawn with PSON, hardware acceleration and address typed in URL bar https://bugs.webkit.org/show_bug.cgi?id=208091 Reviewed by Michael Catanzaro. This happens only when accelerated compositing mode policy is set to always. In this case, the bindSurfaceToWebPage wayland message is received before the WebPageProxy has updated the web page identifier. We should always check if there's a provisional page and get its web page identifier. * UIProcess/gtk/WaylandCompositor.cpp: (WebKit::WaylandCompositor::bindSurfaceToWebPage): 2020-04-12 Carlos Garcia Campos <cgarcia@igalia.com> [GTK][PSON] Crash in WaylandCompositor::Surface destructor with USE_WPE_RENDERER disabled https://bugs.webkit.org/show_bug.cgi?id=209345 Reviewed by Michael Catanzaro. In case of PSON the web page identifier can change fo the same web page proxy. When swapping processes the new web page calls bindSurfaceToWebPage(), but we still have the web page proxy bound to the previous surface. We just need to unbind the current surface before binding the new one. * UIProcess/gtk/WaylandCompositor.cpp: (WebKit::WaylandCompositor::bindSurfaceToWebPage): 2020-04-11 David Kilzer <ddkilzer@apple.com> Follow-up: Add WARN_UNUSED_RETURN to decode methods in Source/WebKit/Platform/IPC <https://webkit.org/b/210316> <rdar://problem/61559305> Changes based on feedback from Alex Christensen and Darin Adler: - Remove WARN_UNUSED_RETURN from methods returning Optional<>. - Place WARN_UNUSED_RETURN consistently before the return type. * Platform/IPC/ArgumentCoder.h: * Platform/IPC/ArgumentCoders.cpp: * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder<OptionSet<T>>::decode): (IPC::ArgumentCoder<Optional<T>>::decode): (IPC::ArgumentCoder<Box<T>>::decode): (IPC::TupleDecoderImpl::decode): (IPC::TupleDecoderImpl<Type>::decode): (IPC::TupleDecoder::decode): (IPC::TupleDecoder<0>::decode): (IPC::VariantCoder::decode): * Platform/IPC/Attachment.h: * Platform/IPC/DataReference.h: * Platform/IPC/Decoder.h: * Platform/IPC/FormDataReference.h: (IPC::FormDataReference::decode): * Platform/IPC/ImageDataReference.h: (IPC::ImageDataReference::decode): * Platform/IPC/SharedBufferDataReference.h: (IPC::SharedBufferDataReference::decode): * Platform/IPC/StringReference.h: 2020-04-11 David Kilzer <ddkilzer@apple.com> Follow-up: Add WARN_UNUSED_RETURN to decode methods in WebCoreArgumentCoders <https://webkit.org/b/210322> <rdar://problem/61565148> Changes based on feedback from Alex Christensen and Darin Adler: - Remove WARN_UNUSED_RETURN from methods returning Optional<>. - Place WARN_UNUSED_RETURN consistently before the return type. * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: 2020-04-11 Daniel Bates <dabates@apple.com> Add text interaction delegate functions https://bugs.webkit.org/show_bug.cgi?id=210395 <rdar://problem/61650549> Reviewed by Wenson Hsieh. Implement some delegate callbacks that are used to toggle selection reveal, placeholder text, and selection assistance. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _willBeginTextInteractionInTextInputContext:]): Added. (-[WKContentView _didFinishTextInteractionInTextInputContext:]): Added. 2020-04-10 Darin Adler <darin@apple.com> Move more from live range to SimpleRange: callers of absoluteTextRects https://bugs.webkit.org/show_bug.cgi?id=210369 Reviewed by Anders Carlsson. * WebProcess/InjectedBundle/API/mac/WKDOMNode.mm: (-[WKDOMNode textRects]): Moved implementation here. There's no reason for Node to have a textRects function, since it's a layout/rendering operation and a single node is also an unusual special case, but for now at least we will keep this legacy method. * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm: (-[WKDOMRange textRects]): Changed to call RenderObject::absoluteTextRects instead of Range::absoluteTextRects. * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindUIAfterPageScroll): Use RenderObject::absoluteTextRects instead of Range::absoluteRectRects. (WebKit::FindController::findStringMatches): Ditto. 2020-04-10 Pablo Saavedra <psaavedra@igalia.com> [GTK][WPE] Replace fopen/fclose by fopen/fseek functions in MemoryPressureMonitor https://bugs.webkit.org/show_bug.cgi?id=209942 Reviewed by Adrian Perez de Castro. Replacing the open()/close() logic to get the data from /proc/meminfo, /proc/self/cgroup, ... with a new logic where the files are just opened once and we just perform a seek to the initial position of of an unbuffered file. Also refactoring of some logic: - Added the CGroupMemoryController class what encapsulates the logic to calculate the the total memory and the memory usage with cgroups. - CGroupMemoryController encpasulates the FILE pointers to the relative files to cgroups. - The memInfoFile, zoneInfoFile and cgroupControllerFile are now opened once in the Thread::create() invoked by the MemoryPressureMonitor::start(). * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::lowWatermarkPages): (WebKit::calculateMemoryAvailable): (WebKit::getCgroupFile): (WebKit::getCgroupControllerPath): (WebKit::systemMemoryUsedAsPercentage): (WebKit::MemoryPressureMonitor::start): (WebKit::CGroupMemoryController::setMemoryControllerPath): (WebKit::CGroupMemoryController::disposeMemoryController): (WebKit::CGroupMemoryController::getCgroupFileValue): (WebKit::CGroupMemoryController::getMemoryTotalWithCgroup): (WebKit::CGroupMemoryController::getMemoryUsageWithCgroup): (WebKit::getCgroupFileValue): Deleted. (WebKit::getMemoryTotalWithCgroup): Deleted. (WebKit::getMemoryUsageWithCgroup): Deleted. * UIProcess/linux/MemoryPressureMonitor.h: (WebKit::CGroupMemoryController::isActive): (WebKit::CGroupMemoryController::~CGroupMemoryController): 2020-04-10 Alex Christensen <achristensen@webkit.org> PersistentCoders should use modern decoding syntax https://bugs.webkit.org/show_bug.cgi?id=207497 Reviewed by Darin Adler. * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::decodeDOMCacheRecord): (WebKit::CacheStorage::Cache::decodeRecordHeader): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::readOrigin): (WebKit::CacheStorage::decodeCachesNames): * NetworkProcess/cache/NetworkCacheCoders.cpp: (WTF::Persistence::Coder<WebCore::HTTPHeaderMap>::decode): * NetworkProcess/cache/NetworkCacheEntry.cpp: (WebKit::NetworkCache::Entry::decodeStorageRecord): * NetworkProcess/cache/NetworkCacheKey.cpp: (WebKit::NetworkCache::Key::decode): * NetworkProcess/cache/NetworkCacheKey.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::decodeRecordMetaData): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp: (WebKit::NetworkCache::SubresourceInfo::encode const): (WebKit::NetworkCache::SubresourceInfo::decode): (WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord): * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: * Shared/UserData.cpp: (WebKit::UserData::decode): * UIProcess/API/APIContentRuleListStore.cpp: (API::decodeContentRuleListMetaData): 2020-04-10 Devin Rousso <drousso@apple.com> Web Inspector: add `broadcastConsoleMessage` calls for new ITPDebug logs after r259275 https://bugs.webkit.org/show_bug.cgi?id=210362 Reviewed by John Wilander. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation): (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation): (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): 2020-04-10 Chris Dumez <cdumez@apple.com> [IPC Hardening] WebHitTestResultData IPC decoder should validate imageSharedMemory / imageSize https://bugs.webkit.org/show_bug.cgi?id=210361 <rdar://problem/60758280> Reviewed by Geoffrey Garen. WebHitTestResultData IPC decoder should validate imageSharedMemory / imageSize to make sure they are consistent. * Shared/WebHitTestResultData.cpp: (WebKit::WebHitTestResultData::decode): 2020-04-10 Alex Christensen <achristensen@webkit.org> Add SPI to handle proxy authentication and require secure proxy connections https://bugs.webkit.org/show_bug.cgi?id=210343 <rdar://problem/61546396> <rdar://problem/61546519> and <rdar://problem/61546658> Reviewed by Geoffrey Garen. I also use WKWebViewConfiguration.connectionProxyDictionary instead of CFURLRequestSetProxySettings to set proxy settings. The equivalence of this behavior is covered by the API tests. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded): * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration preventsSystemHTTPProxyAuthentication]): (-[_WKWebsiteDataStoreConfiguration setPreventsSystemHTTPProxyAuthentication:]): (-[_WKWebsiteDataStoreConfiguration requiresSecureHTTPSProxyConnection]): (-[_WKWebsiteDataStoreConfiguration setRequiresSecureHTTPSProxyConnection:]): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::preventsSystemHTTPProxyAuthentication const): (WebKit::WebsiteDataStoreConfiguration::setPreventsSystemHTTPProxyAuthentication): (WebKit::WebsiteDataStoreConfiguration::requiresSecureHTTPSProxyConnection const): (WebKit::WebsiteDataStoreConfiguration::setRequiresSecureHTTPSProxyConnection): 2020-04-10 Chris Dumez <cdumez@apple.com> [IPC Hardening] WebDeviceOrientationAndMotionAccessController::shouldAllowAccess() should not crash on invalid input https://bugs.webkit.org/show_bug.cgi?id=210359 <rdar://problem/60092453> Reviewed by Geoffrey Garen. Make sure the security origin is a valid HashMap key before trying to do a HashMap lookup. The security origin is coming from IPC and thus cannot be trusted. * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: (WebKit::WebDeviceOrientationAndMotionAccessController::cachedDeviceOrientationPermission const): 2020-04-10 John Wilander <wilander@apple.com> Add capability to opt in specific domains into SameSite=strict bounce tracking protection https://bugs.webkit.org/show_bug.cgi?id=210347 <rdar://problem/61593323> Reviewed by Brent Fulgham. This change adds an additional opt-in condition to the shouldEnforceSameSiteStrictFor() functions in both ResourceLoadStatisticsMemoryStore and ResourceLoadStatisticsDatabaseStore. No new tests. This adds domain specific logic, quirk-style. The logFrameNavigation() changes are covered by existing tests. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation): Now only captures real redirects for the purposes of the SameSite=strict rule. (WebKit::ResourceLoadStatisticsDatabaseStore::shouldEnforceSameSiteStrictFor): * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation): Now only captures real redirects for the purposes of the SameSite=strict rule. (WebKit::ResourceLoadStatisticsMemoryStore::shouldEnforceSameSiteStrictFor): (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor): Removed stray newline. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::shouldEnforceSameSiteStrictForSpecificDomain const): The new function with domains to subject to the new rule. * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: 2020-04-10 Chris Dumez <cdumez@apple.com> First render after a process swap does not use accelerated rendering https://bugs.webkit.org/show_bug.cgi?id=210297 <rdar://problem/61432515> Reviewed by Antti Koivisto. To prevent flashing on navigation when process-swapping, we were delaying the DrawingAreaProxy::EnterAcceleratedCompositingMode IPC message from the WebProcess to the UIProcess, until the new page is ready to display. The reason we did this is that the EnterAcceleratedCompositingMode IPC message ends up setting the root CALayer so the new content would become visible on screen. However, another side effect of this is that we would also delay the point until which we get accelerated rendering, which would negatively impact early page load performance. To address the issue, the following changes were made: 1. We no longer delay the DrawingAreaProxy::EnterAcceleratedCompositingMode IPC. In non process-swap cases, we send it as soon as the DrawingArea is constructed. In process-swap cases, we send it as soon as we commit the load since this is when the provisional drawing area gets committed and happens before we have any content to paint. 2. In the UIProcess, when we get the DrawingAreaProxy::EnterAcceleratedCompositingMode IPC and we already have a root layer, we add the new one behind the existing one instead of replacing the existing one. As a result, the new layer will get accelerated compositing but will not be visible on screen yet. 3. Introduce a new DrawingAreaProxy::DidFirstLayerFlush IPC which gets send at the point where we used to send the EnterAcceleratedCompositingMode IPC, meaning where the new content is ready to display. When the UIProcess receives this IPC, it actually replaces the root layer with the new layer so that the new content visible. After this patch, our CALayers get accelerated compositing right away after a process-swap but we still do not see any blank-flashing on navigation. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): (WebKit::WebViewImpl::setAcceleratedCompositingRootLayerAfterFlush): * UIProcess/DrawingAreaProxy.h: (WebKit::DrawingAreaProxy::didFirstLayerFlush): * UIProcess/DrawingAreaProxy.messages.in: * UIProcess/PageClient.h: (WebKit::PageClient::didFirstLayerFlush): * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::SuspendedPageProxy): (WebKit::SuspendedPageProxy::pageDidFirstLayerFlush): (WebKit::SuspendedPageProxy::closeWithoutFlashing): * UIProcess/SuspendedPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::suspendCurrentPageIfPossible): (WebKit::WebPageProxy::commitProvisionalPage): * UIProcess/WebPageProxy.h: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::didFirstLayerFlush): * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h: * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: (WebKit::TiledCoreAnimationDrawingAreaProxy::didFirstLayerFlush): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::sendEnterAcceleratedCompositingModeIfNeeded): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): (WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded): (WebKit::TiledCoreAnimationDrawingArea::sendEnterAcceleratedCompositingModeIfNeeded): (WebKit::TiledCoreAnimationDrawingArea::updateRendering): 2020-04-10 Wenson Hsieh <wenson_hsieh@apple.com> [iOS] Unable to select text by tap-hold or double tap-hold when allowsLinkPreview property is set to NO https://bugs.webkit.org/show_bug.cgi?id=210191 <rdar://problem/60454016> Reviewed by Tim Horton. In iOS 13.4, UIWKTextInteractionAssistant no longer uses the (misleadingly-named) "force press" gesture to drive text selection when performing a long press. Instead, it now uses the UIVariableDelayLoupeGestureRecognizer, i.e. the text interaction assistant's loupe gesture recognizer. The highlight long press gesture, which is only enabled when `allowsLinkPreview` is set to `NO`, is currently allowed to recognize alongside the force press gesture but not the loupe gesture. This means that when link previews are disabled, we'll end up allowing the highlight long press gesture to prevent text selection. A similar issue already exists for the tap-and-half gesture as well. To fix this, we allow the highlight long press gesture to recognize alongside both gestures. Test: editing/selection/ios/select-text-with-link-preview-disabled.html * UIProcess/ios/WKContentViewInteraction.mm: (tapAndAHalfRecognizerClass): While UITapAndAHalfRecognizer is declared in a UIKit private header, it is (perhaps unintentionally) not exported, so attempting to call +[UITapAndAHalfRecognizer class] leads to a linker error. Work around this by dynamically grabbing the `Class` from the class name. The tap and half gesture recognizer is private in UIKit and only used for text interaction gestures, so we always want the highlight long press gesture to be able to recognize alongside it. (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Also clean up some existing code by replacing `.get().`s with Objective-C bracket operators. 2020-04-10 Brent Fulgham <bfulgham@apple.com> Switch unused IOKit classes from allow-with-report to deny-with-report https://bugs.webkit.org/show_bug.cgi?id=210136 <rdar://problem/61403216> Reviewed by Per Arne Vollan. After tracking telemetry for several weeks, we can now safely switch the default state of a number of IOKit classes from 'allow with telemetry' to 'deny with telemetry'. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-04-10 Daniel Bates <dabates@apple.com> mayContainEditableElementsInRect() can terminate search once the search rect is wholly contained inside a layer https://bugs.webkit.org/show_bug.cgi?id=210340 Reviewed by Simon Fraser. Reduce false positives. This makes mayContainEditableElementsInRect() return false when the search rect is wholly contained inside a higher paint order layer with no editable elements that overlaps a layer with editable elements. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::mayContainEditableElementsInRect): 2020-04-10 Per Arne Vollan <pvollan@apple.com> [iOS] Add routines to message filter in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=210338 Reviewed by Geoffrey Garen. Add required routines to the message filter in the WebContent sandbox on iOS. These have been observed being in use during local testing. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-04-10 Simon Fraser <simon.fraser@apple.com> Reset view navigation gesture state between tests https://bugs.webkit.org/show_bug.cgi?id=210283 Re-land r259818 with a null-check on m_webPageProxyForBackForwardListForCurrentSwipe. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _resetNavigationGestureStateForTesting]): * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::willBeginGesture): (WebKit::ViewGestureController::didEndGesture): (WebKit::ViewGestureController::PendingSwipeTracker::handleEvent): (WebKit::ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore): * UIProcess/ViewGestureController.h: * UIProcess/ios/ViewGestureControllerIOS.mm: (WebKit::ViewGestureController::removeSwipeSnapshot): (WebKit::ViewGestureController::resetState): (WebKit::ViewGestureController::reset): * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::removeSwipeSnapshot): (WebKit::ViewGestureController::resetState): (WebKit::ViewGestureController::reset): 2020-04-10 David Kilzer <ddkilzer@apple.com> Add WARN_UNUSED_RETURN to decode methods in WebCoreArgumentCoders <https://webkit.org/b/210322> Reviewed by Darin Adler. * Shared/WebCoreArgumentCoders.cpp: (IPC::decodeSharedBuffer): (IPC::decodeTypesAndData): (IPC::decodeImage): (IPC::decodeOptionalImage): (IPC::decodeNativeImage): (IPC::decodeOptionalNativeImage): * Shared/WebCoreArgumentCoders.h: * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::decodeNSError): 2020-04-10 Peng Liu <peng.liu6@apple.com> Add null pointer checkings in WebFullScreenManager https://bugs.webkit.org/show_bug.cgi?id=210291 Reviewed by Daniel Bates. Add null pointer checkings for "element" and "m_element" in WebFullScreenManager. * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::screenRectOfContents): (WebKit::WebFullScreenManager::enterFullScreenForElement): (WebKit::WebFullScreenManager::willEnterFullScreen): (WebKit::WebFullScreenManager::didEnterFullScreen): (WebKit::WebFullScreenManager::willExitFullScreen): (WebKit::WebFullScreenManager::didExitFullScreen): (WebKit::WebFullScreenManager::setAnimatingFullScreen): (WebKit::WebFullScreenManager::requestExitFullScreen): == Rolled over to ChangeLog-2020-04-10 ==