Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec0c999ff89cdce5b1eff2e5c4c7678e62592085
      
https://github.com/WebKit/WebKit/commit/ec0c999ff89cdce5b1eff2e5c4c7678e62592085
  Author: Diego De La Toba <[email protected]>
  Date:   2026-04-13 (Mon, 13 Apr 2026)

  Changed paths:
    M 
LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess-in-background.html
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/MockCDMFactory.cpp
    M Source/WebCore/testing/MockCDMFactory.h

  Log Message:
  -----------
  NEW-TEST: [macOS] 
media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html is a 
constant text failure
rdar://174337907
https://bugs.webkit.org/show_bug.cgi?id=311743

Reviewed by Philippe Normand.

mock-navigator-requestMediaKeySystemAccess.html is flakily failing due to 
preceding tests (in test list)
not doing proper cleanup. The -in-background test is missing mock.unregister() 
at the end of runTest().
So its MockCDMFactory stays registered in the global CDM factory list after the 
test completed. When the
main test ran next in the same WebProcess, there were now two mock factories 
registered - the stale one from
the background test plus the one the main test just created. This caused 
requestMediaKeySystemAccess to behave
differently than expected, producing wrong text output.

Changes made:
Test fix (-in-background.html): Added the missing mock.unregister() call so the 
test
properly cleans up after itself, matching what the main test already does at 
line 26.

Harness-level fix (Internals.cpp + MockCDMFactory.cpp/.h):
Added MockCDMFactory::unregisterAllMockFactories() and hooked it into 
Internals::resetToConsistentState().
This is the function the test harness calls between every test to reset global 
state. Now, even if a test
forgets to call mock.unregister(), all mock factories are automatically cleaned 
up before the next test
begins. This is a static WeakHashSet<MockCDMFactory> that tracks all live 
factory instances and unregisters
them all during reset.

* 
LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess-in-background.html:
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
* Source/WebCore/testing/MockCDMFactory.cpp:
(WebCore::allMockFactories):
(WebCore::MockCDMFactory::unregisterAllMockFactories):
(WebCore::MockCDMFactory::~MockCDMFactory):
* Source/WebCore/testing/MockCDMFactory.h:

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



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

Reply via email to