Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d37826b37420741e752448e5d2cbab0f37a21130
https://github.com/WebKit/WebKit/commit/d37826b37420741e752448e5d2cbab0f37a21130
Author: Lauro Moura <[email protected]>
Date: 2026-09-15 (Tue, 15 Sep 2026)
Changed paths:
M Source/WebDriver/SessionHost.cpp
M Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
M Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Log Message:
-----------
[WebDriver] waitForNavigationToComplete callbacks might be lost in concurrent
commands
https://bugs.webkit.org/show_bug.cgi?id=323447
Reviewed by BJ Burg.
Currently, in assertion-less builds, an existing navigation wait
callback can get silently dropped, replaced by a new incoming one. This
in turn can end up making the client wait indefinitely for the original
callback's reply.
While properly enqueueing WebDriverClassic commands would avoid this
issue (bug323444) on this front, this can still happen when
WebDriverBiDi is used, for example. (e.g. WebDriverBiDi navigates a
target, setting the wait callback, and while it is not fulfilled, an
incoming classic command arrives and waits for navigation to complete).
This commit addresses this by storing all pending navigations for a
given target in a vector, so each one of them can be fulfilled when the
navigation reaches the expected stage (eager/normal), or rejected if
the target is destroyed.
This commit also fixes an error where a loop was using the ASYNC_FAIL
macros for error reportning. These macros are supposed to be "bail out"
macros, so in practice it was returning early from the function on the
first iteration.
Note that this still leaves the current WebAutomationSession limitation
of using a single load timer across all waits, but this will be
addressed in bug323980. The only timer-related change was removing the
assertion when adding new callbacks, as this is now supported.
* Source/WebDriver/SessionHost.cpp:
(WebDriver::SessionHost::dispatchMessage):
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::didDestroyFrame):
(WebKit::addPendingNavigationCallback):
(WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
(WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
(WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout):
(WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout):
(WebKit::WebAutomationSession::respondToPendingNavigationCallbacksWithSuccess):
(WebKit::WebAutomationSession::navigationOccurredForFrame):
(WebKit::WebAutomationSession::documentLoadedForFrame):
(WebKit::WebAutomationSession::willClosePage):
* Source/WebKit/UIProcess/Automation/WebAutomationSession.h:
Canonical link: https://commits.webkit.org/321165@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications