Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6a6a378761be030c666f7c47c3045d7592496211
https://github.com/WebKit/WebKit/commit/6a6a378761be030c666f7c47c3045d7592496211
Author: Serge Deh <[email protected]>
Date: 2026-04-07 (Tue, 07 Apr 2026)
Changed paths:
M
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
M Source/JavaScriptCore/inspector/scripts/codegen/models.py
M
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result
M
Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result
A
Source/JavaScriptCore/inspector/scripts/tests/expected/webdriver-bidi-enum-validation.json-result
A
Source/JavaScriptCore/inspector/scripts/tests/webdriver-bidi-enum-validation.json
M WebDriverTests/TestExpectations.json
Log Message:
-----------
[Web Inspector] Add validation for optional enum parameters
https://bugs.webkit.org/show_bug.cgi?id=304062
Reviewed by Devin Rousso and BJ Burg.
The Inspector protocol code generator was not validating optional enum
parameters, allowing invalid values to pass through to the backend
implementation. This is a followup to #58033, handling enum validation at
the JSON-RPC error code level.
Per the JSON-RPC 2.0 specification (https://www.jsonrpc.org/specification),
invalid parameter values should return error code -32602 (Invalid params).
The W3C WebDriver BiDi specification (https://w3c.github.io/webdriver-bidi/)
explicitly follows JSON-RPC 2.0 and requires this error code for invalid
enum values.
This fix uses the framework settings system to configure error codes for
enum validation. The WebDriverBidi and Test frameworks use InvalidParams
(-32602) for both required and optional enum parameters, while other
frameworks preserve the existing ServerError (-32000) behavior for
compatibility. The per-framework settings can be unified once downstream
issues (such as Connection.js test breakages) are resolved.
Tests:
*
imported/w3c/webdriver/tests/bidi/script/get_realms/invalid.py::test_params_type_invalid_value
(protocol test)
*
Source/JavaScriptCore/inspector/scripts/tests/webdriver-bidi-enum-validation.json
(generator test)
* Source/JavaScriptCore/inspector/scripts/codegen/models.py:
Add enum_invalid_value_error_code setting to WebDriverBidi and Test framework
configurations.
*
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
Read error code from framework setting. Apply InvalidParams or ServerError for
both required and optional enum parameters based on framework configuration.
*
Source/JavaScriptCore/inspector/scripts/tests/webdriver-bidi-enum-validation.json:
Add generator test fixture covering required and optional enum parameters.
* Source/JavaScriptCore/inspector/scripts/tests/expected/*.json-result:
Update expected outputs for Test framework to use InvalidParams for enum
validation.
* WebDriverTests/TestExpectations.json:
Remove expected failure for test_params_type_invalid_value test.
Canonical link: https://commits.webkit.org/310738@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications