Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1fb66e16eddacd6ead9e4c01ba6b01b647a3709d
      
https://github.com/WebKit/WebKit/commit/1fb66e16eddacd6ead9e4c01ba6b01b647a3709d
  Author: Basuke Suzuki <[email protected]>
  Date:   2026-07-21 (Tue, 21 Jul 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/webtransport/back-forward-cache-with-closed-webtransport-connection.https.window-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/webtransport/back-forward-cache-with-open-webtransport-connection.https.window-expected.txt
    M Source/WebCore/Modules/webtransport/WebTransport.cpp
    M Source/WebCore/Modules/webtransport/WebTransport.h
    M Tools/TestRunnerShared/TestFeatures.cpp

  Log Message:
  -----------
  [WebTransport] WebTransport pages should be restorable from the back/forward 
cache
https://bugs.webkit.org/show_bug.cgi?id=319915
rdar://172715074

Reviewed by Alex Christensen.

Two WPT tests for WebTransport back/forward cache behavior were skipped and 
never actually
exercised the feature:

- back-forward-cache-with-open-webtransport-connection.https.window
- back-forward-cache-with-closed-webtransport-connection.https.window

There were two root causes:

1. WebKitTestRunner's shouldUseBackForwardCache() only enabled the 
UsesBackForwardCache
preference for the navigation-api/ and websockets/back-forward-cache test 
paths, not
webtransport/back-forward-cache. The WebTransport test windows therefore ran 
with the
back/forward cache disabled, so the page was never cached and the tests 
reported the
assert_implements_optional precondition failure "BFCache not supported".

2. WebTransport::cleanupContext() queued the closed/ready promise rejection with
ScriptExecutionContext::postTask(), which is not a suspendable event-loop task. 
When invoked
from suspend() during back/forward cache entry, that task ran after the frame 
was detached,
when the script execution context has no global object, so cleanup() 
early-returned and
silently dropped the rejection. As a result WebTransport.closed never settled 
after the page
was restored from the back/forward cache; a page with an open WebTransport 
connection would
leave closed pending forever after restore.

Enable the preference for the webtransport/back-forward-cache test path, and 
queue the cleanup
on the event loop (queueTaskKeepingObjectAlive, TaskSource::Networking) instead 
of
ScriptExecutionContext::postTask. This keeps the asynchronous "queue a network 
task" of the
context cleanup steps (WebTransport spec section 6.7) while ensuring the task 
is held during
suspension and runs on resume, when the global object is valid again, so closed 
rejects after
the page is restored. The now-unused ScriptExecutionContext& parameter is 
removed.

Covered by the two now-unskipped WPT tests rebaselined below.

* LayoutTests/TestExpectations: Unskip the two tests.
* 
LayoutTests/imported/w3c/web-platform-tests/webtransport/back-forward-cache-with-closed-webtransport-connection.https.window-expected.txt:
 Rebaseline to PASS.
* 
LayoutTests/imported/w3c/web-platform-tests/webtransport/back-forward-cache-with-open-webtransport-connection.https.window-expected.txt:
 Rebaseline to PASS.
* Source/WebCore/Modules/webtransport/WebTransport.cpp:
(WebCore::WebTransport::suspend):
(WebCore::WebTransport::cleanupContext):
* Source/WebCore/Modules/webtransport/WebTransport.h:
* Tools/TestRunnerShared/TestFeatures.cpp:
(WTR::shouldUseBackForwardCache):

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



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

Reply via email to