Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d058de4fcb0ca270323b9bd0d7a066646928175f
      
https://github.com/WebKit/WebKit/commit/d058de4fcb0ca270323b9bd0d7a066646928175f
  Author: Chris Dumez <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp
    M Tools/TestWebKitAPI/CMakeLists.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebCore/PlatformMediaSessionManagerTests.cpp

  Log Message:
  -----------
  MediaSessionManagerInterface::sessionWillEndPlayback reorders a copy of the 
session set
https://bugs.webkit.org/show_bug.cgi?id=320629

Reviewed by Eric Carlson.

sessionWillEndPlayback() intends to demote the just-paused session behind the
first already-paused session (or to the end of the list) so that the front of
m_sessions keeps pointing at a still-playing session. It did this via:
```
      auto sessions = this->sessions();
```
sessions() returns WeakListHashSet<PlatformMediaSessionInterface>&, but the
missing reference means auto deduces a value and copies the set. The subsequent
remove()/insertBefore()/appendOrMoveToLast() calls therefore mutate a throwaway
copy, and the live m_sessions ordering is never updated. As a result
currentSession() (which returns m_sessions.first()) can keep returning the
session that just paused instead of the one that should take over, which in turn
feeds the wrong value into computeSupportsSeeking() and the now-playing / remote
command routing that depend on session order.

Fix it by taking a reference to the live set, and add an API test covering the
ordering after a pause.

Test: Tools/TestWebKitAPI/Tests/WebCore/PlatformMediaSessionManagerTests.cpp

* Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp:
(WebCore::MediaSessionManagerInterface::sessionWillEndPlayback):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/PlatformMediaSessionManagerTests.cpp: Added.
(TestWebKitAPI::TEST(PlatformMediaSessionManager, 
PausingFrontSessionDemotesItInCurrentSession)):

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



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

Reply via email to