2021-10-19 Michael Catanzaro Update seccomp filters with latest changes from flatpak https://bugs.webkit.org/show_bug.cgi?id=231479 Reviewed by Adrian Perez de Castro. Additionally, let's fix a minor inconsistency in our error-handling code: all but one of our codepaths carefully free and close resources, but the process is about to crash so there's not really any reason to do so. The code is slightly simpler if we don't bother. The seemingly-extraneous include order changes are required to placate the style checker. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::seccompStrerror): (WebKit::setupSeccomp): * UIProcess/Launcher/glib/Syscalls.h: Added. 2021-09-17 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.32.4 release * gtk/NEWS: Add release notes for 2.32.4 2021-07-06 Ryosuke Niwa Deploy smart pointers in EventHandler and UserInputBridge https://bugs.webkit.org/show_bug.cgi?id=227481 Reviewed by Wenson Hsieh and Chris Dumez. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::contextMenuAtPointInWindow): (WebKit::handleContextMenuEvent): 2021-06-24 Venky Dass Crash in WebFrameLoaderClient::dispatchDidStartProvisionalLoad after provisionalLoader is gone. https://bugs.webkit.org/show_bug.cgi?id=226979 Reviewed by Ryosuke Niwa. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): 2021-05-27 Wenson Hsieh [GPU Process] Add validation when reading DisplayListSharedMemoryHeader::waitingStatus in DisplayListReaderHandle https://bugs.webkit.org/show_bug.cgi?id=226306 rdar://78118900 Reviewed by Chris Dumez. Store this waiting status (an enum class with three valid states) as a raw `uint8_t` in shared memory, rather than an `enum class`. This allows us to verify that this value indicates a valid waiting status (using `isValidEnum`) upon reading this flag in the GPU process, and perform a `MESSAGE_CHECK` in the case where it is invalid. * GPUProcess/graphics/DisplayListReaderHandle.h: (WebKit::DisplayListReaderHandle::startWaiting): (WebKit::DisplayListReaderHandle::stopWaiting): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): * Shared/SessionState.cpp: (WebKit::PageState::decode): * Shared/SessionState.h: Drive-by fix: remove a non-templated declaration of `isValidEnum()`. This is necessary in order to use `WTF::isValidEnum` without the explicit WTF namespace prefix inside `DisplayListReaderHandle`, since WTF's declaration of `isValidEnum` clashes with this declaration. Instead of using this separate method for validating the enum, simply encode and decode the `shouldOpenExternalURLsPolicy` enum using << and >> operators, respectively; this ensures that the decoded value of `shouldOpenExternalURLsPolicy` is either valid, or the result will be WTF::nullopt if decoding fails or results in an invalid enum. * Shared/SharedDisplayListHandle.h: * WebProcess/GPU/graphics/DisplayListWriterHandle.h: (WebKit::DisplayListWriterHandle::tryToResume): 2021-05-17 Wenson Hsieh [GPU Process] Object identifiers with the deleted value should cause MESSAGE_CHECKs https://bugs.webkit.org/show_bug.cgi?id=225886 rdar://78114708 Reviewed by Chris Dumez. See WebCore/ChangeLog for more details. Use `ObjectIdentifier::isValid()` instead of just checking for the empty value, when determining whether an object identifier should trigger a message check to the web process. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): 2021-05-12 Julian Gonzalez Crash in WebPageProxy::endColorPicker() https://bugs.webkit.org/show_bug.cgi?id=225679 Reviewed by Ryosuke Niwa. Make sure that endColorPicker() and didEndColorPicker() do not both attempt to null-out m_colorPicker. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::endColorPicker): (WebKit::WebPageProxy::didEndColorPicker): 2021-04-27 Chris Dumez [IPC Hardening] Make sure IPC::Decoder constructors consistently call markInvalid() when decoding fails https://bugs.webkit.org/show_bug.cgi?id=225110 Reviewed by Darin Adler. One of the IPC::Decoder constructors was failing to call markInvalid() after failing to decoder the message name. * Platform/IPC/Decoder.cpp: (IPC::m_destinationID): 2021-04-26 Tim Nguyen Add more eager OOB checks when creating DisplayListReaderHandle & DisplayListWriterHandle. https://bugs.webkit.org/show_bug.cgi?id=225055 Reviewed by Wenson Hsieh. There were already some OOB checks for both classes, this revision adds checks at creation-time. Also add a comment on top of SharedDisplayListHandle.h to mention that only subclasses use it. * GPUProcess/graphics/DisplayListReaderHandle.h: (WebKit::DisplayListReaderHandle::create): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::SharedDisplayListHandle): * WebProcess/GPU/graphics/DisplayListWriterHandle.h: (WebKit::DisplayListWriterHandle::create): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createItemBuffer): 2021-04-06 Ryosuke Niwa Delay the end of printing while PrintContext is in use. https://bugs.webkit.org/show_bug.cgi?id=224229 Reviewed by Antti Koivisto. Added a new RAII object, PrintContextAccessScope, to delay the call to endPrinting and deployed in various IPC messages used during printing. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::beginPrinting): Deployed PrintContextAccessScope. (WebKit::WebPage::endPrinting): Exit early without ending printing if there is an active PrintContextAccessScope in the stack. (WebKit::WebPage::endPrintingImmediately): Extracted from endPrintingImmediately. (WebKit::WebPage::computePagesForPrinting): Deployed PrintContextAccessScope. (WebKit::WebPage::computePagesForPrintingImpl): Ditto. (WebKit::WebPage::drawRectToImage): Ditto. (WebKit::WebPage::drawPagesToPDF): Ditto. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::PrintContextAccessScope): Added. (WebKit::WebPage::PrintContextAccessScope::PrintContextAccessScope): Added. (WebKit::WebPage::PrintContextAccessScope::~PrintContextAccessScope): Added. 2021-03-09 Chris Dumez [IPC Hardening] Protect against bad input in WebProcessProxy::createSpeechRecognitionServer() and MessageReceiverMap https://bugs.webkit.org/show_bug.cgi?id=222948 Reviewed by Alex Christensen. Update MessageReceiverMap so that: 1. Trying to remove a MessageReceiver that is not in the map does not do dangerous things. 2. It stores weak pointers to the receivers instead of raw pointers. This would avoid doing bad things when trying to remove a message receiver that's already been destroyed. Add a MESSAGE_CHECK() in WebProcessProxy::createSpeechRecognitionServer() to make sure the identifier is not already in the map. There used to be a debug assertion but we should MESSAGE_CHECK() too since the value is coming from IPC. * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.h: * GPUProcess/media/RemoteAudioSessionProxy.h: * GPUProcess/media/RemoteCDMFactoryProxy.h: * GPUProcess/media/RemoteCDMProxy.h: * GPUProcess/media/RemoteLegacyCDMFactoryProxy.h: * GPUProcess/media/RemoteLegacyCDMProxy.h: * GPUProcess/media/RemoteLegacyCDMSessionProxy.h: * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaResourceManager.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: * NetworkProcess/NetworkProcess.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * Platform/IPC/MessageReceiver.h: * Platform/IPC/MessageReceiverMap.cpp: (IPC::MessageReceiverMap::addMessageReceiver): (IPC::MessageReceiverMap::removeMessageReceiver): (IPC::MessageReceiverMap::dispatchMessage): (IPC::MessageReceiverMap::dispatchSyncMessage): * Platform/IPC/MessageReceiverMap.h: * Shared/API/Cocoa/RemoteObjectRegistry.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/Authentication/AuthenticationManager.h: * Shared/AuxiliaryProcess.h: * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Inspector/WebInspectorProxy.h: * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/ProvisionalPageProxy.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h: * UIProcess/SpeechRecognitionServer.h: * UIProcess/SuspendedPageProxy.h: * UIProcess/WebAuthentication/WebAuthnProcessProxy.h: * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): * UIProcess/WebProcessProxy.h: * WebAuthnProcess/WebAuthnProcess.h: * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaSourcePrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h: * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Network/WebSocketChannel.h: * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebStorage/StorageAreaMap.h: 2021-03-09 Chris Dumez [IPC Hardening] IPC::decode(Decoder& decoder, RetainPtr&) should make sure keys & values aren't null https://bugs.webkit.org/show_bug.cgi?id=222980 Reviewed by Geoffrey Garen. [NSMutableDictionary setObject:forKey:] throws an exception when the given object or key is nil. The dictionary decoder should therefore fail nicely when either of these is nil, instead of crashing. * Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): 2021-03-09 Chris Dumez [IPC Hardening] SandboxExtension::HandleArray IPC decoder should not call Vector::resize() https://bugs.webkit.org/show_bug.cgi?id=222977 Reviewed by Anders Carlsson. SandboxExtension::HandleArray IPC decoder should not call Vector::resize() with an untrusted size coming from IPC. Instead, call Vector::append(), like the Vector IPC decoder does. * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtension::HandleArray::append): (WebKit::SandboxExtension::HandleArray::decode): * Shared/SandboxExtension.h: (WebKit::SandboxExtension::append): 2021-03-09 Chris Dumez [IPC Hardening] Protect WebPageProxy::willSubmitForm() against bad Strings https://bugs.webkit.org/show_bug.cgi?id=222955 Reviewed by Anders Carlsson. The Strings passed in textFieldValues are used as keys in a HashMap later on so we need to validate them. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::willSubmitForm): 2021-03-05 Chris Dumez [IPC Hardening] Protect against bad navigationID in WebPageProxy::didDestroyNavigation() https://bugs.webkit.org/show_bug.cgi?id=222842 Reviewed by Darin Adler. * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didDestroyNavigation): 2021-07-23 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.32.3 release * wpe/NEWS: Add release notes for 2.32.3 2021-07-23 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.32.3 release * gtk/NEWS: Add release notes for 2.32.3 2021-07-21 Carlos Garcia Campos REGRESSION(r267763): [SOUP] After network process crash, all cookies are lost until browser is restarted https://bugs.webkit.org/show_bug.cgi?id=228128 Reviewed by Adrian Perez de Castro. Cookies configuration is no longer stored to be sent again to the new network process after a crash. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): Encode cookieAcceptPolicy. (WebKit::NetworkSessionCreationParameters::decode): Decode cookieAcceptPolicy. * NetworkProcess/NetworkSessionCreationParameters.h: Add cookieAcceptPolicy. * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::NetworkSessionSoup): Set cookie accept policy on NetworkStorageSession. * UIProcess/API/glib/WebKitCookieManager.cpp: (webkit_cookie_manager_set_persistent_storage): Use WebsiteDataStore API to cache the given values. (webkit_cookie_manager_set_accept_policy): Ditto. * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp: (WebKit::WebsiteDataStore::platformSetNetworkParameters): Set cached cookie settings to network session parameters. (WebKit::WebsiteDataStore::setCookiePersistentStorage): Cache the given value and notify the cookie manager. (WebKit::WebsiteDataStore::setHTTPCookieAcceptPolicy): Ditto. * UIProcess/soup/WebCookieManagerProxySoup.cpp: (WebKit::WebCookieManagerProxy::getCookiePersistentStorage const): Deleted. 2021-07-20 Víctor Manuel Jáquez Leal [GTK][WPE] Fix compilation when ATK is not used https://bugs.webkit.org/show_bug.cgi?id=228077 Reviewed by Carlos Garcia Campos. Guard ATK only inside implementations, so the code is more readable. Also changed guard from ATK to GTK platform showEmojiPicker(). No new tests needed. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/wpe/WebPageProxyWPE.cpp: (WebKit::WebPageProxy::bindAccessibilityTree): 2021-07-16 Carlos Garcia Campos [GTK][WPE] PSON: accessibility doesn't work after a cross site navigation https://bugs.webkit.org/show_bug.cgi?id=228021 Reviewed by Adrian Perez de Castro. The provisional page is not handling the BindAccessibilityTree message and we never embed the new web process plug into the UI process socket. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::bindAccessibilityTree): Save the a11y plug ID. (WebKit::ProvisionalPageProxy::didReceiveMessage): Handle BindAccessibilityTree message. * UIProcess/ProvisionalPageProxy.h: (WebKit::ProvisionalPageProxy::accessibilityPlugID): Returns the a11y plug ID. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::swapToProvisionalPage): If the provisional page has a plug ID, bind the a11y tree. 2021-06-07 Carlos Garcia Campos [GTK][WPE] Signal "window-object-cleared" not emitted unless frame js context is get before https://bugs.webkit.org/show_bug.cgi?id=221771 Reviewed by Michael Catanzaro. This is because when FrameLoader::dispatchDidClearWindowObjectInWorld() is called, the JSWindowProxy for the world hasn't been created yet, so it returns early. But we want to dispatch it always for worlds created by the API, to ensure that WebKitScriptWorld::window-object-cleared is emmitted. * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: Implement globalObjectIsAvailableForFrame() to force the creation of the JavaScript context for existing WebKitScriptWorlds. 2021-04-10 Charlène Wendling Properly use CompletionHandler when USE_OPENGL_OR_ES is set to OFF https://bugs.webkit.org/show_bug.cgi?id=224149 Reviewed by Fujii Hironori. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: (WebKit::LayerTreeHost::forceRepaintAsync): 2021-07-12 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.32.2 release * wpe/NEWS: Add release notes for 2.32.2 2021-07-09 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.32.2 release * gtk/NEWS: Add release notes for 2.32.2 2021-06-18 Zan Dobersek [WPE] Rework touch-based gesture controller https://bugs.webkit.org/show_bug.cgi?id=226456 Reviewed by Alejandro G. Castro. Rename WPE's ScrollGestureController to TouchGestureController since now it also handles production of touch-based click events. TouchGestureController now internally manages all the related state, tracking the touch interaction and determining whether it progresses into a scrolling gesture or whether, upon finishing, it should be translated into a simple click event. In PageClientImpl, any unhandled event is pushed into TouchGestureController and a variant of different outcomes is returned. No-event result is ignored, and click or axis events are dispatched as appropriate. In WPEView, where the touch events arrive into the engine, we keep the shortcut where touch events are piped directly into the controller if said controller is already gesturing scrolling behavior. In that case the touch events are not dispatched into the engine, with the exception of touch-up events which are, to provide matching closure for the touch-down events. * SourcesWPE.txt: * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::doneWithTouchEvent): * UIProcess/API/wpe/TouchGestureController.cpp: Renamed from Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp. (WebKit::TouchGestureController::handleEvent): * UIProcess/API/wpe/TouchGestureController.h: Renamed from Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h. (WebKit::TouchGestureController::gesturedEvent const): * UIProcess/API/wpe/WPEView.cpp: (WKWPE::View::View): (WKWPE::m_backend): * UIProcess/API/wpe/WPEView.h: (WKWPE::View::touchGestureController const): (WKWPE::View::scrollGestureController const): Deleted. 2021-06-11 Michael Catanzaro [GTK] Crash when dragging an account node above WebView https://bugs.webkit.org/show_bug.cgi?id=226811 Reviewed by Adrian Perez de Castro. When we receive empty drag data, this is indicated by length -1, not by 0. * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::dataReceived): 2021-06-01 Alexander Mikhaylenko [GTK] Try harder to find initial WebKitWebView size https://bugs.webkit.org/show_bug.cgi?id=226320 Reviewed by Michael Catanzaro. Currently we base the viewport size on the drawing area size. The drawing area is created with an initial size based on the viewport size, which will be (0, 0) because the drawing area is still null by that point. Then, later, during the widget allocation, the drawing area receives its proper size. There are 2 issues here. First, this approach guarantees that the initial viewport size will always be (0, 0), and then there's no guarantee the widget will be allocated any time soon - for example, while GtkNotebook in GTK3 does allocate children that aren't currently visible, GtkStack doesn't (and that means that GtkNotebook in GTK4 and HdyTabView don't either). This leads to a situation where a page opened in background will load with 0, 0 size and if a page depends on that, it won't load correctly. The first issue can be fixed by basing the viewport size on the view allocation as well, and then if the widget isn't allocated, we instead try to use the size of a parent as an estimation, so that the initial size is at least not 0 even if not fully accurate. See https://gitlab.gnome.org/GNOME/epiphany/-/issues/1532 * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::viewSize): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseGetViewSize): * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: 2021-05-28 Zan Dobersek [WPE] Correctly compute wheel event phase for 2D axis events https://bugs.webkit.org/show_bug.cgi?id=226370 Reviewed by Adrian Perez de Castro. 2D-capable wpe_input_axis_event objects don't have usable axis and delta values set on the base struct, but keep all that information on the more detailed wpe_input_axis_2d_event struct. For such events, the correct phase then has to be special-cased, otherwise the default determination marks both axes as inactive and only PhaseEnded events are dispatched into the engine. * UIProcess/API/wpe/WPEView.cpp: (WKWPE::m_backend): 2021-05-27 Alexander Mikhaylenko Transient quarter display with a HiDPI /4k screen and a 200% scaling https://bugs.webkit.org/show_bug.cgi?id=219202 Reviewed by Adrian Perez de Castro. Set the root layer transformation before syncing animations and not after. This way we avoid having the first frame use the wrong scale on hidpi. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): 2021-05-24 Zan Dobersek [CoordinatedGraphics] Handle null native surface handle for surfaceless rendering https://bugs.webkit.org/show_bug.cgi?id=226165 Reviewed by Philippe Normand. During ThreadedCompositor initialization, a null native surface handle would represent a surfaceless rendering target. Assuming corresponding driver support for this behavior, the GL context creation would still succeed and composition could be performed. To support this behavior, the GL context is now spawned first, and if successful, the scene is set as active. But in case of a null native surface (i.e. surfaceless rendering), the painting has to be mirrored by default because of the OpenGL coordinate system being the immediate coordinate system inside which we end up working. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::m_displayRefreshMonitor): (WebKit::ThreadedCompositor::createGLContext): 2021-05-10 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.32.1 release * gtk/NEWS: Add release notes for 2.32.1 2021-05-08 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.32.1 release * wpe/NEWS: Add release notes for 2.32.1 2021-04-22 Carlos Garcia Campos [GTK] Build error: Couldn't find include 'Soup-2.4.gir' https://bugs.webkit.org/show_bug.cgi?id=224926 Reviewed by Philippe Normand. Use the right soup API version when generating the introspection. * PlatformGTK.cmake: 2021-05-04 Jim Mason [GTK] segmentation fault in WebKit::IconDatabase::loadIconForPageURL https://bugs.webkit.org/show_bug.cgi?id=225279 Reviewed by Carlos Garcia Campos. * UIProcess/API/glib/IconDatabase.cpp: (WebKit::IconDatabase::loadIconForPageURL): (WebKit::IconDatabase::setIconForPageURL): 2021-03-15 Daniel Kolesa [GLIB] Be more selective about bublewrapping libdirs https://bugs.webkit.org/show_bug.cgi?id=221709 Reviewed by Carlos Garcia Campos. On 32-bit systems, bubblewrap lib32 instead of lib64. This unbreaks sandbox on some distributions that have lib32 (which glibc defaults its ld cache lookups to) but configure default libdir to lib rather than lib32. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bubblewrapSpawn): 2021-04-20 Marco Felsch [WPE] QML WPEView dynamic loading fails https://bugs.webkit.org/show_bug.cgi?id=224814 Reviewed by Philippe Normand. The scene graph can be initialized when we receive window handle change notification and so we will not receive a scenegraph initialization notification. In such case we need to initzialize it ourself. No new tests. Testing can be done if the WPEView is moved to a QML component which gets loaded later on demand. * UIProcess/API/wpe/qt/WPEQtView.cpp: (WPEQtView::configureWindow): 2021-04-20 Marco Felsch [WPE][Qt] Fix build failure after r270690 https://bugs.webkit.org/show_bug.cgi?id=223070 Reviewed by Philippe Normand. WPE fails to build with `-DENABLE_WPE_QT_API=ON` after adapting the visibility for linked frameworks done by r270690. The reason for that is that the visibility is now more strict and we have to add the WTF dependecy or drop the WTF fast-allocate mechanism. Adding the WTF dependency is a bit odd since this would staticly link the WTF lib into a small wrapper lib. Also this lib has nothing to do with Webkit at all. It is just a QT adaption library. No new tests, it can be build again. * UIProcess/API/wpe/qt/WPEQtView.cpp: (WPEQtView::notifyLoadChangedCallback): (WPEQtView::notifyLoadFailedCallback): (WPEQtView::runJavaScript): * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp: (WPEQtViewBackend::create): * UIProcess/API/wpe/qt/WPEQtViewBackend.h: * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h: Drop WTF usage and use system allocator since the lib has nothing to do with Webkit at all. 2021-03-05 Michael Catanzaro [GTK] Bubblewrap sandbox should not break X11 forwarding https://bugs.webkit.org/show_bug.cgi?id=221990 Reviewed by Carlos Alberto Lopez Perez. If $DISPLAY points to a TCP socket, or a Unix socket on a different host, then we cannot isolate the web process from the network and must grant access to the host network namespace. Also, clean up some related code by adding PLATFORM(X11) guards where appropriate and removing a redundant display type check. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bindWayland): (WebKit::shouldUnshareNetwork): (WebKit::bubblewrapSpawn): 2021-04-06 Mike Gorse Build fails when video is disabled https://bugs.webkit.org/show_bug.cgi?id=224198 Reviewed by Adrian Perez de Castro. Add #if ENABLE(VIDEO) where needed. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * UIProcess/gtk/ClipboardGtk3.cpp: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::committedLoad): 2021-02-26 Adrian Perez de Castro [WPE][GTK] Bogus Response.{status,ok} for successful fetch() requests to a custom URI scheme handler https://bugs.webkit.org/show_bug.cgi?id=222471 Reviewed by Carlos Garcia Campos. No new tests needed. * UIProcess/API/glib/WebKitURISchemeRequest.cpp: (webkitURISchemeRequestReadCallback): Mark response as having status "200 OK" when webkit_uri_scheme_request_finish() gets passed a GInputStream. 2021-04-13 Philippe Normand [GStreamer] CaptureDevice monitor used from UIProcess https://bugs.webkit.org/show_bug.cgi?id=222888 Reviewed by Youenn Fablet. GStreamer ports aim to reduce usage of the GStreamer library in the UIProcess and thus should not relay capture devicechange monitoring to the UIProcess. For the long term we plan to migrate media processing to the GPUProcess but for now we have to maintain the media pipelines in the WebProcess. Initializing GStreamer in multiple processes (including the UIProcess) has a significant performance impact on embedded platforms, that's why we try to avoid it as much as possible. The device monitoring code from the UserMediaProcessManager was partly moved to the RealtimeMediaSourceCenter so that it can be easily reused by GStreamer ports from the UserMediaPermissionRequestManager. * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::UserMediaProcessManager): (WebKit::UserMediaProcessManager::updateCaptureDevices): (WebKit::UserMediaProcessManager::devicesChanged): (WebKit::UserMediaProcessManager::beginMonitoringCaptureDevices): * UIProcess/UserMediaProcessManager.h: * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: (WebKit::UserMediaPermissionRequestManager::UserMediaPermissionRequestManager): (WebKit::UserMediaPermissionRequestManager::updateCaptureDevices): (WebKit::UserMediaPermissionRequestManager::DeviceObserver::devicesChanged): (WebKit::UserMediaPermissionRequestManager::addDeviceChangeObserver): * WebProcess/MediaStream/UserMediaPermissionRequestManager.h: (WebKit::UserMediaPermissionRequestManager::DeviceObserver::DeviceObserver): 2021-04-07 Michael Catanzaro [GTK] webkit://gpu should print runtime libwpe and wpebackend-fdo versions https://bugs.webkit.org/show_bug.cgi?id=224298 Reviewed by Adrian Perez de Castro. * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleGPU): 2021-03-26 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.32.0 release * wpe/NEWS: Add release notes for 2.32.0 2021-03-26 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.32.0 release * gtk/NEWS: Add release notes for 2.32.0 2021-03-18 Carlos Garcia Campos [WPE] Bump API version when building with libsoup3 https://bugs.webkit.org/show_bug.cgi?id=223437 Reviewed by Adrian Perez de Castro. * PlatformWPE.cmake: Use WPE_API_DOC_VERSION instead of WPE_API_VERSION for gtkdoc config files. * wpe/wpe-web-extension-uninstalled.pc.in: Add variable for libsoup version. * wpe/wpe-web-extension.pc.in: Ditto. * wpe/wpe-webkit-uninstalled.pc.in: Ditto. * wpe/wpe-webkit.pc.in: Ditto. 2021-03-16 Carlos Garcia Campos [GTK][WPE] Stop using g_memdup https://bugs.webkit.org/show_bug.cgi?id=223189 Reviewed by Philippe Normand. * UIProcess/API/glib/WebKitWebResource.cpp: (webkit_web_resource_get_data_finish): Use g_malloc + memcpy instead of g_memdup. * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_save_finish): Use fastMemDup instead g_memdup. 2021-03-12 Carlos Garcia Campos [GTK] GTK4 crashes with XVFB: GLXBadWindow https://bugs.webkit.org/show_bug.cgi?id=223108 Reviewed by Žan Doberšek. Handle GLXBadWindow errors in AcceleratedBackingStoreX11. * UIProcess/gtk/AcceleratedBackingStoreX11.cpp: (WebKit::AcceleratedBackingStoreX11::checkRequirements): (WebKit::glxErrorCode): (WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11): (WebKit::AcceleratedBackingStoreX11::update): 2021-03-24 Pablo Saavedra [WPE] Build error in ARMv7 invalid 'static_cast' for GLNativeWindowType https://bugs.webkit.org/show_bug.cgi?id=223684 Fixes this error: error: invalid 'static_cast' from type 'uintptr_t' {aka 'unsigned int'} to type 'GLNativeWindowType' {aka 'void*'} ; an invalid 'static_cast' from type error for ARMv7 (rpi3 and mesa driver) by using the same solution chosen in https://bugs.webkit.org/show_bug.cgi?id=179511: EGLNativeWindowType can be aliased to a different type depending (at least) on the EGL implementation, its build options, and the libepoxy build options. Using "static_cast" works when it is a numeric value and the width of the value needs to be optionally extended to 64 bits (e.g. the EGL type is "int" in a 32-bit CPU) but not for pointers, and using "reinterpret_cast" works when the size of a pointer is 64 bits but not in other cases. Therefore it seems reasonable to use a plain C cast expression to solve this particular situation. https://trac.webkit.org/changeset/274869/webkit Reviewed by Philippe Normand. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::createGLContext): 2021-03-23 Philippe Normand [GTK] X11 build fixes https://bugs.webkit.org/show_bug.cgi?id=223577 Reviewed by Adrian Perez de Castro. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::createGLContext): GLNativeWindowType might be a long unsigned int, which can't be reinterpret casted to uin64_t on 32-bit platforms. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: Use WebCore::Region to prevent clashes with X11's Region. (WebKit::DrawingAreaCoordinatedGraphics::scroll): (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): (WebKit::DrawingAreaCoordinatedGraphics::display): 2021-03-16 Khem Raj [CMake] Build fails on RISC-V with GCC 11 https://bugs.webkit.org/show_bug.cgi?id=222959 Reviewed by Carlos Alberto Lopez Perez. Use renamed ATOMICS_REQUIRE_LIBATOMIC instead of ATOMIC_INT64_REQUIRES_LIBATOMIC. * CMakeLists.txt: 2021-03-15 Philippe Normand REGRESSION(r233845): EME Keysystem permission when MediaStream is disabled https://bugs.webkit.org/show_bug.cgi?id=223185 Reviewed by Eric Carlson. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestMediaKeySystemPermissionForFrame): This method is required for EME build configurations, not MediaStream... 2021-03-12 Michael Catanzaro REGRESSION(r274270): [WPE][GTK] Broke Epiphany test /embed/ephy-web-view/error-pages-not-stored-in-history https://bugs.webkit.org/show_bug.cgi?id=223140 Reviewed by Alex Christensen. Convert empty strings to NULL. * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (webkit_security_origin_to_string): 2021-03-12 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.31.91 release * wpe/NEWS: Add release notes for 2.31.91, and also the missing ones for 2.31.90. 2021-03-12 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.31.91 release * gtk/NEWS: Add release notes for 2.31.91. 2021-03-12 Carlos Garcia Campos [GTK] Bump API version when building with libsoup3 https://bugs.webkit.org/show_bug.cgi?id=223067 Reviewed by Adrian Perez de Castro. * PlatformGTK.cmake: Use WEBKITGTK_API_DOC_VERSION instead of WEBKITGTK_API_VERSION for gtkdoc config files * gtk/webkit2gtk-web-extension.pc.in: Add variables for gtk pkg-config file and libsoup version. * gtk/webkit2gtk.pc.in: Ditto. 2021-03-11 Philippe Normand [WPE] WebKitMediaKeySystemPermissionRequest.h missing in top-level header https://bugs.webkit.org/show_bug.cgi?id=223076 Reviewed by Adrian Perez de Castro. * UIProcess/API/wpe/WebKitMediaKeySystemPermissionRequest.h: Fix copy/paste mistake from GTK version of this header. * UIProcess/API/wpe/webkit.h: The WebKitMediaKeySystemPermissionRequest header has to be included here so apps can consume this new API. 2021-03-11 Michael Catanzaro REGRESSION(r274270): Broke WebKitSecurityOrigin docs https://bugs.webkit.org/show_bug.cgi?id=223077 Reviewed by Darin Adler. * UIProcess/API/glib/WebKitSecurityOrigin.cpp: 2021-03-11 Michael Catanzaro REGRESSION(r272469): [WPE][GTK] Epiphany UI process crashes when downloading PDFs, WebKitSecurityOrigin should use SecurityOriginData https://bugs.webkit.org/show_bug.cgi?id=222943 Reviewed by Alex Christensen. Since r272469, WebCore::SecurityOrigin no longer accepts custom protocols except those registered with LegacySchemeRegistry. WebPage registers all custom protocols, but WebPageProxy does not, so WebCore::SecurityOrigin now only supports custom protocols in the web process, not the UI process. This causes Epiphany to crash when the protocol of its WebKitSecurityOrigin is unexpectedly NULL. Alex wants to reduce usage of WebCore::SecurityOrigin outside the web process, so instead of registering custom protocols with LegacySchemeRegistry in the UI process -- making it harder to eventually get rid of LegacySchemeRegistry -- we will transition WebKitSecurityOrigin from WebCore::SecurityOrigin to WebCore::SecurityOriginData, which is a simple data store for . This is mostly sufficient to implement WebKitSecurityOrigin, except for webkit_security_origin_is_opaque(). I considered multiple ways to handle this, but ultimately decided to just deprecate it. Epiphany is the only client using this function in order to implement a WebKitSecurityOrigin equality operation, and it does so using origins that should never be opaque, so there are no compatibility concerns here. * UIProcess/API/glib/WebKitAuthenticationRequest.cpp: (webkit_authentication_request_get_security_origin): * UIProcess/API/glib/WebKitSecurityOrigin.cpp: (_WebKitSecurityOrigin::_WebKitSecurityOrigin): (webkitSecurityOriginCreate): (webkitSecurityOriginGetSecurityOriginData): (webkit_security_origin_new): (webkit_security_origin_new_for_uri): (webkit_security_origin_get_protocol): (webkit_security_origin_get_host): (webkit_security_origin_get_port): (webkit_security_origin_is_opaque): (webkit_security_origin_to_string): (webkitSecurityOriginGetSecurityOrigin): Deleted. * UIProcess/API/glib/WebKitSecurityOriginPrivate.h: * UIProcess/API/glib/WebKitWebContext.cpp: (addOriginToMap): * UIProcess/API/gtk/WebKitSecurityOrigin.h: * UIProcess/API/wpe/WebKitSecurityOrigin.h: 2021-03-05 Chris Dumez Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate https://bugs.webkit.org/show_bug.cgi?id=222809 Reviewed by Michael Catanzaro. There was a PageLoadState::Transaction in resetStateAfterProcessTermination() that was previously making sure we would not clear the WebView's URL before calling the processDidTerminate client delegate. Now that we call the client delegate in a separate function (WebPageProxy::dispatchProcessDidTerminate), we need to make move the PageLoadState::Transaction to the caller in WebProcessProxy::processDidTerminateOrFailedToLaunch(), so that its scope covers both resetStateAfterProcessTermination() & dispatchProcessDidTerminate() calls. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetStateAfterProcessTermination): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2021-03-01 Chris Dumez Have WebProcessProxy::requestTermination() call processDidTerminateOrFailedToLaunch() https://bugs.webkit.org/show_bug.cgi?id=222577 Reviewed by Geoffrey Garen. Have WebProcessProxy::requestTermination() call processDidTerminateOrFailedToLaunch() instead of duplicating the code. It was error-prone to have 2 separate code paths whether the process exited due to a crash or a termination request. It led to Bug 222574 for example because we added some logic to remove the process from the cache in processDidTerminateOrFailedToLaunch() but had failed to do so in requestTermination(). * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didClose): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::requestTermination): * UIProcess/WebProcessProxy.h: 2021-03-03 Kate Cheney Report the correct document uri in the case of a ContentSecurityPolicyClient https://bugs.webkit.org/show_bug.cgi?id=222489 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-03-02 Carlos Garcia Campos REGRESSION(r263094): [GTK][WPE] API test /webkit/WebKitWebContext/languages is failing https://bugs.webkit.org/show_bug.cgi?id=188111 Reviewed by Michael Catanzaro. The GLib API allows to change the user preferred languages after the web process is created. Since r263094 we are no loner sending the new overrides to the web process. Instead of calling overrideUserPreferredLanguages() we now set the overrides in the WebProcessPool configuration, so that we can remove the language observer. * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_set_preferred_languages): Use WebProcessPool::setOverrideLanguages() instead of overrideUserPreferredLanguages(). * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::WebProcessPool) Remove the language observer registration. (WebKit::WebProcessPool::~WebProcessPool): Remove the language observer unregistration. (WebKit::WebProcessPool::setOverrideLanguages): Update the language overrides in the configuration and notify all processes. (WebKit::WebProcessPool::languageChanged): Deleted. * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::userPreferredLanguagesChanged const): Call overrideUserPreferredLanguages() again here. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2021-03-01 Alberto Garcia [GTK] Fails to build in i386: static assertion failed: divisor must be a power of two https://bugs.webkit.org/show_bug.cgi?id=222480 Reviewed by Carlos Garcia Campos. * Platform/IPC/StreamConnectionBuffer.h: (IPC::StreamConnectionBuffer::headerSize): 2021-02-11 Sergio Villar Senin Non unified build fixes for mid February 2021 https://bugs.webkit.org/show_bug.cgi?id=221749 Reviewed by Youenn Fablet. * GPUProcess/graphics/RemoteRenderingBackend.cpp: * GPUProcess/media/RemoteCDMInstanceProxy.cpp: 2021-02-26 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.31.90 release * gtk/NEWS:Add release notes for 2.31.90. 2021-02-26 Tim Horton REGRESSION (r269824): macCatalyst WKWebView shows chunks of other tiles in the middle of content https://bugs.webkit.org/show_bug.cgi?id=222460 Reviewed by Simon Fraser. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): Reinstate some code that was accidentally deleted in r269824 that ensures that we do not use an in-use IOSurface as our front buffer, so that we don't paint into it while it's being composited in the render server. Also, add some comments, since this code is all a little confusing with its fronts and backs. 2021-02-25 Brent Fulgham Serialize NSURLRequest (rather than CFURLRequest) in IPC https://bugs.webkit.org/show_bug.cgi?id=222145 Reviewed by Darin Adler and Alex Christensen. Tested by existing layout and WebKitAPI tests. Revise IPC serialization so that NSURLConnection (modern) Cocoa builds serialize the NSURLRequest object, rather than bridging to CFURLRequest and serializing that. This ensures that the full set of NSURLRequest features are accurately reconstituted on the receiving side of the connection. Because NSURL serialization doesn't handle some encoded parameters properly, we implement an archiving delegate to archive the URL like we do for CFURL. * Shared/Cocoa/ArgumentCodersCocoa.mm: (-[WKSecureCodingArchivingDelegate archiver:willEncodeObject:]): Added. (-[WKSecureCodingArchivingDelegate unarchiver:didDecodeObject:]): Added. (+[WKEncodedURL supportsSecureCoding]): Added. (-[WKEncodedURL encodeWithCoder:]): Added. (-[WKEncodedURL initWithCoder:]): Added. (-[WKEncodedURL initWithURL:]): Added. (IPC::encodeSecureCodingInternal): Update to use new delegate. (IPC::decodeSecureCodingInternal): Ditto. (-[WKSecureCodingFontAttributeNormalizer archiver:willEncodeObject:]): Deleted. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder::encodePlatformData): Add NSURLRequest encoding. (IPC::ArgumentCoder::decodePlatformData): Add NSURLRequest decoding. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createSerializableRepresentation): Deleted. (IPC::extractDictionaryValue): Deleted. (IPC::createArchiveList): Deleted. (IPC::createCFURLRequestFromSerializableRepresentation): Deleted. (IPC::createNSURLRequestFromSerializableRepresentation): Deleted. (IPC::ArgumentCoder::encodePlatformData): Deleted. (IPC::ArgumentCoder::decodePlatformData): Deleted. 2021-02-25 Peng Liu [GPUP] The GPU Process crashes in WebKit::RemoteLegacyCDMFactoryProxy::getSession() with an assertion failure https://bugs.webkit.org/show_bug.cgi?id=222435 Reviewed by Eric Carlson. Fix an assertion failure on debug bots. No new tests. Fix crashes on the bots. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerCachedKeyForKeyId const): We should not search the hash table with an empty key (`m_legacySession`). 2021-02-25 BJ Burg [Cocoa] Web Inspector: add support for receiving Web Extension events via _WKInspectorExtensionDelegate https://bugs.webkit.org/show_bug.cgi?id=222252 Reviewed by Devin Rousso. This patch adds support for clients to receive extension lifecycle events. For now this includes extension tab shown/hidden, but will eventually include page navigations and other events exposed via Web Extensions API. This is implemented at the WebKit level via new InspectorFrontendClient methods. This gets piped to WebInspectorUIExtensionControllerProxy via IPC, which then passes on the event to _WKInspectorExtensionDelegate. _WKInspectorExtensionDelegate is a delegate of _WKInspectorExtension. It's for receiving lifecycle events, and is implemented similarly to _WKInspectorDelegate. WebInspectorUIExtensionControllerProxy now keeps a map of extension API objects so that it can call out to the the appropriate extension API object's client/delegate. To better handle the situation where client completion handlers may be invoked after the inspector page has been torn down, switch WebInspectorUIExtensionControllerProxy to be RefCounted instead of std::unique_ptr so that the appropriate API object can be retrieved in the async IPC reply block. (IPC message receiver code knows how to ref the receiver if it expects to deliver a response). Lastly, since this patch introduces InspectorExtensionError at the WebCore level, I decided to move the contents of InspectorExtensionTypes.h to the Inspector namespace. It made more sense than typing out WebCore::InspectorExtensionError and the like. As part of this change, the string type aliases Inspector::ExtensionID and Inspector:ExtensionTabID are now defined in InspectorFrontendClient.h. * DerivedSources-output.xcfilelist: * DerivedSources.make: Add generated files for new message receiver. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Add new files for inspector extension client/delegate boilerplate classes. * Scripts/webkit/messages.py: * Shared/InspectorExtensionTypes.h: * Shared/InspectorExtensionTypes.cpp: (Inspector::extensionErrorToString): (WebKit::inspectorExtensionErrorToString): Deleted. Move these types and helpers to Inspector namespace. * UIProcess/API/APIInspectorExtension.cpp: (API::InspectorExtension::setClient): Add a client member which is used to call out to _WKInspectorExtensionDelegate. (API::InspectorExtension::createTab): Fix namespaces. (API::InspectorExtension::evaluateScript): Fix namespaces. * UIProcess/API/APIInspectorExtension.h: * UIProcess/API/APIInspectorExtensionClient.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h. (API::InspectorExtensionClient::didShowExtensionTab): (API::InspectorExtensionClient::didHideExtensionTab): Added. * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): (-[_WKInspector unregisterExtension:completionHandler:]): Adjust to new type signature that returns an initialized API::InspectorExtension. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): (-[_WKRemoteWebInspectorViewController unregisterExtension:completionHandler:]): Adjust to new type signature that returns an initialized API::InspectorExtension. * UIProcess/API/Cocoa/_WKInspectorExtensionDelegate.h: Added. * UIProcess/API/Cocoa/_WKInspectorExtension.h: Add the delegate property and update documentation to mention its intended usage. * UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: Add delegate storage. * UIProcess/API/Cocoa/_WKInspectorExtension.mm: (-[_WKInspectorExtension delegate]): (-[_WKInspectorExtension setDelegate:]): Added. (-[_WKInspectorExtension createTabWithName:tabIconURL:sourceURL:completionHandler:]): Fix namespaces. (-[_WKInspectorExtension evaluateScript:frameURL:contextSecurityOrigin:useContentScriptContext:completionHandler:]): Fix namespaces. * UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.h: Added. * UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.mm: Added. (WebKit::InspectorExtensionDelegate::InspectorExtensionDelegate): (WebKit::InspectorExtensionDelegate::delegate): (WebKit::InspectorExtensionDelegate::InspectorExtensionClient::InspectorExtensionClient): (WebKit::InspectorExtensionDelegate::InspectorExtensionClient::~InspectorExtensionClient): (WebKit::InspectorExtensionDelegate::InspectorExtensionClient::didShowExtensionTab): (WebKit::InspectorExtensionDelegate::InspectorExtensionClient::didHideExtensionTab): Added. This is ObjC-to-C++ bridge code to connect API::InspectorExtensionClient (used by WebInspectorUIExtensionControllerProxy) to _WKInspectorExtensionDelegate (used by client code). * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: Fix namespaces. * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.messages.in: Added. Make this class an IPC::MessageReceiver. It receives messages for extension lifecycle events. * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: (WebKit::WebInspectorUIExtensionControllerProxy::WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::~WebInspectorUIExtensionControllerProxy): Make this class an IPC::MessageReceiver. It receives messages for extension lifecycle events. (WebKit::WebInspectorUIExtensionControllerProxy::registerExtension): Expand this code out so that we can save API::InspectorExtension instances into our own map before sending it to the completionHandler. This map keeps strong references to the extension API objects since they need to be used to send events at an arbitrary time in the future. Previously, they were kept alive (or not) by the API client. (WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension): When the extension is no longer registered, remove the associated extension API object (and our strong reference to it). (WebKit::WebInspectorUIExtensionControllerProxy::createTabForExtension): Fix namespaces. (WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptForExtension): Fix namespaces. (WebKit::WebInspectorUIExtensionControllerProxy::didShowExtensionTab): (WebKit::WebInspectorUIExtensionControllerProxy::didHideExtensionTab): Added. Try to look up the associated API object for the extension and forward the event to the client of the API object, which is ultimately _WKInspectorExtensionDelegate. * WebProcess/Inspector/RemoteWebInspectorUI.h: * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::supportsWebExtensions): (WebKit::RemoteWebInspectorUI::didShowExtensionTab): (WebKit::RemoteWebInspectorUI::didHideExtensionTab): Added. Defer to the extension controller to handle further event propagation. * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::supportsWebExtensions): (WebKit::WebInspectorUI::didShowExtensionTab): (WebKit::WebInspectorUI::didHideExtensionTab): Added. Defer to the extension controller to handle further event propagation. * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: Fix namespaces. * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController): Be more precise about associating this message receiver with the inspector page's identifier. Also, save the page identifier so that methods that need to send IPC messages can send the message to the correct destinationID. (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromEvaluationResult): (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): (WebKit::WebInspectorUIExtensionController::createTabForExtension): (WebKit::WebInspectorUIExtensionController::evaluateScriptForExtension): Fix namespaces. (WebKit::WebInspectorUIExtensionController::didShowExtensionTab): (WebKit::WebInspectorUIExtensionController::didHideExtensionTab): Added. 2021-02-25 Commit Queue Unreviewed, reverting r273503. https://bugs.webkit.org/show_bug.cgi?id=222442 Caused a blob loading failure Reverted changeset: "Serialize NSURLRequest (rather than CFURLRequest) in IPC" https://bugs.webkit.org/show_bug.cgi?id=222145 https://trac.webkit.org/changeset/273503 2021-02-25 Alex Christensen Add stubs to enable SafariForWebKitDevelopment to launch https://bugs.webkit.org/show_bug.cgi?id=222388 Reviewed by Myles Maxfield. I manually verified that before this change, DYLD won't let it launch or it calls a missing selector, but after this change it launches and loads web pages. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _inspectorDelegate]): (-[WKWebView _setInspectorDelegate:]): 2021-02-25 Chris Dumez Update WebContent sandbox to allow it to call task_create_identity_token() https://bugs.webkit.org/show_bug.cgi?id=222423 Reviewed by Simon Fraser. Update WebContent sandbox to allow it to call task_create_identity_token(). We started using task_create_identity_token() in r273288 and need it for Bug 222391. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-25 Eric Carlson [GPUP] Some media-capabilities tests fail when media in GPU Process is enabled https://bugs.webkit.org/show_bug.cgi?id=221691 Reviewed by Jer Noble. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::setMediaOverridesForTesting): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::updateMediaConfiguration): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/media/MediaOverridesForTesting.h: Added. (WebKit::MediaOverridesForTesting::encode const): (WebKit::MediaOverridesForTesting::decode): * WebProcess/GPU/media/RemoteMediaEngineConfigurationFactory.cpp: (WebKit::RemoteMediaEngineConfigurationFactory::registerFactory): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setUseGPUProcessForMedia): 2021-02-25 Brent Fulgham Serialize NSURLRequest (rather than CFURLRequest) in IPC https://bugs.webkit.org/show_bug.cgi?id=222145 Reviewed by Darin Adler and Alex Christensen. Tested by existing layout and WebKitAPI tests. Revise IPC serialization so that NSURLConnection (modern) Cocoa builds serialize the NSURLRequest object, rather than bridging to CFURLRequest and serializing that. This ensures that the full set of NSURLRequest features are accurately reconstituted on the receiving side of the connection. Because NSURL serialization doesn't handle some encoded parameters properly, we implement an archiving delegate to archive the URL like we do for CFURL. * Shared/Cocoa/ArgumentCodersCocoa.mm: (-[WKSecureCodingArchivingDelegate archiver:willEncodeObject:]): Added. (-[WKSecureCodingArchivingDelegate unarchiver:didDecodeObject:]): Added. (+[WKEncodedURL supportsSecureCoding]): Added. (-[WKEncodedURL encodeWithCoder:]): Added. (-[WKEncodedURL initWithCoder:]): Added. (-[WKEncodedURL initWithURL:]): Added. (IPC::encodeSecureCodingInternal): Update to use new delegate. (IPC::decodeSecureCodingInternal): Ditto. (-[WKSecureCodingFontAttributeNormalizer archiver:willEncodeObject:]): Deleted. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder::encodePlatformData): Add NSURLRequest encoding. (IPC::ArgumentCoder::decodePlatformData): Add NSURLRequest decoding. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::createSerializableRepresentation): Deleted. (IPC::extractDictionaryValue): Deleted. (IPC::createArchiveList): Deleted. (IPC::createCFURLRequestFromSerializableRepresentation): Deleted. (IPC::createNSURLRequestFromSerializableRepresentation): Deleted. (IPC::ArgumentCoder::encodePlatformData): Deleted. (IPC::ArgumentCoder::decodePlatformData): Deleted. 2021-02-25 Per Arne Temporarily stop enforcing notification filtering https://bugs.webkit.org/show_bug.cgi?id=222386 Reviewed by Brent Fulgham. Temporarily stop enforcing notification filtering on macOS and iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-25 Commit Queue Unreviewed, reverting r273469. https://bugs.webkit.org/show_bug.cgi?id=222417 Broke 30+ debug layout tests Reverted changeset: "Add stubs to enable SafariForWebKitDevelopment to launch" https://bugs.webkit.org/show_bug.cgi?id=222388 https://trac.webkit.org/changeset/273469 2021-02-24 Peng Liu [GPUP] Use a WeakPtr of GPUConnectionToWebProcess instead of a reference in some media related objects https://bugs.webkit.org/show_bug.cgi?id=222293 Reviewed by Eric Carlson. A GPUConnectionToWebProcess object may be destroyed when we close a page, then crash will happen in callbacks accessing the GPUConnectionToWebProcess object. For example, in `RemoteSourceBufferProxy::sourceBufferPrivateBufferedRangesChanged()`. This patch replaces the references to a GPUConnectionToWebProcess with WeakPtr(s) in places where the issue may happen. No new tests. Fix some test crashes. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::isAlwaysOnLoggingAllowed const): (WebKit::GPUConnectionToWebProcess::mediaEngineConfigurationFactoryProxy): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/media/RemoteAudioHardwareListenerProxy.cpp: (WebKit::RemoteAudioHardwareListenerProxy::RemoteAudioHardwareListenerProxy): (WebKit::RemoteAudioHardwareListenerProxy::audioHardwareDidBecomeActive): (WebKit::RemoteAudioHardwareListenerProxy::audioHardwareDidBecomeInactive): (WebKit::RemoteAudioHardwareListenerProxy::audioOutputDeviceChanged): * GPUProcess/media/RemoteAudioHardwareListenerProxy.h: * GPUProcess/media/RemoteAudioTrackProxy.cpp: (WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy): (WebKit::RemoteAudioTrackProxy::configurationChanged): * GPUProcess/media/RemoteAudioTrackProxy.h: * GPUProcess/media/RemoteCDMFactoryProxy.cpp: (WebKit::RemoteCDMFactoryProxy::RemoteCDMFactoryProxy): * GPUProcess/media/RemoteCDMFactoryProxy.h: * GPUProcess/media/RemoteCDMInstanceProxy.cpp: (WebKit::RemoteCDMInstanceProxy::unrequestedInitializationDataReceived): * GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp: (WebKit::RemoteCDMInstanceSessionProxy::updateKeyStatuses): (WebKit::RemoteCDMInstanceSessionProxy::sendMessage): (WebKit::RemoteCDMInstanceSessionProxy::sessionIdChanged): * GPUProcess/media/RemoteImageDecoderAVFProxy.cpp: (WebKit::RemoteImageDecoderAVFProxy::RemoteImageDecoderAVFProxy): (WebKit::RemoteImageDecoderAVFProxy::encodedDataStatusChanged): * GPUProcess/media/RemoteImageDecoderAVFProxy.h: * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp: (WebKit::RemoteLegacyCDMFactoryProxy::RemoteLegacyCDMFactoryProxy): (WebKit::RemoteLegacyCDMFactoryProxy::~RemoteLegacyCDMFactoryProxy): (WebKit::RemoteLegacyCDMFactoryProxy::addProxy): (WebKit::RemoteLegacyCDMFactoryProxy::removeProxy): (WebKit::RemoteLegacyCDMFactoryProxy::addSession): (WebKit::RemoteLegacyCDMFactoryProxy::removeSession): * GPUProcess/media/RemoteLegacyCDMFactoryProxy.h: * GPUProcess/media/RemoteLegacyCDMProxy.cpp: (WebKit::RemoteLegacyCDMProxy::cdmMediaPlayer const): * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: (WebKit::RemoteLegacyCDMSessionProxy::sendMessage): (WebKit::RemoteLegacyCDMSessionProxy::sendError): (WebKit::RemoteLegacyCDMSessionProxy::mediaKeysStorageDirectory const): * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.cpp: (WebKit::RemoteMediaEngineConfigurationFactoryProxy::RemoteMediaEngineConfigurationFactoryProxy): * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::RemoteMediaPlayerManagerProxy): (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::logger): (WebKit::RemoteMediaPlayerManagerProxy::logger const): Deleted. (WebKit::RemoteMediaPlayerManagerProxy::logChannel const): Deleted. * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: (WebKit::RemoteMediaPlayerManagerProxy::gpuConnectionToWebProcess): (WebKit::RemoteMediaPlayerManagerProxy::gpuConnectionToWebProcess const): Deleted. (): Deleted. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): (WebKit::RemoteMediaPlayerProxy::loadMediaSource): (WebKit::RemoteMediaPlayerProxy::requestResource): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaKeysStorageDirectory const): (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaCacheDirectory const): (WebKit::RemoteMediaPlayerProxy::addRemoteAudioTrackProxy): (WebKit::RemoteMediaPlayerProxy::addRemoteVideoTrackProxy): (WebKit::RemoteMediaPlayerProxy::addRemoteTextTrackProxy): (WebKit::RemoteMediaPlayerProxy::mediaPlayerCachedKeyForKeyId const): (WebKit::RemoteMediaPlayerProxy::setLegacyCDMSession): (WebKit::RemoteMediaPlayerProxy::cdmInstanceAttached): (WebKit::RemoteMediaPlayerProxy::cdmInstanceDetached): (WebKit::RemoteMediaPlayerProxy::attemptToDecryptWithInstance): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::~RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::seekToTime): (WebKit::RemoteMediaSourceProxy::addSourceBuffer): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteRemoteCommandListenerProxy.cpp: (WebKit::RemoteRemoteCommandListenerProxy::RemoteRemoteCommandListenerProxy): (WebKit::RemoteRemoteCommandListenerProxy::didReceiveRemoteControlCommand): * GPUProcess/media/RemoteRemoteCommandListenerProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::~RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateStreamEndedWithDecodeError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHighestPresentationTimestampChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidParseSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidDropSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReportExtraMemoryCost): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateBufferedDirtyChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateBufferedRangesChanged): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy): (WebKit::RemoteTextTrackProxy::configurationChanged): (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/RemoteVideoTrackProxy.cpp: (WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy): (WebKit::RemoteVideoTrackProxy::configurationChanged): * GPUProcess/media/RemoteVideoTrackProxy.h: 2021-02-24 BJ Burg [Cocoa] Web Inspector: expose the extension host that is used to load _WKInspectorExtension tabs https://bugs.webkit.org/show_bug.cgi?id=222344 Reviewed by Devin Rousso. Clients need access to the WKWebView that hosts extension content in order to implement message passing and event delivery to the extension panel iframes. (Currently, that WebView is the same underlying WKWebView for the whole interface, but that is open to change.) * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: New property. * UIProcess/API/Cocoa/_WKInspectorPrivate.h: * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector extensionHostWebView]): Added. (-[_WKInspector handle]): Deleted. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController extensionHostWebView]): Added. (-[_WKRemoteWebInspectorViewController handle]): Deleted. * Shared/API/Cocoa/WKBrowsingContextHandle.mm: (-[WKBrowsingContextHandle description]): Drive-by, add the standard -description for debugging purposes. 2021-02-24 Alex Christensen Add stubs to enable SafariForWebKitDevelopment to launch https://bugs.webkit.org/show_bug.cgi?id=222388 Reviewed by Myles Maxfield. I manually verified that before this change, DYLD won't let it launch or it calls a missing selector, but after this change it launches and loads web pages. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _inspectorDelegate]): (-[WKWebView _setInspectorDelegate:]): 2021-02-24 Kate Cheney App-bound request parameter should be passed to main resource requests not the main frame https://bugs.webkit.org/show_bug.cgi?id=222241 Reviewed by Chris Dumez. Bug fix to set the isAppBound parameter on the resource request if it is not on the main frame. Previously this only checked if the resource was not a main resource before setting the parameter. Otherwise mostly changes to add better testing. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::appBoundNavigationData): (WebKit::NetworkProcess::clearAppBoundNavigationData): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::appBoundNavigationTestingData): * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): * Scripts/webkit/messages.py: * Shared/NavigatingToAppBoundDomain.h: (WebKit::AppBoundNavigationTestingData::clearAppBoundNavigationDataTesting): (WebKit::AppBoundNavigationTestingData::updateAppBoundNavigationTestingData): (WebKit::AppBoundNavigationTestingData::encode const): (WebKit::AppBoundNavigationTestingData::decode): Struct to return data for tests. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _appBoundNavigationData:]): (-[WKWebView _clearAppBoundNavigationData:]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::appBoundNavigationData): (WebKit::WebPageProxy::clearAppBoundNavigationData): * UIProcess/WebPageProxy.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::loadResource): The fix. 2021-02-24 Peng Liu [GPUP] Refactor RemoteImageDecoderAVF::createFrameImageAtIndex() https://bugs.webkit.org/show_bug.cgi?id=222300 Reviewed by Jer Noble. Use callOnMainThreadAndWait() instead of callOnMainThread() and remove the semaphore. No new tests, this has no behavior change. * GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in: * WebProcess/GPU/media/RemoteImageDecoderAVF.cpp: (WebKit::RemoteImageDecoderAVF::createFrameImageAtIndex): 2021-02-24 Chris Dumez Unreviewed, fix build with the latest iOS SDK. * Shared/FocusedElementInformation.h: 2021-02-24 Per Arne Vollan [iOS] Get default value in the UI process for whether synchronous XMLHttpRequest are allowed during unload https://bugs.webkit.org/show_bug.cgi?id=222377 Reviewed by Brent Fulgham. Getting this default value in the UI process instead of in every WebContent process should be a small speedup, since getting this default value is a bit costly on iOS. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/ios/WebPreferencesDefaultValuesIOS.h: Added. * Shared/ios/WebPreferencesDefaultValuesIOS.mm: (WebKit::cachedAllowsRequest): (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload): (WebKit::setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_lastNavigationWasAppBound): 2021-02-24 Russell Epstein Revert r272735. rdar://problem/74674837 2021-02-24 Russell Epstein Revert r272810. rdar://problem/74674837 2021-02-24 Said Abou-Hallawa [GPU Process] Implement ImageBufferShareableBitmapBackend::bytesPerRow() https://bugs.webkit.org/show_bug.cgi?id=222348 Reviewed by Simon Fraser. The default implementation ImageBufferBackend::bytesPerRow() is not correct for ImageBufferShareableBitmapBackend because ShareableBitmap aligns the rows using IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, ...). * Shared/ShareableBitmap.h: (WebKit::ShareableBitmap::bytesPerRow const): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::bytesPerRow const): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: 2021-02-24 Carlos Garcia Campos REGRESSION(r267763): [GTK][WPE] user preferred languages are sent to the wrong network process https://bugs.webkit.org/show_bug.cgi?id=222347 Reviewed by Adrian Perez de Castro. WebProcessPool::languageChanged() is creating the default website data store, so languages are sent to the newly created network process. We should send them to the existing network processes instead. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::languageChanged): 2021-02-24 Carlos Garcia Campos Unreviewed. Fix GTK build with neewer wpe and wpe-fdo We need to explicitly include wpe.h now. * UIProcess/API/glib/WebKitProtocolHandler.cpp: * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: 2021-02-23 Wenson Hsieh [iOS] Add null checks for Node before accessing treeScope() in rangeForPointInRootViewCoordinates https://bugs.webkit.org/show_bug.cgi?id=222338 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-02-23 Patrick Angle [Cocoa] Web Inspector: Add support for reloading the inspected page via _WKInspectorExtension https://bugs.webkit.org/show_bug.cgi?id=222296 Reviewed by BJ Burg. Added a new method to _WKInspectorExtension which is used to implement `browser.devtools.inspectedWindow.reload` in the Web Extensions API. * UIProcess/API/APIInspectorExtension.cpp: (API::InspectorExtension::reloadIgnoringCache): * UIProcess/API/APIInspectorExtension.h: * UIProcess/API/Cocoa/_WKInspectorExtension.h: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: (-[_WKInspectorExtension reloadIgnoringCache:userAgent:injectedScript:completionHandler:]): * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: (WebKit::WebInspectorUIExtensionControllerProxy::reloadForExtension): * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: (WebKit::WebInspectorUIExtensionController::reloadForExtension): * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: 2021-02-23 Brent Fulgham [macOS] Allow additional syscall support in the sandbox https://bugs.webkit.org/show_bug.cgi?id=222335 Reviewed by Per Arne Vollan. Expand the WebContent process sandbox to allow SYS_open_dprotected_np * WebProcess/com.apple.WebProcess.sb.in: 2021-02-23 Fujii Hironori [CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages https://bugs.webkit.org/show_bug.cgi?id=221391 Reviewed by Carlos Garcia Campos. When triggerRenderingUpdate was called back, it added the whole view area into the dirty region to repaint in non-AC mode pages. This caused a problem that the whole content was unnecessarily repainted by animations in non-AC mode pages. Call scheduleDisplay instead of setNeedsDisplay in triggerRenderingUpdate. However, if the dirty region is empty, display() exited early. If triggerRenderingUpdate is called back, DrawingAreaCoordinatedGraphics::display should be called to ensure WebPage::updateRendering() called even if m_dirtyRegion is empty. Added a new flag m_scheduledWhileWaitingForDidUpdate. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::triggerRenderingUpdate): Call scheduleDisplay() instead of setNeedsDisplay(). (WebKit::DrawingAreaCoordinatedGraphics::didUpdate): (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay): Don't return early even if m_dirtyRegion is empty. (WebKit::DrawingAreaCoordinatedGraphics::display()): Ditto. (WebKit::DrawingAreaCoordinatedGraphics::display(UpdateInfo&)): Return early if m_dirtyRegion is empty. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: Added m_scheduledWhileWaitingForDidUpdate. 2021-02-23 Commit Queue Unreviewed, reverting r273304. https://bugs.webkit.org/show_bug.cgi?id=222324 Introduced test failure Reverted changeset: "[macOS] Crash under AuxiliaryProcess::initializeSandbox" https://bugs.webkit.org/show_bug.cgi?id=222233 https://trac.webkit.org/changeset/273304 2021-02-23 Kimmo Kinnunen REGRESSION(r273204): webkitpy tests fail https://bugs.webkit.org/show_bug.cgi?id=222275 Reviewed by Jonathan Bedard. Regenerate the IPC generation test expectations that were not part of r273204. Tested by ./Tools/Scripts/test-webkitpy-python2 -j1 -p Source/WebKit/Scripts/webkit/messages_unittest.py * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::jsValueForArguments): (IPC::messageArgumentDescriptions): * Scripts/webkit/tests/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: * Scripts/webkit/tests/TestWithSemaphoreMessages.h: * Scripts/webkit/tests/TestWithStreamMessages.h: 2021-02-23 Wenson Hsieh [iOS] Add a watchdog timer to forcibly reset deferring gesture recognizers https://bugs.webkit.org/show_bug.cgi?id=222216 Reviewed by Simon Fraser. Add a mechanism to detect and resolve situations where at least one deferring gesture recognizer (`WKDeferringGestureRecognizer`) is stuck in Possible state after ending touches, but the touch event gesture recognizer is unable to be reset (i.e. neither possible or recognizing). This state is indicative of a general class of bugs regarding native gesture deferral, wherein our "gesture gates" never end up being lifted after ending all touches in the view. One such example of this type of bug was fixed in r272584, where all interaction (touch events, scrolling, tapping) due to the touch end deferrers never exiting Possible state after long pressing to present a context menu. To make these kinds of bugs both easier to diagnose and less fatal in the future, we introduce a watchdog timer that dispatches after ending all touches on the content view, and checks the consistency of deferring gesture recognizers in the view; if we detect stuck deferring gestures, we handle this by forcibly resetting the stuck deferring gestures and logging a fault message. I manually verified this change by reverting my fix for the aforementioned bug (r272584), and observing both (1) a system log fault message, and (2) that interactions continued to work even without the fix in r272584, after the watchdog timer fired. See below for more details. * SourcesCocoa.txt: * UIProcess/ios/GestureRecognizerConsistencyEnforcer.h: Copied from Source/WebKit/UIProcess/ios/WKDeferringGestureRecognizer.h. * UIProcess/ios/GestureRecognizerConsistencyEnforcer.mm: Added. (WebKit::GestureRecognizerConsistencyEnforcer::GestureRecognizerConsistencyEnforcer): (WebKit::GestureRecognizerConsistencyEnforcer::beginTracking): (WebKit::GestureRecognizerConsistencyEnforcer::endTracking): (WebKit::GestureRecognizerConsistencyEnforcer::reset): (WebKit::GestureRecognizerConsistencyEnforcer::timerFired): Add a helper class that wraps a `RunLoop::Timer` for the main runloop, and schedules a 1 second timer after all deferring gestures have ended; assuming no new touches begin after this timer is scheduled, we'll perform a consistency check over the content view's gestures and perform a log fault and force deferring gestures to end if needed. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): Make sure that we reset any extant `GestureRecognizerConsistencyEnforcer` if the web process crashes. (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView _webTouchEventsRecognized:]): Adjust a few compile-time guards so that deferring gesture recognizers exist on the view, even if `ENABLE_IOS_TOUCH_EVENTS` is off. This makes some of the gesture deferral code throughout this file easier to reason about in non-internal iOS builds, since we don't need to sprinkle as many `ENABLE(IOS_TOUCH_EVENTS)` checks throughout this class. (-[WKContentView touchEventGestureRecognizer]): (-[WKContentView gestureRecognizerConsistencyEnforcer]): (-[WKContentView deferringGestures]): (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView deferringGestureRecognizer:willBeginTouchesWithEvent:]): Refactor `-deferringGestureRecognizer:shouldDeferGesturesAfterBeginningTouchesWithEvent:` so that it returns an enum flag indicating whether the given gesture should be allowed to begin deferring native gestures; by making this `-deferringGestureRecognizer:willBeginTouchesWithEvent:`, we can now put state management logic here that's responsible for updating the `GestureRecognizerConsistencyEnforcer`. (-[WKContentView deferringGestureRecognizer:didTransitionToState:]): (-[WKContentView deferringGestureRecognizer:didEndTouchesWithEvent:]): (-[WKContentView _deferringGestures]): Deleted. Rename this to `-deferringGestures` and expose it as a readonly property, for use by the `GestureRecognizerConsistencyEnforcer`. (-[WKContentView deferringGestureRecognizer:shouldDeferGesturesAfterBeginningTouchesWithEvent:]): Deleted. * UIProcess/ios/WKDeferringGestureRecognizer.h: * UIProcess/ios/WKDeferringGestureRecognizer.mm: (-[WKDeferringGestureRecognizer touchesBegan:withEvent:]): (-[WKDeferringGestureRecognizer setState:]): Add a delegate hook to inform `WKContentView` when the gesture recognizer state changes. (-[WKDeferringGestureRecognizer deferringGestureDelegate]): Deleted. * UIProcess/mac/WKPrintingView.h: Fix a missing include that results in a build failure due to changed unified sources. * WebKit.xcodeproj/project.pbxproj: 2021-02-23 Per Arne Vollan [macOS] Crash under AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=222233 Unreviewed, address additional review feedback. Add comment and logging when the WebKit client is setting the user directory suffix. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): 2021-02-23 Kimmo Kinnunen HTMLCanvasElement::copiedImage() contains old image with GPU Process on https://bugs.webkit.org/show_bug.cgi?id=222101 Reviewed by Simon Fraser. Implement RemoteImageBufferProxy::copyImage and RemoteImageBufferProxy::copyNativeImage. Implement by asking the data from the GPU process. Previously, with AcceleratedImageBufferShareableMappedBackend the HTMLCanvasElement::copiedImage() would construct the copy by copying the CGContext backed by the IOSurface that is accessible by both processes. This would succeed. After a draw to the image, the second copy would not reflect the draw but contain the same image as the first copy. Fix by not using the fact that the IOSurface is accessible by both processes. In the end, IOSurfaces will not be available in Web process. Converts NativeImage to ShareableBitmap with WebCore::CompositeOperator::Copy since the ImageBuffers might have unpremultiplied contents. Also, ShareableBitmap does not have contents, so blending is overhead. No new tests, enables ~150 tests. * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::copyTextureFromMedia): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::getShareableBitmapForImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::getShareableBitmap): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2021-02-22 Don Olmstead Non-unified build fixes late February 2021 edition https://bugs.webkit.org/show_bug.cgi?id=222303 Unreviewed non-unified build fixes. * GPUProcess/graphics/RemoteRenderingBackend.cpp: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: 2021-02-22 Devin Rousso [Payment Request] REGRESSION(r273143): crash shortly after showing the Apple Pay sheet https://bugs.webkit.org/show_bug.cgi?id=222298 Reviewed by Wenson Hsieh. * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toNSErrors): Don't use `adoptNS` with `+[NSMutableArray array]` since that returns an autoreleased object. Use the helper `createNSArray` instead (as was previously done before r273143). 2021-02-22 Wenson Hsieh WebMouseEvent.h should avoid pulling in WebCore headers that know about DOM nodes https://bugs.webkit.org/show_bug.cgi?id=222291 Reviewed by Darin Adler. Import `PointerEventTypeNames.h` instead of `PointerEvent.h` in several UI process and shared headers. * Shared/WebMouseEvent.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (primaryPointerForType): (webkitWebViewBaseSynthesizeMouseEvent): * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::performMouseInteraction): * UIProcess/gtk/PointerLockManager.cpp: (WebKit::PointerLockManager::handleMotion): 2021-02-22 Chris Dumez Add assertions to help identify to source of https://bugs.webkit.org/show_bug.cgi?id=222290 Reviewed by Alex Christensen. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore): (WebKit::WebProcessPool::hasPagesUsingWebsiteDataStore const): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addExistingWebPage): 2021-02-22 Said Abou-Hallawa [GPU Process] Implement the ClipToDrawingCommands item by using begin and end markers https://bugs.webkit.org/show_bug.cgi?id=222230 Reviewed by Simon Fraser. Replace the DisplayList item ClipToDrawingCommands by the pair items BeginClipToDrawingCommands and EndClipToDrawingCommands. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2021-02-22 Eric Carlson UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 Unreviewed, address post-review comment. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): Use captured `this`. 2021-02-22 Chris Dumez Prepare for memory ownership transfer in the GPUProcess https://bugs.webkit.org/show_bug.cgi?id=222122 Reviewed by Simon Fraser. Prepare for memory ownership transfer in the GPUProcess: 1. Have the WebProcess create a task identity token and pass it to the GPUProcess when connecting to it. The WebProcess' task identity token is then stored on the GPUConnectionToWebProcess object. 2. Add the entitlement to the GPUProcess that is needed to transfer memory ownership to another process. This is a first step towards having the GPUProcess transfer memory ownership of its IOSurfaces and Metal textures to the WebProcesses it is serving. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::create): (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): * GPUProcess/GPUConnectionToWebProcess.h: (WebKit::GPUConnectionToWebProcess::webProcessIdentityToken const): * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::createGPUConnectionToWebProcess): * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcess.messages.in: * Scripts/process-entitlements.sh: * Shared/GPUProcessConnectionParameters.h: Copied from Source/WTF/wtf/MachSendRight.h. (WebKit::GPUProcessConnectionParameters::encode const): (WebKit::GPUProcessConnectionParameters::decode): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::getGPUProcessConnection): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::getGPUProcessConnection): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getGPUProcessConnection): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::platformInitializeGPUProcessConnectionParameters): (WebKit::WebProcess::getGPUProcessConnection): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeGPUProcessConnectionParameters): 2021-02-22 Per Arne Vollan [Cocoa] Send sandbox extensions for Network Extension services in load parameters https://bugs.webkit.org/show_bug.cgi?id=222284 Reviewed by Brent Fulgham. Currently, sandbox extensions for Network Extension services are sent from the UI process to the WebContent process when the policy decision is made, but that is not soon enough in all cases. They should also be sent as part of the load parameters. * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2021-02-22 Chris Dumez [Cocoa] Add WKWebView session restoration API https://bugs.webkit.org/show_bug.cgi?id=220958 Reviewed by Geoffrey Garen. Add WKWebView session restoration API so that applications can easily retrieve view state (such as back-forward list, scroll position, form data...) and restore it on a WKWebView later on. * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView interactionState]): (-[WKWebView setInteractionState:]): 2021-02-22 Chris Dumez Use adoptNS() as soon as we [[ObjcClass alloc] init] to avoid leaks https://bugs.webkit.org/show_bug.cgi?id=222237 Reviewed by Darin Adler. * UIProcess/API/Cocoa/NSAttributedString.mm: (globalConfiguration): (+[_WKAttributedStringWebViewCache configuration]): (+[_WKAttributedStringWebViewCache clearConfiguration]): * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: (-[WKNSURLAuthenticationChallenge _web_createTarget]): * UIProcess/API/Cocoa/WKProcessPool.mm: (sharedProcessPool): (-[WKProcessPool encodeWithCoder:]): (+[WKProcessPool _sharedProcessPool]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView loadSimulatedRequest:withResponseHTMLString:]): * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore allWebsiteDataTypes]): * UIProcess/Cocoa/PreferenceObserver.mm: (+[WKPreferenceObserver sharedInstance]): * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::createVideoFullscreenViewController): * UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: (+[WKWebInspectorPreferenceObserver sharedInstance]): * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView supportedPasteboardTypesForCurrentSelection]): (-[WKContentView assignLegacyDataForContextMenuInteraction]): * UIProcess/ios/WKMouseDeviceObserver.mm: (+[WKMouseDeviceObserver sharedInstance]): * UIProcess/ios/WKStylusDeviceObserver.mm: (+[WKStylusDeviceObserver sharedInstance]): * UIProcess/mac/WKTextInputWindowController.mm: (+[WKTextInputWindowController sharedTextInputWindowController]): * UIProcess/mac/WebColorPickerMac.mm: (+[WKPopoverColorWell _colorPopoverCreateIfNecessary:]): * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: (-[WKDataListSuggestionWindow initWithContentRect:styleMask:backing:defer:]): * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm: (WebKit::initWithImpl): (WebKit::toWKDOMType): * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::initialize): 2021-02-22 Per Arne Vollan [macOS] Crash under AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=222233 Reviewed by Brent Fulgham. When a WebKit client provides a user directory suffix in the process initialization parameters, confstr with the new user suffix applied will fail to create the full directory path if it does not exist, and return an empty result. This will lead to empty paths in the sandbox parameters, which will cause the sandbox to fail to compile, which will eventually crash the WebKit process. This patch addresses this by making sure the new user directory suffix does not represent a path, since confstr is not able to handle user directory suffixes containing paths that do not exist. Additionally, this patch reverts r271417, which was the first attempt at fixing this crash, but was unsuccessful in doing so. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): (WebKit::AuxiliaryProcess::initializeSandbox): 2021-02-22 Per Arne [macOS] Disabling relaunch on login for the WebContent process is racy https://bugs.webkit.org/show_bug.cgi?id=222074 Reviewed by Geoffrey Garen. When NSApplication is being intialized, the method -[NSApplication disableRelaunchOnLogin] is dispatched on a non-main thread, which is in a race with the revocation of the Launch Services sandbox extension. This patch addresses this by setting this information synchronously with Launch Services while the sandbox extension is being held. Additionally, accessibility related code under WebPage::platformInitialize may reach out to the Launch Services daemon once during the lifetime of the WebContent process. Make sure that call succeeds by making a synchronous call while a sandbox extension to the Launch Services daemon is being held. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2021-02-22 Sam Sneddon REGRESSION(r273204): webkitpy tests don't run on Py3 https://bugs.webkit.org/show_bug.cgi?id=222274 Reviewed by Jonathan Bedard. This doesn't make them pass, but it does get them back to running to completion. * Scripts/webkit/messages.py: avoid using a relative import 2021-02-22 Eric Carlson UserMediaPermissionRequestManagerProxy may be released while computing capture device list https://bugs.webkit.org/show_bug.cgi?id=222236 Reviewed by Youenn Fablet. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): Return early if `weakThis` is NULL. 2021-02-22 Carlos Garcia Campos [SOUP] Add support for libsoup3 https://bugs.webkit.org/show_bug.cgi?id=222093 Reviewed by Adrian Perez de Castro. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::createRequest): (WebKit::NetworkDataTaskSoup::clearRequest): (WebKit::NetworkDataTaskSoup::resume): (WebKit::NetworkDataTaskSoup::cancel): (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificateCallback): (WebKit::NetworkDataTaskSoup::acceptCertificateCallback): (WebKit::NetworkDataTaskSoup::acceptCertificate): (WebKit::NetworkDataTaskSoup::authenticateCallback): (WebKit::NetworkDataTaskSoup::authenticate): (WebKit::NetworkDataTaskSoup::continueAuthenticate): (WebKit::shouldRedirectAsGET): (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): (WebKit::NetworkDataTaskSoup::didGetHeaders): (WebKit::NetworkDataTaskSoup::wroteBodyDataCallback): (WebKit::NetworkDataTaskSoup::didWriteBodyData): (WebKit::NetworkDataTaskSoup::networkEvent): (WebKit::NetworkDataTaskSoup::hstsEnforced): (WebKit::NetworkDataTaskSoup::didRestart): * NetworkProcess/soup/NetworkDataTaskSoup.h: * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::createWebSocketTask): * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::isConnectionError): (WebKit::WebSocketTask::WebSocketTask): 2021-02-20 Brent Fulgham [Cocoa] Update WebCoreArgumentCodersMac with some new additions https://bugs.webkit.org/show_bug.cgi?id=222242 Reviewed by Tim Horton. Will be tested by new API Tests in a subsequent patch. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): 2021-02-20 BJ Burg [Cocoa] Web Inspector: expose the WKBrowsingContextHandle associated with Web Inspector's page https://bugs.webkit.org/show_bug.cgi?id=222226 Reviewed by Timothy Hatcher. In order to implement browser.devtools.inspectedWindow.tabId for Web Extensions, we need a way to do a reverse lookup of the tabId using the current browsing context controller (WKWebProcessPlugInBrowserContextController) in the injected bundle. This patch exposes the browsing context handle for the underlying WKWebView that hosts the inspector page. Clients can use this to precompute a tabId for each inspector browsing context that may be encountered by injected bundle code. * UIProcess/API/Cocoa/_WKInspectorPrivate.h: * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector handle]): Added. * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm: (WebKit::InjectedBundle::classesForCoder): Drive-by, make it possible to use WKBrowsingContextHandle in injected bundle parameters. This is easy because it conforms to NSSecureCoding and is simply a pageId + frameId. 2021-02-20 Chris Fleizach AX: Image should report the embedded accessibility description if available https://bugs.webkit.org/show_bug.cgi?id=221875 Reviewed by Jer Noble. * WebProcess/GPU/media/RemoteImageDecoderAVF.h: 2021-02-20 Peng Liu Video elements do not work as sources for TexImage2D calls in GPU Process https://bugs.webkit.org/show_bug.cgi?id=218184 Reviewed by Jer Noble. Add an IPC message `RemoteGraphicsContextGL::CopyTextureFromMedia` to implement `RemoteGraphicsContextGLProxy::copyTextureFromMedia()` in the Web process. * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::copyTextureFromMedia): * GPUProcess/graphics/RemoteGraphicsContextGL.h: We should use `m_gpuConnectionToWebProcess` in the main thread only. * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::copyTextureFromMedia): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 2021-02-20 Youenn Fablet Add support for adding/removing/clearing mock devices in GPUProcess https://bugs.webkit.org/show_bug.cgi?id=222174 Reviewed by Eric Carlson. Make sure to forward mock device orders to GPU process so that it is kept in sync with UIProcess. Covered by updated test. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::addMockMediaDevice): (WebKit::GPUProcess::clearMockMediaDevices): (WebKit::GPUProcess::removeMockMediaDevice): (WebKit::GPUProcess::resetMockMediaDevices): * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcess.messages.in: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::addMockMediaDevice): (WebKit::GPUProcessProxy::clearMockMediaDevices): (WebKit::GPUProcessProxy::removeMockMediaDevice): (WebKit::GPUProcessProxy::resetMockMediaDevices): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::addMockMediaDevice): (WebKit::WebProcessPool::clearMockMediaDevices): (WebKit::WebProcessPool::removeMockMediaDevice): (WebKit::WebProcessPool::resetMockMediaDevices): 2021-02-20 Jiewen Tan PCM: Store and report source unlinkable tokens https://bugs.webkit.org/show_bug.cgi?id=222208 Reviewed by John Wilander. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setFraudPreventionValuesForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::setFraudPreventionValuesForTesting): * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::getSignedSecretToken): (WebKit::PrivateClickMeasurementManager::setFraudPreventionValuesForTesting): * NetworkProcess/PrivateClickMeasurementManager.h: * UIProcess/API/C/WKPage.cpp: (WKPageSetFraudPreventionValuesForTesting): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::WebPageProxy::setFraudPreventionValuesForTesting): * UIProcess/WebPageProxy.h: Adds infrastructure to mock the crypto operations such that layout tests can be conducted without the server side crypto support. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase): (WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement): * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::getTokenPublicKey): (WebKit::PrivateClickMeasurementManager::getSignedSecretToken): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl): * NetworkProcess/PrivateClickMeasurementManager.h: Connects the fraud prevention feature in PCM to generate, store, and report the unlinkable token. 2021-02-20 Kimmo Kinnunen WebGL GPU process IPC should use shared memory for asynchronous messages https://bugs.webkit.org/show_bug.cgi?id=219641 Reviewed by Geoff Garen. Implement a concept of a message buffer. This is a similar concept as "command buffer" or "display list" in some graphics APIs. Messages can be added to the buffer by a client and then played back by a server. Current implementation adds a specific pseudo-infinite, semi-duplex message buffer type IPC::StreamConnectionBuffer. This is a buffer that can be attached to stream connection, an object that can deliver IPC messages either through the message buffer or through normal IPC::Connection. The stream connection is implemented as IPC::StreamClientConnection and IPC::StreamServerConnection. The connection has server and client distinction, similar to IPC::Connection. Unlike IPC::Connection, a stream connection is asymmetric in features: the client can send messages and receive replies, where as the server can receive messages and send replies. Messages received through IPC::StreamServerConnection can be processed by StreamConnectionWorkQueue. Currently asynchronous messages are added to the stream. Synchronous messages and their replies are dispatched through normal IPC. WebGL is implemented by having one StreamConnectionWorkQueue for all WebGL in the browser. Currently each web process WebGL context in has one StreamClientConnection attached to one 2mb StreamConnectionBuffer. Later on, there will be only one WebGL stream connection and connection buffer shared between all contexts in particular thread in Web process. The implementation is "optimized" for the later on case. Due to single- process nature of each page, it does not make much sense to have buffer per context. However, it is anticipated that many of the successive calls are to same context. The SHM message format implements an optimization where the destination id is maintained as part of the stream connection state. In GPU process side, all WebGL is processed in one task queue, "RemoteGraphicsContextGL task queue". It will process up to 1000 commands per connection per iteration. Implemented as follows: Sender shares the shared memory area with the destination when creating the destination. If the message fits to the stream shared memory area, write it there. Otherwise send it via normal IPC as out of line message. Messages to the destination arrive as before, in order. For each out of line message, an entry is pushed to the stream. Receiver will stop processing the stream and processing will continue once the out-of-line message has been processed. Sender can write messages to the stream simultaneous to the receiver reading the messages. This is implemented as a ring buffer with atomic sender and receiver pointers. Stream connection processing is implemented as a shared semaphore. This semaphore is notified if the receiver is waiting on it. Performance impact (iMac Pro): - MotionMark triangles: 300 points -> 4000 points (~7000 points no-GPUP) - WebGL samples Aquarium: 1000 fish ~60fps -> 5000 fish ~60fps (~5000 fish with no-GPUP) No new tests, tested by existing tests. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createGraphicsContextGL): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::remoteGraphicsContextGLStreamWorkQueue): (WebKit::RemoteGraphicsContextGL::create): (WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL): (WebKit::RemoteGraphicsContextGL::~RemoteGraphicsContextGL): (WebKit::RemoteGraphicsContextGL::initialize): (WebKit::RemoteGraphicsContextGL::connectWebProcessConnection): (WebKit::RemoteGraphicsContextGL::disconnectWebProcessConnection): (WebKit::RemoteGraphicsContextGL::workQueueInitialize): (WebKit::RemoteGraphicsContextGL::workQueueUninitialize): Initialize the OpenGL context in the work queue, since OpenGL has various limitations wrt thread mobility. (WebKit::RemoteGraphicsContextGL::forceContextLost): (WebKit::RemoteGraphicsContextGL::dispatchContextChangedNotification): * GPUProcess/graphics/RemoteGraphicsContextGL.h: (WebKit::RemoteGraphicsContextGL::platformWorkQueueInitialize): (WebKit::RemoteGraphicsContextGL::send const): * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp: (WebKit::RemoteGraphicsContextGL::create): (WebKit::RemoteGraphicsContextGLCocoa::RemoteGraphicsContextGLCocoa): (WebKit::RemoteGraphicsContextGLCocoa::platformWorkQueueInitialize): * NetworkProcess/webrtc/NetworkRTCProvider.h: * Platform/IPC/ArgumentCoder.h: * Platform/IPC/ArgumentCoders.cpp: * Platform/IPC/ArgumentCoders.h: Make it possible to use multiple different Encoder classes to encode the IPC data. * Platform/IPC/Connection.cpp: (IPC::Connection::processIncomingMessage): (IPC::Connection::dispatchDidReceiveInvalidMessage): * Platform/IPC/Connection.h: Add possibility for the stream decoding logic to send the didReceiveInvalidMessage notification to the connection client. * Platform/IPC/Decoder.cpp: (IPC::Decoder::Decoder): (IPC::m_bufferDeallocator): (IPC::m_destinationID): * Platform/IPC/Decoder.h: Add a constructor for Decoder for constructing a decoder in place in the stream buffer. * Platform/IPC/HandleMessage.h: (IPC::handleMessageSynchronous): Adds a stream-specific handleMessageSynchronous. The old ones are unneccessarily complex, as they need redundant calls through redundant generated send functions. The old ones need the reply encoder passed in, which is redundant and problematic for the upcoming case where the stream messaging will mainly reply through the stream itself, constructing the IPC::StreamConnectionEncoder instead of normal IPC::Encoder. * Platform/IPC/StreamClientConnection.cpp: Copied from Source/WebKit/Platform/IPC/cocoa/MachPort.h. (IPC::StreamClientConnection::StreamClientConnection): (IPC::StreamClientConnection::setWakeUpSemaphore): Add function to set the connection receive side wakeup semaphore. Currently the semaphore is the semaphore that StreamConnectionWorkQueue waits on. All streams processed by the same work queue will receive the same semaphore and will notify it when they have written new data. (IPC::StreamClientConnection::wakeUpReceiver): * Platform/IPC/StreamClientConnection.h: Added. (IPC::StreamClientConnection::send): (IPC::StreamClientConnection::sendSync): (IPC::StreamClientConnection::trySendDestinationIDIfNeeded): (IPC::StreamClientConnection::sendProcessOutOfStreamMessage): (IPC::StreamClientConnection::tryAcquire): (IPC::StreamClientConnection::release): (IPC::StreamClientConnection::alignedSpan): (IPC::StreamClientConnection::size): (IPC::StreamClientConnection::clampedLimit const): Add the implementation for sending data through the shared memory. * Platform/IPC/StreamConnectionBuffer.cpp: Added. (IPC::createMemory): (IPC::StreamConnectionBuffer::StreamConnectionBuffer): (IPC::StreamConnectionBuffer::operator=): (IPC::StreamConnectionBuffer::encode const): (IPC::StreamConnectionBuffer::decode): * Platform/IPC/StreamConnectionBuffer.h: Added. (IPC::StreamConnectionBuffer::wrapOffset const): (IPC::StreamConnectionBuffer::alignOffset const): (IPC::StreamConnectionBuffer::senderOffset): (IPC::StreamConnectionBuffer::receiverOffset): (IPC::StreamConnectionBuffer::data const): (IPC::StreamConnectionBuffer::dataSize const): (IPC::StreamConnectionBuffer::senderWaitSemaphore): (IPC::StreamConnectionBuffer::header const): (IPC::StreamConnectionBuffer::headerSize): Add the common implementation for the shared memory ring buffer. This is the common implementation used by both the sender side as well as the receiver side. Due to the selection of how the size is marked up, the common implementation does not contain all the non-trivial code. The "algorithm" uses a "hole indicator" to differentiate between cases of "buffer is empty" and "buffer is full". The other alternative could be better and maybe explored later. * Platform/IPC/StreamConnectionEncoder.h: Added. * Platform/IPC/StreamConnectionWorkQueue.cpp: Added. (IPC::StreamConnectionWorkQueue::StreamConnectionWorkQueue): (IPC::StreamConnectionWorkQueue::dispatch): (IPC::StreamConnectionWorkQueue::addStreamConnection): (IPC::StreamConnectionWorkQueue::removeStreamConnection): (IPC::StreamConnectionWorkQueue::stop): (IPC::StreamConnectionWorkQueue::wakeUp): (IPC::StreamConnectionWorkQueue::wakeUpSemaphore): (IPC::StreamConnectionWorkQueue::wakeUpProcessingThread): (IPC::StreamConnectionWorkQueue::processStreams): Work queue contains multiple StreamServerConnection instances. For each iteration of the work queue thread, it will process 1000 items from each connection. If none of the connections contain work, the queue will sleep on the work queue semaphore. The senders will send through StreamClientConnection which will wake up the work queue by signaling the semaphore. * Platform/IPC/StreamConnectionWorkQueue.h: Copied from Source/WebKit/Platform/IPC/cocoa/MachPort.h. * Platform/IPC/StreamServerConnection.cpp: Added. (IPC::StreamServerConnectionBase::StreamServerConnectionBase): (IPC::StreamServerConnectionBase::startReceivingMessagesImpl): (IPC::StreamServerConnectionBase::stopReceivingMessagesImpl): (IPC::StreamServerConnectionBase::enqueueMessage): (IPC::StreamServerConnectionBase::tryAquire): (IPC::StreamServerConnectionBase::release): (IPC::StreamServerConnectionBase::alignedSpan): (IPC::StreamServerConnectionBase::size): (IPC::StreamServerConnectionBase::clampedLimit const): * Platform/IPC/StreamServerConnection.h: Added. (IPC::StreamServerConnectionBase::connection): (IPC::StreamServerConnectionBase::wrapOffset const): (IPC::StreamServerConnectionBase::alignOffset const): (IPC::StreamServerConnectionBase::sharedSenderOffset): (IPC::StreamServerConnectionBase::sharedReceiverOffset): (IPC::StreamServerConnectionBase::data const): (IPC::StreamServerConnectionBase::dataSize const): (IPC::StreamServerConnectionBase::sendSyncReply): (IPC::StreamServerConnection::startReceivingMessages): (IPC::StreamServerConnection::stopReceivingMessages): (IPC::StreamServerConnection::dispatchStreamMessages): (IPC::StreamServerConnection::processSetStreamDestinationID): (IPC::StreamServerConnection::dispatchStreamMessage): (IPC::StreamServerConnection::dispatchOutOfStreamMessage): StreamServerConnection will process the message buffer and dispatch messages based on the buffer contents. The class is a template so that the message data decode switch (generated by the normal IPC generator) is perhaps inlined to the message unpack loop. * Platform/IPC/cocoa/MachPort.h: * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: Implements a 'Stream' attribute for the message receiver. When marked as 'Stream', the receiver message handler is didReceiveStreamMessage and it will be called for all messages, stream or normal IPC, sync or async. * Scripts/webkit/model.py: Adds IPC control message ProcessOutOfStreamMessage that is acted on if it is part of the stream messages. It means that the stream processing should stop until one normal IPC message, sync or non-synch, should be processed. Adds IPC control message SetStreamDestinationID that is acted on if it is part of the stream messages. It will set the destination ID for all the subsequent stream messages, until another SetStreamDestinationID message is seen. * Scripts/webkit/tests/Makefile: * Scripts/webkit/tests/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: * Scripts/webkit/tests/TestWithStream.messages.in: Copied from Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in. * Scripts/webkit/tests/TestWithStreamBuffer.messages.in: Copied from Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in. * Scripts/webkit/tests/TestWithStreamBufferMessageReceiver.cpp: Added. (WebKit::TestWithStreamBuffer::didReceiveMessage): * Scripts/webkit/tests/TestWithStreamBufferMessages.h: Added. (Messages::TestWithStreamBuffer::messageReceiverName): (Messages::TestWithStreamBuffer::SendStreamBuffer::name): (Messages::TestWithStreamBuffer::SendStreamBuffer::SendStreamBuffer): (Messages::TestWithStreamBuffer::SendStreamBuffer::arguments const): * Scripts/webkit/tests/TestWithStreamBufferMessagesReplies.h: Added. * Scripts/webkit/tests/TestWithStreamMessageReceiver.cpp: Added. (WebKit::TestWithStream::didReceiveStreamMessage): * Scripts/webkit/tests/TestWithStreamMessages.h: Added. (Messages::TestWithStream::messageReceiverName): (Messages::TestWithStream::SendString::name): (Messages::TestWithStream::SendString::SendString): (Messages::TestWithStream::SendString::arguments const): (Messages::TestWithStream::SendStringSynchronized::name): (Messages::TestWithStream::SendStringSynchronized::SendStringSynchronized): (Messages::TestWithStream::SendStringSynchronized::arguments const): * Scripts/webkit/tests/TestWithStreamMessagesReplies.h: Added. * Sources.txt: * UIProcess/Downloads/DownloadProxy.h: * UIProcess/ProvisionalPageProxy.cpp: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy): (WebKit::RemoteGraphicsContextGLProxy::wasCreated): Send the work queue wakeup semaphore as a result of the context creation. * Platform/IPC/ScopedActiveMessageReceiveQueue.h: Added. (IPC::ScopedActiveMessageReceiveQueue::ScopedActiveMessageReceiveQueue): (IPC::ScopedActiveMessageReceiveQueue::operator=): (IPC::ScopedActiveMessageReceiveQueue::~ScopedActiveMessageReceiveQueue): (IPC::ScopedActiveMessageReceiveQueue::reset): (IPC::ScopedActiveMessageReceiveQueue::get const): (IPC::ScopedActiveMessageReceiveQueue::stopListeningForIPCAndRelease): Add a holder to replace previous RemoteRenderingBackendWrapper. Now other classes can be held similarly. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in: * WebProcess/Network/webrtc/LibWebRTCNetwork.h: 2021-02-20 Wenson Hsieh Unreviewed, reverting r273115. Breaks autocorrect without the accompanying change in rdar://problem/74211293 Reverted changeset: "Unconditionally return information in _autofillContext SPI when a field is focused" https://bugs.webkit.org/show_bug.cgi?id=221828 https://commits.webkit.org/r273115 2021-02-20 Chris Dumez Unreviewed, fix regression from r273194 that was spotted by Darin Adler after landing. * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:]): (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): 2021-02-19 Chris Dumez Crash under Decoder::Decoder() https://bugs.webkit.org/show_bug.cgi?id=222192 Reviewed by Geoffrey Garen. We are sometimes crashing under Decoder's copyBuffer(), inside the memcpy() call, with a null address. I have no idea how this is happening and this code has not changed in a long time so I have made the following hardening: 1. Update copyBuffer() to use tryFastMalloc() instead of fastMalloc(). Log and return null if tryFastMalloc() failed instead of calling memcpy(). 2. Update Decoder::create() to log and return early if the input buffer is null. 3. Update Connection's createMessageDecoder() to use CheckedSize when computing the bodySize that is being passed to Decoder::create(). If we overflow, log and return null. No new tests, no idea how this can happen in practice. * Platform/IPC/Decoder.cpp: (IPC::copyBuffer): (IPC::Decoder::create): (IPC::Decoder::Decoder): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::createMessageDecoder): 2021-02-19 BJ Burg [Cocoa] WKBrowsingContextHandle should conform to NSCopying https://bugs.webkit.org/show_bug.cgi?id=222214 Reviewed by Devin Rousso. * Shared/API/Cocoa/WKBrowsingContextHandle.h: * Shared/API/Cocoa/WKBrowsingContextHandle.mm: (-[WKBrowsingContextHandle copyWithZone:]): 2021-02-19 Chris Dumez Review remaining usage of autorelease to make sure it is necessary https://bugs.webkit.org/show_bug.cgi?id=222177 Reviewed by Geoffrey Garen. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:]): (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): * UIProcess/API/Cocoa/NSAttributedString.mm: (+[_WKAttributedStringWebViewCache configuration]): (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (setUpPagePolicyClient): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]): * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: (WebKit::convertToNPNNString): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]): 2021-02-19 Devin Rousso [Payment Request] add an `object data` to `PaymentShippingOption` so that data specific to Apple Pay can be provided https://bugs.webkit.org/show_bug.cgi?id=222211 Reviewed by Tim Horton. * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKShippingMethod): * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: (toShippingMethod): 2021-02-19 Wenson Hsieh Unreviewed, fix some internal builds after r273184 Add a forward declaration for this (recently added) SPI, which we can safely revert once internal automation is using an SDK with the fix for . * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _dataOwnerForPasteboard:]): Additionally make this binary compatible with older versions of the system by adding a `-respondsToSelector:` check before attempting to use the declared SPI. 2021-02-19 Kate Cheney Add back old media playback API but deprecated https://bugs.webkit.org/show_bug.cgi?id=222206 We should add these back in case clients adopted them before the name update in https://trac.webkit.org/changeset/272923/webkit. Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView pauseAllMediaPlayback:]): (-[WKWebView suspendAllMediaPlayback:]): (-[WKWebView resumeAllMediaPlayback:]): (-[WKWebView closeAllMediaPresentations:]): (-[WKWebView requestMediaPlaybackState:]): 2021-02-19 Wenson Hsieh [iOS] Specify a _UIDataOwner when reading or writing from the system pasteboard https://bugs.webkit.org/show_bug.cgi?id=222072 Reviewed by Devin Rousso. Adds WebKit2 support for tagging `PlatformPasteboard` with the content view's pasteboard data owner type. See below for more details. * Platform/spi/ios/UIKitSPI.h: Import `UIPasteboard_Private.h` so that we know about `+_performAsDataOwner:block:` in the API tests. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::getPasteboardTypes): (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType): (WebKit::WebPasteboardProxy::getPasteboardStringForType): (WebKit::WebPasteboardProxy::getPasteboardStringsForType): (WebKit::WebPasteboardProxy::getPasteboardBufferForType): (WebKit::WebPasteboardProxy::getPasteboardChangeCount): (WebKit::WebPasteboardProxy::getPasteboardColor): (WebKit::WebPasteboardProxy::getPasteboardURL): (WebKit::WebPasteboardProxy::addPasteboardTypes): (WebKit::WebPasteboardProxy::setPasteboardTypes): (WebKit::WebPasteboardProxy::setPasteboardURL): (WebKit::WebPasteboardProxy::setPasteboardColor): (WebKit::WebPasteboardProxy::setPasteboardStringForType): (WebKit::WebPasteboardProxy::containsURLStringSuitableForLoading): Make all of these methods use `dataOwner()` with either a `Read` or `Write` pasteboard access intent to grab the data owner type from the view corresponding to the page identifier, and then wrap all pasteboard access within `PlatformPasteboard`'s new `performAsDataOwner` static helper. (WebKit::WebPasteboardProxy::urlStringSuitableForLoading): (WebKit::WebPasteboardProxy::setPasteboardBufferForType): (WebKit::WebPasteboardProxy::getNumberOfFiles): (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): (WebKit::WebPasteboardProxy::writeCustomData): (WebKit::WebPasteboardProxy::allPasteboardItemInfo): (WebKit::WebPasteboardProxy::informationForItemAtIndex): (WebKit::WebPasteboardProxy::getPasteboardItemsCount): (WebKit::WebPasteboardProxy::readStringFromPasteboard): (WebKit::WebPasteboardProxy::readURLFromPasteboard): (WebKit::WebPasteboardProxy::readBufferFromPasteboard): (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType): (WebKit::WebPasteboardProxy::writeURLToPasteboard): (WebKit::WebPasteboardProxy::writeWebContentToPasteboard): (WebKit::WebPasteboardProxy::writeImageToPasteboard): (WebKit::WebPasteboardProxy::writeStringToPasteboard): (WebKit::WebPasteboardProxy::updateSupportedTypeIdentifiers): (WebKit::WebPasteboardProxy::determineDataOwner const): Use the given page identifier in various pasteboard IPC endpoints in `WebPasteboardProxy` to ask `WebPageProxy` for its pasteboard data owner type when reading or writing pasteboard data. * UIProcess/PageClient.h: Add a client hook to return a `DataOwnerType` enum, given a `PasteboardAccessIntent` -- that is, copy (write) or paste (read). (WebKit::PageClient::dataOwnerForPasteboard const): * UIProcess/PasteboardAccessIntent.h: Added. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dataOwnerForPasteboard const): * UIProcess/WebPageProxy.h: * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::dataOwnerForPasteboard const): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (coreDataOwnerType): (-[WKContentView _dataOwnerForPasteboard:]): Return `-_dataOwnerForPaste` or `-_dataOwnerForCopy` (depending on the `PasteboardAccessIntent`). * WebKit.xcodeproj/project.pbxproj: 2021-02-19 Chris Dumez Make format of release logging more consistent to facilitate grepping https://bugs.webkit.org/show_bug.cgi?id=222200 Reviewed by Simon Fraser. * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didCompleteWithError): * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didReceiveMessage): (WebKit::NetworkProcess::didReceiveSyncMessage): (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::prepareToSuspend): * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::didReceiveResponse): (WebKit::PingLoad::didCompleteWithError): * NetworkProcess/PreconnectTask.cpp: (WebKit::PreconnectTask::didFailLoading): * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::startFetch): * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * Platform/IPC/Connection.cpp: (IPC::Connection::waitForSyncReply): * UIProcess/ApplicationStateTracker.mm: (WebKit::ApplicationStateTracker::ApplicationStateTracker): * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::terminate): * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::setAssertionType): (WebKit::ProcessThrottler::updateAssertionIfNeeded): (WebKit::ProcessThrottler::sendPrepareToSuspendIPC): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::ProvisionalPageProxy): (WebKit::ProvisionalPageProxy::processDidTerminate): (WebKit::ProvisionalPageProxy::cancel): (WebKit::ProvisionalPageProxy::loadData): (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::goToBackForwardItem): (WebKit::ProvisionalPageProxy::didCreateMainFrame): (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): (WebKit::ProvisionalPageProxy::didCreateContextForVisibilityPropagation): * UIProcess/WebBackForwardCache.cpp: (WebKit::WebBackForwardCache::addEntry): (WebKit::WebBackForwardCache::removeEntry): (WebKit::WebBackForwardCache::takeSuspendedPage): * UIProcess/WebBackForwardCacheEntry.cpp: (WebKit::WebBackForwardCacheEntry::expirationTimerFired): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared): (WebKit::WebPageProxy::willPerformClientRedirectForFrame): (WebKit::WebPageProxy::didCancelClientRedirectForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::dispatchProcessDidTerminate): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessCrashed): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::updateServiceWorkerProcessAssertion): * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread]): (WebKit::ProcessAssertion::ProcessAssertion): (WebKit::ProcessAssertion::~ProcessAssertion): (WebKit::ProcessAssertion::processAssertionWasInvalidated): * UIProcess/ios/WKApplicationStateTrackingView.mm: (-[WKApplicationStateTrackingView willMoveToWindow:]): (-[WKApplicationStateTrackingView didMoveToWindow]): * UIProcess/ios/WKContentView.mm: (-[WKContentView _setupVisibilityPropagationView]): (-[WKContentView _setupVisibilityPropagationViewForGPUProcess]): * WebAuthnProcess/WebAuthnProcess.cpp: (WebKit::WebAuthnProcess::prepareToSuspend): * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::logUserInteractionWithReducedTimeResolution): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceivePolicyDecision): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): (WebKit::WebProcess::prepareToSuspend): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateFreezerStatus): 2021-02-19 Alex Christensen NSError returned by WebKit API should actually conform to NSSecureCoding https://bugs.webkit.org/show_bug.cgi?id=222204 Reviewed by Chris Dumez. When an NSError is encoded, its userInfo is encoded, which means everything we put in userInfo should be encodable. WKReloadFrameErrorRecoveryAttempter was not, so let's make it! When encoded, it will just encode nothing. When decoded, it will produce a WKReloadFrameErrorRecoveryAttempter that does nothing, which is valid behavior, and more desirable than crashing. * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.h: * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: (-[WKReloadFrameErrorRecoveryAttempter encodeWithCoder:]): (-[WKReloadFrameErrorRecoveryAttempter initWithCoder:]): (+[WKReloadFrameErrorRecoveryAttempter supportsSecureCoding]): 2021-02-19 Alex Christensen CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper [iOS] Remove access to IOSurfaceAcceleratorClient https://bugs.webkit.org/show_bug.cgi?id=222199 Reviewed by Brent Fulgham. Remove access to IOSurfaceAcceleratorClient in the WebContent process on iOS when the GPU process is enabled. This patch also adds the IOKit filter from IOSurfaceRootUserClient when the GPU process is not enabled, to the rule for IOSurfaceRootUserClient when the GPU process is enabled. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-02-19 Jean-Yves Avenard Legacy CDM doesn't work when GPU media process is enabled https://bugs.webkit.org/show_bug.cgi?id=222163 rdar://74254335 Reviewed by Eric Carlson. We don't have an infrastructure to generate CDM keys * WebProcess/GPU/media/RemoteLegacyCDMSession.cpp: (WebKit::RemoteLegacyCDMSession::update): Don't unditionally report that an error occurred, but the result of the actual proxied operation in the content process. 2021-02-19 Per Arne Vollan [iOS] Partially revert r272973 https://bugs.webkit.org/show_bug.cgi?id=222168 Unreviewed, partially reverting r272973. Partially revert r272973, since it appears to have caused a Safari launch regression. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-02-19 Devin Rousso [Payment Request] add support for Apple Pay payment method mode https://bugs.webkit.org/show_bug.cgi?id=222128 Reviewed by Wenson Hsieh. Handle the delegate call from `PaymentAuthorization(View)Controller` by passing it along to the WebProcess to be handled by WebCore. Handle the response sent by the WebProcess by invoking the callback that was provided by the delegate call (which is saved to an ivar). * WebProcess/ApplePay/WebPaymentCoordinator.messages.in: * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::completePaymentMethodModeChange): Added. (WebKit::WebPaymentCoordinator::didChangePaymentMethodMode): Added. * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodModeChange): Added. (WebKit::WebPaymentCoordinatorProxy::presenterDidChangePaymentMethodMode): Added. (WebKit::WebPaymentCoordinatorProxy::canBegin const): (WebKit::WebPaymentCoordinatorProxy::canCancel const): (WebKit::WebPaymentCoordinatorProxy::canCompletePayment const): (WebKit::WebPaymentCoordinatorProxy::canAbort const): * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodModeChange): Added. * Platform/cocoa/PaymentAuthorizationPresenter.h: * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toPKPaymentErrorCode): (WebKit::PaymentAuthorizationPresenter::completePaymentMethodModeChange): Added. * Platform/cocoa/PaymentAuthorizationViewController.mm: * Platform/cocoa/WKPaymentAuthorizationDelegate.h: * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: * Platform/ios/PaymentAuthorizationController.mm: 2021-02-19 Per Arne Vollan [macOS] Add IOKit filtering also when the GPU process is enabled https://bugs.webkit.org/show_bug.cgi?id=222153 Reviewed by Brent Fulgham. IOKit filtering is enabled when the GPU process is not enabled. It should also be enabled when the GPU process is enabled. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-19 Per Arne Add notifyd message filter https://bugs.webkit.org/show_bug.cgi?id=222129 Reviewed by Brent Fulgham. Add notifyd message filter in the WebContent process' sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-19 Kate Cheney Add better error handling to ResourceLoadStatisticsDatabaseStore::needsUpdatedPrivateClickMeasurementSchema() https://bugs.webkit.org/show_bug.cgi?id=222169 Reviewed by Darin Adler. Add better error handling for the case where the query to find the UnattributedPrivateClickMeasurement table fails. This is unlikely to happen in practice, however, if it does, we should add logging and a debug ASSERT. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedPrivateClickMeasurementSchema): 2021-02-19 Devin Rousso [Payment Request] add an `object data` to `PaymentDetailsBase` so that data specific to Apple Pay can be provided https://bugs.webkit.org/show_bug.cgi?id=222002 Reviewed by Tim Horton. * Platform/cocoa/PaymentAuthorizationPresenter.h: * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toPKPaymentErrorCode): (WebKit::toNSError): (WebKit::toNSErrors): (WebKit::toPKShippingMethods): (WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection): (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): (WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection): * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: (toShippingMethod): * Scripts/webkit/messages.py: * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection): (WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection): (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection): (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod): * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toPKShippingMethod): (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): (WebKit::finishCreating): Deleted. * Shared/WebCoreArgumentCoders.h: * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder>>::encode): Added. (IPC::ArgumentCoder>>::decode): Added. (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * WebProcess/ApplePay/WebPaymentCoordinator.messages.in: * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::completeShippingMethodSelection): (WebKit::WebPaymentCoordinator::completeShippingContactSelection): (WebKit::WebPaymentCoordinator::completePaymentMethodSelection): (WebKit::WebPaymentCoordinator::didSelectShippingMethod): Use `ApplePay*Update` instead of duplicating its structure in another object (`ApplePaySessionPaymentRequest::*Update`). Use `ApplePayShippingMethod` instead of duplicating its structure in another object (`ApplePaySessionPaymentRequest::ShippingMethod`). Use `ApplePayError*` instead of duplicating its structure in another object (`ApplePaySessionPaymentRequest::PaymentError::*`). 2021-02-19 Chris Dumez Norton Safe Web extension is causing crashes / hangs under [WKRemoteObjectEncoder encodeObject:forKey:] https://bugs.webkit.org/show_bug.cgi?id=222172 Reviewed by Alex Christensen. The extension appears to be trying to send a JSValue that is a DOM Node. WebKit makes the following call to convert it into a NSDictionary: `[[JSValue valueWithJSValueRef:value inContext:[JSContext contextWithJSGlobalContextRef:JSContextGetGlobalContext(context)]] toObject]` JSC very aggressively iterates over all of the properties of the DOM Node and recursively ends up converting the whole DOM tree with all their properties. This leads to a lot of cycles to as JSC maintains the JSObject <-> NSObject identity during the conversion (Each time the JSDocument is serialized, the same NSDictionary* pointer is used to represent it). The logic introduced in r270559 to detect cycles was flawed because it relied on a NSSet of NSObject* and [NSSet containsObject:] to detect the cycles. The issue is that [NSSet containsObject:] doesn't do a simple pointer comparison but instead calls [NSObject isEqual:] which is very expensive for types like NSDictionary and leads to trouble when the dictionary contains a cycle. To address this I replaced the NSSet with a WTF::HashSet so that key lookup ends up doing a simple pointer comparison. Even after the previous fix, the extension would still cause massive hangs because it would take a very long time to try and encode the whole DOM tree with all the properties of each Node (even without cycles). To address this, we now abort encoding when detecting a cycle instead of encoding an empty object to break the cycle. After this change, Safari becomes usable with this extension again. However, there are still much shorter hangs that occur due to the converting of the JSNode into a JSDictionary via [JSValue toObject]. We should probably improve this in a follow-up. Easy way to reproduce the crash / hang: 1. Install Norton Safe Web & Norton Password Manager extension (may require a subscription) 2. Make sure the extensions are activated and turned on by clicking on their icons next to the URL bar 3. Go to https://bugs.webkit.org/attachment.cgi?id=420530&action=edit 4. Click on the combo box next to "Review" -> Hang / Crash No new tests, covered by WebKit.RemoteObjectRegistry API test. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (-[WKRemoteObjectEncoder init]): (encodeInvocationArguments): (encodeObject): 2021-02-19 Kimmo Kinnunen RemoteRenderingBackend is accessed in non-thread-safe manner https://bugs.webkit.org/show_bug.cgi?id=222056 Reviewed by Chris Dumez. The class calls Connection::addWorkQueueMessageReceiver() during its construction, passing 'this' as the receiver. The virtual function pointer is not fully constructed during the call time. Connection may start dispatching calls to the work queue. The work queue may dispatch the task function through that pointer immediately after the call. If a message comes during the constructor call, it may be dispatched during the constructor still running, before the virtual function pointer being correctly set up. Accessing virtual function pointer is not thread safe until it is fully constructed. No new tests, unit tests for WebKit not possible ATM. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::create): (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::startListeningForIPC): * GPUProcess/graphics/RemoteRenderingBackend.h: 2021-02-19 Kate Cheney Create SQLite skeleton implementation for PCM fraud prevention https://bugs.webkit.org/show_bug.cgi?id=222149 Reviewed by Jiewen Tan. This patch updates the PCM sqlite tables to hold 3 extra values: token content, a signature, and a keyID. Since we are updating the schema of an existing table, we need to migrate existing PCM data to the new tables. These will have "null" values in the new fields. Extensive local testing. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::unattributedPrivateClickMeasurementSchemaV1): (WebKit::unattributedPrivateClickMeasurementSchemaV1Alternate): (WebKit::outdatedUnattributedColumns): (WebKit::outdatedAttributedColumns): Strings that will help us determine if the schema needs to be updated and hold the existing columns so we can populate the new tables with this data. (WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedPrivateClickMeasurementSchema): Compare the existing schema with the new one. We only need to do this for one PCM table because they are being changed in the same patch. (WebKit::ResourceLoadStatisticsDatabaseStore::missingReferenceToObservedDomains): Name update now that there are various reasons to migrate data. (WebKit::columnsToCopy): I chose to migrate all tables even if only PCM tables need updating because it was simpler with existing code, and it gives us more flexibility if we need to change more schemas in the future. Since the migration happens only once each time we update the schema, this is probably low cost. The columnsToCopy() function gives us the option to specify data we need from existing tables when we migrate. (WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase): (WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement): For now, these are empty values that we will implement when PCM fraud prevention pieces are in place. (WebKit::ResourceLoadStatisticsDatabaseStore::isMigrationNecessary): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 2021-02-19 Jiewen Tan PCM: Request server public key to generate secret token https://bugs.webkit.org/show_bug.cgi?id=222141 Reviewed by John Wilander. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setPrivateClickMeasurementTokenPublicKeyURLForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::setPrivateClickMeasurementTokenPublicKeyURLForTesting): * NetworkProcess/NetworkSession.h: Paperwork to add a way to set test URL. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::generateNetworkResourceLoadParameters): (WebKit::generateNetworkResourceLoadParametersForPost): (WebKit::generateNetworkResourceLoadParametersForGet): (WebKit::PrivateClickMeasurementManager::getTokenPublicKey): (WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::setTokenPublicKeyURLForTesting): * NetworkProcess/PrivateClickMeasurementManager.h: Teaches the PCMM to send the token public key request. * UIProcess/API/C/WKPage.cpp: (WKPageSetPrivateClickMeasurementTokenPublicKeyURLForTesting): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::simulateResourceLoadStatisticsSessionRestart): (WebKit::WebPageProxy::setPrivateClickMeasurementTokenPublicKeyURLForTesting): * UIProcess/WebPageProxy.h: Paperwork to add a way to set test URL. 2021-02-19 Michael Catanzaro [WPE] User-Agent quirks not implemented https://bugs.webkit.org/show_bug.cgi?id=222109 Reviewed by Carlos Garcia Campos. Have WPE benefit from GTK's existing user agent code by moving the bits in WebPageGtk.cpp and WebPageProxyGtk.cpp to WebPageGLib.cpp and a new WebPageProxyGLib.cpp. This also moves over a few stub functions that are unimplemented in both WPE and GTK. Finally, it moves a WebsiteDataStore function that had gotten very lost. No new tests. Unfortunately, our existing user agent quirks tests do not exercise these higher-level functions, and so were already running and passing for WPE. * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/glib/WebPageProxyGLib.cpp: Copied from Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp. (WebKit::WebPageProxy::userAgentForURL): (WebKit::WebPageProxy::standardUserAgent): (WebKit::WebPageProxy::saveRecentSearches): (WebKit::WebPageProxy::loadRecentSearches): * UIProcess/glib/WebsiteDataStoreGLib.cpp: (WebKit::WebsiteDataStore::platformRemoveRecentSearches): * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebPageProxy::userAgentForURL): Deleted. (WebKit::WebPageProxy::standardUserAgent): Deleted. (WebKit::WebPageProxy::saveRecentSearches): Deleted. (WebKit::WebPageProxy::loadRecentSearches): Deleted. (WebKit::WebsiteDataStore::platformRemoveRecentSearches): Deleted. * UIProcess/wpe/WebPageProxyWPE.cpp: (WebKit::WebPageProxy::platformInitialize): (WebKit::WebPageProxy::userAgentForURL): Deleted. (WebKit::WebPageProxy::standardUserAgent): Deleted. (WebKit::WebPageProxy::saveRecentSearches): Deleted. (WebKit::WebPageProxy::loadRecentSearches): Deleted. (WebKit::WebsiteDataStore::platformRemoveRecentSearches): Deleted. * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::platformUserAgent const): * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::platformUserAgent const): Deleted. * WebProcess/WebPage/wpe/WebPageWPE.cpp: (WebKit::WebPage::platformUserAgent const): Deleted. 2021-02-19 Youenn Fablet Update WKWebView getUserMedia delegate to latest proposal https://bugs.webkit.org/show_bug.cgi?id=222103 Reviewed by Eric Carlson. Covered by updated API tests. * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::doDefaultAction): 2021-02-18 Chris Dumez Reduce explicit usage of [objC autorelease] in WebKit https://bugs.webkit.org/show_bug.cgi?id=221932 Reviewed by Darin Adler. Follow-up to r272936 in order to address post-landing review comments. * UIProcess/API/Cocoa/NSAttributedString.mm: (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView findString:withConfiguration:completionHandler:]): (-[WKWebView _frames:]): (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]): * UIProcess/API/Cocoa/_WKAutomationSession.mm: (-[_WKAutomationSession init]): * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm: (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]): * UIProcess/Automation/ios/WebAutomationSessionIOS.mm: (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): * UIProcess/Cocoa/WKContactPicker.mm: (-[WKContactPicker _contactsFromJSContacts:]): 2021-02-18 Peng Liu [ MacOS Wk2 Debug ] http/tests/misc/copy-resolves-urls.html is a flakey crash in RemoteMediaPlayerProxy https://bugs.webkit.org/show_bug.cgi?id=222080 Reviewed by Eric Carlson. No new tests, this will fix some crashing macOS tests. * GPUProcess/media/RemoteMediaResource.cpp: (WebKit::RemoteMediaResource::RemoteMediaResource): (WebKit::RemoteMediaResource::~RemoteMediaResource): * GPUProcess/media/RemoteMediaResource.h: * GPUProcess/media/RemoteMediaResourceManager.h: 2021-02-18 Per Arne Vollan [iOS] Remove access to AppleJPEGDriverUserClient https://bugs.webkit.org/show_bug.cgi?id=221458 Reviewed by Brent Fulgham. Remove access to AppleJPEGDriverUserClient in the WebContent process' sandbox on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): 2021-02-18 Megan Gardner Correctly retain properties in _WKAppHighlight https://bugs.webkit.org/show_bug.cgi?id=222151 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/_WKAppHighlight.h: * UIProcess/API/Cocoa/_WKAppHighlight.mm: (-[_WKAppHighlight initWithHighlight:text:image:]): (-[_WKAppHighlight highlight]): (-[_WKAppHighlight text]): (-[_WKAppHighlight image]): 2021-02-18 Julian Gonzalez Crash in IPC::decode(Decoder& decoder, RetainPtr& result) https://bugs.webkit.org/show_bug.cgi?id=222084 Reviewed by Ryosuke Niwa. Add a check for a CFDataRef of 0 length so that we do not pass those to SecKeychainItemCopyFromPersistentReference(), which crashes with them. Test: ipc/argument-coders-crash.html * Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): 2021-02-18 Ricky Mondello Unconditionally return information in _autofillContext SPI when a field is focused https://bugs.webkit.org/show_bug.cgi?id=221828 rdar://74211237 Reviewed by Darin Adler. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _autofillContext]): Change the contract of _autofillContext to return information for any focused text field. Add a "version" key. Explicitly indicate whether we're in a login context. This SPI remains stringly typed for flexibility. 2021-02-18 Brent Fulgham [macOS] Re-add fsctl support for marking files as potentially 'hot' https://bugs.webkit.org/show_bug.cgi?id=222120 Reviewed by Per Arne Vollan. Rolled out r271959. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-18 Devin Rousso [Payment Request] add an `object data` to `PaymentItem` so that data specific to Apple Pay can be provided https://bugs.webkit.org/show_bug.cgi?id=221970 Reviewed by Alex Christensen. * Shared/WebCoreArgumentCoders.h: * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. Just use `ApplePayLineItem` instead of duplicating its structure in another object (`ApplePaySessionPaymentRequest::LineItem`). 2021-02-18 Alex Christensen Add null check in _getMainResourceDataWithCompletionHandler https://bugs.webkit.org/show_bug.cgi?id=222139 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _getMainResourceDataWithCompletionHandler:]): 2021-02-18 BJ Burg [Cocoa] Web Inspector: add support for using custom process pool and page group identifier https://bugs.webkit.org/show_bug.cgi?id=222046 Reviewed by Timothy Hatcher. These additions are necessary for clients to inject Web Extensions API into the tabs created using _WKInspectorExtension. Currently, Web Inspector pages use a private process pool that is separate from page content. Since there is no way to set the pool's injected bundle path prior to opening Web Inspector, we need to allow clients to explicitly configure and set a process pool to be used for WebInspectorUI and any iframe tabs created using _WKInspectorExtension. * UIProcess/API/APIInspectorConfiguration.cpp: (API::InspectorConfiguration::processPool): (API::InspectorConfiguration::setProcessPool): * UIProcess/API/APIInspectorConfiguration.h: * UIProcess/API/Cocoa/_WKInspectorConfiguration.h: * UIProcess/API/Cocoa/_WKInspectorConfiguration.mm: (-[_WKInspectorConfiguration setProcessPool:]): (-[_WKInspectorConfiguration processPool]): (-[_WKInspectorConfiguration applyToWebViewConfiguration:]): (-[_WKInspectorConfiguration copyWithZone:]): Add some plumbing for the new properties. * UIProcess/Inspector/WebInspectorUtilities.h: * UIProcess/Inspector/WebInspectorUtilities.cpp: (WebKit::defaultInspectorPageGroupIdentifierForPage): Renamed. (WebKit::defaultInspectorProcessPool): Renamed. (WebKit::allInspectorProcessPools): Move to using a WeakHashSet since there could be a number of pools specified by the client for different inspector instances. (WebKit::prepareProcessPoolForInspector): Added. (WebKit::isInspectorProcessPool): Turn this into a set lookup. * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController webViewConfiguration]): Add logic to use a custom process pool or a default process pool (existing behavior). Add logic to use a custom page group identifier or a default value (existing behavior). * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformCreateFrontendPage): * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): * UIProcess/Inspector/win/WebInspectorProxyWin.cpp: (WebKit::WebInspectorProxy::platformCreateFrontendPage): Adapt to renames. 2021-02-18 Wenson Hsieh Plumb an Optional through WebPasteboardProxy https://bugs.webkit.org/show_bug.cgi?id=222071 Reviewed by Tim Horton. Add `const PasteboardContext*` arguments to the `PasteboardStrategy` methods on `WebPlatformStrategies`, convert them to `PageIdentifier`s, and send them over to the UI process via `WebPasteboardProxy` methods. While currently unused inside `WebPasteboardProxy`, the next patch will attempt to use these page identifiers to retrieve a data owner type from the corresponding `WebPageProxy`, and then forward this data owner type to the `PlatformPasteboard`. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::getPasteboardTypes): (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType): (WebKit::WebPasteboardProxy::getPasteboardStringForType): (WebKit::WebPasteboardProxy::getPasteboardStringsForType): (WebKit::WebPasteboardProxy::getPasteboardBufferForType): (WebKit::WebPasteboardProxy::getPasteboardChangeCount): (WebKit::WebPasteboardProxy::getPasteboardColor): (WebKit::WebPasteboardProxy::getPasteboardURL): (WebKit::WebPasteboardProxy::addPasteboardTypes): (WebKit::WebPasteboardProxy::setPasteboardTypes): (WebKit::WebPasteboardProxy::setPasteboardURL): (WebKit::WebPasteboardProxy::setPasteboardColor): (WebKit::WebPasteboardProxy::setPasteboardStringForType): (WebKit::WebPasteboardProxy::containsURLStringSuitableForLoading): (WebKit::WebPasteboardProxy::urlStringSuitableForLoading): (WebKit::WebPasteboardProxy::setPasteboardBufferForType): (WebKit::WebPasteboardProxy::getNumberOfFiles): (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): (WebKit::WebPasteboardProxy::writeCustomData): (WebKit::WebPasteboardProxy::allPasteboardItemInfo): (WebKit::WebPasteboardProxy::informationForItemAtIndex): (WebKit::WebPasteboardProxy::getPasteboardItemsCount): (WebKit::WebPasteboardProxy::readStringFromPasteboard): (WebKit::WebPasteboardProxy::readURLFromPasteboard): (WebKit::WebPasteboardProxy::readBufferFromPasteboard): (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType): (WebKit::WebPasteboardProxy::writeURLToPasteboard): (WebKit::WebPasteboardProxy::writeWebContentToPasteboard): (WebKit::WebPasteboardProxy::writeImageToPasteboard): (WebKit::WebPasteboardProxy::writeStringToPasteboard): (WebKit::WebPasteboardProxy::updateSupportedTypeIdentifiers): * UIProcess/WebPasteboardProxy.cpp: (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): (WebKit::WebPasteboardProxy::writeCustomData): (WebKit::WebPasteboardProxy::allPasteboardItemInfo): (WebKit::WebPasteboardProxy::informationForItemAtIndex): (WebKit::WebPasteboardProxy::getPasteboardItemsCount): (WebKit::WebPasteboardProxy::readURLFromPasteboard): (WebKit::WebPasteboardProxy::readBufferFromPasteboard): (WebKit::WebPasteboardProxy::readStringFromPasteboard): (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType): (WebKit::WebPasteboardProxy::containsURLStringSuitableForLoading): (WebKit::WebPasteboardProxy::urlStringSuitableForLoading): * UIProcess/WebPasteboardProxy.h: * UIProcess/WebPasteboardProxy.messages.in: * UIProcess/gtk/WebPasteboardProxyGtk.cpp: (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): (WebKit::WebPasteboardProxy::writeCustomData): * UIProcess/libwpe/WebPasteboardProxyLibWPE.cpp: (WebKit::WebPasteboardProxy::readStringFromPasteboard): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::writeItemsToPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::pageIdentifier): (WebKit::WebPlatformStrategies::getTypes): (WebKit::WebPlatformStrategies::bufferForType): (WebKit::WebPlatformStrategies::getPathnamesForType): (WebKit::WebPlatformStrategies::stringForType): (WebKit::WebPlatformStrategies::allStringsForType): (WebKit::WebPlatformStrategies::changeCount): (WebKit::WebPlatformStrategies::color): (WebKit::WebPlatformStrategies::url): (WebKit::WebPlatformStrategies::addTypes): (WebKit::WebPlatformStrategies::setTypes): (WebKit::WebPlatformStrategies::setBufferForType): (WebKit::WebPlatformStrategies::setURL): (WebKit::WebPlatformStrategies::setColor): (WebKit::WebPlatformStrategies::setStringForType): (WebKit::WebPlatformStrategies::getNumberOfFiles): (WebKit::WebPlatformStrategies::containsURLStringSuitableForLoading): (WebKit::WebPlatformStrategies::urlStringSuitableForLoading): (WebKit::WebPlatformStrategies::writeToPasteboard): (WebKit::WebPlatformStrategies::updateSupportedTypeIdentifiers): (WebKit::WebPlatformStrategies::typesSafeForDOMToReadAndWrite): (WebKit::WebPlatformStrategies::writeCustomData): (WebKit::WebPlatformStrategies::containsStringSafeForDOMToReadForType): (WebKit::WebPlatformStrategies::getPasteboardItemsCount): (WebKit::WebPlatformStrategies::allPasteboardItemInfo): (WebKit::WebPlatformStrategies::informationForItemAtIndex): (WebKit::WebPlatformStrategies::readBufferFromPasteboard): (WebKit::WebPlatformStrategies::readURLFromPasteboard): (WebKit::WebPlatformStrategies::readStringFromPasteboard): * WebProcess/WebCoreSupport/WebPlatformStrategies.h: 2021-02-18 Kate Cheney Add support for non app-bound requests https://bugs.webkit.org/show_bug.cgi?id=221909 Reviewed by Brent Fulgham. Add a new parameter to the ResourceRequest class specifying app bound requests and populate subresource loads, redirects, and preconnect tasks with this value. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::preconnectTo): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * Scripts/webkit/messages.py: * Shared/NavigatingToAppBoundDomain.h: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _lastNavigationWasAppBound:]): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::setLastNavigationWasAppBound): (WebKit::WebPageProxy::lastNavigationWasAppBound): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::preconnectTo): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::preconnectTo): (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::loadResource): For the case of a main resource load without a navigation, like from about:blank, the main resource load uses the original document loader which was created before WebPage::loadRequest sets the value of m_lastNavigationWasAppBound. For this reason, we should not check the document loader value for the main resource and know that the resource request has the correct value. (WebKit::WebLoaderStrategy::preconnectTo): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_lastNavigationWasAppBound): (WebKit::WebPage::loadRequest): (WebKit::WebPage::createDocumentLoader): We should store lastNavigationWasAppBound in the document loader instead of the page so we don't affect previous loads while initiating the navigation to the next site. (WebKit::WebPage::lastNavigationWasAppBound): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::setLastNavigationWasAppBound): * WebProcess/WebPage/WebPage.messages.in: 2021-02-18 Brent Fulgham [macOS] Remove unused IPC shared memory reads in WebContent process https://bugs.webkit.org/show_bug.cgi?id=222083 Reviewed by Per Arne Vollan. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-18 Fujii Hironori Unreviewed, reverting r273063. GTK port layout tests are timint out. Reverted changeset: "[CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages" https://bugs.webkit.org/show_bug.cgi?id=221391 https://commits.webkit.org/r273063 2021-02-18 Per Arne [macOS] Remove access to audio IOKit https://bugs.webkit.org/show_bug.cgi?id=222062 Reviewed by Brent Fulgham. Remove access to audio IOKit in the WebContent process on macOS when GPUP is enabled. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-18 John Wilander PCM: Request signature for unlinkable token using attributionSourceNonce https://bugs.webkit.org/show_bug.cgi?id=222076 Reviewed by Chris Dumez. This patch makes PrivateClickMeasurementManager::storeUnattributed() look for incoming source nonces and if found, call the new function PrivateClickMeasurementManager::getSignedUnlinkableToken(). A new static function generateNetworkResourceLoadParameters() was added to reuse code between PrivateClickMeasurementManager::getSignedUnlinkableToken() and the existing PrivateClickMeasurementManager::fireConversionRequest(). To enable testing, there is a new function called NetworkSession::setPrivateClickMeasurementTokenSignatureURLForTesting() and function setPrivateClickMeasurementConversionURLForTesting() was renamed setPrivateClickMeasurementAttributionReportURLForTesting() in NetworkProcess, NetworkSession, WKPagePrivate, WKWebViewPrivateForTesting, and PrivateClickMeasurementManager to align with the naming used in other places. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setPrivateClickMeasurementTokenSignatureURLForTesting): (WebKit::NetworkProcess::setPrivateClickMeasurementAttributionReportURLForTesting): (WebKit::NetworkProcess::setPrivateClickMeasurementConversionURLForTesting): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::setPrivateClickMeasurementTokenSignatureURLForTesting): (WebKit::NetworkSession::setPrivateClickMeasurementAttributionReportURLForTesting): (WebKit::NetworkSession::setPrivateClickMeasurementConversionURLForTesting): Deleted. * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::generateNetworkResourceLoadParameters): (WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::setTokenSignatureURLForTesting): (WebKit::PrivateClickMeasurementManager::setAttributionReportURLForTesting): (WebKit::PrivateClickMeasurementManager::setConversionURLForTesting): Deleted. * NetworkProcess/PrivateClickMeasurementManager.h: * UIProcess/API/C/WKPage.cpp: (WKPageSetPrivateClickMeasurementTokenSignatureURLForTesting): (WKPageSetPrivateClickMeasurementAttributionReportURLForTesting): (WKPageSetPrivateClickMeasurementConversionURLForTesting): Deleted. * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _setPrivateClickMeasurementAttributionReportURLForTesting:completionHandler:]): (-[WKWebView _setPrivateClickMeasurementConversionURLForTesting:completionHandler:]): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setPrivateClickMeasurementTokenSignatureURLForTesting): (WebKit::WebPageProxy::setPrivateClickMeasurementAttributionReportURLForTesting): (WebKit::WebPageProxy::setPrivateClickMeasurementConversionURLForTesting): Deleted. * UIProcess/WebPageProxy.h: 2021-02-18 Michael Catanzaro [WPE][GTK] Avoid another child setup function in process launcher code https://bugs.webkit.org/show_bug.cgi?id=222049 Reviewed by Carlos Garcia Campos. Avoiding child setup functions is desirable because it could allow GSubprocess to use posix_spawn() instead of fork() in the future. That's not possible to do if we have code that needs to run between fork() and exec(). In this case, the child setup is used only to unset CLOEXEC. We could simply not set it in the first place. This only fails if a secondary thread decides to launch a subprocess before XDGDBusProxyLauncher::launch returns. That window already exists in many other places (e.g. anywhere else setCloseOnExec is called, such as for IPC::Connection objects). Threads should not do that. This also fixes a bug where unsetting CLOEXEC would fail if we get unlucky and receive EINTR. A loop is required here. WTF::setCloseOnExec handles that for us. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::XDGDBusProxyLauncher::launch): (WebKit::XDGDBusProxyLauncher::childSetupFunc): Deleted. 2021-02-18 Youenn Fablet Set ENABLE_VP9 to 1 on IOS https://bugs.webkit.org/show_bug.cgi?id=222042 Reviewed by Eric Carlson. No change of behavior. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetVP9DecoderEnabled): (WKPreferencesGetVP9DecoderEnabled): * UIProcess/API/C/WKPreferencesRef.h: 2021-02-18 Devin Rousso Experiment with using the theme-color as the scroll area background if provided https://bugs.webkit.org/show_bug.cgi?id=222078 Reviewed by Tim Horton. * UIProcess/API/ios/WKWebViewIOS.mm: (baseScrollViewBackgroundColor): * UIProcess/ViewSnapshotStore.cpp: (WebKit::ViewSnapshotStore::recordSnapshot): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebPageProxy::scrollAreaBackgroundColor): Added. 2021-02-18 Per Arne [macOS] Observe system sleep events in the UI process https://bugs.webkit.org/show_bug.cgi?id=221996 Reviewed by Chris Dumez. System sleep events should be observed in the UI process, which should notify the WebContent process. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): (WebKit::WebProcessPool::systemWillSleep): (WebKit::WebProcessPool::systemDidWake): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::systemWillSleep): (WebKit::WebProcess::systemDidWake): 2021-02-18 Kimmo Kinnunen WebGL contexts do not work as source for Context2D drawImage calls in GPU process https://bugs.webkit.org/show_bug.cgi?id=221811 Reviewed by Darin Adler. Implements rudimentary support for reading the WebGL context and transfering it to a ImageBuffer. Fixes many tests that are removed from gpu-process/TestExpectations. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createGraphicsContextGL): * GPUProcess/GPUConnectionToWebProcess.h: (WebKit::GPUConnectionToWebProcess::RemoteRenderingBackendWrapper::get const): * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::create): (WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createGraphicsContextGL const): * GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp: (WebKit::RemoteGraphicsContextGL::create): (WebKit::RemoteGraphicsContextGLCocoa::RemoteGraphicsContextGLCocoa): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: (WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const): RemoteGraphicsContextGL takes a ref of the respective RemoteRenderingBackend. RemoteRenderingBackend is the one that can handle ImageBuffers. (WebKit::RemoteGraphicsContextGL::paintRenderingResultsToCanvas): (WebKit::RemoteGraphicsContextGL::paintCompositedResultsToCanvas): (WebKit::RemoteGraphicsContextGL::paintImageDataToImageBuffer): * GPUProcess/graphics/RemoteGraphicsContextGL.h: * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: Implement the functions by: 1) Wait for the pending changes to the ImageBuffer 2) Send a synchronous message from Web process to GPU process WebGL sequence 3) Reading the buffer, post the task to RenderingBackend sequence 4) Paint the results to the ImageBuffer 5) Return the synchronous message result (WebKit::RemoteGraphicsContextGLCocoa::prepareForDisplay): RemoteGraphicsContextGL now retains the reference to display buffer. Before, just sent the display buffer to Web process and forgot about it. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::dispatch): * GPUProcess/graphics/RemoteRenderingBackend.h: Add function to dispatch work to rendering backend sequence. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::create): (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy): (WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas): (WebKit::RemoteGraphicsContextGLProxy::paintCompositedResultsToCanvas): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: Send the messages. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::connectToGPUProcess): Use IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply to send CreateRenderingBackend. It must be dispatched in order compared to other messages such as CreateRemoteGraphicsContextGL. 2021-02-17 Wenson Hsieh Plumb an Optional through Pasteboard-related codepaths https://bugs.webkit.org/show_bug.cgi?id=221987 Reviewed by Tim Horton. Update more `DragData` and `Pasteboard` initialization sites by passing in a `PageIdentifier` or `PasteboardContext`, respectively. See WebCore ChangeLog for more details. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::draggingEntered): (WebKit::WebViewImpl::draggingUpdated): (WebKit::WebViewImpl::draggingExited): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dragDataForDropSession:dragDestinationAction:]): * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: (WebKit::WebEditorClient::updateGlobalSelection): * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::performDragControllerAction): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::performActionOnElement): 2021-02-18 Alex Christensen Add SPI for getting size of PDF document during printing https://bugs.webkit.org/show_bug.cgi?id=222064 Reviewed by Geoff Garen and Tim Horton. When printing a PDF, we want to know its page size. If the print is initiated by the web process (such as when window.print is called or if the PDF contains JavaScript that tells the browser to print it) then we would like that information with the print request so we don't have to ask the web process, which is hung waiting for a synchronous message reply. If the print is initiated by the UI process (such as if the user prints from a menu or keyboard shortcut) then we need a way to ask what the size of a PDF is. I reused the SPI in WKUIDelegatePrivate because it was only briefly adopted before we knew we needed this and then reverted. I'm also adding an SPI way to get from a WKPageRef to a WKWebView so this can be adopted without redoing all of Safari. Covered by API tests. * UIProcess/API/APIUIClient.h: (API::UIClient::printFrame): * UIProcess/API/C/WKPage.cpp: (WKPageSetPageUIClient): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _getPDFFirstPageSizeInFrame:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::printFrame): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::printFrame): (WebKit::WebPageProxy::getPDFFirstPageSize): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::pdfDocumentSizeForPrinting const): * WebProcess/Plugins/Plugin.cpp: (WebKit::Plugin::pdfDocumentSizeForPrinting const): * WebProcess/Plugins/Plugin.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::print): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::getPDFFirstPageSize): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::getPDFFirstPageSize): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-02-18 Kimmo Kinnunen ThreadMessageReceiverRefCounted subclasses are accessed in non-thread-safe way https://bugs.webkit.org/show_bug.cgi?id=221891 Reviewed by Chris Dumez. For each ThreadMessageReceiverRefCounted subclass, remove calls to Connection::addThreadMessageReceiver() from the constructor. The calls pass 'this' as the ThreadMessageReceiver*. If the connection tries to dispatch a message during the constructor, this results in some or all of below: - non-thread-safe read of mutated virtual function pointer - call to incorrect member function, mostly to MessageReceiver::didReceiveMessage - an assert from above - skipped message For each ThreadMessageReceiverRefCounted subclass, remove calls to Connection::removeThreadMessageReceiver() from the destructor. The message receive destination is still active during destructor, so Connection might dispatch new message tasks during that time. This causes ref of the instance already being destroyed, which then causes the tasks to use deleted instance and then later deleting it again. Does not try to fix any other potential thread-related issues in the modified areas. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: (WebKit::RemoteAudioMediaStreamTrackRendererManager::RemoteAudioMediaStreamTrackRendererManager): (WebKit::RemoteAudioMediaStreamTrackRendererManager::startListeningForIPC): (WebKit::RemoteAudioMediaStreamTrackRendererManager::close): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: (WebKit::RemoteSampleBufferDisplayLayerManager::RemoteSampleBufferDisplayLayerManager): (WebKit::RemoteSampleBufferDisplayLayerManager::startListeningForIPC): (WebKit::RemoteSampleBufferDisplayLayerManager::close): * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): (WebKit::NetworkRTCProvider::startListeningForIPC): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::create): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::startListeningForIPC): (WebKit::LibWebRTCCodecs::~LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::gpuProcessConnectionDidClose): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: (WebKit::LibWebRTCCodecs::create): * WebProcess/Network/webrtc/LibWebRTCNetwork.cpp: (WebKit::LibWebRTCNetwork::~LibWebRTCNetwork): * WebProcess/Network/webrtc/LibWebRTCNetwork.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::libWebRTCCodecs): * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::~RemoteCaptureSampleManager): (WebKit::RemoteCaptureSampleManager::stopListeningForIPC): * WebProcess/cocoa/RemoteCaptureSampleManager.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): * WebProcess/glib/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): 2021-02-17 Megan Gardner Return correct target for App Highlight menus. https://bugs.webkit.org/show_bug.cgi?id=222089 Reviewed by Tim Horton. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView targetForAction:withSender:]): 2021-02-17 Peng Liu [GPUP] Remove RemoteLegacyCDMSessionProxy and RemoteLegacyCDMSessionProxy from the message receiver map in the destructor of RemoteLegacyCDMFactoryProxy https://bugs.webkit.org/show_bug.cgi?id=222079 Reviewed by Jer Noble. Fix a GPU process crash when running http/tests/navigation/parsed-iframe-dynamic-form-back-entry.html. * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp: (WebKit::RemoteLegacyCDMFactoryProxy::~RemoteLegacyCDMFactoryProxy): 2021-02-17 Fujii Hironori [CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages https://bugs.webkit.org/show_bug.cgi?id=221391 Reviewed by Carlos Garcia Campos. When triggerRenderingUpdate was called back, it added the whole view area into the dirty region to repaint in non-AC mode pages. This caused a problem that the whole content was unnecessarily repainted by animations in non-AC mode pages. Call scheduleDisplay instead of setNeedsDisplay in triggerRenderingUpdate. However, if the dirty region is empty, display() exited early. If triggerRenderingUpdate is called back, DrawingAreaCoordinatedGraphics::display should be called to ensure WebPage::updateRendering() called even if m_dirtyRegion is empty. Added a new flag m_scheduledWhileWaitingForDidUpdate. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::triggerRenderingUpdate): Call scheduleDisplay() instead of setNeedsDisplay(). (WebKit::DrawingAreaCoordinatedGraphics::didUpdate): (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay): Don't return early even if m_dirtyRegion is empty. (WebKit::DrawingAreaCoordinatedGraphics::display()): Ditto. (WebKit::DrawingAreaCoordinatedGraphics::display(UpdateInfo&)): Return early if m_dirtyRegion is empty. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: Added m_scheduledWhileWaitingForDidUpdate. 2021-02-17 Chris Dumez Reduce explicit usage of [objC autorelease] in WebKit even further https://bugs.webkit.org/show_bug.cgi?id=222060 Reviewed by Darin Adler. Reduce explicit usage of [objC autorelease] in WebKit further by using RetainPtr. * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::safeBrowsingDetailsText): * UIProcess/WebAuthentication/Mock/MockNfcService.mm: (WebKit::MockNfcService::transceive): * UIProcess/ios/DragDropInteractionState.mm: (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources): * UIProcess/ios/ViewGestureControllerIOS.mm: (-[WKSwipeTransitionController gestureRecognizerForInteractiveTransition:WithTarget:action:]): * UIProcess/ios/WKActionSheetAssistant.mm: (appLinkForURL): * UIProcess/ios/WKContentViewInteraction.mm: (ensureLocalDragSessionContext): (-[WKContentView insertTextPlaceholderWithSize:completionHandler:]): (-[WKContentView continueContextMenuInteraction:]): (-[WKContentView _dataForPreviewItemController:atPosition:type:]): (-[WKContentView _presentedViewControllerForPreviewItemController:]): (-[WKContentView _presentationSnapshotForPreviewItemController:]): (+[WKTextRange textRangeWithState:isRange:isEditable:startRect:endRect:selectionRects:selectedTextLength:]): (+[WKTextPosition textPositionWithRect:]): * UIProcess/ios/WKTextPlaceholder.mm: (-[WKTextPlaceholder rects]): * UIProcess/ios/WKWebEvent.mm: (-[WKWebEvent initWithEvent:]): * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (-[WKDataListSuggestionsPopover showSuggestionsDropdown:activationType:]): (-[WKDataListSuggestionsViewController tableView:cellForRowAtIndexPath:]): * UIProcess/ios/forms/WKDatePickerViewController.mm: (-[WKDatePickerViewController _dateComponentForDay:month:year:era:]): * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKOptionPickerCell initWithOptionItem:]): (-[WKOptionGroupPickerCell initWithOptionItem:]): (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]): (-[WKSelectSinglePicker pickerView:attributedTitleForRow:forComponent:]): (-[WKSelectPickerTableViewController tableView:viewForHeaderInSection:]): (-[WKSelectPickerTableViewController tableView:cellForRowAtIndexPath:]): * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]): (-[WKSelectPopover initWithView:hasGroups:]): * UIProcess/ios/forms/WKNumberPadView.mm: (-[WKNumberPadView _buttonForPosition:]): * UIProcess/ios/forms/WKNumberPadViewController.mm: (-[WKNumberPadViewController _handleKeyPress:]): * UIProcess/ios/forms/WKQuickboardListViewController.mm: (-[WKQuickboardListViewController actionController]): * UIProcess/ios/forms/WKTextInputListViewController.mm: (-[WKTextInputListViewController enterText:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _defaultAnimationController]): * UIProcess/mac/WKTextInputWindowController.mm: (-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]): * UIProcess/mac/WKViewLayoutStrategy.mm: (+[WKViewLayoutStrategy layoutStrategyWithPage:view:viewImpl:mode:]): * UIProcess/mac/WebColorPickerMac.mm: (-[WKColorPopoverMac setAndShowPicker:withColor:suggestions:]): * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: (-[WKDataListSuggestionsController tableView:rowViewForRow:]): (-[WKDataListSuggestionsController tableView:viewForTableColumn:row:]): * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm: (-[WKWebProcessPlugInFrame _certificateChain]): * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm: (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:width:]): * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm: (-[WKDOMDocument parserYieldToken]): * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm: (WebKit::toWKDOMType): * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm: (-[WKDOMRange rangeByExpandingToWordBoundaryByCharacters:inDirection:]): * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (-[WKWebProcessPlugInBrowserContextController handle]): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::platformInitialize): 2021-02-17 Mark Lam Build fix for Debug builds using --force-opt=O3. Not reviewed. #include a needed Inlines.h. * Platform/IPC/JSIPCBinding.cpp: 2021-02-17 Kate Cheney Add additions to LocalConnection.mm https://bugs.webkit.org/show_bug.cgi?id=222029 Reviewed by Jiewen Tan. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::createCredentialPrivateKey const): 2021-02-17 Fujii Hironori Unreviewed, reverting r273019. GTK port layout tests are timint out. Reverted changeset: "[CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages" https://bugs.webkit.org/show_bug.cgi?id=221391 https://commits.webkit.org/r273019 2021-02-17 Aditya Keerthi [iOS][FCR] Add new datalist dropdown for text inputs https://bugs.webkit.org/show_bug.cgi?id=222008 Reviewed by Wenson Hsieh. The new datalist dropdown appears as a popover on both iPhones and iPads. Previously, iPhones displayed a UIPickerView when tapping on the datalist button, while iPads displayed a popover. Furthermore, the datalist button was only visible after focusing the field. Now, the button can be used at any time. If the dropdown is presented while the software keyboard is visible, the keyboard will be dismissed to create space for the dropdown. On devices with a hardware keyboard, the dropdown is updated as characters are typed. Tests: fast/forms/ios/form-control-refresh/datalist/datalist-show-hide.html fast/forms/ios/form-control-refresh/datalist/datalist-textinput-suggestions-order.html * Platform/spi/ios/UIKitSPI.h: Added SPI declarations to configure the presentation of the presented dropdown and to check whether the keyboard is visible. * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/FocusedElementInformation.h: Added the isFocusingWithDataListDropdown member to control the presentation of the keyboard when presenting a datalist dropdown. * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView _selectDataListOption:]): Added a testing hook to select an option from the presented dropdown. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView shouldShowAutomaticKeyboardUI]): Do not show the keyboard when a datalist dropdown is visible, unless a hardware keyboard is attached. (-[WKContentView updateFocusedElementFocusedWithDataListDropdown:]): Toggle keyboard visibility depending on the visibility of the dropdown. (-[WKContentView _selectDataListOption:]): (-[WKContentView _setDataListSuggestionsControl:]): * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h: * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (WebKit::WebDataListSuggestionsDropdownIOS::show): (-[WKDataListSuggestionsControl initWithInformation:inView:]): (-[WKDataListSuggestionsViewController reloadData]): (-[WKDataListSuggestionsDropdown initWithInformation:inView:]): (-[WKDataListSuggestionsDropdown updateWithInformation:]): (-[WKDataListSuggestionsDropdown showSuggestionsDropdown:activationType:]): (-[WKDataListSuggestionsDropdown invalidate]): (-[WKDataListSuggestionsDropdown didSelectOptionAtIndex:]): (-[WKDataListSuggestionsDropdown dealloc]): (-[WKDataListSuggestionsDropdown _displayWithActivationType:]): (-[WKDataListSuggestionsDropdown _showSuggestions]): (-[WKDataListSuggestionsDropdown _presentSuggestionsViewController]): (-[WKDataListSuggestionsDropdown _updateTextSuggestions]): (-[WKDataListSuggestionsDropdown _removeKeyboardDismissalObserver]): (-[WKDataListSuggestionsDropdown presentationControllerDidDismiss:]): (-[WKDataListSuggestionsDropdown adaptivePresentationStyleForPresentationController:traitCollection:]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2021-02-17 Brent Fulgham Follow-up fix after r273023. https://bugs.webkit.org/show_bug.cgi?id=221641 Reviewed by Chris Dumez. Tested by TestWebKitAPI. Resource loading expects the passed ResourceResponse to have a certificateInfo object. This patch ensures that one exists. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadSimulatedRequest): Ensure certificate info is included. 2021-02-17 Megan Gardner Add SPI to allow apps to initiate highlight creation. https://bugs.webkit.org/show_bug.cgi?id=222063 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _addAppHighlight]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2021-02-17 Per Arne Vollan [iOS] Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219733 Reviewed by Brent Fulgham. Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process on iOS when the GPU process is enabled, 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.WebContent.sb: 2021-02-17 Yusuke Suzuki [JSC] Rename entitlements for JITCage https://bugs.webkit.org/show_bug.cgi?id=222077 Reviewed by Mark Lam. * Scripts/process-entitlements.sh: 2021-02-17 Truitt Savell Unreviewed, reverting r272905. caused TestWebKitAPI.WebKit2.CrashGPUProcessWhileCapturingAndCalling to timeout Reverted changeset: "ThreadMessageReceiverRefCounted subclasses are accessed in non-thread-safe way" https://bugs.webkit.org/show_bug.cgi?id=221891 https://commits.webkit.org/r272905 2021-02-17 Chris Dumez Unreviewed attempt to fix GTK build after r273023. * UIProcess/API/APINavigation.cpp: 2021-02-17 David Kilzer Remove missing files from WebKit Xcode project Reviewed by Youenn Fablet. Found using tidy-Xcode-project-file --missing (see Bug 188754). * WebKit.xcodeproj/project.pbxproj: (ConcreteShareableImageBuffer.h): - Remove references to this missing file. This regressed in r270470 when the file was removed. (ImageDataReference.h): - Remove references to this missing file. This regressed in r272786 when the file was removed. (NetworkCacheFileSystemCocoa.mm): - Remove references to this missing file. This regressed in r244921 when the file was removed. (Recovered References): - Remove "Recovered References" folder and missing com.apple.WebKit.GPU.sb file that regressed in r253098. The file was added back separately in r253131. (WebRTCSocket.h): (WebRTCSocket.cpp): (WebRTCNetwork.messages.in): - Remove references to these missing files. This apparently regressed in r261163 when the files were renamed to have a "Lib" prefix, but the old references were not removed. 2021-02-17 Brent Fulgham Expand stubs to thread actual NSURLRequest/NSURLResponse for the new simulated-request API https://bugs.webkit.org/show_bug.cgi?id=221641 Reviewed by Chris Dumez. Tested by new API Test LoadSimulatedRequestUpdatesBackForwardList. This bug builds on the stubs created in Bug 221430 to use actual Request and Response objects for simulated loads: 1. Thread the NSURLRequest and NSURLResponse objects to the loading layer when handling loads for HTML strings and data. 2. Loads via the simulated request API should cause entries to be added to the back/forward list. 3. Create a new API Test to confirm the back/forward list works as expected. * UIProcess/API/APINavigation.cpp: (API::SubstituteData::SubstituteData): New convenience constructor accepting a ResourceResponse. (API::Navigation::Navigation): Ditto. * UIProcess/API/APINavigation.h: (API::Navigation::create): Added. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView loadSimulatedRequest:withResponse:responseData:]): Switch from using the plain 'loadData' method to the new 'loadSimulatedRequest' implementation. * UIProcess/WebNavigationState.cpp: (WebKit::WebNavigationState::createSimulatedLoadWithDataNavigation): Added. * UIProcess/WebNavigationState.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadSimulatedRequest): New method to support the loadSimulatedRequest WKWebView API. * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadSimulatedRequestAndResponse): Added message handler to perform a simulated load using ResourceRequest and ResourceResponse objects. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Added LoadSimulatedRequestAndResponse IPC message. 2021-02-17 Fujii Hironori [CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages https://bugs.webkit.org/show_bug.cgi?id=221391 Reviewed by Carlos Garcia Campos. When triggerRenderingUpdate was called back, it added the whole view area into the dirty region to repaint in non-AC mode pages. This caused a problem that the whole content was unnecessarily repainted by animations in non-AC mode pages If triggerRenderingUpdate is called back, DrawingAreaCoordinatedGraphics::display should be called to ensure WebPage::updateRendering() called even if m_dirtyRegion is empty. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::triggerRenderingUpdate): Call scheduleDisplay() instead of setNeedsDisplay(). (WebKit::DrawingAreaCoordinatedGraphics::didUpdate): (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay): Don't return early even if m_dirtyRegion is empty. (WebKit::DrawingAreaCoordinatedGraphics::display()): Ditto. (WebKit::DrawingAreaCoordinatedGraphics::display(UpdateInfo&)): Return early if m_dirtyRegion is empty. 2021-02-17 David Kilzer REGRESSION (r272625): Fix missing headers in Xcode project Reviewed by Eric Carlson. * WebKit.xcodeproj/project.pbxproj: - Manually reconstruct missing PBXBuildFile entries for Xcode project. 2021-02-17 Megan Gardner Change App Highlight delegate to pass more information about the highlight for display. https://bugs.webkit.org/show_bug.cgi?id=222014 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _storeAppHighlight:]): * UIProcess/API/Cocoa/_WKAppHighlightDelegate.h: * WebKit.xcodeproj/project.pbxproj: 2021-02-17 Devin Rousso [iOS] Add support for additional accessibility image extraction contextmenu actions https://bugs.webkit.org/show_bug.cgi?id=222022 Reviewed by Tim Horton. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView continueContextMenuInteraction:]): (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): 2021-02-17 Devin Rousso [iOS] don't "promote" media controls contextmenu items if they are the only item being shown https://bugs.webkit.org/show_bug.cgi?id=221939 Reviewed by Eric Carlson. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant showMediaControlsContextMenu:items:completionHandler:]): 2021-02-17 Per Arne [macOS] Deny mach-lookup to the fonts service https://bugs.webkit.org/show_bug.cgi?id=221610 Reviewed by Brent Fulgham. This change will by default block access to the font daemon when the platform has support for a static font registry. When the client prefers to allow user installed fonts, or Safari Reader configuration has been customized, access to the font daemon will still be allowed by issuing an extension to the font daemon. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::customizedReaderConfiguration): (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::~WebPage): * WebProcess/WebPage/WebPage.h: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-17 Wenson Hsieh [macOS] Introduce a new context menu item to preview images https://bugs.webkit.org/show_bug.cgi?id=221917 Reviewed by Darin Adler and Tim Horton. Add plumbing to support the `ContextMenuItemTagRevealImage` action, as well as some WebKitAdditions extension points. See below for more details. This patch was mostly written by Devin Rousso, with some adjustments from me. * Configurations/WebKit.xcconfig: Link against UniformTypeIdentifiers. * Shared/API/c/WKContextMenuItemTypes.h: * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): Add `kWKContextMenuItemTagRevealImage`, and add helpers to convert from `WebCore::ContextMenuItemTagRevealImage` to `kWKContextMenuItemTagRevealImage` and vice versa. * Shared/ContextMenuContextData.h: (WebKit::ContextMenuContextData::webHitTestResultData): Add a non-const version of `webHitTestResultData()`, so that we can generate a `CGImage` using `WebHitTestResultData`'s bitmap data. * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm: * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h: * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::handleContextMenuRevealImage): Add a helper method, `handleContextMenuRevealImage`, to handle the new context menu action; additionally, introduce another helper method, `revealExtractedImageInPreviewPanel`, to handle the Mac-specific `QLPreviewPanel` logic when invoking the new item. See WebKitAdditions changes for more detail. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::contextMenuItemSelected): * UIProcess/WebPageProxy.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): 2021-02-17 Per Arne [macOS] Deny access to unused IOKit classes https://bugs.webkit.org/show_bug.cgi?id=221969 Reviewed by Brent Fulgham. Deny access to the IOKit classes AppleIntelMEUserClient and AppleSNBFBUserClient when the GPU process is enabled. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-17 Youenn Fablet RemoteMediaPlayerManager does not need to support media stream code path https://bugs.webkit.org/show_bug.cgi?id=221956 Reviewed by Eric Carlson. RemoteMediaPlayerManager does not support isMediaStream code path so it is simpler to return IsNotSupported instead of MaybeSupported. * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::supportsTypeAndCodecs): 2021-02-17 Carlos Garcia Campos REGRESSION(r272636) [GTK] Crash and failures in API test /WebKit2Gtk/TestResources https://bugs.webkit.org/show_bug.cgi?id=221672 Reviewed by Michael Catanzaro. Since r272636 it's no longer possible to differentiate between async reply being cancelled or data just being empty for WebPageProxy data completion handlers. Use Optional to indicate that the reply was canlled when its data is nullopt, and ensure we always provide a valid API::Data object when data is not nullopt. * Scripts/webkit/messages.py: Handle the special case of SharedBufferDataReference as Optional. * UIProcess/API/glib/WebKitWebResource.cpp: (resourceDataCallback): Bring back the cancellation error handling. * UIProcess/WebPageProxy.cpp: (WebKit::CompletionHandler 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-17 Youenn Fablet Build fix for non MEDIA_STREAM enabled ports after r272858 https://bugs.webkit.org/show_bug.cgi?id=222030 Unreviewed. * WebProcess/GPU/webrtc/MediaRecorderProvider.h: (WebKit::MediaRecorderProvider::MediaRecorderProvider): Do not declare m_webPage in configs that do not use it. 2021-02-16 Peng Liu [GPUP] Video as image source triggers IOSurface readback (unnecessarily slow) https://bugs.webkit.org/show_bug.cgi?id=221993 Reviewed by Tim Horton. Use IOSurface::sinkIntoImage() instead of IOSurface::createImage() to avoid expensive GPU readback. Manually tested. * WebProcess/GPU/media/RemoteImageDecoderAVF.cpp: (WebKit::RemoteImageDecoderAVF::createFrameImageAtIndex): 2021-02-16 Fujii Hironori Unreviewed, reverting r272476. GTK port is crashing. Reverted changeset: "[CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages" https://bugs.webkit.org/show_bug.cgi?id=221391 https://commits.webkit.org/r272476 2021-02-16 Devin Rousso Unreviewed, build fix after r272925 * UIProcess/ios/WKContentViewInteraction.mm: 2021-02-16 Per Arne [iOS] Remove access to the Mobile asset service https://bugs.webkit.org/show_bug.cgi?id=221959 Reviewed by Brent Fulgham. Remove access to the Mobile asset service in the WebContent process, since there are no longer reports of this being in use. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::nonBrowserServices): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::grantAccessToAssetServices): * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::grantAccessToAssetServices): 2021-02-16 Per Arne [macOS] Remove access to IOAccelerationUserClient https://bugs.webkit.org/show_bug.cgi?id=221967 Reviewed by Brent Fulgham. Remove access to IOAccelerationUserClient in the WebContent process on macOS when the GPU process is enabled. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-16 Per Arne Update syntax in the sandbox bootstrap filter https://bugs.webkit.org/show_bug.cgi?id=221913 Reviewed by Brent Fulgham. Update syntax in the sandbox bootstrap filter on macOS and iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-16 Brady Eidson REGRESSION (r271493 ) Crash in +[NSAttributedString(WKPrivate) _loadFromHTMLWithOptions:contentLoader:completionHandler:] on background thread and https://bugs.webkit.org/show_bug.cgi?id=222005 Reviewed by Geoffrey Garen. Test not possible as TestWebKitAPI seems to always initialize WebKit on the main thread. * UIProcess/API/Cocoa/NSAttributedString.mm: (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]): Switch this RunLoop::main() back to dispatch_async to main. 2021-02-16 Chris Dumez Reduce explicit usage of [objC autorelease] in WebKit https://bugs.webkit.org/show_bug.cgi?id=221932 Reviewed by Geoff Garen. Reduce explicit usage of [objC autorelease] in WebKit by using RetainPtr<>. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (downgradeRequest): (updateIgnoreStrictTransportSecuritySettingIfNecessary): (WebKit::proxyDictionary): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::NetworkSessionCocoa::createWebSocketTask): * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:]): (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (encodeObject): * Shared/API/Cocoa/_WKRemoteObjectInterface.mm: (+[_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:]): * Shared/Cocoa/WKObject.h: (WebKit::wrapper): * UIProcess/API/Cocoa/NSAttributedString.mm: (+[_WKAttributedStringWebViewCache configuration]): (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (makePolicyDecisionBlock): (setUpPagePolicyClient): (-[WKBrowsingContextController handle]): * UIProcess/API/Cocoa/WKContentWorld.mm: (-[WKContentWorld _userContentWorld]): * UIProcess/API/Cocoa/WKFrameInfo.mm: (-[WKFrameInfo securityOrigin]): (-[WKFrameInfo webView]): (-[WKFrameInfo _handle]): (-[WKFrameInfo _parentFrameHandle]): * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _userContentWorld]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView configuration]): (-[WKWebView findString:withConfiguration:completionHandler:]): (-[WKWebView _frames:]): (-[WKWebView _handle]): (-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]): (-[WKWebView _sessionState]): (-[WKWebView _sessionStateWithFilter:]): (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]): * UIProcess/API/Cocoa/WKWebpagePreferences.mm: (+[WKWebpagePreferences defaultPreferences]): * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm: (-[WKWebsiteDataRecord _dataSize]): * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: (+[_WKActivatedElementInfo activatedElementInfoWithInteractionInformationAtPosition:userInfo:]): (-[_WKActivatedElementInfo image]): * UIProcess/API/Cocoa/_WKAttachment.mm: (-[_WKAttachment info]): * UIProcess/API/Cocoa/_WKAutomationSession.mm: (-[_WKAutomationSession init]): (-[_WKAutomationSession configuration]): * UIProcess/API/Cocoa/_WKDownload.mm: (+[_WKDownload downloadWithDownload:]): (-[_WKDownload originatingWebView]): * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction elementActionWithTitle:actionHandler:]): (+[_WKElementAction _elementActionWithType:title:actionHandler:]): (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): * UIProcess/API/Cocoa/_WKFrameTreeNode.mm: (-[_WKFrameTreeNode securityOrigin]): (-[_WKFrameTreeNode webView]): (-[_WKFrameTreeNode _handle]): (-[_WKFrameTreeNode _parentFrameHandle]): * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration customClassesForParameterCoder]): * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: (-[_WKTextManipulationToken _descriptionPreservingPrivacy:]): * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm: (+[_WKUserContentExtensionStore defaultStore]): (+[_WKUserContentExtensionStore storeWithURL:]): (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]): * UIProcess/API/Cocoa/_WKUserContentWorld.mm: (+[_WKUserContentWorld worldWithName:]): (+[_WKUserContentWorld normalWorld]): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _uiEventAttribution]): (-[WKWebView _retainActiveFocusedState]): * UIProcess/Automation/ios/WebAutomationSessionIOS.mm: (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): * UIProcess/Cocoa/AutomationClient.mm: (WebKit::AutomationClient::requestAutomationSession): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::addLinkAndReplace): (WebKit::safeBrowsingDetailsText): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (-[WKLayerHostView makeBackingLayer]): * UIProcess/Cocoa/WKContactPicker.mm: (-[WKContactPicker _contactsFromJSContacts:]): * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: (makeButton): (makeLabel): (-[WKSafeBrowsingWarning addContent]): (-[WKSafeBrowsingWarning showDetailsClicked]): (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::fullScreenWindow): 2021-02-16 BJ Burg REGRESSION(r266890): [Cocoa] Fix InspectorDelegate / API::InspectorClient leak https://bugs.webkit.org/show_bug.cgi?id=221988 Reviewed by Devin Rousso. There was a logic error introduced into the new delegate situation after moving _WKInspectorDelegate from WKWebView to _WKInspector. When setting .delegate to nil, we shouldn't allocate dummy API::InspectorClient/ InspectorDelegate instances. As written, these instances form their own retain cycle and cause a leak if Web Inspector has been opened or if WKWebView._inspector is accessed (which lazily creates the delegates). * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector setDelegate:]): Adopt new constructor and pass in the ObjC delegate. * UIProcess/Inspector/Cocoa/InspectorDelegate.h: * UIProcess/Inspector/Cocoa/InspectorDelegate.mm: (WebKit::InspectorDelegate::InspectorDelegate): (WebKit::InspectorDelegate::createInspectorClient): Deleted. (WebKit::InspectorDelegate::setDelegate): Deleted. Clean up this class so that we always receive the ObjC delegate via the constructor. If a nil delegate is passed---for example, when closing the WKWebView---then don't create an API::InspectorClient and set the WebInspectorProxy's client to nullptr. 2021-02-16 Brent Fulgham Remove unneeded sandbox access to some file paths https://bugs.webkit.org/show_bug.cgi?id=221946 Reviewed by Per Arne Vollan. Block access to /etc/passwd now that none of WebContent's dependencies expect access. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-16 Megan Gardner Change App Highlights API to operate in terms of a single serialized highlight at a time https://bugs.webkit.org/show_bug.cgi?id=221802 Reviewed by Tim Horton. Pipe through additional data needed for display, and update to allow for more information to be added more easily. * Shared/CreateNewGroupForHighlight.h: Removed. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _storeAppHighlight:]): (-[WKWebView _restoreAppHighlights:]): (-[WKWebView _updateAppHighlightsStorage:]): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::storeAppHighlight): (WebKit::PageClientImplCocoa::updateAppHighlightsStorage): Deleted. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createAppHighlightInSelectedRange): (WebKit::WebPageProxy::restoreAppHighlights): * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::contextMenuItemSelected): (WebKit::WebPageProxy::storeAppHighlight): (WebKit::WebPageProxy::updateAppHighlightsStorage): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView createHighlightInCurrentGroupWithRange:]): (-[WKContentView createHighlightInNewGroupWithRange:]): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::storeAppHighlight const): (WebKit::WebChromeClient::updateAppHighlightsStorage const): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createAppHighlightInSelectedRange): (WebKit::WebPage::restoreAppHighlights): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-02-16 Kate Cheney Clean up WKWebView media API https://bugs.webkit.org/show_bug.cgi?id=221929 Reviewed by Youenn Fablet. A few fixes that came from API review: 1) Change closeAllMediaPresentations to be closeAllMediaPresentationsWithCompletionHandler. Ditto for pauseAllMediaPlayback and requestMediaPlaybackState. This leads to better Swift imports. 2) Combine suspendAllMediaPlayback and resumeAllMediaPlayback into a single setAllMediaPlaybackSuspended:completionHandler function which takes a boolean. This reinforces the relationship between suspend/resume and differentiates them from pause. And a few other drive-by fixes, like moving WKMediaPlaybackState to the WKWebView class because it is unlikely to be used outside of that context, changing NSUInteger -> NSInteger, and changing the ordering of the WKMediaPlaybackState enum to be more natural. No new tests. No behavior change. Covered by existing API tests. * UIProcess/API/Cocoa/WKMediaPlaybackState.h: Removed. * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView closeAllMediaPresentationsWithCompletionHandler:]): (-[WKWebView pauseAllMediaPlaybackWithCompletionHandler:]): (-[WKWebView setAllMediaPlaybackSuspended:completionHandler:]): (toWKMediaPlaybackState): (-[WKWebView requestMediaPlaybackStateWithCompletionHandler:]): (-[WKWebView _closeAllMediaPresentations]): (-[WKWebView _stopAllMediaPlayback]): (-[WKWebView _suspendAllMediaPlayback]): (-[WKWebView _resumeAllMediaPlayback]): (-[WKWebView closeAllMediaPresentations:]): Deleted. (-[WKWebView pauseAllMediaPlayback:]): Deleted. (-[WKWebView suspendAllMediaPlayback:]): Deleted. (-[WKWebView resumeAllMediaPlayback:]): Deleted. (-[WKWebView requestMediaPlaybackState:]): Deleted. * WebKit.xcodeproj/project.pbxproj: 2021-02-16 Yusuke Suzuki [JSC] Enable JITCage on macOS https://bugs.webkit.org/show_bug.cgi?id=221805 Reviewed by Mark Lam. We need to add this entitlement only when building it on macOS 120000 or higher version. Otherwise, we cannot launch the process. And we attach this entitlement only when building processes with Apple Internal SDKs. * Scripts/process-entitlements.sh: 2021-02-16 Alex Christensen Add API to disable HTTPS upgrade https://bugs.webkit.org/show_bug.cgi?id=221591 Reviewed by Geoff Garen. * 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::setHTTPSUpgradeEnabled): (API::PageConfiguration::httpsUpgradeEnabled const): * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration upgradeCommonKnownRequestsToHTTPS]): (-[WKWebViewConfiguration setUpgradeCommonKnownRequestsToHTTPS:]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2021-02-16 Kimmo Kinnunen Connection clients should be able to obtain the messages as data instead of embedded in function references https://bugs.webkit.org/show_bug.cgi?id=221560 Reviewed by Chris Dumez. Add IPC::MessageReceiveQueue, an interface which obtains messages from the message receive thread and forwards them to caller as data. This is important in order to be able to skip messages that are stale or originating from a sender which is incorrect. Before, the client could only get the messages as Function references, and those cannot be skipped as it would be undefined what not executing a function means. IPC::MessageReceiveQueue is a generalization and simplification of current IPC::Connection::ThreadMessageReceiverRefCounted and IPC::Connection::WorkQueueMessageReceiver. It has different ref-count semantics, in the way that client controls the life-time with add and remove. IPC::MessageReceiveQueue fixes message reordering bug with WorkQueueMessageReceiver and ThreadMessageReceiver where first few messages that are routed to main thread message queue can come later than some other message that gets handled from message receive thread. * Platform/IPC/Connection.cpp: (IPC::Connection::addMessageReceiveQueue): Add plain raw MessageReceiveQueue, to be used in WebGL IPC implementation. Implement ThreadMessageReceiver and WorkQueueMessageReceiver with the above. (IPC::Connection::removeMessageReceiveQueue): (IPC::Connection::dispatchMessageReceiverMessage): (IPC::Connection::processIncomingMessage): (IPC::Connection::enqueueIncomingMessage): (IPC::Connection::dispatchMessage): * Platform/IPC/Connection.h: * Platform/IPC/MessageReceiveQueue.h: Copied from Source/WTF/wtf/FunctionDispatcher.h. * Platform/IPC/MessageReceiveQueues.h: Added. * Platform/IPC/MessageReceiveQueueMap.cpp: Added. (IPC::MessageReceiveQueueMap::addImpl): (IPC::MessageReceiveQueueMap::remove): (IPC::MessageReceiveQueueMap::get const): * Platform/IPC/MessageReceiveQueueMap.h: Copied from Source/WTF/wtf/FunctionDispatcher.h. (IPC::MessageReceiveQueueMap::isValidMessage): (IPC::MessageReceiveQueueMap::add): * Sources.txt: * WebKit.xcodeproj/project.pbxproj: 2021-02-16 Kimmo Kinnunen RemoteAudioSourceProviderManager is accessed in non-thread-safe manner https://bugs.webkit.org/show_bug.cgi?id=221894 Reviewed by Chris Dumez. Remove call to Connection::removeWorkQueueMessageReceiver() from the destructor. The message receive destination is still active during destructor, so Connection might dispatch new message tasks during that time. This causes ref of the instance already being destroyed, which then causes the tasks to use deleted instance and then later deleting it again. Other subclasses call add...() correctly. Other subclasses never call remove..(). Assert that the instances are never destroyed, as to never leave a dangling reference in the connection. * UIProcess/mac/SecItemShimProxy.cpp: (WebKit::SecItemShimProxy::~SecItemShimProxy): * UIProcess/mac/SecItemShimProxy.h: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::~GPUProcessConnection): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::~RemoteAudioSourceProviderManager): (WebKit::RemoteAudioSourceProviderManager::stopListeningForIPC): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: * WebProcess/Inspector/WebInspectorInterruptDispatcher.cpp: (WebKit::WebInspectorInterruptDispatcher::~WebInspectorInterruptDispatcher): * WebProcess/Plugins/PluginProcessConnectionManager.cpp: (WebKit::PluginProcessConnectionManager::~PluginProcessConnectionManager): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::~EventDispatcher): * WebProcess/WebPage/ViewUpdateDispatcher.cpp: (WebKit::ViewUpdateDispatcher::~ViewUpdateDispatcher): 2021-02-16 Youenn Fablet 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-02-16 Alex Christensen Synthesize range responses if needed in WebCoreNSURLSession https://bugs.webkit.org/show_bug.cgi?id=221072 Reviewed by Geoff Garen. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::requestResource): 2021-02-16 Kimmo Kinnunen ThreadMessageReceiverRefCounted subclasses are accessed in non-thread-safe way https://bugs.webkit.org/show_bug.cgi?id=221891 Reviewed by Chris Dumez. For each ThreadMessageReceiverRefCounted subclass, remove calls to Connection::addThreadMessageReceiver() from the constructor. The calls pass 'this' as the ThreadMessageReceiver*. If the connection tries to dispatch a message during the constructor, this results in some or all of below: - non-thread-safe read of mutated virtual function pointer - call to incorrect member function, mostly to MessageReceiver::didReceiveMessage - an assert from above - skipped message For each ThreadMessageReceiverRefCounted subclass, remove calls to Connection::removeThreadMessageReceiver() from the destructor. The message receive destination is still active during destructor, so Connection might dispatch new message tasks during that time. This causes ref of the instance already being destroyed, which then causes the tasks to use deleted instance and then later deleting it again. Does not try to fix any other potential thread-related issues in the modified areas. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: (WebKit::RemoteAudioMediaStreamTrackRendererManager::RemoteAudioMediaStreamTrackRendererManager): (WebKit::RemoteAudioMediaStreamTrackRendererManager::startListeningForIPC): (WebKit::RemoteAudioMediaStreamTrackRendererManager::close): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: (WebKit::RemoteSampleBufferDisplayLayerManager::RemoteSampleBufferDisplayLayerManager): (WebKit::RemoteSampleBufferDisplayLayerManager::startListeningForIPC): (WebKit::RemoteSampleBufferDisplayLayerManager::close): * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): (WebKit::NetworkRTCProvider::startListeningForIPC): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::create): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::startListeningForIPC): (WebKit::LibWebRTCCodecs::~LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::gpuProcessConnectionDidClose): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: (WebKit::LibWebRTCCodecs::create): * WebProcess/Network/webrtc/LibWebRTCNetwork.cpp: (WebKit::LibWebRTCNetwork::~LibWebRTCNetwork): * WebProcess/Network/webrtc/LibWebRTCNetwork.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::libWebRTCCodecs): * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::~RemoteCaptureSampleManager): (WebKit::RemoteCaptureSampleManager::stopListeningForIPC): * WebProcess/cocoa/RemoteCaptureSampleManager.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): * WebProcess/glib/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): 2021-02-16 Youenn Fablet Enable GPU WebRTC codecs in GPUProcess by default on iOS https://bugs.webkit.org/show_bug.cgi?id=221562 Reviewed by Eric Carlson. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebRTCCodecsInGPUProcess): 2021-02-15 Per Arne [macOS] Close XPC connections before entering sandbox https://bugs.webkit.org/show_bug.cgi?id=221905 Reviewed by Brent Fulgham. XPC connections that are now allowed in the sandbox should be closed before entering the sandbox. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): 2021-02-15 Per Arne Remove 'com.apple.powerlog.plxpclogger.xpc' from WebKit sandboxes https://bugs.webkit.org/show_bug.cgi?id=221840 Reviewed by Brent Fulgham. Remove this service from WebKit sandboxes, since it is not required for correctness. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::diagnosticServices): * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-15 Truitt Savell Unreviewed, reverting r272867. Broke 50+ fast/layoutformattingcontext/ tests on Mac Debug WK2 Reverted changeset: "Page scrolling by wheel events doesn't work in non-AC mode pages if Hardware Acceleration Policy is changed dynamically from "always" to "never"" https://bugs.webkit.org/show_bug.cgi?id=221067 https://commits.webkit.org/r272867 2021-02-15 Eric Carlson [macOS] Connect Touch Bar to MediaSession https://bugs.webkit.org/show_bug.cgi?id=221921 Reviewed by Jer Noble. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveRemoteControlCommand): PlatformMediaSession::RemoteCommandArgument is a struct. * GPUProcess/GPUConnectionToWebProcess.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionModelContext::sendRemoteCommand): (WebKit::PlaybackSessionManagerProxy::sendRemoteCommand): * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::didReceiveRemoteCommand): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/GPUProcessConnection.messages.in: * WebProcess/GPU/media/RemoteRemoteCommandListener.messages.in: * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.messages.in: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionManager::sendRemoteCommand): 2021-02-15 Timothy Hatcher Web Inspector: Add a way to wake up debuggables to the remote inspector protocol https://bugs.webkit.org/show_bug.cgi?id=221871 rdar://70351644 Reviewed by Devin Rousso. * UIProcess/API/Cocoa/_WKAutomationDelegate.h: * UIProcess/Cocoa/AutomationClient.h: * UIProcess/Cocoa/AutomationClient.mm: (WebKit::AutomationClient::AutomationClient): Check if the delegate responds to new method. (WebKit::AutomationClient::requestedDebuggablesToWakeUp): Added. Call new process pool delegate method. 2021-02-15 Said Abou-Hallawa [GPU Process] Ensure that no image decoders run in the GPU Process https://bugs.webkit.org/show_bug.cgi?id=221885 Reviewed by Simon Fraser. Make GPU Process force ImageIO to disable all image decoding. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): 2021-02-15 Peng Liu [GPUP] Ignore an IPC message if the message receiver has been destroyed https://bugs.webkit.org/show_bug.cgi?id=221920 Reviewed by Eric Carlson. No new tests, fixing test crashes due to assertion failures. * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): 2021-02-15 Wenson Hsieh [macOS] Add a ShareableBitmap with decoded image data to WebHitTestResultData https://bugs.webkit.org/show_bug.cgi?id=221869 Reviewed by Tim Horton. Add `WebHitTestResultData::imageBitmap`; we'll use this in future patches to vend decoded image data to system frameworks for image extraction. * Shared/WebHitTestResultData.cpp: (WebKit::WebHitTestResultData::WebHitTestResultData): (WebKit::WebHitTestResultData::encode const): (WebKit::WebHitTestResultData::decode): Add `imageBitmap` and decoding/encoding support using `ShareableBitmap::Handle`. * Shared/WebHitTestResultData.h: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp: Added. (WebKit::createShareableBitmap): * WebProcess/WebCoreSupport/ShareableBitmapUtilities.h: Added. Pull logic to decode rendered image data into a bitmap into a separate helper function; use this helper function in `WebHitTestResultData`, as well as a couple of existing call sites in `WebPage`. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::requestImageExtraction): (WebKit::WebPage::shareableBitmap const): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::imagePositionInformation): 2021-02-15 Michael Catanzaro [WPE][GTK] SleepDisabler does not inhibit sleep with bubblewrap sandbox enabled: need to run xdg-dbus-proxy under bwrap or xdg-desktop-portal does not read our app ID https://bugs.webkit.org/show_bug.cgi?id=219010 Reviewed by Carlos Garcia Campos. We need to run xdg-dbus-proxy under bubblewrap so that we can mount /.flatpak-info in its mount namespace. Why? Because xdg-desktop-portal checks the pid of its D-Bus peer using Unix credentials, then looks in that process's mount namespace to read its app ID from /.flatpak-info. If /.flatpak-info doesn't exist, then any portals that depend on the app ID will break, including the inhibit portal that we need to prevent the system from suspending during video playback. This normally works because flatpak runs xdg-dbus-proxy under bubblewrap and mounts /.flatpak-info, but it breaks for WebKit because we don't. Start doing so. This method of getting the app ID might seem like a strange contortion, but it's really required beacuse the sandboxed process cannot be trusted to provide its own app ID, and will not have write access to its /.flatpak-info so we can rely on that. * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::createFlatpakInfo): (WebKit::XDGDBusProxyLauncher::launch): (WebKit::bubblewrapSpawn): 2021-02-15 Michael Catanzaro Fix -Wunused-variable warning https://bugs.webkit.org/show_bug.cgi?id=221653 Reviewed by Alex Christensen. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): 2021-02-15 Commit Queue Unreviewed, reverting r272863. https://bugs.webkit.org/show_bug.cgi?id=221918 broke process launching Reverted changeset: "[WPE][GTK] SleepDisabler does not inhibit sleep with bubblewrap sandbox enabled: need to run xdg-dbus-proxy under bwrap or xdg-desktop-portal does not read our app ID" https://bugs.webkit.org/show_bug.cgi?id=219010 https://trac.webkit.org/changeset/272863 2021-02-15 Alex Christensen Unexpected ASSERT when touch events are dispatched on the main thread https://bugs.webkit.org/show_bug.cgi?id=221832 Reviewed by Dean Jackson. The TouchEvent message is special. It's received on a non-main thread and completed on the main thread, which asserts. Rather than lose our asserts making sure our message CompletionHandlers are called on the correct thread, mark this one with a new attribute, MainThreadCallback, which indicates that it is ok for the callback to be called on the main thread like it was before r272558 in a different form. * Platform/IPC/HandleMessage.h: (IPC::handleMessageAsync): * Scripts/webkit/messages.py: * Scripts/webkit/model.py: * Scripts/webkit/tests/TestWithImageDataMessages.h: * Scripts/webkit/tests/TestWithLegacyReceiverMessages.h: * Scripts/webkit/tests/TestWithSemaphoreMessages.h: * Scripts/webkit/tests/TestWithSuperclass.messages.in: * Scripts/webkit/tests/TestWithSuperclassMessages.h: * Scripts/webkit/tests/TestWithoutAttributesMessages.h: * WebProcess/WebPage/EventDispatcher.messages.in: 2021-02-15 Fujii Hironori Page scrolling by wheel events doesn't work in non-AC mode pages if Hardware Acceleration Policy is changed dynamically from "always" to "never" https://bugs.webkit.org/show_bug.cgi?id=221067 Reviewed by Carlos Garcia Campos. GTK port is still supporting non-AC mode in WebKit2, and it can enable/disable accelerated compositing dynamically. r271235 fixed the bug that wheel event scrolling didn't work in non-AC mode pages by checking if EventDispatcher's m_scrollingTrees has a scrolling tree for a WebKit::WebPage. However, if accelerated compositing is disabled dynamically, m_scrollingTrees keeps to have a scrolling tree for the WebPage. m_scrollingTrees should remove the item if accelerated compositing is disabled. r271235 added a code to check m_scrollingTrees, but it didn't lock m_scrollingTreesMutex. The code can be removed. Removed it by moving to above code. EventDispatcher::wheelEvent was using a local lambda expression. However the return value wasn't used. It can be a do-while statement. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): Replaced the lambda expression with a do-while statement. Unified code of the checking scrolling tree existence. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::enterAcceleratedCompositingMode): (WebKit::WebPage::exitAcceleratedCompositingMode): (WebKit::WebPage::close): 2021-02-15 Michael Catanzaro [WPE][GTK] SleepDisabler does not inhibit sleep with bubblewrap sandbox enabled: need to run xdg-dbus-proxy under bwrap or xdg-desktop-portal does not read our app ID https://bugs.webkit.org/show_bug.cgi?id=219010 Reviewed by Carlos Garcia Campos. We need to run xdg-dbus-proxy under bubblewrap so that we can mount /.flatpak-info in its mount namespace. Why? Because xdg-desktop-portal checks the pid of its D-Bus peer using Unix credentials, then looks in that process's mount namespace to read its app ID from /.flatpak-info. If /.flatpak-info doesn't exist, then any portals that depend on the app ID will break, including the inhibit portal that we need to prevent the system from suspending during video playback. This normally works because flatpak runs xdg-dbus-proxy under bubblewrap and mounts /.flatpak-info, but it breaks for WebKit because we don't. Start doing so. This method of getting the app ID might seem like a strange contortion, but it's really required beacuse the sandboxed process cannot be trusted to provide its own app ID, and will not have write access to its /.flatpak-info so we can rely on that. * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::createFlatpakInfo): (WebKit::XDGDBusProxyLauncher::launch): (WebKit::bubblewrapSpawn): 2021-02-15 Commit Queue Unreviewed, reverting r272831. https://bugs.webkit.org/show_bug.cgi?id=221907 breaking internal build Reverted changeset: "[JSC] Enable JITCage on macOS" https://bugs.webkit.org/show_bug.cgi?id=221805 https://trac.webkit.org/changeset/272831 2021-02-15 Youenn Fablet Move WebRTCPlatformCodecsInGPUProcessEnabled to Page Settings https://bugs.webkit.org/show_bug.cgi?id=221893 Reviewed by Eric Carlson. Make LibWebRTCProvider and MediaRecorder provider keep a WebPage reference. Use it to get WebRTCPlatformCodecsInGPUProcessEnabled setting when needed. For LibWebRTCProvider, set callback only once before creating the first peer connection. This makes sure we do not change callbacks while using them in another thread. * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): * WebProcess/GPU/webrtc/MediaRecorderProvider.h: (WebKit::MediaRecorderProvider::MediaRecorderProvider): * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: (WebKit::LibWebRTCProvider::createPeerConnection): * WebProcess/Network/webrtc/LibWebRTCProvider.h: (WebKit::LibWebRTCProvider::LibWebRTCProvider): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2021-02-15 Youenn Fablet Share more code between RemoteRealtimeAudioSource and RemoteRealtimeVideoSource https://bugs.webkit.org/show_bug.cgi?id=221898 Reviewed by Eric Carlson. Introduce RemoteRealtimeMediaSourceProxy to share more code between the two classes. This class implements most of the messaging with capture process. No change of behavior. * WebProcess/cocoa/RemoteRealtimeAudioSource.cpp: (WebKit::RemoteRealtimeAudioSource::createRemoteMediaSource): * WebProcess/cocoa/RemoteRealtimeAudioSource.h: (WebKit::RemoteRealtimeAudioSource::identifier const): Deleted. (WebKit::RemoteRealtimeAudioSource::connection): Deleted. (WebKit::RemoteRealtimeAudioSource::applyConstraintsFailed): Deleted. * WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.h: (WebKit::RemoteRealtimeMediaSourceProxy::isReady const): * WebProcess/cocoa/RemoteRealtimeVideoSource.cpp: (WebKit::RemoteRealtimeVideoSource::RemoteRealtimeVideoSource): (WebKit::RemoteRealtimeVideoSource::createRemoteMediaSource): (WebKit::RemoteRealtimeVideoSource::~RemoteRealtimeVideoSource): (WebKit::RemoteRealtimeVideoSource::setShouldApplyRotation): (WebKit::RemoteRealtimeVideoSource::hasEnded): (WebKit::RemoteRealtimeVideoSource::generatePresets): (WebKit::RemoteRealtimeVideoSource::setFrameRateWithPreset): (WebKit::RemoteRealtimeVideoSource::gpuProcessConnectionDidClose): (WebKit::RemoteRealtimeVideoSource::whenReady): Deleted. (WebKit::RemoteRealtimeVideoSource::didFail): Deleted. (WebKit::RemoteRealtimeVideoSource::setAsReady): Deleted. (WebKit::RemoteRealtimeVideoSource::connection): Deleted. (WebKit::RemoteRealtimeVideoSource::startProducingData): Deleted. (WebKit::RemoteRealtimeVideoSource::stopProducingData): Deleted. * WebProcess/cocoa/RemoteRealtimeVideoSource.h: (WebKit::RemoteRealtimeVideoSource::identifier const): Deleted. 2021-02-15 Michael Catanzaro [WPE][GTK] BubblewrapLauncher should create flatpak-info keyfile only once https://bugs.webkit.org/show_bug.cgi?id=221224 Reviewed by Adrian Perez de Castro. BubblewrapLauncher should create its flatpak-info keyfile only once, because its contents will never change. Makes more sense to cache this tiny string in memory than to recompute it every time a subprocess is launched. When working on this, I noticed a quirk in the documentation of g_key_file_to_data: although the function has a GError parameter, it is legacy and the function is actually guaranteed to succeed. So icky though it seems, I've removed the error checking for that, as recommended by its documentation. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::createFlatpakInfo): 2021-02-13 Alexey Proskuryakov Unreviewed build fix. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView pointerInteraction:styleForRegion:]): 2021-02-12 Yusuke Suzuki [JSC] Enable JITCage on macOS https://bugs.webkit.org/show_bug.cgi?id=221805 Reviewed by Mark Lam. We need to add this entitlement only when building it on macOS 120000 or higher version. Otherwise, we cannot launch the process. And we attach this entitlement only when building processes with Apple Internal SDKs. * Scripts/process-entitlements.sh: 2021-02-12 Chris Dumez Reduce explicit usage of [objC release] in WebKit https://bugs.webkit.org/show_bug.cgi?id=221780 Reviewed by Darin Adler. Apply review feedback from Darin Adler and Sam Weinig after r272789. * UIProcess/Inspector/ios/WKInspectorHighlightView.h: * UIProcess/ios/WKScrollView.mm: * UIProcess/mac/WebColorPickerMac.mm: (+[WKPopoverColorWell _colorPopoverCreateIfNecessary:]): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm: (-[WKAccessibilityWebPageObjectBase setRemoteParent:]): 2021-02-12 Jiewen Tan [WebAuthn] Provide SPI to query local credentials https://bugs.webkit.org/show_bug.cgi?id=221743 Reviewed by Brent Fulgham. Covered by API tests. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (getAllLocalAuthenticatorCredentialsImpl): (+[_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentials]): (+[_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentialsWithAccessGroup:]): (+[_WKWebAuthenticationPanel deleteLocalAuthenticatorCredentialWithID:]): * UIProcess/API/Cocoa/_WKWebAuthenticationPanelForTesting.h: 2021-02-12 Jer Noble [Mac] Unable to play WebM/Opus generated from Chrome MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=221808 Reviewed by Eric Carlson. In the absense of an explicit duration parsed from the InitializationSegment, rely instead on the maximum presentation timestamp available in any MediaTrackReader to generate an explicit duration. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::finishParsing): (WebKit::MediaFormatReader::copyProperty): * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: (WebKit::MediaTrackReader::greatestPresentationTime const): * Shared/mac/MediaFormatReader/MediaTrackReader.h: 2021-02-12 Ryan Haddad Unreviewed, reverting r272799. Caused debug WK2 tests to exit early with an assertion failure Reverted changeset: "Unexpected ASSERT when touch events are dispatched on the main thread" https://bugs.webkit.org/show_bug.cgi?id=221832 https://commits.webkit.org/r272799 2021-02-12 Youenn Fablet Enable video capture in GPUProcess by default on MacOS https://bugs.webkit.org/show_bug.cgi?id=221750 Reviewed by Eric Carlson. Manually tested. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultCaptureVideoInGPUProcessEnabled): 2021-02-12 Jer Noble [Mac] Update Opus setting after a preference change. https://bugs.webkit.org/show_bug.cgi?id=221807 Reviewed by Eric Carlson. Make the opusDecoderEnabled() setting dynamic by applying changes to that setting after a preference update. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2021-02-12 Youenn Fablet Remote video capture samples should be processed in a background thread https://bugs.webkit.org/show_bug.cgi?id=221201 Reviewed by Eric Carlson. Make RemoteRealtimeVideoSource register to RemoteCaptureSampleManager to get video samples from a background thread. Make RemoteCaptureSampleManager able to handle incoming video samples in background thread like for audio. Make UserMediaCaptureManagerProxy use RemoteCaptureSampleManager instead of UserMediaCaptureManager message. Covered by existing tests. * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::addSource): (WebKit::RemoteCaptureSampleManager::removeSource): (WebKit::RemoteCaptureSampleManager::audioStorageChanged): (WebKit::RemoteCaptureSampleManager::audioSamplesAvailable): (WebKit::RemoteCaptureSampleManager::videoSampleAvailable): (WebKit::RemoteCaptureSampleManager::RemoteVideo::RemoteVideo): (WebKit::RemoteCaptureSampleManager::RemoteVideo::videoSampleAvailable): * WebProcess/cocoa/RemoteCaptureSampleManager.h: * WebProcess/cocoa/RemoteCaptureSampleManager.messages.in: * WebProcess/cocoa/RemoteRealtimeVideoSource.cpp: (WebKit::RemoteRealtimeVideoSource::create): (WebKit::RemoteRealtimeVideoSource::videoSampleAvailable): (WebKit::RemoteRealtimeVideoSource::remoteVideoSampleAvailable): Deleted. * WebProcess/cocoa/RemoteRealtimeVideoSource.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable): Deleted. * WebProcess/cocoa/UserMediaCaptureManager.h: * WebProcess/cocoa/UserMediaCaptureManager.messages.in: 2021-02-12 Aditya Keerthi [tvOS] Fix build failure in WKFormSelectPicker https://bugs.webkit.org/show_bug.cgi?id=221839 Reviewed by Wenson Hsieh. UITableViewStyleInsetGrouped is not available on tvOS. Rather than have two separate codepaths, we can just use UITableViewStyleGrouped with sectionContentInsetFollowsLayoutMargins set to YES. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKSelectPickerTableViewController initWithView:]): 2021-02-12 Youenn Fablet Test landed flaky: [iOS] TestWebKitAPI.WebKit2.CrashGPUProcessWhileCapturing https://bugs.webkit.org/show_bug.cgi?id=221331 Reviewed by Eric Carlson. Now that RemoteRealtimeVideoSource is a RealtimeVideoCaptureSource, we can register RemoteRealtimeVideoSource to its factory so that it will be muted if another RemoteRealtimeVideoSource is created. This is now possible as clones of the track will get the same underlying RemoteRealtimeVideoSource. We can thus only recreate the active source when GPU process crashes. Covered by test no longer flaky. * WebProcess/cocoa/RemoteRealtimeAudioSource.cpp: (WebKit::RemoteRealtimeAudioSource::gpuProcessConnectionDidClose): * WebProcess/cocoa/RemoteRealtimeVideoSource.cpp: (WebKit::RemoteRealtimeVideoSource::gpuProcessConnectionDidClose): * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::VideoFactory::setActiveSource): Deleted. * WebProcess/cocoa/UserMediaCaptureManager.h: 2021-02-12 Dean Jackson Unexpected ASSERT when touch events are dispatched on the main thread https://bugs.webkit.org/show_bug.cgi?id=221832 Reviewed by Sam Weinig. The change in r272558 causes an ASSERT when running on iOS debug builds. The touch event CompletionHandlers are created on the EventDispatcher thread, but serviced on the main thread. We now need to state that this is ok as we create the CompletionHandler. This is covered by tests, but the EWS bots don't run iOS tests in debug mode, and the internal bots hadn't caught up yet! * Platform/IPC/HandleMessage.h: (IPC::handleMessageAsync): Pass a CompletionHandlerCallThread into the constructor. 2021-02-12 Brent Fulgham [macOS] Limit mech-register to required services https://bugs.webkit.org/show_bug.cgi?id=221768 Reviewed by Per Arne Vollan. Limit mach-register to the two cases identified by telemetry. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-12 Chris Dumez Reduce explicit usage of [objC release] in WebKit https://bugs.webkit.org/show_bug.cgi?id=221780 Reviewed by Alex Christensen. Reduce explicit usage of [objC release] in WebKit by using smart pointers. * Shared/Cocoa/WKObject.mm: (-[WKObject dealloc]): (initializeTargetIfNeeded): (-[WKObject forwardingTargetForSelector:]): (-[WKObject forwardInvocation:]): * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: (-[UIView _web_setSubviews:]): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm: (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]): (-[WKCustomProtocolLoader dealloc]): (WebKit::LegacyCustomProtocolManagerClient::startLoading): * UIProcess/Inspector/ios/WKInspectorHighlightView.h: * UIProcess/Inspector/ios/WKInspectorHighlightView.mm: (-[WKInspectorHighlightView initWithFrame:]): (-[WKInspectorHighlightView dealloc]): (-[WKInspectorHighlightView _removeAllLayers]): (-[WKInspectorHighlightView _createLayers:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _selectPositionAtPoint:stayingWithinFocusedElement:completionHandler:]): (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]): (-[WKContentView moveSelectionAtBoundary:inDirection:completionHandler:]): (-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]): * UIProcess/ios/WKScrollView.mm: (-[WKScrollView _updateDelegate]): (-[WKScrollView dealloc]): * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectPopover initWithView:hasGroups:]): * UIProcess/mac/WKTextInputWindowController.mm: (-[WKTextInputPanel dealloc]): (-[WKTextInputPanel init]): * UIProcess/mac/WebColorPickerMac.mm: (+[WKPopoverColorWell _colorPopoverCreateIfNecessary:]): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h: * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm: (-[WKAccessibilityWebPageObjectBase setRemoteParent:]): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject dealloc]): (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]): 2021-02-12 Kimmo Kinnunen GPU process WebGL context toDataURL does not work for non-premultiplied contexts https://bugs.webkit.org/show_bug.cgi?id=221748 Reviewed by Myles C. Maxfield. Implement GraphicsContextGL::paintRenderingResultsToImageData(). This is used for Image.toDataURL() call, and returns something for WebGL canvases that have non-premultiplied alpha. No new tests, tested by currently failing WebGL conformance and ad hoc tests like premultiplyalpha-test.html. This does not make any failing test pass, as the tests test also premultiplied case, which needs other currently unimplemented code. * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h: (paintRenderingResultsToImageData): Generated GPU process side implementation. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::getImageData): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: Change ImageDataReference to RefPtr. * Platform/IPC/ImageDataReference.h: Removed. This implementation is redundant. The messages could accept just RefPtr, which is exactly "reference to Image Data", i.e. ImageDataReference. RefPtr encoder and decoder already exist. * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: * Scripts/webkit/tests/Makefile: * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::jsValueForArguments): (IPC::messageArgumentDescriptions): * Scripts/webkit/tests/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: * Scripts/webkit/tests/TestWithImageData.messages.in: Added. * Scripts/webkit/tests/TestWithImageDataMessageReceiver.cpp: Added. (WebKit::TestWithImageData::didReceiveMessage): (WebKit::TestWithImageData::didReceiveSyncMessage): * Scripts/webkit/tests/TestWithImageDataMessages.h: Added. (Messages::TestWithImageData::messageReceiverName): (Messages::TestWithImageData::SendImageData::name): (Messages::TestWithImageData::SendImageData::SendImageData): (Messages::TestWithImageData::SendImageData::arguments const): (Messages::TestWithImageData::ReceiveImageData::name): (Messages::TestWithImageData::ReceiveImageData::arguments const): * Scripts/webkit/tests/TestWithImageDataMessagesReplies.h: Added. Test using RefPtr in messages.in. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp: (WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToImageData): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::getImageData): Generated Web process side implementation. 2021-02-12 Alex Christensen Stop using GenericCallback from WebPageProxy https://bugs.webkit.org/show_bug.cgi?id=221653 Reviewed by Chris Dumez. There are still two uses in the DrawingAreaProxy implementations, but those are quite tangled and deserve their own patch. * UIProcess/API/APIAttachment.cpp: (API::Attachment::updateAttributes): * UIProcess/API/APIAttachment.h: * UIProcess/API/C/WKPage.cpp: (CompletionHandler Make RemoteRealtimeVideoSource a RealtimeVideoCaptureSource https://bugs.webkit.org/show_bug.cgi?id=221747 Reviewed by Eric Carlson. All capture video sources are now deriving from RealtimeVideoCaptureSource. This allows to expose a RealtimeVideoSource that can handle changes of resolution and frame rate in software as needed. This also allows to better align audio and video sources on iOS: there will only be one running source at any given time. Covered by existing tests. * Scripts/webkit/messages.py: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::capabilities): (WebKit::UserMediaCaptureManagerProxy::generatePresets): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: * WebProcess/cocoa/RemoteRealtimeAudioSource.cpp: (WebKit::RemoteRealtimeAudioSource::createRemoteMediaSource): (WebKit::RemoteRealtimeAudioSource::setAsReady): * WebProcess/cocoa/RemoteRealtimeVideoSource.cpp: (WebKit::RemoteRealtimeVideoSource::create): (WebKit::RemoteRealtimeVideoSource::RemoteRealtimeVideoSource): (WebKit::RemoteRealtimeVideoSource::createRemoteMediaSource): (WebKit::RemoteRealtimeVideoSource::setAsReady): (WebKit::RemoteRealtimeVideoSource::remoteVideoSampleAvailable): (WebKit::RemoteRealtimeVideoSource::setFrameRateWithPreset): (WebKit::RemoteRealtimeVideoSource::prefersPreset): (WebKit::RemoteRealtimeVideoSource::gpuProcessConnectionDidClose): * WebProcess/cocoa/RemoteRealtimeVideoSource.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::VideoFactory::createVideoCaptureSource): (WebKit::UserMediaCaptureManager::DisplayFactory::createDisplayCaptureSource): 2021-02-12 Said Abou-Hallawa Make Pattern hold a NativeImage instead of an Image https://bugs.webkit.org/show_bug.cgi?id=221637 Reviewed by Simon Fraser. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * Shared/WebCoreArgumentCoders.h: Delete the encoding and decoding of Image since it is not used anymore 2021-02-12 Antti Koivisto Increase network layout resource load priority for prioritized loads https://bugs.webkit.org/show_bug.cgi?id=221751 Reviewed by Geoffrey Garen. Currently visibility based prioritization only affects resource load scheduler. We should increase the priority passed to the network layer and so the server too. * NetworkProcess/NetworkDataTask.h: (WebKit::NetworkDataTask::setPriority): * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::reprioritizeRequest): * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkLoadScheduler.cpp: (WebKit::NetworkLoadScheduler::HostContext::shouldDelayLowPriority const): (WebKit::NetworkLoadScheduler::HostContext::schedule): (WebKit::NetworkLoadScheduler::HostContext::unschedule): (WebKit::NetworkLoadScheduler::HostContext::prioritize): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::setPriority): 2021-02-11 Manuel Rego Casasnovas [WPE] event.ctrlKey and other are false in keydown event https://bugs.webkit.org/show_bug.cgi?id=221760 Reviewed by Adrian Perez de Castro. This is the same issue that was fixed for WebKitGTK in r272489. Test: fast/events/keyboardevent-modifier.html * Shared/libwpe/WebEventFactory.cpp: (WebKit::modifiersForEventModifiers): (WebKit::modifiersForKeyboardEvent): (WebKit::WebEventFactory::createWebKeyboardEvent): 2021-02-11 Alex Christensen Unreviewed, reverting r272603. Broke test, has room for improvement Reverted changeset: "Synthesize range responses if needed in WebCoreNSURLSession" https://bugs.webkit.org/show_bug.cgi?id=221072 https://trac.webkit.org/changeset/272603 2021-02-11 Chris Dumez Review usage of adoptNS() https://bugs.webkit.org/show_bug.cgi?id=221779 Reviewed by Alex Christensen. Review usage of adoptNS(): 1. Make sure we call adoptNS() as soon as we allocate the object instead of doing it later on, as this is less error-prone 2. Fix cases where we called adoptNS() but really should have retained instead of adopting * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: (WebKit::RemoteLayerTreeHost::makeNode): * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: (WebKit::RemoteLayerTreeHost::makeNode): 2021-02-11 Jer Noble [Mac] Add Experimental Opus Codec support https://bugs.webkit.org/show_bug.cgi?id=221745 Reviewed by Eric Carlson. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2021-02-11 David Kilzer Remove unused WebKit::LocalStorageDatabaseTracker::deleteAllDatabases() Reviewed by Alexey Proskuryakov. * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp: (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases): Delete. * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h: (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases): Delete. - Remove this method since it's not used anywhere. This fixes a missing symbol linker error for WebCore::SQLiteFileSystem::deleteEmptyDatabaseDirectory() when building WebKit.framework with dead code stripping turned off since that method was not exported from WebCore.framework. 2021-02-11 Aditya Keerthi [iOS][FCR] Add new picker for on iOS. Test: fast/forms/ios/choose-color-from-color-picker.html * Platform/spi/ios/UIKitSPI.h: Added SPI declarations for _UISheetPresentationController and UIColorPickerViewController. * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/FocusedElementInformation.h: Added colorValue member to avoid parsing the input's value in the UIProcess. * SourcesCocoa.txt: * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h: * UIProcess/API/ios/WKWebViewTestingIOS.mm: (-[WKWebView setSelectedColorForColorPicker:]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): (-[WKContentView _elementTypeRequiresAccessoryView:]): The new color picker does not appear as a keyboard input view. (-[WKContentView updateFocusedElementValueAsColor:]): (-[WKContentView setSelectedColorForColorPicker:]): * UIProcess/ios/forms/WKFormColorControl.h: * UIProcess/ios/forms/WKFormColorControl.mm: (-[WKColorPicker initWithView:]): (-[WKColorPicker selectColor:]): Note that the delegate method is not called when programmatically setting the selected color. (-[WKColorPicker focusedElementSuggestedColors]): Suggested colors from a element are displayed in the favorites view. (-[WKColorPicker updateColorPickerState]): (-[WKColorPicker configurePresentation]): On iPad, the color picker is displayed a popover. On iPhone, the picker is displayed as a half-sheet, and can be dragged up into a fullscreen view. (-[WKColorPicker controlBeginEditing]): (-[WKColorPicker controlEndEditing]): (-[WKColorPicker presentationControllerDidDismiss:]): (-[WKColorPicker colorPickerViewControllerDidSelectColor:]): (-[WKColorPicker colorPickerViewControllerDidFinish:]): (-[WKFormColorControl initWithView:]): (-[WKFormColorControl selectColor:]): * UIProcess/ios/forms/WKFormColorPicker.h: Removed. * UIProcess/ios/forms/WKFormColorPicker.mm: Removed. * UIProcess/ios/forms/WKFormSelectPicker.h: Build fix. * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getFocusedElementInformation): 2021-02-09 Alex Christensen Use CompletionHandler instead of DrawToPDFCallback https://bugs.webkit.org/show_bug.cgi?id=220120 Reviewed by Chris Dumez. Along the way I made all asynchronous message replies use 8 fewer bytes by using the destination ID for the listener ID instead of encoding 0 as the destination ID and then encoding the listener ID. This was needed in order to make implementing waitForAsyncCallbackAndDispatchImmediately possible, which looks at the destination IDs of incoming messages. I also made it so that if we are just snapshotting the first page, we don't send a synchronous message because we already know the page count: 1! * Platform/IPC/Connection.cpp: (IPC::Connection::dispatchMessage): * Platform/IPC/Connection.h: (IPC::Connection::sendWithAsyncReply): (IPC::Connection::waitForAndDispatchImmediately): (IPC::Connection::waitForAsyncCallbackAndDispatchImmediately): * Platform/IPC/HandleMessage.h: (IPC::handleMessageAsync): (IPC::handleMessageAsyncWantsConnection): * Platform/IPC/JSIPCBinding.cpp: (IPC::jsValueForDecodedArgumentValue): * Platform/IPC/JSIPCBinding.h: * Platform/IPC/MessageSender.h: (IPC::MessageSender::sendWithAsyncReply): * Scripts/webkit/messages.py: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView createPDFWithConfiguration:completionHandler:]): * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::drawToPDF): (WebKit::WebPageProxy::getLoadDecisionForIcon): (WebKit::WebPageProxy::drawToPDFCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentView.mm: (-[WKContentView _processDidExit]): (-[WKContentView _wk_pageCountForPrintFormatter:]): (-[WKContentView _waitForDrawToPDFCallback]): (-[WKContentView _wk_printedDocument]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::drawToPDF): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::computePagesForPrintingiOS): (WebKit::WebPage::drawToPDFiOS): (WebKit::WebPage::computePagesForPrintingAndDrawToPDF): Deleted. 2021-02-09 Per Arne [macOS] Deny mach-lookup to the fonts service https://bugs.webkit.org/show_bug.cgi?id=221610 Reviewed by Brent Fulgham. By setting the Info.plist key CTIgnoreUserFonts to true, mach-lookup to the fonts service in the WebContent process can be denied on macOS. No new tests, covered by existing tests. * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-09 Per Arne [macOS] Deny mach-lookup to the service 'com.apple.trustd.agent' https://bugs.webkit.org/show_bug.cgi?id=221611 Reviewed by Brent Fulgham. Deny mach-lookup to the service 'com.apple.trustd.agent' in the WebContent process on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-09 Wenson Hsieh REGRESSION (r271660): Unable to interact with page after long-pressing image on images.google.com https://bugs.webkit.org/show_bug.cgi?id=221584 Reviewed by Andy Estes. After long pressing on an image with an active touchend event listener, it's possible to sometimes get stuck in a state where further interaction with the page is impossible, due to all gesture recognizers (except for the touchend deferral gestures) remaining in either Failed or Ended state. When presenting the context menu with a long press, the touch event gesture transitions to Failed state due to the active touch being cancelled. Normally, this invokes `-_webTouchEventsRecognized:` with all touch points being released, which allows us to "lift" the deferred gesture gate by failing any deferring gesture recognizers that are still in Possible state (i.e. deferring native gestures). However, it's possible for touch deferring gestures (in particular, the touchend deferrer) introduced in r271660 to end (i.e. call `-touchesEnded:withEvent:`) before the touch event gesture gets a chance to call `-_webTouchEventsRecognized:`. In this scenario, the touch end deferral gesture remains in Possible state, and prevents the touch event gesture from subsequently firing its action (`-_webTouchEventsRecognized:`), presumably because UIKit is waiting for all other gestures in the same subgraph as the touch event gesture recognizer to Fail. This effectively results in a gesture "deadlock", since the web touch event gesture recognizer won't call `-_webTouchEventsRecognized:` until the touch end deferring gesture has failed, and the touch end deferring gesture won't fail until `-_webTouchEventsRecognized:` is called. To fix this, we restore a bit of logic that was removed with r271193, such that we allow our deferring gesture recognizers to transition to Failed state underneath `-touchesEnded:withEvent:`, as long it's [1] not actively deferring any native gestures, and [2] the web touch event gesture has already failed, so we aren't expecting a subsequent call to `-_webTouchEventsRecognized:` until the deferring gesture has failed. Note that this check for the touch event gesture recognizer's state (condition [2] above) is necessary to prevent the touchend deferring gesture from failing prematurely (i.e. right before we're about to dispatch preventable `touchend` events). Test: fast/events/touch/ios/tap-after-long-press-on-image.html * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _isTouchStartDeferringGesture:]): (-[WKContentView _isTouchEndDeferringGesture:]): (-[WKContentView deferringGestureRecognizer:didEndTouchesWithEvent:]): Add a delegate hook when a deferring gesture's ends touches; use this hook in `WKContentView` to "lift" the gesture gate if needed, in the case where the touch event gesture recognizer has already failed and we can't expect `-_webTouchEventsRecognized:` to be called with all touch points released. (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): Add a missing call to `-[WKWebView _didDismissContextMenu]` here to make `UIHelper.waitForContextMenuToHide()` actually work with image and link context menus in WebKitTestRunner. * UIProcess/ios/WKDeferringGestureRecognizer.h: * UIProcess/ios/WKDeferringGestureRecognizer.mm: (-[WKDeferringGestureRecognizer touchesEnded:withEvent:]): 2021-02-09 Philippe Normand Unreviewed, tvOS build fix after r272573 * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestUserMediaPermissionForSpeechRecognition): That ifdef was updated by mistake in r272573. 2021-02-09 Philippe Normand [GLib] Permission request API for MediaKeySystem access support https://bugs.webkit.org/show_bug.cgi?id=221199 Reviewed by Carlos Garcia Campos. Expose a new Permission Request object to the public WPE and GTK APIs, allowing the application to defer the decision of using a given EME MediaKeySystem to the user's approval. Covered by new API test. * PlatformGTK.cmake: * PlatformWPE.cmake: * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/API/glib/WebKitMediaKeySystemPermissionRequest.cpp: Added. (webkitMediaKeySystemPermissionRequestAllow): (webkitMediaKeySystemPermissionRequestDeny): (webkit_permission_request_interface_init): (webkitMediaKeySystemPermissionRequestDispose): (webkit_media_key_system_permission_request_class_init): (webkitMediaKeySystemPermissionRequestCreate): (webkit_media_key_system_permission_get_name): * UIProcess/API/glib/WebKitMediaKeySystemPermissionRequestPrivate.h: Added. * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/gtk/WebKitAutocleanups.h: * UIProcess/API/gtk/WebKitMediaKeySystemPermissionRequest.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/WebKitMediaKeySystemPermissionRequest.h: Added. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/API/wpe/docs/wpe-docs.sgml: 2021-02-09 Philippe Normand Permission request API for MediaKeySystem access support https://bugs.webkit.org/show_bug.cgi?id=221187 Reviewed by Jer Noble. Add new IPC and C API exposing MediaKeySystem access permissions to the UIProcess. At least GTK/WPE would like to have API for asking permission to the user when EME's MediaKeyAccess is being requested by a page. On Apple platforms the permission is granted by default until a decision is made about supporting this in their APIUIClient. * CMakeLists.txt: * Headers.cmake: * Platform/Logging.h: * Shared/API/APIObject.h: * Shared/API/c/WKBase.h: * Sources.txt: * UIProcess/API/APIUIClient.h: (API::UIClient::decidePolicyForMediaKeySystemPermissionRequest): * UIProcess/API/C/WKAPICast.h: * UIProcess/API/C/WKMediaKeySystemPermissionCallback.cpp: Added. (WKMediaKeySystemPermissionCallbackGetTypeID): (WKMediaKeySystemPermissionCallbackComplete): * UIProcess/API/C/WKMediaKeySystemPermissionCallback.h: Added. * UIProcess/API/C/WKPage.cpp: (WKPageSetPageUIClient): * UIProcess/API/C/WKPageUIClient.h: * UIProcess/MediaKeySystemPermissionRequest.h: Added. (WebKit::MediaKeySystemPermissionRequest::create): (WebKit::MediaKeySystemPermissionRequest::complete): (WebKit::MediaKeySystemPermissionRequest::keySystem const): (WebKit::MediaKeySystemPermissionRequest::MediaKeySystemPermissionRequest): (WebKit::MediaKeySystemPermissionCallback::create): (WebKit::MediaKeySystemPermissionCallback::complete): (WebKit::MediaKeySystemPermissionCallback::MediaKeySystemPermissionCallback): * UIProcess/MediaKeySystemPermissionRequestManagerProxy.cpp: Added. (WebKit::MediaKeySystemPermissionRequestManagerProxy::MediaKeySystemPermissionRequestManagerProxy): (WebKit::MediaKeySystemPermissionRequestManagerProxy::~MediaKeySystemPermissionRequestManagerProxy): (WebKit::MediaKeySystemPermissionRequestManagerProxy::invalidatePendingRequests): (WebKit::MediaKeySystemPermissionRequestManagerProxy::denyRequest): (WebKit::MediaKeySystemPermissionRequestManagerProxy::grantRequest): (WebKit::MediaKeySystemPermissionRequestManagerProxy::createRequestForFrame): (WebKit::MediaKeySystemPermissionRequestManagerProxy::logChannel const): (WebKit::MediaKeySystemPermissionRequestManagerProxy::logger const): * UIProcess/MediaKeySystemPermissionRequestManagerProxy.h: Added. (WebKit::MediaKeySystemPermissionRequestManagerProxy::page const): (WebKit::MediaKeySystemPermissionRequestManagerProxy::denyRequest): * UIProcess/MediaKeySystemPermissionRequestProxy.cpp: Added. (WebKit::MediaKeySystemPermissionRequestProxy::MediaKeySystemPermissionRequestProxy): (WebKit::MediaKeySystemPermissionRequestProxy::allow): (WebKit::MediaKeySystemPermissionRequestProxy::deny): (WebKit::MediaKeySystemPermissionRequestProxy::invalidate): (WebKit::MediaKeySystemPermissionRequestProxy::doDefaultAction): * UIProcess/MediaKeySystemPermissionRequestProxy.h: Added. (WebKit::MediaKeySystemPermissionRequestProxy::create): (WebKit::MediaKeySystemPermissionRequestProxy::isPending const): (WebKit::MediaKeySystemPermissionRequestProxy::mediaKeySystemID const): (WebKit::MediaKeySystemPermissionRequestProxy::mainFrameID const): (WebKit::MediaKeySystemPermissionRequestProxy::frameID const): (WebKit::MediaKeySystemPermissionRequestProxy::topLevelDocumentSecurityOrigin): (WebKit::MediaKeySystemPermissionRequestProxy::topLevelDocumentSecurityOrigin const): (WebKit::MediaKeySystemPermissionRequestProxy::keySystem const): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestMediaKeySystemPermissionForFrame): (WebKit::WebPageProxy::mediaKeySystemPermissionRequestManager): (WebKit::WebPageProxy::requestMediaKeySystemPermissionByDefaultAction): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.cpp: Added. (WebKit::MediaKeySystemPermissionRequestManager::MediaKeySystemPermissionRequestManager): (WebKit::MediaKeySystemPermissionRequestManager::startMediaKeySystemRequest): (WebKit::MediaKeySystemPermissionRequestManager::sendMediaKeySystemRequest): (WebKit::MediaKeySystemPermissionRequestManager::cancelMediaKeySystemRequest): (WebKit::MediaKeySystemPermissionRequestManager::mediaKeySystemWasGranted): (WebKit::MediaKeySystemPermissionRequestManager::mediaKeySystemWasDenied): * WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.h: Added. * WebProcess/WebCoreSupport/WebMediaKeySystemClient.cpp: Added. (WebKit::WebMediaKeySystemClient::WebMediaKeySystemClient): (WebKit::WebMediaKeySystemClient::pageDestroyed): (WebKit::WebMediaKeySystemClient::requestMediaKeySystem): (WebKit::WebMediaKeySystemClient::cancelMediaKeySystemRequest): * WebProcess/WebCoreSupport/WebMediaKeySystemClient.h: Added. (WebKit::WebMediaKeySystemClient::~WebMediaKeySystemClient): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::mediaKeySystemWasGranted): (WebKit::WebPage::mediaKeySystemWasDenied): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::mediaKeySystemPermissionRequestManager): * WebProcess/WebPage/WebPage.messages.in: 2021-02-08 Commit Queue Unreviewed, reverting r272485. https://bugs.webkit.org/show_bug.cgi?id=221588 Required revisions were reversed Reverted changeset: "[GLib] Permission request API for MediaKeySystem access support" https://bugs.webkit.org/show_bug.cgi?id=221199 https://trac.webkit.org/changeset/272485 2021-02-08 Commit Queue Unreviewed, reverting r272480, r272481, and r272500. https://bugs.webkit.org/show_bug.cgi?id=221586 Caused assertion failure seen with EME tests Reverted changesets: "Permission request API for MediaKeySystem access support" https://bugs.webkit.org/show_bug.cgi?id=221187 https://trac.webkit.org/changeset/272480 "Unreviewed, build fix after r272480" https://trac.webkit.org/changeset/272481 "Permission request API for MediaKeySystem access support" https://bugs.webkit.org/show_bug.cgi?id=221187 https://trac.webkit.org/changeset/272500 2021-02-08 Simon Fraser Crash with remote layer tree logging https://bugs.webkit.org/show_bug.cgi?id=221580 Reviewed by Tim Horton. Null-check animation.timingFunction when dumping remote layer tree animations. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::operator<<): 2021-02-08 Alex Christensen Use CompletionHandler instead of BoolCallback https://bugs.webkit.org/show_bug.cgi?id=221575 Reviewed by Chris Dumez. This makes the code more modern, and it makes our fuzzers better at reasoning what the boolean value is going to be used for. It should also fix a rare crash involving BoolCallback by completely removing it. * UIProcess/GenericCallback.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): (WebKit::WebPageProxy::handleUnpreventableTouchEvent): (WebKit::WebPageProxy::boolCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::touchEventWithoutCallback): (WebKit::EventDispatcher::touchEvent): (WebKit::EventDispatcher::dispatchTouchEvents): * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/EventDispatcher.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::touchEventSync): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dispatchAsynchronousTouchEvents): (WebKit::WebPage::cancelAsynchronousTouchEvents): 2021-02-08 Brady Eidson Make the UserContentController for ServiceWorker pages be non-optional. and https://bugs.webkit.org/show_bug.cgi?id=221503 Reviewed by Alex Christensen. Normal Pages always have a UserContentProvider, even if they just create an empty default one. Same should be true for ServiceWorkers. * Shared/ServiceWorkerInitializationData.cpp: (WebKit::ServiceWorkerInitializationData::decode): * Shared/ServiceWorkerInitializationData.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::userContentControllerIdentifierForServiceWorkers): (WebKit::WebProcessPool::createWebPage): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::enableServiceWorkers): * UIProcess/WebProcessProxy.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::m_userContentController): (WebKit::m_userAgent): Deleted. * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2021-02-08 Chris Dumez Prevent WebProcess to re-enter on sync IPC to the GPUProcess https://bugs.webkit.org/show_bug.cgi?id=221566 Reviewed by Ryosuke Niwa. Prevent WebProcess to re-enter on sync IPC to the GPUProcess, similarly to what we already do for sync IPC to other processes (Network, UI). * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): 2021-02-08 Youenn Fablet [MacOS] Enable Audio Capture in GPUProcess by default https://bugs.webkit.org/show_bug.cgi?id=221400 Reviewed by Eric Carlson. Manually tested. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultCaptureAudioInGPUProcessEnabled): 2021-02-08 David Kilzer Check that CGPDFDocumentRef is consistently unlocked and printable Reviewed by Daniel Bates. This patch does the following when printing PDFs: - Checks return value of CGPDFDocumentUnlockWithPassword(). - Calls CGPDFDocumentAllowsPrinting() consistently. - Handles -_ensureDocumentForPrinting and -_wk_printedDocument returning nullptr. * UIProcess/_WKWebViewPrintFormatter.mm: (-[_WKWebViewPrintFormatter drawInRect:forPageAtIndex:]): - Check return value of -_wk_printedDocument since it may return nullptr now. * UIProcess/ios/WKPDFView.mm: (-[WKPDFView _ensureDocumentForPrinting]): - Check return value of CGPDFDocumentUnlockWithPassword(), and return nullptr if unsuccessful. - Add CGPDFDocumentAllowsPrinting() check and return nullptr if it fails. (-[WKPDFView _wk_pageCountForPrintFormatter:]): - Move the CGPDFDocumentAllowsPrinting() check into -[WKPDFView _ensureDocumentForPrinting]. - Check return value of -_ensureDocumentForPrinting since it may return nullptr now. 2021-02-08 Youenn Fablet NetworkRTCSocketCocoa extractDataMessages should not read too much data https://bugs.webkit.org/show_bug.cgi?id=221544 Reviewed by Eric Carlson. * NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm: Make use of WebCore method. 2021-02-08 Youenn Fablet Enable GPU WebRTC codecs in GPUProcess by default on MacOS https://bugs.webkit.org/show_bug.cgi?id=221397 Reviewed by Eric Carlson. Manually tested. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebRTCCodecsInGPUProcess): 2021-02-08 Manuel Rego Casasnovas [GTK] event.ctrlKey and other are false in keydown event https://bugs.webkit.org/show_bug.cgi?id=221456 Reviewed by Adrian Perez de Castro. Modifier keys were not being set on "keydown" events. For example if you check event.ctrlKey (and other) you'll get always false when the user only typed Ctrl key (it'll be true when it's in combination with some other key, like Ctrl + P). This is due to some differences on how X system manages the modifier keys (see http://crbug.com/127142#c8), but this patch will align WebKitGTK with other platforms and browsers on this case. Test: fast/events/keyboardevent-modifier.html * Shared/gtk/WebEventFactory.cpp: (WebKit::modifiersForEvent): In the case of a keyboard press event check if some modifier key has been pressed. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeKeyEvent): Check if some modifier key has been pressed. 2021-02-08 Antoine Quint Unreviewed unified build fix. * UIProcess/MediaPermissionUtilities.h: 2021-02-08 Philippe Normand [GLib] Permission request API for MediaKeySystem access support https://bugs.webkit.org/show_bug.cgi?id=221199 Reviewed by Carlos Garcia Campos. Expose a new Permission Request object to the public WPE and GTK APIs, allowing the application to defer the decision of using a given EME MediaKeySystem to the user's approval. Covered by new API test. * PlatformGTK.cmake: * PlatformWPE.cmake: * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/API/glib/WebKitMediaKeySystemPermissionRequest.cpp: Added. (webkitMediaKeySystemPermissionRequestAllow): (webkitMediaKeySystemPermissionRequestDeny): (webkit_permission_request_interface_init): (webkitMediaKeySystemPermissionRequestDispose): (webkit_media_key_system_permission_request_class_init): (webkitMediaKeySystemPermissionRequestCreate): (webkit_media_key_system_permission_get_name): * UIProcess/API/glib/WebKitMediaKeySystemPermissionRequestPrivate.h: Added. * UIProcess/API/glib/WebKitUIClient.cpp: * UIProcess/API/gtk/WebKitAutocleanups.h: * UIProcess/API/gtk/WebKitMediaKeySystemPermissionRequest.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/WebKitMediaKeySystemPermissionRequest.h: Added. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: * UIProcess/API/wpe/docs/wpe-docs.sgml: 2021-02-08 Philippe Normand Unreviewed, unified build fix after r272480 * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: Logging.h is needed for log channel macros usage. 2021-02-08 Philippe Normand Unreviewed, build fix after r272480 * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestMediaKeySystemPermissionByDefaultAction): * UIProcess/WebPageProxy.h: 2021-02-08 Philippe Normand Permission request API for MediaKeySystem access support https://bugs.webkit.org/show_bug.cgi?id=221187 Reviewed by Jer Noble. Add new IPC and C API exposing MediaKeySystem access permissions to the UIProcess. At least GTK/WPE would like to have API for asking permission to the user when EME's MediaKeyAccess is being requested by a page. On Apple platforms the permission is granted by default until a decision is made about supporting this in their APIUIClient. * CMakeLists.txt: * Headers.cmake: * Platform/Logging.h: * Shared/API/APIObject.h: * Shared/API/c/WKBase.h: * Sources.txt: * UIProcess/API/APIUIClient.h: (API::UIClient::decidePolicyForMediaKeySystemPermissionRequest): * UIProcess/API/C/WKAPICast.h: * UIProcess/API/C/WKMediaKeySystemPermissionCallback.cpp: Added. (WKMediaKeySystemPermissionCallbackGetTypeID): (WKMediaKeySystemPermissionCallbackComplete): * UIProcess/API/C/WKMediaKeySystemPermissionCallback.h: Added. * UIProcess/API/C/WKPage.cpp: (WKPageSetPageUIClient): * UIProcess/API/C/WKPageUIClient.h: * UIProcess/MediaKeySystemPermissionRequest.h: Added. (WebKit::MediaKeySystemPermissionRequest::create): (WebKit::MediaKeySystemPermissionRequest::complete): (WebKit::MediaKeySystemPermissionRequest::keySystem const): (WebKit::MediaKeySystemPermissionRequest::MediaKeySystemPermissionRequest): (WebKit::MediaKeySystemPermissionCallback::create): (WebKit::MediaKeySystemPermissionCallback::complete): (WebKit::MediaKeySystemPermissionCallback::MediaKeySystemPermissionCallback): * UIProcess/MediaKeySystemPermissionRequestManagerProxy.cpp: Added. (WebKit::MediaKeySystemPermissionRequestManagerProxy::MediaKeySystemPermissionRequestManagerProxy): (WebKit::MediaKeySystemPermissionRequestManagerProxy::~MediaKeySystemPermissionRequestManagerProxy): (WebKit::MediaKeySystemPermissionRequestManagerProxy::invalidatePendingRequests): (WebKit::MediaKeySystemPermissionRequestManagerProxy::denyRequest): (WebKit::MediaKeySystemPermissionRequestManagerProxy::grantRequest): (WebKit::MediaKeySystemPermissionRequestManagerProxy::createRequestForFrame): (WebKit::MediaKeySystemPermissionRequestManagerProxy::logChannel const): (WebKit::MediaKeySystemPermissionRequestManagerProxy::logger const): * UIProcess/MediaKeySystemPermissionRequestManagerProxy.h: Added. (WebKit::MediaKeySystemPermissionRequestManagerProxy::page const): (WebKit::MediaKeySystemPermissionRequestManagerProxy::denyRequest): * UIProcess/MediaKeySystemPermissionRequestProxy.cpp: Added. (WebKit::MediaKeySystemPermissionRequestProxy::MediaKeySystemPermissionRequestProxy): (WebKit::MediaKeySystemPermissionRequestProxy::allow): (WebKit::MediaKeySystemPermissionRequestProxy::deny): (WebKit::MediaKeySystemPermissionRequestProxy::invalidate): (WebKit::MediaKeySystemPermissionRequestProxy::doDefaultAction): * UIProcess/MediaKeySystemPermissionRequestProxy.h: Added. (WebKit::MediaKeySystemPermissionRequestProxy::create): (WebKit::MediaKeySystemPermissionRequestProxy::isPending const): (WebKit::MediaKeySystemPermissionRequestProxy::mediaKeySystemID const): (WebKit::MediaKeySystemPermissionRequestProxy::mainFrameID const): (WebKit::MediaKeySystemPermissionRequestProxy::frameID const): (WebKit::MediaKeySystemPermissionRequestProxy::topLevelDocumentSecurityOrigin): (WebKit::MediaKeySystemPermissionRequestProxy::topLevelDocumentSecurityOrigin const): (WebKit::MediaKeySystemPermissionRequestProxy::keySystem const): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestMediaKeySystemPermissionForFrame): (WebKit::WebPageProxy::mediaKeySystemPermissionRequestManager): (WebKit::WebPageProxy::requestMediaKeySystemPermissionByDefaultAction): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.cpp: Added. (WebKit::MediaKeySystemPermissionRequestManager::MediaKeySystemPermissionRequestManager): (WebKit::MediaKeySystemPermissionRequestManager::startMediaKeySystemRequest): (WebKit::MediaKeySystemPermissionRequestManager::sendMediaKeySystemRequest): (WebKit::MediaKeySystemPermissionRequestManager::cancelMediaKeySystemRequest): (WebKit::MediaKeySystemPermissionRequestManager::mediaKeySystemWasGranted): (WebKit::MediaKeySystemPermissionRequestManager::mediaKeySystemWasDenied): * WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.h: Added. * WebProcess/WebCoreSupport/WebMediaKeySystemClient.cpp: Added. (WebKit::WebMediaKeySystemClient::WebMediaKeySystemClient): (WebKit::WebMediaKeySystemClient::pageDestroyed): (WebKit::WebMediaKeySystemClient::requestMediaKeySystem): (WebKit::WebMediaKeySystemClient::cancelMediaKeySystemRequest): * WebProcess/WebCoreSupport/WebMediaKeySystemClient.h: Added. (WebKit::WebMediaKeySystemClient::~WebMediaKeySystemClient): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::mediaKeySystemWasGranted): (WebKit::WebPage::mediaKeySystemWasDenied): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::mediaKeySystemPermissionRequestManager): * WebProcess/WebPage/WebPage.messages.in: 2021-02-07 Fujii Hironori [CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages https://bugs.webkit.org/show_bug.cgi?id=221391 Reviewed by Carlos Garcia Campos. When triggerRenderingUpdate was called back, it added the whole view area into the dirty region to repaint in non-AC mode pages. This caused a problem that the whole content was unnecessarily repainted by animations in non-AC mode pages If triggerRenderingUpdate is called back, DrawingAreaCoordinatedGraphics::display should be called to ensure WebPage::updateRendering() called even if m_dirtyRegion is empty. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::triggerRenderingUpdate): Call scheduleDisplay() instead of setNeedsDisplay(). (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay): Don't return early even if m_dirtyRegion is empty. (WebKit::DrawingAreaCoordinatedGraphics::display()): Ditto. (WebKit::DrawingAreaCoordinatedGraphics::display(UpdateInfo&)): Return early if m_dirtyRegion is empty. 2021-02-07 Sam Weinig Differentiate between color spaces used to tag colors and color spaces used to tag destinations https://bugs.webkit.org/show_bug.cgi?id=221520 Reviewed by Antti Koivisto. * Scripts/webkit/messages.py: * Shared/WebCoreArgumentCoders.h: Coder implementation of EnumTraits for color space types is now in WebCore. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::create): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): * 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: Update to use DestinationColorSpace rather than ColorSpace. 2021-02-07 Sam Weinig Remove more special cases from color conversion https://bugs.webkit.org/show_bug.cgi?id=221519 Reviewed by Antti Koivisto. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorToWebCoreColor): Replace convertTo<> component type conversion to general convertColor<>. 2021-02-06 Wenson Hsieh [macOS] Add support for accessibility image extraction https://bugs.webkit.org/show_bug.cgi?id=221262 Reviewed by Devin Rousso. Add WebKitAdditions support for image extraction. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::requestImageExtraction): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::requestImageExtraction): 2021-02-06 Alex Christensen Non-special URLs should have an opaque origin https://bugs.webkit.org/show_bug.cgi?id=162254 Reviewed by Geoff Garen. I needed to change API::SecurityOrigin from wrapping a WebCore::SecurityOrigin to wrapping a WebCore::SecurityOriginData, otherwise it would often be null and we want it to be not null in the UI process. * Shared/API/APISecurityOrigin.h: (API::SecurityOrigin::createFromString): (API::SecurityOrigin::create): (API::SecurityOrigin::securityOrigin const): (API::SecurityOrigin::SecurityOrigin): * Shared/API/c/WKSecurityOriginRef.cpp: (WKSecurityOriginCopyDatabaseIdentifier): (WKSecurityOriginCopyProtocol): (WKSecurityOriginCopyHost): (WKSecurityOriginGetPort): * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreRemoveFetchCacheForOrigin): * UIProcess/API/Cocoa/WKSecurityOrigin.mm: (-[WKSecurityOrigin protocol]): (-[WKSecurityOrigin host]): (-[WKSecurityOrigin port]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::registerURLSchemeHandler): 2021-02-05 Sihui Liu REGRESSION(r272337): crash under WebCore::SpeechRecognizer::setInactive() https://bugs.webkit.org/show_bug.cgi?id=221451 Reviewed by Youenn Fablet. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::handleRequest): 2021-02-05 Darin Adler Add missing null checks to decoding functions involving RetainPtr https://bugs.webkit.org/show_bug.cgi?id=221441 Reviewed by Anders Carlsson. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::decodePlatformData): Fail if the dictionary is null: the encoder never encodes a null dictionary. (IPC::ArgumentCoder::decode): Fail if the SecTrustRef is null: the encoder never encodes a null SecTrustRef. Fail if the certificate chain array is null: the encoder never encodes a null CFArrayRef. (IPC::decodeNSError): Return a RetainPtr instead of using a bool return value and a RetainPtr out argument. Fail if the user info dictionary is null: the encoder never encodes a null user info dictionary. (IPC::ArgumentCoder::decodePlatformData): Updated for the change to the interface of decodeNSError. (IPC::ArgumentCoder::decode): Fail if the CFDataRef is null: the encoder never encodes a null CFDataRef. 2021-02-05 Brent Fulgham REGRESSION (r271815): [macOS] /dev/dtracehelper is blocked on customer builds, even with SIP disabled https://bugs.webkit.org/show_bug.cgi?id=221501 Reviewed by Per Arne Vollan. Instead of requiring apple-internal to use /dev/dtracehelper, allow on systems where SIP has been deactivated. * WebProcess/com.apple.WebProcess.sb.in: Use CSR filter to gate access to /dev/dtracehelper 2021-02-05 Eric Carlson [Mac] Connect MediaSession with MediaRemote and NowPlaying https://bugs.webkit.org/show_bug.cgi?id=221431 Reviewed by Jer Noble. Add a private preference so the new MediaSession API test can enable the feature. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _mediaSessionEnabled]): (-[WKPreferences _setMediaSessionEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2021-02-05 Youenn Fablet Enable audio capture for speech recognition in GPUProcess https://bugs.webkit.org/show_bug.cgi?id=221457 Reviewed by Eric Carlson. Allow to create remote sources without any constraint. To do so, we serialize through IPC a MediaConstraints with isValid = false and treat it as no constraint in capture process. Make sure to send sandbox extensions and authorizations for GPUProcess to capture in case of speech recognition audio capture request. In case of GPUProcess audio capture, send the request to capture to WebProcess like done for iOS. WebProcess is then responsible to get audio samples from GPUProcess and forward them to UIProcess. A future refactoring should move speech recognition to GPUProcess. * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::grantRequest): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createRealtimeMediaSourceForSpeechRecognition): * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRealtimeMediaSourceManager::grantSandboxExtensions): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::createSource): * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: (WebKit::RemoteRealtimeMediaSource::create): (WebKit::RemoteRealtimeMediaSource::RemoteRealtimeMediaSource): (WebKit::RemoteRealtimeMediaSource::createRemoteMediaSource): (WebKit::RemoteRealtimeMediaSource::~RemoteRealtimeMediaSource): (WebKit::RemoteRealtimeMediaSource::cloneVideoSource): (WebKit::RemoteRealtimeMediaSource::gpuProcessConnectionDidClose): * WebProcess/cocoa/RemoteRealtimeMediaSource.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource): (WebKit::UserMediaCaptureManager::VideoFactory::createVideoCaptureSource): (WebKit::UserMediaCaptureManager::DisplayFactory::createDisplayCaptureSource): 2021-02-05 Kate Cheney ASSERTION FAILED: Completion handler should always be called under WebKit::VideoFullscreenManagerProxy::forEachSession https://bugs.webkit.org/show_bug.cgi?id=221343 Reviewed by Youenn Fablet. If a client tries to exit fullscreen mode when there is no fullscreen video present, we should call the completion handler immediately and return. Rename requestFullscreenModeWithCallback to requestCloseAllMediaPresentations because the completion handler is only called when all media presentations are closed. requestFullscreenModeWithCallback makes it seem like we can use this function with other modes besides VideoFullscreenModeNone. No new tests, this will fix a crashing iOS test. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView closeAllMediaPresentations:]): * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::requestCloseAllMediaPresentations): (WebKit::VideoFullscreenManagerProxy::requestCloseAllMediaPresentations): (WebKit::VideoFullscreenModelContext::requestFullscreenModeWithCallback): Deleted. (WebKit::VideoFullscreenManagerProxy::requestFullscreenModeWithCallback): Deleted. 2021-02-05 Youenn Fablet Make sure click attribution is processed in case of redirected kept alive loads https://bugs.webkit.org/show_bug.cgi?id=221453 Reviewed by John Wilander. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): Move the click attribution processing before kept alive check. 2021-02-05 Per Arne Vollan Remove access to IOMobileFramebufferUserClient https://bugs.webkit.org/show_bug.cgi?id=221408 Reviewed by Brent Fulgham. Remove access to the IOKit class IOMobileFramebufferUserClient in the WebContent process on macOS and iOS when the GPU process is enabled. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-02-05 Kate Cheney CrashTracer: com.apple.WebKit.Networking at WebKit: WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource https://bugs.webkit.org/show_bug.cgi?id=221432 Reviewed by John Wilander. We are seeing crashes in ResourceLoadStatisticsDatabaseStore::setPrevalentResource as a result of trying to use a nullopt domainID value. In theory this should never be WTF::nullopt but is because of a failing SQLite query in ResourceLoadStatisticsDatabaseStore::domainID which reports the error "not an error". To fix this we should check the domain ID and return early with a debug assert in setPrevalentResource() if it is WTF::nullopt to avoid a crash. Additionally, we should add more information to the logging statement, specifically the SQLite statement string, to try and debug further. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const): (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource): 2021-02-05 Sihui Liu SpeechRecognitionPermissionManager should not handle requests that are already cancelled https://bugs.webkit.org/show_bug.cgi?id=221296 Reviewed by Youenn Fablet. It is possible that client asks to stop/abort pending requests, which are waiting for permission check to be done. In our current implementation, SpeechRecognitionPermissionManager would perform permission checks for these cancelled requests, which is unnecessary and may cause extra prompts. We should let SpeechRecognitionPermissionManager check if request is still valid before checking permissions. No test is added as this behavior change is not observable without resetting the TCC permission between requests. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startNextRequest): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::~SpeechRecognitionPermissionRequest): (WebKit::SpeechRecognitionPermissionRequest::request): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): (WebKit::SpeechRecognitionPermissionRequest::origin const): Deleted. (WebKit::SpeechRecognitionPermissionRequest::lang const): Deleted. (WebKit::SpeechRecognitionPermissionRequest::frameIdentifier const): Deleted. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::sendUpdate): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): 2021-02-05 Chris Dumez [GPUProcess][iOS] Audio is lost after media playback recovers from the GPUProcess crash https://bugs.webkit.org/show_bug.cgi?id=221305 Reviewed by Eric Carlson. Fix issue where we would sometimes lose the video after recovering from a GPUProcess crash. The issue is that RemoteMediaPlayerProxy::setVideoInlineSizeFenced() may get called *before* RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable(). As a result, we would not have a root layer yet and we would fail to set the video dimensions and they would remain at 0x0. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: (WebKit::setVideoInlineSizeIfPossible): (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): (WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeFenced): 2021-02-05 Carlos Garcia Campos REGRESSION(r271879) [SOUP] webrtc/datachannel/gather-candidates-networkprocess-crash.html is crashing in debug mode https://bugs.webkit.org/show_bug.cgi?id=221379 Reviewed by Youenn Fablet. * NetworkProcess/soup/WebKitDirectoryInputStream.cpp: (webkitDirectoryInputStreamRead): Fix bytes read calculation. 2021-02-05 Philippe Normand [GTK] clang warnings https://bugs.webkit.org/show_bug.cgi?id=221410 Reviewed by Adrian Perez de Castro. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::resourceLoadInfo): Remove ifdef added in r272313, the corresponding enum value is not ifdeffed either. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::sendUpdate): Use portable format specifier for uint64_t. * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: Ifdef member variable currently used only on Cocoa platforms. 2021-02-04 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.31.1 release * wpe/NEWS: Add release notes for 2.31.1. 2021-02-04 Ross Kirsling REGRESSION (r272382): 2 webkit.messages_unittest.GeneratedFileContentsTest tests failing after Semaphore.h rename https://bugs.webkit.org/show_bug.cgi?id=221433 Reviewed by Don Olmstead. Looks like some changes were accidentally dropped prior to landing. * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: * Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp: 2021-02-04 Julian Gonzalez Null dereference in DocumentLoader::commitData() https://bugs.webkit.org/show_bug.cgi?id=221097 Reviewed by Alex Christensen. As we add another return-early case to commitData(), WebFrameLoaderClient::committedLoad() has to allow for the absence of a Document. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::committedLoad): 2021-02-04 Kate Cheney Link libnetworkextension at compile time https://bugs.webkit.org/show_bug.cgi?id=221372 Reviewed by Brent Fulgham. Network Extension is not available on tvOS. * Configurations/WebKit.xcconfig: 2021-02-04 Megan Gardner Allow highlight delegate to be set on WKWebView https://bugs.webkit.org/show_bug.cgi?id=221362 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2021-02-04 Alex Christensen Don't launch a network process when registering URL schemes https://bugs.webkit.org/show_bug.cgi?id=221427 Reviewed by Chris Dumez. When Safari on macOS is launching, it calls registerURLSchemeAsSecure and registerURLSchemeAsBypassingContentSecurityPolicy. This causes the network process to launch before the app has finished launching. Since values are stored in the UI process and sent in NetworkProcessCreationParameters whenever a network process starts, so it's not necessary to start the network process when calling these two functions. This should decrease Safari's launch time. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::registerURLSchemeAsSecure): (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy): 2021-02-04 Ross Kirsling Don't use Semaphore.h as a filename https://bugs.webkit.org/show_bug.cgi?id=221418 Reviewed by Don Olmstead. IPC::Semaphore was recently moved to IPC/Semaphore.h; let's ensure that it's IPC/IPCSemaphore.h instead. Semaphore.h is a filename that may exist in platform SDKs and thus can cause a WK build break based on ordering. * GPUProcess/graphics/RemoteRenderingBackend.cpp: * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/media/RemoteAudioDestinationManager.cpp: * GPUProcess/media/RemoteAudioDestinationManager.h: * Platform/IPC/IPCSemaphore.cpp: Renamed from Source/WebKit/Platform/IPC/Semaphore.cpp. * Platform/IPC/IPCSemaphore.h: Renamed from Source/WebKit/Platform/IPC/Semaphore.h. * Platform/IPC/darwin/IPCSemaphoreDarwin.cpp: Renamed from Source/WebKit/Platform/IPC/darwin/SemaphoreDarwin.cpp. * Scripts/webkit/messages.py: * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: * Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp: * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2021-02-04 Youenn Fablet Test landed flaky: [iOS] TestWebKitAPI.WebKit2.CrashGPUProcessWhileCapturing https://bugs.webkit.org/show_bug.cgi?id=221331 Reviewed by Eric Carlson. For video sources tied to a remote source in GPUProcess, we are calling requestToEnd instead of end since the same remote source may be shared with other cloned video sources. In that case, the source in WebProcess should be considered as ended as soon as requestToEnd is called. This is important as in case of GPUProcess, we are recreating sources that are not ended. We were thus recreating a source which was actually ended in WebProcess. This appears in particular on iOS where only one source can be active at a time. A further refactoring should probably change the way we clone video sources given we are now supporting size and frame rate adaptations in RealtimeVideoSource. Covered by API test no longer falkily failing. * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: (WebKit::RemoteRealtimeMediaSource::captureFailed): (WebKit::RemoteRealtimeMediaSource::requestToEnd): * WebProcess/cocoa/RemoteRealtimeMediaSource.h: 2021-02-04 Alex Christensen REGRESSION(r267763) Network process launches earlier than before https://bugs.webkit.org/show_bug.cgi?id=221384 Reviewed by Chris Dumez. Before r267763 we could have an app launch, allocate a WKWebView, and set _resourceLoadStatisticsEnabled all without having a network process launch. When setting _resourceLoadStatisticsEnabled, we don't need to launch a network process if we haven't already because when we do, WebsiteDataStore::parameters will send the correct value. I added a test that verifies this doesn't launch the network process if it hasn't already been launched. We also don't need to update the process assertion or the process suspension state if there is no network process. sendNetworkProcessXPCEndpointToWebProcess is also called when opening Safari on iOS and would be the next thing to unnecessarily launch the network process during app initialization. I manually verified that if we add an early return if there is no network process yet, we do send the XPC endpoint to the web process when the network process does launch through the call site in sendNetworkProcessXPCEndpointToAllWebProcesses. I verified on my phone that this is the minimal change needed for Safari on iOS to not launch the network process before application:didFinishLaunchingWithOptions: is called as it did before r267763. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::updateProcessSuppressionState): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::updateProcessAssertions): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToWebProcess): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::networkProcessIfExists): 2021-02-04 Aditya Keerthi [macOS] Selecting a date on datetime-local inputs unexpectedly adds second and millisecond fields https://bugs.webkit.org/show_bug.cgi?id=221350 Reviewed by Devin Rousso. * UIProcess/mac/WebDateTimePickerMac.mm: (-[WKDateTimePicker updatePicker:]): (-[WKDateTimePicker dateFormatStringForType:]): Do not use the length of the value to determine whether or seconds and milliseconds should be present, since the value can be empty. Instead, use the new information in DateTimeChooserParameters, matching the visual appearance of the input. 2021-02-04 Lauro Moura REGRESSION(r267763): [GTK][WPE] Broken main thread assertion in MemoryPressureMonitor https://bugs.webkit.org/show_bug.cgi?id=217363 Reviewed by Carlos Garcia Campos. r267763 changed a number of NetworkProcessProxy methods to be accessible only from the main thread, including allNetworkProcesses(). This function was called from the memory pressure monitor thread directly to notify high memory usage. This was causing the debug bots to abort prematurely with many crashes when in reality just a memory pressure warning would be enough. Covered by existing tests. * UIProcess/linux/MemoryPressureMonitor.cpp: (WebKit::MemoryPressureMonitor::start): Dispatch the memory pressure notification in the main thread. 2021-02-03 Timothy Horton ASSERTION FAILED: !size.isEmpty() under platformInitializeWebProcess * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Follow-up to r272335; don't call IOSurface::setMaximumSize if the UI process did not send us a size. Caused all Web Content processes to assert in debug on launch. 2021-02-03 Jer Noble [Cocoa] WebM audio goes out-of-sync or stops playing after a seek https://bugs.webkit.org/show_bug.cgi?id=221354 Reviewed by Eric Carlson. The MTPluginFormatReader will attempt to determine whether an audio sample needs priming frames by querying for, among other things, its "syncInfo". Previously, we had just presumed all samples without a sample attachment dictionary were sync samples, and reported them as such from MediaSampleCursor, but this causes the format reader plugin to walk backwards all the way to the beginning of the audio track looking for priming samples. Instead, since the sample in question has no sync info (it was synthesized by MediaSample), return kCMBaseObjectError_ValueNotAvailable in this case, which causes the plugin format reader to assume all samples are both sync and do not require explicit priming frames. * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::MediaSampleCursor::getSampleTiming const): (WebKit::MediaSampleCursor::getSyncInfo const): 2021-02-03 Andy Estes [macOS] Shrink MediaSampleByteRange by 8 bytes https://bugs.webkit.org/show_bug.cgi?id=221363 Reviewed by Eric Carlson. Reordered member variables to shrink MediaSampleByteRange from 160 bytes to 152 bytes. * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): * Shared/mac/MediaFormatReader/MediaSampleByteRange.h: 2021-02-03 Kate Cheney PCM: earliestTimeToSend should be treated as an independent time value, not relative to timeOfAdClick https://bugs.webkit.org/show_bug.cgi?id=221303 Reviewed by John Wilander. r270136 assumed that PCM's earliestTimeToSend attribute was the difference between timeOfAdClick and when the attribution should be sent. As a result, it began each new browser session by adjusting this value based on the amount of time the session was closed. In reality, earliestTimeToSend is a raw secondsSinceEpoch() value, so we don't need any adjustment after a new session. No new tests, this is covered by http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start.html now that the corresponding test SPI has been updated. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::createTableQueries): (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): (WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Update the testing SPI to insert an expired time of now minus one hour as the earliestTimeToSend. (WebKit::ResourceLoadStatisticsDatabaseStore::updateTimerLastFired): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::timerLastFired): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::updatePrivateClickMeasurementAttributionTimes): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::updateTimerLastFired): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): Deleted. * NetworkProcess/PrivateClickMeasurementManager.h: 2021-02-03 Jiewen Tan [WebAuthn] Allow one user gesture free prompt for each navigation https://bugs.webkit.org/show_bug.cgi?id=220897 Reviewed by Brent Fulgham. This is a quirk that only allows certain websites. Covered by existing tests. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::filterTransports const): (WebKit::AuthenticatorManager::runPanel): (WebKit::AuthenticatorManager::runPresenter): Cancel the whole WebAuthn operation if no user gesture is indicated. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h: Set a boolean to indicate a free coupon for each navigation. 2021-02-03 Michael Catanzaro [GTK] webkit_settings_set_enable_plugins deprecation warning breaks unit tests https://bugs.webkit.org/show_bug.cgi?id=220620 Reviewed by Carlos Garcia Campos. Don't print a warning when calling webkit_settings_set_enable_plugins() to disable plugins. We'll still print a warning if attempting to enable plugins, or if checking whether plugins are enabled. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_get_enable_plugins): (webkit_settings_set_enable_plugins): 2021-02-03 Sihui Liu Create a SpeechRecognizer for each SpeechRecognitionRequest https://bugs.webkit.org/show_bug.cgi?id=219699 Reviewed by Youenn Fablet. We used the same SpeechRecognizer for multiple requests, so we had to reset SpeechRecognizer state between requests, which makes things complicated and hard to debug (like nested reset calls). Now we have one dedicated SpeechRecognizer for each request. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::stop): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::invalidate): * UIProcess/SpeechRecognitionServer.h: 2021-02-03 Tim Horton REGRESSION (r270392): Launch time regression under IOSurface::maximumSize() https://bugs.webkit.org/show_bug.cgi?id=221346 Reviewed by Sam Weinig. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): Scope r270392 to only the case where it is needed, when DOM rendering in the GPU process is enabled and the Web Content process does not have access to IOSurface, because it causes a small launch time regression. 2021-02-03 Aditya Keerthi [iOS][FCR] Add new picker for select elements https://bugs.webkit.org/show_bug.cgi?id=221153 Reviewed by Tim Horton. Tapping on a select element should display an context menu that allows users to choose one of the specified options. Rather than presenting a UIPickerView, tapping on select elements now create UIContextMenuInteractions, similar to date and file inputs. Test: fast/forms/ios/form-control-refresh/select/choose-select-option.html * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): The new picker does not bring up the keyboard view on all devices. (-[WKContentView _elementTypeRequiresAccessoryView:]): Changed from a static method to an instance method, as the returned value depends on a flag which is only accessible through the instance. (-[WKContentView requiresAccessoryView]): (-[WKContentView _formControlRefreshEnabled]): (-[WKContentView _shouldShowKeyboardForElement:]): (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): (-[WKContentView _removeContextMenuViewIfPossible]): Do not remove the context menu if an select element is actively being interacted with. (-[WKContentView selectControl]): * UIProcess/ios/forms/WKFormSelectControl.mm: (-[WKFormSelectControl initWithView:]): * UIProcess/ios/forms/WKFormSelectPicker.h: * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKSelectPicker initWithView:]): (-[WKSelectPicker controlView]): (-[WKSelectPicker controlBeginEditing]): Ensure the position information is up-to-date prior to presenting the context menu. (-[WKSelectPicker controlEndEditing]): (-[WKSelectPicker dealloc]): (-[WKSelectPicker didSelectOptionIndex:]): (-[WKSelectPicker createMenu]): Build the menu using UIActions and UIMenus. Since optgroup elements cannot be nested, only the root UIMenu can contain UIMenus. Submenus can only contain UIActions. (-[WKSelectPicker actionForOptionItem:withIndex:]): (-[WKSelectPicker contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): (-[WKSelectPicker _contextMenuInteraction:styleForMenuWithConfiguration:]): (-[WKSelectPicker contextMenuInteraction:configurationForMenuAtLocation:]): (-[WKSelectPicker contextMenuInteraction:willDisplayMenuForConfiguration:animator:]): (-[WKSelectPicker contextMenuInteraction:willEndForConfiguration:animator:]): (-[WKSelectPicker removeContextMenuInteraction]): (-[WKSelectPicker ensureContextMenuInteraction]): (-[WKSelectPicker showSelectPicker]): (-[WKSelectPicker selectRow:inComponent:extendingSelection:]): Implement method for testing select pickers. 2021-02-03 Per Arne Vollan [macOS] Remove access to graphics related user clients https://bugs.webkit.org/show_bug.cgi?id=221327 Reviewed by Brent Fulgham. Remove access to graphics related IOKit classes in the WebContent process on macOS when the GPU process is enabled. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-03 Per Arne Vollan [macOS] Remove access to com.apple.cvmsServ https://bugs.webkit.org/show_bug.cgi?id=221336 Reviewed by Brent Fulgham. Remove access to com.apple.cvmsServ in the WebContent process when the GPU Process is enabled. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-03 Per Arne Vollan [macOS] Remove access to RootDomainUserClient https://bugs.webkit.org/show_bug.cgi?id=221326 Reviewed by Brent Fulgham. After r272241, access to the IOKit class RootDomainUserClient can be removed from the WebContent process. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-03 Kate Cheney Add internal additions to NetworkSessionCocoa https://bugs.webkit.org/show_bug.cgi?id=221060 Reviewed by Brent Fulgham. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): 2021-02-03 Devin Rousso [iOS] delay `+[BKSMousePointerService sharedInstance]` so that it doesn't impact launch perf https://bugs.webkit.org/show_bug.cgi?id=221298 Reviewed by Geoffrey Garen. * UIProcess/ios/WKMouseDeviceObserver.h: * UIProcess/ios/WKMouseDeviceObserver.mm: (-[WKMouseDeviceObserver init]): Added. (-[WKMouseDeviceObserver startWithCompletionHandler:]): Added. (-[WKMouseDeviceObserver start]): (-[WKMouseDeviceObserver stop]): (-[WKMouseDeviceObserver stopWithCompletionHandler:]): Added. 2021-02-03 Youenn Fablet Make sure GPUProcess MediaRecorder handles correctly muted tracks https://bugs.webkit.org/show_bug.cgi?id=221325 Reviewed by Eric Carlson. In case of muted audio, zero the audio buffer before writing it in the ring buffer. In case of muted video, send a black frame instead of the real frame. For that purpose, create a black frame and convert it to IOSurface. Apply this to any non IOSurface based video sample. Fix unified build. * GPUProcess/webrtc/RemoteMediaRecorder.h: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::videoSampleAvailable): (WebKit::MediaRecorderPrivate::audioSamplesAvailable): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.mm: Added. * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: 2021-02-03 Alex Christensen Fix watch and tv build after r272228 https://bugs.webkit.org/show_bug.cgi?id=220683 UIEventAttribution is special in that the symbol is declared as unavailable on watchOS and tvOS. To fix the build, we need to not use this symbol on those operating systems. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/ios/WKWebViewIOS.mm: 2021-02-03 Antoine Quint Add a loader for resources https://bugs.webkit.org/show_bug.cgi?id=221255 Reviewed by Youenn Fablet. * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::resourceLoadInfo): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::maximumBufferingTime): 2021-02-03 Kimmo Kinnunen MachSemaphore does not work well with IPC messages https://bugs.webkit.org/show_bug.cgi?id=220919 Reviewed by Sam Weinig. Move WTF::MachSemaphore to WebKit IPC::Semaphore. Currently the MachSemaphore is useful only in cross-process IPC, implemented by the IPC::. Adds a stub IPC::Semaphore to all non-COCOA platforms, so that constructors do not need to ifdef'ed to be able to compile platforms that do not yet support GPU process fully. Implement move constructor and move assignment operator for Semaphore. Makes it possible to create types that hold Semaphore but still are decode()able from a IPC message. The decoded objects are held with Optional, and this forces the subobjects to have move assignment operator. Add asserts that the moved-away object is not used. Add the asserts as asserts on the call return values, so the values are also checked on normal objects on normal operation. Implement an encoder and decoder for IPC::Semaphore. Makes it possible to send it via IPC as its own type, not as MachSendRight. As an example, changes existing uses of MachSendRight for semaphores in messages as Semaphores, described below. No new tests, a refactor. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createRenderingBackend): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::create): (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/RemoteRenderingBackendCreationParameters.h: Removed. Changes RemoteRenderingBackend to receive its parameters from the normal message parameters instead of redundant RemoteRenderingBackendCreationParameters. The IPC generator already generates 1:1 identical structure, it is just the message Messages::GPUConnectionToWebProcess::CreateRenderingBackend. There is no need to double-wrap the simple list of parameters. The double-wrapping is a problem: The message system parameters are of ownership "const reference", which is what is expected. RemoteRenderingBackendCreationParameters contents were of ownership "value", which works as expected only for simple primitive types. Essentially previously calling the IPC function meant transfering objects to RemoteRenderingBackendCreationParameters. This is not how the IPC system is meant to work. The intention of a IPC call is to, by default, reference its arguments for the purpose of encoding. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::create): (WebKit::RemoteAudioDestination::RemoteAudioDestination): (WebKit::RemoteAudioDestinationManager::createAudioDestination): * GPUProcess/media/RemoteAudioDestinationManager.h: * GPUProcess/media/RemoteAudioDestinationManager.messages.in: Receive the semaphore from RemoteAudioDestinationProxy. Previously it was created during RemoteAudioDestination creation and be sent back by RemoteAudioDestinationManager. * Platform/IPC/Semaphore.cpp: Renamed from Source/WTF/wtf/cocoa/MachSemaphore.cpp. (IPC::Semaphore::encode const): (IPC::Semaphore::decode): * Platform/IPC/Semaphore.h: Renamed from Source/WTF/wtf/cocoa/MachSemaphore.h. (IPC::Semaphore::operator bool const): * Platform/IPC/cocoa/SemaphoreCocoa.cpp: Added. (IPC::Semaphore::Semaphore): (IPC::Semaphore::~Semaphore): (IPC::Semaphore::operator=): (IPC::Semaphore::signal): (IPC::Semaphore::wait): (IPC::Semaphore::waitFor): (IPC::Semaphore::createSendRight const): (IPC::Semaphore::encode const): (IPC::Semaphore::decode): (IPC::Semaphore::destroy): * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: * Scripts/webkit/tests/Makefile: * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::jsValueForArguments): (IPC::messageArgumentDescriptions): * Scripts/webkit/tests/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: * Scripts/webkit/tests/TestWithMachSemaphore.messages.in: Copied from Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in. * Scripts/webkit/tests/TestWithMachSemaphoreMessageReceiver.cpp: Added. * Scripts/webkit/tests/TestWithMachSemaphoreMessages.h: Added. * Scripts/webkit/tests/TestWithMachSemaphoreMessagesReplies.h: Added. * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::connectToGPUProcess): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::startRenderingThread): (WebKit::RemoteAudioDestinationProxy::stopRenderingThread): Change the semaphore usage from unique_ptr to the normal object access. The semaphore is now created by the proxy, so there is no unique_ptr. (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): (WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: Changes RemoteAudioDestinationProxy to send its own semaphore from WebProcess to GPUProcess. Previously the semaphore would be sent back by RemoteAudioDestinationManager. Previously the code structure is more complicated than neccessary, as the semaphore holder was being null-checked, reset and re-seated. The WebProcess gets already to choose the semaphores GPUProcess uses, so this should not increase security surface. The change chosen here side-steps the shortcoming of the IPC system where unpacking objects from the Reply messages mandates that a constructed version of that type exists. For previous MachSendRight empty-constructed object is simple, but for MachSemaphore empty-constructed object creates unnecessary complication that is not required otherwise at the moment. The alternative to what was chosen here would be to hold with Optional and add a empty-initializing constructor to hold the object where to unpack the semaphore object from the Reply. 2021-02-03 Carlos Garcia Campos [GTK][WPE] Reduce the use of SoupURI in preparation for libsoup3 https://bugs.webkit.org/show_bug.cgi?id=221251 Reviewed by Adrian Perez de Castro. * UIProcess/API/glib/WebKitURISchemeRequest.cpp: (webkit_uri_scheme_request_get_scheme): (webkit_uri_scheme_request_get_path): * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_load_uri): 2021-02-02 Per Arne Vollan Register for power notifications in the UI process https://bugs.webkit.org/show_bug.cgi?id=221258 Reviewed by Brent Fulgham. Create a PowerObserver object when the Web process pool is registering notification observers. Notify all WebContent processes When a power on notification is received. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeProcess): (WebKit::WebProcess::systemWillPowerOn): 2021-02-02 Kate Cheney PCM: Indicate if network load data is user identifiable https://bugs.webkit.org/show_bug.cgi?id=221113 Reviewed by John Wilander. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/NetworkResourceLoadParameters.cpp: (WebKit::NetworkResourceLoadParameters::encode const): (WebKit::NetworkResourceLoadParameters::decode): * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::fireConversionRequest): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): 2021-02-02 Alex Christensen Remove all use of _UIEventAttribution https://bugs.webkit.org/show_bug.cgi?id=221289 Reviewed by John Wilander. It has been replaced by UIEventAttribution API. * Platform/ios/UIKitSoftLink.h: Removed. * Platform/ios/UIKitSoftLink.mm: Removed. * Platform/spi/ios/UIKitSPI.h: * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setEventAttribution:]): Deleted. (-[WKWebView _eventAttribution]): Deleted. * WebKit.xcodeproj/project.pbxproj: 2021-02-02 Wenson Hsieh Add scaffolding to request image extraction after a delay when hovering over images https://bugs.webkit.org/show_bug.cgi?id=221226 Reviewed by Devin Rousso. Work towards allowing clients to extract image data when hovering over rendered image elements, for new accessibility-related features. See changes below for more details. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::requestImageExtraction): Leave this method stub unimplemented for the time being. * UIProcess/PageClient.h: (WebKit::PageClient::requestImageExtraction): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestImageExtraction): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::requestImageExtraction): Add plumbing to allow the web process to asynchronously request image extraction data from the UI process. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::requestImageExtraction): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): (WebKit::WebPage::requestImageExtraction): * WebProcess/WebPage/WebPage.h: Add a weak set of elements that we've attempted to extract, so that we won't end up extracting elements more than once. Although this set this currently only cleared upon navigation, this should eventually be updated when (for instance) an element's image source changes, such that we can re-extract the new image data if needed. 2021-02-02 Kate Cheney REGRESSION(r271744): Broke Microsoft live login in internal builds https://bugs.webkit.org/show_bug.cgi?id=221271 Reviewed by Alex Christensen. If a user goes straight to login.live.com without first visiting microsoft.com, we crash when checking for storage access because we assume the user has interacted with the page. Since this is a quirked flow, we should not assume that, and should insert the domain into the database. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt): (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 2021-02-02 Alex Christensen Adopt UIEventAttribution instead of _UIEventAttribution https://bugs.webkit.org/show_bug.cgi?id=220683 Reviewed by John Wilander. UIKit introduced UIEventAttribution, so let's adopt it so they can remove their SPI. See rdar://73629041 * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setUIEventAttribution:]): (-[WKWebView _uiEventAttribution]): 2021-02-02 Rini Patel Remove unused functions from GraphicsContextGL and ExtensionsGL https://bugs.webkit.org/show_bug.cgi?id=218896 Reviewed by Dean Jackson. * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h: (getGraphicsResetStatusARB): (getTranslatedShaderSourceANGLE): (blitFramebufferANGLE): Deleted. (renderbufferStorageMultisampleANGLE): Deleted. (insertEventMarkerEXT): Deleted. (pushGroupMarkerEXT): Deleted. (popGroupMarkerEXT): Deleted. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp: (WebKit::RemoteGraphicsContextGLProxy::blitFramebufferANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::renderbufferStorageMultisampleANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::insertEventMarkerEXT): Deleted. (WebKit::RemoteGraphicsContextGLProxy::pushGroupMarkerEXT): Deleted. (WebKit::RemoteGraphicsContextGLProxy::popGroupMarkerEXT): Deleted. (WebKit::RemoteGraphicsContextGLProxy::readPixelsRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::texParameterfvRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::texParameterivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getQueryivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectuivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getBufferPointervRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getVertexAttribIivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getVertexAttribIuivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getUniformuivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getBufferParameteri64vRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::samplerParameterivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::samplerParameterfvRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterfvRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getFramebufferParameterivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getProgramInterfaceivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getBooleani_vRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getMultisamplefvRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getTexLevelParameterivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getTexLevelParameterfvRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getPointervRobustANGLERobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getnUniformfvRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getnUniformivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getnUniformuivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::texParameterIivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::texParameterIuivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getTexParameterIivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getTexParameterIuivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::samplerParameterIivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::samplerParameterIuivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterIivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterIuivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectivRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getQueryObjecti64vRobustANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectui64vRobustANGLE): Deleted. 2021-02-02 Youenn Fablet Recover MediaStreamTrack audio rendering from GPUProcess crash https://bugs.webkit.org/show_bug.cgi?id=221128 Reviewed by Eric Carlson. Make AudioMediaStreamTrackRenderer observe GPUProcess crash. Notify its owner in case of crash. * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::AudioMediaStreamTrackRenderer): (WebKit::AudioMediaStreamTrackRenderer::~AudioMediaStreamTrackRenderer): (WebKit::AudioMediaStreamTrackRenderer::initialize): (WebKit::AudioMediaStreamTrackRenderer::gpuProcessConnectionDidClose): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: 2021-02-02 Youenn Fablet Make sure NetworkRTCProvider stays valid for all NetworkRTCSocketCocoa callbacks https://bugs.webkit.org/show_bug.cgi?id=221249 Reviewed by Eric Carlson. Make the connection callback take a ref of the NetworkRTCProvider. The ref cycle will break at NetworkConnectionToWebProcess destruction since it will call NetworkRTCProvider::close which deletes all sockets owning the connection. * NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm: (WebKit::NetworkRTCSocketCocoa::NetworkRTCSocketCocoa): 2021-02-02 Per Arne Vollan Unreviewed build fix after 272154. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 2021-02-02 Chris Dumez [macOS] Regression(r271897) Prewarmed WebProcesses no longer get a user-friendly process name in Activity Monitor https://bugs.webkit.org/show_bug.cgi?id=221094 Reviewed by Per Arne Vollan. Prewarmed WebProcesses currently do not have a network process connection because they do not have a sessionID yet and initiating a connection to the network process currently requires a sessionID. r271897 made it so that WebProcess::updateProcessName() early returns when there is no network process connection, which means that our prewarmed WebProcesses no longer get the "Safari Web Content (prewarmed)" user-friendly name in activity monitor. This patch relies on the fact that we are allowed to talk to launchservices when WebProcess::updateProcessName() gets called during process initialization (The sandbox extension gets revoked during process initialization right after calling updateProcessName). As a result, if updateProcessName() gets called during process initialization, we now set the process name directly within the process instead of messaging the network process. This fixes the issue with prewarmed WebProcesses. This patch also gets rid of the early returns when the network connection is not present and calls ensureNetworkProcessConnection() instead. We want to make sure to set the process name even if the process does not have a network process connection yet (either because none has been initiated yet or because the network process crashed). Finally, this patch replaces some WTFLogAlways() for error cases with RELEASE_LOG_ERROR() so that the errors stand out in the logs. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::tryTakePrewarmedProcess): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setIsInProcessCache): (WebKit::WebProcess::markIsNoLongerPrewarmed): * WebProcess/WebProcess.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateActivePages): 2021-02-02 Frédéric Wang [GTK] Initialize PrintInfo::PrintMode https://bugs.webkit.org/show_bug.cgi?id=221256 Reviewed by Carlos Garcia Campos. * Shared/PrintInfo.h: 2021-02-02 Youenn Fablet Use WebRTC GPU process flag for MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=220967 Reviewed by Eric Carlson. * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): 2021-02-02 Youenn Fablet Only update IPC connection of RemoteCaptureSampleManager for audio sources https://bugs.webkit.org/show_bug.cgi?id=221200 Reviewed by Eric Carlson. There is no need to update the connection for sources that are not added to the RemoteCaptureSampleManager. * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::addSource): (WebKit::UserMediaCaptureManager::didUpdateSourceConnection): * WebProcess/cocoa/UserMediaCaptureManager.h: 2021-02-02 Antoine Quint WKASCAuthorizationPresenterDelegate needs to import RunLoop.h and BlockPtr.h https://bugs.webkit.org/show_bug.cgi?id=221250 Reviewed by Antti Koivisto. * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: 2021-02-02 Youenn Fablet Recover WebRTC codecs in case of GPUProcess crash https://bugs.webkit.org/show_bug.cgi?id=221138 Reviewed by Eric Carlson. Make LibWebRTCCodecs listen to GPUProcess crash on creation of LibWebRTCCodec. Set the connection also at the same time. This allows to remove the hop to main thread when creating/releasing encoders and decoders. Everything now happens in the dedicated queue, in particular updating of m_connection, encoder and decoder connections, as well as encoders and decoders maps. When using encoder/decoder connection outside of the dedicated queue, a lock is needed. Update LibWebRTCCodecs use of gpu process when creating a peer connection so that this happens in main thread. In case of process crash, we do some setup in main thread (listening to IPC messages for instance). But most of the work is done in a task run in the dedicated queue. In this task, we set the new IPC connection of all running decoders and encoders. We also send IPC message to recreate encoders and decoders. For that purpose, we store some states in encoders and decoders. Covered by API test. * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::formatNameFromWebRTCCodecType): (WebKit::createRemoteDecoder): (WebKit::LibWebRTCCodecs::LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::createDecoder): (WebKit::LibWebRTCCodecs::releaseDecoder): (WebKit::LibWebRTCCodecs::decodeFrame): (WebKit::LibWebRTCCodecs::createEncoder): (WebKit::LibWebRTCCodecs::releaseEncoder): (WebKit::LibWebRTCCodecs::initializeEncoder): (WebKit::LibWebRTCCodecs::encodeFrame): (WebKit::LibWebRTCCodecs::setEncodeRates): (WebKit::LibWebRTCCodecs::gpuProcessConnectionDidClose): (WebKit::LibWebRTCCodecs::setConnection): Deleted. * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: (WebKit::LibWebRTCProvider::createPeerConnection): (WebKit::LibWebRTCProvider::createDecoderFactory): (WebKit::LibWebRTCProvider::createEncoderFactory): 2021-02-02 Youenn Fablet imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-stop.html is flaky when GPUProcess is enabled https://bugs.webkit.org/show_bug.cgi?id=221197 Reviewed by Eric Carlson. * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::stopRecording): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::stopRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: 2021-02-02 Carlos Garcia Campos [SOUP] Stop using SoupBuffer in preparation for libsoup3 https://bugs.webkit.org/show_bug.cgi?id=221206 Reviewed by Sergio Villar Senin. Use GBytes instead of SoupBuffer. * NetworkProcess/cache/NetworkCacheData.h: (WebKit::NetworkCache::Data::bytes const): * NetworkProcess/cache/NetworkCacheDataGLib.cpp: Renamed from Source/WebKit/NetworkProcess/cache/NetworkCacheDataSoup.cpp. (WebKit::NetworkCache::Data::Data): (WebKit::NetworkCache::Data::empty): (WebKit::NetworkCache::Data::data const): (WebKit::NetworkCache::Data::apply const): (WebKit::NetworkCache::Data::subrange const): (WebKit::NetworkCache::concatenate): (WebKit::NetworkCache::Data::adoptMap): (WebKit::NetworkCache::Data::tryCreateSharedMemory const): * NetworkProcess/cache/NetworkCacheIOChannel.h: * NetworkProcess/cache/NetworkCacheIOChannelGLib.cpp: Renamed from Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp. (WebKit::NetworkCache::runTaskInQueue): (WebKit::NetworkCache::fillDataFromReadBuffer): (WebKit::NetworkCache::inputStreamReadReadyCallback): (WebKit::NetworkCache::IOChannel::read): (WebKit::NetworkCache::IOChannel::readSyncInThread): (WebKit::NetworkCache::outputStreamWriteReadyCallback): (WebKit::NetworkCache::IOChannel::write): * Shared/ShareableResource.cpp: (WebKit::ShareableResource::wrapInSharedBuffer): * SourcesGTK.txt: * SourcesWPE.txt: 2021-02-02 Adrian Perez de Castro Non-unified build fixes, late January 2021 edition https://bugs.webkit.org/show_bug.cgi?id=221044 Unreviewed non-unified build fixes. * NetworkProcess/NetworkLoadScheduler.cpp: Add missing wtf/ListHashSet.h header inclusion. (WebKit::NetworkLoadScheduler::HostContext::schedule): Add missing WebCore:: namespace in usage of WebCore::ResourceLoadPriority enum. * Platform/unix/SharedMemoryUnix.cpp: Add missing ArgumentCoders.h header inclusion. * Shared/API/APIFrameHandle.cpp: Ditto. * Shared/API/APIGeometry.cpp: Ditto. * Shared/API/APIPageGroupHandle.cpp: Ditto. * Shared/API/APIPageHandle.cpp: Ditto. * Shared/LayerTreeContext.cpp: Ditto. 2021-02-01 Jiewen Tan [WebAuthn] Optimize _WKWebAuthenticationPanelDelegate for native API https://bugs.webkit.org/show_bug.cgi?id=221125 Reviewed by Brent Fulgham. This patch mainly does the following few things: 1. It connects the new SPI with the existing mock testing infrastructure such that we can mock test it. 2. It adds a new mode in AuthenticatorManager to connect it to the new _WKWebAuthenticationPanelDelegate object. 3. It adss a new SPI to _WKWebAuthenticationPanelDelegate: -[panel:requestLAContextForUserVerificationWithCompletionHandler:], and adds a new method within _WKWebAuthenticationAssertionResponse to accept an LAContext from the caller to unlock the keychain. 4. It enables -[_WKWebAuthenticationPanel cancel] to use the new cancel method. Covered by API tests. * UIProcess/API/APIWebAuthenticationAssertionResponse.h: Accepts a LAContext object. * UIProcess/API/APIWebAuthenticationPanel.cpp: (API::WebAuthenticationPanel::WebAuthenticationPanel): (API::WebAuthenticationPanel::handleRequest): (API::WebAuthenticationPanel::cancel const): (API::WebAuthenticationPanel::setMockConfiguration): * UIProcess/API/APIWebAuthenticationPanel.h: * UIProcess/API/APIWebAuthenticationPanelClient.h: (API::WebAuthenticationPanelClient::requestLAContextForUserVerification const): Adds new SPI and mocking. * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.mm: (-[_WKWebAuthenticationAssertionResponse setLAContext:]): Accepts a LAContext object. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (-[_WKWebAuthenticationPanel setMockConfiguration:]): * UIProcess/API/Cocoa/_WKWebAuthenticationPanelForTesting.h: Adds new SPI and mocking. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): (WebKit::AuthenticatorManager::enableModernWebAuthentication): (WebKit::AuthenticatorManager::enableNativeSupport): (WebKit::AuthenticatorManager::authenticatorAdded): (WebKit::AuthenticatorManager::requestLAContextForUserVerification): (WebKit::AuthenticatorManager::runPresenter): (WebKit::AuthenticatorManager::dispatchPanelClientCall const): * UIProcess/WebAuthentication/AuthenticatorManager.h: Adds a new mode to power the native API. * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h: * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient): (WebKit::WebAuthenticationPanelClient::requestLAContextForUserVerification const): Accepts a LAContext object. * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: (WebKit::MockLocalConnection::verifyUser): Adds new mocking functions. * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Adds the new weak panel. 2021-02-01 Michael Catanzaro [WPE][GTK] flatpak-spawn subsandbox clears environment variables, breaks EphyPermissionsManager https://bugs.webkit.org/show_bug.cgi?id=219325 Reviewed by Adrian Perez de Castro. Manually forward all environment variables from the web process to the UI process. EphyPermissionsManager is breaking because XDG directories are not set in the web process, because flatpak-spawn launches subprocesses with the environment of the host system rather than the environment of the parent process. But also, we really need to forward the entire environment, because otherwise basic expected features like GST_DEBUG, G_MESSAGES_DEBUG, and such will be broken. * UIProcess/Launcher/glib/FlatpakLauncher.cpp: (WebKit::flatpakSpawn): 2021-02-01 Antoine Quint Allow support for CAAnimationGroup https://bugs.webkit.org/show_bug.cgi?id=221209 Reviewed by Dean Jackson, Sam Weinig and Simon Fraser. In order to fix bug 219894, we need to use Core Animation's CAAnimationGroup and its setAnimations() method. Add support for the new "Group" PlatformCAAnimation type for the remote animations. * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (WebKit::PlatformCAAnimationRemote::Properties::encode const): (WebKit::PlatformCAAnimationRemote::Properties::decode): (WebKit::PlatformCAAnimationRemote::copy const): (WebKit::PlatformCAAnimationRemote::setAnimations): (WebKit::PlatformCAAnimationRemote::copyAnimationsFrom): (WebKit::createAnimation): (WebKit::addAnimationToLayer): (WebKit::operator<<): 2021-02-01 Wenson Hsieh Add a cross-platform helper method to generate shareable bitmaps from rendered images https://bugs.webkit.org/show_bug.cgi?id=221217 Reviewed by Tim Horton. Pull what is currently iOS-specific logic in `imagePositionInformation` out into a private, cross-platform helper method on `WebPage`. No change in behavior. * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::imagePositionInformation): 2021-02-01 Stephan Szabo [PlayStation] Build fix after r272058 https://bugs.webkit.org/show_bug.cgi?id=221141 Unreviewed build fix. * Platform/unix/SharedMemoryUnix.cpp: Include ArgumentCoders.h on PlayStation 2021-02-01 Sihui Liu Use user media permission prompt for speech recognition https://bugs.webkit.org/show_bug.cgi?id=221082 rdar://problem/73372499 Reviewed by Youenn Fablet. Make SpeechRecognitionPermissionManager ask UserMediaPermissionRequestManagerProxy for user permission on microphone. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::frameIdentifier const): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/SpeechRecognitionServer.messages.in: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): (WebKit::UserMediaPermissionRequestManagerProxy::grantRequest): (WebKit::UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy): * UIProcess/UserMediaPermissionRequestProxy.h: (WebKit::UserMediaPermissionRequestProxy::create): (WebKit::UserMediaPermissionRequestProxy::decisionCompletionHandler): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): (WebKit::WebPageProxy::requestUserMediaPermissionForSpeechRecognition): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::start): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: 2021-02-01 Wenson Hsieh Add some new data structures to represent image extraction results https://bugs.webkit.org/show_bug.cgi?id=221214 Reviewed by Sam Weinig. See WebCore ChangeLog for more details. * Shared/WebCoreArgumentCoders.cpp: * Shared/WebCoreArgumentCoders.h: 2021-02-01 Per Arne [macOS] Observe color preference changes in the UI process https://bugs.webkit.org/show_bug.cgi?id=221096 Reviewed by Brent Fulgham. As a step towards blocking the distributed notifications daemon in the WebContent process, color preference changes should be observed in the UI process. The UI process should notify the WebContent process about color preference changes. In order to be able to notify the AppKit observer in the WebContent process about changes with a local notification, a specific key/value needs to added to the Info.plist of the WebContent process. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::colorPreferencesDidChangeCallback): (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): * UIProcess/WebProcessPool.h: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::colorPreferencesDidChange): 2021-02-01 Per Arne [macOS] Remove write access to some IOKit properties https://bugs.webkit.org/show_bug.cgi?id=221137 Reviewed by Brent Fulgham. Remove write access to some IOKit properties in the WebContent process' sandbox. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-01 Per Arne [macOS] Add reporting to mach-register sandbox rule https://bugs.webkit.org/show_bug.cgi?id=221139 Reviewed by Brent Fulgham. Add reporting to mach-register rule in the WebContent process' sandbox. * WebProcess/com.apple.WebProcess.sb.in: 2021-02-01 Carlos Garcia Campos [SOUP] Add support for data URLs in the network process https://bugs.webkit.org/show_bug.cgi?id=221127 Reviewed by Adrian Perez de Castro. In r271879 I removed the support for data URLs in the network process for soup, assuming data URLs were always loaded from the web process, but that's not the case for downloads. I think we should not go to the network process for downloads either, but for now it's easier to fix this regression by supporting data URLs in the network process again. Fixes http/tests/security/anchor-download-allow-data.html. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::createRequest): Return early if it's a data URL. (WebKit::NetworkDataTaskSoup::clearRequest): Clear the pending data URL result. (WebKit::NetworkDataTaskSoup::resume): Start a data URL decode task if it's a new data URL request, or complete the pending one. (WebKit::NetworkDataTaskSoup::didReadDataURL): Complete the data URL request. * NetworkProcess/soup/NetworkDataTaskSoup.h: 2021-01-29 Darin Adler Check activeDocumentLoader() for null consistently everywhere https://bugs.webkit.org/show_bug.cgi?id=221167 Reviewed by Anders Carlsson. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::cancelManualStreamLoad): Added null check before calling isLoadingMainResource. 2021-01-30 Wenson Hsieh [macOS] Remove support for image controls https://bugs.webkit.org/show_bug.cgi?id=221156 Reviewed by Tim Horton. Leave the existing SPI implemented for binary compatability, but make them empty stubs and additionally mark the property on WKWebViewConfiguration as deprecated. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetImageControlsEnabled): (WKPreferencesGetImageControlsEnabled): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _setupPageConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _imageControlsEnabled]): (-[WKWebViewConfiguration _setImageControlsEnabled:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: 2021-01-29 Megan Gardner Add plumbing to allow AppHighlights to be restored. https://bugs.webkit.org/show_bug.cgi?id=221123 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _restoreAppHighlights:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::restoreAppHighlights): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::restoreAppHighlights): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-29 Yusuke Suzuki [JSC] Add com.apple.private.securejit entitlement for JITCage https://bugs.webkit.org/show_bug.cgi?id=221147 Reviewed by Keith Miller. Add com.apple.private.securejit only for iOS. * Scripts/process-entitlements.sh: 2021-01-29 Commit Queue Unreviewed, reverting r272065. https://bugs.webkit.org/show_bug.cgi?id=221155 Introduced crash Reverted changeset: "[macOS] Add reporting for some syscalls" https://bugs.webkit.org/show_bug.cgi?id=221135 https://trac.webkit.org/changeset/272065 2021-01-29 Per Arne [iOS] Stop observing changes in one preference domain https://bugs.webkit.org/show_bug.cgi?id=221130 Reviewed by Brent Fulgham. It has been determined that there is no need to observe preference changes in the domain 'com.apple.Preferences'. * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKPreferenceObserver init]): 2021-01-29 Per Arne [macOS] Add audio related shm write reporting https://bugs.webkit.org/show_bug.cgi?id=221136 Reviewed by Brent Fulgham. Add audio related shm write reporting in the WebContent process' sandbox. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-29 Per Arne [macOS] Remove access to IOSurfaceSendRight https://bugs.webkit.org/show_bug.cgi?id=221131 Reviewed by Brent Fulgham. Remove access to IOSurfaceSendRight in the WebContent process on macOS, since there are no reports of this being used. * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): * WebProcess/com.apple.WebProcess.sb.in: 2021-01-29 Commit Queue Unreviewed, reverting r272020 and r272034. https://bugs.webkit.org/show_bug.cgi?id=221144 Revert potentially related change while investigating crash Reverted changesets: "[macOS] WebProcess::updateProcessName should initiate network process connection if none exists" https://bugs.webkit.org/show_bug.cgi?id=221094 https://trac.webkit.org/changeset/272020 "Unreviewed macOS build fix after r272020." https://trac.webkit.org/changeset/272034 2021-01-29 Per Arne [macOS] Add reporting for some syscalls https://bugs.webkit.org/show_bug.cgi?id=221135 Reviewed by Brent Fulgham. Add reporting for some syscalls in the WebContent process on macOS in order to determine if they are being used. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-29 Commit Queue Unreviewed, reverting r272052. https://bugs.webkit.org/show_bug.cgi?id=221132 WPT mediacapture-record/MediaRecorder-stop.html is broken Reverted changeset: "Use WebRTC GPU process flag for MediaRecorder" https://bugs.webkit.org/show_bug.cgi?id=220967 https://trac.webkit.org/changeset/272052 2021-01-29 Kimmo Kinnunen Some type serialization encoders are implemented in Encoder class https://bugs.webkit.org/show_bug.cgi?id=220519 Reviewed by Chris Dumez. Move arithmetic type and enum type serialization from Encoder to ArgumentCoder. This makes it a bit simpler to implement multiple Encoder types, as the serialization code is consistently separate from the Encoder. WebGL SHM IPC stream extensions would eventually need a similar but slightly different Encoder. Since Encoder is intentionally coupled with the Decoder, do the corresponding modification to Decoder class for consistency. Reimplement Has{Legacy,Modern}Decoder for ease of forward declaration and (perhaps?) in a bit simpler terms. Encoder::operator<<() and Encoder::encode() were the same function. Remove Encoder::encode(). No new tests, a refactor. * NetworkProcess/NetworkSocketChannel.h: * Platform/IPC/ArgumentCoder.h: (IPC::Detail::TestLegacyDecoder): (IPC::Detail::TestModernDecoder): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Platform/IPC/ArgumentCoders.h: * Platform/IPC/Connection.h: (IPC::Connection::send): (IPC::Connection::sendWithAsyncReply): (IPC::Connection::sendSync): * Platform/IPC/Decoder.h: (IPC::Decoder::decode): (IPC::Decoder::operator>>): * Platform/IPC/Encoder.h: * Platform/IPC/MessageSender.h: * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::open): * Platform/cocoa/SharedMemoryCocoa.cpp: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const): * Shared/RemoteLayerTree/RemoteScrollingUIState.cpp: (WebKit::RemoteScrollingUIState::encode const): * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::send): (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply): * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSIPC::sendMessage): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRendering): 2021-01-29 Philippe Normand [GTK] return-type-c-linkage warnings https://bugs.webkit.org/show_bug.cgi?id=221047 Reviewed by Carlos Garcia Campos. Remove extern "C" braces, un-needed for private C++ objects. * NetworkProcess/soup/WebKitDirectoryInputStream.h: 2021-01-29 Youenn Fablet Use WebRTC GPU process flag for MediaRecorder https://bugs.webkit.org/show_bug.cgi?id=220967 Reviewed by Eric Carlson. * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp: (WebKit::MediaRecorderProvider::createMediaRecorderPrivate): 2021-01-29 Youenn Fablet Recover audio and video capture from GPUProcess crash https://bugs.webkit.org/show_bug.cgi?id=221086 Reviewed by Eric Carlson. Make RemoteRealtimeMediaSource observe GPU process crash. If RemoteRealtimeMediaSource is live and capturing in GPUProcess, restart capture from WebProcess. If GPU process crashes, make sure to send back the necessary entitlements and information to GPUProcess of which processes are allowed to capture. Covered by API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::gpuProcessCrashed): * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::didUpdateSourceConnection): * WebProcess/cocoa/RemoteCaptureSampleManager.h: * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: (WebKit::RemoteRealtimeMediaSource::create): (WebKit::RemoteRealtimeMediaSource::createRemoteMediaSource): (WebKit::RemoteRealtimeMediaSource::~RemoteRealtimeMediaSource): (WebKit::RemoteRealtimeMediaSource::gpuProcessConnectionDidClose): * WebProcess/cocoa/RemoteRealtimeMediaSource.h: * WebProcess/cocoa/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource): (WebKit::UserMediaCaptureManager::VideoFactory::createVideoCaptureSource): (WebKit::UserMediaCaptureManager::DisplayFactory::createDisplayCaptureSource): (WebKit::UserMediaCaptureManager::didUpdateSourceConnection): * WebProcess/cocoa/UserMediaCaptureManager.h: 2021-01-28 Megan Gardner Add plumbing to allow AppHighlights to be stored. https://bugs.webkit.org/show_bug.cgi?id=221020 Reviewed by Devin Rousso. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _didCreateHighlightsStorageData:]): (-[WKWebView _appHighlightsStorageDelegate]): (-[WKWebView _setAppHighlightsStorageDelegate:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::didCreateHighlightsStorageData): * UIProcess/Cocoa/WebPageProxyCocoa.mm: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCreateHighlightsStorageData): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::didCreateHighlightsStorageData): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createAppHighlightInSelectedRange): 2021-01-28 Jiewen Tan [WebAuthn] Adopt new SPI to show no credentials error for the platform authenticator https://bugs.webkit.org/show_bug.cgi?id=220894 Reviewed by Brent Fulgham. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): 2021-01-28 Peng Liu [GPUP][MSE] A video element does not fire “canplaythrough” event if SourceBuffer.abort() is called https://bugs.webkit.org/show_bug.cgi?id=220964 Reviewed by Jer Noble. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::parseByteSource): 2021-01-28 Chris Dumez Unreviewed macOS build fix after r272020. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateActivePages): 2021-01-28 Chris Dumez [macOS] WebProcess::updateProcessName should initiate network process connection if none exists https://bugs.webkit.org/show_bug.cgi?id=221094 Reviewed by Per Arne Vollan. WebProcess::updateProcessName should initiate network process connection if none exists, instead of giving up and returning early in this case. Same policy applies to WebProcess::updateActivePages. This is a follow-up to: https://trac.webkit.org/changeset/271897/webkit * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateActivePages): 2021-01-28 Martin Robinson Make closestSnapOffset a method on ScrollSnapOffsetsInfo https://bugs.webkit.org/show_bug.cgi?id=221030 Reviewed by Simon Fraser. Make closestSnapOffset a method and change all call sites to use the new method. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling const): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): 2021-01-28 Per Arne [macOS] Crash when updating color preferences https://bugs.webkit.org/show_bug.cgi?id=221088 Reviewed by Brent Fulgham. After r271965, the WebContent process is no longer allowed to connect to the Launch Services daemon. This introduced a crash in the WebContent process when color preferences were changed in System Preferences, since AppKit will then attempt to set application information with Launch Services, which causes a crash when that fails. This patch addresses this issue by overriding the AppKit method that updates the specific application information with Launch Services, since updating this information should be required in the WebContent process. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::updateCanQuitQuietlyAndSafely): (WebKit::WebProcess::platformInitializeWebProcess): 2021-01-28 Brent Fulgham [macOS] Remove reference to deprecated SubmitDiagInfo.domains path https://bugs.webkit.org/show_bug.cgi?id=221056 Reviewed by Per Arne Vollan. macOS does not use SubmitDiagInfo.domains anymore, and even when it did it failed safely. There's no reason to have this access in any of our sandboxes, and we should remove it. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2021-01-28 Per Arne [macOS] Remove access to com.apple.BluetoothServices https://bugs.webkit.org/show_bug.cgi?id=221059 Reviewed by Alex Christensen. Remove access to com.apple.BluetoothServices in the WebContent sandbox on macOS, since there are no reports of this being used. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2021-01-28 Carlos Garcia Campos [SOUP] Stop using SoupRequest API in preparation for libsoup3 https://bugs.webkit.org/show_bug.cgi?id=220764 Reviewed by Adrian Perez de Castro. It's gone in libsoup3, we can just use soup_session_send_async() instead, which is what SoupRequest does internally. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::createRequest): Manually create the SoupMessage. Also connect to content-sniffed signal that it was handled by SoupRequest internally. (WebKit::NetworkDataTaskSoup::clearRequest): Remove the SoupRequest reset and clear m_sniffedContentType. (WebKit::NetworkDataTaskSoup::resume): Use soup_session_send_async(). We need to know the message for passed to the function from the async ready callback, so we use a struct to pass both the task and the message. In case of being suspended the struct was attached to the pending result. (WebKit::NetworkDataTaskSoup::sendRequestCallback): Finish the soup_session_send_async() operation. (WebKit::NetworkDataTaskSoup::didSendRequest): Set the sniffed content type from m_sniffedContentType. (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate): Use SoupMessage instead of SoupRequest to get the URI. (WebKit::NetworkDataTaskSoup::didSniffContentCallback): Build the sniffed content type and call didSniffContent(). (WebKit::NetworkDataTaskSoup::didSniffContent): Save the passed content type. (WebKit::NetworkDataTaskSoup::continueAuthenticate): Use m_currentRequest instead of the SoupRequest to build the authentication error. (WebKit::NetworkDataTaskSoup::skipInputStreamForRedirectionCallback): Pass the failing URL to the ResourceError constructor. (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Ditto. (WebKit::NetworkDataTaskSoup::readCallback): Ditto. (WebKit::NetworkDataTaskSoup::requestNextPartCallback): Ditto. * NetworkProcess/soup/NetworkDataTaskSoup.h: * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: Stop setting the initiating page ID in the request because it's unused. 2021-01-28 Carlos Garcia Campos Load data URLs in the web process also for synchronous loads https://bugs.webkit.org/show_bug.cgi?id=220981 Reviewed by Adrian Perez de Castro. In r271879 I removed the support for data URLs in the network process for soup, assuming data URLs were always loaded from the web process, but that's not the case for synchronous loads. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::createRequest): Schedule an error if URL is not file or HTTP family. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::loadDataURLSynchronously): Helper to load a Data URL synchronously. (WebKit::WebLoaderStrategy::loadResourceSynchronously): Call loadDataURLSynchronously for data URLs. * WebProcess/Network/WebLoaderStrategy.h: 2021-01-27 Devin Rousso [iOS] add accessibility image extraction contextmenu item for revealing images https://bugs.webkit.org/show_bug.cgi?id=221058 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/_WKElementAction.h: * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): (+[_WKElementAction imageForElementActionType:]): (elementActionTypeToUIActionIdentifier): (uiActionIdentifierToElementActionType): * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant defaultActionsForLinkSheet:]): (-[WKActionSheetAssistant defaultActionsForImageSheet:]): (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): * Configurations/WebKit.xcconfig: Link UniformTypeIdentifiers.framework for use in WebKitAdditions. 2021-01-27 Chris Dumez [GPUProcess] Move ownership of RingBuffer backing used by RemoteAudioSourceProviderManager::RemoteAudio to WebProcess https://bugs.webkit.org/show_bug.cgi?id=221048 Reviewed by Geoffrey Garen. Move ownership of RingBuffer backing used by RemoteAudioSourceProviderManager::RemoteAudio from the GPUProcess to WebProcess, for jetsam purposes. This moves half a megabyte of memory from the GPUProcess to the WebProcess on https://foobar404.github.io/Wave.js. * Platform/SharedMemory.cpp: (WebKit::SharedMemory::Handle::takeOwnershipOfMemory const): * Platform/SharedMemory.h: Add takeOwnershipOfMemory() API to SharedMemory::Handle to take ownership of memory and assign it to a particular memory ledger, via mach_memory_entry_ownership(). * Platform/cocoa/SharedMemoryCocoa.cpp: (WebKit::toVMMemoryLedger): (WebKit::SharedMemory::Handle::takeOwnershipOfMemory const): Add implementation to take ownership of memory when given a mach port. (WebKit::SharedMemory::allocate): Add VM_FLAGS_PURGABLE flag when calling mach_vm_allocate() so that memory ownership can be transferred later on. (WebKit::makeMemoryEntry): First try to call mach_make_memory_entry_64() without the MAP_MEM_VM_SHARE flag since this flag prevents transfer of the memory ownership via mach_memory_entry_ownership(). If this fails, we try again with the MAP_MEM_VM_SHARE flag, to be safe. MAP_MEM_VM_SHARE allows the memory entry to cover any virtual range, possibly backed by multiple VM objects. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: Tweak the sandbox to allow the WebProcess to call mach_memory_entry_ownership(). * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage): Take ownership of RingBuffer backing memory. 2021-01-27 Brent Fulgham [iOS] Conditionalize debugging support on internal builds https://bugs.webkit.org/show_bug.cgi?id=221053 Reviewed by Per Arne Vollan. We should restrict use of the (debugging-support) rules in our iOS sandboxes to internal OS, since those features are not accessible to production users. Since these restrictions don't impact end user debugging use cases, we'll also rename the rules to "internal-debugging-support". * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-01-27 Kate Cheney WKWebView closeAllMediaPresentations API does not have a completion handler https://bugs.webkit.org/show_bug.cgi?id=220741 Reviewed by Youenn Fablet. Adds a completion handler to WKWebView closeAllMediaPresentations. This required handling the case for video fullscreen, picture-in-picture, and element fullscreen. Closing fullscreen requires multiple async operations, some of which go out of WebKit scope like PIPViewControllerDelegate functions, so for simplicity, the callbacks are stored in the respective *FullscreenManagerProxy object and called when didExitFullscreen() is executed. Any additional calls to closeAllMediaPresentations made before the previous has finished will have their callbacks appended to a vector and called when all presentations have closed. * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView closeAllMediaPresentations:]): (-[WKWebView _closeAllMediaPresentations]): (-[WKWebView _allMediaPresentationsClosed]): New SPI for testing. Previously these tests used JavaScript to check for inline video but updating the JS value is async and may not be completed by the time didExitFullscreen() is called. So, this SPI will help avoid flakiness. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenModelContext::requestFullscreenModeWithCallback): (WebKit::VideoFullscreenManagerProxy::~VideoFullscreenManagerProxy): (WebKit::VideoFullscreenManagerProxy::forEachSession): (WebKit::VideoFullscreenManagerProxy::callCloseCompletionHandlers): (WebKit::VideoFullscreenManagerProxy::requestFullscreenModeWithCallback): (WebKit::VideoFullscreenManagerProxy::didExitFullscreen): Add a new requestFullscreenModeWithCallback function for VideoFullscreenModelContext which is used when closing fullscreen video. This way we don't need to adjust an overridden function. * UIProcess/WebFullScreenManagerProxy.cpp: (WebKit::WebFullScreenManagerProxy::~WebFullScreenManagerProxy): (WebKit::WebFullScreenManagerProxy::callCloseCompletionHandlers): (WebKit::WebFullScreenManagerProxy::closeWithCallback): (WebKit::WebFullScreenManagerProxy::didExitFullScreen): * UIProcess/WebFullScreenManagerProxy.h: Ditto, create a new function here to be used only for closing media presentations so we don't have to pass empty completion handlers unnecessarily. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::pauseAllMediaPlayback): (WebKit::WebPageProxy::suspendAllMediaPlayback): (WebKit::WebPageProxy::resumeAllMediaPlayback): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::pauseAllMediaPlayback): (WebKit::WebPage::suspendAllMediaPlayback): (WebKit::WebPage::resumeAllMediaPlayback): * WebProcess/WebPage/WebPage.h: Remove unnecessary voids. 2021-01-27 Devin Rousso [iOS] expose existing macOS-only `-[WKWebView _pageExtendedBackgroundColor]` SPI https://bugs.webkit.org/show_bug.cgi?id=221015 Reviewed by Tim Horton. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::pageExtendedBackgroundColorDidChange): * UIProcess/PageClient.h: (WebKit::PageClient::pageExtendedBackgroundColorWillChange): Added. (WebKit::PageClient::pageExtendedBackgroundColorDidChange): Added. * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::pageExtendedBackgroundColorWillChange): Added. (WebKit::PageClientImplCocoa::pageExtendedBackgroundColorDidChange): Added. Add support for ObjC KVO of `-[WKWebView _themeColor]`. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::pageExtendedBackgroundColorDidChange): Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::willCommitLayerTree): (WebKit::WebPage::flushPendingPageExtendedBackgroundColorChange): Added. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::pageExtendedBackgroundColorDidChange const): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): On macOS, instead of messaging the UIProcess as soon as changes happen, keep a flag of whether the `pageExtendedBackgroundColor` has changed and use it when updating rendering so that change messages are kept in sync (e.g. modifying ``). * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _pageExtendedBackgroundColor]): Added. * UIProcess/API/mac/WKWebViewMac.mm: (-[WKWebView _pageExtendedBackgroundColor]): Deleted. 2021-01-27 Per Arne [macOS] Remove CFPBS access in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=221000 Reviewed by Brent Fulgham. Remove CFPBS access in the WebContent process on macOS, since there are no reports of this being used. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-27 Per Arne [macOS] Re-enable ENABLE_SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS https://bugs.webkit.org/show_bug.cgi?id=221039 Reviewed by Brent Fulgham. Work around crash introduced in r271907, by disabling persistent UI. Having persistent UI enabled will exercise code which tries to connect with the Launch Services daemon, and crash if that fails. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2021-01-27 Per Arne [iOS] Fix sandbox violation file-read-data /dev/dtracehelper in the Networking process https://bugs.webkit.org/show_bug.cgi?id=221046 Reviewed by Brent Fulgham. Reading this file should be allowed in the Networking process on internal installs on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2021-01-27 Per Arne [macOS] WebContent sandbox regex incorrect https://bugs.webkit.org/show_bug.cgi?id=221045 Reviewed by Brent Fulgham. When the regex is intended to match the character '.', the pattern '\.' should be used. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-27 Per Arne [macOS] Tighten IOUSB access when camera is enabled https://bugs.webkit.org/show_bug.cgi?id=221042 Reviewed by Brent Fulgham. Tighten IOUSB access when camera is enabled in the WebContent process on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-27 Per Arne [macOS] Remove shm-write access to com.apple.AppleDatabaseChanged https://bugs.webkit.org/show_bug.cgi?id=221041 Reviewed by Brent Fulgham. Remove shm-write access to com.apple.AppleDatabaseChanged in the WebContent process on maOS, since there are no reports of this being used. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-27 Per Arne [macOS] Enforce IOKit message filtering https://bugs.webkit.org/show_bug.cgi?id=221038 Reviewed by Brent Fulgham. Update IOKit message filters based on telemetry, and deny messages not observed being used. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-27 Per Arne [macOS] Remove fsctl-command in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=221002 Reviewed by Brent Fulgham. Remove fsctl-command in the WebContent process on macOS, since there are no reports of this being used. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-27 Commit Queue Unreviewed, reverting r271940. https://bugs.webkit.org/show_bug.cgi?id=221040 Some tests are failing on bots Reverted changeset: "[MacOS] Enable NSURLSession WebSocket code path in WebKitTestRunner" https://bugs.webkit.org/show_bug.cgi?id=220973 https://trac.webkit.org/changeset/271940 2021-01-27 Per Arne Restrict access to syslog in sandbox https://bugs.webkit.org/show_bug.cgi?id=220983 Reviewed by Brent Fulgham. Only allow syslog access on internal builds on macOS and iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-01-27 Antti Koivisto Implement visibility based resource load scheduling for low priority resources https://bugs.webkit.org/show_bug.cgi?id=220728 Reviewed by Geoff Garen. Add a simple network process side resource load scheduler. When active it limits the number of low priority resource loads (mostly images) that are passed to network layer. The current limit is 6 per host, reduced by any ongoing higher priority loads. This reduces impact of low priority loads to higher priority ones, espcially on HTTP/2. The scheduler also supports reprioritizing loads. This is used to let images currently in the viewport to skip the queue and start their loads faster. The feature is not enabled in this patch. * NetworkProcess/Downloads/Download.cpp: (WebKit::Download::cancel): (WebKit::Download::didReceiveData): (WebKit::Download::didFinish): (WebKit::Download::didFail): * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::clearPageSpecificData): (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame): (WebKit::NetworkConnectionToWebProcess::setResourceLoadSchedulingMode): (WebKit::NetworkConnectionToWebProcess::prioritizeResourceLoads): (WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics): Deleted. Rename to clearPageSpecificData and move out of #if. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::start): (WebKit::NetworkLoad::startWithScheduling): (WebKit::NetworkLoad::~NetworkLoad): (WebKit::NetworkLoad::didCompleteWithError): * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkLoadScheduler.cpp: Added. (WebKit::NetworkLoadScheduler::HostContext::schedule): (WebKit::NetworkLoadScheduler::HostContext::unschedule): (WebKit::NetworkLoadScheduler::HostContext::prioritize): (WebKit::NetworkLoadScheduler::HostContext::start): (WebKit::NetworkLoadScheduler::HostContext::~HostContext): (WebKit::NetworkLoadScheduler::schedule): (WebKit::NetworkLoadScheduler::unschedule): (WebKit::NetworkLoadScheduler::setResourceLoadSchedulingMode): (WebKit::NetworkLoadScheduler::prioritizeLoads): (WebKit::NetworkLoadScheduler::clearPageData): (WebKit::NetworkLoadScheduler::contextForLoad): * NetworkProcess/NetworkLoadScheduler.h: Copied from Source/WebCore/loader/LoaderStrategy.cpp. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::startNetworkLoad): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::networkLoadScheduler): * NetworkProcess/NetworkSession.h: * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp: (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad): * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::setResourceLoadSchedulingMode): (WebKit::WebLoaderStrategy::prioritizeResourceLoads): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): 2021-01-27 Youenn Fablet [MacOS] Enable NSURLSession WebSocket code path in WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=220973 Reviewed by Darin Adler. Disable a debug assert unti it get fixed below. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:webSocketTask:didCloseWithCode:reason:]): 2021-01-27 Andy Estes [Mac] MediaSampleCursor::stepInOrderedMap can hang when stepping to the end of a track that hasn't been fully parsed https://bugs.webkit.org/show_bug.cgi?id=220555 Reviewed by Eric Carlson. When a container has multiple tracks, CoreMedia determines the overall duration by creating a cursor at a presentation time of +infinity then asking for its timing info, the expectation being that the cursor will clamp itself to the track duration and report that in MediaSampleCursor::getSampleTiming. Previously, this could result in a hang for tracks that had not yet finished parsing, as MediaSampleCursor was designed to wait for samples outside the playable range. With this change, MediaSampleCursor no longer waits for samples outside the playable range but rather reports clamped timing info without waiting for a sample. If CoreMedia asks for information that requires a sample (e.g., sample location), MediaSampleCursor will respond with `kMTPluginSampleCursorError_LocationNotAvailable`. So that CoreMedia can determine the range of playable samples, this patch implements MediaSampleCursor::getPlayableHorizon. To simplify this implementation, MediaSampleCursor now assumes that decode time equals presentation time (for video tracks) or is invalid (for audio tracks). While here, also added media logging that helped debug this issue. Test: http/tests/media/video-canplaythrough-webm.html * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): Asserted our assmpution about the relationship between presentation time and decode time. * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::assumedDecodeTime): Added to compute decode time from presentation time and a nominal sample. (WebKit::upperBound): Changed to compute the decode key based on assumed decode time. (WebKit::stepIterator): Removed the MediaTime specialization. (WebKit::stepTime): Added to step a MediaTime rather than an iterator. (WebKit::MediaSampleCursor::MediaSampleCursor): Initialized logging. (WebKit::MediaSampleCursor::locateIterator const): Changed to find an iterator based on presentation time and assumed decode time. (WebKit::MediaSampleCursor::locateMediaSample const): Ditto. (WebKit::MediaSampleCursor::locateTiming const): Added to locate timing info even if no sample is available. (WebKit::MediaSampleCursor::stepInOrderedMap): Changed to call getSampleMap, and removed the MediaTime specialization. (WebKit::MediaSampleCursor::stepInPresentationTime): Added to replace the MediaTime specialization of stepInOrderedMap. (WebKit::MediaSampleCursor::getSampleMap const): Added to call MediaTrackReader::waitForSample and return as soon as at least one sample is available. Returns kMTPluginSampleCursorError_NoSamples if the track finishes parsing with no samples. (WebKit::MediaSampleCursor::getMediaSample const): Changed to call getSampleMap. (WebKit::MediaSampleCursor::getTiming const): Added to get timing info. (WebKit::MediaSampleCursor::copyProperty): Added logging. (WebKit::MediaSampleCursor::stepInDecodeOrderAndReportStepsTaken): Changed to call the new version of stepInOrderedMap. (WebKit::MediaSampleCursor::stepInPresentationOrderAndReportStepsTaken): Ditto. (WebKit::MediaSampleCursor::stepByDecodeTime): Changed to call stepInPresentationTime. (WebKit::MediaSampleCursor::stepByPresentationTime): Ditto. (WebKit::MediaSampleCursor::compareInDecodeOrder const): Changed to call getTiming. (WebKit::MediaSampleCursor::getSampleTiming const): Ditto. (WebKit::MediaSampleCursor::getPlayableHorizon const): Implemented by taking the difference between the last sample's end time and the cursor's presentation time. (WebKit::MediaSampleCursor::logChannel const): Added. (WebKit::makeIterator): Deleted. (WebKit::makeTime): Deleted. (WebKit::MediaSampleCursor::createAtDecodedSample): Deleted. * Shared/mac/MediaFormatReader/MediaSampleCursor.h: (WebKit::MediaSampleCursor::logger const): Configured logging. (WebKit::MediaSampleCursor::logClassName const): Ditto. (WebKit::MediaSampleCursor::logIdentifier const): Ditto. * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: (WebKit::MediaTrackReader::mediaTypeString const): Ditto. (WebKit::MediaTrackReader::nextSampleCursorLogIdentifier const): Ditto. * Shared/mac/MediaFormatReader/MediaTrackReader.h: 2021-01-27 Martin Robinson Use ScrollSnapOffsetsInfo in the scrolling tree https://bugs.webkit.org/show_bug.cgi?id=220915 Reviewed by Simon Fraser. Use ScrollSnapOffsets more often in the scrolling tree to continue to abstract away the details of how snap offsets are implemented. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder>::encode): (ArgumentCoder>::decode): (WebKit::dump): * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::shouldSnapForMainFrameScrolling const): (WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling const): (WebKit::RemoteScrollingCoordinatorProxy::hasActiveSnapPoint const): (WebKit::RemoteScrollingCoordinatorProxy::nearestActiveContentInsetAdjustedSnapOffset const): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): 2021-01-26 Sihui Liu Mute audio capture for speech recognition based on shouldInterruptAudioOnPageVisibilityChange when page is invisible https://bugs.webkit.org/show_bug.cgi?id=220960 Reviewed by Youenn Fablet. We used to abort ongoing recognition when page becomes invisible. To match media capture's behavior, now we only abort recognition when shouldInterruptAudioOnPageVisibilityChange is true. Updated API test: WebKit2.SpeechRecognitionPageBecomesInvisible * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::abortForPageIsBecomingInvisible): Deleted. * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::pageIsBecomingInvisible): 2021-01-26 Devin Rousso Expose the value of `` as SPI https://bugs.webkit.org/show_bug.cgi?id=220944 Reviewed by Tim Horton. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::themeColorChanged): Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::willCommitLayerTree): (WebKit::WebPage::didCommitLoad): (WebKit::WebPage::flushPendingThemeColorChange): Added. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::themeColorChanged const): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): * UIProcess/WebPageProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::themeColorChanged): Added. On macOS, keep a flag indicating whether the `themeColor` has changed. Use this flag when updating rendering to send the `Color` to the UIProcess so that it's kept in sync with other changes (e.g. modifying the CSS `background-color`). * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: (WebKit::RemoteLayerTreeTransaction::themeColor const): Added. (WebKit::RemoteLayerTreeTransaction::setThemeColor): Added. * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::encode const): (WebKit::RemoteLayerTreeTransaction::decode): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): On iOS, include the `themeColor` in every `RemoteLayerTreeTransaction` so that it's kept in sync with other changes (e.g. modifying the CSS `background-color`). * UIProcess/PageClient.h: (WebKit::PageClient::themeColorWillChange): Added. (WebKit::PageClient::themeColorDidChange): Added. * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::themeColorWillChange): Added. (WebKit::PageClientImplCocoa::themeColorDidChange): Added. Add support for ObjC KVO of `-[WKWebView _themeColor]`. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::themeColor const): Added. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _themeColor]): Added. 2021-01-26 Brent Fulgham IPC::Decoder constructor should mark the Decoder as invalid if header decoding fails https://bugs.webkit.org/show_bug.cgi?id=220990 Reviewed by Darin Adler. Mark the decoder as invalid if any of the decode operations fail, not just the first one. * Platform/IPC/Decoder.cpp: 2021-01-26 Brent Fulgham Harden NetworkProcess against integer overflow in CacheStorageEngine size calculation https://bugs.webkit.org/show_bug.cgi?id=220997 Reviewed by Youenn Fablet. Since the CacheStorage allocation is based on data provided by the WebContent process, we should check for integer overflow before making an allocation. * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::put): Use checked arithmetic and return a failure if we overflow. 2021-01-26 Per Arne [macOS] Deny mach-lookup to the service 'com.apple.tccd.system' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=220976 Reviewed by Brent Fulgham. Deny mach-lookup to the service 'com.apple.tccd.system' in the WebContent process, since there are no longer reports of this being used. No new tests, since the result will depend on OS version. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-26 Chris Dumez Disable TBA availability macro post-processing on iOS 14 / macOS 11 https://bugs.webkit.org/show_bug.cgi?id=221004 Reviewed by Tim Horton. Disable TBA availability macro post-processing on iOS 14 / macOS 11, now that TBA headers have been updated in r271813. * Configurations/WebKit.xcconfig: * Configurations/WebKitTargetConditionals.xcconfig: 2021-01-26 Per Arne [macOS] Close all XPC connections to Launch Services after checking in https://bugs.webkit.org/show_bug.cgi?id=220952 Reviewed by Brent Fulgham. After checking in with Launch Services on macOS, close all open XPC connections to the service. This patch also adds checks for a valid Network process connection when updating the WebContent process' information. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateActivePages): 2021-01-26 Per Arne [macOS] Add local sandbox reporting for access to Metal services in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=220986 Reviewed by Brent Fulgham. To determine if these services are still used in the WebContent process when the GPU process is enabled, add local sandbox reporting for access to Metal services. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-26 Brent Fulgham REGRESSION(r261238): WKWebView crashes on launch inside a quicklook preview https://bugs.webkit.org/show_bug.cgi?id=219632 Reviewed by Alexey Proskuryakov. Partially revert r261238 to allow applications without access to 'nsurlsessiond' to still be able to use WebKit for local file access. This workaround should be removed once we complete the work needed to support true offline WebKit use. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::checkEntitlements): Add an early return if the application possesses the 'com.apple.security.network.client' entitlement. 2021-01-26 Per Arne [macOS] Restrict process-info in sandbox https://bugs.webkit.org/show_bug.cgi?id=220985 Reviewed by Brent Fulgham. Access to process-info should be restricted to self. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-26 Per Arne [macOS] Deny mach-lookup to the service 'com.apple.audio.SandboxHelper' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=220978 Reviewed by Brent Fulgham. Deny mach-lookup to the service 'com.apple.audio.SandboxHelper' in the WebContent process. Access to this service is only allowed by extension if Media is running in the WebContent process. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-26 Per Arne [macOS] Restrict access to OpenGL profiler https://bugs.webkit.org/show_bug.cgi?id=220980 Reviewed by Brent Fulgham. Only allow the OpenGL profiler to attach on internal installs. * WebProcess/com.apple.WebProcess.sb.in: 2021-01-26 Brent Fulgham [CoreIPC] Add size check in decodeSharedBuffer to allow it to be validated against the SharedMemory received https://bugs.webkit.org/show_bug.cgi?id=220962 Reviewed by Darin Adler. Add a new check during decoding so that we fail if the expected buffer size is larger than the block of shared memory supplied in the IPC call. * Shared/WebCoreArgumentCoders.cpp: (IPC::decodeSharedBuffer): 2021-01-26 Alex Christensen Revert part of r271493 https://bugs.webkit.org/show_bug.cgi?id=220066 We have an internal app that calls registerSchemeForCustomProtocol on a non-main thread before WebKit initializes. While this is a problem, we have to not crash on launch until they fix this. * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (+[WKBrowsingContextController registerSchemeForCustomProtocol:]): (+[WKBrowsingContextController unregisterSchemeForCustomProtocol:]): 2021-01-26 Per Arne [GPU process][macOS] Only allow access to diagnostic services for internal builds https://bugs.webkit.org/show_bug.cgi?id=220957 Reviewed by Brent Fulgham. This patch also removes access to an unused logging service. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: 2021-01-26 Chris Dumez Unreviewed, silence deprecation warning for our own API to address build issues. * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: 2021-01-26 Chris Dumez Unreviewed, reverting r271882. Broke the build Reverted changeset: "Unreviewed, silence deprecation warning for our own API to address build issues." https://trac.webkit.org/changeset/271882 2021-01-26 Chris Dumez Unreviewed, silence deprecation warning for our own API to address build issues. * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: 2021-01-26 Kimmo Kinnunen WebGL power preference and discrete/internal gpu selection implemented incorrectly with ANGLE https://bugs.webkit.org/show_bug.cgi?id=220843 Reviewed by Dean Jackson. Move the high-performance GPU shutdown timer from individual web processes to the main class in the ui process. This simplifies the implementation and reduces the number of timers. * UIProcess/mac/HighPerformanceGPUManager.h: * UIProcess/mac/HighPerformanceGPUManager.mm: (WebKit::HighPerformanceGPUManager::HighPerformanceGPUManager): (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::updateState): * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp: (WebKit::WebSwitchingGPUClient::requestHighPerformanceGPU): (WebKit::WebSwitchingGPUClient::releaseHighPerformanceGPU): * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h: 2021-01-26 Carlos Garcia Campos [SOUP] Stop using SoupRequest API to load files in preparation for libsoup3 https://bugs.webkit.org/show_bug.cgi?id=220509 Reviewed by Adrian Perez de Castro. SoupRequest API is gone in libsoup3 and there's no replacement for file requests. GResource and data URI loads already happen in the web process so we only need to care about file and directory loads. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::createRequest): Create a GFile for local files. (WebKit::NetworkDataTaskSoup::clearRequest): Clear the m_file. (WebKit::NetworkDataTaskSoup::resume): Check also if there's a file operation to resume. (WebKit::NetworkDataTaskSoup::didSendRequest): We always have a soup message now here because SoupRequest is only used for HTTP. (WebKit::NetworkDataTaskSoup::readCallback): In case of failure check if this is an HTTP or file request to create the error. (WebKit::NetworkDataTaskSoup::fileQueryInfoCallback): Call didGetFileInfo() and continue reading the file or directory. (WebKit::NetworkDataTaskSoup::didGetFileInfo): Set URL, content type and length of the response for the given GFileInfo. (WebKit::NetworkDataTaskSoup::readFileCallback): Complete the g_file_read_async operation. (WebKit::NetworkDataTaskSoup::enumerateFileChildrenCallback): Create a WebKitDirectoryInputStream. (WebKit::NetworkDataTaskSoup::didReadFile): Set the input stream and notify the response is ready. * NetworkProcess/soup/NetworkDataTaskSoup.h: * NetworkProcess/soup/Resources/directory.css: Added. * NetworkProcess/soup/Resources/directory.js: Added. * NetworkProcess/soup/WebKitDirectoryInputStream.cpp: Added. (webkitDirectoryInputStreamCreateHeader): (webkitDirectoryInputStreamCreateFooter): (webkitDirectoryInputStreamCreateRow): (webkitDirectoryInputStreamReadNextFile): (webkitDirectoryInputStreamRead): (webkitDirectoryInputStreamClose): (webkit_directory_input_stream_class_init): (webkitDirectoryInputStreamNew): * NetworkProcess/soup/WebKitDirectoryInputStream.h: Added. * PlatformGTK.cmake: * PlatformWPE.cmake: * SourcesGTK.txt: * SourcesWPE.txt: 2021-01-25 Alexey Shvayka REGRESSION (r270874): Some React Native apps are reported broken on iOS https://bugs.webkit.org/show_bug.cgi?id=220809 Reviewed by Saam Barati. * WebProcess/Plugins/Netscape/JSNPObject.h: 2021-01-25 Chris Dumez Unreviewed, add missing header includes to address build issues. * UIProcess/API/Cocoa/WKUserScript.mm: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: * UIProcess/Cocoa/AutomationClient.mm: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: 2021-01-25 Devin Rousso [iOS] improve support for sequential scribble interactions that involving different inputs https://bugs.webkit.org/show_bug.cgi?id=220933 Reviewed by Tim Horton. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView becomeFirstResponderForWebView]): (-[WKContentView _zoomToRevealFocusedElement]): (-[WKContentView _didCommitLoadForMainFrame]): (-[WKContentView _willBeginTextInteractionInTextInputContext:]): (-[WKContentView _didFinishTextInteractionInTextInputContext:]): Rather than have a simple "yes/no" `_textInteractionIsHappening` we should keep a count of scribble interactions (increment in `willBegin*` and decrement in `didFinish*`) so that we don't send unnecessary/incorrect IPC to the WebProcess after the first scribble commits if there's a second scribble in progress for another element. 2021-01-25 Aditya Keerthi [iOS] Obscured elements should not be focusable using the accessory bar https://bugs.webkit.org/show_bug.cgi?id=220929 Reviewed by Tim Horton. Currently, assistable elements hidden behind unassistable elements can be focused using the next/previous buttons on the accessory bar. This behavior is undesirable since users cannot see the focused element, but are still presented UI to enter information into the element. While the current behavior has been longstanding, its undesirability was exposed after r269059, which made it possible to use the accessory bar to focus elements across focusable scopes. As a result, it became possible to focus a hidden input field on appleid.apple.com using the accessory bar. Note that the hidden field is inside a subframe, which was previously excluded from accessory bar next/previous operations. However, the same bug would still exist even if the field was not inside a subframe, which means that r269059 is not the root cause of the issue, but simply exposed a larger underlying problem. To prevent obscured elements from being focusable using the accessory bar, we now use hit testing to determine whether or not an element is obscured, before considering the element "assistable". Test: fast/forms/ios/accessory-bar-navigation-obscured-input.html * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::isObscuredElement): An element is considered obscured if a hit test at its center position relative to the main document targets a different element. (WebKit::nextAssistableElement): Obscured elements should not be assistable. 2021-01-25 Per Arne [macOS] Create extension to Metal compiler service based on GPUP flags https://bugs.webkit.org/show_bug.cgi?id=220931 Reviewed by Brent Fulgham. Depending on which GPUP settings are enabled, an extension to the Metal compiler service should be created. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::gpuMachServices): (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/com.apple.WebProcess.sb.in: 2021-01-25 Per Arne Vollan [macOS] Restrict access to dtracehelper https://bugs.webkit.org/show_bug.cgi?id=220927 Reviewed by Brent Fulgham. Only allow access to dtracehelper for internal installs. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2021-01-25 Chris Dumez Update availability annotations to match the macOS 11.0 and iOS 14.0 GM SDKs https://bugs.webkit.org/show_bug.cgi?id=220874 Reviewed by Darin Adler. * UIProcess/API/Cocoa/WKContentWorld.h: * UIProcess/API/Cocoa/WKError.h: * UIProcess/API/Cocoa/WKFindConfiguration.h: * UIProcess/API/Cocoa/WKFindResult.h: * UIProcess/API/Cocoa/WKFrameInfoPrivate.h: * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h: * UIProcess/API/Cocoa/WKPDFConfiguration.h: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKScriptMessage.h: * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h: * UIProcess/API/Cocoa/WKUserContentController.h: * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: * UIProcess/API/Cocoa/WKUserScript.h: * UIProcess/API/Cocoa/WKUserScriptPrivate.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebpagePreferences.h: * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKFrameTreeNode.h: * UIProcess/API/Cocoa/_WKInputDelegate.h: * UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKResourceLoadDelegate.h: * UIProcess/API/Cocoa/_WKResourceLoadInfo.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.h: * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.h: * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h: * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.h: * UIProcess/API/Cocoa/_WKTextManipulationItem.h: * UIProcess/API/Cocoa/_WKTextManipulationToken.h: * UIProcess/API/Cocoa/_WKUserContentWorld.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsitePolicies.h: 2021-01-25 Chris Dumez [iOS] Stop leaking an XPC boost message to XPC services https://bugs.webkit.org/show_bug.cgi?id=220883 Reviewed by Geoffrey Garen. Turn on RB_full_manage_WK_jetsam feature flag so that we stop leaking an XPC boost message to XPC services on IOS_FAMILY. Instead, RunningBoard will now be setting the priority of our XPC services based on the RunningBoard assertions we're holding for them. The feature flag is checked both by RunningBoard and WebKit. I have verified that our bots have upgraded to a build that supports this. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-watchos.plist: 2021-01-25 Per Arne [macOS] Restrict access to mds data https://bugs.webkit.org/show_bug.cgi?id=220920 Reviewed by Brent Fulgham. Only root show have write access. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2021-01-25 Per Arne [Cocoa] Adjust logic for creating sandbox extensions based on GPUP flags https://bugs.webkit.org/show_bug.cgi?id=220917 Reviewed by Brent Fulgham. Update which GPUP flag should be used in this logic. This patch also includes many IOKit classes on macOS in the set of classes that should be extended when the appropriate GPU flags are set. In the case they are not being extended, logging rules have been added in the sandbox, to determine if they are being used in that case. * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): (WebKit::WebPageProxy::creationParameters): * WebProcess/com.apple.WebProcess.sb.in: 2021-01-25 Chris Dumez Support AbortSignal in addEventListenerOptions to unsubscribe from events https://bugs.webkit.org/show_bug.cgi?id=218753 Reviewed by Darin Adler. Minor build fixes. * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: 2021-01-25 Wenson Hsieh [GPU Process] Web process should be terminated if DisplayListReaderHandle advances past 0 https://bugs.webkit.org/show_bug.cgi?id=220926 Reviewed by Simon Fraser. Address another FIXME in the GPU Process by replacing a release assertion with a MESSAGE_CHECK. See below for more details. * GPUProcess/graphics/DisplayListReaderHandle.cpp: (WebKit::DisplayListReaderHandle::advance): Return `WTF::nullopt` instead of just crashing in the case where the number of bytes to advance exceeds the number of unread bytes. This can (and should) only happen in the case where a compromised web content process attempts to overwrite the number of unread bytes in the shared display list header. * GPUProcess/graphics/DisplayListReaderHandle.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): * Shared/SharedDisplayListHandle.h: Remove this virtual method from the base class, since the reader handle now returns an `Optional` instead of just a `size_t`. * WebProcess/GPU/graphics/DisplayListWriterHandle.h: 2021-01-24 Simon Fraser [iOS WK2] theverge.com - rubber band scrolling at the top of the page causes an abrupt jump https://bugs.webkit.org/show_bug.cgi?id=220886 Reviewed by Sam Weinig. theverge.com on iOS is a page that has long main thread stalls with forced layouts on a timer that alter the page height; this caused the post-layout updateScrollbars() called from FrameView::adjustViewSize() to call scrollToPosition() after adjusting the scroll position to the allowed range. If the page laid out while rubberbanding was happening, the current scroll position would be negative, then clamped to 0, then sent to the UI process as a requested scroll to 0, triggering the jump to top in the UI process. There's existing code to prevent this from happening if we know that rubberbanding is happening; this patch makes isRubberBandInProgress() work for iOS WK2. It does so by having updateVisibleContentRects() push information about rubberbanding nodes onto RemoteScrollingCoordinator. We remove an unnecessary shouldUpdateScrollLayerPositionSynchronously() check in FrameView::isRubberBandInProgress() - if it's true, then the scrolling coordinator won't see any rubberbanding nodes anyway. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::addNodeWithActiveRubberBanding): (WebKit::RemoteScrollingCoordinator::removeNodeWithActiveRubberBanding): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): 2021-01-23 Per Arne Vollan [macOS] Deny mach lookup access to "com.apple.iconservices" in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=220013 Reviewed by Brent Fulgham. Deny mach lookup access to "com.apple.iconservices" in the WebContent process on macOS, since there are no longer any reports of this being used. Test: fast/sandbox/mac/sandbox-mach-lookup.html * WebProcess/com.apple.WebProcess.sb.in: 2021-01-23 Per Arne Vollan [macOS] Deny mach lookup access to "com.apple.iconservices.store" in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=220014 Reviewed by Brent Fulgham. Deny mach lookup access to "com.apple.iconservices.store" in the WebContent process on macOS, since there are no longer any reports of this being used. Test: fast/sandbox/mac/sandbox-mach-lookup.html * WebProcess/com.apple.WebProcess.sb.in: 2021-01-23 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.hiservices-xpcservice' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=220321 Reviewed by Darin Adler. Deny mach-lookup to the service 'com.apple.hiservices-xpcservice' in the WebContent process on macOS, since there are no longer any reports of this service being used. Test: fast/sandbox/mac/sandbox-mach-lookup.html * WebProcess/com.apple.WebProcess.sb.in: 2021-01-22 Wenson Hsieh The web process should be killed after failing to decode display list items in the GPU process https://bugs.webkit.org/show_bug.cgi?id=219097 Reviewed by Chris Dumez. Handle `StopReplayReason::InvalidItem` by terminating the web process via MESSAGE_CHECK. See below for more details. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveInvalidMessage): (WebKit::GPUConnectionToWebProcess::terminateWebProcess): * GPUProcess/GPUConnectionToWebProcess.h: Pull logic for terminating the web process out into a separate helper method on `GPUConnectionToWebProcess`, and use this helper in `GPUConnectionToWebProcess::didReceiveInvalidMessage`, as well as in `RemoteRenderingBackend` below. * GPUProcess/graphics/RemoteRenderingBackend.cpp: Add macro definitions for `MESSAGE_CHECK` and `MESSAGE_CHECK_WITH_RETURN_VALUE`. Since the methods on `RemoteRenderingBackend` that trigger message checks all run on a background queue, the normal (main-thread) way of defining these macros (`MESSAGE_CHECK_WITH_RETURN_VALUE_BASE` and `MESSAGE_CHECK_BASE`) don't work. We instead call into the GPU to web process connection object directly to send a `TerminateWebProcess` message to the parent (UI) process, and additionally log a given failure message. (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): Replace a number FIXMEs throughout these IPC message handlers with `MESSAGE_CHECK`s. Additionally, add a new `MESSAGE_CHECK` for the case where we stopped replay early due to a corrupted or invalid display list item. (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): Simply remove the FIXME and early return here; this can only happen in the case where a compromised web content process attempts to append redundant item buffer change items. However, doing so will either be (1) harmless, since the pending item buffer information will just be overwritten, or (2) result in hitting a MESSAGE_CHECK when decoding items if we try to execute the contents of another item buffer that has not been written to. (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * GPUProcess/graphics/RemoteRenderingBackend.h: 2021-01-22 Simon Fraser [iOS WK2] Make the "in stable state" bit in visible content rect updates more fine-grained https://bugs.webkit.org/show_bug.cgi?id=220875 Reviewed by Tim Horton. VisibleContentRectUpdateInfo contains a single "in stable state" bit, but in a future patch the web process will need to know if the UI process is rubberbanding. In addition, we can fold "isChangingObscuredInsetsInteractively" into the same state bits. So give VisibleContentRectUpdateInfo a OptionSet. To give the correct state for non-main UIScrollViews, have _scrollViewIsRubberBanding take the UIScrollView in question, and only include isChangingObscuredInsetsInteractively if the question is being asked of the main UIScrollView. * Shared/VisibleContentRectUpdateInfo.cpp: (WebKit::VisibleContentRectUpdateInfo::encode const): (WebKit::VisibleContentRectUpdateInfo::decode): (WebKit::operator<<): * Shared/VisibleContentRectUpdateInfo.h: (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo): (WebKit::VisibleContentRectUpdateInfo::inStableState const): (WebKit::VisibleContentRectUpdateInfo::viewStability const): (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize const): (WebKit::operator==): (WebKit::VisibleContentRectUpdateInfo::isChangingObscuredInsetsInteractively const): Deleted. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _didRelaunchProcess]): (-[WKWebView _scrollViewIsRubberBanding:]): (-[WKWebView _viewStabilityState:]): (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]): (-[WKWebView _updateVisibleContentRects]): (-[WKWebView _scrollViewIsRubberBanding]): Deleted. (-[WKWebView _scrollViewIsInStableState:]): Deleted. * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:viewStability:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::updateVisibleContentRects): 2021-01-22 Jiewen Tan [WebAuthn] No error is visible after user enters the incorrect PIN https://bugs.webkit.org/show_bug.cgi?id=220839 Reviewed by Brent Fulgham. To fix that, let's have a boolean to indicate the PIN entry UI has already been presented within this session. And then rely on the error UI to let users retry the PIN. Covered by manual tests. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::requestPin): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): Besides above, this patch also fixes some crashes. 2021-01-22 Jiewen Tan [WebAuthn] Should only check default browsers for the Modern WebAuthn https://bugs.webkit.org/show_bug.cgi?id=220840 Reviewed by Brent Fulgham. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): 2021-01-21 Peng Liu PiP video subtitles stop updating when Safari is backgrounded https://bugs.webkit.org/show_bug.cgi?id=220660 Reviewed by Darin Adler. Subtitles in the picture-in-picture window will stop updating when the browser is in the background because we freeze the layer tree when a browser is in the background. This patch fixes this issue by avoiding freezing the layer tree if a video is playing in picture-in-picture when the browser is in the background. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState): * WebProcess/cocoa/VideoFullscreenManager.h: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::videoInPictureInPicture const): (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): 2021-01-21 Alex Christensen Add experimental feature to use network loader https://bugs.webkit.org/show_bug.cgi?id=220521 Reviewed by Geoff Garen. Manually verified that the setting is correctly appearing in Safari and being given to CFNetwork. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::experimentalFeatureEnabled): (WebKit::WebsiteDataStore::http3Enabled): (WebKit::WebsiteDataStore::useNetworkLoader): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.h: 2021-01-21 Aditya Keerthi Unreviewed, reverting r271691. https://bugs.webkit.org/show_bug.cgi?id=220812 Introduced crash, and failing API tests. Reverted changeset: "[macOS] Titlebar separator doesn't show when WKWebView is scrolled" https://bugs.webkit.org/show_bug.cgi?id=220633 https://trac.webkit.org/changeset/271691 2021-01-21 Chris Dumez [GPUProcess][iOS] https://foobar404.github.io/Wave.js/#/ does not output any audio https://bugs.webkit.org/show_bug.cgi?id=220802 Reviewed by Per Arne Vollan. Allow in the sandbox a few things that were needed to use AudioSourceProvider in the GPUProcess. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: 2021-01-21 Per Arne Vollan [macOS] The development WebContent XPC service crashes under WebKit::AuxiliaryProcess::initializeSandbox https://bugs.webkit.org/show_bug.cgi?id=220777 Reviewed by Brent Fulgham. This happens because the development XPC service does not have the required private entitlement to enable message filtering in the sandbox, and therefore fails to apply the sandbox. The existing runtime switching to enable message filtering based on the presence of the entitlement is not working correctly. The 'if' clause checking the sandbox parameter in the sandbox cannot be nested inside an 'allow' clause, it appears. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2021-01-21 Sam Weinig Add experimental support for separated layers https://bugs.webkit.org/show_bug.cgi?id=220734 Reviewed by Simon Fraser. Plumb a "separated" bit through the graphics layer infrastructure. Currently unused but will be used for optimization experimentation. * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer): * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties): (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const): (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode): (WebKit::dumpChangedLayers): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: (WebKit::PlatformCALayerRemote::isSeparated const): (WebKit::PlatformCALayerRemote::setSeparated): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: 2021-01-21 Sam Weinig Rework color clamping logic to be more consistent and clear https://bugs.webkit.org/show_bug.cgi?id=220716 Reviewed by Simon Fraser. * UIProcess/API/wpe/WebKitColor.cpp: (webkitColorToWebCoreColor): Update to use new convertTo<> functions. 2021-01-21 Aditya Keerthi [macOS] Titlebar separator doesn't show when WKWebView is scrolled https://bugs.webkit.org/show_bug.cgi?id=220633 Reviewed by Tim Horton. Starting in Big Sur, NSWindows with a titlebar display a separator if there is a scrolled NSScrollView adjacent to the titlebar. Since WKWebViews are scrollable views, but not backed by NSScrollView, we need to adopt SPI to support this functionality. This patch updates WKWebView to conform to the NSScrollViewSeparatorTrackingAdapter protocol, ensuring the titlebar separator is displayed when necessary. Note that since WKWebViews are not actually NSScrollView's we don't already have the scroll position of the view in the UIProcess. To determine whether or not the view is scrolled, this patch adds plumbing so that the WebProcess can tell the UIProcess the new scroll position when a page is scrolled. Tests: WKWebViewTitlebarSeparatorTests.BackForwardCache WKWebViewTitlebarSeparatorTests.ChangeTitlebarAdjacency WKWebViewTitlebarSeparatorTests.ChangeViewVisibility WKWebViewTitlebarSeparatorTests.NavigationResetsTitlebarAppearance WKWebViewTitlebarSeparatorTests.ScrollWithTitlebarAdjacency WKWebViewTitlebarSeparatorTests.ScrollWithoutTitlebarAdjacency * Platform/spi/mac/AppKitSPI.h: * UIProcess/API/mac/WKView.mm: (-[WKView scrollViewFrame]): (-[WKView hasScrolledContentsUnderTitlebar]): (-[WKView _web_registerScrollViewSeparatorTrackingAdapter]): (-[WKView _web_unregisterScrollViewSeparatorTrackingAdapter]): * UIProcess/API/mac/WKWebViewMac.mm: (-[WKWebView scrollViewFrame]): (-[WKWebView hasScrolledContentsUnderTitlebar]): (-[WKWebView _web_registerScrollViewSeparatorTrackingAdapter]): (-[WKWebView _web_unregisterScrollViewSeparatorTrackingAdapter]): * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::updateWindowAndViewFrames): If the WKWebView's frame changes, update the titlebar adjacency state and notify observers of the change. (WebKit::WebViewImpl::viewWillMoveToWindowImpl): Unregister the WKWebView as an NSScrollViewSeparatorTrackingAdapter if it is removed from the window. (WebKit::WebViewImpl::viewDidHide): Hidden views are not adjacent to the titlebar. (WebKit::WebViewImpl::viewDidUnhide): An unhidden view may be adjacent to the titlebar. (WebKit::WebViewImpl::pageDidScroll): Use the scroll position of the page to determine whether or not the WKWebView is scrolled. (WebKit::WebViewImpl::scrollViewFrame): Needed to conform to NSScrollViewSeparatorTrackingAdapter. (WebKit::WebViewImpl::hasScrolledContentsUnderTitlebar): Needed to conform to NSScrollViewSeparatorTrackingAdapter. Returns true if the view is registered as an NSScrollViewSeparatorTrackingAdapter and is scrolled. (WebKit::WebViewImpl::updateTitlebarAdjacencyState): The WKWebView needs to be registered as an NSScrollViewSeparatorTrackingAdapter if it's adjacent to the titlebar and unregistered otherwise. * UIProcess/PageClient.h: (WebKit::PageClient::pageDidScroll): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::pageDidScroll): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::didCommitLoadForMainFrame): Reset the scroll position upon navigation, as pageDidScroll does not get called when navigating. (WebKit::PageClientImpl::pageDidScroll): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::pageDidScroll): Pass the current scroll position when the page is scrolled, so that the UIProcess knows whether or not the page has a non-zero scroll position. 2021-01-21 Dave Blanchard Missing header gtk/gtk.h in PointerLockManagerX11.cpp https://bugs.webkit.org/show_bug.cgi?id=220152 Reviewed by Carlos Garcia Campos. * UIProcess/gtk/PointerLockManagerX11.cpp: 2021-01-20 Wenson Hsieh [macOS] Include an origin identifier when writing promised image data to the drag pasteboard https://bugs.webkit.org/show_bug.cgi?id=220782 Reviewed by Megan Gardner. Add plumbing in WebKit to serialize and write the pasteboard origin identifier via custom data when dragging an image with promised data on macOS. In the case where we're dragging an image into a contenteditable area in a document with the *same* pasteboard origin, this allows us to avoid sanitizing the web archive data upon handling the drop. Test: DragAndDropTests.ProvideImageDataForMultiplePasteboards * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::setPromisedDataForImage): * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setPromisedDataForImage): If specified, write the origin to the drag pasteboard by creating a new `PasteboardCustomData` object, setting its origin, and then serializing the custom data object into an `NSData`. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::setPromisedDataForImage): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::setPromisedDataForImage): * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::WebDragClient::declareAndWriteDragImage): 2021-01-20 Kenneth Russell Support WEBGL_multi_draw extension https://bugs.webkit.org/show_bug.cgi?id=219139 Reviewed by Dean Jackson. Add automatically-generated stubs for supporting the multi-draw extension in the GPU process. * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h: (multiDrawArraysANGLE): (multiDrawArraysInstancedANGLE): (multiDrawElementsANGLE): (multiDrawElementsInstancedANGLE): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp: (WebKit::RemoteGraphicsContextGLProxy::multiDrawArraysANGLE): (WebKit::RemoteGraphicsContextGLProxy::multiDrawArraysInstancedANGLE): (WebKit::RemoteGraphicsContextGLProxy::multiDrawElementsANGLE): (WebKit::RemoteGraphicsContextGLProxy::multiDrawElementsInstancedANGLE): 2021-01-20 Chris Dumez [GPUProcess] Mark IOSurface backing for RemoteGraphicsContextGL's displayBuffer as owned by the WebProcess https://bugs.webkit.org/show_bug.cgi?id=220770 Reviewed by Geoffrey Garen. Mark IOSurface backing for RemoteGraphicsContextGL's displayBuffer as owned by the WebProcess. This is so that Jetsam knows which process to terminate to reclaim memory. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create): 2021-01-20 Wenson Hsieh [iOS] "touchend" events should be dispatched and handled asynchronously https://bugs.webkit.org/show_bug.cgi?id=220256 Reviewed by Tim Horton. Allow active "touchend" event listeners to send asynchronous (non-blocking) IPC messages to the web process by augmenting the content view's deferring gesture recognizers. See below for more details. Test: fast/events/touch/ios/click-event-after-touchend.html * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): Send both "touchstart" and "touchend" events asynchronously. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::isHandlingPreventableTouchEnd const): In a similar way to how we defer "touchstart", add a counter to keep track of when we're handling an active (preventable) touchend, such that we can defer all native gestures that can be prevented by touchend until after the page is done handling the event. * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::doneDeferringTouchEnd): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): Add a new set of deferring gesture recognizers that can be used to defer all tap gestures on the content view, due to active "touchend" event listeners. This works because currently, the only default gestures in WebKit that can be prevented by calling `preventDefault()` on "touchend" events are tap gestures. (-[WKContentView cleanUpInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView _deferringGestures]): (-[WKContentView _touchEndDeferringGestures]): (-[WKContentView _doneDeferringTouchEnd:]): Add a hook to "lift" the gesture gate upon touchend, which allows all deferred tap gestures to either fail (in the case where the page prevented default), or recognize (in the case where the page did not prevent default). (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Replace `_touchStartDeferringGestures` with `_deferringGestures` in several call sites that need to iterate over all deferring gestures on the content view. (-[WKContentView _singleTapDidReset:]): When resetting the single tap gesture, ensure that the tap highlight view is removed by calling `-_finishInteraction`; this is because an active touchend event handler may now defer `-_singleTapRecognized:` until after the ending the touch, which causes `-_showTapHighlight` to be called without a matching call to remove the highlight. Since we know that the synthetic tap gesture must eventually be reset after recognition, this is a more suitable catch-all for removing the tap highlight. (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): For the "touchend" deferring gesture recognizers, partition all tap gestures on the content view into three subgraphs that mirror the extant gesture subgraphs currently used for the "touchstart" deferring gestures. This ensures that synthetic clicks always remain fast when the blocking double tap gesture is disabled, and that other tap gestures (such as the text interaction multi-tap gesture) are still immediately reset. 2021-01-20 Jer Noble [Mac] Netflix controls do not fade out after entering fullscreen https://bugs.webkit.org/show_bug.cgi?id=220472 Reviewed by Eric Carlson. Test: TestWebKitAPI/Tests/mac/FullscreenPointerLeave.mm Netflix uses a "pointerleave" event over their playback controls to trigger setting their "fade out controls" timer, but a "pointerleave" event isn't fired when the element moves out from under the pointer (either due to style changes, or the window screen location moving due to entering fullscreen). Work around this behavior by sending a synthetic mouse event after entering fullscreen, which causes the "pointerleave" event to be fired if, indeed, the pointer is no longer over the element in question. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): 2021-01-20 Kate Cheney Safari says "Blocked Plug-in" instead showing a PDF https://bugs.webkit.org/show_bug.cgi?id=220665 Reviewed by Darin Adler. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::shouldUsePDFPlugin const): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createPlugin): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::shouldUsePDFPlugin const): 2021-01-20 Michael Catanzaro [WPE][GTK] Ensure URI scheme handler is not registered multiple times https://bugs.webkit.org/show_bug.cgi?id=220363 Reviewed by Carlos Garcia Campos. * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_register_uri_scheme): 2021-01-20 Youenn Fablet On page close, make sure to notify of capture state immediately https://bugs.webkit.org/show_bug.cgi?id=220588 Reviewed by Geoffrey Garen. If page is getting closed or reset (for instance in case of process swap), we immediately notify the client of the capture state, instead of waiting for 3 seconds if capture just started. Covered by API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::isPlayingMediaDidChange): (WebKit::WebPageProxy::updatePlayingMediaDidChange): (WebKit::WebPageProxy::updateReportedMediaCaptureState): * UIProcess/WebPageProxy.h: 2021-01-19 Sihui Liu Update media state for active speech recognition as it uses audio capture https://bugs.webkit.org/show_bug.cgi?id=220667 Reviewed by Youenn Fablet. * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::unregisterClient): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: 2021-01-19 Chris Dumez [Hardening] Protect against overflows in ArgumentCoder>::decode() https://bugs.webkit.org/show_bug.cgi?id=220748 Reviewed by Geoff Garen. Make sure `size` and `size * sizeof(T)` do not overflow. * Platform/IPC/ArgumentCoders.h: 2021-01-19 Chris Dumez [GPUProcess] Claim ownership of Canvas IOSurface backing in the WebProcess https://bugs.webkit.org/show_bug.cgi?id=220663 Reviewed by Geoffrey Garen. Claim ownership of Canvas IOSurface backing in the WebProcess. If we don't do this, all IOSurface memory gets attributed to the GPUProcess, making it a prime candidate for jetsam. We need to attribute memory usage to the WebProcesses being served by the GPUProcess as much as possible and this is a step in this direction. Note that this patch currently only impacts Canvas IOSurface backing when "DOM Rendering in GPUProcess" is disabled. When "DOM Rendering in GPUProcess" is enabled, we are not supposed to use the IOSurface API in the WebProcess at all. * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create): 2021-01-19 Michael Catanzaro Syscall param sendmsg(msg.msg_iov[1]) points to uninitialised byte(s) in IPC::Connection::sendOutgoingMessage https://bugs.webkit.org/show_bug.cgi?id=220668 Reviewed by Darin Adler. We previously discovered that we need to either (a) manually zero the MessageInfo struct with memcpy (accepted solution), or b) use __attribute__((packed)) to omit struct packing. This seemed to fix our valgrind warnings when bmalloc was in use, but not when bmalloc is disabled, as is good practice when valgrinding. Turns out we need to zero (or pack) the AttachmentInfo struct as well. Let's go with zeroing it, since all its members are trivially copyable, so that's safe to do. For good measure, we'll implement a copy constructor and do so there as well. Do this for MessageInfo too, to round out the original fix to MessageInfo. Since AttachmentInfo and MessageInfo are no longer trivially-copyable, we now need to cast them to void* when using memcpy in order to avoid -Wclass-memaccess warnings from GCC. * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::AttachmentInfo::AttachmentInfo): (): Deleted. * Platform/IPC/unix/UnixMessage.h: (IPC::MessageInfo::MessageInfo): (IPC::UnixMessage::UnixMessage): 2021-01-19 Alex Christensen REGRESSION(r269865) Mail's context menu when right clicking on a link does not contain correct entries https://bugs.webkit.org/show_bug.cgi?id=220745 Reviewed by Tim Horton. * Shared/API/c/WKContextMenuItem.cpp: Add a bunch of static_asserts to verify that our binary values correspond to each other and don't change. * Shared/API/c/WKContextMenuItemTypes.h: 2021-01-19 Jiewen Tan [WebAuthn] Polish the new WebAuthn UI https://bugs.webkit.org/show_bug.cgi?id=220617 Reviewed by Brent Fulgham. This patch does the following few things: 1. It updates the way how the PIN error for security keys is handled. 2. It uses the credential name to identify a credential that passed to the UI instead of the login choice object as it turns out that the UI won't return the same object at all. 3. It delays to show the UI if the platform authenticator is involved given the platform authenticator might not contain the requested credentials. If not, we should either show an error or just requesting the security key ones. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: (NS_ERROR_ENUM): * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::didSelectAssertionResponse): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): 2021-01-19 Michael Catanzaro [WPE][GTK] Remove unnecessary child setup function from process launcher https://bugs.webkit.org/show_bug.cgi?id=220090 Reviewed by Carlos Garcia Campos. The process launcher currently uses a child setup function to close the server end of its IPC socket. But this is totally unnecessary because this socket always uses CLOEXEC. So the child setup function is redundant. This is step one towards making Eclipse not crash when its UI process JVM is using a huge amount of memory. In such conditions, fork() will fail due to OOM, but posix_spawn() will still succeed. A child setup function forces GLib to use fork() instead of posix_spawn(). However, this commit is not sufficient to fix Eclipse, because GSubprocess itself sets its own child setup function. * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::ProcessLauncher::launchProcess): (WebKit::childSetupFunction): Deleted. 2021-01-19 Lauro Moura REGRESSION(r271580) [GTK] LTS/Debian build failure due to unsupported g-ir-scanner parameter https://bugs.webkit.org/show_bug.cgi?id=220730 Reviewed by Philippe Normand. No new behavior. No new tests. * PlatformGTK.cmake: Expose --sources-top-dirs only if available. 2021-01-19 Keith Rollin Modularize WebKitLegacy.framework https://bugs.webkit.org/show_bug.cgi?id=220026 Reviewed by Darin Adler. Add .modulemap files to WebKitLegacy to help speed up client builds. For MigrateHeadersFromWebKitLegacy.make, remove the newly-created umbrella header files from WEBKIT_LEGACY_PRIVATE_HEADERS in order to avoid some processing that the non-umbrella headers receive. * mac/MigrateHeadersFromWebKitLegacy.make: 2021-01-19 Chris Dumez Unreviewed, drop remaining main-thread assertion in ShareableBitmap that I missed in r271533. This assertion is hitting on the debug GPUProcess bot. SharedBitmap subclasses ThreadSafeRefCounted as of r271533 and it is expected that it is used from non-main threads. * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::createGraphicsContext): 2021-01-19 Rob Buis Null check ResourceRequest IPC decode https://bugs.webkit.org/show_bug.cgi?id=220400 Reviewed by Youenn Fablet. Null check ResourceRequest IPC decode since the IPC::decode call can succeed yet but set the dictionary to null. Test: ipc/web-authenticator-get-assertion.html * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::decodePlatformData): 2021-01-18 Michael Catanzaro [GTK] Multilib conflicts in gir files https://bugs.webkit.org/show_bug.cgi?id=220636 Reviewed by Carlos Garcia Campos. By passing --sources-top-dirs to g-ir-scanner, we ensure all paths in the generated gir files are relative to the toplevel builddir. This avoids multilib conflicts when the builddir contains the target architecture. * PlatformGTK.cmake: 2021-01-17 Yusuke Suzuki JITOperation does not exist in WebKit https://bugs.webkit.org/show_bug.cgi?id=220686 Reviewed by Mark Lam. Now, we do not register host functions as JIT operations. As a result, WebKit.framework does not have any JITOperations. We should remove population of JITOperations code in WebKit.framework. * Shared/API/c/WKString.cpp: (WKStringCopyJSString): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): * Shared/WebKitJITOperations.cpp: Removed. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: 2021-01-17 Fujii Hironori [non-Cocoa] Add a new AuxiliaryProcessMainBase class for auxiliary processes without singleton() https://bugs.webkit.org/show_bug.cgi?id=220615 Reviewed by Don Olmstead. non-Cocoa ports auxiliary processes are using AuxiliaryProcessMain as the entry points. AuxiliaryProcessMain supports both kinds of auxiliary processes with and without singleton() method by using initializeAuxiliaryProcess template function. However, all initializeAuxiliaryProcess look similar code. They can share more code. Added a AuxiliaryProcessMainBaseNoSingleton template class for auxiliary processes without singleton(). Moved the code that was in AuxiliaryProcessMain to AuxiliaryProcessMainBase::run() to remove takeInitializationParameters(). * GPUProcess/gstreamer/GPUProcessMainGStreamer.cpp: (WebKit::GPUProcessMain): (WebKit::initializeAuxiliaryProcess): Deleted. * GPUProcess/playstation/GPUProcessMainPlayStation.cpp: (WebKit::GPUProcessMain): (WebKit::initializeAuxiliaryProcess): Deleted. * GPUProcess/win/GPUProcessMainWin.cpp: (WebKit::GPUProcessMain): (WebKit::initializeAuxiliaryProcess): Deleted. * NetworkProcess/curl/NetworkProcessMainCurl.cpp: (WebKit::NetworkProcessMain): (WebKit::initializeAuxiliaryProcess): Deleted. * NetworkProcess/soup/NetworkProcessMainSoup.cpp: (WebKit::NetworkProcessMain): (WebKit::initializeAuxiliaryProcess): Deleted. * Shared/AuxiliaryProcessMain.h: (WebKit::AuxiliaryProcessMainBase::platformInitialize): (WebKit::AuxiliaryProcessMainBase::platformFinalize): (WebKit::AuxiliaryProcessMainBase::initializeAuxiliaryProcess): (WebKit::AuxiliaryProcessMainBase::run): (WebKit::AuxiliaryProcessMainBaseNoSingleton::process): (WebKit::AuxiliaryProcessMain): (WebKit::AuxiliaryProcessMainBase::initializationParameters): Deleted. (WebKit::AuxiliaryProcessMainBase::takeInitializationParameters): Deleted. (WebKit::initializeAuxiliaryProcess): Deleted. * Shared/unix/AuxiliaryProcessMain.cpp: (WebKit::AuxiliaryProcessMainCommon::parseCommandLine): (WebKit::AuxiliaryProcessMainBase::parseCommandLine): Deleted. * Shared/win/AuxiliaryProcessMainWin.cpp: (WebKit::AuxiliaryProcessMainCommon::parseCommandLine): (WebKit::AuxiliaryProcessMainBase::parseCommandLine): Deleted. * WebProcess/gtk/WebProcessMainGtk.cpp: (WebKit::WebProcessMain): * WebProcess/playstation/WebProcessMainPlayStation.cpp: (WebKit::WebProcessMain): * WebProcess/win/WebProcessMainWin.cpp: (WebKit::WebProcessMain): * WebProcess/wpe/WebProcessMainWPE.cpp: (WebKit::WebProcessMain): 2021-01-17 Youenn Fablet Add CoreMedia aavds entitlement to WebContent and GPU processes https://bugs.webkit.org/show_bug.cgi?id=220238 Reviewed by Brent Fulgham. Manually tested. * Scripts/process-entitlements.sh: 2021-01-15 Wenson Hsieh [iOS] Emoji keyboard covers text field on twitter.com/messages https://bugs.webkit.org/show_bug.cgi?id=220664 Reviewed by Devin Rousso. After iOS 14, the emoji software keyboard layout now includes a search field that can be used to filter for specific emojis. This slightly increases the overall height of the software keyboard when the emoji keyplane is active; in turn, this means that if the selection or caret is positioned right above the top of the software keyboard when the normal (alphabetic) keyplane is active, switching to the emoji keyplane will cause the keyboard to overlap the selection, making it difficult to see inserted text. To address this, add a mechanism to detect when a change in the bounds of the software keyboard causes a visible selection or caret rect to become overlapped, and react by scrolling to keep the selection visible. This has the effect of fixing this bug by scrolling to reveal the text field after switching to the emoji keyboard, but it also has the effect of scrolling to keep the selection visible after detaching a connected hardware keyboard, in the case where it would've otherwise been overlapped by the (much taller) software keyboard that appears. Test: editing/selection/ios/scroll-to-reveal-selection-when-showing-software-keyboard.html * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _selectionRectIsFullyVisibleAndNonEmpty]): Add an internal helper to check whether the selection bounds are fully visible. (-[WKWebView _scrollToRevealSelectionIfNeeded]): (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]): In the case where changing input view bounds causes a previously visible selection to become overlapped, call `-_scrollToRevealSelectionIfNeeded` to make the selection visible again. (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentView.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): (-[WKContentView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted. Drive-by fix: remove the unused `insideFixed:` parameter from this adjacent method. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView rectToRevealWhenZoomingToFocusedElement]): (-[WKContentView _zoomToRevealFocusedElement]): (rectToRevealWhenZoomingToFocusedElement): Deleted. Pull this into the `-rectToRevealWhenZoomingToFocusedElement` internal helper method instead, and use the new `selectionBoundingRectInRootViewCoordinates` method below. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::selectionBoundingRectInRootViewCoordinates const): Pull out code to compute the selection bounding rect (for both ranged and caret selections) into a method on `WebPageProxy`, so that it can be used in `WKContentView` and `WKWebView`. 2021-01-15 Alex Christensen REGRESSION(r267763) Uploading zipped directories does not work on iOS https://bugs.webkit.org/show_bug.cgi?id=220666 Reviewed by Geoffrey Garen. r267763 removed indexedDatabaseTempBlobDirectoryExtensionHandle with no replacement, which used to give the network process read/write access to /tmp inside the parent process's container. This seems to have been unused for IndexedDB, but it was used by createTemporaryZipArchive when uploading directories, such as Pages, Numbers, and Keynote documents. Unfortunately the unit test added by r248139 is macOS-only because WKOpenPanelParameters is only available on macOS and it would require a large and risky amount of refactoring to add SPI on iOS to test this because iOS uses WKFileUploadPanel instead. I did manually verify that the bug is fixed using my phone, though. * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess): 2021-01-15 Chris Dumez [GPUProcess] Move DOM / Canvas rendering off the main thread in the GPUProcess https://bugs.webkit.org/show_bug.cgi?id=220476 Reviewed by Simon Fraser. Move DOM / Canvas rendering off the main thread (and on a high-priority serial WorkQueue) in the GPUProcess by making RemoteRenderingBackend a WorkQueueMessageReceiver. There is a serial WorkQueue per RemoteRenderingBackend, which means each WebPage gets its own WorkQueue. A/B testing shows this mostly perf-neutral (could be a slight progression on some hardware). I believe this new architecture should also give us more optimization opportunities in the future. For example, we may be able to more aggressively wait on the cross-process semaphore when waiting for new DisplayList entries without worrying about blocking the main thread. I have run layout tests in Debug on both macOS & iOS with the GPUProcess enabled and I believe I have fixed all the crashes that were discovered. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::didClose): (WebKit::GPUConnectionToWebProcess::createRenderingBackend): (WebKit::GPUConnectionToWebProcess::RemoteRenderingBackendWrapper::RemoteRenderingBackendWrapper): (WebKit::GPUConnectionToWebProcess::RemoteRenderingBackendWrapper::~RemoteRenderingBackendWrapper): * GPUProcess/GPUConnectionToWebProcess.h: (WebKit::GPUConnectionToWebProcess::remoteMediaPlayerManagerProxy): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::create): (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::~RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::disconnect): (WebKit::RemoteRenderingBackend::messageSenderConnection const): (WebKit::RemoteRenderingBackend::applyMediaItem): (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): (WebKit::RemoteRenderingBackend::getImageData): (WebKit::RemoteRenderingBackend::getDataURLForImageBuffer): (WebKit::RemoteRenderingBackend::getDataForImageBuffer): (WebKit::RemoteRenderingBackend::getBGRADataForImageBuffer): (WebKit::RemoteRenderingBackend::cacheNativeImage): (WebKit::RemoteRenderingBackend::cacheFont): (WebKit::RemoteRenderingBackend::deleteAllFonts): (WebKit::RemoteRenderingBackend::releaseRemoteResource): (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * GPUProcess/media/RemoteLegacyCDMProxy.cpp: (WebKit::RemoteLegacyCDMProxy::cdmMediaPlayer const): * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::deleteMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::didReceivePlayerMessage): (WebKit::RemoteMediaPlayerManagerProxy::didReceiveSyncPlayerMessage): (WebKit::RemoteMediaPlayerManagerProxy::mediaPlayer): * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * Platform/SharedMemory.h: * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::ShareableBitmap): (WebKit::ShareableBitmap::~ShareableBitmap): * Shared/ShareableBitmap.h: * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::createGraphicsContext): (WebKit::ShareableBitmap::releaseBitmapContextData): (WebKit::ShareableBitmap::releaseDataProviderData): 2021-01-15 Alex Christensen Remove non-inclusively named WKBrowsingContextGroup SPI https://bugs.webkit.org/show_bug.cgi?id=220604 Reviewed by Anders Carlsson. Once rdar://problem/73167624 has been integrated, we can remove the old SPI, which has been replaced in r263099 * UIProcess/API/Cocoa/WKBrowsingContextGroup.h: * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm: (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]): Deleted. (-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]): Deleted. 2021-01-15 Chris Dumez [GPUProcess] Improve the GPUProcess' memory pressure handler https://bugs.webkit.org/show_bug.cgi?id=220659 Reviewed by Simon Fraser. Improve the GPUProcess' memory pressure handler to clear things like the IOSurfacePool and the SubimageCacheWithTimer. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::lowMemoryHandler): (WebKit::GPUProcess::initializeGPUProcess): (WebKit::GPUProcess::prepareToSuspend): * GPUProcess/GPUProcess.h: 2021-01-15 Philippe Normand [GStreamer] UI<->WebPocess IPC needed for enumerateDevices support https://bugs.webkit.org/show_bug.cgi?id=220542 Reviewed by Eric Carlson. For GLib ports the UIProcess will now send a message to the WebProcess to retrieve the MediaStream devices. This is required because we want to avoid initializing GStreamer in the UIProcess as much as possible. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::platformGetMediaStreamDevices): (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::platformGetMediaStreamDevices): * WebProcess/glib/UserMediaCaptureManager.cpp: (WebKit::UserMediaCaptureManager::validateUserMediaRequestConstraints): (WebKit::UserMediaCaptureManager::getMediaStreamDevices): * WebProcess/glib/UserMediaCaptureManager.h: * WebProcess/glib/UserMediaCaptureManager.messages.in: 2021-01-14 Peng Liu Add a quirk to disable "return to element fullscreen from picture-in-picture" for some sites https://bugs.webkit.org/show_bug.cgi?id=220606 Reviewed by Eric Carlson. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): * UIProcess/WebFullScreenManagerProxy.cpp: (WebKit::WebFullScreenManagerProxy::blocksReturnToFullscreenFromPictureInPicture const): (WebKit::WebFullScreenManagerProxy::enterFullScreen): * UIProcess/WebFullScreenManagerProxy.h: * UIProcess/WebFullScreenManagerProxy.messages.in: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): (-[WKFullScreenWindowController didEnterPictureInPicture]): * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::enterFullScreenForElement): * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp: (WebKit::InjectedBundlePageFullScreenClient::enterFullScreenForElement): * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): 2021-01-14 Chris Dumez Unreviewed, apply post-landing review comments from Darin for r271495. * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::createGraphicsContext): (WebKit::ShareableBitmap::makeCGImageCopy): 2021-01-14 Peng Liu [Cocoa] Add a script to generate the "Feature Flags" plist file https://bugs.webkit.org/show_bug.cgi?id=220080 Reviewed by Daniel Bates. Add a script to combine a plist file from WebKitAdditions with the corresponding plist file in this repo to generate a `WebKit.plist` required by the Feature Flags interface. * FeatureFlags/WebKit-appletvos.plist: Copied from Source/WebKit/FeatureFlags/WebKit.plist. * FeatureFlags/WebKit-ios.plist: Copied from Source/WebKit/FeatureFlags/WebKit.plist. * FeatureFlags/WebKit-macos.plist: Copied from Source/WebKit/FeatureFlags/WebKit.plist. * FeatureFlags/WebKit-watchos.plist: Renamed from Source/WebKit/FeatureFlags/WebKit.plist. * Scripts/combine-feature-flags-plist.py: Added. (main): * Scripts/generate-feature-flags-plist.sh: Added. * WebKit.xcodeproj/project.pbxproj: 2021-01-14 Tim Horton Exceptions thrown when invoking a instead of popover) for two reasons: - we want to maximize compatibility, so they should behave exactly as they do on the only platform they're tested on - other frameworks (mostly UIKit) enforce the use of iPhone UI in iPhone-idiom apps, even on macOS * Shared/UserInterfaceIdiom.mm: (WebKit::currentUserInterfaceIdiomIsPadOrMac): (WebKit::setCurrentUserInterfaceIdiomIsPadOrMac): (WebKit::updateCurrentUserInterfaceIdiom): (WebKit::userInterfaceIdiomIsPad): Deleted. Simplify our UIUserInterfaceIdiom-caching code. currentUserInterfaceIdiomIsPadOrMac now does what it says on the tin, globally; previously on macOS it said YES for iPhone-idiom apps, but now it says NO, like you would expect. Use UIDevice everywhere instead of the soft-deprecated UICurrentUserInterfaceIdiomIsPad, both because it is soft-deprecated, and because it lets us elide the static helper. 2021-01-14 Chris Dumez [Hardening] Protect against overflows in calculateBytesPerRow() https://bugs.webkit.org/show_bug.cgi?id=220625 Reviewed by Alex Christensen. Protect against overflows in calculateBytesPerRow(). * Shared/ShareableBitmap.h: * Shared/cairo/ShareableBitmapCairo.cpp: (WebKit::ShareableBitmap::calculateBytesPerPixel): * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::calculateBytesPerPixel): (WebKit::ShareableBitmap::createGraphicsContext): (WebKit::ShareableBitmap::createCGImage const): * Shared/win/ShareableBitmapDirect2D.cpp: (WebKit::ShareableBitmap::calculateBytesPerPixel): 2021-01-14 Geoffrey Garen Removed most uses of dispatch_async(dispatch_get_main_queue(), ...) https://bugs.webkit.org/show_bug.cgi?id=220066 Reviewed by Antti Koivisto. dispatch_async has two downsides: (1) Its order is undefined (and in practice highly variable) relative to other WebKit operations. This sometimes causes flakiness. (2) It doesn't honor the RunLoop first paint optimization. We can use RunLoop::dispatch() instead. * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: (-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:]): * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::determineITPState): * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextGetInfoForInstalledPlugIns): * UIProcess/API/Cocoa/NSAttributedString.mm: (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]): * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (+[WKBrowsingContextController registerSchemeForCustomProtocol:]): (+[WKBrowsingContextController unregisterSchemeForCustomProtocol:]): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]): * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _doAfterNextVisibleContentRectUpdate:]): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]): (-[WKWebView _updateVisibleContentRects]): (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]): (-[WKWebView _doAfterNextStablePresentationUpdate:]): * UIProcess/Cocoa/AutomationClient.mm: (WebKit::AutomationClient::requestAutomationSession): * UIProcess/Cocoa/NavigationState.mm: (WebKit::tryInterceptNavigation): * UIProcess/Cocoa/PreferenceObserver.mm: (-[WKPreferenceObserver preferenceDidChange:key:encodedValue:]): * UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: (-[WKWebInspectorPreferenceObserver observeValueForKeyPath:ofObject:change:context:]): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::requestThumbnailWithOperation): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::webProcessPoolHighDynamicRangeDidChangeCallback): * UIProcess/Cocoa/WebViewImpl.mm: (-[WKDOMPasteMenuDelegate menuDidClose:]): (WebKit::WebViewImpl::updateWindowAndViewFrames): (WebKit::WebViewImpl::setTopContentInset): (WebKit::WebViewImpl::didBecomeEditable): (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded): (WebKit::WebViewImpl::performDragOperation): * UIProcess/EndowmentStateTracker.mm: (WebKit::EndowmentStateTracker::registerMonitorIfNecessary): * UIProcess/_WKTouchEventGenerator.mm: (-[_WKTouchEventGenerator _sendHIDEvent:]): (-[_WKTouchEventGenerator _sendMarkerHIDEventWithCompletionBlock:]): * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread]): (-[WKRBSAssertionDelegate assertion:didInvalidateWithError:]): (WebKit::ProcessAssertion::ProcessAssertion): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView resignFirstResponderForWebView]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView pdfHostViewControllerExtensionProcessDidCrash:]): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel imagePickerController:didFinishPickingMediaWithInfo:]): (-[WKFileUploadPanel imagePickerController:didFinishPickingMultipleMediaWithInfo:]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController placeholderWillMoveToSuperview:]): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: (WebKit::PlatformCALayerRemoteCustom::clone const): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRendering): * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::requestVideoContentLayer): (WebKit::VideoFullscreenManager::returnVideoContentLayer): (WebKit::VideoFullscreenManager::didSetupFullscreen): (WebKit::VideoFullscreenManager::willExitFullscreen): (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didExitFullscreen): (WebKit::VideoFullscreenManager::didCleanupFullscreen): 2021-01-14 Youenn Fablet Use callOnMainRunLoop in MediaPermissionUtilities https://bugs.webkit.org/show_bug.cgi?id=220616 Reviewed by Chris Dumez. This ensures that we are in main thread and not in web thread. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::requestAVCaptureAccessForType): (WebKit::requestSpeechRecognitionAccess): 2021-01-14 Sihui Liu Update buttons of media permission prompt on macOS https://bugs.webkit.org/show_bug.cgi?id=220613 Reviewed by Eric Carlson. Make allow button on the right and not selected to match TCC prompts. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::alertForPermission): 2021-01-14 Per Arne Vollan [GPUP][iOS] Create sandbox extensions for cache and temp directory https://bugs.webkit.org/show_bug.cgi?id=220595 Reviewed by Chris Dumez. Create sandbox extensions for GPU process access to cache and temp directory. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): * GPUProcess/GPUProcessCreationParameters.cpp: (WebKit::GPUProcessCreationParameters::encode const): (WebKit::GPUProcessCreationParameters::decode): * GPUProcess/GPUProcessCreationParameters.h: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::GPUProcessProxy): 2021-01-13 Tim Horton REGRESSION (r266634): Messages crashes sometimes while scrolling around and playing YouTube videos https://bugs.webkit.org/show_bug.cgi?id=220602 Reviewed by Wenson Hsieh. No new tests; we are unable to API test video full-screen because of the lack of UIApp; I have written a stand-alone test app that can reliably reproduce before this patch and not afterwards. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::scheduleActivityStateUpdate): We can't call dispatchActivityStateChange directly underneath a post-commit callback, because it has side-effects (like un-parenting the full-screen window) that may result in other frameworks (e.g. UIKit) trying to install commit handlers for the same phase, which is not allowed. To fix this, add a dispatch_async; we _only_ care that the activity state change doesn't apply until after the active commit is complete. 2021-01-13 Chris Dumez REGRESSION(r270961): Flipgrid can no longer capture video https://bugs.webkit.org/show_bug.cgi?id=220609 Reviewed by Darin Adler. Add back line in RemoteAudio::setStorage() that was initializing m_buffer and that was dropped by mistake in the refactoring in r270961. This was causing RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable() to return early because m_buffer was not initialized. No new tests, unsure how to test this. * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): 2021-01-13 John Wilander PCM: Output logs by default, including to Web Inspector https://bugs.webkit.org/show_bug.cgi?id=220596 Reviewed by Brent Fulgham. This change turns on PCM output to Web Inspector and logs by default. In some of the cases, the syslog output was deleted since it doesn't make sense to log those messages now that we have output in Web Inspector. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::handleAttribution): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): 2021-01-13 Jer Noble [HANG] 496ms to 1360ms in WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices() https://bugs.webkit.org/show_bug.cgi?id=220471 Reviewed by Youenn Fablet. Use the completion-handler version of RealtimeMediaSourceCenter::getMediaStreamDevices(). * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::updateCaptureDevices): (WebKit::UserMediaProcessManager::beginMonitoringCaptureDevices): * UIProcess/UserMediaProcessManager.h: 2021-01-13 Per Arne Vollan [Cocoa] Network extension sandbox extensions are sometimes issued too late https://bugs.webkit.org/show_bug.cgi?id=220525 Reviewed by Brent Fulgham. Currently, Network extension sandbox extensions are sent to the WebContent process as part of the load parameters, but this is too late in some cases. In these cases, the extensions can be sent along with the DidReceivePolicyDecision message. * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * UIProcess/WebPageProxy.cpp: (WebKit::createNetworkExtensionsSandboxExtensions): (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didReceivePolicyDecision): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-13 Jiewen Tan Crash at SOAuthorizationSession::dismissViewController https://bugs.webkit.org/show_bug.cgi?id=220482 Reviewed by Darin Adler. A crash report suggests that SOAuthorizationSession::dismissViewController could crash at evaluating m_page. This could only happen if the SOAuthorizationSession object is freed. The stack trace starts with callbacks from NSNotificationCenter, which capture a RefPtr of the SOAuthorizationSession object and should guarantee the lifetime of the object. So it contradicts the crash report. One of the possible explanations is that the RefPtr is somehow over-released within NSNotificationCenter since it's not thread-safe. To fix that, the RefPtr can be made thread-safe. No tests. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::dismissViewController): 2021-01-13 Wenson Hsieh [macOS] "Correct Spelling Automatically" menu items are inconsistent when autocorrect="off" https://bugs.webkit.org/show_bug.cgi?id=220598 Reviewed by Tim Horton. Plumb the new `canEnableAutomaticSpellingCorrection` flag through `EditorState` to the UI process, where we can consult it when validating user interface items (namely, the "Correct Spelling Automatically" menu item, which corresponds to the `-toggleAutomaticSpellingCorrection:` selector). * Shared/EditorState.cpp: (WebKit::EditorState::PostLayoutData::encode const): (WebKit::EditorState::PostLayoutData::decode): (WebKit::operator<<): * Shared/EditorState.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::validateUserInterfaceItem): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::getPlatformEditorState const): 2021-01-13 Alex Christensen Remove deprecated script and stylesheet SPI, replaced with more inclusively-named SPI https://bugs.webkit.org/show_bug.cgi?id=214937 Reviewed by Youenn Fablet. Once rdar://problem/66227777 is done we will be able to remove this old SPI. * UIProcess/API/Cocoa/WKUserScript.mm: (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): Deleted. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): Deleted. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:contentWorld:]): Deleted. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:]): Deleted. (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:deferRunningUntilNotification:]): Deleted. * UIProcess/API/Cocoa/WKUserScriptPrivate.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:level:userContentWorld:]): Deleted. (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:baseURL:level:userContentWorld:]): Deleted. (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): Deleted. (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): Deleted. (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:level:userContentWorld:]): Deleted. 2021-01-13 Fujii Hironori Reimplement WebCore::isInWebProcess() family as cross-platform by using AuxiliaryProcessInitializationParameters.processType https://bugs.webkit.org/show_bug.cgi?id=220529 Reviewed by Alex Christensen. Replaced AuxiliaryProcess::ProcessType with WebCore::AuxiliaryProcessType. * GPUProcess/GPUProcess.h: * NetworkProcess/NetworkProcess.h: * PluginProcess/PluginProcess.h: * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::initialize): * Shared/AuxiliaryProcess.h: Removed ProcessType. * Shared/AuxiliaryProcessMain.h: (WebKit::AuxiliaryProcessMainBase::AuxiliaryProcessMainBase): (WebKit::AuxiliaryProcessMain): (WebKit::AuxiliaryProcessMainBase::takeInitializationParameters): Deleted. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::SandboxInfo::SandboxInfo): (WebKit::processStorageClass): (WebKit::sandboxDirectory): (WebKit::applySandbox): * WebAuthnProcess/WebAuthnProcess.h: * WebProcess/WebProcess.h: 2021-01-13 John Wilander PCM: Experimental debug mode needs to be read from defaults differently on iOS https://bugs.webkit.org/show_bug.cgi?id=220573 Reviewed by Brent Fulgham. Experimental features on iOS use the prefix "WebKitExperimental" so we need to read it that way on that platform. PCM is not supported on other platforms than macOS and iOS at this point. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): 2021-01-13 Megan Gardner Defer setting up app highlight menus until needed to not delay launch time. https://bugs.webkit.org/show_bug.cgi?id=220577 rdar://72940219 Delay adding the app highlight menus to the callout bar until a selection happens, as the creation of these menus is expensive, and they are only needed if a selection is made on the page, which is not guaranteed to happen. Reviewed by Tim Horton. * UIProcess/ios/WKContentView.mm: (-[WKContentView _processDidExit]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView _selectionChanged]): (-[WKContentView setupAppHighlightMenus]): 2021-01-13 Commit Queue Unreviewed, reverting r271401. https://bugs.webkit.org/show_bug.cgi?id=220591 It is breaking iOS audio rendering Reverted changeset: "Unmuting a track in case of end of interruption by another web process tab is not working well with capture muting icons" https://bugs.webkit.org/show_bug.cgi?id=220058 https://trac.webkit.org/changeset/271401 2021-01-12 BJ Burg [Cocoa] Web Inspector: move browser domain activation methods back to WKWebView and UIDelegate https://bugs.webkit.org/show_bug.cgi?id=220480 Reviewed by Devin Rousso. Having browser domain activation methods on WKInspectorDelegate means that the browser domain will not work with remote inspection of WKWebViews on macOS. Move these methods back to UIDelegate/WKWebView so that it is possible to remote inspect Safari Technology Preview with another Safari while still benefiting from the browser domain being turned on. Covered by existing API tests. * UIProcess/API/APIInspectorClient.h: (API::InspectorClient::browserDomainEnabled): Deleted. (API::InspectorClient::browserDomainDisabled): Deleted. * UIProcess/API/APIUIClient.h: (API::UIClient::didEnableInspectorBrowserDomain): Moved. (API::UIClient::didDisableInspectorBrowserDomain): Moved. * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _didEnableBrowserExtensions:]): Moved. (-[WKWebView _didDisableBrowserExtensions:]): Moved. Moved from WKInspector.mm. Rather than accessing the browser agent directly from ObjC code, use the page's WebPageInspectorController. * UIProcess/API/Cocoa/_WKInspectorDelegate.h: * UIProcess/API/Cocoa/_WKInspectorPrivate.h: * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector _browserExtensionsEnabled:]): Deleted. (-[_WKInspector _browserExtensionsDisabled:]): Deleted. * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::didEnableInspectorBrowserDomain): (WebKit::UIDelegate::UIClient::didDisableInspectorBrowserDomain): * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp: (WebKit::InspectorBrowserAgent::enable): (WebKit::InspectorBrowserAgent::disable): * UIProcess/Inspector/Cocoa/InspectorDelegate.h: * UIProcess/Inspector/Cocoa/InspectorDelegate.mm: (WebKit::InspectorDelegate::setDelegate): (WebKit::InspectorDelegate::InspectorClient::~InspectorClient): (WebKit::InspectorDelegate::InspectorClient::browserDomainEnabled): Deleted. (WebKit::InspectorDelegate::InspectorClient::browserDomainDisabled): Deleted. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::browserExtensionsEnabled): Deleted. (WebKit::WebInspectorProxy::browserExtensionsDisabled): Deleted. * UIProcess/Inspector/WebInspectorProxy.h: * UIProcess/Inspector/WebPageInspectorController.h: * UIProcess/Inspector/WebPageInspectorController.cpp: (WebKit::WebPageInspectorController::WebPageInspectorController): (WebKit::WebPageInspectorController::init): (WebKit::WebPageInspectorController::connectFrontend): (WebKit::WebPageInspectorController::disconnectFrontend): (WebKit::WebPageInspectorController::disconnectAllFrontends): (WebKit::WebPageInspectorController::setIndicating): (WebKit::WebPageInspectorController::createInspectorTarget): (WebKit::WebPageInspectorController::webPageAgentContext): (WebKit::WebPageInspectorController::setEnabledBrowserAgent): Added. (WebKit::WebPageInspectorController::browserExtensionsEnabled): Added. (WebKit::WebPageInspectorController::browserExtensionsDisabled): Added. Drive-by: rename m_page to m_inspectedPage to emphasize that this class exists as part of Web Inspector's backend, not its frontend. 2021-01-12 Brent Fulgham [macOS] GPU Process unable to play MSE content due to missing sandbox rules https://bugs.webkit.org/show_bug.cgi?id=220549 Reviewed by Per Arne Vollan. Add missing sandbox rules required to support MSE playback in the GPU Process. These rules were previously added to the WebContent process, but should have also been included in the GPU Process sandbox. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Scripts/process-entitlements.sh: 2021-01-12 Per Arne Vollan [macOS] Reset user directory suffix before getting sandbox directory https://bugs.webkit.org/show_bug.cgi?id=220358 Reviewed by Alexey Proskuryakov. Reset the user directory suffix before getting the sandbox data vault directory with confstr. We do not want to include the user directory suffix, since the sandbox data vault will then end up inside the host process' cache folder, which is undesirable. Also, creating the data vault directory with confstr can fail under some circumstances if the user directory suffix is not empty. This patch also changes how we next set the user directory suffix for the process. Instead of setting the environment variable DIRHELPER_USER_DIR_SUFFIX, we can use the SPI _set_user_dir_suffix. The behavior should be identical, but I believe it is better to use SPI for this. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): (WebKit::AuxiliaryProcess::initializeSandbox): 2021-01-12 Don Olmstead Non-unified build fixes mid January 2021 edition https://bugs.webkit.org/show_bug.cgi?id=220560 Unreviewed non-unified build fixes. * 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): 2021-01-12 Wenson Hsieh REGRESSION (r265044): [macOS] Safari autocorrects text when typing in login field on amazon.com https://bugs.webkit.org/show_bug.cgi?id=220556 Reviewed by Darin Adler. Restores the implementation of `WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled`, which was removed in r265044, with the reasoning that the code was unused. However, Safari still uses this SPI on macOS to prevent automatic spelling correction from triggering when editing form fields that are AutoFillable. Test: WebKit.DisableSpellcheck * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: (WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled): 2021-01-12 Wenson Hsieh ASSERTION FAILED: m_connection under WebKit::WebPageProxy::acceptsFirstMouse() https://bugs.webkit.org/show_bug.cgi?id=220545 Reviewed by Tim Horton. Avoid the assertion by making it safe to call `WebPageProxy::messageSenderConnection` in debug builds, in the case where the web process is still launching. * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::hasConnection const): Add a helper method that returns whether or not a process proxy has a non-null connection. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::messageSenderConnection const): Use the above helper to avoid calling into `AuxiliaryProcessProxy::connection()` when the connection is null. 2021-01-12 Jer Noble [Cocoa] Support key rotation with HLS-backed encrypted media streams https://bugs.webkit.org/show_bug.cgi?id=220493 Reviewed by Eric Carlson. Support handling the "unexpectedInitializationDataReceived()" client callback from within the GPUP. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/RemoteCDMInstanceProxy.cpp: (WebKit::RemoteCDMInstanceProxy::create): (WebKit::RemoteCDMInstanceProxy::RemoteCDMInstanceProxy): (WebKit::RemoteCDMInstanceProxy::~RemoteCDMInstanceProxy): (WebKit::RemoteCDMInstanceProxy::unrequestedInitializationDataReceived): * GPUProcess/media/RemoteCDMInstanceProxy.h: * GPUProcess/media/RemoteCDMProxy.cpp: (WebKit::RemoteCDMProxy::createInstance): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/RemoteCDMInstance.cpp: (WebKit::RemoteCDMInstance::RemoteCDMInstance): (WebKit::RemoteCDMInstance::~RemoteCDMInstance): (WebKit::RemoteCDMInstance::unrequestedInitializationDataReceived): * WebProcess/GPU/media/RemoteCDMInstance.h: * WebProcess/GPU/media/RemoteCDMInstance.messages.in: Added. 2021-01-12 Youenn Fablet Unmuting a track in case of end of interruption by another web process tab is not working well with capture muting icons https://bugs.webkit.org/show_bug.cgi?id=220058 Reviewed by Eric Carlson. Add an observer of AudioSession interruptions that forwards the signal to all tabs of the process. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::PageAudioSessionInterruptionObserver::PageAudioSessionInterruptionObserver): (WebKit::PageAudioSessionInterruptionObserver::~PageAudioSessionInterruptionObserver): (WebKit::PageAudioSessionInterruptionObserver::beginAudioSessionInterruption): (WebKit::PageAudioSessionInterruptionObserver::endAudioSessionInterruption): (WebKit::listenToAudioSessionInterruption): 2021-01-12 Philippe Normand [GStreamer] Lazy initialization support https://bugs.webkit.org/show_bug.cgi?id=209332 Reviewed by Carlos Garcia Campos. Introduce a GTK/WPE UserMediaCaptureManager that relays permission requests to the RealtimeMediaSourceCenter running in the WebProcess. We might move this to the GPUProcess at some point but for the time being we only want to avoid initializing GStreamer from the UIProcess. * PlatformGTK.cmake: * PlatformWPE.cmake: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: * UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp: Added. (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest): * WebProcess/glib/UserMediaCaptureManager.cpp: Added. (WebKit::UserMediaCaptureManager::UserMediaCaptureManager): (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): (WebKit::UserMediaCaptureManager::validateUserMediaRequestConstraints): * WebProcess/glib/UserMediaCaptureManager.h: Added. (WebKit::UserMediaCaptureManager::supplementName): * WebProcess/glib/UserMediaCaptureManager.messages.in: Added. * WebProcess/glib/WebProcessGLib.cpp: (WebKit::WebProcess::platformInitializeWebProcess): 2021-01-12 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.31.1 release * gtk/NEWS: Add release notes for 2.31.1. * webkitglib-symbols.map: Remove WebKit::PluginProcessMain. 2021-01-11 Peng Liu Receiving two enter/exit fullscreen delegate callbacks on iPad when presenting fullscreen elements https://bugs.webkit.org/show_bug.cgi?id=218688 Reviewed by Darin Adler. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::didExitFullscreen): (WebKit::VideoFullscreenManagerProxy::didEnterFullscreen): 2021-01-11 Megan Gardner Double tap to select does not work if the page clears selections on tap, like grammarly.com does https://bugs.webkit.org/show_bug.cgi?id=220454 rdar://67757411 Reviewed by Wenson Hsieh. Double tap to select content did not work on grammerly.com on iPad because this is a desktop website run on a touch-based device, and there was a script running that would clear the selection on a mouseDown event. When we would send synthetic click events to the page we would first update the selection and then on completion of the tap, we would dispatch a mouseDown and mouseUp event on iOS. On Mac, we update the selection between the mouseDown and the mouseUp, so in order to bring us more in line with mac/mouse behaviors, we are now saving the information needed to update the selection when we believe we are in the middle of a potential tap, and then setting the selection between these two events. This makes for a more expected change of events, and does not let grammerly.com clear a valid selection based off of synthetic clicks. Test: fast/events/touch/ios/double-tap-on-editable-content-for-selection-with-clear-on-touch.html * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::completeSyntheticClick): (WebKit::WebPage::setSelectionRange): (WebKit::WebPage::selectTextWithGranularityAtPoint): 2021-01-11 Kate Cheney Crash in pageDidComputePageRects() https://bugs.webkit.org/show_bug.cgi?id=220518 Reviewed by Ryosuke Niwa. Make _printOperation a weak pointer and check it before use. Since WKPrintingView is ref counted, a reference could still exist even if _printOperation is nil. Remove the comment as it is not a justification for a raw pointer. * UIProcess/mac/WKPrintingView.h: * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): (-[WKPrintingView _firstPrintedPageNumber]): (-[WKPrintingView _lastPrintedPageNumber]): (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]): (pageDidComputePageRects): (-[WKPrintingView _askPageToComputePageRects]): (-[WKPrintingView knowsPageRange:]): (-[WKPrintingView _drawPreview:]): (-[WKPrintingView drawRect:]): (-[WKPrintingView _drawPageBorderWithSizeOnMainThread:]): (-[WKPrintingView drawPageBorderWithSize:]): (-[WKPrintingView rectForPage:]): (-[WKPrintingView locationOfPrintRect:]): (-[WKPrintingView beginDocument]): (-[WKPrintingView endDocument]): 2021-01-11 Sihui Liu Make SpeechRecognition permission error more informative https://bugs.webkit.org/show_bug.cgi?id=220436 Reviewed by Youenn Fablet. Make SpeechRecognitionPermissionManager complete requests with an optional SpeechRecognitionError instead of a boolean value. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::~SpeechRecognitionPermissionManager): (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::completeCurrentRequest): (WebKit::SpeechRecognitionPermissionManager::requestSpeechRecognitionServiceAccess): (WebKit::SpeechRecognitionPermissionManager::requestMicrophoneAccess): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::complete): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::requestPermissionForRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): 2021-01-11 Alex Christensen Use sendWithAsyncReply instead of dataCallback for icon loading https://bugs.webkit.org/show_bug.cgi?id=220381 Reviewed by Youenn Fablet. * Scripts/webkit/messages.py: * Shared/API/APIData.cpp: (API::Data::create): * Shared/API/APIData.h: (API::Data::create): * UIProcess/API/APIIconLoadingClient.h: (API::IconLoadingClient::getLoadDecisionForIcon): * UIProcess/API/mac/WKView.mm: (-[WKView maybeInstallIconLoadingClient]): * UIProcess/Cocoa/IconLoadingDelegate.h: * UIProcess/Cocoa/IconLoadingDelegate.mm: (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::getLoadDecisionForIcon): (WebKit::WebPageProxy::finishedLoadingIcon): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::finishedLoadingIcon): Deleted. * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didGetLoadDecisionForIcon): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-11 BJ Burg Web Inspector: add nullptr check for WebInspectorProxy::m_extensionsController https://bugs.webkit.org/show_bug.cgi?id=220485 Reviewed by Devin Rousso. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::frontendLoaded): 2021-01-11 Youenn Fablet WebProcessPool::establishWorkerContextConnectionToNetworkProcess should make sure to remove the selected process from the cache https://bugs.webkit.org/show_bug.cgi?id=220503 Reviewed by Darin Adler. In case we reuse an existing web process, make sure to remove it from web process cache. Covered by API test. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): (WebKit::WebProcessCache::addProcess): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): 2021-01-11 Brent Fulgham [macOS] Enable the client decoder entitlement for the GPU Process https://bugs.webkit.org/show_bug.cgi?id=220441 Reviewed by Darin Adler. The GPU process needs the client decoder entitlement we use in the WebContent process to properly handle MSE content. * Scripts/process-entitlements.sh: 2021-01-11 Yoshiaki Jitsukawa [PlayStation] Add MiniBrowser https://bugs.webkit.org/show_bug.cgi?id=220359 Reviewed by Don Olmstead. Add WKRunloop API to allow an external program to run WebKit's generic runloop. * UIProcess/API/C/playstation/WKRunLoop.cpp: Added. (WKRunLoopRunMain): (WKRunLoopStopMain): (WKRunLoopCallOnMainThread): (WKRunLoopInitializeMain): * UIProcess/API/C/playstation/WKRunLoop.h: Added. Add private WKPagePaint() to draw contents to bitmap. Remove unused WKPageSetSize() implementation. * UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp: (drawPageBackground): (WKPageHandleMouseEvent): Fix button click event handling. (WKPagePaint): * UIProcess/API/C/playstation/WKPagePrivatePlayStation.h: Add WKView API to set view client along with fullscreen API and visibility state API. * UIProcess/API/C/playstation/WKView.cpp: (WKViewGetPage): (WKViewSetSize): (WKViewSetFocus): (WKViewSetActive): (WKViewSetVisible): (WKViewWillEnterFullScreen): (WKViewDidEnterFullScreen): (WKViewWillExitFullScreen): (WKViewDidExitFullScreen): (WKViewRequestExitFullScreen): (WKViewIsFullScreen): (WKViewSetViewClient): * UIProcess/API/C/playstation/WKView.h: * UIProcess/API/C/playstation/WKViewClient.h: Added. * UIProcess/API/playstation/APIViewClient.h: Added. * UIProcess/playstation/PageClientImpl.cpp: * UIProcess/playstation/PageClientImpl.h: * UIProcess/playstation/PlayStationWebView.cpp: * UIProcess/playstation/PlayStationWebView.h: Allow rendering without accelerated compositing. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * PlatformPlayStation.cmake: Add relevant sources and include directories. 2021-01-11 Kimmo Kinnunen WebKit::IPC::Encoder needs definitions of all custom enum values at the Encoder definition time https://bugs.webkit.org/show_bug.cgi?id=220410 Reviewed by Darin Adler. Change WTF::EnumTraits to have either EnumTraits::values or EnumTraits::isValidEnum(). Fixes the upcoming problem where Encoder::encode(E) function is moved from Encoder to other class, such as EncoderBase, and where we do not want to add redundant includes. See the WTF/ ChangeLog for discussiong wrt why they were needed before. * Scripts/webkit/messages.py: * Scripts/webkit/tests/MessageNames.h: (WTF::EnumTraits::isValidEnum): 2021-01-11 Carlos Garcia Campos [GTK] System font scaling not applied to 'font-size: XXXpt' https://bugs.webkit.org/show_bug.cgi?id=218450 Reviewed by Žan Doberšek. Apply the text scale factor as WebPageProxy text zoom factor, instead of changing the default font size in settings that only applies to default fonts and it was incorrectly calculated. * UIProcess/API/glib/WebKitSettings.cpp: (webKitSettingsDispose): (webKitSettingsConstructed): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewConstructed): (webkitWebViewDispose): (webkit_web_view_set_zoom_level): (webkit_web_view_get_zoom_level): 2021-01-08 Commit Queue Unreviewed, reverting r271331. https://bugs.webkit.org/show_bug.cgi?id=220487 Wasn't ready for review. Reverted changeset: "[macOS] Reset user directory suffix before getting sandbox directory" https://bugs.webkit.org/show_bug.cgi?id=220358 https://trac.webkit.org/changeset/271331 2021-01-08 Per Arne Vollan [macOS] Reset user directory suffix before getting sandbox directory https://bugs.webkit.org/show_bug.cgi?id=220358 Reviewed by Brent Fulgham. Reset user directory suffix before getting sandbox data vault directory. We do not want to include the user directory suffix, since the compiled sandbox should be shared by all WebKit processes of the same type. Also, creating the data vault directory can fail under some circumstances if the user directory suffix is not empty. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::AuxiliaryProcess::initializeSandbox): 2021-01-08 Peng Liu PlaybackSessionManager::m_clientCounts is not updated correctly when a video enters picture-in-picture from fullscreen https://bugs.webkit.org/show_bug.cgi?id=220435 Reviewed by Jer Noble. A follow-up patch to fix an assertion failure on Mac. `VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation()` should not call `removeClientForContext()` on Mac because `didCleanupFullscreen()` will do that. Fix layout test: media/element-containing-pip-video-going-into-fullscreen.html * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): 2021-01-08 Wenson Hsieh [macOS] -[WKWebView acceptsFirstMouse:] sometimes crashes in IPC::Connection::createSyncMessageEncoder https://bugs.webkit.org/show_bug.cgi?id=220469 Reviewed by Chris Dumez. When sending IPC to the web process from the UI process, it's possible for the `WebProcessProxy`'s IPC connection to be null in the case where the web process is still in the act of launching. In the case of asynchronous IPC, we handle this by queueing the IPC message on the `WebProcessProxy` in the case where the connection hasn't been created yet (refer to `AuxiliaryProcessProxy::sendMessage`). However, in the case where we're sending a sync message, we assume that the IPC connection exists in `MessageSender::sendSync`, which causes us to crash with a null dereference. To fix this, remove the debug assertion in `MessageSender::sendSync` and return a null `SendSyncResult` in the case where the connection has not been created. Test: WebKit2.AcceptsFirstMouseDuringWebProcessLaunch * Platform/IPC/MessageSender.h: 2021-01-08 Jiewen Tan [WebAuthn] Adopt new UI for the update flow https://bugs.webkit.org/show_bug.cgi?id=219713 Reviewed by Brent Fulgham. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: (NS_ERROR_ENUM): * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): 2021-01-08 Youenn Fablet Service Worker is no longer inspectable https://bugs.webkit.org/show_bug.cgi?id=220406 Reviewed by Per Arne Vollan. We were sending the sandbox extension later when enabling remote inspector. But this is not soon enough for inspecting service workers. For that reason, send the sandbox extension at process init time based on whether develop menu is on or not. Manually tested by validating that Develop Menu can list running service workers. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::shouldEnableRemoteInspector): (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded): * UIProcess/WebProcessProxy.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::enableRemoteWebInspector): 2021-01-08 Chris Lord [WPE] Enable smooth-motion and kinetic scrolling on touchpads https://bugs.webkit.org/show_bug.cgi?id=219942 Reviewed by Žan Doberšek. Interpret axis motion events with a zero value as axis stop events and send the appropriate wheel event phase. This enables kinetic scrolling when using touchpads and other smooth-scrolling devices. * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::doneWithTouchEvent): * UIProcess/API/wpe/WPEView.cpp: (WKWPE::m_backend): * UIProcess/API/wpe/WPEView.h: 2021-01-08 Youenn Fablet Make sure that if NetworkProcess clears DOMCache, it also clears service worker registrations https://bugs.webkit.org/show_bug.cgi?id=220408 Reviewed by Alex Christensen. It is expected that clearing DOM cache mandates clearing service worker registrations as service workers expect cache entries added at install time to stay. It is hard for clients to enforce this so it is best to handle it in Network Process. When DOMCache is cleared, service worker registrations will also be cleared. The reverse is not guaranteed. Covered by API test. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): 2021-01-07 Alex Christensen Use WeakHashSet instead of HashSet https://bugs.webkit.org/show_bug.cgi?id=220455 Reviewed by Geoffrey Garen. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::invalidateAndCancel): (WebKit::NetworkSession::registerNetworkDataTask): (WebKit::NetworkSession::unregisterNetworkDataTask): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::registerNetworkDataTask): Deleted. (WebKit::NetworkSession::unregisterNetworkDataTask): Deleted. * UIProcess/WebPageGroup.cpp: (WebKit::WebPageGroup::addPage): (WebKit::WebPageGroup::removePage): (WebKit::WebPageGroup::setPreferences): * UIProcess/WebPageGroup.h: * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::~WebPageProxy): * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::~WebPreferences): (WebKit::WebPreferences::addPage): (WebKit::WebPreferences::removePage): (WebKit::WebPreferences::update): (WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey): * UIProcess/WebPreferences.h: * WebProcess/Geolocation/WebGeolocationManager.cpp: (WebKit::WebGeolocationManager::registerWebPage): (WebKit::WebGeolocationManager::unregisterWebPage): (WebKit::WebGeolocationManager::setEnableHighAccuracyForPage): (WebKit::WebGeolocationManager::isUpdating const): (WebKit::WebGeolocationManager::isHighAccuracyEnabled const): * WebProcess/Geolocation/WebGeolocationManager.h: (WebKit::WebGeolocationManager::isUpdating const): Deleted. (WebKit::WebGeolocationManager::isHighAccuracyEnabled const): Deleted. 2021-01-07 Per Arne Vollan [iOS] Silence diagnostics sandbox violations https://bugs.webkit.org/show_bug.cgi?id=220414 Reviewed by Darin Adler. For performance reasons, silence benign diagnostics sandbox violations in the WebContent process on iOS. Additionally, remove logging for a sysctl in the Networking process' sandbox, since it is known to be used. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-01-07 Kate Cheney Error in layout tests: "Passed ITP enabled state (0) does not match TCC setting (1)" https://bugs.webkit.org/show_bug.cgi?id=220385 Reviewed by Darin Adler. No new tests, this has no behavior change. It will fix excessive logging when running tests. We do not need to log a discrepancy between these states for WebKitTestRunner or TestWebKitAPI because they are sometimes treated like web browsers but need to turn ITP on/off for specific tests, so these states will not always match. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::activateSessionCleanup): * Shared/Cocoa/DefaultWebBrowserChecks.h: * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::isRunningTest): (WebKit::isParentProcessAFullWebBrowser): (WebKit::isFullWebBrowser): (WebKit::shouldBeTreatedAsFullBrowser): Deleted. 2021-01-07 Alex Christensen Remove assertions in MESSAGE_CHECK definition https://bugs.webkit.org/show_bug.cgi?id=220401 * Platform/IPC/Connection.h: The unit test associated with r271263 hits these assertions in debug builds. Since we plan to increase this type of unit testing, I remove the assertions. 2021-01-07 Mark Lam Work around Clang bug in __builtin_return_address(). https://bugs.webkit.org/show_bug.cgi?id=220432 rdar://71648468 Reviewed by Yusuke Suzuki. * PluginProcess/mac/PluginProcessShim.mm: (WebKit::shimCFStringCompare): - We go direct to ptrauth.h instead of using the WTF PtrTag abstraction because this file appears to be going out of its way to avoid importing config.h. Because of this, importing PtrTag.h results in a lot of build error complications. Rather than jump thru many hoops to make importing PtrTag.h work and because all we really want is only to use ptrauth_strip(), importing ptrauth.h is simpler. 2021-01-07 Peng Liu PlaybackSessionManager::m_clientCounts is not updated correctly when a video enters picture-in-picture from fullscreen https://bugs.webkit.org/show_bug.cgi?id=220435 Reviewed by Eric Carlson. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): When a fullscreen video enters picture-in-picture, we should not call `addClientForContext()` because `m_clientCounts` was updated when the video entered fullscreen. (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation): We need to call `removeClientForContext()` in this function like `didCleanupFullscreen()` does. 2021-01-07 Eric Carlson [Mac] Add runtime logging to format reader and WebM parser https://bugs.webkit.org/show_bug.cgi?id=220423 Reviewed by Andy Estes. Use the Document::sharedLogger to log format and track reader state changes and errors. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::nextLogIdentifier): (WebKit::logChannel): (WebKit::logClassName): (WebKit::MediaFormatReader::parseByteSource): (WebKit::MediaFormatReader::didParseTracks): (WebKit::MediaFormatReader::copyProperty): (WebKit::MediaFormatReader::nextTrackReaderLogIdentifier const): * Shared/mac/MediaFormatReader/MediaFormatReader.h: * Shared/mac/MediaFormatReader/WebKit::MediaTrackReader.cpp: (WebKit::MediaTrackReader::MediaTrackReader): (WebKit::MediaTrackReader::finishParsing): (WebKit::MediaTrackReader::mediaTypeString const): (WebKit::MediaTrackReader::copyProperty): (WebKit::MediaTrackReader::finalize): (WebKit::MediaTrackReader::logChannel const): * Shared/mac/MediaFormatReader/WebKit::MediaTrackReader.h: 2021-01-07 Alexey Shvayka [JSC] Simplify get*PropertyNames() methods and EnumerationMode https://bugs.webkit.org/show_bug.cgi?id=212954 Reviewed by Yusuke Suzuki. Adjust for changes in JSC's MethodTable, TypeInfo, and EnumerationMode. No new tests, no behavior change. * WebProcess/Plugins/Netscape/JSNPObject.cpp: (WebKit::JSNPObject::getOwnPropertyNames): * WebProcess/Plugins/Netscape/JSNPObject.h: * WebProcess/Plugins/Netscape/NPJSObject.cpp: (WebKit::NPJSObject::enumerate): 2021-01-07 Commit Queue Unreviewed, reverting r271192. https://bugs.webkit.org/show_bug.cgi?id=220440 Reverted changeset: "NSCrossWebsiteTrackingUsageDescription is not working on Mac, ITP is always enabled" https://bugs.webkit.org/show_bug.cgi?id=220190 https://trac.webkit.org/changeset/271192 2021-01-07 Alex Christensen Use smart pointers in UIDelegate and NavigationState https://bugs.webkit.org/show_bug.cgi?id=220394 Reviewed by Geoff Garen. UIDelegate and NavigationState are owned by WKWebView, but the clients are owned by WebPageProxy, which is independently reference counted and can have a different lifetime. There should be no raw C++ references between the two, so use WeakPtr instead. Also, use WeakObjCPtr instead of a raw C++ WKWebView* * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationState): (WebKit::NavigationState::~NavigationState): (WebKit::NavigationState::navigationGestureDidBegin): (WebKit::NavigationState::navigationGestureWillEnd): (WebKit::NavigationState::navigationGestureDidEnd): (WebKit::NavigationState::willRecordNavigationSnapshot): (WebKit::NavigationState::navigationGestureSnapshotWasRemoved): (WebKit::NavigationState::didRequestPasswordForQuickLookDocument): (WebKit::NavigationState::didFirstPaint): (WebKit::NavigationState::NavigationClient::NavigationClient): (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): (WebKit::NavigationState::NavigationClient::didChangeBackForwardList): (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): (WebKit::NavigationState::NavigationClient::contentRuleListNotification): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation): (WebKit::NavigationState::NavigationClient::didStartProvisionalLoadForFrame): (WebKit::NavigationState::NavigationClient::didReceiveServerRedirectForProvisionalNavigation): (WebKit::NavigationState::NavigationClient::willPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didPerformClientRedirect): (WebKit::NavigationState::NavigationClient::didCancelClientRedirect): (WebKit::NavigationState::NavigationClient::didFailProvisionalNavigationWithError): (WebKit::NavigationState::NavigationClient::didFailProvisionalLoadWithErrorForFrame): (WebKit::NavigationState::NavigationClient::didCommitNavigation): (WebKit::NavigationState::NavigationClient::didCommitLoadForFrame): (WebKit::NavigationState::NavigationClient::didFinishDocumentLoad): (WebKit::NavigationState::NavigationClient::didFinishNavigation): (WebKit::NavigationState::NavigationClient::didFinishLoadForFrame): (WebKit::NavigationState::NavigationClient::didFailNavigationWithError): (WebKit::NavigationState::NavigationClient::didFailLoadWithErrorForFrame): (WebKit::NavigationState::NavigationClient::didSameDocumentNavigation): (WebKit::NavigationState::NavigationClient::renderingProgressDidChange): (WebKit::NavigationState::NavigationClient::shouldBypassContentModeSafeguards const): (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): (WebKit::NavigationState::NavigationClient::shouldAllowLegacyTLS): (WebKit::NavigationState::NavigationClient::didNegotiateModernTLS): (WebKit::NavigationState::NavigationClient::processDidTerminate): (WebKit::NavigationState::NavigationClient::processDidBecomeResponsive): (WebKit::NavigationState::NavigationClient::processDidBecomeUnresponsive): (WebKit::NavigationState::NavigationClient::webCryptoMasterKey): (WebKit::NavigationState::NavigationClient::navigationActionDidBecomeDownload): (WebKit::NavigationState::NavigationClient::navigationResponseDidBecomeDownload): (WebKit::NavigationState::NavigationClient::contextMenuDidCreateDownload): (WebKit::NavigationState::NavigationClient::didStartLoadForQuickLookDocumentInMainFrame): (WebKit::NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame): (WebKit::NavigationState::NavigationClient::decidePolicyForSOAuthorizationLoad): (WebKit::NavigationState::HistoryClient::HistoryClient): (WebKit::NavigationState::HistoryClient::didNavigateWithNavigationData): (WebKit::NavigationState::HistoryClient::didPerformClientRedirect): (WebKit::NavigationState::HistoryClient::didPerformServerRedirect): (WebKit::NavigationState::HistoryClient::didUpdateHistoryTitle): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::ContextMenuClient::ContextMenuClient): (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu): (WebKit::UIDelegate::UIClient::UIClient): (WebKit::UIDelegate::UIClient::createNewPage): (WebKit::UIDelegate::UIClient::runJavaScriptAlert): (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): (WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest): (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance): (WebKit::UIDelegate::UIClient::canRunBeforeUnloadConfirmPanel const): (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel): (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): (WebKit::UIDelegate::UIClient::takeFocus): (WebKit::UIDelegate::UIClient::handleAutoplayEvent): (WebKit::UIDelegate::UIClient::canRunModal const): (WebKit::UIDelegate::UIClient::runModal): (WebKit::UIDelegate::UIClient::headerHeight): (WebKit::UIDelegate::UIClient::footerHeight): (WebKit::UIDelegate::UIClient::drawHeader): (WebKit::UIDelegate::UIClient::drawFooter): (WebKit::UIDelegate::UIClient::pageDidScroll): (WebKit::UIDelegate::UIClient::focus): (WebKit::UIDelegate::UIClient::unfocus): (WebKit::UIDelegate::UIClient::unavailablePluginButtonClicked): (WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground): (WebKit::UIDelegate::UIClient::didNotHandleWheelEvent): (WebKit::UIDelegate::UIClient::setIsResizable): (WebKit::UIDelegate::UIClient::setWindowFrame): (WebKit::UIDelegate::UIClient::windowFrame): (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement): (WebKit::UIDelegate::UIClient::toolbarsAreVisible): (WebKit::UIDelegate::UIClient::didClickAutoFillButton): (WebKit::UIDelegate::UIClient::showPage): (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder): (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest): (WebKit::UIDelegate::UIClient::configurationForLocalInspector): (WebKit::UIDelegate::UIClient::didAttachLocalInspector): (WebKit::UIDelegate::UIClient::willCloseLocalInspector): (WebKit::UIDelegate::UIClient::runOpenPanel): (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess): (WebKit::UIDelegate::UIClient::didChangeFontAttributes): (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange): (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): (WebKit::UIDelegate::UIClient::printFrame): (WebKit::UIDelegate::UIClient::close): (WebKit::UIDelegate::UIClient::fullscreenMayReturnToInline): (WebKit::UIDelegate::UIClient::didEnterFullscreen): (WebKit::UIDelegate::UIClient::didExitFullscreen): (WebKit::UIDelegate::UIClient::shouldIncludeAppLinkActionsForElement): (WebKit::UIDelegate::UIClient::actionsForElement): (WebKit::UIDelegate::UIClient::didNotHandleTapAsClick): (WebKit::UIDelegate::UIClient::presentingViewController): (WebKit::UIDelegate::UIClient::dataDetectionContext): (WebKit::UIDelegate::UIClient::requestPointerLock): (WebKit::UIDelegate::UIClient::didLosePointerLock): (WebKit::UIDelegate::UIClient::didShowSafeBrowsingWarning): (WebKit::UIDelegate::UIClient::confirmPDFOpening): (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel): (WebKit::UIDelegate::UIClient::hasVideoInPictureInPictureDidChange): (WebKit::UIDelegate::UIClient::imageOrMediaDocumentSizeChanged): (WebKit::UIDelegate::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): 2021-01-07 Alex Christensen Assertion failure in WebPageProxy::stopURLSchemeTask, https://bugs.webkit.org/show_bug.cgi?id=220401 Reviewed by Ryosuke Niwa. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::startURLSchemeTaskShared): (WebKit::WebPageProxy::stopURLSchemeTask): (WebKit::WebPageProxy::loadSynchronousURLSchemeTask): * UIProcess/WebURLSchemeHandler.cpp: (WebKit::WebURLSchemeHandler::processForTaskIdentifier const): (WebKit::WebURLSchemeHandler::stopTask): (WebKit::WebURLSchemeHandler::removeTaskFromPageMap): 2021-01-07 Andy Estes [Mac] Prepend "Media" to FormatReader, SampleCursor, and TrackReader class names https://bugs.webkit.org/show_bug.cgi?id=220424 Reviewed by Eric Carlson. Also moved MediaSampleByteRange into its own file from MediaTrackReader.cpp. * MediaFormatReaderPlugIn/MediaFormatReaderPlugIn.cpp: * Shared/API/c/mac/WKMediaFormatReader.cpp: Renamed from Source/WebKit/Shared/API/c/mac/WKFormatReader.cpp. * Shared/API/c/mac/WKMediaFormatReader.h: Renamed from Source/WebKit/Shared/API/c/mac/WKFormatReader.h. * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: Updated DECLARE_CORE_MEDIA_TRAITS to account for renaming. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/FormatReader.cpp. * Shared/mac/MediaFormatReader/MediaFormatReader.h: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/FormatReader.h. * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: Added. * Shared/mac/MediaFormatReader/MediaSampleByteRange.h: Added. * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/SampleCursor.cpp. * Shared/mac/MediaFormatReader/MediaSampleCursor.h: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/SampleCursor.h. * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/TrackReader.cpp. * Shared/mac/MediaFormatReader/MediaTrackReader.h: Renamed from Source/WebKit/Shared/mac/MediaFormatReader/TrackReader.h. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2021-01-07 Chris Dumez [GPUProcess] Implement GPUProcess crash recovery for MediaElementAudioSourceNode https://bugs.webkit.org/show_bug.cgi?id=220391 Reviewed by Geoffrey Garen. When audio is playing using WebAudio and a MediaElementAudioSourceNode, make sure that audio resumes playing seemlessly after a GPUProcess crash. * WebProcess/GPU/GPUProcessConnection.h: Subclass CanMakeWeakPtr<> so that clients can hold a weak pointer to a GPUProcessConnection. * WebProcess/GPU/media/RemoteAudioSourceProvider.cpp: (WebKit::RemoteAudioSourceProvider::create): (WebKit::RemoteAudioSourceProvider::RemoteAudioSourceProvider): (WebKit::RemoteAudioSourceProvider::close): (WebKit::RemoteAudioSourceProvider::hasNewClient): * WebProcess/GPU/media/RemoteAudioSourceProvider.h: Associate the RemoteAudioSourceProvider with a specific GPUProcessConnection instead of always using the latest connection via WebProcess::ensureGPUProcessConnection(). In the event of a GPUProcess crash, MediaPlayer will reconstruct its MediaPlayerPrivate which will reconstruct a new RemoteAudioSourceProvider (since RemoteAudioSourceProvider is owned by MediaPlayerPrivateRemote). As a result, RemoteAudioSourceProvider does not need to do anything to deal with a GPUProcess crash. However, we need to make sure it only interacts with the GPUProcessConnection that existed when it was constructed. 2021-01-07 Kimmo Kinnunen WebKit IPC message names should indicate if the message is synchronous https://bugs.webkit.org/show_bug.cgi?id=220319 Reviewed by Chris Dumez. Order WebKit IPC MessageName enumerators by listing asynchronous messages first. This enables relatively efficient implementation of isMessageSync(). Remove MessageFlags::SyncMessage. This information is already stored in the MessageName -- a message is either synchronous or asynchronous, but not both. * Platform/IPC/Connection.cpp: (IPC::Connection::createSyncMessageEncoder): * Platform/IPC/Decoder.cpp: (IPC::Decoder::alignBufferPosition): * Platform/IPC/Decoder.h: (IPC::Decoder::isSyncMessage const): * Platform/IPC/Encoder.cpp: (IPC::Encoder::grow): * Platform/IPC/Encoder.h: * Platform/IPC/MessageArgumentDescriptions.h: * Platform/IPC/MessageFlags.h: * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: (GeneratedFileContentsTest): * Scripts/webkit/model.py: (check_global_model_inputs): * Scripts/webkit/model_unittest.py: (test_mismatch_message_attribute_sync): * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: * Scripts/webkit/tests/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: (IPC::messageIsSync): 2021-01-07 Sihui Liu ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::SpeechRecognitionServer::~SpeechRecognitionServer() https://bugs.webkit.org/show_bug.cgi?id=220404 Reviewed by Youenn Fablet. API test: WebKit2.SpeechRecognitionPageIsDestroyed * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::destroySpeechRecognitionServer): 2021-01-07 Kimmo Kinnunen WebKit IPC builtin messages should be part of the model https://bugs.webkit.org/show_bug.cgi?id=220318 Reviewed by Chris Dumez. Add IPC and AsyncReply message receivers to the IPC model so that their messages can be part of the generator dynamic logic instead of being part of the static textual templates. IPC receiver is a built-in message receiver that has few async messages. AsyncReply receiver is a built-in message receiver that has one async message for each message declared as 'Async' in any receiver. This helps to refine features such as "is message asynchronous" more easily. Adds new test case TestWithIfMessage to check a case that went wrong when making the change. Moves parsing tests to parser_unittest.py so that TestWithIfMessage does not need to be added to the parsing tests. The said test is not intended to exercises anything particular in the parsing. Adds test logic for asserting MessageNames.{h,cpp} and MessageArgumentDescriptions.cpp are as expected. * Scripts/generate-message-receiver.py: (main): * Scripts/webkit/messages.py: * Scripts/webkit/model.py: (check_global_model_inputs): (generate_global_model): * Scripts/webkit/model_unittest.py: * Scripts/webkit/tests/MessageNames.cpp: (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: 2021-01-07 Lauro Moura REGRESSION(r270425) [GTK] wheel scrolling stopped working https://bugs.webkit.org/show_bug.cgi?id=219547 Reviewed by Carlos Garcia Campos. In GTK we may have the case where the async scrolling is disabled at runtime despite being compiled with ASYNC_SCROLLING/SCROLLING_THREAD. In these cases, the wheel events still need to be dispatched through the main thread. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2021-01-07 Carlos Garcia Campos [GTK] Build failures with GTK4 3.99.5.1 https://bugs.webkit.org/show_bug.cgi?id=219844 Reviewed by Philippe Normand. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSizeAllocate): 2021-01-07 Youenn Fablet WKWebView should expose navigator.mediaDevices when content is loaded from app bundle https://bugs.webkit.org/show_bug.cgi?id=220184 Reviewed by Eric Carlson. In case of non HTTP or HTTPS origins, getUserMedia was always denied. This patch updates the code by allowing getUserMedia prompts for other protocols. In that case, the user is presented the prompt with the application name since the origin domain does not mean anything. Manually tested. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::alertMessageText): 2021-01-07 Jiewen Tan Unreviewed, a build fix after r271221 * Platform/spi/Cocoa/NearFieldSPI.h: * UIProcess/WebAuthentication/Cocoa/NfcService.mm: (WebKit::NfcService::isAvailable): (WebKit::NfcService::platformStartDiscovery): Changed back to sharedHardwareManager. 2021-01-06 Jiewen Tan [WebAuthn] Adopt new UI for the Client PIN and dismiss flow https://bugs.webkit.org/show_bug.cgi?id=219712 Reviewed by Brent Fulgham. Covered by manual tests. This patch does the following few things: 1. It tweaks the WebAuthn process as a UI view service to be able to run NearField in the background. 2. It adopts new SPI for security keys' client pin support. 3. It adopts new SPI to dismiss the UI when necessary. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: (NS_ERROR_ENUM): Adds new SPI. * Scripts/process-entitlements.sh: Tweaks WebAuthn process for NFC. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: Paperwork. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::~AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): (WebKit::AuthenticatorPresenterCoordinator::requestPin): (WebKit::AuthenticatorPresenterCoordinator::dimissPresenter): (WebKit::AuthenticatorPresenterCoordinator::setPin): Adopts new SPIs. * UIProcess/WebAuthentication/Cocoa/NfcService.mm: (WebKit::NfcService::platformStartDiscovery): Tweaks NFC. * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:validateUserEnteredPIN:completionHandler:]): Adopts new SPIs. 2021-01-06 Jer Noble [Cocoa] Revert audioTimePitchAlgorithm to "TimeDomain" from "Spectral" https://bugs.webkit.org/show_bug.cgi?id=220341 Reviewed by Youenn Fablet. Add a private preference to control what pitch correction algorithm will be used by MediaPlayer. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::setPitchCorrectionAlgorithm): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _pitchCorrectionAlgorithm]): (-[WKPreferences _setPitchCorrectionAlgorithm:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::setPitchCorrectionAlgorithm): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2021-01-06 Yusuke Suzuki [JSC] Replace JSBigInt::toUint64 with JSBigInt::toBigUInt64 https://bugs.webkit.org/show_bug.cgi?id=220378 Reviewed by Darin Adler. * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::convertToUint64): (WebKit::IPCTestingAPI::encodeNumericType): 2021-01-06 Andy Estes [Mac] Replace most uses of HAVE(MT_PLUGIN_FORMAT_READER) with ENABLE(WEBM_FORMAT_READER) https://bugs.webkit.org/show_bug.cgi?id=220374 Reviewed by Eric Carlson. * Shared/API/c/mac/WKFormatReader.cpp: (WKFormatReaderCreate): (WKFormatReaderStartOnMainThread): * Shared/WebPreferencesDefaultValues.cpp: * Shared/WebPreferencesDefaultValues.h: * Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp: * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: * Shared/mac/MediaFormatReader/FormatReader.cpp: * Shared/mac/MediaFormatReader/FormatReader.h: * Shared/mac/MediaFormatReader/SampleCursor.cpp: * Shared/mac/MediaFormatReader/SampleCursor.h: * Shared/mac/MediaFormatReader/TrackReader.cpp: * Shared/mac/MediaFormatReader/TrackReader.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2021-01-06 Chris Dumez [GPUProcess] RemoteAudioSourceProviderManager should be a WorkQueueMessageReceiver https://bugs.webkit.org/show_bug.cgi?id=220371 Reviewed by Youenn Fablet. RemoteAudioSourceProviderManager should be a WorkQueueMessageReceiver (not a ThreadMessageReceiver), since it uses a WorkQueue (not a WTF::Thread). This simplifies the code a bit. * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::setConnection): (WebKit::RemoteAudioSourceProviderManager::addProvider): (WebKit::RemoteAudioSourceProviderManager::removeProvider): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: 2021-01-06 Wenson Hsieh [Concurrent Display Lists] GPU process should not immediately sleep after reading all available display list items https://bugs.webkit.org/show_bug.cgi?id=219586 Reviewed by Chris Dumez. This patch adds a mechanism for the GPU process to wait for a short duration (~30 microseconds) after it has finished reading all available data in its shared item buffer; if the web process writes additional data to the item buffer (thereby bumping the unread bytes counter) during this time, we immediately resume processing the new display list items in the GPU process, rather than wait for a new wakeup message. This allows us to avoid the cost of going to sleep just to immediately wake up in the GPU process, in the case where the web process is writing display list items at a very fast rate and the GPU process just happens to catch up (i.e. advance `unreadBytes()` to 0). See below for more details. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createRenderingBackend): Refactor the rendering backend creation message from the web process to the GPU process, so that the rendering backend creation arguments are encapsulated in a single struct, RemoteRenderingBackendCreationParameters. This struct contains the rendering backend identifier and, on Cocoa platforms, a mach send right that can be used to construct the corresponding display list wakeup semaphore in the GPU process. * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/graphics/DisplayListReaderHandle.h: (WebKit::DisplayListReaderHandle::startWaiting): (WebKit::DisplayListReaderHandle::stopWaiting): Add helper methods for the GPU process to start and stop waiting for new items. See the call site in RemoteRenderingBackend for more detail, as well as the comments in SharedDisplayListHandle below. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::create): (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): Refactor this codepath to take RemoteRenderingBackendCreationParameters instead of just an identifier. (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): In the case where we received the wakeup message due to exceeding the display list item count hysteresis, wait for a short duration using the semaphore after we hit an unread count of 0. This allows the web process to write more items and signal the semaphore, so that we can resume reading in the GPU process. (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/GPUProcessWakeupMessageArguments.h: (WebKit::GPUProcessWakeupMessageArguments::encode const): (WebKit::GPUProcessWakeupMessageArguments::decode): Plumb a GPUProcessWakeupReason enum flag over to the GPU process, via wake-up arguments. This flag is used by the GPU process to determine whether we should expect additional items to eventually enter the stream, and whether we should eagerly go to sleep after processing all known items. In other words, if the wakeup message is being sent as a result of flushing the image buffer, we don't want to unnecessarily wait for more items; however, if the wakeup message is being sent as a result of exceeding the (currently) 512-item hysteresis, then we can probably expect more items to stream in, so it's more optimal to wait after finishing all known display list items. * Shared/RemoteRenderingBackendCreationParameters.h: Copied from Source/WebKit/Shared/GPUProcessWakeupMessageArguments.h. (WebKit::RemoteRenderingBackendCreationParameters::encode const): (WebKit::RemoteRenderingBackendCreationParameters::decode): See above for more details. * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::header const): Adds a new WaitingStatus enum type internal to SharedDisplayListHandle and its subclasses, which is used to coordinate the act of waiting for new item data in the GPU process. A shared display list handle now contains an atomic `waitingStatus` flag indicating whether the GPU process is in the process of waiting for more items, and also whether the web process has acknowledged the fact that the GPU process is waiting (thereby putting the GPU process in a state where it is waiting to resume processing). Along with this enum, we also add two new 8-byte values to the header section: an offset to begin reading item data after resuming, and 8 bytes for an identifier indicating the new destination (for the purposes of display list rendering, this is a RenderingResourceIdentifier, though this will be different for WebGL). +--> NotWaiting <--+ | | | | | | [3a] | [3b] | [1] | | | | Resuming +----> Waiting ^ | | [2] | +------------------+ There are three main ways in which this state machine may transition, numbered [1]-[3] in the above diagram. [1] When the GPU process finishes processing available items, it enters Waiting state, indicating that it is now waiting for additional item data. This corresponds to the call to `DisplayListReaderHandle::startWaiting`. [2] When the web process bumps the unread count of an item buffer, if it has a pending wakeup message or would otherwise need to schedule a pending wakeup message, see if we can instead simply tell the GPU process to resume processing, instead of sending a wakeup message. This corresponds to a call to the helper method `DisplayListWriterHandle::tryToResume`. [3] If the maximum wait duration (~30 microseconds) has passed (i.e. scenario 3a) or if the web process has transitioned us from Waiting to Resuming state (i.e. scenario 3b), then transition back to NotWaiting. In both scenarios, this corresponds to a call to `DisplayListReaderHandle::stopWaiting`. In the case where we transitioned from Resuming state, we can immediately continue processing display list items. In the case where we successfully resume, we're essentially "re-waking" the GPU process without the overhead of an additional IPC message, using the same shared display list handle. Since this would've otherwise been a separate wakeup message, we need to be careful that we continue processing display list items from the correct offset into the shared display list handle, and using the correct destination image buffer. This is because the writable offset of the item buffer may have been reset in the middle of waiting by the web process, or the destination image buffer may have changed while waiting. To handle these scenarios, we introduce the `ResumeReadingInformation` struct, which contains both of these pieces of information. An instance of this struct exists in the shared memory header section; this is written by the web process immediately prior to transitioning to Resuming state, and read by the GPU process when transitioning from Resuming to NotWaiting. * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/DisplayListWriterHandle.h: (WebKit::DisplayListWriterHandle::tryToResume): Add a helper method for the web process to try and notify the GPU process that it should try and resume display list processing. See the call site in RemoteRenderingBackendProxy for more detail, as well as the comments in SharedDisplayListHandle above. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::connectToGPUProcess): (WebKit::RemoteRenderingBackendProxy::didAppendData): Rather than always schedule (or send) a wakeup message here in the case where the unread count is 0, see if we can instead tell the GPU process to stop waiting and resume display list processing. To do this, we use the new DisplayListWriterHandle::tryToResume method, giving it the new offset to begin reading items from as well as the destination image buffer to which we should apply display list items. If we successfully tell the GPU process to resume reading, then we can clear out (or avoid storing) wakeup message arguments and avoid sending an IPC wakeup message. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2021-01-06 Alex Christensen Add SPI to determine whether a regex is supported in WKContentRuleList https://bugs.webkit.org/show_bug.cgi?id=220095 Reviewed by Tim Horton. This is a more efficient way than making a little rule list and seeing if it compiles. Here, we don't need access to the disk, and we don't need to hop to another thread and back. Covered by API tests. * UIProcess/API/APIContentRuleList.cpp: (API::ContentRuleList::supportsRegularExpression): * UIProcess/API/APIContentRuleList.h: * UIProcess/API/Cocoa/WKContentRuleList.mm: (+[WKContentRuleList _supportsRegularExpression:]): * UIProcess/API/Cocoa/WKContentRuleListInternal.h: * UIProcess/API/Cocoa/WKContentRuleListPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListInternal.h. * WebKit.xcodeproj/project.pbxproj: 2021-01-06 Alex Christensen Modernize WebContextMenu https://bugs.webkit.org/show_bug.cgi?id=219969 Reviewed by Tim Horton. This is old code, complete with a raw pointer. Use references instead of pointers where possible, and WeakPtr instead of a raw pointer. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageClickMenuItem): (WKBundlePageCopyContextMenuItems): * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::showContextMenu): * WebProcess/WebPage/WebContextMenu.cpp: (WebKit::WebContextMenu::WebContextMenu): * WebProcess/WebPage/WebContextMenu.h: (WebKit::WebContextMenu::create): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::contextMenu): (WebKit::WebPage::contextMenuAtPointInWindow): (WebKit::handleContextMenuEvent): (WebKit::WebPage::contextMenuForKeyEvent): 2021-01-06 Sihui Liu Stop speech recognition if page becomes invisible https://bugs.webkit.org/show_bug.cgi?id=220073 Reviewed by Youenn Fablet. We should not allow speech recognition on page invisible to user, because page may get content of captured audio without user's notice. To do this, we should: 1. deny speech recognition request on invisibile page 2. abort ongoing speech recognition if page becomes invisible API test: WebKit2.SpeechRecognitionPageBecomesInvisible * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::abortForPageIsBecomingInvisible): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchActivityStateChange): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::pageIsBecomingInvisible): * UIProcess/WebProcessProxy.h: 2021-01-06 Alex Christensen Use sendWithAsyncReply instead of iOS-specific GenericCallbacks https://bugs.webkit.org/show_bug.cgi?id=220346 Reviewed by Darin Adler. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _accessibilityRetrieveRectsEnclosingSelectionOffset:withGranularity:]): (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]): (selectionChangedWithGesture): (selectionChangedWithTouch): (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]): (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]): (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]): (-[WKContentView updateCurrentFocusedElementInformation:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::requestFocusedElementInformation): (WebKit::WebPageProxy::selectWithGesture): (WebKit::WebPageProxy::updateSelectionWithTouches): (WebKit::WebPageProxy::selectWithTwoTouches): (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset): (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText): (WebKit::WebPageProxy::gestureCallback): Deleted. (WebKit::WebPageProxy::touchesCallback): Deleted. (WebKit::WebPageProxy::selectionRectsCallback): Deleted. (WebKit::WebPageProxy::focusedElementInformationCallback): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestFocusedElementInformation): (WebKit::WebPage::selectWithGesture): (WebKit::WebPage::updateSelectionWithTouches): (WebKit::WebPage::selectWithTwoTouches): (WebKit::WebPage::getRectsForGranularityWithSelectionOffset): (WebKit::WebPage::getRectsAtSelectionOffsetWithText): 2021-01-06 Per Arne Vollan [iOS] Silence selected sandbox violation reports https://bugs.webkit.org/show_bug.cgi?id=220320 Reviewed by Darin Adler. For performance reasons, benign sandbox violations in the WebContent process can be silenced on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-01-06 Per Arne Vollan [iOS] Add missing endpoint in sandbox message filter https://bugs.webkit.org/show_bug.cgi?id=219731 Reviewed by Darin Adler. Add missing endpoint in the WebContent process' sandbox message filter on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2021-01-05 Eric Carlson [Cocoa] WebM format reader doesn't work with a url in a element https://bugs.webkit.org/show_bug.cgi?id=219961 Reviewed by Andy Estes. Only enable a WebM track when the it has FlagEnabled element, or when we see that it has media samples. This is necessary because there are WebM files with empty tracks, and CoreMedia won't play a file if any enabled track doesn't have samples. * Shared/mac/MediaFormatReader/FormatReader.cpp: (WebKit::FormatReader::didParseTracks): * Shared/mac/MediaFormatReader/TrackReader.cpp: (WebKit::TrackReader::create): (WebKit::TrackReader::TrackReader): (WebKit::TrackReader::finishParsing): (WebKit::TrackReader::isEnabled const): (WebKit::TrackReader::copyProperty): * Shared/mac/MediaFormatReader/TrackReader.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2021-01-05 Wenson Hsieh Refactor some logic around touch event deferring gesture recognizers https://bugs.webkit.org/show_bug.cgi?id=220345 Reviewed by Tim Horton. Rename `_deferringGestureRecognizerForFoo` to `_touchStartDeferringGestureRecognizerForFoo`, to make it clear that these deferring gestures are only intended to defer native gestures until the "touchstart" event has been handled. This distinction becomes important once I introduce deferring gesture recognizers that defer the "touchend" event, and prevent gestures that activate upon touch end (i.e. various types of tap gesture recognizers). See below for more details. * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::doneDeferringTouchStart): (WebKit::PageClientImpl::doneDeferringNativeGestures): Deleted. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView _touchStartDeferringGestures]): (-[WKContentView _doneDeferringTouchStart:]): (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): (-[WKContentView _deferringGestureRecognizers]): Deleted. (-[WKContentView _doneDeferringNativeGestures:]): Deleted. Rename this to `-_doneDeferringTouchStart:`. (-[WKContentView deferringGestureRecognizer:shouldDeferGesturesAfterEndingTouchesWithEvent:]): Deleted. This logic has been moved to WKContentView (see below). * UIProcess/ios/WKDeferringGestureRecognizer.h: * UIProcess/ios/WKDeferringGestureRecognizer.mm: (-[WKDeferringGestureRecognizer touchesEnded:withEvent:]): Deleted. Additionally refactor this code so that this fallback logic for lifting the gesture gate exists inside `WKContentView` (after ending all touches), rather than inside the deferring gesture recognizer. While this doesn't affect the extant touch start deferring gestures, it will ensure that touch end deferring gestures won't get reset prematurely due to the web touch events gesture recognizer ending before the touch end deferring gesture. 2021-01-05 Kate Cheney NSCrossWebsiteTrackingUsageDescription is not working on Mac, ITP is always enabled https://bugs.webkit.org/show_bug.cgi?id=220190 Reviewed by Brent Fulgham. Consider the presence of the NSCrossWebsiteTrackingUsageDescription key as an indication to disable ITP for WKWebView until we implement a mechanism for disabling it in WKWebView like we do for iOS to avoid compatibility bugs. * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::determineITPStateInternal): 2021-01-05 Aditya Keerthi REGRESSION (r261157): Crash in WKSelectPopover when running as iPhone app on iPad https://bugs.webkit.org/show_bug.cgi?id=220065 Reviewed by Darin Adler. r261157 changed how WebKit determined the user interface idiom for WKWebViews that were created in daemons. Since daemons do not create UIApplications, WebKit cannot use UIDevice in these instances. Instead, the user interface idiom determination logic was updated to include a check for device hardware, using MobileGestalt, in cases where no UIApplication was created. Since WebKit only determines the user interface idiom once (then storing the obtained value), the added determination logic breaks down for iPhone apps on iPad. Consider the following sequence of events, eventually leading to a crash when interacting with a element, WebKit checks its saved idiom, an attempts to present a UIPopoverController (the standard behavior under the iPad idiom). 5. However, since the actual idiom is iPhone, UIKit throws an NSInvalidArgumentException, since UIPopoverController should not be used when running under the iPhone idiom. A simple fix for the crash would be to call into UIKit to check the idiom each time it is required, rather than relying on the saved bit. However, this does not address the more general issue, which is that WebKit's saved idiom and the actual idiom can be out of sync. Consequently, the approach taken is to update the saved idiom when it changes. This should only occur when a UIApplication is initialized. Hence, we listen for UIApplicationDidFinishLaunchingNotification, and if the actual idiom is different from our saved idiom, we update the saved idiom and also notify the WebProcess. * Shared/UserInterfaceIdiom.h: * Shared/UserInterfaceIdiom.mm: (WebKit::updateCurrentUserInterfaceIdiom): This method checks the actual idiom and updates the saved idiom if they differ. Returns true only if the idiom was updated. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::registerNotificationObservers): Listen for UIApplicationDidFinishLaunchingNotification if the idiom can change (UIApplication is uninitialized). Then, if the actual and saved idiom differ, notify all WebProcesses of the change. (WebKit::WebProcessPool::unregisterNotificationObservers): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::userInterfaceIdiomDidChange): Update the saved idiom using the information from the UIProcess. 2021-01-05 Chris Dumez [iOS] Add a feature flag to stop leaking an XPC boost message to XPC services https://bugs.webkit.org/show_bug.cgi?id=219453 Reviewed by Geoff Garen. Add a feature flag to stop leaking an XPC boost message to XPC services on builds where RunningBoard is able to give the right priorities to our XPC services based on the type of RunningBoard assertion is being held. There is no behavior change for the Network/WebContent processes since those were blocklisted in RunningBoard (Turning on the RB_full_manage_WK_jetsam feature flag gives us the default RunningBoard behavior without blocklisting). However, this allows the new GPUProcess to move to IDLE jetsam band when homing out of MobileSafari, which makes the GPUProcess eligible for the freezer. Previously, the leaked boost message would keep the GPUProcess in a higher jetsam band. For now, the feature flag is off by default. I will turn it on later on. * FeatureFlags/WebKit.plist: Add RB_full_manage_WK_jetsam feature flag but keep it off for now. On recent enough builds of RunningBoard, this flag disables the blocklisting of the WebContent/Network processes in RunningBoard so that RunningBoard can now set the priority of those processes (instead of us boosting our priority via boost messages). * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: Set _ProcessType=App so that RunningBoard is able to set the priority of our XPC services on iOS. Without this change, we get a permission denied when RunningBoard attempts to set the priority of our XPC services. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::shouldLeakBoost): Stop leaking a boost message on iOS when RUNNINGBOARD_WEBKIT_PRIORITY_SUPPORT compile-time flag is enabled and when the RB_full_manage_WK_jetsam feature flag is enabled. 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of AttributedStringForCharacterRangeCallback and FontAtSelectionCallback https://bugs.webkit.org/show_bug.cgi?id=220344 Reviewed by Geoffrey Garen. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::updateFontManagerIfNeeded): (WebKit::WebViewImpl::attributedSubstringForProposedRange): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync): (WebKit::WebPageProxy::fontAtSelection): (WebKit::WebPageProxy::attributedStringForCharacterRangeCallback): Deleted. (WebKit::WebPageProxy::fontAtSelectionCallback): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): (WebKit::WebPage::fontAtSelection): 2021-01-05 John Wilander PCM: Experimental debug mode stops working after initial use https://bugs.webkit.org/show_bug.cgi?id=220336 Reviewed by Brent Fulgham. The existing experimental PCM debug mode uses RuntimeEnabledFeatures::sharedFeatures().privateClickMeasurementDebugModeEnabled() which is not correct in the network process. This makes the flag to lose its state after navigations in new tabs. This patch moves the flag to be alongside the PCM feature flag in WebKit::NetworkProcess. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcess::privateClickMeasurementDebugModeEnabled const): * NetworkProcess/NetworkProcess.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::debugModeEnabled const): 2021-01-05 Kimmo Kinnunen WebKit IPC generator tests have duplicate receiver names, limiting the implementation https://bugs.webkit.org/show_bug.cgi?id=220236 Reviewed by Chris Dumez. IPC test message receivers defined multiple receivers with same name. Rename the test message receivers based on what feature they test. No change in the non-test code. The IPC works with message identifier defined by the MessageName type. Having multiple clashing receiver names is problematic because a MessageName is defined by pair . Since different receivers might have different kinds of messages with same message name, these might end up mapping to two conflicting message kinds. The rename of test classes makes the tests conform to the already used contract that the MessageName is globally unique to each individual conceptual message because the receiver names are unique. This enables further implementations that make decisions based on the message name. Example is to decide whether a message is synchronous or not. This cannot be implemented generally if there is multiple different kinds of messages with same name. Rename the test message receiver files based on the receiver name. This is more consistent with the existing convention used in the actual code. Move the script test results from the Scripts/ directory to a tests/ subdirectory of the tool. This is to not fill the Scripts/ directory with Scripts/webkit/ related test result data. Adds previously missing test result file MessageArgumentDescriptions.cpp, which was not added when the feature was implemented. Tested by existing tests and new model_unittest.py. * Scripts/Makefile: Removed. * Scripts/MessageNames.cpp: Removed. * Scripts/MessageNames.h: Removed. * Scripts/generate-message-receiver.py: (main): * Scripts/test-legacyMessageReceiver.cpp: Removed. * Scripts/testMessageReceiver.cpp: Removed. * Scripts/webkit/messages.py: * Scripts/webkit/messages_unittest.py: (ParsingTest.test_receiver): (GeneratedFileContentsTest.assertGeneratedFileContentsEqual): * Scripts/webkit/model.py: (Parameter.has_attribute): (check_global_model): * Scripts/webkit/model_unittest.py: Added. (ModelCheckTest): (ModelCheckTest.test_duplicate_receivers): (test_mismatch_message_attribute_sync): * Scripts/webkit/tests/Makefile: Added. * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: Added. (IPC::jsValueForArguments): (IPC::jsValueForReplyArguments): (IPC::messageArgumentDescriptions): (IPC::messageReplyArgumentDescriptions): (IPC::messageIsSync): * Scripts/webkit/tests/MessageNames.cpp: Added. (IPC::description): (IPC::receiverName): (IPC::isValidMessageName): * Scripts/webkit/tests/MessageNames.h: Added. (WTF::isValidEnum): * Scripts/webkit/tests/TestWithLegacyReceiver.messages.in: Renamed from Source/WebKit/Scripts/webkit/test-legacy.messages.in. * Scripts/webkit/tests/TestWithLegacyReceiverMessageReceiver.cpp: Added. (Messages::TestWithLegacyReceiver::GetPluginProcessConnection::send): (Messages::TestWithLegacyReceiver::TestMultipleAttributes::send): (WebKit::TestWithLegacyReceiver::didReceiveTestWithLegacyReceiverMessage): (WebKit::TestWithLegacyReceiver::didReceiveSyncTestWithLegacyReceiverMessage): * Scripts/webkit/tests/TestWithLegacyReceiverMessages.h: Renamed from Source/WebKit/Scripts/test-legacyMessages.h. (Messages::TestWithLegacyReceiver::messageReceiverName): (Messages::TestWithLegacyReceiver::LoadURL::name): (Messages::TestWithLegacyReceiver::LoadSomething::name): (Messages::TestWithLegacyReceiver::TouchEvent::name): (Messages::TestWithLegacyReceiver::AddEvent::name): (Messages::TestWithLegacyReceiver::LoadSomethingElse::name): (Messages::TestWithLegacyReceiver::DidReceivePolicyDecision::name): (Messages::TestWithLegacyReceiver::Close::name): (Messages::TestWithLegacyReceiver::PreferencesDidChange::name): (Messages::TestWithLegacyReceiver::SendDoubleAndFloat::name): (Messages::TestWithLegacyReceiver::SendInts::name): (Messages::TestWithLegacyReceiver::CreatePlugin::name): (Messages::TestWithLegacyReceiver::RunJavaScriptAlert::name): (Messages::TestWithLegacyReceiver::GetPlugins::name): (Messages::TestWithLegacyReceiver::GetPluginProcessConnection::name): (Messages::TestWithLegacyReceiver::TestMultipleAttributes::name): (Messages::TestWithLegacyReceiver::TestParameterAttributes::name): (Messages::TestWithLegacyReceiver::TemplateTest::name): (Messages::TestWithLegacyReceiver::SetVideoLayerID::name): (Messages::TestWithLegacyReceiver::DidCreateWebProcessConnection::name): (Messages::TestWithLegacyReceiver::InterpretKeyEvent::name): (Messages::TestWithLegacyReceiver::DeprecatedOperation::name): (Messages::TestWithLegacyReceiver::ExperimentalOperation::name): * Scripts/webkit/tests/TestWithLegacyReceiverMessagesReplies.h: Renamed from Source/WebKit/Scripts/testMessagesReplies.h. * Scripts/webkit/tests/TestWithSuperclass.messages.in: Renamed from Source/WebKit/Scripts/webkit/test-superclass.messages.in. * Scripts/webkit/tests/TestWithSuperclassMessageReceiver.cpp: Renamed from Source/WebKit/Scripts/test-superclassMessageReceiver.cpp. (WebKit::TestWithSuperclass::didReceiveMessage): (WebKit::TestWithSuperclass::didReceiveSyncMessage): * Scripts/webkit/tests/TestWithSuperclassMessages.h: Renamed from Source/WebKit/Scripts/test-superclassMessages.h. (Messages::TestWithSuperclass::messageReceiverName): (Messages::TestWithSuperclass::LoadURL::name): (Messages::TestWithSuperclass::TestAsyncMessage::name): (Messages::TestWithSuperclass::TestAsyncMessage::asyncMessageReplyName): (Messages::TestWithSuperclass::TestAsyncMessageWithNoArguments::name): (Messages::TestWithSuperclass::TestAsyncMessageWithNoArguments::asyncMessageReplyName): (Messages::TestWithSuperclass::TestAsyncMessageWithMultipleArguments::name): (Messages::TestWithSuperclass::TestAsyncMessageWithMultipleArguments::asyncMessageReplyName): (Messages::TestWithSuperclass::TestAsyncMessageWithConnection::name): (Messages::TestWithSuperclass::TestAsyncMessageWithConnection::asyncMessageReplyName): (Messages::TestWithSuperclass::TestSyncMessage::name): (Messages::TestWithSuperclass::TestSynchronousMessage::name): * Scripts/webkit/tests/TestWithSuperclassMessagesReplies.h: Renamed from Source/WebKit/Scripts/test-superclassMessagesReplies.h. * Scripts/webkit/tests/TestWithoutAttributes.messages.in: Renamed from Source/WebKit/Scripts/webkit/test.messages.in. * Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp: Added. (Messages::TestWithoutAttributes::GetPluginProcessConnection::send): (Messages::TestWithoutAttributes::TestMultipleAttributes::send): (WebKit::TestWithoutAttributes::didReceiveMessage): (WebKit::TestWithoutAttributes::didReceiveSyncMessage): * Scripts/webkit/tests/TestWithoutAttributesMessages.h: Renamed from Source/WebKit/Scripts/testMessages.h. (Messages::TestWithoutAttributes::messageReceiverName): (Messages::TestWithoutAttributes::LoadURL::name): (Messages::TestWithoutAttributes::LoadSomething::name): (Messages::TestWithoutAttributes::TouchEvent::name): (Messages::TestWithoutAttributes::AddEvent::name): (Messages::TestWithoutAttributes::LoadSomethingElse::name): (Messages::TestWithoutAttributes::DidReceivePolicyDecision::name): (Messages::TestWithoutAttributes::Close::name): (Messages::TestWithoutAttributes::PreferencesDidChange::name): (Messages::TestWithoutAttributes::SendDoubleAndFloat::name): (Messages::TestWithoutAttributes::SendInts::name): (Messages::TestWithoutAttributes::CreatePlugin::name): (Messages::TestWithoutAttributes::RunJavaScriptAlert::name): (Messages::TestWithoutAttributes::GetPlugins::name): (Messages::TestWithoutAttributes::GetPluginProcessConnection::name): (Messages::TestWithoutAttributes::TestMultipleAttributes::name): (Messages::TestWithoutAttributes::TestParameterAttributes::name): (Messages::TestWithoutAttributes::TemplateTest::name): (Messages::TestWithoutAttributes::SetVideoLayerID::name): (Messages::TestWithoutAttributes::DidCreateWebProcessConnection::name): (Messages::TestWithoutAttributes::InterpretKeyEvent::name): (Messages::TestWithoutAttributes::DeprecatedOperation::name): (Messages::TestWithoutAttributes::ExperimentalOperation::name): * Scripts/webkit/tests/TestWithoutAttributesMessagesReplies.h: Renamed from Source/WebKit/Scripts/test-legacyMessagesReplies.h. 2021-01-05 Tim Horton SourcesCocoa.txt should not be installed in the Web Content service bundle https://bugs.webkit.org/show_bug.cgi?id=220338 Reviewed by Wenson Hsieh. * WebKit.xcodeproj/project.pbxproj: Remove SourcesCocoa.txt from the target. 2021-01-05 Peng Liu [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed https://bugs.webkit.org/show_bug.cgi?id=220334 Reviewed by Eric Carlson. Update the IPC message RemoteSourceBufferProxy::RemoveCodedFrames to implement SourceBufferPrivateRemote::removeCodedFrames(). * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::removeCodedFrames): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::removeCodedFrames): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2021-01-05 Ryan Haddad Unreviewed, reverting r271169. Caused TestWebKitAPI.WebKit2.SpeechRecognitionErrorWhenStartingAudioCaptureOnDifferentPage to time out on macOS. Reverted changeset: "Stop speech recognition if page becomes invisible" https://bugs.webkit.org/show_bug.cgi?id=220073 https://trac.webkit.org/changeset/271169 2021-01-05 Alex Christensen Make WebPage::ForceRepaint use CompletionHandler instead of VoidCallback https://bugs.webkit.org/show_bug.cgi?id=212269 Reviewed by Chris Dumez. Fix a few unsafe pointer uses along the way. No change in behavior. * UIProcess/API/C/WKPage.cpp: (WKPageForceRepaint): * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::forceRepaintIfNeeded): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::forceRepaint): * UIProcess/WebPageProxy.h: * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): (-[WKFullScreenWindowController _completedExitFullScreen]): * UIProcess/mac/WKFullScreenWindowController.h: * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController dealloc]): (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): (WebKit::LayerTreeHost::forceRepaintAsync): (WebKit::LayerTreeHost::renderNextFrame): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: (WebKit::LayerTreeHost::forceRepaintAsync): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::forceRepaintAsync): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::forceRepaint): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync): 2021-01-05 Sihui Liu Stop speech recognition if page becomes invisible https://bugs.webkit.org/show_bug.cgi?id=220073 Reviewed by Youenn Fablet. We should not allow speech recognition on page invisible to user, because page may get content of captured audio without user's notice. To do this, we should: 1. deny speech recognition request on invisibile page 2. abort ongoing speech recognition if page becomes invisible API test: WebKit2.SpeechRecognitionPageBecomesInvisible * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::abortForPageIsBecomingInvisible): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchActivityStateChange): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::pageIsBecomingInvisible): * UIProcess/WebProcessProxy.h: 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of ValidateCommandCallback https://bugs.webkit.org/show_bug.cgi?id=220124 Reviewed by Chris Dumez. * UIProcess/API/C/WKPage.cpp: (WKPageValidateCommand): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::validateUserInterfaceItem): * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::validateCommand): (WebKit::WebPageProxy::validateCommandCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::~WebProcessPool): * UIProcess/WebProcessPool.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::validateCommand): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of FontAttributesCallback https://bugs.webkit.org/show_bug.cgi?id=220123 Reviewed by Chris Dumez. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::typingAttributesWithCompletionHandler): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart): (WebKit::WebPageProxy::fontAttributesCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::requestFontAttributesAtSelectionStart): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of RectForCharacterRangeCallback https://bugs.webkit.org/show_bug.cgi?id=220125 Reviewed by Chris Dumez. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::firstRectForCharacterRange): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::firstRectForCharacterRangeAsync): (WebKit::WebPageProxy::rectForCharacterRangeCallback): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::firstRectForCharacterRangeAsync): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-01-05 Sihui Liu Fail speech recognition when page is muted for audio capture https://bugs.webkit.org/show_bug.cgi?id=220133 Reviewed by Youenn Fablet. We currently only allow one page to capture media at a time and we did this by muting (stop capture in) other pages. To make speech recognition work with this behavior, two changes are made: 1. when page is muted, mute audio capture source used for speech recognition on the page. This will ultimately fail recognition. 2. when speech recognition is about to start, make sure other pages are muted for capture. * UIProcess/SpeechRecognitionPermissionManager.h: (WebKit::SpeechRecognitionPermissionManager::page): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::mute): * UIProcess/SpeechRecognitionServer.h: * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::muteCaptureMediaStreamsExceptIn): Deleted. * UIProcess/UserMediaProcessManager.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): (WebKit::WebPageProxy::setMuted): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::muteCaptureInPagesExcept): (WebKit::WebProcessProxy::pageMutedStateChanged): * UIProcess/WebProcessProxy.h: 2021-01-05 Alex Christensen Use WeakHashSet instead of HashSet https://bugs.webkit.org/show_bug.cgi?id=220102 Reviewed by Darin Adler. * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::setAsynchronousSpellCheckingEnabled): (WebKit::InjectedBundle::setUserStyleSheetLocation): (WebKit::InjectedBundle::liveDocumentURLs): * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::dispatchLocalStorageEvent): 2021-01-05 Alex Christensen Use sendWithAsyncReply instead of SelectionContextCallback https://bugs.webkit.org/show_bug.cgi?id=220121 Reviewed by Chris Dumez. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _lookupForWebView:]): (-[WKContentView requestDictationContext:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::requestDictationContext): (WebKit::WebPageProxy::getSelectionContext): (WebKit::WebPageProxy::selectionContextCallback): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getSelectionContext): (WebKit::WebPage::requestDictationContext): 2021-01-05 Youenn Fablet Enable WebRTC codecs in GPU process only for --use-gpu-process option https://bugs.webkit.org/show_bug.cgi?id=220316 Reviewed by Alexey Proskuryakov. ADD C SPI used by TestController. Manually tested. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebRTCPlatformCodecsInGPUProcessEnabled): (WKPreferencesGetWebRTCPlatformCodecsInGPUProcessEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: 2021-01-04 Jeff Miller Update user-visible copyright strings to include 2021 https://bugs.webkit.org/show_bug.cgi?id=219901 Reviewed by Anders Carlsson. * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist: * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * Info.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-OSX.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.Info.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-OSX.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: 2021-01-02 Rob Buis Remove some FrameLoader::changeLocation parameters https://bugs.webkit.org/show_bug.cgi?id=220186 Reviewed by Darin Adler. Adapt to API change. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::clickedLink): * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::searchWithGoogle): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick): 2020-12-23 Said Abou-Hallawa [GPU Process]: Don't call flushDrawingContext() in the middle of recording drawing commands https://bugs.webkit.org/show_bug.cgi?id=220126 Reviewed by Simon Fraser. There is no need to replay back the DrawImageBuffer immediately after it was recorded. The worry was the source ImageBuffer may change before replaying back the DrawImageBuffer into the destination ImageBuffer. But this should not happen with the shared memory buffer because the order of drawing among multiple ImageBuffer is preserved. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::display): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-12-23 Peng Liu [Media in GPU Process][MSE] Clean up SourceBufferPrivateRemote and implement functions with new IPC messages https://bugs.webkit.org/show_bug.cgi?id=220122 Reviewed by Eric Carlson. Add IPC messages and handlers in `RemoteSourceBufferProxy` to implement the added functions of `SourceBufferPrivateRemote`. Also add an IPC message to forward the `HighestPresentationTimestampChanged` callback from `RemoteSourceBufferProxy` to `SourceBufferPrivateRemote`. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHighestPresentationTimestampChanged): (WebKit::RemoteSourceBufferProxy::setMediaSourceEnded): (WebKit::RemoteSourceBufferProxy::setMode): (WebKit::RemoteSourceBufferProxy::startChangingType): (WebKit::RemoteSourceBufferProxy::removeCodedFrames): (WebKit::RemoteSourceBufferProxy::setAllTrackBuffersNeedRandomAccess): (WebKit::RemoteSourceBufferProxy::setGroupStartTimestamp): (WebKit::RemoteSourceBufferProxy::setGroupStartTimestampToEndTimestamp): (WebKit::RemoteSourceBufferProxy::setShouldGenerateTimestamps): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * Scripts/webkit/messages.py: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::setMediaSourceEnded): (WebKit::SourceBufferPrivateRemote::setMode): (WebKit::SourceBufferPrivateRemote::removeCodedFrames): (WebKit::SourceBufferPrivateRemote::setAllTrackBuffersNeedRandomAccess): (WebKit::SourceBufferPrivateRemote::setGroupStartTimestamp): (WebKit::SourceBufferPrivateRemote::setGroupStartTimestampToEndTimestamp): (WebKit::SourceBufferPrivateRemote::setShouldGenerateTimestamps): (WebKit::SourceBufferPrivateRemote::startChangingType): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateHighestPresentationTimestampChanged): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: 2020-12-23 Peng Liu [Media in GPU Process][MSE] Media element does not fire "resize" event https://bugs.webkit.org/show_bug.cgi?id=220119 Reviewed by Eric Carlson. Implement `RemoteMediaPlayerProxy::mediaPlayerSizeChanged()` to forward the video resize callback from MSE media player to web process. No new tests, covered by existing failing layout test. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerSizeChanged): * GPUProcess/media/RemoteMediaPlayerProxy.h: 2020-12-23 Simon Fraser Standardize on "allows scrolling" terminology instead of asking about scrollbars https://bugs.webkit.org/show_bug.cgi?id=220111 Reviewed by Wenson Hsieh. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): 2020-12-22 Dean Jackson Use an enum class to identify WebGL versions https://bugs.webkit.org/show_bug.cgi?id=220099 Reviewed by Ken Russell. Encode the WebGL version. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: 2020-12-22 Kate Cheney Cannot see 'Add to my stations' button in BBC World service Radio https://bugs.webkit.org/show_bug.cgi?id=219949 Reviewed by Alex Christensen. This is a temporary quirk to assist a high-traffic website while they complete the large task of migrating away from site compatibility using third party cookies. This quirk will be removed when the site is updated. Create a quirk that will call the Storage Access API on behalf of BBC for radioplayer.co.uk under bbc.co.uk. When the user clicks to open the radio player pop-up, storage access is requested. If the user grants permission, then we open the pop-up to static.radioplayer.co.uk to get first party status, then immediately redirect to the radio player page. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral): Change wording now that quirks are not only being used for login flows. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createNewPage): Mark the quirk-initiated pop-up as user-initiated so it doesn't get blocked. 2020-12-22 Ryan Haddad Unreviewed, fix the build with recent SDKs. * UIProcess/PDF/WKPDFHUDView.mm: (-[WKPDFHUDView _getImageForControlName:]): * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: (-[WKScrollerImpDelegate effectiveAppearanceForScrollerImp:]): 2020-12-22 Youenn Fablet [iOS] Do extensive search for microphone devices when trying to capture https://bugs.webkit.org/show_bug.cgi?id=220010 Reviewed by Eric Carlson. Enable exhaustive audio device query in case getUserMedia is called for audio capture. In case the manager is destroyed or reset after some time without capturing, make sure to disable exhaustive audio device query if no other page need it. * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::invalidatePendingRequests): (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess): (WebKit::UserMediaPermissionRequestManagerProxy::startProcessingUserMediaPermissionRequest): * UIProcess/UserMediaPermissionRequestManagerProxy.h: 2020-12-21 Wenson Hsieh REGRESSION (iOS 14): Bad access crash in ShareableBitmap::makeCGImageCopy() under assignLegacyDataForContextMenuInteraction() https://bugs.webkit.org/show_bug.cgi?id=219843 Reviewed by Geoffrey Garen. Apply a speculative fix for the crash by making the UI process robust in the case where the requested position information has the `isImage` flag set, but no native image. Additionally, keep the existing debug assertions by moving them outside of their current if statements. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView assignLegacyDataForContextMenuInteraction]): (-[WKContentView continueContextMenuInteraction:]): 2020-12-21 Chris Dumez Simplify CARingBuffer usage with SharedMemory storage https://bugs.webkit.org/show_bug.cgi?id=220047 Reviewed by Geoff Garen. Simplify CARingBuffer usage with SharedMemory storage: 1. There are now 2 storage types: - ReadOnlySharedRingBufferStorage: Used by the reader - SharedRingBufferStorage: Used by the writer One type inherits the other. This allows the API to be a bit clearer and we can drop the m_readyOnly flag. 2. Drop SharedRingBufferStorage::updateReadOnlyStorage() function. Instead, the reader can now construct a new ReadOnlySharedRingBufferStorage directly of the SharedMemory handle and pass it to the CARingBuffer constructor. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::RemoteAudioDestination): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::RemoteAudioMediaStreamTrackRenderer): (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::RemoteMediaRecorder): (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): * GPUProcess/webrtc/RemoteMediaRecorder.h: * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::ReadOnlySharedRingBufferStorage::ReadOnlySharedRingBufferStorage): (WebKit::ReadOnlySharedRingBufferStorage::data): (WebKit::ReadOnlySharedRingBufferStorage::sharedFrameBounds const): (WebKit::ReadOnlySharedRingBufferStorage::getCurrentFrameBounds): (WebKit::ReadOnlySharedRingBufferStorage::flush): (WebKit::ReadOnlySharedRingBufferStorage::updateFrameBounds): (WebKit::SharedRingBufferStorage::setStorage): (WebKit::SharedRingBufferStorage::allocate): (WebKit::SharedRingBufferStorage::deallocate): (WebKit::SharedRingBufferStorage::setCurrentFrameBounds): * Shared/Cocoa/SharedRingBufferStorage.h: (WebKit::ReadOnlySharedRingBufferStorage::storage const): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::m_ringBuffer): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage): * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::RemoteAudio): (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage): * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::RemoteAudio): (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): 2020-12-21 Alex Christensen Retain IPC::Connection when using it when making a NetworkDataTask https://bugs.webkit.org/show_bug.cgi?id=220067 Reviewed by Geoffrey Garen. r265230 helped, but it's still crashing. Maybe we're getting a non-null pointer to an object that is about to be destroyed on another thread. There's no reason not to keep it alive here. Also, don't release assert in isParentProcessAFullWebBrowser if there's no audit token so we don't just kick this can down the road. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::sessionWrapperForTask): 2020-12-21 Ryan Haddad Unreviewed, reverting r270939 and r270952. Caused layout test timeouts on internal bots Reverted changesets: "[Cocoa] WebM format reader doesn't work with a url in a element" https://bugs.webkit.org/show_bug.cgi?id=219961 https://trac.webkit.org/changeset/270939 "[Cocoa] WebM format reader doesn't work with a url in a element" https://bugs.webkit.org/show_bug.cgi?id=219961 https://trac.webkit.org/changeset/270952 2020-12-21 Wenson Hsieh Many websites crash under toDataURL() when enabling GPU process for DOM https://bugs.webkit.org/show_bug.cgi?id=220051 Reviewed by Simon Fraser. Three methods of canvas readback (`toDataURL`, `toData`, and `toBGRAData`) currently cause the web content process to crash when enabling GPU process for DOM rendering. This is because we attempt to call into the respective methods on the image buffer backend following r270342, which unconditionally fire release assertions. Instead of using the proxy image buffer backend object in the web process, we need to communicate with the platform `RemoteImageBuffer` in the GPU process. To do this, we add some plumbing through `RemoteRenderingBackendProxy` and `RemoteRenderingBackend`, and override the `toDataURL`, `toData`, and `toBGRAData` methods on `RemoteImageBufferProxy` in the web process to request data from the remote rendering backend instead. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::getDataURLForImageBuffer): (WebKit::RemoteRenderingBackend::getDataForImageBuffer): (WebKit::RemoteRenderingBackend::getBGRADataForImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::getImageData): (WebKit::RemoteRenderingBackendProxy::getDataURLForImageBuffer): (WebKit::RemoteRenderingBackendProxy::getDataForImageBuffer): (WebKit::RemoteRenderingBackendProxy::getBGRADataForImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-21 Kate Cheney Missing textInteractionEnabled key in WKPreferences initWithCoder looks like a false value. https://bugs.webkit.org/show_bug.cgi?id=220061 Reviewed by Wenson Hsieh. We should check for the existence of the textInteractionEnabled key in the NSCoder before updating the default value in WKPreferences, otherwise a missing key will register as a false value when the default of textInteractionEnabled should be true. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences initWithCoder:]): 2020-12-21 Sihui Liu Check availability of speech recognition service before requesting permissions https://bugs.webkit.org/show_bug.cgi?id=220033 Reviewed by Youenn Fablet. If speech recognition service is not available for target language (maybe the language is not supported, user turns off dictation in system settings, etc), let's just fail the speech recognition request without prompting. Manually tested with MiniBrowser. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::requestSpeechRecognitionAccess): (WebKit::checkSpeechRecognitionServiceAccess): (WebKit::checkSpeechRecognitionServiceAvailability): * UIProcess/MediaPermissionUtilities.h: * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/SpeechRecognitionPermissionRequest.h: (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::lang const): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::requestPermissionForRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): 2020-12-21 Alicia Boya García [MSE] Fix allSamplesInTrackEnqueued() handling https://bugs.webkit.org/show_bug.cgi?id=220055 Reviewed by Philippe Normand. trySignalAllSamplesInTrackEnqueued() does not need to be exposed outside of SourceBufferPrivate. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::trySignalAllSamplesInTrackEnqueued): Deleted. * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::trySignalAllSamplesInTrackEnqueued): Deleted. * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-20 Chris Dumez Unreviewed, reverting r270969. Regressed MotionMark with GPUProcess enabled Reverted changeset: "[iOS] Stop leaking an XPC boost message to XPC services" https://bugs.webkit.org/show_bug.cgi?id=219453 https://trac.webkit.org/changeset/270969 2020-12-20 Rob Buis Convert remaining FrameLoaderType enums to enum classes https://bugs.webkit.org/show_bug.cgi?id=219898 Reviewed by Sam Weinig. Adapt to enum class changes. * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameGetFrameLoadState): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): 2020-12-19 Rob Buis Move FrameLoader::arePluginsEnabled to Frame https://bugs.webkit.org/show_bug.cgi?id=220022 Reviewed by Sam Weinig. Adapt to API change. * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::pluginInfo): (WebKit::WebPluginInfoProvider::populatePluginCache): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::objectContentType): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createPlugin): (WebKit::WebPage::canPluginHandleResponse): (WebKit::WebPage::canShowMIMEType const): 2020-12-19 Brent Fulgham REGRESSION(r270575): [iOS] Correct GPU Process sandbox syntax error https://bugs.webkit.org/show_bug.cgi?id=220041 Unreviewed build fix after r270575. A closing parentheses was omitted when the 'play-audio' rule was changed to remove its last rule. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: 2020-12-18 Tim Horton iOS wheel events don't work on many websites https://bugs.webkit.org/show_bug.cgi?id=220034 Reviewed by Simon Fraser. * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent): It turns out that many sites look at the legacy mousewheel event properties, so compute wheelTicks in the same way that we do on macOS. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _scrollView:asynchronouslyHandleScrollEvent:completion:]): If the UI process sends a wheel event with delta=0,0 to the Web Content process, it will not be sent to the page, and thus not handled. If this is the first event, it will prevent future events from being cancelable. Instead, synthetically defer the "Begin" phase to the first event in a given gesture that has non-zero deltas, and just short-circuit any zero-delta events entirely. This way, WebCore can continue with its existing only-the-first-event-is-cancelable logic, and we are assured that the first event that WebCore sees is also the first event that the page sees, and is a Begin-phase event. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::dispatchWheelEventWithoutScrolling): wheelScrollGestureState isn't reset to nullopt until we send the Begin-phase event to EventHandler, so we must make an exception for the Begin-phase event, and explicitly make it cancelable. Otherwise, the state of the previous gesture leaks into the new gesture. Existing API tests caught this, I just apparently failed to run them after adopting the shared wheelScrollGestureState(). 2020-12-18 Brady Eidson Fix some issues with PDFs as . https://bugs.webkit.org/show_bug.cgi?id=220024 Reviewed by Tim Horton. No new tests (Unable to write automated tests) * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::dataProviderGetBytesAtPositionCallback): (WebKit::PDFPlugin::getResourceBytesAtPosition): Set the correct URL. (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData): Try harder to catch mismatches in delivered bytes vs expected bytes. 2020-12-18 Jeff Miller WKProcessPool enhancements for URL schemes https://bugs.webkit.org/show_bug.cgi?id=220030 Reviewed by Brian Weinstein. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _registerURLSchemeAsSecure:]): Added, equivalent to WKContextRegisterURLSchemeAsSecure(). (-[WKProcessPool _registerURLSchemeAsBypassingContentSecurityPolicy:]): Added, equivalent to WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy(). (-[WKProcessPool _setDomainRelaxationForbiddenForURLScheme:]): Added, equivalent to WKContextSetDomainRelaxationForbiddenForURLScheme(). * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 2020-12-18 BJ Burg [Cocoa] Web Inspector: clean up _WKRemoteWebInspectorViewController https://bugs.webkit.org/show_bug.cgi?id=219963 Reviewed by Devin Rousso. Remove deprecated and unused debuggableType-based SPI to load the frontend. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h: Promote the _WKInspectorDebuggableInfo-based SPI to the main header. Fix availability annotations. This class has never worked on iOS. Add TBA annotations for things added since the Big Sur SDK was finalized. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (legacyDebuggableTypeToModernDebuggableType): Deleted. (-[_WKRemoteWebInspectorViewController loadForDebuggableType:backendCommandsURL:]): Deleted. 2020-12-18 Peng Liu [Media in GPU Process][MSE] SourceBufferPrivateRemote needs to override some track buffer related functions of SourceBufferPrivate https://bugs.webkit.org/show_bug.cgi?id=219998 Reviewed by Jer Noble. Implement some track buffer related functions of `SourceBufferPrivateRemote` with new IPC messages. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::resetTrackBuffers): (WebKit::RemoteSourceBufferProxy::clearTrackBuffers): (WebKit::RemoteSourceBufferProxy::resetTimestampOffsetInTrackBuffers): (WebKit::RemoteSourceBufferProxy::setTimestampOffset): (WebKit::RemoteSourceBufferProxy::setAppendWindowStart): (WebKit::RemoteSourceBufferProxy::setAppendWindowEnd): (WebKit::RemoteSourceBufferProxy::updateTrackIds): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack): `MediaSource` manages the track information for the MSE media player, so we should not call `MediaPlayer::addAudioTrack()`, `MediaPlayer::addTextTrack()` and `MediaPlayer::addVideoTrack()`. * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::resetTrackBuffers): (WebKit::SourceBufferPrivateRemote::clearTrackBuffers): (WebKit::SourceBufferPrivateRemote::resetTimestampOffsetInTrackBuffers): (WebKit::SourceBufferPrivateRemote::setTimestampOffset): (WebKit::SourceBufferPrivateRemote::setAppendWindowStart): (WebKit::SourceBufferPrivateRemote::setAppendWindowEnd): (WebKit::SourceBufferPrivateRemote::updateTrackIds): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-18 Sihui Liu SpeechRecognitionRemoteRealtimeMediaSourceManager should not issue sandbox extension for mocked devices https://bugs.webkit.org/show_bug.cgi?id=219972 Reviewed by Eric Carlson. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): We need to sync the preference not only on when mockCaptureDevicesEnabled is set, but also when it is unset. * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::addSource): Grant sandbox extensions to web process when the first source that uses a real device is created. (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::removeSource): Revoke sandbox extensions from web process when the last source that uses a real device is delete. * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h: * UIProcess/SpeechRecognitionServer.cpp: Correct a typo. (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): * UIProcess/SpeechRecognitionServer.h: Correct a typo 2020-12-18 Chris Dumez REGRESSION (r270938): ASSERTION FAILED: !m_renderThread in WebKit::RemoteAudioDestinationProxy::startRenderingThread https://bugs.webkit.org/show_bug.cgi?id=220017 Reviewed by Darin Adler. In case of a GPU process crash, we call stopRenderingThread() and then connectToGPUProcess() which calls startRenderingThread(). We were hitting an assertion in startRenderingThread() making sure that m_renderThread is null because stopRenderingThread() was failing to set it to null after stopping the thread. No new tests, covered by existing failing API test. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::stopRenderingThread): 2020-12-18 Megan Gardner Gate all of the code associated with app highlights https://bugs.webkit.org/show_bug.cgi?id=220003 Reviewed by Tim Horton. * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAppHighlightsEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): 2020-12-18 Chris Dumez [iOS] Stop leaking an XPC boost message to XPC services https://bugs.webkit.org/show_bug.cgi?id=219453 Reviewed by Geoff Garen. Stop leaking an XPC boost message to XPC services on builds where RunningBoard is able to give the right priorities to our XPC services based on the type of RunningBoard assertion is being held. There is no behavior change for the Network/WebContent processes since those were blocklisted in RunningBoard (Turning on the RB_full_manage_WK_jetsam feature flag gives us the default RunningBoard behavior without blocklisting). However, this allows the new GPUProcess to move to IDLE jetsam band when homing out of MobileSafari, which makes the GPUProcess eligible for the freezer. Previously, the leaked boost message would keep the GPUProcess in a higher jetsam band. * FeatureFlags/WebKit.plist: Add RB_full_manage_WK_jetsam feature flag and turn it on. On recent enough builds of RunningBoard, this disables the blocklisting of the WebContent/Network processes in RunningBoard so that RunningBoard can now set the priority of those processes (instead of us boosting our priority via boost messages). * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: Set _ProcessType=App so that RunningBoard is able to set the priority of our XPC services on iOS. Without this change, we get a permission denied when RunningBoard attempts to set the priority of our XPC services. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::shouldLeakBoost): Stop leaking a boost message on iOS when RUNNINGBOARD_WEBKIT_PRIORITY_SUPPORT compile-time flag is enabled and when the RB_full_manage_WK_jetsam feature flag is enabled. 2020-12-17 Kimmo Kinnunen REGRESSION (r268386): Snapshots of WebGL content in the tab picker don't work (black map on Google Maps) https://bugs.webkit.org/show_bug.cgi?id=219946 Reviewed by Dean Jackson. Add dummy implementations of GraphicsContextGL::paintCompositedResultsToCanvas. Painting to canvas is not implemented yet for the remote GraphicsContextGL implementation. * GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp: (WebKit::RemoteGraphicsContextGLCocoa::displayBuffer const): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::paintCompositedResultsToCanvas): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: 2020-12-17 Alex Christensen REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request https://bugs.webkit.org/show_bug.cgi?id=220001 Reviewed by Tim Horton. A ResourceRequest was used after being moved in the super old C SPI that we need to remove, but to keep our client functioning correctly until they do we copy the ResourceRequest instead of moving it. Covered by an API test. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNewWindowAction): 2020-12-17 Chris Dumez [GPUProcess] https://www.waveplayer.info/createmediaelementsource-test/ demo is flaky https://bugs.webkit.org/show_bug.cgi?id=219951 Reviewed by Geoff Garen. The issue was with the following line in AudioSourceProviderAVFObjC::prepare: `m_ringBuffer = m_ringBufferCallback(description, capacity).moveToUniquePtr();` In the case where m_ringBuffer was non-null before the assignment, we would have 2 RingBuffers that would coexist for a very small period of time. When the new one was created, we would send an IPC to the remote process with the shared memory handle of the new RingBuffer. However, very shortly after, the old ring buffer would get destroyed, causing us to send another IPC to the remote process with a null handle (since the shared memory associated with the old ring buffer is getting destroyed). As a result, of this ordering issue, the remote process would end up with a RingBuffer with a null shared memory handle and no audio would be rendered. We could have addressed the issue like so: ``` m_ringBuffer = nullptr; m_ringBuffer = m_ringBufferCallback(description, capacity).moveToUniquePtr(); ``` However, this would be super fragile. Instead, I have made the following changes: 1. If there is already a ringBuffer, reuse it instead of reconstructing it. Calling allocate() with the new parameters on the existing ring buffer is sufficient in this case. 2. Because of 1, the ring buffer creation callback no longer needs to call CARingBuffer::allocate(). I also made the following changes to make the code simpler and to reduce code duplication: - The storage change handler passed to SharedRingBufferStorage is now given as parameter the CAAudioStreamDescription & frameCount. What the handler always does is send an IPC to the remote process to tell it that the storage changed and in all cases, it needs to provide these 2 parameters as well. This is because the remote process will need to call CARingBuffer::allocate(), which requires those 2 parameters. This simplifies our code in some cases since we no longer need a mechanism to retrieve those 2 parameters from inside the storage change handler. - The logic of the StorageChange IPC recipient to update its ringbuffer with the new shared memory handle is complicated and was duplicated in a LOT of places. To address this, I introduced a new SharedRingBufferStorage::updateReadOnlyStorage() function which does exactly what we need. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: (WebKit::RemoteAudioSourceProviderProxy::create): (WebKit::RemoteAudioSourceProviderProxy::createRingBuffer): (WebKit::RemoteAudioSourceProviderProxy::storageChanged): * GPUProcess/media/RemoteAudioSourceProviderProxy.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::SharedRingBufferStorage::setStorage): (WebKit::SharedRingBufferStorage::updateReadOnlyStorage): (WebKit::SharedRingBufferStorage::allocate): (WebKit::SharedRingBufferStorage::deallocate): * Shared/Cocoa/SharedRingBufferStorage.h: (WebKit::SharedRingBufferStorage::SharedRingBufferStorage): (WebKit::SharedRingBufferStorage::storage const): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::storageChanged): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::storageChanged): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::AudioMediaStreamTrackRenderer): (WebKit::AudioMediaStreamTrackRenderer::storageChanged): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): (WebKit::MediaRecorderPrivate::storageChanged): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage): 2020-12-17 Chris Dumez Unreviewed build fix after r270938. Add missing include. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: 2020-12-17 Chris Dumez [WebAudio] Simplify code related to dispatchToRenderThread https://bugs.webkit.org/show_bug.cgi?id=219990 Reviewed by Geoffrey Garen. Simplify code related to dispatchToRenderThread in WebAudio: 1. AudioDestination::start() now always gets called with a non-null dispatchToRenderThread lambda. In the case where there is no AudioWorkletThread to dispatch to, the lambda simply calls its task synchronously. 2. For Cocoa ports, make it so that only AudioDestinationCocoa needs to worry about the dispatchToRenderThread lambda. The dispatchToRenderThread lambda is no longer exposed to subclasses such as MockAudioDestinationCocoa & RemoteAudioDestinationProxy. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::startRenderingThread): (WebKit::RemoteAudioDestinationProxy::startRendering): (WebKit::RemoteAudioDestinationProxy::stopRendering): (WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-12-17 Alex Christensen Fix "Open with Preview" menu item in PDF context menus on Big Sur https://bugs.webkit.org/show_bug.cgi?id=219986 Reviewed by Geoffrey Garen. In r266654 I removed the ability for the web process to open a PDF in Preview on Big Sur. I overlooked the fact that context menus also allow you to open a PDF in Preview, which this fixes by having the UI process initiate the Preview opening if the user clicks on the context menu item with the correct index. * Shared/mac/PDFContextMenu.h: (WebKit::PDFContextMenu::encode const): (WebKit::PDFContextMenu::decode): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::showPDFContextMenu): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::handleContextMenuEvent): 2020-12-17 Kate Cheney Followup patch: Still can't login to my.playstation.com https://bugs.webkit.org/show_bug.cgi?id=219900 Reviewed by Darin Adler. Using curly quotes when constructing the Storage Access prompt message may create issues with localizable strings. We should make a separate localizable string for this quirk case and remove it when Sony migrates away from third party cookies in their login flow. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): (WebKit::buildListForStorageAccessPrompt): Deleted. * UIProcess/Cocoa/WKStorageAccessAlert.h: * UIProcess/Cocoa/WKStorageAccessAlert.mm: (WebKit::presentStorageAccessAlert): (WebKit::presentStorageAccessAlertQuirk): (WebKit::displayStorageAccessAlert): 2020-12-17 Eric Carlson [Cocoa] WebM format reader doesn't work with a url in a element https://bugs.webkit.org/show_bug.cgi?id=219961 Reviewed by Andy Estes. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-12-17 Chris Dumez [GPUProcess] Replace WebAudio rendering timer with a cross-process semaphore https://bugs.webkit.org/show_bug.cgi?id=219964 Reviewed by Geoff Garen. r270907 replaced the per-rendering quantum IPC from the GPUProcess to the WebProcess with a very high-frequency timer in the WebProcess to trigger the rendering. While this works, this seemed a bit fragile and it also adds some latency to avoid missed frames. In this patch, I am replacing the high-frequency timer introduced in r270907 with a cross-process semaphore. When the WebProcess asks the GPU process to create an audio device, the GPUProcess sends it back a MachSendRight to the "rendering" semaphore. The WebProcess then starts a high-priority AudioThread which waits this semaphore to be signaled to render a quantum. Whenever render() gets called on the GPUProcess side, the GPUProcess simply signals the "rendering" semaphore, causing the WebProcess to do the rendering of a quantum. As was the case before, the WebProcess stores rendered buffers into the RingBuffer it shares with the GPUProcess and the GPUProcess fetches from the RingBuffer as needed. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::createRenderSemaphoreSendRight): (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::render): (WebKit::RemoteAudioDestinationManager::createAudioDestination): * GPUProcess/media/RemoteAudioDestinationManager.h: * GPUProcess/media/RemoteAudioDestinationManager.messages.in: * Shared/Cocoa/SharedRingBufferStorage.cpp: * Shared/Cocoa/SharedRingBufferStorage.h: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::startRenderingThread): (WebKit::RemoteAudioDestinationProxy::stopRenderingThread): (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): (WebKit::RemoteAudioDestinationProxy::~RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::stop): (WebKit::RemoteAudioDestinationProxy::renderQuantum): (WebKit::RemoteAudioDestinationProxy::storageChanged): (WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-12-17 Patrick Angle Web Inspector: REGRESSION(r266467): viewing a WebSocket created before Web Inspector was opened doesn't show any message frames https://bugs.webkit.org/show_bug.cgi?id=219510 Reviewed by Youenn Fablet. Restored functionality prior to r266467 so that the `progressIdentifier` (previously `channelIdentifier`) is available from `WebSocketChannel`. * WebProcess/Network/WebSocketChannel.h: 2020-12-17 Rob Buis Make FontCascade::CodePath an enum class https://bugs.webkit.org/show_bug.cgi?id=219947 Reviewed by Alex Christensen. Adapt to enum class change. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setAlwaysUsesComplexTextCodePath): 2020-12-16 Peng Liu [Media in GPU Process][MSE] Add an IPC message BufferedSamplesForTrackId for testing purposes https://bugs.webkit.org/show_bug.cgi?id=219956 Reviewed by Eric Carlson. Implement `SourceBufferPrivateRemote::bufferedSamplesForTrackId()` with a new IPC message. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::bufferedSamplesForTrackId): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::bufferedSamplesForTrackId): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-16 Jiewen Tan Unreviewed, a build fix for the latest Internal SDK * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: 2020-12-16 Kate Cheney Still can't login to my.playstation.com https://bugs.webkit.org/show_bug.cgi?id=219900 Reviewed by John Wilander. Adapted from an original patch by John Wilander. This is a temporary quirk to assist a high-traffic website while they complete the large task of migrating away from login flows that require third party cookies. This quirk will be removed when the site is updated. Create a quirk to call the Storage Access API on behalf of Sony. * UIProcess/Cocoa/UIDelegate.mm: (WebKit::buildList): (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): * UIProcess/Cocoa/WKStorageAccessAlert.mm: (WebKit::presentStorageAccessAlert): Prompt for multiple domains if site-specific quirks are enabled and either Sony login domain is being requested. * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::hasCrossPageStorageAccess const): (WebKit::WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess): * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::addDomainWithPageLevelStorageAccess): Store both Sony login domains as having page level storage access if quirks are enabled and the domain passed is one of the Sony login domains. In this case we know that both login domains were prompted for. 2020-12-16 Chris Dumez [GPUProcess] Avoid doing an IPC per rendering quantum when using WebAudio https://bugs.webkit.org/show_bug.cgi?id=219818 Reviewed by Geoff Garen. Previously, the GPUProcess was sending an IPC to the WebProcess to request to rendering of each quantum, which was very inefficient and a big regression compared to when we do not use a GPUProcess. To address the issue, we now start a rendering timer on the WebProcess side when rendering starts, so that the WebProcess renders each quantum as needed, without needing an IPC from the GPUProcess. Whenever a quantum is rendered, the WebProcess adds it to the RingBuffer it shares with the GPUProcess. To make sure that the WebProcess' writer keeps up with the GPUProcess' reader and that it does not stray too far ahead, the writer keeps track of the last frame that the reader attempted to read. It uses this information to try and stay a few rendering quantums ahead of the GPUProcess, to avoid missed frames. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::RemoteAudioDestination): (WebKit::RemoteAudioDestination::render): * Platform/SharedMemory.h: (WebKit::SharedMemory::protection const): * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::SharedRingBufferStorage::sharedFrameBounds const): (WebKit::SharedRingBufferStorage::setCurrentFrameBounds): (WebKit::SharedRingBufferStorage::setLastReadFrame): (WebKit::SharedRingBufferStorage::lastReadFrame const): * Shared/Cocoa/SharedRingBufferStorage.h: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::startRenderingThread): (WebKit::RemoteAudioDestinationProxy::stopRenderingThreadIfNecessary): (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): (WebKit::RemoteAudioDestinationProxy::~RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::startRendering): (WebKit::RemoteAudioDestinationProxy::stop): (WebKit::RemoteAudioDestinationProxy::stopRenderingIfNecessary): (WebKit::RemoteAudioDestinationProxy::renderQuantum): (WebKit::RemoteAudioDestinationProxy::storageChanged): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: (WebKit::RemoteAudioDestinationProxy::stopRenderingIfNecessary): * WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in: Removed. 2020-12-16 Youenn Fablet REGRESSION [iOS] Flaky GPU Process crash under -[RTCVideoEncoderH264 destroyCompressionSession] https://bugs.webkit.org/show_bug.cgi?id=219899 Reviewed by Alex Christensen. We can no longer get the connection when needed as we are now operating in a background thread. For that reason, capture the IPC connection in the lambda to make sure we have a valid IPC connection. Remove LibWebRTCCodecsProxy when being closed instead of when being destroyed as well. Covered by existing tests. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::~LibWebRTCCodecsProxy): (WebKit::LibWebRTCCodecsProxy::close): (WebKit::LibWebRTCCodecsProxy::createH264Decoder): (WebKit::LibWebRTCCodecsProxy::createH265Decoder): (WebKit::LibWebRTCCodecsProxy::createVP9Decoder): (WebKit::LibWebRTCCodecsProxy::createEncoder): 2020-12-16 Wenson Hsieh Suppress the image extraction interaction while editing text https://bugs.webkit.org/show_bug.cgi?id=219952 Reviewed by Devin Rousso. See radar and WebKitAdditions for more details. * UIProcess/ios/WKContentViewInteraction.h: (WebKit::SuppressInteractionToken::SuppressInteractionToken): (WebKit::SuppressInteractionToken::~SuppressInteractionToken): Add a helper class to help facilitate the temporary removal of UIInteraction objects from a WKContentView. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setIsEditable:]): Use the above helper class to temporarily remove the image extraction interaction while the user is editing text (and is therefore depending on editable text interaction gestures). Note that we avoid unnecessarily clearing out and resetting this member variable when changing focus between editable text fields. (-[WKContentView _didStartProvisionalLoadForMainFrame]): 2020-12-16 Brent Fulgham REGRESSION (r270657) [AS Only] GGE: Netflix, YouTube, Amazon Prime, and Hulu fail to playback https://bugs.webkit.org/show_bug.cgi?id=219954 Reviewed by Per Arne Vollan. Correct a syntax error in a sandbox rule added in r270657. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-15 Simon Fraser Calls to setFixedLayoutSize() should not be inside ENABLE(TEXT_AUTOSIZING) https://bugs.webkit.org/show_bug.cgi?id=219932 Reviewed by Wenson Hsieh. We always want to call setFixedLayoutSize(), whether or not ENABLE(TEXT_AUTOSIZING) is defined. For code simplicity, make resetTextAutosizing() an empty function when ENABLE(TEXT_AUTOSIZING) is not defined. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::dynamicViewportSizeUpdate): (WebKit::WebPage::resetTextAutosizing): (WebKit::WebPage::viewportConfigurationChanged): 2020-12-16 Per Arne Vollan [macOS] Add sandbox parameter for message filter entitlement status https://bugs.webkit.org/show_bug.cgi?id=219852 Reviewed by Brent Fulgham. Add sandbox parameter to determine whether the WebContent process has message filter entitlement. This parameter will be used in the sandbox to enable message filtering. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-16 Youenn Fablet Make sure WebKit WebSocketChannel handle suspend/resume correctly https://bugs.webkit.org/show_bug.cgi?id=219910 Reviewed by Alex Christensen. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::fail): Make sure fail triggers close event if page resumes. 2020-12-15 Pablo Saavedra [CMake][WPE] Add LibWPE before WPEBackend-FDO for qtwpe_INCLUDE_DIRECTORIES https://bugs.webkit.org/show_bug.cgi?id=219920 Reviewed by Michael Catanzaro. * PlatformWPE.cmake: 2020-12-15 Commit Queue Unreviewed, reverting r270829. https://bugs.webkit.org/show_bug.cgi?id=219935 Introduced crash Reverted changeset: "[macOS] Add sandbox parameter for message filter entitlement status" https://bugs.webkit.org/show_bug.cgi?id=219852 https://trac.webkit.org/changeset/270829 2020-12-15 Andy Estes [Mac] Numerous webgl tests continue to time out with the WebM format reader enabled https://bugs.webkit.org/show_bug.cgi?id=219928 Reviewed by Eric Carlson. Covered by existing tests. * Shared/mac/MediaFormatReader/TrackReader.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): (WebKit::MediaSampleByteRange::trackID const): (WebKit::TrackReader::addSample): Store MediaSampleByteRange's track ID as a uint64_t instead of an AtomString that might've been created on another thread. (WebKit::TrackReader::finalize): Ensure that m_sampleStorage really is destroyed on the storage queue by explicitly settings its unique_ptr to nullptr in the lambda. Without doing this, it's possible that the lambda will execute on the storage queue *before* WorkQueue::dispatch returns, and since WorkQueue's BlockPtr is still holding a reference to the block containing the lambda, it would not have been destroyed on the storage queue. 2020-12-15 Per Arne Vollan [macOS, iOS] Add required mach syscall https://bugs.webkit.org/show_bug.cgi?id=219913 Reviewed by Brent Fulgham. Add required mach syscall on macOS and iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * WebProcess/com.apple.WebProcess.sb.in: 2020-12-15 Wenson Hsieh Image extraction interaction should remain active while scrolling https://bugs.webkit.org/show_bug.cgi?id=219895 Reviewed by Devin Rousso. Make our image extraction interaction behave more like the rest of the system by making it persist until explicitly dismissed via tap gesture (or any other competing interaction, such as text interactions, drag interactions and context menu interactions, as long as the interaction location is outside of the active image extraction interaction). We currently just dismiss any active image extraction upon starting a new touch, which prevents scrolling from working as expected with image extraction. See radar for more details. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): (-[WKContentView _singleTapIdentified:]): (-[WKContentView _dragInteraction:prepareForSession:completion:]): (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]): 2020-12-15 Kate Cheney CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper Reviewed by Alex Christensen. Followup patch to add missing completion handlers. This also moves the check for a null m_networkSession variable to the existing PrivateClickMeasurementManager::featureEnabled() function for simplicity. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::clearSentAttributions): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::featureEnabled const): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): 2020-12-15 Simon Fraser Add batching to WebPreferences updates https://bugs.webkit.org/show_bug.cgi?id=219878 Reviewed by Sam Weinig. WebPreferences::resetAllInternalDebugFeatures() and WebPreferences::enableAllExperimentalFeatures() would trigger tens of calls to WebPageProxy::preferencesDidChange(). Fix by adding batching, and only firing update() at the end of any prefs changed. * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::update): (WebKit::WebPreferences::startBatchingUpdates): (WebKit::WebPreferences::endBatchingUpdates): * UIProcess/WebPreferences.h: (WebKit::WebPreferences::UpdateBatch::UpdateBatch): (WebKit::WebPreferences::UpdateBatch::~UpdateBatch): 2020-12-15 Youenn Fablet Fix alertMessageText regression from https://trac.webkit.org/changeset/269918 https://bugs.webkit.org/show_bug.cgi?id=219891 Reviewed by Eric Carlson. alertMessageText was checking twice for audio while it should check once for audio and once for video. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::alertMessageText): 2020-12-15 Ryan Hostetler "make clean" fails on EmptyDSTROOT target https://bugs.webkit.org/show_bug.cgi?id=219870 rdar://72309233 Reviewed by Alexey Proskuryakov. make clean can't find PROJECT_NAME for EmptyDSTROOT. * WebKit.xcodeproj/project.pbxproj: 2020-12-15 Andy Estes [Mac] Numerous webgl tests time out with WebM format reader enabled https://bugs.webkit.org/show_bug.cgi?id=219887 Reviewed by Eric Carlson. When rendering a video frame to canvas, SampleCursor is invoked on the main thread in order to find a sync frame to render. This triggered an ASSERT(!isMainThread()) in debug builds, and possibly a deadlock if the cursor pointed to a sample that hadn't yet been parsed (because SourceBufferParser calls the 'didProvideMediaData' callback on the main thread). Resolve this by having SourceBufferParser provide parsed samples on a background queue. To avoid creating AtomStrings on this non-main queue, teach TrackReader to access the trackID as a uint64_t instead. * Shared/mac/MediaFormatReader/FormatReader.cpp: (WebKit::FormatReader::startOnMainThread): (WebKit::readerQueue): (WebKit::FormatReader::parseByteSource): (WebKit::FormatReader::didParseTracks): (WebKit::FormatReader::didProvideMediaData): (WebKit::FormatReader::finishParsing): (WebKit::FormatReader::copyTrackArray): * Shared/mac/MediaFormatReader/TrackReader.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): (WebKit::TrackReader::create): (WebKit::TrackReader::storageQueue): (WebKit::TrackReader::TrackReader): (WebKit::TrackReader::addSample): (WebKit::TrackReader::waitForSample const): (WebKit::TrackReader::finishParsing): (WebKit::TrackReader::finalize): * Shared/mac/MediaFormatReader/TrackReader.h: 2020-12-15 Chris Dumez [GPUProcess] Crash under AudioDestinationCocoa::setIsPlaying(bool) https://bugs.webkit.org/show_bug.cgi?id=219809 Reviewed by Youenn Fablet. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): 2020-12-15 Per Arne Vollan [macOS] Add sandbox parameter for message filter entitlement status https://bugs.webkit.org/show_bug.cgi?id=219852 Reviewed by Brent Fulgham. Add sandbox parameter to determine whether the WebContent process has message filter entitlement. This parameter will be used in the sandbox to enable message filtering. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeSandbox): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-15 Carlos Garcia Campos [SOUP] WebSockets: wrong data sent in some cases with libsoup < 2.68 https://bugs.webkit.org/show_bug.cgi?id=219850 Reviewed by Michael Catanzaro. We are using soup_websocket_connection_send_text() when libsoup < 2.68, which expects a null terminated string, but we are receiving a IPC::DataReference that needs to be converted to a null terminated string by taking into account its size. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::sendString): 2020-12-14 Peng Liu [Media in GPU Process][MSE] VP9 stream playback is not smooth https://bugs.webkit.org/show_bug.cgi?id=219861 Reviewed by Eric Carlson. Add two new IPC messages in `RemoteMediaSourceProxy` to set `m_isSeeking` and `m_timeFudgeFactor` of the `MediaSourcePrivate` running in the GPU process. * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::setIsSeeking): (WebKit::RemoteMediaSourceProxy::setTimeFudgeFactor): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteMediaSourceProxy.messages.in: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::setIsSeeking): (WebKit::MediaSourcePrivateRemote::setTimeFudgeFactor): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: 2020-12-14 Per Arne Vollan REGRESSION (r270677-r270693): Catalina Perf tests failing https://bugs.webkit.org/show_bug.cgi?id=219802 Reviewed by Brent Fulgham. Create extension for RootDomainUserClient also for Intel Macs, and move logging rules outside of HAVE(SANDBOX_MESSAGE_FILTERING) section in sandbox. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedIOKitClasses): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-14 Alex Christensen Fix null dereference in WKURLCopyCFURL https://bugs.webkit.org/show_bug.cgi?id=219877 Reviewed by Geoffrey Garen. We had an optimistic assertion and crash reports indicating that it is not always true. When it's not, return null instead of crashing. * Shared/API/c/cf/WKURLCF.mm: (WKURLCopyCFURL): 2020-12-14 Chris Dumez Unreviewed, reverting r270768. Still crashes in debug in a different location Reverted changeset: "[GPUProcess] Crash under AudioDestinationCocoa::setIsPlaying(bool)" https://bugs.webkit.org/show_bug.cgi?id=219809 https://trac.webkit.org/changeset/270768 2020-12-14 Peng Liu [Media in GPU Process][MSE] Fix crashes in a debug build https://bugs.webkit.org/show_bug.cgi?id=219874 Reviewed by Eric Carlson. We need to call the completion handler in error cases. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment): 2020-12-14 Chris Dumez [GPUProcess] Bump QoS to UserInteractive for real-time audio rendering thread https://bugs.webkit.org/show_bug.cgi?id=219873 Reviewed by Eric Carlson. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): 2020-12-14 Peng Liu [Media in GPU Process][MSE] WebM source buffer parser is not enabled https://bugs.webkit.org/show_bug.cgi?id=219857 Reviewed by Eric Carlson. Share the value of `RuntimeEnabledFeatures::sharedFeatures().webMParserEnabled()` with the GPU process (`RemoteMediaSourceProxy`) when `MediaPlayerPrivateRemote` tries to load a media source. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::addSourceBuffer): * GPUProcess/media/RemoteMediaSourceProxy.h: * Shared/mac/MediaFormatReader/FormatReader.cpp: (WebKit::FormatReader::parseByteSource): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::load): * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::addSourceBuffer): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: 2020-12-14 Chris Dumez [GPUProcess] Crash in SharedRingBufferStorage::setStorage() under GuardMalloc https://bugs.webkit.org/show_bug.cgi?id=219867 Reviewed by Darin Adler. SharedRingBufferStorage was holding a raw pointer to its client and we would sometimes crash when dereferencing this client in SharedRingBufferStorage::setStorage() because the client is not guaranteed to be alive. To address the issue, I replace the SharedRingBufferStorage::Client with a lambda so that the client can protect itself in the lambda if needed. In particular, RemoteAudioSourceProviderProxy now protects itself in the lambda since the lifetime of the CARingBuffer is not tied to the lifetime of RemoteAudioSourceProviderProxy. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::RemoteAudioDestination): * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: (WebKit::RemoteAudioSourceProviderProxy::createRingBuffer): * GPUProcess/media/RemoteAudioSourceProviderProxy.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::RemoteAudioMediaStreamTrackRenderer): * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::RemoteMediaRecorder): * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::SharedRingBufferStorage::setStorage): * Shared/Cocoa/SharedRingBufferStorage.h: (WebKit::SharedRingBufferStorage::SharedRingBufferStorage): (WebKit::SharedRingBufferStorage::invalidate): * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::storageChanged): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::m_ringBuffer): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::RemoteAudio): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::AudioMediaStreamTrackRenderer): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::startRecording): * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::Source): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::storageChanged): * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::RemoteAudio::RemoteAudio): 2020-12-14 Kate Cheney CrashTracer: com.apple.WebKit.Networking at WebKit: WTF::Detail::CallableWrapper Reviewed by Alex Christensen. No new tests, this should fix a crash. m_networkSession is a weakPtr. We should check that the object it references exists before trying to use it. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::clearSentAttributions): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): 2020-12-14 Tim Horton Adopt symbol image API instead of SPI in WKPDFHUDView https://bugs.webkit.org/show_bug.cgi?id=219866 Reviewed by Wenson Hsieh. * UIProcess/PDF/WKPDFHUDView.mm: (-[WKPDFHUDView _getImageForControlName:]): 2020-12-14 Pablo Saavedra [GLIB] Missing header for std::once_flag in WebKitInitialize.cpp https://bugs.webkit.org/show_bug.cgi?id=219865 Reviewed by Alex Christensen. * UIProcess/API/glib/WebKitInitialize.cpp: 2020-12-14 Wenson Hsieh GPU process sometimes hangs during MotionMark Focus when enabling GPU Process for DOM https://bugs.webkit.org/show_bug.cgi?id=219839 Reviewed by Tim Horton. Fixes an indefinite hang in the GPU process that may occur as a result of this very specific corner case in concurrent display list processing: [1] Let p and q represent two item buffers, and let A and B represent two remote image buffers whose drawing contexts will be destinations for display list playback in the GPU process. Suppose p has k remaining bytes where k >= 32, and A's writable buffer is mapped to a region closest to the end of p. In practice, when this hang reproduces, k is a relatively small number (typically 32-40 bytes). [2] Additionally, suppose that the GPU process is not reading from q (i.e. q's `unreadBytes()` count is 0), and that the GPU process has created a corresponding RemoteImageBuffer for A, but *not* a corresponding RemoteImageBuffer for B. [3] We now append a MetaCommandChangeDestinationImageBuffer item to change destinations from A to B, such that p now has (k - 16) remaining bytes. In preparation for appending new items for B's display list, the logic in `RemoteRenderingBackendProxy::willAppendItem` clears B's writable buffer, with the intention that B will turn around and call out to the client layer for a new writable buffer again once it notices that it has no writable buffer. [4] If we then immediately try to append an item to B that is larger than (k - 32) bytes, `RemoteRenderingBackendProxy::findReusableDisplayListHandle` will see that the most recently used item buffer p has insufficient space, and will instead return item buffer q. We end up appending the new item to item buffer q. [5] In the GPU process, we finish processing all available item data in p. When we encounter the destination buffer change item, we set `m_pendingWakeupInfo` before going to sleep, due to the fact that the GPU process has not learned about image buffer B yet (see the last part of step [2]). [6] Later, in the GPU process, when we create a RemoteImageBuffer for B, we see that we have a `m_pendingWakeupInfo` with destination image buffer B, so we resume display list processing. However, we're unable to resume where we stopped, since B's display list (in the web process) immediately appended to q instead of p, skipping MetaCommandChangeItemBuffer in the process. This manifests as an indefinite hang inside `RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists`, since we expect p to have a nonzero `unreadBytes()` count. [7] Now that the GPU process is in a broken state, the web process follows shortly -- in the Focus subtest of MotionMark, this manifests as a web process crash soon after the GPU process begins to hang, because `RemoteImageBufferProxy::ensureBackendCreated()` times out and returns null, and we subsequently dereference null in `RemoteLayerBackingStore::encode()` after failing to ensure the image buffer backend. To fix this, we target step [3]. Rather than clear B's writable buffer and expect it to append its new items to p, we simply hand it p's item handle -- in this case, a handle with (k - 16) available bytes -- and set its writable buffer before we try to append. In this scenario, doing this ensures that if we are about to append an item that is larger than (k - 32) bytes, we will first leave a 16-byte MetaCommandChangeItemBuffer item inside p before moving on to q. This eventually ensures that when the GPU process resumes display list processing after creating a RemoteImageBuffer for B, it will see 16 unread bytes in p and then immediately continue reading data from item buffer q. Finally, note that in this scenario, p is always guaranteed to contain at least 16 available bytes after step [3] (in other words, k >= 32). This is because all calls to append an item of size n bytes to an item buffer check that there is a minimum (n + 16) bytes remaining (via logic in `ItemBuffer::swapWritableBufferIfNeeded`), such that it is, by design, always possible to append a `MetaCommandChangeItemBuffer` item if necessary. As such, it is safe to return the most recently used item buffer's handle in step [4]. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::clearDisplayList): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::willAppendItem): Call into `prepareToAppendDisplayListItems` instead of `clearDisplayList` when switching destination image buffers. See problem diagnosis above for more detail. (WebKit::RemoteRenderingBackendProxy::mostRecentlyUsedDisplayListHandle): Pull logic to retrieve the most recently used display list handle out into a separate helper method. (WebKit::RemoteRenderingBackendProxy::findReusableDisplayListHandle): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-14 Sihui Liu WebProcessProxy::destroySpeechRecognitionServer should check if identifier exists before removing MessageReceiver https://bugs.webkit.org/show_bug.cgi?id=219815 Reviewed by Youenn Fablet. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::destroySpeechRecognitionServer): 2020-12-14 Chris Dumez Drop duplicate call to makeUniqueRef() in RemoteAudioSourceProviderProxy::createRingBuffer() https://bugs.webkit.org/show_bug.cgi?id=219859 Reviewed by Youenn Fablet. * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: (WebKit::RemoteAudioSourceProviderProxy::createRingBuffer): 2020-12-14 Youenn Fablet Make sure WebProcessPool::setUseSeparateServiceWorkerProcess handles correctly destroyed process pools https://bugs.webkit.org/show_bug.cgi?id=219773 Reviewed by Alex Christensen. Terminating a service worker process may destroy the web process pool. Copy the vector of process pools before iterating over it to terminate service worker processes. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setUseSeparateServiceWorkerProcess): 2020-12-14 Alex Christensen Remove WKDownloadDelegate.didWriteData https://bugs.webkit.org/show_bug.cgi?id=219820 Reviewed by Sam Weinig. API review revealed it was redundant with WKDownload.progress, which has KVO-compliant totalUnitCount and completedUnitCount. * UIProcess/API/Cocoa/WKDownload.mm: (-[WKDownload progress]): * UIProcess/API/Cocoa/WKDownloadDelegate.h: 2020-12-14 Andy Estes [Mac] Enable `webm_format_reader` feature flag by default https://bugs.webkit.org/show_bug.cgi?id=219858 Reviewed by Eric Carlson. * FeatureFlags/WebKit.plist: 2020-12-14 Wenson Hsieh Web process crashes during MotionMark Images when GPU Process for DOM is enabled https://bugs.webkit.org/show_bug.cgi?id=219838 Reviewed by Simon Fraser. It's possible to return prematurely with a null backend when waiting for image buffer backend creation under `RemoteImageBufferProxy::ensureBackendCreated()`. Consider the following scenario (where WEB and GPU denote events that occur in the web and GPU processes, respectively): 1. (WEB) RemoteImageBufferProxy A is created in the web process. 2. (GPU) RemoteImageBuffer A is created in the GPU process, along with an image buffer backend for A. 3. (WEB) RemoteImageBufferProxy B is created in the web process. 4. (GPU) RemoteImageBuffer B is created in the GPU process, along with an image buffer backend for B. 5. (WEB) Something calls `RemoteImageBufferProxy::ensureBackendCreated()` on B. 6. (WEB) We receive the `RemoteRenderingBackendProxy::DidCreateImageBufferBackend` message for A. B subsequently finishes waiting for backend creation because it incorrectly believes that its backend has been initialized, and we end up crashing downstream in `RemoteLayerBackingStore::encode()` because `ensureBackendCreated()` for B returned null. To fix this, we adopt a similar strategy to what we use in `waitForDidFlushWithTimeout()`, and repeatedly call `waitForDidCreateImageBufferBackend()` until the backend has been created (allowing for an arbitrary number of IPC timeouts or failures). Since this counter is only incremented upon timeout (or any other kind of IPC communication failure), we'll simply receive `RemoteRenderingBackendProxy::DidCreateImageBufferBackend` messages until we confirm (in the web process) that the current image buffer's backend has been initialized. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend): Drive-by fix: clarify this code by returning an enum to indicate whether or not we successfully received a backend creation IPC response from the GPU process, instead of just returning a bool. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-14 Sihui Liu Implement recognizer for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=219459 Reviewed by Youenn Fablet. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::invalidate): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): 2020-12-14 Chris Dumez [GPUProcess] Crash under AudioDestinationCocoa::setIsPlaying(bool) https://bugs.webkit.org/show_bug.cgi?id=219809 Reviewed by Eric Carlson. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::create): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/WebMediaStrategy.cpp: (WebKit::WebMediaStrategy::createAudioDestination): * WebProcess/GPU/media/WebMediaStrategy.h: 2020-12-14 Carlos Garcia Campos [WPE][GTK] Should enable WebProcessCache https://bugs.webkit.org/show_bug.cgi?id=219689 Reviewed by Adrian Perez de Castro. * UIProcess/API/glib/WebKitWebContext.cpp: (webkitWebContextConstructed): 2020-12-13 Yusuke Suzuki [JSC] Introduce vmEntryCustomAccessor and vmEntryHostFunction for JITCage https://bugs.webkit.org/show_bug.cgi?id=219847 Reviewed by Mark Lam. * Shared/WebKitJITOperations.cpp: (WebKit::populateJITOperations): 2020-12-13 Andy Estes [Mac] Create a MediaToolbox format reader plug-in for WebM https://bugs.webkit.org/show_bug.cgi?id=218908 Reviewed by Eric Carlson. Implemented a MTPluginFormatReader for WebM containers. The format reader is responsible for parsing a WebM byte stream (using SourceBufferParserWebM) into audio, video, and text tracks. MediaToolbox can then create cursors to step through the tracks' samples in decode or presentation order and access each sample's metadata (e.g., format description, duration, key-frame status) and location in the byte stream. * FeatureFlags/WebKit.plist: * MediaFormatReaderPlugIn/Info.plist: * MediaFormatReaderPlugIn/MediaFormatReaderPlugIn.cpp: * Shared/API/c/mac/WKFormatReader.cpp: Added. * Shared/API/c/mac/WKFormatReader.h: Added. * Shared/WebPreferencesDefaultValues.cpp: * Shared/WebPreferencesDefaultValues.h: * Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp: Added. * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: Added. * Shared/mac/MediaFormatReader/FormatReader.cpp: Added. * Shared/mac/MediaFormatReader/FormatReader.h: Added. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: Added. * Shared/mac/MediaFormatReader/MediaFormatReader.h: Added. * Shared/mac/MediaFormatReader/SampleCursor.cpp: Added. * Shared/mac/MediaFormatReader/SampleCursor.h: Added. * Shared/mac/MediaFormatReader/TrackReader.cpp: Added. * Shared/mac/MediaFormatReader/TrackReader.h: Added. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: 2020-12-13 Tim Horton Fix the watchOS build after r270712 * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent): 2020-12-12 Jiewen Tan [WebAuthn][iOS] Turn on modern WebAuthn for default browsers https://bugs.webkit.org/show_bug.cgi?id=219823 Reviewed by Brent Fulgham. Covered by manual tests. This patch turns on modern WebAuthn on iOS by default. In addition to that, it turns on WebAuthn for all default browsers. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebCore::isWebBrowser): (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): For apps that turn on WebAuthn by overriding the experimental feature settings, return silently. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences) Does the meat. 2020-12-12 Alexander Mikhaylenko [GTK4] Web view is incorrectly scaled on hidpi https://bugs.webkit.org/show_bug.cgi?id=218353 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): Account for the scale factor. 2020-12-12 Commit Queue Unreviewed, reverting r270692. https://bugs.webkit.org/show_bug.cgi?id=219828 Introduced crash Reverted changeset: "[macOS] Remove access to com.apple.MTLCompilerService in the WebContent process" https://bugs.webkit.org/show_bug.cgi?id=219774 https://trac.webkit.org/changeset/270692 2020-12-12 Wenson Hsieh Unreviewed, reverting r270674. Broke web content rendering on iOS Reverted changeset: "[iOS] Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process" https://bugs.webkit.org/show_bug.cgi?id=219733 https://trac.webkit.org/changeset/270674 2020-12-11 Peng Liu [Media in GPU Process][MSE] Implement SourceBuffer::reportExtraMemoryAllocated() https://bugs.webkit.org/show_bug.cgi?id=219812 Reviewed by Eric Carlson. Add a new IPC message `SourceBufferPrivateReportExtraMemoryCost` to forward the callback to the web process. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReportExtraMemoryCost): * GPUProcess/media/RemoteSourceBufferProxy.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateReportExtraMemoryCost): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: 2020-12-11 Jiewen Tan [WebAuthn] Adopt new UI for the Platform Authenticator getAssertion flow https://bugs.webkit.org/show_bug.cgi?id=219710 Reviewed by Brent Fulgham. This patch adopts the new UI for the platform authenticator getAssertion flow. It's more or less the same as the security key one except an LAContext will be passed in from the UI. Now LocalAuthenticator will just utilize the LAContext from the UI. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::~AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::didSelectAssertionResponse): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): 2020-12-11 John Wilander PCM: Change debugModeSecondsUntilSend from 60 seconds to 10 seconds https://bugs.webkit.org/show_bug.cgi?id=219816 Unreviewed change to a constant, only used for debugging. * NetworkProcess/PrivateClickMeasurementManager.cpp: debugModeSecondsUntilSend changed to 10 seconds. (WebKit::PrivateClickMeasurementManager::attribute): Fixed bad indentation. 2020-12-11 Ryosuke Niwa [GPU Process] Cache Font objects https://bugs.webkit.org/show_bug.cgi?id=219672 Reviewed by Wenson Hsieh. Partially based on the patch made by Said Abou-Hallawa. This patch introduces a mechanism to cache Font objects in the GPU process much the same way NativeImage objects are cached in the GPU process, and re-enables Web Fonts. Fonts are removed from the GPU process when either they hadn't been used for 4 rendering updates or a memory warning has been issued. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::submit): Added the font cache. (WebKit::RemoteRenderingBackend::cacheFont): Added. (WebKit::RemoteRenderingBackend::deleteAllFonts): Added. * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: Added CacheFont and DeleteAllFonts as new IPC messages. * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheFont): Added. (WebKit::RemoteResourceCache::deleteAllFonts): Added. Used when a memory warning is issued. * GPUProcess/graphics/RemoteResourceCache.h: (WebKit::RemoteResourceCache::fonts const): Added. * Platform/IPC/FontReference.h: Added. (IPC::FontReference): Added. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): Added FontReference. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): Encode the rendering resource identifier of Font. (IPC::ArgumentCoder>::decode): Ditto for decoding. * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::cacheFont): Added. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::cacheFont): Added. (WebKit::RemoteRenderingBackendProxy::deleteAllFonts): Added. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::cacheFont): Added. It updates the total number of fonts being used since the last rendering update and records the self assigned identifier for the next rendering update. (WebKit::RemoteResourceCacheProxy::didFinalizeRenderingUpdate): Added. Called at the end of each rendering update. It removes all fonts unused in the lsat 4 rendering updates if at least 1/4 of the fonts in the GPU process were not used in this rendering update. (WebKit::RemoteResourceCacheProxy::releaseMemory): Added. Removes all the fonts to free up memory when a memory warning is issued. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: (WebKit::RemoteResourceCacheProxy): Added m_fontLastRenderingUpdateMap which keeps track of the rendering resource identifiers of the fonts cached in the GPU process. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Re-enables the Web Fonts. (WebKit::WebPage::finalizeRenderingUpdate): Added the call to RemoteRenderingBackendProxy's didFinalizeRenderingUpdate. (WebKit::WebPage::releaseMemory): Added. Calls RemoteRenderingBackendProxy's function. * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): Added the call to WebPage::releaseMemory in the memory pressure handler. (WebKit::WebProcess::prepareToSuspend): Ditto for the process suspension. 2020-12-11 Jiewen Tan [WebAuthn] Adopt new UI for the Security Key getAssertion flow https://bugs.webkit.org/show_bug.cgi?id=219711 Reviewed by Brent Fulgham. This patch adopts the new UI for the security key getAssertion flow which contains two part: 1. showing a informative UI to ask the user to connect their security keys, 2. showing an account picker for users to select a credential to use. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: Paperwork. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::didSelectAssertionResponse): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): Implements the two flows. 2020-12-11 John Wilander PCM: Add feature flag support in the network process https://bugs.webkit.org/show_bug.cgi?id=219811 Reviewed by Alex Christensen. No new tests. This just forwards a preference to the network process. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): Stores the incoming enablePrivateClickMeasurement from WebKit::NetworkProcessCreationParameters. (WebKit::NetworkProcess::setPrivateClickMeasurementEnabled): (WebKit::NetworkProcess::privateClickMeasurementEnabled const): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcessCreationParameters.cpp: New field enablePrivateClickMeasurement. (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): Early return if the feature is not enabled. (WebKit::PrivateClickMeasurementManager::handleAttribution): Early return if the feature is not enabled. (WebKit::PrivateClickMeasurementManager::fireConversionRequest): Early return if the feature is not enabled. (WebKit::PrivateClickMeasurementManager::featureEnabled const): New convenience function. * NetworkProcess/PrivateClickMeasurementManager.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): Sets the new enablePrivateClickMeasurement in WebKit::NetworkProcessCreationParameters. 2020-12-11 Jiewen Tan Unreviewed, build fix after r270694 * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): Adds a instance method guard for new SPI. 2020-12-11 Jer Noble [Cocoa] Add Experimental VP8 support https://bugs.webkit.org/show_bug.cgi?id=219732 Reviewed by Eric Carlson. Add new WebPageCreationParameter flags to enable VP8 decoders in the WebContent and GPU processes when the experimental feature is enabled. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::enableVP9Decoders): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::enableVP9Decoders): * GPUProcess/GPUProcess.h: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultVP8DecoderEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::updateParameters): * WebProcess/GPU/GPUProcessConnection.h: (WebKit::GPUProcessConnection::isVP8DecoderEnabled const): * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::enableVP8SWDecoder): * WebProcess/WebProcess.h: 2020-12-11 Chris Dumez Potential null dereference of m_frame under DocumentLoader::stopLoading() https://bugs.webkit.org/show_bug.cgi?id=219786 Reviewed by Geoffrey Garen. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::close): Add some release logging. 2020-12-11 Tim Horton Fix the iOS !UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_HANDLING build. * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent): 2020-12-11 Tim Horton Trackpad and Mouse scroll events on iPad only fire "pointermove" -- not "wheel" https://bugs.webkit.org/show_bug.cgi?id=210071 Reviewed by Simon Fraser. * Platform/spi/ios/UIKitSPI.h: Add some SPI. * Shared/ios/WebIOSEventFactory.h: * Shared/ios/WebIOSEventFactory.mm: (toWebPhase): (WebIOSEventFactory::createWebWheelEvent): Add a UIScrollEvent->WebWheelEvent conversion helper. * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setupScrollAndContentViews]): Enable async UIScrollEvent handling for WKScrollView. (-[WKWebView _scrollView:asynchronouslyHandleScrollEvent:completion:]): Adopt new UIKit SPI to asynchronously defer UIScrollEvents. We pass them to the Web Content process, where they are processed *only* for event handling, not for scrolling. If the event is not cancelable, we will synchronously reply that it was not handled; if it is cancelable, or we don't yet know if it will be, we'll wait to hear back from the Web Content process before replying. UIKit will wait until our reply to apply the UIScrollEvent to the UIScrollView. * UIProcess/PageClient.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::eventListenerTypesAtPoint): Expose a mechanism for retrieving the event listener types at a given point, similar to the existing mechanism for touch event listeners. (-[WKChildScrollView initWithFrame:]): Enable async UIScrollEvent handling for WKChildScrollView. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate _scrollView:asynchronouslyHandleScrollEvent:completion:]): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::handleAsynchronousCancelableScrollEvent): Plumb async scroll events for sub-scrollable regions through PageClient to WKWebView; we don't actually care which UIScrollView they're handed to, since we re-hit-test ourselves. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::dispatchWheelEventWithoutScrolling): * UIProcess/WebPageProxy.h: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::handleAsynchronousCancelableScrollEvent): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::wheelEvent): (WebKit::WebPage::dispatchWheelEventWithoutScrolling): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-12-11 Brent Fulgham Expose API for enabling/disabling Private Click Measurement https://bugs.webkit.org/show_bug.cgi?id=219791 Reviewed by Alex Christensen. Tested by existing PCM test cases. This patch moves the flag for enabling and disabling PCM support from the Experimental features settings to standard settings in preparation for exposing the option in more permanent UI. This patch does not make any changes in behavior. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _privateClickMeasurementEnabled]): (-[WKPreferences _setPrivateClickMeasurementEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2020-12-11 Peng Liu [Media in GPU Process][MSE] Implement some required functions with new IPC messages and remove some unneeded functions https://bugs.webkit.org/show_bug.cgi?id=219788 Reviewed by Eric Carlson. Implement unimplemented functions and remove unneeded ones. This patch also cleans up `RemoteSourceBufferProxy`. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateStreamEndedWithDecodeError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidDropSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError): * GPUProcess/media/RemoteSourceBufferProxy.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateStreamEndedWithDecodeError): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendError): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidDropSample): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveRenderingError): (WebKit::SourceBufferPrivateRemote::flush): Deleted. (WebKit::SourceBufferPrivateRemote::isReadyForMoreSamples): Deleted. (WebKit::SourceBufferPrivateRemote::notifyClientWhenReadyForMoreSamples): Deleted. (WebKit::SourceBufferPrivateRemote::canSetMinimumUpcomingPresentationTime const): Deleted. (WebKit::SourceBufferPrivateRemote::setMinimumUpcomingPresentationTime): Deleted. (WebKit::SourceBufferPrivateRemote::clearMinimumUpcomingPresentationTime): Deleted. * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: 2020-12-11 Chris Dumez [GPUProcess] WebAudio rendering quantum is 15 instead of 128 when the GPU Process is enabled https://bugs.webkit.org/show_bug.cgi?id=219797 Reviewed by Eric Carlson. WebAudio rendering quantum is 15 instead of 128 when the GPU Process is enabled. This generates a lot more IPC unnecessarily, not to mention how WebAudio code expects a rendering quantum of 128 and could potentially do bad things with a lower value. The issue was that RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess() was iterating over all RemoteAudioSessionProxy objects to find out the lowest rendering quantum. If there is a proxy with a preferred buffer size that is not set, the value ends up being 0. When then ask core audio for a rendering quantum of 0, and they end up using 15 (likely the minimum). * GPUProcess/media/RemoteAudioSessionProxyManager.cpp: (WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess): 2020-12-11 Don Olmstead [PlayStation] Link additional libraries into processes after r270690 https://bugs.webkit.org/show_bug.cgi?id=219795 Unreviewed build fix after r270690. Some libraries were being propagated from WebKit before the change so just add them to the Process_PRIVATE_LIBRARIES. * PlatformPlayStation.cmake: 2020-12-11 Fujii Hironori [WinCairo] Enable accelerated WebGL canvas https://bugs.webkit.org/show_bug.cgi?id=219768 Reviewed by Don Olmstead. prepareForRendering should be called before calling flushPendingLayerChanges to make the GL context current because it uses OpenGL API. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::compositeLayersToContext): (WebKit::LayerTreeHost::flushAndRenderLayers): 2020-12-10 Jiewen Tan [WebAuthn] Adopt new UI for the Platform Authenticator makeCredential flow https://bugs.webkit.org/show_bug.cgi?id=219709 Reviewed by Brent Fulgham. This patch adopts the new UI for the platform authenticator makeCredential flow. In this new design, the UI will be responsible for creating the LAContext and get it verified by the user. Therefore, WebKit just needs to reverify the LAContext in non-UI mode against the SecAccessControlRef without handling any LA UI anymore. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: Adds a new class which represents a successful operation. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: Adds rule to allow the WebAuthn process to access Keychain and SEP. * UIProcess/WebAuthentication/Authenticator.h: (WebKit::Authenticator::setWebAuthenticationModernEnabled): (WebKit::Authenticator::webAuthenticationModernEnabled const): Adds a flag to know which UI to call. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): (WebKit::AuthenticatorManager::enableModernWebAuthentication): (WebKit::AuthenticatorManager::authenticatorAdded): (WebKit::AuthenticatorManager::requestLAContextForUserVerification): (WebKit::AuthenticatorManager::invokePendingCompletionHandler): * UIProcess/WebAuthentication/AuthenticatorManager.h: Adds plumbing to the new UI method. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: Paperwork. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: (WebKit::AuthenticatorPresenterCoordinator::setCredentialRequestHandler): This handler is from the UI delegate which is supposed to call if the operation succeeds. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::requestLAContextForUserVerification): (WebKit::AuthenticatorPresenterCoordinator::dimissPresenter): (WebKit::AuthenticatorPresenterCoordinator::setLAContext): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::continueMakeCredentialAfterReceivingLAContext): * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::verifyUser): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): (-[WKASCAuthorizationPresenterDelegate dispatchCoordinatorCallback:]): Implements the new UI logic. 2020-12-11 Per Arne Vollan [macOS] Remove access to com.apple.MTLCompilerService in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219774 Reviewed by Brent Fulgham. Remove access to com.apple.MTLCompilerService in the WebContent process on macOS, since there are no reports of this being used. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-11 Per Arne Vollan [macOS] Remove Mobile Asset access from the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219738 Reviewed by Brent Fulgham. Remove Mobile Asset access from the WebContent process on macOS, since there are no reports of this being used. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-11 Don Olmstead [CMake] Determine correct visibility for linked frameworks https://bugs.webkit.org/show_bug.cgi?id=210366 Reviewed by Michael Catanzaro. Set WebKit_FRAMEWORKS to determine correct linkage for the library. Remove explicit setting of STATICALLY_LINKED_WITH_${framework} and $ by ports. * CMakeLists.txt: * PlatformFTW.cmake: * PlatformPlayStation.cmake: * PlatformWPE.cmake: * PlatformWin.cmake: 2020-12-11 Commit Queue Unreviewed, reverting r270654. https://bugs.webkit.org/show_bug.cgi?id=219793 Introduced crash Reverted changeset: "[macOS] The development WebContent XPC service is missing a required entitlement" https://bugs.webkit.org/show_bug.cgi?id=219730 https://trac.webkit.org/changeset/270654 2020-12-11 Carlos Garcia Campos Protect the WebProcessPool earlier in WebProcessCache::addProcessIfPossible https://bugs.webkit.org/show_bug.cgi?id=219777 Reviewed by Adrian Perez de Castro. We are taking a reference of the WebProcessPool in the isResponsive() completion handler lambda, but the WebProcessPool can be destroyed earlier when CachedProcess is created if the WebProcessProxy contains the last strong reference. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::addProcessIfPossible): 2020-12-11 Brent Fulgham [macOS] Only extend access to the RootDomainUserClient IOKit class if the GPU Process is not used https://bugs.webkit.org/show_bug.cgi?id=219758 Reviewed by Per Arne Vollan. The RootDomainUserClient IOKit class appears to only be used by media on Apple Silicon. Dynamically extend access to this class for Apple Silicon builds if the GPU process is not being used. This patch also includes telemetry to confirm that it is not needed on Intel, or for any other purposes. It does not block access to the IOKit class yet. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedIOKitClasses): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-11 Don Olmstead [GLib] Move GCrypt initialization to platformInitialize https://bugs.webkit.org/show_bug.cgi?id=219749 Reviewed by Adrian Perez de Castro. It makes more sense for initialization of GCrypt to occur in platformInitialize than in the main method of the process. This means that the process does not have to link gcrypt libraries and can just link WebKit only. * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp: (main): * NetworkProcess/soup/NetworkProcessMainSoup.cpp: * WebProcess/EntryPoint/unix/WebProcessMain.cpp: (main): * WebProcess/gtk/WebProcessMainGtk.cpp: (WebKit::WebProcessMain): * WebProcess/wpe/WebProcessMainWPE.cpp: 2020-12-11 Per Arne Vollan [iOS] Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219733 Reviewed by Brent Fulgham. Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process on iOS, since this is not needed when allowing access to IOGPU. The IOGPU class is the superclass of AGXDeviceUserClient, and is the preferred IOKit reference to use according to the Sandbox team. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): 2020-12-11 Per Arne Vollan [macOS] Add telemetry for notification message filtering in sandbox https://bugs.webkit.org/show_bug.cgi?id=219684 Reviewed by Brent Fulgham. Add telemetry for notification message filtering in sandbox in the WebContent process on macOS. No new tests, since this just adds telemetry. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-12-11 Commit Queue Unreviewed, reverting r270655. https://bugs.webkit.org/show_bug.cgi?id=219772 Introduced sandbox compile error Reverted changeset: "[iOS] Add missing endpoint in sandbox message filter" https://bugs.webkit.org/show_bug.cgi?id=219731 https://trac.webkit.org/changeset/270655 2020-12-10 Alex Christensen Accept click measurement data from hosting application https://bugs.webkit.org/show_bug.cgi?id=219763 Reviewed by John Wilander. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase): * Platform/ios/UIKitSoftLink.h: Added. * Platform/ios/UIKitSoftLink.mm: Added. * Platform/spi/ios/UIKitSPI.h: * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _setPrivateClickMeasurementOverrideTimerForTesting:completionHandler:]): (-[WKWebView _setPrivateClickMeasurementConversionURLForTesting:completionHandler:]): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setEventAttribution:]): (-[WKWebView _eventAttribution]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::createNewPage): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::setPrivateClickMeasurement): (WebKit::WebPageProxy::privateClickMeasurement const): * WebKit.xcodeproj/project.pbxproj: 2020-12-10 Peng Liu [Media in GPU Process][MSE] Implement several methods in SourceBufferPrivateRemote to make seeking more reliable https://bugs.webkit.org/show_bug.cgi?id=219757 Reviewed by Eric Carlson. Add the required IPC messages and implement three functions of `SourceBufferPrivateRemote`. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::abort): (WebKit::RemoteSourceBufferProxy::resetParserState): (WebKit::RemoteSourceBufferProxy::removedFromMediaSource): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::abort): (WebKit::SourceBufferPrivateRemote::resetParserState): (WebKit::SourceBufferPrivateRemote::removedFromMediaSource): 2020-12-10 Andy Estes [Mac] Create a format reader plug-in for WebM https://bugs.webkit.org/show_bug.cgi?id=218908 Reviewed by Eric Carlson. Added a new bundle target that builds a MediaToolbox format reader plug-in and installs it in the WebContent and GPU XPC service bundles. The plug-in does nothing for now, but in follow-up patches will learn how to read WebM containers. * Configurations/MediaFormatReader.xcconfig: Added. * MediaFormatReaderPlugIn/Info.plist: Added. Defines a CMClassImplementations array specifying the plug-in factory function and the supported media types / extensions. * MediaFormatReaderPlugIn/MediaFormatReaderPlugIn.cpp: Added. * WebKit.xcodeproj/project.pbxproj: 2020-12-10 Chris Dumez [GPUProcess] Cut in half amount of IPC needed to do WebAudio https://bugs.webkit.org/show_bug.cgi?id=219715 Reviewed by Geoff Garen. Cut in half amount of IPC needed to do WebAudio. Previously, we would send 2 IPCs per rendering quantum: 1. RemoteAudioDestinationProxy::RequestBuffer from GPUProcess to WebProcess 2. The response to RemoteAudioDestinationProxy::RequestBuffer which contained the frame bounds for the RingBuffer. This patch gets rid of IPC 2 by having the CARingBuffer class store its bounds in its memory backing. As a result, when the CARingBuffer is using a shared memory backing, the bounds get shared between processes, without any need for IPC to sync them. This is still too much IPC but this is a step in the right direction. We can hopefully get rid of (or greatly reduce) IPC 1 in a follow-up patch. * GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestination::audioSamplesStorageChanged): (WebKit::RemoteAudioDestination::render): * GPUProcess/media/RemoteAudioSourceProviderProxy.cpp: (WebKit::RemoteAudioSourceProviderProxy::storageChanged): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged): (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesAvailable): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::audioSamplesStorageChanged): (WebKit::RemoteMediaRecorder::audioSamplesAvailable): * GPUProcess/webrtc/RemoteMediaRecorder.h: * GPUProcess/webrtc/RemoteMediaRecorder.messages.in: * Shared/Cocoa/SharedRingBufferStorage.cpp: (WebKit::SharedRingBufferStorage::allocate): (WebKit::SharedRingBufferStorage::sharedFrameBounds): (WebKit::SharedRingBufferStorage::data): (WebKit::SharedRingBufferStorage::getCurrentFrameBounds): (WebKit::SharedRingBufferStorage::setCurrentFrameBounds): (WebKit::SharedRingBufferStorage::updateFrameBounds): (WebKit::SharedRingBufferStorage::flush): * Shared/Cocoa/SharedRingBufferStorage.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::remoteAudioSamplesAvailable): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::remoteAudioSamplesAvailable): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.messages.in: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::requestBuffer): (WebKit::RemoteAudioDestinationProxy::storageChanged): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::setStorage): (WebKit::RemoteAudioSourceProviderManager::RemoteAudio::audioSamplesAvailable): * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: (WebKit::AudioMediaStreamTrackRenderer::pushSamples): (WebKit::AudioMediaStreamTrackRenderer::storageChanged): * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp: (WebKit::MediaRecorderPrivate::audioSamplesAvailable): (WebKit::MediaRecorderPrivate::storageChanged): * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::audioSamplesAvailable): (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable): * WebProcess/cocoa/RemoteCaptureSampleManager.h: * WebProcess/cocoa/RemoteCaptureSampleManager.messages.in: 2020-12-10 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.SystemConfiguration.configd' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219680 Reviewed by Brent Fulgham. Deny mach-lookup to the service 'com.apple.SystemConfiguration.configd' in the WebContent process on macOS, since there are no reports of this being used. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-10 Per Arne Vollan [macOS] Create sandbox extension for AppleAVDUserClient when Media in GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=219740 Reviewed by Brent Fulgham. Create sandbox extension for AppleAVDUserClient for WebContent process when Media in GPU process is not enabled on macOS, since this IOKit class is only used for Media purposes. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedIOKitClasses): (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-10 Per Arne Vollan [macOS] Add telemetry for notification message filtering in sandbox https://bugs.webkit.org/show_bug.cgi?id=219684 Reviewed by Brent Fulgham. Add telemetry for notification message filtering in sandbox in the WebContent process on macOS. No new tests, since this just adds telemetry. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-10 Per Arne Vollan [iOS] Add missing endpoint in sandbox message filter https://bugs.webkit.org/show_bug.cgi?id=219731 Reviewed by Brent Fulgham. Add missing endpoint in the WebContent process' sandbox message filter on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-12-10 Per Arne Vollan [macOS] The development WebContent XPC service is missing a required entitlement https://bugs.webkit.org/show_bug.cgi?id=219730 Reviewed by Brent Fulgham. The message filtering entitlement is missing in com.apple.WebKit.WebContent.Development.xpc on macOS. * Scripts/process-entitlements.sh: 2020-12-10 Andres Gonzalez Rework of AXObjectCache::isIsolatedTreeEnabled. https://bugs.webkit.org/show_bug.cgi?id=219722 Reviewed by Chris Fleizach. - Renamed AXObjecCache::canUseSecondaryAXThread as usedOnAXThread. - No need for the additional thread check since isIsolatedTreeEnabled will return true for any call off of the main thread. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKAccessibilityCanUseSecondaryAXThread): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityHitTest:]): 2020-12-10 Sihui Liu REGRESSION (r270574): [iOS] ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::~SpeechRecognitionRemoteRealtimeMediaSourceManager https://bugs.webkit.org/show_bug.cgi?id=219745 Reviewed by Youenn Fablet. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): Remove SpeechRecognitionRemoteRealtimeMediaSourceManager from MessageReceiverMap before destroying it. 2020-12-10 Timothy Hatcher Add willInjectUserScriptForFrame to WKWebProcessPlugInLoadDelegate. https://bugs.webkit.org/show_bug.cgi?id=219727 rdar://71987073 Reviewed by Brady Eidson. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (willInjectUserScriptForFrame): Added. (setUpPageLoaderClient): Set client.willInjectUserScriptForFrame. 2020-12-10 Don Olmstead [GTK] Add even more exports to support hidden visibility https://bugs.webkit.org/show_bug.cgi?id=219747 Reviewed by Michael Catanzaro. Add WK_EXPORT to additional declarations. * UIProcess/API/glib/WebKitSettingsPrivate.h: * UIProcess/API/glib/WebKitWebViewInternal.h: * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: 2020-12-10 Peng Liu [Media in GPU Process][MSE] Implement seeking support https://bugs.webkit.org/show_bug.cgi?id=219658 Reviewed by Jer Noble. Implement the required functions with IPC to support seeking. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::seekToTime): (WebKit::RemoteMediaSourceProxy::waitForSeekCompleted): (WebKit::RemoteMediaSourceProxy::seekCompleted): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteMediaSourceProxy.messages.in: * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::seekToTime): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::~MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::waitForSeekCompleted): (WebKit::MediaSourcePrivateRemote::seekCompleted): (WebKit::MediaSourcePrivateRemote::seekToTime): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: * WebProcess/GPU/media/MediaSourcePrivateRemote.messages.in: Added. * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::seekToTime): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-10 Alex Christensen Introduce new download API https://bugs.webkit.org/show_bug.cgi?id=217747 Reviewed by Brady Eidson. Safari currently uses _WKDownload, which has evolved strangely over the last decade. In order to make a nicer interface, we need to learn from those lessons and take a step back. I did that, and here's what I came up with: WKDownload and WKDownloadDelegate! Notable changes include: 1. The delegate now lives on the download object instead of the process pool. 2. WKDownload does not conform to NSCopying because we have NSMapTable instead of NSDictionary. 3. publishProgressAtURL is gone. That will be reimplemented in the UI process of the client that used it. 4. cancel has a completion handler to get the resume data instead of waiting for didCancel then getting it from the download object. 5. didFailWithError also gives you the resume data, so there is no way to get it from the download object. That's more about a fail/cancel event than a property of the download. 6. wasUserInitiated is gone. Instead, WKNavigationDelegate has a callback that links a navigation action (where _isUserInitiated is exposed) to the download. 7. redirectChain is also gone. That can also be gotten from the link to the navigation and the download delegate's redirect callback. 8. _downloadDidStart is gone. Instead, we have completion handlers that expose a WKDownload once it's started. There's no need to reference the download object before then anyways. Note: that's when the download "starts" which is before it receives the response, so there will be no server delay in the difference between download object availabilities. 9. didReceiveServerRedirectToURL now gives you the option of continuing or cancelling. This reflects the amount of control the WKNavigationDelegate has. 10. decideDestinationWithSuggestedFilename and didReceiveResponse have been merged, since they actually happen at the same time and NSURLResponse has suggestedFilename API. allowOverwrite is also gone. It wasn't used, and not really needed. 11. didCreateDestination is gone. That callback time wasn't really necessary. If you need to know when it's created, wait until the first didWriteData callback. The destination has definitely been created by then. 12. shouldDecodeSourceDataOfMIMEType is gone. It's actually not called since we adopted NSURLSession, and we should remove the related dead code. 13. originatingFrame is gone. On _WKDownload it was actually a non-null WKFrameInfo that often contained no information. When information was there, the information access has been replaced by didBecomeDownload which links the WKNavigationResponse which has frame info on it. I wrote API tests for everything I could think of. * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::resumeDownload): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): (WebKit::Download::platformCancelNetworkLoad): * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::suggestedFilename const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::resumeDownload): (WebKit::NetworkProcess::findPendingDownloadLocation): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): * Scripts/webkit/messages.py: * Shared/API/Cocoa/WebKit.h: * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIDownloadClient.h: (API::DownloadClient::legacyDidStart): (API::DownloadClient::didFail): (API::DownloadClient::didStart): Deleted. * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::navigationResponseDidBecomeDownload): (API::NavigationClient::navigationActionDidBecomeDownload): (API::NavigationClient::contextMenuDidCreateDownload): * UIProcess/API/APIPolicyClient.h: (API::PolicyClient::decidePolicyForNavigationAction): (API::PolicyClient::decidePolicyForNewWindowAction): * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKContextDownloadClient.h: Removed. * UIProcess/API/C/WKDownload.cpp: Removed. * UIProcess/API/C/WKDownloadClient.h: Added. * UIProcess/API/C/WKDownloadRef.cpp: Added. (WKDownloadGetTypeID): (WKDownloadCopyRequest): (WKDownloadCancel): (WKDownloadGetOriginatingPage): (WKDownloadGetWasUserInitiated): (WKDownloadSetClient): * UIProcess/API/C/WKDownloadRef.h: Renamed from Source/WebKit/UIProcess/API/C/WKDownload.h. * UIProcess/API/C/WKPage.cpp: (WKPageSetPagePolicyClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageNavigationClient.h: * UIProcess/API/Cocoa/WKDownload.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownload.h. * UIProcess/API/Cocoa/WKDownload.mm: Added. (-[WKDownload cancel:]): (-[WKDownload originalRequest]): (-[WKDownload delegate]): (-[WKDownload setDelegate:]): (-[WKDownload dealloc]): (-[WKDownload _apiObject]): * UIProcess/API/Cocoa/WKDownloadDelegate.h: Added. * UIProcess/API/Cocoa/WKDownloadInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownloadInternal.h. * UIProcess/API/Cocoa/WKNavigationAction.h: * UIProcess/API/Cocoa/WKNavigationAction.mm: (-[WKNavigationAction downloadAttribute]): (-[WKNavigationAction _shouldPerformDownload]): * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _downloadURLRequest:websiteDataStore:originatingWebView:]): (-[WKProcessPool _resumeDownloadFromData:websiteDataStore:path:originatingWebView:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView downloadRequest:completionHandler:]): (-[WKWebView resumeDownloadWithData:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload initWithDownload2:]): (+[_WKDownload downloadWithDownload:]): (-[_WKDownload cancel]): (-[_WKDownload publishProgressAtURL:]): (-[_WKDownload request]): (-[_WKDownload originatingWebView]): (-[_WKDownload redirectChain]): (-[_WKDownload wasUserInitiated]): (-[_WKDownload resumeData]): (-[_WKDownload originatingFrame]): (-[_WKDownload _apiObject]): (-[_WKDownload dealloc]): Deleted. * UIProcess/API/Cocoa/_WKDownloadDelegate.h: * UIProcess/API/Cocoa/_WKDownloadInternal.h: * UIProcess/API/glib/WebKitDownloadClient.cpp: * UIProcess/Cocoa/LegacyDownloadClient.h: * UIProcess/Cocoa/LegacyDownloadClient.mm: (WebKit::LegacyDownloadClient::legacyDidStart): (WebKit::LegacyDownloadClient::didReceiveResponse): (WebKit::LegacyDownloadClient::didReceiveData): (WebKit::LegacyDownloadClient::didReceiveAuthenticationChallenge): (WebKit::LegacyDownloadClient::didCreateDestination): (WebKit::LegacyDownloadClient::processDidCrash): (WebKit::LegacyDownloadClient::decideDestinationWithSuggestedFilename): (WebKit::LegacyDownloadClient::didFinish): (WebKit::LegacyDownloadClient::didFail): (WebKit::LegacyDownloadClient::legacyDidCancel): (WebKit::LegacyDownloadClient::willSendRequest): (WebKit::LegacyDownloadClient::didStart): Deleted. * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): (WebKit::NavigationState::NavigationClient::navigationActionDidBecomeDownload): (WebKit::NavigationState::NavigationClient::navigationResponseDidBecomeDownload): (WebKit::NavigationState::NavigationClient::contextMenuDidCreateDownload): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::~DownloadProxy): (WebKit::DownloadProxy::didStart): (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): (WebKit::DownloadProxy::didFail): (WebKit::DownloadProxy::setClient): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setDidStartCallback): (WebKit::DownloadProxy::setSuggestedFilename): * UIProcess/Network/NetworkProcessProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::resumeDownload): (WebKit::WebPageProxy::downloadRequest): (WebKit::WebPageProxy::contextMenuItemSelected): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::resumeDownload): * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2020-12-10 Don Olmstead [CMake] Use TARGET_PROPERTY to set includes for executables https://bugs.webkit.org/show_bug.cgi?id=219743 Reviewed by Michael Catanzaro. Use $ for all executables being built alongside WebKit. This simplifies the includes for those targets. * CMakeLists.txt: 2020-12-10 Chris Dumez Unreviewed, reverting r270542. Seems to have regressed perf benchmarks Reverted changeset: "[iOS] Stop leaking an XPC boost message to XPC services" https://bugs.webkit.org/show_bug.cgi?id=219453 https://trac.webkit.org/changeset/270542 2020-12-10 Youenn Fablet ICE does not resolve for `turns` relay candidates rooted in LetsEncrypt CA https://bugs.webkit.org/show_bug.cgi?id=219274 Reviewed by Eric Carlson. Use NWConnection for client TCP sockets. This allows piggy-backing on this API for things such as proxies or certificate validation. Implementation does opening a TCP socket with TLS using NWConnection: - If the socket is created for STUN/TURN, it is sending packets as is. For receiving data, the socket will make sure to split received data in meaningful messages that WebProcess will process. - If the socket is TCP for data, sent data is prefixed with the size of the data. For received data, the length of the message is read and we wait to receive the whole message data to send it to WebProcess. We enable that new code path based on an experimental feature. Tested manually with TURNS servers and TCP-only connections. * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createClientTCPSocket): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::setPlatformSocketsEnabled): * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * NetworkProcess/webrtc/NetworkRTCSocketSocketCocoa.h: Added. * NetworkProcess/webrtc/NetworkRTCSocketSocketCocoa.mm: Added. (WebKit::socketQueue): (WebKit::NetworkRTCSocketSocketCocoa::createClientTCPSocket): (WebKit::isStunMessage): (WebKit::getSTUNOrTURNMessageLength): (WebKit::extractSTUNOrTURNMessages): (WebKit::extractMessages): (WebKit::processMessage): (WebKit::NetworkRTCSocketSocketCocoa::NetworkRTCSocketSocketCocoa): (WebKit::NetworkRTCSocketSocketCocoa::close): (WebKit::NetworkRTCSocketSocketCocoa::setOption): (WebKit::dataFromVector): (WebKit::NetworkRTCSocketSocketCocoa::sendTo): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::setConnection): 2020-12-10 Antoine Quint Unified WebKit build fails https://bugs.webkit.org/show_bug.cgi?id=219734 Reviewed by Tim Horton. * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: 2020-12-10 Jiewen Tan Unreviewed, build fix after r270616 Adds a platform have flag. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h: * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: 2020-12-10 Jiewen Tan [WebAuthn] Adopt new UI for the Security Key makeCredential flow https://bugs.webkit.org/show_bug.cgi?id=219708 Reviewed by Brent Fulgham. This patch adopts the new AuthenticationServices' UI. The idea is to use AuthenticatorPresenterCoordinator as the middle layer to connect to the new UI while keeping the existing interfaces the same in the AuthenticatorManager to handle the interactions between UI and authenticators. Covered by manual tests. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: Added. SPI for the new UI. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: * Scripts/process-entitlements.sh: Added new sandbox rules for Remote SpringBoard services which are used by the new UI. * SourcesCocoa.txt: Paperwork. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): (WebKit::AuthenticatorManager::cancel): (WebKit::AuthenticatorManager::enableModernWebAuthentication): (WebKit::AuthenticatorManager::clearState): (WebKit::AuthenticatorManager::serviceStatusUpdated): (WebKit::AuthenticatorManager::authenticatorStatusUpdated): (WebKit::AuthenticatorManager::requestPin): (WebKit::AuthenticatorManager::selectAssertionResponse): (WebKit::AuthenticatorManager::startDiscovery): (WebKit::AuthenticatorManager::runPanel): (WebKit::AuthenticatorManager::runPresenter): (WebKit::AuthenticatorManager::invokePendingCompletionHandler): * UIProcess/WebAuthentication/AuthenticatorManager.h: Teached AuthenticatorManager to use the new UI's presenter when it is available. Otherwise, it falls back to the old UI. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h: Added. * UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm: Added. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: Added. * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: Added. (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): (WebKit::AuthenticatorPresenterCoordinator::updatePresenter): (WebKit::AuthenticatorPresenterCoordinator::requestPin): (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): (WebKit::AuthenticatorPresenterCoordinator::dimissPresenter): * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.h: Added. * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: Added. (-[WKASCAuthorizationPresenterDelegate initWithCoordinator:]): (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:validateUserEnteredPIN:completionHandler:]): Introduced the AuthenticatorPresenterCoordinator to handle the new UI. * WebAuthnProcess/WebAuthnProcess.cpp: (WebKit::WebAuthnProcess::WebAuthnProcess): (WebKit::WebAuthnProcess::setMockWebAuthenticationConfiguration): Teached WebAuthnProcess to inform AuthenticatorManager about its existence. * WebKit.xcodeproj/project.pbxproj: Paperwork. 2020-12-09 Per Arne Vollan [macOS] Remove com.apple.PowerManagement.control from WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=219685 Reviewed by Darin Adler. Remove com.apple.PowerManagement.control from WebContent sandbox on macOS, since there are no reports of this being in use. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-09 Peng Liu [Media in GPU Process][MSE] Implement basic video playback https://bugs.webkit.org/show_bug.cgi?id=219402 Reviewed by Jer Noble. Implement the necessary functions with IPC to support media playback. * GPUProcess/media/RemoteAudioTrackProxy.cpp: (WebKit::RemoteAudioTrackProxy::configuration): Rename `identifier` to `trackId` because it is easy to confuse with `TrackPrivateRemoteIdentifier`. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): (WebKit::RemoteMediaPlayerProxy::updateCachedState): For MSE media player, `SourceBuffer` provides the buffered ranges, so `RemoteMediaPlayerProxy` does not need to report this information to the `MediaPlayer` object in the Web process. * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::duration const): (WebKit::RemoteMediaSourceProxy::buffered const): (WebKit::RemoteMediaSourceProxy::durationChanged): (WebKit::RemoteMediaSourceProxy::setReadyState): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteMediaSourceProxy.messages.in: * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::~RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidParseSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateBufferedDirtyChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateBufferedRangesChanged): (WebKit::RemoteSourceBufferProxy::setActive): (WebKit::RemoteSourceBufferProxy::setReadyState): (WebKit::RemoteSourceBufferProxy::updateBufferedFromTrackBuffers): (WebKit::RemoteSourceBufferProxy::evictCodedFrames): (WebKit::RemoteSourceBufferProxy::addTrackBuffer): (WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded): (WebKit::RemoteSourceBufferProxy::trySignalAllSamplesInTrackEnqueued): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasAudio const): Deleted. (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasVideo const): Deleted. * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::configuration): * GPUProcess/media/RemoteVideoTrackProxy.cpp: (WebKit::RemoteVideoTrackProxy::configuration): * GPUProcess/media/TextTrackPrivateRemoteConfiguration.h: (WebKit::TextTrackPrivateRemoteConfiguration::encode const): (WebKit::TextTrackPrivateRemoteConfiguration::decode): * GPUProcess/media/TrackPrivateRemoteConfiguration.h: (WebKit::TrackPrivateRemoteConfiguration::encode const): (WebKit::TrackPrivateRemoteConfiguration::decode): * WebProcess/GPU/media/AudioTrackPrivateRemote.cpp: (WebKit::AudioTrackPrivateRemote::updateConfiguration): * WebProcess/GPU/media/AudioTrackPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::load): * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::durationChanged): (WebKit::MediaSourcePrivateRemote::isEnded const): (WebKit::MediaSourcePrivateRemote::setReadyState): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::setReadyState): (WebKit::SourceBufferPrivateRemote::flush): (WebKit::SourceBufferPrivateRemote::setActive): (WebKit::SourceBufferPrivateRemote::updateBufferedFromTrackBuffers): (WebKit::SourceBufferPrivateRemote::evictCodedFrames): (WebKit::SourceBufferPrivateRemote::addTrackBuffer): (WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded): (WebKit::SourceBufferPrivateRemote::trySignalAllSamplesInTrackEnqueued): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDurationChanged): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidParseSample): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateBufferedDirtyChanged): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateBufferedRangesChanged): (WebKit::SourceBufferPrivateRemote::enqueueSample): Deleted. * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: * WebProcess/GPU/media/TextTrackPrivateRemote.cpp: (WebKit::TextTrackPrivateRemote::updateConfiguration): * WebProcess/GPU/media/VideoTrackPrivateRemote.cpp: (WebKit::VideoTrackPrivateRemote::updateConfiguration): 2020-11-30 Brian Burg [Cocoa] Web Inspector: add support for creating extension tabs in WebInspectorUI via _WKInspectorExtension https://bugs.webkit.org/show_bug.cgi?id=219380 Reviewed by Devin Rousso and Timothy Hatcher. Add a new method to _WKInspectorExtension for creating an extension tab in WebInpectorUI. This can be used to implement browser.devtools.panels.create() as provided by the Web Extensions API. * Platform/Logging.h: Add Inspector channel for error logging. * Shared/InspectorExtensionTypes.h: Add a missing EnumTraits case. * WebKit.xcodeproj/project.pbxproj: * Sources.txt: Add files. * UIProcess/API/APIInspectorExtension.h: * UIProcess/API/APIInspectorExtension.cpp: (API::InspectorExtension::InspectorExtension): (API::InspectorExtension::create): (API::InspectorExtension::createTab): Inspector extensions need to be able to invoke commands in the WebProcess-side extension proxy controller, so keep a WeakRef to the extension controller that created the extension object. Also, implement the new API by forwarding it on. * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): Adapt to the new constructor as explained above. * UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: Expose member m_remoteInspectorPorxy for use in the API::InspectorExtension constructor. * UIProcess/API/Cocoa/_WKInspectorExtension.h: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: (-[_WKInspectorExtension initWithIdentifier:]): Deleted. (-[_WKInspectorExtension createTabWithName:tabIconURL:sourceURL:completionHandler:]): Implement new API. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerInternal.h: Added. Make the RefPtr member variable accessible to the API object constructor. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): Adapt to new constructor as explained above. * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: (WebKit::WebInspectorUIExtensionControllerProxy::createTabForExtension): Forward the request to the inspector frontend WebProcess. * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: Add a new async IPC command for creating a new inspector extension tab. * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: (WebKit::WebInspectorUIExtensionController::unwrapEvaluationResultAsObject): Added. Pull out the code needed for error-handling this common operation. (WebKit::WebInspectorUIExtensionController::createTabForExtension): Added. Call into InspectorFrontendAPI to request a new tab. Turn the result into an InspectorExtensionError or InspectorExtensionTabID and send the IPC reply. * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h: Fix unified sources fallout. 2020-12-09 Said Abou-Hallawa [GPU Process]: Recording an in-process ImageBuffer drawing has to convert it to a NativeImage first https://bugs.webkit.org/show_bug.cgi?id=219705 Reviewed by Wenson Hsieh. Override the virtual method isCachedImageBuffer() which in this case answers the question: is this a remote ImageBuffer or not? * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-12-09 Per Arne Vollan [macOS] Allow mach-lookup of com.apple.relatived.tempest in WebKit GPU process https://bugs.webkit.org/show_bug.cgi?id=219701 Reviewed by Darin Adler. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: 2020-12-09 Wenson Hsieh Some WebGL tests crash in WebKit::RemoteRenderingBackendProxy::willAppendItem(WebCore::RenderingResourceIdentifier) https://bugs.webkit.org/show_bug.cgi?id=219700 Reviewed by Tim Horton. Fixes these assertions by resetting the identifier of the "most recently appended" image buffer (m_currentDestinationImageBufferIdentifier) when the image buffer is released in the rendering backend. We keep track of this so that we can append MetaCommandChangeDestinationImageBuffer items when painting into multiple image buffers; the code to do this in willAppendItem is actually robust against the case where m_currentDestinationImageBufferIdentifier is unknown, but still debug asserts. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): 2020-12-09 Alex Christensen Fix clicking on links in PDFs on Big Sur after r266654 https://bugs.webkit.org/show_bug.cgi?id=219665 Reviewed by Tim Horton. mouseUp: was being called by AppKit on the WKPDFHUDView instead of the WKWebView, causing the event to not make it to the PDFPlugin, which meant PDFKit wasn't being told it was clicked on, which means it wasn't telling WebKit to change the frame's location. Overriding hitTest to forward all mouse events to the WKWebView solves this problem. Covered by the WebKit.PDFLinkReferrer API test, which was failing on Big Sur, where ENABLE(UI_PROCESS_PDF_HUD) is true. * UIProcess/PDF/WKPDFHUDView.mm: (-[WKPDFHUDView hitTest:]): 2020-12-09 Wenson Hsieh [Concurrent display lists] Support playback of display list items with cached resources https://bugs.webkit.org/show_bug.cgi?id=218614 Reviewed by Tim Horton. Teaches the GPU process to resume playback of display list items that were previously unable to be played back due to missing cached resources. See below for more details. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): See if the newly created image buffer's ID matches that of the pending wakeup message; if so, immediately kick off the wakeup loop. (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): In the case where the next destination image buffer is unknown, bail early and resume when we eventually learn about the image buffer in the GPU process. This can happen if a MetaCommandChangeDestinationImageBuffer item is added that references a newly created image buffer. (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): (WebKit::RemoteRenderingBackend::cacheNativeImage): See if the newly cached image's ID matches that of the pending wakeup message; if so, immediately kick off the wakeup loop. (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * GPUProcess/graphics/RemoteRenderingBackend.h: Add a private `PendingWakeupInformation` struct that encapsulates all the information needed to remember that we stopped display list processing, and resume processing in the future. Currently, this contains a set of wakeup message arguments, and (optionally) the identifier of the missing resource that we need to receive in order to continue. We also use this in place of storing GPUProcessWakeupMessageArguments on RemoteRenderingBackend. (WebKit::RemoteRenderingBackend::PendingWakeupInformation::shouldPerformWakeup const): 2020-12-09 Kimmo Kinnunen Implement RemoteWebGLBackend https://bugs.webkit.org/show_bug.cgi?id=217216 Reviewed by Simon Fraser. Implements a beginning of a remote version of GraphicsContextGL for GPU process. Current implementation is using WebKit IPC. Implemented with a generator script implementing the IPC to pass the GraphicsContextGL member function calls from web process to the GPU process. The script is run during development time and the results are committed to the repo for ease of review. Implement the RemoteGraphicsContextGL in WebKit side. This class will forward calls received via IPC to the GraphicsContextGLOpenGL. At the moment RemoteGraphicsContextGL instance is a direct child of GPUConnectionToWebProcess. Compositing is implemented only for PLATFORM(COCOA). Missing: - Simulated context loss - Simulated context change - Paint WebGL contents to 2D canvas - Upload video to WebGL - Upload canvas to WebGL * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createGraphicsContextGL): (WebKit::GPUConnectionToWebProcess::releaseGraphicsContextGL): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: Added. (WebKit::RemoteGraphicsContextGL::create): (WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL): (WebKit::RemoteGraphicsContextGL::~RemoteGraphicsContextGL): (WebKit::RemoteGraphicsContextGL::gpuConnectionToWebProcess const): (WebKit::RemoteGraphicsContextGL::messageSenderConnection const): (WebKit::RemoteGraphicsContextGL::messageSenderDestinationID const): (WebKit::RemoteGraphicsContextGL::didComposite): (WebKit::RemoteGraphicsContextGL::forceContextLost): (WebKit::RemoteGraphicsContextGL::recycleContext): (WebKit::RemoteGraphicsContextGL::dispatchContextChangedNotification): (WebKit::RemoteGraphicsContextGL::recycleBuffer): (WebKit::RemoteGraphicsContextGL::present): (WebKit::RemoteGraphicsContextGL::detachClient): (WebKit::RemoteGraphicsContextGL::reshape): (WebKit::RemoteGraphicsContextGL::prepareForDisplay): (WebKit::RemoteGraphicsContextGL::ensureExtensionEnabled): (WebKit::RemoteGraphicsContextGL::notifyMarkContextChanged): * GPUProcess/graphics/RemoteGraphicsContextGL.h: Added. * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: Added. * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h: Added. (setFailNextGPUStatusCheck): (synthesizeGLError): (moveErrorsToSyntheticErrorList): (activeTexture): (attachShader): (bindAttribLocation): (bindBuffer): (bindFramebuffer): (bindRenderbuffer): (bindTexture): (blendColor): (blendEquation): (blendEquationSeparate): (blendFunc): (blendFuncSeparate): (checkFramebufferStatus): (clear): (clearColor): (clearDepth): (clearStencil): (colorMask): (compileShader): (copyTexImage2D): (copyTexSubImage2D): (createBuffer): (createFramebuffer): (createProgram): (createRenderbuffer): (createShader): (createTexture): (cullFace): (deleteBuffer): (deleteFramebuffer): (deleteProgram): (deleteRenderbuffer): (deleteShader): (deleteTexture): (depthFunc): (depthMask): (depthRange): (detachShader): (disable): (disableVertexAttribArray): (drawArrays): (drawElements): (enable): (enableVertexAttribArray): (finish): (flush): (framebufferRenderbuffer): (framebufferTexture2D): (frontFace): (generateMipmap): (getActiveAttrib): (getActiveUniform): (getAttribLocation): (getBufferParameteri): (getString): (getFloatv): (getIntegerv): (getInteger64): (getInteger64i): (getProgrami): (getBooleanv): (getError): (getFramebufferAttachmentParameteri): (getProgramInfoLog): (getRenderbufferParameteri): (getShaderi): (getShaderInfoLog): (getShaderPrecisionFormat): (getShaderSource): (getTexParameterf): (getTexParameteri): (getUniformfv): (getUniformiv): (getUniformuiv): (getUniformLocation): (getVertexAttribOffset): (hint): (isBuffer): (isEnabled): (isFramebuffer): (isProgram): (isRenderbuffer): (isShader): (isTexture): (lineWidth): (linkProgram): (pixelStorei): (polygonOffset): (renderbufferStorage): (sampleCoverage): (scissor): (shaderSource): (stencilFunc): (stencilFuncSeparate): (stencilMask): (stencilMaskSeparate): (stencilOp): (stencilOpSeparate): (texParameterf): (texParameteri): (uniform1f): (uniform1fv): (uniform1i): (uniform1iv): (uniform2f): (uniform2fv): (uniform2i): (uniform2iv): (uniform3f): (uniform3fv): (uniform3i): (uniform3iv): (uniform4f): (uniform4fv): (uniform4i): (uniform4iv): (uniformMatrix2fv): (uniformMatrix3fv): (uniformMatrix4fv): (useProgram): (validateProgram): (vertexAttrib1f): (vertexAttrib1fv): (vertexAttrib2f): (vertexAttrib2fv): (vertexAttrib3f): (vertexAttrib3fv): (vertexAttrib4f): (vertexAttrib4fv): (vertexAttribPointer): (viewport): (bufferData0): (bufferData1): (bufferSubData): (readnPixels0): (readnPixels1): (texImage2D0): (texImage2D1): (texSubImage2D0): (texSubImage2D1): (compressedTexImage2D0): (compressedTexImage2D1): (compressedTexSubImage2D0): (compressedTexSubImage2D1): (drawArraysInstanced): (drawElementsInstanced): (vertexAttribDivisor): (createVertexArray): (deleteVertexArray): (isVertexArray): (bindVertexArray): (copyBufferSubData): (getBufferSubData): (blitFramebuffer): (framebufferTextureLayer): (invalidateFramebuffer): (invalidateSubFramebuffer): (readBuffer): (renderbufferStorageMultisample): (texStorage2D): (texStorage3D): (texImage3D0): (texImage3D1): (texSubImage3D0): (texSubImage3D1): (copyTexSubImage3D): (compressedTexImage3D0): (compressedTexImage3D1): (compressedTexSubImage3D0): (compressedTexSubImage3D1): (getFragDataLocation): (uniform1ui): (uniform2ui): (uniform3ui): (uniform4ui): (uniform1uiv): (uniform2uiv): (uniform3uiv): (uniform4uiv): (uniformMatrix2x3fv): (uniformMatrix3x2fv): (uniformMatrix2x4fv): (uniformMatrix4x2fv): (uniformMatrix3x4fv): (uniformMatrix4x3fv): (vertexAttribI4i): (vertexAttribI4iv): (vertexAttribI4ui): (vertexAttribI4uiv): (vertexAttribIPointer): (drawRangeElements): (drawBuffers): (clearBufferiv): (clearBufferuiv): (clearBufferfv): (clearBufferfi): (createQuery): (deleteQuery): (isQuery): (beginQuery): (endQuery): (getQuery): (getQueryObjectui): (createSampler): (deleteSampler): (isSampler): (bindSampler): (samplerParameteri): (samplerParameterf): (getSamplerParameterf): (getSamplerParameteri): (fenceSync): (isSync): (deleteSync): (clientWaitSync): (waitSync): (getSynci): (createTransformFeedback): (deleteTransformFeedback): (isTransformFeedback): (bindTransformFeedback): (beginTransformFeedback): (endTransformFeedback): (transformFeedbackVaryings): (getTransformFeedbackVarying): (pauseTransformFeedback): (resumeTransformFeedback): (bindBufferBase): (bindBufferRange): (getUniformIndices): (getActiveUniforms): (getUniformBlockIndex): (getActiveUniformBlockName): (uniformBlockBinding): (getActiveUniformBlockiv): (getGraphicsResetStatusARB): (blitFramebufferANGLE): (renderbufferStorageMultisampleANGLE): (createVertexArrayOES): (deleteVertexArrayOES): (isVertexArrayOES): (bindVertexArrayOES): (getTranslatedShaderSourceANGLE): (insertEventMarkerEXT): (pushGroupMarkerEXT): (popGroupMarkerEXT): (drawBuffersEXT): (drawArraysInstancedANGLE): (drawElementsInstancedANGLE): (vertexAttribDivisorANGLE): * GPUProcess/mac/GPUProcessMac.mm: (WebKit::GPUProcess::initializeProcess): * GPUProcess/media/RemoteLegacyCDMProxy.h: * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: * GPUProcess/media/RemoteMediaResourceManager.cpp: * GPUProcess/media/RemoteMediaResourceManager.h: * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.cpp: * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: * GPUProcess/webrtc/RemoteMediaRecorder.h: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: * NetworkProcess/Downloads/Download.cpp: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/NetworkSocketChannel.cpp: * NetworkProcess/NetworkSocketChannel.h: * NetworkProcess/NetworkSocketStream.cpp: * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: * NetworkProcess/WebSocketTask.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: * NetworkProcess/soup/WebSocketTaskSoup.cpp: * NetworkProcess/soup/WebSocketTaskSoup.h: * Platform/IPC/ArgumentCoders.h: * Platform/IPC/ArrayReference.h: Copied from Source/WebKit/Platform/IPC/DataReference.h. (IPC::ArrayReference::ArrayReference): (IPC::ArrayReference::isEmpty const): (IPC::ArrayReference::size const): (IPC::ArrayReference::data const): (IPC::ArrayReference::vector const): * Platform/IPC/Connection.h: (IPC::Connection::sendSync): * Platform/IPC/DataReference.h: * Platform/IPC/Decoder.cpp: (IPC::Decoder::decodeFixedLengthReference): * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.cpp: (IPC::Encoder::wrapForTesting): * Platform/IPC/Encoder.h: * Platform/IPC/HandleMessage.h: * Platform/IPC/MessageSender.h: (IPC::MessageSender::sendSync): * Platform/IPC/SharedBufferCopy.cpp: (IPC::SharedBufferCopy::decode): * Platform/IPC/SharedBufferDataReference.cpp: * Platform/IPC/StringReference.cpp: * PluginProcess/PluginControllerProxy.cpp: * PluginProcess/PluginControllerProxy.h: * Scripts/webkit/messages.py: * Shared/API/APIData.cpp: * Shared/AuxiliaryProcess.h: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/cf/ArgumentCodersCF.cpp: * Shared/soup/WebCoreArgumentCodersSoup.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIIconLoadingClient.h: * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::sendSync): * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h: * UIProcess/PageClient.h: * UIProcess/UserContent/WebUserContentControllerProxy.cpp: * UIProcess/UserContent/WebUserContentControllerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/graphics/GraphicsContextGLIdentifier.h: Renamed from Source/WebKit/Platform/IPC/DataReference.cpp. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: Added. (WebKit::RemoteGraphicsContextGLProxy::create): (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy): (WebKit::RemoteGraphicsContextGLProxy::~RemoteGraphicsContextGLProxy): (WebKit::RemoteGraphicsContextGLProxy::messageSenderConnection const): (WebKit::RemoteGraphicsContextGLProxy::messageSenderDestinationID const): (WebKit::RemoteGraphicsContextGLProxy::reshape): (WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay): (WebKit::RemoteGraphicsContextGLProxy::ensureExtensionEnabled): (WebKit::RemoteGraphicsContextGLProxy::notifyMarkContextChanged): (WebKit::RemoteGraphicsContextGLProxy::simulateContextChanged): (WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas): (WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToImageData): (WebKit::RemoteGraphicsContextGLProxy::wasCreated): (WebKit::RemoteGraphicsContextGLProxy::wasLost): (WebKit::RemoteGraphicsContextGLProxy::wasChanged): (WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: Added. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in: Copied from Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp: Added. (WebKit::RemoteGraphicsContextGLProxy::setFailNextGPUStatusCheck): (WebKit::RemoteGraphicsContextGLProxy::synthesizeGLError): (WebKit::RemoteGraphicsContextGLProxy::moveErrorsToSyntheticErrorList): (WebKit::RemoteGraphicsContextGLProxy::activeTexture): (WebKit::RemoteGraphicsContextGLProxy::attachShader): (WebKit::RemoteGraphicsContextGLProxy::bindAttribLocation): (WebKit::RemoteGraphicsContextGLProxy::bindBuffer): (WebKit::RemoteGraphicsContextGLProxy::bindFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::bindRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::bindTexture): (WebKit::RemoteGraphicsContextGLProxy::blendColor): (WebKit::RemoteGraphicsContextGLProxy::blendEquation): (WebKit::RemoteGraphicsContextGLProxy::blendEquationSeparate): (WebKit::RemoteGraphicsContextGLProxy::blendFunc): (WebKit::RemoteGraphicsContextGLProxy::blendFuncSeparate): (WebKit::RemoteGraphicsContextGLProxy::checkFramebufferStatus): (WebKit::RemoteGraphicsContextGLProxy::clear): (WebKit::RemoteGraphicsContextGLProxy::clearColor): (WebKit::RemoteGraphicsContextGLProxy::clearDepth): (WebKit::RemoteGraphicsContextGLProxy::clearStencil): (WebKit::RemoteGraphicsContextGLProxy::colorMask): (WebKit::RemoteGraphicsContextGLProxy::compileShader): (WebKit::RemoteGraphicsContextGLProxy::copyTexImage2D): (WebKit::RemoteGraphicsContextGLProxy::copyTexSubImage2D): (WebKit::RemoteGraphicsContextGLProxy::createBuffer): (WebKit::RemoteGraphicsContextGLProxy::createFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::createProgram): (WebKit::RemoteGraphicsContextGLProxy::createRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::createShader): (WebKit::RemoteGraphicsContextGLProxy::createTexture): (WebKit::RemoteGraphicsContextGLProxy::cullFace): (WebKit::RemoteGraphicsContextGLProxy::deleteBuffer): (WebKit::RemoteGraphicsContextGLProxy::deleteFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::deleteProgram): (WebKit::RemoteGraphicsContextGLProxy::deleteRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::deleteShader): (WebKit::RemoteGraphicsContextGLProxy::deleteTexture): (WebKit::RemoteGraphicsContextGLProxy::depthFunc): (WebKit::RemoteGraphicsContextGLProxy::depthMask): (WebKit::RemoteGraphicsContextGLProxy::depthRange): (WebKit::RemoteGraphicsContextGLProxy::detachShader): (WebKit::RemoteGraphicsContextGLProxy::disable): (WebKit::RemoteGraphicsContextGLProxy::disableVertexAttribArray): (WebKit::RemoteGraphicsContextGLProxy::drawArrays): (WebKit::RemoteGraphicsContextGLProxy::drawElements): (WebKit::RemoteGraphicsContextGLProxy::enable): (WebKit::RemoteGraphicsContextGLProxy::enableVertexAttribArray): (WebKit::RemoteGraphicsContextGLProxy::finish): (WebKit::RemoteGraphicsContextGLProxy::flush): (WebKit::RemoteGraphicsContextGLProxy::framebufferRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::framebufferTexture2D): (WebKit::RemoteGraphicsContextGLProxy::frontFace): (WebKit::RemoteGraphicsContextGLProxy::generateMipmap): (WebKit::RemoteGraphicsContextGLProxy::getActiveAttrib): (WebKit::RemoteGraphicsContextGLProxy::getActiveUniform): (WebKit::RemoteGraphicsContextGLProxy::getAttribLocation): (WebKit::RemoteGraphicsContextGLProxy::getBufferParameteri): (WebKit::RemoteGraphicsContextGLProxy::getString): (WebKit::RemoteGraphicsContextGLProxy::getFloatv): (WebKit::RemoteGraphicsContextGLProxy::getIntegerv): (WebKit::RemoteGraphicsContextGLProxy::getInteger64): (WebKit::RemoteGraphicsContextGLProxy::getInteger64i): (WebKit::RemoteGraphicsContextGLProxy::getProgrami): (WebKit::RemoteGraphicsContextGLProxy::getBooleanv): (WebKit::RemoteGraphicsContextGLProxy::getError): (WebKit::RemoteGraphicsContextGLProxy::getFramebufferAttachmentParameteri): (WebKit::RemoteGraphicsContextGLProxy::getProgramInfoLog): (WebKit::RemoteGraphicsContextGLProxy::getRenderbufferParameteri): (WebKit::RemoteGraphicsContextGLProxy::getShaderi): (WebKit::RemoteGraphicsContextGLProxy::getShaderInfoLog): (WebKit::RemoteGraphicsContextGLProxy::getShaderPrecisionFormat): (WebKit::RemoteGraphicsContextGLProxy::getShaderSource): (WebKit::RemoteGraphicsContextGLProxy::getTexParameterf): (WebKit::RemoteGraphicsContextGLProxy::getTexParameteri): (WebKit::RemoteGraphicsContextGLProxy::getUniformfv): (WebKit::RemoteGraphicsContextGLProxy::getUniformiv): (WebKit::RemoteGraphicsContextGLProxy::getUniformuiv): (WebKit::RemoteGraphicsContextGLProxy::getUniformLocation): (WebKit::RemoteGraphicsContextGLProxy::getVertexAttribOffset): (WebKit::RemoteGraphicsContextGLProxy::hint): (WebKit::RemoteGraphicsContextGLProxy::isBuffer): (WebKit::RemoteGraphicsContextGLProxy::isEnabled): (WebKit::RemoteGraphicsContextGLProxy::isFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::isProgram): (WebKit::RemoteGraphicsContextGLProxy::isRenderbuffer): (WebKit::RemoteGraphicsContextGLProxy::isShader): (WebKit::RemoteGraphicsContextGLProxy::isTexture): (WebKit::RemoteGraphicsContextGLProxy::lineWidth): (WebKit::RemoteGraphicsContextGLProxy::linkProgram): (WebKit::RemoteGraphicsContextGLProxy::pixelStorei): (WebKit::RemoteGraphicsContextGLProxy::polygonOffset): (WebKit::RemoteGraphicsContextGLProxy::renderbufferStorage): (WebKit::RemoteGraphicsContextGLProxy::sampleCoverage): (WebKit::RemoteGraphicsContextGLProxy::scissor): (WebKit::RemoteGraphicsContextGLProxy::shaderSource): (WebKit::RemoteGraphicsContextGLProxy::stencilFunc): (WebKit::RemoteGraphicsContextGLProxy::stencilFuncSeparate): (WebKit::RemoteGraphicsContextGLProxy::stencilMask): (WebKit::RemoteGraphicsContextGLProxy::stencilMaskSeparate): (WebKit::RemoteGraphicsContextGLProxy::stencilOp): (WebKit::RemoteGraphicsContextGLProxy::stencilOpSeparate): (WebKit::RemoteGraphicsContextGLProxy::texParameterf): (WebKit::RemoteGraphicsContextGLProxy::texParameteri): (WebKit::RemoteGraphicsContextGLProxy::uniform1f): (WebKit::RemoteGraphicsContextGLProxy::uniform1fv): (WebKit::RemoteGraphicsContextGLProxy::uniform1i): (WebKit::RemoteGraphicsContextGLProxy::uniform1iv): (WebKit::RemoteGraphicsContextGLProxy::uniform2f): (WebKit::RemoteGraphicsContextGLProxy::uniform2fv): (WebKit::RemoteGraphicsContextGLProxy::uniform2i): (WebKit::RemoteGraphicsContextGLProxy::uniform2iv): (WebKit::RemoteGraphicsContextGLProxy::uniform3f): (WebKit::RemoteGraphicsContextGLProxy::uniform3fv): (WebKit::RemoteGraphicsContextGLProxy::uniform3i): (WebKit::RemoteGraphicsContextGLProxy::uniform3iv): (WebKit::RemoteGraphicsContextGLProxy::uniform4f): (WebKit::RemoteGraphicsContextGLProxy::uniform4fv): (WebKit::RemoteGraphicsContextGLProxy::uniform4i): (WebKit::RemoteGraphicsContextGLProxy::uniform4iv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4fv): (WebKit::RemoteGraphicsContextGLProxy::useProgram): (WebKit::RemoteGraphicsContextGLProxy::validateProgram): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib1f): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib1fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib2f): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib2fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib3f): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib3fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib4f): (WebKit::RemoteGraphicsContextGLProxy::vertexAttrib4fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribPointer): (WebKit::RemoteGraphicsContextGLProxy::viewport): (WebKit::RemoteGraphicsContextGLProxy::bufferData): (WebKit::RemoteGraphicsContextGLProxy::bufferSubData): (WebKit::RemoteGraphicsContextGLProxy::readnPixels): (WebKit::RemoteGraphicsContextGLProxy::texImage2D): (WebKit::RemoteGraphicsContextGLProxy::texSubImage2D): (WebKit::RemoteGraphicsContextGLProxy::compressedTexImage2D): (WebKit::RemoteGraphicsContextGLProxy::compressedTexSubImage2D): (WebKit::RemoteGraphicsContextGLProxy::drawArraysInstanced): (WebKit::RemoteGraphicsContextGLProxy::drawElementsInstanced): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribDivisor): (WebKit::RemoteGraphicsContextGLProxy::createVertexArray): (WebKit::RemoteGraphicsContextGLProxy::deleteVertexArray): (WebKit::RemoteGraphicsContextGLProxy::isVertexArray): (WebKit::RemoteGraphicsContextGLProxy::bindVertexArray): (WebKit::RemoteGraphicsContextGLProxy::copyBufferSubData): (WebKit::RemoteGraphicsContextGLProxy::getBufferSubData): (WebKit::RemoteGraphicsContextGLProxy::blitFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::framebufferTextureLayer): (WebKit::RemoteGraphicsContextGLProxy::invalidateFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::invalidateSubFramebuffer): (WebKit::RemoteGraphicsContextGLProxy::readBuffer): (WebKit::RemoteGraphicsContextGLProxy::renderbufferStorageMultisample): (WebKit::RemoteGraphicsContextGLProxy::texStorage2D): (WebKit::RemoteGraphicsContextGLProxy::texStorage3D): (WebKit::RemoteGraphicsContextGLProxy::texImage3D): (WebKit::RemoteGraphicsContextGLProxy::texSubImage3D): (WebKit::RemoteGraphicsContextGLProxy::copyTexSubImage3D): (WebKit::RemoteGraphicsContextGLProxy::compressedTexImage3D): (WebKit::RemoteGraphicsContextGLProxy::compressedTexSubImage3D): (WebKit::RemoteGraphicsContextGLProxy::getFragDataLocation): (WebKit::RemoteGraphicsContextGLProxy::uniform1ui): (WebKit::RemoteGraphicsContextGLProxy::uniform2ui): (WebKit::RemoteGraphicsContextGLProxy::uniform3ui): (WebKit::RemoteGraphicsContextGLProxy::uniform4ui): (WebKit::RemoteGraphicsContextGLProxy::uniform1uiv): (WebKit::RemoteGraphicsContextGLProxy::uniform2uiv): (WebKit::RemoteGraphicsContextGLProxy::uniform3uiv): (WebKit::RemoteGraphicsContextGLProxy::uniform4uiv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2x3fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3x2fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix2x4fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4x2fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix3x4fv): (WebKit::RemoteGraphicsContextGLProxy::uniformMatrix4x3fv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4i): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4iv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4ui): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribI4uiv): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribIPointer): (WebKit::RemoteGraphicsContextGLProxy::drawRangeElements): (WebKit::RemoteGraphicsContextGLProxy::drawBuffers): (WebKit::RemoteGraphicsContextGLProxy::clearBufferiv): (WebKit::RemoteGraphicsContextGLProxy::clearBufferuiv): (WebKit::RemoteGraphicsContextGLProxy::clearBufferfv): (WebKit::RemoteGraphicsContextGLProxy::clearBufferfi): (WebKit::RemoteGraphicsContextGLProxy::createQuery): (WebKit::RemoteGraphicsContextGLProxy::deleteQuery): (WebKit::RemoteGraphicsContextGLProxy::isQuery): (WebKit::RemoteGraphicsContextGLProxy::beginQuery): (WebKit::RemoteGraphicsContextGLProxy::endQuery): (WebKit::RemoteGraphicsContextGLProxy::getQuery): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectui): (WebKit::RemoteGraphicsContextGLProxy::createSampler): (WebKit::RemoteGraphicsContextGLProxy::deleteSampler): (WebKit::RemoteGraphicsContextGLProxy::isSampler): (WebKit::RemoteGraphicsContextGLProxy::bindSampler): (WebKit::RemoteGraphicsContextGLProxy::samplerParameteri): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterf): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterf): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameteri): (WebKit::RemoteGraphicsContextGLProxy::fenceSync): (WebKit::RemoteGraphicsContextGLProxy::isSync): (WebKit::RemoteGraphicsContextGLProxy::deleteSync): (WebKit::RemoteGraphicsContextGLProxy::clientWaitSync): (WebKit::RemoteGraphicsContextGLProxy::waitSync): (WebKit::RemoteGraphicsContextGLProxy::getSynci): (WebKit::RemoteGraphicsContextGLProxy::createTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::deleteTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::isTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::bindTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::beginTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::endTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::transformFeedbackVaryings): (WebKit::RemoteGraphicsContextGLProxy::getTransformFeedbackVarying): (WebKit::RemoteGraphicsContextGLProxy::pauseTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::resumeTransformFeedback): (WebKit::RemoteGraphicsContextGLProxy::bindBufferBase): (WebKit::RemoteGraphicsContextGLProxy::bindBufferRange): (WebKit::RemoteGraphicsContextGLProxy::getUniformIndices): (WebKit::RemoteGraphicsContextGLProxy::getActiveUniforms): (WebKit::RemoteGraphicsContextGLProxy::getUniformBlockIndex): (WebKit::RemoteGraphicsContextGLProxy::getActiveUniformBlockName): (WebKit::RemoteGraphicsContextGLProxy::uniformBlockBinding): (WebKit::RemoteGraphicsContextGLProxy::getActiveUniformBlockiv): (WebKit::RemoteGraphicsContextGLProxy::getGraphicsResetStatusARB): (WebKit::RemoteGraphicsContextGLProxy::blitFramebufferANGLE): (WebKit::RemoteGraphicsContextGLProxy::renderbufferStorageMultisampleANGLE): (WebKit::RemoteGraphicsContextGLProxy::createVertexArrayOES): (WebKit::RemoteGraphicsContextGLProxy::deleteVertexArrayOES): (WebKit::RemoteGraphicsContextGLProxy::isVertexArrayOES): (WebKit::RemoteGraphicsContextGLProxy::bindVertexArrayOES): (WebKit::RemoteGraphicsContextGLProxy::getTranslatedShaderSourceANGLE): (WebKit::RemoteGraphicsContextGLProxy::insertEventMarkerEXT): (WebKit::RemoteGraphicsContextGLProxy::pushGroupMarkerEXT): (WebKit::RemoteGraphicsContextGLProxy::popGroupMarkerEXT): (WebKit::RemoteGraphicsContextGLProxy::drawBuffersEXT): (WebKit::RemoteGraphicsContextGLProxy::drawArraysInstancedANGLE): (WebKit::RemoteGraphicsContextGLProxy::drawElementsInstancedANGLE): (WebKit::RemoteGraphicsContextGLProxy::vertexAttribDivisorANGLE): (WebKit::RemoteGraphicsContextGLProxy::getInternalformativ): (WebKit::RemoteGraphicsContextGLProxy::readPixelsRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::texParameterfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::texParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getBufferPointervRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getInternalformativRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getVertexAttribIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getVertexAttribIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getUniformuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getBufferParameteri64vRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getFramebufferParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getProgramInterfaceivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getBooleani_vRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getMultisamplefvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getTexLevelParameterivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getTexLevelParameterfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getPointervRobustANGLERobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getnUniformfvRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getnUniformivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getnUniformuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::texParameterIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::texParameterIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getTexParameterIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getTexParameterIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::samplerParameterIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterIivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getSamplerParameterIuivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectivRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjecti64vRobustANGLE): (WebKit::RemoteGraphicsContextGLProxy::getQueryObjectui64vRobustANGLE): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): * WebProcess/GPU/media/RemoteAudioSession.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: * WebProcess/GPU/media/RemoteLegacyCDMSession.cpp: * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/TextTrackPrivateRemote.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/Network/NetworkProcessConnection.h: * WebProcess/Network/WebResourceLoader.cpp: * WebProcess/Network/WebResourceLoader.h: * WebProcess/Network/WebSocketChannel.cpp: * WebProcess/Network/WebSocketChannel.h: * WebProcess/Network/WebSocketStream.cpp: * WebProcess/Network/WebSocketStream.h: * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createGraphicsContextGL const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::sendSyncWithDelayedReply): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleEditingKeyboardEvent): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setUseGPUProcessForWebGL): (WebKit::WebProcess::shouldUseRemoteRenderingForWebGL const): * WebProcess/WebProcess.h: 2020-12-09 Brent Fulgham REGRESSION(r269647) [Cocoa] Consume GPU sandbox extensions early in Web page creation flow https://bugs.webkit.org/show_bug.cgi?id=219659 Reviewed by Jer Noble. We need to consume GPU sandbox extensions earlier in the Web page creation flow so that API calls to things like muting video have the relevant mach connections available. This change corrects a regression introduced in Bug 218708 (r269647). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Move extension consumption earlier in the constructor. 2020-12-09 Carlos Garcia Campos WebDriver: add support for pen pointer events https://bugs.webkit.org/show_bug.cgi?id=219024 Reviewed by Brian Burg. Make it possible to synthesize pointer events for any pointer type. Add pen input source to automation and handle it when dispatching actions. * Shared/NativeWebMouseEvent.h: * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent): * Shared/WebMouseEvent.cpp: (WebKit::WebMouseEvent::WebMouseEvent): (WebKit::WebMouseEvent::encode const): (WebKit::WebMouseEvent::decode): * Shared/WebMouseEvent.h: (WebKit::WebMouseEvent::pointerId const): (WebKit::WebMouseEvent::pointerType const): * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (primaryPointerForType): (webkitWebViewBaseSynthesizeMouseEvent): * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: * UIProcess/Automation/Automation.json: * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputSourceState::emptyStateForSourceType): (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::simulateMouseInteraction): (WebKit::WebAutomationSession::performMouseInteraction): (WebKit::simulatedInputSourceTypeFromProtocolSourceType): (WebKit::WebAutomationSession::performInteractionSequence): * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): * UIProcess/Automation/mac/WebAutomationSessionMac.mm: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: (WebKit::WebAutomationSession::platformSimulateMouseInteraction): * UIProcess/gtk/PointerLockManager.cpp: (WebKit::PointerLockManager::handleMotion): 2020-12-09 Stephan Szabo [PlayStation] Fix PlayStation GPU process code after r270563 https://bugs.webkit.org/show_bug.cgi?id=219682 Unreviewed build fix. Remove mediaPlayerRenderingModeChanged from playstation specific RemoteMediaPlayerProxyPlayStation file similar to the removals from other versions in r270563. * GPUProcess/media/playstation/RemoteMediaPlayerProxyPlayStation.cpp: 2020-12-09 Per Arne Vollan [macOS] Change Universal Access zoom in the UI process https://bugs.webkit.org/show_bug.cgi?id=219635 Reviewed by Darin Adler. Implement the method changeUniversalAccessZoomFocus in the WebProcess' chrome client, which will send a message to the UI process, where the Universal Access zoom will be changed. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::changeUniversalAccessZoomFocus): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::changeUniversalAccessZoomFocus): * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-12-09 Ryosuke Niwa iOS build fix after r270573. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): 2020-12-09 Per Arne Vollan Remove access to com.apple.audio.toolbox.reporting.service https://bugs.webkit.org/show_bug.cgi?id=219638 Reviewed by Darin Adler. Remove access to com.apple.audio.toolbox.reporting.service for WebKit processes, since this is a logging service which is not needed for correctness. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-09 Sihui Liu Implement audio capture for SpeechRecognition on iOS https://bugs.webkit.org/show_bug.cgi?id=219371 Reviewed by Youenn Fablet. On iOS, audio capture is done in web process. For speech recognition, recognizer is in UI process. Therefore, UI process needs to ask web process to capture audio and send back data. To implement this, this patch added: - SpeechRecognitionRemoteRealtimeMediaSource: subclass WebCore::RealtimeMediaSource and connect to a remote WebCore::RealtimeMediaSource (owned by SpeechRecognitionRealtimeMediaSourceManager::Source) in web process. - SpeechRecognitionRemoteRealtimeMediaSourceManager: manage all RemoteRealtimeMediaSources. - SpeechRecognitionRealtimeMediaSourceManager: manage all SpeechRecognitionRemoteRealtimeMediaSource. - SpeechRecognitionRealtimeMediaSourceManager::Source: own and monitor a local WebCore::RealtimeMediaSource. This structure is very similar to how we implement media capture on macOS (RemoteRealtimeMediaSource, UserMediaCaptureManager and UserMediaCaptureManagerProxy), where we send data from UI process to web process instead. We should unify the architecture if possible. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: Added. (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::create): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::SpeechRecognitionRemoteRealtimeMediaSource): (WebKit::m_ringBuffer): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::~SpeechRecognitionRemoteRealtimeMediaSource): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::startProducingData): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::stopProducingData): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::remoteAudioSamplesAvailable): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::remoteCaptureFailed): (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::remoteSourceStopped): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.h: Added. (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::identifier const): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp: Added. (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::SpeechRecognitionRemoteRealtimeMediaSourceManager): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::addSource): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::removeSource): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::remoteAudioSamplesAvailable): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::remoteCaptureFailed): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::remoteSourceStopped): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::messageSenderConnection const): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::messageSenderDestinationID const): (WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::setStorage): * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.h: Added. * UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.messages.in: Added. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::handleRequest): * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createRealtimeMediaSourceForSpeechRecognition): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): (WebKit::WebProcessProxy::ensureSpeechRecognitionRemoteRealtimeMediaSourceManager): * UIProcess/WebProcessProxy.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp: Added. (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::Source): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::~Source): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::start): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::stop): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::Source::storage): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::SpeechRecognitionRealtimeMediaSourceManager): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::~SpeechRecognitionRealtimeMediaSourceManager): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::grantSandboxExtensions): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::revokeSandboxExtensions): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::createSource): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::deleteSource): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::start): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::stop): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::messageSenderConnection const): (WebKit::SpeechRecognitionRealtimeMediaSourceManager::messageSenderDestinationID const): * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.h: Added. * WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.messages.in: Added. * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::WebSpeechRecognitionConnection): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::ensureSpeechRecognitionRealtimeMediaSourceManager): * WebProcess/WebProcess.h: 2020-12-08 Kimmo Kinnunen IPC should support non-byte aligned data references https://bugs.webkit.org/show_bug.cgi?id=219487 Reviewed by Chris Dumez. Add a templated version of IPC::DataReference: ArrayReference. The number of elements can be omitted, in which case the ArrayReference size is determined at run-time. This way pointers of typed arrays such as float arrays can be transferred directly from the IPC message data store to the target. This is useful when implementing IPC for WebGL in GPU process. Changes IPC to support passing data references, i.e. DataReference or ArrayReference, as a synchronous IPC call return value. The caller must hold the Connection::syncSend() result (Decoder object) for the duration of using the data values. Makes DataReference an alias of uint8_t dynamic array reference. Unfortunately this makes the forward declaring DataReference hard. Due to this, changes use declaration sites to #include instead of using forward declarations. Removes forward declarations for headers where the type is not used. Adds various #includes to fix errors hidden by the unified build. Adds some WebCore:: namespace qualifications to fix errors hidden by the unified build. * GPUProcess/media/RemoteAudioSessionProxy.cpp: * GPUProcess/media/RemoteLegacyCDMProxy.cpp: * GPUProcess/media/RemoteLegacyCDMProxy.h: * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: * GPUProcess/media/RemoteMediaResourceManager.cpp: * GPUProcess/media/RemoteMediaResourceManager.h: * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.cpp: * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: * GPUProcess/webrtc/RemoteMediaRecorder.h: * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: * NetworkProcess/Downloads/Download.cpp: * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadManager.cpp: * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/NetworkSocketChannel.cpp: * NetworkProcess/NetworkSocketChannel.h: * NetworkProcess/NetworkSocketStream.cpp: * NetworkProcess/NetworkSocketStream.h: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h: * NetworkProcess/WebSocketTask.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.h: * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: * NetworkProcess/soup/WebSocketTaskSoup.cpp: * NetworkProcess/soup/WebSocketTaskSoup.h: * Platform/IPC/ArgumentCoders.h: * Platform/IPC/ArrayReference.h: Copied from Source/WebKit/Platform/IPC/DataReference.h. (IPC::ArrayReference::ArrayReference): (IPC::ArrayReference::isEmpty const): (IPC::ArrayReference::size const): (IPC::ArrayReference::data const): (IPC::ArrayReference::vector const): * Platform/IPC/Connection.h: (IPC::Connection::sendSync): * Platform/IPC/DataReference.cpp: Removed. * Platform/IPC/DataReference.h: * Platform/IPC/Decoder.cpp: (IPC::Decoder::decodeFixedLengthReference): * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.cpp: (IPC::Encoder::wrapForTesting): * Platform/IPC/Encoder.h: * Platform/IPC/HandleMessage.h: * Platform/IPC/MessageSender.h: (IPC::MessageSender::sendSync): * Platform/IPC/SharedBufferCopy.cpp: (IPC::SharedBufferCopy::decode): * Platform/IPC/SharedBufferDataReference.cpp: * Platform/IPC/StringReference.cpp: * PluginProcess/PluginControllerProxy.cpp: * PluginProcess/PluginControllerProxy.h: * Scripts/webkit/messages.py: * Shared/API/APIData.cpp: * Shared/cf/ArgumentCodersCF.cpp: * Shared/soup/WebCoreArgumentCodersSoup.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Sources.txt: * UIProcess/API/APIIconLoadingClient.h: * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::sendSync): * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h: * UIProcess/PageClient.h: * UIProcess/UserContent/WebUserContentControllerProxy.cpp: * UIProcess/UserContent/WebUserContentControllerProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/WebURLSchemeHandler.h: * UIProcess/WebURLSchemeTask.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): * WebProcess/GPU/media/RemoteAudioSourceProvider.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: * WebProcess/GPU/media/RemoteLegacyCDMSession.cpp: * WebProcess/GPU/media/TextTrackPrivateRemote.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): * WebProcess/Network/NetworkProcessConnection.h: * WebProcess/Network/WebResourceLoader.cpp: * WebProcess/Network/WebResourceLoader.h: * WebProcess/Network/WebSocketChannel.cpp: * WebProcess/Network/WebSocketChannel.h: * WebProcess/Network/WebSocketStream.cpp: * WebProcess/Network/WebSocketStream.h: * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::sendSyncWithDelayedReply): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::handleEditingKeyboardEvent): 2020-12-08 Wenson Hsieh [Concurrent Display Lists] Add a new type to represent a set of GPU process wakeup arguments https://bugs.webkit.org/show_bug.cgi?id=219657 Reviewed by Tim Horton. Pull the initial item buffer identifier, offset, and destination image buffer identifier used to wake the GPU process out into a separate struct, in `GPUProcessWakeupMessageArguments.h`, and refactor both the web and GPU process-side rendering backends to use this new struct. This will greatly simplify future logic that will be added to address , which requires us to defer calling into the GPU process wakeup loop in more scenarios. No change in behavior. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Shared/GPUProcessWakeupMessageArguments.h: Added. (WebKit::GPUProcessWakeupMessageArguments::encode const): (WebKit::GPUProcessWakeupMessageArguments::decode): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::sendWakeupMessage): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-08 Peng Liu [Media in GPU Process][MSE] The GPU Process may crash in the destructor of MediaPlayerPrivateMediaSourceAVFObjC https://bugs.webkit.org/show_bug.cgi?id=219622 Reviewed by Eric Carlson. The purpose of `mediaPlayerRenderingModeChanged()` callback is to notify the media element that the player's rendering mode is changed, including the case that the layer is destroyed. So we should not operate on the layer in this function. With this patch, `RemoteMediaPlayerProxy` forwards the callback from the GPU process to the Web process. This patch also cleans up `RemoteMediaPlayerProxy.h`. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Deleted. * GPUProcess/media/gstreamer/RemoteMediaPlayerProxyGStreamer.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Deleted. * GPUProcess/media/win/RemoteMediaPlayerProxyWin.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::renderingModeChanged): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: 2020-12-08 Chris Dumez Potential crash under [WKRemoteObjectEncoder encodeObject:forKey:] when the object graph contains a cycle https://bugs.webkit.org/show_bug.cgi?id=219620 Reviewed by Geoffrey Garen. Update WKRemoteObjectEncoder to detect cycles when encoding objects. When a cycle is detected, we first attempt to encode a default-initialized object of the same type instead. If that fails, we raise a NSInvalidArgumentException. Based on crashes in the wild, we have evidence that such cycles are occuring and I suspect this is caused by Norton Safe Web extension somehow. * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (-[WKRemoteObjectEncoder init]): (encodeObject): 2020-12-08 Simon Fraser Make ScrollingPerformanceLoggingEnabled an internal debug preference https://bugs.webkit.org/show_bug.cgi?id=219647 Reviewed by Sam Weinig. ScrollingPerformanceLoggingEnabled is used by a Safari performance test, so it needs to be easily toggleable from a script. That's easier if it's an Internal Debug preference. Testing also sets ForceUpdateScrollbarsOnMainThreadForPerformanceTesting but we can just use the ScrollingPerformanceLoggingEnabled flag, but it makes more sense to rename ScrollingPerformanceLoggingEnabled to ScrollingPerformanceTestingEnabled when we do that. Also fix how we propagate ScrollingPerformanceTestingEnabled to the scrolling tree; do so via ScrollingStateFrameScrollingNode as we do for the other tree-wide settings, removing code in TiledCoreAnimationDrawingArea::updatePreferences() that did this. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): (ArgumentCoder::decode): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetScrollingPerformanceLoggingEnabled): (WKPreferencesGetScrollingPerformanceLoggingEnabled): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::forceUpdateScrollbarsOnMainThreadForPerformanceTesting const): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updatePreferences): 2020-12-08 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.assertiond.processassertionconnection' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219637 Reviewed by Darin Adler. Deny mach-lookup to the service 'com.apple.assertiond.processassertionconnection' in the WebContent process on macOS, since there are no reports of this service being used. No new tests, since the result will depend on macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-08 Alex Christensen Remove NSString overrelease in _WKUserContentExtensionStore https://bugs.webkit.org/show_bug.cgi?id=219621 Reviewed by Darin Adler. Gasp! * UIProcess/API/Cocoa/WKContentRuleListStore.mm: (-[WKContentRuleListStore compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]): (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]): 2020-12-08 Per Arne Vollan [macOS] Create sandbox extension for audio service when Media in GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=219540 Reviewed by Brent Fulgham. Create sandbox extension for com.apple.audio.SandboxHelper when Media in GPU process is not enabled. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-12-08 Chris Dumez [iOS] Stop leaking an XPC boost message to XPC services https://bugs.webkit.org/show_bug.cgi?id=219453 Reviewed by Geoffrey Garen. Stop leaking an XPC boost message to XPC services on builds where RunningBoard is able to give the right priorities to our XPC services based on the type of RunningBoard assertion is being held. There is no behavior change for the Network/WebContent processes since those were blocklisted in RunningBoard (Turning on the RB_full_manage_WK_jetsam feature flag gives us the default RunningBoard behavior without blocklisting). However, this allows the new GPUProcess to move to IDLE jetsam band when homing out of MobileSafari, which makes the GPUProcess eligible for the freezer. Previously, the leaked boost message would keep the GPUProcess in a higher jetsam band. * FeatureFlags/WebKit.plist: Add RB_full_manage_WK_jetsam feature flag and turn it on. On recent enough builds of RunningBoard, this disables the blocklisting of the WebContent/Network processes in RunningBoard so that RunningBoard can now set the priority of those processes (instead of us boosting our priority via boost messages). * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: Set _ProcessType=App so that RunningBoard is able to set the priority of our XPC services on iOS. Without this change, we get a permission denied when RunningBoard attempts to set the priority of our XPC services. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::shouldLeakBoost): Stop leaking a boost message on iOS when RUNNINGBOARD_WEBKIT_PRIORITY_SUPPORT compile-time flag is enabled and when the RB_full_manage_WK_jetsam feature flag is enabled. 2020-12-08 Ryan Hostetler Add target to create /usr/local to work around XBS Bug https://bugs.webkit.org/show_bug.cgi?id=219618 rdar://72064576 Reviewed by Jonathan Bedard. * WebKit.xcodeproj/project.pbxproj: Add a build target EmptyDSTROOT with script to create an empty folder "/usr/local". This allows WebKit to retain a unified XBS project name across different train configurations. 2020-12-07 Said Abou-Hallawa [GPU Process] Ensure the backend of ImageBuffer is created before getting its handle https://bugs.webkit.org/show_bug.cgi?id=219623 Reviewed by Tim Horton. In r270458 and in RemoteLayerBackingStore::encode(), casting the ImageBuffer and calling the overriding createImageBufferBackendHandle() of the superclass was replaced by casting the backend and calling its createImageBufferBackendHandle() directly. This may lead to crash if the backend was not created when calling its createImageBufferBackendHandle(). The createImageBufferBackendHandle() of the ImageBuffer superclass calls ensureBackendCreated() before calling createImageBufferBackendHandle() of the backend. So we need to replace to call backend() to ensureBackendCreated(). * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-12-07 Brent Fulgham Add sandbox telemetry for likely unused features https://bugs.webkit.org/show_bug.cgi?id=219544 Reviewed by Per Arne Vollan. Add telemetry to confirm the results of our manual review of the sandbox. Add 'hw.memsize' to the allowed sysctl's for the Network process on macOS, since it is needed by CFNetwork, and is already permitted on iOS. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Allow the 'hw.memsize' sysctl, which is needed by CFNetwork, and is already allowed on iOS. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add logging to confirm we do not need file-read-metadata for syslog. * WebProcess/com.apple.WebProcess.sb.in: Add logging to confirm BluetoothServices is not needed. 2020-12-07 Wenson Hsieh Ensure that DisplayListSharedMemoryHeader is never explicitly created or destroyed at compile-time https://bugs.webkit.org/show_bug.cgi?id=219609 Reviewed by Tim Horton. Make sure that a `DisplayListSharedMemoryHeader` is never created or destroyed by marking the constructor and destructor as deleted. A `DisplayListSharedMemoryHeader` should only ever be `reinterpret_cast`-ed from the first few bytes of a shared display list handle. * Shared/SharedDisplayListHandle.h: 2020-12-07 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.audio.SystemSoundServer-OSX' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219590 Reviewed by Brent Fulgham. After r269593, mach-lookup to the service 'com.apple.audio.SystemSoundServer-OSX' in the WebContent process can be denied. Test: fast/sandbox/mac/sandbox-mach-lookup.html * WebProcess/com.apple.WebProcess.sb.in: 2020-12-07 Don Olmstead [CMake] Remove WEBKIT_WRAP_SOURCELIST https://bugs.webkit.org/show_bug.cgi?id=196916 Reviewed by Michael Catanzaro. * PlatformFTW.cmake: * PlatformWin.cmake: 2020-12-07 Tim Horton Fix incorrect capitalization of ClearWheelEventTestMonitor IPC message name https://bugs.webkit.org/show_bug.cgi?id=219606 Reviewed by Wenson Hsieh. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): * WebProcess/WebPage/WebPage.messages.in: 2020-12-07 Chris Dumez [iOS] Add basic GPUProcess crash recovery logic to RemoteMediaSessionHelper https://bugs.webkit.org/show_bug.cgi?id=219494 Reviewed by Eric Carlson. * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp: (WebKit::RemoteMediaSessionHelper::RemoteMediaSessionHelper): (WebKit::RemoteMediaSessionHelper::connectToGPUProcess): (WebKit::RemoteMediaSessionHelper::gpuProcessConnectionDidClose): * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h: 2020-12-07 Commit Queue Unreviewed, reverting r270498. https://bugs.webkit.org/show_bug.cgi?id=219596 Broke the build as it landed simultaneously with a more complete fix Reverted changeset: "Unreviewed. Add the switch case handling missed out from r270415." https://trac.webkit.org/changeset/270498 2020-12-07 Lauro Moura Fix warnings when GPUProcess is disabled https://bugs.webkit.org/show_bug.cgi?id=219587 Reviewed by Žan Doberšek. * UIProcess/API/glib/WebKitNavigationClient.cpp: Handle new enum value in switch after r270415. * WebProcess/WebPage/DrawingArea.cpp: (WebKit::DrawingArea::supportsGPUProcessRendering): Default returning false when GPUProcess is disabled. 2020-12-07 Joonghun Park Unreviewed. Add the switch case handling missed out from r270415. This change removes the build warning below. warning: enumeration value ‘RequestedByGPUProcess’ not handled in switch [-Wswitch] No new tests, no new behaviors. * UIProcess/API/glib/WebKitNavigationClient.cpp: 2020-12-06 Samuel Thibault [WebKit] Fix use of std::max_align_t https://bugs.webkit.org/show_bug.cgi?id=219579 Reviewed by Fujii Hironori. Standard says that it's alignof(std::max_align_t) that should be used, not its size, e.g. https://en.cppreference.com/w/cpp/types/max_align_t and indeed at least with gcc 10's stddef.h, max_align_t is a structure containing a long long, a long double, and a float18, thus not a power of two. * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::headerSize): Use alignof(std::max_align_t) instead of sizeof(std::max_align_t). 2020-12-06 Lauro Moura Unreviewed. Add missing GPU_PROCESS guards around RemoteMediaEngineConfigurationFactory after r270462 https://bugs.webkit.org/show_bug.cgi?id=219578 Was breaking the Ubuntu LTS/Debian builds. * WebProcess/GPU/media/RemoteMediaEngineConfigurationFactory.cpp: * WebProcess/WebProcess.cpp: 2020-12-04 Wenson Hsieh [Concurrent display lists] Synchronize display list rendering across remote image buffers https://bugs.webkit.org/show_bug.cgi?id=219091 Reviewed by Geoff Garen. Refactors the existing concurrent display list processing mechanism, such that we no longer update the unread bytes count every 512 items (or when flushing the drawing context), and instead update it every time we append display list item data. In order to achieve this without making it impossible for multiple display-list backed image buffers to render simultaneously, we also add support for synchronizing display list items across different image buffers by using the new meta command items added in bug #219262. As detailed in the ChangeLog for that bug, a stream of display list data written by the web process and consumed by the GPU process is now structured like so: Wakeup message initiates display list processing with Image Buffer A and Item Buffer 1 | | MetaCommandChangeDestinationImageBuffer(B) | | | | MetaCommandChangeItemBuffer(2) | | | | | | v v v +-----------------------+--------------------------------++ | +--------------------+ +------------------------------+ | | | Destination | | Destination | | Item Buffer 1 | | Image Buffer A | | Image Buffer B | | | +--------------------+ +------------------------------+ | +---------------------------------------------------------+ +---------------------------------------------------------+ | +--------------+ +-----------------------+ | | | Dst. Image | | Destination Image | Unused | Item Buffer 2 | | Buffer B | | Buffer A | Capacity | | +--------------+ +-----------------------+ | +-----------------+-------------------------+-------------+ ^ | | MetaCommandChangeDestinationImageBuffer(A) (Note that the `MetaCommandEnd` item has been omitted, since we no longer need to explicitly tell the GPU process to go to sleep with the latest iteration of this patch). In order to write display list data conforming to this format, we add a mechanism to the web process that keeps track of the "current destination image buffer" (i.e. the image buffer that has most recently appended a display list item). Right before this destination is about to change, we append a new `MetaCommandChangeDestinationImageBuffer` item before proceeding to append display list items for the new current destination. Since we now bump the unread count every time, we need to do some additional work to avoid an excessive number of wakeups and sleeps in the GPU process, which would otherwise cause a massive regression. To do this, we introduce an item count hysteresis in the web process, such that we will wait for 512 items to be written before attempting to send the wakeup message. This allows the web process to get a small head start over the GPU process, and thus allows the GPU process to be more consistently busy over the course of a single frame. On the reader (GPU process) side, we make some minor adjustments so that the main display list processing loop of the GPU process is capable of changing destination image buffers while processing a stream of display list items. See below for more details. * GPUProcess/graphics/DisplayListReaderHandle.cpp: (WebKit::DisplayListReaderHandle::advance): Update `advance` so that it just performs a single 8-byte atomic `exchangeSub` rather than grabbing a spinlock. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::submit): (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): Rename `applyDisplayListsFromHandle` to `nextDestinationImageBufferAfterApplyingDisplayLists`, and make it return the current image buffer to use as the destination for replaying display list commands. This helper is still responsible for replaying a display list item buffer until it has no more data (that is, until we encounter a `MetaCommandChangeItemBuffer` item informing us of the next item buffer to consume). (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): Adjust this to call `nextDestinationImageBufferAfterApplyingDisplayLists`. (WebKit::RemoteRenderingBackend::decodeItem): (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/SharedDisplayListHandle.h: Remove `SharedDisplayListHandle::Lock` altogether, now that we just have a single atomic `uint64_t` counter to represent the number of unread bytes. (WebKit::SharedDisplayListHandle::unreadBytes): (WebKit::SharedDisplayListHandle::Lock::Lock): Deleted. (WebKit::SharedDisplayListHandle::Lock::~Lock): Deleted. * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: (WebKit::DisplayListWriterHandle::advance): Make this use the single atomic counter, instead of grabbing a spinlock. (WebKit::DisplayListWriterHandle::moveWritableOffsetToStartIfPossible): (WebKit::DisplayListWriterHandle::resetWritableOffsetIfPossible): Deleted. Rename `resetWritableOffsetIfPossible` to the more accurate `moveWritableOffsetToStartIfPossible`. * WebProcess/GPU/graphics/DisplayListWriterHandle.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::changeDestinationImageBuffer): Add a helper method to append a `MetaCommandChangeDestinationImageBuffer` item to the display list, given the identifier of this next item buffer. (WebKit::RemoteImageBufferProxy::clearDisplayList): Add a helper method to clear the display list, such that the `RemoteImageBufferProxy` will be asked for a new buffer handle the next time we append an item. (WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout): Make this hit the maximum `waitForAndDispatchImmediately` attempt count and "fail" only if the call to `waitForAndDispatchImmediately` actually times out. This change is necessary to ensure that the scenario of multiple image buffers simultaneously appending display list items works when all image buffers perform (non- blocking) flushes simultaneously, followed by a sync-wait (blocking) flush. In this situation, the web process may receive more than three `DidFlush` messages in rapid succession, causing it to hit this maximum limit of 3 instantly and avoid waiting for the expected `DidFlush` message to arrive. (WebKit::RemoteImageBufferProxy::submitDisplayList): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose): Reset state when the GPU process is terminated. (WebKit::RemoteRenderingBackendProxy::willAppendItem): Update the current destination image buffer (`m_currentDestinationImageBufferIdentifier`). If this identifier changed, then we append a `MetaCommandChangeDestinationImageBuffer` item to the previous destination before setting the new destination image buffer. We also need to clear the new destination image buffer's display list before writing new items, to prevent it from overwriting shared display list item data. (WebKit::RemoteRenderingBackendProxy::sendWakeupMessage): (WebKit::RemoteRenderingBackendProxy::sendDeferredWakeupMessageIfNeeded): (WebKit::RemoteRenderingBackendProxy::didAppendData): Implement a new `ItemBufferWritingClient` hook by advancing the corresponding item buffer's unread count. Additionally, schedule a wakeup message in the case where the unread count was zero when we advanced, and the item buffer we've appended to is not "connected" to a previous item buffer by way of an item buffer change item. Additionally, in the case where we don't schedule a new wakeup message, check whether or not there is a deferred wakeup message; if there is, then decrement the remaining item count before we send the wakeup message, and send the message if the count reaches 0. (WebKit::RemoteRenderingBackendProxy::findReusableDisplayListHandle): Pull logic to find a shared display list handle suitable for reuse into a separate helper method, and adjust it so that if the most recently used display list handle has run out of available capacity, we move it to the end of the reuse queue and only reuse the new first shared handle in the queue if its writable offset can be reset. This ensures that the GPU process can always continue reading display list item data from the start of new item buffers -- i.e., we don't end up with the web process writing out a stream of display list data like: (Start) Bytes (16, 65520) in ItemBuffer[1] Bytes (16, 65536) in ItemBuffer[2] Bytes (65520, 65536) in ItemBuffer[1] (WebKit::RemoteRenderingBackendProxy::createItemBuffer): (WebKit::RemoteRenderingBackendProxy::submitDisplayList): Deleted. (WebKit::RemoteRenderingBackendProxy::updateReusableHandles): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-12-05 Fujii Hironori Remove ENABLE_GRAPHICS_CONTEXT_GL by replacing it with ENABLE(WEBGL) https://bugs.webkit.org/show_bug.cgi?id=219551 Reviewed by Kenneth Russell. * CMakeLists.txt: * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleGPU): * UIProcess/gtk/HardwareAccelerationManager.cpp: (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): 2020-12-04 Said Abou-Hallawa [GPU Process] Remove ConcreteShareableImageBuffer https://bugs.webkit.org/show_bug.cgi?id=219563 Reviewed by Simon Fraser. Delete this class since the only function it implements: 'createImageBufferBackendHandle()' is not used. * Shared/ConcreteShareableImageBuffer.h: Removed. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): 2020-12-04 Wenson Hsieh [iOS] Cancel image extraction when navigating https://bugs.webkit.org/show_bug.cgi?id=219559 Reviewed by Tim Horton. Call `-_cancelImageExtraction` during mainframe navigation. See WebKitAdditions change for more information. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _webTouchEventsRecognized:]): (-[WKContentView _didStartProvisionalLoadForMainFrame]): 2020-12-04 Jer Noble [Cocoa] Adopt AVOutputDevice.allowsHeadTrackedSpatialAudio https://bugs.webkit.org/show_bug.cgi?id=219503 Reviewed by Eric Carlson. Adopt the "com.apple.avfoundation.allow-system-wide-context" entitlement on macOS for both the WebContent and GPU processes. * Scripts/process-entitlements.sh: 2020-12-04 Jer Noble [GPUP] Move MediaCapabilities into the GPU process https://bugs.webkit.org/show_bug.cgi?id=219521 Reviewed by Eric Carlson. Add a new pair of process supplements, RemoteMediaEngineConfigurationFactory and ..Proxy. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::mediaEngineConfigurationFactoryProxy): (WebKit::GPUConnectionToWebProcess::dispatchMessage): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.cpp: Added. (WebKit::RemoteMediaEngineConfigurationFactoryProxy::RemoteMediaEngineConfigurationFactoryProxy): (WebKit::createDecodingConfiguration): (WebKit::RemoteMediaEngineConfigurationFactoryProxy::createEncodingConfiguration): * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.h: Added. * GPUProcess/media/RemoteMediaEngineConfigurationFactoryProxy.messages.in: Added. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::mediaEngineConfigurationFactory): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp: * WebProcess/GPU/media/RemoteAudioSourceProviderManager.h: * WebProcess/GPU/media/RemoteMediaEngineConfigurationFactory.cpp: Added. (WebKit::RemoteMediaEngineConfigurationFactory::RemoteMediaEngineConfigurationFactory): (WebKit::RemoteMediaEngineConfigurationFactory::registerFactory): (WebKit::RemoteMediaEngineConfigurationFactory::supplementName): (WebKit::RemoteMediaEngineConfigurationFactory::gpuProcessConnection): (WebKit::RemoteMediaEngineConfigurationFactory::createDecodingConfiguration): (WebKit::RemoteMediaEngineConfigurationFactory::createEncodingConfiguration): * WebProcess/GPU/media/RemoteMediaEngineConfigurationFactory.h: Copied from Source/WTF/wtf/Algorithms.h. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setUseGPUProcessForMedia): 2020-12-04 Said Abou-Hallawa [GPU Process] Clean up recreating the ImageBufferBackend because of GPU crashing https://bugs.webkit.org/show_bug.cgi?id=219007 Reviewed by Simon Fraser. There is no need to store the backend parameters in RemoteImageBufferProxy. These parameters are now stored in the base class ImageBuffer before the backend is created. Remove the traits definition for RemoteImageBufferProxy types because they are wrong. All ImageBuffers have valid renderingResourceIdentifier() regardless whether they are remote or not. ImageBuffer::setBackend and ImageBuffer::submitDisplayList() are now implemented in WebCore. So no casting is needed. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::RemoteImageBuffer): (WebKit::RemoteImageBuffer::submitDisplayList): Deleted. submitDisplayList() is now a virtual method of ImageBuffer. So make it private and ignore the return of DisplayList::Replayer::replay() since the caller does not use it. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::didCreateImageBufferBackend): (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle): (WebKit::RemoteRenderingBackend::imageBufferBackendWasCreated): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.h: Rename 'imageBufferBackendWasCreated()' to 'didCreateImageBufferBackend()' to be consistent with 'didFlush()'. * Shared/ConcreteShareableImageBuffer.h: (WebKit::ConcreteShareableImageBuffer::create): (WebKit::ConcreteShareableImageBuffer::ConcreteShareableImageBuffer): Deleted. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): Call the function with the new name and delete the FIXME comment. * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::create): (WebKit::ImageBufferShareableBitmapBackend::ImageBufferShareableBitmapBackend): (WebKit::ImageBufferShareableBitmapBackend::backendSize const): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: Use the new structure 'ImageBufferBackend::Parameters'. Implement the virtual method 'backendSize()'. * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: (isType): Deleted. Delete the wrong traits. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): Use the new structure 'ImageBufferBackend::Parameters'. (WebKit::RemoteImageBufferProxy::clearBackend): Deleted. (WebKit::RemoteImageBufferProxy::createBackend): Deleted. (WebKit::RemoteImageBufferProxy::didFlush): Deleted. (WebKit::RemoteImageBufferProxy::size const): Deleted. (WebKit::RemoteImageBufferProxy::renderingMode const): Deleted. (WebKit::RemoteImageBufferProxy::colorSpace const): Deleted. (WebKit::RemoteImageBufferProxy::pixelFormat const): Deleted. These functions are now implemented in ConcreteImageBuffer. (WebKit::RemoteImageBufferProxy::submitDisplayList): Deleted. submitDisplayList() is now virtual. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::reestablishGPUProcessConnection): (WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend): (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::didCreateImageBufferBackend): (WebKit::RemoteRenderingBackendProxy::didFlush): (WebKit::recreateImageBuffer): Deleted. (WebKit::RemoteRenderingBackendProxy::waitForImageBufferBackendWasCreated): Deleted. (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: No need to cast the ImageBuffer to RemoteImageBufferProxy since all what RemoteRenderingBackendProxy needs can be accessed through the base class. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: Rename 'ImageBufferBackendWasCreated' to 'DidCreateImageBufferBackend' to be consistent with 'DidFlush'. No need to pass the creation parameters since they set in the ConcreteImageBuffer. No need to pass the backendSize since it can be retrieved through the backend itself. * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableIOSurfaceBackend::create): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.h: Use the new structure 'ImageBufferBackend::Parameters'. 2020-12-04 John Wilander PCM: Switch to 8+4 bits for source IDs and trigger values respectively https://bugs.webkit.org/show_bug.cgi?id=219519 Reviewed by Brent Fulgham. We've received a lot of feedback saying increased entropy on the click side is more important than the current 6 bits on the conversion side. Some of that conversation is captured in https://github.com/privacycg/private-click-measurement/issues/28. This patch switches from 6+6 bits to 8+4 bits. It also makes sure PCM Debug Mode consistently logs on the LOG level except for real errors. Existing layout tests and API tests were updated. * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): 2020-12-04 Commit Queue Unreviewed, reverting r270422. https://bugs.webkit.org/show_bug.cgi?id=219554 Deleted an SPI that is still in use. Reverted changeset: "Introduce new download API" https://bugs.webkit.org/show_bug.cgi?id=217747 https://trac.webkit.org/changeset/270422 2020-12-04 Brian Burg Web Inspector: InspectorFrontendAPIDispatcher should not ignore all exceptions https://bugs.webkit.org/show_bug.cgi?id=219378 Reviewed by Devin Rousso. The underlying method used for frontend expression evaluations is ScriptController::evaluateIgnoringExceptions. This method calls evaluateInWorld and returns nullopt if an exception happens. Switch to using evaluateInWorld directly and using the existing ValueOrException type from in WebCore. Change our EvaluationResult type to use ValueOrException in place of JSC::JSValue. ValueOrException is Expected so this is exposing more error information in addition to the JSC::JSValue. * Platform/Logging.h: Add 'Inspector' log channel for WebKit.framework. * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController): Remove unnecessary debugging code that was accidentally left in/commented out. * WebProcess/Inspector/WebInspectorUIExtensionController.h: (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromResult): Deleted. (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromEvaluationResult): Added. (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): Adapt to using the new result type. Use the InspectorExtensionID type where possible. 2020-12-04 Kate Cheney Create API to enable/disable text interaction gestures in WKWebView https://bugs.webkit.org/show_bug.cgi?id=217784 Reviewed by Wenson Hsieh. Create a new API to disable text interaction gestures in a WKWebView. We have SPI for this for iOS, but it could be useful to other WebKit clients and on macOS. Add the API to WKPreferences, instead of WKWebViewConfiguration, so it can be changed on the fly. Deprecate the SPI. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences encodeWithCoder:]): (-[WKPreferences initWithCoder:]): (-[WKPreferences textInteractionEnabled]): (-[WKPreferences setTextInteractionEnabled:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): (-[WKWebViewConfiguration encodeWithCoder:]): (-[WKWebViewConfiguration initWithCoder:]): (-[WKWebViewConfiguration copyWithZone:]): (-[WKWebViewConfiguration _textInteractionEnabled]): (-[WKWebViewConfiguration _setTextInteractionEnabled:]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView pointIsNearMarkedText:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): (-[WKContentView _cascadeInteractionTintColor]): (-[WKContentView selectForWebView:]): (-[WKContentView selectAllForWebView:]): Add check for textInteractionEnabled in these select* functions because disabling text interaction should disable selection in WKWebView. * WebProcess/WebPage/WebPage.cpp: Update the textInteractionEnabled value in the page when preferences are updated. (WebKit::WebPage::updatePreferences): 2020-12-04 Adam Roben More FALLBACK_PLATFORM adoption https://bugs.webkit.org/show_bug.cgi?id=219545 Reviewed by Tim Horton. * Configurations/SDKVariant.xcconfig: WK_EMPTY_$(THIS_IS_NOT_EMPTY) evaluates to the empty string, not to NO. 2020-12-04 Said Abou-Hallawa [GPU Process] Share the NativeImage with GPU Process through a ShareableBitmap https://bugs.webkit.org/show_bug.cgi?id=218934 Reviewed by Tim Horton. Instead of relying on the IPC coders to transfer the NativeImage to the GPUP, we are going to move this logic to RemoteResourceCacheProxy and RemoteRenderingBackend. The NativeImage will be transfered as a handle of ShareableBitamp and a renderingResourceIdentifier. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::cacheNativeImage): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Shared/ShareableBitmap.h: (WebKit::ShareableBitmap::createPlatformImage): Add this helper function and avoid adding directive code in many places. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): Deleted. (IPC::ArgumentCoder>::decode): Deleted. * Shared/WebCoreArgumentCoders.h: * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::copyNativeImage const): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::cacheNativeImage): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::createShareableBitmapFromNativeImage): (WebKit::RemoteResourceCacheProxy::cacheNativeImage): 2020-12-04 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219541 Reviewed by Darin Adler. On macOS, deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebContent process, since there are no reports of this being used. No new tests, since the result will depend on the macOS version. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-04 Devin Rousso [iOS] Provide a context menu action to perform accessibility image extraction https://bugs.webkit.org/show_bug.cgi?id=219524 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/_WKElementAction.h: * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): (+[_WKElementAction imageForElementActionType:]): (elementActionTypeToUIActionIdentifier): (uiActionIdentifierToElementActionType): Add a new `_WKElementActionTypeImageExtraction` enum type with a default icon and title. * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant defaultActionsForLinkSheet:]): (-[WKActionSheetAssistant defaultActionsForImageSheet:]): (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): If the `WKActionSheetAssistantDelegate` allows it, add a `_WKElementActionTypeImageExtraction` action for images (including those inside links). Call out to the `WKActionSheetAssistantDelegate` when handling the action. 2020-12-04 Peng Liu [MSE] Move track buffer management from SourceBuffer to SourceBufferPrivate https://bugs.webkit.org/show_bug.cgi?id=219332 Reviewed by Daniel Bates. Update `SourceBufferPrivateRemote` and `RemoteSourceBufferProxy` because of the changes on `SourceBufferPrivate` and `SourceBufferPrivateClient`. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidParseSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidDropSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateStreamEndedWithDecodeError): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasAudio const): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasVideo const): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveSample): Deleted. (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReenqueSamples): Deleted. (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidBecomeReadyForMoreSamples): Deleted. (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateFastSeekTimeForMediaTime): Deleted. * GPUProcess/media/RemoteSourceBufferProxy.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::setClient): Deleted. * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2020-12-04 Kimmo Kinnunen GPU Process WindowServer blocking prevents CGL https://bugs.webkit.org/show_bug.cgi?id=219431 Reviewed by Per Arne Vollan. Mark the GPU process as NSSupportsAutomaticGraphicsSwitching. This allows CGL to work in cases when WindowServer connection is blocked. No new tests, makes the future WebGL in GPU process work. * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist: 2020-12-03 Simon Fraser Only the first wheel event in a gesture should be cancelable https://bugs.webkit.org/show_bug.cgi?id=218764 Reviewed by Tim Horton. In EventDispatcher::wheelEvent(), all wheel events now bounce through the scrolling thread, even those destined for main thread scrolling. This allows the scrolling thread to wait on a condition for the event to come back to the scrolling thread via handleWheelEventAfterMainThread(), since we have to know whether content called preventDefault() on the first event before sending subsequent events. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-12-03 Alex Christensen Introduce new download API https://bugs.webkit.org/show_bug.cgi?id=217747 Reviewed by Brady Eidson. Safari currently uses _WKDownload, which has evolved strangely over the last decade. In order to make a nicer interface, we need to learn from those lessons and take a step back. I did that, and here's what I came up with: WKDownload and WKDownloadDelegate! Notable changes include: 1. The delegate now lives on the download object instead of the process pool. 2. WKDownload does not conform to NSCopying because we have NSMapTable instead of NSDictionary. 3. publishProgressAtURL is gone. That will be reimplemented in the UI process of the client that used it. 4. cancel has a completion handler to get the resume data instead of waiting for didCancel then getting it from the download object. 5. didFailWithError also gives you the resume data, so there is no way to get it from the download object. That's more about a fail/cancel event than a property of the download. 6. wasUserInitiated is gone. Instead, WKNavigationDelegate has a callback that links a navigation action (where _isUserInitiated is exposed) to the download. 7. redirectChain is also gone. That can also be gotten from the link to the navigation and the download delegate's redirect callback. 8. _downloadDidStart is gone. Instead, we have completion handlers that expose a WKDownload once it's started. There's no need to reference the download object before then anyways. Note: that's when the download "starts" which is before it receives the response, so there will be no server delay in the difference between download object availabilities. 9. didReceiveServerRedirectToURL now gives you the option of continuing or cancelling. This reflects the amount of control the WKNavigationDelegate has. 10. decideDestinationWithSuggestedFilename and didReceiveResponse have been merged, since they actually happen at the same time and NSURLResponse has suggestedFilename API. allowOverwrite is also gone. It wasn't used, and not really needed. 11. didCreateDestination is gone. That callback time wasn't really necessary. If you need to know when it's created, wait until the first didWriteData callback. The destination has definitely been created by then. 12. shouldDecodeSourceDataOfMIMEType is gone. It's actually not called since we adopted NSURLSession, and we should remove the related dead code. 13. originatingFrame is gone. On _WKDownload it was actually a non-null WKFrameInfo that often contained no information. When information was there, the information access has been replaced by didBecomeDownload which links the WKNavigationResponse which has frame info on it. I wrote API tests for everything I could think of. * NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::resumeDownload): * NetworkProcess/Downloads/DownloadManager.h: * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): (WebKit::Download::platformCancelNetworkLoad): * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::suggestedFilename const): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::resumeDownload): (WebKit::NetworkProcess::findPendingDownloadLocation): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): * Scripts/webkit/messages.py: * Shared/API/Cocoa/WebKit.h: * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): * Shared/Cocoa/APIObject.mm: (API::Object::newObject): * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIDownloadClient.h: (API::DownloadClient::legacyDidStart): (API::DownloadClient::didFail): (API::DownloadClient::didStart): Deleted. * UIProcess/API/APINavigationAction.h: * UIProcess/API/APINavigationClient.h: (API::NavigationClient::navigationResponseDidBecomeDownload): (API::NavigationClient::navigationActionDidBecomeDownload): (API::NavigationClient::contextMenuDidCreateDownload): * UIProcess/API/APIPolicyClient.h: (API::PolicyClient::decidePolicyForNavigationAction): (API::PolicyClient::decidePolicyForNewWindowAction): * UIProcess/API/C/WKContext.cpp: (WKContextSetDownloadClient): Deleted. * UIProcess/API/C/WKContext.h: * UIProcess/API/C/WKContextDownloadClient.h: Removed. * UIProcess/API/C/WKDownload.cpp: Removed. * UIProcess/API/C/WKDownloadClient.h: Added. * UIProcess/API/C/WKDownloadRef.cpp: Added. (WKDownloadGetTypeID): (WKDownloadCopyRequest): (WKDownloadCancel): (WKDownloadGetOriginatingPage): (WKDownloadGetWasUserInitiated): (WKDownloadSetClient): * UIProcess/API/C/WKDownloadRef.h: Renamed from Source/WebKit/UIProcess/API/C/WKDownload.h. * UIProcess/API/C/WKNavigationActionRef.cpp: (WKNavigationActionGetDownloadAttribute): (WKNavigationActionShouldPerformDownload): Deleted. * UIProcess/API/C/WKNavigationActionRef.h: * UIProcess/API/C/WKPage.cpp: (WKPageSetPagePolicyClient): (WKPageSetPageNavigationClient): * UIProcess/API/C/WKPageNavigationClient.h: * UIProcess/API/Cocoa/WKDownload.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownload.h. * UIProcess/API/Cocoa/WKDownload.mm: Added. (-[WKDownload cancel:]): (-[WKDownload originalRequest]): (-[WKDownload delegate]): (-[WKDownload setDelegate:]): (-[WKDownload dealloc]): (-[WKDownload _apiObject]): * UIProcess/API/Cocoa/WKDownloadDelegate.h: Added. * UIProcess/API/Cocoa/WKDownloadInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKDownloadInternal.h. * UIProcess/API/Cocoa/WKNavigationAction.h: * UIProcess/API/Cocoa/WKNavigationAction.mm: (-[WKNavigationAction downloadAttribute]): (-[WKNavigationAction _shouldPerformDownload]): * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _downloadURLRequest:websiteDataStore:originatingWebView:]): (-[WKProcessPool _resumeDownloadFromData:websiteDataStore:path:originatingWebView:]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView downloadRequest:completionHandler:]): (-[WKWebView resumeDownloadWithData:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload initWithDownload2:]): (+[_WKDownload downloadWithDownload:]): (-[_WKDownload cancel]): (-[_WKDownload publishProgressAtURL:]): (-[_WKDownload request]): (-[_WKDownload originatingWebView]): (-[_WKDownload redirectChain]): (-[_WKDownload wasUserInitiated]): (-[_WKDownload resumeData]): (-[_WKDownload originatingFrame]): (-[_WKDownload _apiObject]): (-[_WKDownload dealloc]): Deleted. * UIProcess/API/Cocoa/_WKDownloadDelegate.h: * UIProcess/API/Cocoa/_WKDownloadInternal.h: * UIProcess/API/glib/WebKitDownloadClient.cpp: * UIProcess/Cocoa/LegacyDownloadClient.h: * UIProcess/Cocoa/LegacyDownloadClient.mm: (WebKit::LegacyDownloadClient::legacyDidStart): (WebKit::LegacyDownloadClient::didReceiveResponse): (WebKit::LegacyDownloadClient::didReceiveData): (WebKit::LegacyDownloadClient::didReceiveAuthenticationChallenge): (WebKit::LegacyDownloadClient::didCreateDestination): (WebKit::LegacyDownloadClient::processDidCrash): (WebKit::LegacyDownloadClient::decideDestinationWithSuggestedFilename): (WebKit::LegacyDownloadClient::didFinish): (WebKit::LegacyDownloadClient::didFail): (WebKit::LegacyDownloadClient::legacyDidCancel): (WebKit::LegacyDownloadClient::willSendRequest): (WebKit::LegacyDownloadClient::didStart): Deleted. * UIProcess/Cocoa/NavigationState.h: * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): (WebKit::NavigationState::NavigationClient::navigationActionDidBecomeDownload): (WebKit::NavigationState::NavigationClient::navigationResponseDidBecomeDownload): (WebKit::NavigationState::NavigationClient::contextMenuDidCreateDownload): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: * UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::~DownloadProxy): (WebKit::DownloadProxy::didStart): (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): (WebKit::DownloadProxy::didFail): (WebKit::DownloadProxy::setClient): * UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setDidStartCallback): (WebKit::DownloadProxy::setSuggestedFilename): * UIProcess/Network/NetworkProcessProxy.cpp: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::receivedPolicyDecision): (WebKit::WebPageProxy::decidePolicyForNavigationAction): (WebKit::WebPageProxy::decidePolicyForNewWindowAction): (WebKit::WebPageProxy::decidePolicyForResponseShared): (WebKit::WebPageProxy::resumeDownload): (WebKit::WebPageProxy::downloadRequest): (WebKit::WebPageProxy::contextMenuItemSelected): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::receivedPolicyDecision): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::resumeDownload): * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2020-12-03 Adam Roben Adopt FALLBACK_PLATFORM https://bugs.webkit.org/show_bug.cgi?id=219504 Reviewed by Tim Horton. * Configurations/SDKVariant.xcconfig: * Scripts/check-xcfilelists.sh: Use FALLBACK_PLATFORM it if it's defined, otherwise use PLATFORM_NAME as before. 2020-12-03 Chris Dumez Drop unimplemented suspension functions on GPUConnectionToWebProcess and WebAuthnConnectionToWebProcess https://bugs.webkit.org/show_bug.cgi?id=219513 Reviewed by Tim Horton. These functions are never called and have no implementation. This is just bad copy/paste from NetworkConnectionToWebProcess. * GPUProcess/GPUConnectionToWebProcess.h: * WebAuthnProcess/WebAuthnConnectionToWebProcess.h: 2020-12-03 Brent Fulgham [macOS] Only extend access to the AppleSNBFBUserClient IOKit class if the GPU Process is not used https://bugs.webkit.org/show_bug.cgi?id=219014 Reviewed by Per Arne Vollan. Instead of globally extending access to the AppleSNBFBUserClient IOKit class, only extend it when the GPU process is not in use. * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): Add 'AppleSNBFBUserClient' as a dynamically-extended IOKit class. * WebProcess/com.apple.WebProcess.sb.in: Only allow 'AppleSNBFBUserClient' if it was dynamically extended. 2020-12-03 Said Abou-Hallawa [GPU Process] Disconnect NativeImages from RemoteResourceCacheProxy when RemoteRenderingBackendProxy is destroyed https://bugs.webkit.org/show_bug.cgi?id=219417 Reviewed by Tim Horton. If the WebPage is destroyed before destroying the CachedImages, a crash may happen. The NativeImage will try to release itself from its observer, which is RemoteResourceCacheProxy, after it has been freed. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::~RemoteResourceCacheProxy): (WebKit::RemoteResourceCacheProxy::cacheNativeImage): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2020-12-03 Chris Dumez Bad IPC from the WebProcess should not terminate the GPUProcess https://bugs.webkit.org/show_bug.cgi?id=219511 Reviewed by Simon Fraser. Bad IPC from the WebProcess should not terminate the GPUProcess. The GPUProcess is shared by all WebProcesses and it is not acceptable for a single bad WebProcess to negatively impact other WebProcesses. Instead, we should terminate the bad WebProcess, like the NetworkProcess already does on bad IPC. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didReceiveInvalidMessage): * Shared/ProcessTerminationReason.h: * UIProcess/API/C/WKAPICast.h: (WebKit::toAPI): * UIProcess/Cocoa/NavigationState.mm: (WebKit::wkProcessTerminationReason): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::terminateWebProcess): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/GPU/GPUProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::shouldReloadAfterProcessTermination): 2020-12-03 Alex Christensen Serialize NFA to disk before converting it to a DFA when compiling a WKContentRuleList https://bugs.webkit.org/show_bug.cgi?id=219452 Reviewed by Geoffrey Garen. * UIProcess/API/Cocoa/WKContentRuleListStore.mm: (-[WKContentRuleListStore _compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:]): * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h: Remove NS_RELEASES_ARGUMENT because it was incorrect and unnecessary because the WTF::String is copied to a background thread. 2020-12-03 Chris Dumez Make sure the GPUConnectionToWebProcess gets destroyed when the connection to the WebProcess gets severed https://bugs.webkit.org/show_bug.cgi?id=219508 Reviewed by Geoffrey Garen. Make sure the GPUConnectionToWebProcess gets destroyed when the connection to the WebProcess gets severed (WebProcess exited normally or crashed). This is similar to what we do in the NetworkProcess for NetworkConnectionToWebProcess. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::didClose): 2020-12-03 Tim Horton GPU Process: Sandbox violations under IOSurface::maximumSize in the Web Content process https://bugs.webkit.org/show_bug.cgi?id=219484 Reviewed by Ryosuke Niwa. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Fetch the maximum allowed size of an IOSurface on the current hardware in the UI process, and push it to the Web Content process on creation. 2020-12-03 Martin Robinson Move code from AxisScrollSnapOffsets to ScrollSnapOffsetsInfo https://bugs.webkit.org/show_bug.cgi?id=219345 Reviewed by Daniel Bates. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: Remove AxisScrollSnapOffsets.h include. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Ditto. 2020-12-02 Tim Horton Many different assertion failures on the GPU process bot after r270366 https://bugs.webkit.org/show_bug.cgi?id=219467 Reviewed by Simon Fraser. * WebProcess/WebPage/DrawingArea.cpp: (WebKit::DrawingArea::supportsGPUProcessRendering): * WebProcess/WebPage/DrawingArea.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/WebPage.h: Disable DOM rendering in the GPU process if the DrawingArea doesn't support it. Currently only RemoteLayerTreeDrawingArea does. 2020-12-02 Tim Horton GPU Process: Temporarily disable Web Fonts when DOM rendering in the GPU process is enabled https://bugs.webkit.org/show_bug.cgi?id=219479 Reviewed by Simon Fraser. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Web fonts don't work in the GPU process yet, so disable them. Unstyled text is better than no text. 2020-12-02 Brent Fulgham [macOS] WebContent sandbox; remove AppleIntelMEUserClient https://bugs.webkit.org/show_bug.cgi?id=219012 Reviewed by Eric Carlson. Instead of globally extending access to the AppleIntelMEUserClient IOKit class, only extend it when the GPU process is not in use. * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): Add 'AppleIntelMEUserClient' as a dynamically-extended IOKit class. * WebProcess/com.apple.WebProcess.sb.in: Only allow 'AppleIntelMEUserClient' if it was dynamically extended. 2020-12-02 Wenson Hsieh Unreviewed, fix the iOS build after r270362 * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView createHighlightInCurrentGroupWithRange:]): (-[WKContentView createHighlightInNewGroupWithRange:]): 2020-12-02 Megan Gardner Create and draw app highlights https://bugs.webkit.org/show_bug.cgi?id=219365 Reviewed by Wenson Hsieh. Handle the creation of App Highlights from selections when the context menu item is selected. This patch will add the highlights to the Document's app Highlight register, and handle drawing them in InlineTextBox. Later patches will handle the persistent storage and repopulation of app highlights on launch or reload of a page. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createAppHighlightInSelectedRange): * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::contextMenuItemSelected): * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView createHighlightInCurrentGroupWithRange:]): (-[WKContentView createHighlightInNewGroupWithRange:]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createAppHighlightInSelectedRange): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-12-02 Brent Fulgham [iOS] Silence sandbox warning for unneeded sysctl-read of "hw.tbfrequency_compat" https://bugs.webkit.org/show_bug.cgi?id=219414 Reviewed by Per Arne Vollan. Silence a spurious log generated when our sandbox denies access to the unused sysctl "hw.tbfrequency_compat". I have confirmed with the framework that attempts to read this value, and they confirm they don't need the value, and actually are not using the result anywhere in their framework. Let's silence this report. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-12-02 Wenson Hsieh Entire image elements are sometimes selected after ending a image extraction interaction https://bugs.webkit.org/show_bug.cgi?id=219435 Reviewed by Megan Gardner. If the image extraction interaction is currently active, regular text interactions may need to defer to these image extraction interactions. See WebKitAdditions changes for more details. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): 2020-12-02 Wenson Hsieh Context menu should be shown after a long timeout following image extraction https://bugs.webkit.org/show_bug.cgi?id=219415 Reviewed by Andy Estes. Ensures that the context menu can still be shown when triggering an image extraction gesture. To do this, we add a new long press gesture recognizer with a much longer delay. See WebKitAdditions patch for more details. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView _doAfterPendingImageExtraction:]): (-[WKContentView _invokeAllActionsToPerformAfterPendingImageExtraction]): Drive-by fix: move a couple of methods out of WebKitAdditions and into non-internal source. 2020-12-01 Tim Horton GPU Process: IOSurfaces should not be mapped into the Web Content Process https://bugs.webkit.org/show_bug.cgi?id=219368 Reviewed by Said Abou-Hallawa. Since the Web Content process sandbox will eventually not have access to IOKit, it will not be able to map/lock/use IOSurfaces. Thankfully, all it really needs to be able to do is carry a reference to the surface from the GPU process to the UI process (where it is mapped and applied as layer contents). * GPUProcess/graphics/PlatformRemoteImageBuffer.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h: * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: (isType): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::reestablishGPUProcessConnection): (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackendProxy::didFlush): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableIOSurfaceBackend::create): (WebKit::ImageBufferShareableIOSurfaceBackend::createImageBufferBackendHandle const): (WebKit::ImageBufferShareableIOSurfaceBackend::context const): (WebKit::ImageBufferShareableIOSurfaceBackend::copyNativeImage const): (WebKit::ImageBufferShareableIOSurfaceBackend::copyImage const): (WebKit::ImageBufferShareableIOSurfaceBackend::draw): (WebKit::ImageBufferShareableIOSurfaceBackend::drawPattern): (WebKit::ImageBufferShareableIOSurfaceBackend::toDataURL const): (WebKit::ImageBufferShareableIOSurfaceBackend::toData const): (WebKit::ImageBufferShareableIOSurfaceBackend::toBGRAData const): (WebKit::ImageBufferShareableIOSurfaceBackend::getImageData const): (WebKit::ImageBufferShareableIOSurfaceBackend::putImageData): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp. (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create): (WebKit::ImageBufferShareableMappedIOSurfaceBackend::createImageBufferBackendHandle const): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h. Rename ImageBufferShareableIOSurfaceBackend to ImageBufferShareableMappedIOSurfaceBackend. Readd ImageBufferShareableIOSurfaceBackend, the unmapped variant. The mapped variant is only used: - in the GPU process - in the Web Content process when DOM rendering in the GPU process is disabled The unmapped variant cannot perform most ImageBufferBackend duties, except creating an ImageBufferBackendHandle, which it does by cloning the existing handle. It explicitly does *not* map the IOSurface in the process, and is meant for use in Web Content processes that do not have access to IOSurface. 2020-12-01 Peng Liu [Media In GPU Process][MSE] Add the support to forward initialization segment from the GPU Process to Web processes https://bugs.webkit.org/show_bug.cgi?id=219227 Reviewed by Eric Carlson. This patch adds the support to forward `sourceBufferPrivateDidReceiveInitializationSegment()` callback from the source buffer parser running in the GPU process to the `SourceBufferPrivateRemote` running in the Web process, which in turn provides the initialization segment to `SourceBuffer`. No change in behavior. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/media/InitializationSegmentInfo.h: Added. (WebKit::InitializationSegmentInfo::TrackInformation::encode const): (WebKit::InitializationSegmentInfo::TrackInformation::decode): (WebKit::InitializationSegmentInfo::encode const): (WebKit::InitializationSegmentInfo::decode): * GPUProcess/media/RemoteAudioTrackProxy.cpp: (WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy): (WebKit::RemoteAudioTrackProxy::~RemoteAudioTrackProxy): (WebKit::RemoteAudioTrackProxy::configurationChanged): (WebKit::RemoteAudioTrackProxy::willRemove): * GPUProcess/media/RemoteAudioTrackProxy.h: * GPUProcess/media/RemoteAudioTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in. * GPUProcess/media/RemoteMediaDescription.h: Added. (WebKit::MediaDescriptionInfo::encode const): (WebKit::MediaDescriptionInfo::decode): (WebKit::RemoteMediaDescription::RemoteMediaDescription): * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): (WebKit::RemoteMediaPlayerProxy::addRemoteAudioTrackProxy): (WebKit::RemoteMediaPlayerProxy::addRemoteVideoTrackProxy): (WebKit::RemoteMediaPlayerProxy::addRemoteTextTrackProxy): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddAudioTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveAudioTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddVideoTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveVideoTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidAddTextTrack): (WebKit::RemoteMediaPlayerProxy::mediaPlayerDidRemoveTextTrack): (WebKit::RemoteMediaPlayerProxy::audioTrackSetEnabled): Deleted. (WebKit::RemoteMediaPlayerProxy::videoTrackSetSelected): Deleted. (WebKit::RemoteMediaPlayerProxy::textTrackSetMode): Deleted. * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/RemoteMediaSourceProxy.cpp: (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::addSourceBuffer): * GPUProcess/media/RemoteMediaSourceProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::create): (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy): (WebKit::RemoteTextTrackProxy::~RemoteTextTrackProxy): (WebKit::RemoteTextTrackProxy::configurationChanged): (WebKit::RemoteTextTrackProxy::willRemove): (WebKit::RemoteTextTrackProxy::addDataCue): (WebKit::RemoteTextTrackProxy::updateDataCue): (WebKit::RemoteTextTrackProxy::removeDataCue): (WebKit::RemoteTextTrackProxy::addGenericCue): (WebKit::RemoteTextTrackProxy::updateGenericCue): (WebKit::RemoteTextTrackProxy::removeGenericCue): (WebKit::RemoteTextTrackProxy::parseWebVTTFileHeader): (WebKit::RemoteTextTrackProxy::parseWebVTTCueData): * GPUProcess/media/RemoteTextTrackProxy.h: * GPUProcess/media/RemoteTextTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in. * GPUProcess/media/RemoteVideoTrackProxy.cpp: (WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy): (WebKit::RemoteVideoTrackProxy::~RemoteVideoTrackProxy): (WebKit::RemoteVideoTrackProxy::configurationChanged): (WebKit::RemoteVideoTrackProxy::willRemove): * GPUProcess/media/RemoteVideoTrackProxy.h: * GPUProcess/media/RemoteVideoTrackProxy.messages.in: Copied from Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in. * Scripts/webkit/messages.py: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/AudioTrackPrivateRemote.cpp: (WebKit::AudioTrackPrivateRemote::AudioTrackPrivateRemote): (WebKit::AudioTrackPrivateRemote::setEnabled): * WebProcess/GPU/media/AudioTrackPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::create): (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::addSourceBuffer): (WebKit::MediaSourcePrivateRemote::readyState const): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::create): (WebKit::SourceBufferPrivateRemote::SourceBufferPrivateRemote): (WebKit::SourceBufferPrivateRemote::readyState const): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: * WebProcess/GPU/media/TextTrackPrivateRemote.cpp: (WebKit::TextTrackPrivateRemote::TextTrackPrivateRemote): (WebKit::TextTrackPrivateRemote::setMode): * WebProcess/GPU/media/TextTrackPrivateRemote.h: * WebProcess/GPU/media/VideoTrackPrivateRemote.cpp: (WebKit::VideoTrackPrivateRemote::VideoTrackPrivateRemote): (WebKit::VideoTrackPrivateRemote::setSelected): * WebProcess/GPU/media/VideoTrackPrivateRemote.h: (WebKit::VideoTrackPrivateRemote::create): 2020-12-01 Wenson Hsieh [iOS] Support image extraction interactions for accessibility https://bugs.webkit.org/show_bug.cgi?id=219398 Reviewed by Devin Rousso. Adds support for a new accessibility feature related to images. Refer to the bug for more details. * Shared/ios/InteractionInformationRequest.cpp: (WebKit::InteractionInformationRequest::encode const): (WebKit::InteractionInformationRequest::decode): (WebKit::InteractionInformationRequest::isValidForRequest const): * Shared/ios/InteractionInformationRequest.h: Add a new flag to request image data via position information. This flag works similarly to the existing `includeSnapshot` flag, except that it only grabs data when the hit-tested node is an image. As such, a position information request with the `includeSnapshot` flag set is valid for an identical request with this new `includeImageData` flag set, but not vice versa. * SourcesCocoa.txt: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: Add various extension points for new WebKitAdditions snippets. (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): Call new methods to set up and tear down the image extraction interaction (defined in WebKitAdditions). (-[WKContentView _webTouchEventsRecognized:]): Upon starting a new gesture, reset the active (or pending) image extraction interaction, if appropriate. (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Allow the image extraction gesture to fire alongside any other gesture. (-[WKContentView _dragInteraction:prepareForSession:completion:]): (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]): These existing interactions may conflict with pending image extraction interactions. Luckily, since these interactions are both asynchronous, we're able to defer them until any pending image extraction request has finished, to determine whether or not they should commence. In both cases, image extraction should take precedence over dragging and context menus. * UIProcess/ios/WKImageExtractionGestureRecognizer.h: * UIProcess/ios/WKImageExtractionGestureRecognizer.mm: Add a new long press gesture recognizer that fires on a very short (100ms) delay. This gesture is used to preflight image extraction requests ahead of the other long press gestures (in particular, context menus), such that these other gestures should be minimally impacted by the time required to perform image extraction. This is still a long press gesture instead of a regular gesture recognizer, since preflighting image extraction requests could be expensive if performed during every single gesture (i.e. scrolling, taps, etc). (-[WKImageExtractionGestureRecognizer initWithDelegate:]): (-[WKImageExtractionGestureRecognizer setState:]): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::imagePositionInformation): 2020-12-01 Per Arne Vollan [macCatalyst] Embedded YouTube videos fail to play https://bugs.webkit.org/show_bug.cgi?id=219412 Reviewed by Tim Horton. Add a missing comma in list of Media services, for which sandbox extensions are created. The missing comma is causing a sandbox violation, since strings are concatenated when there's no comma. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): 2020-12-01 Per Arne Vollan [macOS] Deny mach lookup of 'com.apple.webinspector' in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=219386 Reviewed by Darin Adler. After r270035, mach-lookup of 'com.apple.webinspector' can be denied in the WebContent process on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-01 Brent Fulgham [macOS] Add telemetry for sandbox rules we believe are unused https://bugs.webkit.org/show_bug.cgi?id=219141 Reviewed by Per Arne Vollan. This patch adds telemetry to a set of sandbox features we believe are unused. We should capture telemetry to verify, and confirm before removing. * WebProcess/com.apple.WebProcess.sb.in: 2020-12-01 Keith Rollin Consolidate header postprocessing scripts https://bugs.webkit.org/show_bug.cgi?id=219388 Reviewed by David Kilzer. Our build system contains the following scripts to perform some postprocessing of headers that we export to the SDK: JavaScriptCore/postprocess-headers.sh WebKit/mac/postprocess-framework-headers.sh WebKitLegacy/mac/postprocess-headers.sh The preceding scripts are used when using the non-XCBuild -- or "legacy" -- Xcode build system. They are invoked in a custom Run Script build phase after the headers have been exported with the standard Xcode facility for creating frameworks. Alternatively, we also have the following postprocessing scripts: WebKit/Scripts/postprocess-header-rule JavaScriptCore/Scripts/postprocess-header-rule WebKitLegacy/scripts/postprocess-header-rule These scripts are used when using the XCBuild build system. They are invoked *during* the header export process to copy and postprocess the headers in one blow. They are part of a Custom Build Rule for exporting files ending in ".h". The reason why we have two sets of scripts is because of the different capabilities of the two Xcode build systems. The legacy system does not support a custom "export header" step that would allow us to copy and postprocess each header in a single step. Therefore, when using the legacy build system, we export in one build step and postprocess in a subsequent build step. And XCBuild doesn't like the approach taken by the old build system where files are exported first and then munged in a separate step, since that confuses its notion of the state of the build ("Hey! That file I exported in the previous build? I see now that it's been changed, so I'm going to export it again. And change its modification date. And then rebuild everything downstream that uses it."). Therefore, XCBuild added a facility for copying and postprocessing in one step. The scripts supporting each of these approaches are very similar to each other, such that there is a lot of code duplication between them. At the same time, by having two sets of scripts that are very similar to each other, we run the risk of "drift", where files in one set may get updated while their counterparts in the other set are not. Address this duplication by making the scripts in the "legacy" set be mere stubs that invoke the scripts in the new "XCBuild" set. In doing this, we also fix a case of drift: the legacy-based scripts made use of a timestamp file to determine if headers needed to be reprocessed and exported, while the XCBuild-based scripts used a "process the files and export them if any actual changes now exist between this new version and any previously-exported version" approach. Along the way, fix a bug in WebKitLegacy's postprocess-header-rule that resulted in WebKitAvailability.h not being processed. The practical effect of this bug is that the file ended up with both macOS and iOS code, along with the #if that controlled which chunk of code was compiled, instead of just the chunk of code specific to the targeted SDK. Normally, the unused chunk of code would get removed through the invocation of `unifdef`. But, because of the bug, the results of running `unifdef` were being discarded. * mac/postprocess-framework-headers.sh: 2020-12-01 Kate Cheney ITP logging mixes up the UI process ITP state with the Settings ITP state https://bugs.webkit.org/show_bug.cgi?id=219359 Reviewed by Youenn Fablet. Update an ITP logging message in the network process which mixes up the variables for the ITP state passed from the UI process and the ITP value from Settings. No new tests, this only updates an incorrect logging message. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::activateSessionCleanup): 2020-12-01 Alejandro G. Castro [GTK][WPE] Async scrolling udpates are blocked in the main thread https://bugs.webkit.org/show_bug.cgi?id=219308 Reviewed by Simon Fraser. We need to use the EventDispatcher from the frameDone callback in the ThreadedCompositor, for GTK and WPE we receive the frame information in that thread. We have to notify the scrolling trees in the scrolling thread even if the main thread is busy or we will freeze when the main thread is busy. For that we use the API in the EventDispatcher. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::sceneUpdateFinished): Call the EventDispatcher to notify the scrolling trees a frame was rendered. * WebProcess/WebPage/EventDispatcher.cpp: Enable the compilation of the notify function for all the ports. * WebProcess/WebPage/EventDispatcher.h: Ditto. 2020-12-01 Tim Horton GPU Process: Invalid static_cast from ConcreteImageBuffer to RemoteImageBufferProxy https://bugs.webkit.org/show_bug.cgi?id=219387 Reviewed by Ryosuke Niwa. * Shared/ConcreteShareableImageBuffer.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h. (WebKit::ConcreteShareableImageBuffer::create): (WebKit::ConcreteShareableImageBuffer::ConcreteShareableImageBuffer): (WebKit::ConcreteShareableImageBuffer::createImageBufferBackendHandle): * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): * WebKit.xcodeproj/project.pbxproj: Add and adopt ConcreteShareableImageBuffer. This is a ConcreteImageBuffer that knows how to create an ImageBufferBackendHandle, with no other behavior change. Previously, we were (completely incorrectly) casting ConcreteImageBuffer to RemoteImageBufferProxy to get this behavior, and somehow just got very lucky. * WebProcess/GPU/media/RemoteAudioSession.cpp: Fix some unified source issues. 2020-11-30 Per Arne Vollan [macOS] Adopt SPI to prevent establishing XPC connections to Launch Services https://bugs.webkit.org/show_bug.cgi?id=219173 Reviewed by Alex Christensen. Adopt SPI to prevent establishing XPC connections to Launch Services in the WebContent process on macOS. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-30 Tim Horton Unreviewed, reverting r270275. Broke canvas painting Reverted changeset: "GPU Process: IOSurfaces should not be mapped into the Web Content Process" https://bugs.webkit.org/show_bug.cgi?id=219368 https://trac.webkit.org/changeset/270275 2020-11-30 Fujii Hironori [WinCairo?] GPU process remains alive even after UI process exited https://bugs.webkit.org/show_bug.cgi?id=219321 Reviewed by Don Olmstead. GPUConnectionToWebProcess::didClose is called when web process exits, and GPUProcess::didClose is called when UI process exits in GPU process. GPUProcess::didClose should terminate the GPU process. AuxiliaryProcess is the base class of GPUProcess. AuxiliaryProcess::didClose is calling _exit. However, GPUProcess overrode AuxiliaryProcess::didClose but it did nothing. GPUProcess doesn't need to override it. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::didClose): Deleted. * GPUProcess/GPUProcess.h: 2020-11-30 Simon Fraser Pass OptionSet to various wheel event handler functions https://bugs.webkit.org/show_bug.cgi?id=219373 Reviewed by Tim Horton. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::handleWheelEvent): 2020-11-30 Tim Horton GPU Process: IOSurfaces should not be mapped into the Web Content Process https://bugs.webkit.org/show_bug.cgi?id=219368 Reviewed by Ryosuke Niwa. Since the Web Content process sandbox will eventually not have access to IOKit, it will not be able to map/lock/use IOSurfaces. Thankfully, all it really needs to be able to do is carry a reference to the surface from the GPU process to the UI process (where it is mapped and applied as layer contents). * Shared/ConcreteShareableImageBuffer.h: Copied from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h. (WebKit::ConcreteShareableImageBuffer::create): (WebKit::ConcreteShareableImageBuffer::ConcreteShareableImageBuffer): (WebKit::ConcreteShareableImageBuffer::createImageBufferBackendHandle): * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): Add and adopt ConcreteShareableImageBuffer. This is a ConcreteImageBuffer that knows how to create an ImageBufferBackendHandle, with no other behavior change. Previously, we were (completely incorrectly) casting ConcreteImageBuffer to RemoteImageBufferProxy to get this behavior, and somehow just got very lucky. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h: * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: Remove the ImageBufferShareableIOSurfaceBackend create() method that takes an ImageBufferBackendHandle, since we always use the Unmapped variant. ImageBufferShareableIOSurfaceBackend is now only used: - in the GPU process - in the Web Content process when DOM rendering in the GPU process is disabled In both cases, the process that uses ImageBufferShareableIOSurfaceBackend also originates the surface, so does not create it from a handle. * WebProcess/GPU/graphics/cocoa/ImageBufferShareableUnmappedIOSurfaceBackend.cpp: Added. (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::create): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::createImageBufferBackendHandle const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::context const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::copyNativeImage const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::copyImage const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::draw): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::drawPattern): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toDataURL const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toData const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::toBGRAData const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::getImageData const): (WebKit::ImageBufferShareableUnmappedIOSurfaceBackend::putImageData): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableUnmappedIOSurfaceBackend.h: Added. Add and adopt ImageBufferShareableUnmappedIOSurfaceBackend, which is a ImageBufferBackend that cannot perform most ImageBufferBackend duties, except creating an ImageBufferBackendHandle, which it does by cloning the existing handle. It explicitly does *not* map the IOSurface in the process, and is meant for use in Web Content processes that do not have access to IOSurface. * WebProcess/GPU/media/RemoteAudioSession.cpp: Fix some unified source issues. 2020-11-30 Chris Dumez sessionStorage should not be cloned when a window is opened with rel=noopener https://bugs.webkit.org/show_bug.cgi?id=218804 Reviewed by Alex Christensen. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchCreatePage): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-11-30 Youenn Fablet Introduce an experimental flag specific to VP9 profile 2 https://bugs.webkit.org/show_bug.cgi?id=219350 Reviewed by Eric Carlson. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): 2020-11-30 Antti Koivisto Remove throttling code from NetworkLoad https://bugs.webkit.org/show_bug.cgi?id=219347 Reviewed by Anders Carlsson. It is not a good latency simulation and no one is using it anyway. * NetworkProcess/NetworkLoad.cpp: (WebKit::NetworkLoad::NetworkLoad): (WebKit::NetworkLoad::didReceiveResponse): (WebKit::NetworkLoad::didReceiveData): (WebKit::NetworkLoad::didCompleteWithError): (WebKit::NetworkLoad::Throttle::Throttle): Deleted. (WebKit::NetworkLoad::throttleDelayCompleted): Deleted. * NetworkProcess/NetworkLoad.h: * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::shouldLogCookieInformation const): (WebKit::NetworkSession::loadThrottleLatency const): Deleted. * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): 2020-11-29 Adam Mazander Deny logs for benign fontservicesd daemon https://bugs.webkit.org/show_bug.cgi?id=219180 Reviewed by Per Arne Vollan. After investigating denials of fontservicesd logs over several submissions and without any fallout we are removing logging. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-11-28 Per Arne Vollan [macOS] Set application information in the Networking process on behalf of the WebContent process https://bugs.webkit.org/show_bug.cgi?id=218052 Reviewed by Brent Fulgham. In preparation for blocking Launch Services in the WebContent process' sandbox, application information for the process should be set in the Networking process. * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/mac/NetworkConnectionToWebProcessMac.mm: Added. (WebKit::NetworkConnectionToWebProcess::updateActivePages): * Scripts/process-entitlements.sh: * WebKit.xcodeproj/project.pbxproj: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::activePagesOrigins): (WebKit::WebProcess::updateActivePages): (WebKit::WebProcess::getActivePagesOriginsForTesting): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-28 Per Arne Vollan [macOS] Issue sandbox extension to icon services when starting a drag operation https://bugs.webkit.org/show_bug.cgi?id=219159 Reviewed by Brent Fulgham. Issue sandbox extension to icon services when starting a drag operation on macOS, since the WebContent process needs access to these services when a drag is started. This patch detects when a drag is about to start, and sends sandbox extensions to the icon services along with the mouse event. The sandbox extensions are then temporarily consumed while handling the mouse event in the WebContent process. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::processNextQueuedMouseEvent): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::mouseEvent): (WebKit::WebPage::simulateMouseDown): (WebKit::WebPage::simulateMouseUp): (WebKit::WebPage::simulateMouseMotion): (WebKit::WebPage::consumeSandboxExtensions): (WebKit::WebPage::revokeSandboxExtensions): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-11-27 Fujii Hironori Unreviewed, reverting r270210. It broke TestWebKitAPI.GPUProcess.CrashWhilePlayingVideo on iOS Reverted changeset: "[WinCairo?] GPU process remains alive even after web process exited" https://bugs.webkit.org/show_bug.cgi?id=219321 https://trac.webkit.org/changeset/270210 2020-11-27 Fujii Hironori [WinCairo?] GPU process remains alive even after web process exited https://bugs.webkit.org/show_bug.cgi?id=219321 Reviewed by Don Olmstead. AuxiliaryProcess::didClose is calling _exit. However, GPUProcess overrode AuxiliaryProcess::didClose but it did nothing. GPUProcess doesn't need to override it. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::didClose): Deleted. * GPUProcess/GPUProcess.h: 2020-11-27 Don Olmstead Non-unified build fixes, late November 2020 edition, take two https://bugs.webkit.org/show_bug.cgi?id=219317 Unreviewed non-unified build fixes. * Shared/WebPreferencesDefaultValues.cpp: 2020-11-27 Don Olmstead Fix build when ENABLE_RESOURCE_LOAD_STATISTICS is disabled https://bugs.webkit.org/show_bug.cgi?id=219316 Unreviewed build fix. Add ENABLE(RESOURCE_LOAD_STATISTICS) guards around NetworkSession requests for resource load statistics. Move firePrivateClickMeasurementTimerImmediately out of a ENABLE(RESOURCE_LOAD_STATISTICS) guard and place it where its ordered in the header. This originally broke the PlayStation build before ENABLE_RESOURCE_LOAD_STATISTICS was turned on. No new tests. No change in behavior. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::firePrivateClickMeasurementTimerImmediately): * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::clearSentAttributions): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): 2020-11-27 Wenson Hsieh Introduce new display list meta commands in preparation for webkit.org/b/219091 https://bugs.webkit.org/show_bug.cgi?id=219262 Reviewed by Ryosuke Niwa. See WebCore ChangeLog for more information. Additionally, rename `MetaCommandSwitchToItemBuffer` to `MetaCommandChangeItemBuffer`, for consistency with the new `MetaCommandChangeDestinationImageBuffer` item. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-27 Wenson Hsieh Remove some extraneous PLATFORM(IOS_FAMILY) guards in WKContentViewInteraction https://bugs.webkit.org/show_bug.cgi?id=219289 Reviewed by Sam Weinig. Remove several redundant uses of `PLATFORM(IOS_FAMILY)`. The entire class is already conditional on `IOS_FAMILY`, so adding additional compile-time guards for iOS family is not necessary. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setTimePickerValueToHour:minute:]): (-[WKContentView timePickerValueHour]): (-[WKContentView timePickerValueMinute]): 2020-11-27 Adrian Perez de Castro Non-unified build fixes, late November 2020 edition https://bugs.webkit.org/show_bug.cgi?id=219306 Unreviewed non-unified build fixes. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Add missing PrivateClickMeasurementManager.h header. * NetworkProcess/PrivateClickMeasurementManager.cpp: Add missing NetworkSession.h header. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::handleRequest): Add missing WebCore:: namespace to uses of the WebCore::SpeechRecognizer and WebCore::SpeechRecognitionUpdateType types. 2020-11-27 Yoshiaki Jitsukawa [PlayStation] Define platform argument coders for Font https://bugs.webkit.org/show_bug.cgi?id=219300 Reviewed by Fujii Hironori. * PlatformPlayStation.cmake: * Shared/playstation/WebCoreArgumentCodersPlayStation.cpp: Added. Define required member functions of ArgumentCoder> class. 2020-11-26 Wenson Hsieh Calling waitForAndDispatchImmediately on a loop fails when multiple M messages arrive simultaneously https://bugs.webkit.org/show_bug.cgi?id=219240 Reviewed by Chris Dumez. Fixes a race that may occur when calling `waitForAndDispatchImmediately` in a loop, when multiple messages `N` arrive on the IPC thread simultaneously. This may result from the following sequence of events (note that (Main) and (IPC) in the timeline below refer to the main thread and IPC background thread, respectively): (Main) Call `waitForAndDispatchImmediately`, and begin waiting. (IPC) A message `N` arrives, and is handled in `processIncomingMessage` by setting the decoder of `m_waitingForMessage` and notifying the condition variable. (Main) The main thread wakes up and starts to process `N`, clearing out `m_waitingForMessage` in the process. (IPC) A second message `N` arrives. We see that `m_waitingForMessage` is null, so we don't set the decoder and bail. Instead, we prepare to call `enqueueIncomingMessage` and push the message onto the main thread, *but importantly*, we haven't done so yet. (Main) Call `waitForAndDispatchImmediately` again, set `m_waitingForMessage`, and begin waiting. Since the incoming message that was just received above has not been enqueued yet, we are unable to avoid waiting due to the incoming message. (IPC) We finally call `enqueueIncomingMessage`, which pushes the message `N` into `m_incomingMessages` and dispatches onto the main thread. However, this is too late, since the main thread is already stuck waiting for the incoming IPC message that we've now just enqueued. Two minor adjustments are required to fix this, described in the below comments. The combination of these two changes ensures that the scenario described above is impossible, since we'll either set `m_waitingForMessage`'s decoder and wake up the main thread in the case where `waitForMessage` is called before `processIncomingMessage`, or we'll bail early in `waitForMessage` with the enqueued IPC message in the case where `processIncomingMessage` runs before `waitForMessage`. * Platform/IPC/Connection.cpp: (IPC::Connection::waitForMessage): Move logic that checks the incoming messages queue when calling `Connection::waitForMessage` into the `m_waitForMessageMutex` critical section. (IPC::Connection::processIncomingMessage): Extend the critical section of `m_waitForMessageMutex` when processing an incoming message, such that it encompasses the part that enqueues the incoming message. 2020-11-26 Lauro Moura [GTK][GTK4] Building with GObject-Introspection support does not work https://bugs.webkit.org/show_bug.cgi?id=219221 Reviewed by Carlos Garcia Campos. * PlatformGTK.cmake: Forward GTK version to gir scanner and use correct pkg-config package. 2020-11-26 Lauro Moura [GTK4] Declare lambda return type to avoid build error deducing it https://bugs.webkit.org/show_bug.cgi?id=219268 Reviewed by Adrian Perez de Castro. * UIProcess/gtk/WebPopupMenuProxyGtk.cpp: (WebKit::WebPopupMenuProxyGtk::createPopupMenu): 2020-11-26 Fujii Hironori [WinCairo] Enable GPU process https://bugs.webkit.org/show_bug.cgi?id=219294 Reviewed by Don Olmstead. Added stub functions to build GPU process. Invoke the following command to enable GPU process: > reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /t REG_DWORD /d 1 /f Invoke the following command to disable GPU process: > reg delete HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /f * GPUProcess/media/win/RemoteMediaPlayerProxyWin.cpp: Added. (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): (WebKit::RemoteMediaPlayerProxy::enterFullscreen): (WebKit::RemoteMediaPlayerProxy::exitFullscreen): * GPUProcess/win/GPUProcessMainWin.cpp: Added. (WebKit::initializeAuxiliaryProcess): (WebKit::GPUProcessMain): * GPUProcess/win/GPUProcessWin.cpp: Added. (WebKit::GPUProcess::initializeProcess): (WebKit::GPUProcess::initializeProcessName): (WebKit::GPUProcess::initializeSandbox): * PlatformWin.cmake: * Shared/WebPreferencesDefaultValues.h: * Shared/curl/WebCoreArgumentCodersCurl.cpp: (IPC::ArgumentCoder::encodePlatformData): Deleted. (IPC::ArgumentCoder::decodePlatformData): Deleted. (IPC::ArgumentCoder>::encodePlatformData): Deleted. (IPC::ArgumentCoder>::decodePlatformData): Deleted. * Shared/win/WebCoreArgumentCodersWin.cpp: Added. (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): (IPC::ArgumentCoder>::encodePlatformData): (IPC::ArgumentCoder>::decodePlatformData): * Shared/win/WebPreferencesDefaultValuesWin.cpp: Added. (WebKit::isFeatureFlagEnabled): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::submitDisplayList): (WebKit::RemoteRenderingBackendProxy::createItemBuffer): * WebProcess/GPU/media/win/VideoLayerRemoteWin.cpp: Added. (WebKit::createVideoLayerRemote): 2020-11-26 Youenn Fablet https://collab-project.github.io/videojs-record/demo/video-only.html is not working https://bugs.webkit.org/show_bug.cgi?id=219258 Reviewed by Eric Carlson. Fixed a potential null pointer crash in case load is aborted by WebCore at creation time. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::requestResource): 2020-11-26 Yoshiaki Jitsukawa [PlayStation] Enable ResourceLoadStatistics https://bugs.webkit.org/show_bug.cgi?id=219292 Reviewed by Fujii Hironori. * PlatformPlayStation.cmake: 2020-11-21 Sihui Liu Implement audio capture for SpeechRecognition on macOS https://bugs.webkit.org/show_bug.cgi?id=218855 Reviewed by Youenn Fablet. * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): Check and enable mock devices based on preference as SpeechRecognition needs it for testing. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::stop): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::invalidate): (WebKit::SpeechRecognitionServer::sendUpdate): (WebKit::SpeechRecognitionServer::stopRequest): Deleted. (WebKit::SpeechRecognitionServer::abortRequest): Deleted. * UIProcess/SpeechRecognitionServer.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::syncIfMockDevicesEnabledChanged): * UIProcess/WebPageProxy.h: 2020-11-21 Simon Fraser Propagate the 'wheelEventGesturesBecomeNonBlocking' setting to the ScrollingTree https://bugs.webkit.org/show_bug.cgi?id=219241 Reviewed by Tim Horton. Propagate the 'wheelEventGesturesBecomeNonBlocking' setting to the ScrollingTree via the ScrollingStateFrameScrollingNode, as we do for other settings. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): 2020-11-21 Simon Fraser Add an Experimental Features for wheel event gestures becoming non-blocking https://bugs.webkit.org/show_bug.cgi?id=219236 Reviewed by Sam Weinig. Add a feature flag for the behavior that is being added via webkit.org/b/218764, which is that only the first wheel event in a gesture is cancelable. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWheelEventGesturesBecomeNonBlocking): * Shared/WebPreferencesDefaultValues.h: 2020-11-21 Jiewen Tan [WebAuthn] Implement SPI for AuthenticationServices.Framework https://bugs.webkit.org/show_bug.cgi?id=218893 Reviewed by Alex Christensen. This patch implements the SPI for AuthenticationServices.Framework, which is more or less a direct translation of the WebAuthn Web IDLs and a thin wrapper on top of functionalities of the WebAuthn process. It deprecates the existing _WKWebAuthenticationPanel SPI which is for Safari to show UI only. This patch does not just repurpose the SPI but also modifies some of the implementations. The most noticeable one is the change of ownerships. Prior to this change, AuthenticatorManager owns the APIWebAuthenticationPanel. Now, it's the opposite way. Since there will be a period of time that the deprecated implementation will coexist with the new implementation, this path also marks things that are meant to deprecate in the future to reduce confusions. * UIProcess/API/APIWebAuthenticationPanel.cpp: (API::WebAuthenticationPanel::WebAuthenticationPanel): (API::WebAuthenticationPanel::handleRequest): (API::WebAuthenticationPanel::cancel const): * UIProcess/API/APIWebAuthenticationPanel.h: Implements the plumbing for the new SPI and owns the AuthenticatorManager now. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (-[_WKAuthenticationExtensionsClientOutputs initWithAppid:]): (-[_WKAuthenticatorResponse initWithRawId:extensions:]): (-[_WKAuthenticatorAssertionResponse initWithRawId:extensions:authenticatorData:signature:userHandle:]): (-[_WKAuthenticatorAttestationResponse initWithRawId:extensions:attestationObject:]): (-[_WKAuthenticatorSelectionCriteria init]): (-[_WKPublicKeyCredentialCreationOptions initWithRp:user:pubKeyCredParams:]): (-[_WKPublicKeyCredentialDescriptor initWithType:identifier:]): (-[_WKPublicKeyCredentialEntity initWithName:]): (-[_WKPublicKeyCredentialParameters initWithType:alg:]): (-[_WKPublicKeyCredentialRequestOptions init]): (-[_WKPublicKeyCredentialRpEntity initWithName:]): (-[_WKPublicKeyCredentialUserEntity initWithName:identifier:displayName:]): (-[_WKWebAuthenticationPanel init]): (vectorFromNSData): (encodeEntity): (publicKeyCredentialRpEntity): (publicKeyCredentialUserEntity): (publicKeyCredentialParameters): (authenticatorTransport): (authenticatorTransports): (publicKeyCredentialDescriptors): (authenticatorAttachment): (userVerification): (authenticatorSelectionCriteria): (attestationConveyancePreference): (authenticationExtensionsClientInputs): (+[_WKWebAuthenticationPanel convertToCoreCreationOptionsWithOptions:]): (wkAuthenticatorAttestationResponse): (-[_WKWebAuthenticationPanel makeCredentialWithHash:options:completionHandler:]): (+[_WKWebAuthenticationPanel convertToCoreRequestOptionsWithOptions:]): (wkAuthenticatorAssertionResponse): (-[_WKWebAuthenticationPanel getAssertionWithHash:options:completionHandler:]): (+[_WKWebAuthenticationPanel isUserVerifyingPlatformAuthenticatorAvailable]): Implements the SPI. * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Marks things as to deprecate. 2020-11-20 Kate Cheney PCM: Persist pending ad clicks and attributions so they can survive browser restart https://bugs.webkit.org/show_bug.cgi?id=219134 Reviewed by John Wilander. This patch migrates Private Click Measurement to use SQLite, which is beneficial because it requires less in-memory storage and persists PCM data across browser sessions. It also updates naming to match naming agreed upon in standards bodies: - source -> sourceSite - campaign/campaignID -> sourceID - destination -> attributeOnSite - conversion/conversionValue -> attributionTriggerData - unconverted -> unattributed - convert(ed) -> attribute(d) This adds 3 SQLite tables: one for clicks that haven't been attributed, one for attributions that haven't been sent, and one to store the last time the reports were sent to make sure reports get sent as soon as possible if needed after a browser restart. Behavior is identical to existing PCM implementation with the addition of persistence. Existing PCM tests confirm no regressions. Reviewed by John Wilander. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::createTableQueries): (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): New queries to interact with PCM data. (WebKit::ResourceLoadStatisticsDatabaseStore::updateTimerLastFired): (WebKit::ResourceLoadStatisticsDatabaseStore::timerLastFired): (WebKit::ResourceLoadStatisticsDatabaseStore::updatePrivateClickMeasurementAttributionTimes): Set earliestTimeToSend to be the original value minus the time passed since the last timer fire for each entry. If the result is less than 0, set to 0 so the report gets sent immediately. (WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase): Creates a PCM object from data in the database. (WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): (WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed): (WebKit::ResourceLoadStatisticsDatabaseStore::attributePrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): (WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): (WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttributions): These functions use database queries to implement PCM functionality with exactly the same behavior as the in-memory PCM implementation. (WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::updateTimerLastFired): (WebKit::WebResourceLoadStatisticsStore::insertPrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): (WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::allAttributedPrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurementForRegistrableDomain): (WebKit::WebResourceLoadStatisticsStore::clearExpiredPrivateClickMeasurement): (WebKit::WebResourceLoadStatisticsStore::privateClickMeasurementToString): (WebKit::WebResourceLoadStatisticsStore::clearSentAttributions): (WebKit::WebResourceLoadStatisticsStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::firePrivateClickMeasurementTimerImmediately): (WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart): (WebKit::NetworkProcess::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Test functions to help simulate a browser restart after PCM data has expired during a session close. This is the only behavior change from the existing PCM implementation. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::firePrivateClickMeasurementTimerImmediately): (WebKit::NetworkSession::storePrivateClickMeasurement): (WebKit::NetworkSession::handlePrivateClickMeasurementConversion): (WebKit::NetworkSession::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkSession::markPrivateClickMeasurementsAsExpiredForTesting): * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): Move constructor to cpp file to call startTimer(5_s) which will kick off sending any reports that have expired in the database. We should wait 5 seconds so we are sure ITP is up and running. (WebKit::PrivateClickMeasurementManager::storeUnattributed): (WebKit::PrivateClickMeasurementManager::handleAttribution): (WebKit::PrivateClickMeasurementManager::startTimer): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::clearSentAttributions): (WebKit::PrivateClickMeasurementManager::updateTimerLastFired): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::setConversionURLForTesting): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::storeUnconverted): Deleted. (WebKit::PrivateClickMeasurementManager::handleConversion): Deleted. (WebKit::PrivateClickMeasurementManager::convert): Deleted. (WebKit::PrivateClickMeasurementManager::firePendingConversionRequests): Deleted. (WebKit::PrivateClickMeasurementManager::markAllUnconvertedAsExpiredForTesting): Deleted. Implementation moved to ResourceLoadStatisticsDatabaseStore. * NetworkProcess/PrivateClickMeasurementManager.h: (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): Deleted. Moved to cpp file. (WebKit::PrivateClickMeasurementManager::m_sessionID): Deleted. * UIProcess/API/C/WKPage.cpp: (WKPageMarkAttributedPrivateClickMeasurementsAsExpiredForTesting): (WKPageSimulateResourceLoadStatisticsSessionRestart): * UIProcess/API/C/WKPagePrivate.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::WebPageProxy::simulateResourceLoadStatisticsSessionRestart): * UIProcess/WebPageProxy.h: Testing support. 2020-11-20 Simon Fraser Dispatch main-thread overflow scrolls to the scrolling thread as we do for page scrolls https://bugs.webkit.org/show_bug.cgi?id=219213 Reviewed by Tim Horton. Unify the behavior of overflow scrolling and page scrolling for synchronous scrolls. Somewhat surprisingly, synchronous page scrolls move layers via a dispatch to the scrolling thread in FrameView::handleWheelEventForScrolling(), but overflow scrolls just did main thread compositing updates to set the new layer positions. A future patch will require that the "began" event for a synchronous scroll gets back to the scrolling thread, so unify these code paths to have overflow scrolls also leverage handleWheelEventAfterMainThread(), via RenderLayer::handleWheelEventForScrolling(). There's some fallout from this. ThreadedScrollingTree::handleWheelEventAfterMainThread() calls into handleWheelEventWithNode(), but in this special case that codepath needs to know that we're in a special "post main thread" mode that should 1. Behave as if the node is latched, i.e. don't propagate to parent nodes, and target the node if if it's scrolled to a the min or max to allow rubberbanding 2. Scroll even if the node has synchronous scrolling reasons This mode is represented by the EventTargeting value. Finally, EventHandler::handleWheelEventInternal() should only clear latching state if the content has called preventDefault() on the event. * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent): * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::handleWheelEvent): * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.h: 2020-11-20 Simon Fraser Rename some wheel-event handling functions for clarity https://bugs.webkit.org/show_bug.cgi?id=219211 Reviewed by Tim Horton. There are too many functions called wheelEvent() or handleWheelEvent(), making it hard to know which phase of handling they apply to. So rename some to handleWheelEventForScrolling(), which applies to the "default handling" phase after DOM event dispatch. In addition, make ScrollableArea's handleWheelEventForScrolling() virtual and have FrameView override it (a future patch will also add an override in RenderLayer). Rename ScrollingCoordinator::performDefaultWheelEventHandling() to use handleWheelEventForScrolling() for clarity. * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::handleWheelEvent): 2020-11-20 Ryan Haddad Unreviewed fix for my build fix. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): You have to spell DEPRECATED correctly for this to work. 2020-11-20 Ryan Haddad Unreviewed, fix the build with recent SDKs. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]): 2020-11-20 Philippe Normand Unreviewed, GTK build warning fix * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: Mark configurationForRemoteInspector as override of corresponding parent class method declaration. 2020-11-19 Wenson Hsieh REGRESSION (r259151): The "Convert Text to Traditional Chinese" services menu action is broken https://bugs.webkit.org/show_bug.cgi?id=219190 Reviewed by Tim Horton. Some system services, such as "Convert Text to (Traditional|Simplified) Chinese", use `-[NSServicesMenuRequestor readSelectionFromPasteboard:]` to insert the contents of the given pasteboard into the current selection. After the changes in r259151, this requires the UI process to explicitly grant access to the contents of the given pasteboard, on behalf of the web content process. Fix the bug by adding the missing call to `grantAccessToCurrentPasteboardData`. This is only called from API in the UI process, so it cannot be abused by a compromised web content process to grab the contents of `NSPasteboard`. Test: PasteHTML.ReadSelectionFromPasteboard * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::readSelectionFromPasteboard): 2020-11-19 Fujii Hironori [TextureMapper] Remove m_textureMapper from TextureMapperLayer https://bugs.webkit.org/show_bug.cgi?id=219191 Reviewed by Carlos Garcia Campos. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): (WebKit::CoordinatedGraphicsScene::ensureRootLayer): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::compositeLayersToContext): (WebKit::LayerTreeHost::flushPendingLayerChanges): (WebKit::LayerTreeHost::LayerTreeHost): 2020-11-19 Hoa Dinh Code formatting: change instances of "@synthesize a=b" to "@synthesize a = b". https://bugs.webkit.org/show_bug.cgi?id=219094 Reviewed by Wenson Hsieh. There was a mix of "@synthesize a=b" and "@synthesize a = b" in the codebase. Most of the instances are "@synthesize a = b", with spaces around the equal sign. With https://bugs.webkit.org/show_bug.cgi?id=219092, we're changing the behavior of the code style checker to require spaces around the equal sign. The change replace all the instances of "@synthesize a=b" with "@synthesize a = b". * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: * UIProcess/API/Cocoa/WKPreviewActionItem.mm: * UIProcess/API/Cocoa/_WKThumbnailView.mm: * UIProcess/Cocoa/WebViewImpl.mm: * UIProcess/QuickLookThumbnailLoader.mm: * UIProcess/WebAuthentication/Mock/MockNfcService.mm: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: * UIProcess/mac/ViewGestureControllerMac.mm: * UIProcess/mac/WKFullScreenWindowController.mm: * WebProcess/Plugins/PDF/PDFPlugin.mm: 2020-11-19 Brent Fulgham Unreviewed rollout of r269890 and r269911 due to EME issues on Mac Mini. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-19 Chris Dumez Web Inspector: Unable to Show JavaScript Console in empty tab in Safari Technology Preview https://bugs.webkit.org/show_bug.cgi?id=211590 Reviewed by Simon Fraser. We used to launch the initial process for the inspected page from inside WebInspectorProxy::connect(). I thought this was a good bottleneck to make sure the inspected page has a process to inspect. However, while WebInspectorProxy::connect() gets called by functions by WebInspectorProxy::show(), it does not get called by WebInspectorProxy::showConsole() for example. To address this, I have moved the code that launches the inspected page's initial process from WebInspectorProxy::connect() to WebInspectorProxy::createFrontendPage(). This seems like a much better bottleneck. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::connect): (WebKit::WebInspectorProxy::createFrontendPage): 2020-11-19 Per Arne Vollan [macOS] Issue sandbox extension to Web Inspector service https://bugs.webkit.org/show_bug.cgi?id=219041 Reviewed by Brent Fulgham. In preparation of blocking this service in the WebContent process, a sandbox extension should be issued if Safari's Develop menu is enabled. This extension will also be dynamically issued to all WebContent processes, if the Develop menu preference changes, by observing this preference. * UIProcess/Cocoa/WebInspectorPreferenceObserver.h: Added. * UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: Added. (+[WKWebInspectorPreferenceObserver sharedInstance]): (-[WKWebInspectorPreferenceObserver init]): (-[WKWebInspectorPreferenceObserver observeValueForKeyPath:ofObject:change:context:]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitialize): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded): * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2020-11-19 Per Arne Vollan [macOS] Issue sandbox extension to audio service if Media in the GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=219051 Reviewed by Youenn Fablet. Issue sandbox extension to com.apple.audio.audiohald for the WebContent process on macOS if Media in the GPU process is not enabled. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-19 Joshua Watt [WPE] Prevent elements getting stuck in a pressed state when scrolling on a touchscreen https://bugs.webkit.org/show_bug.cgi?id=218903 Reviewed by Adrian Perez de Castro. Stops the scroll gesture controller from eating touch up events and preventing them from propagating to the page when the controller is handling a scroll event. If the scroll logic prevents the events from propagating to the page, elements on the page (e.g. buttons) can get stuck in a pressed state when the user lifts their finger. * UIProcess/API/wpe/ScrollGestureController.cpp: (WebKit::ScrollGestureController::handleEvent): 2020-11-19 Carlos Garcia Campos Protect WebSocketChannel before calling client methods https://bugs.webkit.org/show_bug.cgi?id=216791 Reviewed by Youenn Fablet. Ensure we keep a reference to the WebSocketChannel before calling client methods that might close the channel. * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::close): (WebKit::WebSocketChannel::fail): (WebKit::WebSocketChannel::didClose): (WebKit::WebSocketChannel::resume): 2020-11-18 Megan Gardner Menu Bar support for app highlights in book. https://bugs.webkit.org/show_bug.cgi?id=219117 Reviewed by Wenson Hsieh. Add menu stubs in iOS to support highlights for books in modern webkit. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView canPerformAction:withSender:]): (-[WKContentView setupAppHighlightMenus]): (-[WKContentView createHighlightInCurrentGroupWithRange:]): (-[WKContentView createHighlightInNewGroupWithRange:]): 2020-11-18 Wenson Hsieh Rename MetaCommandSwitchTo to MetaCommandSwitchToItemBuffer https://bugs.webkit.org/show_bug.cgi?id=219130 Reviewed by Tim Horton. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-18 Wenson Hsieh [Concurrent display lists] Add a way for display lists to partially replay https://bugs.webkit.org/show_bug.cgi?id=219067 Reviewed by Simon Fraser. See WebCore ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: Make `submitDisplayList` on `RemoteImageBuffer` return a `ReplayResult`. (WebKit::RemoteImageBuffer::submitDisplayList): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::submitDisplayList): 2020-11-18 Chris Dumez Drop redundant code that tries to bump the QoS of the WebContent main thread of UserInteractive when handling a sync IPC https://bugs.webkit.org/show_bug.cgi?id=219110 Reviewed by Alex Christensen. Drop redundant code that tries to bump the QoS of the WebContent main thread of UserInteractive when handling a sync IPC. Nowadays, we always run the main thread of the WebContent at UserInteractive QoS (see WTF::Thread::setCurrentThreadIsUserInteractive() call in WebProcess::initializeWebProcess()) so there is no need to boost the QoS during a sync IPC. * Platform/IPC/Connection.cpp: (IPC::Connection::processIncomingMessage): * Platform/IPC/Connection.h: (IPC::Connection::setShouldBoostMainThreadOnSyncMessage): Deleted. * Platform/IPC/Decoder.h: (IPC::Decoder::setQOSClassOverride): Deleted. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeConnection): 2020-11-18 Darin Adler Remove advanced plug-in feature: small plug-in blocking https://bugs.webkit.org/show_bug.cgi?id=219101 Reviewed by Anders Carlsson. * WebProcess/WebPage/WebPage.cpp: (WebKit::pluginIsSmall): Deleted. (WebKit::WebPage::createPlugin): Removed code that blocks small plug-ins. 2020-11-18 Simon Fraser Propagate wheel event handling back to the scrolling thread https://bugs.webkit.org/show_bug.cgi?id=219050 Reviewed by Chris Dumez. For now, use MainThreadForBlockingDOMEventDispatch for the default steps (used by non-macOS platforms). * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::handleWheelEvent): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-11-18 Wenson Hsieh Clean up some code in SharedDisplayListHandle https://bugs.webkit.org/show_bug.cgi?id=219089 Reviewed by Geoff Garen. Currently, `reservedCapacityAtStart` is defined as a constant 16 bytes, which is enough to encompass the contents of the header structure in a shared display list handle (i.e. an 8-byte atomic for the lock, and another 8 bytes for the unread count). Instead of hard-coding this, we could simply make this a constexpr function that returns the size of `DisplayListSharedMemoryHeader` (rounded up to ensure alignment of all display list item data). No change in behavior. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::headerSize): * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: (WebKit::DisplayListWriterHandle::resetWritableOffsetIfPossible): * WebProcess/GPU/graphics/DisplayListWriterHandle.h: (WebKit::DisplayListWriterHandle::DisplayListWriterHandle): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createItemBuffer): Also add a static assert that the size of a newly allocated buffer is larger than the reserved header capacity. 2020-11-18 Per Arne Vollan [macOS] Fix message filter sandbox violation https://bugs.webkit.org/show_bug.cgi?id=219090 Reviewed by Geoffrey Garen. The message filter in the WebContent process on macOS needs to allow some additional messages. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-18 Chris Dumez [GPUProcess] Main thread of the GPUProcess should have same priority as main thread of the WebContent https://bugs.webkit.org/show_bug.cgi?id=219057 Reviewed by Simon Fraser. Main thread of the GPUProcess should have same priority as main thread of the WebContent since it is doing rendering on its behalf. For now, this means that on macOS, the main threads of the GPU and WebContent processes with both get UserInteractive QoS. On iOS, they will both still get UserInitiated QoS until our RunningBoard foreground process assertion get fixed to get the right priority (). * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-OSX.plist: Use _ProcessType=App, similarly as what we do for the WebContent process. If we don't do this, the process is an adaptive daemon and its QoS can never be higher than UserInitiated. We need its priority to go to UserInteractive to match the WebContent process. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): Request UserInteractive QoS for the main thread of the GPUProcess, similarly to what we do for the main thread of the WebContent process already in WebProcess::InitializeWebProcess(). 2020-11-18 Sam Weinig Address additional feedback from https://bugs.webkit.org/show_bug.cgi?id=218960 https://bugs.webkit.org/show_bug.cgi?id=219044 Reviewed by Alex Christensen. * Shared/API/Cocoa/WKDataDetectorTypesInternal.h: (fromWKDataDetectorTypes): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::detectDataInAllFrames): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): (WebKit::WebPage::detectDataInAllFrames): Update for rename of WebCore::DataDetectionTypes to WebCore::DataDetectionType. 2020-11-17 Tim Horton GPU-process-hosted RemoteLayerBackingStore should flush off the main thread https://bugs.webkit.org/show_bug.cgi?id=219063 Reviewed by Simon Fraser. * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::display): Construct the ImageBuffer flusher /after/ submitting the final DisplayList, so that it takes the correct flush identifier. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::didFlush): (WebKit::RemoteRenderingBackend::flushDisplayListWasCommitted): Deleted. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::didFlush): (WebKit::RemoteImageBufferProxy::lastSentFlushIdentifier const): (WebKit::RemoteImageBufferProxy::waitForDidFlushOnSecondaryThread): (WebKit::RemoteImageBufferProxy::hasPendingFlush const): (WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout): (WebKit::ThreadSafeRemoteImageBufferFlusher::ThreadSafeRemoteImageBufferFlusher): (WebKit::RemoteImageBufferProxy::commitFlushDisplayList): Deleted. (WebKit::RemoteImageBufferProxy::isPendingFlush const): Deleted. (WebKit::RemoteImageBufferProxy::timeoutWaitForFlushDisplayListWasCommitted): Deleted. Some renames: Rename flushDisplayListWasCommitted to didFlush; this is the back-message from GPU process to Web Content process that a FlushContext display list item was completed successfully. Rename isPendingFlush to hasPendingFlush, for grammar. Rename timeoutWaitForFlushDisplayListWasCommitted to waitForDidFlushWithTimeout, for similar reasons. Rename waitForFlushDisplayListWasCommitted to waitForDidFlush. Rename commitFlushDisplayList to didFlush. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::waitForDidFlush): (WebKit::RemoteRenderingBackendProxy::didFlush): (WebKit::RemoteRenderingBackendProxy::waitForFlushDisplayListWasCommitted): Deleted. (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: Reimplement ThreadSafeRemoteImageBufferFlusher such that it waits (on the RemoteLayerTreeDrawingArea CommitQueue, in the only current use of it) for the correct flush reply to come in before continuing. This is analogous to what we do for in-process buffers, where we call CGContextFlush() in the flusher. 2020-11-17 Chris Dumez [iOS] ASSERTION FAILED: Completion handler should always be called under WebKit::GPUProcess::didReceiveMessage https://bugs.webkit.org/show_bug.cgi?id=219055 Reviewed by Alex Christensen. Make sure GPUProcess::prepareToSuspend() calls its completion handler to avoid delaying suspension and avoid assertion hits in debug. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::prepareToSuspend): 2020-11-17 Chris Dumez Make sure ProcessThrottler is always holding a ProcessAssertion for its child process https://bugs.webkit.org/show_bug.cgi?id=219053 Reviewed by Geoff Garen. Make sure ProcessThrottler is always holding a ProcessAssertion for its child process. Previously, when changing the assertion type (e.g. when going from background to foreground) we would release the previous assertion and then take the new one. RunningBoard developers recommend that we wait until the new ProcessAssertion is taken before we release the previous one to avoid churn. It is also important we always hold a ProcessAssertion at all times for the child process because the child process may exit otherwise. * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::setAssertionType): 2020-11-17 Chris Dumez [macOS] Stop using RunLoopType=_WebKit starting in Big Sur https://bugs.webkit.org/show_bug.cgi?id=219052 Reviewed by Geoffrey Garen. Stop using RunLoopType=_WebKit starting in Big Sur. This was a temporary hack so that our WebProcesses would get the right scheduling priority. Starting with Big Sur, the right way to do this is to use _ProcessType=App and restore the RunLoopType to be NSRunLoop. After this change, I have verified that the WebContent's main thread still runs at UserInteractive QoS. App Nap is also still working as expected. * Configurations/WebContentService.xcconfig: * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: 2020-11-17 Per Arne Vollan [macOS] Issue sandbox extension to trust service if Media in the GPU process is not enabled https://bugs.webkit.org/show_bug.cgi?id=218986 Reviewed by Brent Fulgham. Since Media is using the trust service, issue a sandbox extension to the WebContent process if Media in the GPU process is not enabled. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-17 Sihui Liu Add a default action for SpeechRecognition permission request https://bugs.webkit.org/show_bug.cgi?id=219021 Reviewed by Youenn Fablet. When there is no delegate or selector for deciding user permission on speech recognition, force an alert and let user decide. This is currently what we do for UserMedia permission request, and it makes testing easier. * SourcesCocoa.txt: * UIProcess/API/APIUIClient.h: (API::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::visibleDomain): (WebKit::alertMessageText): (WebKit::allowButtonText): (WebKit::doNotAllowButtonText): (WebKit::alertForPermission): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): * UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm: Removed. Moved alert code to MediaPermissionUtilities so it can be shared between UserMedia and SpeechRecognition. * UIProcess/MediaPermissionUtilities.h: * UIProcess/SpeechRecognitionPermissionManager.cpp: (WebKit::SpeechRecognitionPermissionManager::decideByDefaultAction): * UIProcess/SpeechRecognitionPermissionManager.h: * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::doDefaultAction): * UIProcess/UserMediaPermissionRequestProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestSpeechRecognitionPermissionByDefaultAction): * UIProcess/WebPageProxy.h: * WebKit.xcodeproj/project.pbxproj: 2020-11-17 Saagar Jha Check com.apple.private.webkit.use-xpc-endpoint only on internal builds https://bugs.webkit.org/show_bug.cgi?id=215423 Reviewed by Per Arne Vollan. Signing with com.apple.private entitlements can only be done by Apple internally. Thus, it should only checked for internal builds. * Shared/Cocoa/XPCEndpoint.mm: (WebKit::XPCEndpoint::XPCEndpoint): Wrap check in USE(APPLE_INTERNAL_SDK). * Shared/Cocoa/XPCEndpointClient.mm: (WebKit::XPCEndpointClient::setEndpoint): Wrap check in USE(APPLE_INTERNAL_SDK). 2020-11-17 Brent Fulgham [macOS] Remove access to the unused AppleSNBFBUserClient IOKit class https://bugs.webkit.org/show_bug.cgi?id=219014 Reviewed by Eric Carlson. Although we originally thought this was needed for H.264 decoding, testing shows that this class is never used in WebKit flows, and is not needed. We should remove it. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-17 Chris Dumez [iOS] Stop leaking an XPC transaction in our XPC services https://bugs.webkit.org/show_bug.cgi?id=219036 Reviewed by Geoffrey Garen. Stop leaking an XPC transaction in our XPC services on iOS. We were doing this to control the lifetime of our child services ourselves. However, this is not needed on iOS because the UIProcess takes RunningBoard process assertions on behalf of its child processes. I have verified that our child processes do not exit/jetsam early. I have verified that our child processes are in the correct jetsam band (IDLE/0 when background and FG/10 when foreground). I have also verified that the main thread of these processes runs at UserInitiated QoS before and after this change. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceExit): 2020-11-17 Peng Liu [Media In GPU Process][MSE] Add infrastructure needed to run MediaPlayerPrivateMediaSourceAVFObjC in the GPU process https://bugs.webkit.org/show_bug.cgi?id=218912 Reviewed by Eric Carlson. Add MediaSourcePrivateRemote/RemoteMediaSourceProxy and SourceBufferPrivateRemote/RemoteSourceBufferProxy, and setup IPC connections for them. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * GPUProcess/GPUProcessSessionParameters.h: * GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/RemoteMediaSourceProxy.cpp: Added. (WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::~RemoteMediaSourceProxy): (WebKit::RemoteMediaSourceProxy::setPrivateAndOpen): (WebKit::RemoteMediaSourceProxy::duration const): (WebKit::RemoteMediaSourceProxy::buffered const): (WebKit::RemoteMediaSourceProxy::seekToTime): (WebKit::RemoteMediaSourceProxy::monitorSourceBuffers): (WebKit::RemoteMediaSourceProxy::setLogIdentifier): (WebKit::RemoteMediaSourceProxy::failedToCreateRenderer): (WebKit::RemoteMediaSourceProxy::addSourceBuffer): * GPUProcess/media/RemoteMediaSourceProxy.h: Added. * GPUProcess/media/RemoteMediaSourceProxy.messages.in: Added. * GPUProcess/media/RemoteSourceBufferIdentifier.h: Added. * GPUProcess/media/RemoteSourceBufferProxy.cpp: Added. (WebKit::RemoteSourceBufferProxy::create): (WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::~RemoteSourceBufferProxy): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveSample): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasAudio const): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHasVideo const): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateReenqueSamples): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidBecomeReadyForMoreSamples): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateFastSeekTimeForMediaTime): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete): (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError): (WebKit::RemoteSourceBufferProxy::append): * GPUProcess/media/RemoteSourceBufferProxy.h: Added. * GPUProcess/media/RemoteSourceBufferProxy.messages.in: Added. * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: * Scripts/webkit/messages.py: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::load): (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load): Deleted. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: Added. (WebKit::MediaSourcePrivateRemote::create): (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::~MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::addSourceBuffer): (WebKit::MediaSourcePrivateRemote::durationChanged): (WebKit::MediaSourcePrivateRemote::markEndOfStream): (WebKit::MediaSourcePrivateRemote::unmarkEndOfStream): (WebKit::MediaSourcePrivateRemote::readyState const): (WebKit::MediaSourcePrivateRemote::setReadyState): (WebKit::MediaSourcePrivateRemote::waitForSeekCompleted): (WebKit::MediaSourcePrivateRemote::seekCompleted): (WebKit::MediaSourcePrivateRemote::logChannel const): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: Added. * WebProcess/GPU/media/RemoteCDMConfiguration.h: * WebProcess/GPU/media/RemoteCDMInstanceConfiguration.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.h: * WebProcess/GPU/media/RemoteMediaSourceIdentifier.h: Added. * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: Added. (WebKit::SourceBufferPrivateRemote::create): (WebKit::SourceBufferPrivateRemote::SourceBufferPrivateRemote): (WebKit::SourceBufferPrivateRemote::~SourceBufferPrivateRemote): (WebKit::SourceBufferPrivateRemote::setClient): (WebKit::SourceBufferPrivateRemote::append): (WebKit::SourceBufferPrivateRemote::abort): (WebKit::SourceBufferPrivateRemote::resetParserState): (WebKit::SourceBufferPrivateRemote::removedFromMediaSource): (WebKit::SourceBufferPrivateRemote::readyState const): (WebKit::SourceBufferPrivateRemote::setReadyState): (WebKit::SourceBufferPrivateRemote::flush): (WebKit::SourceBufferPrivateRemote::enqueueSample): (WebKit::SourceBufferPrivateRemote::isReadyForMoreSamples): (WebKit::SourceBufferPrivateRemote::setActive): (WebKit::SourceBufferPrivateRemote::notifyClientWhenReadyForMoreSamples): (WebKit::SourceBufferPrivateRemote::canSetMinimumUpcomingPresentationTime const): (WebKit::SourceBufferPrivateRemote::setMinimumUpcomingPresentationTime): (WebKit::SourceBufferPrivateRemote::clearMinimumUpcomingPresentationTime): (WebKit::SourceBufferPrivateRemote::canSwitchToType): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendComplete): (WebKit::SourceBufferPrivateRemote::logChannel const): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: Added. * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: Added. 2020-11-17 Per Arne Vollan [macOS] Perform AX TCC check in the UI process https://bugs.webkit.org/show_bug.cgi?id=218870 Reviewed by Brent Fulgham. On behalf of the WebContent process, perform AX TCC check in the UI process on macOS. This is in preparation of blocking tccd in the WebContent process. No new tests. It has been manually tested that the WebContent process is allowing VoiceOver to perform AX requests with this patch. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::isAXAuthenticated): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::isAXAuthenticatedCallback): (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-17 Brian Burg [Cocoa] _WKInspectorExtensionHost should conform to NSObject protocol https://bugs.webkit.org/show_bug.cgi?id=219035 Reviewed by Alex Christensen. This was overlooked in the initial patch. Without it, we can't call -isEqual: and similar basic methods on a type of id<_WKInspectorExtensionHost>. * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: 2020-11-17 Tim Horton Preemptive build fix for https://bugs.webkit.org/show_bug.cgi?id=219024 * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: (SOFT_LINK_CLASS): (-[WKAirPlayRoutePicker show:fromRect:]): 2020-11-17 Tim Horton REGRESSION (r269824): YouTube media control bar sometimes flickers https://bugs.webkit.org/show_bug.cgi?id=219017 Reviewed by Simon Fraser. Test: compositing/repaint/transparent-layer-repaint.html * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::display): I accidentally lost the Copy composite operator in r269824, causing the repaint copy-forward to blend instead of just copying. This wreaks havoc on layers with contents with colors that have 0 < alpha < 1, because every repaint means the colors intensify. 2020-11-16 Brent Fulgham [macOS] Remove access to the unused AppleIntelMEUserClient IOKit class https://bugs.webkit.org/show_bug.cgi?id=219012 Reviewed by Eric Carlson. Although we originally thought this was needed for H.264 decoding, testing shows that this class is never used in WebKit flows, and is not needed. We should remove it. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-16 Per Arne Vollan [macOS] Create sandbox extension for the power log service on internal installs https://bugs.webkit.org/show_bug.cgi?id=218984 Reviewed by Brent Fulgham. Create a sandbox extension for the WebContent process for the power log service on macOS internal installs. * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::diagnosticServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-16 Sam Weinig Standardize enums that are used by Settings in preperation for autogeneration https://bugs.webkit.org/show_bug.cgi?id=218960 Reviewed by Tim Horton. Update enum uses for renames and scoped syntax use. * UIProcess/API/C/WKAPICast.h: (WebKit::toAPI): (WebKit::toEditableLinkBehavior): (WebKit::toStorageBlockingPolicy): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetEditableLinkBehavior): (WKPreferencesSetStorageBlockingPolicy): (WKPreferencesGetStorageBlockingPolicy): * UIProcess/API/Cocoa/WKPreferences.mm: (toStorageBlockingPolicy): (toAPI): (-[WKPreferences _storageBlockingPolicy]): (-[WKPreferences _setStorageBlockingPolicy:]): (toEditableLinkBehavior): (-[WKPreferences _setEditableLinkBehavior:]): * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::createWithLegacyDefaults): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): (WebKit::WebPage::detectDataInAllFrames): 2020-11-16 John Wilander NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking() redacts the cookie name in log output on customer builds https://bugs.webkit.org/show_bug.cgi?id=218997 Unreviewed minor change to logging. NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking() redacts the cookie name in log output on customer builds. This patch changes the format specifier from %s to %{public}s. Note that this logging is just for ITP Debug Mode which is off by default, logs in-memory only, and is disabled again on browser quit. No new tests. This just changes log output on customer builds. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::applyCookiePolicyForThirdPartyCNAMECloaking): 2020-11-16 Chris Dumez [GPUProcess] Update GPUProcess process assertion based on active WebProcesses https://bugs.webkit.org/show_bug.cgi?id=219002 Reviewed by Simon Fraser. Update GPUProcess process assertion based on active WebProcesses, similarly to what we do for the network process. Previously, we would never release the GPUProcess process assertion and it would time out after 30 seconds in the background. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::updateProcessAssertion): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::updateProcessAssertions): 2020-11-16 Brent Fulgham [macOS] Remove remote tcp capability from WebContent Sandbox https://bugs.webkit.org/show_bug.cgi?id=218999 Reviewed by Per Arne Vollan. Since we have moved all network activity (aside from some syslog use) out of the WebContent process, we do not need the ability to open remote tcp connections. We should deny this capability from our non-Network sandboxes. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-16 Devin Rousso Ignore deprecation warnings for the uniform types C API https://bugs.webkit.org/show_bug.cgi?id=218989 Reviewed by Tim Horton. These should eventually be replaced with the ObjC API `UniformTypeIdentifiers.framework`. See . * Shared/ios/WebIconUtilities.mm: (WebKit::iconForFile): * Shared/mac/PasteboardTypes.mm: (WebKit::PasteboardTypes::forEditing): (WebKit::PasteboardTypes::forSelection): * UIProcess/API/Cocoa/APIAttachmentCocoa.mm: (API::isDeclaredOrDynamicTypeIdentifier): (API::Attachment::mimeType const): (API::Attachment::utiType const): (API::Attachment::setFileWrapperAndUpdateContentType): * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm: (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setPromisedDataForImage): * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView supportedPasteboardTypesForCurrentSelection]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView actionSheetAssistant:performAction:]): * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel currentAvailableActionTitles]): (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]): (-[WKFileUploadPanel showFilePickerMenu]): (-[WKFileUploadPanel showDocumentPickerMenu]): (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]): * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::setupServicesMenu): 2020-11-16 Don Olmstead Non-unified build fixes, mid November 2020 edition https://bugs.webkit.org/show_bug.cgi?id=218911 Unreviewed build fix. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::sendUpdate): 2020-11-16 Per Arne Vollan [macOS] The WebContent sandbox does not apply for open source builds https://bugs.webkit.org/show_bug.cgi?id=218982 Reviewed by Alexey Proskuryakov. The WebContent sandbox does not apply for open source builds on macOS, since it has enabled message filtering, which requires a private entitlement. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-16 Megan Gardner Add menu support for app highlights for books https://bugs.webkit.org/show_bug.cgi?id=218879 Reviewed by Alex Christensen. Add menu items and associated plumbing for support for books highlights in modern WebKit. * FeatureFlags/WebKit.plist: * Shared/API/c/WKContextMenuItemTypes.h: * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm: (WebKit::isFeatureFlagEnabled): * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAppHighlightsEnabled): * Shared/WebPreferencesDefaultValues.h: * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm: * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): 2020-11-16 Trevor Stevenson Add didReceiveResponseForResource to WKWebProcessPlugInLoadDelegate https://bugs.webkit.org/show_bug.cgi?id=218925 Reviewed by Alex Christensen. Expose the callback for didReceiveResponseForResource in WKWebProcessPlugInLoadDelegate for use in the injected bundle. * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: (didReceiveResponseForResource): (setUpResourceLoadClient): 2020-11-16 Carlos Garcia Campos WebDriver: do not focus the main frame when switching to a window https://bugs.webkit.org/show_bug.cgi?id=218383 Reviewed by Brian Burg. The spec doesn't say we should focus the main frame. This is confusing WPT test infrastructure/testdriver/actions/crossOrigin.sub.html that first focuses an input in an iframe and then it send keyboard events to the window (after switching to the window again even when it's already the current one, that causes the iframe focus to be lost). * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::switchToBrowsingContext): * WebProcess/Automation/WebAutomationSessionProxy.cpp: * WebProcess/Automation/WebAutomationSessionProxy.h: * WebProcess/Automation/WebAutomationSessionProxy.messages.in: 2020-11-16 Kimmo Kinnunen Final refactor for WebGL implementation to use only GraphicsContextGL https://bugs.webkit.org/show_bug.cgi?id=218333 Reviewed by Simon Fraser. Change MediaPlayerPrivate to use GraphicsContextGL abstract class instead of GraphicsContextGLOpenGL concrete class, since the calling code is doing the same change. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::copyVideoTextureToPlatformTexture): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 2020-11-16 Devin Rousso [iPad] nhl.com cannot select new video to play while video is playing with desktop UA https://bugs.webkit.org/show_bug.cgi?id=218868 Reviewed by Antoine Quint. The desktop "version" of this site uses custom media controls that don't work well on iOS because they rely on mouse events (which is why it was quirked in r255592). The mobile "version" uses the default/native media controls, so there is no issue. Currently, when tapping on another video with a desktop UA, the site uses its touch event handlers for mouse events. These handlers call `Event.prototype.preventDefault` if the event is not a touch event, meaning that `"click"` is not fired. This prevents new videos from being played. Rather than limit the quirk based on some DOM state (which is fragile if the site changes), just have the entire site default to a mobile UA. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommendedForRequest): 2020-11-16 Zan Dobersek [CoordinatedGraphics] Adjust client resizing, render-scope notifying in ThreadedCompositor::renderLayerTree() https://bugs.webkit.org/show_bug.cgi?id=218701 Reviewed by Carlos Garcia Campos. Rework the client operations in ThreadedCompositor::renderLayerTree() so that client resizing is done before the will-render client notification is dispatched. This ensures everything in the will-render-to-did-render scope is done for a well-specified size from the client's point of view. Similar to this change, the GL viewport update is split from the client resize operation and moved into the aforementioned rendering scope. This change is mostly cosmetic, but it's done to neatly package all the GL operations into that scope. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::renderLayerTree): 2020-11-15 Tim Horton Initial implementation of DOM rendering via the GPU process https://bugs.webkit.org/show_bug.cgi?id=218928 Reviewed by Simon Fraser. * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: (WebKit::RemoteLayerBackingStore::hasFrontBuffer const): (WebKit::RemoteLayerBackingStore::Buffer::operator bool const): * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::decode): (WebKit::RemoteLayerBackingStore::pixelFormat const): (WebKit::RemoteLayerBackingStore::bytesPerPixel const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): (WebKit::RemoteLayerBackingStore::display): (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): (WebKit::RemoteLayerBackingStore::takePendingFlusher): (WebKit::RemoteLayerBackingStore::setBufferVolatility): (WebKit::RemoteLayerBackingStore::Buffer::discard): (WebKit::RemoteLayerBackingStore::drawInContext): Deleted. (WebKit::RemoteLayerBackingStore::takeFrontContextPendingFlush): Deleted. (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): Deleted. Reimplement RemoteLayerBackingStore in terms of ImageBuffer instead of using ShareableBitmap + IOSurface explicitly. We use ConcreteImageBuffer versions of the shareable backends in the WebContent process in the non-GPU-process case, and normal DisplayList-backed RemoteImageBufferProxies in the GPU process case. * UIProcess/ViewSnapshotStore.h: * UIProcess/mac/ViewSnapshotStoreMac.mm: (WebKit::ViewSnapshot::setVolatile): (WebKit::ViewSnapshot::asLayerContents): * WebProcess/GPU/graphics/ImageBufferBackendHandle.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::ThreadSafeRemoteImageBufferFlusher::ThreadSafeRemoteImageBufferFlusher): Add a hack to emulate ThreadSafeRemoteImageBufferFlusher; right now, we'll synchronously flush on the main thread when creating the flusher; a future patch will move this into the flush() method so that RemoteLayerBackingStore can do it on a secondary queue. (WebKit::RemoteImageBufferProxy::createImageBufferBackendHandle): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): (WebKit::WebChromeClient::ensureRemoteRenderingBackendProxy const): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::ensureRemoteRenderingBackendProxy): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::updateRendering): (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::create): (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::BackingStoreFlusher): (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::flush): Reimplement BackingStoreFlusher in terms of the abstract ThreadSafeImageBufferFlusher. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::ensureRemoteRenderingBackendProxy): * WebProcess/WebPage/WebPage.h: Move RemoteRenderingBackendProxy from WebChromeClient to WebPage, so that other non-WebCore clients can use it without having to think about WebChromeClient. 2020-11-14 Zan Dobersek Unreviewed, suppressing GCC compilation warnings. * UIProcess/API/wpe/ScrollGestureController.cpp: (WebKit::ScrollGestureController::handleEvent): Explicitly store the std::abs() results as uint32_t values. This avoids comparison between the otherwise-signed return values and the unsigned constants. 2020-11-13 Sihui Liu Implement basic permission check for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=218476 Reviewed by Youenn Fablet. Introduce SpeechRecognitionPermissionManager, which checks and requests speech recognition permissions before we actually start capturing audio and perform recognition. SpeechRecognitionPermissionManager is per-page, like SpeechRecognitionServer. The checks include: 1. Sandbox requirement for microphone 2. TCC check for microphone 3. TCC check for SFSpeechRecognizer 4. User permission on speech recognition for origin Add a delegate function for requesting user permission. By default, user permission is not granted. API test: WebKit2.SpeechRecognitionUserPermissionPersistence * Headers.cmake: * Shared/API/APIObject.h: * Shared/API/c/WKBase.h: * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIUIClient.h: (API::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): * UIProcess/API/C/WKAPICast.h: * UIProcess/API/C/WKPage.cpp: (WKPageSetPageUIClient): * UIProcess/API/C/WKPageUIClient.h: * UIProcess/API/C/WKSpeechRecognitionPermissionCallback.cpp: Added. (WKSpeechRecognitionPermissionCallbackGetTypeID): (WKSpeechRecognitionPermissionCallbackComplete): * UIProcess/API/C/WKSpeechRecognitionPermissionCallback.h: Added. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _speechRecognitionEnabled]): (-[WKPreferences _setSpeechRecognitionEnabled:]): * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/MediaPermissionUtilities.mm: Added. (WebKit::checkSandboxRequirementForType): (WebKit::checkUsageDescriptionStringForType): (WebKit::checkUsageDescriptionStringForSpeechRecognition): (WebKit::requestAVCaptureAccessForType): (WebKit::checkAVCaptureAccessForType): (WebKit::requestSpeechRecognitionAccess): (WebKit::checkSpeechRecognitionServiceAccess): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::decidePolicyForSpeechRecognitionPermissionRequest): * UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm: (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureAudio): (WebKit::UserMediaPermissionRequestManagerProxy::permittedToCaptureVideo): (WebKit::UserMediaPermissionRequestManagerProxy::requestSystemValidation): (WebKit::requestAVCaptureAccessForMediaType): Deleted. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: * UIProcess/MediaPermissionUtilities.h: Copied from Added. * UIProcess/SpeechRecognitionPermissionManager.cpp: Added. (WebKit::computeMicrophoneAccess): (WebKit::computeSpeechRecognitionServiceAccess): (WebKit::SpeechRecognitionPermissionManager::SpeechRecognitionPermissionManager): (WebKit::SpeechRecognitionPermissionManager::~SpeechRecognitionPermissionManager): (WebKit::SpeechRecognitionPermissionManager::request): (WebKit::SpeechRecognitionPermissionManager::startNextRequest): (WebKit::SpeechRecognitionPermissionManager::startProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::continueProcessingRequest): (WebKit::SpeechRecognitionPermissionManager::completeCurrentRequest): (WebKit::SpeechRecognitionPermissionManager::requestSpeechRecognitionServiceAccess): (WebKit::SpeechRecognitionPermissionManager::requestMicrophoneAccess): (WebKit::SpeechRecognitionPermissionManager::requestUserPermission): * UIProcess/SpeechRecognitionPermissionManager.h: Added. * UIProcess/SpeechRecognitionPermissionRequest.h: Added. (WebKit::SpeechRecognitionPermissionRequest::create): (WebKit::SpeechRecognitionPermissionRequest::complete): (WebKit::SpeechRecognitionPermissionRequest::origin const): (WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest): (WebKit::SpeechRecognitionPermissionCallback::create): (WebKit::SpeechRecognitionPermissionCallback::complete): (WebKit::SpeechRecognitionPermissionCallback::SpeechRecognitionPermissionCallback): * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::requestPermissionForRequest): (WebKit::SpeechRecognitionServer::stop): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::invalidate): (WebKit::SpeechRecognitionServer::handleRequest): (WebKit::SpeechRecognitionServer::stopRequest): (WebKit::SpeechRecognitionServer::abortRequest): (WebKit::SpeechRecognitionServer::sendUpdate): (WebKit::SpeechRecognitionServer::processNextPendingRequestIfNeeded): Deleted. (WebKit::SpeechRecognitionServer::removePendingRequest): Deleted. (WebKit::SpeechRecognitionServer::startPocessingRequest): Deleted. (WebKit::SpeechRecognitionServer::stopProcessingRequest): Deleted. * UIProcess/SpeechRecognitionServer.h: * UIProcess/SpeechRecognitionServer.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didChangeMainDocument): (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::requestSpeechRecognitionPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: (WebKit::WebSpeechRecognitionConnection::start): (WebKit::WebSpeechRecognitionConnection::didReceiveUpdate): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: 2020-11-13 Chris Dumez [GPUProcess] Add basic GPUProcess crash handling for canvas https://bugs.webkit.org/show_bug.cgi?id=218924 Reviewed by Simon Fraser. Update RemoteRenderingBackendProxy to be a GPUProcessConnection::Client so that it gets notified when the IPC connection to the GPUProcess gets severed. When this happens, RemoteRenderingBackendProxy clears all its SharedMemory handles and sends IPC messages to the GPU process to recreate all the ImageBuffers we had. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): (WebKit::RemoteImageBufferProxy::clearBackend): (WebKit::RemoteImageBufferProxy::size const): (WebKit::RemoteImageBufferProxy::renderingMode const): (WebKit::RemoteImageBufferProxy::colorSpace const): (WebKit::RemoteImageBufferProxy::pixelFormat const): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy): (WebKit::RemoteRenderingBackendProxy::connectToGPUProcess): (WebKit::recreateImage): (WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose): (WebKit::RemoteRenderingBackendProxy::createImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: (WebKit::RemoteResourceCacheProxy::imageBuffers const): 2020-11-13 Chris Dumez [GPUProcess] Add basic low memory handling in the GPUProcess https://bugs.webkit.org/show_bug.cgi?id=218926 Reviewed by Geoffrey Garen. Add basic low memory handling in the GPUProcess. For now, the GPUProcess only calls WTF::releaseFastMallocFreeMemory() on low memory warning. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): 2020-11-13 Kate Cheney Can't login to Microsoft Teams https://bugs.webkit.org/show_bug.cgi?id=218778 Reviewed by John Wilander. This is a temporary quirk to assist a high-traffic website while they complete the large task of migrating away from login flows that require third party cookies. This quirk will be removed when the site is updated. Create a quirk to call the Storage Access API on behalf of Microsoft. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): Relax the requirement for user interaction for a specific third party needing cookies for authentication purposes. (WebKit::ResourceLoadStatisticsDatabaseStore::clear): (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess): Relax the requirement for user interaction for a specific third party needing cookies for authentication purposes. (WebKit::ResourceLoadStatisticsDatabaseStore::domainsWithStorageAccess const): (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: (WebKit::ResourceLoadStatisticsMemoryStore::clear): (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral): Relax user interaction for reasons above. (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: (WebKit::RegistrableDomainsToBlockCookiesFor::isolatedCopy const): * Shared/WebProcessDataStoreParameters.h: (WebKit::WebProcessDataStoreParameters::encode const): (WebKit::WebProcessDataStoreParameters::decode): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setDomainsWithCrossPageStorageAccess): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::webProcessDataStoreParameters): (WebKit::WebProcessPool::setDomainsWithCrossPageStorageAccess): * UIProcess/WebProcessPool.h: * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::hasCrossPageStorageAccess const): (WebKit::WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess): * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setWebsiteDataStoreParameters): (WebKit::WebProcess::setDomainsWithCrossPageStorageAccess): Add quirk'd domains to have page level storage access to be able to use document.cookie. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: Forward domains with the storage access quirk to the web process to avoid an async call to the network process. 2020-11-13 Sam Weinig Move some more WebKit and WebKitLegacy preferences bound to Settings to WebPreferences.yaml https://bugs.webkit.org/show_bug.cgi?id=218914 Reviewed by Tim Horton. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::appleMailPaginationQuirkEnabled): Deleted. (WebKit::WebPageProxy::appleMailLinesClampEnabled): Deleted. Removes appleMailPaginationQuirkEnabled and appleMailLinesClampEnabled. appleMailPaginationQuirkEnabled is now handled via the preferences infrastructure and appleMailLinesClampEnabled was unused. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAppleMailPaginationQuirkEnabled): * Shared/WebPreferencesDefaultValues.h: Adds default value for AppleMailPaginationQuirkEnabled, which is now in WebPreferences.yaml. Moved from WebPageProxyMac.mm * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Removes explicit setting of setAppleMailPaginationQuirkEnabled, setContentDispositionAttachmentSandboxEnabled, setScrollingPerformanceLoggingEnabled and setUseImageDocumentForSubframePDF which are all generated now. LayoutViewportHeightExpansionFactor was already generated so this call was just redundant. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::setScrollingPerformanceLoggingEnabled): Deleted. It's also no longer necessary to store m_scrollingPerformanceLoggingEnabled as the value can be extracted directly from the store in the one place it was read. setScrollingPerformanceLoggingEnabled was never called, so has been removed. * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updatePreferences): Extract scrollingPerformanceLoggingEnabled directly from the store rather than having the page set it just for this one place to read it. 2020-11-13 Geoffrey Garen Removed DeferrableTaskTimer https://bugs.webkit.org/show_bug.cgi?id=218874 Reviewed by Chris Dumez. It was (mostly) redundant. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateReportedMediaCaptureState): * UIProcess/WebPageProxy.h: Use WTF::RunLoop::Timer instead of WebCore::Timer because WebCore::Timer for WebKit code in the UI process is a no-no, which can crash if the UI process also uses WebThread. 2020-11-13 Per Arne Vollan [macOS] Issue sandbox extension to the WebContent process for com.apple.lskdd https://bugs.webkit.org/show_bug.cgi?id=218920 Reviewed by Geoffrey Garen. This is a Media related service, and a sandbox extension should be issued to the WebContent process based on GPU runtime settings. No new tests, covered by existing tests. * UIProcess/WebPageProxy.cpp: (WebKit::mediaRelatedMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-13 Claudio Saavedra Non-unified build fixes. https://bugs.webkit.org/show_bug.cgi?id=218905 Unreviewed. * GPUProcess/graphics/RemoteRenderingBackend.cpp: * GPUProcess/graphics/RemoteResourceCache.h: 2020-11-13 Alex Christensen Remove more SecItemShim leftovers https://bugs.webkit.org/show_bug.cgi?id=218919 Reviewed by Geoffrey Garen. * Configurations/SecItemShim.xcconfig: Removed. * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkServiceEntryPoint.mm: (NETWORK_SERVICE_INITIALIZER): * PlatformMac.cmake: * WebKit.xcodeproj/project.pbxproj: 2020-11-12 Darin Adler Remove unused advanced plug-in features: snapshotting and plug-in load policy https://bugs.webkit.org/show_bug.cgi?id=218835 Reviewed by Tim Horton. * PluginProcess/mac/PluginProcessMac.mm: (WebKit::muteAudio): Deleted. (WebKit::PluginProcess::platformInitializePluginProcess): * Scripts/webkit/messages.py: Remove PluginProcessType. * Shared/Plugins/PluginProcessAttributes.h: Ditto. * Shared/Plugins/PluginProcessCreationParameters.cpp: (WebKit::PluginProcessCreationParameters::encode const): Ditto. (WebKit::PluginProcessCreationParameters::decode): Ditto. * Shared/Plugins/PluginProcessCreationParameters.h: Ditto. * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): Remove plugInAutoStartOrigins and pluginLoadClientPolicies. (WebKit::WebProcessCreationParameters::decode): Ditto. * Shared/WebProcessCreationParameters.h: Ditto. * Shared/WebProcessDataStoreParameters.h: (WebKit::WebProcessDataStoreParameters::encode const): Remove plugInAutoStartOriginHashes. (WebKit::WebProcessDataStoreParameters::decode): Ditto. * Sources.txt: Remove PlugInAutoStartProvider.cpp and WebPlugInClient.cpp. * UIProcess/API/C/WKContext.cpp: (WKContextCopyPlugInAutoStartOriginHashes): Return nullptr. (WKContextSetPlugInAutoStartOriginHashes): Do nothing. (WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime): Ditto. (WKContextSetPlugInAutoStartOrigins): Ditto. * UIProcess/API/C/WKPage.cpp: (WKPageSetPageNavigationClient): Remove decidePolicyForPluginLoad. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetPlugInSnapshottingEnabled): Do nothing. (WKPreferencesGetPlugInSnapshottingEnabled): Return false. (WKPreferencesSetSnapshotAllPlugIns): Do nothing. (WKPreferencesGetSnapshotAllPlugIns): Return false. (WKPreferencesSetAutostartOriginPlugInSnapshottingEnabled): Do nothing. (WKPreferencesGetAutostartOriginPlugInSnapshottingEnabled): Return false. (WKPreferencesSetPrimaryPlugInSnapshotDetectionEnabled): Do nothing. (WKPreferencesGetPrimaryPlugInSnapshotDetectionEnabled): Return false. * UIProcess/API/C/mac/WKContextPrivateMac.mm: (WKContextIsPlugInUpdateAvailable): Return false. (WKContextSetPluginLoadClientPolicy): Do nothing. (WKContextClearPluginClientPolicies): Do nothing. * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _setPlugInSnapshottingEnabled:]): Do nothing. (-[WKPreferences _plugInSnapshottingEnabled]): Return NO. * UIProcess/API/Cocoa/WKProcessPool.mm: (toPluginLoadClientPoliciesHashMap): Deleted. (policiesHashMapToDictionary): Deleted. (-[WKProcessPool _resetPluginLoadClientPolicies:]): Do nothing. (-[WKProcessPool _pluginLoadClientPolicies]): Return an empty dictionary. * UIProcess/Cocoa/NavigationState.h: Remove didFailToInitializePlugIn, didBlockInsecurePluginVersion, decidePolicyForPluginLoad, webViewDidFailToInitializePlugInWithInfo, webViewDidBlockInsecurePluginVersionWithInfo, and webViewDecidePolicyForPluginLoadWithCurrentPolicyPluginInfoCompletionHandler. * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::setNavigationDelegate): Updated for abvoe removals. (WebKit::NavigationState::NavigationClient::didFailToInitializePlugIn): Deleted. (WebKit::NavigationState::NavigationClient::didBlockInsecurePluginVersion): Deleted. (WebKit::pluginModuleLoadPolicy): Deleted. (WebKit::wkPluginModuleLoadPolicy): Deleted. (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad): Deleted. * UIProcess/Plugins/PlugInAutoStartProvider.cpp: Removed. * UIProcess/Plugins/PlugInAutoStartProvider.h: Removed. * UIProcess/Plugins/PluginProcessManager.cpp: (WebKit::PluginProcessManager::pluginProcessToken): Removed the pluginProcessType argument. (WebKit::PluginProcessManager::fetchWebsiteData): Ditto. (WebKit::PluginProcessManager::deleteWebsiteData): Ditto. (WebKit::PluginProcessManager::deleteWebsiteDataForHostNames): Ditto. * UIProcess/Plugins/PluginProcessManager.h: Ditto. * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::didFinishLaunching): Removed the code to handle PluginProcessType::Snapshot. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::findPlugin): Removed the processType argument. * UIProcess/WebPageProxy.h: Ditto. * UIProcess/WebPageProxy.messages.in: Ditto. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::webProcessDataStoreParameters): Removed plugInAutoStartOriginHashes. (WebKit::WebProcessPool::initializeNewWebProcess): Removed plugInAutoStartOrigins and pluginLoadClientPolicies. (WebKit::WebProcessPool::plugInAutoStartOriginHashes const): Deleted. (WebKit::WebProcessPool::setPlugInAutoStartOriginHashes): Deleted. (WebKit::WebProcessPool::setPlugInAutoStartOrigins): Deleted. (WebKit::WebProcessPool::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime): Deleted. (WebKit::WebProcessPool::setPluginLoadClientPolicy): Deleted. (WebKit::WebProcessPool::resetPluginLoadClientPolicies): Deleted. (WebKit::WebProcessPool::clearPluginClientPolicies): Deleted. * UIProcess/WebProcessPool.h: Removed setPluginLoadClientPolicy, resetPluginLoadClientPolicies, clearPluginClientPolicies, pluginLoadClientPolicies, plugInAutoStartOriginHashes, setPlugInAutoStartOriginHashes, setPlugInAutoStartOrigins, setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime, plugInAutoStartProvider, m_plugInAutoStartProvider, and m_pluginLoadClientPolicies. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addPlugInAutoStartOriginHash): Deleted. (WebKit::WebProcessProxy::plugInDidReceiveUserInteraction): Deleted. * UIProcess/WebProcessProxy.h: Ditto. * UIProcess/WebProcessProxy.messages.in: Ditto. * WebKit.xcodeproj/project.pbxproj: Removed PlugInAutoStartProvider.cpp/h and WebPlugInClient.cpp/h. * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: Removed include of RenderSnapshottedPlugIn.h. * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm: (WebKit::PluginProxy::pluginLayer): Removed code to handle m_isRestartedProcess. * WebProcess/Plugins/PDF/PDFPlugin.h: Removed shouldAlwaysAutoStart. * WebProcess/Plugins/Plugin.h: Ditto. * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::create): Removed isRestartedProcess argument. (WebKit::PluginProxy::PluginProxy): Ditto. Also moved initialization to the class definition. * WebProcess/Plugins/PluginProxy.h: Updated for the above changes. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::PluginView): Removed m_pluginSnapshotTimer. (WebKit::PluginView::recreateAndInitialize): Removed code to manage m_pluginSnapshotTimer. (WebKit::PluginView::initializePlugin): Removed code to set m_didPlugInStartOffScreen. (WebKit::PluginView::didInitializePlugin): Removed code to handle restarting plug-ins. (WebKit::PluginView::paint): Ditto. (WebKit::PluginView::handleEvent): Removed calls to pluginDidReceiveUserInteraction. (WebKit::PluginView::shouldNotAddLayer const): Return false. (WebKit::PluginView::invalidateRect): Removed code to handle restarting plug-ins. (WebKit::PluginView::isAcceleratedCompositingEnabled): Removed some Flash-specific code. (WebKit::isAlmostSolidColor): Deleted. (WebKit::PluginView::pluginSnapshotTimerFired): Deleted. (WebKit::PluginView::beginSnapshottingRunningPlugin): Deleted. (WebKit::PluginView::shouldAlwaysAutoStart const): Deleted. (WebKit::PluginView::pluginDidReceiveUserInteraction): Deleted. * WebProcess/Plugins/PluginView.h: Removed pluginSnapshotTimerFired, pluginDidReceiveUserInteraction, shouldAlwaysAutoStart, beginSnapshottingRunningPlugin, m_didPlugInStartOffScreen, m_pluginSnapshotTimer, m_countSnapshotRetries, m_didReceiveUserInteraction. * WebProcess/Plugins/WebPluginInfoProvider.cpp: (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy): Deleted. (WebKit::WebPluginInfoProvider::clearPluginClientPolicies): Deleted. (WebKit::WebPluginInfoProvider::populatePluginCache): Do not call pluginLoadClientPolicyForHost. (WebKit::WebPluginInfoProvider::pluginLoadClientPolicyForHost const): Deleted. (WebKit::WebPluginInfoProvider::longestMatchedWildcardHostForHost const): Deleted. (WebKit::WebPluginInfoProvider::replaceHostWithMatchedWildcardHost const): Deleted. * WebProcess/Plugins/WebPluginInfoProvider.h: Removed setPluginLoadClientPolicy, clearPluginClientPolicies, pluginLoadClientPolicyForHost, longestMatchedWildcardHostForHost, replaceHostWithMatchedWildcardHost, PluginLoadClientPoliciesByBundleVersion, PluginPolicyMapsByIdentifier, and m_hostsToPluginIdentifierData. * WebProcess/WebCoreSupport/WebPlugInClient.cpp: Removed. * WebProcess/WebCoreSupport/WebPlugInClient.h: Removed. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): Removed code to initialize m_determinePrimarySnapshottedPlugInTimer, plugInClient, and processType. (WebKit::WebPage::createPlugin): Removed isRestartedProcess. (WebKit::WebPage::close): Removed m_determinePrimarySnapshottedPlugInTimer code. (WebKit::WebPage::addPluginView): Ditto. (WebKit::WebPage::removePluginView): Ditto. (WebKit::WebPage::canPluginHandleResponse): Removed plug-in process type. (WebKit::WebPage::didCommitLoad): Removed call to resetPrimarySnapshottedPlugIn. (WebKit::WebPage::didFinishLoad): Removed m_determinePrimarySnapshottedPlugInTimer code. (WebKit::WebPage::determinePrimarySnapshottedPlugInTimerFired): Deleted. (WebKit::WebPage::determinePrimarySnapshottedPlugIn): Deleted. (WebKit::WebPage::resetPrimarySnapshottedPlugIn): Deleted. (WebKit::WebPage::matchesPrimaryPlugIn const): Deleted. (WebKit::WebPage::plugInIntersectsSearchRect): Deleted. (WebKit::WebPage::plugInIsPrimarySize): Deleted. * WebProcess/WebPage/WebPage.h: Removed determinePrimarySnapshottedPlugIn, determinePrimarySnapshottedPlugInTimerFired, resetPrimarySnapshottedPlugIn, matchesPrimaryPlugIn, plugInIntersectsSearchRect, plugInIsPrimarySize, m_readyToFindPrimarySnapshottedPlugin, m_didFindPrimarySnapshottedPlugin, m_numberOfPrimarySnapshotDetectionAttempts, m_primaryPlugInPageOrigin, m_primaryPlugInOrigin, m_primaryPlugInMimeType, and m_determinePrimarySnapshottedPlugInTimer. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): Removed code to set m_plugInAutoStartOrigins and call to resetPluginLoadClientPolicies. (WebKit::WebProcess::setWebsiteDataStoreParameters): Removed call to resetPlugInAutoStartOriginHashes. (WebKit::addCaseFoldedCharacters): Deleted. (WebKit::hashForPlugInOrigin): Deleted. (WebKit::WebProcess::isPlugInAutoStartOriginHash): Deleted. (WebKit::WebProcess::shouldPlugInAutoStartFromOrigin): Deleted. (WebKit::WebProcess::plugInDidStartFromOrigin): Deleted. (WebKit::WebProcess::didAddPlugInAutoStartOriginHash): Deleted. (WebKit::WebProcess::resetPlugInAutoStartOriginHashes): Deleted. (WebKit::WebProcess::plugInDidReceiveUserInteraction): Deleted. (WebKit::WebProcess::setPluginLoadClientPolicy): Deleted. (WebKit::WebProcess::resetPluginLoadClientPolicies): Deleted. (WebKit::WebProcess::clearPluginClientPolicies): Deleted. * WebProcess/WebProcess.h: Removed shouldPlugInAutoStartFromOrigin, plugInDidStartFromOrigin, plugInDidReceiveUserInteraction, setPluginLoadClientPolicy, resetPluginLoadClientPolicies, clearPluginClientPolicies, isPlugInAutoStartOriginHash, didAddPlugInAutoStartOriginHash, resetPlugInAutoStartOriginHashes, m_plugInAutoStartOriginHashes, and m_plugInAutoStartOrigins. * WebProcess/WebProcess.messages.in: Removed DidAddPlugInAutoStartOriginHash, ResetPlugInAutoStartOriginHashes, SetPluginLoadClientPolicy, ResetPluginLoadClientPolicies, and ClearPluginClientPolicies. 2020-11-12 Simon Fraser Force wheel event listeners on the root to be passive https://bugs.webkit.org/show_bug.cgi?id=218842 Reviewed by Chris Dumez. Following Blink (https://www.chromestatus.com/feature/6662647093133312) force 'wheel' and 'mousewheel' event listeners on root objects (window, document and body) to be passive if they were not explicitly registered as non-passive. This behavior is controlled by an experimental feature flag, and a linked-on-or-after check to avoid changing behavior for apps that embed WebKit until they link against new SDKs. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultCSSOMViewScrollingAPIEnabled): (WebKit::defaultPassiveWheelListenersAsDefaultOnDocument): * Shared/WebPreferencesDefaultValues.h: 2020-11-13 Eric Carlson Add _STAttributionDisplayName to macOS WebContent Info.plist https://bugs.webkit.org/show_bug.cgi?id=218900 Reviewed by Youenn Fablet. * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist: 2020-11-13 Miguel Gomez [GTK][WPE] CSS backdrop overlay corners are not rounded on results.webkit.org https://bugs.webkit.org/show_bug.cgi?id=215445 Reviewed by Carlos Garcia Campos. Pass the backdropFiltersRect from the state to TextureMapperLayer. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::updateSceneState): 2020-11-13 Kimmo Kinnunen Remove SecItemShim.dylib from network service link https://bugs.webkit.org/show_bug.cgi?id=218892 Reviewed by Antti Koivisto. Fixes a build failure after https://bugs.webkit.org/show_bug.cgi?id=218862 * Configurations/NetworkService.xcconfig: 2020-11-12 Youenn Fablet Add infrastructure for WebRTC transforms https://bugs.webkit.org/show_bug.cgi?id=218750 Reviewed by Eric Carlson. Remove no longer needed const casting. * Configurations/WebKit.xcconfig: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::completedEncoding): 2020-11-12 Alex Christensen Remove SecItemShim.dylib https://bugs.webkit.org/show_bug.cgi?id=218862 Reviewed by Alexey Proskuryakov. This is dead code since r269697. * Shared/mac/SecItemShim.cpp: * WebKit.xcodeproj/project.pbxproj: * WebProcess/mac/SecItemShimLibrary.h: Removed. * WebProcess/mac/SecItemShimLibrary.mm: Removed. 2020-11-12 Tim Horton canvas-createPattern-video-modify-crash-log.txt asserts on debug GPUProcess bots https://bugs.webkit.org/show_bug.cgi?id=218872 Reviewed by Simon Fraser. * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::create): This assertion is wrong; make it the same as the one in ImageBufferCGBitmapBackend. 2020-11-12 Said Abou-Hallawa [GPU Process] GraphicsContext::drawPattern() should take a NativeImage argument https://bugs.webkit.org/show_bug.cgi?id=218865 Reviewed by Simon Fraser. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-12 Per Arne Vollan [iOS] IOKit sandbox violation when enabling all GPU runtime flags https://bugs.webkit.org/show_bug.cgi?id=218820 Reviewed by Brent Fulgham. When enabling all GPU runtime flags on iOS, there is an iokit-open sandbox violation for the IOKit class AGXDeviceUserClient in the WebContent process. When all GPU runtime flags are enabled, IOKit extensions are not provided to the WebContent process, which should then fall back to a set of rules allowing use of these IOKit classes, with logging. There seems to be a problem with the fallback for this specific IOKit class, which this patch addresses by adding an extra requirement to the rule. The extra requirement is that IOKit extensions have not been provided for these IOKit classes. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-11-12 Chris Dumez [GPUProcess] Add basic GPUProcess crash handling for media playback https://bugs.webkit.org/show_bug.cgi?id=218825 Reviewed by Eric Carlson. When the GPU process crashes and there are pending media players, we now relaunch the GPU process and ask those media players to reconstuct their private media players, reload the file and resume playback if necessary. This ensures that in case of a GPU process crash while the user is playing a video, the video just seamlessly keeps playing from where it was before the crash. Before this patch, we would end up busy looping and the WebContent process would use 100% CPU after a GPU process crash. * WebProcess/GPU/GPUProcessConnection.h: (WebKit::GPUProcessConnection::addClient): (WebKit::GPUProcessConnection::removeClient): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::proxyConfigurationForPlayer): (WebKit::RemoteMediaPlayerManager::gpuProcessConnection const): (WebKit::RemoteMediaPlayerManager::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteMediaPlayerManager.h: 2020-11-12 Chris Dumez ASSERTION FAILED: isValidIdentifier(m_identifier) seen with TestWebKitAPI.GPUProcess.WebProcessTerminationAfterTooManyGPUProcessCrashes https://bugs.webkit.org/show_bug.cgi?id=218856 Reviewed by Tim Horton. The API test is repeatedly killing the GPU process. As a result, it is possible for the GPUProcess to crash while RemoteAudioDestinationProxy::connectToGPUProcess() is in the middle of its RemoteAudioDestinationManager::CreateAudioDestination() synchronous IPC. The function would fail to check if the IPC was successful and proceed with an invalid destinationID in such cases, causing the crash. We now check if the sendSync() was successful. If it wasn't we now log an error and return early. RemoteAudioDestinationManager::gpuProcessConnectionDidClose() will get called later on to notify us that the GPU Process crashed and it will call connectToGPUProcess() again. No new tests, covered by existing API test that is flakily crashing. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): 2020-11-12 Youenn Fablet WebProcess should process WebRTC codecs IPC messages from the GPU Process in a background thread https://bugs.webkit.org/show_bug.cgi?id=218790 Reviewed by Eric Carlson. Use a WorkQueue to process GPU WebRTC codec IPC messages. For that reason, handle encoder and decoder map within that queue. Covered by existing tests. * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::setEncodeRates): * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::dispatchMessage): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::~LibWebRTCCodecs): (WebKit::LibWebRTCCodecs::setConnection): (WebKit::LibWebRTCCodecs::createDecoder): (WebKit::LibWebRTCCodecs::releaseDecoder): (WebKit::LibWebRTCCodecs::failedDecoding): (WebKit::LibWebRTCCodecs::completedDecoding): (WebKit::LibWebRTCCodecs::createEncoder): (WebKit::LibWebRTCCodecs::releaseEncoder): (WebKit::LibWebRTCCodecs::initializeEncoder): (WebKit::LibWebRTCCodecs::setEncodeRates): (WebKit::LibWebRTCCodecs::completedEncoding): (WebKit::LibWebRTCCodecs::dispatchToThread): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: 2020-11-12 Diego Pino Garcia [GTK] Unreviewed, non-unified build fix. * WebProcess/Gamepad/WebGamepadProvider.cpp: Add missing Logging.h header. 2020-11-12 Zalan Bujtas Show legacy line layout visual coverage instead of "simple line" layout. https://bugs.webkit.org/show_bug.cgi?id=218695 Reviewed by Antti Koivisto. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetLegacyLineLayoutVisualCoverageEnabled): (WKPreferencesGetLegacyLineLayoutVisualCoverageEnabled): (WKPreferencesSetSimpleLineLayoutDebugBordersEnabled): Deleted. (WKPreferencesGetSimpleLineLayoutDebugBordersEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _legacyLineLayoutVisualCoverageEnabled]): (-[WKPreferences _setLegacyLineLayoutVisualCoverageEnabled:]): (-[WKPreferences _simpleLineLayoutDebugBordersEnabled]): Deleted. (-[WKPreferences _setSimpleLineLayoutDebugBordersEnabled:]): Deleted. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2020-11-12 Said Abou-Hallawa [GPU Process] Implement DisplayList::ClipToImageBuffer item https://bugs.webkit.org/show_bug.cgi?id=218843 Reviewed by Tim Horton. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-12 Zan Dobersek Unreviewed follow-up to r268965. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_get_enable_accelerated_2d_canvas): Use the FALSE identifier, following GLib styling guidelines. 2020-11-12 Alexander Mikhaylenko [GTK] Swipe navigation shadow is blurry on hidpi https://bugs.webkit.org/show_bug.cgi?id=218800 Reviewed by Carlos Garcia Campos. * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::createElementPattern): Scale surface size and set its scale factor. (WebKit::ViewGestureController::beginSwipeGesture): Pass scale factor to createElementPattern(). 2020-11-11 Brian Burg REGRESSION(r267411): Unable to "Start Element Selection" with Web Inspector closed https://bugs.webkit.org/show_bug.cgi?id=218838 Reviewed by Devin Rousso. The inspector side of the connection between WebInspector (inspected WebProcess) and WebInspectorUI (inspector WebProcess) was mistakenly removed in r267411. Revert those changes. Without a valid frontend connection, WebInspector cannot forward some IPC messages to WebInspectorUI including StartElementSelection. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::updateConnection): (WebKit::WebInspectorUI::closeWindow): * WebProcess/Inspector/WebInspectorUI.h: 2020-11-11 Said Abou-Hallawa [GPU Process] Delete the DisplayList items: DrawImage and DrawTiledImage https://bugs.webkit.org/show_bug.cgi?id=218839 Reviewed by Tim Horton. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-11 Chris Dumez Add RunLoop::Timer constructor taking in a WTF::Function https://bugs.webkit.org/show_bug.cgi?id=218828 Reviewed by Darin Adler. Use the new RunLoop::Timer constructor to simplify the code a bit. * UIProcess/WebProcessPool.cpp: (WebKit::m_resetGPUProcessCrashCountTimer): * UIProcess/WebProcessPool.h: 2020-11-11 John Wilander PCM: Change from ad-click-attribution to private-click-measurement (in all forms, including .well-known URL) https://bugs.webkit.org/show_bug.cgi?id=218730 Reviewed by Alex Christensen. Change to the official name of the proposed standard Private Click Measurement https://github.com/privacycg/private-click-measurement. This includes a change of the reporting URL from "/.well-known/ad-click-attribution/" to "/.well-known/private-click-measurement/". * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::storePrivateClickMeasurement): (WebKit::NetworkProcess::dumpPrivateClickMeasurement): (WebKit::NetworkProcess::clearPrivateClickMeasurement): (WebKit::NetworkProcess::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::NetworkProcess::setPrivateClickMeasurementConversionURLForTesting): (WebKit::NetworkProcess::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkProcess::setAdClickAttributionDebugMode): Deleted. (WebKit::NetworkProcess::storeAdClickAttribution): Deleted. (WebKit::NetworkProcess::dumpAdClickAttribution): Deleted. (WebKit::NetworkProcess::clearAdClickAttribution): Deleted. (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::storePrivateClickMeasurement): (WebKit::NetworkSession::handlePrivateClickMeasurementConversion): (WebKit::NetworkSession::dumpPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurementForRegistrableDomain): (WebKit::NetworkSession::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::NetworkSession::setPrivateClickMeasurementConversionURLForTesting): (WebKit::NetworkSession::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkSession::storeAdClickAttribution): Deleted. (WebKit::NetworkSession::handleAdClickAttributionConversion): Deleted. (WebKit::NetworkSession::dumpAdClickAttribution): Deleted. (WebKit::NetworkSession::clearAdClickAttribution): Deleted. (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain): Deleted. (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting): Deleted. * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: Renamed from Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp. (WebKit::PrivateClickMeasurementManager::storeUnconverted): (WebKit::PrivateClickMeasurementManager::handleConversion): (WebKit::PrivateClickMeasurementManager::startTimer): (WebKit::PrivateClickMeasurementManager::convert): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::firePendingConversionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::setConversionURLForTesting): (WebKit::PrivateClickMeasurementManager::markAllUnconvertedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::debugModeEnabled const): * NetworkProcess/PrivateClickMeasurementManager.h: Renamed from Source/WebKit/NetworkProcess/AdClickAttributionManager.h. (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): (WebKit::PrivateClickMeasurementManager::m_sessionID): (WebKit::PrivateClickMeasurementManager::setPingLoadFunction): (WebKit::PrivateClickMeasurementManager::setOverrideTimerForTesting): * Platform/Logging.h: * Shared/NavigationActionData.cpp: (WebKit::NavigationActionData::encode const): (WebKit::NavigationActionData::decode): * Shared/NavigationActionData.h: * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::ownerProcess): * Shared/WebsiteData/WebsiteDataType.h: * Sources.txt: * UIProcess/API/APINavigation.h: (API::Navigation::privateClickMeasurement const): (API::Navigation::adClickAttribution const): Deleted. * UIProcess/API/C/WKPage.cpp: (WKPageDumpPrivateClickMeasurement): (WKPageClearPrivateClickMeasurement): (WKPageSetPrivateClickMeasurementOverrideTimerForTesting): (WKPageSetPrivateClickMeasurementConversionURLForTesting): (WKPageMarkPrivateClickMeasurementsAsExpiredForTesting): (WKPageDumpAdClickAttribution): Deleted. (WKPageClearAdClickAttribution): Deleted. (WKPageSetAdClickAttributionOverrideTimerForTesting): Deleted. (WKPageSetAdClickAttributionConversionURLForTesting): Deleted. (WKPageMarkAdClickAttributionsAsExpiredForTesting): Deleted. * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreClearPrivateClickMeasurementsThroughWebsiteDataRemoval): (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm: (dataTypesToString): _WKWebsiteDataTypeAdClickAttributions still supported. _WKWebsiteDataTypePrivateClickMeasurements added. * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h: (WebKit::toWebsiteDataType): _WKWebsiteDataTypeAdClickAttributions still supported and mapped to WebsiteDataType::PrivateClickMeasurements. (WebKit::toWKWebsiteDataTypes): * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: _WKWebsiteDataTypeAdClickAttributions still supported. _WKWebsiteDataTypePrivateClickMeasurements added. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: _WKWebsiteDataTypeAdClickAttributions still supported. _WKWebsiteDataTypePrivateClickMeasurements added. (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::setDeveloperPreferenceOverride): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcessProxy::setAdClickAttributionDebugMode): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::dumpPrivateClickMeasurement): (WebKit::WebPageProxy::clearPrivateClickMeasurement): (WebKit::WebPageProxy::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::WebPageProxy::setPrivateClickMeasurementConversionURLForTesting): (WebKit::WebPageProxy::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::WebPageProxy::dumpAdClickAttribution): Deleted. (WebKit::WebPageProxy::clearAdClickAttribution): Deleted. (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setPrivateClickMeasurementDebugMode): (WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 2020-11-11 Peng Liu Update RemoteMediaPlayerMIMETypeCache to add the support for AVFoundationMSE media engine https://bugs.webkit.org/show_bug.cgi?id=218788 Reviewed by Eric Carlson. Originally, `RemoteMediaPlayerMIMETypeCache` inherits from `MIMETypeCache`. It needs to implement three functions: `isAvailable()`, `canDecodeExtendedType()`, `supportedTypes()` through IPC messages, and the IPC message receivers in `RemoteMediaPlayerManagerProxy` needs to repeat the work done by `AVAssetMIMETypeCache` and `AVStreamDataParserMIMETypeCache`. Actually, `MediaPlayerRemoteFactory` only needs two functions from `RemoteMediaPlayerMIMETypeCache`: `supportedTypes()` and `supportsTypeAndCodecs()`. We can implement these two functions with IPC messages to `RemoteMediaPlayerManagerProxy` and cache the results to avoid too many IPC messages. In addition, the implementation of the IPC message receivers in `RemoteMediaPlayerManagerProxy` can reuse the implementation of `AVAssetMIMETypeCache` and `AVStreamDataParserMIMETypeCache`. * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::supportsTypeAndCodecs): (WebKit::RemoteMediaPlayerManagerProxy::canDecodeExtendedType): Deleted. * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in: * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/GPU/media/RemoteCDMInstanceSession.cpp: * WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp: (WebKit::RemoteMediaPlayerMIMETypeCache::addSupportedTypes): (WebKit::RemoteMediaPlayerMIMETypeCache::supportedTypes): (WebKit::RemoteMediaPlayerMIMETypeCache::supportsTypeAndCodecs): (WebKit::RemoteMediaPlayerMIMETypeCache::mimeCache const): Deleted. (WebKit::RemoteMediaPlayerMIMETypeCache::staticContainerTypeList): Deleted. (WebKit::RemoteMediaPlayerMIMETypeCache::isUnsupportedContainerType): Deleted. (WebKit::RemoteMediaPlayerMIMETypeCache::canDecodeExtendedType): Deleted. (WebKit::RemoteMediaPlayerMIMETypeCache::initializeCache): Deleted. * WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.h: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::getSupportedTypes): (RemoteMediaPlayerManager::initialize): 2020-11-11 Tim Horton Add minimal support for deep color IOSurface backing store to ImageBuffer https://bugs.webkit.org/show_bug.cgi?id=218816 Reviewed by Simon Fraser. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::create): (WebKit::RemoteImageBuffer::RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackend::createImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::bytesPerPixel const): (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::create): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _takeViewSnapshot]): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::create): (WebKit::ImageBufferShareableBitmapBackend::ImageBufferShareableBitmapBackend): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::createBackend): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableIOSurfaceBackend::create): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-11-11 Wenson Hsieh Add system trace points for the GPU process display list processing loop https://bugs.webkit.org/show_bug.cgi?id=218824 Reviewed by Simon Fraser. Capture the time spent applying display list items in the GPU process with a pair of new trace points, to aid performance debugging and analysis. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): 2020-11-11 Said Abou-Hallawa [GPU Process] Cache the NativeImage in GPU Process and allow referencing it with its RemoteResourceIdentifier https://bugs.webkit.org/show_bug.cgi?id=217596 Reviewed by Simon Fraser. Recorder::drawNativeImage() will ensure the NativeImage is cached before recording the DrawNativeImage item with the renderingResourceIdentifier. Because RemoteImageBufferProxy is a superclass of DisplayList::Recorder:: Delegate, it will ensure the NativeImage is cached in its RemoteResourceCacheProxy. If the NativeImage is registered in RemoteResourceCacheProxy for the first time, it is going to be sent as an IPC message to GPU. Upon receiving this message, RemoteRenderingBackend will cache this NativeImage in its RemoteResourceCache. This message has to be received for any NativeImage only once for its entire life time. When flushing the DisplayList of any ImageBuffer, RemoteImageBuffer will ensure the NativeImages are cached in the RemoteResourceCache are passed to DisplayList::Replayer so it can use them to get NativeImage for every DrawNativeImage with the same renderingResourceIdentifier it was recorded with. When NativeImage is bing destroyed, its destructor will call its observer virtual method releaseNativeImage(). RemoteResourceCacheProxy will be a superclass NativeImage::Observer so its overriding method will be called. When RemoteResourceCacheProxy::releaseNativeImage() is called it is going to delete the NativeImage from RemoteResourceCacheProxy and is going to send a message to GPU to delete the corresponding NativeImage from RemoteResourceCache via RemoteRenderingBackend::releaseRemoteResource(). * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::cacheNativeImage): (WebKit::RemoteRenderingBackend::decodeItem): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheNativeImage): (WebKit::RemoteResourceCache::releaseRemoteResource): * GPUProcess/graphics/RemoteResourceCache.h: (WebKit::RemoteResourceCache::nativeImages const): * Scripts/webkit/messages.py: * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::cacheNativeImage): (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::RemoteResourceCacheProxy): (WebKit::RemoteResourceCacheProxy::cacheImageBuffer): (WebKit::RemoteResourceCacheProxy::cachedImageBuffer): (WebKit::RemoteResourceCacheProxy::cacheNativeImage): (WebKit::RemoteResourceCacheProxy::releaseNativeImage): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2020-11-11 Chris Dumez Terminate WebProcesses if GPUProcess crashes more than twice in 30 seconds https://bugs.webkit.org/show_bug.cgi?id=218811 Reviewed by Tim Horton. If the GPUProcess crashes more than twice in 30 seconds, we now terminate all WebProcesses to try and get back into a good state. This is to avoid getting into a situation where the GPUProcess is crash looping. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::terminate): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessCrashed): (WebKit::WebProcessPool::resetGPUProcessCrashCount): (WebKit::WebProcessPool::terminateAllWebContentProcesses): * UIProcess/WebProcessPool.h: 2020-11-11 Brian Burg [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing https://bugs.webkit.org/show_bug.cgi?id=217783 Reviewed by Devin Rousso. _WKInspectorExtension is new SPI that represents a Web Extension that uses the 'devtools' API to interact with Web Inspector. An extension is associated with its _WKInspectorExtensionHost. A WebKit client that supports Web Extensions can use this class to implement 'devtools' extension APIs. Add _WKInspectorExtensionHost methods to register and unregister an extension. Add plumbing so that the extension in registered in the frontend with WI.InspectorExtensionController. Later patches will flesh out the needed functionality to implement rest of the 'devtools' API. * Sources.txt: * SourcesCocoa.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * WebKit.xcodeproj/project.pbxproj: Add new files. * Scripts/webkit/messages.py: If a message includes InspectorExtensionError, then generate an include for InspectorExtensionTypes.h where it is declared. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): New API object type. * Shared/InspectorExtensionTypes.h: Added error code enum and useful type aliases. * Shared/InspectorExtensionTypes.cpp: (WebKit::inspectorExtensionErrorToString): * UIProcess/API/APIInspectorExtension.h: * UIProcess/API/APIInspectorExtension.cpp: (API::InspectorExtension::create): (API::InspectorExtension::InspectorExtension): (API::InspectorExtension::~InspectorExtension): Added. This is a placeholder object that's used for the wrapper system, since we don't have single C++ objects for each extension to back the API object. * UIProcess/API/Cocoa/_WKInspector.h: * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): (-[_WKInspector unregisterExtension:completionHandler:]): Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. * UIProcess/API/Cocoa/_WKInspectorExtension.h: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: (-[_WKInspectorExtension initWithIdentifier:]): (-[_WKInspectorExtension dealloc]): (-[_WKInspectorExtension _apiObject]): (-[_WKInspectorExtension extensionID]): Added. This is a data object that's also used as a token to unregister the extension. * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: Add new SPI. * UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): (-[_WKRemoteWebInspectorViewController unregisterExtension:completionHandler:]): Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. * UIProcess/Inspector/RemoteWebInspectorProxy.h: * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: Add FrontendLoaded. (WebKit::RemoteWebInspectorProxy::extensionController const): Added. * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::frontendLoaded): (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow): Set up the extension controller object after the frontend has been created. Hook up the FrontendLoaded event sent from Inspector web process so that the extension controller can be notified of when it's safe to message the frontend. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::createFrontendPage): (WebKit::WebInspectorProxy::closeFrontendPageAndWindow): (WebKit::WebInspectorProxy::frontendLoaded): Set up the extension controller object after the frontend has been created. * UIProcess/Inspector/WebInspectorProxy.h: (WebKit::WebInspectorProxy::extensionController const): Added. * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: Added. (WebKit::WebInspectorUIExtensionControllerProxy::WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::~WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::whenFrontendHasLoaded): (WebKit::WebInspectorUIExtensionControllerProxy::inspectorFrontendLoaded): (WebKit::WebInspectorUIExtensionControllerProxy::registerExtension): (WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension): Added. Forward API requests to the Web Inspector's web process to be evaluated in the frontend. * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: (WebKit::WebInspectorFrontendAPIDispatcher::dispatchCommand): Add a more generic way to encode values to be passed as arguments to InspectorFrontendAPI.dispatch. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::establishConnection): (WebKit::WebInspectorUI::closeWindow): * WebProcess/Inspector/WebInspectorUI.h: (WebKit::WebInspectorUI::frontendPage const): Added. (WebKit::WebInspectorUI::frontendAPIDispatcher): Added. * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: Added. * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: Added. (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromResult): Handle incoming messages by forwarding the associated command to WI.WebExtensionController via InspectorFrontendAPI evaluations. * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: Fallout from unified build chunking shifts. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::getExistingCredentials): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): Fallout from unified build chunking shifts, but more. 2020-11-11 Alex Christensen Define USE(LEGACY_CFNETWORK_DOWNLOADS) https://bugs.webkit.org/show_bug.cgi?id=218814 Reviewed by Geoffrey Garen. Mojave CFNetwork has a few download bugs I'll need to work around. With this change I can use USE(LEGACY_CFNETWORK_DOWNLOADS) instead of __MAC_OS_X_VERSION_MIN_REQUIRED, which is more in line with WebKit style. This will be used more in bug 217747. * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::resume): 2020-11-11 Chris Dumez [GPUProcess] Seamlessly resume WebAudio playback if the GPU Process crashes https://bugs.webkit.org/show_bug.cgi?id=218806 Reviewed by Geoffrey Garen. In case of a GPU process crash, we were previously terminating all WebProcesses. This patch makes it so that WebProcesses are no longer terminated in such cases. Additionally, this patch makes sure that if WebAudio is rendering audio while the GPU Process crashes, the GPU process will get relaunched right away and audio rendering will seamlessly continue. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessCrashed): * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::didClose): * WebProcess/GPU/GPUProcessConnection.h: (WebKit::GPUProcessConnection::Client::gpuProcessConnectionDidClose): (WebKit::GPUProcessConnection::addClient): (WebKit::GPUProcessConnection::removeClient): * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::RemoteAudioDestinationProxy): (WebKit::RemoteAudioDestinationProxy::connectToGPUProcess): (WebKit::RemoteAudioDestinationProxy::gpuProcessConnectionDidClose): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::gpuProcessConnectionClosed): * WebProcess/WebProcess.h: 2020-11-11 Alex Christensen Use _CFURLConnectionSetFrameworkStubs instead of DYLD_INTERPOSE on Intel Macs https://bugs.webkit.org/show_bug.cgi?id=218810 Reviewed by Geoffrey Garen. A long, long time ago, we realized that CFNetwork was looking in the keychain for persistent credentials, and in order to make the network process get credentials as the UI process, we introduced SecItemShim which used DYLD_INTERPOSE to intercept the calls to the security framework and synchronously message the UI process for those calls. Over the last 6 years we have realized that doesn't work on iOS or Apple silicon Macs, so we use _CFURLConnectionSetFrameworkStubs instead. That works on Intel Macs, too, and I'm reasonably certain that using it everywhere won't break anything, so as a step towards rdar://problem/15588174 which should allow us to use asynchronous messages and no more globalNetworkProcess pointer, let's stop using DYLD_INTERPOSE. * Shared/mac/SecItemShim.cpp: (WebKit::initializeSecItemShim): 2020-11-11 Alex Christensen Don't look in keychain for SecKeyRef after deserializing SecIdentityRef https://bugs.webkit.org/show_bug.cgi?id=218809 Reviewed by Geoffrey Garen. In ye olden days of WebKit2, we used to use special code to serialize an NSURLCredential with an identity. We needed to serialize the certificate chain and a way to look in the keychain to find the private key. That didn't work with third party apps not entitled to look in the keychain, and it also didn't work with hardware keys that retain the private key themselves, so we introduced SecKeyProxy. Now, all those things work and we don't serialize SecIdentityRefs any more, so let's remove the problematic dead code that would have tried. Luckily, we now have API tests that verify that client certificate authentication still works. r169938 added a restriction to looking in the keychain only if the parent app has entitlements needed to do so. That restriction isn't needed any more because nobody looks in the keychain from the network process. r269162 entirely removed looking in the keychain for private keys for client certificate authentication. This is moving in that same direction. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::checkEntitlements): * Shared/cf/ArgumentCodersCF.cpp: (IPC::typeFromCFTypeRef): (IPC::encode): (IPC::decode): (IPC::setAllowsDecodingSecKeyRef): Deleted. (IPC::copyPersistentRef): Deleted. * Shared/cf/ArgumentCodersCF.h: * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): 2020-11-11 Sihui Liu REGRESSION (r269348): ASSERTION FAILED: !m_messageReceiverMapCount under WebKit::SpeechRecognitionServer::~SpeechRecognitionServer https://bugs.webkit.org/show_bug.cgi?id=218770 Reviewed by Youenn Fablet. Remove SpeechRecognitionServer from MessageReceiverMap before it is destroyed. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): 2020-11-11 Chris Dumez REGRESSION (r269657): ASSERTION FAILED: Completion handler should always be called under WebKit::GPUProcessProxy::~GPUProcessProxy https://bugs.webkit.org/show_bug.cgi?id=218807 Reviewed by Geoffrey Garen. GPUProcessProxy::sendPrepareToSuspend() was failing to send the IPC to the GPUProcess and was also failing to call its completion handler, thus asserting in Debug. Update GPUProcessProxy to actually send the PrepareToSuspend / ProcessDidResume IPCs to the GPUProcess. The GPUProcess actually already had an implementation to deal with those IPCs. No new tests, covered by existing tests that are crashing in debug. * GPUProcess/GPUProcess.messages.in: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::sendPrepareToSuspend): (WebKit::GPUProcessProxy::sendProcessDidResume): * UIProcess/GPU/GPUProcessProxy.h: 2020-11-11 Wenson Hsieh [Concurrent display lists] Add an initial implementation of concurrent display list rendering https://bugs.webkit.org/show_bug.cgi?id=218426 Reviewed by Ryosuke Niwa. This patch adds a first-cut implementation of concurrent display list rendering, which allows the GPU and web processes to read and write display list data at the same time. To achieve this, we remove the placeholder shared memory display list encoding mechanism previously added in , and replace it with a new model in which a writer (i.e. the web process) and a reader (i.e. the GPU process) share a set of reusable shared memory buffers which contain display list item data. As the writer appends data to shared memory, it increments a counter in each shared memory buffer that represents the number of bytes that the reader has yet to read; as the reader reads display list items from shared memory, it decrements this counter. This patch also implements a simple strategy for reusing these shared item buffers. The web process maintains a queue of reusable buffers; when display list items are appended and the current writable buffer is out of capacity, the display list item buffer calls out to WebKit2 via a client method to request more shared memory. Here, the web process traverses the queue of reusable item buffers in search of a buffer with sufficient capacity; if found, we hand this back to WebCore as an opaque `ItemBufferHandle`; otherwise, we allocate a new reusable shared memory buffer. Item buffers that have been used become reusable only after they are (1) no longer being read from -- i.e., the counter value is 0, and (2) they are not actively being written to. Buffers that have been used are lazily reintroduced into the reuse queue when a display list requests a handle to writable item buffer data. See below for more details. * GPUProcess/graphics/DisplayListReaderHandle.cpp: Copied from Source/WebKit/Shared/SharedDisplayListHandle.cpp. (WebKit::DisplayListReaderHandle::advance): (WebKit::DisplayListReaderHandle::displayListForReading const): * GPUProcess/graphics/DisplayListReaderHandle.h: Copied from Source/WebKit/Shared/SharedDisplayListHandle.cpp. (WebKit::DisplayListReaderHandle::create): (WebKit::DisplayListReaderHandle::DisplayListReaderHandle): Add a new helper class to represent a shared display list item buffer that the GPU process can use to consume display list items. Advancing the cursor in `DisplayListReaderHandle` decrements the "remaining bytes" counter; the class also has a helper method for creating a new `DisplayList` with a given offset into the shared buffer, as well the number of bytes to read. * GPUProcess/graphics/RemoteImageBuffer.h: Handle the `MetaCommandSwitchTo` and `FlushContext` items by (respectively) informing the rendering backend about the next buffer to read from, and sending a "flush committed" IPC message back to the web process. (WebKit::RemoteImageBuffer::RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyDisplayListsFromHandle): (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): This is the main loop in the GPU process that is responsible for applying incoming display list item data. This IPC endpoint receives information about where to start (i.e. an item buffer ID and an offset into shared memory in that buffer) and begins reading ranges of display list item data inside that buffer. After it is done processing all of its unread bytes, it then checks the unread byte count once again, and continues the loop if the web process has advanced this count. (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): Add logic to handle the case where we reached the end of an item buffer, but the next buffer identifier is still unknown to us (since it is still "in transit" via the `DidCreateSharedDisplayListHandle` IPC message). In this case, we remember the next buffer identifier in `m_nextItemBufferToRead`, and exit the processing loop inside `wakeUpAndApplyDisplayList`. Upon receiving the shared memory handle in `didCreateSharedDisplayListHandle`, we then automatically resume display list processing, starting from the beginning of this new buffer. (WebKit::RemoteRenderingBackend::applyDisplayList): Deleted. (WebKit::RemoteRenderingBackend::submitDisplayList): Deleted. (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): Deleted. (WebKit::RemoteRenderingBackend::didCreateSharedItemData): Deleted. We don't need any of these methods anymore, now that there is only one codepath for processing display list items. See `RemoteRenderingBackend::wakeUpAndApplyDisplayList` above. Also, rename `didCreateSharedItemData` to `didCreateSharedDisplayListHandle` (also above). * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::sharedMemory): (WebKit::SharedDisplayListHandle::sharedMemory const): (WebKit::SharedDisplayListHandle::identifier const): (WebKit::SharedDisplayListHandle::data const): (WebKit::SharedDisplayListHandle::unreadBytes): (WebKit::SharedDisplayListHandle::Lock::Lock): (WebKit::SharedDisplayListHandle::Lock::~Lock): (WebKit::SharedDisplayListHandle::SharedDisplayListHandle): (WebKit::SharedDisplayListHandle::header): (WebKit::SharedDisplayListHandle::header const): (WebKit::SharedDisplayListHandle::encode const): Deleted. (WebKit::SharedDisplayListHandle::decode): Deleted. Repurpose `SharedDisplayListHandle` to serve as a base class for both `DisplayListReaderHandle` and `DisplayListWriterHandle`. This base class is aware of the memory layout of the display list item buffer in shared memory (in particular, the fact that the first 8 bytes are the atomic lock and the next 8 bytes contain the unread byte counter). Internally, this uses a protected RAII class, `SharedDisplayListHandle::Lock`, to grab the lock before either reading or writing the unread bytes count. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: Added. (WebKit::DisplayListWriterHandle::advance): (WebKit::DisplayListWriterHandle::availableCapacity const): (WebKit::DisplayListWriterHandle::createHandle const): (WebKit::DisplayListWriterHandle::resetWritableOffsetIfPossible): This helper method moves the writable offset (see below) back to the start of the buffer if it is not being read from by the GPU process. * WebProcess/GPU/graphics/DisplayListWriterHandle.h: Renamed from Source/WebKit/Shared/SharedDisplayListHandle.cpp. (WebKit::DisplayListWriterHandle::create): (WebKit::DisplayListWriterHandle::writableOffset const): Similar to `DisplayListReaderHandle`, except that this contains logic specific to the web process for writing display list items into shared memory. Advancing the cursor in `DisplayListWriterHandle` increments the counter. It also increments the `writableOffset` of the handle, which represents the minimum offset into the shared buffer that may contain newly appended display list items. (WebKit::DisplayListWriterHandle::DisplayListWriterHandle): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::submitDisplayList): (WebKit::RemoteRenderingBackendProxy::updateReusableHandles): This private helper iterates the set of buffers that are not currently being written to, and adds each one to the reusable buffer queue only if its writable offset is at the start. (WebKit::RemoteRenderingBackendProxy::createItemBuffer): Implements logic that hands shared item buffer data handles to WebCore for writing display list items. This will try to reuse an item buffer in the reuse queue, if possible, and fall back to allocating a new chunk of shared memory if no reusable buffer is found (or the existing buffers have insufficient capacity). The fact that we iterate through each reusable buffer in order, combined with the above logic in `updateReusableHandles`, ensures that once we begin writing to a item buffer, we will continue using that item buffer until it exhausts available capacity. This property is important because it allows the GPU process to simply start reading item data from a given offset and buffer ID (specified in the `WakeUpAndApplyDisplayList` IPC message), and seamlessly continue reading data even after it exhausts all available item data in the current buffer by continuing from the start of the item buffer that contains the next display list items (which we learn in the GPU process by encountering a `MetaCommandSwitchTo` item at the end of the previous buffer). In "steady state" (wherein both processes are concurrently writing and reading items as quickly as possible), this means that as the web process is busy filling up each item buffer with item data, the GPU process is also busy applying all the item data in one buffer and automatically moving on to the next buffer with no additional IPC messages required. (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-11-11 Commit Queue Unreviewed, reverting r269244. https://bugs.webkit.org/show_bug.cgi?id=218483 Patch is breaking tests Reverted changeset: "Stop sending origins from WebProcess to UIProcess for getUserMedia requests" https://bugs.webkit.org/show_bug.cgi?id=218192 https://trac.webkit.org/changeset/269244 2020-11-11 Corentin Noël [GTK] Annotate WebKitUserMessage getters as nullable https://bugs.webkit.org/show_bug.cgi?id=218761 Reviewed by Carlos Garcia Campos. These properties can be set to NULL at creation time. * Shared/API/glib/WebKitUserMessage.cpp: 2020-11-10 Commit Queue Unreviewed, reverting r269660. https://bugs.webkit.org/show_bug.cgi?id=218786 Crashing in EWS iOS simulator bots Reverted changeset: "PCM: Change from ad-click-attribution to private-click- measurement (in all forms, including .well-known URL)" https://bugs.webkit.org/show_bug.cgi?id=218730 https://trac.webkit.org/changeset/269660 2020-11-10 Per Arne Vollan [macOS] Enforce message filtering in the WebContent process https://bugs.webkit.org/show_bug.cgi?id=218756 Reviewed by David Kilzer. Based on telemetry, we should deny access to messages not being used in the WebContent process on macOS. No new tests, covered by existing tests. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-10 Chris Dumez Webkit incorrectly setting visibilityState to "prerender" when opening link in new tab https://bugs.webkit.org/show_bug.cgi?id=215851 Reviewed by Geoff Garen. * Shared/API/c/WKSharedAPICast.h: (WebKit::toVisibilityState): * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: (webkit_dom_document_get_visibility_state): 2020-11-10 Tim Horton Use GraphicsContext instead of CGContext in RemoteLayerBackingStore https://bugs.webkit.org/show_bug.cgi?id=218738 Reviewed by Wenson Hsieh. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::drawInContext): Make use of the GraphicsContext abstraction instead of dropping down to CGContext, in preparation for DisplayList rendering. 2020-11-10 Darin Adler Remove another function that implicitly uses the composed tree (intersects with range) https://bugs.webkit.org/show_bug.cgi?id=218726 Reviewed by Ryosuke Niwa. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestDocumentEditingContext): Refactor to use VisiblePositionRange and to call intersects on two of them, to improve the code readability and also sidestep the issue of calling the intersects template function from outside WebCore. 2020-11-10 John Wilander PCM: Change from ad-click-attribution to private-click-measurement (in all forms, including .well-known URL) https://bugs.webkit.org/show_bug.cgi?id=218730 Reviewed by Devin Rousso. Change to the official name of the proposed standard Private Click Measurement https://github.com/privacycg/private-click-measurement. This includes a change of the reporting URL from "/.well-known/ad-click-attribution/" to "/.well-known/private-click-measurement/". * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::initializeNetworkProcess): (WebKit::NetworkProcess::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::storePrivateClickMeasurement): (WebKit::NetworkProcess::dumpPrivateClickMeasurement): (WebKit::NetworkProcess::clearPrivateClickMeasurement): (WebKit::NetworkProcess::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::NetworkProcess::setPrivateClickMeasurementConversionURLForTesting): (WebKit::NetworkProcess::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkProcess::setAdClickAttributionDebugMode): Deleted. (WebKit::NetworkProcess::storeAdClickAttribution): Deleted. (WebKit::NetworkProcess::dumpAdClickAttribution): Deleted. (WebKit::NetworkProcess::clearAdClickAttribution): Deleted. (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting): Deleted. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::storePrivateClickMeasurement): (WebKit::NetworkSession::handlePrivateClickMeasurementConversion): (WebKit::NetworkSession::dumpPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurementForRegistrableDomain): (WebKit::NetworkSession::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::NetworkSession::setPrivateClickMeasurementConversionURLForTesting): (WebKit::NetworkSession::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::NetworkSession::storeAdClickAttribution): Deleted. (WebKit::NetworkSession::handleAdClickAttributionConversion): Deleted. (WebKit::NetworkSession::dumpAdClickAttribution): Deleted. (WebKit::NetworkSession::clearAdClickAttribution): Deleted. (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain): Deleted. (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting): Deleted. * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurementManager.cpp: Renamed from Source/WebKit/NetworkProcess/AdClickAttributionManager.cpp. (WebKit::PrivateClickMeasurementManager::storeUnconverted): (WebKit::PrivateClickMeasurementManager::handleConversion): (WebKit::PrivateClickMeasurementManager::startTimer): (WebKit::PrivateClickMeasurementManager::convert): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): (WebKit::PrivateClickMeasurementManager::firePendingConversionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toString const): (WebKit::PrivateClickMeasurementManager::setConversionURLForTesting): (WebKit::PrivateClickMeasurementManager::markAllUnconvertedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::debugModeEnabled const): * NetworkProcess/PrivateClickMeasurementManager.h: Renamed from Source/WebKit/NetworkProcess/AdClickAttributionManager.h. (WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager): (WebKit::PrivateClickMeasurementManager::m_sessionID): (WebKit::PrivateClickMeasurementManager::setPingLoadFunction): (WebKit::PrivateClickMeasurementManager::setOverrideTimerForTesting): * Platform/Logging.h: * Shared/NavigationActionData.cpp: (WebKit::NavigationActionData::encode const): (WebKit::NavigationActionData::decode): * Shared/NavigationActionData.h: * Shared/WebsiteData/WebsiteData.cpp: (WebKit::WebsiteData::ownerProcess): * Shared/WebsiteData/WebsiteDataType.h: * Sources.txt: * UIProcess/API/APINavigation.h: (API::Navigation::privateClickMeasurement const): (API::Navigation::adClickAttribution const): Deleted. * UIProcess/API/C/WKPage.cpp: (WKPageDumpPrivateClickMeasurement): (WKPageClearPrivateClickMeasurement): (WKPageSetPrivateClickMeasurementOverrideTimerForTesting): (WKPageSetPrivateClickMeasurementConversionURLForTesting): (WKPageMarkPrivateClickMeasurementsAsExpiredForTesting): (WKPageDumpAdClickAttribution): Deleted. (WKPageClearAdClickAttribution): Deleted. (WKPageSetAdClickAttributionOverrideTimerForTesting): Deleted. (WKPageSetAdClickAttributionConversionURLForTesting): Deleted. (WKPageMarkAdClickAttributionsAsExpiredForTesting): Deleted. * UIProcess/API/C/WKPagePrivate.h: * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreClearPrivateClickMeasurementsThroughWebsiteDataRemoval): (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval): Deleted. * UIProcess/API/C/WKWebsiteDataStoreRef.h: * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm: (dataTypesToString): * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h: (WebKit::toWebsiteDataType): (WebKit::toWKWebsiteDataTypes): * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeNetworkProcess): * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::setDeveloperPreferenceOverride): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setPrivateClickMeasurementDebugMode): (WebKit::NetworkProcessProxy::setAdClickAttributionDebugMode): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::createNewPage): (WebKit::WebPageProxy::dumpPrivateClickMeasurement): (WebKit::WebPageProxy::clearPrivateClickMeasurement): (WebKit::WebPageProxy::setPrivateClickMeasurementOverrideTimerForTesting): (WebKit::WebPageProxy::setPrivateClickMeasurementConversionURLForTesting): (WebKit::WebPageProxy::markPrivateClickMeasurementsAsExpiredForTesting): (WebKit::WebPageProxy::dumpAdClickAttribution): Deleted. (WebKit::WebPageProxy::clearAdClickAttribution): Deleted. (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting): Deleted. (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting): Deleted. (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setPrivateClickMeasurementDebugMode): (WebKit::WebsiteDataStore::setAdClickAttributionDebugMode): Deleted. * UIProcess/WebsiteData/WebsiteDataStore.h: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): 2020-11-10 Simon Fraser Make PlatformWheelEventPhase an enum class https://bugs.webkit.org/show_bug.cgi?id=218772 Reviewed by Tim Horton. Change PlatformWheelEventPhase to be an enum class. Changed code that maps between NSEventPhase and PlatformWheelEventPhase to not treat NSEventPhase as a set of bits, since it only ever contains one of the bits. * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: (WebKit::ScrollerPairMac::handleWheelEvent): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): 2020-11-10 Chris Dumez GPUProcess does not properly get relaunched after crashing https://bugs.webkit.org/show_bug.cgi?id=218769 Reviewed by Tim Horton. After the GPUProcess crashes, we need to make sure we construct a new GPUProcessProxy so that a new process gets relaunched. Previously, this wasn't possible because the GPUProcessProxy was a "never destroyed" singleton. The GPUProcessProxy is now kept alive by the WebProcessPool objects refing it. Upon crashing, all WebProcessPools clear their GPUProcessProxy RefPtr so that the old GPUProcessProxy gets destroyed. The next time a GPUProcessProxy is needed, a new one gets constructed. We still make sure that all WebProcessPool objects share the same GPUProcessProxy, as before this patch. * UIProcess/API/Cocoa/WKProcessPool.mm: (-[WKProcessPool _gpuProcessIdentifier]): * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::getOrCreate): (WebKit::GPUProcessProxy::GPUProcessProxy): (WebKit::GPUProcessProxy::~GPUProcessProxy): (WebKit::GPUProcessProxy::processWillShutDown): (WebKit::GPUProcessProxy::gpuProcessCrashed): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::willStartCapture): (WebKit::WebPageProxy::setOrientationForMediaCapture): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::ensureGPUProcess): (WebKit::WebProcessPool::gpuProcessCrashed): (WebKit::WebProcessPool::getGPUProcessConnection): (WebKit::WebProcessPool::updateAudibleMediaAssertions): * UIProcess/WebProcessPool.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _setupVisibilityPropagationViewForGPUProcess]): 2020-11-10 Brent Fulgham [macOS] Allow IOGLESBundleName for Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218774 Unreviewed follow-up fix to r269649. Two additional keys are needed: MetalPluginClassName and MetalPluginName * WebProcess/com.apple.WebProcess.sb.in: 2020-11-10 Brent Fulgham [macOS] Allow IOGLESBundleName for Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218774 Reviewed by Tim Horton. The WebContent should be able to read the IOGLESBundleName IOKit property on Apple Silicon Macs. This will help the OpenGL stack make better choices about which bundles to load when processing WebGL content. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-10 Said Abou-Hallawa [macCatalyst] Fix various build breaks https://bugs.webkit.org/show_bug.cgi?id=218771 Reviewed by Tim Horton. Use NO_RETURN_DUE_TO_ASSERT for unreachable function. * UIProcess/Cocoa/UserMediaPermissionRequestProxy.mm: (WebKit::UserMediaPermissionRequestProxy::doDefaultAction): * UIProcess/UserMediaPermissionRequestProxy.h: 2020-11-10 Per Arne Vollan [Cocoa] Send GPU sandbox extensions in Web page creation parameters https://bugs.webkit.org/show_bug.cgi?id=218708 Reviewed by Brent Fulgham. To pick up correct runtime settings, the GPU sandbox extensions should be sent to the WebContent process as part of the Web page creation parameters. No new tests, covered by existing tests. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::mediaRelatedMachServices): Deleted. (WebKit::gpuIOKitClasses): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::gpuIOKitClasses): (WebKit::mediaRelatedMachServices): (WebKit::WebPageProxy::creationParameters): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-10 Per Arne Vollan [macCatalyst] Add entitlement for message filtering https://bugs.webkit.org/show_bug.cgi?id=218768 Reviewed by Tim Horton. Add required message filtering entitlement for Catalyst. No new tests, covered by existing tests. * Scripts/process-entitlements.sh: 2020-11-10 Youenn Fablet Update WebRTC liwebrtc to M87 https://bugs.webkit.org/show_bug.cgi?id=218436 Reviewed by Eric Carlson. Update code now that fragmentation headers are computed at packetization time. * Configurations/WebKit.xcconfig: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::createEncoder): * Scripts/webkit/messages.py: * Shared/RTCNetwork.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::completedEncoding): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.messages.in: 2020-11-10 Wenson Hsieh REGRESSION (r269525): Many layout tests crash when run under ASan https://bugs.webkit.org/show_bug.cgi?id=218733 Reviewed by Tim Horton. Construct the item 8 bytes after the handle offset, instead of 1 byte (also, add a FIXME indicating that we some way of achieving this without requiring WebKit2 to be aware of an item handle's memory layout). * GPUProcess/graphics/RemoteRenderingBackend.h: (WebKit::RemoteRenderingBackend::decodeAndCreate): 2020-11-10 Chris Dumez [GPUProcess] Regression(r268632) Garbage is rendered on speakers when using WebAudio https://bugs.webkit.org/show_bug.cgi?id=218729 Reviewed by Eric Carlson. RemoteAudioDestinationProxy::requestBuffer() was calling AudioDestinationCocoa::render() and expecting RemoteAudioDestinationProxy::renderOnRenderingThead() to get called as a result. It would take care of writing to the CARingBuffer and sending the IPC back to the GPU process in renderOnRenderingThead(). The issue was that AudioDestinationCocoa uses a PushPullFIFO internally for buffering. It first fetches available frames from the FIFO and then only calls renderOnRenderingThead() with the number of frames that remain to processed (usually 0). As a result, RemoteAudioDestinationProxy::renderOnRenderingThead() would often store 0 frames instead of 128 (or sometimes a number of frames less than 128), even though the full 128 frames were actually rendered. To address the issue, stop overriding renderOnRenderingThead() in RemoteAudioDestinationProxy. Instead, do the writing to the CARingBuffer and the IPC response in RemoteAudioDestinationProxy::requestBuffer(), directly after calling AudioDestinationCocoa::render(). After calling AudioDestinationCocoa::render() we know that |framesToRender| frames have been rendered / added to the buffer. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::requestBuffer): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-11-10 Carlos Garcia Campos [GTK4] WebView is flipped https://bugs.webkit.org/show_bug.cgi?id=218354 Reviewed by Adrian Perez de Castro. Stop painting y-flipped textures when buildig with GTK4. * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: (WebKit::AcceleratedBackingStoreWayland::snapshot): * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h: 2020-11-10 Carlos Garcia Campos [GTK] Crash in WebKit::DropTarget::drop https://bugs.webkit.org/show_bug.cgi?id=217482 Reviewed by Michael Catanzaro. If we don't have selection data when drop is called, just return early to let leave continue. Also change accept() to receive the drop context and position to be set after leaving any previous operation. * UIProcess/API/gtk/DropTarget.h: * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::accept): (WebKit::DropTarget::drop): * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::DropTarget): (WebKit::DropTarget::accept): 2020-11-10 Carlos Garcia Campos [GTK][WPE] WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD returned when plugins are disabled https://bugs.webkit.org/show_bug.cgi?id=216123 Reviewed by Adrian Perez de Castro. Undeprecate webkit_plugin_error_quark and WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD, and update documentation. * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewLoadFail): * UIProcess/API/gtk/WebKitError.h: * UIProcess/API/wpe/WebKitError.h: 2020-11-10 Wenson Hsieh Fix crashes when mapping shared display list item data into display lists in the GPU process https://bugs.webkit.org/show_bug.cgi?id=218739 Reviewed by Tim Horton. I added a "stop-gap" mechanism in r269525 to allow the GPU process to handle newly refactored display list items by encoding display list items directly into shared memory buffers in the web process and reading them back in the GPU process, using standard IPC messages only, and also without reusing any shared memory buffers. However, I introduced a bug in this "stop-gap" mechanism when I tried to clean up some GPU-process-side logic for unregistering these shared memory buffers in the GPU process, by taking shared memory buffers out of the map in the GPU process without ensuring that they're kept alive over the course of applying the display list. This code is going away soon anyways (see webkit.org/b/218426), but in the meantime, we should at least ensure that this temporary shared memory mechanism doesn't cause huge waves of layout test failures. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyDisplayList): 2020-11-09 Said Abou-Hallawa [GPU Process] Control the life cycle of the platform image by a new class named NativeImage https://bugs.webkit.org/show_bug.cgi?id=218427 Reviewed by Simon Fraser. * Scripts/webkit/messages.py: * Shared/API/c/cg/WKImageCG.cpp: (WKImageCreateFromCGImage): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): (IPC::encodeNativeImage): Deleted. (IPC::decodeNativeImage): Deleted. (IPC::encodeOptionalNativeImage): Deleted. (IPC::decodeOptionalNativeImage): Deleted. (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * Shared/WebCoreArgumentCoders.h: * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::createImage): * Shared/win/ShareableBitmapDirect2D.cpp: (WebKit::ShareableBitmap::paint): * UIProcess/API/glib/IconDatabase.cpp: (WebKit::IconDatabase::loadIconForPageURL): (WebKit::IconDatabase::setIconForPageURL): * UIProcess/API/glib/IconDatabase.h: * UIProcess/ios/DragDropInteractionState.mm: (WebKit::uiImageForImage): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _deliverDelayedDropPreviewIfPossible:]): (uiImageForImage): (-[WKContentView _handleDropByInsertingImagePlaceholders:session:]): (-[WKContentView _presentationSnapshotForPreviewItemController:]): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::copyNativeImage const): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::isAlmostSolidColor): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon): 2020-11-09 Chris Dumez Unexpose obsolete HTMLAppletElement interface https://bugs.webkit.org/show_bug.cgi?id=218677 Reviewed by Darin Adler. * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp: (webkit_dom_html_applet_element_dispatch_event): (webkit_dom_html_applet_element_add_event_listener): (webkit_dom_html_applet_element_remove_event_listener): (webkit_dom_html_applet_element_get_align): (webkit_dom_html_applet_element_set_align): (webkit_dom_html_applet_element_get_alt): (webkit_dom_html_applet_element_set_alt): (webkit_dom_html_applet_element_get_archive): (webkit_dom_html_applet_element_set_archive): (webkit_dom_html_applet_element_get_code): (webkit_dom_html_applet_element_set_code): (webkit_dom_html_applet_element_get_code_base): (webkit_dom_html_applet_element_set_code_base): (webkit_dom_html_applet_element_get_height): (webkit_dom_html_applet_element_set_height): (webkit_dom_html_applet_element_get_hspace): (webkit_dom_html_applet_element_set_hspace): (webkit_dom_html_applet_element_get_name): (webkit_dom_html_applet_element_set_name): (webkit_dom_html_applet_element_get_object): (webkit_dom_html_applet_element_set_object): (webkit_dom_html_applet_element_get_vspace): (webkit_dom_html_applet_element_set_vspace): (webkit_dom_html_applet_element_get_width): (webkit_dom_html_applet_element_set_width): * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElementPrivate.h: * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPrivate.cpp: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2020-11-09 Peng Liu REGRESSION (r269557): ASSERTION FAILED: Completion handler should always be called under WebCore::HTMLMediaElement::exitFullscreen https://bugs.webkit.org/show_bug.cgi?id=218722 Reviewed by Eric Carlson. No new tests, covered by an existing test that is crashing on the bots. * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): 2020-11-09 Wenson Hsieh Rename ImageBuffer::flushDisplayList to ImageBuffer::submitDisplayList https://bugs.webkit.org/show_bug.cgi?id=218720 Reviewed by Tim Horton. See Source/WebCore/ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyDisplayList): (WebKit::RemoteRenderingBackend::submitDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayList): Deleted. Additionally rename `flushDisplayList` on `RemoteRenderingBackend`, since this IPC message doesn't actually perform a context flush. * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::submitDisplayList): (WebKit::RemoteRenderingBackendProxy::flushDisplayList): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2020-11-09 Alan Bujtas Unreviewed, reverting r269603. Needs Safari patch Reverted changeset: "Show legacy line layout visual coverage instead of "simple line" layout." https://bugs.webkit.org/show_bug.cgi?id=218695 https://trac.webkit.org/changeset/269603 2020-11-09 Zalan Bujtas Show legacy line layout visual coverage instead of "simple line" layout. https://bugs.webkit.org/show_bug.cgi?id=218695 Reviewed by Antti Koivisto. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetLegacyLineLayoutVisualCoverageEnabled): (WKPreferencesGetLegacyLineLayoutVisualCoverageEnabled): (WKPreferencesSetSimpleLineLayoutDebugBordersEnabled): Deleted. (WKPreferencesGetSimpleLineLayoutDebugBordersEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _legacyLineLayoutVisualCoverageEnabled]): (-[WKPreferences _setLegacyLineLayoutVisualCoverageEnabled:]): (-[WKPreferences _simpleLineLayoutDebugBordersEnabled]): Deleted. (-[WKPreferences _setSimpleLineLayoutDebugBordersEnabled:]): Deleted. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2020-11-09 Per Arne Vollan [macOS] System sounds should be played in the UI process https://bugs.webkit.org/show_bug.cgi?id=218405 Reviewed by Darin Adler. Subclass SystemSoundDelegate, which will forward system sound requests to the UI process. * Sources.txt: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::systemBeep): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebSystemSoundDelegate.cpp: Added. (WebKit::WebSystemSoundDelegate::systemBeep): * WebProcess/WebSystemSoundDelegate.h: Added. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-09 Per Arne Vollan [Cocoa] Diagnostic service sandbox violation loading any webpage https://bugs.webkit.org/show_bug.cgi?id=218710 Reviewed by Alexey Proskuryakov. Loading any Web page will cause a diagnostic service mach-lookup sandbox violation. Consume the extension to the service as early as possible in WebProcess::platformInitializeWebProcess, since there are code paths in this method which will try to access the diagnostic service. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2020-11-09 Devin Rousso autofocus of text input should not select text https://bugs.webkit.org/show_bug.cgi?id=218585 Reviewed by Wenson Hsieh. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::restoreSelectionInFocusedEditableElement): Slightly rework `SelectionRestorationMode` to replace `SetDefault` with two new values: - `PlaceCaretAtStart` puts the caret at the start, regardless of any cached selection - `SelectAll` selects all text, regardless of any cached selection (existing behavior) In order to preserve existing behavior, the default `Restore` will have the same effect as `SelectAll` if there is no cached selection (and is renamed to `RestoreOrSelectAll` as such). 2020-11-09 Per Arne Vollan [macOS] Set preference for overridden languages in the WebContent process after entering the sandbox. https://bugs.webkit.org/show_bug.cgi?id=218097 Reviewed by Alexey Proskuryakov. Currently, the preference for overridden languages in the WebContent process is set before entering the sandbox, which leaves behind an open connection to opendirectoryd. This preference should be set after entering the sandbox to avoid this. This patch sets the preference after the initialization function has been executed. API test: WebKit.OverrideAppleLanguagesPreference * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::setAppleLanguagesPreference): (WebKit::XPCServiceEventHandler): (WebKit::XPCServiceMain): * WebProcess/com.apple.WebProcess.sb.in: 2020-11-09 Joonghun Park Unreviewed. Fix the build warning below since r269525. warning: control reaches end of non-void function [-Wreturn-type] No new tests, no new behaviors. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-09 Zan Dobersek [WPE] ScrollGestureController should only handle complete touch interactions https://bugs.webkit.org/show_bug.cgi?id=218329 Reviewed by Carlos Garcia Campos. ScrollGestureController's purpose is to handle otherwise-unhandled touch events and translate those into a scrolling gesture. Until now, it was possible for a touch motion event to trigger that gesture even when the corresponding touch down event was not handled by the ScrollGestureController, e.g. it was not produced due to the touch interaction being started somewhere else, or the Web content actually handled that event. A flag is added to ScrollGestureController to track that an unhandled touch down event was confronted, before allowing subsequent unhandled touch motion events to trigger the scrolling gesture when conditions are met. The flag is reset upon the touch up event. * UIProcess/API/wpe/ScrollGestureController.cpp: (WebKit::ScrollGestureController::handleEvent): * UIProcess/API/wpe/ScrollGestureController.h: 2020-11-08 Lauro Moura [GTK] REGRESSION(r267250) API test /webkit/WebKitWebView/usermedia-enumeratedevices-permission-check is crashing https://bugs.webkit.org/show_bug.cgi?id=216727 Reviewed by Carlos Garcia Campos. Coverered by existing tests. In some cases, like in TestWebKitAPI, a message can arrive to the GeolocationProvider and it would try to access a WebGeolocationManager that could already had been deleted. * UIProcess/API/glib/WebKitGeolocationManager.cpp: (webkitGeolocationManagerDispose): Added. Removes the provider. (webkit_geolocation_manager_class_init): Register dispose callback. 2020-11-07 Wenson Hsieh Clean up some logic in RemoteImageBuffer and RemoteRenderingBackend https://bugs.webkit.org/show_bug.cgi?id=218689 Reviewed by Tim Horton. Move the implementation of `decodeItem` out of `RemoteImageBuffer`, and into `RemoteRenderingBackend`. This allows us to avoid `static_cast`-ing image buffers to their unaccelerated or accelerated versions when setting the display list's item buffer client in the GPU process. No change in behavior. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::decodeAndCreate): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::applyDisplayList): Also, remove a couple of unnecessary `WebCore::` namespace prefixes while we're here. (WebKit::RemoteRenderingBackend::decodeItem): Move `decodeItem` into the rendering backend. This also has the added bonus of letting us put the method definition in the implementation file instead of a header (i.e. `RemoteRenderingBackend.cpp`). * GPUProcess/graphics/RemoteRenderingBackend.h: (WebKit::RemoteRenderingBackend::decodeAndCreate): 2020-11-06 Peng Liu PiP return to element full screen is not smooth on some websites https://bugs.webkit.org/show_bug.cgi?id=218419 Reviewed by Jer Noble. In r265562, VideoFullscreenInterfaceAVKit uses `fullscreenMayReturnToInline()` to request the observer (WKFullScreenWindowController) to enter element fullscreen before exiting picture-in-picture, and calls `fullscreenWillReturnToInline()` to proceed returning to inline or element fullscreen after WKFullScreenWindowController is ready. In this patch, VideoFullscreenInterfaceAVKit will directly enter a temporary video fullscreen from picture-in-picture, so the preparation step (entering element fullscreen) is not needed. Some important points regarding edge cases: 1) A video enters picture-in-picture and exits picture-in-picture immediately before WKFullScreenWindowController is notified to exit element fullscreen. In this case, WKFullScreenWindowController will do nothing when it is notified that the video has exited picture-in-picture. It will directly tell VideoFullscreenInterfaceAVKit to enter standby. 2) A video exits picture-in-picture when WKFullScreenWindowController is exiting element fullscreen but not complete yet. In this case, WKFullScreenWindowController needs to hold the enter element fullscreen request and exits element fullscreen first before entering element fullscreen. 3) The ancestor element of the video element exits fullscreen and asks the video element to exit standby (in web process) while the video is entering picture-in-picture (in UI process). In this case, VideoFullscreenInterfaceAVKit (in UI process) should ignore the request to exit standby and tell the web process the request is rejected. 4) A user may try to enter picture-in-picture when the video is exiting picture-in-picture and returning to element fullscreen. In this case, VideoFullscreenInterfaceAVKit (in UI process) should temporarily disable the picture-in-picture support. * UIProcess/Cocoa/VideoFullscreenManagerProxy.h: * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in: Remove the message `EnterFullscreen` for the iOS port because the UI process can enter fullscreen/picture-in-picture directly. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::exitFullscreen): (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): We need to call `m_page->fullscreenMayReturnToInline()` in this function after removing `fullscreenWillReturnToInline()`. (WebKit::VideoFullscreenManagerProxy::didSetupFullscreen): For the iOS port, we should enter fullscreen directly. (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen): (WebKit::VideoFullscreenManagerProxy::fullscreenMayReturnToInline): (WebKit::VideoFullscreenModelContext::fullscreenWillReturnToInline): Deleted. (WebKit::VideoFullscreenManagerProxy::fullscreenWillReturnToInline): Deleted. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController requestEnterFullScreen]): (-[WKFullScreenWindowController exitFullScreen]): (-[WKFullScreenWindowController _completedExitFullScreen]): (-[WKFullScreenWindowController didEnterPictureInPicture]): (-[WKFullScreenWindowController didExitPictureInPicture]): (-[WKFullScreenWindowController _exitFullscreenImmediately]): We should force to exit fullscreen because the current exiting fullscreen process might be stuck. (-[WKFullScreenWindowController prepareToExitPictureInPicture]): Deleted. * UIProcess/mac/WKFullScreenWindowController.mm: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::exitVideoFullscreenForVideoElement): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/cocoa/VideoFullscreenManager.h: (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): * WebProcess/cocoa/VideoFullscreenManager.messages.in: * WebProcess/cocoa/VideoFullscreenManager.mm: (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement): (WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement): The request to exit fullscreen (standby) may be rejected. (WebKit::VideoFullscreenManager::didSetupFullscreen): Only the macOS port needs to implement this function. (WebKit::VideoFullscreenManager::didEnterFullscreen): (WebKit::VideoFullscreenManager::didExitFullscreen): (WebKit::VideoFullscreenManager::fullscreenMayReturnToInline): (WebKit::VideoFullscreenManager::fullscreenWillReturnToInline): Deleted. 2020-11-06 Jiewen Tan [WebAuthn] [iOS] WebAuthn process doesn't start on iOS devices https://bugs.webkit.org/show_bug.cgi?id=218479 Reviewed by Brent Fulgham. One of the reasons is missing the iOS sandbox profile. Therefore, this patch adds one. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: Added. Copied from the GPU process. Will strip it down once the process is fully functional. * Scripts/process-entitlements.sh: Adds some missing entitlements. * UIProcess/WebAuthentication/WebAuthnProcessProxy.h: Deals with CompletionHandler assertion. * WebKit.xcodeproj/project.pbxproj: Adds some plumbings for the sandbox profile. 2020-11-06 Wenson Hsieh Add new display list item types in preparation for webkit.org/b/218426 https://bugs.webkit.org/show_bug.cgi?id=218588 Reviewed by Simon Fraser. Simply treat these new items as no-ops for the time being. See Source/WebCore/ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-06 Per Arne Vollan [macOS] Add IOKIt message filtering https://bugs.webkit.org/show_bug.cgi?id=218657 Reviewed by Brent Fulgham. Like on iOS, the WebContent process on macOS should have IOKit message filtering. This patch also allows reading of some IOKIt properties, which was reported when running layout tests. No new tests, covered by existing tests. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-06 Wenson Hsieh Add a display list item to represent stroking a single line https://bugs.webkit.org/show_bug.cgi?id=218589 Reviewed by Tim Horton. * GPUProcess/graphics/RemoteImageBuffer.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-06 Sam Weinig Further progress towards merging Settings.yaml into WebPreferences.yaml https://bugs.webkit.org/show_bug.cgi?id=218663 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration init]): Replace call to WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport() which always returned the empty string with a literal empty string. This was the only caller so the function is really no needed. 2020-11-06 Aditya Keerthi [macOS] Align left edge of presented calendar with left edge of date inputs https://bugs.webkit.org/show_bug.cgi?id=218668 Reviewed by Tim Horton. When a date input is activated, a calendar is presented by adding an NSWindow containing an NSDatePicker to the screen. The frame of the window is set to ensure proper alignment with the date input. However, since the window's hasShadow is set to true, AppKit draws a thin border and shadow around the window's contentView. This results in left border of the window being drawn further out than the left border of the input itself. If the hasShadow property is set to false, the issue is no longer observed, and the calendar aligns with the input. However, this is not an acceptable solution, since we lose the border and the shadow. To ensure alignment between the border of the calendar view and the border of the date input, we can inset the edges of the view. Note that the inset is not applied along the y-axis, to avoid a gap between the bottom of the date input and the top of the calendar view. * UIProcess/mac/WebDateTimePickerMac.mm: (-[WKDateTimePickerBackdropView drawRect:]): 2020-11-06 Alex Christensen Fix build with different unified source arrangement. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 2020-11-06 Wenson Hsieh Move DisplayListFlushIdentifier into WebCore as DisplayList::FlushIdentifier https://bugs.webkit.org/show_bug.cgi?id=218586 Reviewed by Simon Fraser. In preparation for adding a display list item to represent flushing the graphics context, move WebKit's `DisplayListFlushIdentifier` to the `DisplayList` namespace in WebCore, and rename it to `DisplayList::FlushIdentifier`. No change in behavior. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::flushDisplayListWasCommitted): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/DisplayListFlushIdentifier.h: Removed. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::commitFlushDisplayList): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: 2020-11-06 Alex Christensen Fix build after adding files to UIProcess/API/Cocoa https://bugs.webkit.org/show_bug.cgi?id=218664 There is some code that assumes that unified sources always combine sources into the same translation units. inspectorWebView is used from _WKInspectorTesting.mm, but only defined in _WKInspector.mm so it should be added to a header. _WKUserContentWorld also doesn't include WKObject.h or RetainPtr.h but uses both. * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector inspectorWebView]): Deleted. * UIProcess/API/Cocoa/_WKInspectorPrivateForTesting.h: * UIProcess/API/Cocoa/_WKInspectorTesting.mm: (-[_WKInspector inspectorWebView]): * UIProcess/API/Cocoa/_WKUserContentWorldInternal.h: 2020-11-06 Wenson Hsieh Encoding PutImageData should not serialize separate IPC attachments for the image data https://bugs.webkit.org/show_bug.cgi?id=218649 Reviewed by Simon Fraser. The argument coder for `WebCore::ImageData` currently sends its image data by allocating a separate shared memory buffer and sending it over to the GPU process via a separate `IPC::Attachment`. This isn't compatible with the new "concurrent display list" model for processing display list items, wherein all out-of-line items are encoded as raw bytes directly into reusable shared memory buffers and decoded from the corresponding buffer in the GPU process. Instead, encode and decode image data directly into and out of the main IPC data buffer. This also addresses a couple of existing FIXMEs in the ImageData coder methods by avoiding the need for redundant copies to and from temporary `WebCore::SharedBuffer`s. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): 2020-11-06 Wenson Hsieh [Concurrent display lists] Encode display list items directly into shared memory https://bugs.webkit.org/show_bug.cgi?id=218406 Reviewed by Tim Horton. Adjust for changes to display lists and display list items in WebCore (see Source/WebCore/ChangeLog for more information). In particular, we implement the reading and writing client hooks consulted by ItemBuffer, and we also add a temporary mechanism that allows RemoteRenderingBackendProxy (in the web process) to send display list item data through shared memory to the RemoteRenderingBackend (in the GPU process). This temporary mechanism does not attempt to make any reading or writing in shared memory concurrent between the GPU and web processes, and exists only to make sure that rendering with the GPU process still works using these new display list items. In the next patch, I will add a simple concurrent reader/writer model for display list processing between the web and GPU processes, and (in doing so) revert most of the changes in `RemoteRenderingBackend` and `RemoteRenderingBackendProxy` below. See comments below for more detail. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::decodeAndCreate): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyResourceItem): (WebKit::RemoteRenderingBackend::applyMediaItem): Refactor these to take `WebCore::DisplayList::ItemHandle`. (WebKit::RemoteRenderingBackend::applyDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackend::didCreateSharedItemData): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: * Shared/SharedDisplayListHandle.cpp: Added. (WebKit::SharedDisplayListHandle::SharedDisplayListHandle): (WebKit::SharedDisplayListHandle::createDisplayList const): * Shared/SharedDisplayListHandle.h: Added. Add a WebKit2 helper class that represents display list data in shared memory that is propagated from the web process to the GPU process. In the next patch, this class will be rewritten to support concurrent display list reading and writing, with specialized subclasses in service of both the reader (i.e. the GPU process) and the writer (i.e. the web process). (WebKit::SharedDisplayListHandle::SharedDisplayListHandle): (WebKit::SharedDisplayListHandle::encode const): (WebKit::SharedDisplayListHandle::decode): * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::flushDisplayList): (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackendProxy::createItemBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: 2020-11-06 Truitt Savell Unreviewed, reverting r269486. Caused 50+ timeouts on Mac Debug WK2 Reverted changeset: "[Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing" https://bugs.webkit.org/show_bug.cgi?id=217783 https://trac.webkit.org/changeset/269486 2020-11-06 Wenson Hsieh Add some missing header includes in WebAuthenticatorCoordinator.cpp https://bugs.webkit.org/show_bug.cgi?id=218661 Reviewed by Simon Fraser. Add the missing headers. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: 2020-11-06 Brent Fulgham [macOS] Allow IOAVDHEVCDecodeCapabilities on Intel https://bugs.webkit.org/show_bug.cgi?id=218639 Reviewed by Eric Carlson. The current rule for IOAVDHEVCDecodeCapabilities is incorrect for macOS 11. We should allow this access on Intel, too. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-06 Milan Crha [GTK] Application cannot override drag&drop callbacks https://bugs.webkit.org/show_bug.cgi?id=218562 Reviewed by Michael Catanzaro. * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::DropTarget): Use g_signal_connect_after(), thus any descendants can override the callbacks. (WebKit::DropTarget::didPerformAction): Always call gdk_drag_status(), to have gtk+ notified about drag progress. 2020-11-06 Michael Catanzaro [GTK] dlopen libWPEBackend-fdo-1.0.so.1 instead of libWPEBackend-fdo-1.0.so https://bugs.webkit.org/show_bug.cgi?id=218584 Reviewed by Carlos Garcia Campos. wpe_loader_init() tries to dlopen a development symlink, but these will not usually be installed. It only works in the GNOME flatpak runtime because we don't use devel split rules in the GNOME runtime, but we really ought to, and freedesktop-sdk already does, so it's going to break upstream too once that gets implemented. It's easier for everyone if we tackle this now. Since all major distros except Arch Linux use devel split, this patch is really required for almost every distro to use WPE renderer. The downside is that this makes it harder to update the wpebackend-fdo library version, since minor changes there will now unnecessarily break WebKit. This is not good, but it's better than forcing distros to apply this same patch downstream. I considered trying a bunch of different library versions in a loop in order to maximize the chance of success in case the wpebackend-fdo library version increases in the future, but it's probably nicer to just be careful about not changing its library version until we find a better solution for this. * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): 2020-11-05 Said Abou-Hallawa [GPU Process] Use the Ref counting of ImageBuffer to control its life cycle in Web Process and GPU Process https://bugs.webkit.org/show_bug.cgi?id=218529 Reviewed by Simon Fraser. When a DrawImageBuffer item is appended to DisplayList, a Ref will be cached till the DisplayList items list is cleared. So no need to lock the remote resource in RemoteResourceCacheProxy. All we need to is to pass the ImageBufferHashMap which is maintained by the DisplayList or by RemoteResourceCache to the DisplayList::Replayer. It is going to be used to resolve the RenderingResourceIdentifer to an ImageBuffer so the DrawImageBuffer can be applied. No need to special-case DrawImageBuffer::apply() in the RemoteImageBuffer. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::applyResourceItem): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.h: (WebKit::RemoteRenderingBackend::remoteResourceCache): * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheImageBuffer): * GPUProcess/graphics/RemoteResourceCache.h: (WebKit::RemoteResourceCache::imageBuffers const): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::releaseImageBuffer): (WebKit::RemoteResourceCacheProxy::RemoteResourceCacheProxy): Deleted. (WebKit::RemoteResourceCacheProxy::lockRemoteImageBufferForRemoteClient): Deleted. (WebKit::RemoteResourceCacheProxy::lockRemoteResourceForRemoteClient): Deleted. (WebKit::RemoteResourceCacheProxy::releaseRemoteResource): Deleted. (WebKit::RemoteResourceCacheProxy::unlockRemoteResourcesForRemoteClient): Deleted. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2020-11-05 Brent Fulgham [macOS] Remove mdnsresponder access from WebKit processes https://bugs.webkit.org/show_bug.cgi?id=218633 Unreviewed follow-up: Make the sandbox rule conditional on recent macOS to avoid breaking STP use on older macOS releases. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-05 Alex Christensen Add null checks effectively in UserInputBridge https://bugs.webkit.org/show_bug.cgi?id=218622 Reviewed by Wenson Hsieh. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::stopLoadingFrame): (WebKit::WebPage::stopLoading): (WebKit::WebPage::reload): 2020-11-05 Brent Fulgham [macOS] Remove mdnsresponder access from WebKit processes https://bugs.webkit.org/show_bug.cgi?id=218633 Reviewed by Per Arne Vollan. Now that all network loading (including media) happens in the Network process, we can remove an old permission to open outbound connections to mdnsresponder. This is also unneeded in the GPU process, for the same reason. I noticed that the new WebAuthn process sandbox mistakenly included this, and removed it there, too. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-05 John Wilander PCM: Switch to JSON report format https://bugs.webkit.org/show_bug.cgi?id=218634 Reviewed by Brent Fulgham. The standards conversation has landed in attribution reports in a JSON format as opposed to the currently implemented URL format. Discussion here: https://github.com/privacycg/private-click-measurement/issues/30 * NetworkProcess/AdClickAttributionManager.cpp: (WebKit::AdClickAttributionManager::fireConversionRequest): 2020-11-05 Brian Burg [Cocoa] Inspector Extensions: Add _WKInspectorExtension and related plumbing https://bugs.webkit.org/show_bug.cgi?id=217783 Reviewed by Devin Rousso. _WKInspectorExtension is new SPI that represents a Web Extension that uses the 'devtools' API to interact with Web Inspector. An extension is associated with its _WKInspectorExtensionHost. A WebKit client that supports Web Extensions can use this class to implement 'devtools' extension APIs. Add _WKInspectorExtensionHost methods to register and unregister an extension. Add plumbing so that the extension in registered in the frontend with WI.InspectorExtensionController. Later patches will flesh out the needed functionality to implement rest of the 'devtools' API. * Sources.txt: * SourcesCocoa.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * WebKit.xcodeproj/project.pbxproj: Add new files. * Scripts/webkit/messages.py: If a message includes InspectorExtensionError, then generate an include for InspectorExtensionTypes.h where it is declared. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): New API object type. * Shared/InspectorExtensionTypes.h: Added error code enum and useful type aliases. * Shared/InspectorExtensionTypes.cpp: (WebKit::inspectorExtensionErrorToString): * UIProcess/API/APIInspectorExtension.h: * UIProcess/API/APIInspectorExtension.cpp: (API::InspectorExtension::create): (API::InspectorExtension::InspectorExtension): (API::InspectorExtension::~InspectorExtension): Added. This is a placeholder object that's used for the wrapper system, since we don't have single C++ objects for each extension to back the API object. * UIProcess/API/Cocoa/_WKInspector.h: * UIProcess/API/Cocoa/_WKInspector.mm: (-[_WKInspector registerExtensionWithID:displayName:completionHandler:]): (-[_WKInspector unregisterExtension:completionHandler:]): Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. * UIProcess/API/Cocoa/_WKInspectorExtension.h: * UIProcess/API/Cocoa/_WKInspectorExtension.mm: (-[_WKInspectorExtension initWithIdentifier:]): (-[_WKInspectorExtension dealloc]): (-[_WKInspectorExtension _apiObject]): (-[_WKInspectorExtension extensionID]): Added. This is a data object that's also used as a token to unregister the extension. * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: Add new SPI. * UIProcess/API/Cocoa/_WKInspectorExtensionInternal.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController registerExtensionWithID:displayName:completionHandler:]): (-[_WKRemoteWebInspectorViewController unregisterExtension:completionHandler:]): Implement new _WKInspectorExtensionHost methods. Send IPC to the Inspector web process. * UIProcess/Inspector/RemoteWebInspectorProxy.h: * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: Add FrontendLoaded. (WebKit::RemoteWebInspectorProxy::extensionController const): Added. * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::frontendLoaded): (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow): Set up the extension controller object after the frontend has been created. Hook up the FrontendLoaded event sent from Inspector web process so that the extension controller can be notified of when it's safe to message the frontend. * UIProcess/Inspector/WebInspectorProxy.cpp: (WebKit::WebInspectorProxy::createFrontendPage): (WebKit::WebInspectorProxy::closeFrontendPageAndWindow): (WebKit::WebInspectorProxy::frontendLoaded): Set up the extension controller object after the frontend has been created. * UIProcess/Inspector/WebInspectorProxy.h: (WebKit::WebInspectorProxy::extensionController const): Added. * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h: * UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp: Added. (WebKit::WebInspectorUIExtensionControllerProxy::WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::~WebInspectorUIExtensionControllerProxy): (WebKit::WebInspectorUIExtensionControllerProxy::whenFrontendHasLoaded): (WebKit::WebInspectorUIExtensionControllerProxy::inspectorFrontendLoaded): (WebKit::WebInspectorUIExtensionControllerProxy::registerExtension): (WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension): Added. Forward API requests to the Web Inspector's web process to be evaluated in the frontend. * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: (WebKit::WebInspectorFrontendAPIDispatcher::dispatchCommand): Add a more generic way to encode values to be passed as arguments to InspectorFrontendAPI.dispatch. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::establishConnection): (WebKit::WebInspectorUI::closeWindow): * WebProcess/Inspector/WebInspectorUI.h: (WebKit::WebInspectorUI::frontendPage const): Added. (WebKit::WebInspectorUI::frontendAPIDispatcher): Added. * WebProcess/Inspector/WebInspectorUIExtensionController.h: * WebProcess/Inspector/WebInspectorUIExtensionController.messages.in: Added. * WebProcess/Inspector/WebInspectorUIExtensionController.cpp: Added. (WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController): (WebKit::WebInspectorUIExtensionController::registerExtension): (WebKit::WebInspectorUIExtensionController::unregisterExtension): (WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromResult): Handle incoming messages by forwarding the associated command to WI.WebExtensionController via InspectorFrontendAPI evaluations. * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: Fallout from unified build chunking shifts. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::getExistingCredentials): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): Fallout from unified build chunking shifts, but more. 2020-11-05 Per Arne Vollan [macOS] Update message filters in the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=218520 Reviewed by Brent Fulgham. Based on telemetry, update the message filters with allowed messages in the WebContent sandbox. No new tests, covered by existing tests. * WebProcess/com.apple.WebProcess.sb.in: 2020-11-05 Ryan Haddad Unreviewed, fix the build with recent SDKs. * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::platformInvalidate): 2020-11-05 Don Olmstead Non-unified build fixes, early November 2020 edition https://bugs.webkit.org/show_bug.cgi?id=218628 Unreviewed non-unified build fix. * UIProcess/SpeechRecognitionServer.cpp: (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::removePendingRequest): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: 2020-11-05 Ryan Haddad Unreviewed, fix the build with recent SDKs. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::kill): 2020-11-05 Brent Fulgham [iOS] Remove redundant rule using never-granted extension https://bugs.webkit.org/show_bug.cgi?id=218596 Reviewed by Per Arne Vollan. WebKit has long had a sandbox rule granting the ability to issue iokit-open operations if a particular security extension was granted to the process. The WebKit processes are known to never grant this extension, so this rule is not needed. We should remove the rule to reduce sandbox complexity and increase the speed of sandbox compilation. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-11-05 Brent Fulgham [iOS] Remove redundant rule for shared-preference.read-write https://bugs.webkit.org/show_bug.cgi?id=218594 Reviewed by Per Arne Vollan. We have long had a rule to allow shared preferences to be read and written if a particular sandbox extension was granted to the process. However, we do not issue this extension to any WebKit process, so the rule is unnecessary. We should remove it to reduce confusion, and make the sandbox smaller (and quicker to compile). * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: 2020-11-03 Darin Adler Remove more functions that implicitly use composed tree https://bugs.webkit.org/show_bug.cgi?id=218544 Reviewed by Ryosuke Niwa. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::constrainRangeToSelection): Factored this function out of the requestDocumentEditingContext and also rewrote it to use higher level operations. (WebKit::WebPage::requestDocumentEditingContext): Refactored to use the new constrainRangeToSelection. 2020-11-05 Alex Christensen Store WeakPtr instead of Frame* https://bugs.webkit.org/show_bug.cgi?id=218599 Reviewed by Youenn Fablet. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::initWithCoreMainFrame): (WebKit::WebFrame::createSubframe): (WebKit::WebFrame::coreFrame const): (WebKit::WebFrame::info const): (WebKit::WebFrame::handlesPageScaleGesture const): (WebKit::WebFrame::requiresUnifiedScaleFactor const): * WebProcess/WebPage/WebFrame.h: (WebKit::WebFrame::coreFrame const): Deleted. 2020-11-05 Alex Christensen Use fewer raw pointers and more const correctness in Frame.h https://bugs.webkit.org/show_bug.cgi?id=218598 Reviewed by Youenn Fablet. * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: (WebKit::toWebFrameLoaderClient): 2020-11-05 Carlos Garcia Campos WebDriver: handle surrogate pairs in keyboard actions https://bugs.webkit.org/show_bug.cgi?id=218279 Reviewed by Brian Burg. And fail with invalid argument if the string can be represented as a single code point. Fixes: imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f604] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_codepoint_keys_behave_correctly[\U0001f60d] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[fa] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u0ba8\u0bbfb] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u0ba8\u0bbf\u0ba8] imported/w3c/webdriver/tests/perform_actions/key_special_keys.py::test_invalid_multiple_codepoint_keys_fail[\u1100\u1161\u11a8c] * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::pressedCharKey): (WebKit::WebAutomationSession::performInteractionSequence): 2020-11-05 Jiewen Tan [WebAuthn] Determine an AAGUID for the platform authenticators https://bugs.webkit.org/show_bug.cgi?id=217945 Reviewed by Brent Fulgham. Relying parties use the AAGUID to recognize supported authenticators. Using a NULL AAGUID blocks them from recognizing Apple products as valid WebAuthentication targets. We need to assign ourselves a GUID representing Apple authenticators, then publish with our attestation certificate and with the FIDO Alliance. Covered by existing tests. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::aaguidVector): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): 2020-11-05 Carlos Garcia Campos WebDriver: session can have more than one active input source of the same type https://bugs.webkit.org/show_bug.cgi?id=218382 Reviewed by Brian Burg. We are failing in that case, and the dispatcher assumes it's not possible, but the spec doesn't say there's such limitation and there's a WPT infrastructure test checking that (infrastructure/testdriver/actions/eventOrder.html). * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputKeyFrame::keyFrameFromStateOfInputSources): Input sources are now stored in a HashMap. (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): Ditto. (WebKit::SimulatedInputDispatcher::run): We don't need to copy the given input sources, since they are owned by the session. (WebKit::SimulatedInputDispatcher::finishDispatching): Ditto. * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::WebAutomationSession): Do not create initial input sources for each type. (WebKit::WebAutomationSession::performInteractionSequence): Check there aren't multiple input sources with the same ID, but don't fail if there are multiple input sources with the same type. (WebKit::WebAutomationSession::cancelInteractionSequence): Clear the active input sources. (WebKit::WebAutomationSession::inputSourceForType): Removed. * UIProcess/Automation/WebAutomationSession.h: 2020-11-04 Said Abou-Hallawa [GPU Process] Move the internal GPU rendering flags from WebPage to WebProcess https://bugs.webkit.org/show_bug.cgi?id=218549 Reviewed by Tim Horton. Move UseGPUProcessForCanvasRendering from WebPage to WebProcess. Add a new setting for UseGPUProcessForDOMRendering to WebProcess. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Encode/decode the flags from the UI Process to the Web Process. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): Read the flags in from the preferences. * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::setUseGPUProcess): (WebKit::RemoteMediaPlayerManager::updatePreferences): Deleted. * WebProcess/GPU/media/RemoteMediaPlayerManager.h: These flags belong to WebKit so they should not be accessed through the Settings. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): (WebKit::WebPage::shouldUseRemoteRenderingFor): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setUseGPUProcessForCanvasRendering): (WebKit::WebProcess::setUseGPUProcessForDOMRendering): (WebKit::WebProcess::shouldUseRemoteRenderingFor): * WebProcess/WebProcess.h: The rendering and media flags can now be accessed from the WebPorcess. 2020-11-04 Aditya Keerthi [Contact Picker API] Add support for picker UI on iOS https://bugs.webkit.org/show_bug.cgi?id=218189 Reviewed by Devin Rousso. ContactsManager.select() should present a contact picker on platforms which support one. This patch enables the end-to-end functionality on iOS, presenting a contact picker upon a call to the API and returning the selected contacts upon dismissal. Tests: contact-picker/contacts-select-after-dismissing-picker.html contact-picker/contacts-select-while-presenting-picker.html contact-picker/contacts-select.html * Platform/spi/Cocoa/ContactsUISPI.h: Added. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _didPresentContactPicker]): (-[WKWebView _didDismissContactPicker]): (-[WKWebView _dismissContactPickerWithContacts:]): * UIProcess/Cocoa/WKContactPicker.h: Added. * UIProcess/Cocoa/WKContactPicker.mm: Added. WKContactPicker is a WebKit wrapper around CNContactPickerViewController. (-[WKCNContactPickerDelegate initWithContactPickerDelegate:]): WKCNContactPickerDelegate is wrapper around CNContactPickerDelegate. This is necessary as single/multiple selection in a CNContactPickerViewController is determined by which delegate methods are implemented. The two specializations of this class include the methods necessary to present a single-select and multi-select picker respectively. (-[WKCNContactPickerDelegate contactPickerDidCancel:]): (-[WKCNContactPickerSingleSelectDelegate contactPicker:didSelectContact:]): (-[WKCNContactPickerMultiSelectDelegate contactPicker:didSelectContacts:]): (-[WKContactPicker delegate]): (-[WKContactPicker setDelegate:]): (-[WKContactPicker initWithView:]): (-[WKContactPicker presentWithRequestData:completionHandler:]): (-[WKContactPicker contactPickerDidCancel:]): This delegate method is called when the picker is dismissed by tapping the done button or when the picker is dismissed by swiping down. (-[WKContactPicker contactPicker:didSelectContact:]): (-[WKContactPicker contactPicker:didSelectContacts:]): (-[WKContactPicker _contactPickerDidDismissWithContactInfo:]): (-[WKContactPicker _contactInfoFromCNContact:]): (-[WKContactPicker dismissWithContacts:]): (-[WKContactPicker _contactsFromJSContacts:]): * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::showContactPicker): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _showContactPicker:completionHandler:]): (-[WKContentView contactPickerDidPresent:]): (-[WKContentView contactPickerDidDismiss:]): (-[WKContentView _dismissContactPickerWithContacts:]): * WebKit.xcodeproj/project.pbxproj: 2020-11-04 Chris Dumez Unreviewed, fix build with very recent SDK by silencing a deprecation warning. * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::ConnectionTerminationWatchdog::watchdogTimerFired): 2020-11-04 Chris Dumez REGRESSION(r268161?): [ macOS ] imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/processing-after-resume.https.html is a flaky failure https://bugs.webkit.org/show_bug.cgi?id=217542 Reviewed by Youenn Fablet. When the script calls suspend(), we call AudioDestinationCocoa::stop() to stop rendering and then resolve the suspend promise. At this point, the script saves the AudioContext's current sample frame and expects this value to not change until the AudioContext is resumed. The issue was that we previously were potentially resolving the promise on the main thread while the last rendering quantum was still being processed on the AudioWorklet thread. This meant that the sample frame could still increase a bit, a short while after the suspend promise has been resolved. To address the issue, we now to a round trip to the AudioWorklet thread after stopping rendering, to make sure we only resolve the promise after the last rendering quantum has been processed on the AudioWorklet thread. * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::stop): 2020-11-04 Said Abou-Hallawa [GPU Process] Enable Document based ImageBitmap and OffscreenCanvas drawing to use GPU Process rendering https://bugs.webkit.org/show_bug.cgi?id=217735 Reviewed by Simon Fraser. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: putImageData() might be called immediately after creating the ImageBuffer and before receiving the RemoteRenderingBackend.CreateImageBufferBackend message. We need to handle for this case and avoid asserting. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): If the size of the ImageBuffer is very big, no remote ImageBuffer can be created. So we have to be bail out quietly in this case. 2020-11-04 David Kilzer WebKit should remove unused debug variant support Reviewed by Darin Adler. Remove support for building the debug variant since it is currently unused. We now set default values for the DEAD_CODE_STRIPPING, DEBUG_DEFINES, GCC_OPTIMIZATION_LEVEL and STRIP_INSTALLED_PRODUCT variables. Also move these values out of the Xcode project into Base.xcconfig files using the [config=Debug] specifier so that these overrides are next to the definitions. Additional changes in behavior are noted below. * Configurations/Base.xcconfig: * WebKit.xcodeproj/project.pbxproj: - STRIP_INSTALLED_PRODUCT is now set to NO for Debug builds. Previously symbols were always stripped in Debug builds. 2020-11-04 Wenson Hsieh Add some missing header includes in media sources https://bugs.webkit.org/show_bug.cgi?id=218568 Reviewed by Eric Carlson. * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp: Include `WebCoreArgumentCoders.h`, since we need to know how to encode a `MediaPlaybackTargetContext`. * WebProcess/GPU/webrtc/MediaRecorderPrivate.h: Add a missing `WebCore::` namespace. 2020-11-04 Luming Yin [watchOS] Don't allow managed preference to enable legacy sync XHRs on watchOS https://bugs.webkit.org/show_bug.cgi?id=218548 Reviewed by Geoffrey Garen. The managed preference to allow legacy sync XHRs during page dismissal is not applicable to watchOS, but we still attempt to dlopen ManagedConfiguration to get the managed configuration value. This redundant check blocks the main thread and leads to hangs. We now compile out this code for the watchOS platforms. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled): * Shared/WebPreferencesDefaultValues.h: * Shared/ios/WebPreferencesDefaultValuesIOS.mm: 2020-11-04 Dean Jackson WKContentView might get KVO notifications it doesn't expect https://bugs.webkit.org/show_bug.cgi?id=218558 Reviewed by Tim Horton. It's possible that code elsewhere in the system adds KVO observation to the CALayer of a WKContentView, which is a problem because our implementation of observeValue only expects calls that it registered for. Fix this by passing a context to the registration and passing the observation call onto the superclass if it isn't the expected context. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView observeValueForKeyPath:ofObject:change:context:]): 2020-11-04 Youenn Fablet Make functional WebRTC encoders in GPUProcess https://bugs.webkit.org/show_bug.cgi?id=218498 Reviewed by Eric Carlson. Update code according libwebrtc changes. Add missing support for timestamp. Also, in case of samples that are non IO Surface and not BGRA, do a conversion to BGRA and then create an IO surface from it. This allows supporting sending black frames generated in case of muted tracks. Create a remote factory in LibWebRTCProvider based on whether using gpu process or not. * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::encodeFrame): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::createVideoDecoder): (WebKit::encodeVideoFrame): (WebKit::toWebRTCCodecType): (WebKit::LibWebRTCCodecs::createEncoder): (WebKit::LibWebRTCCodecs::encodeFrame): (WebKit::LibWebRTCCodecs::completedEncoding): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.mm: Added. (WebKit::LibWebRTCCodecs::convertToBGRA): * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: (WebKit::LibWebRTCProvider::createEncoderFactory): * WebProcess/Network/webrtc/LibWebRTCProvider.h: 2020-11-03 Sihui Liu Set up basic infrastructure for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=218216 Reviewed by Youenn Fablet. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Scripts/webkit/messages.py: * Sources.txt: * UIProcess/SpeechRecognitionServer.cpp: Added. (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::processNextPendingRequestIfNeeded): (WebKit::SpeechRecognitionServer::stop): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::removePendingRequest): (WebKit::SpeechRecognitionServer::invalidate): (WebKit::SpeechRecognitionServer::startPocessingRequest): (WebKit::SpeechRecognitionServer::stopProcessingRequest): (WebKit::SpeechRecognitionServer::messageSenderConnection const): (WebKit::SpeechRecognitionServer::messageSenderDestinationID const): * UIProcess/SpeechRecognitionServer.h: Added. * UIProcess/SpeechRecognitionServer.messages.in: Added. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): (WebKit::WebProcessProxy::destroySpeechRecognitionServer): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: Added. (WebKit::WebSpeechRecognitionConnection::create): (WebKit::WebSpeechRecognitionConnection::WebSpeechRecognitionConnection): (WebKit::WebSpeechRecognitionConnection::~WebSpeechRecognitionConnection): (WebKit::WebSpeechRecognitionConnection::registerClient): (WebKit::WebSpeechRecognitionConnection::start): (WebKit::WebSpeechRecognitionConnection::stop): (WebKit::WebSpeechRecognitionConnection::abort): (WebKit::WebSpeechRecognitionConnection::invalidate): (WebKit::WebSpeechRecognitionConnection::didReceiveUpdate): (WebKit::WebSpeechRecognitionConnection::messageSenderConnection const): (WebKit::WebSpeechRecognitionConnection::messageSenderDestinationID const): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: Added. * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.messages.in: Added. * WebProcess/WebCoreSupport/WebSpeechRecognitionProvider.h: Added. * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::encodeArgument): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): 2020-11-03 Brent Fulgham [macOS] remove sysctl.oidfmt. access https://bugs.webkit.org/show_bug.cgi?id=218524 Reviewed by Per Arne Vollan. Access to "sysctl.oidfmt." was needed due to a bug . Since that issue has been fixed, we can remove the access. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-03 Rini Patel [GPU Process] Flush canvas displayList from doAfterUpdateRendering https://bugs.webkit.org/show_bug.cgi?id=218401 Reviewed by Simon Fraser. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::flushDrawingContextAndCommit): Deleted. 2020-11-03 Wenson Hsieh Replace DisplayList::Recorder::Delegate::(will|did)AppendItem with (will|did)AppendItemOfType https://bugs.webkit.org/show_bug.cgi?id=218518 Reviewed by Simon Fraser. See WebCore ChangeLog for more information. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-11-03 Wenson Hsieh Add helper methods to encode and decode IPC arguments as raw data https://bugs.webkit.org/show_bug.cgi?id=218516 Reviewed by Geoff Garen. Add new helper methods to `IPC::Encoder` and `IPC::Decoder` that can be used to convert anything that can be sent as an IPC argument into raw bytes (i.e. using `WebCore::SharedBuffer`), as long as there are no IPC attachments in the encoded data. For more details, see . * Platform/IPC/Decoder.cpp: (IPC::Decoder::Decoder): Add private versions of the Encoder and Decoder constructors that avoid IPC header data. These constructors are called only from within `encodeSingleObject` and `decodeSingleObject`, respectively. (IPC::m_bufferDeallocator): * Platform/IPC/Decoder.h: (IPC::Decoder::decodeSingleObject): * Platform/IPC/Encoder.cpp: (IPC::Encoder::Encoder): (IPC::Encoder::releaseAttachments): (IPC::Encoder::hasAttachments const): * Platform/IPC/Encoder.h: 2020-11-03 Stephan Szabo [WinCairo/PlayStation] ICU 68.1 no longer exposes FALSE and TRUE macros by default https://bugs.webkit.org/show_bug.cgi?id=218522 Reviewed by Don Olmstead. * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: Replace FALSE with false 2020-11-03 Said Abou-Hallawa [GPU Process] Make ImageBuffer RefCounted https://bugs.webkit.org/show_bug.cgi?id=218472 Reviewed by Simon Fraser. Currently after a remote ImageBuffer is deleted, its identifier is locked in the RemoteResourceCacheProxy till no remote client is referencing it. Then an IPC message is sent to GPU Process to release it. The plan is to decode the DisplayList::DrawImageBuffer by replacing the ImageBuffer identifier with a RefPtr to the ImageBuffer itself. Once the ImageBuffer is removed from the RemoteResourceCache, it is going to be deleted after the last DrawImageBuffer is replayed back. So no locking is needed to guarantee the existence of the ImageBuffer when it is drawn. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::flushDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackend::getImageData): * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheImageBuffer): * GPUProcess/graphics/RemoteResourceCache.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createSelectionSnapshot const): 2020-11-03 Wenson Hsieh Replace DisplayList::itemCount with DisplayList::isEmpty https://bugs.webkit.org/show_bug.cgi?id=218517 Reviewed by Geoffrey Garen. Separately keep track of the item count in the context's display list. See WebCore/ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: Use `isEmpty()` instead of checking `itemCount()`. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::flushDrawingContextAndCommit): 2020-11-02 Simon Fraser Scroll position can get reset after programmatic scroll https://bugs.webkit.org/show_bug.cgi?id=218477 Reviewed by Antti Koivisto. * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): 2020-11-03 Brent Fulgham [macOS] Adopt additional QuartzCore entitlement to reduce accessible endpoints https://bugs.webkit.org/show_bug.cgi?id=218466 Reviewed by Per Arne Vollan. In iOS 14 we adopted a new entitlement that limited the set of XPC endpoints available to QuartzCore clients. We should do the same on macOS to provide a similar level of protection. * Scripts/process-entitlements.sh: 2020-11-03 Youenn Fablet Add support for WebRTC VP9 decoder in GPU process https://bugs.webkit.org/show_bug.cgi?id=218445 Reviewed by Eric Carlson. Add support for VP9 decoder, send key frame size as IPC message specifically for VP9 hardware decoder. If GPU process does not enable either SW or HW VP9 decoder, we fall back to in process VP9 decoder. Manually tested by enabling WebRTC codec in GPU process. Will be covered by existing VP9 tests in GPU process mode once canvas in GPUProcess is fully supported. * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::createVP9Decoder): (WebKit::LibWebRTCCodecsProxy::setFrameSize): * WebProcess/GPU/GPUProcessConnection.h: (WebKit::GPUProcessConnection::isVP9DecoderEnabled const): (WebKit::GPUProcessConnection::isVPSWDecoderEnabled const): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::createVideoDecoder): (WebKit::decodeVideoFrame): (WebKit::LibWebRTCCodecs::setCallbacks): (WebKit::LibWebRTCCodecs::createDecoder): (WebKit::LibWebRTCCodecs::decodeFrame): (WebKit::formatNameFromCodecType): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: (WebKit::LibWebRTCCodecs::setVP9VTBSupport): (WebKit::LibWebRTCCodecs::supportVP9VTB const): 2020-11-03 Youenn Fablet Allow low latency H264 encoder in GPUProcess https://bugs.webkit.org/show_bug.cgi?id=218442 Reviewed by Eric Carlson. Pass useLowLatency boolean from WebProcess to GPUProcess. * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::createEncoder): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::completedDecoding): (WebKit::LibWebRTCCodecs::createEncoder): 2020-11-03 Chris Lord [GTK] Zooming causes page to scroll to top https://bugs.webkit.org/show_bug.cgi?id=217955 Reviewed by Carlos Garcia Campos. Don't reset page scale when setting zoom level on GLIB backend. * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_set_zoom_level): 2020-11-03 Adrian Perez de Castro [GTK][WPE] Cannot remove individual scripts/stylesheets using WebKitUserContentManager https://bugs.webkit.org/show_bug.cgi?id=218403 Reviewed by Carlos Garcia Campos. Add the missing WebKitUserContentManager functions which allow removing a single script and style sheet from the manager. Given that it is possible to remove a single content filter and message handlers already, this make the API orthogonal for scripts and style sheets as well. * UIProcess/API/glib/WebKitUserContentManager.cpp: (webkit_user_content_manager_remove_style_sheet): Added. (webkit_user_content_manager_remove_script): Added. * UIProcess/API/gtk/WebKitUserContentManager.h: Add declarations for the new functions. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Ditto. * UIProcess/API/wpe/WebKitUserContentManager.h: Ditto. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Ditto. 2020-11-02 Ryosuke Niwa Remove some useless comments from .messages.in files https://bugs.webkit.org/show_bug.cgi?id=218473 Reviewed by Tim Horton. Remove comments that simply repeats what the code says. * GPUProcess/GPUProcess.messages.in: * NetworkProcess/NetworkProcess.messages.in: * WebProcess/WebProcess.messages.in: 2020-11-02 Devin Rousso guard UIScribbleInteraction class property observing behind a LOA check https://bugs.webkit.org/show_bug.cgi?id=218463 Reviewed by Tim Horton. Some apps appear to swizzle `-[NSObject addObserver:forKeyPath:options:context:]` without support for the fact that the object can be a class rather than an instance and therefore crash. Use a LOA check to guard observing `+[UIScribbleInteraction isPencilInputExpected]` so that this doesn't happen, but only until the apps update, at which point they can fix it. * UIProcess/ios/WKStylusDeviceObserver.mm: (-[WKStylusDeviceObserver start]): (-[WKStylusDeviceObserver stop]): 2020-11-02 James Savage Changes to SWIFT_MODULE_ONLY_ARCHS https://bugs.webkit.org/show_bug.cgi?id=218404 Reviewed by Tim Horton. * SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Simplify how we specify these options. 2020-11-02 Aditya Keerthi [iOS] Link Contacts.framework during build https://bugs.webkit.org/show_bug.cgi?id=218289 Reviewed by Andy Estes. Contacts.framework is currrently soft linked in PaymentAuthorizationPresenter. Soft linking is generally discouraged, since it requires running the linker at runtime, leading to an unwanted performance cost. By normally linking the framework, the linkage is declared at build time, which enables running the linker at build/update/install time and avoiding the runtime cost. Unfortunately, we still have to soft link the framework on macOS, to avoid introducing a dependency cycle. Upward linking is not an option, since the Contacts framework does not implement InstallAPI. The SOFT_LINK_FRAMEWORK macro has been kept in PaymentAuthorizationPresenter to avoid introducing additional #ifs. This should be fine to keep on iOS, since the framework will already loaded in the address space, and the call to dlopen() should be much less expensive. * Configurations/WebKit.xcconfig: * Platform/cocoa/PaymentAuthorizationPresenter.mm: 2020-11-02 Chris Dumez Crash under ProcessThrottler::setAssertionType() https://bugs.webkit.org/show_bug.cgi?id=218448 Reviewed by Geoffrey Garen. A ProcessThrottler object is owned by its associated AuxiliaryProcessProxy. The crash was happening in ProcessThrottler::setAssertionType(), we would replace m_assertion with a new "Suspended" assertion and then crash on the next line when using m_assertion. The reason we crash is that when we replaced m_assertion with a new assertion, the destruction of the previous assertion caused the UIProcess's background task to get released (because this was the last non-suspended process assertion). When we release the UIProcess' background task, we call WebProcessPool::notifyProcessPoolsApplicationIsAboutToSuspend(), which destroys non-critical WebProcesses (e.g. WebProcesses in the back/forward cache), which in turns destroy their ProcessThrottler. As a result, when replacing m_assertion, the ProcessAssertion may get destroyed, which is why we would crash on the next line when trying to use m_assertion. To address the issue, we now release the UIProcess's background task asynchronously when releasing the last non-suspended ProcessAssertion, making sure we still need to release the assertion beforehand. This has 2 benefits: - The ProcessThrottler can no longer get destroyed synchronously when releasing its ProcessAssertion. - In the case where the ProcessThrottler replaces a foreground assertion with a background assertion (or vice-versa) and this is the last non-suspended assertion, this avoids unnecessarily releasing and retaking the UIProcess's background task. This also avoids killing non-critical processes unnecessarily. * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]): 2020-11-02 Brent Fulgham [macOS] Remove unneeded shmem access to ColorSync https://bugs.webkit.org/show_bug.cgi?id=218395 Reviewed by Per Arne Vollan. ColorSync on macOS has not used shared memory since Mac OS X 10.7, and our sandbox should not have this access. Removing this unused shared memory capability. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2020-11-01 Darin Adler Start removing functions that implicitly use composed tree https://bugs.webkit.org/show_bug.cgi?id=218424 Reviewed by Ryosuke Niwa. * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::getPlatformEditorState const): Use contains. 2020-11-02 David Kilzer Fix link error with WebKit.framework Undefined symbols for architecture x86_64: "JSC::GenericTypedArrayView::create(WTF::RefPtr, WTF::DefaultRefDerefTraits >&&, unsigned int, unsigned int)", referenced from: WebKit::convertToUint8Array(IPC::SharedBufferCopy&&) in UnifiedSource7.o ld: symbol(s) not found for architecture x86_64 * GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp: - Include to fix linker error with some builds of WebKit. - See also WebProcess/GPU/media/RemoteLegacyCDMSession.cpp. 2020-11-02 Youenn Fablet Stop sending origins from WebProcess to UIProcess for getUserMedia requests https://bugs.webkit.org/show_bug.cgi?id=218192 Reviewed by Eric Carlson. Pass directly a UserMediaRequestIdentifier through IPC. Stop passing origins from IPC and instead compute them from UIProcess side. * Scripts/webkit/messages.py: * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): (WebKit::UserMediaPermissionRequestManagerProxy::grantRequest): (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest): (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest): (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): * UIProcess/UserMediaPermissionRequestManagerProxy.h: * UIProcess/UserMediaPermissionRequestProxy.cpp: (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy): * UIProcess/UserMediaPermissionRequestProxy.h: (WebKit::UserMediaPermissionRequestProxy::create): (WebKit::UserMediaPermissionRequestProxy::userMediaID const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest): (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted): (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasDenied): (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices): * WebProcess/MediaStream/UserMediaPermissionRequestManager.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::userMediaAccessWasGranted): (WebKit::WebPage::userMediaAccessWasDenied): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2020-11-01 Sam Weinig Remove remaining alternative preference setting mechanisms from LayoutTests https://bugs.webkit.org/show_bug.cgi?id=218417 Reviewed by Simon Fraser. Remove now unused bundle SPI that was only used by the WebKitTestRuner. * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleOverrideBoolPreferenceForTestRunner): Deleted. (WKBundleSetAllowUniversalAccessFromFileURLs): Deleted. (WKBundleSetAllowFileAccessFromFileURLs): Deleted. (WKBundleSetAllowStorageAccessFromFileURLS): Deleted. (WKBundleSetMinimumLogicalFontSize): Deleted. (WKBundleSetFrameFlatteningEnabled): Deleted. (WKBundleSetJavaScriptCanAccessClipboard): Deleted. (WKBundleSetPopupBlockingEnabled): Deleted. (WKBundleSetAuthorAndUserStylesEnabled): Deleted. * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::addOriginAccessAllowListEntry): (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Deleted. (WebKit::InjectedBundle::setAllowUniversalAccessFromFileURLs): Deleted. (WebKit::InjectedBundle::setAllowFileAccessFromFileURLs): Deleted. (WebKit::InjectedBundle::setNeedsStorageAccessFromFileURLsQuirk): Deleted. (WebKit::InjectedBundle::setMinimumLogicalFontSize): Deleted. (WebKit::InjectedBundle::setFrameFlatteningEnabled): Deleted. (WebKit::InjectedBundle::setAsyncFrameScrollingEnabled): Deleted. (WebKit::InjectedBundle::setJavaScriptCanAccessClipboard): Deleted. (WebKit::InjectedBundle::setPopupBlockingEnabled): Deleted. (WebKit::InjectedBundle::setAuthorAndUserStylesEnabled): Deleted. * WebProcess/InjectedBundle/InjectedBundle.h: 2020-10-31 Simon Fraser Clean up BoxSide and BorderEdge code https://bugs.webkit.org/show_bug.cgi?id=218197 Reviewed by Sam Weinig. * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (boxSide): 2020-10-30 Brian Burg Web Inspector: move InspectorFrontendAPIDispatcher to WebCore, clean up uses https://bugs.webkit.org/show_bug.cgi?id=217835 Reviewed by Devin Rousso. Adopt the JSONValue-based InspectorFrontendAPIDispatcher::dispatch() method in WebInspectorUI and RemoteInspectorUI methods that dispatch to the frontend. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: Move files. * WebProcess/Inspector/RemoteWebInspectorUI.h: * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::RemoteWebInspectorUI): (WebKit::RemoteWebInspectorUI::initialize): (WebKit::RemoteWebInspectorUI::updateFindString): (WebKit::RemoteWebInspectorUI::didSave): (WebKit::RemoteWebInspectorUI::didAppend): (WebKit::RemoteWebInspectorUI::frontendLoaded): (WebKit::RemoteWebInspectorUI::sendMessageToFrontend): (WebKit::RemoteWebInspectorUI::pagePaused): (WebKit::RemoteWebInspectorUI::pageUnpaused): (WebKit::RemoteWebInspectorUI::setDiagnosticLoggingAvailable): * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::WebInspectorUI): (WebKit::WebInspectorUI::setDockSide): (WebKit::WebInspectorUI::setDockingUnavailable): (WebKit::WebInspectorUI::setIsVisible): (WebKit::WebInspectorUI::updateFindString): (WebKit::WebInspectorUI::setDiagnosticLoggingAvailable): (WebKit::WebInspectorUI::showConsole): (WebKit::WebInspectorUI::showResources): (WebKit::WebInspectorUI::showMainResourceForFrame): (WebKit::WebInspectorUI::startPageProfiling): (WebKit::WebInspectorUI::stopPageProfiling): (WebKit::WebInspectorUI::startElementSelection): (WebKit::WebInspectorUI::stopElementSelection): (WebKit::WebInspectorUI::didSave): (WebKit::WebInspectorUI::didAppend): (WebKit::WebInspectorUI::sendMessageToFrontend): (WebKit::WebInspectorUI::evaluateInFrontendForTesting): (WebKit::WebInspectorUI::pagePaused): (WebKit::WebInspectorUI::pageUnpaused): * WebProcess/WebCoreSupport/WebChromeClient.cpp: Add missing header includes (related to unified sources changes from r269168). 2020-10-30 Brent Fulgham Correct sandbox violations in GPU Process https://bugs.webkit.org/show_bug.cgi?id=218356 Reviewed by Eric Carlson. The new GPU Process sandbox is missing 'sysctl.name2oid' from the allow list, even though we allow it everywhere else. We need this for proper function. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: 2020-10-30 Simon Fraser Convert ScrollingTreeNode change flags to an OptionSet<> https://bugs.webkit.org/show_bug.cgi?id=218374 Reviewed by Antti Koivisto. Address the FIXME in ScrollingStateNode.h and use an OptionSet<> for the ScrollingState tree change flags. This required moving them all into the same enum class in ScrollingStateNode. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder::encode): (ArgumentCoder::encode): (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder::decode): (ArgumentCoder::decode): (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder::encode): (ArgumentCoder::decode): (ArgumentCoder::encode): (ArgumentCoder::decode): (WebKit::dump): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren): (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren): * UIProcess/RemoteLayerTree/mac/ScrollingTreeOverflowScrollingNodeRemoteMac.cpp: (WebKit::ScrollingTreeOverflowScrollingNodeRemoteMac::commitStateBeforeChildren): 2020-10-29 Aditya Keerthi [Cocoa] Remove soft linking of NetworkExtension.framework https://bugs.webkit.org/show_bug.cgi?id=218314 Reviewed by Andy Estes. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): Replaced the soft linked method call with a new method exported from WebCore. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2020-10-29 Chris Dumez Regression(PSON): Back/forward navigation may hang https://bugs.webkit.org/show_bug.cgi?id=216611 Reviewed by Geoffrey Garen. The scenario was as follows: 1. Load A in Process P1 2. Load A#foo in Process P1 (fragment navigation) 3. Load B in Process P2 4. history.go(-2) to load A again in P1 5. history.go(2) to load B again in P2 6. history.back() to go back to A#foo in P1 -> Hang We doing the process swap at step 3, we would suspend the page containing A#foo in P1 when doing the new load in P2. When process swapping again at step 4, we would go back to process P1 (because it is same origin) but we did not have any suspended WebPage for A so we would create a new WebPage (with a new WebPageIdentifier). The reason we do this is to allow the suspended WebPage for A#foo to remain in process, as we may want it for another back/forward navigation later. The issue was that when constructing the new WebPage in P1 for A at step 4, we would restore all history items from the WebPageProxy's BackForwardList and overwrite any existing HistoryItems with the same IDs in the WebProcess. This meant that WebKit layer would construct new HistoryItems for HistoryItems that already existing and are used by the Suspended WebPage containing A#foo. Later on, at step 6, when trying to go back A#foo in P1, we would ask the Suspended WebPage in P1 to load a given HistoryItem. This HistoryItem is supposed to be present in the Page's back/forward list and is supposed to have an associated back/forward cache entry. However, it was not the case here because we ended up with a new HistoryItem instance that was restored from the UIProcess earlier. To address the issue, The WebPage constructor no longer overwrites existing HistoryItems. Note that before prior to r231048, the WebPage constructor was NOT overwriting existing HistoryItems so this restores previous behavior. Presumably, we started overwriting to stop hitting the assertion in WebBackForwardListProxy::addItemFromUIProcess() that checked that we either wanted to overwrite or that there was no existing HistoryItem with the given ID. This is no longer an issue since I replaced this assertion with an if-check and an early return. * WebProcess/WebPage/WebBackForwardListProxy.cpp: (WebKit::WebBackForwardListProxy::addItemFromUIProcess): * WebProcess/WebPage/WebPage.cpp: 2020-10-29 Jiewen Tan [WebAuthn] Make WebContent process talk to the WebAuthn process for WebAuthn requests https://bugs.webkit.org/show_bug.cgi?id=218070 Reviewed by Brent Fulgham. Once modern web authentication is enabled, let WebContent process talk to the WebAuthn process for WebAuthn requests. * Scripts/process-entitlements.sh: Adds necessary entitlements for the WebAuthn process. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::handleRequest): Adds a way to distinguish if itself is in the UI Process or in the WebAuthn process. * WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp: (WebKit::WebAuthnConnectionToWebProcess::makeCredential): (WebKit::WebAuthnConnectionToWebProcess::getAssertion): (WebKit::WebAuthnConnectionToWebProcess::handleRequest): (WebKit::WebAuthnConnectionToWebProcess::isUserVerifyingPlatformAuthenticatorAvailable): (WebKit::WebAuthnConnectionToWebProcess::setMockWebAuthenticationConfiguration): * WebAuthnProcess/WebAuthnConnectionToWebProcess.h: * WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in: Adds receivers for messages coming from the web content processes. * WebAuthnProcess/WebAuthnProcess.cpp: (WebKit::WebAuthnProcess::WebAuthnProcess): (WebKit::WebAuthnProcess::setMockWebAuthenticationConfiguration): * WebAuthnProcess/WebAuthnProcess.h: (WebKit::WebAuthnProcess::authenticatorManager): Handles the authenticator managers. * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: Relaxes sandbox for necessary hardware accesses. * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): Sends messages to the WebAuthn process accordingly. 2020-10-29 Per Arne Vollan [macOS] Add required entitlement for message filtering https://bugs.webkit.org/show_bug.cgi?id=218342 Reviewed by Brent Fulgham. The entitlement 'com.apple.private.security.message-filter' needs to be set to YES. This patch also adds telemetry for mach-bootstrap filtering. * Scripts/process-entitlements.sh: * WebProcess/com.apple.WebProcess.sb.in: 2020-10-29 Alex Christensen Don't look in the keychain for a preferred client certificate in the network process https://bugs.webkit.org/show_bug.cgi?id=218322 Reviewed by Geoffrey Garen. Often, based on a race condition of preconnecting to a server we have just been told to load and the use of Safari's BackgroundLoad class when navigating to a page we have not received any data from yet, and with an installed client certificate and an identity preference in the keychain, the user will be asked if com.apple.WebKit.Networking can access a private key in the keychain instead of if Safari can access a private key in the keychain. If the user types in the password and clicks "Always Allow" this does not make it always allowed, but it would have if Safari had asked instead of com.apple.WebKit.Networking. This is because Safari is responding to WKNavigationDelegate's didReceiveAuthenticationChallenge with NSURLSessionAuthChallengeUseCredential and nil, which would cause CFNetwork to search in the keychain as the network process for the preferred client certificate. What we want Safari's network process to do is not search in the keychain for this preconnect request's challenge but wait until the actual request, at which time Safari will use its proper logic to find the correct client certificate and AuthenticationManager::initializeConnection will create a SecKeyProxy to do the signing in the UI process. Third party applications will not be affected because the SecKeyProxy path is the only one that works for applications lacking Safari's entitlements. I used the steps in the radar to verify that this is fixed. Unfortunately, it is not practical to make a unit test that installs a system client certificate and an identity preference because doing so would require the entry of the login keychain password while running the unit test. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 2020-10-29 Said Abou-Hallawa REGRESSION(269065): [GPU Process]: Order of drawing has to be preserved when drawing a canvas to another canvas https://bugs.webkit.org/show_bug.cgi?id=218324 Reviewed by Simon Fraser. When drawing an ImageBuffer to another ImageBuffer, the DrawingContext of the source and the destination ImageBuffers have to be flushed immediately. Otherwise an older version or a newer version of the source ImageBuffer might be drawn to the destination ImageBuffer. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-10-29 Ryan Haddad Unreviewed, reverting r269109. Introduced dependency cycle Reverted changeset: "[Cocoa] Remove soft linking of Contacts.framework" https://bugs.webkit.org/show_bug.cgi?id=218289 https://trac.webkit.org/changeset/269109 2020-10-29 Per Arne Vollan [macOS] Add telemetry for IOKit use https://bugs.webkit.org/show_bug.cgi?id=218343 Reviewed by Geoffrey Garen. Add telemetry with backtrace for IOKIt use in the WebContent process. * WebProcess/com.apple.WebProcess.sb.in: 2020-10-29 Chris Lord [WPE] Add axis-locking to kinetic scrolling https://bugs.webkit.org/show_bug.cgi?id=209729 Reviewed by Adrian Perez de Castro. Add axis-locking to scroll gestures on WPE, and new WPE-specific settings to control the process. * UIProcess/API/wpe/ScrollGestureController.cpp: (WebKit::ScrollGestureController::handleEvent): * UIProcess/API/wpe/ScrollGestureController.h: 2020-10-29 Youenn Fablet Improve LibWebRTCSocketClient logging https://bugs.webkit.org/show_bug.cgi?id=218336 Reviewed by Eric Carlson. Output webrtc socket identifier in case of error. Fix the case of LibWebRTCSocketClient::sendTo that can log too much. No observable change of behavior. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::sendTo): (WebKit::LibWebRTCSocketClient::close): (WebKit::LibWebRTCSocketClient::setOption): 2020-10-29 Chris Lord [GTK] Smooth scrolling should not apply to continuous scrolling with sync scrolling https://bugs.webkit.org/show_bug.cgi?id=218133 Reviewed by Adrian Perez de Castro. Set hasPreciseScrollDeltas appropriately on scroll events created from GdkEvent. * Shared/gtk/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): 2020-10-28 John Wilander PCM: Accept ad click data when the link opens a new window https://bugs.webkit.org/show_bug.cgi?id=214176 Reviewed by Brent Fulgham. A link with the attribute target="_blank" takes another code path for navigation which involves the creation of a new window and webpage. That code path needs to transfer ad click attribution data to the new webpage where it can be picked up in WebPageProxy::didCommitLoadForFrame(). The ad click attribution data sits in the NavigationAction which is not available in the completion handler WebPageProxy::createNewPage(). The client, which differs between TestRunner and e.g. Safari, consumes the NavigationAction. I don't want to risk a regression in e.g. Safari while still passing the test because TestRunner hasn't regressed. Test: http/tests/adClickAttribution/attribution-conversion-through-image-redirect-in-new-window.html * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): Now also checks for pending ad click attribution data in its new member variable m_newPageNavigationAdClickAttribution. (WebKit::WebPageProxy::createNewPage): Now forwards optional ad click attribution data to the completion handler where it can be stored on the newly created webpage in the new member variable m_newPageNavigationAdClickAttribution. * UIProcess/WebPageProxy.h: Added m_newPageNavigationAdClickAttribution. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): Added missing navigationAction.adClickAttribution() copy. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): Added missing navigationAction.adClickAttribution() copy. 2020-10-28 Said Abou-Hallawa [GPU Process] Eagerly flush the PutImageData item to the GPU Process https://bugs.webkit.org/show_bug.cgi?id=218116 Reviewed by Simon Fraser. Flush the DrawingContext of the RemoteImageBufferProxy once the PutImageData item is recorded. So no expensive operation is going to block the painting. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 2020-10-28 Tim Horton macCatalyst WebGL on Apple Silicon devices is using a software renderer https://bugs.webkit.org/show_bug.cgi?id=218303 Reviewed by Geoffrey Garen. * UIProcess/mac/HighPerformanceGPUManager.mm: (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance): (WebKit::HighPerformanceGPUManager::updateState): (WebKit::isiOSAppOnMac): Deleted. HighPerformanceGPUManager is PLATFORM(MAC)-only, which is not true for MACCATALYST, so delete this dead code. 2020-10-28 Sam Weinig Reduce Preference Override Methods: TabsToLinks/SpatialNavigation https://bugs.webkit.org/show_bug.cgi?id=218288 Reviewed by Tim Horton. Removes WKPreferencesGet/SetTabToLinksEnabled preference as it duplicates functionality of WKPreferencesGet/SetTabsToLinks. The former was added for https://bugs.webkit.org/show_bug.cgi?id=95329 but was redundant even at the time. We can now use test header commands for all of its use cases. Also removes testing only bundle SPI for enabling spatial navigation which also can be set via test headers instead. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetTabToLinksEnabled): Deleted. (WKPreferencesGetTabToLinksEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleSetSpatialNavigationEnabled): Deleted. * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): (WebKit::InjectedBundle::setSpatialNavigationEnabled): Deleted. * WebProcess/InjectedBundle/InjectedBundle.h: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::setTabToLinksEnabled): Deleted. (WebKit::WebPage::tabToLinksEnabled const): Deleted. 2020-10-28 Aditya Keerthi [Cocoa] Remove soft linking of Contacts.framework https://bugs.webkit.org/show_bug.cgi?id=218289 Reviewed by Geoff Garen. Since Contacts.framework does not depend on WebKit and soft linking is discouraged, WebKit should link Contacts.framework normally. Soft linking requires running the linker at runtime, leading to an unwanted performance cost. By normally linking (on iOS) and weak linking (on macOS), the linkage is declared at build time, which enables running the linker at build/update/install time and avoiding the runtime cost. * Configurations/WebKit.xcconfig: On macOS, weak link the framework since Contacts.framework is not available on the Base System. * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toNSError): 2020-10-28 Adrian Perez de Castro [GTK4] Build broken with GTK 3.99.3 https://bugs.webkit.org/show_bug.cgi?id=218270 Reviewed by Carlos Garcia Campos. No new tests needed. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (toplevelWindowStateChanged): Replace GDK_SURFACE_STATE_MINIMIZED with GDK_TOPLEVEL_STATE_MINIMIZED. * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (surfaceStateChangedCallback): Ditto, and GDK_SURFACE_STATE_MAXIMIZED with GDK_TOPLEVEL_STATE_MAXIMIZED. * UIProcess/Gamepad/gtk/UIGamepadProviderGtk.cpp: (WebKit::getWebPageProxy): Write an implementation which works for GTK4. (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput): Accomodate for windows being a bit less special in GTK4 and use gtk_widget_has_focus() directly. 2020-10-27 Alex Christensen Use _CFURLConnectionSetFrameworkStubs for SecItemShim instead of DYLD_INTERPOSE on Apple Silicon Macs https://bugs.webkit.org/show_bug.cgi?id=218269 Reviewed by Darin Adler. r171066 introduced the use of _CFURLConnectionSetFrameworkStubs on iOS for CFNetwork to be able to get and set credentials as the UI process. This is also needed on Apple Silicon Macs. We should eventually replace it with an even cleaner per-NSURLSession solution, but this is a step in the right direction, and I verified manually that it fixes the radar. Covered by an API test that used to fail on Apple Silicon Macs. * Shared/mac/SecItemShim.cpp: (WebKit::initializeSecItemShim): 2020-10-27 Said Abou-Hallawa Make RenderingMode a bool enum and remove ShouldAccelerate https://bugs.webkit.org/show_bug.cgi?id=218264 Reviewed by Tim Horton. When creating a remote ImageBuffer in WebKit, all we need to know is whether the backend is accelerated or not. RemoteImageBufferProxy has to be backed by a DisplayList. RemoteImageBuffer has to own the real backend. Two enum values for RenderingMode is sufficient for creating the remote ImageBuffer. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: * Shared/WebCoreArgumentCoders.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): * WebProcess/WebCoreSupport/WebChromeClient.h: 2020-10-27 Tim Horton Adopt the UIPointerInteraction API https://bugs.webkit.org/show_bug.cgi?id=218266 Reviewed by Wenson Hsieh. No new tests, just moving from deprecated SPI to API. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView setUpPointerInteraction]): (-[WKContentView _pointerInteraction:regionForRequest:defaultRegion:completion:]): (-[WKContentView pointerRegionForPositionInformation:point:]): (-[WKContentView pointerInteraction:styleForRegion:]): (-[WKContentView setUpCursorInteraction]): Deleted. (-[WKContentView _cursorInteraction:regionForLocation:defaultRegion:completion:]): Deleted. (-[WKContentView cursorRegionForPositionInformation:point:]): Deleted. (-[WKContentView cursorInteraction:styleForRegion:modifiers:]): Deleted. 2020-10-27 Chris Dumez [GPUProcess] Use async IPC for RemoteAudioDestinationManager's StartAudioDestination / StopAudioDestination https://bugs.webkit.org/show_bug.cgi?id=218251 Reviewed by Geoffrey Garen. Use async IPC for RemoteAudioDestinationManager's StartAudioDestination / StopAudioDestination. * GPUProcess/media/RemoteAudioDestinationManager.messages.in: * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::start): (WebKit::RemoteAudioDestinationProxy::stop): * WebProcess/GPU/media/RemoteAudioDestinationProxy.h: 2020-10-27 Brian Burg [Cocoa] Introduce _WKInspectorConfiguration for customizing local and remote Web Inspectors https://bugs.webkit.org/show_bug.cgi?id=217896 Reviewed by Devin Rousso. Introduce _WKInspectorConfiguration for customizing the behavior of Web Inspector instances. The initial customization is to allow for custom WKURLSchemeHandlers to be used by Web Inspector's WebView to load resources from client-controlled locations. This can be used to implement loading of extension resources using a custom scheme such as web-extension://. Scheme handlers need to be registered at WebView creation time via WKWebViewConfiguration. In order to configure a inspector page summoned from within WebKit (i.e., Inspect Element context menu item), we need to add a method to the UI delegate to get a configuration when the page is being created. This configuration object is used in two different SPI (local and remote cases): - As part of WKUIDelegatePrivate, to retrieve a _WKInspectorConfiguration given a _WKInspector. - As an argument to the _WKRemoteWebInspectorViewController initializer. It's used later as needed. New API test: WKInspectorDelegate.InspectorConfiguration. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: Add new files. * UIProcess/API/APIInspectorConfiguration.h: Added. * UIProcess/API/APIInspectorConfiguration.cpp: Added. * UIProcess/API/Cocoa/_WKInspectorConfiguration.h: Added. * UIProcess/API/Cocoa/_WKInspectorConfigurationInternal.h: Added. * UIProcess/API/Cocoa/_WKInspectorConfiguration.mm: Added. (-[_WKInspectorConfiguration init]): (-[_WKInspectorConfiguration dealloc]): (-[_WKInspectorConfiguration _apiObject]): (-[_WKInspectorConfiguration setURLSchemeHandler:forURLScheme:]): (-[_WKInspectorConfiguration applyToWebViewConfiguration:]): (-[_WKInspectorConfiguration copyWithZone:]): Create _WKInspectorConfiguration and add a method to register WKURLSchemeHandlers. * Shared/API/APIObject.h: * Shared/Cocoa/APIObject.mm: (API::Object::newObject): Add new API object types. Add missing InspectorExtension. * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/APIUIClient.h: (API::UIClient::configurationForLocalInspector): * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::setDelegate): (WebKit::UIDelegate::UIClient::configurationForLocalInspector): Add new client/delegate method to fetch an inspector configuration as needed. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController initWithConfiguration:]): Renamed from -init. (-[_WKRemoteWebInspectorViewController init]): Deleted. (-[_WKRemoteWebInspectorViewController loadForDebuggableType:backendCommandsURL:]): (-[_WKRemoteWebInspectorViewController configurationForDebuggable:]): (-[_WKRemoteWebInspectorViewController _setDiagnosticLoggingDelegate:]): Store a _WKInspectorConfiguration and provide it when asked by RemoteWebInspectorProxy. * UIProcess/Inspector/RemoteWebInspectorProxy.h: * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: (WebKit::RemoteWebInspectorProxy::load): Store m_debuggableInfo before creating the page and window. It's used from inside platformCreateFrontendPageAndWindow to pass as an argument to the delegate method. * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow): * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: (WebKit::WebInspectorProxy::platformCreateFrontendPage): Obtain a configuration and use it to initialize the WKInspectorViewController. * UIProcess/Inspector/mac/WKInspectorViewController.h: * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController initWithConfiguration:inspectedPage:]): (-[WKInspectorViewController webView]): (-[WKInspectorViewController webViewConfiguration]): Renamed from -configuration. (-[WKInspectorViewController initWithInspectedPage:]): Deleted. (-[WKInspectorViewController configuration]): Deleted. Apply the URL scheme handlers registered in the _WKInspectorConfiguration to the WKWebViewConfiguration. * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: Stub out RemoteWebInspectorProxyClient::configurationForRemoteInspector(). * UIProcess/API/Cocoa/_WKUserStyleSheet.h: * UIProcess/API/Cocoa/_WKUserStyleSheet.mm: Fix build problems caused by repartitioning of unified sources. 2020-10-27 Said Abou-Hallawa [GPU Process]: Implement DisplayList::DrawImageBuffer item https://bugs.webkit.org/show_bug.cgi?id=217566 Reviewed by Simon Fraser. The sequence in the Web Process is the following: -- GraphicsContext::drawImageBuffer() uses DisplayList::Recorder to check whether it is appropriate to create a DrawImageBuffer item or not. -- DisplayList::Recorder::drawImageBuffer() uses the delegate to see if the ImageBuffer is remote or not and whether it can be locked till replaying back the DisplayList in the GPU side. -- RemoteImageBufferProxy inherits DisplayList::Recorder::Delegate. So its lockRemoteImageBuffer() is called. -- If the ImageBuffer can be locked, a DrawImageBufferItem is created with the ImageBuffer::renderingResourceIdentifier(). The sequence in the GPU Process is the following: -- When replaying back the DisplayList, DisplayList::Replayer will call its delegate to check if it wants to apply the DrawImageBuffer. -- Because RemoteImageBuffer inherits DisplayList::Replayer::Delegate, RemoteImageBuffer::apply() will be called. -- RemoteImageBuffer will call RemoteRenderingBackend::applyResourceItem() which will check whether the item's renderingResourceIdentifier is one of the ImageBuffers in its RemoteResourceCache or not. -- If there is a cached ImageBuffer, RemoteRenderingBackend::applyResourceItem() will draw it in the GraphicsContext. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::apply): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::applyResourceItem): (WebKit::RemoteRenderingBackend::applyMediaItem): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cachedImageBuffer): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::releaseImageBuffer): (WebKit::RemoteResourceCacheProxy::lockRemoteImageBufferForRemoteClient): (WebKit::RemoteResourceCacheProxy::lockRemoteResourceForRemoteClient): (WebKit::RemoteResourceCacheProxy::releaseRemoteResource): (WebKit::RemoteResourceCacheProxy::unlockRemoteResourcesForRemoteClient): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2020-10-27 Alex Christensen Use NSURLSessionAuthChallengeRejectProtectionSpace if WKNavigationDelegate didReceiveAuthenticationChallenge is not implemented https://bugs.webkit.org/show_bug.cgi?id=218008 Reviewed by Darin Adler. This is documented in WKNavigationDelegate.h, and the behavior is basically identical. The difference is if there is a challenge with multiple protection spaces and a delegate that implements didReceiveAuthenticationChallenge is attached between the delegate callbacks, it will receive the second callback. This is unlikely and next to impossible to test, but out of principle we should behave like we have documented that we do. * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): 2020-10-27 Sam Weinig Rename WKPreferencesSet*ValueForKey SPI to WKPreferencesSet*ValueForKeyForTesting https://bugs.webkit.org/show_bug.cgi?id=218240 Reviewed by Darin Adler. Addresses feedback from initial naming to make it clear what they are used for and for consistency with WebKitLegacy. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetBoolValueForKeyForTesting): (WKPreferencesSetDoubleValueForKeyForTesting): (WKPreferencesSetUInt32ValueForKeyForTesting): (WKPreferencesSetStringValueForKeyForTesting): (WKPreferencesSetBoolValueForKey): Deleted. (WKPreferencesSetDoubleValueForKey): Deleted. (WKPreferencesSetUInt32ValueForKey): Deleted. (WKPreferencesSetStringValueForKey): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: 2020-10-27 Carlos Garcia Campos WebDriver: sequence of char key press is not supported https://bugs.webkit.org/show_bug.cgi?id=217951 Reviewed by Brian Burg. We are assuming there can be only one char key pressed at a time. Use a HashSet to store the currently pressed char keys and the handle them the same way we do with virtual keys. Fixes: imported/w3c/webdriver/tests/perform_actions/key_events.py::test_sequence_of_keydown_printable_keys_sends_events * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::performInteractionSequence): 2020-10-27 Tetsuharu Ohzeki Make WebCore::FocusDirection to enum class https://bugs.webkit.org/show_bug.cgi?id=218162 Reviewed by Darin Adler. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::takeFocus): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::takeFocus): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::takeFocus): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::handleKeyEventByRelinquishingFocusToChrome): (WebKit::WebPage::setInitialFocus): 2020-10-26 Said Abou-Hallawa [GPU Process]: Introduce RemoteResourceCacheProxy to manage the remote resources in Web Process https://bugs.webkit.org/show_bug.cgi?id=217558 Reviewed by Simon Fraser. Remove RemoteImageBufferMessageHandlerProxy and move sending the messages to RemoteRenderingBackendProxy. To allow casting ImageBuffer to RemoteImageBufferProxy, a new method named remoteResourceIdentifier() is added to IamgeBuffer and it is only overridden by RemoteImageBufferProxy. This method is used in SPECIALIZE_TYPE_TRAITS macros along with IamgeBuffer::isAccelerated(). Introduce RemoteResourceCacheProxy which will manage caching and releasing the RemoteImageBufferProxy. Caching NativeImage will be added to it in future patches. More about controlling the life cycles of remote resources will be added also when supporting drawing remote resources to remote client in future patches. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::create): (WebKit::RemoteImageBuffer::RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackend::flushDisplayListWasCommitted): (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::flushDisplayList): (WebKit::RemoteRenderingBackend::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackend::getImageData): (WebKit::RemoteRenderingBackend::releaseRemoteResource): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheImageBuffer): (WebKit::RemoteResourceCache::cachedImageBuffer): (WebKit::RemoteResourceCache::releaseRemoteResource): * GPUProcess/graphics/RemoteResourceCache.h: * Scripts/webkit/messages.py: * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: (isType): * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp: Removed. * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h: Removed. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): (WebKit::RemoteImageBufferProxy::createBackend): (WebKit::RemoteImageBufferProxy::commitFlushDisplayList): (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): (WebKit::RemoteImageBufferProxy::isPendingFlush const): (WebKit::RemoteImageBufferProxy::timeoutWaitForFlushDisplayListWasCommitted): (WebKit::RemoteImageBufferProxy::flushDrawingContextAndCommit): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createImageBuffer): (WebKit::RemoteRenderingBackendProxy::getImageData): (WebKit::RemoteRenderingBackendProxy::flushDisplayList): (WebKit::RemoteRenderingBackendProxy::flushDisplayListAndCommit): (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): (WebKit::RemoteRenderingBackendProxy::imageBufferBackendWasCreated): (WebKit::RemoteRenderingBackendProxy::flushDisplayListWasCommitted): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: (WebKit::RemoteRenderingBackendProxy::remoteResourceCacheProxy): (WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const): Deleted. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: Copied from Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp. (WebKit::RemoteResourceCacheProxy::RemoteResourceCacheProxy): (WebKit::RemoteResourceCacheProxy::cacheImageBuffer): (WebKit::RemoteResourceCacheProxy::cachedImageBuffer): (WebKit::RemoteResourceCacheProxy::releaseImageBuffer): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: Copied from Source/WebKit/GPUProcess/graphics/RemoteResourceCache.h. 2020-10-26 Alex Christensen Add null checks and smart pointers in PDF and Plugin code https://bugs.webkit.org/show_bug.cgi?id=218144 Reviewed by Youenn Fablet. It's nice when things don't crash. isBeingAsynchronouslyInitialized wasn't called anywhere, so I removed it. * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::PDFPlugin): (WebKit::PDFPlugin::~PDFPlugin): (WebKit::PDFPlugin::getResourceBytesAtPosition): (WebKit::PDFPlugin::updateScrollbars): (WebKit::PDFPlugin::createScrollbar): (WebKit::PDFPlugin::isActive const): (WebKit::PDFPlugin::forceUpdateScrollbarsOnMainThreadForPerformanceTesting const): (WebKit::PDFPlugin::jsPDFDocPrint): (WebKit::PDFPlugin::installPDFDocument): (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors): (WebKit::PDFPlugin::calculateSizes): (WebKit::PDFPlugin::willDetachRenderer): (WebKit::PDFPlugin::destroy): (WebKit::PDFPlugin::paintControlForLayerInContext): (WebKit::PDFPlugin::convertFromPDFViewToScreen const): (WebKit::PDFPlugin::boundsOnScreen const): (WebKit::PDFPlugin::visibilityDidChange): (WebKit::PDFPlugin::showContextMenuAtPoint): (WebKit::PDFPlugin::handleContextMenuEvent): (WebKit::PDFPlugin::isFullFramePlugin const): (WebKit::PDFPlugin::handlesPageScaleFactor const): (WebKit::PDFPlugin::clickedLink): (WebKit::PDFPlugin::save): (WebKit::PDFPlugin::openWithPreview): (WebKit::PDFPlugin::saveToPDF): (WebKit::PDFPlugin::openWithNativeApplication): (WebKit::PDFPlugin::showDefinitionForAttributedString): (WebKit::PDFPlugin::notifySelectionChanged): (WebKit::PDFPlugin::notifyCursorChanged): (WebKit::PDFPlugin::axObjectCache const): (WebKit::PDFPlugin::performWebSearch): (WebKit::PDFPlugin::performSpotlightSearch): * WebProcess/Plugins/Plugin.cpp: (WebKit::Plugin::Plugin): (WebKit::Plugin::initialize): (WebKit::Plugin::controller): (WebKit::Plugin::controller const): (WebKit::Plugin::~Plugin): Deleted. * WebProcess/Plugins/Plugin.h: (WebKit::Plugin::controller): Deleted. (WebKit::Plugin::controller const): Deleted. * WebProcess/Plugins/PluginController.h: * WebProcess/WebPage/WebFrame.h: (WebKit::WebFrame::setLoadListener): (WebKit::WebFrame::loadListener const): 2020-10-26 Youenn Fablet Add support for VP9 Profile 2 (10-bit color) in WebRTC https://bugs.webkit.org/show_bug.cgi?id=217673 Reviewed by Eric Carlson. * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::pixelBufferPool): 2020-10-26 Zan Dobersek Remove Accelerated2dCanvasEnabled WebPreferences entry https://bugs.webkit.org/show_bug.cgi?id=218114 Reviewed by Adrian Perez de Castro. With the removal of the Accelerated2dCanvasEnabled preference key, relevant API functions in the WK2 C API are made no-op. Similar thing is done for the relevant GLib API, with the addition of marking relevant API funcions as deprecated. * Shared/API/c/WKDeprecatedFunctions.cpp: (WKPreferencesSetAccelerated2DCanvasEnabled): (WKPreferencesGetAccelerated2DCanvasEnabled): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetAccelerated2DCanvasEnabled): Deleted. (WKPreferencesGetAccelerated2DCanvasEnabled): Deleted. * UIProcess/API/glib/WebKitSettings.cpp: (webKitSettingsSetProperty): (webKitSettingsGetProperty): (webkit_settings_class_init): (webkit_settings_get_enable_accelerated_2d_canvas): (webkit_settings_set_enable_accelerated_2d_canvas): * UIProcess/API/gtk/WebKitSettings.h: * UIProcess/API/wpe/WPEView.cpp: (WKWPE::m_backend): * UIProcess/API/wpe/WebKitSettings.h: 2020-10-22 Ryosuke Niwa IPC testing API should expose ArrayBuffer for an unknown decoded argument https://bugs.webkit.org/show_bug.cgi?id=218113 Reviewed by Darin Adler. Expose the decoded argument as an ArrayBuffer when it can't be encoded as a JS value. Also make the treatment of a JS array as a tuple or a Vector explicit in argument encoding. Test: TestWebKitAPI.IPCTestingAPI.CanInterceptAlert * Platform/IPC/Decoder.h: (IPC::Decoder::currentBufferPosition const): Added. * Platform/IPC/JSIPCBinding.cpp: (IPC::putJSValueForDecodedArgumentAtIndexOrArrayBufferIfUndefined): Added. * Platform/IPC/JSIPCBinding.h: (IPC::DecodedArgumentJSValueConverter): Deleted. (IPC::putJSValueForDecodeArgumentInArray): Replaced DecodedArgumentJSValueConverter. Take Decoder and decode each tuple argument and create a JS value at a time. (IPC::jsValueForArgumentTuple): Deleted. Merged into jsValueForDecodedArguments. (IPC::jsValueForDecodedArguments): * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::VectorEncodeHelper::encode const): (WebKit::IPCTestingAPI::encodeArrayArgument): Extracted out of encodeArgument. (WebKit::IPCTestingAPI::encodeArgument): Treat an array as a tuple unless it's explicitly specified that the argument's type is a Vector. 2020-10-23 Eric Carlson [Media in GPU Process] in-band metadata cues sometimes crash https://bugs.webkit.org/show_bug.cgi?id=218106 Reviewed by Jer Noble. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::ArgumentCoder::encodePlatformData): SerializedPlatformDataCueValue::nativeValue() is a RetainPtr<>. 2020-10-23 Miguel Gomez [GTK][WPE] Implement antialiased rounded rectangle clipping in TextureMapper https://bugs.webkit.org/show_bug.cgi?id=174457 Reviewed by Carlos Garcia Campos. Use the new TextureMapper::beginClip() method that receives a FloatRoundedRect. * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): 2020-10-23 Michael Catanzaro [SOUP] Fix crash in WebSocketTask https://bugs.webkit.org/show_bug.cgi?id=217892 Reviewed by Carlos Garcia Campos. The WebSocketTask connects to the "starting" signal of its SoupMessage and never disconnects this signal, which is only safe if it is guaranteed to outlive its SoupMessage. However, it is not. We crash when the signal is emitted after the WebSocketTask is destroyed. To solve this, we just need to disconnect the signal when required. Normally that would be done in the destructor, but the WebSocketTask drops its ownership of the SoupMessage prior to that point, so we need to disconnect on each possible paths. * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::~WebSocketTask): (WebKit::WebSocketTask::didConnect): (WebKit::WebSocketTask::didFail): 2020-10-22 Aditya Keerthi [Contact Picker API] Add skeleton implementation of ContactsManager.select() https://bugs.webkit.org/show_bug.cgi?id=218050 Reviewed by Devin Rousso. Added the necessary plumbing in order for the UIProcess to display a contact picker after a call to ContactsManager.select() is made. * UIProcess/PageClient.h: (WebKit::PageClient::showContactPicker): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContactPicker): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::showContactPicker): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::showContactPicker): * WebProcess/WebPage/WebPage.h: 2020-10-22 Ryosuke Niwa IPC testing API should have the capability to observe messages being sent and received https://bugs.webkit.org/show_bug.cgi?id=217870 Unreviewed ASAN release build fix. * Platform/IPC/JSIPCBinding.cpp: * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSMessageListener::JSMessageListener): 2020-10-22 Eric Carlson UIClient isn't notified when page muted state changes https://bugs.webkit.org/show_bug.cgi?id=218085 Reviewed by Youenn Fablet. API test: WKWebView.MediaMuted * UIProcess/API/C/WKPage.cpp: (WKPageGetMediaState): reportedMediaCaptureState -> reportedMediaState. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _mediaCaptureState]): Ditto. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateReportedMediaCaptureState): Only record current capture state in m_reportedMediaCaptureState. m_delayStopCapturingReporting isn't necessary, remove it. * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::reportedMediaState const): Renamed from reportedMediaCaptureState to reflect what it returns. (WebKit::WebPageProxy::mediaStateFlags const): Deleted. (WebKit::WebPageProxy::reportedMediaCaptureState const): Deleted. 2020-10-22 Youenn Fablet Introduce worklet destinations and allow to fetch modules with CORS based on destination https://bugs.webkit.org/show_bug.cgi?id=218019 Reviewed by Chris Dumez. Add support to new fetch destinations in enumerations. * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::resourceLoadInfo): 2020-10-22 Nitzan Uziely Elements in Shadow DOM are wrongly marked as stale by the WebDriver https://bugs.webkit.org/show_bug.cgi?id=217635 Reviewed by Brian Burg. Fixed the focus script to work for elements in Shadow DOM instead of declaring them as not interactable. * WebProcess/Automation/WebAutomationSessionProxy.js: (let.AutomationSessionProxy.prototype._clearStaleNodes): (let.AutomationSessionProxy): 2020-10-22 Aditya Keerthi [iOS] Prevent presentation of input peripherals when focusing form controls with a validation message https://bugs.webkit.org/show_bug.cgi?id=218004 Reviewed by Wenson Hsieh. Interactive form validation can result in the presentation of a validation message bubble near the first form control that has invalid data. Prior to displaying the message, the invalid control is focused. On iOS, this also has the effect of also presenting a virtual keyboard or another custom input peripheral, such as a context menu for date inputs. Attempting to present both the validation message and custom input peripheral can leave the view in an inconsistent state. For example, or a