Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 763d3d51da9cb47ec02636021caa3536e2b86d9a
https://github.com/WebKit/WebKit/commit/763d3d51da9cb47ec02636021caa3536e2b86d9a
Author: Lauro Moura <[email protected]>
Date: 2026-04-02 (Thu, 02 Apr 2026)
Changed paths:
M Source/WebDriver/Session.cpp
M Source/WebDriver/Session.h
M Source/WebDriver/WebDriverService.cpp
M Source/WebDriver/WebDriverService.h
M Source/WebKit/Sources.txt
A Source/WebKit/UIProcess/Automation/BidiEventNames.h
A Source/WebKit/UIProcess/Automation/BidiSessionAgent.cpp
A Source/WebKit/UIProcess/Automation/BidiSessionAgent.h
M Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
M Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.cpp
M Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.h
M Source/WebKit/UIProcess/Automation/protocol/BidiSession.json
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M WebDriverTests/TestExpectations.json
Log Message:
-----------
[WebDriver][BiDi] Move event subscription inside the browser.
https://bugs.webkit.org/show_bug.cgi?id=295497
Reviewed by BJ Burg.
Moving the implementation from Source/WebDriver into the
UIProcess's Bidi automation code.
Having subscription on the browser will make it easier checking which
events are enabled, especially non-global events, alongside avoiding
excessive message exchange between the browser and driver from the
increasing number of events supported.
For example, as of around 302979@main, without this patch, the Selenium
`api_example_tests.py` alone sends 303 events back to the driver,
despite not enabling any WebDriver-BiDi event. With this patch, all
events are filtered at the browser level.
In this commit, we also replace the Vectors used to track the
subscription fields with HashSets, preparing the way to support
subscriptions by individual browsing contexts. This helped refactor the
unsubscription logic to better match the spec, looping through the
current subscriptions instead of through the individual event names.
This commit also removes the 'context' parameter from
session.unsubscribe, as it was removed from the spec, and simplified the
implementation.
Previously, the context and userContexts parameters to session.subscribe
were ignored. Now, we raised NotImplemented errors, as support for them will be
added in follow up commits. Tests expectations were updated accordingly.
We'll also improve the protocol generator to generate
a helper method that take care of checking whether a given event is
enabled and dispatch it, instead of the current
eventIsEnabled()+dispatch procedure. It can also generate the list of
event names, which is currently manually kept.
* Source/WebDriver/Session.cpp:
(WebDriver::Session::dispatchBidiMessage):
(WebDriver::Session::eventIsEnabled): Deleted.
(WebDriver::Session::subscribeForEvents): Deleted.
(WebDriver::Session::unsubscribeByIDs): Deleted.
(WebDriver::Session::unsubscribeByEventName): Deleted.
* Source/WebDriver/Session.h:
(WebDriver::EventSubscription::isGlobal const): Deleted.
* Source/WebDriver/WebDriverService.cpp:
(WebDriver::WebDriverService::bidiSessionSubscribe): Deleted.
(WebDriver::WebDriverService::bidiSessionUnsubscribe): Deleted.
* Source/WebDriver/WebDriverService.h:
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/Automation/BidiEventNames.h: Added.
* Source/WebKit/UIProcess/Automation/BidiSessionAgent.cpp: Added.
(WebKit::BidiSessionAgent::BidiSessionAgent):
(WebKit::BidiSessionAgent::subscribe):
(WebKit::BidiSessionAgent::unsubscribeByEventName):
(WebKit::BidiSessionAgent::unsubscribe):
(WebKit::BidiSessionAgent::eventIsEnabled):
* Source/WebKit/UIProcess/Automation/BidiSessionAgent.h: Added.
(WebKit::BidiEventSubscription::isGlobal const):
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::willShowJavaScriptDialog):
(WebKit::WebAutomationSession::documentLoadedForFrame):
(WebKit::WebAutomationSession::loadCompletedForFrame):
(WebKit::WebAutomationSession::navigationStartedForFrame):
(WebKit::WebAutomationSession::navigationCommittedForFrame):
(WebKit::WebAutomationSession::navigationFailedForFrame):
(WebKit::WebAutomationSession::navigationAbortedForFrame):
(WebKit::WebAutomationSession::fragmentNavigatedForFrame):
(WebKit::WebAutomationSession::contextCreatedForFrame):
(WebKit::WebAutomationSession::recursivelyEmitContextCreatedEvent):
(WebKit::WebAutomationSession::contextDestroyedForPage):
(WebKit::WebAutomationSession::contextDestroyedForFrame):
(WebKit::WebAutomationSession::dismissCurrentJavaScriptDialog):
(WebKit::WebAutomationSession::acceptCurrentJavaScriptDialog):
(WebKit::WebAutomationSession::logEntryAdded):
* Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.cpp:
(WebKit::WebDriverBidiProcessor::WebDriverBidiProcessor):
(WebKit::WebDriverBidiProcessor::eventIsEnabled):
(WebKit::WebDriverBidiProcessor::emitEventIfEnabled):
* Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.h:
* Source/WebKit/UIProcess/Automation/protocol/BidiSession.json:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* WebDriverTests/TestExpectations.json:
Canonical link: https://commits.webkit.org/310494@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications