diff --git a/Libraries/LibIPC/Connection.cpp b/Libraries/LibIPC/Connection.cpp index 18651c7972e..a93d25875fb 100644 --- a/Libraries/LibIPC/Connection.cpp +++ b/Libraries/LibIPC/Connection.cpp @@ -107,7 +107,7 @@ void ConnectionBase::handle_messages() auto messages = move(m_unprocessed_messages); for (auto& message : messages) { if (message->endpoint_magic() == m_local_endpoint_magic) { - auto handler_result = m_local_stub.handle(*message); + auto handler_result = m_local_stub.handle(move(message)); if (handler_result.is_error()) { dbgln("IPC::ConnectionBase::handle_messages: {}", handler_result.error()); continue; diff --git a/Libraries/LibIPC/Stub.h b/Libraries/LibIPC/Stub.h index 49d6ee09fbc..4a444cb4c79 100644 --- a/Libraries/LibIPC/Stub.h +++ b/Libraries/LibIPC/Stub.h @@ -23,7 +23,7 @@ public: virtual u32 magic() const = 0; virtual ByteString name() const = 0; - virtual ErrorOr> handle(Message const&) = 0; + virtual ErrorOr> handle(NonnullOwnPtr) = 0; protected: Stub() = default; diff --git a/Libraries/LibImageDecoderClient/Client.cpp b/Libraries/LibImageDecoderClient/Client.cpp index d71a4887b14..a2220f0d5d6 100644 --- a/Libraries/LibImageDecoderClient/Client.cpp +++ b/Libraries/LibImageDecoderClient/Client.cpp @@ -57,9 +57,9 @@ NonnullRefPtr> Client::decode_image(ReadonlyBytes en return promise; } -void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gfx::BitmapSequence const& bitmap_sequence, Vector const& durations, Gfx::FloatPoint scale, Gfx::ColorSpace const& color_space) +void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gfx::BitmapSequence bitmap_sequence, Vector durations, Gfx::FloatPoint scale, Gfx::ColorSpace color_space) { - auto const& bitmaps = bitmap_sequence.bitmaps; + auto bitmaps = move(bitmap_sequence.bitmaps); VERIFY(!bitmaps.is_empty()); auto maybe_promise = m_pending_decoded_images.take(image_id); @@ -82,13 +82,13 @@ void Client::did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gf return; } - image.frames.empend(*bitmaps[i], durations[i]); + image.frames.empend(bitmaps[i].release_value(), durations[i]); } promise->resolve(move(image)); } -void Client::did_fail_to_decode_image(i64 image_id, String const& error_message) +void Client::did_fail_to_decode_image(i64 image_id, String error_message) { auto maybe_promise = m_pending_decoded_images.take(image_id); if (!maybe_promise.has_value()) { diff --git a/Libraries/LibImageDecoderClient/Client.h b/Libraries/LibImageDecoderClient/Client.h index 7dbf61fa0d3..53c38df21b1 100644 --- a/Libraries/LibImageDecoderClient/Client.h +++ b/Libraries/LibImageDecoderClient/Client.h @@ -45,8 +45,8 @@ public: private: virtual void die() override; - virtual void did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gfx::BitmapSequence const& bitmap_sequence, Vector const& durations, Gfx::FloatPoint scale, Gfx::ColorSpace const& color_profile) override; - virtual void did_fail_to_decode_image(i64 image_id, String const& error_message) override; + virtual void did_decode_image(i64 image_id, bool is_animated, u32 loop_count, Gfx::BitmapSequence bitmap_sequence, Vector durations, Gfx::FloatPoint scale, Gfx::ColorSpace color_space) override; + virtual void did_fail_to_decode_image(i64 image_id, String error_message) override; HashMap>> m_pending_decoded_images; }; diff --git a/Libraries/LibRequests/RequestClient.cpp b/Libraries/LibRequests/RequestClient.cpp index e4360f4b02f..10422fa5ca2 100644 --- a/Libraries/LibRequests/RequestClient.cpp +++ b/Libraries/LibRequests/RequestClient.cpp @@ -43,7 +43,7 @@ RefPtr RequestClient::start_request(ByteString const& method, URL::URL return request; } -void RequestClient::request_started(i32 request_id, IPC::File const& response_file) +void RequestClient::request_started(i32 request_id, IPC::File response_file) { auto request = m_requests.get(request_id); if (!request.has_value()) { @@ -69,7 +69,7 @@ bool RequestClient::set_certificate(Badge, Request& request, ByteString return IPCProxy::set_certificate(request.id(), move(certificate), move(key)); } -void RequestClient::request_finished(i32 request_id, u64 total_size, RequestTimingInfo const& timing_info, Optional const& network_error) +void RequestClient::request_finished(i32 request_id, u64 total_size, RequestTimingInfo timing_info, Optional network_error) { RefPtr request; if ((request = m_requests.get(request_id).value_or(nullptr))) { @@ -78,7 +78,7 @@ void RequestClient::request_finished(i32 request_id, u64 total_size, RequestTimi m_requests.remove(request_id); } -void RequestClient::headers_became_available(i32 request_id, HTTP::HeaderMap const& response_headers, Optional const& status_code, Optional const& reason_phrase) +void RequestClient::headers_became_available(i32 request_id, HTTP::HeaderMap response_headers, Optional status_code, Optional reason_phrase) { auto request = const_cast(m_requests.get(request_id).value_or(nullptr)); if (!request) { @@ -111,11 +111,11 @@ void RequestClient::websocket_connected(i64 websocket_id) maybe_connection.value()->did_open({}); } -void RequestClient::websocket_received(i64 websocket_id, bool is_text, ByteBuffer const& data) +void RequestClient::websocket_received(i64 websocket_id, bool is_text, ByteBuffer data) { auto maybe_connection = m_websockets.get(websocket_id); if (maybe_connection.has_value()) - maybe_connection.value()->did_receive({}, data, is_text); + maybe_connection.value()->did_receive({}, move(data), is_text); } void RequestClient::websocket_errored(i64 websocket_id, i32 message) @@ -125,11 +125,11 @@ void RequestClient::websocket_errored(i64 websocket_id, i32 message) maybe_connection.value()->did_error({}, message); } -void RequestClient::websocket_closed(i64 websocket_id, u16 code, ByteString const& reason, bool clean) +void RequestClient::websocket_closed(i64 websocket_id, u16 code, ByteString reason, bool clean) { auto maybe_connection = m_websockets.get(websocket_id); if (maybe_connection.has_value()) - maybe_connection.value()->did_close({}, code, reason, clean); + maybe_connection.value()->did_close({}, code, move(reason), clean); } void RequestClient::websocket_ready_state_changed(i64 websocket_id, u32 ready_state) @@ -141,11 +141,11 @@ void RequestClient::websocket_ready_state_changed(i64 websocket_id, u32 ready_st } } -void RequestClient::websocket_subprotocol(i64 websocket_id, ByteString const& subprotocol) +void RequestClient::websocket_subprotocol(i64 websocket_id, ByteString subprotocol) { auto maybe_connection = m_websockets.get(websocket_id); if (maybe_connection.has_value()) { - maybe_connection.value()->set_subprotocol_in_use(subprotocol); + maybe_connection.value()->set_subprotocol_in_use(move(subprotocol)); } } diff --git a/Libraries/LibRequests/RequestClient.h b/Libraries/LibRequests/RequestClient.h index f5795cae996..08b19f06361 100644 --- a/Libraries/LibRequests/RequestClient.h +++ b/Libraries/LibRequests/RequestClient.h @@ -42,17 +42,17 @@ public: private: virtual void die() override; - virtual void request_started(i32, IPC::File const&) override; - virtual void request_finished(i32, u64, RequestTimingInfo const&, Optional const&) override; + virtual void request_started(i32, IPC::File) override; + virtual void request_finished(i32, u64, RequestTimingInfo, Optional) override; virtual void certificate_requested(i32) override; - virtual void headers_became_available(i32, HTTP::HeaderMap const&, Optional const&, Optional const&) override; + virtual void headers_became_available(i32, HTTP::HeaderMap, Optional, Optional) override; virtual void websocket_connected(i64 websocket_id) override; - virtual void websocket_received(i64 websocket_id, bool, ByteBuffer const&) override; + virtual void websocket_received(i64 websocket_id, bool, ByteBuffer) override; virtual void websocket_errored(i64 websocket_id, i32) override; - virtual void websocket_closed(i64 websocket_id, u16, ByteString const&, bool) override; + virtual void websocket_closed(i64 websocket_id, u16, ByteString, bool) override; virtual void websocket_ready_state_changed(i64 websocket_id, u32 ready_state) override; - virtual void websocket_subprotocol(i64 websocket_id, ByteString const& subprotocol) override; + virtual void websocket_subprotocol(i64 websocket_id, ByteString subprotocol) override; virtual void websocket_certificate_requested(i64 websocket_id) override; HashMap> m_requests; diff --git a/Libraries/LibWebView/ChromeProcess.cpp b/Libraries/LibWebView/ChromeProcess.cpp index dac57631786..dac05a9dfdd 100644 --- a/Libraries/LibWebView/ChromeProcess.cpp +++ b/Libraries/LibWebView/ChromeProcess.cpp @@ -115,13 +115,13 @@ void UIProcessConnectionFromClient::die() s_connections.remove(client_id()); } -void UIProcessConnectionFromClient::create_new_tab(Vector const& urls) +void UIProcessConnectionFromClient::create_new_tab(Vector urls) { if (on_new_tab) on_new_tab(sanitize_urls(urls, Application::chrome_options().new_tab_page_url)); } -void UIProcessConnectionFromClient::create_new_window(Vector const& urls) +void UIProcessConnectionFromClient::create_new_window(Vector urls) { if (on_new_window) on_new_window(sanitize_urls(urls, Application::chrome_options().new_tab_page_url)); diff --git a/Libraries/LibWebView/ChromeProcess.h b/Libraries/LibWebView/ChromeProcess.h index 1fb5da57f50..e95ed862e54 100644 --- a/Libraries/LibWebView/ChromeProcess.h +++ b/Libraries/LibWebView/ChromeProcess.h @@ -34,8 +34,8 @@ public: private: UIProcessConnectionFromClient(IPC::Transport, int client_id); - virtual void create_new_tab(Vector const& urls) override; - virtual void create_new_window(Vector const& urls) override; + virtual void create_new_tab(Vector urls) override; + virtual void create_new_window(Vector urls) override; }; class ChromeProcess { diff --git a/Libraries/LibWebView/WebContentClient.cpp b/Libraries/LibWebView/WebContentClient.cpp index 0698f49557b..f4cbf963e25 100644 --- a/Libraries/LibWebView/WebContentClient.cpp +++ b/Libraries/LibWebView/WebContentClient.cpp @@ -56,13 +56,13 @@ void WebContentClient::unregister_view(u64 page_id) } } -void WebContentClient::did_paint(u64 page_id, Gfx::IntRect const& rect, i32 bitmap_id) +void WebContentClient::did_paint(u64 page_id, Gfx::IntRect rect, i32 bitmap_id) { if (auto view = view_for_page_id(page_id); view.has_value()) view->server_did_paint({}, bitmap_id, rect.size()); } -void WebContentClient::did_start_loading(u64 page_id, URL::URL const& url, bool is_redirect) +void WebContentClient::did_start_loading(u64 page_id, URL::URL url, bool is_redirect) { if (auto process = WebView::Application::the().find_process(m_process_handle.pid); process.has_value()) process->set_title(OptionalNone {}); @@ -75,7 +75,7 @@ void WebContentClient::did_start_loading(u64 page_id, URL::URL const& url, bool } } -void WebContentClient::did_finish_loading(u64 page_id, URL::URL const& url) +void WebContentClient::did_finish_loading(u64 page_id, URL::URL url) { if (auto view = view_for_page_id(page_id); view.has_value()) { view->set_url({}, url); @@ -85,7 +85,7 @@ void WebContentClient::did_finish_loading(u64 page_id, URL::URL const& url) } } -void WebContentClient::did_finish_text_test(u64 page_id, String const& text) +void WebContentClient::did_finish_text_test(u64 page_id, String text) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_text_test_finish) @@ -109,7 +109,7 @@ void WebContentClient::did_set_browser_zoom(u64 page_id, double factor) } } -void WebContentClient::did_find_in_page(u64 page_id, size_t current_match_index, Optional const& total_match_count) +void WebContentClient::did_find_in_page(u64 page_id, size_t current_match_index, Optional total_match_count) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_find_in_page) @@ -123,7 +123,7 @@ void WebContentClient::did_request_refresh(u64 page_id) view->reload(); } -void WebContentClient::did_request_cursor_change(u64 page_id, Gfx::Cursor const& cursor) +void WebContentClient::did_request_cursor_change(u64 page_id, Gfx::Cursor cursor) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_cursor_change) @@ -131,7 +131,7 @@ void WebContentClient::did_request_cursor_change(u64 page_id, Gfx::Cursor const& } } -void WebContentClient::did_change_title(u64 page_id, ByteString const& title) +void WebContentClient::did_change_title(u64 page_id, ByteString title) { if (auto process = WebView::Application::the().find_process(m_process_handle.pid); process.has_value()) process->set_title(MUST(String::from_byte_string(title))); @@ -145,7 +145,7 @@ void WebContentClient::did_change_title(u64 page_id, ByteString const& title) } } -void WebContentClient::did_change_url(u64 page_id, URL::URL const& url) +void WebContentClient::did_change_url(u64 page_id, URL::URL url) { if (auto view = view_for_page_id(page_id); view.has_value()) { view->set_url({}, url); @@ -155,7 +155,7 @@ void WebContentClient::did_change_url(u64 page_id, URL::URL const& url) } } -void WebContentClient::did_request_tooltip_override(u64 page_id, Gfx::IntPoint position, ByteString const& title) +void WebContentClient::did_request_tooltip_override(u64 page_id, Gfx::IntPoint position, ByteString title) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_tooltip_override) @@ -171,7 +171,7 @@ void WebContentClient::did_stop_tooltip_override(u64 page_id) } } -void WebContentClient::did_enter_tooltip_area(u64 page_id, ByteString const& title) +void WebContentClient::did_enter_tooltip_area(u64 page_id, ByteString title) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_enter_tooltip_area) @@ -187,7 +187,7 @@ void WebContentClient::did_leave_tooltip_area(u64 page_id) } } -void WebContentClient::did_hover_link(u64 page_id, URL::URL const& url) +void WebContentClient::did_hover_link(u64 page_id, URL::URL url) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_link_hover) @@ -203,7 +203,7 @@ void WebContentClient::did_unhover_link(u64 page_id) } } -void WebContentClient::did_click_link(u64 page_id, URL::URL const& url, ByteString const& target, unsigned modifiers) +void WebContentClient::did_click_link(u64 page_id, URL::URL url, ByteString target, unsigned modifiers) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_link_click) @@ -211,7 +211,7 @@ void WebContentClient::did_click_link(u64 page_id, URL::URL const& url, ByteStri } } -void WebContentClient::did_middle_click_link(u64 page_id, URL::URL const& url, ByteString const& target, unsigned modifiers) +void WebContentClient::did_middle_click_link(u64 page_id, URL::URL url, ByteString target, unsigned modifiers) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_link_middle_click) @@ -227,7 +227,7 @@ void WebContentClient::did_request_context_menu(u64 page_id, Gfx::IntPoint conte } } -void WebContentClient::did_request_link_context_menu(u64 page_id, Gfx::IntPoint content_position, URL::URL const& url, ByteString const&, unsigned) +void WebContentClient::did_request_link_context_menu(u64 page_id, Gfx::IntPoint content_position, URL::URL url, ByteString, unsigned) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_link_context_menu_request) @@ -235,7 +235,7 @@ void WebContentClient::did_request_link_context_menu(u64 page_id, Gfx::IntPoint } } -void WebContentClient::did_request_image_context_menu(u64 page_id, Gfx::IntPoint content_position, URL::URL const& url, ByteString const&, unsigned, Optional const& bitmap) +void WebContentClient::did_request_image_context_menu(u64 page_id, Gfx::IntPoint content_position, URL::URL url, ByteString, unsigned, Optional bitmap) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_image_context_menu_request) @@ -243,7 +243,7 @@ void WebContentClient::did_request_image_context_menu(u64 page_id, Gfx::IntPoint } } -void WebContentClient::did_request_media_context_menu(u64 page_id, Gfx::IntPoint content_position, ByteString const&, unsigned, Web::Page::MediaContextMenu const& menu) +void WebContentClient::did_request_media_context_menu(u64 page_id, Gfx::IntPoint content_position, ByteString, unsigned, Web::Page::MediaContextMenu menu) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_media_context_menu_request) @@ -251,7 +251,7 @@ void WebContentClient::did_request_media_context_menu(u64 page_id, Gfx::IntPoint } } -void WebContentClient::did_get_source(u64 page_id, URL::URL const& url, URL::URL const& base_url, String const& source) +void WebContentClient::did_get_source(u64 page_id, URL::URL url, URL::URL base_url, String source) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_source) @@ -287,7 +287,7 @@ static JsonType parse_json(StringView json, StringView name) } } -void WebContentClient::did_inspect_dom_tree(u64 page_id, String const& dom_tree) +void WebContentClient::did_inspect_dom_tree(u64 page_id, String dom_tree) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_dom_tree) @@ -295,7 +295,7 @@ void WebContentClient::did_inspect_dom_tree(u64 page_id, String const& dom_tree) } } -void WebContentClient::did_inspect_dom_node(u64 page_id, bool has_style, String const& computed_style, String const& resolved_style, String const& custom_properties, String const& node_box_sizing, String const& aria_properties_state, String const& fonts) +void WebContentClient::did_inspect_dom_node(u64 page_id, bool has_style, String computed_style, String resolved_style, String custom_properties, String node_box_sizing, String aria_properties_state, String fonts) { auto view = view_for_page_id(page_id); if (!view.has_value() || !view->on_received_dom_node_properties) @@ -317,7 +317,7 @@ void WebContentClient::did_inspect_dom_node(u64 page_id, bool has_style, String view->on_received_dom_node_properties(move(properties)); } -void WebContentClient::did_inspect_accessibility_tree(u64 page_id, String const& accessibility_tree) +void WebContentClient::did_inspect_accessibility_tree(u64 page_id, String accessibility_tree) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_accessibility_tree) @@ -325,7 +325,7 @@ void WebContentClient::did_inspect_accessibility_tree(u64 page_id, String const& } } -void WebContentClient::did_get_hovered_node_id(u64 page_id, Web::UniqueNodeID const& node_id) +void WebContentClient::did_get_hovered_node_id(u64 page_id, Web::UniqueNodeID node_id) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_hovered_node_id) @@ -333,7 +333,7 @@ void WebContentClient::did_get_hovered_node_id(u64 page_id, Web::UniqueNodeID co } } -void WebContentClient::did_finish_editing_dom_node(u64 page_id, Optional const& node_id) +void WebContentClient::did_finish_editing_dom_node(u64 page_id, Optional node_id) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_finshed_editing_dom_node) @@ -341,15 +341,15 @@ void WebContentClient::did_finish_editing_dom_node(u64 page_id, Optionalon_dom_mutation_received) - view->on_dom_mutation_received(move(const_cast(mutation))); + view->on_dom_mutation_received(move(mutation)); } } -void WebContentClient::did_get_dom_node_html(u64 page_id, String const& html) +void WebContentClient::did_get_dom_node_html(u64 page_id, String html) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_dom_node_html) @@ -357,23 +357,23 @@ void WebContentClient::did_get_dom_node_html(u64 page_id, String const& html) } } -void WebContentClient::did_take_screenshot(u64 page_id, Gfx::ShareableBitmap const& screenshot) +void WebContentClient::did_take_screenshot(u64 page_id, Gfx::ShareableBitmap screenshot) { if (auto view = view_for_page_id(page_id); view.has_value()) view->did_receive_screenshot({}, screenshot); } -void WebContentClient::did_get_internal_page_info(u64 page_id, WebView::PageInfoType type, String const& info) +void WebContentClient::did_get_internal_page_info(u64 page_id, WebView::PageInfoType type, String info) { if (auto view = view_for_page_id(page_id); view.has_value()) view->did_receive_internal_page_info({}, type, info); } -void WebContentClient::did_execute_js_console_input(u64 page_id, JsonValue const& result) +void WebContentClient::did_execute_js_console_input(u64 page_id, JsonValue result) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_js_console_result) - view->on_received_js_console_result(move(const_cast(result))); + view->on_received_js_console_result(move(result)); } } @@ -385,7 +385,7 @@ void WebContentClient::did_output_js_console_message(u64 page_id, i32 message_in } } -void WebContentClient::did_get_styled_js_console_messages(u64 page_id, i32 start_index, Vector const& message_types, Vector const& messages) +void WebContentClient::did_get_styled_js_console_messages(u64 page_id, i32 start_index, Vector message_types, Vector messages) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_styled_console_messages) @@ -393,15 +393,15 @@ void WebContentClient::did_get_styled_js_console_messages(u64 page_id, i32 start } } -void WebContentClient::did_get_unstyled_js_console_messages(u64 page_id, i32 start_index, Vector const& console_output) +void WebContentClient::did_get_unstyled_js_console_messages(u64 page_id, i32 start_index, Vector console_output) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_unstyled_console_messages) - view->on_received_unstyled_console_messages(start_index, move(const_cast&>(console_output))); + view->on_received_unstyled_console_messages(start_index, move(console_output)); } } -void WebContentClient::did_request_alert(u64 page_id, String const& message) +void WebContentClient::did_request_alert(u64 page_id, String message) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_alert) @@ -409,7 +409,7 @@ void WebContentClient::did_request_alert(u64 page_id, String const& message) } } -void WebContentClient::did_request_confirm(u64 page_id, String const& message) +void WebContentClient::did_request_confirm(u64 page_id, String message) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_confirm) @@ -417,7 +417,7 @@ void WebContentClient::did_request_confirm(u64 page_id, String const& message) } } -void WebContentClient::did_request_prompt(u64 page_id, String const& message, String const& default_) +void WebContentClient::did_request_prompt(u64 page_id, String message, String default_) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_prompt) @@ -425,7 +425,7 @@ void WebContentClient::did_request_prompt(u64 page_id, String const& message, St } } -void WebContentClient::did_request_set_prompt_text(u64 page_id, String const& message) +void WebContentClient::did_request_set_prompt_text(u64 page_id, String message) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_set_prompt_text) @@ -449,7 +449,7 @@ void WebContentClient::did_request_dismiss_dialog(u64 page_id) } } -void WebContentClient::did_change_favicon(u64 page_id, Gfx::ShareableBitmap const& favicon) +void WebContentClient::did_change_favicon(u64 page_id, Gfx::ShareableBitmap favicon) { if (!favicon.is_valid()) { dbgln("DidChangeFavicon: Received invalid favicon"); @@ -462,27 +462,27 @@ void WebContentClient::did_change_favicon(u64 page_id, Gfx::ShareableBitmap cons } } -Messages::WebContentClient::DidRequestAllCookiesResponse WebContentClient::did_request_all_cookies(URL::URL const& url) +Messages::WebContentClient::DidRequestAllCookiesResponse WebContentClient::did_request_all_cookies(URL::URL url) { return Application::cookie_jar().get_all_cookies(url); } -Messages::WebContentClient::DidRequestNamedCookieResponse WebContentClient::did_request_named_cookie(URL::URL const& url, String const& name) +Messages::WebContentClient::DidRequestNamedCookieResponse WebContentClient::did_request_named_cookie(URL::URL url, String name) { return Application::cookie_jar().get_named_cookie(url, name); } -Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(URL::URL const& url, Web::Cookie::Source source) +Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(URL::URL url, Web::Cookie::Source source) { return Application::cookie_jar().get_cookie(url, source); } -void WebContentClient::did_set_cookie(URL::URL const& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source) +void WebContentClient::did_set_cookie(URL::URL url, Web::Cookie::ParsedCookie cookie, Web::Cookie::Source source) { Application::cookie_jar().set_cookie(url, cookie, source); } -void WebContentClient::did_update_cookie(Web::Cookie::Cookie const& cookie) +void WebContentClient::did_update_cookie(Web::Cookie::Cookie cookie) { Application::cookie_jar().update_cookie(cookie); } @@ -492,7 +492,7 @@ void WebContentClient::did_expire_cookies_with_time_offset(AK::Duration offset) Application::cookie_jar().expire_cookies_with_time_offset(offset); } -Messages::WebContentClient::DidRequestNewWebViewResponse WebContentClient::did_request_new_web_view(u64 page_id, Web::HTML::ActivateTab const& activate_tab, Web::HTML::WebViewHints const& hints, Optional const& page_index) +Messages::WebContentClient::DidRequestNewWebViewResponse WebContentClient::did_request_new_web_view(u64 page_id, Web::HTML::ActivateTab activate_tab, Web::HTML::WebViewHints hints, Optional page_index) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_new_web_view) @@ -574,7 +574,7 @@ void WebContentClient::did_request_fullscreen_window(u64 page_id) } } -void WebContentClient::did_request_file(u64 page_id, ByteString const& path, i32 request_id) +void WebContentClient::did_request_file(u64 page_id, ByteString path, i32 request_id) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_file) @@ -582,7 +582,7 @@ void WebContentClient::did_request_file(u64 page_id, ByteString const& path, i32 } } -void WebContentClient::did_request_color_picker(u64 page_id, Color const& current_color) +void WebContentClient::did_request_color_picker(u64 page_id, Color current_color) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_color_picker) @@ -590,7 +590,7 @@ void WebContentClient::did_request_color_picker(u64 page_id, Color const& curren } } -void WebContentClient::did_request_file_picker(u64 page_id, Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles allow_multiple_files) +void WebContentClient::did_request_file_picker(u64 page_id, Web::HTML::FileFilter accepted_file_types, Web::HTML::AllowMultipleFiles allow_multiple_files) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_file_picker) @@ -598,7 +598,7 @@ void WebContentClient::did_request_file_picker(u64 page_id, Web::HTML::FileFilte } } -void WebContentClient::did_request_select_dropdown(u64 page_id, Gfx::IntPoint content_position, i32 minimum_width, Vector const& items) +void WebContentClient::did_request_select_dropdown(u64 page_id, Gfx::IntPoint content_position, i32 minimum_width, Vector items) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_request_select_dropdown) @@ -620,7 +620,7 @@ void WebContentClient::did_change_theme_color(u64 page_id, Gfx::Color color) } } -void WebContentClient::did_insert_clipboard_entry(u64 page_id, String const& data, String const& presentation_style, String const& mime_type) +void WebContentClient::did_insert_clipboard_entry(u64 page_id, String data, String presentation_style, String mime_type) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_insert_clipboard_entry) @@ -640,7 +640,7 @@ void WebContentClient::did_update_navigation_buttons_state(u64 page_id, bool bac view->did_update_navigation_buttons_state({}, back_enabled, forward_enabled); } -void WebContentClient::did_allocate_backing_stores(u64 page_id, i32 front_bitmap_id, Gfx::ShareableBitmap const& front_bitmap, i32 back_bitmap_id, Gfx::ShareableBitmap const& back_bitmap) +void WebContentClient::did_allocate_backing_stores(u64 page_id, i32 front_bitmap_id, Gfx::ShareableBitmap front_bitmap, i32 back_bitmap_id, Gfx::ShareableBitmap back_bitmap) { if (auto view = view_for_page_id(page_id); view.has_value()) view->did_allocate_backing_stores({}, front_bitmap_id, front_bitmap, back_bitmap_id, back_bitmap); @@ -654,7 +654,7 @@ void WebContentClient::inspector_did_load(u64 page_id) } } -void WebContentClient::inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional const& pseudo_element) +void WebContentClient::inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional pseudo_element) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_inspector_selected_dom_node) @@ -662,7 +662,7 @@ void WebContentClient::inspector_did_select_dom_node(u64 page_id, Web::UniqueNod } } -void WebContentClient::inspector_did_set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text) +void WebContentClient::inspector_did_set_dom_node_text(u64 page_id, Web::UniqueNodeID node_id, String text) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_inspector_set_dom_node_text) @@ -670,7 +670,7 @@ void WebContentClient::inspector_did_set_dom_node_text(u64 page_id, Web::UniqueN } } -void WebContentClient::inspector_did_set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& tag) +void WebContentClient::inspector_did_set_dom_node_tag(u64 page_id, Web::UniqueNodeID node_id, String tag) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_inspector_set_dom_node_tag) @@ -678,7 +678,7 @@ void WebContentClient::inspector_did_set_dom_node_tag(u64 page_id, Web::UniqueNo } } -void WebContentClient::inspector_did_add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector const& attributes) +void WebContentClient::inspector_did_add_dom_node_attributes(u64 page_id, Web::UniqueNodeID node_id, Vector attributes) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_inspector_added_dom_node_attributes) @@ -686,7 +686,7 @@ void WebContentClient::inspector_did_add_dom_node_attributes(u64 page_id, Web::U } } -void WebContentClient::inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, size_t attribute_index, Vector const& replacement_attributes) +void WebContentClient::inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, size_t attribute_index, Vector replacement_attributes) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_inspector_replaced_dom_node_attribute) @@ -694,7 +694,7 @@ void WebContentClient::inspector_did_replace_dom_node_attribute(u64 page_id, Web } } -void WebContentClient::inspector_did_request_dom_tree_context_menu(u64 page_id, Web::UniqueNodeID const& node_id, Gfx::IntPoint position, String const& type, Optional const& tag, Optional const& attribute_index) +void WebContentClient::inspector_did_request_dom_tree_context_menu(u64 page_id, Web::UniqueNodeID node_id, Gfx::IntPoint position, String type, Optional tag, Optional attribute_index) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_inspector_requested_dom_tree_context_menu) @@ -710,7 +710,7 @@ void WebContentClient::inspector_did_request_cookie_context_menu(u64 page_id, si } } -void WebContentClient::inspector_did_execute_console_script(u64 page_id, String const& script) +void WebContentClient::inspector_did_execute_console_script(u64 page_id, String script) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_inspector_executed_console_script) @@ -718,7 +718,7 @@ void WebContentClient::inspector_did_execute_console_script(u64 page_id, String } } -void WebContentClient::inspector_did_export_inspector_html(u64 page_id, String const& html) +void WebContentClient::inspector_did_export_inspector_html(u64 page_id, String html) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_inspector_exported_inspector_html) @@ -736,7 +736,7 @@ Messages::WebContentClient::RequestWorkerAgentResponse WebContentClient::request return IPC::File {}; } -void WebContentClient::inspector_did_list_style_sheets(u64 page_id, Vector const& stylesheets) +void WebContentClient::inspector_did_list_style_sheets(u64 page_id, Vector stylesheets) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_style_sheet_list) @@ -744,7 +744,7 @@ void WebContentClient::inspector_did_list_style_sheets(u64 page_id, Vectoron_inspector_requested_style_sheet_source) @@ -752,7 +752,7 @@ void WebContentClient::inspector_did_request_style_sheet_source(u64 page_id, Web } } -void WebContentClient::did_get_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier, URL::URL const& base_url, String const& source) +void WebContentClient::did_get_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier identifier, URL::URL base_url, String source) { if (auto view = view_for_page_id(page_id); view.has_value()) { if (view->on_received_style_sheet_source) diff --git a/Libraries/LibWebView/WebContentClient.h b/Libraries/LibWebView/WebContentClient.h index ef8d6e1c5a8..06eec41a253 100644 --- a/Libraries/LibWebView/WebContentClient.h +++ b/Libraries/LibWebView/WebContentClient.h @@ -51,53 +51,53 @@ public: private: virtual void die() override; - virtual void did_paint(u64 page_id, Gfx::IntRect const&, i32) override; - virtual void did_finish_loading(u64 page_id, URL::URL const&) override; + virtual void did_paint(u64 page_id, Gfx::IntRect, i32) override; + virtual void did_finish_loading(u64 page_id, URL::URL) override; virtual void did_request_refresh(u64 page_id) override; - virtual void did_request_cursor_change(u64 page_id, Gfx::Cursor const&) override; - virtual void did_change_title(u64 page_id, ByteString const&) override; - virtual void did_change_url(u64 page_id, URL::URL const&) override; - virtual void did_request_tooltip_override(u64 page_id, Gfx::IntPoint, ByteString const&) override; + virtual void did_request_cursor_change(u64 page_id, Gfx::Cursor) override; + virtual void did_change_title(u64 page_id, ByteString) override; + virtual void did_change_url(u64 page_id, URL::URL) override; + virtual void did_request_tooltip_override(u64 page_id, Gfx::IntPoint, ByteString) override; virtual void did_stop_tooltip_override(u64 page_id) override; - virtual void did_enter_tooltip_area(u64 page_id, ByteString const&) override; + virtual void did_enter_tooltip_area(u64 page_id, ByteString) override; virtual void did_leave_tooltip_area(u64 page_id) override; - virtual void did_hover_link(u64 page_id, URL::URL const&) override; + virtual void did_hover_link(u64 page_id, URL::URL) override; virtual void did_unhover_link(u64 page_id) override; - virtual void did_click_link(u64 page_id, URL::URL const&, ByteString const&, unsigned) override; - virtual void did_middle_click_link(u64 page_id, URL::URL const&, ByteString const&, unsigned) override; - virtual void did_start_loading(u64 page_id, URL::URL const&, bool) override; + virtual void did_click_link(u64 page_id, URL::URL, ByteString, unsigned) override; + virtual void did_middle_click_link(u64 page_id, URL::URL, ByteString, unsigned) override; + virtual void did_start_loading(u64 page_id, URL::URL, bool) override; virtual void did_request_context_menu(u64 page_id, Gfx::IntPoint) override; - virtual void did_request_link_context_menu(u64 page_id, Gfx::IntPoint, URL::URL const&, ByteString const&, unsigned) override; - virtual void did_request_image_context_menu(u64 page_id, Gfx::IntPoint, URL::URL const&, ByteString const&, unsigned, Optional const&) override; - virtual void did_request_media_context_menu(u64 page_id, Gfx::IntPoint, ByteString const&, unsigned, Web::Page::MediaContextMenu const&) override; - virtual void did_get_source(u64 page_id, URL::URL const&, URL::URL const&, String const&) override; - virtual void did_inspect_dom_tree(u64 page_id, String const&) override; - virtual void did_inspect_dom_node(u64 page_id, bool has_style, String const& computed_style, String const& resolved_style, String const& custom_properties, String const& node_box_sizing, String const& aria_properties_state, String const& fonts) override; - virtual void did_inspect_accessibility_tree(u64 page_id, String const&) override; - virtual void did_get_hovered_node_id(u64 page_id, Web::UniqueNodeID const& node_id) override; - virtual void did_finish_editing_dom_node(u64 page_id, Optional const& node_id) override; - virtual void did_mutate_dom(u64 page_id, Mutation const&) override; - virtual void did_get_dom_node_html(u64 page_id, String const& html) override; - virtual void did_take_screenshot(u64 page_id, Gfx::ShareableBitmap const& screenshot) override; - virtual void did_get_internal_page_info(u64 page_id, PageInfoType, String const&) override; - virtual void did_execute_js_console_input(u64 page_id, JsonValue const&) override; + virtual void did_request_link_context_menu(u64 page_id, Gfx::IntPoint, URL::URL, ByteString, unsigned) override; + virtual void did_request_image_context_menu(u64 page_id, Gfx::IntPoint, URL::URL, ByteString, unsigned, Optional) override; + virtual void did_request_media_context_menu(u64 page_id, Gfx::IntPoint, ByteString, unsigned, Web::Page::MediaContextMenu) override; + virtual void did_get_source(u64 page_id, URL::URL, URL::URL, String) override; + virtual void did_inspect_dom_tree(u64 page_id, String) override; + virtual void did_inspect_dom_node(u64 page_id, bool has_style, String computed_style, String resolved_style, String custom_properties, String node_box_sizing, String aria_properties_state, String fonts) override; + virtual void did_inspect_accessibility_tree(u64 page_id, String) override; + virtual void did_get_hovered_node_id(u64 page_id, Web::UniqueNodeID node_id) override; + virtual void did_finish_editing_dom_node(u64 page_id, Optional node_id) override; + virtual void did_mutate_dom(u64 page_id, Mutation) override; + virtual void did_get_dom_node_html(u64 page_id, String html) override; + virtual void did_take_screenshot(u64 page_id, Gfx::ShareableBitmap screenshot) override; + virtual void did_get_internal_page_info(u64 page_id, PageInfoType, String) override; + virtual void did_execute_js_console_input(u64 page_id, JsonValue) override; virtual void did_output_js_console_message(u64 page_id, i32 message_index) override; - virtual void did_get_styled_js_console_messages(u64 page_id, i32 start_index, Vector const& message_types, Vector const& messages) override; - virtual void did_get_unstyled_js_console_messages(u64 page_id, i32 start_index, Vector const&) override; - virtual void did_change_favicon(u64 page_id, Gfx::ShareableBitmap const&) override; - virtual void did_request_alert(u64 page_id, String const&) override; - virtual void did_request_confirm(u64 page_id, String const&) override; - virtual void did_request_prompt(u64 page_id, String const&, String const&) override; - virtual void did_request_set_prompt_text(u64 page_id, String const& message) override; + virtual void did_get_styled_js_console_messages(u64 page_id, i32 start_index, Vector message_types, Vector messages) override; + virtual void did_get_unstyled_js_console_messages(u64 page_id, i32 start_index, Vector) override; + virtual void did_change_favicon(u64 page_id, Gfx::ShareableBitmap) override; + virtual void did_request_alert(u64 page_id, String) override; + virtual void did_request_confirm(u64 page_id, String) override; + virtual void did_request_prompt(u64 page_id, String, String) override; + virtual void did_request_set_prompt_text(u64 page_id, String message) override; virtual void did_request_accept_dialog(u64 page_id) override; virtual void did_request_dismiss_dialog(u64 page_id) override; - virtual Messages::WebContentClient::DidRequestAllCookiesResponse did_request_all_cookies(URL::URL const&) override; - virtual Messages::WebContentClient::DidRequestNamedCookieResponse did_request_named_cookie(URL::URL const&, String const&) override; - virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(URL::URL const&, Web::Cookie::Source) override; - virtual void did_set_cookie(URL::URL const&, Web::Cookie::ParsedCookie const&, Web::Cookie::Source) override; - virtual void did_update_cookie(Web::Cookie::Cookie const&) override; + virtual Messages::WebContentClient::DidRequestAllCookiesResponse did_request_all_cookies(URL::URL) override; + virtual Messages::WebContentClient::DidRequestNamedCookieResponse did_request_named_cookie(URL::URL, String) override; + virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(URL::URL, Web::Cookie::Source) override; + virtual void did_set_cookie(URL::URL, Web::Cookie::ParsedCookie, Web::Cookie::Source) override; + virtual void did_update_cookie(Web::Cookie::Cookie) override; virtual void did_expire_cookies_with_time_offset(AK::Duration) override; - virtual Messages::WebContentClient::DidRequestNewWebViewResponse did_request_new_web_view(u64 page_id, Web::HTML::ActivateTab const&, Web::HTML::WebViewHints const&, Optional const& page_index) override; + virtual Messages::WebContentClient::DidRequestNewWebViewResponse did_request_new_web_view(u64 page_id, Web::HTML::ActivateTab, Web::HTML::WebViewHints, Optional page_index) override; virtual void did_request_activate_tab(u64 page_id) override; virtual void did_close_browsing_context(u64 page_id) override; virtual void did_update_resource_count(u64 page_id, i32 count_waiting) override; @@ -107,34 +107,34 @@ private: virtual void did_request_maximize_window(u64 page_id) override; virtual void did_request_minimize_window(u64 page_id) override; virtual void did_request_fullscreen_window(u64 page_id) override; - virtual void did_request_file(u64 page_id, ByteString const& path, i32) override; - virtual void did_request_color_picker(u64 page_id, Color const& current_color) override; - virtual void did_request_file_picker(u64 page_id, Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles) override; - virtual void did_request_select_dropdown(u64 page_id, Gfx::IntPoint content_position, i32 minimum_width, Vector const& items) override; + virtual void did_request_file(u64 page_id, ByteString path, i32) override; + virtual void did_request_color_picker(u64 page_id, Color current_color) override; + virtual void did_request_file_picker(u64 page_id, Web::HTML::FileFilter accepted_file_types, Web::HTML::AllowMultipleFiles) override; + virtual void did_request_select_dropdown(u64 page_id, Gfx::IntPoint content_position, i32 minimum_width, Vector items) override; virtual void did_finish_handling_input_event(u64 page_id, Web::EventResult event_result) override; - virtual void did_finish_text_test(u64 page_id, String const& text) override; + virtual void did_finish_text_test(u64 page_id, String text) override; virtual void did_set_test_timeout(u64 page_id, double milliseconds) override; virtual void did_set_browser_zoom(u64 page_id, double factor) override; - virtual void did_find_in_page(u64 page_id, size_t current_match_index, Optional const& total_match_count) override; + virtual void did_find_in_page(u64 page_id, size_t current_match_index, Optional total_match_count) override; virtual void did_change_theme_color(u64 page_id, Gfx::Color color) override; - virtual void did_insert_clipboard_entry(u64 page_id, String const& data, String const& presentation_style, String const& mime_type) override; + virtual void did_insert_clipboard_entry(u64 page_id, String data, String presentation_style, String mime_type) override; virtual void did_change_audio_play_state(u64 page_id, Web::HTML::AudioPlayState) override; virtual void did_update_navigation_buttons_state(u64 page_id, bool back_enabled, bool forward_enabled) override; - virtual void did_allocate_backing_stores(u64 page_id, i32 front_bitmap_id, Gfx::ShareableBitmap const&, i32 back_bitmap_id, Gfx::ShareableBitmap const&) override; + virtual void did_allocate_backing_stores(u64 page_id, i32 front_bitmap_id, Gfx::ShareableBitmap, i32 back_bitmap_id, Gfx::ShareableBitmap) override; virtual void inspector_did_load(u64 page_id) override; - virtual void inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional const& pseudo_element) override; - virtual void inspector_did_set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text) override; - virtual void inspector_did_set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& tag) override; - virtual void inspector_did_add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector const& attributes) override; - virtual void inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, size_t attribute_index, Vector const& replacement_attributes) override; - virtual void inspector_did_request_dom_tree_context_menu(u64 page_id, Web::UniqueNodeID const& node_id, Gfx::IntPoint position, String const& type, Optional const& tag, Optional const& attribute_index) override; + virtual void inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional pseudo_element) override; + virtual void inspector_did_set_dom_node_text(u64 page_id, Web::UniqueNodeID node_id, String text) override; + virtual void inspector_did_set_dom_node_tag(u64 page_id, Web::UniqueNodeID node_id, String tag) override; + virtual void inspector_did_add_dom_node_attributes(u64 page_id, Web::UniqueNodeID node_id, Vector attributes) override; + virtual void inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, size_t attribute_index, Vector replacement_attributes) override; + virtual void inspector_did_request_dom_tree_context_menu(u64 page_id, Web::UniqueNodeID node_id, Gfx::IntPoint position, String type, Optional tag, Optional attribute_index) override; virtual void inspector_did_request_cookie_context_menu(u64 page_id, size_t cookie_index, Gfx::IntPoint position) override; - virtual void inspector_did_execute_console_script(u64 page_id, String const& script) override; - virtual void inspector_did_export_inspector_html(u64 page_id, String const& html) override; + virtual void inspector_did_execute_console_script(u64 page_id, String script) override; + virtual void inspector_did_export_inspector_html(u64 page_id, String html) override; virtual Messages::WebContentClient::RequestWorkerAgentResponse request_worker_agent(u64 page_id) override; - virtual void inspector_did_list_style_sheets(u64 page_id, Vector const& stylesheets) override; - virtual void inspector_did_request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier) override; - virtual void did_get_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier, URL::URL const&, String const& source) override; + virtual void inspector_did_list_style_sheets(u64 page_id, Vector stylesheets) override; + virtual void inspector_did_request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier identifier) override; + virtual void did_get_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier identifier, URL::URL, String source) override; Optional view_for_page_id(u64, SourceLocation = SourceLocation::current()); diff --git a/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp b/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp index 11f887898eb..48fceef252d 100644 --- a/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp @@ -771,17 +771,20 @@ public: virtual u32 magic() const override { return @endpoint.magic@; } virtual ByteString name() const override { return "@endpoint.name@"; } - virtual ErrorOr> handle(const IPC::Message& message) override + virtual ErrorOr> handle(NonnullOwnPtr message) override { - switch (message.message_id()) {)~~~"); + switch (message->message_id()) {)~~~"); for (auto const& message : endpoint.messages) { auto do_handle_message = [&](ByteString const& name, Vector const& parameters, bool returns_something) { auto message_generator = generator.fork(); StringBuilder argument_generator; - for (size_t i = 0; i < parameters.size(); ++i) { - auto const& parameter = parameters[i]; - argument_generator.append("request."sv); + for (auto const& [i, parameter] : enumerate(parameters)) { + if (is_primitive_or_simple_type(parameter.type)) + argument_generator.append("request."sv); + else + argument_generator.append("request.take_"sv); + argument_generator.append(parameter.name); argument_generator.append("()"sv); if (i != parameters.size() - 1) @@ -797,19 +800,19 @@ public: if (returns_something) { if (message.outputs.is_empty()) { message_generator.append(R"~~~( - [[maybe_unused]] auto& request = static_cast(message); + [[maybe_unused]] auto& request = static_cast(*message); @handler_name@(@arguments@); auto response = Messages::@endpoint.name@::@message.response_type@ { }; return make(TRY(response.encode()));)~~~"); } else { message_generator.append(R"~~~( - [[maybe_unused]] auto& request = static_cast(message); + [[maybe_unused]] auto& request = static_cast(*message); auto response = @handler_name@(@arguments@); return make(TRY(response.encode()));)~~~"); } } else { message_generator.append(R"~~~( - [[maybe_unused]] auto& request = static_cast(message); + [[maybe_unused]] auto& request = static_cast(*message); @handler_name@(@arguments@); return nullptr;)~~~"); } @@ -827,9 +830,9 @@ public: for (auto const& message : endpoint.messages) { auto message_generator = generator.fork(); - auto do_handle_message_decl = [&](ByteString const& name, Vector const& parameters, bool is_response) { + auto do_handle_message_decl = [&](ByteString const& name, Vector const& parameters) { ByteString return_type = "void"; - if (message.is_synchronous && !message.outputs.is_empty() && !is_response) + if (message.is_synchronous && !message.outputs.is_empty()) return_type = message_name(endpoint.name, message.name, true); message_generator.set("message.complex_return_type", return_type); @@ -840,21 +843,17 @@ public: for (size_t i = 0; i < parameters.size(); ++i) { auto const& parameter = parameters[i]; auto argument_generator = message_generator.fork(); - argument_generator.set("argument.type", make_argument_type(parameter.type)); + argument_generator.set("argument.type", parameter.type); argument_generator.set("argument.name", parameter.name); - argument_generator.append("[[maybe_unused]] @argument.type@ @argument.name@"); + argument_generator.append("@argument.type@ @argument.name@"); if (i != parameters.size() - 1) argument_generator.append(", "); } - if (is_response) { - message_generator.append(") { };"); - } else { - message_generator.append(") = 0;"); - } + message_generator.append(") = 0;"); }; - do_handle_message_decl(message.name, message.inputs, false); + do_handle_message_decl(message.name, message.inputs); } generator.appendln(R"~~~( diff --git a/Services/ImageDecoder/ConnectionFromClient.cpp b/Services/ImageDecoder/ConnectionFromClient.cpp index cf0466bd779..08b04a10439 100644 --- a/Services/ImageDecoder/ConnectionFromClient.cpp +++ b/Services/ImageDecoder/ConnectionFromClient.cpp @@ -160,7 +160,7 @@ NonnullRefPtr ConnectionFromClient::make_decode_image }); } -Messages::ImageDecoderServer::DecodeImageResponse ConnectionFromClient::decode_image(Core::AnonymousBuffer const& encoded_buffer, Optional const& ideal_size, Optional const& mime_type) +Messages::ImageDecoderServer::DecodeImageResponse ConnectionFromClient::decode_image(Core::AnonymousBuffer encoded_buffer, Optional ideal_size, Optional mime_type) { auto image_id = m_next_image_id++; @@ -170,7 +170,7 @@ Messages::ImageDecoderServer::DecodeImageResponse ConnectionFromClient::decode_i return image_id; } - m_pending_jobs.set(image_id, make_decode_image_job(image_id, encoded_buffer, ideal_size, mime_type)); + m_pending_jobs.set(image_id, make_decode_image_job(image_id, move(encoded_buffer), ideal_size, move(mime_type))); return image_id; } diff --git a/Services/ImageDecoder/ConnectionFromClient.h b/Services/ImageDecoder/ConnectionFromClient.h index 8c6a09bd842..e75c2c89e03 100644 --- a/Services/ImageDecoder/ConnectionFromClient.h +++ b/Services/ImageDecoder/ConnectionFromClient.h @@ -40,7 +40,7 @@ private: explicit ConnectionFromClient(IPC::Transport); - virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer const&, Optional const& ideal_size, Optional const& mime_type) override; + virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer, Optional ideal_size, Optional mime_type) override; virtual void cancel_decoding(i64 image_id) override; virtual Messages::ImageDecoderServer::ConnectNewClientsResponse connect_new_clients(size_t count) override; virtual Messages::ImageDecoderServer::InitTransportResponse init_transport(int peer_pid) override; diff --git a/Services/RequestServer/ConnectionFromClient.cpp b/Services/RequestServer/ConnectionFromClient.cpp index 63d66fe1f31..235c83b3c7a 100644 --- a/Services/RequestServer/ConnectionFromClient.cpp +++ b/Services/RequestServer/ConnectionFromClient.cpp @@ -340,12 +340,12 @@ Messages::RequestServer::ConnectNewClientResponse ConnectionFromClient::connect_ return IPC::File::adopt_fd(socket_fds[1]); } -Messages::RequestServer::IsSupportedProtocolResponse ConnectionFromClient::is_supported_protocol(ByteString const& protocol) +Messages::RequestServer::IsSupportedProtocolResponse ConnectionFromClient::is_supported_protocol(ByteString protocol) { return protocol == "http"sv || protocol == "https"sv; } -void ConnectionFromClient::set_dns_server(ByteString const& host_or_address, u16 port, bool use_tls) +void ConnectionFromClient::set_dns_server(ByteString host_or_address, u16 port, bool use_tls) { if (host_or_address == g_dns_info.server_hostname && port == g_dns_info.port && use_tls == g_dns_info.use_dns_over_tls) return; @@ -372,7 +372,7 @@ void ConnectionFromClient::set_dns_server(ByteString const& host_or_address, u16 default_resolver()->dns.reset_connection(); } -void ConnectionFromClient::start_request(i32 request_id, ByteString const& method, URL::URL const& url, HTTP::HeaderMap const& request_headers, ByteBuffer const& request_body, Core::ProxyData const& proxy_data) +void ConnectionFromClient::start_request(i32 request_id, ByteString method, URL::URL url, HTTP::HeaderMap request_headers, ByteBuffer request_body, Core::ProxyData proxy_data) { auto host = url.serialized_host().to_byte_string(); @@ -386,7 +386,7 @@ void ConnectionFromClient::start_request(i32 request_id, ByteString const& metho // FIXME: Implement timing info for DNS lookup failure. async_request_finished(request_id, 0, {}, Requests::NetworkError::UnableToResolveHost); }) - .when_resolved([this, request_id, host, url, method, request_body, request_headers, proxy_data](auto const& dns_result) { + .when_resolved([this, request_id, host = move(host), url = move(url), method = move(method), request_body = move(request_body), request_headers = move(request_headers), proxy_data](auto const& dns_result) mutable { if (dns_result->records().is_empty() || dns_result->cached_addresses().is_empty()) { dbgln("StartRequest: DNS lookup failed for '{}'", host); // FIXME: Implement timing info for DNS lookup failure. @@ -438,7 +438,7 @@ void ConnectionFromClient::start_request(i32 request_id, ByteString const& metho if (method == "GET"sv) { set_option(CURLOPT_HTTPGET, 1L); } else if (method.is_one_of("POST"sv, "PUT"sv, "PATCH"sv, "DELETE"sv)) { - request->body = request_body; + request->body = move(request_body); set_option(CURLOPT_POSTFIELDSIZE, request->body.size()); set_option(CURLOPT_POSTFIELDS, request->body.data()); did_set_body = true; @@ -653,7 +653,7 @@ Messages::RequestServer::StopRequestResponse ConnectionFromClient::stop_request( return true; } -Messages::RequestServer::SetCertificateResponse ConnectionFromClient::set_certificate(i32 request_id, ByteString const& certificate, ByteString const& key) +Messages::RequestServer::SetCertificateResponse ConnectionFromClient::set_certificate(i32 request_id, ByteString certificate, ByteString key) { (void)request_id; (void)certificate; @@ -661,7 +661,7 @@ Messages::RequestServer::SetCertificateResponse ConnectionFromClient::set_certif TODO(); } -void ConnectionFromClient::ensure_connection(URL::URL const& url, ::RequestServer::CacheLevel const& cache_level) +void ConnectionFromClient::ensure_connection(URL::URL url, ::RequestServer::CacheLevel cache_level) { auto const url_string_value = url.to_string(); @@ -715,7 +715,7 @@ void ConnectionFromClient::ensure_connection(URL::URL const& url, ::RequestServe } } -void ConnectionFromClient::websocket_connect(i64 websocket_id, URL::URL const& url, ByteString const& origin, Vector const& protocols, Vector const& extensions, HTTP::HeaderMap const& additional_request_headers) +void ConnectionFromClient::websocket_connect(i64 websocket_id, URL::URL url, ByteString origin, Vector protocols, Vector extensions, HTTP::HeaderMap additional_request_headers) { auto host = url.serialized_host().to_byte_string(); @@ -728,18 +728,18 @@ void ConnectionFromClient::websocket_connect(i64 websocket_id, URL::URL const& u dbgln("WebSocketConnect: DNS lookup failed: {}", error); async_websocket_errored(websocket_id, static_cast(Requests::WebSocket::Error::CouldNotEstablishConnection)); }) - .when_resolved([this, websocket_id, host, url, origin, protocols, extensions, additional_request_headers](auto dns_result) { + .when_resolved([this, websocket_id, host = move(host), url = move(url), origin = move(origin), protocols = move(protocols), extensions = move(extensions), additional_request_headers = move(additional_request_headers)](auto const& dns_result) mutable { if (dns_result->records().is_empty() || dns_result->cached_addresses().is_empty()) { dbgln("WebSocketConnect: DNS lookup failed for '{}'", host); async_websocket_errored(websocket_id, static_cast(Requests::WebSocket::Error::CouldNotEstablishConnection)); return; } - WebSocket::ConnectionInfo connection_info(url); - connection_info.set_origin(origin); - connection_info.set_protocols(protocols); - connection_info.set_extensions(extensions); - connection_info.set_headers(additional_request_headers); + WebSocket::ConnectionInfo connection_info(move(url)); + connection_info.set_origin(move(origin)); + connection_info.set_protocols(move(protocols)); + connection_info.set_extensions(move(extensions)); + connection_info.set_headers(move(additional_request_headers)); connection_info.set_dns_result(move(dns_result)); if (!g_default_certificate_path.is_empty()) @@ -769,19 +769,19 @@ void ConnectionFromClient::websocket_connect(i64 websocket_id, URL::URL const& u }); } -void ConnectionFromClient::websocket_send(i64 websocket_id, bool is_text, ByteBuffer const& data) +void ConnectionFromClient::websocket_send(i64 websocket_id, bool is_text, ByteBuffer data) { if (auto connection = m_websockets.get(websocket_id).value_or({}); connection && connection->ready_state() == WebSocket::ReadyState::Open) - connection->send(WebSocket::Message { data, is_text }); + connection->send(WebSocket::Message { move(data), is_text }); } -void ConnectionFromClient::websocket_close(i64 websocket_id, u16 code, ByteString const& reason) +void ConnectionFromClient::websocket_close(i64 websocket_id, u16 code, ByteString reason) { if (auto connection = m_websockets.get(websocket_id).value_or({}); connection && connection->ready_state() == WebSocket::ReadyState::Open) connection->close(code, reason); } -Messages::RequestServer::WebsocketSetCertificateResponse ConnectionFromClient::websocket_set_certificate(i64 websocket_id, ByteString const&, ByteString const&) +Messages::RequestServer::WebsocketSetCertificateResponse ConnectionFromClient::websocket_set_certificate(i64 websocket_id, ByteString, ByteString) { auto success = false; if (auto connection = m_websockets.get(websocket_id).value_or({}); connection) { diff --git a/Services/RequestServer/ConnectionFromClient.h b/Services/RequestServer/ConnectionFromClient.h index 0e6540059c6..c378f80f99d 100644 --- a/Services/RequestServer/ConnectionFromClient.h +++ b/Services/RequestServer/ConnectionFromClient.h @@ -40,17 +40,17 @@ private: virtual Messages::RequestServer::InitTransportResponse init_transport(int peer_pid) override; virtual Messages::RequestServer::ConnectNewClientResponse connect_new_client() override; - virtual Messages::RequestServer::IsSupportedProtocolResponse is_supported_protocol(ByteString const&) override; - virtual void set_dns_server(ByteString const& host_or_address, u16 port, bool use_tls) override; - virtual void start_request(i32 request_id, ByteString const&, URL::URL const&, HTTP::HeaderMap const&, ByteBuffer const&, Core::ProxyData const&) override; + virtual Messages::RequestServer::IsSupportedProtocolResponse is_supported_protocol(ByteString) override; + virtual void set_dns_server(ByteString host_or_address, u16 port, bool use_tls) override; + virtual void start_request(i32 request_id, ByteString, URL::URL, HTTP::HeaderMap, ByteBuffer, Core::ProxyData) override; virtual Messages::RequestServer::StopRequestResponse stop_request(i32) override; - virtual Messages::RequestServer::SetCertificateResponse set_certificate(i32, ByteString const&, ByteString const&) override; - virtual void ensure_connection(URL::URL const& url, ::RequestServer::CacheLevel const& cache_level) override; + virtual Messages::RequestServer::SetCertificateResponse set_certificate(i32, ByteString, ByteString) override; + virtual void ensure_connection(URL::URL url, ::RequestServer::CacheLevel cache_level) override; - virtual void websocket_connect(i64 websocket_id, URL::URL const&, ByteString const&, Vector const&, Vector const&, HTTP::HeaderMap const&) override; - virtual void websocket_send(i64 websocket_id, bool, ByteBuffer const&) override; - virtual void websocket_close(i64 websocket_id, u16, ByteString const&) override; - virtual Messages::RequestServer::WebsocketSetCertificateResponse websocket_set_certificate(i64, ByteString const&, ByteString const&) override; + virtual void websocket_connect(i64 websocket_id, URL::URL, ByteString, Vector, Vector, HTTP::HeaderMap) override; + virtual void websocket_send(i64 websocket_id, bool, ByteBuffer) override; + virtual void websocket_close(i64 websocket_id, u16, ByteString) override; + virtual Messages::RequestServer::WebsocketSetCertificateResponse websocket_set_certificate(i64, ByteString, ByteString) override; HashMap> m_websockets; diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cpp index a7807c3d939..dc1acf9d80d 100644 --- a/Services/WebContent/ConnectionFromClient.cpp +++ b/Services/WebContent/ConnectionFromClient.cpp @@ -109,13 +109,13 @@ Messages::WebContentServer::GetWindowHandleResponse ConnectionFromClient::get_wi return String {}; } -void ConnectionFromClient::set_window_handle(u64 page_id, String const& handle) +void ConnectionFromClient::set_window_handle(u64 page_id, String handle) { if (auto page = this->page(page_id); page.has_value()) - page->page().top_level_traversable()->set_window_handle(handle); + page->page().top_level_traversable()->set_window_handle(move(handle)); } -void ConnectionFromClient::connect_to_webdriver(u64 page_id, ByteString const& webdriver_ipc_path) +void ConnectionFromClient::connect_to_webdriver(u64 page_id, ByteString webdriver_ipc_path) { if (auto page = this->page(page_id); page.has_value()) { // FIXME: Propagate this error back to the browser. @@ -124,13 +124,13 @@ void ConnectionFromClient::connect_to_webdriver(u64 page_id, ByteString const& w } } -void ConnectionFromClient::connect_to_image_decoder(IPC::File const& image_decoder_socket) +void ConnectionFromClient::connect_to_image_decoder(IPC::File image_decoder_socket) { if (on_image_decoder_connection) on_image_decoder_connection(image_decoder_socket); } -void ConnectionFromClient::update_system_theme(u64 page_id, Core::AnonymousBuffer const& theme_buffer) +void ConnectionFromClient::update_system_theme(u64 page_id, Core::AnonymousBuffer theme_buffer) { auto page = this->page(page_id); if (!page.has_value()) @@ -141,13 +141,13 @@ void ConnectionFromClient::update_system_theme(u64 page_id, Core::AnonymousBuffe page->set_palette_impl(*impl); } -void ConnectionFromClient::update_screen_rects(u64 page_id, Vector const& rects, u32 main_screen) +void ConnectionFromClient::update_screen_rects(u64 page_id, Vector rects, u32 main_screen) { if (auto page = this->page(page_id); page.has_value()) page->set_screen_rects(rects, main_screen); } -void ConnectionFromClient::load_url(u64 page_id, const URL::URL& url) +void ConnectionFromClient::load_url(u64 page_id, URL::URL url) { auto page = this->page(page_id); if (!page.has_value()) @@ -156,7 +156,7 @@ void ConnectionFromClient::load_url(u64 page_id, const URL::URL& url) page->page().load(url); } -void ConnectionFromClient::load_html(u64 page_id, ByteString const& html) +void ConnectionFromClient::load_html(u64 page_id, ByteString html) { if (auto page = this->page(page_id); page.has_value()) page->page().load_html(html); @@ -174,7 +174,7 @@ void ConnectionFromClient::traverse_the_history_by_delta(u64 page_id, i32 delta) page->page().traverse_the_history_by_delta(delta); } -void ConnectionFromClient::set_viewport_size(u64 page_id, Web::DevicePixelSize const size) +void ConnectionFromClient::set_viewport_size(u64 page_id, Web::DevicePixelSize size) { if (auto page = this->page(page_id); page.has_value()) page->set_viewport_size(size); @@ -186,12 +186,12 @@ void ConnectionFromClient::ready_to_paint(u64 page_id) page->ready_to_paint(); } -void ConnectionFromClient::key_event(u64 page_id, Web::KeyEvent const& event) +void ConnectionFromClient::key_event(u64 page_id, Web::KeyEvent event) { - enqueue_input_event({ page_id, move(const_cast(event)), 0 }); + enqueue_input_event({ page_id, move(event), 0 }); } -void ConnectionFromClient::mouse_event(u64 page_id, Web::MouseEvent const& event) +void ConnectionFromClient::mouse_event(u64 page_id, Web::MouseEvent event) { // OPTIMIZATION: Coalesce consecutive unprocessed mouse move and wheel events. auto event_to_coalesce = [&]() -> Web::MouseEvent const* { @@ -212,22 +212,21 @@ void ConnectionFromClient::mouse_event(u64 page_id, Web::MouseEvent const& event }; if (auto const* last_mouse_event = event_to_coalesce()) { - auto& mutable_event = const_cast(event); - mutable_event.wheel_delta_x += last_mouse_event->wheel_delta_x; - mutable_event.wheel_delta_y += last_mouse_event->wheel_delta_y; + event.wheel_delta_x += last_mouse_event->wheel_delta_x; + event.wheel_delta_y += last_mouse_event->wheel_delta_y; - m_input_event_queue.tail().event = move(mutable_event); + m_input_event_queue.tail().event = move(event); ++m_input_event_queue.tail().coalesced_event_count; return; } - enqueue_input_event({ page_id, move(const_cast(event)), 0 }); + enqueue_input_event({ page_id, move(event), 0 }); } -void ConnectionFromClient::drag_event(u64 page_id, Web::DragEvent const& event) +void ConnectionFromClient::drag_event(u64 page_id, Web::DragEvent event) { - enqueue_input_event({ page_id, move(const_cast(event)), 0 }); + enqueue_input_event({ page_id, move(event), 0 }); } void ConnectionFromClient::enqueue_input_event(Web::QueuedInputEvent event) @@ -235,7 +234,7 @@ void ConnectionFromClient::enqueue_input_event(Web::QueuedInputEvent event) m_input_event_queue.enqueue(move(event)); } -void ConnectionFromClient::debug_request(u64 page_id, ByteString const& request, ByteString const& argument) +void ConnectionFromClient::debug_request(u64 page_id, ByteString request, ByteString argument) { auto page = this->page(page_id); if (!page.has_value()) @@ -434,7 +433,7 @@ void ConnectionFromClient::inspect_dom_tree(u64 page_id) } } -void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional const& pseudo_element) +void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional pseudo_element) { auto page = this->page(page_id); if (!page.has_value()) @@ -599,7 +598,7 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const async_did_inspect_dom_node(page_id, false, String {}, String {}, String {}, String {}, String {}, String {}); } -void ConnectionFromClient::highlight_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional const& pseudo_element) +void ConnectionFromClient::highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional pseudo_element) { auto page = this->page(page_id); if (!page.has_value()) @@ -651,7 +650,7 @@ void ConnectionFromClient::list_style_sheets(u64 page_id) async_inspector_did_list_style_sheets(page_id, page->list_style_sheets()); } -void ConnectionFromClient::request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier) +void ConnectionFromClient::request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier identifier) { auto page = this->page(page_id); if (!page.has_value()) @@ -672,7 +671,7 @@ void ConnectionFromClient::set_listen_for_dom_mutations(u64 page_id, bool listen page->page().set_listen_for_dom_mutations(listen_for_dom_mutations); } -void ConnectionFromClient::set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text) +void ConnectionFromClient::set_dom_node_text(u64 page_id, Web::UniqueNodeID node_id, String text) { auto* dom_node = Web::DOM::Node::from_unique_id(node_id); if (!dom_node || (!dom_node->is_text() && !dom_node->is_comment())) { @@ -686,7 +685,7 @@ void ConnectionFromClient::set_dom_node_text(u64 page_id, Web::UniqueNodeID cons async_did_finish_editing_dom_node(page_id, character_data.unique_id()); } -void ConnectionFromClient::set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& name) +void ConnectionFromClient::set_dom_node_tag(u64 page_id, Web::UniqueNodeID node_id, String name) { auto* dom_node = Web::DOM::Node::from_unique_id(node_id); if (!dom_node || !dom_node->is_element() || !dom_node->parent()) { @@ -710,7 +709,7 @@ void ConnectionFromClient::set_dom_node_tag(u64 page_id, Web::UniqueNodeID const async_did_finish_editing_dom_node(page_id, new_element->unique_id()); } -void ConnectionFromClient::add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector const& attributes) +void ConnectionFromClient::add_dom_node_attributes(u64 page_id, Web::UniqueNodeID node_id, Vector attributes) { auto* dom_node = Web::DOM::Node::from_unique_id(node_id); if (!dom_node || !dom_node->is_element()) { @@ -728,7 +727,7 @@ void ConnectionFromClient::add_dom_node_attributes(u64 page_id, Web::UniqueNodeI async_did_finish_editing_dom_node(page_id, element.unique_id()); } -void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, String const& name, Vector const& replacement_attributes) +void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, String name, Vector replacement_attributes) { auto* dom_node = Web::DOM::Node::from_unique_id(node_id); if (!dom_node || !dom_node->is_element()) { @@ -753,7 +752,7 @@ void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, Web::UniqueNo async_did_finish_editing_dom_node(page_id, element.unique_id()); } -void ConnectionFromClient::create_child_element(u64 page_id, Web::UniqueNodeID const& node_id) +void ConnectionFromClient::create_child_element(u64 page_id, Web::UniqueNodeID node_id) { auto* dom_node = Web::DOM::Node::from_unique_id(node_id); if (!dom_node) { @@ -767,7 +766,7 @@ void ConnectionFromClient::create_child_element(u64 page_id, Web::UniqueNodeID c async_did_finish_editing_dom_node(page_id, element->unique_id()); } -void ConnectionFromClient::create_child_text_node(u64 page_id, Web::UniqueNodeID const& node_id) +void ConnectionFromClient::create_child_text_node(u64 page_id, Web::UniqueNodeID node_id) { auto* dom_node = Web::DOM::Node::from_unique_id(node_id); if (!dom_node) { @@ -781,7 +780,7 @@ void ConnectionFromClient::create_child_text_node(u64 page_id, Web::UniqueNodeID async_did_finish_editing_dom_node(page_id, text_node->unique_id()); } -void ConnectionFromClient::clone_dom_node(u64 page_id, Web::UniqueNodeID const& node_id) +void ConnectionFromClient::clone_dom_node(u64 page_id, Web::UniqueNodeID node_id) { auto* dom_node = Web::DOM::Node::from_unique_id(node_id); if (!dom_node || !dom_node->parent_node()) { @@ -795,7 +794,7 @@ void ConnectionFromClient::clone_dom_node(u64 page_id, Web::UniqueNodeID const& async_did_finish_editing_dom_node(page_id, dom_node_clone->unique_id()); } -void ConnectionFromClient::remove_dom_node(u64 page_id, Web::UniqueNodeID const& node_id) +void ConnectionFromClient::remove_dom_node(u64 page_id, Web::UniqueNodeID node_id) { auto page = this->page(page_id); if (!page.has_value()) @@ -822,7 +821,7 @@ void ConnectionFromClient::remove_dom_node(u64 page_id, Web::UniqueNodeID const& async_did_finish_editing_dom_node(page_id, previous_dom_node->unique_id()); } -void ConnectionFromClient::get_dom_node_html(u64 page_id, Web::UniqueNodeID const& node_id) +void ConnectionFromClient::get_dom_node_html(u64 page_id, Web::UniqueNodeID node_id) { auto* dom_node = Web::DOM::Node::from_unique_id(node_id); if (!dom_node) @@ -852,7 +851,7 @@ void ConnectionFromClient::take_document_screenshot(u64 page_id) page->queue_screenshot_task({}); } -void ConnectionFromClient::take_dom_node_screenshot(u64 page_id, Web::UniqueNodeID const& node_id) +void ConnectionFromClient::take_dom_node_screenshot(u64 page_id, Web::UniqueNodeID node_id) { auto page = this->page(page_id); if (!page.has_value()) @@ -974,7 +973,7 @@ void ConnectionFromClient::select_all(u64 page_id) page->page().focused_navigable().select_all(); } -void ConnectionFromClient::find_in_page(u64 page_id, String const& query, CaseSensitivity case_sensitivity) +void ConnectionFromClient::find_in_page(u64 page_id, String query, CaseSensitivity case_sensitivity) { auto page = this->page(page_id); if (!page.has_value()) @@ -1004,13 +1003,13 @@ void ConnectionFromClient::find_in_page_previous_match(u64 page_id) async_did_find_in_page(page_id, result.current_match_index, result.total_match_count); } -void ConnectionFromClient::paste(u64 page_id, String const& text) +void ConnectionFromClient::paste(u64 page_id, String text) { if (auto page = this->page(page_id); page.has_value()) page->page().focused_navigable().paste(text); } -void ConnectionFromClient::set_content_filters(u64, Vector const& filters) +void ConnectionFromClient::set_content_filters(u64, Vector filters) { Web::ContentFilter::the().set_patterns(filters).release_value_but_fixme_should_propagate_errors(); } @@ -1021,13 +1020,13 @@ void ConnectionFromClient::set_autoplay_allowed_on_all_websites(u64) autoplay_allowlist.enable_globally(); } -void ConnectionFromClient::set_autoplay_allowlist(u64, Vector const& allowlist) +void ConnectionFromClient::set_autoplay_allowlist(u64, Vector allowlist) { auto& autoplay_allowlist = Web::PermissionsPolicy::AutoplayAllowlist::the(); autoplay_allowlist.enable_for_origins(allowlist).release_value_but_fixme_should_propagate_errors(); } -void ConnectionFromClient::set_proxy_mappings(u64, Vector const& proxies, HashMap const& mappings) +void ConnectionFromClient::set_proxy_mappings(u64, Vector proxies, HashMap mappings) { auto keys = mappings.keys(); quick_sort(keys, [&](auto& a, auto& b) { return a.length() < b.length(); }); @@ -1040,34 +1039,34 @@ void ConnectionFromClient::set_proxy_mappings(u64, Vector const& pro sorted_mappings.set(key, value); } - Web::ProxyMappings::the().set_mappings(proxies, move(sorted_mappings)); + Web::ProxyMappings::the().set_mappings(move(proxies), move(sorted_mappings)); } -void ConnectionFromClient::set_preferred_color_scheme(u64 page_id, Web::CSS::PreferredColorScheme const& color_scheme) +void ConnectionFromClient::set_preferred_color_scheme(u64 page_id, Web::CSS::PreferredColorScheme color_scheme) { if (auto page = this->page(page_id); page.has_value()) page->set_preferred_color_scheme(color_scheme); } -void ConnectionFromClient::set_preferred_contrast(u64 page_id, Web::CSS::PreferredContrast const& contrast) +void ConnectionFromClient::set_preferred_contrast(u64 page_id, Web::CSS::PreferredContrast contrast) { if (auto page = this->page(page_id); page.has_value()) page->set_preferred_contrast(contrast); } -void ConnectionFromClient::set_preferred_motion(u64 page_id, Web::CSS::PreferredMotion const& motion) +void ConnectionFromClient::set_preferred_motion(u64 page_id, Web::CSS::PreferredMotion motion) { if (auto page = this->page(page_id); page.has_value()) page->set_preferred_motion(motion); } -void ConnectionFromClient::set_preferred_languages(u64, Vector const& preferred_languages) +void ConnectionFromClient::set_preferred_languages(u64, Vector preferred_languages) { // FIXME: Whenever the user agent needs to make the navigator.languages attribute of a Window or WorkerGlobalScope // object global return a new set of language tags, the user agent must queue a global task on the DOM manipulation // task source given global to fire an event named languagechange at global, and wait until that task begins to be // executed before actually returning a new value. - Web::ResourceLoader::the().set_preferred_languages(preferred_languages); + Web::ResourceLoader::the().set_preferred_languages(move(preferred_languages)); } void ConnectionFromClient::set_enable_do_not_track(u64, bool enable) @@ -1133,7 +1132,7 @@ Messages::WebContentServer::GetSessionStorageEntriesResponse ConnectionFromClien return session_storage->map(); } -void ConnectionFromClient::handle_file_return(u64, i32 error, Optional const& file, i32 request_id) +void ConnectionFromClient::handle_file_return(u64, i32 error, Optional file, i32 request_id) { auto file_request = m_requested_files.take(request_id); @@ -1159,7 +1158,7 @@ void ConnectionFromClient::set_system_visibility_state(u64 page_id, Web::HTML::V page->page().top_level_traversable()->set_system_visibility_state(visibility_state); } -void ConnectionFromClient::js_console_input(u64 page_id, String const& js_source) +void ConnectionFromClient::js_console_input(u64 page_id, String js_source) { auto page = this->page(page_id); if (!page.has_value()) @@ -1168,7 +1167,7 @@ void ConnectionFromClient::js_console_input(u64 page_id, String const& js_source page->js_console_input(js_source); } -void ConnectionFromClient::run_javascript(u64 page_id, String const& js_source) +void ConnectionFromClient::run_javascript(u64 page_id, String js_source) { if (auto page = this->page(page_id); page.has_value()) page->run_javascript(js_source); @@ -1192,25 +1191,25 @@ void ConnectionFromClient::confirm_closed(u64 page_id, bool accepted) page->page().confirm_closed(accepted); } -void ConnectionFromClient::prompt_closed(u64 page_id, Optional const& response) +void ConnectionFromClient::prompt_closed(u64 page_id, Optional response) { if (auto page = this->page(page_id); page.has_value()) - page->page().prompt_closed(response); + page->page().prompt_closed(move(response)); } -void ConnectionFromClient::color_picker_update(u64 page_id, Optional const& picked_color, Web::HTML::ColorPickerUpdateState const& state) +void ConnectionFromClient::color_picker_update(u64 page_id, Optional picked_color, Web::HTML::ColorPickerUpdateState state) { if (auto page = this->page(page_id); page.has_value()) page->page().color_picker_update(picked_color, state); } -void ConnectionFromClient::file_picker_closed(u64 page_id, Vector const& selected_files) +void ConnectionFromClient::file_picker_closed(u64 page_id, Vector selected_files) { if (auto page = this->page(page_id); page.has_value()) - page->page().file_picker_closed(const_cast&>(selected_files)); + page->page().file_picker_closed(selected_files); } -void ConnectionFromClient::select_dropdown_closed(u64 page_id, Optional const& selected_item_id) +void ConnectionFromClient::select_dropdown_closed(u64 page_id, Optional selected_item_id) { if (auto page = this->page(page_id); page.has_value()) page->page().select_dropdown_closed(selected_item_id); @@ -1246,10 +1245,10 @@ void ConnectionFromClient::toggle_page_mute_state(u64 page_id) page->page().toggle_page_mute_state(); } -void ConnectionFromClient::set_user_style(u64 page_id, String const& source) +void ConnectionFromClient::set_user_style(u64 page_id, String source) { if (auto page = this->page(page_id); page.has_value()) - page->page().set_user_style(source); + page->page().set_user_style(move(source)); } void ConnectionFromClient::enable_inspector_prototype(u64) diff --git a/Services/WebContent/ConnectionFromClient.h b/Services/WebContent/ConnectionFromClient.h index ca1785b505d..8ba5b0eb351 100644 --- a/Services/WebContent/ConnectionFromClient.h +++ b/Services/WebContent/ConnectionFromClient.h @@ -58,50 +58,50 @@ private: virtual Messages::WebContentServer::InitTransportResponse init_transport(int peer_pid) override; virtual void close_server() override; virtual Messages::WebContentServer::GetWindowHandleResponse get_window_handle(u64 page_id) override; - virtual void set_window_handle(u64 page_id, String const& handle) override; - virtual void connect_to_webdriver(u64 page_id, ByteString const& webdriver_ipc_path) override; - virtual void connect_to_image_decoder(IPC::File const& image_decoder_socket) override; - virtual void update_system_theme(u64 page_id, Core::AnonymousBuffer const&) override; - virtual void update_screen_rects(u64 page_id, Vector const&, u32) override; - virtual void load_url(u64 page_id, URL::URL const&) override; - virtual void load_html(u64 page_id, ByteString const&) override; + virtual void set_window_handle(u64 page_id, String handle) override; + virtual void connect_to_webdriver(u64 page_id, ByteString webdriver_ipc_path) override; + virtual void connect_to_image_decoder(IPC::File image_decoder_socket) override; + virtual void update_system_theme(u64 page_id, Core::AnonymousBuffer) override; + virtual void update_screen_rects(u64 page_id, Vector, u32) override; + virtual void load_url(u64 page_id, URL::URL) override; + virtual void load_html(u64 page_id, ByteString) override; virtual void reload(u64 page_id) override; virtual void traverse_the_history_by_delta(u64 page_id, i32 delta) override; - virtual void set_viewport_size(u64 page_id, Web::DevicePixelSize const) override; - virtual void key_event(u64 page_id, Web::KeyEvent const&) override; - virtual void mouse_event(u64 page_id, Web::MouseEvent const&) override; - virtual void drag_event(u64 page_id, Web::DragEvent const&) override; + virtual void set_viewport_size(u64 page_id, Web::DevicePixelSize) override; + virtual void key_event(u64 page_id, Web::KeyEvent) override; + virtual void mouse_event(u64 page_id, Web::MouseEvent) override; + virtual void drag_event(u64 page_id, Web::DragEvent) override; virtual void ready_to_paint(u64 page_id) override; - virtual void debug_request(u64 page_id, ByteString const&, ByteString const&) override; + virtual void debug_request(u64 page_id, ByteString, ByteString) override; virtual void get_source(u64 page_id) override; virtual void inspect_dom_tree(u64 page_id) override; - virtual void inspect_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional const& pseudo_element) override; - virtual void highlight_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional const& pseudo_element) override; + virtual void inspect_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional pseudo_element) override; + virtual void highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional pseudo_element) override; virtual void inspect_accessibility_tree(u64 page_id) override; virtual void get_hovered_node_id(u64 page_id) override; virtual void list_style_sheets(u64 page_id) override; - virtual void request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier) override; + virtual void request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier identifier) override; virtual void set_listen_for_dom_mutations(u64 page_id, bool) override; - virtual void set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text) override; - virtual void set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& name) override; - virtual void add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector const& attributes) override; - virtual void replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, String const& name, Vector const& replacement_attributes) override; - virtual void create_child_element(u64 page_id, Web::UniqueNodeID const& node_id) override; - virtual void create_child_text_node(u64 page_id, Web::UniqueNodeID const& node_id) override; - virtual void clone_dom_node(u64 page_id, Web::UniqueNodeID const& node_id) override; - virtual void remove_dom_node(u64 page_id, Web::UniqueNodeID const& node_id) override; - virtual void get_dom_node_html(u64 page_id, Web::UniqueNodeID const& node_id) override; + virtual void set_dom_node_text(u64 page_id, Web::UniqueNodeID node_id, String text) override; + virtual void set_dom_node_tag(u64 page_id, Web::UniqueNodeID node_id, String name) override; + virtual void add_dom_node_attributes(u64 page_id, Web::UniqueNodeID node_id, Vector attributes) override; + virtual void replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, String name, Vector replacement_attributes) override; + virtual void create_child_element(u64 page_id, Web::UniqueNodeID node_id) override; + virtual void create_child_text_node(u64 page_id, Web::UniqueNodeID node_id) override; + virtual void clone_dom_node(u64 page_id, Web::UniqueNodeID node_id) override; + virtual void remove_dom_node(u64 page_id, Web::UniqueNodeID node_id) override; + virtual void get_dom_node_html(u64 page_id, Web::UniqueNodeID node_id) override; - virtual void set_content_filters(u64 page_id, Vector const&) override; + virtual void set_content_filters(u64 page_id, Vector) override; virtual void set_autoplay_allowed_on_all_websites(u64 page_id) override; - virtual void set_autoplay_allowlist(u64 page_id, Vector const& allowlist) override; - virtual void set_proxy_mappings(u64 page_id, Vector const&, HashMap const&) override; - virtual void set_preferred_color_scheme(u64 page_id, Web::CSS::PreferredColorScheme const&) override; - virtual void set_preferred_contrast(u64 page_id, Web::CSS::PreferredContrast const&) override; - virtual void set_preferred_motion(u64 page_id, Web::CSS::PreferredMotion const&) override; - virtual void set_preferred_languages(u64 page_id, Vector const&) override; + virtual void set_autoplay_allowlist(u64 page_id, Vector allowlist) override; + virtual void set_proxy_mappings(u64 page_id, Vector, HashMap) override; + virtual void set_preferred_color_scheme(u64 page_id, Web::CSS::PreferredColorScheme) override; + virtual void set_preferred_contrast(u64 page_id, Web::CSS::PreferredContrast) override; + virtual void set_preferred_motion(u64 page_id, Web::CSS::PreferredMotion) override; + virtual void set_preferred_languages(u64 page_id, Vector) override; virtual void set_enable_do_not_track(u64 page_id, bool) override; virtual void set_has_focus(u64 page_id, bool) override; virtual void set_is_scripting_enabled(u64 page_id, bool) override; @@ -109,19 +109,19 @@ private: virtual void set_window_position(u64 page_id, Web::DevicePixelPoint) override; virtual void set_window_size(u64 page_id, Web::DevicePixelSize) override; virtual void did_update_window_rect(u64 page_id) override; - virtual void handle_file_return(u64 page_id, i32 error, Optional const& file, i32 request_id) override; + virtual void handle_file_return(u64 page_id, i32 error, Optional file, i32 request_id) override; virtual void set_system_visibility_state(u64 page_id, Web::HTML::VisibilityState) override; - virtual void js_console_input(u64 page_id, String const&) override; - virtual void run_javascript(u64 page_id, String const&) override; + virtual void js_console_input(u64 page_id, String) override; + virtual void run_javascript(u64 page_id, String) override; virtual void js_console_request_messages(u64 page_id, i32) override; virtual void alert_closed(u64 page_id) override; virtual void confirm_closed(u64 page_id, bool accepted) override; - virtual void prompt_closed(u64 page_id, Optional const& response) override; - virtual void color_picker_update(u64 page_id, Optional const& picked_color, Web::HTML::ColorPickerUpdateState const& state) override; - virtual void file_picker_closed(u64 page_id, Vector const& selected_files) override; - virtual void select_dropdown_closed(u64 page_id, Optional const& selected_item_id) override; + virtual void prompt_closed(u64 page_id, Optional response) override; + virtual void color_picker_update(u64 page_id, Optional picked_color, Web::HTML::ColorPickerUpdateState state) override; + virtual void file_picker_closed(u64 page_id, Vector selected_files) override; + virtual void select_dropdown_closed(u64 page_id, Optional selected_item_id) override; virtual void toggle_media_play_state(u64 page_id) override; virtual void toggle_media_mute_state(u64 page_id) override; @@ -130,12 +130,12 @@ private: virtual void toggle_page_mute_state(u64 page_id) override; - virtual void set_user_style(u64 page_id, String const&) override; + virtual void set_user_style(u64 page_id, String) override; virtual void enable_inspector_prototype(u64 page_id) override; virtual void take_document_screenshot(u64 page_id) override; - virtual void take_dom_node_screenshot(u64 page_id, Web::UniqueNodeID const& node_id) override; + virtual void take_dom_node_screenshot(u64 page_id, Web::UniqueNodeID node_id) override; virtual void request_internal_page_info(u64 page_id, WebView::PageInfoType) override; @@ -145,11 +145,11 @@ private: virtual Messages::WebContentServer::GetSelectedTextResponse get_selected_text(u64 page_id) override; virtual void select_all(u64 page_id) override; - virtual void find_in_page(u64 page_id, String const& query, CaseSensitivity) override; + virtual void find_in_page(u64 page_id, String query, CaseSensitivity) override; virtual void find_in_page_next_match(u64 page_id) override; virtual void find_in_page_previous_match(u64 page_id) override; - virtual void paste(u64 page_id, String const& text) override; + virtual void paste(u64 page_id, String text) override; virtual void system_time_zone_changed() override; diff --git a/Services/WebContent/WebDriverConnection.cpp b/Services/WebContent/WebDriverConnection.cpp index 28beabe2ec8..93ded1ccbc1 100644 --- a/Services/WebContent/WebDriverConnection.cpp +++ b/Services/WebContent/WebDriverConnection.cpp @@ -231,14 +231,14 @@ void WebDriverConnection::close_session() } } -void WebDriverConnection::set_page_load_strategy(Web::WebDriver::PageLoadStrategy const& page_load_strategy) +void WebDriverConnection::set_page_load_strategy(Web::WebDriver::PageLoadStrategy page_load_strategy) { m_page_load_strategy = page_load_strategy; } -void WebDriverConnection::set_user_prompt_handler(Web::WebDriver::UserPromptHandler const& user_prompt_handler) +void WebDriverConnection::set_user_prompt_handler(Web::WebDriver::UserPromptHandler user_prompt_handler) { - Web::WebDriver::set_user_prompt_handler(move(const_cast(user_prompt_handler))); + Web::WebDriver::set_user_prompt_handler(move(user_prompt_handler)); } void WebDriverConnection::set_strict_file_interactability(bool strict_file_interactability) @@ -262,7 +262,7 @@ Messages::WebDriverClient::GetTimeoutsResponse WebDriverConnection::get_timeouts } // 9.2 Set Timeouts, https://w3c.github.io/webdriver/#dfn-set-timeouts -Messages::WebDriverClient::SetTimeoutsResponse WebDriverConnection::set_timeouts(JsonValue const& payload) +Messages::WebDriverClient::SetTimeoutsResponse WebDriverConnection::set_timeouts(JsonValue payload) { // FIXME: Spec issue: As written, the spec replaces the timeouts configuration with the newly provided values. But // all other implementations update the existing configuration with any new values instead. WPT relies on @@ -280,7 +280,7 @@ Messages::WebDriverClient::SetTimeoutsResponse WebDriverConnection::set_timeouts } // 10.1 Navigate To, https://w3c.github.io/webdriver/#navigate-to -Messages::WebDriverClient::NavigateToResponse WebDriverConnection::navigate_to(JsonValue const& payload) +Messages::WebDriverClient::NavigateToResponse WebDriverConnection::navigate_to(JsonValue payload) { // 1. If the current top-level browsing context is no longer open, return error with error code no such window. TRY(ensure_current_top_level_browsing_context_is_open()); @@ -565,7 +565,7 @@ Messages::WebDriverClient::CloseWindowResponse WebDriverConnection::close_window } // 11.3 Switch to Window, https://w3c.github.io/webdriver/#dfn-switch-to-window -Messages::WebDriverClient::SwitchToWindowResponse WebDriverConnection::switch_to_window(String const& handle) +Messages::WebDriverClient::SwitchToWindowResponse WebDriverConnection::switch_to_window(String handle) { // 4. If handle is equal to the associated window handle for some top-level browsing context, let context be the that // browsing context, and set the current top-level browsing context with session and context. @@ -595,7 +595,7 @@ Messages::WebDriverClient::SwitchToWindowResponse WebDriverConnection::switch_to } // 11.5 New Window, https://w3c.github.io/webdriver/#dfn-new-window -Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(JsonValue const& payload) +Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(JsonValue payload) { // 1. If the implementation does not support creating new top-level browsing contexts, return error with error code unsupported operation. @@ -603,7 +603,7 @@ Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(Jso TRY(ensure_current_top_level_browsing_context_is_open()); // 3. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, payload = move(const_cast(payload))]() { + handle_any_user_prompts([this, payload = move(payload)]() { // 4. Let type hint be the result of getting the property "type" from the parameters argument. if (!payload.is_object()) { async_driver_execution_complete(Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "Payload is not a JSON object"sv)); @@ -650,7 +650,7 @@ Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(Jso } // 11.6 Switch To Frame, https://w3c.github.io/webdriver/#dfn-switch-to-frame -Messages::WebDriverClient::SwitchToFrameResponse WebDriverConnection::switch_to_frame(JsonValue const& payload) +Messages::WebDriverClient::SwitchToFrameResponse WebDriverConnection::switch_to_frame(JsonValue payload) { // 1. Let id be the result of getting the property "id" from parameters. if (!payload.is_object() || !payload.as_object().has("id"sv)) @@ -747,7 +747,7 @@ Messages::WebDriverClient::SwitchToFrameResponse WebDriverConnection::switch_to_ } // 11.7 Switch To Parent Frame, https://w3c.github.io/webdriver/#dfn-switch-to-parent-frame -Messages::WebDriverClient::SwitchToParentFrameResponse WebDriverConnection::switch_to_parent_frame(JsonValue const&) +Messages::WebDriverClient::SwitchToParentFrameResponse WebDriverConnection::switch_to_parent_frame(JsonValue) { // 1. If session's current browsing context is already the top-level browsing context: if (¤t_browsing_context() == current_top_level_browsing_context()) { @@ -795,7 +795,7 @@ Messages::WebDriverClient::GetWindowRectResponse WebDriverConnection::get_window } // 11.8.2 Set Window Rect, https://w3c.github.io/webdriver/#dfn-set-window-rect -Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window_rect(JsonValue const& payload) +Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window_rect(JsonValue payload) { if (!payload.is_object()) return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "Payload is not a JSON object"sv); @@ -977,7 +977,7 @@ static Web::WebDriver::Response extract_first_element(Web::WebDriver::Response r } // 12.3.2 Find Element, https://w3c.github.io/webdriver/#dfn-find-element -Messages::WebDriverClient::FindElementResponse WebDriverConnection::find_element(JsonValue const& payload) +Messages::WebDriverClient::FindElementResponse WebDriverConnection::find_element(JsonValue payload) { // 1. Let location strategy be the result of getting a property named "using" from parameters. auto location_strategy_string = TRY(Web::WebDriver::get_property(payload, "using"sv)); @@ -1019,7 +1019,7 @@ Messages::WebDriverClient::FindElementResponse WebDriverConnection::find_element } // 12.3.3 Find Elements, https://w3c.github.io/webdriver/#dfn-find-elements -Messages::WebDriverClient::FindElementsResponse WebDriverConnection::find_elements(JsonValue const& payload) +Messages::WebDriverClient::FindElementsResponse WebDriverConnection::find_elements(JsonValue payload) { // 1. Let location strategy be the result of getting a property named "using" from parameters. auto location_strategy_string = TRY(Web::WebDriver::get_property(payload, "using"sv)); @@ -1060,7 +1060,7 @@ Messages::WebDriverClient::FindElementsResponse WebDriverConnection::find_elemen } // 12.3.4 Find Element From Element, https://w3c.github.io/webdriver/#dfn-find-element-from-element -Messages::WebDriverClient::FindElementFromElementResponse WebDriverConnection::find_element_from_element(JsonValue const& payload, String const& element_id) +Messages::WebDriverClient::FindElementFromElementResponse WebDriverConnection::find_element_from_element(JsonValue payload, String element_id) { // 1. Let location strategy be the result of getting a property named "using" from parameters. auto location_strategy_string = TRY(Web::WebDriver::get_property(payload, "using"sv)); @@ -1095,7 +1095,7 @@ Messages::WebDriverClient::FindElementFromElementResponse WebDriverConnection::f } // 12.3.5 Find Elements From Element, https://w3c.github.io/webdriver/#dfn-find-elements-from-element -Messages::WebDriverClient::FindElementsFromElementResponse WebDriverConnection::find_elements_from_element(JsonValue const& payload, String const& element_id) +Messages::WebDriverClient::FindElementsFromElementResponse WebDriverConnection::find_elements_from_element(JsonValue payload, String element_id) { // 1. Let location strategy be the result of getting a property named "using" from parameters. auto location_strategy_string = TRY(Web::WebDriver::get_property(payload, "using"sv)); @@ -1129,7 +1129,7 @@ Messages::WebDriverClient::FindElementsFromElementResponse WebDriverConnection:: } // 12.3.6 Find Element From Shadow Root, https://w3c.github.io/webdriver/#find-element-from-shadow-root -Messages::WebDriverClient::FindElementFromShadowRootResponse WebDriverConnection::find_element_from_shadow_root(JsonValue const& payload, String const& shadow_id) +Messages::WebDriverClient::FindElementFromShadowRootResponse WebDriverConnection::find_element_from_shadow_root(JsonValue payload, String shadow_id) { // 1. Let location strategy be the result of getting a property called "using". auto location_strategy_string = TRY(Web::WebDriver::get_property(payload, "using"sv)); @@ -1164,7 +1164,7 @@ Messages::WebDriverClient::FindElementFromShadowRootResponse WebDriverConnection } // 12.3.7 Find Elements From Shadow Root, https://w3c.github.io/webdriver/#find-elements-from-shadow-root -Messages::WebDriverClient::FindElementsFromShadowRootResponse WebDriverConnection::find_elements_from_shadow_root(JsonValue const& payload, String const& shadow_id) +Messages::WebDriverClient::FindElementsFromShadowRootResponse WebDriverConnection::find_elements_from_shadow_root(JsonValue payload, String shadow_id) { // 1. Let location strategy be the result of getting a property called "using". auto location_strategy_string = TRY(Web::WebDriver::get_property(payload, "using"sv)); @@ -1223,13 +1223,13 @@ Messages::WebDriverClient::GetActiveElementResponse WebDriverConnection::get_act } // 12.3.9 Get Element Shadow Root, https://w3c.github.io/webdriver/#get-element-shadow-root -Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get_element_shadow_root(String const& element_id) +Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get_element_shadow_root(String element_id) { // 1. If session's current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { // 3. Let element be the result of trying to get a known element with session and URL variables[element id]. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1253,13 +1253,13 @@ Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get } // 12.4.1 Is Element Selected, https://w3c.github.io/webdriver/#dfn-is-element-selected -Messages::WebDriverClient::IsElementSelectedResponse WebDriverConnection::is_element_selected(String const& element_id) +Messages::WebDriverClient::IsElementSelectedResponse WebDriverConnection::is_element_selected(String element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { // 3. Let element be the result of trying to get a known connected element with url variable element id. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1291,13 +1291,13 @@ Messages::WebDriverClient::IsElementSelectedResponse WebDriverConnection::is_ele } // 12.4.2 Get Element Attribute, https://w3c.github.io/webdriver/#dfn-get-element-attribute -Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_element_attribute(String const& element_id, String const& name) +Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_element_attribute(String element_id, String name) { // 1. If session's current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Try to handle any user prompts with session. - handle_any_user_prompts([this, element_id, name]() { + handle_any_user_prompts([this, element_id = move(element_id), name]() { // 3. Let element be the result of trying to get a known element with session and URL variables' element id. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1326,13 +1326,13 @@ Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_ } // 12.4.3 Get Element Property, https://w3c.github.io/webdriver/#dfn-get-element-property -Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_element_property(String const& element_id, String const& name) +Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_element_property(String element_id, String name) { // 1. If session's current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Try to handle any user prompts with session. - handle_any_user_prompts([this, element_id, name]() { + handle_any_user_prompts([this, element_id = move(element_id), name]() { Web::WebDriver::Response result { JsonValue {} }; // 3. Let element be the result of trying to get a known element with session and URL variables' element id. @@ -1358,13 +1358,13 @@ Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_e } // 12.4.4 Get Element CSS Value, https://w3c.github.io/webdriver/#dfn-get-element-css-value -Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_element_css_value(String const& element_id, String const& name) +Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_element_css_value(String element_id, String name) { // 1. If session's current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Try to handle any user prompts with session. - handle_any_user_prompts([this, element_id, name]() { + handle_any_user_prompts([this, element_id = move(element_id), name]() { // 3. Let element be the result of trying to get a known element with URL variables["element id"]. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1392,13 +1392,13 @@ Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_e } // 12.4.5 Get Element Text, https://w3c.github.io/webdriver/#dfn-get-element-text -Messages::WebDriverClient::GetElementTextResponse WebDriverConnection::get_element_text(String const& element_id) +Messages::WebDriverClient::GetElementTextResponse WebDriverConnection::get_element_text(String element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { // 3. Let element be the result of trying to get a known connected element with url variable element id. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1414,13 +1414,13 @@ Messages::WebDriverClient::GetElementTextResponse WebDriverConnection::get_eleme } // 12.4.6 Get Element Tag Name, https://w3c.github.io/webdriver/#dfn-get-element-tag-name -Messages::WebDriverClient::GetElementTagNameResponse WebDriverConnection::get_element_tag_name(String const& element_id) +Messages::WebDriverClient::GetElementTagNameResponse WebDriverConnection::get_element_tag_name(String element_id) { // 1. If session's current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Try to handle any user prompts with session. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { // 3. Let element be the result of trying to get a known element with URL variables["element id"]. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1437,13 +1437,13 @@ Messages::WebDriverClient::GetElementTagNameResponse WebDriverConnection::get_el } // 12.4.7 Get Element Rect, https://w3c.github.io/webdriver/#dfn-get-element-rect -Messages::WebDriverClient::GetElementRectResponse WebDriverConnection::get_element_rect(String const& element_id) +Messages::WebDriverClient::GetElementRectResponse WebDriverConnection::get_element_rect(String element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { // 3. Let element be the result of trying to get a known connected element with url variable element id. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1470,13 +1470,13 @@ Messages::WebDriverClient::GetElementRectResponse WebDriverConnection::get_eleme } // 12.4.8 Is Element Enabled, https://w3c.github.io/webdriver/#dfn-is-element-enabled -Messages::WebDriverClient::IsElementEnabledResponse WebDriverConnection::is_element_enabled(String const& element_id) +Messages::WebDriverClient::IsElementEnabledResponse WebDriverConnection::is_element_enabled(String element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { // 3. Let element be the result of trying to get a known connected element with url variable element id. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1498,13 +1498,13 @@ Messages::WebDriverClient::IsElementEnabledResponse WebDriverConnection::is_elem } // 12.4.9 Get Computed Role, https://w3c.github.io/webdriver/#dfn-get-computed-role -Messages::WebDriverClient::GetComputedRoleResponse WebDriverConnection::get_computed_role(String const& element_id) +Messages::WebDriverClient::GetComputedRoleResponse WebDriverConnection::get_computed_role(String element_id) { // 1. If the current top-level browsing context is no longer open, return error with error code no such window. TRY(ensure_current_top_level_browsing_context_is_open()); // 2. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { // 3. Let element be the result of trying to get a known connected element with url variable element id. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1523,13 +1523,13 @@ Messages::WebDriverClient::GetComputedRoleResponse WebDriverConnection::get_comp } // 12.4.10 Get Computed Label, https://w3c.github.io/webdriver/#get-computed-label -Messages::WebDriverClient::GetComputedLabelResponse WebDriverConnection::get_computed_label(String const& element_id) +Messages::WebDriverClient::GetComputedLabelResponse WebDriverConnection::get_computed_label(String element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { // 3. Let element be the result of trying to get a known element with url variable element id. auto element = WEBDRIVER_TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1544,20 +1544,20 @@ Messages::WebDriverClient::GetComputedLabelResponse WebDriverConnection::get_com } // 12.5.1 Element Click, https://w3c.github.io/webdriver/#element-click -Messages::WebDriverClient::ElementClickResponse WebDriverConnection::element_click(String const& element_id) +Messages::WebDriverClient::ElementClickResponse WebDriverConnection::element_click(String element_id) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Handle any user prompts and return its value if it is an error. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { WEBDRIVER_TRY(element_click_impl(element_id)); }); return JsonValue {}; } -Web::WebDriver::Response WebDriverConnection::element_click_impl(String const& element_id) +Web::WebDriver::Response WebDriverConnection::element_click_impl(StringView element_id) { // 3. Let element be the result of trying to get a known element with element id. auto element = TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -1724,20 +1724,20 @@ Web::WebDriver::Response WebDriverConnection::element_click_impl(String const& e } // 12.5.2 Element Clear, https://w3c.github.io/webdriver/#dfn-element-clear -Messages::WebDriverClient::ElementClearResponse WebDriverConnection::element_clear(String const& element_id) +Messages::WebDriverClient::ElementClearResponse WebDriverConnection::element_clear(String element_id) { // 1. If session's current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Try to handle any user prompts with session. - handle_any_user_prompts([this, element_id]() { + handle_any_user_prompts([this, element_id = move(element_id)]() { async_driver_execution_complete(element_clear_impl(element_id)); }); return JsonValue {}; } -Web::WebDriver::Response WebDriverConnection::element_clear_impl(String const& element_id) +Web::WebDriver::Response WebDriverConnection::element_clear_impl(StringView element_id) { // https://w3c.github.io/webdriver/#dfn-clear-a-content-editable-element auto clear_content_editable_element = [&](Web::DOM::Element& element) { @@ -1836,7 +1836,7 @@ Web::WebDriver::Response WebDriverConnection::element_clear_impl(String const& e } // 12.5.3 Element Send Keys, https://w3c.github.io/webdriver/#dfn-element-send-keys -Messages::WebDriverClient::ElementSendKeysResponse WebDriverConnection::element_send_keys(String const& element_id, JsonValue const& payload) +Messages::WebDriverClient::ElementSendKeysResponse WebDriverConnection::element_send_keys(String element_id, JsonValue payload) { // 1. Let text be the result of getting a property named "text" from parameters. // 2. If text is not a String, return an error with error code invalid argument. @@ -1846,14 +1846,14 @@ Messages::WebDriverClient::ElementSendKeysResponse WebDriverConnection::element_ TRY(ensure_current_browsing_context_is_open()); // 4. Try to handle any user prompts with session. - handle_any_user_prompts([this, element_id, text = move(text)]() { + handle_any_user_prompts([this, element_id = move(element_id), text = move(text)]() { WEBDRIVER_TRY(element_send_keys_impl(element_id, text)); }); return JsonValue {}; } -Web::WebDriver::Response WebDriverConnection::element_send_keys_impl(String const& element_id, String const& text) +Web::WebDriver::Response WebDriverConnection::element_send_keys_impl(StringView element_id, String const& text) { // 5. Let element be the result of trying to get a known element with session and URL variables[element id]. auto element = TRY(Web::WebDriver::get_known_element(current_browsing_context(), element_id)); @@ -2049,7 +2049,7 @@ Messages::WebDriverClient::GetSourceResponse WebDriverConnection::get_source() } // 13.2.1 Execute Script, https://w3c.github.io/webdriver/#dfn-execute-script -Messages::WebDriverClient::ExecuteScriptResponse WebDriverConnection::execute_script(JsonValue const& payload) +Messages::WebDriverClient::ExecuteScriptResponse WebDriverConnection::execute_script(JsonValue payload) { auto* window = current_browsing_context().active_window(); auto& vm = window->vm(); @@ -2079,7 +2079,7 @@ Messages::WebDriverClient::ExecuteScriptResponse WebDriverConnection::execute_sc } // 13.2.2 Execute Async Script, https://w3c.github.io/webdriver/#dfn-execute-async-script -Messages::WebDriverClient::ExecuteAsyncScriptResponse WebDriverConnection::execute_async_script(JsonValue const& payload) +Messages::WebDriverClient::ExecuteAsyncScriptResponse WebDriverConnection::execute_async_script(JsonValue payload) { auto* window = current_browsing_context().active_window(); auto& vm = window->vm(); @@ -2170,7 +2170,7 @@ Messages::WebDriverClient::GetAllCookiesResponse WebDriverConnection::get_all_co } // 14.2 Get Named Cookie, https://w3c.github.io/webdriver/#dfn-get-named-cookie -Messages::WebDriverClient::GetNamedCookieResponse WebDriverConnection::get_named_cookie(String const& name) +Messages::WebDriverClient::GetNamedCookieResponse WebDriverConnection::get_named_cookie(String name) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); @@ -2194,7 +2194,7 @@ Messages::WebDriverClient::GetNamedCookieResponse WebDriverConnection::get_named } // 14.3 Add Cookie, https://w3c.github.io/webdriver/#dfn-adding-a-cookie -Messages::WebDriverClient::AddCookieResponse WebDriverConnection::add_cookie(JsonValue const& payload) +Messages::WebDriverClient::AddCookieResponse WebDriverConnection::add_cookie(JsonValue payload) { // 1. Let data be the result of getting a property named cookie from the parameters argument. auto const& data = *TRY(Web::WebDriver::get_property(payload, "cookie"sv)); @@ -2289,7 +2289,7 @@ Web::WebDriver::Response WebDriverConnection::add_cookie_impl(JsonObject const& } // 14.4 Delete Cookie, https://w3c.github.io/webdriver/#dfn-delete-cookie -Messages::WebDriverClient::DeleteCookieResponse WebDriverConnection::delete_cookie(String const& name) +Messages::WebDriverClient::DeleteCookieResponse WebDriverConnection::delete_cookie(String name) { // 1. If the current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); @@ -2325,13 +2325,13 @@ Messages::WebDriverClient::DeleteAllCookiesResponse WebDriverConnection::delete_ } // 15.7 Perform Actions, https://w3c.github.io/webdriver/#perform-actions -Messages::WebDriverClient::PerformActionsResponse WebDriverConnection::perform_actions(JsonValue const& payload) +Messages::WebDriverClient::PerformActionsResponse WebDriverConnection::perform_actions(JsonValue payload) { // 1. If session's current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); // 2. Try to handle any user prompts with session. - handle_any_user_prompts([this, payload = move(const_cast(payload))]() { + handle_any_user_prompts([this, payload = move(payload)]() { // 3. Let input state be the result of get the input state with session and session's current top-level browsing context. auto& input_state = Web::WebDriver::get_input_state(*current_top_level_browsing_context()); @@ -2465,7 +2465,7 @@ Messages::WebDriverClient::GetAlertTextResponse WebDriverConnection::get_alert_t } // 16.4 Send Alert Text, https://w3c.github.io/webdriver/#send-alert-text -Messages::WebDriverClient::SendAlertTextResponse WebDriverConnection::send_alert_text(JsonValue const& payload) +Messages::WebDriverClient::SendAlertTextResponse WebDriverConnection::send_alert_text(JsonValue payload) { // 1. Let text be the result of getting the property "text" from parameters. // 2. If text is not a String, return error with error code invalid argument. @@ -2539,7 +2539,7 @@ Messages::WebDriverClient::TakeScreenshotResponse WebDriverConnection::take_scre } // 17.2 Take Element Screenshot, https://w3c.github.io/webdriver/#dfn-take-element-screenshot -Messages::WebDriverClient::TakeElementScreenshotResponse WebDriverConnection::take_element_screenshot(String const& element_id) +Messages::WebDriverClient::TakeElementScreenshotResponse WebDriverConnection::take_element_screenshot(String element_id) { // 1. If session's current browsing context is no longer open, return error with error code no such window. TRY(ensure_current_browsing_context_is_open()); @@ -2577,7 +2577,7 @@ Messages::WebDriverClient::TakeElementScreenshotResponse WebDriverConnection::ta } // 18.1 Print Page, https://w3c.github.io/webdriver/#dfn-print-page -Messages::WebDriverClient::PrintPageResponse WebDriverConnection::print_page(JsonValue const& payload) +Messages::WebDriverClient::PrintPageResponse WebDriverConnection::print_page(JsonValue payload) { dbgln("FIXME: WebDriverConnection::print_page({})", payload); return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::UnsupportedOperation, "Print not implemented"sv); diff --git a/Services/WebContent/WebDriverConnection.h b/Services/WebContent/WebDriverConnection.h index 4624aa38cba..b7243421132 100644 --- a/Services/WebContent/WebDriverConnection.h +++ b/Services/WebContent/WebDriverConnection.h @@ -47,13 +47,13 @@ private: virtual void die() override { } virtual void close_session() override; - virtual void set_page_load_strategy(Web::WebDriver::PageLoadStrategy const& page_load_strategy) override; - virtual void set_user_prompt_handler(Web::WebDriver::UserPromptHandler const& user_prompt_handler) override; + virtual void set_page_load_strategy(Web::WebDriver::PageLoadStrategy page_load_strategy) override; + virtual void set_user_prompt_handler(Web::WebDriver::UserPromptHandler user_prompt_handler) override; virtual void set_strict_file_interactability(bool strict_file_interactability) override; virtual void set_is_webdriver_active(bool) override; virtual Messages::WebDriverClient::GetTimeoutsResponse get_timeouts() override; - virtual Messages::WebDriverClient::SetTimeoutsResponse set_timeouts(JsonValue const& payload) override; - virtual Messages::WebDriverClient::NavigateToResponse navigate_to(JsonValue const& payload) override; + virtual Messages::WebDriverClient::SetTimeoutsResponse set_timeouts(JsonValue payload) override; + virtual Messages::WebDriverClient::NavigateToResponse navigate_to(JsonValue payload) override; virtual Messages::WebDriverClient::GetCurrentUrlResponse get_current_url() override; virtual Messages::WebDriverClient::BackResponse back() override; virtual Messages::WebDriverClient::ForwardResponse forward() override; @@ -61,54 +61,54 @@ private: virtual Messages::WebDriverClient::GetTitleResponse get_title() override; virtual Messages::WebDriverClient::GetWindowHandleResponse get_window_handle() override; virtual Messages::WebDriverClient::CloseWindowResponse close_window() override; - virtual Messages::WebDriverClient::SwitchToWindowResponse switch_to_window(String const& handle) override; - virtual Messages::WebDriverClient::NewWindowResponse new_window(JsonValue const& payload) override; - virtual Messages::WebDriverClient::SwitchToFrameResponse switch_to_frame(JsonValue const& payload) override; - virtual Messages::WebDriverClient::SwitchToParentFrameResponse switch_to_parent_frame(JsonValue const& payload) override; + virtual Messages::WebDriverClient::SwitchToWindowResponse switch_to_window(String handle) override; + virtual Messages::WebDriverClient::NewWindowResponse new_window(JsonValue payload) override; + virtual Messages::WebDriverClient::SwitchToFrameResponse switch_to_frame(JsonValue payload) override; + virtual Messages::WebDriverClient::SwitchToParentFrameResponse switch_to_parent_frame(JsonValue payload) override; virtual Messages::WebDriverClient::GetWindowRectResponse get_window_rect() override; - virtual Messages::WebDriverClient::SetWindowRectResponse set_window_rect(JsonValue const& payload) override; + virtual Messages::WebDriverClient::SetWindowRectResponse set_window_rect(JsonValue payload) override; virtual Messages::WebDriverClient::MaximizeWindowResponse maximize_window() override; virtual Messages::WebDriverClient::MinimizeWindowResponse minimize_window() override; virtual Messages::WebDriverClient::FullscreenWindowResponse fullscreen_window() override; virtual Messages::WebDriverClient::ConsumeUserActivationResponse consume_user_activation() override; - virtual Messages::WebDriverClient::FindElementResponse find_element(JsonValue const& payload) override; - virtual Messages::WebDriverClient::FindElementsResponse find_elements(JsonValue const& payload) override; - virtual Messages::WebDriverClient::FindElementFromElementResponse find_element_from_element(JsonValue const& payload, String const& element_id) override; - virtual Messages::WebDriverClient::FindElementsFromElementResponse find_elements_from_element(JsonValue const& payload, String const& element_id) override; - virtual Messages::WebDriverClient::FindElementFromShadowRootResponse find_element_from_shadow_root(JsonValue const& payload, String const& shadow_id) override; - virtual Messages::WebDriverClient::FindElementsFromShadowRootResponse find_elements_from_shadow_root(JsonValue const& payload, String const& shadow_id) override; + virtual Messages::WebDriverClient::FindElementResponse find_element(JsonValue payload) override; + virtual Messages::WebDriverClient::FindElementsResponse find_elements(JsonValue payload) override; + virtual Messages::WebDriverClient::FindElementFromElementResponse find_element_from_element(JsonValue payload, String element_id) override; + virtual Messages::WebDriverClient::FindElementsFromElementResponse find_elements_from_element(JsonValue payload, String element_id) override; + virtual Messages::WebDriverClient::FindElementFromShadowRootResponse find_element_from_shadow_root(JsonValue payload, String shadow_id) override; + virtual Messages::WebDriverClient::FindElementsFromShadowRootResponse find_elements_from_shadow_root(JsonValue payload, String shadow_id) override; virtual Messages::WebDriverClient::GetActiveElementResponse get_active_element() override; - virtual Messages::WebDriverClient::GetElementShadowRootResponse get_element_shadow_root(String const& element_id) override; - virtual Messages::WebDriverClient::IsElementSelectedResponse is_element_selected(String const& element_id) override; - virtual Messages::WebDriverClient::GetElementAttributeResponse get_element_attribute(String const& element_id, String const& name) override; - virtual Messages::WebDriverClient::GetElementPropertyResponse get_element_property(String const& element_id, String const& name) override; - virtual Messages::WebDriverClient::GetElementCssValueResponse get_element_css_value(String const& element_id, String const& name) override; - virtual Messages::WebDriverClient::GetElementTextResponse get_element_text(String const& element_id) override; - virtual Messages::WebDriverClient::GetElementTagNameResponse get_element_tag_name(String const& element_id) override; - virtual Messages::WebDriverClient::GetElementRectResponse get_element_rect(String const& element_id) override; - virtual Messages::WebDriverClient::IsElementEnabledResponse is_element_enabled(String const& element_id) override; - virtual Messages::WebDriverClient::GetComputedRoleResponse get_computed_role(String const& element_id) override; - virtual Messages::WebDriverClient::GetComputedLabelResponse get_computed_label(String const& element_id) override; - virtual Messages::WebDriverClient::ElementClickResponse element_click(String const& element_id) override; - virtual Messages::WebDriverClient::ElementClearResponse element_clear(String const& element_id) override; - virtual Messages::WebDriverClient::ElementSendKeysResponse element_send_keys(String const& element_id, JsonValue const& payload) override; + virtual Messages::WebDriverClient::GetElementShadowRootResponse get_element_shadow_root(String element_id) override; + virtual Messages::WebDriverClient::IsElementSelectedResponse is_element_selected(String element_id) override; + virtual Messages::WebDriverClient::GetElementAttributeResponse get_element_attribute(String element_id, String name) override; + virtual Messages::WebDriverClient::GetElementPropertyResponse get_element_property(String element_id, String name) override; + virtual Messages::WebDriverClient::GetElementCssValueResponse get_element_css_value(String element_id, String name) override; + virtual Messages::WebDriverClient::GetElementTextResponse get_element_text(String element_id) override; + virtual Messages::WebDriverClient::GetElementTagNameResponse get_element_tag_name(String element_id) override; + virtual Messages::WebDriverClient::GetElementRectResponse get_element_rect(String element_id) override; + virtual Messages::WebDriverClient::IsElementEnabledResponse is_element_enabled(String element_id) override; + virtual Messages::WebDriverClient::GetComputedRoleResponse get_computed_role(String element_id) override; + virtual Messages::WebDriverClient::GetComputedLabelResponse get_computed_label(String element_id) override; + virtual Messages::WebDriverClient::ElementClickResponse element_click(String element_id) override; + virtual Messages::WebDriverClient::ElementClearResponse element_clear(String element_id) override; + virtual Messages::WebDriverClient::ElementSendKeysResponse element_send_keys(String element_id, JsonValue payload) override; virtual Messages::WebDriverClient::GetSourceResponse get_source() override; - virtual Messages::WebDriverClient::ExecuteScriptResponse execute_script(JsonValue const& payload) override; - virtual Messages::WebDriverClient::ExecuteAsyncScriptResponse execute_async_script(JsonValue const& payload) override; + virtual Messages::WebDriverClient::ExecuteScriptResponse execute_script(JsonValue payload) override; + virtual Messages::WebDriverClient::ExecuteAsyncScriptResponse execute_async_script(JsonValue payload) override; virtual Messages::WebDriverClient::GetAllCookiesResponse get_all_cookies() override; - virtual Messages::WebDriverClient::GetNamedCookieResponse get_named_cookie(String const& name) override; - virtual Messages::WebDriverClient::AddCookieResponse add_cookie(JsonValue const& payload) override; - virtual Messages::WebDriverClient::DeleteCookieResponse delete_cookie(String const& name) override; + virtual Messages::WebDriverClient::GetNamedCookieResponse get_named_cookie(String name) override; + virtual Messages::WebDriverClient::AddCookieResponse add_cookie(JsonValue payload) override; + virtual Messages::WebDriverClient::DeleteCookieResponse delete_cookie(String name) override; virtual Messages::WebDriverClient::DeleteAllCookiesResponse delete_all_cookies() override; - virtual Messages::WebDriverClient::PerformActionsResponse perform_actions(JsonValue const& payload) override; + virtual Messages::WebDriverClient::PerformActionsResponse perform_actions(JsonValue payload) override; virtual Messages::WebDriverClient::ReleaseActionsResponse release_actions() override; virtual Messages::WebDriverClient::DismissAlertResponse dismiss_alert() override; virtual Messages::WebDriverClient::AcceptAlertResponse accept_alert() override; virtual Messages::WebDriverClient::GetAlertTextResponse get_alert_text() override; - virtual Messages::WebDriverClient::SendAlertTextResponse send_alert_text(JsonValue const& payload) override; + virtual Messages::WebDriverClient::SendAlertTextResponse send_alert_text(JsonValue payload) override; virtual Messages::WebDriverClient::TakeScreenshotResponse take_screenshot() override; - virtual Messages::WebDriverClient::TakeElementScreenshotResponse take_element_screenshot(String const& element_id) override; - virtual Messages::WebDriverClient::PrintPageResponse print_page(JsonValue const& payload) override; + virtual Messages::WebDriverClient::TakeElementScreenshotResponse take_element_screenshot(String element_id) override; + virtual Messages::WebDriverClient::PrintPageResponse print_page(JsonValue payload) override; virtual Messages::WebDriverClient::EnsureTopLevelBrowsingContextIsOpenResponse ensure_top_level_browsing_context_is_open() override; void set_current_browsing_context(Web::HTML::BrowsingContext&); @@ -121,9 +121,9 @@ private: ErrorOr ensure_current_browsing_context_is_open(); ErrorOr ensure_current_top_level_browsing_context_is_open(); - Web::WebDriver::Response element_click_impl(String const& element_id); - Web::WebDriver::Response element_clear_impl(String const& element_id); - Web::WebDriver::Response element_send_keys_impl(String const& element_id, String const& text); + Web::WebDriver::Response element_click_impl(StringView element_id); + Web::WebDriver::Response element_clear_impl(StringView element_id); + Web::WebDriver::Response element_send_keys_impl(StringView element_id, String const& text); Web::WebDriver::Response add_cookie_impl(JsonObject const&); Web::WebDriver::PromptHandlerConfiguration get_the_prompt_handler(Web::WebDriver::PromptType type) const; diff --git a/Services/WebDriver/WebContentConnection.cpp b/Services/WebDriver/WebContentConnection.cpp index a306399e70c..54197bbed5d 100644 --- a/Services/WebDriver/WebContentConnection.cpp +++ b/Services/WebDriver/WebContentConnection.cpp @@ -20,10 +20,10 @@ void WebContentConnection::die() on_close(); } -void WebContentConnection::driver_execution_complete(Web::WebDriver::Response const& response) +void WebContentConnection::driver_execution_complete(Web::WebDriver::Response response) { if (on_driver_execution_complete) - on_driver_execution_complete(response); + on_driver_execution_complete(move(response)); } } diff --git a/Services/WebDriver/WebContentConnection.h b/Services/WebDriver/WebContentConnection.h index 7b2f7cf5d84..f50d7b02f7f 100644 --- a/Services/WebDriver/WebContentConnection.h +++ b/Services/WebDriver/WebContentConnection.h @@ -27,7 +27,7 @@ public: private: virtual void die() override; - virtual void driver_execution_complete(Web::WebDriver::Response const&) override; + virtual void driver_execution_complete(Web::WebDriver::Response) override; }; } diff --git a/Services/WebWorker/ConnectionFromClient.cpp b/Services/WebWorker/ConnectionFromClient.cpp index 79aef848884..3f2d6e09ff2 100644 --- a/Services/WebWorker/ConnectionFromClient.cpp +++ b/Services/WebWorker/ConnectionFromClient.cpp @@ -63,15 +63,13 @@ Web::Page const& ConnectionFromClient::page() const return m_page_host->page(); } -void ConnectionFromClient::start_dedicated_worker(URL::URL const& url, Web::Bindings::WorkerType const& type, Web::Bindings::RequestCredentials const&, String const& name, Web::HTML::TransferDataHolder const& implicit_port, Web::HTML::SerializedEnvironmentSettingsObject const& outside_settings) +void ConnectionFromClient::start_dedicated_worker(URL::URL url, Web::Bindings::WorkerType type, Web::Bindings::RequestCredentials, String name, Web::HTML::TransferDataHolder implicit_port, Web::HTML::SerializedEnvironmentSettingsObject outside_settings) { - m_worker_host = make_ref_counted(url, type, name); - // FIXME: Yikes, const_cast to move? Feels like a LibIPC bug. - // We should be able to move non-copyable types from a Message type. - m_worker_host->run(page(), move(const_cast(implicit_port)), outside_settings); + m_worker_host = make_ref_counted(move(url), type, move(name)); + m_worker_host->run(page(), move(implicit_port), outside_settings); } -void ConnectionFromClient::handle_file_return(i32 error, Optional const& file, i32 request_id) +void ConnectionFromClient::handle_file_return(i32 error, Optional file, i32 request_id) { auto file_request = m_requested_files.take(request_id); diff --git a/Services/WebWorker/ConnectionFromClient.h b/Services/WebWorker/ConnectionFromClient.h index a3c9d0018ee..42df6e0d687 100644 --- a/Services/WebWorker/ConnectionFromClient.h +++ b/Services/WebWorker/ConnectionFromClient.h @@ -41,8 +41,8 @@ private: Web::Page& page(); Web::Page const& page() const; - virtual void start_dedicated_worker(URL::URL const& url, Web::Bindings::WorkerType const& type, Web::Bindings::RequestCredentials const& credentials, String const& name, Web::HTML::TransferDataHolder const&, Web::HTML::SerializedEnvironmentSettingsObject const&) override; - virtual void handle_file_return(i32 error, Optional const& file, i32 request_id) override; + virtual void start_dedicated_worker(URL::URL url, Web::Bindings::WorkerType type, Web::Bindings::RequestCredentials credentials, String name, Web::HTML::TransferDataHolder, Web::HTML::SerializedEnvironmentSettingsObject) override; + virtual void handle_file_return(i32 error, Optional file, i32 request_id) override; GC::Root m_page_host;