Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d74b116a2b69cfac711eda9b54f175db32c3afc4
      
https://github.com/WebKit/WebKit/commit/d74b116a2b69cfac711eda9b54f175db32c3afc4
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M LayoutTests/platform/ios-site-isolation/TestExpectations
    M Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
    M Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
    M Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp
    M Source/WebCore/platform/audio/MediaSessionManagerInterface.h
    M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h
    M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm
    M Source/WebKit/WebProcess/Media/RemoteMediaSessionManager.cpp
    M Source/WebKit/WebProcess/Media/RemoteMediaSessionManager.h
    M Tools/TestWebKitAPI/Resources/cocoa/media-session-capture.html
    M 
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/GetDisplayMediaWindowAndScreen.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/GetUserMedia.mm

  Log Message:
  -----------
  [site-isolation] 
fast/mediastream/microphone-interruption-and-audio-session.html is an 
almost-permanent failure
https://bugs.webkit.org/show_bug.cgi?id=320425
rdar://183383148

Reviewed by Eric Carlson.

Under site isolation RemoteMediaSessionManager applies the audio session 
category to the WebContent
process only from an asynchronous IPC reply, so getUserMedia's promise (and the 
track mute/unmute events)
resolved before the category was updated, leaving 
internals.audioSessionCategory() reading a stale value.
Fixed by making updateSessionState() return a GenericPromise that settles once 
the category has been
applied, and gating the getUserMedia resolution and mute/unmute event dispatch 
on it. Audio session
activation and deactivation remain synchronous, so AudioSession::isActive() is 
up to date as soon as
audioCaptureSourceStateChanged() returns.

API tests expected synchronous operations which they can't be when site 
isolation is enabled.
We update those tests to handle the asynchronous operations.

Covered by existing tests.

* LayoutTests/platform/ios-site-isolation/TestExpectations: Unskip the 
now-passing test.
* Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::trackMutedChanged): Defer the mute/unmute event 
until the category is applied.
* Source/WebCore/Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::allow): Resolve the promise once the category is 
applied.
* Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp:
(WebCore::MediaSessionManagerInterface::audioCaptureSourceStateChanged): Return 
a promise that settles once the category has been applied; activation stays 
synchronous.
(WebCore::MediaSessionManagerInterface::updateSessionState):
* Source/WebCore/platform/audio/MediaSessionManagerInterface.h:
* Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h:
* Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::updateSessionState): Return an 
already-resolved promise.
* Source/WebKit/WebProcess/Media/RemoteMediaSessionManager.cpp:
(WebKit::RemoteMediaSessionManager::updateSessionState): Apply the category 
from the IPC reply and settle the returned promise.
* Source/WebKit/WebProcess/Media/RemoteMediaSessionManager.h:
* Tools/TestWebKitAPI/Resources/cocoa/media-session-capture.html:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/GetDisplayMediaWindowAndScreen.mm:
(TestWebKitAPI::armActionState):
(TestWebKitAPI::waitForActionState):
(TestWebKitAPI::TEST(WebKit2, ToggleScreenshare)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/GetUserMedia.mm:
(TestWebKitAPI::armActionState):
(TestWebKitAPI::waitForActionState):
(TestWebKitAPI::(WebKit2, ToggleCameraCaptureWhenRestarting)):
(TestWebKitAPI::(WebKit2, ToggleMicrophoneCaptureWhenRestarting)):

Canonical link: https://commits.webkit.org/318537@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to