Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2cb4a4edf352593c30f835b967a5b3699fefc898
      
https://github.com/WebKit/WebKit/commit/2cb4a4edf352593c30f835b967a5b3699fefc898
  Author: Alejandro G. Castro <[email protected]>
  Date:   2026-10-08 (Thu, 08 Oct 2026)

  Changed paths:
    A 
LayoutTests/inspector/protocol/backend-dispatcher-async-command-errors-expected.txt
    A 
LayoutTests/inspector/protocol/backend-dispatcher-async-command-errors.html
    M Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
    M Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
    M 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
    M 
Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/command-targetType-matching-domain-debuggableType.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/definitions-with-mac-platform.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-debuggableTypes.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-exposed-as-other-name.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetType-matching-domain-debuggableType.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetTypes.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/event-targetType-matching-domain-debuggableType.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result
    M 
Source/JavaScriptCore/inspector/scripts/tests/expected/webdriver-bidi-enum-validation.json-result

  Log Message:
  -----------
  Web Inspector: the error of an async command is sent with the id of the 
command being dispatched
https://bugs.webkit.org/show_bug.cgi?id=326703

Reviewed by Devin Rousso.

Async commands send their errors with reportProtocolError() followed by
sendPendingErrors(). reportProtocolError() only uses the request id it is
given when no request is being dispatched, so when an async command fails
while another command is being dispatched, its error is sent with the id of
that other command, and the async command never gets a response.

This happens with WebDriver when a page closes while a command is waiting on
it: Automation.closeBrowsingContext closes the page, WebAutomationSession::
willClosePage() fails the pending waitForNavigationToComplete with
WindowNotFound, and that error goes out as the response to
closeBrowsingContext. The driver then reports "no such window" for Close
Window, drops the real response as an unknown sequence id, and waits forever
for the navigation, so the command that started it never returns. On WPE for
Android this is one of the causes of whole test files hanging in the W3C
WebDriver tests, and it reproduces every time by navigating a window while
closing it.

Add BackendDispatcher::sendErrorResponse(), which sends a single error with
the given request id without touching the state of the request being
dispatched, and use it for the errors of async commands: in
CallbackBase::sendFailure(), and in the generated C++ and ObjC async command
handlers.

Added a test to verify the issue: 
inspector/protocol/backend-dispatcher-async-command-errors.html

* 
LayoutTests/inspector/protocol/backend-dispatcher-async-command-errors-expected.txt:
 Added.
* LayoutTests/inspector/protocol/backend-dispatcher-async-command-errors.html: 
Added.
* Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp:
(Inspector::BackendDispatcher::CallbackBase::sendFailure):
(Inspector::errorMessageForRequest):
(Inspector::BackendDispatcher::sendPendingErrors):
(Inspector::BackendDispatcher::sendErrorResponse):
* Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h:
* 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
* Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/command-targetType-matching-domain-debuggableType.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/definitions-with-mac-platform.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-debuggableTypes.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-exposed-as-other-name.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetType-matching-domain-debuggableType.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetTypes.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/event-targetType-matching-domain-debuggableType.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
* 
Source/JavaScriptCore/inspector/scripts/tests/expected/webdriver-bidi-enum-validation.json-result:

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



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

Reply via email to