[webkit-changes] [WebKit/WebKit] bc2351: [WebDriver] Add support for bidi session
Lauro Moura
noreply at github.com
Thu Oct 17 18:53:22 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bc2351a5f32bf1139b458277a3c4cbd0ccc71322
https://github.com/WebKit/WebKit/commit/bc2351a5f32bf1139b458277a3c4cbd0ccc71322
Author: Lauro Moura <lmoura at igalia.com>
Date: 2024-10-17 (Thu, 17 Oct 2024)
Changed paths:
M Source/WebDriver/CMakeLists.txt
M Source/WebDriver/CommandResult.cpp
M Source/WebDriver/CommandResult.h
M Source/WebDriver/HTTPServer.h
M Source/WebDriver/PlatformWPE.cmake
M Source/WebDriver/Session.cpp
M Source/WebDriver/Session.h
M Source/WebDriver/SessionHost.cpp
M Source/WebDriver/SessionHost.h
M Source/WebDriver/WebDriverService.cpp
M Source/WebDriver/WebDriverService.h
A Source/WebDriver/WebSocketServer.cpp
A Source/WebDriver/WebSocketServer.h
M Source/WebDriver/glib/WebDriverServiceGLib.cpp
M Source/WebDriver/soup/HTTPServerSoup.cpp
A Source/WebDriver/soup/WebSocketServerSoup.cpp
M Source/cmake/WebKitFeatures.cmake
Log Message:
-----------
[WebDriver] Add support for bidi session
https://bugs.webkit.org/show_bug.cgi?id=230615
Reviewed by Carlos Garcia Campos and BJ Burg.
Laying out the groundwork for BiDi support. This commit adds a
"ENABLE_WEBDRIVER_BIDI" cmake build option to use it. When enabled,
`WPEWebDriver` will spawn the libsoup3 implementation of the new
WebSocketServer in parallel to the HTTPServer of WebDriver classic.
We also added a `visibleHost` method to the HTTPServer so we can
properly build the right WebSocket URL that WPEWebDriver will forward
to the classic session. This URL is used by the webdriver client library
to connect to the right WebSocketServer address.
With this commit, we can create bidi-ready sessions using client
libraries like Selenium or WPT's wdclient, even though without support
for actual BiDi commands/events at this point.
In a future commit, we'll add actual bidi features support, like
events, starting with basic console.log messages.
* Source/WebDriver/CMakeLists.txt: Add new file.
* Source/WebDriver/CommandResult.cpp:
(WebDriver::CommandResult::httpStatusCode const): Calling new function
below.
(WebDriver::CommandResult::errorCodeToHTTPStatusCode): Added.
* Source/WebDriver/CommandResult.h:
* Source/WebDriver/HTTPServer.h:
(WebDriver::HTTPServer::visibleHost const): Added.
* Source/WebDriver/PlatformWPE.cmake: Add new file.
* Source/WebDriver/Session.cpp:
(WebDriver::Session::Session): Added new constructor with reference to
the BiDi server.
(WebDriver::Session::~Session): Notify the bidi server of the classic
session closure.
* Source/WebDriver/Session.h:
(WebDriver::Session::create): Added.
(WebDriver::Session::hasBiDiEnabled const): Added.
(WebDriver::Session::setHasBiDiEnabled): Added.
* Source/WebDriver/SessionHost.cpp:
(WebDriver::browserTerminatedObservers): Added, so we can close the
WebSocket connection when the browser is terminated.
(WebDriver::SessionHost::inspectorDisconnected): Notify of browser
closure.
(WebDriver::SessionHost::addBrowserTerminatedObserver): Added.
* Source/WebDriver/SessionHost.h:
* Source/WebDriver/WebDriverService.cpp:
(WebDriver::WebDriverService::WebDriverService): Instantiate BiDi server
and browser killed observer.
(WebDriver::printUsageStatement):
(WebDriver::WebDriverService::run): Parse new param and instantiate
server.
(WebDriver::WebDriverService::acceptHandshake): Handle platform-agnostic
handshake algorithm steps
(WebDriver::WebDriverService::handleMessage): Placeholder, to be
implement in a future commit.
(WebDriver::WebDriverService::connectToBrowser): Add observer
(WebDriver::WebDriverService::createSession): Run extra bidi step when
creating new classic sessions
(WebDriver::WebDriverService::deleteSession): Also close BiDi session on
classic session closure.
(WebDriver::WebDriverService::clientDisconnected): Implement spec steps.
(WebDriver::WebDriverService::onBrowserTerminated): Disconnect BiDi session.
* Source/WebDriver/WebDriverService.h:
* Source/WebDriver/WebSocketServer.cpp: Added, with platform-independent
functions.
* Source/WebDriver/WebSocketServer.h: Added.
* Source/WebDriver/glib/WebDriverServiceGLib.cpp:
(WebDriver::WebDriverService::platformSupportBidi const):
* Source/WebDriver/soup/HTTPServerSoup.cpp:
(WebDriver::HTTPServer::listen): Save visible IP for BiDi URL
* Source/WebDriver/soup/WebSocketServerSoup.cpp: Added.
* Source/cmake/WebKitFeatures.cmake: Expose ENABLE_WEBDRIVER_BIDI
Canonical link: https://commits.webkit.org/285374@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