mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 00:37:35 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -60,7 +60,7 @@ Web::Page const& ConnectionFromClient::page() const
|
|||
return m_page_host->page();
|
||||
}
|
||||
|
||||
void ConnectionFromClient::connect_to_webdriver(String const& webdriver_ipc_path)
|
||||
void ConnectionFromClient::connect_to_webdriver(DeprecatedString const& webdriver_ipc_path)
|
||||
{
|
||||
// FIXME: Propagate this error back to the browser.
|
||||
if (auto result = m_page_host->connect_to_webdriver(webdriver_ipc_path); result.is_error())
|
||||
|
@ -74,7 +74,7 @@ void ConnectionFromClient::update_system_theme(Core::AnonymousBuffer const& them
|
|||
m_page_host->set_palette_impl(*impl);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::update_system_fonts(String const& default_font_query, String const& fixed_width_font_query, String const& window_title_font_query)
|
||||
void ConnectionFromClient::update_system_fonts(DeprecatedString const& default_font_query, DeprecatedString const& fixed_width_font_query, DeprecatedString const& window_title_font_query)
|
||||
{
|
||||
Gfx::FontDatabase::set_default_font_query(default_font_query);
|
||||
Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query);
|
||||
|
@ -91,11 +91,11 @@ void ConnectionFromClient::load_url(const URL& url)
|
|||
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadURL: url={}", url);
|
||||
|
||||
#if defined(AK_OS_SERENITY)
|
||||
String process_name;
|
||||
DeprecatedString process_name;
|
||||
if (url.host().is_empty())
|
||||
process_name = "WebContent";
|
||||
else
|
||||
process_name = String::formatted("WebContent: {}", url.host());
|
||||
process_name = DeprecatedString::formatted("WebContent: {}", url.host());
|
||||
|
||||
pthread_setname_np(pthread_self(), process_name.characters());
|
||||
#endif
|
||||
|
@ -103,7 +103,7 @@ void ConnectionFromClient::load_url(const URL& url)
|
|||
page().load(url);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::load_html(String const& html, const URL& url)
|
||||
void ConnectionFromClient::load_html(DeprecatedString const& html, const URL& url)
|
||||
{
|
||||
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadHTML: html={}, url={}", html, url);
|
||||
page().load_html(html, url);
|
||||
|
@ -195,7 +195,7 @@ void ConnectionFromClient::report_finished_handling_input_event(bool event_was_h
|
|||
async_did_finish_handling_input_event(event_was_handled);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::debug_request(String const& request, String const& argument)
|
||||
void ConnectionFromClient::debug_request(DeprecatedString const& request, DeprecatedString const& argument)
|
||||
{
|
||||
if (request == "dump-dom-tree") {
|
||||
if (auto* doc = page().top_level_browsing_context().active_document())
|
||||
|
@ -301,7 +301,7 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
if (!element.computed_css_values())
|
||||
return { false, "", "", "", "" };
|
||||
|
||||
auto serialize_json = [](Web::CSS::StyleProperties const& properties) -> String {
|
||||
auto serialize_json = [](Web::CSS::StyleProperties const& properties) -> DeprecatedString {
|
||||
StringBuilder builder;
|
||||
|
||||
auto serializer = MUST(JsonObjectSerializer<>::try_create(builder));
|
||||
|
@ -313,10 +313,10 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
return builder.to_string();
|
||||
};
|
||||
|
||||
auto serialize_custom_properties_json = [](Web::DOM::Element const& element) -> String {
|
||||
auto serialize_custom_properties_json = [](Web::DOM::Element const& element) -> DeprecatedString {
|
||||
StringBuilder builder;
|
||||
auto serializer = MUST(JsonObjectSerializer<>::try_create(builder));
|
||||
HashTable<String> seen_properties;
|
||||
HashTable<DeprecatedString> seen_properties;
|
||||
|
||||
auto const* element_to_check = &element;
|
||||
while (element_to_check) {
|
||||
|
@ -334,7 +334,7 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
|
||||
return builder.to_string();
|
||||
};
|
||||
auto serialize_node_box_sizing_json = [](Web::Layout::Node const* layout_node) -> String {
|
||||
auto serialize_node_box_sizing_json = [](Web::Layout::Node const* layout_node) -> DeprecatedString {
|
||||
if (!layout_node || !layout_node->is_box()) {
|
||||
return "{}";
|
||||
}
|
||||
|
@ -375,17 +375,17 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
// in a format we can use. So, we run the StyleComputer again to get the specified
|
||||
// values, and have to ignore the computed values and custom properties.
|
||||
auto pseudo_element_style = page().focused_context().active_document()->style_computer().compute_style(element, pseudo_element);
|
||||
String computed_values = serialize_json(pseudo_element_style);
|
||||
String resolved_values = "{}";
|
||||
String custom_properties_json = "{}";
|
||||
String node_box_sizing_json = serialize_node_box_sizing_json(pseudo_element_node.ptr());
|
||||
DeprecatedString computed_values = serialize_json(pseudo_element_style);
|
||||
DeprecatedString resolved_values = "{}";
|
||||
DeprecatedString custom_properties_json = "{}";
|
||||
DeprecatedString node_box_sizing_json = serialize_node_box_sizing_json(pseudo_element_node.ptr());
|
||||
return { true, computed_values, resolved_values, custom_properties_json, node_box_sizing_json };
|
||||
}
|
||||
|
||||
String computed_values = serialize_json(*element.computed_css_values());
|
||||
String resolved_values_json = serialize_json(element.resolved_css_values());
|
||||
String custom_properties_json = serialize_custom_properties_json(element);
|
||||
String node_box_sizing_json = serialize_node_box_sizing_json(element.layout_node());
|
||||
DeprecatedString computed_values = serialize_json(*element.computed_css_values());
|
||||
DeprecatedString resolved_values_json = serialize_json(element.resolved_css_values());
|
||||
DeprecatedString custom_properties_json = serialize_custom_properties_json(element);
|
||||
DeprecatedString node_box_sizing_json = serialize_node_box_sizing_json(element.layout_node());
|
||||
return { true, computed_values, resolved_values_json, custom_properties_json, node_box_sizing_json };
|
||||
}
|
||||
|
||||
|
@ -415,13 +415,13 @@ void ConnectionFromClient::initialize_js_console(Badge<PageHost>)
|
|||
console_object.console().set_client(*m_console_client.ptr());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::js_console_input(String const& js_source)
|
||||
void ConnectionFromClient::js_console_input(DeprecatedString const& js_source)
|
||||
{
|
||||
if (m_console_client)
|
||||
m_console_client->handle_input(js_source);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::run_javascript(String const& js_source)
|
||||
void ConnectionFromClient::run_javascript(DeprecatedString const& js_source)
|
||||
{
|
||||
auto* active_document = page().top_level_browsing_context().active_document();
|
||||
|
||||
|
@ -484,27 +484,27 @@ Messages::WebContentServer::DumpLayoutTreeResponse ConnectionFromClient::dump_la
|
|||
{
|
||||
auto* document = page().top_level_browsing_context().active_document();
|
||||
if (!document)
|
||||
return String { "(no DOM tree)" };
|
||||
return DeprecatedString { "(no DOM tree)" };
|
||||
auto* layout_root = document->layout_node();
|
||||
if (!layout_root)
|
||||
return String { "(no layout tree)" };
|
||||
return DeprecatedString { "(no layout tree)" };
|
||||
StringBuilder builder;
|
||||
Web::dump_tree(builder, *layout_root);
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_content_filters(Vector<String> const& filters)
|
||||
void ConnectionFromClient::set_content_filters(Vector<DeprecatedString> const& filters)
|
||||
{
|
||||
for (auto& filter : filters)
|
||||
Web::ContentFilter::the().add_pattern(filter);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_proxy_mappings(Vector<String> const& proxies, HashMap<String, size_t> const& mappings)
|
||||
void ConnectionFromClient::set_proxy_mappings(Vector<DeprecatedString> const& proxies, HashMap<DeprecatedString, size_t> const& mappings)
|
||||
{
|
||||
auto keys = mappings.keys();
|
||||
quick_sort(keys, [&](auto& a, auto& b) { return a.length() < b.length(); });
|
||||
|
||||
OrderedHashMap<String, size_t> sorted_mappings;
|
||||
OrderedHashMap<DeprecatedString, size_t> sorted_mappings;
|
||||
for (auto& key : keys) {
|
||||
auto value = *mappings.get(key);
|
||||
if (value >= proxies.size())
|
||||
|
@ -590,7 +590,7 @@ void ConnectionFromClient::confirm_closed(bool accepted)
|
|||
m_page_host->confirm_closed(accepted);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::prompt_closed(String const& response)
|
||||
void ConnectionFromClient::prompt_closed(DeprecatedString const& response)
|
||||
{
|
||||
m_page_host->prompt_closed(response);
|
||||
}
|
||||
|
|
|
@ -47,12 +47,12 @@ private:
|
|||
Web::Page& page();
|
||||
Web::Page const& page() const;
|
||||
|
||||
virtual void connect_to_webdriver(String const& webdriver_ipc_path) override;
|
||||
virtual void connect_to_webdriver(DeprecatedString const& webdriver_ipc_path) override;
|
||||
virtual void update_system_theme(Core::AnonymousBuffer const&) override;
|
||||
virtual void update_system_fonts(String const&, String const&, String const&) override;
|
||||
virtual void update_system_fonts(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override;
|
||||
virtual void update_screen_rects(Vector<Gfx::IntRect> const&, u32) override;
|
||||
virtual void load_url(URL const&) override;
|
||||
virtual void load_html(String const&, URL const&) override;
|
||||
virtual void load_html(DeprecatedString const&, URL const&) override;
|
||||
virtual void paint(Gfx::IntRect const&, i32) override;
|
||||
virtual void set_viewport_rect(Gfx::IntRect const&) override;
|
||||
virtual void mouse_down(Gfx::IntPoint const&, unsigned, unsigned, unsigned) override;
|
||||
|
@ -64,14 +64,14 @@ private:
|
|||
virtual void key_up(i32, unsigned, u32) override;
|
||||
virtual void add_backing_store(i32, Gfx::ShareableBitmap const&) override;
|
||||
virtual void remove_backing_store(i32) override;
|
||||
virtual void debug_request(String const&, String const&) override;
|
||||
virtual void debug_request(DeprecatedString const&, DeprecatedString const&) override;
|
||||
virtual void get_source() override;
|
||||
virtual void inspect_dom_tree() override;
|
||||
virtual Messages::WebContentServer::InspectDomNodeResponse inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> const& pseudo_element) override;
|
||||
virtual Messages::WebContentServer::GetHoveredNodeIdResponse get_hovered_node_id() override;
|
||||
virtual Messages::WebContentServer::DumpLayoutTreeResponse dump_layout_tree() override;
|
||||
virtual void set_content_filters(Vector<String> const&) override;
|
||||
virtual void set_proxy_mappings(Vector<String> const&, HashMap<String, size_t> const&) override;
|
||||
virtual void set_content_filters(Vector<DeprecatedString> const&) override;
|
||||
virtual void set_proxy_mappings(Vector<DeprecatedString> const&, HashMap<DeprecatedString, size_t> const&) override;
|
||||
virtual void set_preferred_color_scheme(Web::CSS::PreferredColorScheme const&) override;
|
||||
virtual void set_has_focus(bool) override;
|
||||
virtual void set_is_scripting_enabled(bool) override;
|
||||
|
@ -80,13 +80,13 @@ private:
|
|||
virtual void handle_file_return(i32 error, Optional<IPC::File> const& file, i32 request_id) override;
|
||||
virtual void set_system_visibility_state(bool visible) override;
|
||||
|
||||
virtual void js_console_input(String const&) override;
|
||||
virtual void run_javascript(String const&) override;
|
||||
virtual void js_console_input(DeprecatedString const&) override;
|
||||
virtual void run_javascript(DeprecatedString const&) override;
|
||||
virtual void js_console_request_messages(i32) override;
|
||||
|
||||
virtual void alert_closed() override;
|
||||
virtual void confirm_closed(bool accepted) override;
|
||||
virtual void prompt_closed(String const& response) override;
|
||||
virtual void prompt_closed(DeprecatedString const& response) override;
|
||||
|
||||
virtual Messages::WebContentServer::TakeDocumentScreenshotResponse take_document_screenshot() override;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ void PageHost::set_window_size(Gfx::IntSize const& size)
|
|||
page().set_window_size(size);
|
||||
}
|
||||
|
||||
ErrorOr<void> PageHost::connect_to_webdriver(String const& webdriver_ipc_path)
|
||||
ErrorOr<void> PageHost::connect_to_webdriver(DeprecatedString const& webdriver_ipc_path)
|
||||
{
|
||||
VERIFY(!m_webdriver);
|
||||
m_webdriver = TRY(WebDriverConnection::connect(*this, webdriver_ipc_path));
|
||||
|
@ -158,7 +158,7 @@ void PageHost::page_did_layout()
|
|||
m_client.async_did_layout(m_content_size);
|
||||
}
|
||||
|
||||
void PageHost::page_did_change_title(String const& title)
|
||||
void PageHost::page_did_change_title(DeprecatedString const& title)
|
||||
{
|
||||
m_client.async_did_change_title(title);
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void PageHost::page_did_request_scroll_into_view(Gfx::IntRect const& rect)
|
|||
m_client.async_did_request_scroll_into_view(rect);
|
||||
}
|
||||
|
||||
void PageHost::page_did_enter_tooltip_area(Gfx::IntPoint const& content_position, String const& title)
|
||||
void PageHost::page_did_enter_tooltip_area(Gfx::IntPoint const& content_position, DeprecatedString const& title)
|
||||
{
|
||||
m_client.async_did_enter_tooltip_area(content_position, title);
|
||||
}
|
||||
|
@ -243,12 +243,12 @@ void PageHost::page_did_unhover_link()
|
|||
m_client.async_did_unhover_link();
|
||||
}
|
||||
|
||||
void PageHost::page_did_click_link(const URL& url, String const& target, unsigned modifiers)
|
||||
void PageHost::page_did_click_link(const URL& url, DeprecatedString const& target, unsigned modifiers)
|
||||
{
|
||||
m_client.async_did_click_link(url, target, modifiers);
|
||||
}
|
||||
|
||||
void PageHost::page_did_middle_click_link(const URL& url, [[maybe_unused]] String const& target, [[maybe_unused]] unsigned modifiers)
|
||||
void PageHost::page_did_middle_click_link(const URL& url, [[maybe_unused]] DeprecatedString const& target, [[maybe_unused]] unsigned modifiers)
|
||||
{
|
||||
m_client.async_did_middle_click_link(url, target, modifiers);
|
||||
}
|
||||
|
@ -273,12 +273,12 @@ void PageHost::page_did_request_context_menu(Gfx::IntPoint const& content_positi
|
|||
m_client.async_did_request_context_menu(content_position);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_link_context_menu(Gfx::IntPoint const& content_position, const URL& url, String const& target, unsigned modifiers)
|
||||
void PageHost::page_did_request_link_context_menu(Gfx::IntPoint const& content_position, const URL& url, DeprecatedString const& target, unsigned modifiers)
|
||||
{
|
||||
m_client.async_did_request_link_context_menu(content_position, url, target, modifiers);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_alert(String const& message)
|
||||
void PageHost::page_did_request_alert(DeprecatedString const& message)
|
||||
{
|
||||
m_client.async_did_request_alert(message);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ void PageHost::alert_closed()
|
|||
page().alert_closed();
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_confirm(String const& message)
|
||||
void PageHost::page_did_request_confirm(DeprecatedString const& message)
|
||||
{
|
||||
m_client.async_did_request_confirm(message);
|
||||
}
|
||||
|
@ -298,17 +298,17 @@ void PageHost::confirm_closed(bool accepted)
|
|||
page().confirm_closed(accepted);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_prompt(String const& message, String const& default_)
|
||||
void PageHost::page_did_request_prompt(DeprecatedString const& message, DeprecatedString const& default_)
|
||||
{
|
||||
m_client.async_did_request_prompt(message, default_);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_set_prompt_text(String const& text)
|
||||
void PageHost::page_did_request_set_prompt_text(DeprecatedString const& text)
|
||||
{
|
||||
m_client.async_did_request_set_prompt_text(text);
|
||||
}
|
||||
|
||||
void PageHost::prompt_closed(String response)
|
||||
void PageHost::prompt_closed(DeprecatedString response)
|
||||
{
|
||||
page().prompt_closed(move(response));
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ void PageHost::page_did_change_favicon(Gfx::Bitmap const& favicon)
|
|||
m_client.async_did_change_favicon(favicon.to_shareable_bitmap());
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_image_context_menu(Gfx::IntPoint const& content_position, const URL& url, String const& target, unsigned modifiers, Gfx::Bitmap const* bitmap_pointer)
|
||||
void PageHost::page_did_request_image_context_menu(Gfx::IntPoint const& content_position, const URL& url, DeprecatedString const& target, unsigned modifiers, Gfx::Bitmap const* bitmap_pointer)
|
||||
{
|
||||
auto bitmap = bitmap_pointer ? bitmap_pointer->to_shareable_bitmap() : Gfx::ShareableBitmap();
|
||||
m_client.async_did_request_image_context_menu(content_position, url, target, modifiers, bitmap);
|
||||
|
@ -339,12 +339,12 @@ Vector<Web::Cookie::Cookie> PageHost::page_did_request_all_cookies(URL const& ur
|
|||
return m_client.did_request_all_cookies(url);
|
||||
}
|
||||
|
||||
Optional<Web::Cookie::Cookie> PageHost::page_did_request_named_cookie(URL const& url, String const& name)
|
||||
Optional<Web::Cookie::Cookie> PageHost::page_did_request_named_cookie(URL const& url, DeprecatedString const& name)
|
||||
{
|
||||
return m_client.did_request_named_cookie(url, name);
|
||||
}
|
||||
|
||||
String PageHost::page_did_request_cookie(const URL& url, Web::Cookie::Source source)
|
||||
DeprecatedString PageHost::page_did_request_cookie(const URL& url, Web::Cookie::Source source)
|
||||
{
|
||||
auto response = m_client.send_sync_but_allow_failure<Messages::WebContentClient::DidRequestCookie>(move(url), static_cast<u8>(source));
|
||||
if (!response) {
|
||||
|
|
|
@ -40,11 +40,11 @@ public:
|
|||
|
||||
Gfx::IntSize const& content_size() const { return m_content_size; }
|
||||
|
||||
ErrorOr<void> connect_to_webdriver(String const& webdriver_ipc_path);
|
||||
ErrorOr<void> connect_to_webdriver(DeprecatedString const& webdriver_ipc_path);
|
||||
|
||||
void alert_closed();
|
||||
void confirm_closed(bool accepted);
|
||||
void prompt_closed(String response);
|
||||
void prompt_closed(DeprecatedString response);
|
||||
|
||||
private:
|
||||
// ^PageClient
|
||||
|
@ -56,7 +56,7 @@ private:
|
|||
virtual void page_did_change_selection() override;
|
||||
virtual void page_did_request_cursor_change(Gfx::StandardCursor) override;
|
||||
virtual void page_did_layout() override;
|
||||
virtual void page_did_change_title(String const&) override;
|
||||
virtual void page_did_change_title(DeprecatedString const&) override;
|
||||
virtual void page_did_request_navigate_back() override;
|
||||
virtual void page_did_request_navigate_forward() override;
|
||||
virtual void page_did_request_refresh() override;
|
||||
|
@ -69,28 +69,28 @@ private:
|
|||
virtual void page_did_request_scroll(i32, i32) override;
|
||||
virtual void page_did_request_scroll_to(Gfx::IntPoint const&) override;
|
||||
virtual void page_did_request_scroll_into_view(Gfx::IntRect const&) override;
|
||||
virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, String const&) override;
|
||||
virtual void page_did_enter_tooltip_area(Gfx::IntPoint const&, DeprecatedString const&) override;
|
||||
virtual void page_did_leave_tooltip_area() override;
|
||||
virtual void page_did_hover_link(const URL&) override;
|
||||
virtual void page_did_unhover_link() override;
|
||||
virtual void page_did_click_link(const URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void page_did_middle_click_link(const URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void page_did_click_link(const URL&, DeprecatedString const& target, unsigned modifiers) override;
|
||||
virtual void page_did_middle_click_link(const URL&, DeprecatedString const& target, unsigned modifiers) override;
|
||||
virtual void page_did_request_context_menu(Gfx::IntPoint const&) override;
|
||||
virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, const URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, const URL&, DeprecatedString const& target, unsigned modifiers) override;
|
||||
virtual void page_did_start_loading(const URL&, bool) override;
|
||||
virtual void page_did_create_main_document() override;
|
||||
virtual void page_did_finish_loading(const URL&) override;
|
||||
virtual void page_did_request_alert(String const&) override;
|
||||
virtual void page_did_request_confirm(String const&) override;
|
||||
virtual void page_did_request_prompt(String const&, String const&) override;
|
||||
virtual void page_did_request_set_prompt_text(String const&) override;
|
||||
virtual void page_did_request_alert(DeprecatedString const&) override;
|
||||
virtual void page_did_request_confirm(DeprecatedString const&) override;
|
||||
virtual void page_did_request_prompt(DeprecatedString const&, DeprecatedString const&) override;
|
||||
virtual void page_did_request_set_prompt_text(DeprecatedString const&) override;
|
||||
virtual void page_did_request_accept_dialog() override;
|
||||
virtual void page_did_request_dismiss_dialog() override;
|
||||
virtual void page_did_change_favicon(Gfx::Bitmap const&) override;
|
||||
virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, const URL&, String const& target, unsigned modifiers, Gfx::Bitmap const*) override;
|
||||
virtual void page_did_request_image_context_menu(Gfx::IntPoint const&, const URL&, DeprecatedString const& target, unsigned modifiers, Gfx::Bitmap const*) override;
|
||||
virtual Vector<Web::Cookie::Cookie> page_did_request_all_cookies(URL const&) override;
|
||||
virtual Optional<Web::Cookie::Cookie> page_did_request_named_cookie(URL const&, String const&) override;
|
||||
virtual String page_did_request_cookie(const URL&, Web::Cookie::Source) override;
|
||||
virtual Optional<Web::Cookie::Cookie> page_did_request_named_cookie(URL const&, DeprecatedString const&) override;
|
||||
virtual DeprecatedString page_did_request_cookie(const URL&, Web::Cookie::Source) override;
|
||||
virtual void page_did_set_cookie(const URL&, Web::Cookie::ParsedCookie const&, Web::Cookie::Source) override;
|
||||
virtual void page_did_update_cookie(URL const&, Web::Cookie::Cookie) override;
|
||||
virtual void page_did_update_resource_count(i32) override;
|
||||
|
|
|
@ -16,32 +16,32 @@ endpoint WebContentClient
|
|||
did_change_selection() =|
|
||||
did_request_cursor_change(i32 cursor_type) =|
|
||||
did_layout(Gfx::IntSize content_size) =|
|
||||
did_change_title(String title) =|
|
||||
did_change_title(DeprecatedString title) =|
|
||||
did_request_scroll(i32 x_delta, i32 y_delta) =|
|
||||
did_request_scroll_to(Gfx::IntPoint scroll_position) =|
|
||||
did_request_scroll_into_view(Gfx::IntRect rect) =|
|
||||
did_enter_tooltip_area(Gfx::IntPoint content_position, String title) =|
|
||||
did_enter_tooltip_area(Gfx::IntPoint content_position, DeprecatedString title) =|
|
||||
did_leave_tooltip_area() =|
|
||||
did_hover_link(URL url) =|
|
||||
did_unhover_link() =|
|
||||
did_click_link(URL url, String target, unsigned modifiers) =|
|
||||
did_middle_click_link(URL url, String target, unsigned modifiers) =|
|
||||
did_click_link(URL url, DeprecatedString target, unsigned modifiers) =|
|
||||
did_middle_click_link(URL url, DeprecatedString target, unsigned modifiers) =|
|
||||
did_request_context_menu(Gfx::IntPoint content_position) =|
|
||||
did_request_link_context_menu(Gfx::IntPoint content_position, URL url, String target, unsigned modifiers) =|
|
||||
did_request_image_context_menu(Gfx::IntPoint content_position, URL url, String target, unsigned modifiers, Gfx::ShareableBitmap bitmap) =|
|
||||
did_request_alert(String message) =|
|
||||
did_request_confirm(String message) =|
|
||||
did_request_prompt(String message, String default_) =|
|
||||
did_request_set_prompt_text(String message) =|
|
||||
did_request_link_context_menu(Gfx::IntPoint content_position, URL url, DeprecatedString target, unsigned modifiers) =|
|
||||
did_request_image_context_menu(Gfx::IntPoint content_position, URL url, DeprecatedString target, unsigned modifiers, Gfx::ShareableBitmap bitmap) =|
|
||||
did_request_alert(DeprecatedString message) =|
|
||||
did_request_confirm(DeprecatedString message) =|
|
||||
did_request_prompt(DeprecatedString message, DeprecatedString default_) =|
|
||||
did_request_set_prompt_text(DeprecatedString message) =|
|
||||
did_request_accept_dialog() =|
|
||||
did_request_dismiss_dialog() =|
|
||||
did_get_source(URL url, String source) =|
|
||||
did_get_dom_tree(String dom_tree) =|
|
||||
did_get_dom_node_properties(i32 node_id, String specified_style, String computed_style, String custom_properties, String node_box_sizing_json) =|
|
||||
did_get_source(URL url, DeprecatedString source) =|
|
||||
did_get_dom_tree(DeprecatedString dom_tree) =|
|
||||
did_get_dom_node_properties(i32 node_id, DeprecatedString specified_style, DeprecatedString computed_style, DeprecatedString custom_properties, DeprecatedString node_box_sizing_json) =|
|
||||
did_change_favicon(Gfx::ShareableBitmap favicon) =|
|
||||
did_request_all_cookies(URL url) => (Vector<Web::Cookie::Cookie> cookies)
|
||||
did_request_named_cookie(URL url, String name) => (Optional<Web::Cookie::Cookie> cookie)
|
||||
did_request_cookie(URL url, u8 source) => (String cookie)
|
||||
did_request_named_cookie(URL url, DeprecatedString name) => (Optional<Web::Cookie::Cookie> cookie)
|
||||
did_request_cookie(URL url, u8 source) => (DeprecatedString cookie)
|
||||
did_set_cookie(URL url, Web::Cookie::ParsedCookie cookie, u8 source) =|
|
||||
did_update_cookie(URL url, Web::Cookie::Cookie cookie) =|
|
||||
did_update_resource_count(i32 count_waiting) =|
|
||||
|
@ -51,10 +51,10 @@ endpoint WebContentClient
|
|||
did_request_maximize_window() => (Gfx::IntRect window_rect)
|
||||
did_request_minimize_window() => (Gfx::IntRect window_rect)
|
||||
did_request_fullscreen_window() => (Gfx::IntRect window_rect)
|
||||
did_request_file(String path, i32 request_id) =|
|
||||
did_request_file(DeprecatedString path, i32 request_id) =|
|
||||
did_finish_handling_input_event(bool event_was_accepted) =|
|
||||
|
||||
did_output_js_console_message(i32 message_index) =|
|
||||
did_get_js_console_messages(i32 start_index, Vector<String> message_types, Vector<String> messages) =|
|
||||
did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> message_types, Vector<DeprecatedString> messages) =|
|
||||
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@ public:
|
|||
virtual ~ConsoleEnvironmentSettingsObject() override = default;
|
||||
|
||||
JS::GCPtr<Web::DOM::Document> responsible_document() override { return nullptr; }
|
||||
String api_url_character_encoding() override { return m_api_url_character_encoding; }
|
||||
DeprecatedString api_url_character_encoding() override { return m_api_url_character_encoding; }
|
||||
AK::URL api_base_url() override { return m_url; }
|
||||
Web::HTML::Origin origin() override { return m_origin; }
|
||||
Web::HTML::PolicyContainer policy_container() override { return m_policy_container; }
|
||||
Web::HTML::CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override { return Web::HTML::CanUseCrossOriginIsolatedAPIs::Yes; }
|
||||
|
||||
private:
|
||||
String m_api_url_character_encoding;
|
||||
DeprecatedString m_api_url_character_encoding;
|
||||
AK::URL m_url;
|
||||
Web::HTML::Origin m_origin;
|
||||
Web::HTML::PolicyContainer m_policy_container;
|
||||
|
@ -66,7 +66,7 @@ WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, JS::Realm
|
|||
console_realm->set_host_defined(move(host_defined));
|
||||
}
|
||||
|
||||
void WebContentConsoleClient::handle_input(String const& js_source)
|
||||
void WebContentConsoleClient::handle_input(DeprecatedString const& js_source)
|
||||
{
|
||||
if (!m_realm)
|
||||
return;
|
||||
|
@ -88,7 +88,7 @@ void WebContentConsoleClient::report_exception(JS::Error const& exception, bool
|
|||
print_html(JS::MarkupGenerator::html_from_error(exception, in_promise));
|
||||
}
|
||||
|
||||
void WebContentConsoleClient::print_html(String const& line)
|
||||
void WebContentConsoleClient::print_html(DeprecatedString const& line)
|
||||
{
|
||||
m_message_log.append({ .type = ConsoleOutput::Type::HTML, .data = line });
|
||||
m_client.async_did_output_js_console_message(m_message_log.size() - 1);
|
||||
|
@ -100,7 +100,7 @@ void WebContentConsoleClient::clear_output()
|
|||
m_client.async_did_output_js_console_message(m_message_log.size() - 1);
|
||||
}
|
||||
|
||||
void WebContentConsoleClient::begin_group(String const& label, bool start_expanded)
|
||||
void WebContentConsoleClient::begin_group(DeprecatedString const& label, bool start_expanded)
|
||||
{
|
||||
m_message_log.append({ .type = start_expanded ? ConsoleOutput::Type::BeginGroup : ConsoleOutput::Type::BeginGroupCollapsed, .data = label });
|
||||
m_client.async_did_output_js_console_message(m_message_log.size() - 1);
|
||||
|
@ -126,8 +126,8 @@ void WebContentConsoleClient::send_messages(i32 start_index)
|
|||
}
|
||||
|
||||
// FIXME: Replace with a single Vector of message structs
|
||||
Vector<String> message_types;
|
||||
Vector<String> messages;
|
||||
Vector<DeprecatedString> message_types;
|
||||
Vector<DeprecatedString> messages;
|
||||
message_types.ensure_capacity(messages_to_send);
|
||||
messages.ensure_capacity(messages_to_send);
|
||||
|
||||
|
@ -185,11 +185,11 @@ JS::ThrowCompletionOr<JS::Value> WebContentConsoleClient::printer(JS::Console::L
|
|||
|
||||
if (log_level == JS::Console::LogLevel::Group || log_level == JS::Console::LogLevel::GroupCollapsed) {
|
||||
auto group = arguments.get<JS::Console::Group>();
|
||||
begin_group(String::formatted("<span style='{}'>{}</span>", styling, escape_html_entities(group.label)), log_level == JS::Console::LogLevel::Group);
|
||||
begin_group(DeprecatedString::formatted("<span style='{}'>{}</span>", styling, escape_html_entities(group.label)), log_level == JS::Console::LogLevel::Group);
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
auto output = String::join(' ', arguments.get<JS::MarkedVector<JS::Value>>());
|
||||
auto output = DeprecatedString::join(' ', arguments.get<JS::MarkedVector<JS::Value>>());
|
||||
m_console.output_debug_message(log_level, output);
|
||||
|
||||
StringBuilder html;
|
||||
|
|
|
@ -20,7 +20,7 @@ class WebContentConsoleClient final : public JS::ConsoleClient {
|
|||
public:
|
||||
WebContentConsoleClient(JS::Console&, JS::Realm&, ConnectionFromClient&);
|
||||
|
||||
void handle_input(String const& js_source);
|
||||
void handle_input(DeprecatedString const& js_source);
|
||||
void send_messages(i32 start_index);
|
||||
void report_exception(JS::Error const&, bool) override;
|
||||
|
||||
|
@ -40,8 +40,8 @@ private:
|
|||
JS::Handle<ConsoleGlobalObject> m_console_global_object;
|
||||
|
||||
void clear_output();
|
||||
void print_html(String const& line);
|
||||
void begin_group(String const& label, bool start_expanded);
|
||||
void print_html(DeprecatedString const& line);
|
||||
void begin_group(DeprecatedString const& label, bool start_expanded);
|
||||
virtual void end_group() override;
|
||||
|
||||
struct ConsoleOutput {
|
||||
|
@ -53,7 +53,7 @@ private:
|
|||
EndGroup,
|
||||
};
|
||||
Type type;
|
||||
String data;
|
||||
DeprecatedString data;
|
||||
};
|
||||
Vector<ConsoleOutput> m_message_log;
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
|
||||
endpoint WebContentServer
|
||||
{
|
||||
connect_to_webdriver(String webdriver_ipc_path) =|
|
||||
connect_to_webdriver(DeprecatedString webdriver_ipc_path) =|
|
||||
|
||||
update_system_theme(Core::AnonymousBuffer theme_buffer) =|
|
||||
update_system_fonts(String default_font_query, String fixed_width_font_query, String window_title_font_query) =|
|
||||
update_system_fonts(DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query) =|
|
||||
update_screen_rects(Vector<Gfx::IntRect> rects, u32 main_screen_index) =|
|
||||
|
||||
load_url(URL url) =|
|
||||
load_html(String html, URL url) =|
|
||||
load_html(DeprecatedString html, URL url) =|
|
||||
|
||||
add_backing_store(i32 backing_store_id, Gfx::ShareableBitmap bitmap) =|
|
||||
remove_backing_store(i32 backing_store_id) =|
|
||||
|
@ -33,25 +33,25 @@ endpoint WebContentServer
|
|||
key_down(i32 key, unsigned modifiers, u32 code_point) =|
|
||||
key_up(i32 key, unsigned modifiers, u32 code_point) =|
|
||||
|
||||
debug_request(String request, String argument) =|
|
||||
debug_request(DeprecatedString request, DeprecatedString argument) =|
|
||||
get_source() =|
|
||||
inspect_dom_tree() =|
|
||||
inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element) => (bool has_style, String specified_style, String computed_style, String custom_properties, String node_box_sizing)
|
||||
inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element) => (bool has_style, DeprecatedString specified_style, DeprecatedString computed_style, DeprecatedString custom_properties, DeprecatedString node_box_sizing)
|
||||
get_hovered_node_id() => (i32 node_id)
|
||||
js_console_input(String js_source) =|
|
||||
js_console_input(DeprecatedString js_source) =|
|
||||
js_console_request_messages(i32 start_index) =|
|
||||
|
||||
take_document_screenshot() => (Gfx::ShareableBitmap data)
|
||||
|
||||
run_javascript(String js_source) =|
|
||||
run_javascript(DeprecatedString js_source) =|
|
||||
|
||||
dump_layout_tree() => (String dump)
|
||||
dump_layout_tree() => (DeprecatedString dump)
|
||||
|
||||
get_selected_text() => (String selection)
|
||||
get_selected_text() => (DeprecatedString selection)
|
||||
select_all() =|
|
||||
|
||||
set_content_filters(Vector<String> filters) =|
|
||||
set_proxy_mappings(Vector<String> proxies, HashMap<String,size_t> mappings) =|
|
||||
set_content_filters(Vector<DeprecatedString> filters) =|
|
||||
set_proxy_mappings(Vector<DeprecatedString> proxies, HashMap<DeprecatedString,size_t> mappings) =|
|
||||
set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme) =|
|
||||
set_has_focus(bool has_focus) =|
|
||||
set_is_scripting_enabled(bool is_scripting_enabled) =|
|
||||
|
@ -59,8 +59,8 @@ endpoint WebContentServer
|
|||
set_window_position(Gfx::IntPoint position) =|
|
||||
set_window_size(Gfx::IntSize size) =|
|
||||
|
||||
get_local_storage_entries() => (OrderedHashMap<String,String> entries)
|
||||
get_session_storage_entries() => (OrderedHashMap<String,String> entries)
|
||||
get_local_storage_entries() => (OrderedHashMap<DeprecatedString,DeprecatedString> entries)
|
||||
get_session_storage_entries() => (OrderedHashMap<DeprecatedString,DeprecatedString> entries)
|
||||
|
||||
handle_file_return(i32 error, Optional<IPC::File> file, i32 request_id) =|
|
||||
|
||||
|
@ -68,5 +68,5 @@ endpoint WebContentServer
|
|||
|
||||
alert_closed() =|
|
||||
confirm_closed(bool accepted) =|
|
||||
prompt_closed(String response) =|
|
||||
prompt_closed(DeprecatedString response) =|
|
||||
}
|
||||
|
|
|
@ -26,33 +26,33 @@ endpoint WebDriverClient {
|
|||
fullscreen_window() => (Web::WebDriver::Response response)
|
||||
find_element(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
find_elements(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
find_element_from_element(JsonValue payload, String element_id) => (Web::WebDriver::Response response)
|
||||
find_elements_from_element(JsonValue payload, String element_id) => (Web::WebDriver::Response response)
|
||||
find_element_from_shadow_root(JsonValue payload, String shadow_id) => (Web::WebDriver::Response response)
|
||||
find_elements_from_shadow_root(JsonValue payload, String shadow_id) => (Web::WebDriver::Response response)
|
||||
find_element_from_element(JsonValue payload, DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
find_elements_from_element(JsonValue payload, DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
find_element_from_shadow_root(JsonValue payload, DeprecatedString shadow_id) => (Web::WebDriver::Response response)
|
||||
find_elements_from_shadow_root(JsonValue payload, DeprecatedString shadow_id) => (Web::WebDriver::Response response)
|
||||
get_active_element() => (Web::WebDriver::Response response)
|
||||
get_element_shadow_root(String element_id) => (Web::WebDriver::Response response)
|
||||
is_element_selected(String element_id) => (Web::WebDriver::Response response)
|
||||
get_element_attribute(String element_id, String name) => (Web::WebDriver::Response response)
|
||||
get_element_property(String element_id, String name) => (Web::WebDriver::Response response)
|
||||
get_element_css_value(String element_id, String name) => (Web::WebDriver::Response response)
|
||||
get_element_text(String element_id) => (Web::WebDriver::Response response)
|
||||
get_element_tag_name(String element_id) => (Web::WebDriver::Response response)
|
||||
get_element_rect(String element_id) => (Web::WebDriver::Response response)
|
||||
is_element_enabled(String element_id) => (Web::WebDriver::Response response)
|
||||
get_element_shadow_root(DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
is_element_selected(DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
get_element_attribute(DeprecatedString element_id, DeprecatedString name) => (Web::WebDriver::Response response)
|
||||
get_element_property(DeprecatedString element_id, DeprecatedString name) => (Web::WebDriver::Response response)
|
||||
get_element_css_value(DeprecatedString element_id, DeprecatedString name) => (Web::WebDriver::Response response)
|
||||
get_element_text(DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
get_element_tag_name(DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
get_element_rect(DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
is_element_enabled(DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
get_source() => (Web::WebDriver::Response response)
|
||||
execute_script(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
execute_async_script(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
get_all_cookies() => (Web::WebDriver::Response response)
|
||||
get_named_cookie(String name) => (Web::WebDriver::Response response)
|
||||
get_named_cookie(DeprecatedString name) => (Web::WebDriver::Response response)
|
||||
add_cookie(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
delete_cookie(String name) => (Web::WebDriver::Response response)
|
||||
delete_cookie(DeprecatedString name) => (Web::WebDriver::Response response)
|
||||
delete_all_cookies() => (Web::WebDriver::Response response)
|
||||
dismiss_alert() => (Web::WebDriver::Response response)
|
||||
accept_alert() => (Web::WebDriver::Response response)
|
||||
get_alert_text() => (Web::WebDriver::Response response)
|
||||
send_alert_text(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
take_screenshot() => (Web::WebDriver::Response response)
|
||||
take_element_screenshot(String element_id) => (Web::WebDriver::Response response)
|
||||
take_element_screenshot(DeprecatedString element_id) => (Web::WebDriver::Response response)
|
||||
print_page() => (Web::WebDriver::Response response)
|
||||
}
|
||||
|
|
|
@ -105,21 +105,21 @@ static Gfx::IntRect calculate_absolute_rect_of_element(Web::Page const& page, We
|
|||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-get-or-create-a-web-element-reference
|
||||
static String get_or_create_a_web_element_reference(Web::DOM::Node const& element)
|
||||
static DeprecatedString get_or_create_a_web_element_reference(Web::DOM::Node const& element)
|
||||
{
|
||||
// FIXME: 1. For each known element of the current browsing context’s list of known elements:
|
||||
// FIXME: 1. If known element equals element, return success with known element’s web element reference.
|
||||
// FIXME: 2. Add element to the list of known elements of the current browsing context.
|
||||
// FIXME: 3. Return success with the element’s web element reference.
|
||||
|
||||
return String::number(element.id());
|
||||
return DeprecatedString::number(element.id());
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-web-element-reference-object
|
||||
static JsonObject web_element_reference_object(Web::DOM::Node const& element)
|
||||
{
|
||||
// https://w3c.github.io/webdriver/#dfn-web-element-identifier
|
||||
static String const web_element_identifier = "element-6066-11e4-a52e-4f735466cecf"sv;
|
||||
static DeprecatedString const web_element_identifier = "element-6066-11e4-a52e-4f735466cecf"sv;
|
||||
|
||||
// 1. Let identifier be the web element identifier.
|
||||
auto identifier = web_element_identifier;
|
||||
|
@ -146,27 +146,27 @@ static ErrorOr<Web::DOM::Element*, Web::WebDriver::Error> get_known_connected_el
|
|||
auto* node = Web::DOM::Node::from_id(*element);
|
||||
|
||||
if (!node || !node->is_element())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, String::formatted("Could not find element with ID: {}", element_id));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, DeprecatedString::formatted("Could not find element with ID: {}", element_id));
|
||||
|
||||
return static_cast<Web::DOM::Element*>(node);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-get-or-create-a-shadow-root-reference
|
||||
static String get_or_create_a_shadow_root_reference(Web::DOM::ShadowRoot const& shadow_root)
|
||||
static DeprecatedString get_or_create_a_shadow_root_reference(Web::DOM::ShadowRoot const& shadow_root)
|
||||
{
|
||||
// FIXME: 1. For each known shadow root of the current browsing context’s list of known shadow roots:
|
||||
// FIXME: 1. If known shadow root equals shadow root, return success with known shadow root’s shadow root reference.
|
||||
// FIXME: 2. Add shadow to the list of known shadow roots of the current browsing context.
|
||||
// FIXME: 3. Return success with the shadow’s shadow root reference.
|
||||
|
||||
return String::number(shadow_root.id());
|
||||
return DeprecatedString::number(shadow_root.id());
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-shadow-root-reference-object
|
||||
static JsonObject shadow_root_reference_object(Web::DOM::ShadowRoot const& shadow_root)
|
||||
{
|
||||
// https://w3c.github.io/webdriver/#dfn-shadow-root-identifier
|
||||
static String const shadow_root_identifier = "shadow-6066-11e4-a52e-4f735466cecf"sv;
|
||||
static DeprecatedString const shadow_root_identifier = "shadow-6066-11e4-a52e-4f735466cecf"sv;
|
||||
|
||||
// 1. Let identifier be the shadow root identifier.
|
||||
auto identifier = shadow_root_identifier;
|
||||
|
@ -193,7 +193,7 @@ static ErrorOr<Web::DOM::ShadowRoot*, Web::WebDriver::Error> get_known_shadow_ro
|
|||
auto* node = Web::DOM::Node::from_id(*shadow_root);
|
||||
|
||||
if (!node || !node->is_shadow_root())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, String::formatted("Could not find shadow root with ID: {}", shadow_id));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, DeprecatedString::formatted("Could not find shadow root with ID: {}", shadow_id));
|
||||
|
||||
return static_cast<Web::DOM::ShadowRoot*>(node);
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ static void scroll_element_into_view(Web::DOM::Element& element)
|
|||
element.scroll_into_view(options);
|
||||
}
|
||||
|
||||
template<typename PropertyType = String>
|
||||
template<typename PropertyType = DeprecatedString>
|
||||
static ErrorOr<PropertyType, Web::WebDriver::Error> get_property(JsonValue const& payload, StringView key)
|
||||
{
|
||||
if (!payload.is_object())
|
||||
|
@ -223,27 +223,27 @@ static ErrorOr<PropertyType, Web::WebDriver::Error> get_property(JsonValue const
|
|||
auto const* property = payload.as_object().get_ptr(key);
|
||||
|
||||
if (!property)
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("No property called '{}' present", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("No property called '{}' present", key));
|
||||
|
||||
if constexpr (IsSame<PropertyType, String>) {
|
||||
if constexpr (IsSame<PropertyType, DeprecatedString>) {
|
||||
if (!property->is_string())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not a String", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a String", key));
|
||||
return property->as_string();
|
||||
} else if constexpr (IsSame<PropertyType, bool>) {
|
||||
if (!property->is_bool())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not a Boolean", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a Boolean", key));
|
||||
return property->as_bool();
|
||||
} else if constexpr (IsSame<PropertyType, u32>) {
|
||||
if (!property->is_u32())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not a Number", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a Number", key));
|
||||
return property->as_u32();
|
||||
} else if constexpr (IsSame<PropertyType, JsonArray const*>) {
|
||||
if (!property->is_array())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not an Array", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not an Array", key));
|
||||
return &property->as_array();
|
||||
} else if constexpr (IsSame<PropertyType, JsonObject const*>) {
|
||||
if (!property->is_object())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not an Object", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not an Object", key));
|
||||
return &property->as_object();
|
||||
} else {
|
||||
static_assert(DependentFalse<PropertyType>, "get_property invoked with unknown property type");
|
||||
|
@ -251,7 +251,7 @@ static ErrorOr<PropertyType, Web::WebDriver::Error> get_property(JsonValue const
|
|||
}
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebDriverConnection>> WebDriverConnection::connect(Web::PageClient& page_client, String const& webdriver_ipc_path)
|
||||
ErrorOr<NonnullRefPtr<WebDriverConnection>> WebDriverConnection::connect(Web::PageClient& page_client, DeprecatedString const& webdriver_ipc_path)
|
||||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "Trying to connect to {}", webdriver_ipc_path);
|
||||
auto socket = TRY(Core::Stream::LocalSocket::connect(webdriver_ipc_path));
|
||||
|
@ -550,14 +550,14 @@ Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window
|
|||
if (!property)
|
||||
return Optional<i32> {};
|
||||
if (!property->is_number())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' is not a Number", name));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a Number", name));
|
||||
|
||||
auto number = property->template to_number<i64>();
|
||||
|
||||
if (number < min)
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' value {} exceeds the minimum allowed value {}", name, number, min));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' value {} exceeds the minimum allowed value {}", name, number, min));
|
||||
if (number > max)
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Property '{}' value {} exceeds the maximum allowed value {}", name, number, max));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' value {} exceeds the maximum allowed value {}", name, number, max));
|
||||
|
||||
return static_cast<i32>(number);
|
||||
};
|
||||
|
@ -695,7 +695,7 @@ Messages::WebDriverClient::FindElementResponse WebDriverConnection::find_element
|
|||
|
||||
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
|
||||
if (!location_strategy.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
|
||||
// 3. Let selector be the result of getting a property called "value".
|
||||
// 4. If selector is undefined, return error with error code invalid argument.
|
||||
|
@ -737,7 +737,7 @@ Messages::WebDriverClient::FindElementsResponse WebDriverConnection::find_elemen
|
|||
|
||||
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
|
||||
if (!location_strategy.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
|
||||
// 3. Let selector be the result of getting a property called "value".
|
||||
// 4. If selector is undefined, return error with error code invalid argument.
|
||||
|
@ -765,7 +765,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 const& payload, DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. Let location strategy be the result of getting a property called "using".
|
||||
auto location_strategy_string = TRY(get_property(payload, "using"sv));
|
||||
|
@ -773,7 +773,7 @@ Messages::WebDriverClient::FindElementFromElementResponse WebDriverConnection::f
|
|||
|
||||
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
|
||||
if (!location_strategy.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
|
||||
// 3. Let selector be the result of getting a property called "value".
|
||||
// 4. If selector is undefined, return error with error code invalid argument.
|
||||
|
@ -801,7 +801,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 const& payload, DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. Let location strategy be the result of getting a property called "using".
|
||||
auto location_strategy_string = TRY(get_property(payload, "using"sv));
|
||||
|
@ -809,7 +809,7 @@ Messages::WebDriverClient::FindElementsFromElementResponse WebDriverConnection::
|
|||
|
||||
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
|
||||
if (!location_strategy.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
|
||||
// 3. Let selector be the result of getting a property called "value".
|
||||
// 4. If selector is undefined, return error with error code invalid argument.
|
||||
|
@ -831,7 +831,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 const& payload, DeprecatedString const& shadow_id)
|
||||
{
|
||||
// 1. Let location strategy be the result of getting a property called "using".
|
||||
auto location_strategy_string = TRY(get_property(payload, "using"sv));
|
||||
|
@ -839,7 +839,7 @@ Messages::WebDriverClient::FindElementFromShadowRootResponse WebDriverConnection
|
|||
|
||||
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
|
||||
if (!location_strategy.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
|
||||
// 3. Let selector be the result of getting a property called "value".
|
||||
// 4. If selector is undefined, return error with error code invalid argument.
|
||||
|
@ -867,7 +867,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 const& payload, DeprecatedString const& shadow_id)
|
||||
{
|
||||
// 1. Let location strategy be the result of getting a property called "using".
|
||||
auto location_strategy_string = TRY(get_property(payload, "using"sv));
|
||||
|
@ -875,7 +875,7 @@ Messages::WebDriverClient::FindElementsFromShadowRootResponse WebDriverConnectio
|
|||
|
||||
// 2. If location strategy is not present as a keyword in the table of location strategies, return error with error code invalid argument.
|
||||
if (!location_strategy.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, String::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
|
||||
// 3. Let selector be the result of getting a property called "value".
|
||||
// 4. If selector is undefined, return error with error code invalid argument.
|
||||
|
@ -911,13 +911,13 @@ Messages::WebDriverClient::GetActiveElementResponse WebDriverConnection::get_act
|
|||
// 4. If active element is a non-null element, return success with data set to web element reference object for active element.
|
||||
// Otherwise, return error with error code no such element.
|
||||
if (active_element)
|
||||
return String::number(active_element->id());
|
||||
return DeprecatedString::number(active_element->id());
|
||||
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, "The current document does not have an active element"sv);
|
||||
}
|
||||
|
||||
// 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(DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -933,7 +933,7 @@ Messages::WebDriverClient::GetElementShadowRootResponse WebDriverConnection::get
|
|||
|
||||
// 5. If shadow root is null, return error with error code no such shadow root.
|
||||
if (!shadow_root)
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchShadowRoot, String::formatted("Element with ID '{}' does not have a shadow root", element_id));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchShadowRoot, DeprecatedString::formatted("Element with ID '{}' does not have a shadow root", element_id));
|
||||
|
||||
// 6. Let serialized be the shadow root reference object for shadow root.
|
||||
auto serialized = shadow_root_reference_object(*shadow_root);
|
||||
|
@ -943,7 +943,7 @@ 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(DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -979,7 +979,7 @@ 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(DeprecatedString const& element_id, DeprecatedString const& name)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -991,7 +991,7 @@ Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_
|
|||
auto* element = TRY(get_known_connected_element(element_id));
|
||||
|
||||
// 4. Let result be the result of the first matching condition:
|
||||
Optional<String> result;
|
||||
Optional<DeprecatedString> result;
|
||||
|
||||
// -> If name is a boolean attribute
|
||||
if (Web::HTML::is_boolean_attribute(name)) {
|
||||
|
@ -1012,7 +1012,7 @@ 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(DeprecatedString const& element_id, DeprecatedString const& name)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1023,7 +1023,7 @@ Messages::WebDriverClient::GetElementPropertyResponse WebDriverConnection::get_e
|
|||
// 3. Let element be the result of trying to get a known connected element with url variable element id.
|
||||
auto* element = TRY(get_known_connected_element(element_id));
|
||||
|
||||
Optional<String> result;
|
||||
Optional<DeprecatedString> result;
|
||||
|
||||
// 4. Let property be the result of calling the Object.[[GetProperty]](name) on element.
|
||||
if (auto property_or_error = element->get(name); !property_or_error.is_throw_completion()) {
|
||||
|
@ -1043,7 +1043,7 @@ 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(DeprecatedString const& element_id, DeprecatedString const& name)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1055,7 +1055,7 @@ Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_e
|
|||
auto* element = TRY(get_known_connected_element(element_id));
|
||||
|
||||
// 4. Let computed value be the result of the first matching condition:
|
||||
String computed_value;
|
||||
DeprecatedString computed_value;
|
||||
|
||||
// -> current browsing context’s active document’s type is not "xml"
|
||||
if (!m_page_client.page().top_level_browsing_context().active_document()->is_xml_document()) {
|
||||
|
@ -1068,7 +1068,7 @@ Messages::WebDriverClient::GetElementCssValueResponse WebDriverConnection::get_e
|
|||
// -> Otherwise
|
||||
else {
|
||||
// "" (empty string)
|
||||
computed_value = String::empty();
|
||||
computed_value = DeprecatedString::empty();
|
||||
}
|
||||
|
||||
// 5. Return success with data computed value.
|
||||
|
@ -1076,7 +1076,7 @@ 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(DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1095,7 +1095,7 @@ 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(DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1114,7 +1114,7 @@ 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(DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1145,7 +1145,7 @@ 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(DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1180,7 +1180,7 @@ Messages::WebDriverClient::GetSourceResponse WebDriverConnection::get_source()
|
|||
TRY(handle_any_user_prompts());
|
||||
|
||||
auto* document = m_page_client.page().top_level_browsing_context().active_document();
|
||||
Optional<String> source;
|
||||
Optional<DeprecatedString> source;
|
||||
|
||||
// 3. Let source be the result of invoking the fragment serializing algorithm on a fictional node whose only child is the document element providing true for the require well-formed flag. If this causes an exception to be thrown, let source be null.
|
||||
if (auto result = document->serialize_fragment(Web::DOMParsing::RequireWellFormed::Yes); !result.is_error())
|
||||
|
@ -1286,7 +1286,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(DeprecatedString const& name)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1303,7 +1303,7 @@ Messages::WebDriverClient::GetNamedCookieResponse WebDriverConnection::get_named
|
|||
}
|
||||
|
||||
// 4. Otherwise, return error with error code no such cookie.
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchCookie, String::formatted("Cookie '{}' not found", name));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchCookie, DeprecatedString::formatted("Cookie '{}' not found", name));
|
||||
}
|
||||
|
||||
// 14.3 Add Cookie, https://w3c.github.io/webdriver/#dfn-adding-a-cookie
|
||||
|
@ -1380,7 +1380,7 @@ Messages::WebDriverClient::AddCookieResponse WebDriverConnection::add_cookie(Jso
|
|||
}
|
||||
|
||||
// 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(DeprecatedString const& name)
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1531,7 +1531,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(DeprecatedString const& element_id)
|
||||
{
|
||||
// 1. If the current top-level browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
@ -1686,7 +1686,7 @@ ErrorOr<JsonArray, Web::WebDriver::Error> WebDriverConnection::find(StartNodeGet
|
|||
|
||||
// 5. If a DOMException, SyntaxError, XPathException, or other error occurs during the execution of the element location strategy, return error invalid selector.
|
||||
if (elements.is_error())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSelector, String::formatted("The location strategy could not finish: {}", elements.error().message));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSelector, DeprecatedString::formatted("The location strategy could not finish: {}", elements.error().message));
|
||||
|
||||
return elements.release_value();
|
||||
};
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibIPC/ConnectionToServer.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
|
@ -29,7 +29,7 @@ class WebDriverConnection final
|
|||
C_OBJECT(WebDriverConnection)
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<WebDriverConnection>> connect(Web::PageClient& page_client, String const& webdriver_ipc_path);
|
||||
static ErrorOr<NonnullRefPtr<WebDriverConnection>> connect(Web::PageClient& page_client, DeprecatedString const& webdriver_ipc_path);
|
||||
virtual ~WebDriverConnection() = default;
|
||||
|
||||
private:
|
||||
|
@ -61,34 +61,34 @@ private:
|
|||
virtual Messages::WebDriverClient::FullscreenWindowResponse fullscreen_window() 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::FindElementFromElementResponse find_element_from_element(JsonValue const& payload, DeprecatedString const& element_id) override;
|
||||
virtual Messages::WebDriverClient::FindElementsFromElementResponse find_elements_from_element(JsonValue const& payload, DeprecatedString const& element_id) override;
|
||||
virtual Messages::WebDriverClient::FindElementFromShadowRootResponse find_element_from_shadow_root(JsonValue const& payload, DeprecatedString const& shadow_id) override;
|
||||
virtual Messages::WebDriverClient::FindElementsFromShadowRootResponse find_elements_from_shadow_root(JsonValue const& payload, DeprecatedString const& 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::GetElementShadowRootResponse get_element_shadow_root(DeprecatedString const& element_id) override;
|
||||
virtual Messages::WebDriverClient::IsElementSelectedResponse is_element_selected(DeprecatedString const& element_id) override;
|
||||
virtual Messages::WebDriverClient::GetElementAttributeResponse get_element_attribute(DeprecatedString const& element_id, DeprecatedString const& name) override;
|
||||
virtual Messages::WebDriverClient::GetElementPropertyResponse get_element_property(DeprecatedString const& element_id, DeprecatedString const& name) override;
|
||||
virtual Messages::WebDriverClient::GetElementCssValueResponse get_element_css_value(DeprecatedString const& element_id, DeprecatedString const& name) override;
|
||||
virtual Messages::WebDriverClient::GetElementTextResponse get_element_text(DeprecatedString const& element_id) override;
|
||||
virtual Messages::WebDriverClient::GetElementTagNameResponse get_element_tag_name(DeprecatedString const& element_id) override;
|
||||
virtual Messages::WebDriverClient::GetElementRectResponse get_element_rect(DeprecatedString const& element_id) override;
|
||||
virtual Messages::WebDriverClient::IsElementEnabledResponse is_element_enabled(DeprecatedString const& element_id) 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::GetAllCookiesResponse get_all_cookies() override;
|
||||
virtual Messages::WebDriverClient::GetNamedCookieResponse get_named_cookie(String const& name) override;
|
||||
virtual Messages::WebDriverClient::GetNamedCookieResponse get_named_cookie(DeprecatedString 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::DeleteCookieResponse delete_cookie(DeprecatedString const& name) override;
|
||||
virtual Messages::WebDriverClient::DeleteAllCookiesResponse delete_all_cookies() 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::TakeScreenshotResponse take_screenshot() override;
|
||||
virtual Messages::WebDriverClient::TakeElementScreenshotResponse take_element_screenshot(String const& element_id) override;
|
||||
virtual Messages::WebDriverClient::TakeElementScreenshotResponse take_element_screenshot(DeprecatedString const& element_id) override;
|
||||
virtual Messages::WebDriverClient::PrintPageResponse print_page() override;
|
||||
|
||||
ErrorOr<void, Web::WebDriver::Error> ensure_open_top_level_browsing_context();
|
||||
|
@ -101,7 +101,7 @@ private:
|
|||
ErrorOr<JsonArray, Web::WebDriver::Error> find(StartNodeGetter&& start_node_getter, Web::WebDriver::LocationStrategy using_, StringView value);
|
||||
|
||||
struct ScriptArguments {
|
||||
String script;
|
||||
DeprecatedString script;
|
||||
JS::MarkedVector<JS::Value> arguments;
|
||||
};
|
||||
ErrorOr<ScriptArguments, Web::WebDriver::Error> extract_the_script_arguments_from_a_request(JsonValue const& payload);
|
||||
|
@ -122,11 +122,11 @@ private:
|
|||
Web::WebDriver::TimeoutsConfiguration m_timeouts_configuration;
|
||||
|
||||
struct Window {
|
||||
String handle;
|
||||
DeprecatedString handle;
|
||||
bool is_open { false };
|
||||
};
|
||||
HashMap<String, Window> m_windows;
|
||||
String m_current_window_handle;
|
||||
HashMap<DeprecatedString, Window> m_windows;
|
||||
DeprecatedString m_current_window_handle;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue