Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5f0f237529e13e34275420ae27e1a3e029d56c7f
      
https://github.com/WebKit/WebKit/commit/5f0f237529e13e34275420ae27e1a3e029d56c7f
  Author: BJ Burg <[email protected]>
  Date:   2025-02-18 (Tue, 18 Feb 2025)

  Changed paths:
    M 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py
    M 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
    M 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py
    M 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py
    M 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
    M Source/JavaScriptCore/inspector/scripts/codegen/models.py
    M 
Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
    M Source/WTF/wtf/PlatformEnableCocoa.h
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebKit/CMakeLists.txt
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources-output.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/SaferCPPExpectations/MemoryUnsafeCastCheckerExpectations
    M Source/WebKit/SaferCPPExpectations/NoUncountedMemberCheckerExpectations
    M Source/WebKit/SaferCPPExpectations/UncountedCallArgsCheckerExpectations
    M Source/WebKit/Sources.txt
    M Source/WebKit/UIProcess/Automation/Automation.json
    M Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
    M Source/WebKit/UIProcess/Automation/WebAutomationSession.h
    A Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.cpp
    A Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.h
    A Source/WebKit/UIProcess/Automation/protocol/BidiBrowser.json
    A Source/WebKit/UIProcess/Automation/protocol/BidiBrowsingContext.json
    A Source/WebKit/UIProcess/Automation/protocol/BidiLog.json
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  Web Automation: generate WebDriver BiDi protocol backend dispatchers from 
JSON input files
https://bugs.webkit.org/show_bug.cgi?id=284322
<rdar://136766847>

Reviewed by Devin Rousso and Patrick Angle.

This change introduces two domain specifications for WebDriver BiDi and hooks up
the protocol code generator to produce C++ backend dispatchers for each domain.
Previously, Automation.json was used to produce an Automation protocol 
dispatcher.
To support WebDriver BiDi's concept of multiple domains, we take an approach 
similar
to Web Inspector: combine all the domain definitions into one big JSON file and
call the code generator. Introduce a new class called WebDriverBidiProcessor 
which
dispatches WebDriver BiDi messages to the available backend domain dispatchers.

In order to interoperate within the existing Automation protocol, we take the 
nested approach
of adding a command and event to Automation protocol for WebDriverBidi message 
send/receive.
On the driver side, delivery of the message from Automation.bidiMessageSent to 
the client is further
mediated by an event publish/subscribe mechanism that matches expected 
semantics of WebDriver BiDi.

We do not try to handle event pub/sub from UIProcess, as these 
subscribe/unsubscribe requests can
come in from a session client prior to a browser being launched. Secondly, 
pub/sub state is per-client
connection, rather than per-session, so this cannot really be mediated from 
UIProcess.

* Source/WTF/wtf/PlatformEnableCocoa.h: Define ENABLE_WEBDRIVER_BIDI for Cocoa 
ports.

* Source/WebKit/DerivedSources.make:
For the most part, we can copy the approach taken to generate Inspector 
Protocol files.

* 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
(CppBackendDispatcherHeaderGenerator._generate_secondary_header_includes):
* 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
(CppBackendDispatcherImplementationGenerator._generate_secondary_header_includes):
* 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator._generate_secondary_header_includes):
* Source/JavaScriptCore/inspector/scripts/codegen/models.py:
(Framework.fromString):
(Frameworks):
* 
Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py:
(generate_from_specification):
Add a new target pseudo-framework called 'WebDriverBidi' which will be used to 
generate WebDriver BiDi
protocol code.

* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources-output.xcfilelist:
Add new files.

* Source/WebKit/UIProcess/Automation/protocol/BidiBrowser.json:
* Source/WebKit/UIProcess/Automation/protocol/BidiBrowsingContext.json:
Added, let's start with Browser.close and BrowsingContext.navigate to flesh 
things out.

* Source/WebKit/UIProcess/Automation/WebAutomationSession.h:
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::WebAutomationSession): Create a Bidi dispatcher.
(WebKit::WebAutomationSession::processBidiMessage): Added.
(WebKit::WebAutomationSession::sendBidiMessage): Added.

* Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.h: Added.
* Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.cpp: Added.
(WebKit::WebDriverBidiProcessor::WebDriverBidiProcessor):
(WebKit::WebDriverBidiProcessor::~WebDriverBidiProcessor):
(WebKit::WebDriverBidiProcessor::protectedFrontendRouter const):
(WebKit::WebDriverBidiProcessor::protectedBackendDispatcher const):
(WebKit::WebDriverBidiProcessor::processBidiMessage):
(WebKit::WebDriverBidiProcessor::sendBidiMessage):
(WebKit::WebDriverBidiProcessor::sendMessageToFrontend):
(WebKit::WebDriverBidiProcessor::navigate):
(WebKit::WebDriverBidiProcessor::close):

* Source/WebKit/SaferCPPExpectations/MemoryUnsafeCastCheckerExpectations:
* Source/WebKit/SaferCPPExpectations/UncountedCallArgsCheckerExpectations:
Copy pre-existing SaferCPP expectations for generated inspector protocol code.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj: Add new Derived Sources files.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj: Add existing 
AutomationInstrumentation
files to the Xcode project since we need to start building with 
ENABLE(WEBDRIVER_BIDI) on Cocoa.

Web Automation: start using WebDriver BiDi generated frontend dispatchers from 
JSON input files
https://bugs.webkit.org/show_bug.cgi?id=284322
<rdar://136788420>

Reviewed by Devin Rousso and Patrick Angle.

This change starts using generated frontend dispatchers as the mechanism to 
deliver per-domain
WebDriver BiDi events from WebDriverBidiProcessor out through Automation 
protocol.

Hook up the recently implemented log.entryAdded event so that this event also 
is sent out via
the newly added WebDriverBidi protocol (`Automation.bidiMessageSent`). When 
clients have moved
away from using `Automation.logEntryAdded`, that event can be removed in favor 
of the event that
is now defined in `BidiLog.json`.

* 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
(CppFrontendDispatcherHeaderGenerator._generate_secondary_header_includes):
* 
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
(CppFrontendDispatcherImplementationGenerator._generate_secondary_header_includes):
Mark these headers as allowed to be included for WebDriverBidi. (Otherwise, it 
won't build as-is.)
* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make: Add new domain.

* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::logEntryAdded):
Additionally send the log entry to be dispatched via the generated 
BidiLogFrontendDispatcher
interface. It will eventually come back out via `Automation.bidiMessageSent`.

* Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.cpp:
(WebKit::WebDriverBidiProcessor::WebDriverBidiProcessor):
(WebKit::WebDriverBidiProcessor::logEntryAdded):
* Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.h:
* Source/WebKit/UIProcess/Automation/protocol/BidiLog.json: Added.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/290582@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