Browse Source

WebDriver: Avoid some JsonValue copies in Session::find_element()

Linus Groh 2 years ago
parent
commit
8fc4c5d27b
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Userland/Services/WebDriver/Session.cpp

+ 3 - 3
Userland/Services/WebDriver/Session.cpp

@@ -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" };