Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4cdafb42e29d0fd7e0c21da6808c131d68c4bba2
https://github.com/WebKit/WebKit/commit/4cdafb42e29d0fd7e0c21da6808c131d68c4bba2
Author: Jean-Yves Avenard <[email protected]>
Date: 2026-08-07 (Fri, 07 Aug 2026)
Changed paths:
M LayoutTests/http/tests/webrtc/audioSessionInFrames.html
M LayoutTests/platform/ios-site-isolation/TestExpectations
M LayoutTests/platform/mac-site-isolation/TestExpectations
M Source/WebCore/Modules/audiosession/DOMAudioSession.cpp
M Source/WebCore/Modules/audiosession/DOMAudioSession.h
M Source/WebCore/Modules/audiosession/NavigatorAudioSession.cpp
M Source/WebCore/Modules/audiosession/NavigatorAudioSession.h
M Source/WebCore/dom/Document.cpp
M Source/WebCore/page/DocumentSyncData.in
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp
M Source/WebKit/Shared/WebCoreArgumentCodersMedia.serialization.in
M Source/WebKit/Shared/WebPageCreationParameters.h
M Source/WebKit/Shared/WebPageCreationParameters.serialization.in
M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
M Source/WebKit/UIProcess/RemotePageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Tools/TestWebKitAPI/Resources/getUserMedia.html
M Tools/TestWebKitAPI/SourcesCocoa.txt
Log Message:
-----------
[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
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications