LibIPC+Everywhere: Always pass ownership of transferred data to clients

This has been a longstanding ergonomic issue with our IPC compiler. Non-
trivial types were previously passed by const&. So if we wanted to avoid
expensive copies, we would have to const_cast and move the data.

We now pass ownership of all transferred data to the client subclasses.
This allows us to remove const_cast from these methods, and allows us to
avoid some trivial expensive copies that we didn't bother to const_cast.
This commit is contained in:
Timothy Flynn 2025-03-08 12:22:39 -05:00 committed by Tim Flynn
parent 0f05aac290
commit cf69f52d53
Notes: github-actions[bot] 2025-03-09 15:15:22 +00:00
23 changed files with 395 additions and 399 deletions

View file

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

View file

@ -23,7 +23,7 @@ public:
virtual u32 magic() const = 0;
virtual ByteString name() const = 0;
virtual ErrorOr<OwnPtr<MessageBuffer>> handle(Message const&) = 0;
virtual ErrorOr<OwnPtr<MessageBuffer>> handle(NonnullOwnPtr<Message>) = 0;
protected:
Stub() = default;

View file

@ -57,9 +57,9 @@ NonnullRefPtr<Core::Promise<DecodedImage>> 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<u32> 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<u32> 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()) {

View file

@ -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<u32> 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<u32> durations, Gfx::FloatPoint scale, Gfx::ColorSpace color_space) override;
virtual void did_fail_to_decode_image(i64 image_id, String error_message) override;
HashMap<i64, NonnullRefPtr<Core::Promise<DecodedImage>>> m_pending_decoded_images;
};

View file

@ -43,7 +43,7 @@ RefPtr<Request> 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& 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<NetworkError> const& network_error)
void RequestClient::request_finished(i32 request_id, u64 total_size, RequestTimingInfo timing_info, Optional<NetworkError> network_error)
{
RefPtr<Request> 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<u32> const& status_code, Optional<String> const& reason_phrase)
void RequestClient::headers_became_available(i32 request_id, HTTP::HeaderMap response_headers, Optional<u32> status_code, Optional<String> reason_phrase)
{
auto request = const_cast<Request*>(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));
}
}

View file

@ -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<NetworkError> const&) override;
virtual void request_started(i32, IPC::File) override;
virtual void request_finished(i32, u64, RequestTimingInfo, Optional<NetworkError>) override;
virtual void certificate_requested(i32) override;
virtual void headers_became_available(i32, HTTP::HeaderMap const&, Optional<u32> const&, Optional<String> const&) override;
virtual void headers_became_available(i32, HTTP::HeaderMap, Optional<u32>, Optional<String>) 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<i32, RefPtr<Request>> m_requests;

View file

@ -115,13 +115,13 @@ void UIProcessConnectionFromClient::die()
s_connections.remove(client_id());
}
void UIProcessConnectionFromClient::create_new_tab(Vector<ByteString> const& urls)
void UIProcessConnectionFromClient::create_new_tab(Vector<ByteString> urls)
{
if (on_new_tab)
on_new_tab(sanitize_urls(urls, Application::chrome_options().new_tab_page_url));
}
void UIProcessConnectionFromClient::create_new_window(Vector<ByteString> const& urls)
void UIProcessConnectionFromClient::create_new_window(Vector<ByteString> urls)
{
if (on_new_window)
on_new_window(sanitize_urls(urls, Application::chrome_options().new_tab_page_url));

View file

@ -34,8 +34,8 @@ public:
private:
UIProcessConnectionFromClient(IPC::Transport, int client_id);
virtual void create_new_tab(Vector<ByteString> const& urls) override;
virtual void create_new_window(Vector<ByteString> const& urls) override;
virtual void create_new_tab(Vector<ByteString> urls) override;
virtual void create_new_window(Vector<ByteString> urls) override;
};
class ChromeProcess {

View file

@ -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<size_t> const& total_match_count)
void WebContentClient::did_find_in_page(u64 page_id, size_t current_match_index, Optional<size_t> 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<Gfx::ShareableBitmap> const& bitmap)
void WebContentClient::did_request_image_context_menu(u64 page_id, Gfx::IntPoint content_position, URL::URL url, ByteString, unsigned, Optional<Gfx::ShareableBitmap> 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<Web::UniqueNodeID> const& node_id)
void WebContentClient::did_finish_editing_dom_node(u64 page_id, Optional<Web::UniqueNodeID> 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, Optional<Web::Un
}
}
void WebContentClient::did_mutate_dom(u64 page_id, Mutation const& mutation)
void WebContentClient::did_mutate_dom(u64 page_id, Mutation mutation)
{
if (auto view = view_for_page_id(page_id); view.has_value()) {
if (view->on_dom_mutation_received)
view->on_dom_mutation_received(move(const_cast<Mutation&>(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<JsonValue&>(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<String> const& message_types, Vector<String> const& messages)
void WebContentClient::did_get_styled_js_console_messages(u64 page_id, i32 start_index, Vector<String> message_types, Vector<String> 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<ConsoleOutput> const& console_output)
void WebContentClient::did_get_unstyled_js_console_messages(u64 page_id, i32 start_index, Vector<ConsoleOutput> 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<Vector<ConsoleOutput>&>(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<u64> 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<u64> 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<Web::HTML::SelectItem> const& items)
void WebContentClient::did_request_select_dropdown(u64 page_id, Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> 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<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
void WebContentClient::inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> 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<Attribute> const& attributes)
void WebContentClient::inspector_did_add_dom_node_attributes(u64 page_id, Web::UniqueNodeID node_id, Vector<Attribute> 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<Attribute> const& replacement_attributes)
void WebContentClient::inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, size_t attribute_index, Vector<Attribute> 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<String> const& tag, Optional<size_t> 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<String> tag, Optional<size_t> 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<Web::CSS::StyleSheetIdentifier> const& stylesheets)
void WebContentClient::inspector_did_list_style_sheets(u64 page_id, Vector<Web::CSS::StyleSheetIdentifier> 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, Vector<Web::
}
}
void WebContentClient::inspector_did_request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier const& identifier)
void WebContentClient::inspector_did_request_style_sheet_source(u64 page_id, Web::CSS::StyleSheetIdentifier identifier)
{
if (auto view = view_for_page_id(page_id); view.has_value()) {
if (view->on_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)

View file

@ -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<Gfx::ShareableBitmap> 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<Web::UniqueNodeID> 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<Gfx::ShareableBitmap>) 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<Web::UniqueNodeID> 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<String> const& message_types, Vector<String> const& messages) override;
virtual void did_get_unstyled_js_console_messages(u64 page_id, i32 start_index, Vector<ConsoleOutput> 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<String> message_types, Vector<String> messages) override;
virtual void did_get_unstyled_js_console_messages(u64 page_id, i32 start_index, Vector<ConsoleOutput>) 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<u64> const& page_index) override;
virtual Messages::WebContentClient::DidRequestNewWebViewResponse did_request_new_web_view(u64 page_id, Web::HTML::ActivateTab, Web::HTML::WebViewHints, Optional<u64> 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<Web::HTML::SelectItem> 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<Web::HTML::SelectItem> 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<size_t> const& total_match_count) override;
virtual void did_find_in_page(u64 page_id, size_t current_match_index, Optional<size_t> 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<Web::CSS::Selector::PseudoElement::Type> 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<Attribute> const& attributes) override;
virtual void inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, size_t attribute_index, Vector<Attribute> 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<String> const& tag, Optional<size_t> const& attribute_index) override;
virtual void inspector_did_select_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> 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<Attribute> attributes) override;
virtual void inspector_did_replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, size_t attribute_index, Vector<Attribute> 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<String> tag, Optional<size_t> 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<Web::CSS::StyleSheetIdentifier> 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<Web::CSS::StyleSheetIdentifier> 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<ViewImplementation&> view_for_page_id(u64, SourceLocation = SourceLocation::current());

View file

@ -771,17 +771,20 @@ public:
virtual u32 magic() const override { return @endpoint.magic@; }
virtual ByteString name() const override { return "@endpoint.name@"; }
virtual ErrorOr<OwnPtr<IPC::MessageBuffer>> handle(const IPC::Message& message) override
virtual ErrorOr<OwnPtr<IPC::MessageBuffer>> handle(NonnullOwnPtr<IPC::Message> message) override
{
switch (message.message_id()) {)~~~");
switch (message->message_id()) {)~~~");
for (auto const& message : endpoint.messages) {
auto do_handle_message = [&](ByteString const& name, Vector<Parameter> 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<const Messages::@endpoint.name@::@message.pascal_name@&>(message);
[[maybe_unused]] auto& request = static_cast<Messages::@endpoint.name@::@message.pascal_name@&>(*message);
@handler_name@(@arguments@);
auto response = Messages::@endpoint.name@::@message.response_type@ { };
return make<IPC::MessageBuffer>(TRY(response.encode()));)~~~");
} else {
message_generator.append(R"~~~(
[[maybe_unused]] auto& request = static_cast<const Messages::@endpoint.name@::@message.pascal_name@&>(message);
[[maybe_unused]] auto& request = static_cast<Messages::@endpoint.name@::@message.pascal_name@&>(*message);
auto response = @handler_name@(@arguments@);
return make<IPC::MessageBuffer>(TRY(response.encode()));)~~~");
}
} else {
message_generator.append(R"~~~(
[[maybe_unused]] auto& request = static_cast<const Messages::@endpoint.name@::@message.pascal_name@&>(message);
[[maybe_unused]] auto& request = static_cast<Messages::@endpoint.name@::@message.pascal_name@&>(*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<Parameter> const& parameters, bool is_response) {
auto do_handle_message_decl = [&](ByteString const& name, Vector<Parameter> 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"~~~(

View file

@ -160,7 +160,7 @@ NonnullRefPtr<ConnectionFromClient::Job> ConnectionFromClient::make_decode_image
});
}
Messages::ImageDecoderServer::DecodeImageResponse ConnectionFromClient::decode_image(Core::AnonymousBuffer const& encoded_buffer, Optional<Gfx::IntSize> const& ideal_size, Optional<ByteString> const& mime_type)
Messages::ImageDecoderServer::DecodeImageResponse ConnectionFromClient::decode_image(Core::AnonymousBuffer encoded_buffer, Optional<Gfx::IntSize> ideal_size, Optional<ByteString> 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;
}

View file

@ -40,7 +40,7 @@ private:
explicit ConnectionFromClient(IPC::Transport);
virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer const&, Optional<Gfx::IntSize> const& ideal_size, Optional<ByteString> const& mime_type) override;
virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer, Optional<Gfx::IntSize> ideal_size, Optional<ByteString> 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;

View file

@ -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<ByteString> const& protocols, Vector<ByteString> const& extensions, HTTP::HeaderMap const& additional_request_headers)
void ConnectionFromClient::websocket_connect(i64 websocket_id, URL::URL url, ByteString origin, Vector<ByteString> protocols, Vector<ByteString> 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<i32>(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<i32>(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) {

View file

@ -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<ByteString> const&, Vector<ByteString> 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<ByteString>, Vector<ByteString>, 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<i32, RefPtr<WebSocket::WebSocket>> m_websockets;

View file

@ -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<Web::DevicePixelRect> const& rects, u32 main_screen)
void ConnectionFromClient::update_screen_rects(u64 page_id, Vector<Web::DevicePixelRect> 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<Web::KeyEvent&>(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<Web::MouseEvent&>(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<Web::MouseEvent&>(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<Web::DragEvent&>(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<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> 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<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
void ConnectionFromClient::highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> 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<WebView::Attribute> const& attributes)
void ConnectionFromClient::add_dom_node_attributes(u64 page_id, Web::UniqueNodeID node_id, Vector<WebView::Attribute> 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<WebView::Attribute> const& replacement_attributes)
void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, String name, Vector<WebView::Attribute> 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<String> const& filters)
void ConnectionFromClient::set_content_filters(u64, Vector<String> 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<String> const& allowlist)
void ConnectionFromClient::set_autoplay_allowlist(u64, Vector<String> 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<ByteString> const& proxies, HashMap<ByteString, size_t> const& mappings)
void ConnectionFromClient::set_proxy_mappings(u64, Vector<ByteString> proxies, HashMap<ByteString, size_t> 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<ByteString> 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<String> const& preferred_languages)
void ConnectionFromClient::set_preferred_languages(u64, Vector<String> 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<IPC::File> const& file, i32 request_id)
void ConnectionFromClient::handle_file_return(u64, i32 error, Optional<IPC::File> 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<String> const& response)
void ConnectionFromClient::prompt_closed(u64 page_id, Optional<String> 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<Color> const& picked_color, Web::HTML::ColorPickerUpdateState const& state)
void ConnectionFromClient::color_picker_update(u64 page_id, Optional<Color> 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<Web::HTML::SelectedFile> const& selected_files)
void ConnectionFromClient::file_picker_closed(u64 page_id, Vector<Web::HTML::SelectedFile> selected_files)
{
if (auto page = this->page(page_id); page.has_value())
page->page().file_picker_closed(const_cast<Vector<Web::HTML::SelectedFile>&>(selected_files));
page->page().file_picker_closed(selected_files);
}
void ConnectionFromClient::select_dropdown_closed(u64 page_id, Optional<u32> const& selected_item_id)
void ConnectionFromClient::select_dropdown_closed(u64 page_id, Optional<u32> 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)

View file

@ -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<Web::DevicePixelRect> 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<Web::DevicePixelRect>, 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<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element) override;
virtual void highlight_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element) override;
virtual void inspect_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) override;
virtual void highlight_dom_node(u64 page_id, Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> 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<WebView::Attribute> const& attributes) override;
virtual void replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, String const& name, Vector<WebView::Attribute> 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<WebView::Attribute> attributes) override;
virtual void replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID node_id, String name, Vector<WebView::Attribute> 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<String> const&) override;
virtual void set_content_filters(u64 page_id, Vector<String>) override;
virtual void set_autoplay_allowed_on_all_websites(u64 page_id) override;
virtual void set_autoplay_allowlist(u64 page_id, Vector<String> const& allowlist) override;
virtual void set_proxy_mappings(u64 page_id, Vector<ByteString> const&, HashMap<ByteString, size_t> 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<String> const&) override;
virtual void set_autoplay_allowlist(u64 page_id, Vector<String> allowlist) override;
virtual void set_proxy_mappings(u64 page_id, Vector<ByteString>, HashMap<ByteString, size_t>) 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<String>) 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<IPC::File> const& file, i32 request_id) override;
virtual void handle_file_return(u64 page_id, i32 error, Optional<IPC::File> 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<String> const& response) override;
virtual void color_picker_update(u64 page_id, Optional<Color> const& picked_color, Web::HTML::ColorPickerUpdateState const& state) override;
virtual void file_picker_closed(u64 page_id, Vector<Web::HTML::SelectedFile> const& selected_files) override;
virtual void select_dropdown_closed(u64 page_id, Optional<u32> const& selected_item_id) override;
virtual void prompt_closed(u64 page_id, Optional<String> response) override;
virtual void color_picker_update(u64 page_id, Optional<Color> picked_color, Web::HTML::ColorPickerUpdateState state) override;
virtual void file_picker_closed(u64 page_id, Vector<Web::HTML::SelectedFile> selected_files) override;
virtual void select_dropdown_closed(u64 page_id, Optional<u32> 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;

View file

@ -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<Web::WebDriver::UserPromptHandler&>(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<JsonValue&>(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 (&current_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<JsonObject const*>(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<JsonValue&>(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);

View file

@ -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<void, Web::WebDriver::Error> ensure_current_browsing_context_is_open();
ErrorOr<void, Web::WebDriver::Error> 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;

View file

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

View file

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

View file

@ -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<DedicatedWorkerHost>(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<Web::HTML::TransferDataHolder&>(implicit_port)), outside_settings);
m_worker_host = make_ref_counted<DedicatedWorkerHost>(move(url), type, move(name));
m_worker_host->run(page(), move(implicit_port), outside_settings);
}
void ConnectionFromClient::handle_file_return(i32 error, Optional<IPC::File> const& file, i32 request_id)
void ConnectionFromClient::handle_file_return(i32 error, Optional<IPC::File> file, i32 request_id)
{
auto file_request = m_requested_files.take(request_id);

View file

@ -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<IPC::File> 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<IPC::File> file, i32 request_id) override;
GC::Root<PageHost> m_page_host;