mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:17:34 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -86,7 +86,7 @@ void ConnectionFromClient::set_window_handle(String const& handle)
|
|||
page().page().top_level_browsing_context().set_window_handle(handle);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::connect_to_webdriver(DeprecatedString const& webdriver_ipc_path)
|
||||
void ConnectionFromClient::connect_to_webdriver(ByteString const& webdriver_ipc_path)
|
||||
{
|
||||
// FIXME: Propagate this error back to the browser.
|
||||
if (auto result = page().connect_to_webdriver(webdriver_ipc_path); result.is_error())
|
||||
|
@ -100,7 +100,7 @@ void ConnectionFromClient::update_system_theme(Core::AnonymousBuffer const& them
|
|||
page().set_palette_impl(*impl);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::update_system_fonts(DeprecatedString const& default_font_query, DeprecatedString const& fixed_width_font_query, DeprecatedString const& window_title_font_query)
|
||||
void ConnectionFromClient::update_system_fonts(ByteString const& default_font_query, ByteString const& fixed_width_font_query, ByteString 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);
|
||||
|
@ -117,11 +117,11 @@ void ConnectionFromClient::load_url(const URL& url)
|
|||
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadURL: url={}", url);
|
||||
|
||||
#if defined(AK_OS_SERENITY)
|
||||
DeprecatedString process_name;
|
||||
ByteString process_name;
|
||||
if (url.host().has<Empty>() || url.host() == String {})
|
||||
process_name = "WebContent";
|
||||
else
|
||||
process_name = DeprecatedString::formatted("WebContent: {}", url.serialized_host().release_value_but_fixme_should_propagate_errors());
|
||||
process_name = ByteString::formatted("WebContent: {}", url.serialized_host().release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
pthread_setname_np(pthread_self(), process_name.characters());
|
||||
#endif
|
||||
|
@ -129,7 +129,7 @@ void ConnectionFromClient::load_url(const URL& url)
|
|||
page().page().load(url);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::load_html(DeprecatedString const& html)
|
||||
void ConnectionFromClient::load_html(ByteString const& html)
|
||||
{
|
||||
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadHTML: html={}", html);
|
||||
page().page().load_html(html);
|
||||
|
@ -364,7 +364,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(DeprecatedString const& request, DeprecatedString const& argument)
|
||||
void ConnectionFromClient::debug_request(ByteString const& request, ByteString const& argument)
|
||||
{
|
||||
if (request == "dump-session-history") {
|
||||
auto const& traversable = page().page().top_level_traversable();
|
||||
|
@ -452,7 +452,7 @@ void ConnectionFromClient::debug_request(DeprecatedString const& request, Deprec
|
|||
}
|
||||
|
||||
if (request == "spoof-user-agent") {
|
||||
Web::ResourceLoader::the().set_user_agent(MUST(String::from_deprecated_string(argument)));
|
||||
Web::ResourceLoader::the().set_user_agent(MUST(String::from_byte_string(argument)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -496,14 +496,14 @@ void ConnectionFromClient::debug_request(DeprecatedString const& request, Deprec
|
|||
void ConnectionFromClient::get_source()
|
||||
{
|
||||
if (auto* doc = page().page().top_level_browsing_context().active_document()) {
|
||||
async_did_get_source(doc->url(), doc->source().to_deprecated_string());
|
||||
async_did_get_source(doc->url(), doc->source().to_byte_string());
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionFromClient::inspect_dom_tree()
|
||||
{
|
||||
if (auto* doc = page().page().top_level_browsing_context().active_document()) {
|
||||
async_did_get_dom_tree(doc->dump_dom_tree_as_json().to_deprecated_string());
|
||||
async_did_get_dom_tree(doc->dump_dom_tree_as_json().to_byte_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -531,19 +531,19 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
if (!element.computed_css_values())
|
||||
return { false, "", "", "", "", "" };
|
||||
|
||||
auto serialize_json = [](Web::CSS::StyleProperties const& properties) -> DeprecatedString {
|
||||
auto serialize_json = [](Web::CSS::StyleProperties const& properties) -> ByteString {
|
||||
StringBuilder builder;
|
||||
|
||||
auto serializer = MUST(JsonObjectSerializer<>::try_create(builder));
|
||||
properties.for_each_property([&](auto property_id, auto& value) {
|
||||
MUST(serializer.add(Web::CSS::string_from_property_id(property_id), value.to_string().to_deprecated_string()));
|
||||
MUST(serializer.add(Web::CSS::string_from_property_id(property_id), value.to_string().to_byte_string()));
|
||||
});
|
||||
MUST(serializer.finish());
|
||||
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
};
|
||||
|
||||
auto serialize_custom_properties_json = [](Web::DOM::Element const& element, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) -> DeprecatedString {
|
||||
auto serialize_custom_properties_json = [](Web::DOM::Element const& element, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) -> ByteString {
|
||||
StringBuilder builder;
|
||||
auto serializer = MUST(JsonObjectSerializer<>::try_create(builder));
|
||||
HashTable<FlyString> seen_properties;
|
||||
|
@ -562,9 +562,9 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
|
||||
MUST(serializer.finish());
|
||||
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
};
|
||||
auto serialize_node_box_sizing_json = [](Web::Layout::Node const* layout_node) -> DeprecatedString {
|
||||
auto serialize_node_box_sizing_json = [](Web::Layout::Node const* layout_node) -> ByteString {
|
||||
if (!layout_node || !layout_node->is_box()) {
|
||||
return "{}";
|
||||
}
|
||||
|
@ -593,10 +593,10 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
}
|
||||
|
||||
MUST(serializer.finish());
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
};
|
||||
|
||||
auto serialize_aria_properties_state_json = [](Web::DOM::Element const& element) -> DeprecatedString {
|
||||
auto serialize_aria_properties_state_json = [](Web::DOM::Element const& element) -> ByteString {
|
||||
auto role_name = element.role_or_default();
|
||||
if (!role_name.has_value()) {
|
||||
return "";
|
||||
|
@ -608,7 +608,7 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
|
|||
auto serializer = MUST(JsonObjectSerializer<>::try_create(builder));
|
||||
MUST(role->serialize_as_json(serializer));
|
||||
MUST(serializer.finish());
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
};
|
||||
|
||||
if (pseudo_element.has_value()) {
|
||||
|
@ -620,18 +620,18 @@ 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 = MUST(page().page().focused_context().active_document()->style_computer().compute_style(element, pseudo_element));
|
||||
DeprecatedString computed_values = serialize_json(pseudo_element_style);
|
||||
DeprecatedString resolved_values = "{}";
|
||||
DeprecatedString custom_properties_json = serialize_custom_properties_json(element, pseudo_element);
|
||||
DeprecatedString node_box_sizing_json = serialize_node_box_sizing_json(pseudo_element_node.ptr());
|
||||
ByteString computed_values = serialize_json(pseudo_element_style);
|
||||
ByteString resolved_values = "{}";
|
||||
ByteString custom_properties_json = serialize_custom_properties_json(element, pseudo_element);
|
||||
ByteString 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, "" };
|
||||
}
|
||||
|
||||
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());
|
||||
DeprecatedString aria_properties_state_json = serialize_aria_properties_state_json(element);
|
||||
ByteString computed_values = serialize_json(*element.computed_css_values());
|
||||
ByteString resolved_values_json = serialize_json(element.resolved_css_values());
|
||||
ByteString custom_properties_json = serialize_custom_properties_json(element, {});
|
||||
ByteString node_box_sizing_json = serialize_node_box_sizing_json(element.layout_node());
|
||||
ByteString aria_properties_state_json = serialize_aria_properties_state_json(element);
|
||||
return { true, computed_values, resolved_values_json, custom_properties_json, node_box_sizing_json, aria_properties_state_json };
|
||||
}
|
||||
|
||||
|
@ -668,7 +668,7 @@ Messages::WebContentServer::SetDomNodeTagResponse ConnectionFromClient::set_dom_
|
|||
auto new_element = Web::DOM::create_element(element.document(), name, element.namespace_uri(), element.prefix(), element.is_value()).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
element.for_each_attribute([&](auto const& attribute) {
|
||||
new_element->set_attribute_value(attribute.local_name(), attribute.value().to_deprecated_string(), attribute.prefix(), attribute.namespace_uri());
|
||||
new_element->set_attribute_value(attribute.local_name(), attribute.value().to_byte_string(), attribute.prefix(), attribute.namespace_uri());
|
||||
});
|
||||
|
||||
while (auto* child_node = element.first_child()) {
|
||||
|
@ -799,13 +799,13 @@ void ConnectionFromClient::destroy_js_console(Badge<PageClient>, Web::DOM::Docum
|
|||
m_console_clients.remove(&document);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::js_console_input(DeprecatedString const& js_source)
|
||||
void ConnectionFromClient::js_console_input(ByteString const& js_source)
|
||||
{
|
||||
if (m_top_level_document_console_client)
|
||||
m_top_level_document_console_client->handle_input(js_source);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::run_javascript(DeprecatedString const& js_source)
|
||||
void ConnectionFromClient::run_javascript(ByteString const& js_source)
|
||||
{
|
||||
auto* active_document = page().page().top_level_browsing_context().active_document();
|
||||
|
||||
|
@ -870,7 +870,7 @@ Messages::WebContentServer::TakeDomNodeScreenshotResponse ConnectionFromClient::
|
|||
Messages::WebContentServer::DumpGcGraphResponse ConnectionFromClient::dump_gc_graph()
|
||||
{
|
||||
auto gc_graph_json = Web::Bindings::main_thread_vm().heap().dump_graph();
|
||||
return MUST(String::from_deprecated_string(gc_graph_json.to_deprecated_string()));
|
||||
return MUST(String::from_byte_string(gc_graph_json.to_byte_string()));
|
||||
}
|
||||
|
||||
Messages::WebContentServer::GetSelectedTextResponse ConnectionFromClient::get_selected_text()
|
||||
|
@ -888,39 +888,39 @@ Messages::WebContentServer::DumpLayoutTreeResponse ConnectionFromClient::dump_la
|
|||
{
|
||||
auto* document = page().page().top_level_browsing_context().active_document();
|
||||
if (!document)
|
||||
return DeprecatedString { "(no DOM tree)" };
|
||||
return ByteString { "(no DOM tree)" };
|
||||
document->update_layout();
|
||||
auto* layout_root = document->layout_node();
|
||||
if (!layout_root)
|
||||
return DeprecatedString { "(no layout tree)" };
|
||||
return ByteString { "(no layout tree)" };
|
||||
StringBuilder builder;
|
||||
Web::dump_tree(builder, *layout_root);
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
Messages::WebContentServer::DumpPaintTreeResponse ConnectionFromClient::dump_paint_tree()
|
||||
{
|
||||
auto* document = page().page().top_level_browsing_context().active_document();
|
||||
if (!document)
|
||||
return DeprecatedString { "(no DOM tree)" };
|
||||
return ByteString { "(no DOM tree)" };
|
||||
document->update_layout();
|
||||
auto* layout_root = document->layout_node();
|
||||
if (!layout_root)
|
||||
return DeprecatedString { "(no layout tree)" };
|
||||
return ByteString { "(no layout tree)" };
|
||||
if (!layout_root->paintable())
|
||||
return DeprecatedString { "(no paint tree)" };
|
||||
return ByteString { "(no paint tree)" };
|
||||
StringBuilder builder;
|
||||
Web::dump_tree(builder, *layout_root->paintable());
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
Messages::WebContentServer::DumpTextResponse ConnectionFromClient::dump_text()
|
||||
{
|
||||
auto* document = page().page().top_level_browsing_context().active_document();
|
||||
if (!document)
|
||||
return DeprecatedString { "(no DOM tree)" };
|
||||
return ByteString { "(no DOM tree)" };
|
||||
if (!document->body())
|
||||
return DeprecatedString { "(no body)" };
|
||||
return ByteString { "(no body)" };
|
||||
return document->body()->inner_text();
|
||||
}
|
||||
|
||||
|
@ -941,12 +941,12 @@ void ConnectionFromClient::set_autoplay_allowlist(Vector<String> const& allowlis
|
|||
autoplay_allowlist.enable_for_origins(allowlist).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_proxy_mappings(Vector<DeprecatedString> const& proxies, HashMap<DeprecatedString, size_t> const& mappings)
|
||||
void ConnectionFromClient::set_proxy_mappings(Vector<ByteString> const& proxies, HashMap<ByteString, size_t> const& mappings)
|
||||
{
|
||||
auto keys = mappings.keys();
|
||||
quick_sort(keys, [&](auto& a, auto& b) { return a.length() < b.length(); });
|
||||
|
||||
OrderedHashMap<DeprecatedString, size_t> sorted_mappings;
|
||||
OrderedHashMap<ByteString, size_t> sorted_mappings;
|
||||
for (auto& key : keys) {
|
||||
auto value = *mappings.get(key);
|
||||
if (value >= proxies.size())
|
||||
|
@ -1082,7 +1082,7 @@ void ConnectionFromClient::set_user_style(String const& source)
|
|||
void ConnectionFromClient::inspect_accessibility_tree()
|
||||
{
|
||||
if (auto* doc = page().page().top_level_browsing_context().active_document()) {
|
||||
async_did_get_accessibility_tree(doc->dump_accessibility_tree_as_json().to_deprecated_string());
|
||||
async_did_get_accessibility_tree(doc->dump_accessibility_tree_as_json().to_byte_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,12 +52,12 @@ private:
|
|||
|
||||
virtual Messages::WebContentServer::GetWindowHandleResponse get_window_handle() override;
|
||||
virtual void set_window_handle(String const& handle) override;
|
||||
virtual void connect_to_webdriver(DeprecatedString const& webdriver_ipc_path) override;
|
||||
virtual void connect_to_webdriver(ByteString const& webdriver_ipc_path) override;
|
||||
virtual void update_system_theme(Core::AnonymousBuffer const&) override;
|
||||
virtual void update_system_fonts(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override;
|
||||
virtual void update_system_fonts(ByteString const&, ByteString const&, ByteString const&) override;
|
||||
virtual void update_screen_rects(Vector<Web::DevicePixelRect> const&, u32) override;
|
||||
virtual void load_url(URL const&) override;
|
||||
virtual void load_html(DeprecatedString const&) override;
|
||||
virtual void load_html(ByteString const&) override;
|
||||
virtual void paint(Web::DevicePixelRect const&, i32) override;
|
||||
virtual void set_viewport_rect(Web::DevicePixelRect const&) override;
|
||||
virtual void mouse_down(Web::DevicePixelPoint, Web::DevicePixelPoint, unsigned, unsigned, unsigned) override;
|
||||
|
@ -69,7 +69,7 @@ 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(DeprecatedString const&, DeprecatedString const&) override;
|
||||
virtual void debug_request(ByteString const&, ByteString 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::Type> const& pseudo_element) override;
|
||||
|
@ -92,7 +92,7 @@ private:
|
|||
virtual void set_content_filters(Vector<String> const&) override;
|
||||
virtual void set_autoplay_allowed_on_all_websites() override;
|
||||
virtual void set_autoplay_allowlist(Vector<String> const& allowlist) override;
|
||||
virtual void set_proxy_mappings(Vector<DeprecatedString> const&, HashMap<DeprecatedString, size_t> const&) override;
|
||||
virtual void set_proxy_mappings(Vector<ByteString> const&, HashMap<ByteString, 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;
|
||||
|
@ -102,8 +102,8 @@ 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(DeprecatedString const&) override;
|
||||
virtual void run_javascript(DeprecatedString const&) override;
|
||||
virtual void js_console_input(ByteString const&) override;
|
||||
virtual void run_javascript(ByteString const&) override;
|
||||
virtual void js_console_request_messages(i32) override;
|
||||
|
||||
virtual void alert_closed() override;
|
||||
|
|
|
@ -68,7 +68,7 @@ JS_DEFINE_NATIVE_FUNCTION(ConsoleGlobalEnvironmentExtensions::$_function)
|
|||
auto* console_global_object = TRY(get_console(vm));
|
||||
auto& window = *console_global_object->m_window_object;
|
||||
|
||||
auto selector = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
auto selector = TRY(vm.argument(0).to_byte_string(vm));
|
||||
|
||||
if (vm.argument_count() > 1) {
|
||||
auto element_value = vm.argument(1);
|
||||
|
@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(ConsoleGlobalEnvironmentExtensions::$$_function)
|
|||
auto* console_global_object = TRY(get_console(vm));
|
||||
auto& window = *console_global_object->m_window_object;
|
||||
|
||||
auto selector = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
auto selector = TRY(vm.argument(0).to_byte_string(vm));
|
||||
|
||||
Web::DOM::ParentNode* element = &window.associated_document();
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ void PageClient::page_did_layout()
|
|||
client().async_did_layout(m_content_size.to_type<int>());
|
||||
}
|
||||
|
||||
void PageClient::page_did_change_title(DeprecatedString const& title)
|
||||
void PageClient::page_did_change_title(ByteString const& title)
|
||||
{
|
||||
client().async_did_change_title(title);
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ void PageClient::page_did_request_scroll_into_view(Web::CSSPixelRect const& rect
|
|||
device_pixel_rect.height().value() });
|
||||
}
|
||||
|
||||
void PageClient::page_did_enter_tooltip_area(Web::CSSPixelPoint content_position, DeprecatedString const& title)
|
||||
void PageClient::page_did_enter_tooltip_area(Web::CSSPixelPoint content_position, ByteString const& title)
|
||||
{
|
||||
client().async_did_enter_tooltip_area({ content_position.x().to_int(), content_position.y().to_int() }, title);
|
||||
}
|
||||
|
@ -314,12 +314,12 @@ void PageClient::page_did_unhover_link()
|
|||
client().async_did_unhover_link();
|
||||
}
|
||||
|
||||
void PageClient::page_did_click_link(const URL& url, DeprecatedString const& target, unsigned modifiers)
|
||||
void PageClient::page_did_click_link(const URL& url, ByteString const& target, unsigned modifiers)
|
||||
{
|
||||
client().async_did_click_link(url, target, modifiers);
|
||||
}
|
||||
|
||||
void PageClient::page_did_middle_click_link(const URL& url, [[maybe_unused]] DeprecatedString const& target, [[maybe_unused]] unsigned modifiers)
|
||||
void PageClient::page_did_middle_click_link(const URL& url, [[maybe_unused]] ByteString const& target, [[maybe_unused]] unsigned modifiers)
|
||||
{
|
||||
client().async_did_middle_click_link(url, target, modifiers);
|
||||
}
|
||||
|
@ -354,18 +354,18 @@ void PageClient::page_did_request_context_menu(Web::CSSPixelPoint content_positi
|
|||
client().async_did_request_context_menu(page().css_to_device_point(content_position).to_type<int>());
|
||||
}
|
||||
|
||||
void PageClient::page_did_request_link_context_menu(Web::CSSPixelPoint content_position, URL const& url, DeprecatedString const& target, unsigned modifiers)
|
||||
void PageClient::page_did_request_link_context_menu(Web::CSSPixelPoint content_position, URL const& url, ByteString const& target, unsigned modifiers)
|
||||
{
|
||||
client().async_did_request_link_context_menu(page().css_to_device_point(content_position).to_type<int>(), url, target, modifiers);
|
||||
}
|
||||
|
||||
void PageClient::page_did_request_image_context_menu(Web::CSSPixelPoint content_position, URL const& url, DeprecatedString const& target, unsigned modifiers, Gfx::Bitmap const* bitmap_pointer)
|
||||
void PageClient::page_did_request_image_context_menu(Web::CSSPixelPoint content_position, URL const& url, ByteString const& target, unsigned modifiers, Gfx::Bitmap const* bitmap_pointer)
|
||||
{
|
||||
auto bitmap = bitmap_pointer ? bitmap_pointer->to_shareable_bitmap() : Gfx::ShareableBitmap();
|
||||
client().async_did_request_image_context_menu(page().css_to_device_point(content_position).to_type<int>(), url, target, modifiers, bitmap);
|
||||
}
|
||||
|
||||
void PageClient::page_did_request_media_context_menu(Web::CSSPixelPoint content_position, DeprecatedString const& target, unsigned modifiers, Web::Page::MediaContextMenu menu)
|
||||
void PageClient::page_did_request_media_context_menu(Web::CSSPixelPoint content_position, ByteString const& target, unsigned modifiers, Web::Page::MediaContextMenu menu)
|
||||
{
|
||||
client().async_did_request_media_context_menu(page().css_to_device_point(content_position).to_type<int>(), target, modifiers, move(menu));
|
||||
}
|
||||
|
@ -460,12 +460,12 @@ Vector<Web::Cookie::Cookie> PageClient::page_did_request_all_cookies(URL const&
|
|||
return client().did_request_all_cookies(url);
|
||||
}
|
||||
|
||||
Optional<Web::Cookie::Cookie> PageClient::page_did_request_named_cookie(URL const& url, DeprecatedString const& name)
|
||||
Optional<Web::Cookie::Cookie> PageClient::page_did_request_named_cookie(URL const& url, ByteString const& name)
|
||||
{
|
||||
return client().did_request_named_cookie(url, name);
|
||||
}
|
||||
|
||||
DeprecatedString PageClient::page_did_request_cookie(const URL& url, Web::Cookie::Source source)
|
||||
ByteString PageClient::page_did_request_cookie(const URL& url, Web::Cookie::Source source)
|
||||
{
|
||||
auto response = client().send_sync_but_allow_failure<Messages::WebContentClient::DidRequestCookie>(move(url), static_cast<u8>(source));
|
||||
if (!response) {
|
||||
|
@ -589,7 +589,7 @@ void PageClient::inspector_did_execute_console_script(String const& script)
|
|||
client().async_inspector_did_execute_console_script(script);
|
||||
}
|
||||
|
||||
ErrorOr<void> PageClient::connect_to_webdriver(DeprecatedString const& webdriver_ipc_path)
|
||||
ErrorOr<void> PageClient::connect_to_webdriver(ByteString const& webdriver_ipc_path)
|
||||
{
|
||||
VERIFY(!m_webdriver);
|
||||
m_webdriver = TRY(WebDriverConnection::connect(*this, webdriver_ipc_path));
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
virtual Web::Page& page() override { return *m_page; }
|
||||
virtual Web::Page const& page() const override { return *m_page; }
|
||||
|
||||
ErrorOr<void> connect_to_webdriver(DeprecatedString const& webdriver_ipc_path);
|
||||
ErrorOr<void> connect_to_webdriver(ByteString const& webdriver_ipc_path);
|
||||
|
||||
virtual void paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap&, Web::PaintOptions = {}) override;
|
||||
|
||||
|
@ -78,7 +78,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(DeprecatedString const&) override;
|
||||
virtual void page_did_change_title(ByteString 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;
|
||||
|
@ -91,16 +91,16 @@ private:
|
|||
virtual void page_did_request_scroll(i32, i32) override;
|
||||
virtual void page_did_request_scroll_to(Web::CSSPixelPoint) override;
|
||||
virtual void page_did_request_scroll_into_view(Web::CSSPixelRect const&) override;
|
||||
virtual void page_did_enter_tooltip_area(Web::CSSPixelPoint, DeprecatedString const&) override;
|
||||
virtual void page_did_enter_tooltip_area(Web::CSSPixelPoint, ByteString 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&, 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_click_link(const URL&, ByteString const& target, unsigned modifiers) override;
|
||||
virtual void page_did_middle_click_link(const URL&, ByteString const& target, unsigned modifiers) override;
|
||||
virtual void page_did_request_context_menu(Web::CSSPixelPoint) override;
|
||||
virtual void page_did_request_link_context_menu(Web::CSSPixelPoint, URL const&, DeprecatedString const& target, unsigned modifiers) override;
|
||||
virtual void page_did_request_image_context_menu(Web::CSSPixelPoint, const URL&, DeprecatedString const& target, unsigned modifiers, Gfx::Bitmap const*) override;
|
||||
virtual void page_did_request_media_context_menu(Web::CSSPixelPoint, DeprecatedString const& target, unsigned modifiers, Web::Page::MediaContextMenu) override;
|
||||
virtual void page_did_request_link_context_menu(Web::CSSPixelPoint, URL const&, ByteString const& target, unsigned modifiers) override;
|
||||
virtual void page_did_request_image_context_menu(Web::CSSPixelPoint, const URL&, ByteString const& target, unsigned modifiers, Gfx::Bitmap const*) override;
|
||||
virtual void page_did_request_media_context_menu(Web::CSSPixelPoint, ByteString const& target, unsigned modifiers, Web::Page::MediaContextMenu) override;
|
||||
virtual void page_did_start_loading(const URL&, bool) override;
|
||||
virtual void page_did_create_new_document(Web::DOM::Document&) override;
|
||||
virtual void page_did_destroy_document(Web::DOM::Document&) override;
|
||||
|
@ -113,8 +113,8 @@ private:
|
|||
virtual void page_did_request_dismiss_dialog() override;
|
||||
virtual void page_did_change_favicon(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&, DeprecatedString const&) override;
|
||||
virtual DeprecatedString page_did_request_cookie(const URL&, Web::Cookie::Source) override;
|
||||
virtual Optional<Web::Cookie::Cookie> page_did_request_named_cookie(URL const&, ByteString const&) override;
|
||||
virtual ByteString 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(Web::Cookie::Cookie) override;
|
||||
virtual void page_did_update_resource_count(i32) override;
|
||||
|
|
|
@ -22,33 +22,33 @@ endpoint WebContentClient
|
|||
did_change_selection() =|
|
||||
did_request_cursor_change(i32 cursor_type) =|
|
||||
did_layout(Gfx::IntSize content_size) =|
|
||||
did_change_title(DeprecatedString title) =|
|
||||
did_change_title(ByteString 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, DeprecatedString title) =|
|
||||
did_enter_tooltip_area(Gfx::IntPoint content_position, ByteString title) =|
|
||||
did_leave_tooltip_area() =|
|
||||
did_hover_link(URL url) =|
|
||||
did_unhover_link() =|
|
||||
did_click_link(URL url, DeprecatedString target, unsigned modifiers) =|
|
||||
did_middle_click_link(URL url, DeprecatedString target, unsigned modifiers) =|
|
||||
did_click_link(URL url, ByteString target, unsigned modifiers) =|
|
||||
did_middle_click_link(URL url, ByteString target, unsigned modifiers) =|
|
||||
did_request_context_menu(Gfx::IntPoint content_position) =|
|
||||
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_media_context_menu(Gfx::IntPoint content_position, DeprecatedString target, unsigned modifiers, Web::Page::MediaContextMenu menu) =|
|
||||
did_request_link_context_menu(Gfx::IntPoint content_position, URL url, ByteString target, unsigned modifiers) =|
|
||||
did_request_image_context_menu(Gfx::IntPoint content_position, URL url, ByteString target, unsigned modifiers, Gfx::ShareableBitmap bitmap) =|
|
||||
did_request_media_context_menu(Gfx::IntPoint content_position, ByteString target, unsigned modifiers, Web::Page::MediaContextMenu menu) =|
|
||||
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_accept_dialog() =|
|
||||
did_request_dismiss_dialog() =|
|
||||
did_get_source(URL url, DeprecatedString source) =|
|
||||
did_get_dom_tree(DeprecatedString dom_tree) =|
|
||||
did_get_accessibility_tree(DeprecatedString accessibility_tree) =|
|
||||
did_get_source(URL url, ByteString source) =|
|
||||
did_get_dom_tree(ByteString dom_tree) =|
|
||||
did_get_accessibility_tree(ByteString accessibility_tree) =|
|
||||
did_change_favicon(Gfx::ShareableBitmap favicon) =|
|
||||
did_request_all_cookies(URL url) => (Vector<Web::Cookie::Cookie> cookies)
|
||||
did_request_named_cookie(URL url, DeprecatedString name) => (Optional<Web::Cookie::Cookie> cookie)
|
||||
did_request_cookie(URL url, u8 source) => (DeprecatedString cookie)
|
||||
did_request_named_cookie(URL url, ByteString name) => (Optional<Web::Cookie::Cookie> cookie)
|
||||
did_request_cookie(URL url, u8 source) => (ByteString cookie)
|
||||
did_set_cookie(URL url, Web::Cookie::ParsedCookie cookie, u8 source) =|
|
||||
did_update_cookie(Web::Cookie::Cookie cookie) =|
|
||||
did_update_resource_count(i32 count_waiting) =|
|
||||
|
@ -61,7 +61,7 @@ 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(DeprecatedString path, i32 request_id) =|
|
||||
did_request_file(ByteString path, i32 request_id) =|
|
||||
did_request_color_picker(Color current_color) =|
|
||||
did_request_select_dropdown(Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> items) =|
|
||||
did_finish_handling_input_event(bool event_was_accepted) =|
|
||||
|
@ -69,7 +69,7 @@ endpoint WebContentClient
|
|||
did_insert_clipboard_entry(String data, String presentation_style, String mime_type) =|
|
||||
|
||||
did_output_js_console_message(i32 message_index) =|
|
||||
did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> message_types, Vector<DeprecatedString> messages) =|
|
||||
did_get_js_console_messages(i32 start_index, Vector<ByteString> message_types, Vector<ByteString> messages) =|
|
||||
|
||||
did_finish_text_test() =|
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, JS::Realm
|
|||
m_console_global_environment_extensions = realm.heap().allocate<ConsoleGlobalEnvironmentExtensions>(realm, realm, window);
|
||||
}
|
||||
|
||||
void WebContentConsoleClient::handle_input(DeprecatedString const& js_source)
|
||||
void WebContentConsoleClient::handle_input(ByteString const& js_source)
|
||||
{
|
||||
if (!m_console_global_environment_extensions)
|
||||
return;
|
||||
|
@ -46,16 +46,16 @@ void WebContentConsoleClient::handle_input(DeprecatedString const& js_source)
|
|||
|
||||
if (result.value().has_value()) {
|
||||
m_console_global_environment_extensions->set_most_recent_result(result.value().value());
|
||||
print_html(JS::MarkupGenerator::html_from_value(*result.value()).release_value_but_fixme_should_propagate_errors().to_deprecated_string());
|
||||
print_html(JS::MarkupGenerator::html_from_value(*result.value()).release_value_but_fixme_should_propagate_errors().to_byte_string());
|
||||
}
|
||||
}
|
||||
|
||||
void WebContentConsoleClient::report_exception(JS::Error const& exception, bool in_promise)
|
||||
{
|
||||
print_html(JS::MarkupGenerator::html_from_error(exception, in_promise).release_value_but_fixme_should_propagate_errors().to_deprecated_string());
|
||||
print_html(JS::MarkupGenerator::html_from_error(exception, in_promise).release_value_but_fixme_should_propagate_errors().to_byte_string());
|
||||
}
|
||||
|
||||
void WebContentConsoleClient::print_html(DeprecatedString const& line)
|
||||
void WebContentConsoleClient::print_html(ByteString 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);
|
||||
|
@ -67,7 +67,7 @@ void WebContentConsoleClient::clear_output()
|
|||
m_client.async_did_output_js_console_message(m_message_log.size() - 1);
|
||||
}
|
||||
|
||||
void WebContentConsoleClient::begin_group(DeprecatedString const& label, bool start_expanded)
|
||||
void WebContentConsoleClient::begin_group(ByteString 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);
|
||||
|
@ -93,8 +93,8 @@ void WebContentConsoleClient::send_messages(i32 start_index)
|
|||
}
|
||||
|
||||
// FIXME: Replace with a single Vector of message structs
|
||||
Vector<DeprecatedString> message_types;
|
||||
Vector<DeprecatedString> messages;
|
||||
Vector<ByteString> message_types;
|
||||
Vector<ByteString> messages;
|
||||
message_types.ensure_capacity(messages_to_send);
|
||||
messages.ensure_capacity(messages_to_send);
|
||||
|
||||
|
@ -152,7 +152,7 @@ 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(DeprecatedString::formatted("<span style='{}'>{}</span>", styling, escape_html_entities(group.label)), log_level == JS::Console::LogLevel::Group);
|
||||
begin_group(ByteString::formatted("<span style='{}'>{}</span>", styling, escape_html_entities(group.label)), log_level == JS::Console::LogLevel::Group);
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class WebContentConsoleClient final : public JS::ConsoleClient
|
|||
public:
|
||||
WebContentConsoleClient(JS::Console&, JS::Realm&, ConnectionFromClient&);
|
||||
|
||||
void handle_input(DeprecatedString const& js_source);
|
||||
void handle_input(ByteString const& js_source);
|
||||
void send_messages(i32 start_index);
|
||||
void report_exception(JS::Error const&, bool) override;
|
||||
|
||||
|
@ -39,8 +39,8 @@ private:
|
|||
JS::Handle<ConsoleGlobalEnvironmentExtensions> m_console_global_environment_extensions;
|
||||
|
||||
void clear_output();
|
||||
void print_html(DeprecatedString const& line);
|
||||
void begin_group(DeprecatedString const& label, bool start_expanded);
|
||||
void print_html(ByteString const& line);
|
||||
void begin_group(ByteString const& label, bool start_expanded);
|
||||
virtual void end_group() override;
|
||||
|
||||
struct ConsoleOutput {
|
||||
|
@ -52,7 +52,7 @@ private:
|
|||
EndGroup,
|
||||
};
|
||||
Type type;
|
||||
DeprecatedString data;
|
||||
ByteString data;
|
||||
};
|
||||
Vector<ConsoleOutput> m_message_log;
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ endpoint WebContentServer
|
|||
get_window_handle() => (String handle)
|
||||
set_window_handle(String handle) =|
|
||||
|
||||
connect_to_webdriver(DeprecatedString webdriver_ipc_path) =|
|
||||
connect_to_webdriver(ByteString webdriver_ipc_path) =|
|
||||
|
||||
update_system_theme(Core::AnonymousBuffer theme_buffer) =|
|
||||
update_system_fonts(DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query) =|
|
||||
update_system_fonts(ByteString default_font_query, ByteString fixed_width_font_query, ByteString window_title_font_query) =|
|
||||
update_screen_rects(Vector<Web::DevicePixelRect> rects, u32 main_screen_index) =|
|
||||
|
||||
load_url(URL url) =|
|
||||
load_html(DeprecatedString html) =|
|
||||
load_html(ByteString html) =|
|
||||
|
||||
add_backing_store(i32 backing_store_id, Gfx::ShareableBitmap bitmap) =|
|
||||
remove_backing_store(i32 backing_store_id) =|
|
||||
|
@ -37,13 +37,13 @@ endpoint WebContentServer
|
|||
key_down(i32 key, unsigned modifiers, u32 code_point) =|
|
||||
key_up(i32 key, unsigned modifiers, u32 code_point) =|
|
||||
|
||||
debug_request(DeprecatedString request, DeprecatedString argument) =|
|
||||
debug_request(ByteString request, ByteString argument) =|
|
||||
get_source() =|
|
||||
inspect_dom_tree() =|
|
||||
inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) => (bool has_style, DeprecatedString computed_style, DeprecatedString resolved_style, DeprecatedString custom_properties, DeprecatedString node_box_sizing, DeprecatedString aria_properties_state)
|
||||
inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element) => (bool has_style, ByteString computed_style, ByteString resolved_style, ByteString custom_properties, ByteString node_box_sizing, ByteString aria_properties_state)
|
||||
inspect_accessibility_tree() =|
|
||||
get_hovered_node_id() => (i32 node_id)
|
||||
js_console_input(DeprecatedString js_source) =|
|
||||
js_console_input(ByteString js_source) =|
|
||||
js_console_request_messages(i32 start_index) =|
|
||||
|
||||
set_dom_node_text(i32 node_id, String text) =|
|
||||
|
@ -61,19 +61,19 @@ endpoint WebContentServer
|
|||
|
||||
dump_gc_graph() => (String json)
|
||||
|
||||
run_javascript(DeprecatedString js_source) =|
|
||||
run_javascript(ByteString js_source) =|
|
||||
|
||||
dump_layout_tree() => (DeprecatedString dump)
|
||||
dump_paint_tree() => (DeprecatedString dump)
|
||||
dump_text() => (DeprecatedString dump)
|
||||
dump_layout_tree() => (ByteString dump)
|
||||
dump_paint_tree() => (ByteString dump)
|
||||
dump_text() => (ByteString dump)
|
||||
|
||||
get_selected_text() => (DeprecatedString selection)
|
||||
get_selected_text() => (ByteString selection)
|
||||
select_all() =|
|
||||
|
||||
set_content_filters(Vector<String> filters) =|
|
||||
set_autoplay_allowed_on_all_websites() =|
|
||||
set_autoplay_allowlist(Vector<String> allowlist) =|
|
||||
set_proxy_mappings(Vector<DeprecatedString> proxies, HashMap<DeprecatedString,size_t> mappings) =|
|
||||
set_proxy_mappings(Vector<ByteString> proxies, HashMap<ByteString,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) =|
|
||||
|
|
|
@ -51,10 +51,10 @@ namespace WebContent {
|
|||
static JsonValue serialize_cookie(Web::Cookie::Cookie const& cookie)
|
||||
{
|
||||
JsonObject serialized_cookie;
|
||||
serialized_cookie.set("name"sv, cookie.name.to_deprecated_string());
|
||||
serialized_cookie.set("value"sv, cookie.value.to_deprecated_string());
|
||||
serialized_cookie.set("path"sv, cookie.path.to_deprecated_string());
|
||||
serialized_cookie.set("domain"sv, cookie.domain.to_deprecated_string());
|
||||
serialized_cookie.set("name"sv, cookie.name.to_byte_string());
|
||||
serialized_cookie.set("value"sv, cookie.value.to_byte_string());
|
||||
serialized_cookie.set("path"sv, cookie.path.to_byte_string());
|
||||
serialized_cookie.set("domain"sv, cookie.domain.to_byte_string());
|
||||
serialized_cookie.set("secure"sv, cookie.secure);
|
||||
serialized_cookie.set("httpOnly"sv, cookie.http_only);
|
||||
serialized_cookie.set("expiry"sv, cookie.expiry_time.seconds_since_epoch());
|
||||
|
@ -116,21 +116,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 DeprecatedString get_or_create_a_web_element_reference(Web::DOM::Node const& element)
|
||||
static ByteString 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 DeprecatedString::number(element.unique_id());
|
||||
return ByteString::number(element.unique_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 DeprecatedString const web_element_identifier = "element-6066-11e4-a52e-4f735466cecf"sv;
|
||||
static ByteString const web_element_identifier = "element-6066-11e4-a52e-4f735466cecf"sv;
|
||||
|
||||
// 1. Let identifier be the web element identifier.
|
||||
auto identifier = web_element_identifier;
|
||||
|
@ -157,27 +157,27 @@ static ErrorOr<Web::DOM::Element*, Web::WebDriver::Error> get_known_connected_el
|
|||
auto* node = Web::DOM::Node::from_unique_id(*element);
|
||||
|
||||
if (!node || !node->is_element())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, DeprecatedString::formatted("Could not find element with ID: {}", element_id));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, ByteString::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 DeprecatedString get_or_create_a_shadow_root_reference(Web::DOM::ShadowRoot const& shadow_root)
|
||||
static ByteString 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 DeprecatedString::number(shadow_root.unique_id());
|
||||
return ByteString::number(shadow_root.unique_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 DeprecatedString const shadow_root_identifier = "shadow-6066-11e4-a52e-4f735466cecf"sv;
|
||||
static ByteString const shadow_root_identifier = "shadow-6066-11e4-a52e-4f735466cecf"sv;
|
||||
|
||||
// 1. Let identifier be the shadow root identifier.
|
||||
auto identifier = shadow_root_identifier;
|
||||
|
@ -204,7 +204,7 @@ static ErrorOr<Web::DOM::ShadowRoot*, Web::WebDriver::Error> get_known_shadow_ro
|
|||
auto* node = Web::DOM::Node::from_unique_id(*shadow_root);
|
||||
|
||||
if (!node || !node->is_shadow_root())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, DeprecatedString::formatted("Could not find shadow root with ID: {}", shadow_id));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, ByteString::formatted("Could not find shadow root with ID: {}", shadow_id));
|
||||
|
||||
return static_cast<Web::DOM::ShadowRoot*>(node);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ static ErrorOr<void> scroll_element_into_view(Web::DOM::Element& element)
|
|||
return {};
|
||||
}
|
||||
|
||||
template<typename PropertyType = DeprecatedString>
|
||||
template<typename PropertyType = ByteString>
|
||||
static ErrorOr<PropertyType, Web::WebDriver::Error> get_property(JsonValue const& payload, StringView key)
|
||||
{
|
||||
if (!payload.is_object())
|
||||
|
@ -236,27 +236,27 @@ static ErrorOr<PropertyType, Web::WebDriver::Error> get_property(JsonValue const
|
|||
auto property = payload.as_object().get(key);
|
||||
|
||||
if (!property.has_value())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("No property called '{}' present", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::formatted("No property called '{}' present", key));
|
||||
|
||||
if constexpr (IsSame<PropertyType, DeprecatedString>) {
|
||||
if constexpr (IsSame<PropertyType, ByteString>) {
|
||||
if (!property->is_string())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a String", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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, DeprecatedString::formatted("Property '{}' is not a Boolean", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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, DeprecatedString::formatted("Property '{}' is not a Number", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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, DeprecatedString::formatted("Property '{}' is not an Array", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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, DeprecatedString::formatted("Property '{}' is not an Object", key));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::formatted("Property '{}' is not an Object", key));
|
||||
return &property->as_object();
|
||||
} else {
|
||||
static_assert(DependentFalse<PropertyType>, "get_property invoked with unknown property type");
|
||||
|
@ -321,7 +321,7 @@ static bool fire_an_event(FlyString name, Optional<Web::DOM::Element&> target)
|
|||
return target->dispatch_event(event);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebDriverConnection>> WebDriverConnection::connect(Web::PageClient& page_client, DeprecatedString const& webdriver_ipc_path)
|
||||
ErrorOr<NonnullRefPtr<WebDriverConnection>> WebDriverConnection::connect(Web::PageClient& page_client, ByteString const& webdriver_ipc_path)
|
||||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "Trying to connect to {}", webdriver_ipc_path);
|
||||
auto socket = TRY(Core::LocalSocket::connect(webdriver_ipc_path));
|
||||
|
@ -403,7 +403,7 @@ Messages::WebDriverClient::NavigateToResponse WebDriverConnection::navigate_to(J
|
|||
// 2. Let url be the result of getting the property url from the parameters argument.
|
||||
if (!payload.is_object() || !payload.as_object().has_string("url"sv))
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "Payload doesn't have a string `url`"sv);
|
||||
URL url(payload.as_object().get_deprecated_string("url"sv).value());
|
||||
URL url(payload.as_object().get_byte_string("url"sv).value());
|
||||
|
||||
// FIXME: 3. If url is not an absolute URL or is not an absolute URL with fragment or not a local scheme, return error with error code invalid argument.
|
||||
|
||||
|
@ -445,7 +445,7 @@ Messages::WebDriverClient::GetCurrentUrlResponse WebDriverConnection::get_curren
|
|||
TRY(handle_any_user_prompts());
|
||||
|
||||
// 3. Let url be the serialization of the current top-level browsing context’s active document’s document URL.
|
||||
auto url = m_page_client.page().top_level_browsing_context().active_document()->url().to_deprecated_string();
|
||||
auto url = m_page_client.page().top_level_browsing_context().active_document()->url().to_byte_string();
|
||||
|
||||
// 4. Return success with data url.
|
||||
return url;
|
||||
|
@ -523,7 +523,7 @@ Messages::WebDriverClient::GetTitleResponse WebDriverConnection::get_title()
|
|||
auto title = m_page_client.page().top_level_browsing_context().active_document()->title();
|
||||
|
||||
// 4. Return success with data title.
|
||||
return title.to_deprecated_string();
|
||||
return title.to_byte_string();
|
||||
}
|
||||
|
||||
// 11.1 Get Window Handle, https://w3c.github.io/webdriver/#get-window-handle
|
||||
|
@ -621,14 +621,14 @@ Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window
|
|||
if (property.is_null())
|
||||
return Optional<i32> {};
|
||||
if (!property.is_number())
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, DeprecatedString::formatted("Property '{}' is not a Number", name));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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, DeprecatedString::formatted("Property '{}' value {} exceeds the minimum allowed value {}", name, number, min));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::formatted("Property '{}' value {} exceeds the minimum allowed value {}", name, number, min));
|
||||
if (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 Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::formatted("Property '{}' value {} exceeds the maximum allowed value {}", name, number, max));
|
||||
|
||||
return static_cast<i32>(number);
|
||||
};
|
||||
|
@ -766,7 +766,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, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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.
|
||||
|
@ -808,7 +808,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, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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.
|
||||
|
@ -844,7 +844,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, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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.
|
||||
|
@ -880,7 +880,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, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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.
|
||||
|
@ -910,7 +910,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, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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.
|
||||
|
@ -946,7 +946,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, DeprecatedString::formatted("Location strategy '{}' is invalid", location_strategy_string));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, ByteString::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.
|
||||
|
@ -982,7 +982,7 @@ 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 DeprecatedString::number(active_element->unique_id());
|
||||
return ByteString::number(active_element->unique_id());
|
||||
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, "The current document does not have an active element"sv);
|
||||
}
|
||||
|
@ -1004,7 +1004,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, DeprecatedString::formatted("Element with ID '{}' does not have a shadow root", element_id));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchShadowRoot, ByteString::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);
|
||||
|
@ -1062,7 +1062,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<DeprecatedString> result;
|
||||
Optional<ByteString> result;
|
||||
|
||||
// -> If name is a boolean attribute
|
||||
if (Web::HTML::is_boolean_attribute(name)) {
|
||||
|
@ -1094,15 +1094,15 @@ 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<DeprecatedString> result;
|
||||
Optional<ByteString> result;
|
||||
|
||||
// 4. Let property be the result of calling the Object.[[GetProperty]](name) on element.
|
||||
if (auto property_or_error = element->get(name.to_deprecated_string()); !property_or_error.is_throw_completion()) {
|
||||
if (auto property_or_error = element->get(name.to_byte_string()); !property_or_error.is_throw_completion()) {
|
||||
auto property = property_or_error.release_value();
|
||||
|
||||
// 5. Let result be the value of property if not undefined, or null.
|
||||
if (!property.is_undefined()) {
|
||||
if (auto string_or_error = property.to_deprecated_string(element->vm()); !string_or_error.is_error())
|
||||
if (auto string_or_error = property.to_byte_string(element->vm()); !string_or_error.is_error())
|
||||
result = string_or_error.release_value();
|
||||
}
|
||||
}
|
||||
|
@ -1126,20 +1126,20 @@ 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:
|
||||
DeprecatedString computed_value;
|
||||
ByteString 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()) {
|
||||
// computed value of parameter property name from element’s style declarations. property name is obtained from url variables.
|
||||
if (auto property = Web::CSS::property_id_from_string(name); property.has_value()) {
|
||||
if (auto* computed_values = element->computed_css_values())
|
||||
computed_value = computed_values->property(property.value())->to_string().to_deprecated_string();
|
||||
computed_value = computed_values->property(property.value())->to_string().to_byte_string();
|
||||
}
|
||||
}
|
||||
// -> Otherwise
|
||||
else {
|
||||
// "" (empty string)
|
||||
computed_value = DeprecatedString::empty();
|
||||
computed_value = ByteString::empty();
|
||||
}
|
||||
|
||||
// 5. Return success with data computed value.
|
||||
|
@ -1162,7 +1162,7 @@ Messages::WebDriverClient::GetElementTextResponse WebDriverConnection::get_eleme
|
|||
auto rendered_text = element->text_content();
|
||||
|
||||
// 5. Return success with data rendered text.
|
||||
return rendered_text.value_or(String {}).to_deprecated_string();
|
||||
return rendered_text.value_or(String {}).to_byte_string();
|
||||
}
|
||||
|
||||
// 12.4.6 Get Element Tag Name, https://w3c.github.io/webdriver/#dfn-get-element-tag-name
|
||||
|
@ -1278,7 +1278,7 @@ Messages::WebDriverClient::GetComputedLabelResponse WebDriverConnection::get_com
|
|||
auto label = element->accessible_name(element->document()).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 5. Return success with data label.
|
||||
return label.to_deprecated_string();
|
||||
return label.to_byte_string();
|
||||
}
|
||||
|
||||
// 12.5.1 Element Click, https://w3c.github.io/webdriver/#element-click
|
||||
|
@ -1418,15 +1418,15 @@ Messages::WebDriverClient::GetSourceResponse WebDriverConnection::get_source()
|
|||
TRY(handle_any_user_prompts());
|
||||
|
||||
auto* document = m_page_client.page().top_level_browsing_context().active_document();
|
||||
Optional<DeprecatedString> source;
|
||||
Optional<ByteString> 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())
|
||||
source = result.release_value().to_deprecated_string();
|
||||
source = result.release_value().to_byte_string();
|
||||
|
||||
// 4. Let source be the result of serializing to string the current browsing context active document, if source is null.
|
||||
if (!source.has_value())
|
||||
source = MUST(document->serialize_fragment(Web::DOMParsing::RequireWellFormed::No)).to_deprecated_string();
|
||||
source = MUST(document->serialize_fragment(Web::DOMParsing::RequireWellFormed::No)).to_byte_string();
|
||||
|
||||
// 5. Return success with data source.
|
||||
return source.release_value();
|
||||
|
@ -1539,13 +1539,13 @@ Messages::WebDriverClient::GetNamedCookieResponse WebDriverConnection::get_named
|
|||
// 3. If the url variable name is equal to a cookie’s cookie name amongst all associated cookies of the current browsing context’s active document, return success with the serialized cookie as data.
|
||||
auto* document = m_page_client.page().top_level_browsing_context().active_document();
|
||||
|
||||
if (auto cookie = m_page_client.page_did_request_named_cookie(document->url(), name.to_deprecated_string()); cookie.has_value()) {
|
||||
if (auto cookie = m_page_client.page_did_request_named_cookie(document->url(), name.to_byte_string()); cookie.has_value()) {
|
||||
auto serialized_cookie = serialize_cookie(*cookie);
|
||||
return serialized_cookie;
|
||||
}
|
||||
|
||||
// 4. Otherwise, return error with error code no such cookie.
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchCookie, DeprecatedString::formatted("Cookie '{}' not found", name));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchCookie, ByteString::formatted("Cookie '{}' not found", name));
|
||||
}
|
||||
|
||||
// 14.3 Add Cookie, https://w3c.github.io/webdriver/#dfn-adding-a-cookie
|
||||
|
@ -1570,13 +1570,13 @@ Messages::WebDriverClient::AddCookieResponse WebDriverConnection::add_cookie(Jso
|
|||
|
||||
// 7. Create a cookie in the cookie store associated with the active document’s address using cookie name name, cookie value value, and an attribute-value list of the following cookie concepts listed in the table for cookie conversion from data:
|
||||
Web::Cookie::ParsedCookie cookie {};
|
||||
cookie.name = MUST(String::from_deprecated_string(TRY(get_property(data, "name"sv))));
|
||||
cookie.value = MUST(String::from_deprecated_string(TRY(get_property(data, "value"sv))));
|
||||
cookie.name = MUST(String::from_byte_string(TRY(get_property(data, "name"sv))));
|
||||
cookie.value = MUST(String::from_byte_string(TRY(get_property(data, "value"sv))));
|
||||
|
||||
// Cookie path
|
||||
// The value if the entry exists, otherwise "/".
|
||||
if (data.has("path"sv))
|
||||
cookie.path = MUST(String::from_deprecated_string(TRY(get_property(data, "path"sv))));
|
||||
cookie.path = MUST(String::from_byte_string(TRY(get_property(data, "path"sv))));
|
||||
else
|
||||
cookie.path = "/"_string;
|
||||
|
||||
|
@ -1584,7 +1584,7 @@ Messages::WebDriverClient::AddCookieResponse WebDriverConnection::add_cookie(Jso
|
|||
// The value if the entry exists, otherwise the current browsing context’s active document’s URL domain.
|
||||
// NOTE: The otherwise case is handled by the CookieJar
|
||||
if (data.has("domain"sv))
|
||||
cookie.domain = MUST(String::from_deprecated_string(TRY(get_property(data, "domain"sv))));
|
||||
cookie.domain = MUST(String::from_byte_string(TRY(get_property(data, "domain"sv))));
|
||||
|
||||
// Cookie secure only
|
||||
// The value if the entry exists, otherwise false.
|
||||
|
@ -1722,7 +1722,7 @@ Messages::WebDriverClient::GetAlertTextResponse WebDriverConnection::get_alert_t
|
|||
|
||||
// 4. Return success with data message.
|
||||
if (message.has_value())
|
||||
return message->to_deprecated_string();
|
||||
return message->to_byte_string();
|
||||
return JsonValue {};
|
||||
}
|
||||
|
||||
|
@ -1761,7 +1761,7 @@ Messages::WebDriverClient::SendAlertTextResponse WebDriverConnection::send_alert
|
|||
}
|
||||
|
||||
// 6. Perform user agent dependent steps to set the value of current user prompt’s text field to text.
|
||||
m_page_client.page_did_request_set_prompt_text(TRY(String::from_deprecated_string(text)));
|
||||
m_page_client.page_did_request_set_prompt_text(TRY(String::from_byte_string(text)));
|
||||
|
||||
// 7. Return success with data null.
|
||||
return JsonValue {};
|
||||
|
@ -1997,7 +1997,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, DeprecatedString::formatted("The location strategy could not finish: {}", elements.error().message));
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSelector, ByteString::formatted("The location strategy could not finish: {}", elements.error().message));
|
||||
|
||||
return elements.release_value();
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
|
@ -31,7 +31,7 @@ class WebDriverConnection final
|
|||
C_OBJECT_ABSTRACT(WebDriverConnection)
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<WebDriverConnection>> connect(Web::PageClient& page_client, DeprecatedString const& webdriver_ipc_path);
|
||||
static ErrorOr<NonnullRefPtr<WebDriverConnection>> connect(Web::PageClient& page_client, ByteString const& webdriver_ipc_path);
|
||||
virtual ~WebDriverConnection() = default;
|
||||
|
||||
private:
|
||||
|
@ -111,7 +111,7 @@ private:
|
|||
ErrorOr<JsonArray, Web::WebDriver::Error> find(StartNodeGetter&& start_node_getter, Web::WebDriver::LocationStrategy using_, StringView value);
|
||||
|
||||
struct ScriptArguments {
|
||||
DeprecatedString script;
|
||||
ByteString script;
|
||||
JS::MarkedVector<JS::Value> arguments;
|
||||
};
|
||||
ErrorOr<ScriptArguments, Web::WebDriver::Error> extract_the_script_arguments_from_a_request(JsonValue const& payload);
|
||||
|
|
|
@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
TRY(Core::System::pledge("stdio recvfd sendfd accept unix rpath thread proc"));
|
||||
|
||||
// This must be first; we can't check if /tmp/webdriver exists once we've unveiled other paths.
|
||||
auto webdriver_socket_path = DeprecatedString::formatted("{}/webdriver", TRY(Core::StandardPaths::runtime_directory()));
|
||||
auto webdriver_socket_path = ByteString::formatted("{}/webdriver", TRY(Core::StandardPaths::runtime_directory()));
|
||||
if (FileSystem::exists(webdriver_socket_path))
|
||||
TRY(Core::System::unveil(webdriver_socket_path, "rw"sv));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue