[site-isolation] http/tests/webrtc/audioSessionInFrames.html is a permanent failure https://bugs.webkit.org/show_bug.cgi?id=321166 rdar://184204754 Reviewed by Eric Carlson. This test exposed four separate issues. 1) navigator.audioSession.type read "auto" in a cross-site iframe: a WebContent process joining an existing page never received the top document's DocumentSyncData. The broadcast on change only reached processes that already hosted the page, and RemotePageParameters carried the main document URL but no sync data, so the iframe's Page kept a default-constructed DocumentSyncData. 100% failure whenever the iframe was site-isolated into its own process. 2) navigator.audioSession.state read "inactive" there: the DOM audio session state was not page-scoped, so a passive iframe process consulted its own RemoteAudioSession, which never activated. RemoteAudioSessionConfiguration::isActive was that process's own activation request, and the GPU process only pushed ConfigurationChanged for mute, buffer size and sample rate. Also 100% failure once 1) was fixed. 3) getUserMedia resolved once the audio session category had been applied but before the activation completed, so JS reading state right after the await could see "inactive" in any configuration. 45% failure without site isolation. 4) The test only started listening for the frame's message after waiting for the frame to load. With the frame in another process, the message and the load notification travelled as separate IPCs, so a message that arrived first was dropped and the test waited forever. 8% of runs, reported as a timeout. DocumentSyncData is now sent in the remote page creation parameters and adopted by pages that do not host the local main frame, and the audio session state joins it as a synchronized, page-scoped value that remote-frame processes read and dispatch statechange from. For 3), audioCaptureSourceStateChanged() returns GenericPromise::all() of the category and the activation, so waiters (the getUserMedia promise, the track mute/unmute events) see a session that is both categorised and active; activation is still requested synchronously, so callers that do not wait keep observing AudioSession::isActive() immediately, as 318537@main requires. The test now starts listening for the message before it creates the frame. * LayoutTests/http/tests/webrtc/audioSessionInFrames.html: Listen for the frame's message before creating the frame. * LayoutTests/platform/ios-site-isolation/TestExpectations: Unskip the now-passing test. * LayoutTests/platform/mac-site-isolation/TestExpectations: Ditto. * Source/WebCore/Modules/audiosession/DOMAudioSession.cpp: (WebCore::DOMAudioSession::state const): Use the effective state. (WebCore::DOMAudioSession::currentState const): Read the synchronized state when the page has no local main frame, otherwise compute it and publish it from the top document. (WebCore::DOMAudioSession::topDocumentAudioSessionStateChanged): Schedule a statechange event for a state computed in another process. (WebCore::DOMAudioSession::scheduleStateChangeEvent): Capture the effective state. * Source/WebCore/Modules/audiosession/DOMAudioSession.h: * Source/WebCore/Modules/audiosession/NavigatorAudioSession.cpp: (WebCore::NavigatorAudioSession::audioSessionIfExists): Added; does not provision the supplement. * Source/WebCore/Modules/audiosession/NavigatorAudioSession.h: * Source/WebCore/dom/Document.cpp: (WebCore::Document::populateDocumentSyncDataForNewlyConstructedDocument): Handle the new data type. * Source/WebCore/page/DocumentSyncData.in: Add AudioSessionState. * Source/WebCore/page/Page.cpp: (WebCore::Page::setAudioSessionState): Store and broadcast the page's audio session state. (WebCore::Page::audioSessionState const): (WebCore::Page::updateTopDocumentSyncData): Notify existing DOMAudioSession objects when the synchronized state changes. * Source/WebCore/page/Page.h: * Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp: (WebCore::MediaSessionManagerInterface::audioCaptureSourceStateChanged): Return a promise covering both the category and the activation; keep requesting activation synchronously. * Source/WebKit/Shared/WebCoreArgumentCodersMedia.serialization.in: Declare DOMAudioSessionState for IPC. * Source/WebKit/Shared/WebPageCreationParameters.h: * Source/WebKit/Shared/WebPageCreationParameters.serialization.in: Carry the top document's DocumentSyncData in RemotePageParameters. * Source/WebKit/UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::initializeWebPage): Send fresh sync data; the provisional page commits a new top document. * Source/WebKit/UIProcess/RemotePageProxy.cpp: (WebKit::RemotePageProxy::injectPageIntoNewProcess): Send the current sync data. (WebKit::RemotePageProxy::setDrawingArea): Ditto. * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::topDocumentSyncData const): Added. * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::m_allowsImmersiveEnvironments): * Tools/TestWebKitAPI/Resources/getUserMedia.html: Wait for the getUserMedia promise to resolved before calling stop(). * Tools/TestWebKitAPI/SourcesCocoa.txt: Added missing file so API test gets compiled. Canonical link: https://commits.webkit.org/318776@main
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, Apple Books, and many other applications. For more information about WebKit, see the WebKit project website.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
Run the following command to clone WebKit's Git repository:
git clone https://github.com/WebKit/WebKit.git WebKit
You can enable git fsmonitor to make many git commands faster (such as git status) with git config core.fsmonitor true
Install Xcode and its command line tools if you haven't done so already:
xcode-select --installxcodebuild -downloadComponent MetalToolchainRun the following command to build a macOS debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release instead. If you also need debug symbols (dSYMs), run:
Tools/Scripts/build-webkit --release DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
To build for an embedded platform like iOS, tvOS, or watchOS, pass a platform argument to build-webkit.
For example, to build a debug build with debugging symbols and assertions for embedded simulators:
Tools/Scripts/build-webkit --debug --<platform>-simulator
or embedded devices:
Tools/Scripts/build-webkit --debug --<platform>-device
where platform is ios, tvos or watchos.
You can open WebKit.xcworkspace to build and debug WebKit within Xcode. Select the “Everything up to WebKit + Tools” scheme to build the entire project.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild for both Products and Intermediates.
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the WebKit on Windows page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari script sets the DYLD_FRAMEWORK_PATH environment variable to point to your build products, and then launches /Applications/Safari.app. DYLD_FRAMEWORK_PATH tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release instead of --debug.
To run other applications, for example MobileMiniBrowser, with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app --debug --iphone-simulator <application-path>
Open WebKit.xcworkspace, select intended scheme such as MobileMiniBrowser and an iOS simulator as target, click run.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk, --jsc-only, or --wpe to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.