Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 20fa2504d9b7c8f3779941ef1953192850c67705
      
https://github.com/WebKit/WebKit/commit/20fa2504d9b7c8f3779941ef1953192850c67705
  Author: Lauro Moura <[email protected]>
  Date:   2025-06-11 (Wed, 11 Jun 2025)

  Changed paths:
    M Source/JavaScriptCore/inspector/remote/RemoteInspector.h
    M Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp
    M Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorServer.cpp
    M Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp

  Log Message:
  -----------
  [WebDriver][GLIB] Notify automation session on abnormal disconnections from 
the browser
https://bugs.webkit.org/show_bug.cgi?id=294044

Reviewed by Carlos Garcia Campos.

Currently, an automation session is just cleared up on normal
disconnections through `WebAutomationSession::terminate()`. This method
notifies the WebKitWebContext to make its WebKitAutomationSession emit
the "will-close" signal, allowing the browser to clean up resources,
alongside releasing the automation session reference. This signal was
added in 282489@main.

In unclean terminations, like a driver crash or failure to setup
capabilities, the session currently is left open, as this code path is
not hit.

This brings problems when we're connecting to a running browser (common
scenario when working with less powerful boards). In this case,
WebKitAutomationSession/WebKitWebContext are not notified of the
connection closure and we might get an inconsistent automation state
despite a successful initial connection. For example, if assertions are
disabled, we end up with no error messages until trying to create the
first browsing context reference, where we get the generic "Failed to
create a browsing context" message.

This commits addresses this issue by making the RemoteInspectorServer
notify the RemoteInspector of the connection closure, which in turn
notifies the WebKitWebContext client, ensuring "will-close" gets called.

With this, the browser is able to recover and make new incoming sessions
work normally.

* Source/JavaScriptCore/inspector/remote/RemoteInspector.h: Expose
  `closeAutomationSession` to GLIB client and add new
  automationConnectionDidClose Inspector method.
* Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp:
(Inspector::RemoteInspector::automationConnectionDidClose): call new
client method.
* Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorServer.cpp:
(Inspector::RemoteInspectorServer::connectionDidClose): Notify
inspector that the automation connection was closed.
* Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:
(WebKitAutomationClient::requestAutomationSession): Replace assert with
a g_critical, so release builds can notify a double attempt to connect.
(webkitWebContextWillCloseAutomationSession): Check for session presence
before trying to emit the signal.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to