Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a735fd3063f79481584a963d7de114ea0dd2f089
      
https://github.com/WebKit/WebKit/commit/a735fd3063f79481584a963d7de114ea0dd2f089
  Author: Chris Dumez <[email protected]>
  Date:   2026-05-14 (Thu, 14 May 2026)

  Changed paths:
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm

  Log Message:
  -----------
  WKBackForwardList.BackForwardNavigationSkipsItemsWithoutUserGesture* API 
tests are flaky
https://bugs.webkit.org/show_bug.cgi?id=314785
rdar://176046782

Reviewed by Brady Eidson.

The shared helper runBackForwardNavigationSkipsItemsWithoutUserGestureTest
runs ~12 sequential navigations in a single TEST(), and is shared across
three variants (PushState, Fragment, PushStateAfterEvaluateJS). On loaded
bots this exceeds the per-test timeout, producing flaky failures across all
three variants — including failures at the very first loadRequest on a fresh
WKWebView.

A previous attempt (313126@main) added a 10-second inner timeout to each
wait. That made things worse: 10 seconds is too tight for slow bots that
previously recovered within the per-test framework timeout, so the inner
timeout converted slow steps into hard fails rather than catching genuine
hangs.

Reduce per-test work by splitting the helper into a setup function and two
phase checks:
  - Phase 1: the goBack/goForward navigations that verify items without
    user gesture are skipped (idempotent — leaves state unchanged).
  - Phase 2: the JS history.back() navigations that verify the JS API does
    not skip those items (mutating — must run after Phase 1).

Use a templated testing::Test base WKBackForwardListSkipItemsTestBase<navigate>
parameterized by a per-variant navigate function, so the back/forward list
setup is built once via SetUpTestSuite and shared across both phase checks
within the suite. Each variant becomes a one-line subclass with two TEST_F
entries (six tests in total). Gtest registration (source) order ensures
Phase 1 runs before Phase 2 within each suite.

Make the setup more resilient to slow / I/O-saturated bots:
  - Switch from file:// URLs to a custom URL scheme handler serving in-memory
    HTML for a "test://" scheme. Avoids the file scheme handler path in
    NetworkProcess, which can be slow under disk pressure.
  - Share a single WKProcessPool across all fixtures (and across
    --gtest_repeat iterations) so WebProcesses get cached and reused
    instead of cold-launched per WebView.
  - Share a single ephemeral WKWebsiteDataStore so cookies/cache stay in
    memory and we avoid disk I/O entirely.
  - Call _launchInitialProcessIfNecessary right after WKWebView creation
    so the WebProcess launch overlaps with the rest of test setup rather
    than blocking the first loadRequest.

Also restore the unbounded 
waitForDidFinishNavigationOrDidSameDocumentNavigation,
matching what the other tests in this file use, and re-enable
BackForwardNavigationSkipsItemsWithoutUserGestureFragment on macOS.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm:
(-[WKBackForwardNavigationDelegate 
waitForDidFinishNavigationOrDidSameDocumentNavigationWithTimeout:]): Deleted.
(setupBackForwardListWithItemsWithoutUserGesture):
(runBackForwardNavigationSkipsItemsWithoutUserGestureCheck):
(runJSHistoryBackDoesNotSkipItemsWithoutUserGestureCheck):
(pushStateNavigate):
(fragmentNavigate):
(pushStateAfterEvaluateJSNavigate):
(WKBackForwardListSkipItemsTestBase::SetUpTestSuite):
(WKBackForwardListSkipItemsTestBase::TearDownTestSuite):
(TEST_F(WKBackForwardListSkipItemsPushStateTest, 
BackForwardNavigationSkipsItemsWithoutUserGesture)):
(TEST_F(WKBackForwardListSkipItemsPushStateTest, 
JSHistoryBackDoesNotSkipItemsWithoutUserGesture)):
(TEST_F(WKBackForwardListSkipItemsFragmentTest, 
BackForwardNavigationSkipsItemsWithoutUserGesture)):
(TEST_F(WKBackForwardListSkipItemsFragmentTest, 
JSHistoryBackDoesNotSkipItemsWithoutUserGesture)):
(TEST_F(WKBackForwardListSkipItemsPushStateAfterEvaluateJSTest, 
BackForwardNavigationSkipsItemsWithoutUserGesture)):
(TEST_F(WKBackForwardListSkipItemsPushStateAfterEvaluateJSTest, 
JSHistoryBackDoesNotSkipItemsWithoutUserGesture)):

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



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

Reply via email to