From 8fc4c5d27bbac040e123d98ebe3d1b463b865d92 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 18 Oct 2022 22:55:25 +0200 Subject: [PATCH] WebDriver: Avoid some JsonValue copies in Session::find_element() --- Userland/Services/WebDriver/Session.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Services/WebDriver/Session.cpp b/Userland/Services/WebDriver/Session.cpp index b36a5480a7..486cdc144c 100644 --- a/Userland/Services/WebDriver/Session.cpp +++ b/Userland/Services/WebDriver/Session.cpp @@ -363,11 +363,11 @@ ErrorOr 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 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" };