[webkit-changes] [WebKit/WebKit] 9948a5: Ensuring initialization of `CaptionUserPreferences...

Kohei Ueno noreply at github.com
Wed Oct 18 01:17:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9948a5b7f3736753adf75857450b9a518806f501
      https://github.com/WebKit/WebKit/commit/9948a5b7f3736753adf75857450b9a518806f501
  Author: Kohei Ueno <kohei.ueno119 at gmail.com>
  Date:   2023-10-18 (Wed, 18 Oct 2023)

  Changed paths:
    A Source/WebKit/Shared/API/APICaptionUserPreferencesTestingModeToken.h
    M Source/WebKit/Shared/API/APIObject.h
    M Source/WebKit/Shared/API/c/WKBase.h
    M Source/WebKit/UIProcess/API/C/WKAPICast.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
    M Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h
    M Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
    M Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h

  Log Message:
  -----------
  Ensuring initialization of `CaptionUserPreferencesTestingModeToken` before setting caption mode
https://bugs.webkit.org/show_bug.cgi?id=262680

Reviewed by Eric Carlson.

The `captionDisplayMode` option was introduced in
https://bugs.webkit.org/show_bug.cgi?id=261460 (PR:
https://github.com/WebKit/WebKit/pull/17689). However,
when I attempted to import WPT for webvtt/parsing with
`captionDisplayMode` setting enabled, I found that the
tests were failing intermittently on ios-wk2 (example:
https://github.com/WebKit/WebKit/pull/17852#issuecomment-1723066317).

The flakiness of these tests appears to be due to the fact
that the `CaptionUserPreferencesTestingModeToken` instance
may not always be initialized before the caption mode is
set (https://github.com/WebKit/WebKit/blob/659f85098cf4322282a775cbd51eb58a4ed34022/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp#L583).
This instance is usually initialized on the `Internals`
class's constructor during the WebKitTestRunner setup
(https://github.com/WebKit/WebKit/blob/659f85098cf4322282a775cbd51eb58a4ed34022/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp#L888).
In most cases, the `CaptionUserPreferencesTestingModeToken`
instance is created in the `Internals` class constructor
before `WKBundlePageSetCaptionDisplayMode` is called, but
there are instances where it is not, particularly when tests
are run concurrently. This leads to the tests failing.

To address this issue, the WebKitTestRunner needs to ensure
that the `CaptionUserPreferencesTestingModeToken` instance
is always initialized before `WKBundlePageSetCaptionDisplayMode`
is called, thus eliminating the flakiness of the tests.

* Source/WebKit/Shared/API/APICaptionUserPreferencesTestingModeToken.h: Added.
(API::CaptionUserPreferencesTestingModeToken::create):
(API::CaptionUserPreferencesTestingModeToken::CaptionUserPreferencesTestingModeToken):
* Source/WebKit/Shared/API/APIObject.h:
* Source/WebKit/Shared/API/c/WKBase.h:
* Source/WebKit/UIProcess/API/C/WKAPICast.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageSetCaptionDisplayMode):
(WKBundlePageCreateCaptionUserPreferencesTestingModeToken):
(WKBundleSetCaptionDisplayMode): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h:

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




More information about the webkit-changes mailing list