2022-04-25 Russell Epstein Cherry-pick r293339. rdar://problem/92283605 Fix the tvOS and watchOS builds after r293231 https://bugs.webkit.org/show_bug.cgi?id=239736 rdar://92283605 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebView.h: UIFindInteraction is marked unavailable on watchOS and tvOS. * UIProcess/API/Cocoa/WKWebView.mm: Use platform-checks rather than the existing HAVE macro, so that these methods are still implemented in older builds. There are no version checks in WKWebView.h. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293339 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2022-04-25 Aditya Keerthi Fix the tvOS and watchOS builds after r293231 https://bugs.webkit.org/show_bug.cgi?id=239736 rdar://92283605 Reviewed by Wenson Hsieh. * UIProcess/API/Cocoa/WKWebView.h: UIFindInteraction is marked unavailable on watchOS and tvOS. * UIProcess/API/Cocoa/WKWebView.mm: Use platform-checks rather than the existing HAVE macro, so that these methods are still implemented in older builds. There are no version checks in WKWebView.h. 2022-04-22 Aditya Keerthi [iOS] Add find interaction API to WKWebView https://bugs.webkit.org/show_bug.cgi?id=239612 rdar://88442918 Reviewed by Alex Christensen. Promote the `_findInteraction` and `_findInteractionEnabled` SPI to `findInteraction` and `findInteractionEnabled` API. In order to make this change, new UIKit objects and protocols must be adopted. Existing (deprecated) protocol conformance is kept around to avoid breaking internal clients. * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView findInteractionEnabled]): (-[WKWebView setFindInteractionEnabled:]): (-[WKWebView findInteraction]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declare conformance to three protocols: _UITextSearching, UITextSearching, UIFindInteractionDelegate. _UITextSearching: Conformance is kept around to avoid breaking internal clients. UITextSearching: Conformance is declared for clients to migrate off of _UITextSearching. UIFindInteractionDelegate: Conformance is necessary to begin a UIFindSession. * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _didCommitLoadForMainFrame]): The "searchable object" does not need to be reset anymore, as UIKit will do that in `-[WKWebView findInteraction:sessionForView:]` the next time a find session begins. (-[WKWebView _searchableObject]): (-[WKWebView _setFindInteractionEnabled:]): (-[WKWebView _findInteraction]): It is safe to cast between the SPI and API version of this object. UIKit has guaranteed compatibility. (-[WKWebView offsetFromPosition:toPosition:inDocument:]): (-[WKWebView compareFoundRange:toRange:inDocument:]): (-[WKWebView performTextSearchWithQueryString:usingOptions:resultAggregator:]): (-[WKWebView replaceFoundTextInRange:inDocument:withText:]): (-[WKWebView decorateFoundTextRange:inDocument:usingStyle:]): (-[WKWebView scrollRangeToVisible:inDocument:]): (-[WKWebView findInteraction:sessionForView:]): (-[WKWebView findInteraction:didBeginFindSession:]): Custom content views do not need to be aware that a find session has begun, as they do not draw an overlay. (-[WKWebView findInteraction:didEndFindSession:]): Custom content views do not need to be aware that a find session has begun, as they do not draw an overlay. * UIProcess/ios/WKContentViewInteraction.h: Declare the old _UITextSearching methods explicitly, as we need to maintain support for internal clients. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView performTextSearchWithQueryString:usingOptions:resultAggregator:]): (-[WKContentView replaceFoundTextInRange:inDocument:withText:]): (-[WKContentView decorateFoundTextRange:inDocument:usingStyle:]): (-[WKContentView scrollRangeToVisible:inDocument:]): (-[WKContentView offsetFromPosition:toPosition:inDocument:]): (-[WKContentView compareFoundRange:toRange:inDocument:]): * UIProcess/ios/WKPDFView.mm: (-[WKPDFView compareFoundRange:toRange:inDocument:]): (-[WKPDFView performTextSearchWithQueryString:usingOptions:resultAggregator:]): (-[WKPDFView decorateFoundTextRange:inDocument:usingStyle:]): 2022-04-22 Wenson Hsieh [iOS] `-selectWordForReplacement` should select dictation alternatives that span multiple words https://bugs.webkit.org/show_bug.cgi?id=239622 rdar://91416535 Reviewed by Aditya Keerthi. Currently, `-selectWordForReplacement` (which is invoked by UIKit when the tapping on spelling corrections and dictation alternatives to reveal the callout bar with text suggestions) handles multi-word dictation ranges by only selecting one of the words (i.e., whichever word is closest to the tapped location). This makes it impossible to handle dictation ranges that span multiple words, since only part of the range is replaced with the chosen alternative. To address this, instead of using the existing `extendSelection` method (which is still exercised when tapping the "Select" action in the callout bar with a caret selection), we add `extendSelectionForReplacement`, which extends the selection to include any dictation alternative range that encompasses the selection (and otherwise falls back to selecting the current word). Test: SelectionTests.SelectWordForReplacementWithDictationAlternative * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView selectWordForReplacement]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::extendSelectionForReplacement): Add a new IPC message, `WebPage::ExtendSelectionForReplacement`, and use it to implement `-[WKContentView selectWordForReplacement]`. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::extendSelectionForReplacement): Add logic to select the enclosing dictation alternative marker range (if it exists), or the current word at the start of the selection if there is no enclosing marker range. Note that we first grab a Vector of all the marker ranges instead of creating them as we iterate through the list of `RenderedDocumentMarker*`, since creating visible position ranges from each marker range triggers layout, and each `RenderedDocumentMarker*` is not ref-counted, so it's possible that a reentrant call to update the document marker controller during layout could destroy the next `RenderedDocumentMarker*` during iteration. (WebKit::WebPage::extendSelection): (WebKit::WebPage::setSelectedRangeDispatchingSyntheticMouseEventsIfNeeded): Pull out logic for dispatching synthetic mouse events when selecting text into a separate helper method, which is now called from both `extendSelection` and `extendSelectionForReplacement`. 2022-04-22 Zan Dobersek [GLib] Make WebKitSettings XSS auditor functions no-op https://bugs.webkit.org/show_bug.cgi?id=239651 Reviewed by Adrian Perez de Castro. With the XSS auditor feature being deprecated and removed, and the preference entries removed in r293199, the GLib API for this feature has to be adjusted as well. In both getter and setter, a warning is printed out when invoked. * UIProcess/API/glib/WebKitSettings.cpp: (webkit_settings_get_enable_xss_auditor): (webkit_settings_set_enable_xss_auditor): 2022-04-21 John Cunningham Use GCGLSpanTuple to pass buffer parameters to multidraw calls. https://bugs.webkit.org/show_bug.cgi?id=239154 Reviewed by Kimmo Kinnunen. * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::WebCore::vectorCopyCast): (WebKit::RemoteGraphicsContextGL::multiDrawArraysANGLE): (WebKit::RemoteGraphicsContextGL::multiDrawArraysInstancedANGLE): (WebKit::RemoteGraphicsContextGL::multiDrawElementsANGLE): (WebKit::RemoteGraphicsContextGL::multiDrawElementsInstancedANGLE): * GPUProcess/graphics/RemoteGraphicsContextGL.h: * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h: (getInternalformativ): (multiDrawArraysANGLE): Deleted. (multiDrawArraysInstancedANGLE): Deleted. (multiDrawElementsANGLE): Deleted. (multiDrawElementsInstancedANGLE): Deleted. * Platform/IPC/ArgumentCoders.h: * Platform/IPC/ArrayReferenceTuple.h: Added. * Scripts/webkit/messages.py: (class_template_headers): * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::multiDrawArraysANGLE): (WebKit::RemoteGraphicsContextGLProxy::multiDrawArraysInstancedANGLE): (WebKit::RemoteGraphicsContextGLProxy::multiDrawElementsANGLE): (WebKit::RemoteGraphicsContextGLProxy::multiDrawElementsInstancedANGLE): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp: (WebKit::RemoteGraphicsContextGLProxy::multiDrawArraysANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::multiDrawArraysInstancedANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::multiDrawElementsANGLE): Deleted. (WebKit::RemoteGraphicsContextGLProxy::multiDrawElementsInstancedANGLE): Deleted. 2022-04-20 Yusuke Suzuki [WTF] Add string concatenate adapter for UUID https://bugs.webkit.org/show_bug.cgi?id=239590 Reviewed by Chris Dumez and Darin Adler. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::addStorageSession): * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: (WebKit::NetworkMDNSRegister::registerMDNSName): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::handleForWebPageProxy): (WebKit::WebAutomationSession::handleForWebFrameID): * UIProcess/gtk/WaylandCompositor.cpp: (WebKit::WaylandCompositor::WaylandCompositor): * UIProcess/ios/WKModelView.mm: (-[WKModelView createFileForModel:]): * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm: (WebKit::ARKitInlinePreviewModelPlayerMac::createFile): 2022-04-21 Chris Dumez Adopt RobinHoodHashMap / RobinHoodHashSet more broadly in WebCore https://bugs.webkit.org/show_bug.cgi?id=239576 Reviewed by Yusuke Suzuki. Adopt RobinHoodHashMap / RobinHoodHashSet more broadly in WebKit to avoid wasting memory in hash tables. RobinHoodHashMap / RobinHoodHashSet have more restrictions on what key types they work with and may result in slightly lower performance but they have a much higher load factor that the regular HashMap / HashSet, thus reducing memory usage. This patch adopts RobinHoodHashMap / RobinHoodHashSet on non performance sensitive maps / sets in WebCore that have compatible keys (String / AtomString / URL because they cache their hash). * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::didSaveScriptsToDisk): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::allowedNetworkHosts const): (API::PageConfiguration::setAllowedNetworkHosts): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _setLoadsFromNetwork:]): (-[WKWebViewConfiguration _setAllowedNetworkHosts:]): 2022-04-21 Chris Dumez Build is broken on shipping macOS due to TBA annotations replacement in API headers https://bugs.webkit.org/show_bug.cgi?id=239623 Unreviewed, bump versions in WebKit.xcconfig too to disable TBA annotation replacement on shipping OS so that we don't get warnings about API not yet being available. * Configurations/WebKit.xcconfig: 2022-04-21 Simon Fraser with overflow:hidden CSS is scrollable on iOS standalone web app https://bugs.webkit.org/show_bug.cgi?id=220908 Reviewed by Devin Rousso. `overflow:hidden` failed to make the primary scroll view unscrollable in a home screen web app because of logic in _updateScrollViewForTransaction: that was intended to ensure that if the current unobscured rect is equal to the max unobscured rect (i.e. testing for collapsed UI in MobileSafari), the user could scroll to expand the UI. This failed in Web.app because there is no collapsible UI there, i.e. minUnobscuredSize == maxUnobscuredSize. So test for that scenario. Tested by new API tests. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _updateScrollViewForTransaction:]): 2022-04-21 Youenn Fablet A suspended remote shared worker should resume when a new SharedWorker is added https://bugs.webkit.org/show_bug.cgi?id=239325 Reviewed by Chris Dumez. Check whether resuming/suspending remote shared worker in case of added/removed SharedWorker object. Make sure to suspend the remote shared worker at launch time if needed. Covered by updated test. * NetworkProcess/SharedWorker/WebSharedWorker.cpp: * NetworkProcess/SharedWorker/WebSharedWorker.h: * NetworkProcess/SharedWorker/WebSharedWorkerServer.cpp: 2022-04-21 Eric Carlson AVSampleBufferRenderSynchronizer timeline sometimes goes backwards when playback begins https://bugs.webkit.org/show_bug.cgi?id=239471 rdar://91117803 Reviewed by Jer Noble. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::currentTimeChanged): Log when time jumps backwards. 2022-04-20 Wenson Hsieh Unreviewed, fix the iOS 15.4 build after r293117 Remove an unnecessary header include. * Platform/spi/ios/UIKitSPI.h: 2022-04-20 Wenson Hsieh Avoid falling back to snapshots for transparent images when triggering batch text recognition https://bugs.webkit.org/show_bug.cgi?id=239555 rdar://91622151 Reviewed by Aditya Keerthi. Refactor `requestTextRecognition()` to take in `TextRecognitionOptions`. See WebCore/ChangeLog for more details. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::requestTextRecognition): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::requestTextRecognition): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::requestTextRecognition): 2022-04-20 Simon Fraser Add release assert logging in RemoteRenderingBackendProxy::prepareBuffersForDisplay() https://bugs.webkit.org/show_bug.cgi?id=239563 Reviewed by Wenson Hsieh. Use RELEASE_ASSERT_WITH_MESSAGE() to make it more clear which of the two release assertions is being hit. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::prepareBuffersForDisplay): 2022-04-20 Megan Gardner Address recent deprecation warnings on iOS. https://bugs.webkit.org/show_bug.cgi?id=239560 Reviewed by Wenson Hsieh. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]): (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): Deleted. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView setUpInteraction]): (-[WKContentView canPerformActionForWebView:withSender:]): (-[WKContentView pasteForWebView:]): (-[WKContentView _handleDOMPasteRequestWithResult:]): (-[WKContentView _requestDOMPasteAccessForCategory:elementRect:originIdentifier:completionHandler:]): (-[WKContentView contextMenuInteraction:configuration:previewForHighlightingItemWithIdentifier:]): (-[WKContentView contextMenuInteraction:configuration:dismissalPreviewForItemWithIdentifier:]): (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): Deleted. (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]): Deleted. * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm: (-[WKDataListSuggestionsDropdown contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]): (-[WKDataListSuggestionsDropdown contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): Deleted. * UIProcess/ios/forms/WKDateTimeInputControl.mm: (-[WKDateTimePicker contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]): (-[WKDateTimePicker contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): Deleted. * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]): (-[WKFileUploadPanel contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): Deleted. * UIProcess/ios/forms/WKFormSelectPicker.mm: (-[WKSelectPicker contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:]): (-[WKSelectPicker contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]): Deleted. 2022-04-20 Alan Bujtas [IFC][Integration] Do not call WebPreferences::simpleLineLayoutEnabled in canUseForLineLayoutWithReason https://bugs.webkit.org/show_bug.cgi?id=239540 Reviewed by Antti Koivisto. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetSimpleLineLayoutEnabled): Deleted. (WKPreferencesGetSimpleLineLayoutEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences _simpleLineLayoutEnabled]): Deleted. (-[WKPreferences _setSimpleLineLayoutEnabled:]): Deleted. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 2022-04-20 Myles C. Maxfield [WebGPU] WebKit and WebKitLegacy shouldn't need to know about WebGPU.framework https://bugs.webkit.org/show_bug.cgi?id=239528 Unreviewed build fix. * GPUProcess/graphics/WebGPU/RemoteGPU.cpp: (WebKit::RemoteGPU::workQueueInitialize): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createGPUForWebGPU const): 2022-04-20 Diego Pino Garcia Unreviewed, non-unified build fixes after r293052 * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::handleEvent): 2022-04-19 Ben Nham Handle public token updates in webpushd https://bugs.webkit.org/show_bug.cgi?id=239042 Reviewed by Brady Eidson. When the public token associated with our push service changes, we have to invalidate all push subscriptions, since they all derive from the public token. This is only expected to happen in very rare cases, e.g. keychain corruption. To implement this, we now listen for public token updates from our push service, and pass that on to PushDatabase. PushDatabase persists the token and deletes all subscriptions on token change if necessary. * Shared/WebPushDaemonConstants.h: (WebKit::WebPushD::messageTypeSendsReply): * webpushd/ApplePushServiceConnection.mm: (-[_WKAPSConnectionDelegate connection:didReceivePublicToken:]): (-[_WKAPSConnectionDelegate connection:didReceiveIncomingMessage:]): * webpushd/MockPushServiceConnection.mm: (WebPushD::MockPushServiceConnection::MockPushServiceConnection): (WebPushD::MockPushServiceConnection::setPublicTokenForTesting): * webpushd/PushService.mm: (WebPushD::PushService::PushService): (WebPushD::PushService::setPublicTokenForTesting): (WebPushD::PushService::didReceivePublicToken): * webpushd/PushServiceConnection.mm: (WebPushD::PushServiceConnection::startListeningForPublicToken): (WebPushD::PushServiceConnection::didReceivePublicToken): (WebPushD::PushServiceConnection::setPublicTokenForTesting): * webpushd/WebPushDaemon.mm: (WebPushD::Daemon::decodeAndHandleMessage): (WebPushD::Daemon::setPublicTokenForTesting): 2022-04-19 Wenson Hsieh [iOS] Dictation text that contains emojis is inserted twice upon finalization https://bugs.webkit.org/show_bug.cgi?id=239508 rdar://91895524 Reviewed by Aditya Keerthi. `WebPage::replaceDictatedText` contains logic to only proceed with text replacement in the case where the dictated text still matches the text before the current selection. To ensure this, it marches backwards through visible positions from the start of the selection, for a total number of times equal to the length of the expected string (`oldText`). If the text within this found range (i.e. from the position before the start of the selection, to the start of the selection) no longer matches the `oldText` provided by the client, we return early and do nothing. However, this logic fails in the case where `oldText` contains emojis (or more generally, multiple codepoints that combine to form a single grapheme cluster), since the length of the string is more than the number of visible position iterations needed to find the correct starting position for the range. As a result, we end up not replacing any characters, and when UIKit dictation code later calls `-insertText:` with the final dictation string, we end up duplicating the finalized dictation text. To address this issue, simply advance backwards by grapheme count instead of the raw string length to keep the starting visible position consistent with the start of the range that we're trying to replace. Test: UIWKInteractionViewProtocol.ReplaceDictatedTextContainingEmojis * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::replaceDictatedText): (WebKit::WebPage::applyAutocorrectionInternal): Also add a FIXME here around similar code that might also be susceptible to the same bug. However, in this case, we avoid the problem because of subsequent logic that adjusts the starting position to try and match the expected string. We may be able to remove or further limit this extra adjustment by using grapheme cluster count here instead of string length when finding the initial starting position. 2022-04-19 Chris Dumez Inline Element::shadowRoot() https://bugs.webkit.org/show_bug.cgi?id=239460 Reviewed by Darin Adler. I moved findDataDetectionResultElementInImageOverlay() to WebCore since it only relies on WebCore things. This function relies on ElementRareData but ElementRareData.h is not currently exported from WebCore. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updateWithTextRecognitionResult): (WebKit::WebPage::findDataDetectionResultElementInImageOverlay): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::dataDetectorImageOverlayPositionInformation): 2022-04-19 Sihui Liu Add logging for WebsiteDataStore data fetch and removal https://bugs.webkit.org/show_bug.cgi?id=239409 Reviewed by Chris Dumez. This would help us debug issues like rdar://91422245. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::fetchWebsiteData): (WebKit::NetworkProcess::deleteWebsiteData): (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::fetchDataAndApply): (WebKit::WebsiteDataStore::removeData): 2022-04-19 Kimmo Kinnunen ASSERTION FAILED: !m_isInitializingSendSource crashes on the bots https://bugs.webkit.org/show_bug.cgi?id=239399 Reviewed by Chris Dumez. Avoid sending messages to IPC::Connection before the connection is open. There's multiple logic problems as well as a race to toggle m_isInitializingSendSource. Commit "RemoteRenderingBackend should have dedicated IPC::Connection for out-of-stream messages" would make RRBProxy in WP create the "server" IPC::Connection and send that to RRB in GPUP. This would cause RRB in GPUP to ASSERT(... || !m_isInitializingSendSource) fail in the IPC work queue. For "client" connection, IPC::Connection::open() will run in the calling queue, toggling m_isInitializingSendSource = true. The m_isInitializingSendSource = false will be toggled in the message send queue by the send source initialization callback. If the caller has already enqueued messages before calling open(), the callbacks the sendMessage() or open() schedules might run the functions which do not expect to be dispatched unless m_isInitializingSendSource == false. This commit just fixes the send vs open order, but does not fix the underlying problems. They are tracked in bug 239494, which should also add tests for the case. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::startListeningForIPC): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::sendOutgoingMessage): Expand one ASSERT(!a && !b) to individual assertions in order to catch the exact problem easier. 2022-04-19 Ada Chan [WebXR] Update Device::initializeTrackingAndRendering() to take in more parameters regarding the session setup https://bugs.webkit.org/show_bug.cgi?id=239476 Reviewed by Dean Jackson. Pass in document's origin and session features to Device::initializeTrackingAndRendering(). * Shared/XR/XRDeviceProxy.cpp: (WebKit::XRDeviceProxy::initializeTrackingAndRendering): * Shared/XR/XRDeviceProxy.h: * UIProcess/XR/PlatformXRCoordinator.h: * UIProcess/XR/PlatformXRSystem.cpp: (WebKit::PlatformXRSystem::initializeTrackingAndRendering): * UIProcess/XR/PlatformXRSystem.h: * UIProcess/XR/PlatformXRSystem.messages.in: * WebProcess/XR/PlatformXRSystemProxy.cpp: (WebKit::PlatformXRSystemProxy::initializeTrackingAndRendering): * WebProcess/XR/PlatformXRSystemProxy.h: 2022-04-15 Antoine Quint [model] ready promise does not work on iOS https://bugs.webkit.org/show_bug.cgi?id=239395 rdar://91761135 Reviewed by Dean Jackson. We actually never communicated success or failure when creating the ASVInlinePreview in the UI process on iOS in WKModelView. We now provide a reference to the WebPageProxy and a GraphicsLayer::PlatformLayerID when creating a WKModelView so that we can message the Web process and have WebPage look for the matching ARKitInlinePreviewModelPlayerIOS to notify of load success or failure via the ModelPlayerClient protocol which is already implemented by HTMLModelElement. * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: (WebKit::RemoteLayerTreeHost::makeNode): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::modelInlinePreviewDidLoad): (WebKit::WebPageProxy::modelInlinePreviewDidFailToLoad): * UIProcess/WebPageProxy.h: * UIProcess/ios/WKModelView.h: * UIProcess/ios/WKModelView.mm: (-[WKModelView initWithModel:layerID:page:]): (-[WKModelView createPreview]): (-[WKModelView initWithModel:]): Deleted. * WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.h: * WebProcess/Model/ios/ARKitInlinePreviewModelPlayerIOS.mm: (WebKit::ARKitInlinePreviewModelPlayerIOS::ARKitInlinePreviewModelPlayerIOS): (WebKit::ARKitInlinePreviewModelPlayerIOS::~ARKitInlinePreviewModelPlayerIOS): (WebKit::ARKitInlinePreviewModelPlayerIOS::modelPlayerForPageAndLayerID): (WebKit::ARKitInlinePreviewModelPlayerIOS::pageLoadedModelInlinePreview): (WebKit::ARKitInlinePreviewModelPlayerIOS::pageFailedToLoadModelInlinePreview): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::modelInlinePreviewDidLoad): (WebKit::WebPage::modelInlinePreviewDidFailToLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2022-04-19 Wenson Hsieh [iOS] Text selection flickers when inserting text using dictation https://bugs.webkit.org/show_bug.cgi?id=239467 rdar://91895659 Reviewed by Aditya Keerthi. Implement two new SPI methods on UIWKInteractionViewProtocol (to be added in rdar://91919121), which UIKit uses to encapsulate text input changes while inserting final dictation results (specifically, a call to `-replaceDictatedText:withText:`, followed by one or more calls to `-insertText:`). During this scope, we suppress all DOM selection changes from propagating to the client (thereby causing visible text selection updates) by creating and holding on to a `IgnoreSelectionChangeForScope` RAII object. At the end of this scope, we then schedule one final editor state update after resetting the scope, to ensure that the final selection state propagates to the UI process. Test: UIWKInteractionViewProtocol.SuppressSelectionChangesDuringDictation * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView willInsertFinalDictationResult]): (-[WKContentView didInsertFinalDictationResult]): (-[WKContentView _updateChangedSelection:]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::willInsertFinalDictationResult): (WebKit::WebPageProxy::didInsertFinalDictationResult): Plumb these method calls into the web process, through `WebPageProxy` and `WebPage`. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): If (for any reason) we're committing a load while holding on to `m_ignoreSelectionChangeScopeForDictation`, forcibly call `Editor::setIgnoreSelectionChanges(false, RevealSelection::No)` and destroy the scoped object. * WebProcess/WebPage/WebPage.h: Add `m_ignoreSelectionChangeScopeForDictation`, which is set in `willInsertFinalDictationResult` and unset in `didInsertFinalDictationResult` below. * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::replaceSelectedText): (WebKit::WebPage::replaceDictatedText): Deploy `IgnoreSelectionChangeForScope` here, so that if we're already ignoring selection changes due to `m_ignoreSelectionChangeScopeForDictation`, we won't prematurely revert "ignore selection change" state (this is because this RAII helper object consults the preexisting state of `document.editor().ignoreSelectionChanges()` before calling into `setIgnoreSelectionChanges`, and effectively becomes a no-op if the bit was already set). (WebKit::WebPage::willInsertFinalDictationResult): (WebKit::WebPage::didInsertFinalDictationResult): 2022-04-19 Simon Fraser Use ProcessTerminationReason::Unresponsive for unresponsive network processes https://bugs.webkit.org/show_bug.cgi?id=239401 Reviewed by Chris Dumez. NetworkProcessProxy used ProcessTerminationReason::RequestedByClient for all callers of terminate(). Move the call to networkProcessDidTerminate() out to callers of terminate() so they can pass the correct reasons. Also use processTerminationReasonToString() in some more logs, and fix a log string typo introduced in the previous commit. * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::gpuProcessExited): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::terminate): (WebKit::NetworkProcessProxy::didBecomeUnresponsive): (WebKit::NetworkProcessProxy::didReceiveInvalidMessage): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetStateAfterProcessTermination): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessExited): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::gpuProcessExited): (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2022-04-19 Antoine Quint [model] set canonicalWebPageURL and urlFragment on ASVInlinePreview on iOS https://bugs.webkit.org/show_bug.cgi?id=239502 rdar://87352281 Reviewed by Dean Jackson. Set the `canonicalWebPageURL` and `urlFragment` properties on the ASVInlinePreview prior to entering fullscreen. * UIProcess/Cocoa/ModelElementControllerCocoa.mm: (WebKit::ModelElementController::takeModelElementFullscreen): * UIProcess/ModelElementController.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::takeModelElementFullscreen): 2022-04-19 Zan Dobersek [GTK][WPE][GPUProcess] Add RemoteGraphicsContextGLGBM, RemoteGraphicsContextGLProxyGBM https://bugs.webkit.org/show_bug.cgi?id=239348 Reviewed by Carlos Garcia Campos. Provide RemoteGraphicsContextGL and RemoteGraphicsContextGLProxy implementations guarded by and based on USE(LIBGBM) functionality, usable by the GTK and WPE ports when jointly enabled with ANGLE backing of WebGL execution. RemoteGraphicsContextGLGBM is the GPUProcess-side GL executor. Internally it spawns a GraphicsContextGLGBM instance, and once invoked, the PrepareForDisplay() IPC message returns the reply with the DMABuf object that was used as the rendering backing in that context instance. RemoteGraphicsContextGLProxyGBM is the WebProcess-side counterpart. Besides relaying the prepare-for-display request, it also manages the GraphicsLayerContentsDisplayDelegate object which handles presenting DMABuf objects arriving from the GPUProcess. That delegate is of the NicosiaDisplayDelegate type, a slim class also handling a Nicosia::ContentLayer object through which any arriving DMABuf is presented in the TextureMapper tree. * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: * GPUProcess/graphics/RemoteGraphicsContextGL.h: * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGLGBM.cpp: Added. (WebKit::RemoteGraphicsContextGLGBM::RemoteGraphicsContextGLGBM): (WebKit::RemoteGraphicsContextGLGBM::platformWorkQueueInitialize): (WebKit::RemoteGraphicsContextGLGBM::prepareForDisplay): (WebKit::RemoteGraphicsContextGL::create): * SourcesGTK.txt: * SourcesWPE.txt: * WebProcess/GPU/graphics/gbm/RemoteGraphicsContextGLProxyGBM.cpp: Added. (WebKit::NicosiaDisplayDelegate::NicosiaDisplayDelegate): (WebKit::NicosiaDisplayDelegate::~NicosiaDisplayDelegate): (WebKit::NicosiaDisplayDelegate::platformLayer const): (WebKit::NicosiaDisplayDelegate::swapBuffersIfNeeded): (WebKit::RemoteGraphicsContextGLProxyGBM::RemoteGraphicsContextGLProxyGBM): (WebKit::RemoteGraphicsContextGLProxyGBM::layerContentsDisplayDelegate): (WebKit::RemoteGraphicsContextGLProxyGBM::prepareForDisplay): (WebKit::RemoteGraphicsContextGLProxy::create): 2022-04-18 Per Arne Vollan Block system calls in the Network process https://bugs.webkit.org/show_bug.cgi?id=238935 Reviewed by Geoffrey Garen. Block unused system calls in the Network process on macOS and iOS. This is based on collected telemetry. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb.in: 2022-04-18 Per Arne Vollan [iOS][WP] Add telemetry with backtrace for network related system calls https://bugs.webkit.org/show_bug.cgi?id=239465 Reviewed by Darin Adler. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: 2022-04-18 Commit Queue Unreviewed, reverting r292957. https://bugs.webkit.org/show_bug.cgi?id=239468 Introduced crash Reverted changeset: "Block system calls in the Network process" https://bugs.webkit.org/show_bug.cgi?id=238935 https://commits.webkit.org/r292957 2022-04-18 Brent Fulgham Remove the deprecated CaptivePortal enablement key https://bugs.webkit.org/show_bug.cgi?id=239456 Reviewed by Wenson Hsieh. This is a minor code cleanup to remove an old default key we used in the early experiments with this behavior. * UIProcess/API/Cocoa/_WKSystemPreferences.mm: (+[_WKSystemPreferences isCaptivePortalModeEnabled]): * UIProcess/API/Cocoa/_WKSystemPreferencesInternal.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::notifyPreferencesChanged): 2022-04-18 Per Arne Vollan Fix incorrect syscall name in sandboxes https://bugs.webkit.org/show_bug.cgi?id=239454 Reviewed by Darin Adler. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2022-04-18 Simon Fraser Allow C API clients to get the WKProcessTerminationReason in processDidCrash functions, and use in WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=239400 Reviewed by Sam Weinig. Introduce WKContextClientV4 with "did crash" functions that take a ProcessID and WKProcessTerminationReason. WebContextClient will call the new functions if registered, otherwise the old ones. Have WebProcessPool::networkProcessDidTerminate() and WebProcessPool::gpuProcessExited() call the client for more types of reasons; ExceededMemoryLimit and ExceededCPULimit only apply to the web process, so the behavior change here is to call m_client.networkProcessDidCrash() for ProcessTerminationReason::Unresponsive. * UIProcess/API/C/WKContext.h: * UIProcess/WebContextClient.cpp: (WebKit::WebContextClient::networkProcessDidCrash): (WebKit::WebContextClient::serviceWorkerProcessDidCrash): (WebKit::WebContextClient::gpuProcessDidCrash): * UIProcess/WebContextClient.h: * UIProcess/WebProcessPool.cpp: (WebKit::shouldReportAuxiliaryProcessCrash): (WebKit::WebProcessPool::networkProcessDidTerminate): (WebKit::WebProcessPool::serviceWorkerProcessCrashed): (WebKit::WebProcessPool::gpuProcessExited): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch): 2022-04-18 Said Abou-Hallawa REGRESSION(r288847): GPU Process crash under GPUProcess::canExitUnderMemoryPressure() https://bugs.webkit.org/show_bug.cgi?id=238558 rdar://91052033 Reviewed by Kimmo Kinnunen. Use the rendering resources request count to keep the GPU process alive. RemoteRenderingBackend updates it when active image buffers change. RemoteGraphicsContextGL updates it on creation and destruction. RemoteMediaPlayerProxy updates it on creation and destruction. Remove RemoterRenderingBackend::updateRenderingResourceRequest(), the count is now counted by RemoteImageBuffer creation, destruction. Remove RemoterRenderingBackend::allowsExitUnderMemoryPressure(), it was crashing due to race between the function and the work queue cleanup task. Remove RemoteMediaPlayerManagerProxy::allowsExitUnderMemoryPressure(), the count is already counted by RemoteMediaPlayerProxy creation, destruction. Based on the initial patch by Kimmo Kinnunen. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::allowsExitUnderMemoryPressure const): * GPUProcess/graphics/QualifiedResourceHeap.h: (WebKit::QualifiedResourceHeap::hasImageBuffer const): Deleted. (WebKit::QualifiedResourceHeap::hasNativeImage const): Deleted. (WebKit::QualifiedResourceHeap::hasFont const): Deleted. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::m_renderingResourcesRequest): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier): (WebKit::RemoteRenderingBackend::releaseRemoteResourceWithQualifiedIdentifier): (WebKit::RemoteRenderingBackend::updateRenderingResourceRequest): Deleted. (WebKit::RemoteRenderingBackend::allowsExitUnderMemoryPressure const): Deleted. * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteResourceCache.h: (WebKit::RemoteResourceCache::resourceHeap const): Deleted. (WebKit::RemoteResourceCache::hasActiveDrawables const): Deleted. * GPUProcess/graphics/ScopedRenderingResourcesRequest.h: (WebKit::hasOutstandingRenderingResourceUsage): * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::deleteMediaPlayer): (WebKit::RemoteMediaPlayerManagerProxy::allowsExitUnderMemoryPressure const): Deleted. * GPUProcess/media/RemoteMediaPlayerManagerProxy.h: 2022-04-18 Elliott Williams [XCBuild] Use XCBuild for all command-line and project builds https://bugs.webkit.org/show_bug.cgi?id=238916 Reviewed by Alexey Proskuryakov. * WebKit.xcodeproj/project.pbxproj: 2022-04-18 Per Arne Vollan Block system calls in the Network process https://bugs.webkit.org/show_bug.cgi?id=238935 Reviewed by Geoffrey Garen. Block unused system calls in the Network process on macOS and iOS. This is based on collected telemetry. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb.in: 2022-04-18 Wenson Hsieh Unreviewed, fix the internal watchOS engineering build In the case where `HAVE(UIKIT_WITH_MOUSE_SUPPORT)` is off, internal watchOS engineering builds fail due to `shouldEnableAlternativeMouseGestureRecognizers` being unused. Fix this, and do some minor cleanup in this code while we're here: - Remove extra space before `_alternateMouseGestureRecognizer.get()`. - Move * to the correct side for Objective-C instances. - Fix a typo: "alternativeMouseRecgnizer" => "alternativeMouseRecognizer". * UIProcess/ios/WKContentViewInteraction.mm: (shouldEnableAlternativeMouseGestureRecognizers): (-[WKContentView _configureMouseGestureRecognizer]): 2022-04-18 Wenson Hsieh Make the main video heuristic robust when video elements are added after entering fullscreen https://bugs.webkit.org/show_bug.cgi?id=239438 rdar://91867187 Reviewed by Eric Carlson. Adjust the heuristic for identifying the most prominent video element in an element fullscreen container, such that it can detect video elements that are inserted into the document after we've already entered fullscreen mode. See below for more details. Exercised by a new internal API test. * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::setElement): Listen for several events (play, pause, loadedmetadata) that are bubbled up to the fullscreen container element, from any media element underneath the fullscreen container; in response to these events, we re-run the main fullscreen video element heuristic to update `m_mainVideoElement` (and cancel and reschedule the video extraction timer, if this main video element changed). (WebKit::WebFullScreenManager::enterFullScreenForElement): (WebKit::WebFullScreenManager::didEnterFullScreen): Pull existing logic for walking through the element fullscreen DOM in search of video elements out into a new helper method, `updateMainVideoElement`, that's invoked both when we finish entering fullscreen mode, and when observing any of the new events that bubble up to the fullscreen container. (WebKit::WebFullScreenManager::updateMainVideoElement): (WebKit::WebFullScreenManager::handleEvent): (WebKit::WebFullScreenManager::setMainVideoElement): * WebProcess/FullScreen/WebFullScreenManager.h: 2022-04-17 Chris Dumez Leverage StringView in more places https://bugs.webkit.org/show_bug.cgi?id=239426 Reviewed by Sam Weinig. Leverage StringView in more places, to reduce the number of String allocations. * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::dictionaryPopupInfoForRange): 2022-04-16 Chris Dumez Drop String::truncate() and use String::left() instead https://bugs.webkit.org/show_bug.cgi?id=239412 Reviewed by Darin Adler. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::getUserDirectorySuffix): 2022-04-15 Chris Dumez Leverage StringView in more places to avoid some String allocations https://bugs.webkit.org/show_bug.cgi?id=239356 Reviewed by Darin Adler. * Platform/cocoa/ImageAnalysisUtilities.mm: (WebKit::makeTextRecognitionResult): * UIProcess/Cocoa/MediaPermissionUtilities.mm: (WebKit::visibleDomain): * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performJavaScriptURLRequest): 2022-04-15 Wenson Hsieh Add a helper function to perform additional setup on VKCImageAnalysis(Interaction|OverlayView) https://bugs.webkit.org/show_bug.cgi?id=239391 rdar://91466567 Reviewed by Tim Horton. Add a helper function to ImageAnalysisUtilities, and call it on both iOS (WKContentView) and macOS (WebViewImpl). * Platform/cocoa/ImageAnalysisUtilities.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::installImageAnalysisOverlayView): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _singleTapIdentified:]): (-[WKContentView installImageAnalysisInteraction:]): (-[WKContentView imageAnalysisInteraction:shouldBeginAtPoint:forAnalysisType:]): Add support for toggling the Live Text overlay when tapping on the image analysis button owned by the interaction. This custom handling is necessary, since the synthetic tap gesture recognizer does not recognize simultaneously alongside the tap gesture for VisionKit's UIButton, and we can't (easily) grab VisionKit's button's tap gesture to add failure requirements to our synthetic tap gesture. 2022-04-15 Yusuke Suzuki [JSC] Remove VM& parameter from structure related code including jsDyamicCast https://bugs.webkit.org/show_bug.cgi?id=239362 Reviewed by Darin Adler. * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::setScriptObject): (WebKit::WebAutomationSessionProxy::elementForNodeHandle): * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::reportException): * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::encodeArgument): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::counterValue): 2022-04-15 Brent Fulgham Add new dyld support sandbox rules https://bugs.webkit.org/show_bug.cgi?id=238389 Reviewed by Eric Carlson. Update sandbox profiles to adopt a new dyld-related utility file on platforms where it exists. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.adattributiond.sb.in: * WebProcess/com.apple.WebProcess.sb.in: * webpushd/mac/com.apple.WebKit.webpushd.sb.in: 2022-04-15 Brent Fulgham REGRESSION (r291843): Broken Netflix and Amazon video playback https://bugs.webkit.org/show_bug.cgi?id=239397 Unreviewed revert of r291843. * WebProcess/WebPage/WebPage.cpp: (WebKit::adjustSettingsForCaptivePortal): 2022-04-15 Tim Horton Make it possible to adjust the final trait collection applied by LocalCurrentTraitCollection https://bugs.webkit.org/show_bug.cgi?id=239375 rdar://problem/87115393 Reviewed by Wenson Hsieh. * UIProcess/API/ios/WKWebViewIOS.mm: (scrollViewBackgroundColor): * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::contentViewBackgroundColor): 2022-04-15 J Pascoe [WebAuthn] Implement getTransports() and getAuthenticatorData() on AuthenticatorAttestationResponse https://bugs.webkit.org/show_bug.cgi?id=238966 rdar://problem/91449906 This change implements the getTransports() and getAuthenticatorData() functions on AuthenticatorAttestationResponse. For security keys, the supported transports of the key are parsed from authenticatorGetInfo. For the local authenticator, the supported transports are specified according to which features are available. getAuthenticatorData() is a convenience method for RPs who want to avoid parsing CBOR. Reviewed by Brent Fulgham. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: * UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponse.h: * UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponse.mm: (-[_WKAuthenticatorAttestationResponse initWithClientDataJSON:rawId:extensions:attestationObject:attachment:transports:]): (-[_WKAuthenticatorAttestationResponse initWithClientDataJSON:rawId:extensions:attestationObject:attachment:]): Deleted. * UIProcess/API/Cocoa/_WKAuthenticatorAttestationResponseInternal.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (wkExtensionsClientOutputs): (wkAuthenticatorAttestationResponse): (wkAuthenticatorAssertionResponse): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticatorInternal::transports): (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested): * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm: (WebKit::toASCDescriptor): (WebKit::toAuthenticatorTransports): (WebKit::continueAfterRequest): * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived): (WebKit::CtapAuthenticator::transports): * UIProcess/WebAuthentication/fido/CtapAuthenticator.h: * UIProcess/WebAuthentication/fido/CtapDriver.h: (WebKit::CtapDriver::transport const): (WebKit::CtapDriver::protocol const): (WebKit::CtapDriver::CtapDriver): * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: (WebKit::CtapHidDriver::CtapHidDriver): * UIProcess/WebAuthentication/fido/CtapNfcDriver.cpp: (WebKit::CtapNfcDriver::CtapNfcDriver): * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived): 2022-04-14 Simon Fraser Use the ProcessTerminationReason enum for all the process types https://bugs.webkit.org/show_bug.cgi?id=239372 Reviewed by Chris Dumez. WebProcess, NetworkProcess and GPUProcess all had their own "termination reasons" enums. Use ProcessTerminationReason for all of them (noting values that only apply to the web process). Also provide a helper function to turn the reasons into a string. * Shared/ProcessTerminationReason.cpp: Copied from Source/WebKit/Shared/ProcessTerminationReason.h. (WebKit::processTerminationReasonToString): * Shared/ProcessTerminationReason.h: * Sources.txt: * UIProcess/API/C/WKAPICast.h: (WebKit::toAPI): * UIProcess/Cocoa/NavigationState.mm: (WebKit::wkProcessTerminationReason): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::gpuProcessExited): (WebKit::GPUProcessProxy::processIsReadyToExit): (WebKit::GPUProcessProxy::didClose): (WebKit::GPUProcessProxy::didFinishLaunching): (WebKit::GPUProcessProxy::didBecomeUnresponsive): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::terminate): (WebKit::NetworkProcessProxy::networkProcessDidTerminate): (WebKit::NetworkProcessProxy::didClose): (WebKit::NetworkProcessProxy::didFinishLaunching): (WebKit::NetworkProcessProxy::didExceedMemoryLimit): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::shouldReloadAfterProcessTermination): (WebKit::WebPageProxy::gpuProcessExited): (WebKit::processTerminationReasonToString): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::networkProcessDidTerminate): (WebKit::WebProcessPool::gpuProcessExited): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::gpuProcessExited): * UIProcess/WebProcessProxy.h: * WebKit.xcodeproj/project.pbxproj: 2022-04-15 Youenn Fablet ServiceWorker.postMessage() doesn't work from inside iframe https://bugs.webkit.org/show_bug.cgi?id=213984 Reviewed by Chris Dumez. Pass the full ClientOrigin when registering a service worker client. Filter out clients that cannot be matched: - non HTTP/blob/about:blank clients - sandboxed HTTP clients * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: * WebProcess/Storage/WebSWClientConnection.cpp: * WebProcess/Storage/WebSWClientConnection.h: 2022-04-14 Claudio Saavedra [GTK] Default initialize GTK-specific print info in WebKit::PrintInfo https://bugs.webkit.org/show_bug.cgi?id=196542 Reviewed by Adrian Perez de Castro. printInfoFromWKPrintInfo() will not initialize GTK-specific bits, leading to problems down the road with IPC encoders, so add default values. * Shared/PrintInfo.h: 2022-04-15 Zan Dobersek [GTK][WPE] Remove exclusive build guards around GPU process preferences, code https://bugs.webkit.org/show_bug.cgi?id=239331 Reviewed by Philippe Normand. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createGraphicsContextGL const): Remove restrictive guards around the check for remote-WebGL execution, only remaining guard being ENABLE(GPU_PROCESS). 2022-04-14 Antoine Quint [model] ASVInlinePreview objects don't get cleared when the model source changes https://bugs.webkit.org/show_bug.cgi?id=239064 Reviewed by Dean Jackson. We add a new ModelElementDestroyRemotePreview message going from the Web process to the UI process to notify that an ASVInlinePreview with a given UUID should be cleared. This message is sent via ~ARKitInlinePreviewModelPlayerMac since any unused resource will trigger the destruction of such objects. For testing purposes, we also add a new ModelInlinePreviewUUIDs message going from the Web process to the UI process to retreive the list of UUIDs for the ASVInlinePreview objects currently loaded in the UI process. This will allow tests to check whether the UUID for a given element is correctly removed from the UI process. * UIProcess/Cocoa/ModelElementControllerCocoa.mm: (WebKit::ModelElementController::modelElementDestroyRemotePreview): (WebKit::ModelElementController::inlinePreviewUUIDs): * UIProcess/ModelElementController.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::modelElementDestroyRemotePreview): (WebKit::WebPageProxy::modelInlinePreviewUUIDs): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h: * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm: (WebKit::ARKitInlinePreviewModelPlayerMac::~ARKitInlinePreviewModelPlayerMac): (WebKit::ARKitInlinePreviewModelPlayerMac::inlinePreviewUUIDForTesting const): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::modelInlinePreviewUUIDs const): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 2022-04-14 Wenson Hsieh Undo option after invoking "Markup Image" says "Undo Paste" https://bugs.webkit.org/show_bug.cgi?id=239351 rdar://91647863 Reviewed by Darin Adler. Rename `replaceWithPasteboardData` to the more specific `replaceImageWithMarkupResults`. This method was introduced (and is currently only used) to drive image replacement using "Markup Image"; giving this method a more specific name allows us to hard-code `EditAction::MarkupImage` when calling into Editor to carry out the replacement editing action in `WebPage::replaceImageWithMarkupResults`. See WebCore/ChangeLog for additional details. * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::replaceImageWithMarkupResults): (WebKit::WebPageProxy::replaceWithPasteboardData): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView imageAnalysisMarkupMenu]): * UIProcess/mac/WebContextMenuProxyMac.mm: (WebKit::WebContextMenuProxyMac::applyMarkupToControlledImage): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::replaceImageWithMarkupResults): (WebKit::WebPage::replaceWithPasteboardData): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2022-04-14 Wenson Hsieh Unreviewed, fix the Catalyst build after r292888 `MCProfileConnection` is not available on Mac Catalyst. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _dataOwnerForPasteboard:]): 2022-04-14 Wenson Hsieh [iOS] [WK2] Managed pasteboard should function for all managed domains https://bugs.webkit.org/show_bug.cgi?id=239319 rdar://80059355 Reviewed by Kate Cheney. Unless a WebKit client has specified a data owner for the web view that is not _UIDataOwnerUndefined, fall back to _UIDataOwnerEnterprise when the current domain of the WKWebView is managed (that is, `-[MCProfileConnection isURLManaged:]` returns YES for the web view's current URL). This allows managed pasteboard to work for all WebKit clients, if the current URL is managed. Test: UIPasteboardTests.PerformAsDataOwnerWithManagedURL * Platform/spi/ios/UIKitSPI.h: Drive-by fix: move the staged declarations of `-_dataOwnerForCopy` and `-_dataOwnerForPaste` out of the IPI section, and into the non-internal SDK section. * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _dataOwnerForPasteboard:]): 2022-04-14 J Pascoe [WebAuthn] Clean up WebAuthenticationModern and WebAuthnProcess https://bugs.webkit.org/show_bug.cgi?id=239073 rdar://problem/91571030 The WebAuthenticationModern flag and WebAuthnProcess are no longer used and can be removed. This patch removes all references to both the flag and the process. Reviewed by Brent Fulgham. Covered by existing tests and manual testing on macOS / iOS. * Configurations/WebAuthnService.xcconfig: Removed. * Configurations/WebKit.xcconfig: * DerivedSources.make: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb.in: Removed. * Scripts/process-entitlements.sh: * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::isInWebKitChildProcess): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceEventHandler): * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::processStorageClass): (WebKit::sandboxDirectory): * Sources.txt: * SourcesCocoa.txt: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetWebAuthenticationModernEnabled): Deleted. (WKPreferencesGetWebAuthenticationModernEnabled): Deleted. * UIProcess/API/C/WKPreferencesRefPrivate.h: * UIProcess/API/Cocoa/WKProcessPool.mm: (+[WKProcessPool _webAuthnProcessIdentifier]): Deleted. * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (+[_WKWebAuthenticationPanel importLocalAuthenticatorWithAccessGroup:credential:error:]): * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::getLaunchOptions): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::notifyPreferencesChanged): * UIProcess/Launcher/ProcessLauncher.h: * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::serviceName): (WebKit::shouldLeakBoost): * UIProcess/WebAuthentication/Authenticator.h: (WebKit::Authenticator::requestData const): (WebKit::Authenticator::setWebAuthenticationModernEnabled): Deleted. (WebKit::Authenticator::webAuthenticationModernEnabled const): Deleted. (): Deleted. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::AuthenticatorManager::authenticatorAdded): (WebKit::AuthenticatorManager::enableModernWebAuthentication): Deleted. * UIProcess/WebAuthentication/AuthenticatorManager.h: * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::makeCredential): (WebKit::LocalAuthenticator::getAssertion): (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected): * UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp: Removed. * UIProcess/WebAuthentication/WebAuthnProcessProxy.h: Removed. * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived): (WebKit::CtapAuthenticator::continueRequestPinAfterGetKeyAgreement): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::getWebAuthnProcessConnection): Deleted. * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getWebAuthnProcessConnection): Deleted. * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-OSX.plist: Removed. * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnService/Info-iOS.plist: Removed. * WebAuthnProcess/EntryPoint/Cocoa/XPCService/WebAuthnServiceEntryPoint.mm: Removed. * WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp: Removed. * WebAuthnProcess/WebAuthnConnectionToWebProcess.h: Removed. * WebAuthnProcess/WebAuthnConnectionToWebProcess.messages.in: Removed. * WebAuthnProcess/WebAuthnProcess.cpp: Removed. * WebAuthnProcess/WebAuthnProcess.h: Removed. * WebAuthnProcess/WebAuthnProcess.messages.in: Removed. * WebAuthnProcess/WebAuthnProcessCreationParameters.cpp: Removed. * WebAuthnProcess/WebAuthnProcessCreationParameters.h: Removed. * WebAuthnProcess/ios/WebAuthnProcessIOS.mm: Removed. * WebAuthnProcess/mac/WebAuthnProcessMac.mm: Removed. * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: Removed. * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable): * WebProcess/WebAuthentication/WebAuthnProcessConnection.cpp: Removed. * WebProcess/WebAuthentication/WebAuthnProcessConnection.h: Removed. * WebProcess/WebAuthentication/WebAuthnProcessConnection.messages.in: Removed. * WebProcess/WebAuthentication/WebAuthnProcessConnectionInfo.h: Removed. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): * WebProcess/WebProcess.cpp: (WebKit::getWebAuthnProcessConnection): Deleted. (WebKit::WebProcess::ensureWebAuthnProcessConnection): Deleted. (WebKit::WebProcess::webAuthnProcessConnectionClosed): Deleted. * WebProcess/WebProcess.h: (WebKit::WebProcess::existingWebAuthnProcessConnection): Deleted. 2022-04-14 Aditya Keerthi [iOS] Add support for find-and-replace keyboard shortcut https://bugs.webkit.org/show_bug.cgi?id=239320 rdar://91537724 Reviewed by Wenson Hsieh. * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView canPerformActionForWebView:withSender:]): (-[WKContentView findAndReplaceForWebView:]): 2022-04-14 Chris Dumez Drop inefficient String::append() overloads https://bugs.webkit.org/show_bug.cgi?id=239289 Reviewed by Sam Weinig. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::populateSandboxInitializationParameters): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::setSuggestedFilename): 2022-04-14 Justin Michaud [PGO] We should be able to build WebKit to collect PGO profiles easily https://bugs.webkit.org/show_bug.cgi?id=238776 Reviewed by Wenson Hsieh. * Configurations/BaseTarget.xcconfig: * Configurations/WebKit.xcconfig: * GPUProcess/mac/GPUProcessMac.mm: (WebKit::GPUProcess::initializeProcess): * NetworkProcess/mac/NetworkProcessMac.mm: (WebKit::NetworkProcess::initializeProcess): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_appHighlightsVisible): 2022-04-14 Youenn Fablet REGRESSION (249029@main): http/wpt/cache-storage/cache-storage-networkprocess-crash.html is a flaky CRASH with ASSERTION FAILED: m_pageMap.isEmpty() https://bugs.webkit.org/show_bug.cgi?id=239095 Reviewed by Chris Dumez. We send the same IPC message to close WebSWContextManagerConnection from either network process or UIProcess. To prevent closing twice the same connection, we exit early if the connection is closed. Covered by existing tests. * WebProcess/Storage/WebSWContextManagerConnection.cpp: * WebProcess/Storage/WebSharedWorkerContextManagerConnection.cpp: 2022-04-14 Kate Cheney WKWebView: navigator.serviceWorker.register method fails for a new version of an already registered service worker. https://bugs.webkit.org/show_bug.cgi?id=229554 Reviewed by Brent Fulgham. Plumbing to override the max service worker registration count for test purposes. See WebCore changelog for details. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::NetworkSession): (WebKit::NetworkSession::ensureSWServer): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::overrideServiceWorkerRegistrationCountTestingValue const): * NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::encode const): (WebKit::NetworkSessionCreationParameters::decode): * NetworkProcess/NetworkSessionCreationParameters.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: (-[_WKWebsiteDataStoreConfiguration overrideServiceWorkerRegistrationCountTestingValue]): (-[_WKWebsiteDataStoreConfiguration setOverrideServiceWorkerRegistrationCountTestingValue:]): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::copy const): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::overrideServiceWorkerRegistrationCountTestingValue const): (WebKit::WebsiteDataStoreConfiguration::setOverrideServiceWorkerRegistrationCountTestingValue): 2022-04-14 Zan Dobersek [WK2] Enable more efficient encoding of synchronous-message reply arguments https://bugs.webkit.org/show_bug.cgi?id=238740 Reviewed by Kimmo Kinnunen. Handling of synchronous messages requires construction of a CompletionHandler object that wraps a lambda function which handles logging of the passed-in reply arguments as well as subsequent encoding and dispatching of the reply into the IPC channel. Right now, for any given message the CompletionHandler type is generated from the IPC message specification, and it's essentially a function type with a void return value and const lvalue references for every non-builtin parameter type. This type is imposed onto the lambda handler and when invoked, all the reply arguments are passed on to the IPC encoding as lvalue references. This inhibits opportunities where the reply argument could instead be moved into the completion handler invocation, enabling a more efficient encoding of the passed-in value. For instance, if a Unix file descriptor was moved into the completion handler invocation, it could be trickled down into an IPC::Attachment object and dispatched over IPC without any problems. Instead, because the lvalue reference is imposed as the type, it will have to be duplicated even if the object itself is expiring or would be movable down the invocation. To cover these cases, the actual completion handler type is now deduced from the synchronous-message-handling method itself. This means that the completion handler parameter for the given handler method can now specify whether it wants to receive reply arguments by value or by either lvalue or rvalue reference. The completion handler lambda can combine these parameter types with std::forward() to pass down the actual arguments in the most optimal fashion. To avoid problems, each CompletionHandler specialization retrieved from the method siganture is validated against the CompletionHandler type generated from the IPC specification, requiring that the decayed parameter types match between the two. It's still possible to directly use the CompletionHandler type from the IPC specification as the completion handler type in the message-handling method. An rvalue reference variant of ArgumentCoder::encode() is added. Generic implementation again casts the passed-in reference into an rvalue and calls the encode() on that object. If that type provides ref-qualified encode() methods, implementations of those methods can adjust and more aggressively move things into the encoder when the method is called on an rvalue. It would also be possible to delete the ref-qualified method covering lvalues, meaning encoding would be allowed only for objects that are moved into the completion handler. For types with custom specializations of ArgumentCoder, those specializations would again have to provide rvalue variants of the encode() method and handle the passed-in values appropriately. The send() methods that were previously generated for every IPC message are removed in favor of encoding and calling Connection::sendSyncReply() in the completion-handler lambda. Missing std::forward() calls are added in parameter pack expansions as required. * GPUProcess/media/RemoteCDMProxy.cpp: (WebKit::RemoteCDMProxy::getSupportedConfiguration): * GPUProcess/media/RemoteCDMProxy.h: * GPUProcess/media/RemoteImageDecoderAVFProxy.cpp: (WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex): * GPUProcess/media/RemoteImageDecoderAVFProxy.h: * Platform/IPC/ArgumentCoder.h: (IPC::ArgumentCoder::encode): * Platform/IPC/HandleMessage.h: (IPC::C::): (IPC::CompletionHandlerValidation::matchingParameters): (IPC::CompletionHandlerValidation::matchingTypes): (IPC::handleMessageSynchronous): (IPC::handleMessageSynchronousWantsConnection): (IPC::handleMessageAsync): (IPC::handleMessageAsyncWantsConnection): * Platform/IPC/StreamServerConnection.h: (IPC::StreamServerConnection::sendSyncReply): * Scripts/webkit/messages.py: (message_to_struct_declaration): (generate_message_handler): * Scripts/webkit/tests/TestWithCVPixelBufferMessageReceiver.cpp: (Messages::TestWithCVPixelBuffer::ReceiveCVPixelBuffer::send): Deleted. * Scripts/webkit/tests/TestWithCVPixelBufferMessages.h: * Scripts/webkit/tests/TestWithImageDataMessageReceiver.cpp: (Messages::TestWithImageData::ReceiveImageData::send): Deleted. * Scripts/webkit/tests/TestWithImageDataMessages.h: * Scripts/webkit/tests/TestWithLegacyReceiverMessageReceiver.cpp: (Messages::TestWithLegacyReceiver::CreatePlugin::send): Deleted. (Messages::TestWithLegacyReceiver::RunJavaScriptAlert::send): Deleted. (Messages::TestWithLegacyReceiver::GetPlugins::send): Deleted. (Messages::TestWithLegacyReceiver::GetPluginProcessConnection::send): Deleted. (Messages::TestWithLegacyReceiver::TestMultipleAttributes::send): Deleted. (Messages::TestWithLegacyReceiver::InterpretKeyEvent::send): Deleted. * Scripts/webkit/tests/TestWithLegacyReceiverMessages.h: * Scripts/webkit/tests/TestWithSemaphoreMessageReceiver.cpp: (Messages::TestWithSemaphore::ReceiveSemaphore::send): Deleted. * Scripts/webkit/tests/TestWithSemaphoreMessages.h: * Scripts/webkit/tests/TestWithSuperclassMessageReceiver.cpp: (Messages::TestWithSuperclass::TestAsyncMessage::send): Deleted. (Messages::TestWithSuperclass::TestAsyncMessageWithNoArguments::send): Deleted. (Messages::TestWithSuperclass::TestAsyncMessageWithMultipleArguments::send): Deleted. (Messages::TestWithSuperclass::TestAsyncMessageWithConnection::send): Deleted. (Messages::TestWithSuperclass::TestSyncMessage::send): Deleted. (Messages::TestWithSuperclass::TestSynchronousMessage::send): Deleted. * Scripts/webkit/tests/TestWithSuperclassMessages.h: * Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp: (Messages::TestWithoutAttributes::CreatePlugin::send): Deleted. (Messages::TestWithoutAttributes::RunJavaScriptAlert::send): Deleted. (Messages::TestWithoutAttributes::GetPlugins::send): Deleted. (Messages::TestWithoutAttributes::GetPluginProcessConnection::send): Deleted. (Messages::TestWithoutAttributes::TestMultipleAttributes::send): Deleted. (Messages::TestWithoutAttributes::InterpretKeyEvent::send): Deleted. * Scripts/webkit/tests/TestWithoutAttributesMessages.h: * UIProcess/ProvisionalPageProxy.cpp: Add a missing include that brings in the definition of the WebBackForwardListCounts type along with its encode() method. 2022-04-14 Kimmo Kinnunen Some IPC related message forwarding functions use const lvalue references https://bugs.webkit.org/show_bug.cgi?id=238937 Reviewed by Antti Koivisto. Passing the message as const lvalue reference prevents IPC messages to be changed to support move semantics for some message arguments. Fix by using universal references in the shell function signatures. Forward the messages from one shell function to other as rvalue references via WTFMove, since the messages are always such that they are forwarded so. This also catches most such errors in the future. No new tests, refactor. * Platform/IPC/MessageSender.h: (IPC::MessageSender::send): (IPC::MessageSender::sendSync): (IPC::MessageSender::sendWithAsyncReply): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::send): 2022-04-14 Youenn Fablet Expose workers as service worker clients and implement registration matching for dedicated workers https://bugs.webkit.org/show_bug.cgi?id=239066 Reviewed by Chris Dumez. Reuse the same strategy for DedicatedWorkers as for Documents to match registrations and control then: - Do matching in network process - If matching, send a message to WebProcess to set the matching registration data. Add specific handling for worker registration rematching in case of redirections: - If redirection comes from service worker (via respondWith), do rematching. - If redirection comes from network, do not do rematching. * NetworkProcess/NetworkResourceLoader.cpp: * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: * WebProcess/Network/WebLoaderStrategy.cpp: * WebProcess/Storage/WebSWClientConnection.cpp: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWClientConnection.messages.in: 2022-04-14 Youenn Fablet A shared worker in a cached page should not allow the remote shared worker to continue executing https://bugs.webkit.org/show_bug.cgi?id=239286 Reviewed by Chris Dumez. Store whether shared worker objects are suspended or resumed. If all objects are suspended, suspend the remote shared worker. Otherwise, keep the remote shared worker live. Add plumbing code to make this happen. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: * NetworkProcess/SharedWorker/WebSharedWorker.cpp: * NetworkProcess/SharedWorker/WebSharedWorker.h: * NetworkProcess/SharedWorker/WebSharedWorkerServer.cpp: * NetworkProcess/SharedWorker/WebSharedWorkerServer.h: * NetworkProcess/SharedWorker/WebSharedWorkerServerConnection.cpp: * NetworkProcess/SharedWorker/WebSharedWorkerServerConnection.h: * NetworkProcess/SharedWorker/WebSharedWorkerServerConnection.messages.in: * NetworkProcess/SharedWorker/WebSharedWorkerServerToContextConnection.cpp: * NetworkProcess/SharedWorker/WebSharedWorkerServerToContextConnection.h: * WebProcess/Storage/WebSharedWorkerContextManagerConnection.messages.in: * WebProcess/Storage/WebSharedWorkerObjectConnection.cpp: * WebProcess/Storage/WebSharedWorkerObjectConnection.h: 2022-04-13 Chris Dumez Replace calls to substring(0, x) with the more concise left(x) https://bugs.webkit.org/show_bug.cgi?id=239306 Reviewed by Darin Adler. * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp: (WebKit::LocalStorageDatabaseTracker::origins const): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::traverseRecordsFiles): * NetworkProcess/storage/LocalStorageManager.cpp: (WebKit::fileNameToOrigin): * Shared/API/c/WKString.cpp: (WKStringGetCharacters): * UIProcess/API/glib/InputMethodFilter.cpp: (WebKit::InputMethodFilter::notifySurrounding): * UIProcess/gtk/GtkSettingsManager.cpp: (WebKit::GtkSettingsManager::themeName const): * UIProcess/gtk/TextCheckerGtk.cpp: (WebKit::TextChecker::checkTextOfParagraph): * UIProcess/win/WebProcessPoolWin.cpp: (WebKit::initializeRemoteInspectorServer): 2022-04-13 Alex Christensen Adjust when _setPrivacyProxyFailClosedForUnreachableNonMainHosts is called https://bugs.webkit.org/show_bug.cgi?id=237735 Reviewed by Geoff Garen. This is recommitting http://trac.webkit.org/r291598 but leaving the definition of PrivateRelayed::Yes and ::No based on whether metrics._privacyStance == nw_connection_privacy_stance_direct instead of nw_connection_privacy_stance_failed. It has flip flopped several times in the various related commits, but it needs to be nw_connection_privacy_stance_direct. I manually verified that this fixes without reintroducing . * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): (WebKit::NetworkSessionCocoa::createWebSocketTask): 2022-04-13 Elliott Williams [Xcode] Fix public watchOS workspace build by updating scheme and build settings https://bugs.webkit.org/show_bug.cgi?id=239301 Reviewed by Alexey Proskuryakov. * Configurations/WebKit.xcconfig: 2022-04-13 Chris Dumez WebContent crashes with SIGTERM_TIMEOUT on macOS https://bugs.webkit.org/show_bug.cgi?id=239298 Reviewed by Darin Adler. To make sure that WebProcesses cannot use any CPU time while in the WebProcess cache on macOS, I recently tried to suspend these cached processes. However, since we haven't adopted RunningBoard on macOS yet, I was doing suspension and resuming manually via the SIGSTOP & SIGCONT signals. While this properly suspended our cached processes, this introduced SIGTERM_TIMEOUT crashes and potential delays when exiting Safari or logging out of macOS while Safari is running. This is because our cached & suspended processes are unable to process the SIGTERM signal they receive and thus don't cleanly exit. After a timeout, the system forcefully kills them and generates a crash log with SIGTERM_TIMEOUT to let us know. To address the issue, I am disabling the WebProcess suspension logic that I recently added. We can reconsider doing something like this once we adopt RunningBoard on macOS, assuming the same issue doesn't affect suspension via RunningBoard. * UIProcess/mac/WebProcessProxyMac.mm: (WebKit::WebProcessProxy::platformSuspendProcess): (WebKit::WebProcessProxy::platformResumeProcess): 2022-04-13 Michael Catanzaro Misc compiler warnings, April 2022 edition https://bugs.webkit.org/show_bug.cgi?id=239290 Reviewed by Adrian Perez de Castro. * NetworkProcess/storage/OriginStorageManager.cpp: (WebKit::OriginStorageManager::StorageBucket::resolvedPath): 2022-04-13 Simon Fraser [css-scroll-snap] scrollIntoView fails with scroll-snap-type on :root https://bugs.webkit.org/show_bug.cgi?id=239063 Reviewed by Dean Jackson. Programmatic smooth scrolls on iframe documents were broken because ScrollingTreeFrameScrollingNodeRemoteIOS was overlooked when adding support (easily done since the main frame's scrolling is controlled via the WKWebView; some unification here would be beneficial). Implementing startAnimatedScrollToPosition() and stopAnimatedScroll() on ScrollingTreeFrameScrollingNodeRemoteIOS fixes this. However, this revealed an additional bug; RenderLayer::scrollRectToVisible() failed to clamp the target scroll position correctly, and nothing in the iOS-smooth scrolling code path clamped, so the scroll would go too far. Testing required getting UIHelper.waitForScrollCompletion() to work. This is based on the uiController.didEndScrollingCallback, but that was only hooked up for the main scroller. So make it work for all scrollers by plumbing ScrollingNodeIDs through scrollingNodeScrollViewDidScroll() and friends so that everything ends up in -[WKWebViewIOS _didFinishScrolling:] with a UIScrollView argument; to avoid any behavior change, this bails for non-main scroll views, but TestRunnerWKWebView overrides it to make testing work. Test: fast/scrolling/ios/constrain-scrollintoview-position.html * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _didFinishScrolling:]): (-[WKWebView scrollViewDidEndDragging:willDecelerate:]): (-[WKWebView scrollViewDidEndDecelerating:]): (-[WKWebView scrollViewDidScrollToTop:]): (-[WKWebView scrollViewDidEndScrollingAnimation:]): (-[WKWebView _didFinishScrolling]): Deleted. * UIProcess/PageClient.h: * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll): * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture): (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll): (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll): * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h: * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::startAnimatedScrollToPosition): (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::stopAnimatedScroll): * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: (-[WKScrollingNodeScrollViewDelegate scrollViewDidEndScrollingAnimation:]): (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::scrollingNodeScrollViewWillStartPanGesture): (WebKit::PageClientImpl::scrollingNodeScrollViewDidScroll): (WebKit::PageClientImpl::scrollingNodeScrollWillStartScroll): (WebKit::PageClientImpl::scrollingNodeScrollDidEndScroll): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _scrollingNodeScrollingWillBegin:]): (-[WKContentView _scrollingNodeScrollingDidEnd:]): (-[WKContentView keyboardScrollViewAnimatorDidFinishScrolling:]): (-[WKContentView _scrollingNodeScrollingWillBegin]): Deleted. (-[WKContentView _scrollingNodeScrollingDidEnd]): Deleted. * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::scrollingNodeScrollViewWillStartPanGesture): (WebKit::WebPageProxy::scrollingNodeScrollViewDidScroll): (WebKit::WebPageProxy::scrollingNodeScrollWillStartScroll): (WebKit::WebPageProxy::scrollingNodeScrollDidEndScroll): * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm: (WebKit::WebChromeClient::didStartOverflowScroll): (WebKit::WebChromeClient::didEndOverflowScroll): 2022-04-13 Chris Dumez Replace AtomString(const char*) with AtomString::fromLatin1(const char*) https://bugs.webkit.org/show_bug.cgi?id=239127 Reviewed by Darin Adler. * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: (WebKit::PDFPluginPasswordField::createAnnotationElement): * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSIPC::messages): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::focusedElementInformation): 2022-04-13 Kimmo Kinnunen RemoteRenderingBackend should have dedicated IPC::Connection for out-of-stream messages https://bugs.webkit.org/show_bug.cgi?id=238516 Reviewed by Simon Fraser. Use dedicated IPC::Connection for RemoteRenderingBackend IPC stream connection instead of using the WP-GPUP main connection. RemoteDisplayListRecorder starts listening to its messages in the worker thread. At that point, some out-of-stream message for that id might already have been dispatched to main thread, causing missing message and assert. Instead, use dedicated connection and route all the messages to the StreamServerConnection in a "message queue". This way when each out-of-stream message marker is processed, the message will be, directly or eventually, found from the message queue. Remove workarounds: - Adding a listener to the main WP-GPUP connection for all RemoteDisplayListRecorder messages and routing them to particular StreamServerConnection. This was problematic since there are many RRB StreamServerConnection instances, one per Page, but only one WP-GPUP connection. - RELEASE_LOG in MessageReceiveQueueMap about warning for the above. Turn this back into an ASSERT. Since IPC::StreamClientConnection and IPC::StreamServerConnection are like IPC::Connection, add open() and invalidate() calls. These have same contract as with IPC::Connection: open() should be called if connection is to be used, invalidate() must be called if open() was called. These calls have an effect currently only with dedicated connections, but these are added to all IPC::Stream*Connection clients for consistency and future uses. Changes semantics of IPC::Connection slightly: Before, there was no untrusted holders of "server" IPC::Connection, e.g. the IPC::Connection instances were never instantiated by WP. After, untrusted WP instantiates these IPC stream dedicated connections. This is accounted in the case where IPC::Connection ensures that IPC::MessageNames::InitializeConnection message is not acted on twice. Tested by imported/w3c/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/target_blank_implicit_noopener.html --child-processes=1 --experimental-feature=UseGPUProcessForDOMRenderingEnabled=true --iterations=100 --force --simulator * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createRenderingBackend): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUConnectionToWebProcess.messages.in: * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::initialize): (WebKit::RemoteGraphicsContextGL::stopListeningForIPC): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::create): (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::startListeningForIPC): (WebKit::RemoteRenderingBackend::stopListeningForIPC): (WebKit::RemoteRenderingBackend::messageSenderConnection const): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/WebGPU/RemoteGPU.cpp: (WebKit::RemoteGPU::initialize): (WebKit::RemoteGPU::stopListeningForIPC): * Platform/IPC/MessageReceiveQueueMap.cpp: (IPC::MessageReceiveQueueMap::addImpl): (IPC::MessageReceiveQueueMap::remove): * Platform/IPC/StreamClientConnection.cpp: (IPC::StreamClientConnection::createWithDedicatedConnection): (IPC::StreamClientConnection::StreamClientConnection): (IPC::StreamClientConnection::~StreamClientConnection): (IPC::StreamClientConnection::open): (IPC::StreamClientConnection::invalidate): (IPC::StreamClientConnection::connectionForTesting): * Platform/IPC/StreamClientConnection.h: (IPC::StreamClientConnection::send): (IPC::StreamClientConnection::sendSync): (IPC::StreamClientConnection::waitForAndDispatchImmediately): (IPC::StreamClientConnection::trySendSyncStream): * Platform/IPC/StreamServerConnection.cpp: (IPC::StreamServerConnection::create): (IPC::StreamServerConnection::createWithDedicatedConnection): (IPC::StreamServerConnectionBase::StreamServerConnectionBase): (IPC::StreamServerConnectionBase::~StreamServerConnectionBase): (IPC::StreamServerConnectionBase::open): (IPC::StreamServerConnectionBase::invalidate): (IPC::StreamServerConnectionBase::startReceivingMessagesImpl): (IPC::StreamServerConnectionBase::stopReceivingMessagesImpl): * Platform/IPC/StreamServerConnection.h: * Shared/IPCStreamTester.cpp: (WebKit::IPCStreamTester::initialize): (WebKit::IPCStreamTester::stopListeningForIPC): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy): (WebKit::RemoteGraphicsContextGLProxy::disconnectGpuProcessIfNeeded): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection): (WebKit::RemoteRenderingBackendProxy::disconnectGPUProcess): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp: (WebKit::RemoteGPUProxy::RemoteGPUProxy): (WebKit::RemoteGPUProxy::abandonGPUProcess): * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSIPCStreamClientConnection::sendMessage): (WebKit::IPCTestingAPI::JSIPCStreamClientConnection::sendSyncMessage): 2022-04-12 Wenson Hsieh Remove support for drawing cropped image overlays when hovering over "Copy Cropped Image" https://bugs.webkit.org/show_bug.cgi?id=239269 Reviewed by Darin Adler. * Shared/ContextMenuContextData.cpp: (WebKit::ContextMenuContextData::ContextMenuContextData): (WebKit::ContextMenuContextData::encode const): (WebKit::ContextMenuContextData::decode): * Shared/ContextMenuContextData.h: (WebKit::ContextMenuContextData::hitTestedElementContext const): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didDismissContextMenu): (WebKit::WebPageProxy::resetStateAfterProcessExited): * UIProcess/WebPageProxy.h: * UIProcess/mac/WebContextMenuProxyMac.mm: (-[WKMenuDelegate menu:willHighlightItem:]): Deleted. * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::handleContextMenuCopyCroppedImage): (WebKit::WebPageProxy::willHighlightContextMenuItem): Deleted. * WebProcess/WebPage/WebContextMenu.cpp: (WebKit::WebContextMenu::show): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didDismissContextMenu): (WebKit::WebPage::installCroppedImageOverlay): Deleted. (WebKit::WebPage::setCroppedImageOverlayVisibility): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2022-04-12 Elliott Williams [Xcode] In open-source builds, disable bitcode in xcconfigs instead of build-webkit https://bugs.webkit.org/show_bug.cgi?id=239262 Reviewed by Alexey Proskuryakov. * Configurations/Base.xcconfig: * SwiftOverlay/Configurations/Base.xcconfig: 2022-04-12 Tim Horton Adopt "version set"-based linked-on-or-after checks instead of platform-specific ones https://bugs.webkit.org/show_bug.cgi?id=239054 Reviewed by Wenson Hsieh. * Shared/AuxiliaryProcess.h: * Shared/Cocoa/AuxiliaryProcessCocoa.mm: (WebKit::AuxiliaryProcess::platformInitialize): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::getClientSDKAlignedBehaviors): (WebKit::XPCServiceInitializerDelegate::getClientSDKVersion): Deleted. (WebKit::XPCServiceInitializerDelegate::getLinkedOnOrAfterOverride): Deleted. * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::ProcessLauncher::launchProcess): Instead of transmitting the SDK version and override state in the bootstrap message, just send the computed set of behaviors. * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::configurationForSessionID): * Shared/Cocoa/CompletionHandlerCallChecker.mm: (WebKit::shouldThrowExceptionForDuplicateCompletionHandlerCall): * Shared/Cocoa/DefaultWebBrowserChecks.mm: (WebKit::determineITPState): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::InitializeWebKit2): * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultPassiveTouchListenersAsDefaultOnDocument): (WebKit::defaultCSSOMViewScrollingAPIEnabled): (WebKit::defaultPassiveWheelListenersAsDefaultOnDocument): (WebKit::defaultWheelEventGesturesBecomeNonBlocking): (WebKit::defaultOfflineWebApplicationCacheEnabled): * UIProcess/API/C/WKPage.cpp: (WKPageReload): * UIProcess/API/Cocoa/WKProcessPool.mm: (+[WKProcessPool _setLinkedOnOrBeforeEverythingForTesting]): (+[WKProcessPool _setLinkedOnOrAfterEverything]): * UIProcess/API/Cocoa/WKWebView.mm: (shouldAllowPictureInPictureMediaPlayback): (shouldAllowSettingAnyXHRHeaderFromFileURLs): (shouldRequireUserGestureToLoadVideo): (shouldRestrictBaseURLSchemes): (-[WKWebView _initializeWithConfiguration:]): (-[WKWebView _setupPageConfiguration:]): (-[WKWebView reload]): (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview): (-[WKWebViewConfiguration init]): * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore init]): * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _computedObscuredInset]): * UIProcess/API/mac/WKWebViewMac.mm: (-[WKWebView _web_dragDestinationActionForDraggingInfo:]): * UIProcess/Inspector/mac/WKInspectorViewController.mm: (-[WKInspectorViewController inspectorWKWebViewReload:]): * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableOrZoomedMainFrame const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): (WebKit::WebPageProxy::makeViewBlankIfUnpaintedSinceLastLoadCommit): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createWebPage): * UIProcess/WebProcessProxy.cpp: (WebKit::isMainThreadOrCheckDisabled): * UIProcess/ios/WKContentView.mm: (-[WKContentView _commonInitializationWithProcessPool:configuration:]): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView _shouldUseContextMenus]): (applicationIsKnownToIgnoreMouseEvents): * UIProcess/ios/WKScrollView.mm: (-[WKScrollView _systemContentInset]): * UIProcess/ios/WKStylusDeviceObserver.mm: (-[WKStylusDeviceObserver start]): (-[WKStylusDeviceObserver stop]): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::desktopClassBrowsingRecommended): Adopt the new naming. 2022-04-12 Elliott Williams Reland "[XCBuild] Enable dependency validation by default" https://bugs.webkit.org/show_bug.cgi?id=238901 Reviewed by Alexey Proskuryakov. * Configurations/DebugRelease.xcconfig: In open-source builds, disable VALIDATE_DEPENDENCIES when there is no PRODUCT_TYPE (i.e. not building a native target). 2022-04-12 Jer Noble Leak of MediaSourcePrivateAVFObjC and RemoteMediaSourceProxy https://bugs.webkit.org/show_bug.cgi?id=239088 Reviewed by Eric Carlson. Adopt changes to MediaSourcePrivateClient making it a CanMakeWeakPtr class. * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::loadMediaSource): * GPUProcess/media/RemoteMediaSourceProxy.h: * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::load): * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: * WebProcess/GPU/media/MediaSourcePrivateRemote.cpp: (WebKit::MediaSourcePrivateRemote::create): (WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote): (WebKit::MediaSourcePrivateRemote::seekToTime): * WebProcess/GPU/media/MediaSourcePrivateRemote.h: 2022-04-12 Ada Chan [WebXR] Implement the WebXRFrame methods for getting joints' poses and radii https://bugs.webkit.org/show_bug.cgi?id=238968 Reviewed by Dean Jackson. * Shared/XR/XRDeviceProxy.cpp: (WebKit::XRDeviceProxy::initializeTrackingAndRendering): Initialize input sources on session start. 2022-04-12 Youenn Fablet Remove getsockopt from WebProcess sandboxes https://bugs.webkit.org/show_bug.cgi?id=239120 Reviewed by Anders Carlsson. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2022-04-12 Youenn Fablet Add logging in case WebsiteDataStore is not found for persistent notification events https://bugs.webkit.org/show_bug.cgi?id=239111 Reviewed by Chris Dumez. * UIProcess/Notifications/WebNotificationManagerProxy.cpp: (WebKit::dispatchDidClickNotification): (WebKit::WebNotificationManagerProxy::providerDidCloseNotifications): 2022-04-12 Kimmo Kinnunen FunctionDispatcher should not be RefCounted https://bugs.webkit.org/show_bug.cgi?id=231940 Reviewed by Chris Dumez. Remove ThreadSafeRefCounted from FunctionDispatcher. Make all existing function dispatchers refcounted. No new tests, refactor. * NetworkProcess/cache/NetworkCacheData.h: * Platform/IPC/StreamConnectionWorkQueue.h: 2022-04-11 Zan Dobersek [WK2] Simplify IPC encoding, decoding of tuples https://bugs.webkit.org/show_bug.cgi?id=239062 Reviewed by Darin Adler. For encoding each element of a given tuple, an index sequence is used in combination with a fold expression calling ArgumentCoder::encode(). For decoding, std::tuple_cat() is used to concatenate a single-element tuple containing the current element with the tuple of the remaining decoded elements. No real change in behavior, sequence of encoding and decoding remains the same. * Platform/IPC/ArgumentCoders.h: (IPC::TupleEncoder::encode): (IPC::tupleFromTupleAndObject): Deleted. (IPC::TupleDecoderImpl::decode): Deleted. (IPC::TupleDecoderImpl::decode): Deleted. (IPC::TupleDecoder::decode): Deleted. (IPC::TupleDecoder<0>::decode): Deleted. 2022-04-11 Diego Pino Garcia [GLIB] Unreviewed, build fix for Debian Stable after r292251 https://bugs.webkit.org/show_bug.cgi?id=239102 * UIProcess/gtk/WaylandCompositor.cpp: (WebKit::WaylandCompositor::initializeEGL): Convert char* to String. 2022-04-11 Wenson Hsieh REGRESSION: Web content process crashes when triggering Live Text in recoveryOS https://bugs.webkit.org/show_bug.cgi?id=239096 rdar://91592943 Reviewed by Tim Horton. Make encoding or decoding `RetainPtr` a no-op when the VisionKitCore framework is unavailable on Cocoa platforms, rather than crashing (due to `PAL::getVKCImageAnalysisClass()` returning nil). * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): 2022-04-11 Myles C. Maxfield [WebGPU] Hook up device.queue to the IDL https://bugs.webkit.org/show_bug.cgi?id=239043 Reviewed by Kimmo Kinnunen. * GPUProcess/graphics/WebGPU/RemoteAdapter.cpp: (WebKit::RemoteAdapter::requestDevice): * GPUProcess/graphics/WebGPU/RemoteAdapter.h: * GPUProcess/graphics/WebGPU/RemoteAdapter.messages.in: * GPUProcess/graphics/WebGPU/RemoteDevice.cpp: (WebKit::RemoteDevice::RemoteDevice): (WebKit::RemoteDevice::queue): * GPUProcess/graphics/WebGPU/RemoteDevice.h: * WebProcess/GPU/graphics/WebGPU/RemoteAdapterProxy.cpp: (WebKit::WebGPU::RemoteAdapterProxy::requestDevice): * WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp: (WebKit::WebGPU::RemoteDeviceProxy::RemoteDeviceProxy): (WebKit::WebGPU::RemoteDeviceProxy::queue): * WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.h: 2022-04-11 Alex Christensen Use WebKit::blockedError instead of ResourceLoader::blockedError in WebLoaderStrategy::scheduleLoadFromNetworkProcess https://bugs.webkit.org/show_bug.cgi?id=239089 Reviewed by Chris Dumez. The latter dereferences the frame loader which can be null. * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): 2022-04-11 Simon Fraser Crash under ShareableBitmap::makeCGImageCopy() https://bugs.webkit.org/show_bug.cgi?id=239085 Reviewed by Wenson Hsieh. ShareableBitmap::create() can return null, so check it before calling makeCGImageCopy() on the result. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): 2022-04-11 Aditya Keerthi [iOS] Ignore find interaction deprecation warnings https://bugs.webkit.org/show_bug.cgi?id=239084 Unreviewed, build fix. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _setFindInteractionEnabled:]): 2022-04-11 Jer Noble REGRESSION(r292051-r292022): [ iOS ] media/video-object-fit.html is a constant image failure https://bugs.webkit.org/show_bug.cgi?id=238634 Reviewed by Eric Carlson. Use an `std:: bool` rather than `bool` to cache values sent to WebContent, so that when a new value is pushed in, it's sent to WebContent the first time regardless of the default value. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 2022-04-11 Wenson Hsieh REGRESSION (r289785): [iOS] Unable to double-click to select a word in a received email https://bugs.webkit.org/show_bug.cgi?id=239055 rdar://90736710 Reviewed by Tim Horton. Following r289785, double-clicking text in Mail message viewer on iOS (or more generally, any web view in an app that does not have the "UIApplicationSupportsIndirectInputEvents" application plist key set to `YES`) produces a selection that is immediately removed. This is because after double clicking, the synthetic click gesture fires and immediately clears the selection. In Safari (an application that sets UIApplicationSupportsIndirectInputEvents), the non-pointer gesture recognizers (e.g. synthetic taps) don't fire because the type of the `UITouch` is `UITouchTypeIndirectPointer`, which allows us to return `NO` from `-gestureRecognizer:shouldReceiveTouch:` for anything that is not the mouse gesture recognizer's current mouse touch. For apps that lack this plist key, the touch type remains `UITouchTypeDirect` to avoid breaking compatibility, even for events that are generated via a pointing device (i.e. trackpad). This means that we no longer route these events solely to the mouse gesture recognizer. To fix this, use `-_isPointerTouch` instead of `-[UITouch type]` here. Unlike the latter, the former isn't affected by the "supports indirect input" plist key. * Platform/spi/ios/UIKitSPI.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView gestureRecognizer:shouldReceiveTouch:]): * UIProcess/ios/WKMouseGestureRecognizer.mm: (-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]): Also fix a similar bug here, where the check against `UITouchTypeIndirectPointer` instead of `-_isPointerEvent` causes apps without the UIApplicationSupportsIndirectInputEvents key to lose the ability to listen for mousedown and mouseup events when the user clicks via trackpad on iPad. 2022-04-11 J Pascoe [WebAuthn] Ensure requestPin callback on main thread https://bugs.webkit.org/show_bug.cgi?id=238962 rdar://problem/91446051 Reviewed by Brent Fulgham. This callback gets called by a non-main thread when making calls via ASA. This patch uses ensureOnMainThread to ensure the completion handler is called on the main thread. It also upgrades the callback asserts to RELEASE_ASSERTs to avoid this issue in the future. * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::getAssertion): * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm: (WebKit::WebAuthenticationPanelClient::requestPin const): * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: (WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived): (WebKit::CtapAuthenticator::continueRequestPinAfterGetKeyAgreement): 2022-04-10 Chris Dumez Unreviewed Windows build fix after r292696. * Platform/win/LoggingWin.cpp: (WebKit::logLevelString): 2022-04-10 Fujii Hironori [WinCairo] Child process happens to remain alive even after IPC::Connection is disconnected https://bugs.webkit.org/show_bug.cgi?id=204221 Reviewed by Don Olmstead. After running layout tests, I observed some processes of WebKitWebProcess.exe and WebKitNetworkProcess.exe were still alive. These child processed should exit if the named pipe of IPC::Connection is broken. * Platform/IPC/win/ConnectionWin.cpp: (IPC::Connection::readEventHandler): Call connectionDidClose() in the case of ERROR_BROKEN_PIPE. 2022-04-09 Simon Fraser Put layer backing store buffers into the per-RemoteRenderingBackend IOSurfacePool https://bugs.webkit.org/show_bug.cgi?id=238972 Reviewed by Tim Horton. Give each RemoteRenderingBackend its own IOSurfacePool. RemoteImageBuffer gets surfaces from this pool, and RemoteRenderingBackend::willDestroyImageBuffer() puts surfaces in, if they are layer backing store surfaces. The low memory handler removes all surfaces from the pool. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::create): (WebKit::RemoteImageBuffer::~RemoteImageBuffer): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): (WebKit::RemoteRenderingBackend::willDestroyImageBuffer): (WebKit::RemoteRenderingBackend::lowMemoryHandler): * GPUProcess/graphics/RemoteRenderingBackend.h: (WebKit::RemoteRenderingBackend::ioSurfacePool const): 2022-04-09 Adrian Perez de Castro [GTK][WPE] Missing inter-module documentation links https://bugs.webkit.org/show_bug.cgi?id=239016 Reviewed by Michael Catanzaro. Add JS snippets to be used in the gi-docgen output to setup links to other modules. Take advantage of being able to compute the documentation API version suffix from the currently loaded page URL, which avoids having a number of templates depending on the API version and having to deal with the documentation API version being sometimes different than the actual API version of the library. The URLs for GTK3 vs. GTK4 documentation cannot be handled in the same way, and instead the JS snippet is also a template expanded by CMake to allows using the ${GTK_API_VERSION} variable there. * PlatformGTK.cmake: Set urlmap.js as documentation content template. * gtk/urlmap.js.in: Added. * gtk/webkit2gtk-webextension.toml.in: Use urlmap.js from added template. * gtk/webkit2gtk.toml.in: Ditto. * wpe/urlmap.js: Added. (const.baseURLApiLevelSuffix): * wpe/wpewebextension.toml.in: Use added urlmap.js file. * wpe/wpewebkit.toml.in: Ditto. 2022-04-09 Sihui Liu Move canAccessStorage() check from SecurityOrigin to ScriptExecutionContext https://bugs.webkit.org/show_bug.cgi?id=238524 Reviewed by Chris Dumez. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::storageBlockingStateChanged): 2022-04-08 Chris Dumez Drop unused pluginReplacementScriptObject https://bugs.webkit.org/show_bug.cgi?id=239008 Reviewed by Geoff Garen. Drop unused pluginReplacementScriptObject as it is always null. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::scriptObject): Deleted. * WebProcess/Plugins/PluginView.h: 2022-04-08 Elliott Williams [Xcode] Avoid targeting 32-bit iOS and Mac architectures https://bugs.webkit.org/show_bug.cgi?id=238971 Reviewed by Alexey Proskuryakov. * Configurations/DebugRelease.xcconfig: 2022-04-08 Commit Queue Unreviewed, reverting r292429. https://bugs.webkit.org/show_bug.cgi?id=239011 Introduced Data Detectors regression in Mail Reverted changeset: "Unreviewed, reverting r291821." https://bugs.webkit.org/show_bug.cgi?id=238839 https://commits.webkit.org/r292429 2022-04-08 Gavin Phillips Remove unneeded CoreIPC messages and corresponding handlers related to StorageManagerSet https://bugs.webkit.org/show_bug.cgi?id=238938 Reviewed by Chris Dumez. There are various CoreIPC messages related to StorageManagerSet which are no longer needed. This change removes them. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * NetworkProcess/NetworkProcess.cpp: * NetworkProcess/WebStorage/StorageManagerSet.cpp: Removed. * NetworkProcess/WebStorage/StorageManagerSet.h: Removed. * NetworkProcess/WebStorage/StorageManagerSet.messages.in: Removed. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebStorage/StorageAreaMap.cpp: 2022-04-08 Jonathan Bedard [iOS 15.4] Fix embedded device build https://bugs.webkit.org/show_bug.cgi?id=239012 Reviewed by Ryan Haddad. * Configurations/Base.xcconfig: Allow AdHoc codesigning. 2022-04-08 Philippe Normand [WPE][2.36] Build with a11y disabled fails https://bugs.webkit.org/show_bug.cgi?id=239004 Reviewed by Michael Catanzaro. Add accessibility build guards. * UIProcess/Launcher/glib/XDGDBusProxy.cpp: (WebKit::XDGDBusProxy::XDGDBusProxy): (WebKit::XDGDBusProxy::launch const): 2022-04-08 Elliott Williams Unreviewed, reverting r292591. Causing spurious EWS errors Reverted changeset: "[XCBuild] Enable dependency validation by default" https://bugs.webkit.org/show_bug.cgi?id=238901 https://commits.webkit.org/r292591 2022-04-08 Gavin Phillips Remove misc unused CoreIPC messages/handlers that have no instances of messages being dispatched to them https://bugs.webkit.org/show_bug.cgi?id=238996 Reviewed by Chris Dumez. Remove misc unused CoreIPC messages/handlers that have no instances of messages being dispatched to them. This includes: WebPage::FrameBecameRemote, WebInspectorUIProxy::BringInspectedPageToFront, WebProcess::refreshPlugins, NetworkProcess::SetQOS WebPage::GetPositionInformation, WebPage::InvalidateMediaSessionCoordinator, RemoteCDMInstanceSessionProxy::DisplayIDChanged. * GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp: (WebKit::RemoteCDMInstanceSessionProxy::displayIDChanged): Deleted. * GPUProcess/media/RemoteCDMInstanceSessionProxy.h: * GPUProcess/media/RemoteCDMInstanceSessionProxy.messages.in: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Inspector/WebInspectorUIProxy.cpp: (WebKit::WebInspectorUIProxy::bringInspectedPageToFront): Deleted. * UIProcess/Inspector/WebInspectorUIProxy.messages.in: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::createMediaSessionCoordinator): (WebKit::WebPage::frameBecameRemote): Deleted. (WebKit::WebPage::invalidateMediaSessionCoordinator): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::isObscuredElement): (WebKit::WebPage::getPositionInformation): Deleted. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::refreshPlugins): Deleted. * WebProcess/WebProcess.h: * WebProcess/WebProcess.messages.in: 2022-04-08 Simon Fraser Have GPU Process call lowMemoryHandler() on each RemoteRenderingBackend https://bugs.webkit.org/show_bug.cgi?id=238967 Reviewed by Tim Horton. Hook up RemoteRenderingBackend::lowMemoryHandler(), which doesn't do anything yet, but will clear the IOSurface pool. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::lowMemoryHandler): * GPUProcess/GPUConnectionToWebProcess.h: * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::lowMemoryHandler): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::lowMemoryHandler): * GPUProcess/graphics/RemoteRenderingBackend.h: 2022-04-08 Carlos Garcia Campos [GTK] RemoteInspector: update target list page contents on change instead of reloading https://bugs.webkit.org/show_bug.cgi?id=238990 Reviewed by Adrian Perez de Castro. We can use webkit_web_view_run_javascript() to replace the target list with the new one. This also fixes the race condition when loading inspector:// for the first time that target list is always empty. The web view HashSet is now a HashMap where the value is a pointer to the client to be able to associate web view with its client without having to check the host and port. * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: (WebKit::RemoteInspectorProtocolHandler::~RemoteInspectorProtocolHandler): Disconnect web view signals. (WebKit::RemoteInspectorProtocolHandler::handleRequest): On new web view, connect to notify::uri and remove the web view if it's no longer showing an inspector page list. (WebKit::RemoteInspectorProtocolHandler::updateTargetList): Update the target list html. (WebKit::RemoteInspectorProtocolHandler::webViewLoadChanged): Call updateTargetList() when load finished. (WebKit::RemoteInspectorProtocolHandler::targetListChanged): Call updateTargetList() for web views that are not loading. For loading web view connect to load-event to update the target list once the load finishes. (WebKit::RemoteInspectorProtocolHandler::connectionClosed): Remove the associated web views. * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.h: * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::appendTargertList const): Append the target list html to the given GString. (WebKit::RemoteInspectorClient::buildTargetListPage const): Use appendTargertList() now. * UIProcess/Inspector/glib/RemoteInspectorClient.h: 2022-04-08 Carlos Garcia Campos Web Inspector: Use computedStyleMap() instead of deprecated getPropertyCSSValue() https://bugs.webkit.org/show_bug.cgi?id=238661 Reviewed by Devin Rousso. Ensure CSS Type OM is enabled in inspector frontend page. * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::enableFrontendFeatures): 2022-04-08 Carlos Garcia Campos Incorrect CORP/COEP check in 304 responses https://bugs.webkit.org/show_bug.cgi?id=238238 Reviewed by Youenn Fablet. Add CORP header to the 304 response if previously set to avoid being blocked by load checker due to COEP. Test: imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/require-corp-revalidated-images.https.html * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::didReceiveResponse): 2022-04-07 J Pascoe [WebAuthn] Support all CTAP transports and remove gesture requirement for virtual authenticators https://bugs.webkit.org/show_bug.cgi?id=238814 rdar://problem/91300515 Reviewed by Brent Fulgham. This patch adds support for the other CTAP virtual authenticator transports and removes the user gesture requirement when using virtual authenticators. These changes are needed to run the webauthn web-platform-tests. * UIProcess/WebAuthentication/AuthenticatorManager.cpp: (WebKit::WebCore::collectTransports): (WebKit::AuthenticatorManager::filterTransports const): * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: (WebKit::MockAuthenticatorManager::filterTransports const): * UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.cpp: (WebKit::VirtualAuthenticatorManager::createAuthenticator): * UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorManager.h: * UIProcess/WebAuthentication/Virtual/VirtualLocalConnection.mm: (WebKit::VirtualLocalConnection::verifyUser): * UIProcess/WebAuthentication/Virtual/VirtualService.mm: (WebKit::VirtualService::startDiscoveryInternal): * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest): 2022-04-07 Elliott Williams [XCBuild] Enable dependency validation by default https://bugs.webkit.org/show_bug.cgi?id=238901 Reviewed by Alexey Proskuryakov. * Configurations/DebugRelease.xcconfig: 2022-04-07 Stephan Szabo [WinCairo] Fix DrawingAreaWC after r292557 https://bugs.webkit.org/show_bug.cgi?id=238979 Unreviewed build fix * WebProcess/WebPage/wc/DrawingAreaWC.cpp: 2022-04-07 Simon Fraser Fix the CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER build (again) * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::ensureFrontBuffer): 2022-04-07 Chris Dumez Add PAL::TextEncoding() constructor that takes in a StringView https://bugs.webkit.org/show_bug.cgi?id=238905 Reviewed by Darin Adler. This allows some call sites to be a bit more efficient. * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::didRequestNextPart): (WebKit::NetworkDataTaskSoup::didGetFileInfo): * UIProcess/API/glib/WebKitURISchemeRequest.cpp: (webkitURISchemeRequestReadCallback): 2022-04-07 Chris Dumez Replace deprecated String(const char*) with String::fromLatin1() in more places https://bugs.webkit.org/show_bug.cgi?id=238925 Reviewed by Darin Adler. * NetworkProcess/DatabaseUtilities.cpp: (WebKit::DatabaseUtilities::stripIndexQueryToMatchStoredValue): * NetworkProcess/cache/NetworkCache.cpp: (WebKit::NetworkCache::Cache::dumpContentsToFile): * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb: * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (encodeObject): * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm: (-[_WKRemoteObjectRegistry _sendInvocation:interface:]): * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtension::createHandleForTemporaryFile): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::getClientBundleIdentifier): (WebKit::XPCServiceInitializerDelegate::getClientProcessName): (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (+[_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentials]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::showSafeBrowsingWarning): * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::clearAllCredentials): * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: (WebKit::LocalConnection::createCredentialPrivateKey const): * UIProcess/WebPageProxy.cpp: (WebKit::pasteAccessCategoryForCommand): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::didReceiveInvalidMessage): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::pluginInfo): * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::replaceSelectionPasteboardName): * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::createJSArrayForArgumentDescriptions): (WebKit::IPCTestingAPI::JSMessageListener::jsDescriptionFromDecoder): * webpushd/WebPushDaemonMain.mm: (WebKit::WebPushDaemonMain): 2022-04-07 Stephan Szabo Build-fix for not ENABLE(SERVICE_WORKER) after r292539 https://bugs.webkit.org/show_bug.cgi?id=238957 Unreviewed build fix. * UIProcess/WebPageProxy.cpp: 2022-04-07 Simon Fraser Add a LayerBacking RenderingPurpose https://bugs.webkit.org/show_bug.cgi?id=238896 Reviewed by Said Abou-Hallawa. Add RenderingPurpose::LayerBacking so the GPU Process knows which buffers are associated with layer backing. * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: (WebKit::RemoteLayerBackingStoreCollection::allocateBufferForBackingStore): * Shared/RemoteLayerTree/RemoteLayerWithRemoteRenderingBackingStoreCollection.mm: (WebKit::RemoteLayerWithRemoteRenderingBackingStoreCollection::allocateBufferForBackingStore): * Shared/WebCoreArgumentCoders.h: * WebProcess/WebProcess.cpp: (WebKit::WebProcess::shouldUseRemoteRenderingFor): 2022-04-07 Per Arne Vollan [iOS][WP] Block kernel routines https://bugs.webkit.org/show_bug.cgi?id=238898 Reviewed by Geoffrey Garen. Block kernel routines only used during launch of the WebContent process on iOS. This is based on collected telemetry. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: 2022-04-07 Simon Fraser Have ImageBuffer store the RenderingPurpose, and send it to the GPU process https://bugs.webkit.org/show_bug.cgi?id=238887 Reviewed by Said Abou-Hallawa. Add RenderingPurpose to ImageBufferBackend::Parameters so it's stored on ImageBufferBackend/ImageBuffer, and propagate that to the GPU process. * GPUProcess/graphics/RemoteImageBuffer.h: (WebKit::RemoteImageBuffer::create): * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::createImageBuffer): (WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): (headers_for_type): * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: (WebKit::RemoteLayerBackingStoreCollection::allocateBufferForBackingStore): * Shared/RemoteLayerTree/RemoteLayerWithRemoteRenderingBackingStoreCollection.mm: (WebKit::RemoteLayerWithRemoteRenderingBackingStoreCollection::allocateBufferForBackingStore): * Shared/WebCoreArgumentCoders.h: * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp: (WebKit::RemoteDisplayListRecorderProxy::createImageBuffer const): * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::create): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::createRemoteImageBuffer): (WebKit::RemoteRenderingBackendProxy::createImageBuffer): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createImageBuffer const): 2022-04-07 Youenn Fablet Use the same callback mechanism for ServiceWorker openWindow and navigate in UIProcess https://bugs.webkit.org/show_bug.cgi?id=238924 Reviewed by Chris Dumez. Reuse WebFrameProxy navigation delegate for openWindow once the main frame is created. This ensures we get the same behavior for both code paths and makes sure openWindow does not hang if a delegate cancels the load. Covered by API test. * UIProcess/WebFrameProxy.cpp: (WebKit::WebFrameProxy::transferNavigationCallbackToFrame): (WebKit::WebFrameProxy::setNavigationCallback): * UIProcess/WebFrameProxy.h: (WebKit::WebFrameProxy::transferNavigationCallbackToFrame): Deleted. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCreateMainFrame): (WebKit::WebPageProxy::callLoadCompletionHandlersIfNecessary): * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::openWindowFromServiceWorker): 2022-04-07 Chris Dumez Drop unused EditorClient::getAutoCorrectSuggestionForMisspelledWord() https://bugs.webkit.org/show_bug.cgi?id=238897 Reviewed by Wenson Hsieh. * WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::getAutoCorrectSuggestionForMisspelledWord): Deleted. * WebProcess/WebCoreSupport/WebEditorClient.h: 2022-04-07 Kimmo Kinnunen IPC::Connection should support diverting all messages to a message queue in other thread https://bugs.webkit.org/show_bug.cgi?id=238608 Reviewed by Simon Fraser. Previously, it was possible to divert all messages to certain ReceiverName to a message queue. This is used in IPC streams functionality. Add a possibility to divert all messages to a message queue. Instead of passing ReceiverName, id pair to Connection, pass new struct ReceiverMatcher. Use ReceiverMatcher instead of pair optional, optional, since nullopt, id is not a valid case. This will be used in future patch for the case where IPC::Connection is created for the sole purpose of using it together with IPC stream connection. This also clarifies the overloaded use of destinationID 0 as a wildcard as well as a valid message destination. Also implement the possibility to divert all messages to particular ReceiverName, id 0. Previously this was signifying the destination ID wildcard. No new tests, refactor. * Platform/IPC/Connection.cpp: (IPC::Connection::SyncMessageState::enqueueMatchingMessages): (IPC::Connection::enqueueMatchingMessagesToMessageReceiveQueue): (IPC::Connection::addMessageReceiveQueue): (IPC::Connection::removeMessageReceiveQueue): (IPC::Connection::addWorkQueueMessageReceiver): (IPC::Connection::removeWorkQueueMessageReceiver): (IPC::Connection::addThreadMessageReceiver): (IPC::Connection::removeThreadMessageReceiver): * Platform/IPC/Connection.h: * Platform/IPC/Decoder.h: (IPC::Decoder::matches const): * Platform/IPC/MessageReceiveQueueMap.cpp: (IPC::MessageReceiveQueueMap::addImpl): (IPC::MessageReceiveQueueMap::remove): (IPC::MessageReceiveQueueMap::get const): * Platform/IPC/MessageReceiveQueueMap.h: (IPC::MessageReceiveQueueMap::add): * Platform/IPC/ReceiverMatcher.h: Copied from Source/WebKit/Platform/IPC/MessageReceiveQueueMap.h. (IPC::ReceiverMatcher::ReceiverMatcher): (IPC::ReceiverMatcher::createForLegacyAPI): (IPC::ReceiverMatcher::matches const): * Platform/IPC/StreamServerConnection.cpp: (IPC::StreamServerConnectionBase::startReceivingMessagesImpl): (IPC::StreamServerConnectionBase::stopReceivingMessagesImpl): * WebKit.xcodeproj/project.pbxproj: 2022-04-07 Carlos Garcia Campos Unreviewed. Fix GTK build after r292506 * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp: (webkit_dom_media_list_set_media_text): * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeGtk.cpp: (webkit_dom_node_set_node_value): (webkit_dom_node_set_text_content): 2022-04-07 Carlos Garcia Campos [GTK][WPE] RemoteInspector add support for IPv6 https://bugs.webkit.org/show_bug.cgi?id=238797 Reviewed by Adrian Perez de Castro. Make it possible to connect to remote inspector server using IPv6 address. * UIProcess/API/glib/WebKitInitialize.cpp: (WebKit::initializeRemoteInspectorServer): Parse IPv6 address and build GSocketAddress to pass to inspector ot HTTP server. * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: (WebKit::RemoteInspectorProtocolHandler::handleRequest): RemoteInspectorClient now expects host and port in a single String. * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::RemoteInspectorClient): Receive the host and port in a String. * UIProcess/Inspector/glib/RemoteInspectorClient.h: * UIProcess/Inspector/glib/RemoteInspectorHTTPServer.cpp: * UIProcess/Inspector/glib/RemoteInspectorHTTPServer.h: 2022-04-06 Chris Dumez Improve API::SerializedScriptValue::deserialize to not allocate a new JSContext every second https://bugs.webkit.org/show_bug.cgi?id=210920 Reviewed by Geoffrey Garen. Instead of forcing the lifetime of the shared JSContext to 1 second, we now use a hysteresis logic so that it can stay alive as long as it is used at least every 10 seconds. * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm: (API::SharedJSContext::SharedJSContext): (API::SharedJSContext::ensureContext): (API::SharedJSContext::releaseContextIfNecessary): (API::SharedJSContext::releaseContext): Deleted. 2022-04-06 Chris Dumez Reduce number of conversions from StringView to String https://bugs.webkit.org/show_bug.cgi?id=238841 Reviewed by Geoffrey Garen. * NetworkProcess/NetworkSchemeRegistry.cpp: (WebKit::NetworkSchemeRegistry::shouldTreatURLSchemeAsCORSEnabled): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::updateVaryInformation): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::proxyDictionary): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::shouldAllowHSTSPolicySetting const): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::decidePolicyForNavigationAction): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler): (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler): * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::representationExistsForURLScheme const): (WebKit::WebFrameLoaderClient::generatedMIMETypeForURLScheme const): * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: * WebProcess/WebPage/WebCookieCache.cpp: (WebKit::WebCookieCache::cookiesForDOM): (WebKit::WebCookieCache::setCookiesFromDOM): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::canHandleRequest): (WebKit::WebPage::urlSchemeHandlerForScheme): * WebProcess/WebPage/WebPage.h: 2022-04-06 Kimmo Kinnunen ServiceWorkerDownloadTask starts listening for IPC in constructor https://bugs.webkit.org/show_bug.cgi?id=238860 Reviewed by Youenn Fablet. IPC messages will start to be delivered after connection->addThreadMessageReceiver(..., this, ..) from the message receive queue. This function cannot be called in the constructor, since the virtual function table of the `this` object has not been constructed fully yet. This means that if a message arrives during the constructor, it is dispatched via incorrect virtual function pointer. Initiate the listening from a separate function that is called from ServiceWorkerDownloadTask::create(). No new tests, not testable. * NetworkProcess/ServiceWorker/ServiceWorkerDownloadTask.cpp: (WebKit::ServiceWorkerDownloadTask::startListeningForIPC): (WebKit::ServiceWorkerDownloadTask::close): * NetworkProcess/ServiceWorker/ServiceWorkerDownloadTask.h: (WebKit::ServiceWorkerDownloadTask::create): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::registerDownload): (WebKit::WebSWServerToContextConnection::unregisterDownload): 2022-04-06 Youenn Fablet In case of COOP-based process swap, we need to make sure the document gets controlled by its matching service worker registration https://bugs.webkit.org/show_bug.cgi?id=238800 Reviewed by Chris Dumez. Make sure in case loader is transferred to call controlClient in the new WebProcess. To do so, we also update page and frame IDs. Covered by API test. * NetworkProcess/NetworkConnectionToWebProcess.cpp: * NetworkProcess/NetworkLoadParameters.h: * NetworkProcess/NetworkResourceLoadParameters.h: * NetworkProcess/NetworkResourceLoader.cpp: * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: 2022-04-06 Kimmo Kinnunen Media and WebRTC code uses ThreadMessageReceiverRefCounted with WorkQueues https://bugs.webkit.org/show_bug.cgi?id=238858 Reviewed by Youenn Fablet. Media and WebRTC code uses IPC::Connection::ThreadMessageReceiverRefCounted to submit work to a WorkQueue. For this use-case, IPC::Connection has IPC::Connection::WorkQueueMessageReceiver, which does the same. This is work towards simplifying IPC::Connection by removing ThreadMessageReceiverRefCounted. No new tests, refactor. * GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::stopListeningForIPC): (WebKit::LibWebRTCCodecsProxy::initialize): * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: (WebKit::RemoteSampleBufferDisplayLayerManager::startListeningForIPC): (WebKit::RemoteSampleBufferDisplayLayerManager::close): (WebKit::RemoteSampleBufferDisplayLayerManager::createLayer): (WebKit::RemoteSampleBufferDisplayLayerManager::releaseLayer): * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionOnMainThreadWithLock): (WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionAndDispatchToThread): (WebKit::LibWebRTCCodecs::gpuProcessConnectionDidClose): * WebProcess/GPU/webrtc/LibWebRTCCodecs.h: * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: (WebKit::RemoteCaptureSampleManager::stopListeningForIPC): (WebKit::RemoteCaptureSampleManager::setConnection): * WebProcess/cocoa/RemoteCaptureSampleManager.h: 2022-04-06 Carlos Garcia Campos Unreviewed. Fix GTK build after r292458 * UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::hostFileDescriptor): 2022-04-06 Youenn Fablet Implement ServiceWorkerWindowClient.navigate https://bugs.webkit.org/show_bug.cgi?id=238738 Reviewed by Chris Dumez. When receiving a request to navigate a client, send message to UIProcess. UIProcess locates the WebFrameProxy which will send an IPC message to the WebProcess to do navigation. We keep track of the navigation within WebFrameProxy. In case of process swapping, we make sure to transfer the WebFrameProxy callback. In case of policy decision to stop loads, we resolve the promise with an empty client. A follow-up patch may reject the promise once the expected behavior will be clarified. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/ProvisionalPageProxy.cpp: * UIProcess/WebFrameProxy.cpp: * UIProcess/WebFrameProxy.h: * UIProcess/WebPageProxy.cpp: * WebProcess/Storage/WebSWContextManagerConnection.cpp: * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: * WebProcess/WebPage/WebPage.cpp: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2022-04-06 Zan Dobersek [Unix] Adopt UnixFileDescriptor in IPC::Attachment https://bugs.webkit.org/show_bug.cgi?id=238801 Reviewed by Carlos Garcia Campos. Adopt WTF::UnixFileDescriptor for usage in IPC::Attachment, in place of a raw integer value. This simplifies move operations and destruction of this value. The two relevant constructors are changed to expect a UnixFileDescriptor rvalue, and they're also made explicit. The file descriptor object is accessible through both a const and a non-const getter, which allows the user to read or release the file descriptor contained there. There's also a release method that returns the contained UnixFileDescriptor. The releaseFileDescriptor() and fileDescriptor() methods, previously releasing or returning the contained integer value of the descriptor. Call sites for these methods as well as the old-form constructors are adjusted to the new variants. * Platform/IPC/Attachment.h: (IPC::Attachment::isNull const): (IPC::Attachment::fd const): (IPC::Attachment::release): (IPC::Attachment::releaseFileDescriptor): Deleted. (IPC::Attachment::fileDescriptor const): Deleted. * Platform/IPC/unix/AttachmentUnix.cpp: (IPC::Attachment::Attachment): (IPC::Attachment::operator=): (IPC::Attachment::~Attachment): Deleted. * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::Connection::processMessage): (IPC::Connection::sendOutputMessage): (IPC::Connection::createConnectionIdentifierPair): * Platform/unix/SharedMemoryUnix.cpp: (WebKit::SharedMemory::Handle::isNull const): (WebKit::SharedMemory::map): (WebKit::SharedMemory::createHandle): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/glib/UserMessage.cpp: (WebKit::UserMessage::encode const): (WebKit::UserMessage::decode): * UIProcess/API/wpe/PageClientImpl.cpp: (WebKit::PageClientImpl::hostFileDescriptor): * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/GPU/GPUProcessConnectionInfo.h: (WebKit::GPUProcessConnectionInfo::identifier const): (WebKit::GPUProcessConnectionInfo::releaseIdentifier): * WebProcess/Inspector/WebInspector.cpp: (WebKit::WebInspector::setFrontendConnection): * WebProcess/Network/NetworkProcessConnectionInfo.h: (WebKit::NetworkProcessConnectionInfo::identifier const): (WebKit::NetworkProcessConnectionInfo::releaseIdentifier): * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::hostFileDescriptor const): * WebProcess/glib/WebProcessGLib.cpp: (WebKit::WebProcess::platformInitializeWebProcess): 2022-04-06 Youenn Fablet ServiceWorkerClients.openWindow should not need to get all clients asynchronously to resolve its promise https://bugs.webkit.org/show_bug.cgi?id=238503 Reviewed by Chris Dumez. Add logic to get the client from its page ID. In case of internal error case, trigger promise rejection instead of promise resolution with null. * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * WebProcess/Storage/WebSWContextManagerConnection.cpp: * WebProcess/Storage/WebSWContextManagerConnection.h: 2022-04-06 Youenn Fablet Remove Notification::m_relatedNotificationIdentifier https://bugs.webkit.org/show_bug.cgi?id=238603 Reviewed by Brady Eidson. Directly use identifier now that we correctly reuse them when needed. We no longer store persistent notifications in the map since we do not use the map for click/close events. * WebProcess/Notifications/WebNotificationManager.cpp: * WebProcess/Notifications/WebNotificationManager.h: 2022-04-05 Ada Chan [WebXR] Add a new enum type to represent session features https://bugs.webkit.org/show_bug.cgi?id=238837 Reviewed by Dean Jackson. Add a new _WKXRSessionFeatureFlags entry for hand-tracking. * Scripts/webkit/messages.py: (types_that_cannot_be_forward_declared): (headers_for_type): * Shared/XR/XRDeviceProxy.cpp: (WebKit::XRDeviceProxy::XRDeviceProxy): * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.mm: (WebKit::toWKXRSessionFeatureFlags): (WebKit::toPlatformXRFeatures): * UIProcess/XR/PlatformXRSystem.cpp: (WebKit::PlatformXRSystem::requestPermissionOnSessionFeatures): * UIProcess/XR/PlatformXRSystem.h: * UIProcess/XR/PlatformXRSystem.messages.in: 2022-04-05 Wenson Hsieh [iOS] Update the context menu item glyph for visual look up https://bugs.webkit.org/show_bug.cgi?id=238853 Reviewed by Devin Rousso. Switch from `info.circle` to the (private) symbol `info.circle.and.sparkles`, for the icon next to the Look Up item when long pressing images that have visual look up results. * Platform/spi/ios/UIKitSPI.h: * UIProcess/API/Cocoa/_WKElementAction.mm: (+[_WKElementAction imageForElementActionType:]): 2022-04-05 Stephan Szabo [PlayStation[ Fix build break after r292408 https://bugs.webkit.org/show_bug.cgi?id=238840 Unreviewed build fix. * UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp: 2022-04-05 Alex Christensen Revert r291598 https://bugs.webkit.org/show_bug.cgi?id=238842 Reviewed by Geoff Garen. It caused some problems and needs further analysis. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::createWebSocketTask): 2022-04-05 Commit Queue Unreviewed, reverting r291821. https://bugs.webkit.org/show_bug.cgi?id=238839 Invalid fix. Reverted changeset: "REGRESSION(r286590): Links with URL schemes are not clickable in Mail" https://bugs.webkit.org/show_bug.cgi?id=238262 https://commits.webkit.org/r291821 2022-04-05 Sihui Liu Verify generalStorageDirectory is not in use when creating WebsiteDataStore https://bugs.webkit.org/show_bug.cgi?id=238686 rdar://90808910 Reviewed by Chris Dumez. In r290739, we added assertion to verify that no two sessions share the same general storage directory. The assertion is hit on macOS as shown in rdar://90808910. However, because we checked the directories when launching new network process, not when creating WebsiteDataStore, the backtraces do not give much information about when the problematic WebsiteDataStore (using the generalStorageDirectory that's already used by another WebsiteDataStore) is created. To help debug the issue, let's move the assertion to the constructor of WebsiteDataStore. * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::activeGeneralStorageDirectories): (WebKit::WebsiteDataStore::WebsiteDataStore): (WebKit::WebsiteDataStore::~WebsiteDataStore): 2022-04-05 Chris Dumez Unreviewed GTK build fix after r292408. * Platform/unix/LoggingUnix.cpp: (WebKit::logLevelString): 2022-04-05 Chris Dumez Unreviewed build fix after r292408. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::removeNetworkWebsiteData): 2022-04-05 Chris Dumez Mark String(const char*) constructor as explicit https://bugs.webkit.org/show_bug.cgi?id=238693 Reviewed by Geoffrey Garen. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (stringForSSLProtocol): * NetworkProcess/curl/NetworkDataTaskCurl.cpp: (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): * NetworkProcess/soup/NetworkDataTaskSoup.cpp: (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): (WebKit::NetworkDataTaskSoup::readCallback): (WebKit::NetworkDataTaskSoup::didRequestNextPart): (WebKit::NetworkDataTaskSoup::download): (WebKit::NetworkDataTaskSoup::writeDownloadCallback): (WebKit::NetworkDataTaskSoup::didFinishDownload): (WebKit::NetworkDataTaskSoup::didGetFileInfo): (WebKit::NetworkDataTaskSoup::readFileCallback): (WebKit::NetworkDataTaskSoup::enumerateFileChildrenCallback): * NetworkProcess/soup/WebSocketTaskSoup.cpp: (WebKit::WebSocketTask::didConnect): * Shared/API/Cocoa/WKRemoteObjectCoder.h: * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (WebKit::methodSignaturesAreCompatible): (decodeInvocation): * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm: (replyBlockSignature): (-[_WKRemoteObjectRegistry _invokeMethod:]): * Shared/API/glib/WebKitURIRequest.cpp: (webkit_uri_request_set_uri): * Shared/gtk/WebErrorsGtk.cpp: (WebKit::printerNotFoundError): (WebKit::invalidPageRangeToPrint): * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionGetBrowserName): * UIProcess/API/glib/WebKitCredential.cpp: (webkit_credential_new_for_certificate_pin): * UIProcess/API/glib/WebKitInjectedBundleClient.cpp: * UIProcess/API/glib/WebKitProtocolHandler.cpp: (WebKit::WebKitProtocolHandler::handleRequest): * UIProcess/API/glib/WebKitSettings.cpp: (_WebKitSettingsPrivate::_WebKitSettingsPrivate): (webkit_settings_set_user_agent): * UIProcess/API/glib/WebKitURISchemeRequest.cpp: (webkitURISchemeRequestReadCallback): (webkit_uri_scheme_request_finish_error): * UIProcess/API/gtk/DragSourceGtk4.cpp: (WebKit::DragSource::begin): * UIProcess/API/gtk/DropTargetGtk3.cpp: (WebKit::DropTarget::DropTarget): * UIProcess/API/gtk/DropTargetGtk4.cpp: (WebKit::DropTarget::DropTarget): * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: (WebKit::RemoteInspectorProtocolHandler::~RemoteInspectorProtocolHandler): (WebKit::RemoteInspectorProtocolHandler::handleRequest): (WebKit::RemoteInspectorProtocolHandler::targetListChanged): * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseEnterFullScreen): * UIProcess/API/wpe/WebKitColor.cpp: (webkit_color_parse): * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: (WebKit::malwareDetailsBase): (WebKit::reportAnErrorBase): * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: * UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp: (WebKit::RemoteWebInspectorUIProxy::platformCreateFrontendPageAndWindow): (WebKit::remoteFileReplaceContentsCallback): * UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp: (WebKit::WebInspectorUIProxy::platformCreateFrontendPage): (WebKit::fileReplaceContentsCallback): * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp: (WebKit::RemoteInspectorProtocolHandler::platformStartTask): * UIProcess/Inspector/win/RemoteWebInspectorUIProxyWin.cpp: (WebKit::RemoteWebInspectorUIProxy::platformCreateFrontendPageAndWindow): * UIProcess/Inspector/win/WebInspectorUIProxyWin.cpp: (WebKit::WebInspectorUIProxy::platformCreateFrontendPage): * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: (WebKit::bindSymlinksRealPath): (WebKit::bubblewrapSpawn): * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: (WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration): * UIProcess/glib/WebProcessPoolGLib.cpp: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/glib/WebProcessProxyGLib.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): * UIProcess/glib/WebsiteDataStoreGLib.cpp: * UIProcess/gtk/ClipboardGtk3.cpp: (WebKit::Clipboard::write): * UIProcess/gtk/ClipboardGtk4.cpp: (WebKit::Clipboard::write): * UIProcess/gtk/KeyBindingTranslator.cpp: * UIProcess/win/WebProcessPoolWin.cpp: (WebKit::backendCommandsPath): * UIProcess/win/WebView.cpp: (WebKit::WebView::WebView): * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: (webkitWebPageDidReceiveMessage): * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: (webkit_dom_document_get_visibility_state): * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp: (WebKit::handleKeyPress): (WebKit::handleKeyDown): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runJavaScript): * WebProcess/WebPage/glib/WebPageGLib.cpp: (WebKit::WebPage::getPlatformEditorState const): * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::generateSyntheticEditingCommand): (WebKit::WebPage::platformUserAgent const): * WebProcess/WebPage/win/WebPageWin.cpp: (WebKit::WebPage::handleEditingKeyboardEvent): * webpushd/PushClientConnection.mm: (WebPushD::ClientConnection::hostAppCodeSigningIdentifier): 2022-04-05 Tim Horton Fix the CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER build * Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h: 2022-04-05 Yury Semikhatsky Do not create network process in ~WebsiteDataStore destructor https://bugs.webkit.org/show_bug.cgi?id=238570 Reviewed by Chris Dumez. Check if m_networkProcess is initialized before removing session from it instead, otherwise WebsiteDataStore::networkProcess() lazily creates the process and it will keep running after WebsiteDataStore is destroyed. * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::~WebsiteDataStore): 2022-04-05 Eric Carlson 5 Media API tests are flakily timing out on iOS14 https://bugs.webkit.org/show_bug.cgi?id=230321 Reviewed by Jer Noble. Un-skipped API test WKWebViewPausePlayingAudioTests.OutOfWindow * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::applicationWillEnterForegroundForMedia): Log the correct name. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::applicationDidEnterBackgroundForMedia): Call PlatformMediaSessionManager. (WebKit::WebPage::applicationWillEnterForegroundForMedia): Ditto. 2022-04-05 Simon Fraser Pass an IOSurfacePool to ImageBuffer::releaseBufferToPool() https://bugs.webkit.org/show_bug.cgi?id=238768 Reviewed by Said Abou-Hallawa. In order to move away from a singleton IOSurfacePool, we need to pass the pool which the IOSurface will be added to. For RemoteLayerBackingStore, pass the singleton WebProcess pool (this is the non-GPU Process code path). * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::Buffer::discard): 2022-04-05 Zan Dobersek [Unix] Add UnixFileDescriptor, use it in IPC::Semaphore https://bugs.webkit.org/show_bug.cgi?id=238726 Reviewed by Carlos Garcia Campos. Use WTF::UnixFileDescriptor in IPC::Semaphore in place of a raw integer value. This also simplifies other things, e.g. the move constructor and assignment operator can now both be defaulted. The IPC encoding and decoding of the semaphore object is also simpler, leaning into the custom ArgumentCoder specialization for objects of the WTF::UnixFileDescriptor type. The encoding and decoding is done by chaperoning the file descriptor through IPC::Attachment. * Platform/IPC/IPCSemaphore.h: (IPC::Semaphore::operator bool const): * Platform/IPC/unix/IPCSemaphoreUnix.cpp: (IPC::Semaphore::Semaphore): (IPC::Semaphore::signal): (IPC::Semaphore::wait): (IPC::Semaphore::waitFor): (IPC::Semaphore::encode const): (IPC::Semaphore::decode): (IPC::Semaphore::destroy): (IPC::Semaphore::operator=): Deleted. * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder::encode): (IPC::ArgumentCoder::decode): * Shared/WebCoreArgumentCoders.h: 2022-04-05 Megan Gardner Expand autocorrect context for more accurate results. https://bugs.webkit.org/show_bug.cgi?id=237990 Reviewed by Wenson Hsieh. Covered by existing tests. Expand autocorrect context to at least 10 words instead of 3, and with a min/max length of 40/100 instead of 12/30 and start context at the beginning of sentences to help with having more accurate autocorrect suggestions. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::autocorrectionContext): 2022-04-05 Tim Horton Remove system feature flags implementation https://bugs.webkit.org/show_bug.cgi?id=238791 Reviewed by Megan Gardner. * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm: (WebKit::isFeatureFlagEnabled): Deleted. * Shared/WebPreferencesDefaultValues.cpp: (WebKit::isFeatureFlagEnabled): Deleted. * Shared/WebPreferencesDefaultValues.h: * Shared/win/WebPreferencesDefaultValuesWin.cpp: Removed. 2022-04-05 Adrian Perez de Castro [WPE] Mark "backend" parameters of web view constructors not nullable https://bugs.webkit.org/show_bug.cgi?id=238734 Reviewed by Martin Robinson. No new tests needed. * UIProcess/API/wpe/WebKitWebViewWPE.cpp: Annotate web view constructors with (not nullable) and while at it, fix documentation links, and improve the wording to better follow gi-docgen copywriting style. Remove the mentions to the single process model, which is deprecated anyway. 2022-04-04 Tim Horton Stop generating WebKit system feature flags plists https://bugs.webkit.org/show_bug.cgi?id=238784 Reviewed by Wenson Hsieh. * FeatureFlags/WebKit-appletvos.plist: Removed. * FeatureFlags/WebKit-ios.plist: Removed. * FeatureFlags/WebKit-macos.plist: Removed. * FeatureFlags/WebKit-watchos.plist: Removed. * Scripts/combine-feature-flags-plist.py: Removed. * Scripts/generate-feature-flags-plist.sh: Removed. * WebKit.xcodeproj/project.pbxproj: 2022-04-04 Saam Barati Turn off LLInt ICs in captive portal mode https://bugs.webkit.org/show_bug.cgi?id=238778 Reviewed by Yusuke Suzuki. * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): 2022-04-04 Adrian Perez de Castro [WPE][GTK] Fix code examples in reference documentation https://bugs.webkit.org/show_bug.cgi?id=238770 Reviewed by Michael Catanzaro. Replace DocBook SGML tags containing code examples with Markdown fenced code blocks as consumed by gi-docgen. * UIProcess/API/glib/WebKitSettings.cpp: * UIProcess/API/glib/WebKitUserContentManager.cpp: * UIProcess/API/glib/WebKitWebContext.cpp: * UIProcess/API/glib/WebKitWebView.cpp: (webkit_web_view_class_init): * UIProcess/API/glib/WebKitWebsitePolicies.cpp: * UIProcess/API/gtk/WebKitWebInspector.cpp: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp: 2022-04-04 Simon Fraser Fix the CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER build https://bugs.webkit.org/show_bug.cgi?id=238783 Unreviewed build fix. ConcreteImageBuffer<>::create() needs a default CreationContext argument. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::ensureFrontBuffer): 2022-04-04 Tim Horton Remove GPU process system feature flags https://bugs.webkit.org/show_bug.cgi?id=238766 Reviewed by Simon Fraser. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultCaptureAudioInGPUProcessEnabled): (WebKit::defaultUseGPUProcessForCanvasRenderingEnabled): Deleted. (WebKit::defaultUseGPUProcessForDOMRenderingEnabled): Deleted. (WebKit::defaultUseGPUProcessForMediaEnabled): Deleted. (WebKit::defaultUseGPUProcessForWebGLEnabled): Deleted. (WebKit::defaultCaptureVideoInGPUProcessEnabled): Deleted. (WebKit::defaultWebRTCCodecsInGPUProcess): Deleted. * Shared/WebPreferencesDefaultValues.h: 2022-04-04 Simon Fraser Remove lots of WebCore:: in RemoteLayerBackingStore https://bugs.webkit.org/show_bug.cgi?id=238765 Reviewed by Wenson Hsieh. Add a `using namespace WebCore` to RemoteLayerBackingStore. WebCore::IOSurface still needs qualification. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::ensureBackingStore): (WebKit::RemoteLayerBackingStore::encode const): (WebKit::RemoteLayerBackingStore::setNeedsDisplay): (WebKit::RemoteLayerBackingStore::pixelFormat const): (WebKit::RemoteLayerBackingStore::bytesPerPixel const): (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): (WebKit::RemoteLayerBackingStore::applySwappedBuffers): (WebKit::RemoteLayerBackingStore::prepareToDisplay): (WebKit::RemoteLayerBackingStore::dirtyRepaintCounterIfNecessary): (WebKit::RemoteLayerBackingStore::ensureFrontBuffer): (WebKit::RemoteLayerBackingStore::prepareBuffers): (WebKit::RemoteLayerBackingStore::paintContents): (WebKit::RemoteLayerBackingStore::drawInContext): (WebKit::RemoteLayerBackingStore::enumerateRectsBeingDrawn): (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): (WebKit::RemoteLayerBackingStore::takePendingFlushers): (WebKit::RemoteLayerBackingStore::setBufferVolatile): (WebKit::RemoteLayerBackingStore::setBufferNonVolatile): (WebKit::RemoteLayerBackingStore::setFrontBufferNonVolatile): (WebKit::RemoteLayerBackingStore::bufferForType const): 2022-04-04 Simon Fraser Remove lots of WebCore:: in RemoteRenderingBackend https://bugs.webkit.org/show_bug.cgi?id=238763 Reviewed by Wenson Hsieh. RemoteRenderingBackend already has a `using namespace WebCore` so remove the explicit namespacing. Also clean up some includes in the header. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::getPixelBufferForImageBuffer): (WebKit::RemoteRenderingBackend::getPixelBufferForImageBufferWithNewMemory): (WebKit::RemoteRenderingBackend::putPixelBufferForImageBuffer): (WebKit::RemoteRenderingBackend::getDataURLForImageBuffer): (WebKit::RemoteRenderingBackend::getDataURLForImageBufferWithQualifiedIdentifier): (WebKit::RemoteRenderingBackend::getDataForImageBuffer): (WebKit::RemoteRenderingBackend::getShareableBitmapForImageBuffer): (WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier): (WebKit::RemoteRenderingBackend::cacheFont): (WebKit::handleFromBuffer): (WebKit::RemoteRenderingBackend::markSurfacesVolatile): * GPUProcess/graphics/RemoteRenderingBackend.h: 2022-04-04 Tim Horton Remove VP8/9 and WebM-related system feature flags https://bugs.webkit.org/show_bug.cgi?id=238757 Reviewed by Eric Carlson. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultWebMFormatReaderEnabled): Deleted. (WebKit::defaultVP8DecoderEnabled): Deleted. (WebKit::defaultVP9DecoderEnabled): Deleted. (WebKit::defaultWebMParserEnabled): Deleted. * Shared/WebPreferencesDefaultValues.h: 2022-04-04 Wenson Hsieh [macOS] [WK2] Add plumbing to extract video frames in element fullscreen https://bugs.webkit.org/show_bug.cgi?id=238715 rdar://91216152 Reviewed by Tim Horton. Implement (begin|cancel)ElementFullscreenVideoExtraction on macOS, leaving empty stubs for non-internal builds. * UIProcess/Cocoa/WebViewImpl.h: * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::beginElementFullscreenVideoExtraction): (WebKit::WebViewImpl::cancelElementFullscreenVideoExtraction): * UIProcess/mac/PageClientImplMac.h: * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::beginElementFullscreenVideoExtraction): (WebKit::PageClientImpl::cancelElementFullscreenVideoExtraction): 2022-04-04 Tim Horton Remove the 'general_directory_for_storage' system feature flag https://bugs.webkit.org/show_bug.cgi?id=238762 Reviewed by Sihui Liu. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::defaultShouldUseCustomStoragePaths): 2022-04-04 Tim Horton Remove the 'sw_vp9_decoder_on_battery' system feature flag https://bugs.webkit.org/show_bug.cgi?id=238761 Reviewed by Eric Carlson. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultVP9SWDecoderEnabledOnBattery): Deleted. 2022-04-04 Tim Horton Remove the 'async frame and overflow scrolling' system feature flag https://bugs.webkit.org/show_bug.cgi?id=238758 Reviewed by Simon Fraser. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled): Deleted. (WebKit::defaultAsyncFrameScrollingEnabled): Deleted. (WebKit::defaultAsyncOverflowScrollingEnabled): Deleted. * Shared/WebPreferencesDefaultValues.h: 2022-04-04 Tim Horton Remove the incremental_pdf system feature flag https://bugs.webkit.org/show_bug.cgi?id=238754 Reviewed by Wenson Hsieh. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * Shared/WebPreferencesDefaultValues.cpp: * Shared/WebPreferencesDefaultValues.h: (WebKit::defaultIncrementalPDFEnabled): Deleted. Remove the incremental_pdf system feature flag in favor of a traditional WebKit preference. 2022-04-04 Tim Horton Remove the 'RB_full_manage_WK_jetsam' system feature flag and simplify adjacent logic https://bugs.webkit.org/show_bug.cgi?id=238760 Reviewed by Chris Dumez. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::shouldLeakBoost): 2022-04-04 Tim Horton Remove some unused system feature flags https://bugs.webkit.org/show_bug.cgi?id=238755 Reviewed by Wenson Hsieh. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: Neither of these flags is read anywhere, so they don't need to be in the plist. 2022-04-04 Cameron McCormack Remove display list map entry before remote resource https://bugs.webkit.org/show_bug.cgi?id=238764 Reviewed by Simon Fraser. * GPUProcess/graphics/RemoteDisplayListRecorder.cpp: (WebKit::RemoteDisplayListRecorder::clearImageBufferReference): * GPUProcess/graphics/RemoteDisplayListRecorder.h: * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::releaseRemoteResourceWithQualifiedIdentifier): 2022-04-04 Wenson Hsieh [macOS] Add helper methods to install and uninstall VKCImageAnalysisOverlayView https://bugs.webkit.org/show_bug.cgi?id=238714 Reviewed by Tim Horton. Add helper methods for adding and removing a temporary VKCImageAnalysisOverlayView as a subview of WKWebView. See below for more details. No change in behavior (yet). * UIProcess/Cocoa/WebViewImpl.h: (WebKit::WebViewImpl::imageAnalysisInteractionBounds const): (WebKit::WebViewImpl::imageAnalysisOverlayView const): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::processImageAnalyzerRequest): Pull logic for processing an image analyzer request and invoking the completion handler on the main thread (via `callOnMainRunLoop`) out into a separate helper method (to be used in a subsequent patch). (WebKit::WebViewImpl::requestTextRecognition): (-[WKImageAnalysisOverlayViewDelegate initWithWebViewImpl:]): Add an Objective-C object that acts as a delegate for the image analysis overlay view. This is done to correctly position the overlay, but also for a couple of additonal reasons below. (-[WKImageAnalysisOverlayViewDelegate dealloc]): (-[WKImageAnalysisOverlayViewDelegate observeValueForKeyPath:ofObject:change:context:]): Add logic to steal first responder status away from VKCImageAnalysisOverlayView's internal text selection view and restore it to the web view when there is no longer an active text selection in the overlay. This ensures that key events are only routed to the image analysis overlay view in the case where the overlay actually contains a text selection. (-[WKImageAnalysisOverlayViewDelegate firstResponderIsInsideImageOverlay]): (-[WKImageAnalysisOverlayViewDelegate imageAnalysisOverlay:shouldHandleKeyDownEvent:]): Never allow the image overlay view to override Escape key handling. (-[WKImageAnalysisOverlayViewDelegate contentsRectForImageAnalysisOverlayView:]): (WebKit::WebViewImpl::installImageAnalysisOverlayView): (WebKit::WebViewImpl::uninstallImageAnalysisOverlayView): (WebKit::WebViewImpl::imageAnalysisOverlayViewHasCursorAtPoint const): Allow the image analysis overlay view to set the mouse cursor when the mouse is over interactable content. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::setCursor): 2022-04-04 Youenn Fablet Service-Worker-Navigation-Preload header not being sent when Navigation Preload is enabled. https://bugs.webkit.org/show_bug.cgi?id=238564 Reviewed by Alex Christensen. We were cancelling the preload as soon as receiving a response through FetchEvent.respondWith. But it is possible to answer with a synthetic response and then use the preload to fill the synthetic response body. To allow this, we no longer cancel the preload when receiving a response in case of enabled navigation preload. Test: http/wpt/service-workers/service-worker-iframe-preload-after-response.https.html * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: 2022-04-04 Elliott Williams [XCBuild] WebKitLegacy's "Migrated headers" script does not emit task information https://bugs.webkit.org/show_bug.cgi?id=238409 Reviewed by Alexey Proskuryakov. * WebKit.xcodeproj/project.pbxproj: Small build rule fix to prevent "no rule to process file" warnings on every generated forwarding header. This happened because the build rule that generates these temporary forwarding headers looked like it was supposed to _process_ those headers, too. 2022-04-04 Kimmo Kinnunen RemoteRenderingBackendProxy fails to maintain correct state when gpu process crashes and upon deletion https://bugs.webkit.org/show_bug.cgi?id=238618 Reviewed by Simon Fraser. RemoteRenderingBackendProxy::m_needsWakeUpSemaphoreForDisplayListStream was not reset when proxy would connect to a new gpu process after a crash. RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy() would not remove the GPUConnection::Client registration. * Platform/IPC/MessageReceiveQueueMap.cpp: (IPC::MessageReceiveQueueMap::remove): * Platform/IPC/StreamClientConnection.h: * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy): (WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose): (WebKit::RemoteRenderingBackendProxy::disconnectGPUProcess): (WebKit::RemoteRenderingBackendProxy::streamConnection): (WebKit::RemoteRenderingBackendProxy::didCreateWakeUpSemaphoreForDisplayListStream): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2022-04-04 Kimmo Kinnunen StreamClientConnection should have waitForAndDispatchImmediately https://bugs.webkit.org/show_bug.cgi?id=238622 Reviewed by Simon Fraser. IPC::StreamClientConnection should have the same communication methods as the IPC::Connection. The stream connection will forward the calls to underlying IPC::Connection, if needed. Add missing IPC::StreamClientConnection::waitForAndDispatchImmediately() and use it. Remove conveinence accessor methods for the IPC::Connection, as that should be accessed by accessing the stream connection in the respective classes. No new tests, refactor. * Platform/IPC/StreamClientConnection.h: (IPC::StreamClientConnection::waitForAndDispatchImmediately): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy): (WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: (WebKit::RemoteGraphicsContextGLProxy::sendSync): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend): (WebKit::RemoteRenderingBackendProxy::waitForDidFlush): (WebKit::RemoteRenderingBackendProxy::streamConnection): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp: (WebKit::RemoteGPUProxy::RemoteGPUProxy): (WebKit::RemoteGPUProxy::waitUntilInitialized): 2022-04-04 Kimmo Kinnunen IPC::StreamServerConnectionBase has only one subclass, it should be removed https://bugs.webkit.org/show_bug.cgi?id=238676 Reviewed by Wenson Hsieh. Merge IPC::StreamServerConnectionBase and IPC::StreamServerConnection. The base was useful when the concrete classes were templates per message receiver. The concrete class was changed to use multiple message receivers, and the templating was replaced with id lookup. No new tests, refactor. * GPUProcess/graphics/RemoteDisplayListRecorder.h: * GPUProcess/graphics/RemoteGraphicsContextGL.h: * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/WebGPU/RemoteAdapter.h: * GPUProcess/graphics/WebGPU/RemoteBindGroup.h: * GPUProcess/graphics/WebGPU/RemoteBindGroupLayout.h: * GPUProcess/graphics/WebGPU/RemoteBuffer.h: * GPUProcess/graphics/WebGPU/RemoteCommandBuffer.h: * GPUProcess/graphics/WebGPU/RemoteCommandEncoder.h: * GPUProcess/graphics/WebGPU/RemoteComputePassEncoder.h: * GPUProcess/graphics/WebGPU/RemoteComputePipeline.h: * GPUProcess/graphics/WebGPU/RemoteDevice.h: * GPUProcess/graphics/WebGPU/RemoteExternalTexture.h: * GPUProcess/graphics/WebGPU/RemoteGPU.h: * GPUProcess/graphics/WebGPU/RemotePipelineLayout.h: * GPUProcess/graphics/WebGPU/RemoteQuerySet.h: * GPUProcess/graphics/WebGPU/RemoteQueue.h: * GPUProcess/graphics/WebGPU/RemoteRenderBundle.h: * GPUProcess/graphics/WebGPU/RemoteRenderBundleEncoder.h: * GPUProcess/graphics/WebGPU/RemoteRenderPassEncoder.h: * GPUProcess/graphics/WebGPU/RemoteRenderPipeline.h: * GPUProcess/graphics/WebGPU/RemoteSampler.h: * GPUProcess/graphics/WebGPU/RemoteShaderModule.h: * GPUProcess/graphics/WebGPU/RemoteTexture.h: * GPUProcess/graphics/WebGPU/RemoteTextureView.h: * Platform/IPC/HandleMessage.h: (IPC::handleMessageSynchronous): * Platform/IPC/StreamConnectionWorkQueue.cpp: (IPC::StreamConnectionWorkQueue::addStreamConnection): (IPC::StreamConnectionWorkQueue::removeStreamConnection): (IPC::StreamConnectionWorkQueue::processStreams): * Platform/IPC/StreamConnectionWorkQueue.h: * Platform/IPC/StreamMessageReceiver.h: * Platform/IPC/StreamServerConnection.cpp: (IPC::StreamServerConnection::StreamServerConnection): (IPC::StreamServerConnection::startReceivingMessages): (IPC::StreamServerConnection::stopReceivingMessages): (IPC::StreamServerConnection::enqueueMessage): (IPC::StreamServerConnection::tryAcquire): (IPC::StreamServerConnection::acquireAll): (IPC::StreamServerConnection::release): (IPC::StreamServerConnection::releaseAll): (IPC::StreamServerConnection::alignedSpan): (IPC::StreamServerConnection::size): (IPC::StreamServerConnection::clampedLimit const): (IPC::StreamServerConnection::dispatchStreamMessages): * Platform/IPC/StreamServerConnection.h: (IPC::StreamServerConnection::sendSyncReply): * Scripts/webkit/messages.py: (generate_message_handler): * Scripts/webkit/tests/TestWithStreamMessageReceiver.cpp: (WebKit::TestWithStream::didReceiveStreamMessage): * Shared/IPCStreamTester.h: 2022-04-03 Tim Horton _WKDataTask doesn't work in macCatalyst https://bugs.webkit.org/show_bug.cgi?id=238655 Reviewed by Alexey Proskuryakov. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]): Deleted. 2022-04-02 Simon Fraser Plumb the IOSurfacePool through to ImageBufferBackend creation via ImageBuffer::CreationContext https://bugs.webkit.org/show_bug.cgi?id=238695 Reviewed by Said Abou-Hallawa. Wrap the existing HostWindow* and a new IOSurfacePool* pointers into a ImageBuffer::CreationContext struct, and replace the HostWindow* argument with it in buffer creation functions. RemoteLayerBackingStoreCollection::allocateBufferForBackingStore() passes the singleton IOSurfacePool which is thus used in the non-GPU Process code path (DOM rendering disabled). * Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp: (WebKit::CGDisplayListImageBufferBackend::create): * Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::ensureFrontBuffer): * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: (WebKit::RemoteLayerBackingStoreCollection::allocateBufferForBackingStore): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp: (WebKit::ImageBufferShareableBitmapBackend::create): * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h: * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.h: 2022-04-02 Chris Dumez Add default constructor to ASCIILiteral https://bugs.webkit.org/show_bug.cgi?id=238700 Reviewed by Geoffrey Garen. Add default constructor to ASCIILiteral, to replace the more verbose ASCIILiteral::null(). * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: (WebKit::LocalStorageDatabase::migrateItemTableIfNeeded): * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::sendMessage): * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::setDockSide): 2022-04-02 Myles C. Maxfield [Cocoa] semaphore_timedwait() can return KERN_ABORTED https://bugs.webkit.org/show_bug.cgi?id=238694 Reviewed by Geoffrey Garen. I was hitting this assert while debugging WebKit today. * Platform/IPC/darwin/IPCSemaphoreDarwin.cpp: (IPC::Semaphore::waitFor): 2022-04-02 Yury Semikhatsky GTK doesn't compile with ENABLE_ACCESSIBILITY=0 https://bugs.webkit.org/show_bug.cgi?id=238669 Reviewed by Michael Catanzaro. Fix GTK compilation with ENABLE_ACCESSIBILITY=0 No new tests. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseDispose): (webkit_web_view_base_class_init): 2022-04-02 Andres Gonzalez Expose AXObjectCache::treeData to the UI process. https://bugs.webkit.org/show_bug.cgi?id=238563 Reviewed by Chris Fleizach. Exposed Page::accessibilityTreeData so that it can be invoked from the UI process. This will be used to log a textual representation of the AX trees from the browser process. * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView retrieveAccessibilityTreeData:]): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::getAccessibilityTreeData): * UIProcess/WebPageProxy.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::getAccessibilityTreeData): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2022-04-02 Adrian Perez de Castro [GTK] Replace gtk-doc with gi-docgen https://bugs.webkit.org/show_bug.cgi?id=226662 Reviewed by Michael Catanzaro. Import two new CMake modules which define commands to easy setup of GObject-Introspection and gi-docgen. These in turn allow to remove a bunch of duplicated CMake code, reuse the same for both the WPE and GTK ports, and remove the gnarly DocBook templates and other auxiliary files previously used by gtk-doc (which amount to a sizeable amount of code). While at it, do a quick pass to fix the most egregious issues reported by gi-docgen's linting mode and that all public symbols end up with at least some documentation in the generated output. Follow-up patches will be needed to keep adapting to the style encouraged by gi-docgen, fix linking between documented entities, make code examples display properly, and a few other things. * PlatformGTK.cmake: Adapt to use the new CMake modules. * PlatformWPE.cmake: Ditto. * Shared/API/glib/WebKitContextMenu.cpp: Fix documentation comments. * Shared/API/glib/WebKitContextMenuItem.cpp: Ditto. * Shared/API/glib/WebKitHitTestResult.cpp: Ditto. * Shared/API/glib/WebKitURIRequest.cpp: Ditto. * Shared/API/glib/WebKitURIResponse.cpp: Ditto. * Shared/API/glib/WebKitUserMessage.cpp: Ditto. * UIProcess/API/glib/WebKitApplicationInfo.cpp: Ditto. * UIProcess/API/glib/WebKitAuthenticationRequest.cpp: Ditto. * UIProcess/API/glib/WebKitAutomationSession.cpp: Ditto. * UIProcess/API/glib/WebKitBackForwardList.cpp: Ditto. * UIProcess/API/glib/WebKitBackForwardListItem.cpp: Ditto. * UIProcess/API/glib/WebKitCookieManager.cpp: Ditto. * UIProcess/API/glib/WebKitCredential.cpp: Ditto. * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitDownload.cpp: Ditto. * UIProcess/API/glib/WebKitEditorState.cpp: Ditto. * UIProcess/API/glib/WebKitError.cpp: Ditto. * UIProcess/API/glib/WebKitFaviconDatabase.cpp: Ditto. * UIProcess/API/glib/WebKitFileChooserRequest.cpp: Ditto. * UIProcess/API/glib/WebKitFindController.cpp: Ditto. * UIProcess/API/glib/WebKitFormSubmissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitGeolocationManager.cpp: Ditto. * UIProcess/API/glib/WebKitGeolocationPermissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitInputMethodContext.cpp: Ditto. (webkit_input_method_context_class_init): Ditto. * UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitJavascriptResult.cpp: Ditto. * UIProcess/API/glib/WebKitMediaKeySystemPermissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitMemoryPressureSettings.cpp: Ditto. * UIProcess/API/glib/WebKitMimeInfo.cpp: Ditto. * UIProcess/API/glib/WebKitNavigationAction.cpp: Ditto. * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp: Ditto. * UIProcess/API/glib/WebKitNetworkProxySettings.cpp: Ditto. * UIProcess/API/glib/WebKitNotification.cpp: Ditto. * UIProcess/API/glib/WebKitNotificationPermissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitOptionMenu.cpp: Ditto. * UIProcess/API/glib/WebKitOptionMenuItem.cpp: Ditto. * UIProcess/API/glib/WebKitPermissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitPlugin.cpp: Ditto. * UIProcess/API/glib/WebKitPointerLockPermissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitPolicyDecision.cpp: Ditto. * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp: Ditto. * UIProcess/API/glib/WebKitScriptDialog.cpp: Ditto. * UIProcess/API/glib/WebKitSecurityManager.cpp: Ditto. * UIProcess/API/glib/WebKitSecurityOrigin.cpp: Ditto. * UIProcess/API/glib/WebKitSettings.cpp: Ditto. * UIProcess/API/glib/WebKitURISchemeRequest.cpp: Ditto. * UIProcess/API/glib/WebKitURISchemeResponse.cpp: Ditto. (webkit_uri_scheme_response_class_init): Ditto. * UIProcess/API/glib/WebKitURIUtilities.cpp: Ditto. * UIProcess/API/glib/WebKitUserContent.cpp: Ditto. * UIProcess/API/glib/WebKitUserContentFilterStore.cpp: Ditto. * UIProcess/API/glib/WebKitUserContentManager.cpp: Ditto. * UIProcess/API/glib/WebKitUserMediaPermissionRequest.cpp: Ditto. (webkit_user_media_permission_request_class_init): Ditto. * UIProcess/API/glib/WebKitVersion.cpp: Ditto. * UIProcess/API/glib/WebKitWebContext.cpp: Ditto. * UIProcess/API/glib/WebKitWebResource.cpp: Ditto. * UIProcess/API/glib/WebKitWebView.cpp: Ditto. * UIProcess/API/glib/WebKitWebViewSessionState.cpp: Ditto. * UIProcess/API/glib/WebKitWebsiteData.cpp: Ditto. * UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequest.cpp: Ditto. * UIProcess/API/glib/WebKitWebsiteDataManager.cpp: Ditto. * UIProcess/API/glib/WebKitWebsitePolicies.cpp: Ditto. * UIProcess/API/glib/WebKitWindowProperties.cpp: Ditto. (webkit_window_properties_class_init): Ditto. * UIProcess/API/gtk/WebKitAuthenticationDialog.h: Ditto. * UIProcess/API/gtk/WebKitAuthenticationRequest.h: Ditto. * UIProcess/API/gtk/WebKitAutomationSession.h: Ditto. * UIProcess/API/gtk/WebKitBackForwardList.h: Ditto. * UIProcess/API/gtk/WebKitBackForwardListItem.h: Ditto. * UIProcess/API/gtk/WebKitColorChooserRequest.cpp: Ditto. (webkit_color_chooser_request_class_init): Ditto. * UIProcess/API/gtk/WebKitContextMenu.h: Ditto. * UIProcess/API/gtk/WebKitCookieManager.h: Ditto. * UIProcess/API/gtk/WebKitDefines.h: Ditto. * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Ditto. * UIProcess/API/gtk/WebKitDownload.h: Ditto. * UIProcess/API/gtk/WebKitEditorState.h: Ditto. * UIProcess/API/gtk/WebKitError.h: Ditto. * UIProcess/API/gtk/WebKitFaviconDatabase.h: Ditto. * UIProcess/API/gtk/WebKitFileChooserRequest.h: Ditto. * UIProcess/API/gtk/WebKitFindController.h: Ditto. * UIProcess/API/gtk/WebKitFormSubmissionRequest.h: Ditto. * UIProcess/API/gtk/WebKitGeolocationManager.h: Ditto. * UIProcess/API/gtk/WebKitGeolocationPermissionRequest.h: Ditto. * UIProcess/API/gtk/WebKitHitTestResult.h: Ditto. * UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.h: Ditto. * UIProcess/API/gtk/WebKitMediaKeySystemPermissionRequest.h: Ditto. * UIProcess/API/gtk/WebKitNavigationPolicyDecision.h: Ditto. * UIProcess/API/gtk/WebKitNotification.h: Ditto. * UIProcess/API/gtk/WebKitOptionMenu.h: Ditto. * UIProcess/API/gtk/WebKitPlugin.h: Ditto. * UIProcess/API/gtk/WebKitPointerLockPermissionRequest.h: Ditto. * UIProcess/API/gtk/WebKitPolicyDecision.h: Ditto. * UIProcess/API/gtk/WebKitPrintCustomWidget.cpp: Ditto. * UIProcess/API/gtk/WebKitPrintCustomWidget.h: Ditto. * UIProcess/API/gtk/WebKitPrintOperation.cpp: Ditto. * UIProcess/API/gtk/WebKitPrintOperation.h: Ditto. * UIProcess/API/gtk/WebKitResponsePolicyDecision.h: Ditto. * UIProcess/API/gtk/WebKitSecurityManager.h: Ditto. * UIProcess/API/gtk/WebKitSettings.h: Ditto. * UIProcess/API/gtk/WebKitURIRequest.h: Ditto. * UIProcess/API/gtk/WebKitURIResponse.h: Ditto. * UIProcess/API/gtk/WebKitURISchemeRequest.h: Ditto. * UIProcess/API/gtk/WebKitURISchemeResponse.h: Ditto. * UIProcess/API/gtk/WebKitUserContentFilterStore.h: Ditto. * UIProcess/API/gtk/WebKitUserContentManager.h: Ditto. * UIProcess/API/gtk/WebKitUserMediaPermissionRequest.h: Ditto. * UIProcess/API/gtk/WebKitUserMessage.h: Ditto. * UIProcess/API/gtk/WebKitVersion.h.in: Ditto. * UIProcess/API/gtk/WebKitWebContext.h: Ditto. * UIProcess/API/gtk/WebKitWebInspector.cpp: Ditto. * UIProcess/API/gtk/WebKitWebInspector.h: Ditto. * UIProcess/API/gtk/WebKitWebResource.h: Ditto. * UIProcess/API/gtk/WebKitWebView.h: Ditto. * UIProcess/API/gtk/WebKitWebViewBase.cpp: Ditto. * UIProcess/API/gtk/WebKitWebViewDialog.h: Ditto. * UIProcess/API/gtk/WebKitWebsiteDataAccessPermissionRequest.h: Ditto. * UIProcess/API/gtk/WebKitWebsiteDataManager.h: Ditto. * UIProcess/API/gtk/WebKitWebsitePolicies.h: Ditto. * UIProcess/API/gtk/WebKitWindowProperties.h: Ditto. * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Removed. * UIProcess/API/gtk/docs/webkit2gtk-4.0.types: Removed. * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Removed. * UIProcess/API/wpe/WebKitAuthenticationRequest.h: Fix documentation comments. * UIProcess/API/wpe/WebKitAutomationSession.h: Ditto. * UIProcess/API/wpe/WebKitBackForwardList.h: Ditto. * UIProcess/API/wpe/WebKitBackForwardListItem.h: Ditto. * UIProcess/API/wpe/WebKitColor.cpp: Ditto. * UIProcess/API/wpe/WebKitColor.h: Ditto. * UIProcess/API/wpe/WebKitContextMenu.h: Ditto. * UIProcess/API/wpe/WebKitContextMenuItem.h: Ditto. * UIProcess/API/wpe/WebKitCookieManager.h: Ditto. * UIProcess/API/wpe/WebKitDefines.h: Ditto. * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Ditto. * UIProcess/API/wpe/WebKitDownload.h: Ditto. * UIProcess/API/wpe/WebKitEditorState.h: Ditto. * UIProcess/API/wpe/WebKitError.h: Ditto. * UIProcess/API/wpe/WebKitFaviconDatabase.h: Ditto. * UIProcess/API/wpe/WebKitFileChooserRequest.h: Ditto. * UIProcess/API/wpe/WebKitFindController.h: Ditto. * UIProcess/API/wpe/WebKitFormSubmissionRequest.h: Ditto. * UIProcess/API/wpe/WebKitGeolocationManager.h: Ditto. * UIProcess/API/wpe/WebKitGeolocationPermissionRequest.h: Ditto. * UIProcess/API/wpe/WebKitHitTestResult.h: Ditto. * UIProcess/API/wpe/WebKitInputMethodContext.h: Ditto. * UIProcess/API/wpe/WebKitInstallMissingMediaPluginsPermissionRequest.h: Ditto. * UIProcess/API/wpe/WebKitMediaKeySystemPermissionRequest.h: Ditto. * UIProcess/API/wpe/WebKitNavigationPolicyDecision.h: Ditto. * UIProcess/API/wpe/WebKitNotification.h: Ditto. * UIProcess/API/wpe/WebKitOptionMenu.h: Ditto. * UIProcess/API/wpe/WebKitPlugin.h: Ditto. * UIProcess/API/wpe/WebKitPolicyDecision.h: Ditto. * UIProcess/API/wpe/WebKitRectangle.cpp: Ditto. * UIProcess/API/wpe/WebKitRectangle.h: Ditto. * UIProcess/API/wpe/WebKitResponsePolicyDecision.h: Ditto. * UIProcess/API/wpe/WebKitSecurityManager.h: Ditto. * UIProcess/API/wpe/WebKitSettings.h: Ditto. * UIProcess/API/wpe/WebKitURIRequest.h: Ditto. * UIProcess/API/wpe/WebKitURIResponse.h: Ditto. * UIProcess/API/wpe/WebKitURISchemeRequest.h: Ditto. * UIProcess/API/wpe/WebKitURISchemeResponse.h: Ditto. * UIProcess/API/wpe/WebKitUserContentFilterStore.h: Ditto. * UIProcess/API/wpe/WebKitUserContentManager.h: Ditto. * UIProcess/API/wpe/WebKitUserMediaPermissionRequest.h: Ditto. * UIProcess/API/wpe/WebKitUserMessage.h: Ditto. * UIProcess/API/wpe/WebKitVersion.h.in: Ditto. * UIProcess/API/wpe/WebKitWebContext.h: Ditto. * UIProcess/API/wpe/WebKitWebResource.h: Ditto. * UIProcess/API/wpe/WebKitWebView.h: Ditto. * UIProcess/API/wpe/WebKitWebViewBackend.cpp: Ditto. * UIProcess/API/wpe/WebKitWebViewWPE.cpp: Ditto. * UIProcess/API/wpe/WebKitWebsiteDataAccessPermissionRequest.h: Ditto. * UIProcess/API/wpe/WebKitWebsiteDataManager.h: Ditto. * UIProcess/API/wpe/WebKitWebsitePolicies.h: Ditto. * UIProcess/API/wpe/WebKitWindowProperties.h: Ditto. * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Removed. * UIProcess/API/wpe/docs/wpe-docs.sgml: Removed. * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp: Fix documentation comments. * WebProcess/InjectedBundle/API/glib/WebKitWebEditor.cpp: Ditto. * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp: Ditto. * WebProcess/InjectedBundle/API/glib/WebKitWebHitTestResult.cpp: Ditto. * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp: Ditto. * WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt: Removed. * WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-docs.sgml: Removed. * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h: Fix documentation comments. * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h: Ditto. * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h: Ditto. * WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h: Ditto. * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt: Removed. * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-docs.sgml: Removed. * gtk/webkit2gtk-webextension.toml.in: Added. * gtk/webkit2gtk.toml.in: Added. * wpe/wpewebextension.toml.in: Added. * wpe/wpewebkit.toml.in: Added. 2022-04-02 Youenn Fablet Remove notifications from notification list when notification gets closed https://bugs.webkit.org/show_bug.cgi?id=238665 Reviewed by Darin Adler. Cancelling a notification should trigger the close steps, which means removing the notification from the notification list. * UIProcess/Notifications/WebNotificationManagerProxy.cpp: (WebKit::WebNotificationManagerProxy::cancel): (WebKit::WebNotificationManagerProxy::didDestroyNotification): 2022-04-01 Wenson Hsieh [iOS] WKFullScreenWindowController's UIViewController leaks after entering element fullscreen https://bugs.webkit.org/show_bug.cgi?id=238684 Reviewed by Eric Carlson. The window controller's `_rootViewController` is a `RetainPtr`, but we're missing an `adoptNS` when creating a new view controller. Fix the leak by using `adoptNS` to prevent the redundant `-retain` when constructing `RetainPtr`. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController enterFullScreen]): 2022-04-01 Wenson Hsieh [iOS] Several tests in media/modern-media-controls crash in -[WKActionSheetAssistant _uiMenuElementsForMediaControlContextMenuItems:] https://bugs.webkit.org/show_bug.cgi?id=238687 Reviewed by Tim Horton. Fixes several debug assertions that are hit when running layout tests in media/modern-media-controls, due to exercising undefined behavior in the case where there is only one item. This is because we currently use Vector's move assignment operator to set `items` to `items[0].children`; however, this move assignment operator starts by calling the destructor on the contents of `item`, which puts the first item's vector of children in an invalid state. Instead, simply add a new temporary variable, and move into the temporary variable instead. * UIProcess/ios/WKActionSheetAssistant.mm: (-[WKActionSheetAssistant _uiMenuElementsForMediaControlContextMenuItems:]): (-[WKActionSheetAssistant showMediaControlsContextMenu:items:completionHandler:]): 2022-04-01 Michael Saboff Stop copying StagedFrameworks to the secondary path by default https://bugs.webkit.org/show_bug.cgi?id=238688 Reviewed by Saam Barati. Decoupled COPY_STAGED_FRAMEWORKS_TO_SECONDARY_PATH from USE_SYSTEM_CONTENT_PATH so we won't always copy frameworks to the secondary path on macOS. Instead, the build configuration can set COPY_STAGED_FRAMEWORKS_TO_SECONDARY_PATH as appropriate. * Configurations/Base.xcconfig: 2022-04-01 Diego Pino Garcia Unreviewed, fix non-unified build after r292225 * Platform/IPC/unix/IPCSemaphoreUnix.cpp: Add poll.h and remove duplicated Decoder.h and Encoder.h headers. 2022-04-01 Sihui Liu Avoid initializing default WKWebsiteDataStore in -[WKWebViewConfiguration copyWithZone] https://bugs.webkit.org/show_bug.cgi?id=238531 rdar://90628101 Reviewed by Tim Horton. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration copyWithZone:]): 2022-04-01 Jeff Miller WKBundlePageUIClient console message support should include source URL, column number, and console messages with arguments https://bugs.webkit.org/show_bug.cgi?id=238032 Reviewed by Alex Christensen. Add a new ChromeClient addMessageWithArgumentsToConsole() member function for adding a console message that includes formatted arguments. I left the existing behavior of addMessageToConsole() unchanged since layout tests expect to get the console message without these arguments. * Shared/API/APIArray.cpp: (API::Array::createStringArray): Added, creates an array from a Span. * Shared/API/APIArray.h: * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h: (API::InjectedBundle::PageUIClient::willAddMessageWithArgumentsToConsole): Added. * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h: Add WKBundlePageUIClientV5 with a new willAddMessageWithDetailsToConsole callback. This callback is similar to the existing willAddMessageToConsole callback, but includes any message arguments, the column number, and source URL. * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: (WebKit::InjectedBundlePageUIClient::willAddMessageWithArgumentsToConsole): Added, invokes the new willAddMessageWithDetailsToConsole callback. * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: Add a new bundle page UI client version. * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::addMessageWithArgumentsToConsole): Added. * WebProcess/WebCoreSupport/WebChromeClient.h: Added addMessageWithArgumentsToConsole(). 2022-04-01 Wenson Hsieh [iOS] [WK2] Add plumbing for extracting video frames in element fullscreen https://bugs.webkit.org/show_bug.cgi?id=238607 rdar://91102888 Reviewed by Eric Carlson. Add WebKit2 client layer plumbing for triggering video extraction for the prominent video in element fullscreen. See below for more details. * UIProcess/PageClient.h: (WebKit::PageClient::beginElementFullscreenVideoExtraction): (WebKit::PageClient::cancelElementFullscreenVideoExtraction): Add new PageClient hooks to start and cancel video element extraction in element fullscreen. We only implement these on iOS, for now. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::extractVideoInElementFullScreen): (WebKit::WebPageProxy::cancelVideoExtractionInElementFullScreen): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: Add IPC plumbing from WebPage to WebPageProxy for starting and canceling video element extraction. * UIProcess/ios/PageClientImplIOS.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::beginElementFullscreenVideoExtraction): (WebKit::PageClientImpl::cancelElementFullscreenVideoExtraction): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView beginElementFullscreenVideoExtraction:bounds:]): (-[WKContentView cancelElementFullscreenVideoExtraction]): Add method stubs for non-internal builds. * WebProcess/FullScreen/WebFullScreenManager.cpp: (WebKit::WebFullScreenManager::mainVideoElementExtractionTimerFired): (WebKit::WebFullScreenManager::endMainVideoElementExtractionIfNeeded): Remove the FIXMEs and call into the new helper methods on WebPage to start and cancel video element extraction. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::extractVideoInElementFullScreen): (WebKit::WebPage::cancelVideoExtractionInElementFullScreen): * WebProcess/WebPage/WebPage.h: 2022-04-01 Simon Fraser Hoist the IOSurfacePool out of IOSurface https://bugs.webkit.org/show_bug.cgi?id=238675 Reviewed by Tim Horton. A future patch will break the assumption that there is a singleton IOSurfacePool per process, so we can't have IOSurface::create() consult the pool internally. Instead, pass the pool to the create() functions, and to the moveToPool() function. Callers in the web process pass IOSurfacePool::sharedPool(); those in the UI process pass nullptr to avoid pool creation there. * GPUProcess/media/RemoteImageDecoderAVFProxy.cpp: (WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex): * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: (WebKit::RemoteMediaPlayerProxy::nativeImageForCurrentTime): * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _takeViewSnapshot]): (-[WKWebView _snapshotRectAfterScreenUpdates:rectInViewCoordinates:intoImageOfWidth:completionHandler:]): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::takeViewSnapshot): * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp: (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create): 2022-04-01 Jigen Zhou Fix build break after r292225 for Playstation. https://bugs.webkit.org/show_bug.cgi?id=238683 Reviewed by Don Olmstead. Unreviewed build fix after 292225 for Playstation build. * Platform/IPC/unix/IPCSemaphoreUnix.cpp: 2022-04-01 Diego Pino Garcia Unreviewed, fix non-unified build after r292218 * Platform/IPC/unix/IPCSemaphoreUnix.cpp: * UIProcess/Notifications/WebNotificationManagerProxy.h: 2022-04-01 Tusooa Zhu Expose WebKitWebView from WPEQtView https://bugs.webkit.org/show_bug.cgi?id=236746 Reviewed by Adrian Perez de Castro. WPEQtView currently does not allow manipulating the underlying WebKitWebView. This patch allows retrieving the WebKitWebView from the WPEQtView. No tests needed, as this patch only adds a trivial getter. * UIProcess/API/wpe/qt/WPEQtView.cpp: (WPEQtView::webView const): * UIProcess/API/wpe/qt/WPEQtView.h: 2022-04-01 Ben Nham Add more push-related logging https://bugs.webkit.org/show_bug.cgi?id=238591 Reviewed by Youenn Fablet. Add logging to help diagnose Push API errors. We currently log very little, which is making it hard for us to diagnose bug reports. - Log when we try to fetch or process push messages in NetworkProcess. - Log when we enqueue, start, and finish a PushServiceRequest. This helps catch issues such as a queued request never running because the OS push daemon never completing a request. - Log if we failed trying to wake up the browser to process a push message. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::processPushMessage): * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _getPendingPushMessages:]): (-[WKWebsiteDataStore _processPushMessage:completionHandler:]): * webpushd/PushService.mm: (WebPushD::PushService::create): (WebPushD::PushServiceRequestImpl::fulfill): (WebPushD::PushServiceRequestImpl::reject): (WebPushD::SubscribeRequest::startImpl): (WebPushD::UnsubscribeRequest::startInternal): (WebPushD::PushService::enqueuePushServiceRequest): (WebPushD::PushService::incrementSilentPushCount): (WebPushD::PushService::removeRecordsImpl): (WebPushD::makeRawPushMessage): (WebPushD::PushService::didReceivePushMessage): * webpushd/WebPushDaemon.mm: (WebPushD::Daemon::injectEncryptedPushMessageForTesting): (WebPushD::Daemon::notifyClientPushMessageIsAvailable): (WebPushD::Daemon::getPendingPushMessages): 2022-04-01 Chris Dumez REGRESSION(r292197): 3 TestWebKitAPI.ContentRuleList API tests are constant failures/timeout https://bugs.webkit.org/show_bug.cgi?id=238678 Unreviewed, in r292197, I made a last minute mistake when applying some of Darin's review comments. I converted a few calls to `NSURL.absoluteURL.fileSystemRepresentation` to `NSURL.absoluteString` instead of `NSURL.absoluteURL.path`. As a result, the file:// prefix was still present and some characters may still be URL-encoded. No new tests, covered by existing API tests failing on the bots. * UIProcess/API/Cocoa/WKContentRuleListStore.mm: (+[WKContentRuleListStore storeWithURL:]): (+[WKContentRuleListStore storeWithURLAndLegacyFilename:]): 2022-04-01 Zan Dobersek [Linux] Implement IPC::Semaphore https://bugs.webkit.org/show_bug.cgi?id=238596 Reviewed by Adrian Perez de Castro. Provide a Linux implementation for IPC::Semaphore that's based on eventfd mechanics. The IPC::Semaphore class now has a UNIX-specific file descriptor member variable. For Linux, this file descriptor is an eventfd with semaphore semantics (eventfd being Linux-specific). Signalling and waiting on such semaphore is done through the read() and write() functions. Non-Linux platforms are expected to provide something equivalent, if possible. For encoding and decoding that's necessary to move these semaphores across process boundaries, IPC::Attachment is used. For encoding the eventfd is simply duplicated and pushed into the Attachment, and for decoding the Attachment's file descriptor is taken and adopted by the Semaphore object. * Platform/IPC/IPCSemaphore.h: (IPC::Semaphore::operator bool const): * Platform/IPC/unix/IPCSemaphoreUnix.cpp: (IPC::Semaphore::Semaphore): (IPC::Semaphore::~Semaphore): (IPC::Semaphore::operator=): (IPC::Semaphore::signal): (IPC::waitImpl): (IPC::Semaphore::wait): (IPC::Semaphore::waitFor): (IPC::Semaphore::encode const): (IPC::Semaphore::decode): (IPC::Semaphore::destroy): 2022-04-01 Youenn Fablet ServiceWorkerRegistration.getNotifications should list all persistent notifications https://bugs.webkit.org/show_bug.cgi?id=238544 Reviewed by Darin Adler. Go from WebProcess to UIProcess to read the notification map through IPC messaging. Filter out the notifications according tag, origin and session. Sort the notifications according creationTime with UIProcess identifier as tie breaker. * UIProcess/Notifications/WebNotificationManagerProxy.cpp: * UIProcess/Notifications/WebNotificationManagerProxy.h: * UIProcess/WebProcessProxy.cpp: * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * UIProcess/WebsiteData/WebsiteDataStore.cpp: * WebProcess/Notifications/WebNotificationManager.cpp: * WebProcess/Storage/WebSWClientConnection.cpp: * WebProcess/Storage/WebSWClientConnection.h: 2022-04-01 Carlos Garcia Campos REGRESSION(r290360): [GLX] Crash on process exit https://bugs.webkit.org/show_bug.cgi?id=238494 Reviewed by Michael Catanzaro. * WebProcess/gtk/WaylandCompositorDisplay.cpp: (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay): 2022-04-01 Tim Horton Translated applications cannot use remote methods with BOOL arguments https://bugs.webkit.org/show_bug.cgi?id=238651 Reviewed by Geoffrey Garen. Propagate the fix from r261155 to WKRemoteObjectCoder's method-signature-equality test as well, so that BOOL arguments correctly compare as equal between a Rosetta application and its native ARM Web Content process. * Shared/API/Cocoa/WKRemoteObjectCoder.h: * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (WebKit::methodSignaturesAreCompatible): (decodeInvocation): Relax argument signature validation slightly, considering signed char and BOOL, which are equivalent and sometimes substituted for each other, to be equal. * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm: (-[_WKRemoteObjectRegistry _invokeMethod:]): (blockSignaturesAreCompatible): Deleted. 2022-04-01 Tim Horton Add a debug overlay for interaction regions https://bugs.webkit.org/show_bug.cgi?id=238187 Reviewed by Wenson Hsieh. * Shared/mac/MediaFormatReader/MediaFormatReader.cpp: Unified source fixes. * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Add plumbing for a new debug overlay. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::interactionRegions): (WebKit::WebPageProxy::interactableRegionsInRootViewCoordinates): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView interactionRegionsForHoverPlatter:inRect:completionHandler:]): (-[WKContentView interactableRegionsForHoverPlatter:inRect:completionHandler:]): Deleted. * UIProcess/ios/WKHoverPlatter.h: * UIProcess/ios/WKHoverPlatter.mm: (-[WKHoverPlatter updateDebugIndicator]): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::interactionRegions): Move interactionRegions() from WebPage to WebCore::InteractionRegion. (WebKit::WebPage::interactableRegionsInRootViewCoordinates): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: 2022-04-01 Youenn Fablet Persistent notifications should work in document scopes as well as service worker global scopes https://bugs.webkit.org/show_bug.cgi?id=238601 Reviewed by Brady Eidson. In case of notification message coming from a WebPage, check whether the notification is persistent or not. If persistent, go to ServiceWorkerNotificationHandler, otherwise use the current code path through WebPageProxy. * UIProcess/Notifications/ServiceWorkerNotificationHandler.h: * UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp: (WebKit::WebNotificationManagerMessageHandler::showNotification): (WebKit::WebNotificationManagerMessageHandler::cancelNotification): (WebKit::WebNotificationManagerMessageHandler::clearNotifications): (WebKit::WebNotificationManagerMessageHandler::didDestroyNotification): 2022-03-31 Wenson Hsieh Add a heuristic to identify and extract the prominent video element in element fullscreen https://bugs.webkit.org/show_bug.cgi?id=238579 Reviewed by Jer Noble. Add a heuristic to WebFullScreenManager that identifies and keeps track of the largest, rendered video element in element fullscreen mode (that is, the video element with the largest area that's inside of the subtree of the fullscreen container element). We couple this with a mechanism to detect when such a video has been paused for a short (250 ms) delay. These mechanisms will be used in a future patch to support "video extraction" in element fullscreen. See below for more details. * WebProcess/FullScreen/WebFullScreenManager.cpp: Turn WebFullScreenManager into an EventListener subclass, so that we can observe the "playing", "pause", and "seeking" events on the main video element (if it exists). See `handleEvent` below for more information. (WebKit::WebFullScreenManager::WebFullScreenManager): (WebKit::WebFullScreenManager::exitFullScreenForElement): Clear out the main video element upon exiting fullscreen. (WebKit::WebFullScreenManager::didEnterFullScreen): After we've finished entering element fullsreen, traverse the DOM in search of the largest video element (area- wise). If the container for element fullscreen is, itself, a video element, then automatically treat that element as the main video. (WebKit::WebFullScreenManager::mainVideoElementExtractionTimerFired): (WebKit::WebFullScreenManager::scheduleMainVideoElementExtraction): (WebKit::WebFullScreenManager::endMainVideoElementExtractionIfNeeded): For now, these are essentially no-ops; add FIXME's to call into WebPage to begin or cancel video extraction. These will be implemented in an upcoming patch, that connects this element fullscreen code to a more generic fullscreen video extraction mechanism implemented entirely in the client layer. (WebKit::WebFullScreenManager::setMainVideoElement): Add a helper method to set the main video element, adding or removing event listeners as needed. (WebKit::WebFullScreenManager::handleEvent): When observing any of the "playing", "pause", and "seeking" events, update the main video extraction timer; that is, if the main video element is paused, restart the timer; otherwise, stop it entirely. * WebProcess/FullScreen/WebFullScreenManager.h: 2022-03-31 Chris Dumez Prepare WebKit/ & WebKitLegacy/ for making the String(const char*) constructor explicit https://bugs.webkit.org/show_bug.cgi?id=238525 Reviewed by Darin Adler. * GPUProcess/graphics/RemoteGraphicsContextGL.cpp: (WebKit::RemoteGraphicsContextGL::workQueueInitialize): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::appendBoolean): (WebKit::ResourceLoadStatisticsDatabaseStore::getSubStatisticStatement const): (WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList const): (WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString const): * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: * NetworkProcess/NetworkConnectionToWebProcess.cpp: (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::deletePushAndNotificationRegistration): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::logCookieInformation const): (WebKit::logBlockedCookieInformation): (WebKit::logCookieInformationInternal): (WebKit::NetworkResourceLoader::logCookieInformation): * NetworkProcess/NetworkResourceLoader.h: * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp: (WebKit::PCM::Database::clearPrivateClickMeasurement): (WebKit::PCM::Database::addDestinationTokenColumnsIfNecessary): (WebKit::PCM::Database::columnsForTable): (WebKit::PCM::Database::addMissingColumnToTable): * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h: * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::getSignedUnlinkableTokenForDestination): (WebKit::PrivateClickMeasurementManager::handleAttribution): * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp: (WebKit::LocalStorageDatabaseTracker::databasePath const): * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h: * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: (WebKit::NetworkCache::BlobStorage::get): * NetworkProcess/cache/NetworkCacheData.cpp: (WebKit::NetworkCache::mapFile): * NetworkProcess/cache/NetworkCacheData.h: * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm: (WebKit::LaunchServicesDatabaseObserver::handleEvent): * NetworkProcess/storage/SQLiteStorageArea.cpp: (WebKit::SQLiteStorageArea::createTableIfNecessary): * Platform/IPC/JSIPCBinding.cpp: (IPC::jsValueForDecodedArgumentValue): * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: * Shared/API/Cocoa/WKRemoteObjectCoder.mm: (encodeObject): * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm: (-[_WKRemoteObjectRegistry _sendInvocation:interface:]): (replyBlockSignature): (-[_WKRemoteObjectRegistry _invokeMethod:]): * Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::stringByResolvingSymlinksInPath): (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension): (WebKit::resolvePathForSandboxExtension): (WebKit::SandboxExtension::createHandleWithoutResolvingPath): (WebKit::SandboxExtension::createHandle): (WebKit::SandboxExtension::createHandleForReadWriteDirectory): (WebKit::SandboxExtension::createHandleForTemporaryFile): (WebKit::SandboxExtension::createHandleForReadByAuditToken): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::getClientIdentifier): (WebKit::XPCServiceInitializerDelegate::getClientBundleIdentifier): (WebKit::XPCServiceInitializerDelegate::getClientProcessName): (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData): * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceMain): * Shared/IPCTester.cpp: (WebKit::messageTestDriver): * Shared/InspectorExtensionTypes.cpp: (Inspector::extensionErrorToString): * Shared/SandboxExtension.h: (WebKit::SandboxExtension::createHandle): (WebKit::SandboxExtension::createHandleWithoutResolvingPath): (WebKit::SandboxExtension::createHandleForReadWriteDirectory): (WebKit::SandboxExtension::createHandleForTemporaryFile): (WebKit::stringByResolvingSymlinksInPath): (WebKit::resolvePathForSandboxExtension): (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension): * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::sandboxDataVaultParentDirectory): (WebKit::getUserDirectorySuffix): (WebKit::populateSandboxInitializationParameters): * Shared/mac/WebEventFactory.mm: (WebKit::WebEventFactory::createWebKeyboardEvent): * UIProcess/API/APIContentRuleListStore.cpp: (API::openAndMapContentRuleList): * UIProcess/API/C/WKDownloadRef.cpp: (WKDownloadSetClient): * UIProcess/API/C/WKPage.cpp: (WKPageGetSessionHistoryURLValueType): (WKPageGetSessionBackForwardListItemValueType): (WKPageSetPageUIClient): * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesCreate): (WKPreferencesCreateWithIdentifier): * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm: (API::ContentRuleListStore::defaultStorePath): * UIProcess/API/Cocoa/WKContentRuleListStore.mm: (+[WKContentRuleListStore storeWithURL:]): (+[WKContentRuleListStore storeWithURLAndLegacyFilename:]): * UIProcess/API/Cocoa/WKPreferences.mm: (-[WKPreferences init]): * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::getLaunchOptions): * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm: (WebKit::SubFrameSOAuthorizationSession::loadRequestToFrame): * UIProcess/Cocoa/WebKitSwiftSoftLink.mm: (WebKit::WebKitSwiftLibrary): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions): * UIProcess/Cocoa/WebViewImpl.mm: (-[WKTextTouchBarItemController _wkChangeTextStyle:]): (-[WKTextTouchBarItemController _wkChangeTextAlignment:]): (-[WKTextTouchBarItemController _wkChangeColor:]): (WebKit::WebViewImpl::insertText): * UIProcess/DeviceIdHashSaltStorage.cpp: (WebKit::getSecurityOriginData): (WebKit::DeviceIdHashSaltStorage::getDataFromDecoder const): (WebKit::DeviceIdHashSaltStorage::createEncoderFromData const): * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Network/NetworkProcessProxyCocoa.mm: (WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const): * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest): * UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::SnapshotRemovalTracker::log const): (WebKit::ViewGestureController::SnapshotRemovalTracker::reset): (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent): (WebKit::ViewGestureController::SnapshotRemovalTracker::eventOccurred): (WebKit::ViewGestureController::SnapshotRemovalTracker::cancelOutstandingEvent): (WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackIfPossible): (WebKit::stopWaitingForEvent): Deleted. * UIProcess/ViewGestureController.h: * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm: * UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorUtils.mm: (WebKit::base64PrivateKey): * UIProcess/WebAuthentication/Virtual/VirtualHidConnection.cpp: (WebKit::VirtualHidConnection::parseRequest): * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest): * UIProcess/WebPageGroup.cpp: (WebKit::WebPageGroup::WebPageGroup): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::createRealtimeMediaSourceForSpeechRecognition): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::didReceiveInvalidMessage): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed): (WebKit::WebProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished): (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished): (WebKit::WebProcessProxy::createSpeechRecognitionServer): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::defaultApplicationCacheDirectory): (WebKit::WebsiteDataStore::defaultCacheStorageDirectory): (WebKit::WebsiteDataStore::defaultGeneralStorageDirectory): (WebKit::WebsiteDataStore::defaultNetworkCacheDirectory): (WebKit::WebsiteDataStore::defaultAlternativeServicesDirectory): (WebKit::WebsiteDataStore::defaultMediaCacheDirectory): (WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory): (WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): (WebKit::WebsiteDataStore::defaultLocalStorageDirectory): (WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory): (WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory): (WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory): (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): (WebKit::WebsiteDataStore::defaultJavaScriptConfigurationDirectory): (WebKit::WebsiteDataStore::defaultModelElementCacheDirectory): (WebKit::WebsiteDataStore::tempDirectoryFileSystemRepresentation): (WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation): (WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::fetchDataAndApply): * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::formatNameFromWebRTCCodecType): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageSetComposition): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::increaseBufferedAmount): * WebProcess/Network/WebSocketStream.cpp: (WebKit::WebSocketStream::networkProcessCrashed): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel): (WebKit::PDFPlugin::threadEntry): (WebKit::PDFPlugin::adoptBackgroundThreadDocument): (WebKit::PDFPlugin::pluginInfo): (WebKit::PDFPlugin::addArchiveResource): (WebKit::PDFPlugin::setSuggestedFilename): (WebKit::PDFPlugin::initialize): * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: (WebKit::cssAlignmentValueForNSTextAlignment): * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::loadURL): * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp: (WebKit::WebAuthenticatorCoordinator::makeCredential): (WebKit::WebAuthenticatorCoordinator::getAssertion): * WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp: (WebKit::WebFileSystemStorageConnection::isSameEntry): (WebKit::WebFileSystemStorageConnection::getFileHandle): (WebKit::WebFileSystemStorageConnection::getDirectoryHandle): (WebKit::WebFileSystemStorageConnection::removeEntry): (WebKit::WebFileSystemStorageConnection::resolve): (WebKit::WebFileSystemStorageConnection::getFile): (WebKit::WebFileSystemStorageConnection::createSyncAccessHandle): (WebKit::WebFileSystemStorageConnection::closeSyncAccessHandle): (WebKit::WebFileSystemStorageConnection::getHandleNames): (WebKit::WebFileSystemStorageConnection::getHandle): (WebKit::WebFileSystemStorageConnection::move): * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp: (WebKit::WebSpeechSynthesisClient::speak): * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: (WebKit::changeWordCase): * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::JSMessageListener::jsDescriptionFromDecoder): (IPC::jsValueForDecodedArgumentValue): * WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::layerTreeAsText const): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::transientZoomSnapAnimationForKeyPath): (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom): * WebProcess/cocoa/LaunchServicesDatabaseManager.mm: (WebKit::LaunchServicesDatabaseManager::handleEvent): * webpushd/AppBundleRequest.mm: (WebPushD::AppBundleDeletionRequest::didDeleteExistingBundleWithError): * webpushd/PushClientConnection.h: * webpushd/PushClientConnection.mm: (WebPushD::ClientConnection::broadcastDebugMessage): (WebPushD::ClientConnection::sendDebugMessage): * webpushd/WebPushDaemon.h: * webpushd/WebPushDaemon.mm: (WebPushD::Daemon::broadcastDebugMessage): (WebPushD::Daemon::deletePushAndNotificationRegistration): * webpushd/WebPushDaemonMain.mm: (WebKit::WebPushDaemonMain): 2022-03-31 Jean-Yves Avenard Player window shouldn't have black bar when going into fullscreen https://bugs.webkit.org/show_bug.cgi?id=238592 rdar://91085981 Reviewed by Tim Horton. Set the window size to the video element size when going fullscreen and restore the original window size when coming out of it. Manually tested. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]): 2022-03-31 Chris Dumez Adopt Identifier::fromString(ASCIILiteral) more broadly https://bugs.webkit.org/show_bug.cgi?id=238574 Reviewed by Darin Adler. Adopt Identifier::fromString(ASCIILiteral) more broadly, now that it is very efficient. * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::jsResultFromReplyDecoder): (WebKit::IPCTestingAPI::createJSArrayForArgumentDescriptions): (WebKit::IPCTestingAPI::JSIPC::messages): (WebKit::IPCTestingAPI::JSMessageListener::jsDescriptionFromDecoder): (WebKit::IPCTestingAPI::inject): 2022-03-31 Said Abou-Hallawa [GPU Process] [iOS] Text decoration is always drawn with solid stroke style https://bugs.webkit.org/show_bug.cgi?id=236909 rdar://89196615 Reviewed by Simon Fraser. * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp: (WebKit::RemoteDisplayListRecorderProxy::recordDrawLinesForText): * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h: 2022-03-31 Commit Queue Unreviewed, reverting r292183. https://bugs.webkit.org/show_bug.cgi?id=238639 Broke the Big Sur build Reverted changeset: "[XCBuild] WebKitLegacy's "Migrated headers" script does not emit task information" https://bugs.webkit.org/show_bug.cgi?id=238409 https://commits.webkit.org/r292183 2022-03-31 Commit Queue Unreviewed, reverting r292119. https://bugs.webkit.org/show_bug.cgi?id=238638 New API test is flaky Reverted changeset: "Avoid initializing default WKWebsiteDataStore in -[WKWebViewConfiguration copyWithZone]" https://bugs.webkit.org/show_bug.cgi?id=238531 https://commits.webkit.org/r292119 2022-03-31 Wenson Hsieh [iOS] Add support for temporarily installing VKCImageAnalysisInteraction on WKContentView https://bugs.webkit.org/show_bug.cgi?id=238582 Reviewed by Tim Horton. Add helper methods for temporarily creating and installing an image analysis interaction on the root view. See below for more details. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView hasSelectablePositionAtPoint:]): (-[WKContentView pointIsNearMarkedText:]): (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): If Live Text exists at the given location, suppress default WebKit text selection behaviors in favor of Live Text instead. (-[WKContentView _singleTapRecognized:]): Since we only allow the image analysis interaction to begin when interacting directly with regions of the content view that contain Live Text, we need to (manually) clear the native text selection here when handling a tap over other parts of the web view that are not covered by Live Text. (-[WKContentView _didCommitLoadForMainFrame]): Uninstall the interaction when loading a new page. (-[WKContentView gestureRecognizer:shouldIgnoreWebTouchWithEvent:]): (-[WKContentView deferringGestureRecognizer:willBeginTouchesWithEvent:]): Don't allow touch events to even begin, if the gesture starts over a region of Live Text. (-[WKContentView _tearDownImageAnalysis]): Uninstall the interaction when the web process terminates or swaps. (-[WKContentView installImageAnalysisInteraction:]): (-[WKContentView uninstallImageAnalysisInteraction]): These are the two main helper methods for adding or removing the image analysis interaction. (-[WKContentView contentsRectForImageAnalysisInteraction:]): (-[WKContentView imageAnalysisInteraction:shouldBeginAtPoint:forAnalysisType:]): Only allow Live Text interaction gestures to begin if there's interactable content at the given location. The only reason why this isn't default behavior already is that the image analysis interaction handles taps that happen outside of Live Text by clearing any active selection; to ensure that this continues to work, we handle the tap ourselves, and clear the native selection directly (see `-_singleTapRecognized:` above). 2022-03-31 Elliott Williams [XCBuild] WebKitLegacy's "Migrated headers" script does not emit task information https://bugs.webkit.org/show_bug.cgi?id=238409 Reviewed by Alexey Proskuryakov. * WebKit.xcodeproj/project.pbxproj: Small build rule fix to prevent "no rule to process file" warnings on every generated forwarding header. This happened because the build rule that generates these temporary forwarding headers looked like it was supposed to _process_ those headers, too. 2022-03-31 Alex Christensen null check page in API::DataTask constructor https://bugs.webkit.org/show_bug.cgi?id=238632 Reviewed by Tim Horton. If the page is deallocated between the request to make a data task and the completion providing the data task to the API client, we don't want to crash. * UIProcess/API/APIDataTask.cpp: (API::DataTask::cancel): (API::DataTask::DataTask): (API::m_sessionID): * UIProcess/API/APIDataTask.h: 2022-03-31 Alex Christensen Expand adattributiond sandbox slightly to avoid sandbox crashes https://bugs.webkit.org/show_bug.cgi?id=238609 Reviewed by Per Arne Vollan. * Resources/SandboxProfiles/ios/com.apple.WebKit.adattributiond.sb.in: 2022-03-31 Fujii Hironori [WinCairo][WK2] fast/events/wheel/wheelevent-basic.html is timing out https://bugs.webkit.org/show_bug.cgi?id=238590 Reviewed by Don Olmstead. This issue happened only if SPI_GETWHEELSCROLLLINES was less than 3. If I changed "Choose how many lines to scroll each time" to 1 or 2 in Windows Settings, this test passed. * Shared/win/WebEventFactory.cpp: (WebKit::WebEventFactory::createWebWheelEvent): Changed local variables to float not to truncate the wheel delta. 2022-03-31 Brent Fulgham Add a placeholder for some additional Captive Portal mode settings https://bugs.webkit.org/show_bug.cgi?id=238573 Reviewed by Wenson Hsieh. SSIA. * WebProcess/WebPage/WebPage.cpp: (WebKit::adjustSettingsForCaptivePortal): Call new placeholder helper function. 2022-03-31 Ben Nham Remove push subscriptions when permissions are reset https://bugs.webkit.org/show_bug.cgi?id=238068 Reviewed by Youenn Fablet. When the notification permission for an origin is reset (i.e. is in the prompt state), we should delete any push subscriptions associated with that origin. We do this by having the providerDidRemoveNotificationPolicies API call deletePushAndNotificationRegistration in webpushd. We also do this when processing a push message, since it's possible for the state to get out of sync due to the number of processes involved. For instance, removing the policy from System Preferences rather than the browser's notification preference pane can result in the providerDidRemoveNotificationPolicies call in the browser to be delayed or dropped. Note that we don't delete the subscription if the permission is simply toggled off (i.e. the permission is in the Denied state). In that case, the user can easily toggle the permission back on. We want the subscription object to stay the same after the preference is toggled back on so that the server can still send pushes to that push endpoint. In a future patch we'll add subscriptions in this state to the ignored topics list in webpushd, which will prevent pushes for those subscriptions from being delivered to the device without actually unsubscribing. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::processPushMessage): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::processPushMessage): * UIProcess/Notifications/WebNotificationManagerProxy.cpp: (WebKit::removePushSubscriptionsForOrigins): (WebKit::WebNotificationManagerProxy::providerDidRemoveNotificationPolicies): * webpushd/WebPushDaemon.mm: (WebPushD::Daemon::deletePushAndNotificationRegistration): 2022-03-31 Alex Christensen Remove EXPERIMENTAL_FEATURES flag on Cocoa platforms https://bugs.webkit.org/show_bug.cgi?id=238565 Reviewed by Darin Adler. * Configurations/BaseTarget.xcconfig: 2022-03-31 Zan Dobersek [GTK][WPE][GPUProcess] Switch GPUProcessGStreamer.cpp, GPUProcessMainGStreamer.cpp to the GLib flavor https://bugs.webkit.org/show_bug.cgi?id=238597 Reviewed by Adrian Perez de Castro. Move the GStreamer implementations for the platform-specific GPUProcess methods and entrypoint into GLib-flavored files. This fits better the purpose of the GPUProcess since it's been extended beyond just media playback. Instead of USE(GSTREAMER), the code in these files is now guarded by (PLATFORM(GTK) || PLATFORM(WPE)), the two ports depending on the GLib library. The GPUProcessMain entrypoint, since it's unconditionally exported in the library, is now also unconditionally defined, but with the internal implementation launching the GPUProcess logic if ENABLE(GPU_PROCESS) is enabled and simply returning 0 otherwise. * GPUProcess/glib/GPUProcessGLib.cpp: Renamed from Source/WebKit/GPUProcess/gstreamer/GPUProcessGStreamer.cpp. (WebKit::GPUProcess::initializeProcess): (WebKit::GPUProcess::initializeProcessName): (WebKit::GPUProcess::initializeSandbox): * GPUProcess/glib/GPUProcessMainGLib.cpp: Renamed from Source/WebKit/GPUProcess/gstreamer/GPUProcessMainGStreamer.cpp. (WebKit::GPUProcessMain): * SourcesGTK.txt: * SourcesWPE.txt: * webkitglib-symbols.map: 2022-03-31 Ben Nham Fix null string crashes in PushService https://bugs.webkit.org/show_bug.cgi?id=238585 Reviewed by Darin Adler. We've seen a few webpushd crashes due to some PushService routines being passed null string arguments. Guard against this with isEmpty checks. This also shouldn't be possible--we shouldn't be sending these requests to webpushd in the first place. Add some logs to help us catch what's going on. * webpushd/PushService.mm: (WebPushD::PushService::getSubscription): (WebPushD::PushService::subscribe): (WebPushD::PushService::unsubscribe): (WebPushD::PushService::incrementSilentPushCount): (WebPushD::PushService::removeRecordsImpl): 2022-03-31 Diego Pino Garcia [WPE] Unreviewed, fix non-unified build after r290343 * Platform/IPC/ArgumentCoder.h: 2022-03-31 Zan Dobersek [GTK][WPE] Make ENABLE(GPU_PROCESS) code buildable https://bugs.webkit.org/show_bug.cgi?id=238595 Reviewed by Adrian Perez de Castro. * GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::setCaptureAttributionString): Adjust the setCaptureAttributionString() method definition for non-Cocoa platforms. * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.h: * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.messages.in: Guard the RemoteAudioMediaStreamTrackRendererInternalUnitManager class with PLATFORM(COCOA) since all its uses are guarded the same way, and the implementation unconditionally uses Cocoa-specific classes from WebCore. The class can be refactored later if it ends up required for any other platform. 2022-03-31 Per Arne Vollan Add runtime flag for blocking IOKit resources in the WebContent process' sandbox https://bugs.webkit.org/show_bug.cgi?id=238528 Reviewed by Simon Fraser. This flag will trigger a set of sandbox rules in the WebContent process which will block graphics related IOKit classes and the Metal compiler service. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * WebProcess/WebPage/WebPage.cpp: 2022-03-30 Simon Fraser Crash the WebContent process if the RemoteRenderingBackend::PrepareBuffersForDisplay IPC fails https://bugs.webkit.org/show_bug.cgi?id=238569 Reviewed by Kimmo Kinnunen. We can't sensibly recover from RemoteRenderingBackend::PrepareBuffersForDisplay IPC failing, which can happen when the GPU process crashes, so just crash the WebContent process. * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::prepareBuffersForDisplay): 2022-03-30 Sihui Liu Regression: WebsiteDataStore fails to read experimental feature values from NSUserDefaults https://bugs.webkit.org/show_bug.cgi?id=238486 Reviewed by Alex Christensen. From rdar://46352542, Safari no longer uses "Experimental" as prefix for experimental features. * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::internalFeatureEnabled): (WebKit::experimentalFeatureEnabled): (WebKit::WebsiteDataStore::thirdPartyCookieBlockingMode const): (WebKit::WebsiteDataStore::platformSetNetworkParameters): 2022-03-30 Kate Cheney Migrate manifest version content security policy filtering for extensions into WebKit https://bugs.webkit.org/show_bug.cgi?id=238230 Reviewed by Timothy Hatcher. Add an SPI for Safari to specify when we are loading a WebView for an extension, and which manifest version the extension has. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: * UIProcess/API/APIPageConfiguration.cpp: (API::PageConfiguration::copy const): * UIProcess/API/APIPageConfiguration.h: (API::PageConfiguration::setContentSecurityPolicyModeForExtension): (API::PageConfiguration::contentSecurityPolicyModeForExtension const): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration _setContentSecurityPolicyModeForExtension:]): (-[WKWebViewConfiguration _contentSecurityPolicyModeForExtension]): * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: * UIProcess/Cocoa/CSPExtensionUtilities.h: Added. * UIProcess/Cocoa/CSPExtensionUtilities.mm: Added. (WebKit::toWKContentSecurityPolicyModeForExtension): (WebKit::toContentSecurityPolicyModeForExtension): * UIProcess/Cocoa/WebProcessProxyCocoa.mm: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: 2022-03-30 Chris Dumez Use dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM) in setOSTransaction() https://bugs.webkit.org/show_bug.cgi?id=238559 Reviewed by Darin Adler. Use dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM) in setOSTransaction() instead of a low-level signal(SIGTERM) handler, as recommended by the XPC team. This is better becomes it has less limitations about what you can do in the handler. It is also possible to set several handlers this way, in different parts of the code (i.e. also not worry about some other code overriding our handler). * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm: (WebKit::setOSTransaction): 2022-03-30 Sihui Liu Remove -[WKWebsiteDataStore _indexedDBDatabaseDirectory] https://bugs.webkit.org/show_bug.cgi?id=238487 Reviewed by Alex Christensen. This is not used by SPI clients, and we have -[_WKWebsiteDataStoreConfiguration _indexedDBDatabaseDirectory]. * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _indexedDBDatabaseDirectory]): Deleted. * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: 2022-03-30 Devin Rousso Web Inspector: Sources: the mapped file URL of a Response Local Override should be clickable https://bugs.webkit.org/show_bug.cgi?id=238533 Reviewed by Patrick Angle. * WebProcess/Inspector/RemoteWebInspectorUI.h: * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::revealFileExternally): Added. * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::revealFileExternally): Added. * UIProcess/Inspector/WebInspectorUIProxy.messages.in: * UIProcess/Inspector/WebInspectorUIProxy.h: * UIProcess/Inspector/WebInspectorUIProxy.cpp: (WebKit::WebInspectorUIProxy::revealFileExternally): Added. (WebKit::WebInspectorUIProxy::platformRevealFileExternally): Added. * UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.mm: (WebKit::WebInspectorUIProxy::platformRevealFileExternally): Added. * UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm: (WebKit::WebInspectorUIProxy::platformRevealFileExternally): Added. * UIProcess/Inspector/win/WebInspectorUIProxyWin.mm: (WebKit::WebInspectorUIProxy::platformRevealFileExternally): Added. * UIProcess/Inspector/RemoteWebInspectorUIProxy.messages.in: * UIProcess/Inspector/RemoteWebInspectorUIProxy.h: * UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp: (WebKit::RemoteWebInspectorUIProxy::revealFileExternally): Added. (WebKit::RemoteWebInspectorUIProxy::platformRevealFileExternally): Added. * UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp: (WebKit::RemoteWebInspectorUIProxy::platformRevealFileExternally): Added. * UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm: (WebKit::RemoteWebInspectorUIProxy::platformRevealFileExternally): Added. * UIProcess/Inspector/win/RemoteWebInspectorUIProxyWin.cpp: (WebKit::RemoteWebInspectorUIProxy::platformRevealFileExternally): Added. Add a helper for selecting a file in the system file explorer. 2022-03-30 Sihui Liu Avoid initializing default WKWebsiteDataStore in -[WKWebViewConfiguration copyWithZone] https://bugs.webkit.org/show_bug.cgi?id=238531 rdar://90628101 Reviewed by Tim Horton. API test: WKWebsiteDataStore.DoNotCreateDefaultDataStore * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _initializeWithConfiguration:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: (-[WKWebViewConfiguration copyWithZone:]): 2022-03-30 Youenn Fablet Implement persistent notification handling https://bugs.webkit.org/show_bug.cgi?id=238498 Reviewed by Brady Eidson. When receiving an update for a notification, check if the notification is tied to a service worker registration. If so, go to network process to fire a functional event, as per https://notifications.spec.whatwg.org/#activating-a-notification and https://notifications.spec.whatwg.org/#ref-for-fire-a-service-worker-notification-eventâ‘  UIProcess sends the corresponding NotficationData to NetworkProcess. NetworkProcess gets the service worker registration, runs the service worker as needed and fires the functional event. Add IPC plumbing code to support this flow. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::processNotificationEvent): (WebKit::NetworkProcess::processPushMessage): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::firePushEvent): (WebKit::WebSWServerToContextConnection::fireNotificationEvent): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::processNotificationEvent): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Notifications/WebNotification.cpp: (WebKit::WebNotification::WebNotification): * UIProcess/Notifications/WebNotification.h: (WebKit::WebNotification::title const): (WebKit::WebNotification::body const): (WebKit::WebNotification::iconURL const): (WebKit::WebNotification::tag const): (WebKit::WebNotification::lang const): (WebKit::WebNotification::dir const): (WebKit::WebNotification::coreNotificationID const): (WebKit::WebNotification::sessionID const): (WebKit::WebNotification::data const): (WebKit::WebNotification::isPersistentNotification const): (WebKit::WebNotification::notificationID const): * UIProcess/Notifications/WebNotificationManagerProxy.cpp: (WebKit::dispatchDidClickNotification): (WebKit::WebNotificationManagerProxy::providerDidCloseNotifications): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::fireNotificationEvent): * WebProcess/Storage/WebSWContextManagerConnection.h: * WebProcess/Storage/WebSWContextManagerConnection.messages.in: 2022-03-30 Chris Dumez Add HashTranslator for ASCIILiteral for faster lookup in HashMaps / HashSets https://bugs.webkit.org/show_bug.cgi?id=238521 Reviewed by Geoffrey Garen. Add HashTranslator for ASCIILiteral for faster lookup in HashMaps / HashSets using an ASCIILiteral, without the need for allocating a String. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::getUserDirectorySuffix): * UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::getLaunchOptions): * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::ProcessLauncher::launchProcess): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getLaunchOptions): * UIProcess/glib/WebProcessProxyGLib.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeProcess): 2022-03-30 Youenn Fablet Implement ServiceWorker WindowClient.ancestorOrigins https://bugs.webkit.org/show_bug.cgi?id=238441 Reviewed by Chris Dumez. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::controlClient): 2022-03-30 Kimmo Kinnunen Move AuxiliaryProcess::createIPCConnectionPair to IPC::Connection https://bugs.webkit.org/show_bug.cgi?id=238504 Reviewed by Chris Dumez. Move connection port/socket/pipe pair creation function from AuxiliaryProcess to IPC::Connection. This way other components than AuxiliaryProcess subclasses can create and send new connections. No new tests, refactor. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::createGPUConnectionToWebProcess): * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): * Platform/IPC/Connection.cpp: (IPC::Connection::createConnectionIdentifierPair): * Platform/IPC/Connection.h: * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::Connection::createConnectionIdentifierPair): * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::Connection::createConnectionIdentifierPair): * Platform/IPC/win/ConnectionWin.cpp: (IPC::Connection::createConnectionIdentifierPair): * Shared/AuxiliaryProcess.cpp: * Shared/AuxiliaryProcess.h: * WebAuthnProcess/WebAuthnProcess.cpp: (WebKit::WebAuthnProcess::createWebAuthnConnectionToWebProcess): * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::updateConnection): 2022-03-30 Pablo Saavedra [GTK][WPE] Exit cleanly if Connection to UIProcess severed. Regression (r214307) https://bugs.webkit.org/show_bug.cgi?id=235224 This patch reverts the WPE and GTK specific code removed in '[WK2] Make establishing a connection between the WebProcess and the Network process more robust' (r12345): GTK+ and WPE ports don't exit on send sync message failure. In those particular cases, the network process can be terminated by the UI process while the Web process is still initializing, so we always want to exit instead of crashing. This can happen when the WebView is created and then destroyed quickly. See https://bugs.webkit.org/show_bug.cgi?id=183348. Reviewed by Carlos Garcia Campos. * WebProcess/WebProcess.cpp: (WebKit::getNetworkProcessConnection): (WebKit::WebProcess::getGPUProcessConnection): (WebKit::getWebAuthnProcessConnection): 2022-03-30 Jean-Yves Avenard Window is too small after entering and exiting video/element fullscreen https://bugs.webkit.org/show_bug.cgi?id=238488 rdar://89363964 Reviewed by Tim Horton. Don't change the size of the window to the size of the element. * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): 2022-03-29 Devin Rousso Web Inspector: Sources: allow Response Local Overrides to map to a file on disk https://bugs.webkit.org/show_bug.cgi?id=238236 Reviewed by Patrick Angle. This makes Response Local Overrides even more powerful by allowing developers to map the contents of the (Local Override) resource to a file on disk (e.g. a local copy of the file), meaning that they can use their preferred editor of choice (and all the tools that may come with it) to make changes instead of having to stay within Web Inspector. * WebProcess/Inspector/WebInspectorUI.h: * WebProcess/Inspector/WebInspectorUI.cpp: (WebKit::WebInspectorUI::load): Added. (WebKit::WebInspectorUI::canLoad): Added. * WebProcess/Inspector/gtk/WebInspectorUIGtk.cpp: (WebKit::WebInspectorUI::canLoad): Added. * WebProcess/Inspector/mac/WebInspectorUIMac.mm: (WebKit::WebInspectorUI::canLoad): Added. * WebProcess/Inspector/win/WebInspectorUIWin.cpp: (WebKit::WebInspectorUI::canLoad): Added. * WebProcess/Inspector/RemoteWebInspectorUI.h: * WebProcess/Inspector/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::load): Added. * UIProcess/Inspector/WebInspectorUIProxy.messages.in: * UIProcess/Inspector/WebInspectorUIProxy.h: * UIProcess/Inspector/WebInspectorUIProxy.cpp: (WebKit::WebInspectorUIProxy::load): Added. (WebKit::WebInspectorUIProxy::platformLoad): Added. * UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp: (WebKit::WebInspectorUIProxy::platformLoad): Added. * UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm: (WebKit::WebInspectorUIProxy::platformLoad): Added. * UIProcess/Inspector/win/WebInspectorUIProxyWin.cpp: (WebKit::WebInspectorUIProxy::platformLoad): Added. * UIProcess/Inspector/RemoteWebInspectorUIProxy.messages.in: * UIProcess/Inspector/RemoteWebInspectorUIProxy.h: * UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp: (WebKit::RemoteWebInspectorUIProxy::initialize): Renamed from `load`. (WebKit::RemoteWebInspectorUIProxy::reopen): (WebKit::RemoteWebInspectorUIProxy::load): Added. (WebKit::RemoteWebInspectorUIProxy::platformLoad): Added. * UIProcess/Inspector/gtk/RemoteWebInspectorUIProxyGtk.cpp: (WebKit::RemoteWebInspectorUIProxy::platformLoad): Added. * UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm: (WebKit::RemoteWebInspectorUIProxy::platformLoad): Added. * UIProcess/Inspector/win/RemoteWebInspectorUIProxyWin.cpp: (WebKit::RemoteWebInspectorUIProxy::platformLoad): Added. Add helpers for loading the contents of a file on disk. * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (-[_WKRemoteWebInspectorViewController loadForDebuggable:backendCommandsURL:]): * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorProxy::initialize): Renamed from `load`. (WebKit::RemoteInspectorClient::inspect): * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorProxy::initialize): Renamed from `load`. (WebKit::RemoteInspectorClient::inspect): Use renamed `WebKit::RemoteWebInspectorUIProxy::initialize`. 2022-03-29 Jigen Zhou [Playstation] Fix build break after r292041 when ENABLE_SERVICE_WORKER is off https://bugs.webkit.org/show_bug.cgi?id=238520 Reviewed by Darin Adler. Unreviewed build fix after r292041 / r291979 for Playsation platform builds. * UIProcess/WebsiteData/WebsiteDataStore.cpp: 2022-03-29 Alex Christensen Don't create directories on iOS if we are only using ephemeral storages https://bugs.webkit.org/show_bug.cgi?id=238402 Reviewed by Chris Dumez. Since we have been giving access to those directories as long as WebKit2 has been on iOS, this is a conservative change to only give access to the directories when using persistent storage. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::addWebsiteDataStore): * NetworkProcess/NetworkProcessCreationParameters.cpp: (WebKit::NetworkProcessCreationParameters::encode const): (WebKit::NetworkProcessCreationParameters::decode): * NetworkProcess/NetworkProcessCreationParameters.h: * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): * Shared/WebsiteDataStoreParameters.cpp: (WebKit::WebsiteDataStoreParameters::encode const): (WebKit::WebsiteDataStoreParameters::decode): * Shared/WebsiteDataStoreParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions): (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): 2022-03-29 Alex Christensen Navigation Timing data is corrupt in WebView (UIWebView/WKWebView) https://bugs.webkit.org/show_bug.cgi?id=186919 Reviewed by Simon Fraser. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): 2022-03-29 C Lopez Add Captive Portal alert to WKWebView https://bugs.webkit.org/show_bug.cgi?id=238326 Reviewed by Geoffrey Garen and Brent Fulgham When WkWebView on iOS is initialized, we call `_presentCaptivePortalModeAlertIfNeeded` which checks whether an alert needs to be presented or not. * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _presentCaptivePortalModeAlertIfNeeded]): (-[WKWebView didMoveToWindow]): 2022-03-29 Don Olmstead [LibWPE] Guard libxkbcommon code with WPE_ENABLE_XKB https://bugs.webkit.org/show_bug.cgi?id=238510 Reviewed by Adrian Perez de Castro. Guard libwpe xkb code with WPE_ENABLE_XKB. * UIProcess/Automation/libwpe/WebAutomationSessionLibWPE.cpp: (WebKit::doKeyStrokeEvent): 2022-03-29 Sihui Liu Unreviewed test fix after r292024. https://bugs.webkit.org/show_bug.cgi?id=238082 Correcting an if condition. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::processDidResume): 2022-03-29 Eric Carlson [macOS] Muted video is sometimes paused when entering fullscreen https://bugs.webkit.org/show_bug.cgi?id=238462 rdar://89104216 Reviewed by Jer Noble. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::setPageIsVisible): Track visibility and do nothing when it doesn't change. (WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio): Ditto for aspect ratio. * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 2022-03-29 Eric Carlson Don't send sync RemoteMediaPlayerProxy messages that we know will fail https://bugs.webkit.org/show_bug.cgi?id=238467 rdar://86662565 Reviewed by Jer Noble. * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::videoFrameForCurrentTime): Return early if readyState is less than HaveCurrentData, or if the first frame is not available. * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: (WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime): Ditto. (WebKit::MediaPlayerPrivateRemote::colorSpace): Ditto. 2022-03-29 Devin Rousso Unreviewed, fix UAF after r291980 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Expose `OverrideViewportSize` so that we can copy those members specifically instead of having to keep alive the old `FrameView` when transitioning to a new page. 2022-03-29 Jigen Zhou [Playstation] Fix build break after r291979 if ENABLE_SERVICE_WORKER is off https://bugs.webkit.org/show_bug.cgi?id=238471 Reviewed by Don Olmstead. Build fix for playstation platform after r291979 to support ServiceWorkerClients.openWindow. This patch resolves compiling errors occurs in WebPageProxy::callLoadCompletionHandlersIfNecessary if ENABLE_SERVICE_WORKER is off. * UIProcess/WebPageProxy.cpp: 2022-03-29 Patrick Angle Web Inspector: [Cocoa] Indicate a request was sent through proxy/private relay in Network tab https://bugs.webkit.org/show_bug.cgi?id=233202 Reviewed by Devin Rousso. Add plumbing for the new `isProxyConnection` network metric. * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): 2022-03-28 Simon Fraser [iOS GPUProcess] Image decoding should not trigger IOSurface usage in the web process https://bugs.webkit.org/show_bug.cgi?id=238489 Reviewed by Per Arne Vollan. When useGPUProcessForDOMRendering is true, disable hardware image decoding since we need to avoid IOSurface access in the web process. * WebProcess/WebProcess.cpp: (WebKit::WebProcess::setUseGPUProcessForDOMRendering): 2022-03-29 Don Olmstead Share WebAutomationSession among USE(LIBWPE) ports https://bugs.webkit.org/show_bug.cgi?id=238470 Reviewed by Adrian Perez de Castro. Rename WebAutomationSessionWPE.cpp to WebAutomationSessionLibWPE since its just using the libWPE API. Remove glib specific code in WebAutomationSession::platformSimulateKeySequence to use a StringView::codePoints. The same code was in GTK so replace that as well. * SourcesWPE.txt: * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: (WebKit::WebAutomationSession::platformSimulateKeySequence): * UIProcess/Automation/libwpe/WebAutomationSessionLibWPE.cpp: Renamed from Source/WebKit/UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp. (WebKit::WebAutomationSession::platformSimulateKeySequence): 2022-03-29 Youenn Fablet RealtimeMediaSource::Type::Video is misleading as it is actually referring to camera sources https://bugs.webkit.org/show_bug.cgi?id=238449 Reviewed by Eric Carlson. * Shared/WebCoreArgumentCoders.h: * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy): * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: (WebKit::toSourceType): 2022-03-28 Sihui Liu Add logging about process entering background to NetworkProcess::processDidResume https://bugs.webkit.org/show_bug.cgi?id=238082 Reviewed by Chris Dumez. In rdar://82412733, we found network process can be suspended right after it receives processDidResume message. For network process, processDidResume means process is not suspended and it is safe to perform database operations. Let's add logging to check when and why processDidResume message is sent. If the logging confirms that processDidResume message can be received when process is close to assertion timeout, we probably want to ignore such message and resume database operations when application actually enters foreground. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::prepareToSuspend): (WebKit::NetworkProcess::applicationDidEnterBackground): (WebKit::NetworkProcess::applicationWillEnterForeground): (WebKit::NetworkProcess::processDidResume): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/ios/NetworkProcessIOS.mm: * UIProcess/API/Cocoa/WKWebViewTesting.mm: (-[WKWebView _processDidResumeForTesting]): * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: (WebKit::DownloadProxyMap::platformCreate): (WebKit::DownloadProxyMap::platformDestroy): * UIProcess/Downloads/DownloadProxyMap.cpp: (WebKit::DownloadProxyMap::applicationDidEnterBackground): Deleted. (WebKit::DownloadProxyMap::applicationWillEnterForeground): Deleted. * UIProcess/Downloads/DownloadProxyMap.h: (WebKit::DownloadProxyMap::isEmpty const): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::sendProcessDidResume): * UIProcess/GPU/GPUProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::NetworkProcessProxy): (WebKit::NetworkProcessProxy::~NetworkProcessProxy): (WebKit::NetworkProcessProxy::synthesizeAppIsBackground): (WebKit::NetworkProcessProxy::sendProcessDidResume): (WebKit::NetworkProcessProxy::applicationDidEnterBackground): (WebKit::NetworkProcessProxy::applicationWillEnterForeground): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxyCocoa.mm: (WebKit::NetworkProcessProxy::addBackgroundStateObservers): (WebKit::NetworkProcessProxy::removeBackgroundStateObservers): * UIProcess/ProcessThrottler.cpp: (WebKit::ProcessThrottler::updateAssertionIfNeeded): * UIProcess/ProcessThrottlerClient.h: * UIProcess/WebAuthentication/WebAuthnProcessProxy.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::sendProcessDidResume): * UIProcess/WebProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::sendNetworkProcessDidResume): 2022-03-28 Sihui Liu Disable custom storage paths for IndexedDB and LocalStorage by default https://bugs.webkit.org/show_bug.cgi?id=236977 Reviewed by Geoffrey Garen. Developers can enable them by disabling "general directory for storage" via internal debug feature or system feature flag. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::internalFeatureEnabled): (WebKit::WebsiteDataStore::defaultShouldUseCustomStoragePaths): 2022-03-28 Commit Queue Unreviewed, reverting r291728. https://bugs.webkit.org/show_bug.cgi?id=238476 causing crashes in tests Reverted changeset: "Expand autocorrect context for more accurate results." https://bugs.webkit.org/show_bug.cgi?id=237990 https://commits.webkit.org/r291728 2022-03-28 Devin Rousso [macOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units https://bugs.webkit.org/show_bug.cgi?id=238173 Reviewed by Wenson Hsieh. See for information about this API. This change just also enables it on macOS (the other change was iOS-only). * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebView.mm: * UIProcess/API/mac/WKWebViewMac.mm: (-[WKWebView setFrameSize:]): Remove the `#if PLATFORM(IOS_FAMILY)` around all things related to `-[WKWebview setMinimumViewportInset:maximumViewportInset:]`. 2022-03-28 Wenson Hsieh REGRESSION (r290794): [ iOS Debug ] 4 editing/selection/* tests are constant timeouts https://bugs.webkit.org/show_bug.cgi?id=238155 rdar://90593957 Reviewed by Aditya Keerthi. After the changes in r290794, we now preemptively compute and send an excessive amount of autocorrection contexts to the UI process when an element gains focus, such that the UI process is capable of immediately responding to calls to `-requestAutocorrectionContextWithCompletionHandler:` without relying on synchronous IPC to the web process. This made several (already-fairly-slow) tests in editing/selection time out, due to WebKit computing and sending an excessive amount of this contextual information. To mitigate this, only perform this preemptive autocorrection context computation if the focused element is actually changing (i.e., we're not refocusing the same element). Covered by removing several [ Slow ] test expectations that should no longer be needed. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::elementDidFocus): 2022-03-28 Per Arne Vollan [macOS] Block access to IOKit class https://bugs.webkit.org/show_bug.cgi?id=238457 Reviewed by Geoffrey Garen. Block access to IOKit class AGPMClient on macOS. We already block all messages for this class. * WebProcess/com.apple.WebProcess.sb.in: 2022-03-28 Fujii Hironori Unreviewed build fix after 291979 for WinCairo and PlayStation Debug builds https://bugs.webkit.org/show_bug.cgi?id=238400 > WebNotificationManager.cpp(153): error C2027: use of undefined type 'WebCore::Notification' * WebProcess/Notifications/WebNotificationManager.cpp: (WebKit::WebNotificationManager::show): Guarded the LOG with ENABLE(NOTIFICATIONS). 2022-03-28 Chris Dumez Prepare WebCore for making the String(const char*) constructor explicit https://bugs.webkit.org/show_bug.cgi?id=238408 Reviewed by Geoff Garen. Prepare WebCore for making the String(const char*) constructor explicit. Making this constructor explicit helps findings cases where a String is constructed from a literal without the ""_s suffix. * NetworkProcess/NetworkDataTaskBlob.cpp: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::didCreateSleepDisabler): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): 2022-03-28 J Pascoe Adopt ASCPublicKeyCredentialCreationOptions's residentKeyPreference https://bugs.webkit.org/show_bug.cgi?id=238387 rdar://problem/90845393 Reviewed by Brent Fulgham. This patch passes along the residentKeyPreference to ASA, so it can be passed back via _WKAuthenticatorSelectionCriteria.residentKey. * Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h: * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm: (WebKit::toASCResidentKeyPreference): (WebKit::configureRegistrationRequestContext): 2022-03-28 Per Arne Vollan [iOS] Fix sandbox violation related to Network content filtering https://bugs.webkit.org/show_bug.cgi?id=238458 Reviewed by Brent Fulgham. After enabling Network content filtering in the Network process, a related sandbox rule should be moved to the Network process' sandbox. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: 2022-03-28 Devin Rousso [iOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units https://bugs.webkit.org/show_bug.cgi?id=237979 Reviewed by Tim Horton. Recently the W3C CSS working group added [some new unit types to CSS](https://drafts.csswg.org/css-values-4/#viewport-variants) with the goal of helping web developers better deal with browsers that have dynamic UI elements that change apperance/size/etc. based on user actions (e.g. the URL bar collapsing/"squishing" and expanding/"unsquishing" depending on whether the user has most recently scrolled/swiped down the page). These new units come in three categories: - the "large viewport" units (`lvw`, `lvh`, etc.) each represent 1% of one dimension of the size of the visual area of the page when all browser UI elements are in their smallest state (e.g. when the URL bar is collapsed/"squished") - the "small viewport" units (`svw`, `svh`, etc.) each represent 1% of one dimension of the size of the visual area of the page when all browser UI elements are in their largest state (e.g. when the URL bar is expanded/"unsquished") - the "dynamic viewport" units (`dvw`, `dvh`, etc.) each represent 1% of one dimension of the size of the current visual area of the page, which depends on the current state of all browser UI elements This way, developer could use `100svh` to ensure that no matter what state the browser UI elements are in the entire element will always be visible on the screen, or use `100dvh` to respond to browser UI element changes by automatically resizing various elements to always fully take advantage of the available space. Nothing needs to be added to support "dynamic viewport" `dv*` units as there already exists other methods to adjust the visual area of the `WKWebView` without adjusting its `frame` (e.g. `-[WKWebView setBounds:]`, `-[UIScrollView setContentInset:]`, etc.). But for "small viewport" `sv*` units and "large viewport" `lv*` units, however, there is unfortunately no way to tell a `WKWebView` anything like "this is the smallest/largest that this `WKWebView` will ever be", so there's no way to know ahead of time what the size of the visual area would be when all browser UI elements are in their smallest/largest state. As such, this patch adds a new API to allow for `WKWebView` clients to tell WebKit this information ahead of time. Note that there already exists the concept of "default viewport" units (`vw`, `vh`, etc.) that each represent 1% of one dimension of the size of the visual area of the page when all browser UI elements are in their default state. The behavior of these units remain the same, and the value can be changed via the existing `-[WKWebView setFrame:]`. Tests: CSSViewportUnits.NegativeMinimumViewportInset CSSViewportUnits.NegativeMaximumViewportInset CSSViewportUnits.MinimumViewportInsetLargerThanMaximumViewportInset CSSViewportUnits.MinimumViewportInsetLargerThanFrame CSSViewportUnits.MaximumViewportInsetLargerThanFrame CSSViewportUnits.MinimumViewportInset CSSViewportUnits.MaximumViewportInset CSSViewportUnits.MinimumViewportInsetWithZoom CSSViewportUnits.MaximumViewportInsetWithZoom CSSViewportUnits.MinimumViewportInsetWithWritingMode CSSViewportUnits.MaximumViewportInsetWithWritingMode CSSViewportUnits.MinimumViewportInsetWithFrame CSSViewportUnits.MaximumViewportInsetWithFrame CSSViewportUnits.MinimumViewportInsetWithBounds CSSViewportUnits.MaximumViewportInsetWithBounds CSSViewportUnits.MinimumViewportInsetWithContentInset CSSViewportUnits.MaximumViewportInsetWithContentInset CSSViewportUnits.MinimumViewportInsetWithSafeAreaInsets CSSViewportUnits.MaximumViewportInsetWithSafeAreaInsets CSSViewportUnits.UnobscuredSizeOverridesIgnoreMaximumViewportInsetAPI * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebView.h: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _recalculateViewportSizesWithMinimumViewportInset:maximumViewportInset:throwOnInvalidInput:]): Added. (-[WKWebView setMinimumViewportInset:maximumViewportInset:]): Added. * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _processWillSwapOrDidExit]): (-[WKWebView _frameOrBoundsChanged]): (-[WKWebView _didCompleteAnimatedResize]): (-[WKWebView _setMinimumUnobscuredSizeOverride:]): (-[WKWebView _setMaximumUnobscuredSizeOverride:]): (-[WKWebView _beginAnimatedResizeWithUpdates:]): (-[WKWebView _dispatchSetMinimumUnobscuredSize:]): Deleted. (-[WKWebView _dispatchSetMaximumUnobscuredSize:]): Deleted. Recalculate the size for CSS "small viewport" `sv*` units whenever the `frame` changes. Also move the deduplication logic that prevents the same value from being sent to the WebProcess more than once to the setter methods on `WebPageProxy` so that it can be used by more than just iOS-only codepaths. * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::setDefaultUnobscuredSize): Added. (WebKit::WebPageProxy::setMinimumUnobscuredSize): Added. (WebKit::WebPageProxy::setMaximumUnobscuredSize): Added. (WebKit::WebPageProxy::creationParameters): * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::dynamicViewportSizeUpdate): (WebKit::WebPageProxy::setMinimumUnobscuredSize): Deleted. (WebKit::WebPageProxy::setMaximumUnobscuredSize): Deleted. * Shared/WebPageCreationParameters.h: * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::WebPage): (WebKit::WebPage::setViewportSizeForCSSViewportUnits): (WebKit::WebPage::setDefaultUnobscuredSize): Added. (WebKit::WebPage::setMinimumUnobscuredSize): Added. (WebKit::WebPage::setMaximumUnobscuredSize): Added. (WebKit::WebPage::updateSizeForCSSDefaultViewportUnits): Added. (WebKit::WebPage::updateSizeForCSSSmallViewportUnits): Added. (WebKit::WebPage::updateSizeForCSSLargeViewportUnits): Added. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::viewportConfigurationChanged): (WebKit::WebPage::setMinimumUnobscuredSize): Deleted. (WebKit::WebPage::setMaximumUnobscuredSize): Deleted. (WebKit::WebPage::updateViewportSizeForCSSViewportUnits): Deleted. Add all the various methods for getting/setting/overriding/clearing an override value for CSS "default viewport" `v*` units. This allows for `WKWebView` clients to preserve existing behavior (where CSS "default viewport" `v*` units match the size of the `WKWebView`) while adding supporting CSS "small viewport" `sv*` units and CSS "large viewport" `lv*` units. Move iOS-only code to be for all platforms. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Propagate all viewport size overrides when a new `FrameView` is created. 2022-03-28 Brady Eidson Support ServiceWorkerClients.openWindow. and https://bugs.webkit.org/show_bug.cgi?id=238400 Reviewed by Youenn Fablet. This API asks the browser to asynchronously open a new tab to a URL then resolve a promise with the new WindowClient representing that tab. From a WebCore/WebKit standpoint, implementing this was mostly straightforward. 1 - A plumbing exercise (thread hopping and IPC'ing the message and its reply around) 2 - Implmenting a new delegate method for the hosting app to create the requested WKWebView The delegate method was interesting. Normally this is the type of thing that'd go to the WKUIDelegate but that requires there to be a WKWebView, and service workers can be running without any web views. Fortunately we already had a WKWebsiteDataStore delegate SPI, and service workers *do* always have an associated website data store they're running under. Once the app gives the new web view back to WebKit, we record its PageIdentifier in the reply. Once the reply makes its way all the way back to the ServiceWorker process and on the ServiceWorker thread, we do a client match and cross check with that PageIdentifier to make sure we're resolving the promise with the correct WindowClient. If there's no matched clients, then the view is either already gone or it has navigated away to a non-applicable URL. Same if there are matched clients, but they don't match the specified PageIdentifier. A straight forward layouttest completes the task. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: (WebKit::WebSWServerConnection::controlClient): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: (WebKit::WebSWServerToContextConnection::openWindow): * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore set_delegate:]): * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::openWindowFromServiceWorker): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Network/NetworkProcessProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared): (WebKit::WebPageProxy::callLoadCompletionHandlersIfNecessary): (WebKit::WebPageProxy::didFinishLoadForFrame): (WebKit::WebPageProxy::didFailLoadForFrame): (WebKit::WebPageProxy::resetState): (WebKit::WebPageProxy::callServiceWorkerLaunchCompletionHandlerIfNecessary): Deleted. * UIProcess/WebPageProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::openWindowFromServiceWorker): * UIProcess/WebsiteData/WebsiteDataStore.h: * UIProcess/WebsiteData/WebsiteDataStoreClient.h: (WebKit::WebsiteDataStoreClient::openWindowFromServiceWorker): * WebProcess/Notifications/WebNotificationManager.cpp: (WebKit::WebNotificationManager::show): (WebKit::WebNotificationManager::didShowNotification): (WebKit::WebNotificationManager::didClickNotification): * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::openWindow): * WebProcess/Storage/WebSWContextManagerConnection.h: 2022-03-28 Youenn Fablet Share more code between RemoteRealtimeAudioSource and RemoteRealtimeVideoSource https://bugs.webkit.org/show_bug.cgi?id=237704 Reviewed by Eric Carlson. Introduce RemoteRealtimeMediaSource as a common class for RemoteRealtimeAudioSource and RemoteRealtimeVideoSource. * SourcesCocoa.txt: * WebKit.xcodeproj/project.pbxproj: * WebProcess/cocoa/RemoteRealtimeAudioSource.cpp: * WebProcess/cocoa/RemoteRealtimeAudioSource.h: * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: Added. * WebProcess/cocoa/RemoteRealtimeMediaSource.h: Added. * WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.h: * WebProcess/cocoa/RemoteRealtimeVideoSource.cpp: * WebProcess/cocoa/RemoteRealtimeVideoSource.h: 2022-03-27 Lauro Moura Unreviewed, non-unified buildfix https://bugs.webkit.org/show_bug.cgi?id=238436 * WebProcess/Storage/WebSWClientConnection.cpp: 2022-03-26 Yusuke Suzuki Use static_assert instead of COMPILE_ASSERT https://bugs.webkit.org/show_bug.cgi?id=238417 Reviewed by Mark Lam. * Platform/IPC/Connection.h: (IPC::Connection::send): (IPC::Connection::sendWithAsyncReply): (IPC::Connection::sendSync): * Platform/IPC/MessageSender.h: * Platform/IPC/unix/ConnectionUnix.cpp: (IPC::Connection::sendOutgoingMessage): * UIProcess/AuxiliaryProcessProxy.h: (WebKit::AuxiliaryProcessProxy::send): (WebKit::AuxiliaryProcessProxy::sendSync): (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply): 2022-03-26 David Quesada Update the check in the sandbox profiles to guard the system content path rules https://bugs.webkit.org/show_bug.cgi?id=238419 rdar://90878560 Reviewed by Per Arne Vollan. Replace `USE(SYSTEM_CONTENT_PATH)` in the sandbox profiles with a different feature flag so that we can enable these rules independently even if WebKit itself isn't using the system content path. * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.adattributiond.sb.in: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2022-03-26 David Quesada REGRESSION(r291814): WebAuthn sandbox profile is missing https://bugs.webkit.org/show_bug.cgi?id=238418 rdar://90878872 Reviewed by Per Arne Vollan. Fix a typo in the script phase that copies the embedded sandbox profiles. We want to copy com.apple.WebKit.WebAuthn.sb, not com.apple.WebKit.WebAuth.sb. * WebKit.xcodeproj/project.pbxproj: 2022-03-26 Sihui Liu Unreviewed, reverting r291909. Found a better way to eanble the feature Reverted changeset: "Disable custom storage paths for IndexedDB and LocalStorage by default" https://bugs.webkit.org/show_bug.cgi?id=236977 https://commits.webkit.org/r291909 2022-03-26 Youenn Fablet Implement ServiceWorkerWindowClient.focus https://bugs.webkit.org/show_bug.cgi?id=238319 Reviewed by Brady Eidson. Support new IPC message flow to focus from a service worker to network process to service worker client process to UIProcess. Introduce a new delegate _focusWebViewFromServiceWorker as the scope is specific to service worker and usage is different from existing _focusWebView and other delegates. The overall flow is like this: - ServiceWorker process to NetworkProcess to Client WebProcess process to UIProcess (do the actual focus) to NetworkProcess to ServiceWorker process We might want to directly go from NetworkProcess to UIProcess but we need to handle potential race conditions in that case. * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: * NetworkProcess/ServiceWorker/WebSWServerConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: * UIProcess/API/APIUIClient.h: * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: * UIProcess/Cocoa/UIDelegate.h: * UIProcess/Cocoa/UIDelegate.mm: * UIProcess/WebPageProxy.cpp: * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebProcess/Storage/WebSWClientConnection.cpp: * WebProcess/Storage/WebSWClientConnection.h: * WebProcess/Storage/WebSWClientConnection.messages.in: * WebProcess/Storage/WebSWContextManagerConnection.cpp: * WebProcess/Storage/WebSWContextManagerConnection.h: 2022-03-26 Yusuke Suzuki Use unary static_assert https://bugs.webkit.org/show_bug.cgi?id=238412 Reviewed by Mark Lam. * Shared/API/c/WKContextMenuItem.cpp: * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::HistoryEntryDataEncoder::encodeArithmeticType): (WebKit::HistoryEntryDataDecoder::decodeArithmeticType): 2022-03-25 Simon Fraser Temporarily disable assertion in MessageReceiveQueueMap::addImpl() https://bugs.webkit.org/show_bug.cgi?id=238397 Unreviewed followup: similarly change the assertion in remove() into a log. * Platform/IPC/MessageReceiveQueueMap.cpp: (IPC::MessageReceiveQueueMap::remove): 2022-03-25 Commit Queue Unreviewed, reverting r291884. https://bugs.webkit.org/show_bug.cgi?id=238405 Broke the internal iOS build Reverted changeset: "Add Captive Portal alert to WKWebView" https://bugs.webkit.org/show_bug.cgi?id=238326 https://commits.webkit.org/r291884 2022-03-25 Simon Fraser Temporarily disable assertion in MessageReceiveQueueMap::addImpl() https://bugs.webkit.org/show_bug.cgi?id=238397 Reviewed by Wenson Hsieh. Enabling DOM Rendering in the GPU Process has exposed an issue (webkit.org/b/237674, webkit.org/b/238391). Temporarily convert this assertion to logging to reduce test failures. * Platform/IPC/MessageReceiveQueueMap.cpp: (IPC::MessageReceiveQueueMap::addImpl): 2022-03-25 Sihui Liu Disable custom storage paths for IndexedDB and LocalStorage by default https://bugs.webkit.org/show_bug.cgi?id=236977 Reviewed by Geoffrey Garen. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-macos.plist: * FeatureFlags/WebKit-watchos.plist: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::defaultShouldUseCustomStoragePaths): 2022-03-25 Said Abou-Hallawa [GPU Process] [iOS] Enable GPU Process for DOM rendering on iOS https://bugs.webkit.org/show_bug.cgi?id=236508 rdar://83437844 Reviewed by Jon Lee. * FeatureFlags/WebKit-appletvos.plist: * FeatureFlags/WebKit-ios.plist: * FeatureFlags/WebKit-watchos.plist: * Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultUseGPUProcessForDOMRenderingEnabled): 2022-03-25 Chris Dumez Use StringView::split() instead of String::split() in more places https://bugs.webkit.org/show_bug.cgi?id=238362 Reviewed by Geoffrey Garen. Use StringView::split() instead of String::split() where suitable and more efficient. * Shared/mac/AuxiliaryProcessMac.mm: (WebKit::parseOSVersion): (WebKit::populateSandboxInitializationParameters): * UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::ProcessLauncher::launchProcess): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::initialize): 2022-03-25 Elliott Williams [Big Sur] WK2 failing to build with `error: reference to 'WebDocumentView' is ambiguous` https://bugs.webkit.org/show_bug.cgi?id=238384 Reviewed by Alexey Proskuryakov. Build fix, see rdar://90844690. Create forwarding headers in WebKit's temporary directory which cause imports of any migrated header to be imported using WebKit's header map. For example, #import #import ...both resolve to the same header. Also, clean up project file references to files which were deleted in r291809. * WebKit.xcodeproj/project.pbxproj: 2022-03-25 Wenson Hsieh Enable PGO when building for release and production https://bugs.webkit.org/show_bug.cgi?id=238119 rdar://90182309 Reviewed by Alexey Proskuryakov and Geoff Garen. See WebCore/ChangeLog for more information. * Configurations/Base.xcconfig: * Configurations/BaseTarget.xcconfig: * WebKit.xcodeproj/project.pbxproj: 2022-03-25 Simon Fraser Add some generated sources to the WebKit project https://bugs.webkit.org/show_bug.cgi?id=238363 Reviewed by Alexey Proskuryakov. There are many generated files which haven't been added to the project (they get built via Sources.txt). Here, I add a few that I like to be able to find code in, particularly MessageNames.h. com.apple.WebKit.plugin-common.sb was deleted so is removed from the project. * WebKit.xcodeproj/project.pbxproj: 2022-03-25 C Lopez Add Captive Portal alert to WKWebView https://bugs.webkit.org/show_bug.cgi?id=238326 Reviewed by Geoffrey Garen. When WkWebView on iOS is initialized, we call `_presentCaptivePortalModeAlertIfNeeded` which checks whether an alert needs to be presented or not. * UIProcess/API/ios/WKWebViewIOS.h: * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _presentCaptivePortalModeAlertIfNeeded]): (-[WKWebView didMoveToWindow]): 2022-03-25 J Pascoe [WebAuthn] Maintain last modification time separate from last used time for platform credentials https://bugs.webkit.org/show_bug.cgi?id=238293 rdar://90655676 Reviewed by Brent Fulgham. This patch splits a key returned from [_WKWebAuthenticationPanel getAllLocalAuthenticatorCredentials...], _WKLocalAuthenticatorCredentialLastModificationDateKey, which previously signified the last time a credential was modified or used in an assertion, to just the last time the credential was modified. A new key, _WKLocalAuthenticatorCredentialLastUsedDateKey represents the old definition, the last time a key was used or modified. * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h: * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm: (getAllLocalAuthenticatorCredentialsImpl): (+[_WKWebAuthenticationPanel setUsernameForLocalCredentialWithGroupAndID:credential:username:]): * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification): 2022-03-25 Said Abou-Hallawa [GPU Process] RemoteRenderingBackend::stopListeningForIPC() should not change the RemoteResourceCache on the main thread https://bugs.webkit.org/show_bug.cgi?id=238298 rdar://90731372 Reviewed by Simon Fraser. To release the RemoteResourceCache and the rendering resource request on the WorkQueue thread, RemoteRenderingBackend::stopListeningForIPC() dispatches an empty lambda to its WorkQueue but m_renderingResourcesRequest and m_remoteResourceCache are captured by-move to initializers to this lambda. But this means m_remoteResourceCache is changed on the main thread while the WorkQueue thread may be accessing it to get a cached remote resource. The EWS crashes showed that, RemoteRenderingBackend::stopListeningForIPC() on the main thread is waiting its WorkQueue to stop and complete all its work including the dispatched empty lambda. And the WorkQueue thread is getting wrong resource counters from the RemoteResourceCache. This would happen if the HashMaps of RemoteResourceCache were emptied on the main thread while the counters had outdated values. To fix this thread safety issue, the RemoteResourceCache should not ever be changed on the main thread. Since capturing by-move is kind of change, we will capture m_renderingResourcesRequest and m_remoteResourceCache by reference and we let the dispatched lambda explicitly releases them on the WorkQueue thread. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::stopListeningForIPC): 2022-03-25 Per Arne Vollan [macOS][WP] Remove unused sandbox extension rule https://bugs.webkit.org/show_bug.cgi?id=238377 Reviewed by Geoffrey Garen. Remove unused sandbox extension rule for RootDomainUserClient. * WebProcess/com.apple.WebProcess.sb.in: 2022-03-25 Michael Saboff Unreviewed, fix the internal iOS build after r291814 rdar://90848250 Removed extraneous double quote (") in com.apple.WebKit.WebContent.sb.in. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: 2022-03-25 Chris Dumez Start preparing WebCore for making the String(const char*) constructor explicit https://bugs.webkit.org/show_bug.cgi?id=238336 Reviewed by Geoffrey Garen. Start preparing WebCore for making the String(const char*) constructor explicit. Making this constructor explicit helps catch at compile time cases where the ""_s prefix is missing on String literals. * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::WebViewImpl::setPromisedDataForImage): (WebKit::WebViewImpl::requestDOMPasteAccess): 2022-03-25 Wenson Hsieh Unreviewed, fix the internal iOS build after r291842 https://bugs.webkit.org/show_bug.cgi?id=238344 Apply a similar adjustment to `WKModelView.mm`, as in `ARKitInlinePreviewModelPlayerMac.mm`, when generating a usdz file path. * UIProcess/ios/WKModelView.mm: (-[WKModelView createFileForModel:]): 2022-03-25 Sihui Liu Introduce an SPI to get website data directory for origin and use it in API tests https://bugs.webkit.org/show_bug.cgi?id=238269 Reviewed by Alex Christensen. There are a few tests using hardcoded website data paths to check if files are correcly modified by API. Everytime we migrate website data (for example, if we start using general storage directory for IndexedDB storage), we need to update these tests with new paths, otherwise the tests will check the wrong paths. Let's just add an SPI so these tests can get the paths in use dynamically, which would avoid test breakage when we do website data migration. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::websiteDataOriginDirectoryForTesting): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * NetworkProcess/storage/NetworkStorageManager.cpp: (WebKit::NetworkStorageManager::moveData): (WebKit::NetworkStorageManager::getOriginDirectory): * NetworkProcess/storage/NetworkStorageManager.h: * NetworkProcess/storage/OriginStorageManager.cpp: (WebKit::OriginStorageManager::StorageBucket::toStorageType const): (WebKit::OriginStorageManager::StorageBucket::resolvedLocalStoragePath): (WebKit::OriginStorageManager::StorageBucket::resolvedIDBStoragePath): (WebKit::OriginStorageManager::StorageBucket::resolvedPath): (WebKit::OriginStorageManager::resolvedPath): (WebKit::OriginStorageManager::resolvedLocalStoragePath): Deleted. (WebKit::OriginStorageManager::resolvedIDBStoragePath): Deleted. * NetworkProcess/storage/OriginStorageManager.h: * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: (-[WKWebsiteDataStore _originDirectoryForTesting:topOrigin:type:completionHandler:]): * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::websiteDataOriginDirectoryForTesting): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::originDirectoryForTesting): * UIProcess/WebsiteData/WebsiteDataStore.h: 2022-03-24 Don Olmstead Non-unified build fixes, late March 2022 edition https://bugs.webkit.org/show_bug.cgi?id=238358 Unreviewed non-unified build fixes. * GPUProcess/GPUProcess.cpp: * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: 2022-03-24 Chris Dumez String::split() should take in a StringView instead of a String https://bugs.webkit.org/show_bug.cgi?id=238355 Reviewed by Geoffrey Garen. * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp: Optimize by calling StringView::split() instead of String::split(). 2022-03-24 Brent Fulgham Require click-to-play for media in Captive Portals https://bugs.webkit.org/show_bug.cgi?id=238353 Reviewed by Chris Dumez. * WebProcess/WebPage/WebPage.cpp: (WebKit::adjustSettingsForCaptivePortal): Disable auto-play for media for Captive Portals. 2022-03-24 Chris Dumez FileSystem::pathByAppendingComponent() should take in StringViews instead of Strings https://bugs.webkit.org/show_bug.cgi?id=238344 Reviewed by Geoff Garen. * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore): * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp: (WebKit::PCM::Database::Database): * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::storagePath): (WebKit::CacheStorage::Engine::initialize): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::cachesListFilename): (WebKit::CacheStorage::cachesOriginFilename): (WebKit::CacheStorage::Caches::cachesSizeFilename): * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: (WebKit::NetworkCache::BlobStorage::blobPathForHash const): * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::makeCachePath): * NetworkProcess/storage/IDBStorageManager.cpp: (WebKit::IDBStorageManager::idbStorageOriginDirectory): * UIProcess/Inspector/win/InspectorResourceURLSchemeHandler.cpp: (WebKit::InspectorResourceURLSchemeHandler::platformStartTask): 2022-03-24 Don Olmstead [GLib] Add user directories to WTF::FileSystem https://bugs.webkit.org/show_bug.cgi?id=238348 Reviewed by Adrian Perez de Castro. Use the new FileSystem APIs instead of calling glib directly. * UIProcess/Inspector/gtk/WebInspectorUIProxyGtk.cpp: (WebKit::inspectorWebsiteDataStore): * UIProcess/glib/WebsiteDataStoreGLib.cpp: (WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation): (WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation): 2022-03-24 Devin Rousso [iOS] make `WKMouseGestureRecognizer` officially conform to `_UIHoverEventRespondable` https://bugs.webkit.org/show_bug.cgi?id=238242 Reviewed by Tim Horton. * UIProcess/ios/WKMouseGestureRecognizer.h: * UIProcess/ios/WKMouseGestureRecognizer.mm: * Platform/spi/ios/UIKitSPI.h: 2022-03-24 Michael Saboff After r291814, we need to create the INSTALL_PATH for the iOS sandbox files https://bugs.webkit.org/show_bug.cgi?id=238351 Reviewed by Saam Barati. We need to create the $(INSTALL_PATH) for the preprocessed iOS sandbox files. Before r291814, the built-in Xcode copy step used ditto when copying the .sb files thus creating $(INSTALL_PATH) and its intermediate directories. That change set made it so that all WebKit iOS sandbox profile files are preprocessed thus eliminating the Xcode copy step. * WebKit.xcodeproj/project.pbxproj: 2022-03-24 Patrick Angle REGRESSION(STP142): "A JavaScript exception occured: Can't find variable: utils" from SafariDriver https://bugs.webkit.org/show_bug.cgi?id=238335 Reviewed by Devin Rousso. Following r289467, we can't just copy the WebDriver atom scripts to the build products, since they now need to have `utils.js` in any script that uses the `utils` namespace. The `WebKit.framework` copy of these scripts are later used while building safaridriver, so they need to include the scripts as well. * WebKit.xcodeproj/project.pbxproj: 2022-03-24 Per Arne Vollan REGRESSION(r286590): Links with URL schemes are not clickable in Mail https://bugs.webkit.org/show_bug.cgi?id=238262 Reviewed by Geoffrey Garen. This feature requires access to the Launch Services daemon in Mail and other apps on iOS. This patch is a partial revert of r286590. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::nonBrowserServices): (WebKit::WebProcessPool::platformInitializeWebProcess): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): 2022-03-24 Brent Fulgham Disable RTCRtpScriptTransform in CaptivePortal mode https://bugs.webkit.org/show_bug.cgi?id=238340 Reviewed by Chris Dumez. When displaying content in a captive portal, we should make sure we disable WebRTCEncodedTransform. Tests: TestWebKitAPI * WebProcess/WebPage/WebPage.cpp: (WebKit::adjustSettingsForCaptivePortal): Disable WebRTCEncodedTransform. 2022-03-24 Antoine Quint DOM GPUP: paintSystemPreviewBadge (AR QuickLook element badge) https://bugs.webkit.org/show_bug.cgi?id=238295 rdar://83580608 Reviewed by Dean Jackson. Make sure we restore the Image on the ARKitBadgeSystemImage before we attempt to draw it. * GPUProcess/graphics/RemoteDisplayListRecorder.cpp: (WebKit::RemoteDisplayListRecorder::drawSystemImage): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder>::encode): (IPC::ArgumentCoder>::decode): 2022-03-24 Michael Saboff Update Sandbox profiles for system content path https://bugs.webkit.org/show_bug.cgi?id=238255 Reviewed by Per Arne Vollan. Updated WebKit sandbox profiles to include system content path rule files when building with the system content path. Changed the iOS profiles to be preprocessed to make these changes. * DerivedSources-input.xcfilelist * DerivedSources-output.xcfilelist * DerivedSources.make: * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb: Removed. * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb.in: Copied from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Removed. * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb.in: Copied from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb: Removed. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb.in: Copied from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb. * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in: * Resources/SandboxProfiles/ios/com.apple.WebKit.adattributiond.sb: Removed. * Resources/SandboxProfiles/ios/com.apple.WebKit.adattributiond.sb.in: Copied from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.adattributiond.sb. * Shared/Sandbox/preferences.sb: * WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/com.apple.WebProcess.sb.in: 2022-03-24 Fujii Hironori [WinCairo] WCTileGrid should create tiles only for the inside of layer area https://bugs.webkit.org/show_bug.cgi?id=238317 Reviewed by Don Olmstead. The coverage rect returned by computeVisibleAndCoverageRect may be bigger than the layer rect. Tiles should be paved only for the intersection of the coverage rect and the layer rect. * WebProcess/WebPage/wc/WCTileGrid.cpp: (WebKit::WCTileGrid::tileRectFromPixelRect): Take the intersection with the layer rect. Return an empty rect if the intersection is empty. 2022-03-24 Per Arne Vollan [iOS] Disable unneeded code when content filtering is running in the Network process https://bugs.webkit.org/show_bug.cgi?id=238332 Reviewed by Geoffrey Garen. * Shared/Cocoa/LoadParametersCocoa.mm: (WebKit::LoadParameters::platformEncode const): (WebKit::LoadParameters::platformDecode): * Shared/LoadParameters.h: * UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::addPlatformLoadParameters): * UIProcess/WebProcessProxy.h: * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::WebPage::platformDidReceiveLoadParameters): 2022-03-24 Elliott Williams [XCBuild] WebKit: Use native headers + build rules for migrated headers https://bugs.webkit.org/show_bug.cgi?id=238213 Reviewed by Alexey Proskuryakov. Replace the Make-based header migration script phase with a native project-based representation in WebKit.xcodeproj. The project now contains a 'Migrated Headers' group which lists the headers from WebKitLegacy and WebCore that are copied to WebKit.framework during the build process. This group must be kept in sync with the actual headers in WebKitLegacy, but since new headers shouldn't really be added to WebKitLegacy this will be low-friction. The preexisting postprocess-header-rule build rule is refactored to handle the transformations needed for Migrated headers, which previous came from WebKitLegacy's `postprocess-header-rule` script or from one of the MigrateHeaders*.make files. * Configurations/WebKit.xcconfig: Use EXCLUDED_SOURCE_FILE_NAMES to customize migrated headers on mac vs. non-mac platforms. * Scripts/postprocess-header-rule: Refactored to incorporate WebKitLegacy's postprocessing steps, and to do less disk I/O, now that it's always invoked as a build rule and can do less in-place editing. Local testing shows a ~15% speedup. * Shared/API/Cocoa/WebKitLegacy.h: Added. Xcode's header maps forbid a header's name from changing during the copy process, so we have to duplicate WebKitLegacy's umbrella header instead of renaming it WebKit.h -> WebKitLegacy.h during the build. * WebKit.xcodeproj/project.pbxproj: Added 'Migrated Headers' group and build rule. Configured headers to always copy using XCBuild. Removed legacy-only header script phases. * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm: This file used unqualified imports, which are not supported by Xcode's headermaps. Replaced with "HEADER.h". * mac/MigrateHeadersFromWebKitLegacy.make: Removed, logic now lives in mingrate-headers-rule.sh. * mac/postprocess-framework-headers.sh: Removed. * mac/replace-webkit-additions-includes.py: Refactored to use stdin and stdout rather than editing in-place. Corresponds to refactors in postprocess-header-rule. 2022-03-24 Per Arne Vollan [macOS] Remove reports for some sandbox violations on process launch https://bugs.webkit.org/show_bug.cgi?id=238324 Reviewed by Geoffrey Garen. Remove reports for some sandbox violations on process launch on macOS. These violations are not critical, and are slowing down process launch. This patch also adds access to a mach syscall observed being in use. * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: * WebProcess/com.apple.WebProcess.sb.in: 2022-03-24 Chris Dumez String's find() / reverseFind() / replace() should take in a StringView instead of a String https://bugs.webkit.org/show_bug.cgi?id=238287 Reviewed by Darin Adler. * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::searchWithGoogle): 2022-03-24 Adrian Perez de Castro [GTK] REGRESSION(r291613): Build broken with USE_GTK4 + ENABLE_ACCESSIBILITY https://bugs.webkit.org/show_bug.cgi?id=238320 Reviewed by Carlos Garcia Campos. Guard remaning uses of ATK when building with GTK4, where ATK is not used at all. * UIProcess/API/glib/WebKitWebViewAccessible.cpp: * UIProcess/API/glib/WebKitWebViewAccessible.h: * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseDispose): 2022-03-23 Sihui Liu Add logging for LocalStorage and IndexedDB data migration https://bugs.webkit.org/show_bug.cgi?id=238169 Reviewed by Chris Dumez. * NetworkProcess/storage/IDBStorageManager.cpp: (WebKit::migrateOriginDataImpl): (WebKit::IDBStorageManager::migrateOriginData): * NetworkProcess/storage/IDBStorageManager.h: * NetworkProcess/storage/OriginStorageManager.cpp: (WebKit::OriginStorageManager::StorageBucket::resolvedLocalStoragePath): (WebKit::OriginStorageManager::StorageBucket::resolvedIDBStoragePath): 2022-03-23 Simon Fraser Have MiniBrowser shows the GPU Process pid in its title bar https://bugs.webkit.org/show_bug.cgi?id=238286 Reviewed by Tim Horton. Expose _gpuProcessIdentifier on WKWebView as SPI. In order to support KVO for this, we need to pass gpuProcessDidFinishLaunching() all the way from GPUProcessProxy::didFinishLaunching() to PageClientImplCocoa. This KVO isn't accurate (the "willChange" fires after the new pid is available) but for SPI it's good enough. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _gpuProcessIdentifier]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::gpuProcessDidFinishLaunching): (WebKit::PageClientImplCocoa::gpuProcessDidExit): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::didFinishLaunching): * UIProcess/PageClient.h: (WebKit::PageClient::gpuProcessDidFinishLaunching): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::gpuProcessIdentifier const): (WebKit::WebPageProxy::gpuProcessDidFinishLaunching): * UIProcess/WebPageProxy.h: * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::gpuProcessDidFinishLaunching): * UIProcess/WebProcessPool.h: * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::gpuProcessDidFinishLaunching): * UIProcess/WebProcessProxy.h: * UIProcess/ios/PageClientImplIOS.mm: (WebKit::PageClientImpl::gpuProcessDidExit): 2022-03-23 Simon Fraser REGRESSION (248692@main?): [iOS] ASSERTION FAILED: m_layer->owner()->platformCALayerDelegatesDisplay(m_layer) in WebKit::RemoteLayerBackingStore::paintContents() https://bugs.webkit.org/show_bug.cgi?id=238277 Reviewed by Tim Horton. Empty backing store (height or width of zero) never need display; ImageBuffer allocation with empty sizes always returns null anyway. * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::needsDisplay const): * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: (WebKit::RemoteLayerBackingStoreCollection::backingStoreNeedsDisplay): * Shared/RemoteLayerTree/RemoteLayerWithRemoteRenderingBackingStoreCollection.mm: (WebKit::RemoteLayerWithRemoteRenderingBackingStoreCollection::backingStoreNeedsDisplay): 2022-03-23 Sihui Liu [ BigSur+ Debug wk2 EWS ] imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/quirks.window.html is a flaky crash https://bugs.webkit.org/show_bug.cgi?id=237165 Reviewed by Chris Dumez. The test is hitting an assertion in StorageAreaBase::addListener. The assertion is used to verify that one connection will not be added to a StorageArea twice, i.e. one web process will not have two StorageAreaMaps pointing to the same StorageArea in network process. With our current implementation, there is an edge case that we load a.com, navigate to b.com and go back to a.com. In this case, we would create a StorageAreaMap for a.com, destroy it on navigation, and create another StorageAreaMap for a.com on going back. Because we don't remove listener during destruction of StorageAreaMap (we do it when web process receives reply from network process), the assertion is hit for two StorageAreaMaps from one connection pointing to the same StorageArea. We can fix it by sending a cancelConnectToStorage message to remove listener during destruction. The edge case is a bit hard to reproduce with auto test since we need to ensure web process sends the second ConnectionToStorageArea message before receiving the reply of the first ConnectionToStorageArea message, so I manually tested it by adding delay in NetworkStorageManager::connectToStorageArea. * NetworkProcess/storage/LocalStorageManager.cpp: (WebKit::LocalStorageManager::cancelConnectToLocalStorageArea): (WebKit::LocalStorageManager::cancelConnectToTransientLocalStorageArea): * NetworkProcess/storage/LocalStorageManager.h: * NetworkProcess/storage/NetworkStorageManager.cpp: (WebKit::NetworkStorageManager::cancelConnectToStorageArea): * NetworkProcess/storage/NetworkStorageManager.h: * NetworkProcess/storage/NetworkStorageManager.messages.in: * NetworkProcess/storage/SessionStorageManager.cpp: (WebKit::SessionStorageManager::cancelConnectToSessionStorageArea): * NetworkProcess/storage/SessionStorageManager.h: * WebProcess/WebStorage/StorageAreaMap.cpp: (WebKit::StorageAreaMap::computeStorageType const): (WebKit::StorageAreaMap::clientOrigin const): (WebKit::StorageAreaMap::sendConnectMessage): (WebKit::StorageAreaMap::didConnect): (WebKit::StorageAreaMap::disconnect): * WebProcess/WebStorage/StorageAreaMap.h: 2022-03-23 Eric Carlson [Cocoa] Adopt new AVCapture SPI https://bugs.webkit.org/show_bug.cgi?id=238289 rdar://90576101 Reviewed by Jer Noble. Call AVCapture SPI once the GPU process sandbox has been expanded to allow capture. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::updateSandboxAccess): * GPUProcess/GPUProcess.h: * GPUProcess/cocoa/GPUProcessCocoa.mm: (WebKit::GPUProcess::dispatchSimulatedNotificationsForPreferenceChange): (WebKit::GPUProcess::sandboxWasUpatedForCapture): 2022-03-23 Wenson Hsieh [iOS] Mail compose web view no longer scrolls to reveal selection upon showing the keyboard https://bugs.webkit.org/show_bug.cgi?id=238271 rdar://89821087 Reviewed by Tim Horton. When a certain UIKit feature is enabled on certain builds of iOS, Mail compose no longer scrolls to reveal the selection range or caret. This is because we have logic to defer scrolling/zooming to reveal the selection after focusing the body element, for reasons outlined in trac.webkit.org/r288178. However, when the feature flag is enabled, UIKeyboardWillShowNotification is no longer fired synchronously underneath the call to `-reloadInputViews`, which means that `isKeyboardAnimatingIn()` will (most of the time) return false upon calling `-_zoomToRevealFocusedElement` when receiving the next post-layout editor state update. To mitigate this, add a new boolean flag, `_waitingForKeyboardToStartAnimatingInAfterElementFocus`, that's set right before we reload input views when focusing an element that requires the keyboard (either software or hardware), and unset when we observe the "WillShow" notification. In addition to checking `_page->isKeyboardAnimatingIn()` when determining whether to defer zooming, we check this new flag as well. Covered by an existing layout test (which currently fails when the aforementioned UIKit feature is enabled): editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html * UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _keyboardWillShow:]): * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpInteraction]): (-[WKContentView _keyboardWillShow]): (-[WKContentView _zoomToRevealFocusedElement]): (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): (-[WKContentView _elementDidBlur]): 2022-03-23 J Pascoe [WebAuthn] Specify correct ASCPublicKeyCredentialKind in configureAssertionOptions https://bugs.webkit.org/show_bug.cgi?id=238272 rdar://problem/90710080 Reviewed by Brent Fulgham. There was a typo when refactoring code into this method. The kind passed to the function should be used, instead of always ASCPublicKeyCredentialKindPlatform. * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm: (WebKit::configureAssertionOptions): 2022-03-23 Kimmo Kinnunen After losing context due to too many contexts, getError() does not return CONTEXT_LOST_WEBGL https://bugs.webkit.org/show_bug.cgi?id=236965 Reviewed by Kenneth Russell. Remove recording of synthetic webgl context lost error from the proxy. This is now recorded in the WebGLRenderingContextBase. * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: (WebKit::RemoteGraphicsContextGLProxy::synthesizeGLError): (WebKit::RemoteGraphicsContextGLProxy::getError): * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: 2022-03-23 Fujii Hironori [WinCairo] Unreviewed build fix after r291733 * WebProcess/GPU/graphics/PrepareBackingStoreBuffersData.h: 2022-03-22 Alex Christensen Implement PCM to SKAdNetwork bridge https://bugs.webkit.org/show_bug.cgi?id=237969 Reviewed by John Wilander. The WebKit parts of this just introduce a new information flow to SKAdNetwork to send the app purchase attribution kind of like WebKit sends a PCM attribution report 24-48 hours after a non-app-purchase click with attribution. * Configurations/WebKit.xcconfig: * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::storePrivateClickMeasurement): * NetworkProcess/NetworkSession.h: (WebKit::NetworkSession::donateToSKAdNetwork): * NetworkProcess/cocoa/AppStoreDaemonSPI.h: Added. * NetworkProcess/cocoa/NetworkSessionCocoa.h: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::donateToSKAdNetwork): * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: * Scripts/process-entitlements.sh: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): * WebKit.xcodeproj/project.pbxproj: 2022-03-22 Simon Fraser Swap all RemoteLayerBackingStore buffers in a single IPC https://bugs.webkit.org/show_bug.cgi?id=238210 Reviewed by Tim Horton. PrepareBuffersForDisplay is a sync IPC (since we need the result before painting), and sync IPC per-layer has performance impact. So group all the swapping into a single IPC with the GPU Process. The PrepareBuffersForDisplay message now takes a vector of PrepareBackingStoreBuffersInputData, and returns a vector of PrepareBackingStoreBuffersOutputData. Swapped buffers are applied to the RemoteLayerBackingStore as before, with a minor change in the place that setNeedsDisplay() is called in the case where we need a full display. * GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::prepareBuffersForDisplay): (WebKit::RemoteRenderingBackend::prepareLayerBuffersForDisplay): * GPUProcess/graphics/RemoteRenderingBackend.h: * GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Scripts/webkit/messages.py: (headers_for_type): * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: (WebKit::RemoteLayerBackingStore::applySwappedBuffers): (WebKit::RemoteLayerBackingStore::performDelegatedLayerDisplay): (WebKit::RemoteLayerBackingStore::prepareToDisplay): (WebKit::RemoteLayerBackingStore::ensureFrontBuffer): (WebKit::RemoteLayerBackingStore::prepareBuffers): (WebKit::operator<<): Deleted. * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h: * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: (WebKit::RemoteLayerBackingStoreCollection::prepareBackingStoreBuffers): Deleted. * Shared/RemoteLayerTree/RemoteLayerWithRemoteRenderingBackingStoreCollection.h: * Shared/RemoteLayerTree/RemoteLayerWithRemoteRenderingBackingStoreCollection.mm: (WebKit::RemoteLayerWithRemoteRenderingBackingStoreCollection::prepareBackingStoresForDisplay): (WebKit::RemoteLayerWithRemoteRenderingBackingStoreCollection::prepareBackingStoreBuffers): Deleted. * WebKit.xcodeproj/project.pbxproj: * WebProcess/GPU/graphics/PrepareBackingStoreBuffersData.h: Added. (WebKit::PrepareBackingStoreBuffersInputData::encode const): (WebKit::PrepareBackingStoreBuffersInputData::decode): (WebKit::PrepareBackingStoreBuffersOutputData::encode const): (WebKit::PrepareBackingStoreBuffersOutputData::decode): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::prepareBuffersForDisplay): * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: 2022-03-22 Sihui Liu REGRESSION (248499@main): [iOS] ASSERTION FAILED: Completion handler should always be called under WebKit::NetworkProcess::prepareToSuspend() https://bugs.webkit.org/show_bug.cgi?id=238234 Reviewed by Chris Dumez. Invoke completion handler on early return. * NetworkProcess/storage/NetworkStorageManager.cpp: (WebKit::NetworkStorageManager::suspend): 2022-03-22 Megan Gardner Expand autocorrect context for more accurate results. https://bugs.webkit.org/show_bug.cgi?id=237990 rdar://87353381 Expand autocorrect context to at least 10 words instead of 3, and with a min/max length of 40/100 instead of 12/30 and start context at the beginning of sentences to help with having more accurate autocorrect suggestions. Reviewed by Tim Horton. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::autocorrectionContext): 2022-03-22 Tyler Wilcock Expose the AX tree of PDFs loaded via iframes on the Mac https://bugs.webkit.org/show_bug.cgi?id=238168 Reviewed by Chris Fleizach. Given this markup: