mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibWeb: Do not reject valid WebDriver script timeouts
The spec's text is pretty awkward here, but the way we've currently transcribed it to C++ means we reject valid script timeouts. This meant the following would fail: TimeoutsConfiguration config {}; // Default values. auto json = timeouts_object(config); config = TRY(json_deserialize_as_a_timeouts_configuration(json));
This commit is contained in:
parent
5d61053276
commit
5b5b563968
1 changed files with 3 additions and 1 deletions
|
@ -51,7 +51,9 @@ ErrorOr<TimeoutsConfiguration, Error> json_deserialize_as_a_timeouts_configurati
|
|||
auto const& script_duration = value.as_object().get("script"sv);
|
||||
|
||||
// 2. If script duration is a number and less than 0 or greater than maximum safe integer, or it is not null, return error with error code invalid argument.
|
||||
if ((script_duration.is_number() && (script_duration.to_i64() < 0 || script_duration.to_i64() > max_safe_integer)) || !script_duration.is_null())
|
||||
if (script_duration.is_number() && (script_duration.to_i64() < 0 || script_duration.to_i64() > max_safe_integer))
|
||||
return Error::from_code(ErrorCode::InvalidArgument, "Invalid script duration");
|
||||
if (!script_duration.is_number() && !script_duration.is_null())
|
||||
return Error::from_code(ErrorCode::InvalidArgument, "Invalid script duration");
|
||||
|
||||
// 3. Set timeouts’s script timeout to script duration.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue