diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-11-03 15:58:13 -0400 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-11-03 19:40:43 -0400 |
commit | d907fb304ea775179d85f235a29640787d0016c9 (patch) | |
tree | 62adde6a77975b466e9ad48c5c96923772a9f7b6 | |
parent | 92cb67522dee389cb1d17b325ef10c2824808839 (diff) | |
download | serenity-d907fb304ea775179d85f235a29640787d0016c9.zip |
WebDriver: Pass StringView by value
See: 8b1108e4858f797c9216dc8ae4a3918ad50c73b4.
-rw-r--r-- | Userland/Services/WebDriver/Session.cpp | 14 | ||||
-rw-r--r-- | Userland/Services/WebDriver/Session.h | 16 |
2 files changed, 15 insertions, 15 deletions
diff --git a/Userland/Services/WebDriver/Session.cpp b/Userland/Services/WebDriver/Session.cpp index 7a643cfe74..64dca937b2 100644 --- a/Userland/Services/WebDriver/Session.cpp +++ b/Userland/Services/WebDriver/Session.cpp @@ -465,7 +465,7 @@ static ErrorOr<i32, WebDriverError> get_known_connected_element(StringView eleme } // https://w3c.github.io/webdriver/#dfn-find -ErrorOr<JsonArray, WebDriverError> Session::find(Session::LocalElement const& start_node, StringView const& using_, StringView const& value) +ErrorOr<JsonArray, WebDriverError> Session::find(Session::LocalElement const& start_node, StringView using_, StringView value) { // 1. Let end time be the current time plus the session implicit wait timeout. auto end_time = Time::now_monotonic() + Time::from_milliseconds(static_cast<i64>(m_timeouts_configuration.implicit_wait_timeout)); @@ -514,7 +514,7 @@ Vector<Session::LocatorStrategy> Session::s_locator_strategies = { }; // https://w3c.github.io/webdriver/#css-selectors -ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_css_selectors(Session::LocalElement const& start_node, StringView const& selector) +ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_css_selectors(Session::LocalElement const& start_node, StringView selector) { // 1. Let elements be the result of calling querySelectorAll() with start node as this and selector as the argument. // If this causes an exception to be thrown, return error with error code invalid selector. @@ -533,28 +533,28 @@ ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy } // https://w3c.github.io/webdriver/#link-text -ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_link_text(Session::LocalElement const&, StringView const&) +ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_link_text(Session::LocalElement const&, StringView) { // FIXME: Implement return WebDriverError::from_code(ErrorCode::UnsupportedOperation, "Not implemented: locator strategy link text"); } // https://w3c.github.io/webdriver/#partial-link-text -ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_partial_link_text(Session::LocalElement const&, StringView const&) +ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_partial_link_text(Session::LocalElement const&, StringView) { // FIXME: Implement return WebDriverError::from_code(ErrorCode::UnsupportedOperation, "Not implemented: locator strategy partial link text"); } // https://w3c.github.io/webdriver/#tag-name -ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_tag_name(Session::LocalElement const&, StringView const&) +ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_tag_name(Session::LocalElement const&, StringView) { // FIXME: Implement return WebDriverError::from_code(ErrorCode::UnsupportedOperation, "Not implemented: locator strategy tag name"); } // https://w3c.github.io/webdriver/#xpath -ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_x_path(Session::LocalElement const&, StringView const&) +ErrorOr<Vector<Session::LocalElement>, WebDriverError> Session::locator_strategy_x_path(Session::LocalElement const&, StringView) { // FIXME: Implement return WebDriverError::from_code(ErrorCode::UnsupportedOperation, "Not implemented: locator strategy XPath"); @@ -1253,7 +1253,7 @@ void Session::delete_cookies(Optional<StringView> const& name) } // 14.4 Delete Cookie, https://w3c.github.io/webdriver/#dfn-delete-cookie -ErrorOr<JsonValue, WebDriverError> Session::delete_cookie(StringView const& name) +ErrorOr<JsonValue, WebDriverError> Session::delete_cookie(StringView name) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(check_for_open_top_level_browsing_context_or_return_error()); diff --git a/Userland/Services/WebDriver/Session.h b/Userland/Services/WebDriver/Session.h index 4ce2824ba0..e51952ab0d 100644 --- a/Userland/Services/WebDriver/Session.h +++ b/Userland/Services/WebDriver/Session.h @@ -72,15 +72,15 @@ public: ErrorOr<JsonValue, WebDriverError> get_all_cookies(); ErrorOr<JsonValue, WebDriverError> get_named_cookie(String const& name); ErrorOr<JsonValue, WebDriverError> add_cookie(JsonValue const& payload); - ErrorOr<JsonValue, WebDriverError> delete_cookie(StringView const& name); + ErrorOr<JsonValue, WebDriverError> delete_cookie(StringView name); ErrorOr<JsonValue, WebDriverError> delete_all_cookies(); ErrorOr<JsonValue, WebDriverError> take_screenshot(); private: void delete_cookies(Optional<StringView> const& name = {}); - ErrorOr<JsonArray, WebDriverError> find(LocalElement const& start_node, StringView const& location_strategy, StringView const& selector); + ErrorOr<JsonArray, WebDriverError> find(LocalElement const& start_node, StringView location_strategy, StringView selector); - using ElementLocationStrategyHandler = ErrorOr<Vector<LocalElement>, WebDriverError> (Session::*)(LocalElement const&, StringView const&); + using ElementLocationStrategyHandler = ErrorOr<Vector<LocalElement>, WebDriverError> (Session::*)(LocalElement const&, StringView); struct LocatorStrategy { String name; ElementLocationStrategyHandler handler; @@ -88,11 +88,11 @@ private: static Vector<LocatorStrategy> s_locator_strategies; - ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_css_selectors(LocalElement const&, StringView const&); - ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_link_text(LocalElement const&, StringView const&); - ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_partial_link_text(LocalElement const&, StringView const&); - ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_tag_name(LocalElement const&, StringView const&); - ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_x_path(LocalElement const&, StringView const&); + ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_css_selectors(LocalElement const&, StringView); + ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_link_text(LocalElement const&, StringView); + ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_partial_link_text(LocalElement const&, StringView); + ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_tag_name(LocalElement const&, StringView); + ErrorOr<Vector<LocalElement>, WebDriverError> locator_strategy_x_path(LocalElement const&, StringView); NonnullRefPtr<Client> m_client; bool m_started { false }; |