diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-11-08 20:13:00 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-11-09 14:15:59 +0000 |
commit | 098216fad74b5be00714772bef2f34b3c005ceaf (patch) | |
tree | d8fe7cdfd27df5bd466169b776544cb7412da191 | |
parent | 357fd76e300cfd3f35d0cf9c528b9708ba82266c (diff) | |
download | serenity-098216fad74b5be00714772bef2f34b3c005ceaf.zip |
WebContent: Remove the DRIVER_TRY macro now that it is no longer needed
We can now invoke TRY directly, and don't need to wrap single-value
return statements with braces.
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index 53c7c3ae03..58e7c79c6e 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -20,14 +20,6 @@ namespace WebContent { -#define DRIVER_TRY(expression) \ - ({ \ - auto _temporary_result = (expression); \ - if (_temporary_result.is_error()) [[unlikely]] \ - return { _temporary_result.release_error() }; \ - _temporary_result.release_value(); \ - }) - static JsonValue make_success_response(JsonValue value) { JsonObject result; @@ -71,11 +63,11 @@ Messages::WebDriverClient::NavigateToResponse WebDriverConnection::navigate_to(J dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection::navigate_to {}", payload); // 1. If the current top-level browsing context is no longer open, return error with error code no such window. - DRIVER_TRY(ensure_open_top_level_browsing_context()); + TRY(ensure_open_top_level_browsing_context()); // 2. Let url be the result of getting the property url from the parameters argument. if (!payload.is_object() || !payload.as_object().has_string("url"sv)) - return { Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "Payload doesn't have a string `url`"sv) }; + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "Payload doesn't have a string `url`"sv); URL url(payload.as_object().get_ptr("url"sv)->as_string()); // FIXME: 3. If url is not an absolute URL or is not an absolute URL with fragment or not a local scheme, return error with error code invalid argument. @@ -94,7 +86,7 @@ Messages::WebDriverClient::NavigateToResponse WebDriverConnection::navigate_to(J // FIXME: 10. If the current top-level browsing context contains a refresh state pragma directive of time 1 second or less, wait until the refresh timeout has elapsed, a new navigate has begun, and return to the first step of this algorithm. // 11. Return success with data null. - return { make_success_response({}) }; + return make_success_response({}); } // 10.2 Get Current URL, https://w3c.github.io/webdriver/#get-current-url @@ -103,7 +95,7 @@ Messages::WebDriverClient::GetCurrentUrlResponse WebDriverConnection::get_curren dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection::get_current_url"); // 1. If the current top-level browsing context is no longer open, return error with error code no such window. - DRIVER_TRY(ensure_open_top_level_browsing_context()); + TRY(ensure_open_top_level_browsing_context()); // FIXME: 2. Handle any user prompts and return its value if it is an error. @@ -111,7 +103,7 @@ Messages::WebDriverClient::GetCurrentUrlResponse WebDriverConnection::get_curren auto url = m_page_host.page().top_level_browsing_context().active_document()->url().to_string(); // 4. Return success with data url. - return { make_success_response(url) }; + return make_success_response(url); } // https://w3c.github.io/webdriver/#dfn-no-longer-open |