mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:37:34 +00:00
WebDriver: Avoid some JsonValue copies in Session::find_element()
This commit is contained in:
parent
f3d66b1108
commit
8fc4c5d27b
1 changed files with 3 additions and 3 deletions
|
@ -363,11 +363,11 @@ ErrorOr<JsonValue, HttpError> Session::find_element(JsonValue const& payload)
|
|||
if (!payload.is_object())
|
||||
return HttpError { 400, "invalid argument", "Payload is not a JSON object" };
|
||||
|
||||
auto properties = payload.as_object();
|
||||
auto const& properties = payload.as_object();
|
||||
// 1. Let location strategy be the result of getting a property called "using".
|
||||
if (!properties.has("using"sv))
|
||||
return HttpError { 400, "invalid argument", "No property called 'using' present" };
|
||||
auto maybe_location_strategy = properties.get("using"sv);
|
||||
auto const& maybe_location_strategy = properties.get("using"sv);
|
||||
if (!maybe_location_strategy.is_string())
|
||||
return HttpError { 400, "invalid argument", "Property 'using' is not a String" };
|
||||
|
||||
|
@ -381,7 +381,7 @@ ErrorOr<JsonValue, HttpError> Session::find_element(JsonValue const& payload)
|
|||
// 4. If selector is undefined, return error with error code invalid argument.
|
||||
if (!properties.has("value"sv))
|
||||
return HttpError { 400, "invalid argument", "No property called 'value' present" };
|
||||
auto maybe_selector = properties.get("value"sv);
|
||||
auto const& maybe_selector = properties.get("value"sv);
|
||||
if (!maybe_selector.is_string())
|
||||
return HttpError { 400, "invalid argument", "Property 'value' is not a String" };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue