2022-04-08 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.7 release * wpe/NEWS: Add release notes for 2.34.7 2022-02-16 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.6 release * wpe/NEWS: Add release notes for 2.34.6 2022-02-16 Adrian Perez de Castro Unreviewed. Update OptionsGTK.cmake and NEWS for the 2.34.6 release * gtk/NEWS: Add release notes for 2.34.6 2022-02-16 Adrian Perez de Castro [CMake] Cannot find OpenGL when system provides opengl.pc instead of gl.pc https://bugs.webkit.org/show_bug.cgi?id=236592 Reviewed by Don Olmstead. * CMakeLists.txt: Remove usage of the OPENGL_ variables for the WebKit target, which is uneeded because it links to WebCore, which transitively pulls the needed libraries now that imported targets are being used. 2022-02-15 Carlos Garcia Campos [GTK] D-Bus crash atk-bridge https://bugs.webkit.org/show_bug.cgi?id=236208 Reviewed by Adrian Perez de Castro. It seems that for some reason we might end up with an empty string as plug ID which ATK doesn't handle right. We should not send the BindAccessibilityTree message if the plug ID is not valid. In the case of ATSPI we can just check it's not empty, since we know we always build a valid ID when we have a connection. In the case of ATK we should check it's a valid unique name and object path. * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::platformInitialize): 2022-02-15 Adrian Perez de Castro [GTK][WPE] Inclusion of OpenGLShims.h should not depend on USE(GLX) https://bugs.webkit.org/show_bug.cgi?id=236593 Reviewed by Michael Catanzaro. * UIProcess/API/glib/WebKitProtocolHandler.cpp: Move inclusion of GL/glx.h under a PLATFORM(X11) guard, and inclusion of WebCore/OpenGLShims.h into a chain of guards which picks it if USE(LIBEPOXY) and USE(OPENGL_ES) are both false, which is the same checks done in other parts of the code where these are needed. 2022-02-11 Carlos Garcia Campos [WPE][GTK] BubblewrapLauncher leaks D-Bus proxy sockets https://bugs.webkit.org/show_bug.cgi?id=201771 Reviewed by Michael Catanzaro. xdg-dbus-proxy removes the socket when the sync fd is closed by the application. In most of the cases the xdg-dbus-proxy process is killed before the sync fd is closed and the socket file is leaked. We should explicitly close the sync fd. * UIProcess/Launcher/glib/XDGDBusProxy.cpp: (WebKit::XDGDBusProxy::XDGDBusProxy): Save the sync fd. (WebKit::XDGDBusProxy::~XDGDBusProxy): Close the sync fd is needed. (WebKit::XDGDBusProxy::launch const): Return the sync fd. * UIProcess/Launcher/glib/XDGDBusProxy.h: 2022-02-10 Carlos Garcia Campos [GTK][WPE] Refactor the XDGDBusProxy launcher to simplify it and fix some issues https://bugs.webkit.org/show_bug.cgi?id=236437 Reviewed by Adrian Perez de Castro. This patch moves the XDGDBusProxy launcher implementation to its own file and fixes the following issues: - r289369 introduced an issue with old versions of bwrap that fails to mount over an existing file, so we need to ensure we only bind the original socket for the a11y socket and not the session bus one. - bindA11y is GTK specific for some reason, which means WPE doesn't have a11y under the sandbox. - The names of the socket paths for a11y and session bus use the same pattern dbus-proxy-XXXXXX, it helps to use a different one. - The code to get the a11y DBus address is now duplicated in PlatformDisplay, we can just use the PlatformDisplay to get the address. * SourcesGTK.txt: * SourcesWPE.txt: * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::argumentsToFileDescriptor): (WebKit::bindDBusSession): (WebKit::bindA11y): (WebKit::bubblewrapSpawn): (WebKit::argsToFd): Deleted. (WebKit::XDGDBusProxyLauncher::setAddress): Deleted. (WebKit::XDGDBusProxyLauncher::isRunning const): Deleted. (WebKit::XDGDBusProxyLauncher::path const): Deleted. (WebKit::XDGDBusProxyLauncher::proxyPath const): Deleted. (WebKit::XDGDBusProxyLauncher::setPermissions): Deleted. (WebKit::XDGDBusProxyLauncher::launch): Deleted. (WebKit::XDGDBusProxyLauncher::makeProxyPath): Deleted. (WebKit::XDGDBusProxyLauncher::dbusAddressToPath): Deleted. (): Deleted. * UIProcess/Launcher/glib/BubblewrapLauncher.h: * UIProcess/Launcher/glib/XDGDBusProxy.cpp: Added. (WebKit::XDGDBusProxy::XDGDBusProxy): (WebKit::XDGDBusProxy::makeProxy const): (WebKit::XDGDBusProxy::launch const): * UIProcess/Launcher/glib/XDGDBusProxy.h: Added. (WebKit::XDGDBusProxy::proxyPath const): (WebKit::XDGDBusProxy::path const): 2022-02-09 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.5 release * wpe/NEWS: Add release notes for 2.34.5 2022-02-08 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.5 release * gtk/NEWS: Add release notes for 2.34.5 2022-02-08 Carlos Garcia Campos [GTK][WPE] Crash at WebKit::bindA11y() in WebKitGTK 2.35.2 https://bugs.webkit.org/show_bug.cgi?id=236144 Reviewed by Adrian Perez de Castro. ATSPI stopped using an abstract socket but we are still assuming the a11y bus address is an abstract socket, even when the path is not really used after all. However, just handling the case of the socket being a normal unix socket is not enough, because the actual socket path is not mounted in the xdg-dbus-proxy sandbox, so it fails to connect to the original a11y bus. * UIProcess/Launcher/ProcessLauncher.h: Rename extraWebProcessSandboxPaths as extraSandboxPaths. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::XDGDBusProxyLauncher::setAddress): Remove the DBusAddressType parameter. Check the address looks valid and just store the result of dbusAddressToPath() in m_path. (WebKit::XDGDBusProxyLauncher::launch): Do not require m_path to be non-null and add it to the sanbox. (WebKit::XDGDBusProxyLauncher::dbusAddressToPath): Only return the path for normal unix sockets. (WebKit::bindDBusSession): Remove the DBusAddressType parameter passed to dbusAddressToPath(). (WebKit::bindA11y): Check proxy path is not null before setting a11y bus address in display. (WebKit::addExtraPaths): Helper to add extra paths to the sandbox. (WebKit::bubblewrapSpawn): Call addExtraPaths() for WebProcess and DBusProxy types. * UIProcess/Launcher/glib/FlatpakLauncher.cpp: (WebKit::flatpakSpawn): Use extraSandboxPaths. * UIProcess/glib/WebProcessProxyGLib.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): Ditto. 2022-02-04 Alexander Mikhaylenko [GTK] Crash when starting DND on touchscreen https://bugs.webkit.org/show_bug.cgi?id=235694 Reviewed by Adrian Perez de Castro. Drag-n-drop on touch has never worked correctly in GTK, and is usually just disabled. Do the same thing and ignore it for synthesized mouse events. * 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::isTouchEvent const): * Shared/gtk/NativeWebMouseEventGtk.cpp: (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseTouchRelease): (webkitWebViewBaseTouchDragUpdate): (webkitWebViewBaseTouchDragEnd): (webkitWebViewBaseSynthesizeMouseEvent): * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: * UIProcess/gtk/PointerLockManager.cpp: (WebKit::PointerLockManager::handleMotion): 2021-11-20 Carlos Garcia Campos Report the initiating url instead of the redirected one https://bugs.webkit.org/show_bug.cgi?id=233037 Reviewed by Brent Fulgham. Pass pre-redirect URL to allowChildContextFromSource() and allowScriptFromSource(). * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): 2022-01-31 Alexander Mikhaylenko REGRESSION(r288644): [GTK4] Criticals when using pinch zoom https://bugs.webkit.org/show_bug.cgi?id=235883 Reviewed by Carlos Garcia Campos. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseZoomBegin): Only cancel the click gesture on GTK3. We don't use g_object_set_data() on GTK4. 2022-01-26 Alexander Mikhaylenko [GTK3] Pinch zooming from a link activates it https://bugs.webkit.org/show_bug.cgi?id=235639 Reviewed by Carlos Garcia Campos. Turns out gestures behave differently between GTK3 and 4. On GTK4 it works fine, but on GTK3 starting a pinch zoom triggers the multipress gesture when one finger is down, and completes it when the second finger is down. This results in a bogus click, with no way to prevent it as it happens before any of the zoom callbacks are called. Since we can't know if there will be a zoom afterwards or not, we can't do anything about it. However, what we can do is reorder these gestures. In GTK3 the order the gestures are processed in depends on which order they were created in. At that point, there's a problem with the fact the gestures are grouped. Grouping means that these 2 gestures are triggered at the same time. While somehow the press gesture is still triggered without grouping with the original order, they become properly decoupled in reverse order and ungrouped. At that point, we can safely cancel the press gesture when the zoom gesture starts, and fix the issue. This seems to still work fine for GTK4. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseZoomBegin): (webkitWebViewBaseConstructed): 2022-01-26 Alexander Mikhaylenko [GTK] REGRESSION: Touch scrolling is broken https://bugs.webkit.org/show_bug.cgi?id=235436 Reviewed by Chris Lord. Remove webkitWebViewBaseSetWheelHasPreciseDeltas(), instead add a parameter to webkitWebViewBaseSynthesizeWheelEvent() that specifies whether the event should have precise deltas or not. Correct the touch swipe velocity, since it won't get multiplied by pixelsPerLineStep(). * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::navigationGestureDidBegin): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseZoomBegin): (webkitWebViewBaseTouchDragBegin): (webkitWebViewBaseTouchDragUpdate): (webkitWebViewBaseTouchSwipe): (webkitWebViewBaseSynthesizeWheelEvent): (webkitWebViewBaseSetWheelHasPreciseDeltas): Deleted. * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateWheelInteraction): 2021-09-23 Chris Lord [GTK] Allow sending precise mouse wheel events in LayoutTests https://bugs.webkit.org/show_bug.cgi?id=230541 Reviewed by Tim Horton. Add code to be able to send precise synthetic mouse-wheel events in GTK. * Shared/NativeWebWheelEvent.h: * Shared/gtk/NativeWebWheelEventGtk.cpp: (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseSynthesizeWheelEvent): (webkitWebViewBaseSetWheelHasPreciseDeltas): * UIProcess/API/gtk/WebKitWebViewBaseInternal.h: 2022-01-20 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.4 release * wpe/NEWS: Add release notes for 2.34.4 2022-01-20 Adrian Perez de Castro Unreviewed. Update OptionsGTK.cmake and NEWS for the 2.34.4 release * gtk/NEWS: Add release notes for 2.34.4 2021-11-30 Youenn Fablet ServiceWorkerContainer does not respond well to network process crash https://bugs.webkit.org/show_bug.cgi?id=233626 Reviewed by Chris Dumez. Set SW client connection as closed when IPC connection gets closed. * WebProcess/Storage/WebSWClientConnection.cpp: (WebKit::WebSWClientConnection::connectionToServerLost): 2021-11-16 Chris Dumez Crash under WebKit::WebPageProxy::commitProvisionalPage() https://bugs.webkit.org/show_bug.cgi?id=233199 Reviewed by Youenn Fablet. In the event where the committed WebProcess would crash while a cross-site provisional load is going on in a provisional page / WebProcess, we would do a null dereference of the page's drawing area when trying to commit the provisional page later on. We would also hit various assertions in debug since the page's state gets completely reset when its WebProcess crashes. To address the issue, we now clear the provisional page if the page's WebProcess crashes. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetStateAfterProcessExited): 2021-09-29 Chris Dumez [ iOS Debug ] http/tests/xmlhttprequest/access-control-preflight-credential-sync.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=228305 Reviewed by Alex Christensen. When a NetworkResourceLoader for a synchronous XHR gets aborted (e.g. because the connection to the WebProcess was severed), NetworkResourceLoader::abort() would fail to call sendReplyToSynchronousRequest() (sendReplyToSynchronousRequest was only called in didFailLoading() and didFinishLoading()). As a result, we would hit the following assertion in the NetworkResourceLoader destructor later on: ASSERT(!isSynchronous() || !m_synchronousLoadData->delayedReply) No new tests, covered by existing test that I am unskipping. * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::abort): 2021-09-08 Sihui Liu Remove responsiveness timer in NetworkProcessProxy::getNetworkProcessConnection https://bugs.webkit.org/show_bug.cgi?id=230016 rdar://problem/80760179 Reviewed by Chris Dumez. We've seen evidence that network process may be blocked in initializeNetworkProcess. Since we have a 3-second responsiveness timer in NetworkProcessProxy::getNetworkProcessConnection, blocked network process will be killed and a new network process will be launched for getting connection. However, the new network process may get stuck in initializeNetworkProcess too. In this case, web process will crash for not being able to get network process connection. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::getNetworkProcessConnection): * UIProcess/WebsiteData/WebsiteDataStore.cpp: change RELEASE_ASSERT_NOT_REACHED_WITH_MESSAGE to RELEASE_LOG_ERROR as the message is not printed in non-debug build. (WebKit::WebsiteDataStore::getNetworkProcessConnection): 2021-09-02 Chris Dumez [ BigSur arm64 Debug EWS ] ASSERTION FAILED: m_uncommittedState.state == State::Provisional https://bugs.webkit.org/show_bug.cgi?id=229769 Reviewed by Alex Christensen. I am unable to reproduce the crash but we know that we're crashing when committing the load after a process-swap, because the WebPageProxy doesn't know that a provisional load is going on. One possible explanation for this, and the most likely one is that the WebPageProxy got a DidFailProvisionalLoadForFrame IPC from the current process while the provisional load is proceeding in the new provisional process. We had logic in WebPageProxy::didFailProvisionalLoadForFrame() to try and discard such IPC but the check was relying on the navigationID and was therefore fragile. I updated the check in didFailProvisionalLoadForFrame() to ignore all DidFailProvisionalLoadForFrame IPCs for the main frame from the current process when there is a ProvisionalPageProxy, without relying on the navigationID. This should be more robust and will hopefully fix this flaky crash. No new tests, unskipped existing tests. * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): * UIProcess/WebPageProxy.h: 2022-01-12 Frédéric Wang Protect DocumentLoader when a reference to its members is used. https://bugs.webkit.org/show_bug.cgi?id=233464 Reviewed by Brady Eidson. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFinishLoadForFrame): If the navigationID is obsolete, skip update of the page load state to avoid failure of debug ASSERT. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad): Ensure that DocumentLoader loader remains alive while DocumentLoader::m_request is used. 2021-09-13 Chris Dumez Crash under WebPage::runJavaScript() https://bugs.webkit.org/show_bug.cgi?id=230223 Reviewed by Brady Eidson. The resolveFunction() was capturing `frame = makeRef(frame)` and then calling `frame->coreFrame()->script()`. This would lead to a null dereference crash in the case where the core frame gets destroyed before the JS promise gets resolved. Protecting the WebFrame does not keep the core Frame alive as WebFrame::m_coreFrame is merely a WeakPtr. To address the issue, the lambda now also protects the core frame and uses it to get the script controller. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): 2021-10-01 Brent Fulgham Protect WebFrame during invalidatePolicyListener() https://bugs.webkit.org/show_bug.cgi?id=229981 Reviewed by Alex Christensen. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::invalidatePolicyListeners): Protect the WebFrame while policy handlers are run. 2021-12-20 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.34.3 release * gtk/NEWS: Add release notes for 2.34.3. 2021-12-17 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.3 release * wpe/NEWS: Add release notes for 2.34.3. 2021-12-09 Chris Dumez [WPE] Crash under WebProcessProxy::setIsInProcessCache when closing web view in debug builds https://bugs.webkit.org/show_bug.cgi?id=233933 Reviewed by Geoffrey Garen. The crash would occur because the WebProcessPool destructor would call WebProcessCache::clear() which would destroy WebProcessCache::CachedProcess objects, causing WebProcessProxy::setIsInProcessCache(false) to get called. Previously, this call to setIsInProcessCache() would convert the WeakPtr the WebProcessProxy held to its process pool into a RefPtr, thus causing the WebProcessPool to get ref'd while in the middle of destruction. To address the issue, the setIsInProcessCache() setter now takes a WillShutDown flag that gets set in the CachedProcess destructor and which causes setIsInProcessCache() to return early right after setting the m_isInProcessCache flag, without trying to send IPC to the WebProcess or trying to ref the WebProcessPool. * UIProcess/WebProcessCache.cpp: (WebKit::WebProcessCache::CachedProcess::~CachedProcess): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setIsInProcessCache): * UIProcess/WebProcessProxy.h: 2021-11-24 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.2 release * wpe/NEWS: Add release notes for 2.34.2. 2021-11-24 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.34.2 release * gtk/NEWS: Add release notes for 2.34.2. 2021-11-23 Alexander Mikhaylenko [GTK] Effective appearance doesn't update on the old process after PSON https://bugs.webkit.org/show_bug.cgi?id=233451 Reviewed by Michael Catanzaro. When reinitializing a WebPage, we get effective appearance from the page creation parameters. Actually apply them. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::reinitializeWebPage): 2021-10-21 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.1 release * wpe/NEWS: Add release notes for 2.34.1. 2021-10-21 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.34.1 release * gtk/NEWS: Add release notes for 2.34.1. 2021-10-20 Michael Catanzaro REGRESSION(r276635): [GTK] local HTML file is downloaded instead of displayed if any application has ever called g_desktop_app_info_set_as_default_for_extension(info, "html") https://bugs.webkit.org/show_bug.cgi?id=230797 Reviewed by Carlos Garcia Campos. Let's revert this change. Disabling content sniffing prevents WebKit from distinguishing between different content types with the same file extension, which is something it needs to be able to do. In this bug report, it is conflating text/html with application/x-extension-html, but it could just as well confuse text/html with application/xhtml+xml, causing rendering issues. I don't think we can remove the content sniffing. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::didGetFileInfo): 2021-10-13 Adrian Perez de Castro [GTK] Opening emoji chooser crashes UI process with GTK 3.24.30 https://bugs.webkit.org/show_bug.cgi?id=228664 Reviewed by Michael Catanzaro. Instead of providing a copy of the emoji chooser widget, use GLib's introspection features and a little sprinkle of knowledge about how GTK works in order to obtain the type code of the GtkEmojiChooser widget included with GTK. This ensures that a working widget is always used, regardless of the current GTK version. No new tests needed. * UIProcess/API/gtk/WebKitEmojiChooser.cpp: (webkitEmojiChooserNew): (): Deleted. (webkitEmojiChooserAddEmoji): Deleted. (webkitEmojiChooserAddRecentItem): Deleted. (emojiActivated): Deleted. (emojiDataHasVariations): Deleted. (webkitEmojiChooserShowVariations): Deleted. (emojiLongPressed): Deleted. (emojiPressed): Deleted. (emojiPopupMenu): Deleted. (verticalAdjustmentChanged): Deleted. (webkitEmojiChooserSetupSectionBox): Deleted. (scrollToSection): Deleted. (webkitEmojiChooserSetupSectionButton): Deleted. (webkitEmojiChooserSetupRecent): Deleted. (webkitEmojiChooserEnsureEmptyResult): Deleted. (webkitEmojiChooserSearchChanged): Deleted. (webkitEmojiChooserSetupFilters): Deleted. (webkitEmojiChooserSetupEmojiSections): Deleted. (webkitEmojiChooserInitializeEmojiMaxWidth): Deleted. (webkitEmojiChooserConstructed): Deleted. (webkitEmojiChooserShow): Deleted. (webkit_emoji_chooser_class_init): Deleted. * UIProcess/API/gtk/WebKitEmojiChooser.h: 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-10-19 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.34.0 release * wpe/NEWS: Add release notes for 2.34.0. 2021-09-22 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.34.0 release * gtk/NEWS: Add release notes for 2.34.0. 2021-09-17 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.33.91 release * gtk/NEWS: Add release notes for 2.33.91. 2021-09-16 Carlos Garcia Campos [GTK][WPE] test animations/steps-transform-rendering-updates.html fails https://bugs.webkit.org/show_bug.cgi?id=230307 Reviewed by Carlos Alberto Lopez Perez. ThreadedDisplayRefreshMonitor is not setting isScheduled back to false when it's fired. That causes hasBeenRescheduled to be true and handleDisplayRefreshMonitorUpdate() is called with force repaint option, so we end up flushing layers on every display refresh update. * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp: (WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback): 2021-09-14 Carlos Garcia Campos REGRESSION(r274929): [CoordinatedGraphics] DrawingAreaCoordinatedGraphics::createDisplayRefreshMonitor is no longer used https://bugs.webkit.org/show_bug.cgi?id=230214 Reviewed by Adrian Perez de Castro. That means we use the right display refresh monitor in the threaded compositor but a different one for rendering update scheduler. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::displayRefreshMonitorFactory const): Remove platform ifdef, DrawingArea unconditionally inherits from DisplayRefreshMonitorFactory and the default implementation of createDisplayRefreshMonitor() returns nullptr. 2021-09-11 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.33.90 release * wpe/NEWS: Add release notes for 2.33.90. 2021-09-02 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.33.90 release * gtk/NEWS: Add release notes for 2.33.90. 2021-09-02 Carlos Garcia Campos Unreviewed. Fix GTK distcheck build * webkitglib-symbols.map: Bring back symbols removed in r281073. 2021-09-01 Tomoki Imai [CoordinatedGraphics] Schedule rendering after setLayerTreeStateIsFrozen(false) in non-AC mode https://bugs.webkit.org/show_bug.cgi?id=229749 We should schedule another rendering when the setLayerTreeStateIsFrozen(false) is called. In some rare cases, the browser only shows the white page after the page transition, because the rendering is skipped while the layer tree is frozen and there was no guarantee that there is another rendering after setLayerTreeStateIsFrozen(false). Reviewed by Carlos Garcia Campos. Tested by manual. * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::setLayerTreeStateIsFrozen): Schedule another rendering when the layer tree becomes unfrozen. 2021-08-31 Lauro Moura Non-unified build partial fixes, late late August 2021 https://bugs.webkit.org/show_bug.cgi?id=229741 Unreviewed non-unified build fixes. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: Add missing header. * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp: Add missing header. (WebKit::PCM::Database::attributePrivateClickMeasurement): Namespace some names. (WebKit::PCM::Database::removeUnattributed): Ditto. (WebKit::PCM::Database::clearPrivateClickMeasurement): Ditto. (WebKit::PCM::Database::clearSentAttribution): Ditto. * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h: Add missing header. 2021-08-31 Chris Dumez Enable SharedArrayBuffer support when COOP/COEP headers are used https://bugs.webkit.org/show_bug.cgi?id=229559 Reviewed by Alex Christensen. Make sure window.crossOriginIsolated returns true when COOP=same-origin and COEP=require-corp are used. Also make sure that cross-origin-isolates pages are allowed to use SharedArrayBuffer. When the WebProcess determines it needs to switch browsing context group it now sends a NeedsBrowsingContextGroupSwitch::YesWithoutCrossOriginIsolation / NeedsBrowsingContextGroupSwitch::YesWithCrossOriginIsolation enum value to the UIProcess with the DecidePolicyForResponse IPC instead of a simple boolean. We send YesWithoutCrossOriginIsolation when the navigation destination will be cross-origin-isolated due to COOP=same-origin and COEP=require-corp. In the UIProcess, when YesWithCrossOriginIsolation is received, we take care of launching a fresh WebProcess (never recycling an existing WebProcess) and we make this WebProcess as cross-origin-isolated. When a process is cross-origin-isolated, we pass it a XPC flag on launch to allow the process to use SharedArrayBuffer. We use an XPC flag because JSC Options need to be set before JSC::initialize() is called, which occurs during XPC service initialization. When a WebProcess is marked as cross-origin-isolated, we make sure to never cache it so it cannot be recycled for a new navigation (given that it has special permission to use SharedArrayBuffer). * Scripts/webkit/messages.py: (headers_for_type): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): * UIProcess/Launcher/ProcessLauncher.h: (WebKit::ProcessLauncher::Client::shouldEnableSharedArrayBuffer const): * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::decidePolicyForResponse): * UIProcess/ProvisionalPageProxy.h: * UIProcess/SuspendedPageProxy.cpp: (WebKit::SuspendedPageProxy::findReusableSuspendedPageProcess): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createNewWebProcess): (WebKit::WebProcessPool::createWebPage): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::create): (WebKit::WebProcessProxy::createForServiceWorkers): (WebKit::WebProcessProxy::WebProcessProxy): (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const): * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::isCrossOriginIsolated const): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2021-08-31 Kate Cheney Use after move in ServiceWorkerThreadProxy https://bugs.webkit.org/show_bug.cgi?id=229731 Reviewed by Chris Dumez. * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::installServiceWorker): 2021-08-31 Aditya Keerthi [iOS] Move the implementation of -[WKWebView _dynamicUserInterfaceTraitDidChange] out of the testing category https://bugs.webkit.org/show_bug.cgi?id=229735 Reviewed by Tim Horton. r253465 incorrectly moved -[WKWebView _dynamicUserInterfaceTraitDidChange] into the WKTestingIOS category. _dynamicUserInterfaceTraitDidChange is used to respond to trait collection changes that affect dynamic colors, and is not a testing only method. Consequently, the method should be implemented in the WKViewInternalIOS category. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _dynamicUserInterfaceTraitDidChange]): * UIProcess/API/ios/WKWebViewTestingIOS.mm: 2021-08-31 Sihui Liu REGRESSION (r281771): ASSERTION FAILED: !m_deletionHasBegun under WebCore::Permissions::~Permissions() https://bugs.webkit.org/show_bug.cgi?id=229714 Reviewed by Chris Dumez. * WebProcess/WebCoreSupport/WebPermissionController.cpp: (WebKit::WebPermissionController::create): * WebProcess/WebCoreSupport/WebPermissionController.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_appHighlightsVisible): 2021-08-31 Kate Cheney Loads after session restore marked app initiated in Safari https://bugs.webkit.org/show_bug.cgi?id=229721 Reviewed by Brent Fulgham. Offer a way to set the app initiated value when restoring a session. * Shared/SessionState.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _restoreSessionState:andNavigate:]): * UIProcess/API/Cocoa/_WKSessionState.h: * UIProcess/API/Cocoa/_WKSessionState.mm: (-[_WKSessionState _sessionStateWithAppInitiatedValue]): * UIProcess/API/Cocoa/_WKSessionStateInternal.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::goToBackForwardItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::launchProcessForReload): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::restoreFromSessionState): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::goToBackForwardItem): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-08-31 Carlos Garcia Campos [SOUP] Assertion in startObservingCookieChanges() https://bugs.webkit.org/show_bug.cgi?id=229708 Reviewed by Philippe Normand. Do not observe cookies changes unconditionally on session creation/destruction. * NetworkProcess/soup/NetworkSessionSoup.cpp: (WebKit::NetworkSessionSoup::NetworkSessionSoup): (WebKit::NetworkSessionSoup::~NetworkSessionSoup): 2021-08-31 Myles C. Maxfield [Cocoa] Drawing system fallback fonts to canvas causes a crash https://bugs.webkit.org/show_bug.cgi?id=229633 Reviewed by Wenson Hsieh. Dot-prefixed font names don't survive the round-trip through CTFontDescriptorCopyAttributes(CTFontCopyFontDescriptor(font)) unless you also pass in the kCTFontOptionsSystemUIFont option. Tests: fast/text/system-fallback-canvas.html fast/text/draw-synthetic-system-bold-font-into-canvas.html * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::createCTFont): (IPC::ArgumentCoder>::decodePlatformData): 2021-08-26 Darin Adler Cut down on use of CFGetTypeID, using dynamic_cf_cast instead; related streamlining https://bugs.webkit.org/show_bug.cgi?id=229414 Reviewed by Tim Horton. * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm: (WebKit::getPluginInfoFromPropertyLists): Use dynamic_cf_cast. (WebKit::NetscapePluginModule::getPluginInfo): Ditto. 2021-08-30 Alex Christensen Remove unused OptionalCallbackID https://bugs.webkit.org/show_bug.cgi?id=229359 Reviewed by Sam Weinig. * NetworkProcess/NetworkProcess.h: * Shared/CallbackID.h: * Shared/OptionalCallbackID.h: Removed. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebCookieManagerProxy.cpp: * UIProcess/WebPageProxy.cpp: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/EventDispatcher.h: * WebProcess/WebPage/FindController.cpp: * WebProcess/WebPage/WebPage.h: 2021-08-30 Alex Christensen Update availability macros for APIs available in iOS 14.5 and macOS 11.3 https://bugs.webkit.org/show_bug.cgi?id=229466 Reviewed by Chris Dumez. We mistakenly updated them to 15.0/12.0 * UIProcess/API/Cocoa/WKDownload.h: * UIProcess/API/Cocoa/WKDownloadDelegate.h: * UIProcess/API/Cocoa/WKNavigationAction.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.h: 2021-08-30 Alex Christensen Migrate PrivateClickMeasurements from ResourceLoadStatistics database to new database https://bugs.webkit.org/show_bug.cgi?id=229646 Reviewed by Kate Cheney. In r281721 I moved the PCM database to be separate from the ResourceLoadStatistics database. This patch extracts data from the old database and sends it to the new database. I added some tests that create databases in each of the 3 historical schemas then verify that data is successfully migrated to the new database. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::tableExists): (WebKit::ResourceLoadStatisticsDatabaseStore::deleteTable): (WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToPCMDatabaseIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/DatabaseUtilities.cpp: (WebKit::DatabaseUtilities::buildPrivateClickMeasurementFromDatabase): * NetworkProcess/DatabaseUtilities.h: * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp: (WebKit::PCM::Database::insertPrivateClickMeasurement): (WebKit::PCM::Database::findPrivateClickMeasurement): (WebKit::PCM::Database::allAttributedPrivateClickMeasurement): (WebKit::PCM::Database::getDomainStringFromDomainID const): (WebKit::PCM::Database::buildPrivateClickMeasurementFromDatabase): Deleted. (WebKit::PCM::Database::getDomainStringFromDomainID): Deleted. * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _dumpPrivateClickMeasurement:]): 2021-08-30 Alex Christensen WKWebViewConfiguration._loadsSubresources=NO should prevent preconnecting https://bugs.webkit.org/show_bug.cgi?id=229684 Reviewed by Tim Horton. This is like bug 228044 and even uses the same test setup. This should fix rdar://79307070 * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::preconnectTo): 2021-08-30 Sihui Liu Add stubs for Permissions API https://bugs.webkit.org/show_bug.cgi?id=229339 Reviewed by Chris Dumez. Set up basic infrastructure of permission getting and setting. * Sources.txt: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebPermissionController.cpp: Added. (WebKit::WebPermissionController::WebPermissionController): (WebKit::WebPermissionController::query): (WebKit::WebPermissionController::request): (WebKit::WebPermissionController::queryCache): (WebKit::WebPermissionController::updateCache): (WebKit::WebPermissionController::tryProcessingRequest): (WebKit::WebPermissionController::addObserver): (WebKit::WebPermissionController::removeObserver): (WebKit::WebPermissionController::permissionChanged): * WebProcess/WebCoreSupport/WebPermissionController.h: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_appHighlightsVisible): * WebProcess/WebPage/mac/DisplayRefreshMonitorMac.h: 2021-08-29 Fujii Hironori REGRESSION(r281102): ASSERTION FAILED: !isInAcceleratedCompositingMode() in DrawingAreaProxyCoordinatedGraphics::incorporateUpdate https://bugs.webkit.org/show_bug.cgi?id=229228 Reviewed by Carlos Garcia Campos. WinCairo WK2 layout tests were observing an assertion failure for some animations tests since r281102. DrawingAreaProxyCoordinatedGraphics::incorporateUpdate has an assertion ensuring a DrawingAreaProxy::Update message isn't sent during the compositing mode. However, DrawingAreaCoordinatedGraphics sent a Update message before sending ExitAcceleratedCompositingMode message in the following scenario. 1. DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode calls DrawingAreaCoordinatedGraphics::display(WebKit::UpdateInfo&) 2. It calls WebPage::updateRendering() 3. It executes JavaScript 4. It calls notifyDone 5. It calls WTR::TestRunner::notifyDone which calls WKBundlePageForceRepaint 6. It calls DrawingAreaCoordinatedGraphics::display() which dispatches the Update message Send an ExitAcceleratedCompositingMode message instead of an Update message if ExitAcceleratedCompositingMode isn't sent yet in display(). * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): (WebKit::DrawingAreaCoordinatedGraphics::display): 2021-08-29 Joonghun Park Unreviewed. Remove the build warning below since r281096. No new tests, no new behavioral changes. * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::stateString const): 2021-08-28 Cameron McCormack Miscellaneous typo fixes https://bugs.webkit.org/show_bug.cgi?id=229642 Reviewed by Fujii Hironori. * Platform/IPC/HandleMessage.h: (IPC::callMemberFunction): * Shared/Cocoa/ArgumentCodersCocoa.mm: (IPC::encodeArrayInternal): * Shared/cf/ArgumentCodersCF.cpp: (IPC::ArgumentCoder::encode): 2021-08-27 Cameron McCormack Fix std::optional<> stripping in MessageArgumentDescriptions.cpp generator https://bugs.webkit.org/show_bug.cgi?id=229636 Reviewed by Darin Adler. * Scripts/webkit/messages.py: (generate_js_argument_descriptions): * Scripts/webkit/tests/MessageArgumentDescriptions.cpp: (IPC::messageReplyArgumentDescriptions): 2021-08-27 Simon Fraser Address post-landing feedback on r281728. Move a line inside the #ifdef. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformWillPerformEditingCommand): 2021-08-27 Simon Fraser Define ENABLE_CONTENT_CHANGE_OBSERVER for IOS_FAMILY and use it to wrap content observation code https://bugs.webkit.org/show_bug.cgi?id=229624 Reviewed by Alan Bujtas. Deploy ENABLE(CONTENT_CHANGE_OBSERVER). * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformWillPerformEditingCommand): 2021-08-27 Alex Christensen Add UIEventAttribution SPI that uses PrivateClickMeasurementAttributionEphemeral::Yes https://bugs.webkit.org/show_bug.cgi?id=229623 Reviewed by John Wilander. This will be used by rdar://80806283. * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setEphemeralUIEventAttribution:]): (-[WKWebView _ephemeralUIEventAttribution]): 2021-08-27 Alex Christensen Separate PrivateClickMeasurement database from ResourceLoadStatistics database and add SPI to set its location https://bugs.webkit.org/show_bug.cgi?id=229527 Reviewed by Kate Cheney. This will be used by rdar://80806283 In order to do this, I moved common code to DatabaseUtilities and moved the PCM logic from ResourceLoadStatisticsDatabaseStore to a new class. It puts the data in a different file in the same directory unless SPI tells it to put it in a different directory. The biggest functional change I needed to do was to make a PCMObservedDomains table in the new DB instead of an ObservedDomains table, which contained more information than I needed. I need just an index and a list of domains. Another slight implementation change is that instead of checking isEphemeral in WebResourceLoadStatisticsStore, I just pass an empty String to the Store if it's ephemeral, which causes no DB to be created, which causes equivalent behavior. I also moved the debug message broadcasting to PrivateClickMeasurementManager::attribute in order to make the Database object not need to know about the NetworkProcess and not need to keep state of whether debug mode is enabled. Database::attributePrivateClickMeasurement now returns a DebugInfo object and PrivateClickMeasurementManager::attribute checks whether debug mode is enabled and broadcasts the messages. I added a few calls to PrivateClickMeasurement::isolatedCopy when moving an PrivateClickMeasurement object to another thread. I added a CompletionHandler to clearPrivateClickMeasurement and clearPrivateClickMeasurementForRegistrableDomain so that clearing website data doesn't say it's done until it's done. An even smaller change is I added a "ForTesting" suffix on some function names of functions that are only used in tests. The rest of this patch just moves code from one location to another. I still need to implement migrating data from the old DB to the new DB. I'll do that in another patch soon. * CMakeLists.txt: * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::expectedTableAndIndexQueries): (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): (WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase): (WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedSchema): (WebKit::insertDistinctValuesInTableStatement): (WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::interruptAllDatabases): (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices): (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema): (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements): (WebKit::ResourceLoadStatisticsDatabaseStore::clearDatabaseContents): (WebKit::expectedUnattributedColumns): Deleted. (WebKit::expectedAttributedColumns): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::close): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::enableForeignKeys): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedPrivateClickMeasurementSchema): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsIfNecessary): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnInTable): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnsIfNecessary): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::scopedStatement const): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::interrupt): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::attributePrivateClickMeasurement): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredPrivateClickMeasurement): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::earliestTimesToSend): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::markReportAsSentToSource): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::markReportAsSentToDestination): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Deleted. (WebKit::ResourceLoadStatisticsDatabaseStore::beginTransactionIfNecessary): Deleted. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::pcmStoreDirectory): (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::create): (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession): (WebKit::WebResourceLoadStatisticsStore::suspend): (WebKit::WebResourceLoadStatisticsStore::insertPrivateClickMeasurement): Deleted. (WebKit::WebResourceLoadStatisticsStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): Deleted. (WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement): Deleted. (WebKit::WebResourceLoadStatisticsStore::allAttributedPrivateClickMeasurement): Deleted. (WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurement): Deleted. (WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurementForRegistrableDomain): Deleted. (WebKit::WebResourceLoadStatisticsStore::clearExpiredPrivateClickMeasurement): Deleted. (WebKit::WebResourceLoadStatisticsStore::privateClickMeasurementToString): Deleted. (WebKit::WebResourceLoadStatisticsStore::clearSentAttribution): Deleted. (WebKit::WebResourceLoadStatisticsStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Deleted. * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * NetworkProcess/DatabaseUtilities.cpp: Added. (WebKit::DatabaseUtilities::DatabaseUtilities): (WebKit::DatabaseUtilities::~DatabaseUtilities): (WebKit::DatabaseUtilities::scopedStatement const): (WebKit::DatabaseUtilities::beginTransactionIfNecessary): (WebKit::DatabaseUtilities::openDatabaseAndCreateSchemaIfNecessary): (WebKit::DatabaseUtilities::enableForeignKeys): (WebKit::DatabaseUtilities::close): (WebKit::DatabaseUtilities::interrupt): * NetworkProcess/DatabaseUtilities.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::resume): (WebKit::NetworkProcess::clearPrivateClickMeasurement): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): (WebKit::NetworkSession::recreateResourceLoadStatisticStore): (WebKit::NetworkSession::dumpPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurement): (WebKit::NetworkSession::clearPrivateClickMeasurementForRegistrableDomain): * NetworkProcess/NetworkSession.h: * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp: Added. (WebKit::PCM::Database::Database): (WebKit::PCM::Database::~Database): (WebKit::PCM::Database::interruptAllDatabases): (WebKit::PCM::Database::createSchema): (WebKit::PCM::Database::insertPrivateClickMeasurement): (WebKit::PCM::Database::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): (WebKit::PCM::Database::findPrivateClickMeasurement): (WebKit::PCM::Database::attributePrivateClickMeasurement): (WebKit::PCM::Database::buildPrivateClickMeasurementFromDatabase): (WebKit::PCM::Database::removeUnattributed): (WebKit::PCM::Database::allAttributedPrivateClickMeasurement): (WebKit::PCM::Database::privateClickMeasurementToStringForTesting): (WebKit::PCM::Database::attributionToStringForTesting): (WebKit::PCM::Database::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::PCM::Database::clearPrivateClickMeasurement): (WebKit::PCM::Database::clearExpiredPrivateClickMeasurement): (WebKit::PCM::Database::clearSentAttribution): (WebKit::PCM::Database::markReportAsSentToDestination): (WebKit::PCM::Database::markReportAsSentToSource): (WebKit::PCM::Database::earliestTimesToSend): (WebKit::PCM::Database::domainID): (WebKit::PCM::Database::getDomainStringFromDomainID): (WebKit::PCM::Database::ensureDomainID): (WebKit::PCM::Database::destroyStatements): * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h: Added. * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDebugInfo.cpp: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h. (WebKit::PCM::DebugInfo::isolatedCopy const): (WebKit::PCM::DebugInfo::Message::isolatedCopy const): * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDebugInfo.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h. * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp: Added. (WebKit::PCM::sharedWorkQueue): (WebKit::PCM::Store::prepareForProcessToSuspend): (WebKit::PCM::Store::processDidResume): (WebKit::PCM::Store::Store): (WebKit::PCM::Store::postTask): (WebKit::PCM::Store::postTaskReply): (WebKit::PCM::Store::insertPrivateClickMeasurement): (WebKit::PCM::Store::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): (WebKit::PCM::Store::attributePrivateClickMeasurement): (WebKit::PCM::Store::privateClickMeasurementToStringForTesting): (WebKit::PCM::Store::allAttributedPrivateClickMeasurement): (WebKit::PCM::Store::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::PCM::Store::clearPrivateClickMeasurement): (WebKit::PCM::Store::clearPrivateClickMeasurementForRegistrableDomain): (WebKit::PCM::Store::clearExpiredPrivateClickMeasurement): (WebKit::PCM::Store::clearSentAttribution): (WebKit::PCM::Store::close): * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.h: Added. (WebKit::PCM::Store::create): * NetworkProcess/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::insertPrivateClickMeasurement): (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::clearSentAttribution): (WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests): (WebKit::PrivateClickMeasurementManager::clear): (WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain): (WebKit::PrivateClickMeasurementManager::clearExpired): (WebKit::PrivateClickMeasurementManager::toStringForTesting const): (WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting): (WebKit::PrivateClickMeasurementManager::toString const): Deleted. * NetworkProcess/PrivateClickMeasurementManager.h: * NetworkProcess/PrivateClickMeasurementNetworkLoader.cpp: (WebKit::PrivateClickMeasurementNetworkLoader::~PrivateClickMeasurementNetworkLoader): (WebKit::PrivateClickMeasurementNetworkLoader::cancel): (WebKit::PrivateClickMeasurementNetworkLoader::willSendRedirectedRequest): * NetworkProcess/PrivateClickMeasurementNetworkLoader.h: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: * NetworkProcess/webrtc/NetworkRTCResolver.h: * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp: (WebKit::resolvedName): * Shared/ResourceLoadStatisticsParameters.h: (WebKit::ResourceLoadStatisticsParameters::encode const): (WebKit::ResourceLoadStatisticsParameters::decode): * Sources.txt: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (+[WKWebsiteDataStore _setNetworkProcessSuspensionAllowedForTesting:]): (+[WKWebsiteDataStore _preventNetworkProcessSuspensionForTesting]): Deleted. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration privateClickMeasurementStorageDirectory]): (-[_WKWebsiteDataStoreConfiguration setPrivateClickMeasurementStorageDirectory:]): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::setSuspensionAllowedForTesting): (WebKit::NetworkProcessProxy::sendPrepareToSuspend): (WebKit::NetworkProcessProxy::preventSuspensionForTesting): Deleted. * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::privateClickMeasurementStorageDirectory const): (WebKit::WebsiteDataStoreConfiguration::setPrivateClickMeasurementStorageDirectory): * WebKit.xcodeproj/project.pbxproj: 2021-08-27 Chris Dumez [WK2] Reuse the same network load when process-swapping on resource response due to COOP https://bugs.webkit.org/show_bug.cgi?id=229465 Reviewed by Alex Christensen. r281516 added support for process-swapping based on Cross-Origin-Opener-Policy header in HTTP responses. However, on process-swap, we would abort the existing network load that was started by the original WebProcess and start a fresh network load in the new WebProcess. This was suboptimal and could lead to issues with resources that provide one-time behaviors. This patch addresses the issue by transferring the network load in the network process from the old WebProcess to the new WebProcess when process swapping. When the UIProcess decides to process-swap on response policy decision, it first sends IPC to the network process to ask it to prepare the NetworkResourceLoader for ownership transfer. The network process takes the NetworkResourceLoader from its NetworkConnectionToWebProcess and stores it in a temporary cache, then responds to the UIProcess with the NetworkResourceLoadIdentifier of the loader. Upon receiving the response, the UIProcess proceeds with the process-swap, it rejects response processing in the old process and does a loadRequest in a new WebProcess. When starting sending the LoadRequest IPC to the new WebProcess, it passes along the NetworkResourceLoadIdentifier of the cached loader in the network process. When the WebProcess ends up scheduling the load with the network process, it passes again the NetworkResourceLoadIdentifier. Upon receiving the load request, the network process checks if a NetworkResourceLoadIdentifier is provided for continuing a load. If none is provided, we use the regular code path and actually construct a new NetworkResourceLoader. However, if a NetworkResourceLoadIdentifier is provided, we take the corresponding NetworkResourceLoader from the cache, transfer it to the new NetworkConnectionToWebProcess and have it send the DidReceiveResponse IPC to the WebProcess to continue the load with the new WebProcess. Test: http/wpt/cross-origin-opener-policy/single-request-to-server.html * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::didCleanupResourceLoader): (WebKit::NetworkConnectionToWebProcess::transferKeptAliveLoad): (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad): (WebKit::NetworkConnectionToWebProcess::takeNetworkResourceLoader): * NetworkProcess/NetworkConnectionToWebProcess.h: * NetworkProcess/NetworkConnectionToWebProcess.messages.in: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::CachedNetworkResourceLoader::CachedNetworkResourceLoader): (WebKit::NetworkProcess::CachedNetworkResourceLoader::takeLoader): (WebKit::NetworkProcess::CachedNetworkResourceLoader::expirationTimerFired): (WebKit::NetworkProcess::takeLoaderAwaitingWebProcessTransfer): (WebKit::NetworkProcess::prepareLoadForWebProcessTransfer): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::transferToNewWebProcess): (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions): (WebKit::NetworkResourceLoader::shouldInterruptNavigationForCrossOriginEmbedderPolicy): (WebKit::NetworkResourceLoader::shouldInterruptWorkerLoadForCrossOriginEmbedderPolicy): (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didFinishLoading): (WebKit::NetworkResourceLoader::didFailLoading): (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): (WebKit::NetworkResourceLoader::logCookieInformation const): (WebKit::NetworkResourceLoader::addConsoleMessage): (WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: (WebKit::ServiceWorkerFetchTask::sendToClient): (WebKit::ServiceWorkerFetchTask::didReceiveResponse): * Shared/LoadParameters.cpp: (WebKit::LoadParameters::encode const): (WebKit::LoadParameters::decode): * Shared/LoadParameters.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::prepareLoadForWebProcessTransfer): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::loadRequest): (WebKit::ProvisionalPageProxy::decidePolicyForResponse): * UIProcess/ProvisionalPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::decidePolicyForResponse): (WebKit::WebPageProxy::decidePolicyForResponseShared): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): * WebProcess/Network/WebLoaderStrategy.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadRequest): * WebProcess/WebPage/WebPage.h: 2021-08-26 Wenson Hsieh Fix a typo in `ArgumentCoder>::decode()` https://bugs.webkit.org/show_bug.cgi?id=229596 Reviewed by Tim Horton. Change `renderingRersouceIdentifier` to `renderingResourceIdentifier`. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::decode): 2021-08-26 Wenson Hsieh Add type-safe transaction identifiers for EditorState and FocusedElementInformation https://bugs.webkit.org/show_bug.cgi?id=229571 Reviewed by Tim Horton. Make `transactionID` a monotonic object identifier instead of a generic `TransactionID`, and replace `FocusedElementIdentifier` (which is currently type-defined to `uint64_t`) with its own monotonic object identifier type. In a future patch, I plan to implement a mechanism to synchronize `EditorState` and `FocusedElementInformation` updates, which would require one or both of these objects to hold both types of transactional identifiers; in order to do this, we need to ensure that these two identifiers are distinct types, so that they can't be easily mixed up. * Shared/EditorState.cpp: (WebKit::EditorState::encode const): (WebKit::EditorState::decode): * Shared/EditorState.h: * Shared/FocusedElementInformation.cpp: (WebKit::FocusedElementInformation::encode const): (WebKit::FocusedElementInformation::decode): * Shared/FocusedElementInformation.h: * Shared/IdentifierTypes.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateEditorState): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView updateCurrentFocusedElementInformation:]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::editorState const): (WebKit::WebPage::elementDidFocus): * WebProcess/WebPage/WebPage.h: Additionally rename `m_currentFocusedElementIdentifier` to `m_lastFocusedElementInformationIdentifier`, for consistency with `m_lastEditorStateIdentifier`. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::focusedElementInformation): 2021-08-26 Cameron McCormack Manually release SharedBitmap if CGBitmapContextCreateWithData fails and doesn't do it https://bugs.webkit.org/show_bug.cgi?id=229428 Reviewed by Darin Adler. * Shared/ShareableBitmap.h: * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::createGraphicsContext): (WebKit::ShareableBitmap::releaseBitmapContextData): 2021-08-26 Aditya Keerthi [iOS] Photo picker appears at incorrect locations when opened using a trackpad https://bugs.webkit.org/show_bug.cgi?id=229568 rdar://80268735 Reviewed by Wenson Hsieh. On iOS, file inputs that accept photos give the user the option to select from a photo picker rather than a standard document picker. The photo picker is presented as a popover, and uses the content view's `lastInteractionLocation` to determine the source rect. However, `lastInteractionLocation` is not updated when mouse events are recognized, leading to the popover being presented at the location of the most recent tap / long press / touch event. To fix, ensure `lastInteractionLocation` is updated when a mouse down event is recognized. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView mouseGestureRecognizerChanged:]): 2021-08-26 Myles C. Maxfield Clean up logging #includes https://bugs.webkit.org/show_bug.cgi?id=229547 Reviewed by Eric Carlson. It's actually harmful to include the wrong framework's Logging.h file, because they conflict with each other. You'll end up with errors like Unknown symbol "WebCore::WebKit2LogLayout". No new tests because there is no behavior change. * GPUProcess/GPUConnectionToWebProcess.cpp: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::logChannel const): * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::logChannel): * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::MediaSampleCursor::logChannel const): * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: (WebKit::MediaTrackReader::logChannel const): * UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp: (WebKit::RemoteMediaSessionCoordinatorProxy::logChannel const): * UIProcess/MediaKeySystemPermissionRequestManagerProxy.cpp: (WebKit::logChannel): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::logChannel const): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::logChannel const): * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::logChannel const): * WebProcess/GPU/media/RemoteAudioSourceProvider.cpp: (WebKit::RemoteAudioSourceProvider::logChannel const): * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::logChannel const): * WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp: (WebKit::RemoteMediaSessionCoordinator::logChannel const): 2021-08-26 Kimmo Kinnunen RemoteGraphicsContextGL refers to GraphicsContextGLOpenGL::SimulatedEventForTesting https://bugs.webkit.org/show_bug.cgi?id=229405 Reviewed by Kenneth Russell. Instead, refer via the defining base class, i.e. use GraphicsContextGL::SimulatedEventForTesting. Fixes problems if we try to move ANGLE implementation out of GraphicsContextGLOpenGL. No new tests, refactor. * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::simulateEventForTesting): * GPUProcess/graphics/RemoteGraphicsContextGL.h: 2021-08-26 Fujii Hironori [curl] REGRESSION(r281158): fetch('http://localhost/') from about:blank doesn't emit the console error message https://bugs.webkit.org/show_bug.cgi?id=229515 Unreviewed, reverting r281158. * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): 2021-08-25 Aditya Keerthi [iOS] Unable to select files when the accept attribute is set to "*/*" https://bugs.webkit.org/show_bug.cgi?id=229456 rdar://82346315 Reviewed by Chris Dumez. "*/*" is a valid MIME type string representing all media types. However, the UniformTypeIdentifiers framework (as well as the now deprecated CoreServices type identifiers API) does not map wildcard MIME types. In order to restrict `UIDocumentPickerViewController` to the types of files specified in the accept attribute, all MIME type strings are converted into `UTType`s. However, when attempting to retrieve a UTType for "*/*", the system dynamically generates a type, since the string is unregistered. Then, since no files conform to the dynamic type, all files in the document picker are greyed out, and the user is unable to access the "Photo Library" and "Take Photo or Video" items. To fix, return an empty set of type identifiers whenever "*/*" is present in the list of MIME types, ensuring there are no restrictions on the types of files that can be selected. Note that the same issue does not occur on macOS, since all MIME types are mapped to a set of file extensions, rather than UTTypes. Furthermore, on macOS, the embedding app, not WebKit, is responsible for displaying the file picker. * UIProcess/ios/forms/WKFileUploadPanel.mm: 2021-08-25 Wenson Hsieh Remove some iOS-specific compile-time guards that are no longer needed https://bugs.webkit.org/show_bug.cgi?id=229500 Reviewed by Tim Horton. Remove two compile-time flags that were no longer necessary after WebKit's minimum supported iOS version became iOS 14: `USE(UIKIT_KEYBOARD_ADDITIONS)` and `HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)`. `HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)` was only needed for a workaround in our test infrastructure, while `USE(UIKIT_KEYBOARD_ADDITIONS)` was only introduced to maintain basic hardware keyboard functionality in iOS 12, while supporting improvements to hardware keyboard support in iOS 13. The latter now only guards `PLATFORM(IOS) || PLATFORM(MACCATALYST)`. However, there's no reason the codepaths for hardware keyboard support can't exist on watchOS as well (especially since most of hardware keyboard support is already implemented there -- just unreachable because it's not possible to attach a hardware keyboard to an Apple watch). We can remove this feature flag, and simply delete code that was formerly guarded by `!USE(UIKIT_KEYBOARD_ADDITIONS)`. * Platform/spi/ios/UIKitSPI.h: * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent): * Shared/WebKeyboardEvent.cpp: (WebKit::WebKeyboardEvent::WebKeyboardEvent): (WebKit::WebKeyboardEvent::encode const): (WebKit::WebKeyboardEvent::decode): * Shared/WebKeyboardEvent.h: * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _disableAutomaticKeyboardUI]): (-[WKContentView _requiresKeyboardWhenFirstResponder]): (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): (-[WKContentView _didCommitLoadForMainFrame]): (-[WKContentView _setMarkedText:highlights:selectedRange:]): (-[WKContentView textInputTraits]): (-[WKContentView _handleKeyUIEvent:]): (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): (-[WKContentView _elementDidBlur]): (-[WKContentView _hardwareKeyboardAvailabilityChanged]): (-[WKContentView _selectionChanged]): (-[WKContentView keyCommands]): Deleted. (-[WKContentView handleKeyEvent:]): Deleted. * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h: * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm: * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectPopover initWithView:hasGroups:]): (-[WKSelectTableViewController hasText]): Deleted. (-[WKSelectTableViewController insertText:]): Deleted. (-[WKSelectTableViewController deleteBackward]): Deleted. * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm: (WebKit::WebEditorClient::handleInputMethodKeydown): 2021-08-25 Simon Fraser Replace the uint64_t used to identify form submits with a strongly typed identifier https://bugs.webkit.org/show_bug.cgi?id=229513 Reviewed by Alex Christensen. Introduce FormSubmitListenerIdentifier and use it in place of a uint64_t. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): (headers_for_type): * Shared/IdentifierTypes.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::willSubmitForm): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::setUpWillSubmitFormListener): (WebKit::WebFrame::continueWillSubmitForm): * WebProcess/WebPage/WebFrame.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::continueWillSubmitForm): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-08-25 Wenson Hsieh [iOS] Visual Look Up animates from the wrong rect when the web view is scaled https://bugs.webkit.org/show_bug.cgi?id=229518 rdar://82147473 Reviewed by Darin Adler. When adopting QLPreviewControllerDelegate's animated transition methods for rdar://76020349, I mistakenly thought that the `outContentRect` passed into `-previewController:transitionImageForPreviewItem:contentRect:` would be in source view (WKContentView) coordinates; instead, QuickLook expects this `contentRect` to be in window coordinates. Fix this by first converting `_visualSearchPreviewImageBounds` to window coordinates. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView previewController:transitionImageForPreviewItem:contentRect:]): 2021-08-25 Eric Carlson [GPUP] RemoteAudioSession doesn't implement begin/endInterruption https://bugs.webkit.org/show_bug.cgi?id=229514 rdar://80896732 Reviewed by Jer Noble. * WebProcess/GPU/media/RemoteAudioSession.cpp: (WebKit::RemoteAudioSession::setIsPlayingToBluetoothOverride): Remove ENABLE_ROUTING_ARBITRATION guard because it isn't used in the base class. * WebProcess/GPU/media/RemoteAudioSession.h: Change the order virtual methods are declared so they match the base class, to make it easier to spot differences. 2021-08-25 Per Arne Vollan Build error preprocessing sandbox https://bugs.webkit.org/show_bug.cgi?id=229418 Reviewed by Alexey Proskuryakov. Build fix after https://commits.webkit.org/240941@main. * Scripts/generate-derived-sources.sh: 2021-08-25 Aditya Keerthi [iOS] Crash when tapping picker value committed to incorrect element after programmatic focus change https://bugs.webkit.org/show_bug.cgi?id=228556 rdar://81222952 Reviewed by Wenson Hsieh. The old picker, on apps linked before iOS 13, since the new picker commits value changes immediately and dismisses itself. Test: fast/forms/ios/select-picker-change-and-focus-another-select-programmatically.html * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView accessoryClear]): (-[WKContentView updateFocusedElementValueAsNumber:]): (-[WKContentView updateFocusedElementValue:]): (-[WKContentView updateFocusedElementValueAsColor:]): (-[WKContentView updateFocusedElementSelectedIndex:allowsMultipleSelection:]): (-[WKContentView insertTextSuggestion:]): (-[WKContentView selectMenu:didSelectItemAtIndex:]): (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::setFocusedElementValue): (WebKit::WebPageProxy::setFocusedElementValueAsNumber): (WebKit::WebPageProxy::setFocusedElementSelectedIndex): * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker reset:]): * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKMultipleSelectPicker pickerView:row:column:checked:]): (-[WKSelectSinglePicker controlEndEditing]): (-[WKSelectPicker didSelectOptionIndex:]): (-[WKSelectPickerTableViewController tableView:didSelectRowAtIndexPath:]): * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::setFocusedElementValue): (WebKit::WebPage::setFocusedElementValueAsNumber): (WebKit::WebPage::setFocusedElementSelectedIndex): 2021-07-28 Tim Horton iOS Simulator doesn't have any WebKit system feature flags https://bugs.webkit.org/show_bug.cgi?id=228557 rdar://80991854 Reviewed by Darin Adler. * Scripts/generate-feature-flags-plist.sh: Install iOS feature flags for the simulator (and watchOS and tvOS for their respective simulators). This was causing on-by-default features like GPUP to be disabled in the simulator. 2021-07-28 Alex Christensen WebSocket: Safari on iOS 15 beta 3 is sending invalid close frame https://bugs.webkit.org/show_bug.cgi?id=228329 Reviewed by Youenn Fablet. Our NSURLSession WebSocket implementation had two bugs: 1. It was sending 1005 as the close code if none was specified. It now sends no close code, which matches Chrome and Firefox. 2. It was not sending a close code before the close reason when a WebSocket is closed due to navigation. It now sends the close code in 2 bytes before the reason, which matches Chrome and Firefox. Side note: our CFReadStream/CFWriteStream implementation sent neither the code nor the reason in this case, which matches no other browser. Covered by an API test. * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: (WebKit::WebSocketTask::close): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::fail): (WebKit::WebSocketChannel::disconnect): 2021-07-28 Philippe Normand [WPE][GTK] SVN_REVISION drifting away if bots don't re-run cmake https://bugs.webkit.org/show_bug.cgi?id=228290 Reviewed by Michael Catanzaro. * PlatformGTK.cmake: Expand ${BUILD_REVISION} with apply-build-revision-to-files.py for non-tarball builds, or let CMake do it for tarball builds. * PlatformWPE.cmake: Ditto. * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleGPU): Use generated BuildRevision.h header * gtk/webkit2gtk-web-extension.pc.in: Switch revision var to ${} format, so that we can choose to either let CMake expand it or do it ourselves. * gtk/webkit2gtk.pc.in: Ditto. 2021-07-27 Devin Rousso [Modern Media Controls] [macOS] Overflow button still shows as `on` even after contextmenu is dismissed https://bugs.webkit.org/show_bug.cgi?id=228310 Reviewed by Wenson Hsieh. Pipe along the `-[NSMenuDelegate menuDidClose:]` signal to the WebProcess so the `WebCore::ContextMenuProvider` can handle it if needed. * UIProcess/WebContextMenuProxy.cpp: (WebKit::WebContextMenuProxy::useContextMenuItems): * UIProcess/mac/WebContextMenuProxyMac.mm: (-[WKMenuDelegate menuWillOpen:]): (-[WKMenuDelegate menuDidClose:]): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::showContextMenu): (WebKit::WebPageProxy::didShowContextMenu): (WebKit::WebPageProxy::didDismissContextMenu): Added. * WebProcess/WebPage/WebContextMenu.cpp: (WebKit::WebContextMenu::show): * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::startWaitingForContextMenuToShow): Added. (WebKit::WebPage::contextMenuShowing): Deleted. (WebKit::WebPage::contextMenuHidden): Deleted. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didShowContextMenu): Added. (WebKit::WebPage::didDismissContextMenu): Added. (WebKit::WebPage::mouseEvent): Drive-by: Rename `m_contextMenuShowing` to `m_waitingForContextMenuToShow` for clarity. 2021-07-27 Myles C. Maxfield [GPU Process] Code cleanup after r280356 https://bugs.webkit.org/show_bug.cgi?id=228495 Reviewed by Wenson Hsieh. * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::putPixelBuffer): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::recordNativeImageUse): (WebKit::RemoteResourceCacheProxy::recordFontUse): (WebKit::RemoteResourceCacheProxy::cacheNativeImage): Deleted. (WebKit::RemoteResourceCacheProxy::cacheFont): Deleted. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2021-07-27 Aditya Keerthi [iOS] REGRESSION: Tapping a menus should scroll to the selected option https://bugs.webkit.org/show_bug.cgi?id=227562 Reviewed by Wenson Hsieh. Before iOS 15, options are displayed in a context menu. WebKit does not have access to the menu's view hierarchy, and must rely on UIKit to perform the scrolling behavior. * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKSelectPicker createMenu]): Adopt UIMenuOptionsSingleSelection to obtain UIKit behaviors for popup menus. 2021-07-01 Jer Noble [Mac] Adopt async GroupActivity.sessions() iterable instead of GroupSessionObserver https://bugs.webkit.org/show_bug.cgi?id=227548 Reviewed by Sam Weinig. Rather than adopting GroupSessionObserver, which requires Combine, GroupActivity.sessions() uses AsyncSequence, a new Swift 5.5 feature, to allow clients to be notified that new sessions are avaliable. * UIProcess/Cocoa/GroupActivities/WKGroupSession.swift: (WKGroupSessionObserver.incomingSessionsTask): (WKGroupSessionObserver.receivedSession(_:)): (WKGroupSessionObserver.cancellables): Deleted. (WKGroupSessionObserver.recievedSession(_:)): Deleted. 2021-07-01 Youenn Fablet [Cocoa] Migrate WebRTC UDP socket handling to NW API https://bugs.webkit.org/show_bug.cgi?id=227210 Unreviewed, post commit fix. * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h: (WTF::HashTraits::constructDeletedValue): (WTF::HashTraits::isDeletedValue): No need to set all deleted value slots, instead just rely on scope id being equal to numeric_limits::min. Also ensure we do not add an empty/deleted address to the map. 2021-07-01 Youenn Fablet [Cocoa] Migrate WebRTC UDP socket handling to NW API https://bugs.webkit.org/show_bug.cgi?id=227210 Reviewed by Eric Carlson. Migrate UDP socket handling from WebRTC physical socket server to nw API for Cocoa ports. For each UDP socket opened, we open a nw_listener that will listen to inbound connections. On inbound connection, we receive a nw_connection that we store in a address -> connection map. Whenever sending a packet, we look at the remote address. If needed, we create a nw_connection to that particular remote address and store it in the address -> connection map. We then use the pre-existing or newly created nw_connection to send the packet. Make sure to cancel NW connection in case of failure before releasing the socket. Covered by existing tests * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createUDPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::setPlatformTCPSocketsEnabled): (WebKit::NetworkRTCProvider::setPlatformUDPSocketsEnabled): * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.h. * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm: Renamed from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm. (WebKit::tcpSocketQueue): (WebKit::NetworkRTCTCPSocketCocoa::createClientTCPSocket): (WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa): (WebKit::NetworkRTCTCPSocketCocoa::close): (WebKit::NetworkRTCTCPSocketCocoa::setOption): (WebKit::NetworkRTCTCPSocketCocoa::createMessageBuffer): (WebKit::NetworkRTCTCPSocketCocoa::sendTo): * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h: Added. (WTF::DefaultHash::hash): (WTF::DefaultHash::equal): (WTF::HashTraits::emptyValue): (WTF::HashTraits::constructDeletedValue): (WTF::HashTraits::isDeletedValue): * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm: Added. (WebKit::NetworkRTCUDPSocketCocoaConnections::create): (WebKit::NetworkRTCUDPSocketCocoaConnections::WTF_GUARDED_BY_LOCK): (WebKit::udpSocketQueue): (WebKit::NetworkRTCUDPSocketCocoa::createUDPSocket): (WebKit::NetworkRTCUDPSocketCocoa::NetworkRTCUDPSocketCocoa): (WebKit::NetworkRTCUDPSocketCocoa::~NetworkRTCUDPSocketCocoa): (WebKit::NetworkRTCUDPSocketCocoa::close): (WebKit::NetworkRTCUDPSocketCocoa::setOption): (WebKit::NetworkRTCUDPSocketCocoa::sendTo): (WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections): (WebKit::NetworkRTCUDPSocketCocoaConnections::close): (WebKit::NetworkRTCUDPSocketCocoaConnections::setOption): (WebKit::processUDPData): (WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection): (WebKit::NetworkRTCUDPSocketCocoaConnections::setupNWConnection): (WebKit::NetworkRTCUDPSocketCocoaConnections::sendTo): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::setConnection): 2021-07-01 Carlos Garcia Campos [Cairo] Simplify GraphicsContextCairo creation https://bugs.webkit.org/show_bug.cgi?id=227575 Reviewed by Žan Doberšek. Use the new GraphicsContextCairo constructors. * Shared/cairo/ShareableBitmapCairo.cpp: (WebKit::ShareableBitmap::createGraphicsContext): * UIProcess/cairo/BackingStoreCairo.cpp: (WebKit::BackingStore::incorporateUpdate): 2021-07-01 Jer Noble [Mac] (Re-)enable GroupActivities after upstreaming https://bugs.webkit.org/show_bug.cgi?id=227546 Reviewed by Eric Carlson. Fix some build errors exposed by enabling GroupActivities. * UIProcess/Cocoa/GroupActivities/GroupActivitiesCoordinator.mm: 2021-06-30 Antoine Quint [Model] [macOS] Add support for rendering model resources https://bugs.webkit.org/show_bug.cgi?id=227530 Reviewed by Dean Jackson. On macOS, ASVInlinePreview requires an instance in both the WebProcess and the UIProcess to exist with a matching UUID. On the WebKit side, in the UIProcess, we receive a message from the WebProcess when the ASVInlinePreview in that process was created with its generated UUID. We provide this to the ModelElementController, set the remote connection up and load the file. When those tasks complete successfully we message back the WebProcess with the UUID and the provided ElementContext to talk back to the HTMLModelElement instance that initiated the message to the UIProcess in the first place. * UIProcess/Cocoa/ModelElementControllerCocoa.mm: (WebKit::ModelElementController::modelElementDidCreatePreview): * UIProcess/ModelElementController.h: * UIProcess/PageClient.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::modelElementDidCreatePreview): (WebKit::WebPageProxy::modelElementPreviewDidObtainContextId): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::modelElementDidCreatePreview const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::modelElementDidCreatePreview): (WebKit::WebPage::modelElementPreviewDidObtainContextId): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-06-30 Chris Dumez Regression(r278737): WebContent crash when calling [WKWebView loadHTMLString:] with an invalid URL https://bugs.webkit.org/show_bug.cgi?id=227560 Reviewed by Alex Christensen. Make sure the parsed URL is valid in WebPage::loadData() before getting its protocol and calling LegacySchemeRegistry::registerURLSchemeAsHandledBySchemeHandler() with it. Passing a null String to LegacySchemeRegistry::registerURLSchemeAsHandledBySchemeHandler() causes crashes. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadData): 2021-06-30 Megan Gardner Add ID and versioning support for AppHighlights https://bugs.webkit.org/show_bug.cgi?id=227279 Reviewed by Tim Horton. Reformat the storage of Highlight Data to allow for accurate deletion of active highlights, as well as making them more robust and future-proof. Also found an issue with creating SharedBuffers from the memory map, in that the ipcHandle size should be used instead of the sharedMemory->size(). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::restoreAppHighlightsAndScrollToIndex): 2021-06-30 Truitt Savell Unreviewed, reverting r279405. Casued 50+ webrtc crashes on Big Sur Debug Reverted changeset: "[Cocoa] Migrate WebRTC UDP socket handling to NW API" https://bugs.webkit.org/show_bug.cgi?id=227210 https://commits.webkit.org/r279405 2021-06-30 Tim Horton Fix the build. * UIProcess/ios/ProcessAssertionIOS.mm: 2021-06-30 Wenson Hsieh [iOS] [Live Text] "Text from Camera" should not be shown in callout bar when selecting text https://bugs.webkit.org/show_bug.cgi?id=227535 rdar://79936981 Reviewed by Devin Rousso. Match new system behavior in rdar://79758142 by not showing the "Text from Camera" item in the callout bar when the selection is a (non-collapsed) range. Test: WebKit.CaptureTextFromCamera * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformActionForWebView:withSender:]): 2021-06-30 Antoine Quint [Model] [iOS] Add support for displaying in fullscreen https://bugs.webkit.org/show_bug.cgi?id=227443 Reviewed by Sam Weinig. Displaying a model element in fullscreen requires making some calls on the ASVInlinePreview object created by a WKModelView. We send the content layer ID we receive through an IPC call from the WebProcess to the new ModelElementController. We then look at the remote layer tree for a node matching that ID and find its related UIView. If we find a WKModelView, as expected, we can carry on and call -[ASVInlinePreview createFullscreenInstanceWithInitialFrame:previewOptions:completionHandler:] to enter fullscreen using the presentingViewController provided by the UI client, and then observe when we exit fullscreen using -[ASVInlinePreview observeDismissFullscreenWithCompletionHandler:] to make sure the presenting view controller is removed. * Sources.txt: * SourcesCocoa.txt: * UIProcess/Cocoa/ModelElementControllerCocoa.mm: Added. (WebKit::ModelElementController::takeModelElementFullscreen): * UIProcess/ModelElementController.cpp: Added. (WebKit::ModelElementController::ModelElementController): * UIProcess/ModelElementController.h: Added. (WebKit::ModelElementController::page): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didAttachToRunningProcess): (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::takeModelElementFullscreen): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::takeModelElementFullscreen const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::takeModelElementFullscreen): * WebProcess/WebPage/WebPage.h: 2021-06-30 Chris Dumez Unreviewed, reverting r276969. Causes previous assertion to get released before the new one is taken (asynchronously) Reverted changeset: "[iOS] Use async API to take RunningBoard assertions" https://bugs.webkit.org/show_bug.cgi?id=225324 https://commits.webkit.org/r276969 2021-06-30 Chris Dumez Unreviewed, reverting r279155. Caused a PLT5 regression Reverted changeset: "[macOS] Suspend WebProcesses that are in the process cache" https://bugs.webkit.org/show_bug.cgi?id=227269 https://commits.webkit.org/r279155 2021-06-30 Youenn Fablet [Cocoa] Migrate WebRTC UDP socket handling to NW API https://bugs.webkit.org/show_bug.cgi?id=227210 Reviewed by Eric Carlson. Migrate UDP socket handling from WebRTC physical socket server to nw API for Cocoa ports. For each UDP socket opened, we open a nw_listener that will listen to inbound connections. On inbound connection, we receive a nw_connection that we store in a address -> connection map. Whenever sending a packet, we look at the remote address. If needed, we create a nw_connection to that particular remote address and store it in the address -> connection map. We then use the pre-existing or newly created nw_connection to send the packet. Make sure to cancel NW connection in case of failure before releasing the socket. Covered by existing tests * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createUDPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): * NetworkProcess/webrtc/NetworkRTCProvider.h: (WebKit::NetworkRTCProvider::setPlatformTCPSocketsEnabled): (WebKit::NetworkRTCProvider::setPlatformUDPSocketsEnabled): * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.h. * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm: Renamed from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm. (WebKit::tcpSocketQueue): (WebKit::NetworkRTCTCPSocketCocoa::createClientTCPSocket): (WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa): (WebKit::NetworkRTCTCPSocketCocoa::close): (WebKit::NetworkRTCTCPSocketCocoa::setOption): (WebKit::NetworkRTCTCPSocketCocoa::createMessageBuffer): (WebKit::NetworkRTCTCPSocketCocoa::sendTo): * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h: Added. (WTF::DefaultHash::hash): (WTF::DefaultHash::equal): (WTF::HashTraits::emptyValue): (WTF::HashTraits::constructDeletedValue): (WTF::HashTraits::isDeletedValue): * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm: Added. (WebKit::NetworkRTCUDPSocketCocoaConnections::create): (WebKit::NetworkRTCUDPSocketCocoaConnections::WTF_GUARDED_BY_LOCK): (WebKit::udpSocketQueue): (WebKit::NetworkRTCUDPSocketCocoa::createUDPSocket): (WebKit::NetworkRTCUDPSocketCocoa::NetworkRTCUDPSocketCocoa): (WebKit::NetworkRTCUDPSocketCocoa::~NetworkRTCUDPSocketCocoa): (WebKit::NetworkRTCUDPSocketCocoa::close): (WebKit::NetworkRTCUDPSocketCocoa::setOption): (WebKit::NetworkRTCUDPSocketCocoa::sendTo): (WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections): (WebKit::NetworkRTCUDPSocketCocoaConnections::close): (WebKit::NetworkRTCUDPSocketCocoaConnections::setOption): (WebKit::processUDPData): (WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection): (WebKit::NetworkRTCUDPSocketCocoaConnections::setupNWConnection): (WebKit::NetworkRTCUDPSocketCocoaConnections::sendTo): * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::setConnection): 2021-06-28 Antoine Quint [Model] [iOS] Add support for manipulating inline https://bugs.webkit.org/show_bug.cgi?id=227448 Reviewed by Tim Horton. ASVInlinePreview instances allow for UITouch and UIEvent objects to be forwarded in order to manipulate the object inline. We create a UIGestureRecognizer subclass that is attached to WKModelView and forwards touchesBegan: and similar UIResponder messages over to the ASVInlinePreview managed by the WKModelView. This allows multiple elements to be manipulated at once. We will add support for disallowing such interaction with an attribute and/or a call to preventDefault() at a later time. * SourcesCocoa.txt: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: (WebKit::collectDescendantViewsAtPoint): (-[UIView _web_findDescendantViewAtPoint:withEvent:]): * UIProcess/ios/WKModelInteractionGestureRecognizer.h: Added. * UIProcess/ios/WKModelInteractionGestureRecognizer.mm: Added. (-[WKModelInteractionGestureRecognizer touchesBegan:withEvent:]): (-[WKModelInteractionGestureRecognizer touchesMoved:withEvent:]): (-[WKModelInteractionGestureRecognizer touchesEnded:withEvent:]): (-[WKModelInteractionGestureRecognizer touchesCancelled:withEvent:]): * UIProcess/ios/WKModelView.h: * UIProcess/ios/WKModelView.mm: (-[WKModelView initWithModel:]): * WebKit.xcodeproj/project.pbxproj: 2021-06-29 Cameron McCormack Don't null check destination in the RemoteRenderingBackend::nextDestinationImageBufferAfterApply main loop https://bugs.webkit.org/show_bug.cgi?id=227475 Reviewed by Wenson Hsieh. We already null check it and return early as part of the MESSAGE_CHECK_WITH_RETURN_VALUE call just above. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): 2021-06-24 Jer Noble Loading WebM hangs if server sends only small amount of data https://bugs.webkit.org/show_bug.cgi?id=226217 Reviewed by Eric Carlson. Test: http/tests/media/video-webm-stall.html Adopt FigThread{Un,}RegisterAbortAction() when blocking against track parsing. CoreMedia will attempt to abort reads during AVPlayer teardown, but because the parsing thread is blocked on a Condition variable in WebKit code, the abort request has no effect. Adopt methods from CoreMedia to run code during an abort request, and wrap these calls in a stack-based object. The new AbortAction object takes a Condition variable to notify during an abort, and its aborted() state can be queried by the Condition's predicate. Drive-by Fix: enable running an unsigned MTFormatReaderPlugin in the GPU process for engineering builds. * Configurations/BaseTarget.xcconfig: * GPUProcess/mac/GPUProcessMac.mm: (WebKit::GPUProcess::initializeProcess): * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::AbortAction::AbortAction): (WebKit::AbortAction::~AbortAction): (WebKit::AbortAction::aborted const): (WebKit::AbortAction::action): (WebKit::MediaFormatReader::copyProperty): (WebKit::MediaFormatReader::copyTrackArray): 2021-06-29 Carlos Garcia Campos [GTK][WPE] Check GApplication has a valid ID before trying to create the flatpack info https://bugs.webkit.org/show_bug.cgi?id=227344 Reviewed by Michael Catanzaro. Show a warning if GApplication is used but app ID is nullptr. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::createFlatpakInfo): 2021-06-29 Carlos Garcia Campos [GTK][WPE] Bubblewrap: allow to set DBus proxy logging per proxy https://bugs.webkit.org/show_bug.cgi?id=227447 Reviewed by Michael Catanzaro. It's currently global using env var WEBKIT_ENABLE_DBUS_PROXY_LOGGING. Add WEBKIT_ENABLE_A11Y_DBUS_PROXY_LOGGING to enable logging only on a11y bus. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::XDGDBusProxyLauncher::launch): (WebKit::bindA11y): (WebKit::bubblewrapSpawn): 2021-06-29 Youenn Fablet Remove RemoteAudioMediaStreamTrackRenderer and RemoteAudioMediaStreamTrackRendererManager https://bugs.webkit.org/show_bug.cgi?id=227438 Reviewed by Eric Carlson. Remove code no longer enabled. This code was obsoleted by RemoteAudioMediaStreamTrackRendererInternalUnitManager and friends. Update GPUProcess to not exit if RemoteAudioMediaStreamTrackRendererInternalUnitManager has some units, like was done by RemoteAudioMediaStreamTrackRendererManager. * DerivedSources.make: * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::~GPUConnectionToWebProcess): (WebKit::GPUConnectionToWebProcess::allowsExitUnderMemoryPressure const): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::audioMediaStreamTrackRendererQueue): Deleted. * GPUProcess/GPUProcess.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: Removed. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: Removed. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: Removed. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp: (WebKit::renderCallback): (WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::Unit): (WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::start): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.h: (WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::hasUnits): * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: Removed. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: Removed. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.messages.in: Removed. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): * Sources.txt: * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: Removed. * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: Removed. * WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererIdentifier.h: Removed. 2021-06-28 Wenson Hsieh REGRESSION (r279310): Occasional crash when focusing login fields on iPad with a software keyboard https://bugs.webkit.org/show_bug.cgi?id=227472 rdar://79876040 Reviewed by Tim Horton. I added a mechanism in r279310 to defer calling `-[WKContentView _setSuppressSoftwareKeyboard:NO]` until we've gotten a response from the web process containing an up-to-date autocorrection context. However, in the case where the WKWebView client sets `_suppressSoftwareKeyboard` to `YES` and then immediately to `NO` underneath the scope of a call to `-_webView:willStartInputSession:`, we'll end up calling into `-_setSuppressSoftwareKeyboard:` inside the scope of `-requestAutocorrectionContextWithCompletionHandler:`, when we've received an autocorrection context while sync-waiting. This is problematic because it breaks UIKeyboardTaskQueue's state, since the call to `-_setSuppressSoftwareKeyboard:` will attempt to enqueue a new task after the previous task's context has already returned execution to the parent. To fix this, we instead invoke `self._suppressSoftwareKeyboard = NO;` *before* calling the completion block in `-_handleAutocorrectionContext:`. This allows the request for an autocorrection context underneath `-_setSuppressSoftwareKeyboard:` to be handled (and completed) as a child task of the previous task, which keeps UIKeyboardTaskQueue in a valid state. Test: fast/forms/ios/suppress-software-keyboard-while-focusing-input.html * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _handleAutocorrectionContext:]): 2021-06-28 Dana Estra Refactor MacOS keyboard scrolling and use KeyboardScroll struct https://bugs.webkit.org/show_bug.cgi?id=226986 Reviewed by Tim Horton. In addition to notes underneath, changed usage of WebKit::KeyboardScroll, WebKit::ScrollingIncrement, and WebKit::ScrollingDirection to WebCore::KeyboardScroll, WebCore::ScrollGranularity, and WebCore::ScrollDirection, respectively. * UIProcess/ios/WKKeyboardScrollingAnimator.h: * UIProcess/ios/WKKeyboardScrollingAnimator.mm: (-[WKKeyboardScrollingAnimator parameters]): Deleted. Now lives in WebCore/KeyboardScroll.h. (unitVector): Deleted. Now lives in WebCore/KeyboardScroll.h. (perpendicularAbsoluteUnitVector): (boxSide): (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]): (-[WKKeyboardScrollingAnimator beginWithEvent:]): (farthestPointInDirection): (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::handleEditingKeyboardEvent): (WebKit::WebPage::performNonEditingBehaviorForSelector): Added switch that removes selectors that are now handled by EventHandler when EventHandlerDrivenSmoothKeyboardScrolling is enabled. 2021-06-28 Chris Dumez NetworkProcessProxy::networkProcessDidTerminate() should copy process pools before iterating over them https://bugs.webkit.org/show_bug.cgi?id=227468 Reviewed by Alex Christensen. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::networkProcessDidTerminate): 2021-06-28 Sihui Liu Nullptr crash in ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement https://bugs.webkit.org/show_bug.cgi?id=227462 rdar://50772934 Reviewed by Chris Dumez. Return early if statement cannot be created. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList): (WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement): 2021-06-28 Brent Fulgham REGRESSION (r279305) [Mac DEBUG] 4 SOAuthorizationRedirect Tests are Crashing with Assert: !m_sheetWindow https://bugs.webkit.org/show_bug.cgi?id=227454 Reviewed by Kate Cheney. The new assertion is wrong in the case that the app is hidden. When minimized (or hidden) we need to remember to dismiss the sheet once Cocoa restores the app to visible state. So the m_sheetWindow may still exist after returning from 'dismissViewController'. We should assert that either m_sheetWindow is nullptr, or that both m_sheetWindow and m_sheetWindowWillCloseObserver exist. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::becomeCompleted): 2021-06-28 Kate Cheney I-beam pointer is vertical for vertical text https://bugs.webkit.org/show_bug.cgi?id=227414 Reviewed by Tim Horton. Pass the orientation from the renderer to the WKContentView. Rename caretHeight to caretLength now that we use it to calculate the I-beam size for vertical text. * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView pointerInteraction:styleForRegion:]): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::populateCaretContext): 2021-06-28 Per Arne Pass correct value of AX per app settings to the WebContent process https://bugs.webkit.org/show_bug.cgi?id=227441 Reviewed by Brent Fulgham. Pass value of type AXValueState instead of a boolean value for per app AX settings. * Shared/AccessibilityPreferences.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::accessibilityPreferences): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::accessibilityPreferencesDidChange): 2021-06-28 Alex Christensen RELEASE_ASSERT hit in NetworkSessionCocoa::removeWebSocketTask when using WKWebViewConfiguration._attributedBundleIdentifier https://bugs.webkit.org/show_bug.cgi?id=227420 Reviewed by Brady Eidson. WKWebViewConfiguration._attributedBundleIdentifier makes us use a SessionSet per WKWebView. When the WKWebView is destroyed with an open WebSocket, there's a race condition between the NetworkSessionCocoa::removeWebPageNetworkParameters message coming from the UI process and the NetworkConnectionToWebProcess::didClose message coming from the closing of the web process, which calls NetworkSessionCocoa::removeWebSocketTask which currently expects the WebSocketTask to still be there. Instead, keep a WeakPtr and don't remove it if the SessionSet's map is gone. I wrote an API test that hits this condition sometimes when HAVE_NSURLSESSION_WEBSOCKET is true. * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::removeWebSocketTask): * NetworkProcess/NetworkSocketChannel.cpp: (WebKit::NetworkSocketChannel::~NetworkSocketChannel): * NetworkProcess/cocoa/NetworkSessionCocoa.h: (WebKit::SessionSet::create): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::sessionSetForPage): (WebKit::NetworkSessionCocoa::sessionSetForPage const): (WebKit::SessionSet::initializeEphemeralStatelessSessionIfNeeded): (WebKit::SessionSet::isolatedSession): (WebKit::NetworkSessionCocoa::createWebSocketTask): (WebKit::NetworkSessionCocoa::addWebSocketTask): (WebKit::NetworkSessionCocoa::removeWebSocketTask): (WebKit::NetworkSessionCocoa::SessionSet::initializeEphemeralStatelessSessionIfNeeded): Deleted. (WebKit::NetworkSessionCocoa::SessionSet::isolatedSession): Deleted. * NetworkProcess/cocoa/WebSocketTaskCocoa.h: (WebKit::WebSocketTask::sessionSet): * NetworkProcess/cocoa/WebSocketTaskCocoa.mm: (WebKit::WebSocketTask::WebSocketTask): 2021-06-28 Jean-Yves Avenard Not all uses of AudioToolbox framework use soft linking https://bugs.webkit.org/show_bug.cgi?id=227250 Reviewed by Eric Carlson. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::consumeAudioComponentRegistrations): * Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp: (WebKit::createWrapper): (WebKit::wrapperStorage): (WebKit::wrapperVTable): * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::copyProperty): * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: * WebProcess/cocoa/RemoteRealtimeAudioSource.cpp: * WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::consumeAudioComponentRegistrations): 2021-06-28 Kimmo Kinnunen Possible build breakage after r279221 in some unified build configurations https://bugs.webkit.org/show_bug.cgi?id=227440 Unreviewed build fix. Add missing #import since the code use MachSendRight. The code happens to work on default configuration due to unified build. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: 2021-06-27 Commit Queue Unreviewed, reverting r279322. https://bugs.webkit.org/show_bug.cgi?id=227434 Reverted changeset: "Not all uses of AudioToolbox framework use soft linking" https://bugs.webkit.org/show_bug.cgi?id=227250 https://commits.webkit.org/r279322 2021-06-27 Jean-Yves Avenard Not all uses of AudioToolbox framework use soft linking https://bugs.webkit.org/show_bug.cgi?id=227250 Reviewed by Eric Carlson. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::consumeAudioComponentRegistrations): * Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp: (WebKit::createWrapper): (WebKit::wrapperStorage): (WebKit::wrapperVTable): * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::copyProperty): * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: * WebProcess/cocoa/RemoteRealtimeAudioSource.cpp: * WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::consumeAudioComponentRegistrations): 2021-06-27 Wenson Hsieh Unreviewed, fix the iOS build after rdar://76781873 Remove support for `-[UIResponder _insertTextFromCamera:]` in WebKit2, now that UIKit only supports the public API version (`-[UIResponder captureTextFromCamera:]`). * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformActionForWebView:withSender:]): (-[WKContentView _insertTextFromCameraForWebView:]): Deleted. 2021-06-27 Antoine Quint [Model] [iOS] Add support for rendering model resources https://bugs.webkit.org/show_bug.cgi?id=227392 Reviewed by Tim Horton. Add a new WKModelView class which manages an ASVInlinePreview and displays its layer. The current incarnation of the ASVInlinePreview SPI requires a URL to a file to specify the resource, so we write a file to the temporary directory added in 279267 with the data wrapped in the Model object passed through the remote layer tree. Ultimately we will be able to use an SPI that does not require a file and instead will allow data to be passed directly, this is purely for a temporary experimentation. * Platform/Logging.h: * SourcesCocoa.txt: * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: (WebKit::RemoteLayerTreeHost::makeNode): * UIProcess/ios/WKModelView.h: Added. * UIProcess/ios/WKModelView.mm: Added. (-[WKModelView preview]): (-[WKModelView initWithFrame:]): (-[WKModelView initWithCoder:]): (-[WKModelView initWithModel:]): (-[WKModelView createFileForModel:]): (-[WKModelView layoutSubviews]): (-[WKModelView updateBounds]): * WebKit.xcodeproj/project.pbxproj: 2021-06-26 Wenson Hsieh [iOS] Safari sometimes hangs under sync IPC in `-[WKWebView _setSuppressSoftwareKeyboard:]` https://bugs.webkit.org/show_bug.cgi?id=227424 rdar://79745385 Reviewed by Tim Horton. When activating streamlined AutoFill, Safari calls UIKit SPI (`-_setSuppressSoftwareKeyboard:`) on WKWebView to ensure that the normal software keyboard doesn't briefly appear instead of the AutoFill input view; after requesting AutoFill credentials, Safari then stops suppressing the software keyboard by setting the SPI property back to NO. In WebKit, we override `-[WKWebView _setSuppressSoftwareKeyboard:]`, such that WKContentView's keyboard suppression state follows the web view's state (this is necessary, since WKContentView is the actual `-firstResponder` when editing focused text inputs). However, when changing software keyboard suppression from YES to NO, UIKit reloads input views and (in the process) calls into `-requestAutocorrectionContextWithCompletionHandler:`, which then makes a sync IPC call into the web process. To avoid this sync IPC call, we refactor the implementation of `-[WKWebView _setSuppressSoftwareKeyboard:]`, such that we don't immediately attempt to unsuppress the software keyboard by calling into WKContentView. Instead, we asynchronously request an autocorrection context from the web process, and then call `-[WKContentView _setSuppressSoftwareKeyboard:NO]` after the autocorrection context request completes (using the last known autocorrection context data in the UI process rather than making a sync IPC call). * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setSuppressSoftwareKeyboard:]): Call into `-updateSoftwareKeyboardSuppressionStateFromWebView` below. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): Invoke `-unsuppressSoftwareKeyboardUsingLastAutocorrectionContextIfNeeded` to ensure that we stop software keyboard suppression if the web process terminates while we're waiting for autocorrection context data to arrive. (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): (-[WKContentView _handleAutocorrectionContext:]): (-[WKContentView updateSoftwareKeyboardSuppressionStateFromWebView]): Add a new helper that keeps WKContentView's software keyboard suppression state in sync with the WKWebView's software keyboard suppression state. In the case where we're supressing the software keyboard, we can simply call into `-[WKContentView _setSuppressSoftwareKeyboard:]` right away, since UIKit won't try to request an autocorrection context. However, in the case where we're unsuppressing the software keyboard, set a new flag, don't immediately forward the call to WKContentView. Instead, set the `_unsuppressSoftwareKeyboardAfterNextAutocorrectionContextUpdate` flag to YES and call into WebPageProxy to request an updated autocorrection context. Upon receiving the response in `-[WKContentView _handleAutocorrectionContext:]`, we then unset the flag and unsuppress the software keyboard (crucially, using `_lastAutocorrectionContext` instead of making a synchronous call back to the web content process). (-[WKContentView unsuppressSoftwareKeyboardUsingLastAutocorrectionContextIfNeeded]): 2021-06-25 Brent Fulgham [macOS] Add logging and clean up AppSSO flows https://bugs.webkit.org/show_bug.cgi?id=227379 Reviewed by Kate Cheney. This patch adds detailed logging to understand the flows through the AppSSO authentication code, and adds clean-up code in more places to ensure that the modal sheet used by AppSSO is dismissed in cases where the authentication has completed (or failed). * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm: (WebKit::NavigationSOAuthorizationSession::shouldStartInternal): Adds new logging. (WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow): Ditto. (WebKit::NavigationSOAuthorizationSession::pageActiveURLDidChangeDuringWaiting const): Ditto. * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm: (WebKit::PopUpSOAuthorizationSession::shouldStartInternal): Adds new logging. (WebKit::PopUpSOAuthorizationSession::fallBackToWebPathInternal): Ditto. (WebKit::PopUpSOAuthorizationSession::abortInternal): Ditto. (WebKit::PopUpSOAuthorizationSession::completeInternal): Ditto. (WebKit::PopUpSOAuthorizationSession::close): Ditto. (WebKit::PopUpSOAuthorizationSession::initSecretWebView): Ditto. * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: (WebKit::RedirectSOAuthorizationSession::fallBackToWebPathInternal): Adds new logging. (WebKit::RedirectSOAuthorizationSession::abortInternal): Ditto. (WebKit::RedirectSOAuthorizationSession::completeInternal): Ditto. (WebKit::RedirectSOAuthorizationSession::beforeStart): Ditto. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.mm: (WebKit::SOAuthorizationCoordinator::tryAuthorize): Adds new logging. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h: * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::stateString const): Added. (WebKit::SOAuthorizationSession::~SOAuthorizationSession): Add new logging, and ensure modal sheet is dismissed. (WebKit::SOAuthorizationSession::becomeCompleted): Added new logging. (WebKit::SOAuthorizationSession::shouldStart): Ditto. (WebKit::SOAuthorizationSession::start): Ditto. (WebKit::SOAuthorizationSession::continueStartAfterGetAuthorizationHints): Ditto. (WebKit::SOAuthorizationSession::continueStartAfterDecidePolicy): Ditto. (WebKit::SOAuthorizationSession::fallBackToWebPath): Add new logging, and ensure modal sheet is dismissed. (WebKit::SOAuthorizationSession::abort): Ditto. (WebKit::SOAuthorizationSession::complete): Ditto. (WebKit::SOAuthorizationSession::presentViewController): Added new logging, and dismiss modal if an existing view is in place. (WebKit::SOAuthorizationSession::dismissModalSheetIfNecessary): Added. (WebKit::SOAuthorizationSession::dismissViewController): Use new helper function. * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm: (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal): Adds new logging. (WebKit::SubFrameSOAuthorizationSession::abortInternal): Ditto. (WebKit::SubFrameSOAuthorizationSession::completeInternal): Ditto. (WebKit::SubFrameSOAuthorizationSession::beforeStart): Ditto. (WebKit::SubFrameSOAuthorizationSession::didFinishLoad): Ditto. (WebKit::SubFrameSOAuthorizationSession::loadRequestToFrame): Ditto. * UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.mm: (-[WKSOAuthorizationDelegate authorization:presentViewController:withCompletion:]): Adds new logging. (-[WKSOAuthorizationDelegate authorizationDidNotHandle:]): Ditto. (-[WKSOAuthorizationDelegate authorizationDidCancel:]): Ditto. (-[WKSOAuthorizationDelegate authorizationDidComplete:]): Ditto. (-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPAuthorizationHeaders:]): Ditto. (-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPResponse:httpBody:]): Ditto. (-[WKSOAuthorizationDelegate authorization:didCompleteWithError:]): Ditto. (-[WKSOAuthorizationDelegate setSession:]): Ditto. 2021-06-25 Wenson Hsieh [iOS] Web process sometimes crashes under findDataDetectionResultElementInImageOverlay https://bugs.webkit.org/show_bug.cgi?id=227412 rdar://79588091 Reviewed by Devin Rousso. Speculatively fix the crash by ensuring that the hit-tested text node inside an image overlay is inside the shadow root of the element responding to click events, and that the element responding to click events contains an image overlay. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::elementPositionInformation): 2021-06-25 Per Arne [macOS] Add missing methods to IOKit filter https://bugs.webkit.org/show_bug.cgi?id=227398 Reviewed by Brent Fulgham. Add missing methods to the IOAccelerator IOKit filter on macOS. * WebProcess/com.apple.WebProcess.sb.in: 2021-06-25 Ryan Haddad Unreviewed, reverting r279208. https://bugs.webkit.org/show_bug.cgi?id=227381 Broke the Apple Windows build. Reverted changeset: "Not all uses of AudioToolbox framework use soft linking" https://bugs.webkit.org/show_bug.cgi?id=227250 https://trac.webkit.org/changeset/279208 2021-06-25 Peng Liu Explicitly invalidate WKFullScreenViewController after a video exits fullscreen https://bugs.webkit.org/show_bug.cgi?id=227372 Reviewed by Eric Carlson. Since `WKFullScreenWindowController` owns `WKFullScreenViewController`, we had better let `WKFullScreenWindowController` manage the life cycle of `WKFullScreenViewController`. * UIProcess/ios/fullscreen/WKFullScreenViewController.h: * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController initWithWebView:]): (-[WKFullScreenViewController invalidate]): (-[WKFullScreenViewController dealloc]): (-[WKFullScreenViewController showUI]): (-[WKFullScreenViewController hideUI]): (-[WKFullScreenViewController videoControlsManagerDidChange]): (-[WKFullScreenViewController setAnimatingViewAlpha:]): (-[WKFullScreenViewController setPrefersStatusBarHidden:]): (-[WKFullScreenViewController setPrefersHomeIndicatorAutoHidden:]): (-[WKFullScreenViewController setPlaying:]): (-[WKFullScreenViewController setPictureInPictureActive:]): (-[WKFullScreenViewController setAnimating:]): (-[WKFullScreenViewController _manager]): (-[WKFullScreenViewController _effectiveFullscreenInsets]): (-[WKFullScreenViewController _cancelAction:]): (-[WKFullScreenViewController _togglePiPAction:]): (-[WKFullScreenViewController _touchDetected:]): (-[WKFullScreenViewController _statusBarFrameDidChange:]): (-[WKFullScreenViewController _updateWebViewFullscreenInsets]): (-[WKFullScreenViewController _showPhishingAlert]): * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController _completedExitFullScreen]): 2021-06-25 Commit Queue Unreviewed, reverting r279266. https://bugs.webkit.org/show_bug.cgi?id=227402 Causes crash loop Reverted changeset: "Remove references to order files" https://bugs.webkit.org/show_bug.cgi?id=227377 https://trac.webkit.org/changeset/279266 2021-06-25 Zan Dobersek [GLib] Guard Cairo inclusions in shared GLib API implementation files https://bugs.webkit.org/show_bug.cgi?id=227370 Reviewed by Philippe Normand. For cross-port GLib API implementation, different Cairo inclusions are moved into appropriate build guards tha match the build guards where Cairo is then used. * UIProcess/API/glib/WebKitFaviconDatabase.cpp: * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleGPU): * UIProcess/API/glib/WebKitWebView.cpp: 2021-06-24 Antoine Quint [Model] Create a sandbox extension for a temporary directory to store model resources https://bugs.webkit.org/show_bug.cgi?id=227359 Reviewed by Tim Horton. The SPIs we will use to render resources expect a file URL to load and render the model. Before we adopt these SPIs, we extend the sandbox to allow writing to a temporary directory where we will store these resources. * Shared/WebProcessDataStoreParameters.h: (WebKit::WebProcessDataStoreParameters::encode const): (WebKit::WebProcessDataStoreParameters::decode): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::webProcessDataStoreParameters): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::defaultModelElementCacheDirectory): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): * UIProcess/WebsiteData/WebsiteDataStore.h: (WebKit::WebsiteDataStore::resolvedModelElementCacheDirectory const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration): (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::modelElementCacheDirectory const): (WebKit::WebsiteDataStoreConfiguration::setModelElementCacheDirectory): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setWebsiteDataStoreParameters): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformSetWebsiteDataStoreParameters): 2021-06-24 Sihui Liu Remove references to order files https://bugs.webkit.org/show_bug.cgi?id=227377 rdar://76070556 Reviewed by Mark Lam. * Configurations/WebKit.xcconfig: 2021-06-24 Chris Dumez REGRESSION: (r279244) [ Mac ] http/tests/workers/service/postmessage-after-terminate.https.html is timing out https://bugs.webkit.org/show_bug.cgi?id=227380 Unreviewed, drop protector added in r279244 inside establishServiceWorkerContext() as it is what caused this test to time out. I am not sure why this is happening yet but I am doing this partial revert to get us back in a good state. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::establishServiceWorkerContext): 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-06-24 Said Abou-Hallawa [GPU Process] RELEASE_ASSERT in RemoteResourceCacheProxy::didFinalizeRenderingUpdate() may fire if GPUP is relaunched https://bugs.webkit.org/show_bug.cgi?id=227229 Reviewed by Myles C. Maxfield. When the GPUP is relaunched remoteResourceCacheWasDestroyed() clears m_fontIdentifierToLastRenderingUpdateVersionMap but it does not reset m_numberOfFontsUsedInCurrentRenderingUpdate. This will make it always greater than m_fontIdentifierToLastRenderingUpdateVersionMap.size(). And this is why the assertion fires. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed): 2021-06-24 Alex Christensen Fix WKDownloadDelegate header doc https://bugs.webkit.org/show_bug.cgi?id=227378 Reviewed by Brady Eidson. This removes the following sentence: "If this is a download of a blob URL, response will be null." This was correct in an earlier iteration of the implementation of this API, but is now incorrect and verified by the WKDownload.BlobResponse API test. * UIProcess/API/Cocoa/WKDownloadDelegate.h: 2021-06-24 Kate Cheney WKWebView loadSimulatedRequest does not set attribution value for url requests within html content https://bugs.webkit.org/show_bug.cgi?id=227266 Reviewed by Brent Fulgham. We currently pass the attribution value from the main NSURLRequest passed into WebPageProxy::loadRequest by setting a value on the WebPage document loader that gets passed to all requests initiated by that main navigation. This patch adds the same functionality for WebPageProxy::loadSimulatedRequest, which could initiate URL requests from HTML content. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadSimulatedRequest): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadSimulatedRequestAndResponse): 2021-06-24 Wenson Hsieh [watchOS] Automatically apply system minimum layout margins as scroll view content insets https://bugs.webkit.org/show_bug.cgi?id=227178 rdar://76784095 Reviewed by Tim Horton. Respect `-[UIViewController systemMinimumLayoutMargins]` on watchOS by treating them in a similar way as safe area insets, such that we avoid laying out parts of the web page within these margins unless the page's meta viewport specifies `viewport-fit=cover`. On watch, avoiding these layout margins is crucial. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _computedObscuredInsetForSafeBrowsingWarning]): (-[WKWebView _contentInsetsFromSystemMinimumLayoutMargins]): Add a helper method to compute the amount of additional content inset we need to apply to the scroll view in order for content to fit within WKWebView's view controller's `-systemMinimumLayoutMargins`. Note that this accounts for cases where the web view's frame is already inset relative to the view controller's content view. (-[WKWebView _computedObscuredInset]): (-[WKWebView _computedContentInset]): Unconditionalize a few codepaths that apply obscured and content insets by consulting `-_scrollViewSystemContentInset`. (-[WKWebView _computedUnobscuredSafeAreaInset]): On watchOS, we augment safe area insets, such that they include `_contentInsetsFromSystemMinimumLayoutMargins` as well. (-[WKWebView activeViewLayoutSize:]): (-[WKWebView _updateScrollViewContentInsetsIfNecessary]): Add a helper method that (on watchOS only) updates WKScrollView's content scroll insets such that the web page fits inside `-systemMinimumLayoutMargins`. See WKScrollView changes below for more details. (-[WKWebView _updateVisibleContentRects]): (-[WKWebView _setAvoidsUnsafeArea:]): Update scroll view content insets on watchOS if the `viewport-fit` state changes. Additionally make sure that we also update the active layout size if the insets actually change (without this tweak, when dynamically adding `viewport-fit=cover`, we'll end up in a state where the content size is still narrow to account for the old content scroll insets, but the new content scroll insets are set, so the web page apears misaligned relative to the scroll view). * UIProcess/ios/WKScrollView.h: * UIProcess/ios/WKScrollView.mm: (-[WKScrollView _setContentScrollInset:]): (-[WKScrollView _setContentScrollInsetInternal:]): Add an internal method for setting `-[UIScrollView _contentScrollInset]` that defers to the embedding client. This means WKWebView clients that use `webView.scrollView.contentScrollInset = myInset;` will override the above behavior in `-_updateScrollViewContentInsetsIfNecessary`, but otherwise, the content scroll insets will be automatically computed and set in order to avoid minimum layout margins if needed. Note that this also returns a `BOOL` indicating whether the inset was updated. (-[WKScrollView _updateContentScrollInset]): 2021-06-24 Chris Dumez Improve release logging in WebProcessProxy https://bugs.webkit.org/show_bug.cgi?id=227374 Reviewed by Geoffrey Garen. Improve release logging in WebProcessProxy: - Add more logging - Use more consistent logging format to faciliate grep'ing - Always include pointer and PID in the logging * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::enableProcessTermination): (WebKit::WebProcessPool::disableProcessTermination): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::~WebProcessProxy): (WebKit::WebProcessProxy::setIsInProcessCache): (WebKit::WebProcessProxy::setWebsiteDataStore): (WebKit::WebProcessProxy::addProvisionalPageProxy): (WebKit::WebProcessProxy::removeProvisionalPageProxy): (WebKit::WebProcessProxy::processWillShutDown): (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::addExistingWebPage): (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool): (WebKit::WebProcessProxy::removeWebPage): (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess): (WebKit::WebProcessProxy::gpuProcessExited): (WebKit::WebProcessProxy::didClose): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): (WebKit::WebProcessProxy::didBecomeUnresponsive): (WebKit::WebProcessProxy::didBecomeResponsive): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const): (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess): (WebKit::WebProcessProxy::fetchWebsiteData): (WebKit::WebProcessProxy::deleteWebsiteData): (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins): (WebKit::WebProcessProxy::requestTermination): (WebKit::WebProcessProxy::sendPrepareToSuspend): (WebKit::WebProcessProxy::sendProcessDidResume): (WebKit::WebProcessProxy::didSetAssertionType): (WebKit::WebProcessProxy::updateAudibleMediaAssertions): (WebKit::WebProcessProxy::setIsHoldingLockedFiles): (WebKit::WebProcessProxy::processTerminated): (WebKit::WebProcessProxy::didExceedActiveMemoryLimit): (WebKit::WebProcessProxy::didExceedInactiveMemoryLimit): (WebKit::WebProcessProxy::didExceedCPULimit): (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame): (WebKit::WebProcessProxy::incrementSuspendedPageCount): (WebKit::WebProcessProxy::decrementSuspendedPageCount): (WebKit::WebProcessProxy::processPoolIfExists const): (WebKit::WebProcessProxy::startBackgroundActivityForFullscreenInput): (WebKit::WebProcessProxy::endBackgroundActivityForFullscreenInput): (WebKit::WebProcessProxy::establishServiceWorkerContext): (WebKit::WebProcessProxy::updateServiceWorkerProcessAssertion): (WebKit::WebProcessProxy::registerServiceWorkerClientProcess): (WebKit::WebProcessProxy::unregisterServiceWorkerClientProcess): (WebKit::WebProcessProxy::disableServiceWorkers): (WebKit::WebProcessProxy::enableServiceWorkers): 2021-06-24 Chris Dumez Add release logging in the WebPage constructor / destructor https://bugs.webkit.org/show_bug.cgi?id=227361 Reviewed by Geoffrey Garen. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::~WebPage): 2021-06-24 Per Arne [macOS] Fix incorrect version check in the WebContent process' sandbox https://bugs.webkit.org/show_bug.cgi?id=227346 Reviewed by Alexey Proskuryakov. * WebProcess/com.apple.WebProcess.sb.in: 2021-06-24 Brent Fulgham [iOS] Allow network-outbound logging for internal builds https://bugs.webkit.org/show_bug.cgi?id=227332 Reviewed by Per Arne Vollan. We allow network-outbound for /private/var/run/syslog in the WebContent process for debugging purposes on internal OS images. We should do the same for our other processes to avoid noisy logging. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: 2021-06-24 Kimmo Kinnunen Using a video as a source for a WebGL texture is slow and hangs on iOS 15 https://bugs.webkit.org/show_bug.cgi?id=227081 Reviewed by Eric Carlson. In current form, media is decoded in GPU process and WebGL is processed in Web process. Video frame transfer from GPU process to Web process would fail when WebGL tried to copy the video frame to a texture. The failure was artificial, due to use of WebCore::IOSurface as a unneeeded helper to convert CVPixelBufferRef to a cross-process object. The failure would occur when AVPlayerItemVideoOutput would generate a CVPixelBufferRef without color space information. Creating WebCore::IOSurface out of this would fail. WebCore::IOSurface has always a color space. The failure is not significant, as WebCore::IOSurface was only used as a convenience. This would cause performance regression when WebGL would fall back to software conversion fallback. This callback did work as it obtains the image through "get last frame as native image" API. * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: Use the correct type of object in the IPC messages: Function `PixelBufferForCurrentTime` returns `CVPixelBufferRef` so use that type instead of `MachPort`. It is an implementation detail of `CVPixelBufferRef` encode/decode how the object transfer is implemented. The type of transfer must be RetainPtr as that is how the IPC system operates wrt input, output and "storage" types. This is the same as with IPC support for RefPtr<> types. No tests as Sources/WebKit is not unit-testable ATM. * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: (WebKit::RemoteMediaPlayerProxy::pixelBufferForCurrentTime): Change the receive side according to the message type change. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): (class_template_headers): Add support for RetainPtr in the IPC message language. * 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/TestWithCVPixelBuffer.messages.in: Added. * Scripts/webkit/tests/TestWithCVPixelBufferMessageReceiver.cpp: Added. (WebKit::TestWithCVPixelBuffer::didReceiveMessage): (WebKit::TestWithCVPixelBuffer::didReceiveSyncMessage): * Scripts/webkit/tests/TestWithCVPixelBufferMessages.h: Copied from Source/WebKit/Scripts/webkit/tests/TestWithSuperclassMessagesReplies.h. (Messages::TestWithCVPixelBuffer::messageReceiverName): (Messages::TestWithCVPixelBuffer::SendCVPixelBuffer::name): (Messages::TestWithCVPixelBuffer::SendCVPixelBuffer::SendCVPixelBuffer): (Messages::TestWithCVPixelBuffer::SendCVPixelBuffer::arguments const): (Messages::TestWithCVPixelBuffer::ReceiveCVPixelBuffer::name): (Messages::TestWithCVPixelBuffer::ReceiveCVPixelBuffer::arguments const): * Scripts/webkit/tests/TestWithCVPixelBufferMessagesReplies.h: Copied from Source/WebKit/Scripts/webkit/tests/TestWithSuperclassMessagesReplies.h. * Scripts/webkit/tests/TestWithSuperclassMessagesReplies.h: Add code generation examples for IPC implemetation regarding transferring RetainPtr. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): * Shared/WebCoreArgumentCoders.h: Move the CVPixelBufferRef transfer code from IOSurface to the IPC layer. The encode function must be of type RetainPtr instead of CVPixelBufferRef, in contrast to existing RetainPtr types. The existing RetainPtr types are not used as IPC message inputs, only as subobjects. The IPC message language does not have concept of encode type differing from decode type. * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: (WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime): Change the send side according to the message type change. 2021-06-24 Martin Robinson [css-scroll-snap] Remove ENABLE_SCROLL_SNAP compile-time option https://bugs.webkit.org/show_bug.cgi?id=227067 Reviewed by Simon Fraser. Remove compile-time ENABLE_SCROLL_SNAP configuration option. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::encode): (ArgumentCoder::decode): (WebKit::dump): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView scrollViewWillBeginDragging:]): (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]): (-[WKWebView _updateVisibleContentRects]): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::resetStateAfterProcessExited): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: 2021-06-24 Michael Catanzaro REGRESSION(r272882): [WPE][GTK] xdg-dbus-proxy may not be mounted in sandbox https://bugs.webkit.org/show_bug.cgi?id=227294 Reviewed by Adrian Perez de Castro. * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bubblewrapSpawn): 2021-06-23 Said Abou-Hallawa REGRESSION(r278970): A CATransaction commitHandler should not execute a client callback https://bugs.webkit.org/show_bug.cgi?id=227318 Reviewed by Tim Horton. In takeSnapshotWithConfiguration() we call callSnapshotRect() inside the callback of [CATransaction addCommitHandler]. callSnapshotRect() calls the client callback which may call directly or indirectly addCommitHandler. But it is prohibited by CA to add a commit handler while processing a registered commit handler. The fix is to postpone calling callSnapshotRect() till CATransaction processes all its commit handler callbacks. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): 2021-06-23 Jean-Yves Avenard Not all uses of AudioToolbox framework use soft linking https://bugs.webkit.org/show_bug.cgi?id=227250 Reviewed by Eric Carlson. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::consumeAudioComponentRegistrations): * Shared/mac/MediaFormatReader/CoreMediaWrapped.cpp: (WebKit::createWrapper): (WebKit::wrapperStorage): (WebKit::wrapperVTable): * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::copyProperty): * Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp: (WebKit::MediaSampleByteRange::MediaSampleByteRange): * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: * WebProcess/cocoa/RemoteRealtimeAudioSource.cpp: * WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::consumeAudioComponentRegistrations): 2021-06-23 Wenson Hsieh Add a delegate SPI to allow arbitrary gestures to ignore preventDefault() with active touch events https://bugs.webkit.org/show_bug.cgi?id=227311 rdar://79624236 Reviewed by Tim Horton. Add a UI delegate hook to allow internal clients to (easily) introduce gesture recognizers on WKWebView that are capable of recognizing even if active touch events are prevented by the page. This allows Safari to stop overriding an internal method on WKWebView, `-_isNavigationSwipeGestureRecognizer:`. Testing this requires the ability to simulate touch events (through HID event dispatch) in API tests. * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _touchEventsMustRequireGestureRecognizerToFail:]): Note that we only consult the delegate here for gestures that are added directly to WKWebView. This is because we already avoid deferring gestures that are added *above* WKWebView, and it's unnecessary to allow clients to avoid deferring gestures that are internal to WebKit (i.e. added on WKContentView). (-[WKContentView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]): (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): 2021-06-23 Martin Robinson [iOS 15 Regression]: scroll position resets when using scroll snap https://bugs.webkit.org/show_bug.cgi?id=226816 Reviewed by Simon Fraser. To improve scrolling fluidity on iOS, have any sort of momentum scroll trigger directional scroll snapping. This means that any momentum scroll will move to the next or previous scroll position and not snap back. This improves behavior on tesla.com and also on the scroll snapping demo on the WebKit page. Tests: fast/scrolling/ios/scroll-snap-with-momentum-scroll-in-main-frame.html fast/scrolling/ios/scroll-snap-with-momentum-scroll-in-overflow-scroll-area.html * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Pass the current scroll offset to the RemoteScrollingCoordinatorProxy. Passing a value for this offset is the trigger for directional scroll snapping. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Update method definitions. * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping): Pass the current offset. (WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling const): Ditto. * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Enable directional scroll snapping for RenderLayers. 2021-06-23 Jer Noble [Cocoa] Make the hostTime parameter to playSession a Monotonic time https://bugs.webkit.org/show_bug.cgi?id=226515 Reviewed by Youenn Fablet. * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]): (-[WKMediaSessionCoordinatorHelper playSessionWithCompletion:]): * UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp: (WebKit::RemoteMediaSessionCoordinatorProxy::playSession): * UIProcess/Media/RemoteMediaSessionCoordinatorProxy.h: * WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp: (WebKit::RemoteMediaSessionCoordinator::playSession): * WebProcess/MediaSession/RemoteMediaSessionCoordinator.h: * WebProcess/MediaSession/RemoteMediaSessionCoordinator.messages.in: 2021-06-23 Kate Cheney Migrate App Privacy Report code from WebKitAdditions https://bugs.webkit.org/show_bug.cgi?id=227045 Reviewed by Alex Christensen. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (processPCMRequest): (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (contextString): Deleted. This patch deletes the contextString function because it is no longer needed now that CFNetwork sets the attribution context based on the main document URL, and it seemed silly to migrate code from WebKitAdditions just to delete it immediately. This also moves the processPCMRequest function declaration from WebKitAdditions so we can remove NETWORK_DATA_TASK_COCOA_ADDITIONS. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::isActingOnBehalfOfAFullWebBrowser): (WebKit::NetworkSessionCocoa::removeNetworkWebsiteData): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::setLastNavigationWasAppBound): 2021-06-23 Aditya Keerthi [iOS] Adopt new date picker presentation SPI https://bugs.webkit.org/show_bug.cgi?id=227221 Reviewed by Wenson Hsieh. In native applications, tapping on a compact UIDatePicker presents an inline picker using _UIDatePickerOverlayPresentation. To avoid maintaining our own presentation logic, and to better match the native presentation, use _UIDatePickerOverlayPresentation when tapping on a date/time input in WebKit. Covered by existing tests. * Platform/spi/ios/UIKitSPI.h: Declare the SPI rather than importing the header directly, as the _UIDatePickerOverlayAnchor enum is not available in all SDKs with the header. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePickerViewController initWithDatePicker:]): (-[WKDateTimePickerViewController setDelegate:]): (-[WKDateTimePicker initWithView:datePickerMode:]): Create the UIDatePicker here so it can be shared by the old context menu presentation and the new overlay presentation. (-[WKDateTimePicker handleDatePickerPresentationDismissal]): (-[WKDateTimePicker removeDatePickerPresentation]): `accessoryDone` eventually removes the presentation. If the date picker is already being dismissed, do not dismiss it without an animation. For programmatic dismissal (using blur()) this method is called prior to `accessoryDone`, in which case we force dismissal without animation. (-[WKDateTimePicker dateTimePickerViewControllerDidPressResetButton:]): (-[WKDateTimePicker dateTimePickerViewControllerDidPressDoneButton:]): (-[WKDateTimePicker showDateTimePicker]): (-[WKDateTimePicker datePickerChanged:]): (-[WKDateTimePicker reset:]): (-[WKDateTimePicker done:]): (-[WKDateTimePicker dealloc]): (-[WKDateTimePicker _timeZoneOffsetFromGMT:]): (-[WKDateTimePicker dateFormatterForPicker]): (-[WKDateTimePicker _dateChangedSetAsNumber]): (-[WKDateTimePicker _dateChangedSetAsString]): (-[WKDateTimePicker setDateTimePickerToInitialValue]): (-[WKDateTimePicker controlBeginEditing]): (-[WKDateTimePicker controlEndEditing]): (-[WKDateTimePicker calendarType]): (-[WKDateTimePicker hour]): (-[WKDateTimePicker minute]): (-[WKDateTimePicker setHour:minute:]): 2021-06-23 Commit Queue Unreviewed, reverting r279104. https://bugs.webkit.org/show_bug.cgi?id=227292 Made various layout tests very flaky Reverted changeset: "[GPU Process] RELEASE_ASSERT in RemoteResourceCacheProxy::didFinalizeRenderingUpdate() may fire if GPUP is relaunched" https://bugs.webkit.org/show_bug.cgi?id=227229 https://trac.webkit.org/changeset/279104 2021-06-22 Megan Gardner Message dropped when restoring webpages. https://bugs.webkit.org/show_bug.cgi?id=227278 Reviewed by Tim Horton. The message to initialize the state of highlightVisibility is dropped sometimes, but fortunately, there is no need to pass the current state when initializing the HighlightObserver, as WebPageProxy::creationParameters will obtain the correct highlight state on initialization after r279078. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::setUpHighlightsObserver): 2021-06-22 Wenson Hsieh [Live Text] [macOS] Add an internal option to disable inline text selection in images https://bugs.webkit.org/show_bug.cgi?id=227265 rdar://79460142 Reviewed by Tim Horton. Refactor Live Text and Visual Look Up logic, such that the ability to select text inside of images is behind an internal feature flag that can be toggled at runtime. When Live Text is disabled, we'll unconditionally show the "Look Up" context menu action using the more generic title "Quick Look". This "Quick Look" action is then retitled to either "Look Up in Quick Look" or "Select Text in Quick Look" once image analysis completes. * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): Rename ContextMenuItemTagLookUpImage to ContextMenuItemTagQuickLookImage. * UIProcess/Cocoa/QuickLookPreviewActivity.h: Copied from Source/WebKit/UIProcess/mac/WKQuickLookPreviewController.h. Move this enum out of WKQuickLookPreviewController.h, such that we can use and import it in non-Cocoa headers and implementation files. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::computeHasImageAnalysisResults): Rename `computeHasVisualSearchResults` to `computeHasImageAnalysisResults`, and allow it to take a flag to indicate whether or not it should request text recognition results or visual search results. We use this for the "Quick Look" context menu action when inline text selection is disabled, in order to retitle the item to "Select Text in Quick Look". (WebKit::WebViewImpl::computeHasVisualSearchResults): Deleted. * UIProcess/PageClient.h: (WebKit::PageClient::computeHasImageAnalysisResults): (WebKit::PageClient::computeHasVisualSearchResults): Deleted. * UIProcess/WebContextMenuProxy.h: (WebKit::WebContextMenuProxy::quickLookPreviewActivity const): Add a flag to WebContextMenuProxy to determine what initial activity to use when presenting the QuickLook preview panel after selecting the ContextMenuItemTagQuickLookImage item. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::contextMenuItemSelected): (WebKit::WebPageProxy::computeHasImageAnalysisResults): (WebKit::WebPageProxy::computeHasVisualSearchResults): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::computeHasImageAnalysisResults): (WebKit::PageClientImpl::computeHasVisualSearchResults): Deleted. * UIProcess/mac/WKQuickLookPreviewController.h: * UIProcess/mac/WKQuickLookPreviewController.mm: * UIProcess/mac/WebContextMenuProxyMac.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): (WebKit::WebContextMenuProxyMac::getContextMenuFromItems): Add logic to either remove and reinsert the "Look Up" context menu action (if inline text selection in images is enabled), or to promote the "Quick Look" context menu action to either "Select Text in Quick Look" or "Look Up in Quick Look" in the case where inline text selection in images is disabled. Note that when inline text selection in images is disabled, we'll first check for visual search results before checking for text. This is because visual search results will take precedence over text selection (i.e., we'll show "Look Up in Quick Look" even if both visual search results and text is present), so we can avoid performing text analysis in the case where we already found visual search results. (WebKit::WebContextMenuProxyMac::insertOrUpdateQuickLookImageItem): (WebKit::WebContextMenuProxyMac::updateQuickLookContextMenuItemTitle): Add a helper method to find and update the title of the NSMenuItem corresponding to ContextMenuItemTagQuickLookImage. See `getContextMenuFromItems` above for more details. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::handleContextMenuQuickLookImage): (WebKit::WebPageProxy::handleContextMenuLookUpImage): Deleted. Rename this to `handleContextMenuQuickLookImage`, and have it take an argument to indicate whether the QuickLook panel should start out in Visual Look Up mode. * WebKit.xcodeproj/project.pbxproj: 2021-06-22 Chris Dumez [macOS] Suspend WebProcesses that are in the process cache https://bugs.webkit.org/show_bug.cgi?id=227269 Reviewed by Geoffrey Garen. Suspend WebProcesses that are in the process cache on macOS to make sure they use no CPU. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::setIsInProcessCache): (WebKit::WebProcessProxy::platformSuspendProcess): (WebKit::WebProcessProxy::platformResumeProcess): * UIProcess/WebProcessProxy.h: * UIProcess/mac/WebProcessProxyMac.mm: (WebKit::WebProcessProxy::platformSuspendProcess): (WebKit::WebProcessProxy::platformResumeProcess): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setIsInProcessCache): * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2021-06-22 Jer Noble Further unreviewed build fix after r279133: remove even more things. * UIProcess/WebPageProxy.cpp: 2021-06-22 Jer Noble Unreviewed build fix after r279133: remove unnecessary includes and defines after upstreaming. * UIProcess/WebPageProxy.cpp: 2021-06-22 Per Arne Vollan [macOS] Deny mach-lookup to the service 'com.apple.print.normalizerd' https://bugs.webkit.org/show_bug.cgi?id=227248 Reviewed by Brent Fulgham. Deny mach-lookup to the service 'com.apple.print.normalizerd' in the WebKit processes on macOS. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: * UIProcess/WebPageProxy.cpp: (WebKit::gpuMachServices): * WebProcess/com.apple.WebProcess.sb.in: 2021-06-22 Fujii Hironori [GLib] Rewrite NetworkCache::Data::adoptMap without FileSystem::MappedFileData::leakHandle and munmap https://bugs.webkit.org/show_bug.cgi?id=227017 Reviewed by Carlos Garcia Campos. FileSystem::MappedFileData class wraps file mapping APIs like mmap and munmap in cross-platform manner. NetworkCache::Data::adoptMap shouldn't use FileSystem::MappedFileData::leakHandle and munmap. * NetworkProcess/cache/NetworkCacheDataGLib.cpp: (WebKit::NetworkCache::MapWrapper::~MapWrapper): (WebKit::NetworkCache::Data::adoptMap): 2021-06-07 Jer Noble [Cocoa] Upstream GroupActivitiesCoordinator https://bugs.webkit.org/show_bug.cgi?id=226757 Reviewed by Eric Carlson. Upstream the backing objects for a GroupActivities-based MediaSessionCoordinator. * SourcesCocoa.txt: * UIProcess/Cocoa/GroupActivities/GroupActivitiesCoordinator.h: Added. * UIProcess/Cocoa/GroupActivities/GroupActivitiesCoordinator.mm: Added. (-[WKGroupActivitiesCoordinatorDelegate initWithParent:]): (-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssuePlayCommand:completionHandler:]): (-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssuePauseCommand:completionHandler:]): (-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssueSeekCommand:completionHandler:]): (-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssueBufferingCommand:completionHandler:]): (-[WKGroupActivitiesCoordinatorDelegate playbackCoordinator:didIssuePrepareTransitionCommand:]): (WebKit::GroupActivitiesCoordinator::create): (WebKit::GroupActivitiesCoordinator::GroupActivitiesCoordinator): (WebKit::GroupActivitiesCoordinator::~GroupActivitiesCoordinator): (WebKit::GroupActivitiesCoordinator::sessionStateChanged): (WebKit::GroupActivitiesCoordinator::identifier const): (WebKit::GroupActivitiesCoordinator::join): (WebKit::GroupActivitiesCoordinator::leave): (WebKit::GroupActivitiesCoordinator::seekTo): (WebKit::GroupActivitiesCoordinator::play): (WebKit::GroupActivitiesCoordinator::pause): (WebKit::GroupActivitiesCoordinator::setTrack): (WebKit::GroupActivitiesCoordinator::positionStateChanged): (WebKit::GroupActivitiesCoordinator::readyStateChanged): (WebKit::GroupActivitiesCoordinator::playbackStateChanged): (WebKit::GroupActivitiesCoordinator::trackIdentifierChanged): (WebKit::GroupActivitiesCoordinator::issuePlayCommand): (WebKit::GroupActivitiesCoordinator::issuePauseCommand): (WebKit::GroupActivitiesCoordinator::issueSeekCommand): (WebKit::GroupActivitiesCoordinator::issueBufferingCommand): (WebKit::GroupActivitiesCoordinator::issuePrepareTransitionCommand): * UIProcess/Cocoa/GroupActivities/GroupActivitiesSession.h: Added. (WebKit::GroupActivitiesSession::groupSession): * UIProcess/Cocoa/GroupActivities/GroupActivitiesSession.mm: Added. (WebKit::GroupActivitiesSession::create): (WebKit::GroupActivitiesSession::GroupActivitiesSession): (WebKit::GroupActivitiesSession::~GroupActivitiesSession): (WebKit::GroupActivitiesSession::join): (WebKit::GroupActivitiesSession::leave): (WebKit::GroupActivitiesSession::state const): (WebKit::GroupActivitiesSession::uuid const): (WebKit::GroupActivitiesSession::fallbackURL const): (WebKit::GroupActivitiesSession::addStateChangeObserver): (WebKit::GroupActivitiesSession::addFallbackURLObserver): * UIProcess/Cocoa/GroupActivities/GroupActivitiesSessionNotifier.h: Added. * UIProcess/Cocoa/GroupActivities/GroupActivitiesSessionNotifier.mm: Added. (WebKitSwiftLibrary): (WebKit::GroupActivitiesSessionNotifier::sharedNotifier): (WebKit::GroupActivitiesSessionNotifier::GroupActivitiesSessionNotifier): (WebKit::GroupActivitiesSessionNotifier::sessionStateChanged): (WebKit::GroupActivitiesSessionNotifier::addWebPage): (WebKit::GroupActivitiesSessionNotifier::removeWebPage): (WebKit::GroupActivitiesSessionNotifier::webPageURLChanged): (WebKit::GroupActivitiesSessionNotifier::hasSessionForURL): (WebKit::GroupActivitiesSessionNotifier::takeSessionForURL): * UIProcess/Cocoa/GroupActivities/WKGroupSession.h: Added. * UIProcess/Cocoa/GroupActivities/WKGroupSession.swift: Added. (WKURLActivityWrapper.urlActivity): (WKURLActivityWrapper.fallbackURL): (WKGroupSessionWrapper.groupSession): (WKGroupSessionWrapper.cancellables): (WKGroupSessionWrapper.activity): (WKGroupSessionWrapper.uuid): (WKGroupSessionWrapper.wrapperSessionState(_:)): (WKGroupSessionWrapper.state): (WKGroupSessionWrapper.newActivityCallback): (WKGroupSessionWrapper.stateChangedCallback): (WKGroupSessionWrapper.join): (WKGroupSessionWrapper.leave): (WKGroupSessionWrapper.coordinate(_:)): (WKGroupSessionWrapper.activityChanged(_:)): (WKGroupSessionWrapper.stateChanged(_:)): (WKGroupSessionObserver.newSessionCallback): (WKGroupSessionObserver.cancellables): (WKGroupSessionObserver.recievedSession(_:)): * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h: * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::~WebPageProxy): (WebKit::WebPageProxy::didCommitLoadForFrame): * WebKit.xcodeproj/project.pbxproj: 2021-06-22 Peng Liu ASSERTION FAILED: videoFullscreenManager->client() == nullptr in WKFullScreenWindowController.mm https://bugs.webkit.org/show_bug.cgi?id=227243 Reviewed by Eric Carlson. `-[WKFullScreenWindowController windowDidExitFullScreen:]` needs to clear its client like `-[WKFullScreenWindowController didExitPictureInPicture]` does. * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController windowDidExitFullScreen:]): 2021-06-22 Truitt Savell Unreviewed, reverting r279083. Broke Mac Builds Reverted changeset: "Migrate App Privacy Report code from WebKitAdditions" https://bugs.webkit.org/show_bug.cgi?id=227045 https://commits.webkit.org/r279083 2021-06-22 Kimmo Kinnunen Functions dispatched to WorkQueue are sometimes destroyed in the calling thread due to block refcounting https://bugs.webkit.org/show_bug.cgi?id=227160 Reviewed by Antti Koivisto. As an example, remove one workaround mutability of dispatched function and nullptr assignment that was needed for working around WorkQueue::dispatch bug where the dispatched function was not always destroyed in the queue. * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: (WebKit::MediaTrackReader::finalize): 2021-06-22 Myles C. Maxfield [Cocoa] Force a copy of font data when receiving it from the untrusted web process https://bugs.webkit.org/show_bug.cgi?id=227247 Reviewed by Maciej Stachowiak. Sending a SharedBuffer across IPC is implemented by having the receiver map a shmem into its address space. On the sender's side, the shmem still exists, and a compromised web process could scribble data into it after sending it. So, when the GPU process receives the font data, we need to make a copy of it locally to make sure the data can't change out from under us. No new tests because there is no behavior change. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder>::decodePlatformData): 2021-06-21 Said Abou-Hallawa [GPU Process] RELEASE_ASSERT in RemoteResourceCacheProxy::didFinalizeRenderingUpdate() may fire if GPUP is relaunched https://bugs.webkit.org/show_bug.cgi?id=227229 Reviewed by Myles C. Maxfield. 1) Remove maximumUnusedFontCountToSkipRemoval because 'unusedFontCount < maximumUnusedFontCountToSkipRemoval' can't be true since both unusedFontCount and maximumUnusedFontCountToSkipRemoval are unsigned and maximumUnusedFontCountToSkipRemoval is equal to zero. So they can only be equal and we can replace this by '!unusedFontCount'. 2) RemoteResourceCacheProxy::cacheFont() assumes if the font is cached in m_fontIdentifierToLastRenderingUpdateVersionMap then it is also cached in GPUP. We have to keep this assumption correct by removing the corresponding entries from m_fontIdentifierToLastRenderingUpdateVersionMap. 3) RemoteResourceCacheProxy::didFinalizeRenderingUpdate() needs to reset m_numberOfFontsUsedInCurrentRenderingUpdate and to increment m_currentRenderingUpdateVersion in all its code branches. 4) If the GPUP is relaunched, we need to set m_numberOfFontsUsedInCurrentRenderingUpdate to zero after we clear m_fontIdentifierToLastRenderingUpdateVersionMap. Otherwise the RELEASE_ASSERT in RemoteResourceCacheProxy::didFinalizeRenderingUpdate() will fire. * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::prepareForNextRenderingUpdate): (WebKit::RemoteResourceCacheProxy::clearFontMap): (WebKit::RemoteResourceCacheProxy::didFinalizeRenderingUpdate): (WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed): (WebKit::RemoteResourceCacheProxy::releaseMemory): * WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: 2021-06-21 Wenson Hsieh [macOS] [WebKitLegacy] Non-actionable "Look Up" action appears when right clicking images https://bugs.webkit.org/show_bug.cgi?id=227240 Reviewed by Devin Rousso. Override the new client hook and return true. * WebProcess/WebCoreSupport/WebContextMenuClient.h: 2021-06-21 Don Olmstead Non-unified build fixes late June 2021 edition https://bugs.webkit.org/show_bug.cgi?id=227241 Unreviewed non-unified build fixes. * GPUProcess/GPUProcess.cpp: * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: * WebProcess/GPU/media/WebMediaStrategy.cpp: (WebKit::WebMediaStrategy::createNowPlayingManager const): 2021-06-21 Don Olmstead Update signature of createVideoLayerRemote for PlayStation and GStreamer https://bugs.webkit.org/show_bug.cgi?id=227242 Reviewed by Eric Carlson. Followup on r278740 which changed the signature of createVideoLayerRemote. Updating the PlayStation and GStreamer accordingly. * WebProcess/GPU/media/gstreamer/VideoLayerRemoteGStreamer.cpp: (WebKit::createVideoLayerRemote): * WebProcess/GPU/media/playstation/VideoLayerRemotePlayStation.cpp: (WebKit::createVideoLayerRemote): 2021-06-21 Chris Dumez Update TBA macros for iOS 15 / macOS 13 https://bugs.webkit.org/show_bug.cgi?id=227228 Reviewed by Alex Christensen. * Configurations/WebKit.xcconfig: * Shared/API/Cocoa/_WKFrameHandle.h: * Shared/API/Cocoa/_WKRemoteObjectInterface.h: * UIProcess/API/Cocoa/WKContentRuleListPrivate.h: * UIProcess/API/Cocoa/WKDownload.h: * UIProcess/API/Cocoa/WKDownloadDelegate.h: * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h: * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h: * UIProcess/API/Cocoa/WKNavigationAction.h: * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: * UIProcess/API/Cocoa/WKNavigationDelegate.h: * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: * UIProcess/API/Cocoa/WKPreferences.h: * UIProcess/API/Cocoa/WKPreferencesPrivate.h: * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/WKUIDelegate.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebViewConfiguration.h: * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKAppHighlight.h: * UIProcess/API/Cocoa/_WKAppHighlightDelegate.h: * UIProcess/API/Cocoa/_WKApplicationManifest.h: * UIProcess/API/Cocoa/_WKAuthenticationExtensionsClientInputs.h: * UIProcess/API/Cocoa/_WKAuthenticationExtensionsClientOutputs.h: * UIProcess/API/Cocoa/_WKAuthenticatorAssertionResponse.h: * UIProcess/API/Cocoa/_WKAuthenticatorAttachment.h: * UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponse.h: * UIProcess/API/Cocoa/_WKAuthenticatorResponse.h: * UIProcess/API/Cocoa/_WKAuthenticatorSelectionCriteria.h: * UIProcess/API/Cocoa/_WKAutomationDelegate.h: * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h: * UIProcess/API/Cocoa/_WKDownload.h: * UIProcess/API/Cocoa/_WKDownloadDelegate.h: * UIProcess/API/Cocoa/_WKElementAction.h: * UIProcess/API/Cocoa/_WKInspector.h: * UIProcess/API/Cocoa/_WKInspectorConfiguration.h: * UIProcess/API/Cocoa/_WKInspectorExtension.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKPublicKeyCredentialCreationOptions.h: * UIProcess/API/Cocoa/_WKPublicKeyCredentialDescriptor.h: * UIProcess/API/Cocoa/_WKPublicKeyCredentialEntity.h: * UIProcess/API/Cocoa/_WKPublicKeyCredentialParameters.h: * UIProcess/API/Cocoa/_WKPublicKeyCredentialRelyingPartyEntity.h: * UIProcess/API/Cocoa/_WKPublicKeyCredentialRequestOptions.h: * UIProcess/API/Cocoa/_WKPublicKeyCredentialUserEntity.h: * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h: * UIProcess/API/Cocoa/_WKTextManipulationToken.h: * UIProcess/API/Cocoa/_WKUserVerificationRequirement.h: * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanelForTesting.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h: * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h: 2021-06-21 Myles C. Maxfield Fix Apple internal build Rubber-stamped by Megan Gardner. * UIProcess/WebPageProxy.cpp: 2021-06-21 Fujii Hironori [WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on https://bugs.webkit.org/show_bug.cgi?id=227011 Reviewed by Don Olmstead. * NetworkProcess/cache/NetworkCacheDataCurl.cpp: (WebKit::NetworkCache::Data::tryCreateSharedMemory const): Added. 2021-06-21 Kate Cheney Migrate App Privacy Report code from WebKitAdditions https://bugs.webkit.org/show_bug.cgi?id=227045 Reviewed by Alex Christensen. No new tests, covered by existing tests. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (contextString): Deleted. This patch deletes the contextString function because it is no longer needed now that CFNetwork sets the attribution context, and it seemed silly to migrate code from WebKitAdditions just to delete it immediately. This also moves the processPCMRequest function declaration from WebKitAdditions so we can remove NETWORK_DATA_TASK_COCOA_ADDITIONS. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::isActingOnBehalfOfAFullWebBrowser): (WebKit::NetworkSessionCocoa::removeNetworkWebsiteData): * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::setLastNavigationWasAppBound): 2021-06-21 Chris Dumez [WK2] Don't process-swap on navigations within the same non-HTTP(s) protocol https://bugs.webkit.org/show_bug.cgi?id=227220 Reviewed by Tim Horton. Don't process-swap on navigations within the same non-HTTP(s) protocol. Trying to extract registrable domains from non-HTTP(s) URLs does not make much sense and leads to unexpected process swaps. * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration setProcessSwapsOnNavigationWithinSameNonHTTPFamilyProtocol:]): (-[_WKProcessPoolConfiguration processSwapsOnNavigationWithinSameNonHTTPFamilyProtocol]): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame): 2021-06-21 Megan Gardner AppHighlights disappear on page reload https://bugs.webkit.org/show_bug.cgi?id=227141 rdar://78190331 Reviewed by Devin Rousso. When a page is reloaded, a new set of highlights is loaded, but the state of visibility of the highlights is not preserved. We need to preserve the state of highlights so they are correctly shown on reload. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::appHighlightsVisiblility const): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_appHighlightsVisible): (WebKit::WebPage::setAppHighlightsVisibility): (WebKit::m_lastNavigationWasAppBound): Deleted. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::appHighlightsVisiblility const): 2021-06-21 Alex Christensen Break ref cycle between API::HTTPCookieStore and WebKit::WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=226992 Reviewed by Chris Dumez. Covered by an API test. * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::HTTPCookieStore): (API::HTTPCookieStore::filterAppBoundCookies): (API::HTTPCookieStore::cookies): (API::HTTPCookieStore::cookiesForURL): (API::HTTPCookieStore::setCookies): (API::HTTPCookieStore::deleteCookie): (API::HTTPCookieStore::deleteAllCookies): (API::HTTPCookieStore::setHTTPCookieAcceptPolicy): (API::HTTPCookieStore::flushCookies): (API::HTTPCookieStore::registerObserver): (API::HTTPCookieStore::unregisterObserver): * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::complete): 2021-06-21 James Savage Upstream async support to Swift overlay. https://bugs.webkit.org/show_bug.cgi?id=227006. Reviewed by Alex Christensen. * SwiftOverlay/Tests/JavaScriptToSwiftTypeConversions.swift: (JavaScriptToSwiftConversions.testUsingSwiftAsync): Adds a simple test for the Swift async interface. * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Removed use of WebKitAdditions, which is needed both to prevent redefinition errors and because they are no longer necessary. * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift: (WKWebView.callAsyncJavaScript(_:arguments:in:contentWorld:)): (WKWebView.pdf(_:)): (WKWebView.evaluateJavaScript(_:in:contentWorld:)): (WKWebView.find(_:configuration:)): 2021-06-21 Alex Christensen Add log when creating NSURLSession that will not accept cookies https://bugs.webkit.org/show_bug.cgi?id=226511 Reviewed by Chris Dumez. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::initializeStandardSessionsInSet): 2021-06-21 Alex Christensen REGRESSION (r275496): WebSocket Message too long when message is larger than 1mb https://bugs.webkit.org/show_bug.cgi?id=227030 Reviewed by Youenn Fablet. NSURLSession's WebSocket implementation currently has maximumMessageSize's default value at 1MB. Our CFReadStream-based WebSocket implementation had no message size limitation, so set it to 0 to remove the limit. Writing a test for this was tricky because our WebSocket LayoutTests use the deflate extension. I wrote an API test that implements a simple WebSocket exchange and verifies each byte is what we expect. The test used to fail using our NSURLSession-based WebSocket implementation but now passes everywhere. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::createWebSocketTask): Set maximumMessageSize to 0, which, as documented in ws_options.h but unfortunately not yet in NSURLSession.h: "means there is no receive limit." This matches our behavior with the CFReadStream-based WebSocket implementation. 2021-06-20 Wenson Hsieh [macOS] Rename WKVisualSearchPreviewController to WKQuickLookPreviewController https://bugs.webkit.org/show_bug.cgi?id=227193 Reviewed by Sam Weinig. Rename WKVisualSearchPreviewController to WKQuickLookPreviewController, with the intention of using this logic to implement a new context menu action for opening images in a QuickLook preview panel. See below for more details. * SourcesCocoa.txt: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::handleContextMenuLookUpImage): Deleted. Move this into WebPageProxyMac.mm, since this is (1) only relevant to macOS, and (2) this logic now requires WKQuickLookPreviewController.h, which WebPageProxyMac.mm already imports. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::acceptsPreviewPanelControl): * UIProcess/WebPageProxy.h: * UIProcess/mac/WKQuickLookPreviewController.h: Renamed from Source/WebKit/UIProcess/mac/WKVisualSearchPreviewController.h. * UIProcess/mac/WKQuickLookPreviewController.mm: Renamed from Source/WebKit/UIProcess/mac/WKVisualSearchPreviewController.mm. (-[WKQuickLookPreviewController initWithPage:imageData:title:imageURL:activity:]): Add QuickLookPreviewActivity, a flag to indicate whether or not WKQuickLookPreviewController should start with QLPreviewActivityVisualSearch or QLPreviewActivityNone. For the time being, we only use this helper object for visual search, so we only pass in QuickLookPreviewActivity::VisualSearch. (-[WKQuickLookPreviewController beginControl:]): (-[WKQuickLookPreviewController endControl:]): (-[WKQuickLookPreviewController closePanelIfNecessary]): (-[WKQuickLookPreviewController isControlling:]): (-[WKQuickLookPreviewController provideDataForItem:]): (-[WKQuickLookPreviewController numberOfPreviewItemsInPreviewPanel:]): (-[WKQuickLookPreviewController previewPanel:previewItemAtIndex:]): (-[WKQuickLookPreviewController previewPanel:initialActivityForItem:]): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::beginPreviewPanelControl): (WebKit::WebPageProxy::endPreviewPanelControl): (WebKit::WebPageProxy::closeSharedPreviewPanelIfNecessary): (WebKit::WebPageProxy::handleContextMenuLookUpImage): (WebKit::WebPageProxy::showImageInQuickLookPreviewPanel): (WebKit::WebPageProxy::showImageInVisualSearchPreviewPanel): Deleted. * WebKit.xcodeproj/project.pbxproj: 2021-06-20 Wenson Hsieh [Live Text] Mouse events should only trigger text recognition if the cursor is moving https://bugs.webkit.org/show_bug.cgi?id=227181 rdar://79469827 Reviewed by Tim Horton. Populate the `deltaX` and `deltaY` members of the platform mouse event on iOS, when using a trackpad. This allows the adjusted logic in EventHandler to apply to iPadOS when using a trackpad as well (see WebCore ChangeLog for more information). * Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent): * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer createMouseEventWithType:wasCancelled:]): 2021-06-18 Brent Fulgham Clear state after process crash so that we know to re-issue sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=227103 Reviewed by Tim Horton. Follow-up patch that corrects a problem when switching between processes (for example, when a provisional load moves to a committed load.) The parameters for the new process would fail to pass the necessary sandbox extensions for the element if they had been vended to the provisional load. Instead, we should be checking if the new process has been given the necessary extensions. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): Use the new process, not the process state we are copying from when deciding whether we need to extend sandbox powers to the new process. 2021-06-18 Peng Liu [iOS] Fullscreen video playback gets stuck after interacting with the playback controls https://bugs.webkit.org/show_bug.cgi?id=227047 Reviewed by Eric Carlson. When we scrub a playing video, the video element may enter a temporarily stalled state - the player is still playing, but it does not have enough data. In WebKit, the `rate` of the player will be 0. But we cannot set the rate of `WebAVPlayerController` to 0 in this case, because AVKit will believe the video playback is paused when its rate is 0. In r261587, we defined a magic rate (0.00000001f) for this case. Unfortunately, with the changes in r275956, `WebAVPlayerController` will align its `defaultPlaybackRate` with `rate` when `rate` is not 0. Under stress tests, e.g., keep scrubbing a video, a video element will eventually enter a state in which both `defaultPlaybackRate` and `rate` are the magic rate. And the video appears to be stuck for users. To fix the issue, this patch removes the magic rate and defines a new state: `stalled`. A video will be in the stalled state when it is playing but does not have enough data. WebKit will only change the rate of `WebAVPlayerController` when the video is not stalled. To avoid potential problems due to the conversions between "float" and "double" back and forth, this patch updates the types of `playbackRate` and `defaultPlaybackRate`. * Scripts/webkit/messages.py: (headers_for_type): * UIProcess/Cocoa/PlaybackSessionManagerProxy.h: * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in: * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: (WebKit::PlaybackSessionModelContext::setDefaultPlaybackRate): (WebKit::PlaybackSessionModelContext::setPlaybackRate): (WebKit::PlaybackSessionModelContext::rateChanged): (WebKit::PlaybackSessionManagerProxy::rateChanged): (WebKit::PlaybackSessionManagerProxy::setDefaultPlaybackRate): (WebKit::PlaybackSessionManagerProxy::setPlaybackRate): * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: * WebProcess/cocoa/PlaybackSessionManager.h: * WebProcess/cocoa/PlaybackSessionManager.mm: (WebKit::PlaybackSessionInterfaceContext::rateChanged): (WebKit::PlaybackSessionManager::rateChanged): 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-18 Carlos Garcia Campos [SOUP] Add Timing-Allow-Origin checks to NetworkDataTaskSoup https://bugs.webkit.org/show_bug.cgi?id=227008 Reviewed by Adrian Perez de Castro. Add missing TAO checks to Soup backend. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): (WebKit::NetworkDataTaskSoup::didSendRequest): (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): * NetworkProcess/soup/NetworkDataTaskSoup.h: 2021-06-17 Said Abou-Hallawa [Cocoa] Disable hardware decoding in the WebProcess https://bugs.webkit.org/show_bug.cgi?id=226869 Reviewed by Per Arne Vollan and Simon Fraser. Restrict video decoders and disable hardware image decoders. A temp extension is created for the service "com.apple.trustd.agent" to allow temporarily calling FigPhotoSupportsHEVCHWDecode(). This function needs access this service but we have recently closed access to it. FigPhotoSupportsHEVCHWDecode() sets a local static variable by using the service "com.apple.trustd.agent" when it is called for the first time. Our purpose of calling it in this context is to initialize the static variable only. And this is why we do not use its return value. This solution is fragile. If MediaToolbox is changed such that it needs 'com.apple.trustd.agent' while decoding an image, the decoding will fail. * 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): (WebKit::restrictImageAndVideoDecoders): (WebKit::WebProcess::initializeSandbox): 2021-06-17 Chris Dumez Enable some more release logging in for ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=227142 Reviewed by Eric Carlson. Enable some more release logging in for ephemeral sessions, to faciliate debugging. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::isAlwaysOnLoggingAllowed const): Deleted. * GPUProcess/GPUConnectionToWebProcess.h: (WebKit::GPUConnectionToWebProcess::sessionID const): * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::logger): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const): (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const): (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList): (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore): (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic): (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics): (WebKit::ResourceLoadStatisticsDatabaseStore::incrementRecordsDeletedCountForDomains): (WebKit::ResourceLoadStatisticsDatabaseStore::recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::markAsPrevalentIfHasRedirectedToPrevalent): (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains): (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode): (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation): (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration): (WebKit::ResourceLoadStatisticsDatabaseStore::clearTopFrameUniqueRedirectsToSinceSameSiteStrictEnforcement): (WebKit::ResourceLoadStatisticsDatabaseStore::setUserInteraction): (WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction): (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction): (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction): (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource): (WebKit::ResourceLoadStatisticsDatabaseStore::setDomainsAsPrevalent): (WebKit::ResourceLoadStatisticsDatabaseStore::predicateValueForDomain const): (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource): (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered): (WebKit::ResourceLoadStatisticsDatabaseStore::setIsScheduledForAllButCookieDataRemoval): (WebKit::ResourceLoadStatisticsDatabaseStore::getMostRecentlyUpdatedTimestamp const): (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo): (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom): (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo): (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom): (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::removeDataForDomain): (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess): (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt): (WebKit::ResourceLoadStatisticsDatabaseStore::clearGrandfathering): (WebKit::ResourceLoadStatisticsDatabaseStore::pruneStatisticsIfNeeded): (WebKit::ResourceLoadStatisticsDatabaseStore::updateLastSeen): (WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen): (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource): (WebKit::ResourceLoadStatisticsDatabaseStore::updateDataRecordsRemoved): (WebKit::ResourceLoadStatisticsDatabaseStore::isCorrectSubStatisticsCount): (WebKit::ResourceLoadStatisticsDatabaseStore::getDomainStringFromDomainID const): (WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const): (WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): (WebKit::ResourceLoadStatisticsDatabaseStore::domainIDExistsInDatabase): (WebKit::ResourceLoadStatisticsDatabaseStore::updateOperatingDatesParameters): (WebKit::ResourceLoadStatisticsDatabaseStore::includeTodayAsOperatingDateIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting): (WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): (WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed): (WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredPrivateClickMeasurement): (WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): (WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution): (WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::getNetworkProcessConnection): * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp: (WebKit::WebURLSchemeTaskProxy::startLoading): (WebKit::WebURLSchemeTaskProxy::stopLoading): (WebKit::WebURLSchemeTaskProxy::didPerformRedirection): (WebKit::WebURLSchemeTaskProxy::didReceiveResponse): (WebKit::WebURLSchemeTaskProxy::didReceiveData): (WebKit::WebURLSchemeTaskProxy::didComplete): 2021-06-17 Brent Fulgham Clear state after process crash so that we know to re-issue sandbox extensions https://bugs.webkit.org/show_bug.cgi?id=227103 Reviewed by Per Arne Vollan. We dynamically extend access to certain mach services when the ATTACHMENT_ELEMENT feature is enabled. If a process with this feature activated crashes and WebKit relaunches it, we don't grant the new process the same extensions because we believe they were already previously sent. This patch clears the state after a process crash so that it properly handles the restart case. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shutDown): Clear state. (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): Clear state. 2021-06-17 Ben Nham Remove Mac-specific CPUTime functions https://bugs.webkit.org/show_bug.cgi?id=227109 Reviewed by Yusuke Suzuki. Permit calling thread_selfusage, since it is used by clock_gettime(CLOCK_THREAD_CPUTIME_ID, tp). * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2021-06-17 Chris Dumez Trying to take empty snapshots of the view should not cause crashes https://bugs.webkit.org/show_bug.cgi?id=227133 Reviewed by Tim Horton. Trying to take empty snapshots of the view should not cause crashes. We would previously see crashes because: 1. We would end up doing divisions by zero 2. We would hit the ASSERT(size) in SharedMemory::allocate(). * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): 2021-06-17 Kate Cheney Storage Access quirks should prompt up to twice if a user does not allow storage access https://bugs.webkit.org/show_bug.cgi?id=227099 Reviewed by John Wilander. We should allow storage access prompts twice per document for quirks just like for non-quirk cases. Previously we were only presenting the quirk prompt once per web content process if the user denied. This patch removes this code and utilizes maxNumberOfTimesExplicitlyDeniedStorageAccess instead. * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: (WebKit::WebResourceLoadObserver::hasDeniedCrossPageStorageAccess const): Deleted. (WebKit::WebResourceLoadObserver::setHasDeniedCrossPageStorageAccess): Deleted. * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: 2021-06-17 Tim Horton Adopt WKHoverGestureRecognizer https://bugs.webkit.org/show_bug.cgi?id=227116 Reviewed by Wenson Hsieh. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView _removeDefaultGestureRecognizers]): (-[WKContentView _addDefaultGestureRecognizers]): (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): (-[WKContentView gestureRecognizer:shouldReceivePress:]): (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView setUpHoverGestureRecognizer]): (-[WKContentView hoverGestureRecognizerChanged:]): Plumb mouse events from WKHoverGestureRecognizer to the page. 2021-06-17 Alex Christensen Fix crashes in ContentRuleListStore::lookupContentRuleList https://bugs.webkit.org/show_bug.cgi?id=227100 Reviewed by Chris Dumez. To be extra careful, instead of just assuming that moveFile will always succeed, when moveFile fails, try to delete the legacy path (which has a ContentExtension- instead of ContentRuleList- prefix) and fail the lookup. This will only happen in Safari, which was the only client of _WKUserContentExtensionStore. The legacy file is not useful to us because in r275078 I incremented CurrentContentRuleListFileVersion so the bytes on disk need to be recompiled anyways. Safari already has logic to recompile it. This was just an attempt to use what we have and not leave anything behind. Also, to be extra careful, try deleting a file before moving a file on top of it. * UIProcess/API/APIContentRuleListStore.cpp: compiledToFile: (API::ContentRuleListStore::lookupContentRuleList): 2021-06-17 Alex Christensen WKScriptMessageHandlerWithReply should raise an exception if replyHandler is called twice https://bugs.webkit.org/show_bug.cgi?id=226863 Reviewed by Chris Dumez. We currently dereference null inside CompletionHandlerWithFinalizer. This makes it more obvious what is going on. Related to rdar://78865409 but not solving it. * UIProcess/API/Cocoa/WKUserContentController.mm: 2021-06-17 Per Arne [macOS] Close open connections https://bugs.webkit.org/show_bug.cgi?id=227068 Reviewed by Brent Fulgham. On macOS, close open connections in initializeSandboxParameters. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::initializeSandboxParameters): 2021-06-16 Garrett Davidson Passkeys don't work in Simulator https://bugs.webkit.org/show_bug.cgi?id=227076 Reviewed by Brent Fulgham. Simulator does not support LAAccessControlOperationUseKeySign, so -evaluateAccessControl:... returns an error. However, this check isn't actually necessary in the simulator when using passkeys, so just skip it. Tested registration and assertion in an app in Simulator. * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::verifyUser): 2021-06-16 Said Abou-Hallawa takeSnapshotWithConfiguration() should wait for the next flush before it does callSnapshotRect() https://bugs.webkit.org/show_bug.cgi?id=226257 Reviewed by Simon Fraser and Tim Horton. This will ensure the latest IOSurfaces are pushed to backboardd before taking the snapshot. Also we need create an implicit transaction to ensure a commit will happen. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): 2021-06-16 Mark Lam Adopt com.apple.security.cs.jit-write-allowlist on internal builds. https://bugs.webkit.org/show_bug.cgi?id=222148 rdar://74284026 Reviewed by Per Arne Vollan. * Scripts/process-entitlements.sh: 2021-06-16 Wenson Hsieh [watchOS] Reenable modern text input UI for non-numeric text input types https://bugs.webkit.org/show_bug.cgi?id=226988 rdar://78102953 Reviewed by Tim Horton. Refactor text input logic on watchOS such that we're able to present the new ("modern") UI for scribble text input on watchOS 8, rather than legacy (in-process) scribble UI. Overall, this patch removes WKQuickboardListViewController altogether. This had two subclasses: WKSelectMenuListViewController (used for focused single and multiple select elements) and WKTextInputListViewController (used for text input types). WKSelectMenuListViewController now inherits directly from PUICQuickboardListViewController, and WKTextInputListViewController now inherits from PUICQuickboardMessageViewController; this inheritance from PUICQuickboardMessageViewController instead of PUICQuickboardListViewController allows the WKTextInputListViewController to show text suggestions using `-setMessages:` on PUICQuickboardMessageViewController, instead of relying on custom WebKit code to insert text suggestions. This means that we move the following pieces of functionality out of WKQuickboardListViewController, and into either WKSelectMenuListViewController or WKTextInputListViewController: 1. Support for inserting and updating context views (i.e. the domain name header view in Quickboard) => WKTextInputListViewController. 2. Logic for determining whether or not we should show language selection UI => WKTextInputListViewController. 3. Support for laying out custom collection view cells in Quickboard => WKSelectMenuListViewController. * Platform/spi/watchos/PepperUICoreSPI.h: * SourcesCocoa.txt: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView createQuickboardTextInputContext]): (-[WKContentView _createQuickboardController:]): Refactor logic to create a PUICTextInputContext from the current focused element information out into a separate helper method, `-createQuickboardTextInputContext`, and use it when both directly launching into PUICQuickboardController and WKTextInputListViewController. (canUseQuickboardControllerFor): Remove a comment, now that we intend to continue using WKTextInputListViewController for non-keychain-AutoFill- compatible text fields moving forward. (-[WKContentView focusedFormControllerDidUpdateSuggestions:]): (-[WKContentView allowsLanguageSelectionForListViewController:]): (-[WKContentView textInputContextForListViewController:]): (-[WKContentView textContentTypeForTesting]): (-[WKContentView viewController:inputContextViewHeightForSize:]): Deleted. Remove this delegate method, which was (effectively) unused since we just ask for `-inputContextViewForViewController:` from the input delegate anyways. (-[WKContentView allowsLanguageSelectionMenuForListViewController:]): Deleted. Rename this to `-allowsLanguageSelectionForListViewController:`. (-[WKContentView textContentTypeForListViewController:]): Deleted. Replace this with `-textInputContextForListViewController:`, which returns a whole PUICTextInputContext instead of just a text content type. (-[WKContentView textSuggestionsForListViewController:]): Deleted. (-[WKContentView listViewController:didSelectTextSuggestion:]): Deleted. Remove several delegate methods that are no longer needed. * UIProcess/ios/forms/WKDatePickerViewController.h: * UIProcess/ios/forms/WKDatePickerViewController.mm: (-[WKDatePickerViewController viewWillAppear:]): Remove some (defunct) logic for overriding the status bar when showing Quickboard input view controllers. This status bar mechanism (which was previously used to show label text for form controls) hasn't worked since watchOS 6, and we need to implement this in a way that doesn't use PUICStatusBarGlobalContextViewAssertion. * UIProcess/ios/forms/WKQuickboardListViewController.mm: Removed. * UIProcess/ios/forms/WKQuickboardViewControllerDelegate.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.h. * UIProcess/ios/forms/WKSelectMenuListViewController.h: * UIProcess/ios/forms/WKSelectMenuListViewController.mm: (-[WKSelectMenuItemCell topToLabelBaselineSpecValue]): (-[WKSelectMenuItemCell baselineToBottomSpecValue]): (-[WKSelectMenuCollectionViewItemCell topToLabelBaselineSpecValue]): (-[WKSelectMenuCollectionViewItemCell baselineToBottomSpecValue]): (-[WKSelectMenuListViewController initWithDelegate:]): See above comment for more details. * UIProcess/ios/forms/WKTextInputListViewController.h: * UIProcess/ios/forms/WKTextInputListViewController.mm: (-[WKTextInputListViewController initWithDelegate:]): (-[WKTextInputListViewController reloadContextView]): (-[WKTextInputListViewController updateContextViewIfNeeded]): Move logic for showing and updating the context view out of WKQuickboardListViewController, and into WKTextInputListViewController. See comments above. (-[WKTextInputListViewController requiresNumericInput]): (-[WKTextInputListViewController additionalTrayButtons]): (-[WKTextInputListViewController updateTextSuggestions:]): (-[WKTextInputListViewController headerContentViewHeight]): (-[WKTextInputListViewController headerContentView]): (-[WKTextInputListViewController shouldShowLanguageButton]): (-[WKTextInputListViewController supportsDictationInput]): (-[WKTextInputListViewController shouldShowTrayView]): (-[WKTextInputListViewController shouldShowTextField]): Override this and return YES for text input types that don't require an additional numeric input tray button. This allows PUICQuickboardMessageViewController to show a native text field containing the input text inside quickboard, which (when tapped) presents modern text input UI. Since showing the text field is apparently mutually exclusive to showing a tray view, we additionally override `-shouldShowTrayView` and return NO for non-numeric text inputs. (-[WKTextInputListViewController supportsArouetInput]): (-[WKTextInputListViewController viewDidLoad]): Deleted. (-[WKTextInputListViewController willPresentArouetViewController:]): Deleted. There's no need to override this delegate method anymore, since the PUICTextInputContext's `-initialText` is sufficient to ensure that the scribble text input UI is prepopulated with the focused text field's initial text content. (-[WKTextInputListViewController reloadTextSuggestions]): Deleted. Rename this to `-updateTextSuggestions:`, and make it take a list of UITextSuggestions. This makes the code a bit easier to follow and allows us to remove the `-textSuggestionsForListViewController:` delegate method. (-[WKTextInputListViewController didSelectListItemAtIndexPath:]): Deleted. (-[WKTextInputListViewController didSelectListItem:]): Deleted. (-[WKTextInputListViewController _didSelectListItem:]): Deleted. (-[WKTextInputListViewController numberOfListItems]): Deleted. (-[WKTextInputListViewController heightForListItem:width:]): Deleted. (-[WKTextInputListViewController cellForListItem:]): Deleted. (-[WKTextInputListViewController listItemCellReuseIdentifier]): Deleted. (-[WKTextInputListViewController listItemCellClass]): Deleted. (-[WKTextInputListViewController itemCellForListItem:forIndexPath:]): Deleted. Remove all this code for showing text suggestions in Quickboard UI. Since WKTextInputListViewController is now a subclass of PUICQuickboardMessageViewController, we can now simply use the `-messages` property of to populate quickboard with text suggestions. * UIProcess/ios/forms/WKTimePickerViewController.h: * WebKit.xcodeproj/project.pbxproj: 2021-06-16 Chris Dumez Enable release logging in the network process for ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=227087 Reviewed by Geoffrey Garen. Enable release logging in the network process for ephemeral sessions, to facilitate debugging. No domains or other sensitive information is logged by WebKit. * NetworkProcess/Downloads/Download.cpp: (WebKit::Download::cancel): (WebKit::Download::didReceiveData): (WebKit::Download::didFinish): (WebKit::Download::didFail): * NetworkProcess/Downloads/Download.h: * NetworkProcess/Downloads/DownloadMonitor.cpp: (WebKit::DownloadMonitor::applicationWillEnterForeground): (WebKit::DownloadMonitor::applicationDidEnterBackground): (WebKit::DownloadMonitor::timerFired): * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::startPreflight): (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection): (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge): (WebKit::NetworkCORSPreflightChecker::didReceiveResponse): (WebKit::NetworkCORSPreflightChecker::didReceiveData): (WebKit::NetworkCORSPreflightChecker::didCompleteWithError): (WebKit::NetworkCORSPreflightChecker::wasBlocked): (WebKit::NetworkCORSPreflightChecker::cannotShowURL): (WebKit::NetworkCORSPreflightChecker::wasBlockedByRestrictions): * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::hasUploadStateChanged): (WebKit::NetworkConnectionToWebProcess::didClose): (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences): (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad): (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad): (WebKit::NetworkConnectionToWebProcess::loadPing): (WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier): (WebKit::NetworkConnectionToWebProcess::preconnectTo): (WebKit::NetworkConnectionToWebProcess::serverToContextConnectionNoLongerNeeded): * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::continueCheckingRequest): (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::start): (WebKit::NetworkResourceLoader::retrieveCacheEntry): (WebKit::NetworkResourceLoader::retrieveCacheEntryInternal): (WebKit::NetworkResourceLoader::startNetworkLoad): (WebKit::NetworkResourceLoader::cleanup): (WebKit::NetworkResourceLoader::convertToDownload): (WebKit::NetworkResourceLoader::abort): (WebKit::NetworkResourceLoader::didReceiveResponse): (WebKit::NetworkResourceLoader::didReceiveBuffer): (WebKit::NetworkResourceLoader::didFinishLoading): (WebKit::NetworkResourceLoader::didFailLoading): (WebKit::NetworkResourceLoader::didBlockAuthenticationChallenge): (WebKit::NetworkResourceLoader::willSendRedirectedRequest): (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse): (WebKit::NetworkResourceLoader::restartNetworkLoad): (WebKit::NetworkResourceLoader::continueWillSendRequest): (WebKit::NetworkResourceLoader::continueDidReceiveResponse): (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry): (WebKit::NetworkResourceLoader::didReceiveMainResourceResponse): (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): (WebKit::NetworkResourceLoader::sendResultForCacheEntry): (WebKit::NetworkResourceLoader::validateCacheEntry): (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry): (WebKit::NetworkResourceLoader::logSlowCacheRetrieveIfNeeded): (WebKit::NetworkResourceLoader::startWithServiceWorker): (WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::loadRequest): (WebKit::PingLoad::didReceiveChallenge): (WebKit::PingLoad::didReceiveResponse): (WebKit::PingLoad::didReceiveData): (WebKit::PingLoad::didCompleteWithError): (WebKit::PingLoad::wasBlocked): (WebKit::PingLoad::cannotShowURL): (WebKit::PingLoad::wasBlockedByRestrictions): (WebKit::PingLoad::timeoutTimerFired): * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask): (WebKit::ServiceWorkerFetchTask::~ServiceWorkerFetchTask): (WebKit::ServiceWorkerFetchTask::start): (WebKit::ServiceWorkerFetchTask::contextClosed): (WebKit::ServiceWorkerFetchTask::startFetch): (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse): (WebKit::ServiceWorkerFetchTask::didReceiveResponse): (WebKit::ServiceWorkerFetchTask::didFinish): (WebKit::ServiceWorkerFetchTask::didFail): (WebKit::ServiceWorkerFetchTask::didNotHandle): (WebKit::ServiceWorkerFetchTask::cannotHandle): (WebKit::ServiceWorkerFetchTask::cancelFromClient): (WebKit::ServiceWorkerFetchTask::continueDidReceiveFetchResponse): (WebKit::ServiceWorkerFetchTask::continueFetchTaskWith): (WebKit::ServiceWorkerFetchTask::timeoutTimerFired): (WebKit::ServiceWorkerFetchTask::softUpdateIfNeeded): * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::createFetchTask): (WebKit::WebSWServerConnection::startFetch): (WebKit::WebSWServerConnection::scheduleJobInServer): (WebKit::WebSWServerConnection::scheduleUnregisterJobInServer): * NetworkProcess/cache/CacheStorageEngineConnection.cpp: (WebKit::CacheStorageEngineConnection::open): (WebKit::CacheStorageEngineConnection::remove): (WebKit::CacheStorageEngineConnection::caches): (WebKit::CacheStorageEngineConnection::retrieveRecords): (WebKit::CacheStorageEngineConnection::deleteMatchingRecords): (WebKit::CacheStorageEngineConnection::putRecords): (WebKit::CacheStorageEngineConnection::reference): (WebKit::CacheStorageEngineConnection::dereference): * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: (WebKit::registerMDNSNameCallback): (WebKit::NetworkMDNSRegister::registerMDNSName): * NetworkProcess/webrtc/NetworkRTCMonitor.cpp: (WebKit::NetworkRTCMonitor::startUpdatingIfNeeded): (WebKit::NetworkRTCMonitor::stopUpdating): (WebKit::NetworkRTCMonitor::onNetworksChanged): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): (WebKit::NetworkRTCProvider::close): (WebKit::NetworkRTCProvider::createSocket): * NetworkProcess/webrtc/NetworkRTCProvider.h: 2021-06-16 Brent Fulgham Sandbox profiles need to allow loading from /usr/appleinternal/lib on internal builds https://bugs.webkit.org/show_bug.cgi?id=227079 Reviewed by Per Arne Vollan. We allow the specific directory "/usr/appleinternal/lib/sanitizers", but we actually need access to "/usr/appleinternal/lib" in certain development environments. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * 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.in: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2021-06-16 Alex Christensen Clean up WebCookieManagerProxy https://bugs.webkit.org/show_bug.cgi?id=227074 Reviewed by Brady Eidson. Remove dead code. WKCookieManagerSetClient is deprecated and doesn't do anything, so we don't need a client here. Use smart pointers instead of raw pointers to be on the safe side. * Shared/API/APIObject.h: * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/APIInspectorExtension.cpp: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::NetworkProcessProxy): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebCookieManagerProxy.cpp: (WebKit::WebCookieManagerProxy::registerObserver): (WebKit::WebCookieManagerProxy::unregisterObserver): (WebKit::WebCookieManagerProxy::cookiesDidChange): (WebKit::WebCookieManagerProxy::initializeClient): Deleted. (WebKit::WebCookieManagerProxy::setCookieObserverCallback): Deleted. * UIProcess/WebCookieManagerProxy.h: (WebKit::WebCookieManagerProxy::create): Deleted. * UIProcess/WebCookieManagerProxy.messages.in: * UIProcess/WebCookieManagerProxyClient.cpp: Removed. * UIProcess/WebCookieManagerProxyClient.h: Removed. * UIProcess/mac/WebCookieManagerProxyMac.mm: Removed. * WebKit.xcodeproj/project.pbxproj: 2021-06-16 Alex Christensen Clean up API::HTTPCookieStore https://bugs.webkit.org/show_bug.cgi?id=227058 Reviewed by Anders Carlsson. This removes code that has been unused since r267763. I also use smart pointers instead of raw pointers just to be on the safe side. * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::~HTTPCookieStore): (API::HTTPCookieStore::registerObserver): (API::HTTPCookieStore::unregisterObserver): (API::HTTPCookieStore::cookiesDidChange): (API::HTTPCookieStore::cookieManagerDestroyed): Deleted. * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/WebCookieManagerProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::generateListenerIdentifier): Deleted. (WebKit::processPoolCreationListenerFunctionMap): Deleted. (WebKit::WebProcessPool::registerProcessPoolCreationListener): Deleted. (WebKit::WebProcessPool::unregisterProcessPoolCreationListener): Deleted. (WebKit::WebProcessPool::notifyThisWebProcessPoolWasCreated): Deleted. * UIProcess/WebProcessPool.h: 2021-06-16 Kimmo Kinnunen ANGLE Metal gl sync objects do not work in case of listener being needed https://bugs.webkit.org/show_bug.cgi?id=227024 Reviewed by Per Arne Vollan. Make MTLSharedEventListener instantiatable by adding IOKit messages 39 and 40 to IOSurfaceRootUserClientMessageFilter. The MTLSharedEventListener init would fail, and ANGLE would fail to make the shared event signal the event listener. This would cause all glClientWaitSync calls to wait the full timeout time. No new tests, WebGL2 sync object implementation does not support non-zero timeout values that would be needed to detect the failure. Standalone test-cases would need the test runner being sandboxed, which is not implemented currently. * WebProcess/com.apple.WebProcess.sb.in: 2021-06-16 Per Arne Update Media Accessibility preferences in the WebContent process from the UI process https://bugs.webkit.org/show_bug.cgi?id=227031 Reviewed by Eric Carlson. Due to stricter sandboxing in the WebContent process, Media Accessibility preferences should be updated from the UI process. The preferences for caption display mode and preferred caption languages will be sent to the WebContent process on process startup and when the preference has been changed. * Shared/AccessibilityPreferences.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/AccessibilityPreferences.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::accessibilityPreferences): (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::accessibilityPreferencesDidChange): 2021-06-16 Martin Robinson Replace invalidSnapOffsetIndex with std::optional https://bugs.webkit.org/show_bug.cgi?id=226654 Reviewed by Simon Fraser. Use std::optional in order to represent the situation where we do not have a snap point selected rather than UINT_MAX. * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (ArgumentCoder::decode): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::currentSnapPointIndicesDidChange): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::currentSnapPointIndicesDidChange): * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping): (WebKit::RemoteScrollingCoordinatorProxy::shouldSnapForMainFrameScrolling const): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange const): * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: (WebKit::RemoteScrollingCoordinator::currentSnapPointIndicesChangedForNode): 2021-06-15 Alex Christensen Remove unused code on API::HTTPCookieStore https://bugs.webkit.org/show_bug.cgi?id=227056 Reviewed by Brady Eidson. The dust has settled a bit since r267763. Let's clean up! * SourcesCocoa.txt: * UIProcess/API/APIHTTPCookieStore.cpp: (API::HTTPCookieStore::unregisterObserver): (API::HTTPCookieStore::cookieManagerDestroyed): (API::HTTPCookieStore::flushDefaultUIProcessCookieStore): Deleted. (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies): Deleted. (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore): Deleted. (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore): Deleted. (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore): Deleted. (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore): Deleted. (API::HTTPCookieStore::deleteCookiesInDefaultUIProcessCookieStore): Deleted. (API::HTTPCookieStore::setHTTPCookieAcceptPolicyInDefaultUIProcessCookieStore): Deleted. * UIProcess/API/APIHTTPCookieStore.h: * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: Removed. * UIProcess/API/Cocoa/WKBrowsingContextController.mm: * UIProcess/API/Cocoa/WKDownloadInternal.h: * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::sendAudioComponentRegistrations): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::handleClickForDataDetectionResult): * UIProcess/WebProcessPool.h: * WebKit.xcodeproj/project.pbxproj: 2021-06-15 Said Abou-Hallawa [GPU Process] ConcreteImageBuffer::baseTransform() returns incorrect transform for unaccelerated ImageBuffer https://bugs.webkit.org/show_bug.cgi?id=227044 Reviewed by Simon Fraser. * Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: 2021-06-15 Jean-Yves Avenard REGRESSION: MSE: Netflix playback sometimes fails when going to "next episode" in series https://bugs.webkit.org/show_bug.cgi?id=226952 rdar://77583769 Reviewed by Eric Carlson. Following bug #225396, the remote/proxy MediaPlayer readyState became decoupled from the currentTime. In the scenario where a time update was pushed from the GPU to the WebContent process, followed by a change of readyState status; should the HTMLMediaElement query the MediaPlayer's time in-between those two IPC calls, it would be possible for the time to be incorrectly estimated as it assumed it had progressed since it received the update. Additionally, it was assumed that the only case where the time won't progress was if the media element was explicitly paused. This was incorrect it could have stalled due to the lack of data such as commonly happen with MSE. We add in the time update IPC message a boolean indicating if the GPU's MediaPlayer is either stalled or paused and that the time shouldn't advance. While this new boolean appears redundant with the values of the cached readyState/paused it differs in that timeIsProgressing is accurate at the moment the time update is sent and received. Test: media/media-source/media-source-seek-unbuffered.html * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerPausedOrStalled const): Add utility method. (WebKit::RemoteMediaPlayerProxy::currentTimeChanged): * GPUProcess/media/RemoteMediaPlayerProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::currentMediaTime const): (WebKit::MediaPlayerPrivateRemote::seek): Set the cached media time to the seek value so that reading it back the time will provide accurate data. (WebKit::MediaPlayerPrivateRemote::seekWithTolerance): same as with seek method. (WebKit::MediaPlayerPrivateRemote::currentTimeChanged): Check if timeIsProgressing is true and only estimate the time if we are certain playback has continued. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: add timeIsProgressing to method. 2021-06-15 Chris Dumez Use more SQL transactions in ResourceLoadStatisticsDatabaseStore https://bugs.webkit.org/show_bug.cgi?id=227034 Reviewed by Kate Cheney. Use more SQL transactions in ResourceLoadStatisticsDatabaseStore, for performance. I updated the code so that we start a SQL transaction whenever we do more than one consecutive "write" statement. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable): (WebKit::ResourceLoadStatisticsDatabaseStore::addMissingTablesIfNecessary): (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore): (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics): (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources): (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains): (WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting): 2021-06-15 Chris Dumez Reloading the view should be able to recover if the GPUProcess or NetworkProcess are hung https://bugs.webkit.org/show_bug.cgi?id=227051 Reviewed by Geoffrey Garen. Reloading the view should be able to get us out of bad state if the GPUProcess or NetworkProcess are hung. This is useful as the first instinct of the user may be to reload the page if the page appears hung. Before the change, if the page is in a bad state due to a hung GPUProcess or NetworkProcess and you'd reload, the reload would hang indefinitely. After the change, we'll make sure that both processes are still responsive when triggering the reload. If they are unresponsive, we kill them and the reload is able to proceed. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::didReceiveMessage): * GPUProcess/GPUProcess.h: * GPUProcess/GPUProcess.messages.in: * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::mainThreadPing): * Shared/AuxiliaryProcess.h: * Shared/AuxiliaryProcess.messages.in: * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::checkForResponsiveness): * UIProcess/AuxiliaryProcessProxy.h: * UIProcess/GPU/GPUProcessProxy.messages.in: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::reload): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::isResponsive): (WebKit::WebProcessProxy::isResponsiveWithLazyStop): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebProcess/WebProcess.cpp: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2021-06-15 Jonathan Bedard [watchOS 8] Support building WebKit https://bugs.webkit.org/show_bug.cgi?id=227050 Reviewed by Tim Horton. Covered by existing tests. * Platform/spi/watchos/PepperUICoreSPI.h: Add QuickboardController SPI. 2021-06-15 Chris Dumez Add basic detection of unresponsive Network / GPU Processes https://bugs.webkit.org/show_bug.cgi?id=226994 Reviewed by Geoffrey Garen. If a WebProcess A attempts to connect to the GPUProcess / NetworkProcess B and process B fails to respond within 3 seconds, we consider process B as unresponsive and terminate it. As a result, it will re-attempt to launch process B and connect to it again. This helps in the following scenario: 1. User is in a tab and something looks broken due to the GPUProcess or NetworkProcess becoming unresponsive 2. The user tries to reload the page in a new tab Before this patch, the tab would be similarly broken / hung because the GPUProcess or NetworkProcess would be unresponsive. After this patch, we would detect the process is hung and kill it. As a result, the page would load correctly in a new tab (with a delay). In a follow-up, I think we should consider doing the same thing when the user requests a reload, so that we don't require opening a new tab to recover. However, this keeps the patch small and is a decent first step. * Shared/ProcessTerminationReason.h: * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::AuxiliaryProcessProxy): (WebKit::AuxiliaryProcessProxy::didFinishLaunching): (WebKit::AuxiliaryProcessProxy::shutDownProcess): (WebKit::AuxiliaryProcessProxy::platformIsBeingDebugged const): (WebKit::AuxiliaryProcessProxy::stopResponsivenessTimer): (WebKit::AuxiliaryProcessProxy::startResponsivenessTimer): (WebKit::AuxiliaryProcessProxy::mayBecomeUnresponsive): (WebKit::AuxiliaryProcessProxy::didBecomeUnresponsive): * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::responsivenessTimer): (WebKit::AuxiliaryProcessProxy::responsivenessTimer const): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::platformIsBeingDebugged const): Deleted. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::getGPUProcessConnection): (WebKit::GPUProcessProxy::gpuProcessExited): (WebKit::GPUProcessProxy::didBecomeUnresponsive): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::didBecomeUnresponsive): (WebKit::NetworkProcessProxy::getNetworkProcessConnection): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/ResponsivenessTimer.cpp: (WebKit::ResponsivenessTimer::timerFired): (WebKit::ResponsivenessTimer::mayBecomeUnresponsive const): * UIProcess/ResponsivenessTimer.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessExited): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::WebProcessProxy): (WebKit::WebProcessProxy::shutDown): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::isResponsive const): (WebKit::WebProcessProxy::processTerminated): (WebKit::WebProcessProxy::platformIsBeingDebugged const): Deleted. (WebKit::WebProcessProxy::mayBecomeUnresponsive): Deleted. (WebKit::WebProcessProxy::stopResponsivenessTimer): Deleted. (WebKit::WebProcessProxy::startResponsivenessTimer): Deleted. * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::responsivenessTimer): Deleted. 2021-06-15 Jonathan Bedard [Monterey] Support building WebKit (Follow-up) https://bugs.webkit.org/show_bug.cgi?id=226846 Unreviewed follow-up fix. Covered by exisiting tests. * WebKit.xcodeproj/project.pbxproj: Reset objectVersion. 2021-06-15 Brent Fulgham [iOS] Permit access to 'platform-name' https://bugs.webkit.org/show_bug.cgi?id=227032 Reviewed by Per Arne Vollan. Telemetry shows that some media code needs access to 'platform-name'. We allow this in the WebContent process, but didn't include it in the GPU Process. Make the WebContent and GPU Process consistent in this access. Also adopt the standard rule for this used in the system sandbox, which restricts the access to the IOKit class family that has this property. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: 2021-06-15 Alexander Mikhaylenko [GTK] Support transient zoom https://bugs.webkit.org/show_bug.cgi?id=197002 Reviewed by Michael Catanzaro. Speed up pinch zoom for AC mode. Reuse the same infrastructure as the macOS implementation. Move the shared code to ViewGestureController.cpp where possible. Slightly adjust the shared code to support changing the gesture origin during the gesture since we support it on both touchscreen and touchpad. There's not much we can do for non-AC mode so just keep the current behavior there, wrapping real-time zoom into transient zoom API so that it's confined to the web process. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseZoomChanged): (webkitWebViewBaseZoomEnd): (webkitWebViewBaseConstructed): (webkitWebViewBaseZoomBegin): Deleted. * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: (WebKit::DrawingAreaProxyCoordinatedGraphics::adjustTransientZoom): (WebKit::DrawingAreaProxyCoordinatedGraphics::commitTransientZoom): * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::scaledMagnificationOrigin): Support changing origin during the gesture, cache the page scale factor to accommodate non-AC mode doing real-time zooming instead of transient zooming. (WebKit::ViewGestureController::didCollectGeometryForMagnificationGesture): (WebKit::ViewGestureController::prepareMagnificationGesture): (WebKit::ViewGestureController::applyMagnification): (WebKit::ViewGestureController::endMagnificationGesture): (WebKit::ViewGestureController::magnification const): Moved from ViewGestureControllerMac.mm. * UIProcess/ViewGestureController.h: * UIProcess/ViewGestureController.messages.in: * UIProcess/WebPageProxy.h: * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::setMagnification): (WebKit::ViewGestureController::endMagnification): * UIProcess/gtk/WebPageProxyGtk.cpp: (WebKit::WebPageProxy::getCenterForZoomGesture): Deleted. * UIProcess/mac/ViewGestureControllerMac.mm: (WebKit::ViewGestureController::resistanceForDelta): Make it a static private method instead of a function so that we can keep using minMagnification and maxMagnification in it. (WebKit::ViewGestureController::handleMagnificationGestureEvent): (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture): Set the initial scale and origin before calling scaledMagnificationOrigin(). (WebKit::resistanceForDelta): Deleted. (WebKit::ViewGestureController::scaledMagnificationOrigin): (WebKit::ViewGestureController::didCollectGeometryForMagnificationGesture): (WebKit::ViewGestureController::endMagnificationGesture): (WebKit::ViewGestureController::magnification const): Moved to ViewGestureController.cpp. * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp: (WebKit::CompositingCoordinator::flushPendingLayerChanges): We only need to set the ApplyScrollingTreeLayerPositions flag when not zooming, so add a parameter to do that. * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h: * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp: (WebKit::DrawingAreaCoordinatedGraphics::adjustTransientZoom): (WebKit::DrawingAreaCoordinatedGraphics::commitTransientZoom): * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h: * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): (WebKit::LayerTreeHost::forceRepaint): Don't pass ApplyScrollingTreeLayerPositions when transient zoom is active. (WebKit::LayerTreeHost::constrainTransientZoomOrigin const): (WebKit::LayerTreeHost::layerForTransientZoom const): (WebKit::LayerTreeHost::applyTransientZoomToLayers): (WebKit::LayerTreeHost::adjustTransientZoom): (WebKit::LayerTreeHost::commitTransientZoom): * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::addTransactionCallbackID): (WebKit::DrawingArea::commitTransientZoom): * WebProcess/WebPage/DrawingArea.messages.in: * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture): * WebProcess/WebPage/ViewGestureGeometryCollector.h: * WebProcess/WebPage/ViewGestureGeometryCollector.messages.in: Build CollectGeometryForMagnificationGesture for GTK as well. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::getCenterForZoomGesture): Deleted. 2021-06-15 Brent Fulgham [Cocoa] Harden WebAuthn process by restricting to browser-entitled processes https://bugs.webkit.org/show_bug.cgi?id=226772 Reviewed by Darin Adler. We should ensure that any process attempting to launch the WebAuthn XPC service is entitled as a full web browser. We should also ensure that the process requesting WebAuthn operations over WebKit CoreIPC is the WebContent process. Tested by existing WebAuthn tests. * Platform/Logging.h: Add WebAuthn category. * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::isInWebKitChildProcess): Recognize 'com.apple.WebKit.WebAuthn' as a WebKit sub-process. * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::hasCorrectPACEntitlement): Added. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getWebAuthnProcessConnection): Add a new MESSAGE_CHECK that the process requesting a WebAuthn process connection is a WebContent process. * UIProcess/WebProcessProxy.h: * WebAuthnProcess/WebAuthnProcess.cpp: (WebKit::WebAuthnProcess::platformInitializeWebAuthnProcess): Add some logging. * WebAuthnProcess/WebAuthnProcess.h: * WebAuthnProcess/ios/WebAuthnProcessIOS.mm: (WebKit::WebAuthnProcess::platformInitializeWebAuthnProcess): Ensure that the application invoking the WebAuthn XPC service is entitled as a default web browser. * WebAuthnProcess/mac/WebAuthnProcessMac.mm: (WebKit::WebAuthnProcess::platformInitializeWebAuthnProcess): Stub. * WebProcess/WebProcess.cpp: (WebKit::getWebAuthnProcessConnection): (WebKit::WebProcess::ensureWebAuthnProcessConnection): 2021-06-15 Youenn Fablet Caches::removeCacheEntry should check for m_storage https://bugs.webkit.org/show_bug.cgi?id=227022 Reviewed by Antti Koivisto. removeCacheEntry can be called asynchronoulsy in Cache::open for badly formatted content. In that case, given this is done asynchronously, m_storage might be nullified. Add a nullptr check to cope with this. * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::Caches::removeCacheEntry): 2021-06-15 Jonathan Bedard [iOS 15] Support building WebKit https://bugs.webkit.org/show_bug.cgi?id=227002 Reviewed by Tim Horton. Covered by existing tests. * Platform/spi/ios/UIKitSPI.h: Add _insertTextFromCamera. 2021-06-15 Eric Carlson [Mac] CoreMedia WrapperClass does not need alignment fixup https://bugs.webkit.org/show_bug.cgi?id=226978 rdar://78864290 Reviewed by Geoffrey Garen and Dan Bernstein. * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: (WebKit::CoreMediaWrapped::vTable): Don't add padding to WrapperClass, it isn't necessary. static_assert CMBaseClass and WrapperClass alignment and .version sizes. 2021-06-15 Martin Robinson [css-scroll-snap] New snap containers always snap to the first scroll position https://bugs.webkit.org/show_bug.cgi?id=226630 Reviewed by Simon Fraser. * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Use invalidSnapOffsetIndex instead of 0 to initialize the snap position. 2021-06-14 Alex Christensen Pass PAL::SessionID by value instead of reference https://bugs.webkit.org/show_bug.cgi?id=226983 Reviewed by Geoffrey Garen. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::newTestingSession): (WebKit::NetworkProcess::ensureSession): (WebKit::NetworkProcess::storageSession const): (WebKit::NetworkProcess::findCacheEngine): (WebKit::NetworkProcess::ensureCacheEngine): (WebKit::NetworkProcess::removeCacheEngine): (WebKit::NetworkProcess::flushCookies): (WebKit::NetworkProcess::platformFlushCookies): (WebKit::NetworkProcess::addWebPageNetworkParameters): (WebKit::NetworkProcess::removeWebPageNetworkParameters): (WebKit::NetworkProcess::countNonDefaultSessionSets): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::shouldLogCookieInformation): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/NetworkStorageSessionProvider.h: * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::makeUseDecision): * NetworkProcess/cache/NetworkCache.h: (WebKit::NetworkCache::Cache::sessionID const): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::flushCookies): (WebKit::NetworkProcess::platformFlushCookies): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::flushCookies): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebProcessPool.h: * WebProcess/Databases/WebDatabaseProvider.cpp: (WebKit::WebDatabaseProvider::idbConnectionToServerForSession): * WebProcess/Databases/WebDatabaseProvider.h: 2021-06-14 Youenn Fablet Accessing navigator.mediaDevices.enumerateDevices after granting permission https://bugs.webkit.org/show_bug.cgi?id=226969 Reviewed by Eric Carlson. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::checkUsageDescriptionStringForType): Check for NSCameraUsageDescription instead of NSMicrophoneUsageDescription for camera. 2021-06-14 Brent Fulgham [iOS] Tighten the WebAuthn Sandbox https://bugs.webkit.org/show_bug.cgi?id=226944 Reviewed by Per Arne Vollan. Revise the WebAuthn process sandbox to remove the many things originally copied from the WebContent sandbox that are not needed. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: 2021-06-14 Per Arne [iOS] Sync Accessibility preferences https://bugs.webkit.org/show_bug.cgi?id=226738 Reviewed by Brent Fulgham. Only attempt to modify Accessibility preferences if they have changed. * Shared/AccessibilityPreferences.cpp: Replaced. * Shared/AccessibilityPreferences.h: Replaced. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::accessibilityPreferencesDidChange): 2021-06-13 Wenson Hsieh [watchOS] Quickboard UI for focused select elements should not allow the user to change the input language https://bugs.webkit.org/show_bug.cgi?id=226958 Reviewed by Tim Horton. Fix a couple of bugs around focused select element UI that were introduced in watchOS 7, due to changes in PepperUICore. See below for details. * UIProcess/ios/forms/WKQuickboardListViewController.mm: (-[WKQuickboardListViewController initWithDelegate:]): Drive-by fix: remove a `USE(APPLE_INTERNAL_SDK)` guard that was (seemingly) unintentionally added in r262854. (-[WKQuickboardListViewController viewDidLoad]): Deleted. Avoid hiding the list view controller's `-headerView` when focusing select elements. In watchOS 7, the accept and cancel buttons are positioned inside the `-headerView`, so having this logic in the base class (WKQuickboardListViewController) means that the Done button in select menus does not show up. In turn, this means that currently, users who focus select elements must know to use the crown button to dismiss the select menu. For now, we move logic to the only other subclass of WKQuickboardListViewController, WKTextInputListViewController. However, note that this too is going away in an upcoming patch that refactors WKTextInputListViewController so that it directly subclasses PUICQuickboardMessageViewController instead of PUICQuickboardListViewController. * Platform/spi/watchos/PepperUICoreSPI.h: Move a declaration of `-initWithDelegate:dictationMode:` from PUICDictationViewController to PUICQuickboardListViewController (see the change in `-[WKQuickboardListViewController initWithDelegate:]` above). * UIProcess/ios/forms/WKSelectMenuListViewController.mm: (-[WKSelectMenuListViewController shouldShowLanguageButton]): Since watchOS 7, the language button is now always shown by default in PUICQuickboardListViewController, with a new subclassing hook to avoid showing it. It doesn't make sense to allow the user to change input languages when choosing options in a select menu, so we implement this and always return `NO` here. * UIProcess/ios/forms/WKTextInputListViewController.mm: (-[WKTextInputListViewController viewDidLoad]): 2021-06-12 Wenson Hsieh Number pad button is missing its image when tapping on in watchOS 8 https://bugs.webkit.org/show_bug.cgi?id=226955 Reviewed by Darin Adler. After some recent PepperUICore changes, the Quickboard button for presenting the number pad when focusing a telephone input on watchOS 8 is missing its icon image. To fix this, stop using deprecated SPI for creating the list tray button, and instead use `+[PUICQuickboardListTrayButton buttonWithType:]` and `-setAction:` to create and set up the button. * Platform/spi/watchos/PepperUICoreSPI.h: * UIProcess/ios/forms/WKTextInputListViewController.mm: (-[WKTextInputListViewController additionalTrayButtons]): 2021-06-12 Peng Liu REGRESSION (r278374): [Big Sur] ASSERTION FAILED: !isInRoutingArbitrationForToken(token) in WebCore::SharedRoutingArbitrator::beginRoutingArbitrationForToken() https://bugs.webkit.org/show_bug.cgi?id=226787 Reviewed by Eric Carlson. A WebContent process will resume a video element playback after the GPU process crashes and restarts. During that process, the WebContent process will set category of the audio session, and the UI process will be asked to begin routing arbitration with the new category. However, the `SharedRoutingArbitrator` at the UI process will have stale routing arbitrator tokens, which lead to the assertion failure. To fix this issue, this patch cleans up the `SharedRoutingArbitrator` when the GPU process crashes. No new tests. Fix an API test: - TestWebKitAPI.GPUProcess.CrashWhilePlayingVideo * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::gpuProcessExited): 2021-06-11 Ryan Haddad Unreviewed, reverting r278754. Caused 5 TestWebKitAPI.WKWebView.SnapshotImage* tests to time out on iOS Reverted changeset: "takeSnapshotWithConfiguration() should wait for the next flush before it does callSnapshotRect()" https://bugs.webkit.org/show_bug.cgi?id=226257 https://commits.webkit.org/r278754 2021-06-11 Wenson Hsieh [Cocoa] Clean up some VisionKitCore soft linking code in WebKit https://bugs.webkit.org/show_bug.cgi?id=226941 Reviewed by Tim Horton. Remove softlinking macros from several files in WebKit; instead, import and use the new PAL soft-linking helper functions. Additionally, move a couple of staging forward declarations into the non-internal SDK section of the VisionKitCore SPI header. * Platform/cocoa/TextRecognitionUtilities.h: * Platform/cocoa/TextRecognitionUtilities.mm: (WebKit::isLiveTextEnabled): (WebKit::isLiveTextAvailableAndEnabled): Additionally replace `isLiveTextEnabled` with `isLiveTextAvailableAndEnabled`, and have it check for the presence of the VisionKitCore framework in addition to whether the system feature flag is enabled (at least, when building with the internal SDK). * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::ensureImageAnalyzer): (WebKit::createImageAnalysisRequest): (WebKit::WebViewImpl::requestTextRecognition): (WebKit::WebViewImpl::computeHasVisualSearchResults): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView actionSheetAssistant:shouldIncludeShowTextActionForElement:]): (-[WKContentView actionSheetAssistant:shouldIncludeLookUpImageActionForElement:]): (-[WKContentView imageAnalyzer]): (-[WKContentView _setUpImageAnalysis]): (-[WKContentView _tearDownImageAnalysis]): (-[WKContentView createImageAnalysisRequest:image:imageURL:]): (-[WKContentView imageAnalysisGestureDidBegin:]): 2021-06-11 Alex Christensen Partition CrossOriginPreflightResultCache by SessionID https://bugs.webkit.org/show_bug.cgi?id=226910 Reviewed by Youenn Fablet. * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::didCompleteWithError): * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight): 2021-06-11 Chris Dumez Enable more release logging in UIProcess/WebProcess for ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=226945 Reviewed by Geoffrey Garen. Enable more release logging in UIProcess/WebProcess for ephemeral sessions, to facilitate debugging. * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: (WebKit::RemoteLayerTreeHost::updateLayerTree): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didClose): (WebKit::WebProcessProxy::didFinishLaunching): (WebKit::WebProcessProxy::fetchWebsiteData): (WebKit::WebProcessProxy::deleteWebsiteData): (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins): (WebKit::WebProcessProxy::requestTermination): * UIProcess/WebProcessProxy.h: * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::loadResource): (WebKit::WebLoaderStrategy::scheduleLoad): (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler): (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): (WebKit::WebLoaderStrategy::networkProcessCrashed): (WebKit::WebLoaderStrategy::loadDataURLSynchronously): (WebKit::WebLoaderStrategy::loadResourceSynchronously): * WebProcess/Network/webrtc/WebRTCMonitor.cpp: (WebKit::WebRTCMonitor::StartUpdating): (WebKit::WebRTCMonitor::StopUpdating): (WebKit::WebRTCMonitor::networksChanged): * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp: 2021-06-11 Chris Dumez [WK2] Batch local storage database writes using transactions https://bugs.webkit.org/show_bug.cgi?id=226938 Reviewed by Geoff Garen. Batch local storage writes using transactions, to improve performance and reduce disk writes. In this patch, we use a simple time-based approach where we batch transactions happening in the same 500ms period. * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::create): (WebKit::LocalStorageDatabase::LocalStorageDatabase): (WebKit::LocalStorageDatabase::startTransactionIfNecessary): (WebKit::LocalStorageDatabase::removeItem): (WebKit::LocalStorageDatabase::setItem): (WebKit::LocalStorageDatabase::clear): (WebKit::LocalStorageDatabase::close): * NetworkProcess/WebStorage/LocalStorageDatabase.h: * NetworkProcess/WebStorage/StorageArea.cpp: (WebKit::StorageArea::ensureDatabase const): 2021-06-11 Alex Christensen Don't include certificate info in WebURLSchemeTask::didReceiveResponse https://bugs.webkit.org/show_bug.cgi?id=226939 Reviewed by Chris Dumez. This call was introduced in r215384 but is unused since WKURLSchemeTask isn't used for HTTPS. It is causing hangs sometimes, so let's drop it. * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::didReceiveResponse): 2021-06-11 Jonathan Bedard [Monterey] Support building WebKit https://bugs.webkit.org/show_bug.cgi?id=226846 Reviewed by Tim Horton. * Platform/cocoa/TextRecognitionUtilities.mm: Import VisionKitSPI.h. * Platform/spi/Cocoa/VisionKitSPI.h: Added. * UIProcess/API/Cocoa/WKBrowsingContextController.mm: (setUpPageLoaderClient): Allow deprecated declarations. (setUpPagePolicyClient): Ditto. * UIProcess/API/Cocoa/WKConnection.mm: (setUpClient): Allow deprecated declarations. * UIProcess/API/Cocoa/WKProcessGroup.mm: (setUpConnectionClient): Allow deprecated declarations. (setUpInjectedBundleClient): Ditto. (setUpHistoryClient): Ditto. * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]): Explicitly define second arugment to avoid 'missing field' compilation error. * UIProcess/Cocoa/WebViewImpl.mm: Import VisionKitSPI.h. * UIProcess/ios/WKContentViewInteraction.mm: Ditto. * WebKit.xcodeproj/project.pbxproj: Ditto. 2021-06-11 Chris Dumez Enable release logging in ephemeral sessions for parts of WebCore https://bugs.webkit.org/show_bug.cgi?id=226929 Reviewed by Eric Carlson. Enable release logging in ephemeral sessions for parts of WebCore, to facilitate debugging. * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::willSendRequest): (WebKit::WebResourceLoader::didReceiveResponse): (WebKit::WebResourceLoader::didReceiveData): (WebKit::WebResourceLoader::didFinishResourceLoad): (WebKit::WebResourceLoader::serviceWorkerDidNotHandle): (WebKit::WebResourceLoader::didFailResourceLoad): (WebKit::WebResourceLoader::didBlockAuthenticationChallenge): (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): (WebKit::WebResourceLoader::didReceiveResource): * WebProcess/Network/WebResourceLoader.h: 2021-06-11 Chris Dumez Regression(r276653) We're going to disk more often for local storage operations https://bugs.webkit.org/show_bug.cgi?id=226832 Reviewed by Darin Adler. We're going to disk more often for local storage operations since r276653 because we no longer keep items in memory. This results in a slightly increased power usage on one of our benchmarks. As a first step to improve this, I am reintroducing a cache of the items in memory, as long as the values are not too large (1Kb limit). We still go to disk to look up values that are larger than 1Kb to avoid regressing memory usage. * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::openDatabase): (WebKit::LocalStorageDatabase::items const): (WebKit::LocalStorageDatabase::removeItem): (WebKit::LocalStorageDatabase::item const): (WebKit::LocalStorageDatabase::itemBypassingCache const): (WebKit::LocalStorageDatabase::setItem): (WebKit::LocalStorageDatabase::clear): (WebKit::LocalStorageDatabase::close): (WebKit::LocalStorageDatabase::databaseIsEmpty const): * NetworkProcess/WebStorage/LocalStorageDatabase.h: 2021-06-11 Chris Dumez Enable WebProcess' release logging in ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=226927 Reviewed by Geoffrey Garen. Enable WebProcess' release logging in ephemeral sessions, to faciliate debugging. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): (WebKit::WebProcess::networkProcessConnectionClosed): (WebKit::WebProcess::prepareToSuspend): (WebKit::WebProcess::markAllLayersVolatile): (WebKit::WebProcess::cancelMarkAllLayersVolatile): (WebKit::WebProcess::freezeAllLayerTrees): (WebKit::WebProcess::unfreezeAllLayerTrees): (WebKit::WebProcess::processDidResume): (WebKit::WebProcess::grantUserMediaDeviceSandboxExtensions): (WebKit::WebProcess::revokeUserMediaDeviceSandboxExtensions): * WebProcess/WebProcess.h: (WebKit::WebProcess::isAlwaysOnLoggingAllowed): Deleted. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): (WebKit::WebProcess::updateActivePages): (WebKit::WebProcess::updateCPUMonitorState): (WebKit::WebProcess::destroyRenderingResources): (WebKit::WebProcess::updateFreezerStatus): (WebKit::WebProcess::consumeAudioComponentRegistrations): 2021-06-11 Megan Gardner Rename AppHighlight group to QuickNote to correctly reflect feature. https://bugs.webkit.org/show_bug.cgi?id=226888 Reviewed by Tim Horton. * Scripts/webkit/messages.py: (headers_for_type): * Shared/API/c/WKContextMenuItemTypes.h: * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm: * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _storeAppHighlight:]): (-[WKWebView _addAppHighlightInNewGroup:originatedInApp:]): (-[WKWebView _addAppHighlightInNewQuickNote:originatedInApp:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/API/Cocoa/_WKAppHighlightDelegate.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::createAppHighlightInSelectedRange): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::contextMenuItemSelected): * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView targetForAction:withSender:]): (-[WKContentView setUpAppHighlightMenusIfNeeded]): (-[WKContentView createHighlightForCurrentQuickNoteWithRange:]): (-[WKContentView createHighlightForNewQuickNoteWithRange:]): (-[WKContentView createHighlightInCurrentGroupWithRange:]): Deleted. (-[WKContentView createHighlightInNewGroupWithRange:]): Deleted. * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::storeAppHighlight const): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createAppHighlightInSelectedRange): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::highlightIsNewQuickNote const): (WebKit::WebPage::highlightIsNewGroup const): Deleted. * WebProcess/WebPage/WebPage.messages.in: 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-11 Adrian Perez de Castro Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.33.2 release * wpe/NEWS: Add release notes for 2.33.2. 2021-06-10 Said Abou-Hallawa takeSnapshotWithConfiguration() should wait for the next flush before it does callSnapshotRect() https://bugs.webkit.org/show_bug.cgi?id=226257 Reviewed by Simon Fraser. This will ensure the latest IOSurfaces are pushed to backboardd before taking the snapshot. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): 2021-06-10 Chris Dumez Unreviewed macOS build fix. Add some missing header includes. * Shared/mac/MediaFormatReader/CoreMediaWrapped.h: * Shared/mac/MediaFormatReader/MediaSampleByteRange.h: * Shared/mac/MediaFormatReader/MediaSampleCursor.h: * Shared/mac/MediaFormatReader/MediaTrackReader.cpp: 2021-06-10 Fujii Hironori [WinCairo] Can't open WebInspector UI since r277787 https://bugs.webkit.org/show_bug.cgi?id=226908 Reviewed by Don Olmstead. r277787 (Bug 226001) changed the return type of WebURLSchemeTask::request() from const WebCore::ResourceRequest& to WebCore::ResourceRequest. InspectorResourceURLSchemeHandler::platformStartTask shouldn't hold the reference of the temporary object. * UIProcess/Inspector/win/InspectorResourceURLSchemeHandler.cpp: (WebKit::InspectorResourceURLSchemeHandler::platformStartTask): Changed the type of requestURL from auto& to auto to copy the URL. 2021-06-10 Wenson Hsieh [Live Text] Add a mechanism to regenerate text in an image element when it changes dimensions https://bugs.webkit.org/show_bug.cgi?id=226858 rdar://77522786 Reviewed by Devin Rousso. Push `m_elementsWithTextRecognitionResults` from `WebKit::WebPage` down to `WebCore::Page`. See WebCore ChangeLog for more details. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): (WebKit::WebPage::requestTextRecognition): (WebKit::WebPage::updateWithTextRecognitionResult): * WebProcess/WebPage/WebPage.h: 2021-06-10 Per Arne Vollan [iOS] Sync Accessibility preferences https://bugs.webkit.org/show_bug.cgi?id=226738 Reviewed by Brent Fulgham. Implement Per-App Accessibility preferences on iOS. The Per-App Accessibility preferences in the WebContent process should reflect the values in the UI process. This is addressed by syncing the values between the two processes on startup of the WebContent process, and when the values change. * Platform/spi/Cocoa/AccessibilitySupportSPI.h: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): (WebKit::WebProcessPool::accessibilityPreferencesChangedCallback): (WebKit::WebProcessPool::registerNotificationObservers): (WebKit::WebProcessPool::unregisterNotificationObservers): * UIProcess/WebProcessPool.h: * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): (WebKit::WebProcess::accessibilityPreferencesDidChange): 2021-06-10 Sihui Liu Regression(r278449): add null check for completionHandler in WebIDBServer::close https://bugs.webkit.org/show_bug.cgi?id=226900 rdar://79160392 Reviewed by Chris Dumez. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::close): 2021-06-10 Eric Carlson [Cocoa] Remote video layer should respect video gravity when resizing https://bugs.webkit.org/show_bug.cgi?id=226784 Reviewed by Jer Noble. Tested manually. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::prepareForPlayback): Pass specify video gravity when creating remote layer. (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenGravity): Remember gravity. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/VideoLayerRemote.h: * WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.h: * WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm: (-[WKVideoLayerRemote videoGravity]): (-[WKVideoLayerRemote setVideoGravity:]): (-[WKVideoLayerRemote resizePreservingGravity]): Return true when in PiP, fullscreen, or when video gravity is not "resize". (-[WKVideoLayerRemote layoutSublayers]): Preserve aspect ration when appropriate. (WebKit::createVideoLayerRemote): 2021-06-10 Alex Christensen Move Timing-Allow-Origin checks to the network process https://bugs.webkit.org/show_bug.cgi?id=226678 Reviewed by Chris Dumez. * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::sendReplyToSynchronousRequest): Pass complete metrics with sync xhr responses. Many of the tests use sync xhr. (WebKit::NetworkResourceLoader::didFinishLoading): (WebKit::NetworkResourceLoader::didFailLoading): (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): 2021-06-10 Alex Christensen Origin is null in http requests when baseURL has custom scheme on iOS 15.0 https://bugs.webkit.org/show_bug.cgi?id=226760 Reviewed by Chris Dumez. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadData): 2021-06-10 Chris Fleizach AX: TestWebKitAPI.WebKit.AccessibilityReduceMotion failing on iOS https://bugs.webkit.org/show_bug.cgi?id=226758 Reviewed by Alex Christensen. For releases that don't have the accessibility update method, the direct setters need to be called in order to update the cache. * Platform/spi/Cocoa/AccessibilitySupportSPI.h: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::increaseContrastPreferenceKey): (WebKit::setPreferenceValue): 2021-06-10 Aditya Keerthi [iOS] VinylWall app crashes when tapping on 'format' dropdown menu in 'Add Record' menu https://bugs.webkit.org/show_bug.cgi?id=226886 Reviewed by Tim Horton. The VinylWall app contains a WKWebView, and uses presents a UIContextMenuInteraction, rather than a picker wheel or popover. However, UIContextMenuInteraction is not supported on apps linked against an SDK older than iOS 14, resulting in this crash. To fix, perform a linked-on-or-after check before showing the new UI for with a . If the check fails, fallback to the old UI. We already have this check in place for other context menus in `-[WKContentView _shouldUseContextMenus]`, so we reuse that method. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): (-[WKContentView _elementTypeRequiresAccessoryView:]): (-[WKContentView _shouldUseContextMenusForFormControls]): * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (WebKit::WebDataListSuggestionsDropdownIOS::show): * UIProcess/ios/forms/WKFormSelectControl.mm: (-[WKFormSelectControl initWithView:]): 2021-06-10 Tim Horton REGRESSION (r277820): Trackpad interaction in Web Content is not working on iOS or macCatalyst https://bugs.webkit.org/show_bug.cgi?id=226892 Reviewed by Wenson Hsieh. * UIProcess/ios/WKMouseGestureRecognizer.h: * UIProcess/ios/WKMouseGestureRecognizer.mm: Stop inheriting from UIHoverGestureRecognizer; since r277820 removed our override of _shouldReceiveTouch, and the default implementation always says NO, r277820 broke trackpad-origiating mouse events (but left hover working, since that is not a touch). 2021-06-10 Chris Dumez Do some hardening in XPCServiceEventHandler() https://bugs.webkit.org/show_bug.cgi?id=226860 Reviewed by Geoffrey Garen. Do some hardening in XPCServiceEventHandler() to deal with unexpected values and add some more logging as well. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceEventHandler): * WebProcess/cocoa/HandleXPCEndpointMessages.h: * WebProcess/cocoa/HandleXPCEndpointMessages.mm: (WebKit::handleXPCEndpointMessages): 2021-06-10 Chris Dumez Enable WebPage's release logging in ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=226510 Reviewed by Eric Carlson. Enable WebPage's release logging in ephemeral sessions. Our release logging doesn't contain anything sensitive and not having this logging makes it hard to debug issues in apps using ephemeral sessions. * WebProcess/ApplePay/WebPaymentCoordinator.cpp: * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::m_lastNavigationWasAppBound): (WebKit::WebPage::close): (WebKit::WebPage::freezeLayerTree): (WebKit::WebPage::unfreezeLayerTree): (WebKit::WebPage::layerVolatilityTimerFired): (WebKit::WebPage::markLayersVolatile): (WebKit::WebPage::cancelMarkLayersVolatile): (WebKit::WebPage::touchEventSync): (WebKit::WebPage::didReceivePolicyDecision): (WebKit::WebPage::setIsTakingSnapshotsForApplicationSuspension): (WebKit::WebPage::suspend): (WebKit::WebPage::resume): (WebKit::WebPage::runJavaScript): (WebKit::WebPage::runJavaScriptInFrameInScriptWorld): (WebKit::WebPage::updatePreferences): (WebKit::WebPage::registerURLSchemeHandler): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPositionInformation): 2021-06-10 Adrian Perez de Castro Non-unified build fixes, early May 2021 edition https://bugs.webkit.org/show_bug.cgi?id=226763 Unreviewed non-unified build fixes. * Shared/WebPageNetworkParameters.cpp: Add missing inclusion of the ArgumentCoders.h header. 2021-06-09 Megan Gardner Create SPI file for Synapse so external builds will work. https://bugs.webkit.org/show_bug.cgi?id=226844 Reviewed by Tim Horton. * Platform/spi/Cocoa/SynapseSPI.h: Added. * UIProcess/Cocoa/WebPageProxyCocoa.mm: * WebKit.xcodeproj/project.pbxproj: 2021-06-09 Michael Catanzaro [GTK] Duplicate WebKitWebView::show-option-menu confuses introspection, should use --warn-error when building gir https://bugs.webkit.org/show_bug.cgi?id=222985 Reviewed by Adrian Perez de Castro. WebKitWebView::show-option-menu has different parameters for GTK than it does for WPE. It seems g-ir-scanner is taking the WPE documentation and merging it with the GTK parameters. We can fix this by moving the introspection comment into platform-specific files. Additionally, let's use --warn-error to turn warnings into errors to prevent this from ever happening again, as we already do when generating introspection for JavaScriptCore. * PlatformGTK.cmake: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_class_init): * UIProcess/API/glib/WebKitWebViewPrivate.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (createShowOptionMenuSignal): * UIProcess/API/wpe/WebKitWebViewWPE.cpp: (createShowOptionMenuSignal): 2021-06-09 Peng Liu [iOS] UIDelegate::UIClient::fullscreenMayReturnToInline() is not called when a video exits fullscreen https://bugs.webkit.org/show_bug.cgi?id=226785 Reviewed by Eric Carlson. On iOS, `UIDelegate::UIClient::fullscreenMayReturnToInline()` is called when a video exits picture-in-picture, but not when a video exits fullscreen. This patch fixes that. We cannot add a regression test for this patch before fixing webkit.org/b/212654. * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: (WebKit::VideoFullscreenManagerProxy::exitFullscreen): 2021-06-09 Diego Pino Garcia [GTK] Do not depend on resources provided by the GNOME icon theme https://bugs.webkit.org/show_bug.cgi?id=186767 Reviewed by Adrian Perez de Castro. Covered by existing tests. * PlatformGTK.cmake: 2021-06-09 Alexander Mikhaylenko [GTK4] Add support for navigation gestures https://bugs.webkit.org/show_bug.cgi?id=212327 Reviewed by Michael Catanzaro. Make ViewSnapshotStore store GdkTexture instead of Cairo surfaces for GTK4. Split ViewSnapshotStoreGtk.cpp into GTK3 and GTK4 versions since they don't have much in common. When taking a view snapshot, render the web view into a texture. When starting a navigation gesture, create a render node from either the texture, or a fallback color, then render that instead of using Cairo. Implement the same dimming+shadow as in GTK3. This time don't bother with CSS, the approach we used in GTK3 doesn't work anymore, and since elements like scrollbars aren't themeable anyway it's not very important to preserve that. * SourcesGTK.txt: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseTakeViewSnapshot): * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp: (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): * UIProcess/ViewGestureController.h: * UIProcess/ViewSnapshotStore.cpp: (WebKit::ViewSnapshotStore::didAddImageToSnapshot): (WebKit::ViewSnapshotStore::willRemoveImageFromSnapshot): * UIProcess/ViewSnapshotStore.h: (WebKit::ViewSnapshot::estimatedImageSizeInBytes const): (WebKit::ViewSnapshot::texture const): (WebKit::ViewSnapshot::imageSizeInBytes const): Renamed to estimatedImageSizeInBytes(). * UIProcess/gtk/ViewGestureControllerGtk.cpp: (WebKit::ViewGestureController::beginSwipeGesture): (WebKit::ViewGestureController::snapshot): (WebKit::ViewGestureController::removeSwipeSnapshot): * UIProcess/gtk/ViewSnapshotStoreGtk3.cpp: Copied from Source/WebKit/UIProcess/gtk/ViewSnapshotStoreGtk.cpp. (WebKit::ViewSnapshot::create): (WebKit::ViewSnapshot::ViewSnapshot): (WebKit::ViewSnapshot::hasImage const): (WebKit::ViewSnapshot::clearImage): (WebKit::ViewSnapshot::estimatedImageSizeInBytes const): (WebKit::ViewSnapshot::size const): * UIProcess/gtk/ViewSnapshotStoreGtk4.cpp: Renamed from Source/WebKit/UIProcess/gtk/ViewSnapshotStoreGtk.cpp. (WebKit::ViewSnapshot::create): (WebKit::ViewSnapshot::ViewSnapshot): (WebKit::ViewSnapshot::hasImage const): (WebKit::ViewSnapshot::clearImage): (WebKit::ViewSnapshot::estimatedImageSizeInBytes const): (WebKit::ViewSnapshot::size const): 2021-06-09 Chris Dumez Rely on SQLiteDatabase::setMaximumSize() for quota management in LocalStorageDatabase https://bugs.webkit.org/show_bug.cgi?id=226788 Reviewed by Sihui Liu. Rely on SQLiteDatabase::setMaximumSize() for quota management in LocalStorageDatabase. It simplifies the code a bit. No new test, covered by storage/domstorage/quota.html that is still passing. * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::openDatabase): (WebKit::LocalStorageDatabase::removeItem): (WebKit::LocalStorageDatabase::setItem): (WebKit::LocalStorageDatabase::clear): * NetworkProcess/WebStorage/LocalStorageDatabase.h: 2021-06-08 Alex Christensen Move PrivacyStance code from WebKitAdditions https://bugs.webkit.org/show_bug.cgi?id=226774 Reviewed by Jer Noble. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toPrivacyStance): (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): 2021-06-08 Sam Weinig Adopt WTF::Span in SQLiteStatement https://bugs.webkit.org/show_bug.cgi?id=226773 Reviewed by Alex Christensen. * UIProcess/API/glib/IconDatabase.cpp: (WebKit::IconDatabase::addIcon): Adopt new bindBlob() signature. 2021-06-08 Jean-Yves Avenard MediaPlayerPrivateRemote::didLoadingProgress should not send synchronous message to GPU process https://bugs.webkit.org/show_bug.cgi?id=226761 rdar://78834312 Reviewed by Eric Carlson. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::didLoadingProgress): Forward call to the actual proxied MediaPlayer. * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: Make message async. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::didLoadingProgress const): This method should no longer ever be called, but is required as it's pure-virtual. (WebKit::MediaPlayerPrivateRemote::didLoadingProgressAsync const): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: Add new didLoadingProgressAsync method. 2021-06-08 Megan Gardner Upstream AppHighlight Observer code https://bugs.webkit.org/show_bug.cgi?id=226794 Reviewed by Tim Horton. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::appHighlightsVisibility): (WebKit::WebPageProxy::setUpHighlightsObserver): * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpAppHighlightMenusIfNeeded]): 2021-06-08 Wenson Hsieh [iOS] Safari tab pill should toggle visibility when tapping on article text on adventure.com https://bugs.webkit.org/show_bug.cgi?id=226775 rdar://78826820 Reviewed by Tim Horton and Devin Rousso. Adjust the meaningful click heuristic to account for click event listeners added to the document node. See below for more details. Test: fast/events/ios/non-meaningful-click-when-tapping-document.html * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::getPlatformEditorState const): (WebKit::isProbablyMeaningfulClick): Remove a check for whether or not the clicked node is an Element; this existed because the call to `rootViewBoundsForElement` below takes an Element rather than just a Node; however, this method doesn't do anything that requires an Element instead of a Node, so we can just remove the check and refactor these static methods to accept Nodes. This allows us to bail early if the clicked node is *either* the body or the document node, instead of just the body. (WebKit::WebPage::insertDroppedImagePlaceholders): (WebKit::elementBoundsInFrame): (WebKit::WebPage::rootViewBounds): (WebKit::WebPage::absoluteInteractionBounds): (WebKit::WebPage::rootViewInteractionBounds): Drive-by refactoring: drop the `-ForElement` suffixes on these helper methods, and additionally make them accept a Node instead of requiring an Element. This allows us to remove the `is()` check from the meaningful click heuristic above. Also deploy RefPtr in a few more places. (WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture): (WebKit::WebPage::focusedElementInformation): (WebKit::WebPage::rootViewBoundsForElement): Deleted. (WebKit::WebPage::absoluteInteractionBoundsForElement): Deleted. (WebKit::WebPage::rootViewInteractionBoundsForElement): Deleted. 2021-06-08 Devin Rousso [Payment Request] upstream new features https://bugs.webkit.org/show_bug.cgi?id=226740 Reviewed by Andy Estes. - recurring line items (`HAVE_PASSKIT_RECURRING_SUMMARY_ITEM` and `ENABLE_APPLE_PAY_RECURRING_LINE_ITEM`) - deferred line items (`HAVE_PASSKIT_DEFERRED_SUMMARY_ITEM` and `ENABLE_APPLE_PAY_DEFERRED_LINE_ITEM`) - estimated shipping dates (`HAVE_PASSKIT_SHIPPING_METHOD_DATE_COMPONENTS_RANGE` and `ENABLE_APPLE_PAY_SHIPPING_METHOD_DATE_COMPONENTS_RANGE`) - coupon code entry (`HAVE_PASSKIT_COUPON_CODE` and `ENABLE_APPLE_PAY_COUPON_CODE`) - shipped vs in-store pickup (`HAVE_PASSKIT_SHIPPING_CONTACT_EDITING_MODE` and `ENABLE_APPLE_PAY_SHIPPING_CONTACT_EDITING_MODE`) * Platform/cocoa/PaymentAuthorizationViewController.mm: (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didChangeCouponCode:handler:]): Added. * Platform/ios/PaymentAuthorizationController.mm: (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didChangeCouponCode:handler:]): Added. * Platform/cocoa/PaymentAuthorizationPresenter.h: * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toPKPaymentErrorCode): (WebKit::PaymentAuthorizationPresenter::completeCouponCodeChange): Renamed from `WebKit::PaymentAuthorizationPresenter::completePaymentMethodModeChange`. * Platform/cocoa/WKPaymentAuthorizationDelegate.h: * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: (-[WKPaymentAuthorizationDelegate completeCouponCodeChange:]): Added. (toDateComponents): Added. (toDateComponentsRange): Added. (toShippingMethod): (-[WKPaymentAuthorizationDelegate _didChangeCouponCode:completion:]): Added. Add plumbing from/to PassKit for coupon code changes. * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::completeCouponCodeChange): Renamed from `WebKit::WebPaymentCoordinatorProxy::completePaymentMethodModeChange`. (WebKit::WebPaymentCoordinatorProxy::presenterDidChangeCouponCode): Renamed from `WebKit::WebPaymentCoordinatorProxy::presenterDidChangePaymentMethodMode`. (WebKit::WebPaymentCoordinatorProxy::canBegin const): (WebKit::WebPaymentCoordinatorProxy::canCancel const): (WebKit::WebPaymentCoordinatorProxy::canCompletePayment const): (WebKit::WebPaymentCoordinatorProxy::canAbort const): * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::toNSDateComponents): Added. (WebKit::toPKDateComponentsRange): Added. (WebKit::toPKShippingMethod): (WebKit::toPKShippingContactEditingMode): Added. (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): (WebKit::WebPaymentCoordinatorProxy::platformCompleteCouponCodeChange): Renamed from `WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodModeChange`. Convert PassKit objects to/from WebCore objects. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * WebProcess/ApplePay/WebPaymentCoordinator.messages.in: * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::completeCouponCodeChange): Renamed from `WebKit::WebPaymentCoordinator::completePaymentMethodModeChange`. (WebKit::WebPaymentCoordinator::didChangeCouponCode): Renamed from `WebKit::WebPaymentCoordinator::didChangePaymentMethodMode`. Plumbing into/from WebCore. 2021-06-08 Truitt Savell Unreviewed, reverting r278609. Broke builds with a linker error. Reverted changeset: "Update libwebrtc to M92" https://bugs.webkit.org/show_bug.cgi?id=226494 https://commits.webkit.org/r278609 2021-06-08 Chris Dumez Reduce use of reinterpret_cast<> in the codebase https://bugs.webkit.org/show_bug.cgi?id=226743 Reviewed by Darin Adler. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered): * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::addDataCue): * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::fetchData): * NetworkProcess/cache/NetworkCacheDataCurl.cpp: (WebKit::NetworkCache::Data::apply const): * NetworkProcess/cache/NetworkCacheKey.cpp: (WebKit::NetworkCache::hashString): * NetworkProcess/soup/WebKitDirectoryInputStream.cpp: (webkitDirectoryInputStreamRead): * Platform/IPC/ArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::encode): * Shared/API/c/cf/WKStringCF.mm: (WKStringCopyCFString): * Shared/API/c/cf/WKURLCF.mm: (WKURLCopyCFURL): * Shared/ShareableResource.cpp: (WebKit::ShareableResource::wrapInSharedBuffer): * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::data const): * Shared/WebCompiledContentRuleList.cpp: (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const): * UIProcess/API/APIWebAuthenticationAssertionResponse.cpp: (API::WebAuthenticationAssertionResponse::userHandle const): * UIProcess/API/C/WKPage.cpp: (dataFrom): * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: (WebKit::RedirectSOAuthorizationSession::completeInternal): * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::sendWebInspectorEvent): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): (WebKit::WebSocketChannel::didReceiveText): * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: (WebKit::RTCDataChannelRemoteManager::sendData): (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData): * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::sendJavaScriptStream): 2021-06-08 Devin Rousso Require that callsites of `SnapshotOptions` specify a `PixelFormat` and `DestinationColorSpace` https://bugs.webkit.org/show_bug.cgi?id=226756 Reviewed by Sam Weinig. Don't wrap `PixelFormat` or `DestinationColorSpace` with `std::optional` as we want each callsite to explicity configure them. This makes it easier to find where values for each are used as there's no implicit behavior. No behavior change. Followup after r278565. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createSelectionSnapshot const): 2021-06-08 Jean-Yves Avenard [MSE] Rework handling of SourceBuffer's buffer full. https://bugs.webkit.org/show_bug.cgi?id=226711 Reviewed by Jer Noble. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::evictCodedFrames): (WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: Remove capacity and buffer full references from all methods; relying on the totalTrackBufferSizeInBytes instead. * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::evictCodedFrames): (WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: 2021-06-08 Carlos Garcia Campos Unreviewed. Update OptionsGTK.cmake and NEWS for 2.33.2 release * gtk/NEWS: Add release notes for 2.33.2. 2021-06-08 Carlos Garcia Campos [SOUP] Several timing tests failing since r278477 https://bugs.webkit.org/show_bug.cgi?id=226728 Reviewed by Michael Catanzaro. responseBodyBytesReceived and responseBodyDecodedSize are expected to be always filled, and not only when shouldCaptureExtraNetworkLoadMetrics() returns true. Fixes: imported/w3c/web-platform-tests/navigation-timing/test_document_onload.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values.html imported/w3c/web-platform-tests/resource-timing/cors-preflight.any.worker.html * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::createRequest): 2021-06-08 Carlos Garcia Campos REGRESSION(r278391): [SOUP] Test fast/dom/webtiming.html is failing https://bugs.webkit.org/show_bug.cgi?id=226726 Reviewed by Michael Catanzaro. We need to set network metrics on response even for non HTTP loads now. Fixes fast/dom/webtiming.html * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::resume): (WebKit::NetworkDataTaskSoup::didSendRequest): (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): 2021-06-07 Alex Christensen Adopt SecTrustGetCertificateAtIndex replacement where available https://bugs.webkit.org/show_bug.cgi?id=225893 Reviewed by Chris Dumez. * Shared/mac/WebCoreArgumentCodersMac.mm: (IPC::encodeNSError): * UIProcess/Authentication/mac/WebCredentialMac.mm: (WebKit::leafCertificate): (WebKit::chain): (WebKit::WebCredential::WebCredential): 2021-06-07 Alexey Shvayka Unreviewed, reland r276592 with a fix for put() override in prototype chain of a JSProxy https://bugs.webkit.org/show_bug.cgi?id=226185 * WebProcess/Plugins/Netscape/JSNPObject.h: 2021-06-07 Wenson Hsieh Upstream WebKit support for Live Text https://bugs.webkit.org/show_bug.cgi?id=226706 Reviewed by Tim Horton. See WebCore/ChangeLog for more details. * Platform/cocoa/ImageExtractionUtilities.mm: Removed. * Platform/cocoa/TextRecognitionUtilities.h: Renamed from Source/WebKit/Platform/cocoa/ImageExtractionUtilities.h. * Platform/cocoa/TextRecognitionUtilities.mm: Added. Rename ImageExtractionUtilities to TextRecognitionUtilities. (WebKit::floatQuad): (WebKit::floatQuads): (WebKit::makeTextRecognitionResult): (WebKit::isLiveTextEnabled): * Shared/API/c/WKSharedAPICast.h: (WebKit::toAPI): (WebKit::toImpl): * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder::encodePlatformData): (IPC::ArgumentCoder::decodePlatformData): (IPC::ArgumentCoder::encodePlatformData): Deleted. (IPC::ArgumentCoder::decodePlatformData): Deleted. * Shared/TextRecognitionUpdateResult.h: Renamed from Source/WebKit/Shared/ImageExtractionUpdateResult.h. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): (IPC::ArgumentCoder::encode): Deleted. (IPC::ArgumentCoder::decode): Deleted. * Shared/WebCoreArgumentCoders.h: * SourcesCocoa.txt: * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction _elementActionWithType:customTitle:assistant:]): (+[_WKElementAction imageForElementActionType:]): Note that we need to keep the _WKElementActionTypeRevealImage SPI symbol, to avoid breaking MobileMail. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::handleContextMenuLookUpImage): (WebKit::WebPageProxy::handleContextMenuRevealImage): Deleted. Rename `handleContextMenuRevealImage` to `handleContextMenuLookUpImage`. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::ensureImageAnalyzer): (WebKit::createImageAnalysisRequest): (WebKit::WebViewImpl::requestTextRecognition): (WebKit::WebViewImpl::computeHasVisualSearchResults): Rename `computeCanRevealImage` to `computeHasVisualSearchResults`. (WebKit::WebViewImpl::acceptsPreviewPanelControl): * UIProcess/PageClient.h: (WebKit::PageClient::requestTextRecognition): (WebKit::PageClient::computeHasVisualSearchResults): (WebKit::PageClient::requestImageExtraction): Deleted. (WebKit::PageClient::computeCanRevealImage): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::contextMenuItemSelected): (WebKit::WebPageProxy::requestTextRecognition): (WebKit::WebPageProxy::computeHasVisualSearchResults): (WebKit::WebPageProxy::updateWithTextRecognitionResult): (WebKit::WebPageProxy::requestImageExtraction): Deleted. (WebKit::WebPageProxy::computeCanRevealImage): Deleted. (WebKit::WebPageProxy::updateWithImageExtractionResult): Deleted. Rename `updateWithImageExtractionResult` to `updateWithTextRecognitionResult`. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::requestTextRecognition): (WebKit::PageClientImpl::requestImageExtraction): Deleted. Rename `requestImageExtraction` to `requestTextRecognition`. * UIProcess/ios/WKActionSheetAssistant.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant defaultActionsForLinkSheet:]): (-[WKActionSheetAssistant defaultActionsForImageSheet:]): (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView cleanUpInteraction]): (-[WKContentView deferringGestures]): (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): (-[WKContentView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]): (-[WKContentView gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:]): (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): (-[WKContentView canPerformActionForWebView:withSender:]): (-[WKContentView targetForAction:withSender:]): (-[WKContentView _didStartProvisionalLoadForMainFrame]): (-[WKContentView shouldDeferGestureDueToImageAnalysis:]): (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]): (-[WKContentView _dragInteraction:prepareForSession:completion:]): (-[WKContentView _endImageAnalysisGestureDeferral:]): (-[WKContentView _doAfterPendingImageAnalysis:]): (-[WKContentView _invokeAllActionsToPerformAfterPendingImageAnalysis:]): (-[WKContentView presentVisualSearchPreviewControllerForImage:imageURL:title:imageBounds:appearanceActions:]): (-[WKContentView previewController:frameForPreviewItem:inSourceView:]): (-[WKContentView previewController:transitionImageForPreviewItem:contentRect:]): (-[WKContentView previewControllerDidDismiss:]): (-[WKContentView numberOfPreviewItemsInPreviewController:]): (-[WKContentView previewController:previewItemAtIndex:]): (-[WKContentView provideDataForItem:]): (-[WKContentView actionSheetAssistant:shouldIncludeShowTextActionForElement:]): (-[WKContentView actionSheetAssistant:showTextForImage:imageURL:title:imageBounds:]): (-[WKContentView actionSheetAssistant:shouldIncludeLookUpImageActionForElement:]): (-[WKContentView actionSheetAssistant:lookUpImage:imageURL:title:imageBounds:]): (-[WKContentView imageAnalyzer]): (-[WKContentView hasPendingImageAnalysisRequest]): (-[WKContentView _setUpImageAnalysis]): (-[WKContentView _tearDownImageAnalysis]): (-[WKContentView _cancelImageAnalysis]): (-[WKContentView createImageAnalysisRequest:image:imageURL:]): (-[WKContentView createImageAnalysisRequest:image:]): (-[WKContentView validateImageAnalysisRequestIdentifier:]): (-[WKContentView requestTextRecognition:imageData:completionHandler:]): (-[WKContentView imageAnalysisGestureDidBegin:]): (-[WKContentView imageAnalysisGestureDidFail:]): (-[WKContentView imageAnalysisGestureDidTimeOut:]): (-[WKContentView _insertTextFromCameraForWebView:]): (-[WKContentView captureTextFromCameraForWebView:]): (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]): (-[WKContentView continueContextMenuInteraction:]): (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): (-[WKContentView shouldDeferGestureDueToImageExtraction:]): Deleted. (-[WKContentView _endImageExtractionGestureDeferral:]): Deleted. (-[WKContentView _doAfterPendingImageExtraction:]): Deleted. (-[WKContentView _invokeAllActionsToPerformAfterPendingImageExtraction:]): Deleted. * UIProcess/ios/WKImageAnalysisGestureRecognizer.h: Renamed from Source/WebKit/UIProcess/ios/WKImageExtractionGestureRecognizer.h. * UIProcess/ios/WKImageAnalysisGestureRecognizer.mm: Renamed from Source/WebKit/UIProcess/ios/WKImageExtractionGestureRecognizer.mm. (-[WKImageAnalysisGestureRecognizer initWithImageAnalysisGestureDelegate:]): (-[WKImageAnalysisGestureRecognizer setState:]): Rename WKImageExtractionGestureRecognizer to WKImageAnalysisGestureRecognizer (along with all adjacent classes). * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::requestTextRecognition): (WebKit::PageClientImpl::computeHasVisualSearchResults): (WebKit::PageClientImpl::requestImageExtraction): Deleted. (WebKit::PageClientImpl::computeCanRevealImage): Deleted. * UIProcess/mac/WKVisualSearchPreviewController.h: Renamed from Source/WebKit/UIProcess/mac/WKImageExtractionPreviewController.h. * UIProcess/mac/WKVisualSearchPreviewController.mm: Renamed from Source/WebKit/UIProcess/mac/WKImageExtractionPreviewController.mm. (-[WKVisualSearchPreviewController initWithPage:imageData:title:imageURL:]): (-[WKVisualSearchPreviewController beginControl:]): (-[WKVisualSearchPreviewController endControl:]): (-[WKVisualSearchPreviewController closePanelIfNecessary]): (-[WKVisualSearchPreviewController isControlling:]): (-[WKVisualSearchPreviewController provideDataForItem:]): (-[WKVisualSearchPreviewController numberOfPreviewItemsInPreviewPanel:]): (-[WKVisualSearchPreviewController previewPanel:previewItemAtIndex:]): (-[WKVisualSearchPreviewController previewPanel:initialActivityForItem:]): Rename `WKImageExtractionPreviewController` to `WKVisualSearchPreviewController`. * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::menuItemIdentifier): (WebKit::WebContextMenuProxyMac::getContextMenuFromItems): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::beginPreviewPanelControl): (WebKit::WebPageProxy::endPreviewPanelControl): (WebKit::WebPageProxy::closeSharedPreviewPanelIfNecessary): (WebKit::WebPageProxy::showImageInVisualSearchPreviewPanel): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::requestTextRecognition): (WebKit::WebChromeClient::requestImageExtraction): Deleted. * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): (WebKit::WebPage::requestTextRecognition): (WebKit::WebPage::updateWithTextRecognitionResult): (WebKit::WebPage::requestImageExtraction): Deleted. (WebKit::WebPage::updateWithImageExtractionResult): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2021-06-07 Devin Rousso Convert WebCore::SnapshotOptions into an enum class https://bugs.webkit.org/show_bug.cgi?id=226730 Reviewed by Wenson Hsieh. Convert `SnapshotOptions` into an `enum class SnapshotFlags` and create a container `struct SnapshotOptions` that also allows for changing the `DestinationColorSpace` (defaults to sRGB) and `PixelFormat` (defaults to BGRA8). No behavior change. * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::createSelectionSnapshot const): 2021-06-07 Wenson Hsieh [Cocoa] Find-in-page should match text inside image overlays https://bugs.webkit.org/show_bug.cgi?id=226704 Reviewed by Tim Horton. Add the `PaintAllContent` and `PaintBackgrounds` text indicator options when generating a TextIndicator for selected content inside an image overlay. See WebCore/ChangeLog for more details. * WebProcess/WebPage/FindController.cpp: (WebKit::FindController::updateFindIndicator): * WebProcess/WebPage/ios/FindControllerIOS.mm: (WebKit::findTextIndicatorOptions): (WebKit::FindIndicatorOverlayClientIOS::drawRect): (WebKit::FindController::updateFindIndicator): 2021-06-07 Aditya Keerthi [iOS] Unexpected scrolling when switching focus from a text input to a select element https://bugs.webkit.org/show_bug.cgi?id=226657 Reviewed by Tim Horton. When switching focus from a text input to a select element, UIKit makes deferred calls to `-[WKWebView inputView]` after the keyboard dismissal. This method calls `-[WKContentView inputViewForWebView]`, which calls `-[WKContentView _zoomToRevealFocusedElement]`. Consequently, these methods can get invoked while the context menu (dropdown) is displayed for a focused select element. In this instance, the call should be idempotent, since the focused element is fully visible in the viewport. However, since the context menu is visible and overlaps the element, our logic incorrectly determines that the element is obscured, leading to unexpected zooming/scrolling. To fix, we need to correct the logic that determines the visible portion of the view. Test: fast/forms/ios/form-control-refresh/select/focus-select-after-textfield.html * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Always use the window to determine the portion of the webview that is visible, rather than relying on the root view controller's top-most full-screen view controller's view. The old logic worked fine in most cases, since the root view controller and the top-most full-screen view controller are almost always the same. Furthermore, the root view controller's view usually takes up the entire window. However, when the context menu is on screen, the top-most full-screen view controller is an internal UIKit view controller (_UIContextMenuActionsOnlyViewController), and the associated view is the context menu view. This exposed a flaw in the existing logic, as visibility detection could be performed by intersecting with an incorrect view. In general, the top-most full-screen view is not a reliable way to determine the visible portion of the webview. 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-06-06 Commit Queue Unreviewed, reverting r277464. https://bugs.webkit.org/show_bug.cgi?id=226709 No longer necessary Reverted changeset: "Work around WebCore failing to build due to NDEBUG getting undefined in release" https://bugs.webkit.org/show_bug.cgi?id=225782 https://trac.webkit.org/changeset/277464 2021-06-06 Wenson Hsieh Turn TextIteratorBehaviorFlag into an enum class and wrap it in OptionSet https://bugs.webkit.org/show_bug.cgi?id=226691 Reviewed by Darin Adler. See WebCore/ChangeLog for more information. * WebProcess/WebPage/ViewGestureGeometryCollector.cpp: (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::plainTextForDisplay): (WebKit::rangeNearPositionMatchesText): 2021-06-06 Jean-Yves Avenard [GPUP][MSE] QuotaExceededError Exception not thrown even if the sum of totalTrackBufferSize and appendBuffer size exceeds maximumBufferSize https://bugs.webkit.org/show_bug.cgi?id=226034 rdar://78579904 Reviewed by Eric Carlson. Cache the size of the remote source buffer's track size. We pass an extra totalTrackBufferSizeInBytes argument to each method that could impact a source buffer size. * GPUProcess/media/RemoteSourceBufferProxy.cpp: (WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete): (WebKit::RemoteSourceBufferProxy::removeCodedFrames): (WebKit::RemoteSourceBufferProxy::evictCodedFrames): * GPUProcess/media/RemoteSourceBufferProxy.h: * GPUProcess/media/RemoteSourceBufferProxy.messages.in: * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp: (WebKit::SourceBufferPrivateRemote::abort): Add comment explaining on why getting an up to date totalTrackBufferSizeInBytes isn't necessary at this point. (WebKit::SourceBufferPrivateRemote::removeCodedFrames): (WebKit::SourceBufferPrivateRemote::evictCodedFrames): (WebKit::SourceBufferPrivateRemote::clearTrackBuffers): (WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendComplete): (WebKit::SourceBufferPrivateRemote::totalTrackBufferSizeInBytes const): * WebProcess/GPU/media/SourceBufferPrivateRemote.h: * WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in: 2021-06-06 David Kilzer Weak external symbols found in WebKit.framework with Release+Coverage configuration Reviewed by Darin Adler. * Configurations/WebKit.xcconfig: (UNEXPORTED_SYMBOL_LDFLAGS): - Remove std::function<> symbols as those were replaced by WTF::Function<> a while ago. * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::determineITPStateInternal): (WebKit::doesParentProcessHaveITPEnabled): - Switch to use TCCSoftLink.h. * Shared/Cocoa/TCCSoftLink.h: Add. * Shared/Cocoa/TCCSoftLink.mm: Add. - Implement a single place for soft-linking to TCC.framework. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::getProcessIdentifier): - Change ProcessIdentifier to WebCore::ProcessIdentifier to fix the build since this source file no longer gets `using namespace WebCore;` from another source file after changes to SourcesCocoa.txt. * SourcesCocoa.txt: - Add DefaultWebBrowserChecks.mm since it no longer contains any SOFT_LINK macros. - Add new TCCSoftLink.mm file. * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::checkUsageDescriptionStringForType): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: (WebKit::WebProcessProxy::isAXAuthenticated): * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant defaultActionsForLinkSheet:]): (-[WKActionSheetAssistant defaultActionsForImageSheet:]): - Switch to use TCCSoftLink.h. * WebKit.xcodeproj/project.pbxproj: - Add TCCSoftLink.{h,mm} to the project. - Remove DefaultWebBrowserChecks.mm from the WebKit.framework target after adding it to SourcesCocoa.txt. 2021-06-05 Chris Dumez Use `const uint8_t*` type more consistently to store bytes in WebKit https://bugs.webkit.org/show_bug.cgi?id=226688 Reviewed by Darin Adler. * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::parseWebVTTCueData): * GPUProcess/media/RemoteTextTrackProxy.h: * WebProcess/GPU/media/TextTrackPrivateRemote.cpp: (WebKit::TextTrackPrivateRemote::parseWebVTTCueData): 2021-06-05 Wenson Hsieh [macOS] Dictionary lookup highlights in image overlays should include background content https://bugs.webkit.org/show_bug.cgi?id=226686 Reviewed by Tim Horton. Make a few minor adjustments to text indicator options on macOS when triggering Look Up. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::dictionaryPopupInfoForRange): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::performImmediateActionHitTestAtLocation): Add both `PaintAllContent` and `PaintBackgrounds` options when creating text indicators, in the case where the indicated range is inside an image overlay. 2021-06-05 Wenson Hsieh [macOS] Move DataDetectors softlinking in DataDetectorsSPI.h out into a separate PAL header https://bugs.webkit.org/show_bug.cgi?id=226669 Reviewed by Sam Weinig. Adopt the new PAL softlinking header in a few places. See WebCore/ChangeLog for more details. Additionally, move several softlinking header imports so that they're the last imported headers in a few sources. * Platform/mac/MenuUtilities.mm: (WebKit::actionForMenuItem): (WebKit::menuItemForTelephoneNumber): * Shared/Cocoa/DataDetectionResult.mm: (WebKit::DataDetectionResult::decode): * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::decode): * Shared/mac/WebHitTestResultData.mm: (WebKit::WebHitTestResultData::platformDecode): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly): * UIProcess/mac/WKImmediateActionController.mm: (-[WKImmediateActionController _clearImmediateActionState]): (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]): (-[WKImmediateActionController _animationControllerForDataDetectedText]): (-[WKImmediateActionController _animationControllerForDataDetectedLink]): 2021-06-04 Chris Dumez Optimize a few call sites creating SharedBuffer objects https://bugs.webkit.org/show_bug.cgi?id=226674 Reviewed by Darin Adler. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadDataInFrame): (WebKit::WebPage::loadData): (WebKit::WebPage::loadAlternateHTML): (WebKit::WebPage::loadSimulatedRequestAndResponse): 2021-06-04 Chris Dumez FileSystem::readFromFile() should return data as `void*` https://bugs.webkit.org/show_bug.cgi?id=226671 Reviewed by Darin Adler. FileSystem::readFromFile() should return data as `void*` instead of `char*`. This is more flexible and consistent with FileSystem::writeToFile(). * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp: (WebKit::NetworkCache::IOChannel::read): * Shared/PersistencyUtils.cpp: (WebKit::createForFile): 2021-06-04 Alex Christensen REGRESSION(r275765) When ignoring HSTS, sometimes loads fail https://bugs.webkit.org/show_bug.cgi?id=226670 Reviewed by Chris Dumez. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (setIgnoreHSTS): Use the value passed in to the function instead of always false. 2021-06-04 Chris Dumez Use Vector instead of Vector to store bytes in SharedBuffer https://bugs.webkit.org/show_bug.cgi?id=226623 Reviewed by Darin Adler. Use Vector instead of Vector to store bytes in SharedBuffer. Also have SharedBuffer::data() return a `const uint8_t*` instead of `const char*`. This is our preferred type to store bytes. * Platform/IPC/SharedBufferCopy.h: (IPC::SharedBufferCopy::data const): * PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::streamDidReceiveData): (WebKit::PluginControllerProxy::manualStreamDidReceiveData): * Shared/PersistencyUtils.cpp: (WebKit::writeToDisk): * Shared/WebCoreArgumentCoders.cpp: (IPC::tryConvertToShareableResourceHandle): * UIProcess/WebURLSchemeTask.cpp: (WebKit::WebURLSchemeTask::didComplete): * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::didReceiveData): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: (WebKit::RTCDataChannelRemoteManager::sendData): (WebKit::RTCDataChannelRemoteManager::receiveData): (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveRawData): * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.h: * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: (WebKit::parsePostBuffer): * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::streamDidReceiveData): (WebKit::NetscapePlugin::manualStreamDidReceiveData): * WebProcess/Plugins/Netscape/NetscapePlugin.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::didReceiveData): (WebKit::NetscapePluginStream::sendJavaScriptStream): (WebKit::NetscapePluginStream::deliverData): (WebKit::NetscapePluginStream::deliverDataToFile): * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/Plugins/PDF/PDFPlugin.h: * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::PDFPluginStreamLoaderClient::didReceiveData): (WebKit::PDFPlugin::streamDidReceiveData): (WebKit::PDFPlugin::manualStreamDidReceiveData): * WebProcess/Plugins/Plugin.h: * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::streamDidReceiveData): (WebKit::PluginProxy::manualStreamDidReceiveData): * WebProcess/Plugins/PluginProxy.h: * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::Stream::didReceiveData): (WebKit::PluginView::manualLoadDidReceiveData): * WebProcess/Plugins/PluginView.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::committedLoad): * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: (WebKit::WebPlatformStrategies::bufferForType): 2021-06-04 Wenson Hsieh [iOS] Meaningful click heuristic should account for media state changes https://bugs.webkit.org/show_bug.cgi?id=226655 rdar://78330664 Reviewed by Tim Horton and Devin Rousso. Teach the "meaningful click" heuristic about changes to media element state flags. See comments below for more details. Test: fast/events/ios/meaningful-click-when-playing-media.html * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::isPlayingMediaDidChange): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::isPlayingMediaDidChange): Refactor some logic here so that the WebChromeClient calls into WebPage, which then sends an IPC message to the UI process and additionally calls into a private method for platform-specific logic (see WebPageIOS.mm). * WebProcess/WebPage/WebPage.h: Replace `m_didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick` with another flag, `m_currentSyntheticClickMayNotBeMeaningful`, that is initially set to `true` at the beginning of `WebPage::completeSyntheticClick`, and consulted after the events have been dispatched to see if anything has set it to `false` (currently, this includes only playing media state changes and handled click events by the page). If the flag is set to `false`, we then consider the click to have been "meaningful", with respect to the `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` UI delegate method. (WebKit::WebPage::platformIsPlayingMediaDidChange): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::completeSyntheticClick): (WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent): (WebKit::WebPage::platformIsPlayingMediaDidChange): Make these set `m_currentSyntheticClickMayNotBeMeaningful` to `false`. 2021-06-04 Ryosuke Niwa Store MediaPlayer using WeakPtr in MediaPlayerPrivateRemote https://bugs.webkit.org/show_bug.cgi?id=224421 Unreviewed. Address Darin's post commit commnet. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::load): (WebKit::MediaPlayerPrivateRemote::networkStateChanged): (WebKit::MediaPlayerPrivateRemote::setReadyState): (WebKit::MediaPlayerPrivateRemote::readyStateChanged): (WebKit::MediaPlayerPrivateRemote::volumeChanged): (WebKit::MediaPlayerPrivateRemote::muteChanged): (WebKit::MediaPlayerPrivateRemote::timeChanged): (WebKit::MediaPlayerPrivateRemote::durationChanged): (WebKit::MediaPlayerPrivateRemote::rateChanged): (WebKit::MediaPlayerPrivateRemote::playbackStateChanged): (WebKit::MediaPlayerPrivateRemote::engineFailedToLoad): (WebKit::MediaPlayerPrivateRemote::characteristicChanged): (WebKit::MediaPlayerPrivateRemote::sizeChanged): (WebKit::MediaPlayerPrivateRemote::firstVideoFrameAvailable): (WebKit::MediaPlayerPrivateRemote::renderingModeChanged): (WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged): (WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack): (WebKit::MediaPlayerPrivateRemote::removeRemoteAudioTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack): (WebKit::MediaPlayerPrivateRemote::removeRemoteTextTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack): (WebKit::MediaPlayerPrivateRemote::removeRemoteVideoTrack): (WebKit::MediaPlayerPrivateRemote::currentPlaybackTargetIsWirelessChanged): (WebKit::MediaPlayerPrivateRemote::mediaPlayerKeyNeeded): (WebKit::MediaPlayerPrivateRemote::waitingForKeyChanged): (WebKit::MediaPlayerPrivateRemote::initializationDataEncountered): (WebKit::MediaPlayerPrivateRemote::resourceNotSupported): (WebKit::MediaPlayerPrivateRemote::activeSourceBuffersChanged): (WebKit::MediaPlayerPrivateRemote::getRawCookies const): 2021-06-04 Chris Dumez Flaky crash under UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy() on the bots https://bugs.webkit.org/show_bug.cgi?id=226653 Reviewed by Eric Carlson. The SourceProxy destructor was taking care of calling invalidate() on the SharedRingBufferStorage before destroying the CARingBuffer on the main thread, to avoid having SourceProxy::storageChanged() called in the middle of destruction. However, the background thread may still be running at this point and may reconstruct the RingBuffer right after the invalidate call, causing us to crash because storageChanged() still gets called in the middle on destruction. To address the issue, we now make sure to stop the rendering thread before we proceed with the destruction and invalidate the SharedRingBufferStorage's storage change handler. * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy): 2021-06-04 Ryosuke Niwa Store MediaPlayer using WeakPtr in MediaPlayerPrivateRemote https://bugs.webkit.org/show_bug.cgi?id=224421 Reviewed by Eric Carlson. Made MediaPlayerPrivateRemote::m_player a WeakPtr. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): (WebKit::MediaPlayerPrivateRemote::prepareForPlayback): (WebKit::MediaPlayerPrivateRemote::load): (WebKit::MediaPlayerPrivateRemote::networkStateChanged): (WebKit::MediaPlayerPrivateRemote::setReadyState): (WebKit::MediaPlayerPrivateRemote::readyStateChanged): (WebKit::MediaPlayerPrivateRemote::volumeChanged): (WebKit::MediaPlayerPrivateRemote::muteChanged): (WebKit::MediaPlayerPrivateRemote::timeChanged): (WebKit::MediaPlayerPrivateRemote::durationChanged): (WebKit::MediaPlayerPrivateRemote::rateChanged): (WebKit::MediaPlayerPrivateRemote::playbackStateChanged): (WebKit::MediaPlayerPrivateRemote::engineFailedToLoad): (WebKit::MediaPlayerPrivateRemote::characteristicChanged): (WebKit::MediaPlayerPrivateRemote::sizeChanged): (WebKit::MediaPlayerPrivateRemote::firstVideoFrameAvailable): (WebKit::MediaPlayerPrivateRemote::renderingModeChanged): (WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged): (WebKit::MediaPlayerPrivateRemote::addRemoteAudioTrack): (WebKit::MediaPlayerPrivateRemote::removeRemoteAudioTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteTextTrack): (WebKit::MediaPlayerPrivateRemote::removeRemoteTextTrack): (WebKit::MediaPlayerPrivateRemote::addRemoteVideoTrack): (WebKit::MediaPlayerPrivateRemote::removeRemoteVideoTrack): (WebKit::MediaPlayerPrivateRemote::currentPlaybackTargetIsWirelessChanged): (WebKit::MediaPlayerPrivateRemote::mediaPlayerKeyNeeded): (WebKit::MediaPlayerPrivateRemote::waitingForKeyChanged): (WebKit::MediaPlayerPrivateRemote::initializationDataEncountered): (WebKit::MediaPlayerPrivateRemote::resourceNotSupported): (WebKit::MediaPlayerPrivateRemote::activeSourceBuffersChanged): (WebKit::MediaPlayerPrivateRemote::getRawCookies const): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): 2021-06-04 Wenson Hsieh Remove the unused `sourceElementID` argument in `Document::updateIsPlayingMedia` and related code https://bugs.webkit.org/show_bug.cgi?id=226650 Reviewed by Chris Dumez. Remove more unused code. See WebCore/ChangeLog for more details. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::isPlayingMediaDidChange): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::isPlayingMediaDidChange): * WebProcess/WebCoreSupport/WebChromeClient.h: 2021-06-04 Alex Christensen Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize https://bugs.webkit.org/show_bug.cgi?id=226629 Reviewed by Brady Eidson. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): 2021-06-04 Alex Christensen Make attributedBundleIdendifier a property for WKWebViewConfiguration instead of _WKWebsiteDataStoreConfiguration https://bugs.webkit.org/show_bug.cgi?id=226548 Reviewed by Brady Eidson. We have been putting properties to go into the NSURLSessionConfiguration on the _WKWebsiteDataStoreConfiguration. This has been ok so far, but now we have an application that needs to run networking attributed to different applications but sharing the data storage in the same process. We now do what we should've done long ago: put these non-storage-related properties on the WKWebViewConfiguration. I introduce WebPageNetworkParameters which currently has only one member, but will soon have more. I made it so that if multiple WKWebViews with the same data store have the same attributedBundleIdendifier, they share an NSURLSession. Otherwise, they get their own NSURLSession in a different SessionSet. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::addWebPageNetworkParameters): (WebKit::NetworkProcess::removeWebPageNetworkParameters): (WebKit::NetworkProcess::countNonDefaultSessionSets): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::addWebPageNetworkParameters): (WebKit::NetworkSession::removeWebPageNetworkParameters): (WebKit::NetworkSession::countNonDefaultSessionSets const): * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::NetworkSessionCocoa::initializeNSURLSessionsInSet): (WebKit::NetworkSessionCocoa::SessionSet::initializeEphemeralStatelessSessionIfNeeded): (WebKit::NetworkSessionCocoa::addWebPageNetworkParameters): (WebKit::NetworkSessionCocoa::removeWebPageNetworkParameters): (WebKit::NetworkSessionCocoa::countNonDefaultSessionSets const): (WebKit::NetworkSessionCocoa::attributedBundleIdentifier const): Deleted. (WebKit::NetworkSessionCocoa::initializeStandardSessionsInSet): Deleted. * Shared/WebPageNetworkParameters.cpp: Added. (WebKit::WebPageNetworkParameters::encode const): (WebKit::WebPageNetworkParameters::decode): * Shared/WebPageNetworkParameters.h: Added. (WebKit::WebPageNetworkParameters::WebPageNetworkParameters): (WebKit::WebPageNetworkParameters::isHashTableDeletedValue const): (WebKit::WebPageNetworkParameters::hash const): (WebKit::WebPageNetworkParameters::operator== const): (WebKit::WebPageNetworkParameters::attributedBundleIdentifier const): (WTF::DefaultHash::hash): (WTF::DefaultHash::equal): * Sources.txt: * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::setAttributedBundleIdentifier): (API::PageConfiguration::attributedBundleIdentifier const): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _setAttributedBundleIdentifier:]): (-[WKWebViewConfiguration _attributedBundleIdentifier]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _countNonDefaultSessionSets:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration setAttributedBundleIdentifier:]): Deleted. (-[_WKWebsiteDataStoreConfiguration attributedBundleIdentifier]): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::~WebPageProxy): (WebKit::WebPageProxy::initializeWebPage): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::countNonDefaultSessionSets): * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::setSourceApplicationSecondaryIdentifier): (WebKit::WebsiteDataStoreConfiguration::attributedBundleIdentifier const): Deleted. (WebKit::WebsiteDataStoreConfiguration::setAttributedBundleIdentifier): Deleted. * WebKit.xcodeproj/project.pbxproj: 2021-06-04 Chris Dumez Avoid wasteful large allocation in SpeechRecognitionRemoteRealtimeMediaSource::setStorage() https://bugs.webkit.org/show_bug.cgi?id=226644 Reviewed by Eric Carlson. Avoid wasteful large allocation in SpeechRecognitionRemoteRealtimeMediaSource::setStorage(). setStorage() was setting m_buffer's size to the same size as the RingBuffer (2*sampleRate), only to resize it to the size of the rendering quantum (512) later in SpeechRecognitionRemoteRealtimeMediaSource::remoteAudioSamplesAvailable(). * UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp: (WebKit::SpeechRecognitionRemoteRealtimeMediaSource::setStorage): 2021-06-04 Alex Christensen Pass NetworkLoadParameters to NetworkDataTaskCocoa constructor https://bugs.webkit.org/show_bug.cgi?id=226628 Reviewed by Sam Weinig. No change in behavior. Just pass a parameters object instead of splitting them into separate parameters. * NetworkProcess/NetworkActivityTracker.h: (WebKit::NetworkActivityTracker::getPlatformObject const): (WebKit::NetworkActivityTracker::getPlatformObject): Deleted. * NetworkProcess/NetworkDataTask.cpp: (WebKit::NetworkDataTask::create): * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): (WebKit::NetworkDataTaskCocoa::didReceiveResponse): 2021-06-04 Wenson Hsieh [iOS] Long pressing images on 9gag.com fails to present context menus https://bugs.webkit.org/show_bug.cgi?id=226625 rdar://78136095 Reviewed by Megan Gardner. Make some small adjustments to context menu logic to allow the context menu to appear when long pressing images that are inside links (anchor elements) with JavaScript URLs. See below for more details. Test: fast/events/touch/ios/long-press-on-image-in-javascript-link.html * UIProcess/ios/WKActionSheetAssistant.mm: (isJavaScriptURL): Pull logic that checks for "javascript" URL schemes into a separate helper function, and use it below. (-[WKActionSheetAssistant _createSheetWithElementActions:defaultTitle:showLinkTitle:]): (-[WKActionSheetAssistant defaultActionsForLinkSheet:]): (-[WKActionSheetAssistant defaultActionsForImageSheet:]): Add `_WKElementActionTypeCopy` for image sheets, even when the target URL is a JavaScript URL; even if the image is inside a JavaScript URL, we should be capable of triggering the "Copy" action by copying the image data and the image URL, rather than the JavaScript URL. The change in `WebPage::performActionOnElement` below ensures that we don't end up copying the JavaScript URL. (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]): Make another minor adjustment to share the imageURL instead of the target URL in the case where the target is a JavaScript URL. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView continueContextMenuInteraction:]): Avoid bailing early with `continueWithContextMenuConfiguration(nil);` in the case where we're long pressing an image inside a JavaScript link. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::performActionOnElement): Push the JavaScript URL check in `defaultActionsForImageSheet` down into `WebPage::performActionOnElement`, when copying an image. This tweak allows us to still show the Copy action for images in JavaScript URLs, but just copy the image and image URL instead of the JavaScript URL. 2021-06-04 Michael Catanzaro Fix more GCC warnings https://bugs.webkit.org/show_bug.cgi?id=226193 Reviewed by Adrian Perez de Castro. Remove redundant WTFMove that's triggering GCC's -Wredundant-move. * Platform/IPC/ArgumentCoder.h: (IPC::ArgumentCoder::decode): 2021-06-04 Jan-Michael Brummer [GTK][WPE] Expose setCORSDisablingPatterns https://bugs.webkit.org/show_bug.cgi?id=219995 Reviewed by Carlos Garcia Campos. * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_set_cors_allowlist): * UIProcess/API/gtk/WebKitWebView.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebView.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: 2021-06-03 Sihui Liu Make WebIDBServer use WorkQueue instead of Thread https://bugs.webkit.org/show_bug.cgi?id=226589 Reviewed by Chris Dumez. This matches other storage manager classes and makes management of thread lifetime much easier. We used to destroy WebIDBServer aggressively (when there is no connection or task left) to ensure thread of WebIDBServer does not stay around idly, and that led us to create new WebIDBServer for new task right after destroying WebIDBServer and before databases are properly closed in some cases, which can caused issues like database is locked during new task. With WorkQueue, we don't need to manage the threads, and we can close WebIDBServer when session is destroyed. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::create): (WebKit::WebIDBServer::WebIDBServer): (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::getOrigins): (WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince): (WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins): (WebKit::WebIDBServer::renameOrigin): (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::postTask): (WebKit::WebIDBServer::postTaskReply): (WebKit::WebIDBServer::close): (WebKit::m_closeCallback): Deleted. (WebKit::WebIDBServer::dispatchToThread): Deleted. (WebKit::WebIDBServer::tryClose): Deleted. * NetworkProcess/IndexedDB/WebIDBServer.h: * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::didClose): (WebKit::NetworkProcess::destroySession): (WebKit::NetworkProcess::createWebIDBServer): 2021-06-03 Chris Dumez stopMakingViewBlankDueToLackOfRenderingUpdate logging shows even if we never made the view blank https://bugs.webkit.org/show_bug.cgi?id=226616 Reviewed by Tim Horton. stopMakingViewBlankDueToLackOfRenderingUpdate logging was showing even if we never made the view blank. This was confusing so this fix makes the logging conditional. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): (WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate): (WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit): * UIProcess/WebPageProxy.h: 2021-06-03 Chris Dumez Fix thread safety issues in [WKShareSheet presentWithParameters] https://bugs.webkit.org/show_bug.cgi?id=226611 Reviewed by Ryosuke Niwa. The code in [WKShareSheet presentWithParameters] was passing WebCore::RawFile objects to another thread. This wasn't safe since WebCore::RawFile contains a WTF::String and a SharedBuffer, both of which are not thread safe. Fix this by creating an isolated copy of the fileName String and converting the SharedBuffer to a NSData before passing them to the background thread. Also rewrite the code from ObjC to C++ because I felt it was clearer and less error-prone. * UIProcess/Cocoa/WKShareSheet.mm: (appendFilesAsShareableURLs): (-[WKShareSheet presentWithParameters:inRect:completionHandler:]): 2021-06-03 Matt Mokary Add a way to specify origin and destination of app highlight https://bugs.webkit.org/show_bug.cgi?id=226607 Reviewed by Megan Gardner. Expose a method for adding app highlights which allows the caller to specify origin and destination of the new highlight. Update the existing method, which specifies originatedInApp: true, newGroup: false, to use this new method. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _addAppHighlight]): (-[WKWebView _addAppHighlightInNewGroup:originatedInApp:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: 2021-06-03 Jean-Yves Avenard Add MediaSessionCoordinator test to ensure that disconnection on the private side is properly handled. https://bugs.webkit.org/show_bug.cgi?id=226568 rdar://problem/78801408 Reviewed by Eric Carlson. * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]): Carry on required change as coordinatorStateChanged is now pure virtual. (-[WKMediaSessionCoordinatorHelper coordinatorStateChanged:]): 2021-06-03 Chris Dumez [Hardening] Stop storing raw pointers inside WebIDBServer::m_connections https://bugs.webkit.org/show_bug.cgi?id=226595 Reviewed by Ryosuke Niwa. Stop storing raw pointers inside WebIDBServer::m_connections and use a WeakHashSet instead. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::addConnection): (WebKit::WebIDBServer::removeConnection): (WebKit::WebIDBServer::close): (WebKit::WebIDBServer::tryClose): * NetworkProcess/IndexedDB/WebIDBServer.h: * Platform/IPC/Connection.h: 2021-06-03 Chris Dumez Move protector earlier in NetworkProcessProxy::networkProcessDidTerminate() https://bugs.webkit.org/show_bug.cgi?id=226594 Reviewed by Geoffrey Garen. Move protector earlier in NetworkProcessProxy::networkProcessDidTerminate() as it seems unsafe to do some of the earlier operations before protected |this|. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::networkProcessDidTerminate): 2021-06-03 Chris Dumez Stop storing Ref in RTCDataChannelRemoteManagerProxy::m_webProcessConnections https://bugs.webkit.org/show_bug.cgi?id=226596 Reviewed by Eric Carlson. Stop storing Ref in RTCDataChannelRemoteManagerProxy::m_webProcessConnections. Keeping the IPC::Connection alive always carries the chance of leaking if we fail to properly clear the HashMap. We can simply store an IPC::Connection::UniqueID and use that ID to send the IPC on the background thread. * NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp: (WebKit::RTCDataChannelRemoteManagerProxy::registerConnectionToWebProcess): (WebKit::RTCDataChannelRemoteManagerProxy::sendData): (WebKit::RTCDataChannelRemoteManagerProxy::close): (WebKit::RTCDataChannelRemoteManagerProxy::changeReadyState): (WebKit::RTCDataChannelRemoteManagerProxy::receiveData): (WebKit::RTCDataChannelRemoteManagerProxy::detectError): (WebKit::RTCDataChannelRemoteManagerProxy::bufferedAmountIsDecreasing): * NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.h: 2021-06-03 Wenson Hsieh [macOS] Image extraction preview panel should automatically close when the web view is unparented https://bugs.webkit.org/show_bug.cgi?id=226588 rdar://77062762 Reviewed by Tim Horton. Refactor some logic for presenting the preview panel. See below for more details. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::handleProcessSwapOrExit): (WebKit::WebViewImpl::viewDidMoveToWindow): When the web view is removed from the view hierarchy (i.e. when the view is moved to a `nil` window), call into `closeSharedPreviewPanelIfNecessary` to dismiss the shared preview panel if we're currently controlling its presentation for the purposes of image extraction. (WebKit::WebViewImpl::beginPreviewPanelControl): (WebKit::WebViewImpl::endPreviewPanelControl): Add more plumbing into WebPageProxy to begin and end preview panel control; this allows us to avoid having to expose a separate method to reset WebPageProxy's `m_imageExtractionPreviewController` and call it from WebViewImpl. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): Additionally call into `closeSharedPreviewPanelIfNecessary` when committing main frame navigation. We also refactor a bit of logic here so that we fold several pieces of similar "reset" logic into a single if statement. * UIProcess/WebPageProxy.h: * UIProcess/mac/WKImageExtractionPreviewController.h: * UIProcess/mac/WKImageExtractionPreviewController.mm: (-[WKImageExtractionPreviewController beginControl:]): (-[WKImageExtractionPreviewController endControl:]): (-[WKImageExtractionPreviewController closePanelIfNecessary]): (-[WKImageExtractionPreviewController isControlling:]): Move logic for assigning, removing, and checking the QLPreviewPanel's `-delegate` and `-dataSource` into helper methods on WKImageExtractionPreviewController. Doing this allows us to consolidate more of the QuickLookUI- specific logic inside WKImageExtractionPreviewController and WebPageProxy, but also (and more importantly) prevents us from having to `#import ` inside `WebPageProxyMac.mm`, which results in nullability errors when calling into `-[NSApplication stopSpeaking:]`. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::beginPreviewPanelControl): (WebKit::WebPageProxy::endPreviewPanelControl): (WebKit::WebPageProxy::closeSharedPreviewPanelIfNecessary): 2021-06-03 Chris Fleizach AX: macOS WebContent can't read prefs from com.apple.Accessibility https://bugs.webkit.org/show_bug.cgi?id=226528 Reviewed by Per Arne Vollan. Some accessibility preferences on macOS use libAccessibility. WebContent should process these on iOS & macOS. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::setPreferenceValue): 2021-06-03 Chris Dumez StorageArea should be able to send its IPC directly from the background thread https://bugs.webkit.org/show_bug.cgi?id=226583 Reviewed by Alex Christensen. Update StorageArea so that it does its IPC sending straight from the storage thread, instead of hopping to the main thread to do so. * NetworkProcess/WebStorage/StorageArea.cpp: (WebKit::StorageArea::clear): (WebKit::StorageArea::dispatchEvents const): 2021-06-03 Carlos Garcia Campos [GLIB] imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse_mixed_content.html is failing since r277493 https://bugs.webkit.org/show_bug.cgi?id=225904 Reviewed by Michael Catanzaro. Set secureConnectionStart to WebCore::reusedTLSConnectionSentinel in case of reused TLS connection. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::didStartRequest): 2021-06-02 Rob Buis Split FillInlinePath/StrokeInlinePath https://bugs.webkit.org/show_bug.cgi?id=225687 Reviewed by Wenson Hsieh. Adjust to new display list item types. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::decodeItem): 2021-06-02 Chris Dumez Stop using a RefPtr as HashMap key in DisplayLink https://bugs.webkit.org/show_bug.cgi?id=226561 Reviewed by Simon Fraser. Stop using a RefPtr as HashMap key in DisplayLink. Using a RefPtr as key is suboptimal and could leak to memory leaks. The reason this needed a RefPtr was because we needed to send IPC from a background thread. To support this, I have added a static IPC::Connection::send() function that takes an IPC::Connection::UniqueID and that is thread safe. The function looks up the IPC::Connection from its UniqueID and sends the IPC while still holding the lock. As a result, DisplayLink can use IPC::Connection::UniqueID as key instead. Note that I am planning to use the new static IPC::Connection::send() in other cases where we could send IPC directly from a background thread instead of having to hop to the main thread to look up the IPC::Connection from its UniqueID. StorageArea::dispatchEvents() is an example of where this will be useful. * Platform/IPC/Connection.cpp: (IPC::Connection::Connection): (IPC::Connection::~Connection): * Platform/IPC/Connection.h: (IPC::Connection::send): * UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::addObserver): (WebKit::DisplayLink::removeObserver): (WebKit::DisplayLink::removeObservers): (WebKit::DisplayLink::removeInfoForConnectionIfPossible): (WebKit::DisplayLink::incrementFullSpeedRequestClientCount): (WebKit::DisplayLink::decrementFullSpeedRequestClientCount): (WebKit::DisplayLink::setPreferredFramesPerSecond): (WebKit::DisplayLink::notifyObserversDisplayWasRefreshed): * UIProcess/mac/DisplayLink.h: 2021-06-02 Wenson Hsieh [iOS] Show data detector context menu on long press inside image overlays https://bugs.webkit.org/show_bug.cgi?id=226559 Reviewed by Tim Horton. Add additional support for data detectors that appear inside image overlays on iOS. * Shared/ImageExtractionUpdateResult.h: Added. Turn the `bool` propagated back to the UI process when calling `updateWithImageExtractionResult` into a separate three-state enum instead; see changes below for more details. * Shared/ios/InteractionInformationAtPosition.h: * Shared/ios/InteractionInformationAtPosition.mm: (WebKit::InteractionInformationAtPosition::encode const): (WebKit::InteractionInformationAtPosition::decode): Make some minor adjustments to `InteractionInformationAtPosition`: - Add `dataDetectorBounds`, which determines the bounds in root view coordinates of the data detector result corresponding to the hit-tested element. - Encode and decode `dataDetectorResults`, even if `isDataDetectorLink` is `false`. Unless the data detector is inside an image overlay, this (effectively) has no impact, since `dataDetectorResults` was previously only set if `isDataDetectorLink` was true. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::updateWithImageExtractionResult): * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView dataDetectionContextForPositionInformation:]): Let `dataDetectorResults` take precedence over regular `bounds` when returning the context for the data detector menu configuration. (-[WKContentView positionInformationHasImageOverlayDataDetector]): Add a helper method that returns `YES` in the case where the currently cached position information object contains a text data detection result inside an image overlay. (-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]): Use `dataDetectorBounds` instead of `bounds` when creating a fallback targeted preview for a data detection result in an image overlay. (-[WKContentView continueContextMenuInteraction:]): (-[WKContentView continueContextMenuInteractionWithDataDetectors:]): Adjust these codepaths so that we'll continue through to the data detector case instead of bailing early in the case where both `isImageOverlayText` is set, and `dataDetectionResults` exist. * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::findDataDetectionResultElementInImageOverlay): Add a static helper to locate a data detector element underneath the given point, inside the given element's image overlay in the user agent shadow root. Note that we check each of the element's bounds instead of using a hit-test because we normally just hit-test to the text containers instead of the data detector containers. (WebKit::WebPage::updateWithImageExtractionResult): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::dataDetectorLinkPositionInformation): (WebKit::dataDetectorImageOverlayPositionInformation): Add a static helper function to populate the given `InteractionInformationAtPosition`, if it's over a data detection result inside an image overlay. (WebKit::elementPositionInformation): Call the above helper function. 2021-06-02 Alex Christensen Fix WPT test resource-timing/cross-origin-redirects.html https://bugs.webkit.org/show_bug.cgi?id=190523 Reviewed by Brady Eidson. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): (WebKit::NetworkDataTaskSoup::clearRequest): (WebKit::NetworkDataTaskSoup::resume): (WebKit::NetworkDataTaskSoup::didSendRequest): (WebKit::NetworkDataTaskSoup::dispatchDidCompleteWithError): (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): (WebKit::NetworkDataTaskSoup::networkEvent): (WebKit::NetworkDataTaskSoup::didStartRequest): (WebKit::NetworkDataTaskSoup::didRestart): 2021-06-02 Brent Fulgham [Cocoa] Clean up notification_center message filters https://bugs.webkit.org/show_bug.cgi?id=226555 Reviewed by Per Arne Vollan. We initially had two groups of mach-message-send filter rules for 'com.apple.system.notification_center' so we could collect telemetry on a group of messages. Now that we have removed all the messages we do not need, there is no reason to maintain two separate sets. This patch just combines the two sets into a single list so we can easily conditionalize it for different OS releases if needed. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2021-06-02 Jer Noble REGRESSION(r276993): 5 TestWebKitAPI.AudioRoutingArbitration (api-tests) are constant failures https://bugs.webkit.org/show_bug.cgi?id=226104 Reviewed by Eric Carlson. In r276993, AudioSessionRoutingArbitration was moved from being initiated in the WebContent process and dispatched to the UIProcess, to being dispatched to the GPU process. However two problems occurred: 1) The UIProcess no longer knows about routing arbitration, which is reasonable for the feature, but breaks an API test that queries arbitration status in the UIProcess. 2) A sandbox violation causes routing arbitration to fail in the GPU process regardless. We could open up the sandbox to allow routing arbitration to succeed (and come up with a way to push state changes up to the UIProcess for testing purposes), but it's not technically necessary for arbitration to occur there. Instead, just revert to the status-quo-ante behavior of having arbitration take place in the UIProcess, and just add a new set of messages from the GPUConnoctionToWebProcess to the GPUProcessConnection to facilitate arbitration. Drive-by fix: AudioSessionRoutingArbitrator is a supplement to WebProcess, and as such it's created at WebProcess creation time. However, it also causes an AudioSession to be created by attempting to add itself as a client. This is bad on iOS, where it could cause hangs due to AVAudioSession calls. So, add a mechanism to be notified when an AudioSession eventually does get created, and add the arbitrator as a client then. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess): * GPUProcess/mac/LocalAudioSessionRoutingArbitrator.cpp: (WebKit::LocalAudioSessionRoutingArbitrator::create): (WebKit::LocalAudioSessionRoutingArbitrator::LocalAudioSessionRoutingArbitrator): (WebKit::LocalAudioSessionRoutingArbitrator::processDidTerminate): (WebKit::LocalAudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory): (WebKit::LocalAudioSessionRoutingArbitrator::leaveRoutingAbritration): * GPUProcess/mac/LocalAudioSessionRoutingArbitrator.h: * GPUProcess/media/RemoteAudioSessionProxyManager.h: (WebKit::RemoteAudioSessionProxyManager::session): * UIProcess/GPU/GPUProcessProxy.h: * WebProcess/GPU/GPUProcessConnection.cpp: (WebKit::GPUProcessConnection::beginRoutingArbitrationWithCategory): (WebKit::GPUProcessConnection::endRoutingArbitration): * WebProcess/GPU/GPUProcessConnection.h: * WebProcess/GPU/GPUProcessConnection.messages.in: * WebProcess/cocoa/AudioSessionRoutingArbitrator.cpp: (WebKit::AudioSessionRoutingArbitrator::AudioSessionRoutingArbitrator): * WebProcess/cocoa/AudioSessionRoutingArbitrator.h: 2021-06-02 Jer Noble REGRESSION(r277217?): ASSERTION FAILED: Unhandled message RemoteLegacyCDMSession_SendError to 10 assertionFailureDueToUnreachableCode https://bugs.webkit.org/show_bug.cgi?id=226545 Reviewed by Eric Carlson. Add message handlers for RemoteLegacyCDMProxy and RemoteLegacyCDMSessionProxy. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::dispatchMessage): (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage): 2021-06-02 Per Arne [iOS] Fix IOKit sandbox violations https://bugs.webkit.org/show_bug.cgi?id=226546 Reviewed by Tim Horton. Fix IOKit sandbox violations in the WebContent process on iOS. * Configurations/SandboxProfiles.xcconfig: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * WebKit.xcodeproj/project.pbxproj: 2021-06-02 Chris Dumez Drop Checked::safeGet() https://bugs.webkit.org/show_bug.cgi?id=226537 Reviewed by Geoffrey Garen. Drop Checked::safeGet() and replace with uses of Checked::operator T() or Checked::value(). safeGet() is a bit akward, having both a return value and an out-parameter. * UIProcess/mac/TextCheckerMac.mm: (WebKit::TextChecker::updateSpellingUIWithGrammarString): 2021-06-02 Garrett Davidson [Cocoa] _WKAuthenticatorAssertionResponse should specify the attachment type used https://bugs.webkit.org/show_bug.cgi?id=225519 Reviewed by Brent Fulgham. Have WebAuthn authenticators start passing back their attachment type, and plumb it up through to the calling process. * UIProcess/API/Cocoa/_WKAuthenticatorAssertionResponse.mm: (-[_WKAuthenticatorAssertionResponse initWithClientDataJSON:rawId:extensions:authenticatorData:signature:userHandle:attachment:]): (-[_WKAuthenticatorAssertionResponse initWithClientDataJSON:rawId:extensions:authenticatorData:signature:userHandle:]): Deleted. * UIProcess/API/Cocoa/_WKAuthenticatorAssertionResponseInternal.h: * UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponse.mm: (-[_WKAuthenticatorAttestationResponse initWithClientDataJSON:rawId:extensions:attestationObject:attachment:]): (-[_WKAuthenticatorAttestationResponse initWithClientDataJSON:rawId:extensions:attestationObject:]): Deleted. * UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponseInternal.h: * UIProcess/API/Cocoa/_WKAuthenticatorResponse.h: * UIProcess/API/Cocoa/_WKAuthenticatorResponse.mm: (-[_WKAuthenticatorResponse initWithClientDataJSON:rawId:extensions:attachment:]): (-[_WKAuthenticatorResponse initWithClientDataJSON:rawId:extensions:]): Deleted. * UIProcess/API/Cocoa/_WKAuthenticatorResponseInternal.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (authenticatorAttachmentToWKAuthenticatorAttachment): (wkAuthenticatorAttestationResponse): (-[_WKWebAuthenticationPanel makeCredentialWithChallenge:origin:options:completionHandler:]): (wkAuthenticatorAssertionResponse): (-[_WKWebAuthenticationPanel getAssertionWithChallenge:origin:options:completionHandler:]): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::getExistingCredentials): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest): * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h: * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in: * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived): (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived): (WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived): * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived): (WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived): * WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp: (WebKit::WebAuthnConnectionToWebProcess::handleRequest): * WebAuthnProcess/WebAuthnConnectionToWebProcess.h: * WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in: 2021-06-02 Chris Dumez Use Checked aliases instead of Checked https://bugs.webkit.org/show_bug.cgi?id=226535 Reviewed by Keith Miller. * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::numBytesForSize): * Shared/ShareableBitmap.h: * Shared/cairo/ShareableBitmapCairo.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::calculateBytesPerPixel): * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::calculateBytesPerPixel): * Shared/win/ShareableBitmapDirect2D.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::calculateBytesPerPixel): * UIProcess/mac/TextCheckerMac.mm: (WebKit::TextChecker::updateSpellingUIWithGrammarString): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::calculateSafeBackendSize): 2021-06-01 Darin Adler Remove https://bugs.webkit.org/show_bug.cgi?id=226437 Reviewed by Chris Dumez. * : Removed include of . 2021-06-01 Chris Dumez Rename Checked::unsafeGet() to Checked::value() https://bugs.webkit.org/show_bug.cgi?id=226514 Reviewed by Darin Adler. Rename Checked::unsafeGet() to Checked::value(). The "unsafeGet" naming is confusing as this function isn't really unsafe since it will crash if the value has overflowed. Also add an `operator T()` to implicitly convert a Checked to its underlying type without needing to call value(). * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::setItem): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::put): * Platform/IPC/ArgumentCoders.h: * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendOutgoingMessage): (IPC::createMessageDecoder): * Platform/IPC/cocoa/MachMessage.cpp: (IPC::MachMessage::create): * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::Handle::encode const): (WebKit::ShareableBitmap::create): (WebKit::ShareableBitmap::createShareable): * Shared/ShareableBitmap.h: (WebKit::ShareableBitmap::bytesPerRow const): (WebKit::ShareableBitmap::sizeInBytes const): * Shared/ShareableResource.cpp: (WebKit::ShareableResource::create): * Shared/cg/ShareableBitmapCG.cpp: (WebKit::ShareableBitmap::calculateBytesPerRow): (WebKit::ShareableBitmap::createGraphicsContext): (WebKit::ShareableBitmap::createCGImage const): * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::copyTrackArray): * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp: (WebKit::MediaSampleCursor::copySampleLocation const): * WebProcess/GPU/graphics/DisplayListWriterHandle.cpp: (WebKit::DisplayListWriterHandle::advance): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::calculateBytesPerRow): * WebProcess/GPU/media/RemoteImageDecoderAVF.cpp: (WebKit::RemoteImageDecoderAVF::frameBytesAtIndex const): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::increaseBufferedAmount): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::requestEvasionRectsAboveSelection): (WebKit::WebPage::updateSelectionWithDelta): 2021-06-01 Dana Estra Adopt Reveal for phone numbers https://bugs.webkit.org/show_bug.cgi?id=226383 rdar://78482517 Reviewed by Tim Horton. Manually tested by selecting text containing phone numbers in Safari and viewing dropdown menu. Switch to Reveal framework to show a dropdown menu for telephone numbers with more options. * Platform/mac/MenuUtilities.mm: (-[WKEmptyPresenterHighlightDelegate revealContext:rectsForItem:]): (WebKit::menuForTelephoneNumber): 2021-06-01 Chris Dumez Unreviewed build fix after r278253. Revert changes to WebKitTests.swift as this is Swift's Optional<> not WTF's. * SwiftOverlay/Tests/WebKitTests.swift: (WebKitTests.testWKPDFConfigurationRect): 2021-06-01 Chris Dumez Unreviewed build fix after r278253. Revert changes to ObjectiveCBlockConversions.swift and this is Swift's Optional<> not WTF's. * SwiftOverlay/SwiftOverlay/ObjectiveCBlockConversions.swift: (ObjCBlockConversion.boxingNilAsAnyForCompatibility(_:Error:Error:)): 2021-06-01 Chris Dumez REGRESSION (iOS 14.5): Can't go back and render previous page properly after "location.href" https://bugs.webkit.org/show_bug.cgi?id=226323 Reviewed by Alex Christensen. A while back, we did an optimization to allow several WebPage objects associated with the same WebPageProxy to live in the same WebProcess. This allowed us to reuse a process from a SuspendedPageProxy for a forward navigation, without destroying the SuspendedPageProxy. However, this added quite a bit of complexity and this broke some same-process back/forward navigations like in this bug. In particular, it is really hard to get do our history management right (with the current model) if there is more than more WebPage in a process for the same WebPageProxy. To address issues, we go back to the older model with one WebPage per WebProcess for a given WebPageProxy. To achieve this, we make sure to destroy of SuspendedPageProxy objects for the current page and destination process before we process-swap (like we used to do). * UIProcess/WebBackForwardCache.cpp: (WebKit::WebBackForwardCache::removeEntriesForPageAndProcess): * UIProcess/WebBackForwardCache.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::receivedNavigationPolicyDecision): 2021-06-01 Sihui Liu Resume WebIDBServer when it is about to be closed https://bugs.webkit.org/show_bug.cgi?id=226502 rdar://78691498 Reviewed by Chris Dumez. We started to acquire m_serverLock in WebIDBServer::close() in r278179 to stop database activities on the main thread. However, m_serverLock may already be held for suspension, and WebIDBServer::close() may be called before resume(). We need to resume WebIDBServer so m_serverLock can be acquired for stopping database activities. This also makes sure background thread is resumed before WebIDBServer is removed from NetworkProcess. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::~WebIDBServer): (WebKit::WebIDBServer::close): 2021-06-01 Chris Dumez Enable WebPageProxy's release logging in ephemeral sessions https://bugs.webkit.org/show_bug.cgi?id=226342 Reviewed by Geoff Garen. Enable WebPageProxy's release logging in ephemeral sessions. Our release logging doesn't contain anything sensitive and not having this logging makes it hard to debug issues in apps using ephemeral sessions. * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: (WebKit::SOAuthorizationSession::shouldStart): (WebKit::SOAuthorizationSession::start): (WebKit::SOAuthorizationSession::continueStartAfterGetAuthorizationHints): (WebKit::SOAuthorizationSession::continueStartAfterDecidePolicy): (WebKit::SOAuthorizationSession::fallBackToWebPath): (WebKit::SOAuthorizationSession::abort): (WebKit::SOAuthorizationSession::complete): (WebKit::SOAuthorizationSession::presentViewController): (WebKit::SOAuthorizationSession::dismissViewController): * 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::didCreateContextInWebProcessForVisibilityPropagation): (WebKit::ProvisionalPageProxy::didCreateContextInGPUProcessForVisibilityPropagation): * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::isAlwaysOnLoggingAllowed const): * UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::~WebPageProxy): (WebKit::WebPageProxy::launchProcess): (WebKit::WebPageProxy::suspendCurrentPageIfPossible): (WebKit::WebPageProxy::swapToProvisionalPage): (WebKit::WebPageProxy::launchProcessForReload): (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::tryClose): (WebKit::WebPageProxy::tryCloseTimedOut): (WebKit::WebPageProxy::loadRequest): (WebKit::WebPageProxy::loadRequestWithNavigationShared): (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadData): (WebKit::WebPageProxy::loadDataWithNavigationShared): (WebKit::WebPageProxy::loadSimulatedRequest): (WebKit::WebPageProxy::loadAlternateHTML): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): (WebKit::WebPageProxy::stopLoading): (WebKit::WebPageProxy::reload): (WebKit::WebPageProxy::goToBackForwardItem): (WebKit::WebPageProxy::tryRestoreScrollPosition): (WebKit::WebPageProxy::updateActivityState): (WebKit::WebPageProxy::updateThrottleState): (WebKit::WebPageProxy::clearAudibleActivity): (WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate): (WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit): (WebKit::WebPageProxy::receivedNavigationPolicyDecision): (WebKit::WebPageProxy::commitProvisionalPage): (WebKit::WebPageProxy::continueNavigationInNewProcess): (WebKit::WebPageProxy::suspend): (WebKit::WebPageProxy::resume): (WebKit::WebPageProxy::restoreFromSessionState): (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared): (WebKit::WebPageProxy::didExplicitOpenForFrame): (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::didNavigateWithNavigationDataShared): (WebKit::WebPageProxy::didPerformClientRedirectShared): (WebKit::WebPageProxy::didPerformServerRedirectShared): (WebKit::WebPageProxy::closePage): (WebKit::WebPageProxy::processDidBecomeUnresponsive): (WebKit::WebPageProxy::processDidBecomeResponsive): (WebKit::WebPageProxy::resetStateAfterProcessTermination): (WebKit::WebPageProxy::dispatchProcessDidTerminate): (WebKit::WebPageProxy::tryReloadAfterProcessTermination): (WebKit::WebPageProxy::requestStorageSpace): (WebKit::WebPageProxy::updateReportedMediaCaptureState): (WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive): (WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground): (WebKit::WebPageProxy::logger): * UIProcess/WebPageProxy.h: 2021-06-01 Per Arne [iOS] Preprocess the WebContent sandbox https://bugs.webkit.org/show_bug.cgi?id=226301 Reviewed by Geoffrey Garen. Run the WebContent sandbox through the preprocessor on iOS. * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Removed. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: Copied from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb. * WebKit.xcodeproj/project.pbxproj: 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-30 Dean Jackson [WebXR] Send recommendedResolution using DeviceProxy https://bugs.webkit.org/show_bug.cgi?id=226402 Reviewed by Tim Horton. Add a recommendedResolution field to DeviceInfo and send it across processes using the XRDeviceProxy. * Shared/Cocoa/XRDeviceInfo.h: * Shared/Cocoa/XRDeviceInfo.mm: (WebKit::XRDeviceInfo::encode const): (WebKit::XRDeviceInfo::decode): * Shared/Cocoa/XRDeviceProxy.h: * Shared/Cocoa/XRDeviceProxy.mm: (WebKit::XRDeviceProxy::XRDeviceProxy): 2021-05-30 Wenson Hsieh [iOS] UI process crashes when deallocating WKWebView in a script message handler during an active touch event https://bugs.webkit.org/show_bug.cgi?id=226426 rdar://75425319 Reviewed by Darin Adler. It's possible for the UI process to crash upon being notified that asynchronous, active touch events have been handled in the web process via the async IPC replay block in `WebPageProxy::handlePreventableTouchEvent()`. This happens if the client posts a message from the web process to UI process while handling an active touch event and deallocates the WKWebView currently handling the touch event in the script message handler. This is because the async replay block inside `WebPageProxy::handlePreventableTouchEvent()` strongly captures a reference to the `WebPageProxy`, thus keeping it alive; however, the `WebPageProxy`'s weak pointer to the page client is nulled out, which causes `WebPageProxy::pageClient()` to crash with a null dereference. To fix this, we weakly capture `WebPageProxy` instead and return early if it has already been destroyed by the time we process the completion handler, and also add a null check for `m_pageClient` before attempting to call into it. Note that it's unnecessary to call into `doneDeferringTouch(Start|End)` to unblock any deferred gestures here, because the process of destroying the content view will call `-cleanUpInteraction` and remove all deferring gestures from the view, regardless of whether they're still in Possible state. Test: TouchEventTests.DestroyWebViewWhileHandlingTouchEnd * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::handlePreventableTouchEvent): 2021-05-30 Darin Adler Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. * : Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) 2021-05-28 Darin Adler Clients of optional should use has_value instead of relying on hasValue macro https://bugs.webkit.org/show_bug.cgi?id=226395 Reviewed by Chris Dumez. * Platform/IPC/ArgumentCoders.h: Use std::optional; there was no hasValue in here and I edited it by mistake, but we want to do this eventually. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed using namespace WebCore. (IPC::ArgumentCoder>::decodePlatformData): Use has_value. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::getClientSDKVersion): Ditto. * Shared/WebCoreArgumentCoders.cpp: (IPC::decodeImage): Changed idiom to not call hasValue. (IPC::ArgumentCoder>::decode): Ditto. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::finishParsing): Use has_value. (WebKit::MediaFormatReader::copyProperty): Ditto. (WebKit::MediaFormatReader::copyTrackArray): Ditto. * Shared/win/WebCoreArgumentCodersWin.cpp: (IPC::ArgumentCoder>::decodePlatformData): Do not call hasValue. * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration encodeWithCoder:]): Changed idiom to not use hasValue. * UIProcess/API/glib/InputMethodFilter.cpp: (WebKit::InputMethodFilter::setState): Use has_value. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::AutomationCommandError::toProtocolString): Changed idiom to not use hasValue. * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::determineDataOwner const): Use has_value. * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::sendWebInspectorEvent): Changed idiom to not use hasValue. * UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::platformValidateUserMediaRequestConstraints): Ditto. * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::addSourceBuffer): Use has_value. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): Ditto. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::notifyPreferencesChanged): Changed idiom to not call hasValue. 2021-05-28 Wenson Hsieh Web process terminates when attempting to log in on bankid.no https://bugs.webkit.org/show_bug.cgi?id=226411 rdar://77419432 Reviewed by Chris Dumez. See WebCore ChangeLog for more details. * GPUProcess/graphics/RemoteImageBuffer.h: Implement the new display list replayer delegate hooks and plumb the calls over to the RemoteRenderingBackend. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::submit): Keep track of `m_currentMaskImageBuffer` by implementing the methods below, and use this when initializing our DisplayList::Replayer if needed. (WebKit::RemoteRenderingBackend::didCreateMaskImageBuffer): (WebKit::RemoteRenderingBackend::didResetMaskImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.h: 2021-05-28 Don Olmstead [Cocoa] HDR variants in HLS playlists not selected when screen is HDR https://bugs.webkit.org/show_bug.cgi?id=226349 Unreviewed build fix after r278204. Update the method signature of RemoteMediaPlayerProxy::prepareForPlayback for non-Cocoa platforms. * GPUProcess/media/gstreamer/RemoteMediaPlayerProxyGStreamer.cpp: (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): * GPUProcess/media/playstation/RemoteMediaPlayerProxyPlayStation.cpp: (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): * GPUProcess/media/win/RemoteMediaPlayerProxyWin.cpp: (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): 2021-05-28 Sihui Liu Regression(r278179): m_serverLock is still held after WebIDBServer is destroyed https://bugs.webkit.org/show_bug.cgi?id=226389 Reviewed by Chris Dumez. * NetworkProcess/IndexedDB/WebIDBServer.cpp: (WebKit::WebIDBServer::close): 2021-05-28 Matt Gilligan Prevent resetting scroll position in unnecessary cases during page load https://bugs.webkit.org/show_bug.cgi?id=226338 rdar://75334651 Reviewed by Simon Fraser. When WKWebView's scroll view has a refresh control and is rubber banding along the top edge, don't cancel scrolling animations or reset contentOffset within valid range due to the page load. This can cause flickering during dragging and can prevent the bounce animation from finishing. Test: ScrollViewInsetTests.PreserveContentOffsetForRefreshControl * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _didCommitLoadForMainFrame]): Avoid calling -_stopScrollingAndZoomingAnimations when rubber banding for a refresh control to prevent cancelling a bounce animation. (-[WKWebView _restoreScrollAndZoomStateForTransaction:]): (-[WKWebView _didCommitLayerTree:]): Don't adjust content offset to be within valid range when rubber banding for a refresh control, or the scroll position will be reset while dragging or bouncing. (-[WKWebView _scrollViewIsRubberBandingForRefreshControl]): Return whether _scrollView has a refresh control and is rubber banding along the top edge. * UIProcess/ios/WKScrollView.mm: (-[WKScrollView _setContentSizePreservingContentOffsetDuringRubberband:]): When the refresh control is dismissing, the scroll view will be rubber banding but not dragging or bouncing. Treat a non-nil refreshControl as a hint that the scroll view might be rubber banding. 2021-05-28 Jer Noble [Cocoa] Hang in WebM format reader when loading content from https://powerrangers.fandom.com/ https://bugs.webkit.org/show_bug.cgi?id=226128 Reviewed by Eric Carlson. When creating a format reader, MediaToolbox will query for various properties including ones about MetadataFormat and MetadataKeySpace. We don't support those properties, but we still block until tracks are loaded before answering that we don't support them. Instead, just return early unless the query is for the one property which we do support, Duration. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: (WebKit::MediaFormatReader::copyProperty): 2021-05-28 Wenson Hsieh [iOS] Adjust logic when determining whether to enable image extraction actions in the callout bar https://bugs.webkit.org/show_bug.cgi?id=226387 rdar://76781788 Reviewed by Tim Horton and Devin Rousso. Call into the superclass (which contains additional restrictions beyond our `isContentEditable` check on the editor state), and additionally refactor this helper function to take a selector and return whether or not it is one of the image extraction action selectors (as opposed to returning the selector itself). See Radar for more details. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformActionForWebView:withSender:]): 2021-05-28 Sam Weinig Add stub implementation of CA separated portal bits for GraphicsLayer https://bugs.webkit.org/show_bug.cgi?id=226343 Reviewed by Simon Fraser. Plumbs isSeparatedPortal and isDescendentOfSeparatedPortal bits through GraphicsLayer. Renames setSeparated to setIsSeparated for consistency. Currently unused, but getting the bits in is big enough that its helpful to land on its own. * 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): (WebKit::RemoteLayerTreeTransaction::RemoteLayerTreeTransaction): Deleted. (WebKit::RemoteLayerTreeTransaction::~RemoteLayerTreeTransaction): Deleted. * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: (WebKit::PlatformCALayerRemote::setIsSeparated): (WebKit::PlatformCALayerRemote::isSeparatedPortal const): (WebKit::PlatformCALayerRemote::setIsSeparatedPortal): (WebKit::PlatformCALayerRemote::isDescendentOfSeparatedPortal const): (WebKit::PlatformCALayerRemote::setIsDescendentOfSeparatedPortal): (WebKit::PlatformCALayerRemote::setSeparated): Deleted. * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: 2021-05-28 Jer Noble [Cocoa] HDR variants in HLS playlists not selected when screen is HDR https://bugs.webkit.org/show_bug.cgi?id=226349 Reviewed by Eric Carlson. An existing test, http/tests/media/hls/hls-hdr-switch.html, should have caught this regression, but is not currently functional as it depends on PHP, which has been removed. The preferredDynamicRangeMode needs to be piped over from WebContent -> GPU process. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::setPreferredDynamicRangeMode): * GPUProcess/media/RemoteMediaPlayerProxy.h: * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): * Scripts/webkit/messages.py: (headers_for_type): * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::prepareForPlayback): (WebKit::MediaPlayerPrivateRemote::setPreferredDynamicRangeMode): * WebProcess/GPU/media/MediaPlayerPrivateRemote.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-28 Eric Carlson [GPUP] [Video/Audio/Text]TrackPrivateRemote.h should use startTimeVariance https://bugs.webkit.org/show_bug.cgi?id=226355 rdar://77326202 Reviewed by Jer Noble. Test: http/tests/media/hls/hls-webvtt-seek-backwards.html * WebProcess/GPU/media/AudioTrackPrivateRemote.h: Use configuration.startTimeVariance. * WebProcess/GPU/media/TextTrackPrivateRemote.h: Ditto. * WebProcess/GPU/media/VideoTrackPrivateRemote.h: Ditto. 2021-05-28 Carlos Garcia Campos [SOUP] Implement NetworkDataTask::setPriority https://bugs.webkit.org/show_bug.cgi?id=226371 Reviewed by Adrian Perez de Castro. To update the soup message priority. In HTTP/2 soup can send a priority frame to prioritize the associated stream. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::setPriority): * NetworkProcess/soup/NetworkDataTaskSoup.h: 2021-05-27 Wenson Hsieh [GPU Process] Add debug logging around some shared display list codepaths https://bugs.webkit.org/show_bug.cgi?id=226356 Reviewed by Simon Fraser. Add logging around the shared display list processing logic between the web and GPU processes. This is the basic set of log messages I've used in the past to triage crashes and hangs while optimizing MotionMark performance, and should be sufficient for some basic debugging around display list code around RemoteRenderingBackend(Proxy). * GPUProcess/graphics/RemoteImageBuffer.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): Log when wakeup messages are sent by the web process and received by the GPU process. * GPUProcess/graphics/RemoteRenderingBackend.h: * Platform/Logging.h: * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout): Log when synchronous flushes are performed, as well as whether they time out. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::sendWakeupMessage): (WebKit::RemoteRenderingBackendProxy::createItemBuffer): Log whenever new display list shared memory is created, and also when display lists are reused (additionally logging the remaining capacity on reused display lists). 2021-05-27 Wenson Hsieh [macOS] Show context menu when clicking on data detection results in image overlays https://bugs.webkit.org/show_bug.cgi?id=226274 rdar://75504956 Reviewed by Tim Horton and Aditya Keerthi. Implement a WebKit2 client hook to handle a click over a data detection result by using the Reveal framework to collect and present a context menu. See below for more details. * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: Add encoding and decoding support for DataDetectorElementInfo. * SourcesCocoa.txt: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::handleClickForDataDetectionResult): * UIProcess/Cocoa/WebViewImpl.h: (WebKit::WebViewImpl::view const): Add a helper method to grab the view (either a WKView or WKWebView) from a WebViewImpl. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::handleClickForDataDetectionResult): Create and present a new WKRevealItemPresenter using the DDScannerResult. (WebKit::WebViewImpl::didFinishPresentation): * UIProcess/PageClient.h: (WebKit::PageClient::handleClickForDataDetectionResult): Add more plumbing through the UI process to handle clicking on a data detection result. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::handleClickForDataDetectionResult): * UIProcess/mac/WKRevealItemPresenter.h: Added. * UIProcess/mac/WKRevealItemPresenter.mm: Added. Add a helper class that takes an RVItem and is capable of presenting a context menu for the item, on behalf of WebViewImpl. For the time being, this is only used on macOS (and thus, directly holds a WeakPtr to a WebViewImpl). However, we may want to use this in the future for Mac Catalyst as well, in which case we should make this work via a generic WKRevealItemPresenterDelegate protocol instead. (-[WKRevealItemPresenter initWithWebViewImpl:item:frame:menuLocation:]): (-[WKRevealItemPresenter showContextMenu]): (-[WKRevealItemPresenter _callDidFinishPresentationIfNeeded]): Call out to the WebViewImpl to reset its current reveal item presenter after we've finished presentation. This happens either after we've dismissed the context menu (if no item is highlighted), or after we've finished highlighting the item. (-[WKRevealItemPresenter revealContext:rectsForItem:]): (-[WKRevealItemPresenter revealContext:shouldUseDefaultHighlightForItem:]): (-[WKRevealItemPresenter revealContext:startHighlightingItem:]): (-[WKRevealItemPresenter revealContext:stopHighlightingItem:]): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::handleClickForDataDetectionResult): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::handleClickForDataDetectionResult): * WebProcess/WebPage/WebPage.h: 2021-05-27 Darin Adler Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. * : Accept the renaming done by do-webcore-rename. 2021-05-27 Devin Rousso [iOS] contextmenu hints don't follow scrolling inside `