Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9d4b276bf1295e00cbf0b9c83ac3970c0b239c3a
https://github.com/WebKit/WebKit/commit/9d4b276bf1295e00cbf0b9c83ac3970c0b239c3a
Author: Lauro Moura <[email protected]>
Date: 2026-02-28 (Sat, 28 Feb 2026)
Changed paths:
M Source/WebDriver/Session.cpp
M Source/WebDriver/Session.h
M Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
M WebDriverTests/TestExpectations.json
Log Message:
-----------
REGRESSION(306469@main) [WebDriver] Fix browsing context state tracking after
waitForNavigationToComplete returns WindowNotFound for frames
https://bugs.webkit.org/show_bug.cgi?id=308571
Reviewed by BJ Burg.
306469@main correctly changed most automation methods to return
WindowNotFound when we have a stale frame handle, as expected by the
spec.
This included the Automation.waitForNavigationToComplete on the browser
side, which is used by WebDriver::Session::waitForNavigationToComplete
to update its internal current browsing context state. The problem is
that it relied on the browser returning WindowNotFound or FrameNotFound,
as it was the case before 306469@main.
As Automation.waitForNavigationToComplete now returns only
WindowNotFound, the driver thinks that the entire window was destroyed,
and not just the original frame. This could lead to unexpected
NoSuchWindow errors on the clients instead of the expected NoSuchFrame.
To fix this, before waiting for the navigation, we validate the browsing
context handles with Automation.resolveBrowsingContext, updating the
context state accordingly.
Note that this reverts resolveBrowsingContext to its pre 306469@main
behavior, returning FrameNotFound for deleted frames. This matches its
original intent and documentation.
Covered by existing tests.
* Source/WebDriver/Session.cpp:
(WebDriver::Session::clearBrowsingContextsOnError):
(WebDriver::Session::waitForNavigationToComplete):
* Source/WebDriver/Session.h:
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::resolveBrowsingContext):
* WebDriverTests/TestExpectations.json:
Canonical link: https://commits.webkit.org/308405@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications