[webkit-changes] [WebKit/WebKit] 79271e: [WebDriver][WPE] Allow reconnections while keeping...
Lauro Moura
noreply at github.com
Tue Aug 20 07:08:49 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 79271e75c2fec165d6badfa191b6b9a6edeee611
https://github.com/WebKit/WebKit/commit/79271e75c2fec165d6badfa191b6b9a6edeee611
Author: Lauro Moura <lmoura at igalia.com>
Date: 2024-08-20 (Tue, 20 Aug 2024)
Changed paths:
M Source/WebDriver/Session.cpp
M Source/WebDriver/SessionHost.cpp
M Source/WebDriver/SessionHost.h
M Source/WebDriver/glib/SessionHostGlib.cpp
M Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp
M Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
M Source/WebKit/UIProcess/Automation/Automation.json
M Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
M Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Log Message:
-----------
[WebDriver][WPE] Allow reconnections while keeping the view open
https://bugs.webkit.org/show_bug.cgi?id=277341
Reviewed by Carlos Garcia Campos.
Currently, when we close a session, all open windows are unconditionally
closed, while the spec[1] says it's optional. Allowing the window to
remain open might be interesting when we connect to an already running
browser, another scenario covered by the WebDriver spec[2] and supported
by WPEWebKit.
For the record, while the usual practice is to let the WebDriver service
manage the browser lifetime, in some cases we might want to start the
browser in a more controlled way, for example, to enable
profiling/debugging, loading a heavy page beforehand, etc.
To allow deleting a session and keep the windows open, this commit adds
a new `Automation.json` command, "deleteSession", which makes the
UIProcess terminate the automation session and thus the RemoteInspector
connection between the UIProcess and the WebDriver service. This command
also serves as a fallback if somehow the browser fails to close all
windows.
On the browser-level API, this commit also adds a new signal,
`WebKitAutomationSession::will-close` to notify the browser that the
WebDriver client disconnected, and the browser is free to either kill or
keep the view open for new sessions as required.
[1] https://w3c.github.io/webdriver/#dfn-close-the-session (Step 3.5)
[2] https://w3c.github.io/webdriver/#new-session (Step 8 note)
* Source/WebDriver/Session.cpp:
(WebDriver::Session::close): Only close windows for non-remote sessions
and issue the new "deleteSession" automation command.
* Source/WebDriver/SessionHost.cpp:
(WebDriver::SessionHost::isRemoteBrowser const): Added
* Source/WebDriver/SessionHost.h: Ditto
* Source/WebDriver/glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::connectionDidClose): If we lost connection to a
non-remote (i.e. managed) browser, kill it.
(WebDriver::SessionHost::setTargetList): Check for empty target list.
(WebDriver::SessionHost::isRemoteBrowser const): Added
* Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp:
(webkit_automation_session_class_init): Add new "will-close" signal
* Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextWillCloseAutomationSession): Emit the new signal
* Source/WebKit/UIProcess/Automation/Automation.json: Added
"deleteSession" command.
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::deleteSession): Implemented by requesting
to terminate the connection between the WebDriver service and the
browser.
* Source/WebKit/UIProcess/Automation/WebAutomationSession.h: Ditto.
Canonical link: https://commits.webkit.org/282489@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list