1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:27:45 +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:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -174,7 +174,7 @@ JS::ThrowCompletionOr<bool> LegacyPlatformObject::internal_set(JS::PropertyKey c
// 2. If O implements an interface with a named property setter and Type(P) is String, then:
if (has_named_property_setter() && property_name.is_string()) {
// 1. Invoke the named property setter on O with P and V.
TRY(throw_dom_exception_if_needed(vm, [&] { return invoke_named_property_setter(MUST(String::from_deprecated_string(property_name.as_string())), value); }));
TRY(throw_dom_exception_if_needed(vm, [&] { return invoke_named_property_setter(MUST(String::from_byte_string(property_name.as_string())), value); }));
// 2. Return true.
return true;
@ -220,7 +220,7 @@ JS::ThrowCompletionOr<bool> LegacyPlatformObject::internal_define_own_property(J
// 1. Let creating be true if P is not a supported property name, and false otherwise.
// NOTE: This is in it's own variable to enforce the type.
Vector<String> supported_property_names = this->supported_property_names();
bool creating = !supported_property_names.contains_slow(MUST(String::from_deprecated_string(property_name_as_string)));
bool creating = !supported_property_names.contains_slow(MUST(String::from_byte_string(property_name_as_string)));
// 2. If O implements an interface with the [LegacyOverrideBuiltIns] extended attribute or O does not have an own property named P, then:
// NOTE: Own property lookup has to be done manually instead of using Object::has_own_property, as that would use the overridden internal_get_own_property.
@ -236,7 +236,7 @@ JS::ThrowCompletionOr<bool> LegacyPlatformObject::internal_define_own_property(J
return false;
// 2. Invoke the named property setter on O with P and Desc.[[Value]].
TRY(throw_dom_exception_if_needed(vm, [&] { return invoke_named_property_setter(MUST(String::from_deprecated_string(property_name_as_string)), property_descriptor.value.value()); }));
TRY(throw_dom_exception_if_needed(vm, [&] { return invoke_named_property_setter(MUST(String::from_byte_string(property_name_as_string)), property_descriptor.value.value()); }));
// 3. Return true.
return true;
@ -291,7 +291,7 @@ JS::ThrowCompletionOr<bool> LegacyPlatformObject::internal_delete(JS::PropertyKe
// 4. Otherwise, operation was defined with an identifier:
// 1. Perform method steps of operation with O as this and « P » as the argument values.
// 2. If operation was declared with a return type of boolean and the steps returned false, then return false.
auto did_deletion_fail = TRY(throw_dom_exception_if_needed(vm, [&] { return delete_value(MUST(String::from_deprecated_string(property_name_string))); }));
auto did_deletion_fail = TRY(throw_dom_exception_if_needed(vm, [&] { return delete_value(MUST(String::from_byte_string(property_name_string))); }));
if (!named_property_deleter_has_identifier())
VERIFY(did_deletion_fail != DidDeletionFail::NotRelevant);
@ -348,7 +348,7 @@ JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> LegacyPlatformObject::interna
// 3. If O supports named properties, then for each P of Os supported property names that is visible according to the named property visibility algorithm, append P to keys.
if (supports_named_properties()) {
for (auto& named_property : supported_property_names()) {
if (TRY(WebIDL::is_named_property_exposed_on_object({ this }, named_property.to_deprecated_string())))
if (TRY(WebIDL::is_named_property_exposed_on_object({ this }, named_property.to_byte_string())))
keys.append(JS::PrimitiveString::create(vm, named_property));
}
}

View file

@ -377,7 +377,7 @@ ErrorOr<void> initialize_main_thread_vm()
// 2. Let url be the result of resolving a module specifier given moduleScript and specifier.
auto url = TRY(Bindings::throw_dom_exception_if_needed(vm, [&] {
return HTML::resolve_module_specifier(*module_script, specifier_string.to_deprecated_string());
return HTML::resolve_module_specifier(*module_script, specifier_string.to_byte_string());
}));
// 3. Return the serialization of url.
@ -399,7 +399,7 @@ ErrorOr<void> initialize_main_thread_vm()
// FIXME: Implement 8.1.5.5.3 HostResolveImportedModule(referencingScriptOrModule, moduleRequest), https://html.spec.whatwg.org/multipage/webappapis.html#hostresolveimportedmodule(referencingscriptormodule,-modulerequest)
// 8.1.6.5.2 HostGetSupportedImportAttributes(), https://html.spec.whatwg.org/multipage/webappapis.html#hostgetsupportedimportassertions
s_main_thread_vm->host_get_supported_import_attributes = []() -> Vector<DeprecatedString> {
s_main_thread_vm->host_get_supported_import_attributes = []() -> Vector<ByteString> {
// 1. Return « "type" ».
return { "type"sv };
};
@ -487,7 +487,7 @@ ErrorOr<void> initialize_main_thread_vm()
auto completion = [&]() -> JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Module>> {
// 2. If moduleScript is null, then set completion to Completion Record { [[Type]]: throw, [[Value]]: a new TypeError, [[Target]]: empty }.
if (!module_script) {
return JS::throw_completion(JS::TypeError::create(realm, DeprecatedString::formatted("Loading imported module '{}' failed.", module_request.module_specifier)));
return JS::throw_completion(JS::TypeError::create(realm, ByteString::formatted("Loading imported module '{}' failed.", module_request.module_specifier)));
}
// 3. Otherwise, if moduleScript's parse error is not null, then:
else if (!module_script->parse_error().is_null()) {

View file

@ -12,13 +12,13 @@
namespace Web::Bindings {
#define WEB_PLATFORM_OBJECT(class_, base_class) \
JS_OBJECT(class_, base_class) \
virtual bool implements_interface(DeprecatedString const& interface) const override \
{ \
if (interface == #class_) \
return true; \
return Base::implements_interface(interface); \
#define WEB_PLATFORM_OBJECT(class_, base_class) \
JS_OBJECT(class_, base_class) \
virtual bool implements_interface(ByteString const& interface) const override \
{ \
if (interface == #class_) \
return true; \
return Base::implements_interface(interface); \
}
// https://webidl.spec.whatwg.org/#dfn-platform-object
@ -37,7 +37,7 @@ public:
// https://webidl.spec.whatwg.org/#implements
// This is implemented by overrides that get generated by the WEB_PLATFORM_OBJECT macro.
[[nodiscard]] virtual bool implements_interface(DeprecatedString const&) const { return false; }
[[nodiscard]] virtual bool implements_interface(ByteString const&) const { return false; }
protected:
explicit PlatformObject(JS::Realm&, MayInterfereWithIndexedPropertyAccess = MayInterfereWithIndexedPropertyAccess::No);

View file

@ -291,7 +291,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
// 3. If referrer is a URL record, then set document's referrer to the serialization of referrer.
if (referrer.has<AK::URL>()) {
document->m_referrer = MUST(String::from_deprecated_string(referrer.get<AK::URL>().serialize()));
document->m_referrer = MUST(String::from_byte_string(referrer.get<AK::URL>().serialize()));
}
}
@ -804,7 +804,7 @@ WebIDL::ExceptionOr<void> Document::set_title(String const& title)
}
if (browsing_context() == &page().top_level_browsing_context())
page().client().page_did_change_title(title.to_deprecated_string());
page().client().page_did_change_title(title.to_byte_string());
return {};
}
@ -1206,7 +1206,7 @@ void Document::set_hovered_node(Node* node)
JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_name(String const& name)
{
auto deprecated_name = name.to_deprecated_string();
auto deprecated_name = name.to_byte_string();
return HTMLCollection::create(*this, HTMLCollection::Scope::Descendants, [deprecated_name](Element const& element) {
return element.name() == deprecated_name;
});
@ -1349,7 +1349,7 @@ HTML::EnvironmentSettingsObject& Document::relevant_settings_object() const
// https://dom.spec.whatwg.org/#dom-document-createelement
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element(String const& a_local_name, Variant<String, ElementCreationOptions> const& options)
{
auto local_name = a_local_name.to_deprecated_string();
auto local_name = a_local_name.to_byte_string();
// 1. If localName does not match the Name production, then throw an "InvalidCharacterError" DOMException.
if (!is_valid_name(a_local_name))
@ -1427,7 +1427,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ProcessingInstruction>> Document::create_pr
// FIXME: 2. If data contains the string "?>", then throw an "InvalidCharacterError" DOMException.
// 3. Return a new ProcessingInstruction node, with target set to target, data set to data, and node document set to this.
return heap().allocate<ProcessingInstruction>(realm(), *this, data.to_deprecated_string(), target.to_deprecated_string());
return heap().allocate<ProcessingInstruction>(realm(), *this, data.to_byte_string(), target.to_byte_string());
}
JS::NonnullGCPtr<Range> Document::create_range()
@ -1974,7 +1974,7 @@ void Document::completely_finish_loading()
String Document::cookie(Cookie::Source source)
{
return MUST(String::from_deprecated_string(page().client().page_did_request_cookie(m_url, source)));
return MUST(String::from_byte_string(page().client().page_did_request_cookie(m_url, source)));
}
void Document::set_cookie(StringView cookie_string, Cookie::Source source)
@ -3021,7 +3021,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Attr>> Document::create_attribute(String co
// 2. If this is an HTML document, then set localName to localName in ASCII lowercase.
// 3. Return a new attribute whose local name is localName and node document is this.
auto deprecated_local_name = local_name.to_deprecated_string();
auto deprecated_local_name = local_name.to_byte_string();
return Attr::create(*this, MUST(FlyString::from_deprecated_fly_string(is_html_document() ? deprecated_local_name.to_lowercase() : deprecated_local_name)));
}

View file

@ -88,7 +88,7 @@ static bool build_text_document(DOM::Document& document, ByteBuffer const& data)
auto title_element = DOM::create_element(document, HTML::TagNames::title, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
MUST(head_element->append_child(title_element));
auto title_text = document.create_text_node(MUST(String::from_deprecated_string(document.url().basename())));
auto title_text = document.create_text_node(MUST(String::from_byte_string(document.url().basename())));
MUST(title_element->append_child(title_text));
auto body_element = DOM::create_element(document, HTML::TagNames::body, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
@ -137,7 +137,7 @@ static bool build_gemini_document(DOM::Document& document, ByteBuffer const& dat
{
StringView gemini_data { data };
auto gemini_document = Gemini::Document::parse(gemini_data, document.url());
DeprecatedString html_data = gemini_document->render_to_html();
ByteString html_data = gemini_document->render_to_html();
dbgln_if(GEMINI_DEBUG, "Gemini data:\n\"\"\"{}\"\"\"", gemini_data);
dbgln_if(GEMINI_DEBUG, "Converted to HTML:\n\"\"\"{}\"\"\"", html_data);

View file

@ -120,27 +120,27 @@ Optional<String> Element::get_attribute(StringView name) const
return attribute->value();
}
DeprecatedString Element::deprecated_get_attribute(StringView name) const
ByteString Element::deprecated_get_attribute(StringView name) const
{
auto maybe_attribute = get_attribute(name);
if (!maybe_attribute.has_value())
return DeprecatedString::empty();
return ByteString::empty();
return maybe_attribute->to_deprecated_string();
return maybe_attribute->to_byte_string();
}
// https://dom.spec.whatwg.org/#concept-element-attributes-get-value
DeprecatedString Element::get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_) const
ByteString Element::get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_) const
{
// 1. Let attr be the result of getting an attribute given namespace, localName, and element.
auto const* attribute = m_attributes->get_attribute_ns(namespace_, local_name);
// 2. If attr is null, then return the empty string.
if (!attribute)
return DeprecatedString::empty();
return ByteString::empty();
// 3. Return attrs value.
return attribute->value().to_deprecated_string();
return attribute->value().to_byte_string();
}
// https://dom.spec.whatwg.org/#dom-element-getattributenode
@ -247,7 +247,7 @@ void Element::append_attribute(Attr& attribute)
}
// https://dom.spec.whatwg.org/#concept-element-attributes-set-value
void Element::set_attribute_value(FlyString const& local_name, DeprecatedString const& value, Optional<FlyString> const& prefix, Optional<FlyString> const& namespace_)
void Element::set_attribute_value(FlyString const& local_name, ByteString const& value, Optional<FlyString> const& prefix, Optional<FlyString> const& namespace_)
{
// 1. Let attribute be the result of getting an attribute given namespace, localName, and element.
auto* attribute = m_attributes->get_attribute_ns(namespace_, local_name);
@ -258,14 +258,14 @@ void Element::set_attribute_value(FlyString const& local_name, DeprecatedString
if (!attribute) {
QualifiedName name { local_name, prefix, namespace_ };
auto new_attribute = Attr::create(document(), move(name), MUST(String::from_deprecated_string(value)));
auto new_attribute = Attr::create(document(), move(name), MUST(String::from_byte_string(value)));
m_attributes->append_attribute(new_attribute);
return;
}
// 3. Change attribute to value.
attribute->change_attribute(MUST(String::from_deprecated_string(value)));
attribute->change_attribute(MUST(String::from_byte_string(value)));
}
// https://dom.spec.whatwg.org/#dom-element-setattributenode
@ -1457,7 +1457,7 @@ WebIDL::ExceptionOr<void> Element::insert_adjacent_html(String const& position,
}
// https://dom.spec.whatwg.org/#insert-adjacent
WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(DeprecatedString const& where, JS::NonnullGCPtr<Node> node)
WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(ByteString const& where, JS::NonnullGCPtr<Node> node)
{
// To insert adjacent, given an element element, string where, and a node node, run the steps associated with the first ASCII case-insensitive match for where:
if (Infra::is_ascii_case_insensitive_match(where, "beforebegin"sv)) {
@ -1501,7 +1501,7 @@ WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(DeprecatedString c
WebIDL::ExceptionOr<JS::GCPtr<Element>> Element::insert_adjacent_element(String const& where, JS::NonnullGCPtr<Element> element)
{
// The insertAdjacentElement(where, element) method steps are to return the result of running insert adjacent, give this, where, and element.
auto returned_node = TRY(insert_adjacent(where.to_deprecated_string(), move(element)));
auto returned_node = TRY(insert_adjacent(where.to_byte_string(), move(element)));
if (!returned_node)
return JS::GCPtr<Element> { nullptr };
return JS::GCPtr<Element> { verify_cast<Element>(*returned_node) };
@ -1515,7 +1515,7 @@ WebIDL::ExceptionOr<void> Element::insert_adjacent_text(String const& where, Str
// 2. Run insert adjacent, given this, where, and text.
// Spec Note: This method returns nothing because it existed before we had a chance to design it.
(void)TRY(insert_adjacent(where.to_deprecated_string(), text));
(void)TRY(insert_adjacent(where.to_byte_string(), text));
return {};
}
@ -2019,10 +2019,10 @@ void Element::for_each_attribute(Function<void(Attr const&)> callback) const
callback(*m_attributes->item(i));
}
void Element::for_each_attribute(Function<void(FlyString const&, DeprecatedString const&)> callback) const
void Element::for_each_attribute(Function<void(FlyString const&, ByteString const&)> callback) const
{
for_each_attribute([&callback](Attr const& attr) {
callback(attr.name(), attr.value().to_deprecated_string());
callback(attr.name(), attr.value().to_byte_string());
});
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibWeb/ARIA/ARIAMixin.h>
#include <LibWeb/Bindings/ElementPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
@ -82,7 +82,7 @@ public:
// NOTE: This is for the JS bindings
FlyString const& tag_name() const { return html_uppercased_qualified_name(); }
DeprecatedString deprecated_tag_name() const { return html_uppercased_qualified_name().to_deprecated_fly_string(); }
ByteString deprecated_tag_name() const { return html_uppercased_qualified_name().to_deprecated_fly_string(); }
Optional<FlyString> const& prefix() const { return m_qualified_name.prefix(); }
@ -97,19 +97,19 @@ public:
bool has_attributes() const;
// FIXME: This should be taking a 'FlyString const&'
DeprecatedString deprecated_attribute(StringView name) const { return deprecated_get_attribute(name); }
ByteString deprecated_attribute(StringView name) const { return deprecated_get_attribute(name); }
Optional<String> attribute(StringView name) const { return get_attribute(name); }
// FIXME: This should be taking a 'FlyString const&' / 'Optional<FlyString> const&'
Optional<String> get_attribute(StringView name) const;
DeprecatedString deprecated_get_attribute(StringView name) const;
DeprecatedString get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_ = {}) const;
ByteString deprecated_get_attribute(StringView name) const;
ByteString get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_ = {}) const;
WebIDL::ExceptionOr<void> set_attribute(FlyString const& name, String const& value);
// FIXME: This should be taking an Optional<FlyString>
WebIDL::ExceptionOr<void> set_attribute_ns(Optional<String> const& namespace_, FlyString const& qualified_name, FlyString const& value);
void set_attribute_value(FlyString const& local_name, DeprecatedString const& value, Optional<FlyString> const& prefix = {}, Optional<FlyString> const& namespace_ = {});
void set_attribute_value(FlyString const& local_name, ByteString const& value, Optional<FlyString> const& prefix = {}, Optional<FlyString> const& namespace_ = {});
WebIDL::ExceptionOr<JS::GCPtr<Attr>> set_attribute_node(Attr&);
WebIDL::ExceptionOr<JS::GCPtr<Attr>> set_attribute_node_ns(Attr&);
@ -140,7 +140,7 @@ public:
void for_each_attribute(Function<void(Attr const&)>) const;
void for_each_attribute(Function<void(FlyString const&, DeprecatedString const&)>) const;
void for_each_attribute(Function<void(FlyString const&, ByteString const&)>) const;
bool has_class(FlyString const&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
Vector<FlyString> const& class_names() const { return m_classes; }
@ -179,7 +179,7 @@ public:
Layout::NodeWithStyle* layout_node();
Layout::NodeWithStyle const* layout_node() const;
DeprecatedString name() const { return deprecated_attribute(HTML::AttributeNames::name); }
ByteString name() const { return deprecated_attribute(HTML::AttributeNames::name); }
CSS::StyleProperties* computed_css_values() { return m_computed_css_values.ptr(); }
CSS::StyleProperties const* computed_css_values() const { return m_computed_css_values.ptr(); }
@ -395,7 +395,7 @@ private:
void invalidate_style_after_attribute_change(FlyString const& attribute_name);
WebIDL::ExceptionOr<JS::GCPtr<Node>> insert_adjacent(DeprecatedString const& where, JS::NonnullGCPtr<Node> node);
WebIDL::ExceptionOr<JS::GCPtr<Node>> insert_adjacent(ByteString const& where, JS::NonnullGCPtr<Node> node);
void enqueue_an_element_on_the_appropriate_element_queue();

View file

@ -364,7 +364,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
auto& event_handler = event_handler_iterator->value;
// 3. If eventHandler's value is an internal raw uncompiled handler, then:
if (event_handler->value.has<DeprecatedString>()) {
if (event_handler->value.has<ByteString>()) {
// 1. If eventTarget is an element, then let element be eventTarget, and document be element's node document.
// Otherwise, eventTarget is a Window object, let element be null, and document be eventTarget's associated Document.
JS::GCPtr<Element> element;
@ -387,7 +387,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
return nullptr;
// 3. Let body be the uncompiled script body in eventHandler's value.
auto& body = event_handler->value.get<DeprecatedString>();
auto& body = event_handler->value.get<ByteString>();
// FIXME: 4. Let location be the location where the script body originated, as given by eventHandler's value.
@ -418,7 +418,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
builder.appendff("function {}(event) {{\n{}\n}}", name, body);
}
auto source_text = builder.to_deprecated_string();
auto source_text = builder.to_byte_string();
auto parser = JS::Parser(JS::Lexer(source_text));
@ -486,7 +486,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
// 6. Return scope. (NOTE: Not necessary)
auto function = JS::ECMAScriptFunctionObject::create(realm, name.to_deprecated_fly_string(), builder.to_deprecated_string(), program->body(), program->parameters(), program->function_length(), program->local_variables_names(), scope, nullptr, JS::FunctionKind::Normal, program->is_strict_mode(), program->might_need_arguments_object(), is_arrow_function);
auto function = JS::ECMAScriptFunctionObject::create(realm, name.to_deprecated_fly_string(), builder.to_byte_string(), program->body(), program->parameters(), program->function_length(), program->local_variables_names(), scope, nullptr, JS::FunctionKind::Normal, program->is_strict_mode(), program->might_need_arguments_object(), is_arrow_function);
// 10. Remove settings object's realm execution context from the JavaScript execution context stack.
VERIFY(vm.execution_context_stack().last() == &settings_object.realm_execution_context());
@ -747,7 +747,7 @@ void EventTarget::element_event_handler_attribute_changed(FlyString const& local
// NOTE: See the optimization comments in set_event_handler_attribute.
if (event_handler_iterator == handler_map.end()) {
auto new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(value->to_deprecated_string());
auto new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(value->to_byte_string());
// 6. Activate an event handler given eventTarget and name.
event_target->activate_event_handler(local_name, *new_event_handler);
@ -759,7 +759,7 @@ void EventTarget::element_event_handler_attribute_changed(FlyString const& local
auto& event_handler = event_handler_iterator->value;
// 6. Activate an event handler given eventTarget and name.
event_handler->value = value->to_deprecated_string();
event_handler->value = value->to_byte_string();
event_target->activate_event_handler(local_name, *event_handler);
}

View file

@ -233,7 +233,7 @@ WebIDL::ExceptionOr<JS::GCPtr<Attr>> NamedNodeMap::set_attribute(Attr& attribute
// 2. Let oldAttr be the result of getting an attribute given attrs namespace, attrs local name, and element.
size_t old_attribute_index = 0;
DeprecatedString deprecated_namespace_uri;
ByteString deprecated_namespace_uri;
if (attribute.namespace_uri().has_value())
deprecated_namespace_uri = attribute.namespace_uri().value().to_deprecated_fly_string();

View file

@ -9,7 +9,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/StringView.h>
#include <LibWeb/Bindings/LegacyPlatformObject.h>
#include <LibWeb/Forward.h>

View file

@ -819,7 +819,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
element.for_each_attribute([&](auto& name, auto& value) {
// 1. Let copyAttribute be a clone of attribute.
// 2. Append copyAttribute to copy.
MUST(element_copy->set_attribute(name, MUST(String::from_deprecated_string(value))));
MUST(element_copy->set_attribute(name, MUST(String::from_byte_string(value))));
});
copy = move(element_copy);
@ -872,7 +872,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
auto processing_instruction = verify_cast<ProcessingInstruction>(this);
// Set copys target and data to those of node.
auto processing_instruction_copy = heap().allocate<ProcessingInstruction>(realm(), *document, processing_instruction->data().to_deprecated_string(), processing_instruction->target());
auto processing_instruction_copy = heap().allocate<ProcessingInstruction>(realm(), *document, processing_instruction->data().to_byte_string(), processing_instruction->target());
copy = processing_instruction_copy;
}
// Otherwise, Do nothing.
@ -1783,8 +1783,8 @@ ErrorOr<String> Node::name_or_description(NameOrDescription target, Document con
// process its IDREFs in the order they occur:
auto aria_labelled_by = element->aria_labelled_by();
auto aria_described_by = element->aria_described_by();
if ((target == NameOrDescription::Name && aria_labelled_by.has_value() && Node::first_valid_id(aria_labelled_by->to_deprecated_string(), document).has_value())
|| (target == NameOrDescription::Description && aria_described_by.has_value() && Node::first_valid_id(aria_described_by->to_deprecated_string(), document).has_value())) {
if ((target == NameOrDescription::Name && aria_labelled_by.has_value() && Node::first_valid_id(aria_labelled_by->to_byte_string(), document).has_value())
|| (target == NameOrDescription::Description && aria_described_by.has_value() && Node::first_valid_id(aria_described_by->to_byte_string(), document).has_value())) {
// i. Set the accumulated text to the empty string.
total_accumulated_text.clear();

View file

@ -5,7 +5,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Vector.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/DocumentFragment.h>

View file

@ -13,8 +13,8 @@ namespace Web::DOM {
JS_DEFINE_ALLOCATOR(ProcessingInstruction);
ProcessingInstruction::ProcessingInstruction(Document& document, DeprecatedString const& data, DeprecatedString const& target)
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, MUST(String::from_deprecated_string(data)))
ProcessingInstruction::ProcessingInstruction(Document& document, ByteString const& data, ByteString const& target)
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, MUST(String::from_byte_string(data)))
, m_target(target)
{
}

View file

@ -19,14 +19,14 @@ public:
virtual FlyString node_name() const override { return MUST(FlyString::from_deprecated_fly_string(m_target)); }
DeprecatedString const& target() const { return m_target; }
ByteString const& target() const { return m_target; }
private:
ProcessingInstruction(Document&, DeprecatedString const& data, DeprecatedString const& target);
ProcessingInstruction(Document&, ByteString const& data, ByteString const& target);
virtual void initialize(JS::Realm&) override;
DeprecatedString m_target;
ByteString m_target;
};
template<>

View file

@ -1187,7 +1187,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::create_contextual
}
// 3. Let fragment node be the result of invoking the fragment parsing algorithm with fragment as markup, and element as the context element.
auto fragment_node = TRY(DOMParsing::parse_fragment(fragment.to_deprecated_string(), *element));
auto fragment_node = TRY(DOMParsing::parse_fragment(fragment.to_byte_string(), *element));
// 4. Unmark all scripts in fragment node as "already started" and as "parser-inserted".
fragment_node->for_each_in_subtree_of_type<HTML::HTMLScriptElement>([&](HTML::HTMLScriptElement& script_element) {

View file

@ -1424,7 +1424,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
// FIXME: Getting to the page client reliably is way too complicated, and going via the document won't work in workers.
auto document = Bindings::host_defined_environment_settings_object(realm).responsible_document();
if (!document)
return DeprecatedString::empty();
return ByteString::empty();
return document->page().client().page_did_request_cookie(http_request->current_url(), Cookie::Source::Http);
})();
@ -1604,8 +1604,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
// FIXME: 2. Let username and password be the result of prompting the end user for a username and password,
// respectively, in requests window.
dbgln("Fetch: Username/password prompt is not implemented, using empty strings. This request will probably fail.");
auto username = DeprecatedString::empty();
auto password = DeprecatedString::empty();
auto username = ByteString::empty();
auto password = ByteString::empty();
// 3. Set the username given requests current URL and username.
MUST(request->current_url().set_username(username));
@ -1729,9 +1729,9 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_load
LoadRequest load_request;
load_request.set_url(request->current_url());
load_request.set_page(page);
load_request.set_method(DeprecatedString::copy(request->method()));
load_request.set_method(ByteString::copy(request->method()));
for (auto const& header : *request->header_list())
load_request.set_header(DeprecatedString::copy(header.name), DeprecatedString::copy(header.value));
load_request.set_header(ByteString::copy(header.name), ByteString::copy(header.value));
if (auto const* body = request->body().get_pointer<JS::NonnullGCPtr<Infrastructure::Body>>()) {
TRY((*body)->source().visit(
[&](ByteBuffer const& byte_buffer) -> WebIDL::ExceptionOr<void> {

View file

@ -196,7 +196,7 @@ ErrorOr<String> Request::serialize_origin() const
return "null"_string;
// 2. Return requests origin, serialized.
return String::from_deprecated_string(m_origin.get<HTML::Origin>().serialize());
return String::from_byte_string(m_origin.get<HTML::Origin>().serialize());
}
// https://fetch.spec.whatwg.org/#byte-serializing-a-request-origin

View file

@ -514,7 +514,7 @@ WebIDL::ExceptionOr<String> Request::url() const
auto& vm = this->vm();
// The url getter steps are to return thiss requests URL, serialized.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_request->url().serialize()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_request->url().serialize()));
}
// https://fetch.spec.whatwg.org/#dom-request-headers
@ -550,7 +550,7 @@ WebIDL::ExceptionOr<String> Request::referrer() const
},
[&](AK::URL const& url) -> WebIDL::ExceptionOr<String> {
// 3. Return thiss requests referrer, serialized.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url.serialize()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(url.serialize()));
});
}

View file

@ -239,7 +239,7 @@ WebIDL::ExceptionOr<String> Response::url() const
// The url getter steps are to return the empty string if thiss responses URL is null; otherwise thiss responses URL, serialized with exclude fragment set to true.
return !m_response->url().has_value()
? String {}
: TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_response->url()->serialize(AK::URL::ExcludeFragment::Yes)));
: TRY_OR_THROW_OOM(vm, String::from_byte_string(m_response->url()->serialize(AK::URL::ExcludeFragment::Yes)));
}
// https://fetch.spec.whatwg.org/#dom-response-redirected

View file

@ -226,7 +226,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
// 15. If creator is non-null, then:
if (creator) {
// 1. Set document's referrer to the serialization of creator's URL.
document->set_referrer(MUST(String::from_deprecated_string(creator->url().serialize())));
document->set_referrer(MUST(String::from_byte_string(creator->url().serialize())));
// FIXME: 2. Set document's policy container to a clone of creator's policy container.
@ -412,7 +412,7 @@ void BrowsingContext::set_cursor_position(JS::NonnullGCPtr<DOM::Position> positi
reset_cursor_blink_cycle();
}
static DeprecatedString visible_text_in_range(DOM::Range const& range)
static ByteString visible_text_in_range(DOM::Range const& range)
{
// NOTE: This is an adaption of Range stringification, but we skip over DOM nodes that don't have a corresponding layout node.
StringBuilder builder;
@ -420,7 +420,7 @@ static DeprecatedString visible_text_in_range(DOM::Range const& range)
if (range.start_container() == range.end_container() && is<DOM::Text>(*range.start_container())) {
if (!range.start_container()->layout_node())
return ""sv;
return MUST(static_cast<DOM::Text const&>(*range.start_container()).data().substring_from_byte_offset(range.start_offset(), range.end_offset() - range.start_offset())).to_deprecated_string();
return MUST(static_cast<DOM::Text const&>(*range.start_container()).data().substring_from_byte_offset(range.start_offset(), range.end_offset() - range.start_offset())).to_byte_string();
}
if (is<DOM::Text>(*range.start_container()) && range.start_container()->layout_node())
@ -434,10 +434,10 @@ static DeprecatedString visible_text_in_range(DOM::Range const& range)
if (is<DOM::Text>(*range.end_container()) && range.end_container()->layout_node())
builder.append(static_cast<DOM::Text const&>(*range.end_container()).data().bytes_as_string_view().substring_view(0, range.end_offset()));
return builder.to_deprecated_string();
return builder.to_byte_string();
}
DeprecatedString BrowsingContext::selected_text() const
ByteString BrowsingContext::selected_text() const
{
auto* document = active_document();
if (!document)

View file

@ -151,7 +151,7 @@ public:
bool cursor_blink_state() const { return m_cursor_blink_state; }
DeprecatedString selected_text() const;
ByteString selected_text() const;
void select_all();
void did_edit(Badge<EditEventHandler>);
@ -222,7 +222,7 @@ private:
RefPtr<Core::Timer> m_cursor_blink_timer;
bool m_cursor_blink_state { false };
DeprecatedString m_name;
ByteString m_name;
// https://html.spec.whatwg.org/multipage/browsers.html#tlbc-group
JS::GCPtr<BrowsingContextGroup> m_group;

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibWeb/HTML/Path2D.h>
namespace Web::HTML {

View file

@ -58,7 +58,7 @@ public:
{
return m_fill_or_stroke_style.visit(
[&](Gfx::Color color) -> JsFillOrStrokeStyle {
return MUST(String::from_deprecated_string(color.to_deprecated_string()));
return MUST(String::from_byte_string(color.to_byte_string()));
},
[&](auto handle) -> JsFillOrStrokeStyle {
return handle;

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Optional.h>
#include <LibWeb/HTML/TextMetrics.h>

View file

@ -20,7 +20,7 @@ class CanvasTextDrawingStyles {
public:
~CanvasTextDrawingStyles() = default;
DeprecatedString font() const
ByteString font() const
{
// When font style value is empty return default string
if (!my_drawing_state().font_style_value) {
@ -33,7 +33,7 @@ public:
auto font_weight = font_style_value.longhand(CSS::PropertyID::FontWeight);
auto font_size = font_style_value.longhand(CSS::PropertyID::FontSize);
auto font_family = font_style_value.longhand(CSS::PropertyID::FontFamily);
return DeprecatedString::formatted("{} {} {} {}", font_style->to_string(), font_weight->to_string(), font_size->to_string(), font_family->to_string());
return ByteString::formatted("{} {} {} {}", font_style->to_string(), font_weight->to_string(), font_size->to_string(), font_family->to_string());
}
void set_font(StringView font)

View file

@ -440,7 +440,7 @@ RefPtr<Gfx::Font const> CanvasRenderingContext2D::current_font()
}
// https://html.spec.whatwg.org/multipage/canvas.html#text-preparation-algorithm
CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(DeprecatedString const& text, float max_width)
CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(ByteString const& text, float max_width)
{
// 1. If maxWidth was provided but is less than or equal to zero or equal to NaN, then return an empty array.
if (max_width <= 0 || max_width != max_width) {
@ -452,7 +452,7 @@ CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(De
for (auto c : text) {
builder.append(Infra::is_ascii_whitespace(c) ? ' ' : c);
}
auto replaced_text = builder.to_deprecated_string();
auto replaced_text = builder.to_byte_string();
// 3. Let font be the current font of target, as given by that object's font attribute.
auto font = current_font();

View file

@ -138,7 +138,7 @@ private:
RefPtr<Gfx::Font const> current_font();
PreparedText prepare_text(DeprecatedString const& text, float max_width = INFINITY);
PreparedText prepare_text(ByteString const& text, float max_width = INFINITY);
Gfx::Painter* painter();
Optional<Gfx::AntiAliasingPainter> antialiased_painter();

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Forward.h>
#include <AK/Optional.h>
#include <AK/Traits.h>
@ -16,7 +16,7 @@
namespace Web::HTML {
struct CrossOriginProperty {
DeprecatedString property;
ByteString property;
Optional<bool> needs_get {};
Optional<bool> needs_set {};
};

View file

@ -82,7 +82,7 @@ Vector<DOMStringMap::NameValuePair> DOMStringMap::get_name_value_pairs() const
builder.append(current_character);
}
list.append({ MUST(builder.to_string()), MUST(String::from_deprecated_string(value)) });
list.append({ MUST(builder.to_string()), MUST(String::from_byte_string(value)) });
});
// 4. Return list.
@ -190,7 +190,7 @@ WebIDL::ExceptionOr<Bindings::LegacyPlatformObject::DidDeletionFail> DOMStringMa
}
// Remove an attribute by name given name and the DOMStringMap's associated element.
auto data_name = builder.to_deprecated_string();
auto data_name = builder.to_byte_string();
m_associated_element->remove_attribute(data_name);
// The spec doesn't have the step. This indicates that the deletion was successful.

View file

@ -111,7 +111,7 @@ bool is_valid_date_string(StringView value)
if (parts.size() != 3)
return false;
if (!is_valid_month_string(DeprecatedString::formatted("{}-{}", parts[0], parts[1])))
if (!is_valid_month_string(ByteString::formatted("{}-{}", parts[0], parts[1])))
return false;
if (parts[2].length() != 2)

View file

@ -11,7 +11,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(EventHandler);
EventHandler::EventHandler(DeprecatedString s)
EventHandler::EventHandler(ByteString s)
: value(move(s))
{
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Variant.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/CellAllocator.h>
@ -19,7 +19,7 @@ class EventHandler final : public JS::Cell {
JS_DECLARE_ALLOCATOR(EventHandler);
public:
explicit EventHandler(DeprecatedString);
explicit EventHandler(ByteString);
explicit EventHandler(WebIDL::CallbackType&);
// Either uncompiled source code or a callback.
@ -27,7 +27,7 @@ public:
// NOTE: This does not contain Empty as part of the optimization of not allocating all event handler attributes up front.
// FIXME: The string should actually be an "internal raw uncompiled handler" struct. This struct is just the uncompiled source code plus a source location for reporting parse errors.
// https://html.spec.whatwg.org/multipage/webappapis.html#internal-raw-uncompiled-handler
Variant<DeprecatedString, JS::GCPtr<WebIDL::CallbackType>> value;
Variant<ByteString, JS::GCPtr<WebIDL::CallbackType>> value;
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-listener
JS::GCPtr<DOM::DOMEventListener> listener;

View file

@ -170,7 +170,7 @@ static Vector<JS::Handle<DOM::Node>> focus_chain(DOM::Node* subject)
// https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps
// FIXME: This should accept more types.
void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target, [[maybe_unused]] Optional<DeprecatedString> focus_trigger)
void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target, [[maybe_unused]] Optional<ByteString> focus_trigger)
{
// FIXME: 1. If new focus target is not a focusable area, then set new focus target
// to the result of getting the focusable area for new focus target,

View file

@ -6,13 +6,13 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Optional.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target = nullptr, Optional<DeprecatedString> focus_trigger = {});
void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target = nullptr, Optional<ByteString> focus_trigger = {});
void run_unfocusing_steps(DOM::Node* old_focus_target);
}

View file

@ -107,13 +107,13 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
continue;
// 5. Let name be the value of the field element's name attribute.
auto name = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(control->name()));
auto name = TRY_OR_THROW_OOM(vm, String::from_byte_string(control->name()));
// 6. If the field element is a select element, then for each option element in the select element's list of options whose selectedness is true and that is not disabled, create an entry with name and the value of the option element, and append it to entry list.
if (auto* select_element = dynamic_cast<HTML::HTMLSelectElement*>(control.ptr())) {
for (auto const& option_element : select_element->list_of_options()) {
if (option_element->selected() && !option_element->disabled()) {
auto option_name = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(option_element->name()));
auto option_name = TRY_OR_THROW_OOM(vm, String::from_byte_string(option_element->name()));
auto option_value = option_element->value();
TRY_OR_THROW_OOM(vm, entry_list.try_append(XHR::FormDataEntry { .name = move(option_name), .value = move(option_value) }));
}
@ -127,7 +127,7 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
value = "on"_string;
// 2. Create an entry with name and value, and append it to entry list.
auto checkbox_or_radio_element_name = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(checkbox_or_radio_element->name()));
auto checkbox_or_radio_element_name = TRY_OR_THROW_OOM(vm, String::from_byte_string(checkbox_or_radio_element->name()));
TRY_OR_THROW_OOM(vm, entry_list.try_append(XHR::FormDataEntry { .name = move(checkbox_or_radio_element_name), .value = move(value) }));
}
// 8. Otherwise, if the field element is an input element whose type attribute is in the File Upload state, then:

View file

@ -20,9 +20,9 @@ class HTMLAnchorElement final
public:
virtual ~HTMLAnchorElement() override;
DeprecatedString rel() const { return deprecated_attribute(HTML::AttributeNames::rel); }
DeprecatedString target() const { return deprecated_attribute(HTML::AttributeNames::target); }
DeprecatedString download() const { return deprecated_attribute(HTML::AttributeNames::download); }
ByteString rel() const { return deprecated_attribute(HTML::AttributeNames::rel); }
ByteString target() const { return deprecated_attribute(HTML::AttributeNames::target); }
ByteString download() const { return deprecated_attribute(HTML::AttributeNames::download); }
String text() const;
void set_text(String const&);

View file

@ -62,17 +62,17 @@ void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<String>
HTMLElement::attribute_changed(name, value);
if (name.equals_ignoring_ascii_case("link"sv)) {
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-3
auto color = parse_legacy_color_value(value.value_or(String {}).to_deprecated_string());
auto color = parse_legacy_color_value(value.value_or(String {}).to_byte_string());
if (color.has_value())
document().set_link_color(color.value());
} else if (name.equals_ignoring_ascii_case("alink"sv)) {
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-5
auto color = parse_legacy_color_value(value.value_or(String {}).to_deprecated_string());
auto color = parse_legacy_color_value(value.value_or(String {}).to_byte_string());
if (color.has_value())
document().set_active_link_color(color.value());
} else if (name.equals_ignoring_ascii_case("vlink"sv)) {
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-4
auto color = parse_legacy_color_value(value.value_or(String {}).to_deprecated_string());
auto color = parse_legacy_color_value(value.value_or(String {}).to_byte_string());
if (color.has_value())
document().set_visited_link_color(color.value());
} else if (name.equals_ignoring_ascii_case("background"sv)) {

View file

@ -162,7 +162,7 @@ WebIDL::ExceptionOr<void> HTMLFormElement::submit_form(JS::NonnullGCPtr<HTMLElem
// 13. If action is the empty string, let action be the URL of the form document.
if (action.is_empty())
action = form_document->url_string().to_deprecated_string();
action = form_document->url_string().to_byte_string();
// 14. Parse a URL given action, relative to the submitter element's node document. If this fails, return.
// 15. Let parsed action be the resulting URL record.
@ -302,7 +302,7 @@ void HTMLFormElement::remove_associated_element(Badge<FormAssociatedElement>, HT
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fs-action
DeprecatedString HTMLFormElement::action_from_form_element(JS::NonnullGCPtr<HTMLElement> element) const
ByteString HTMLFormElement::action_from_form_element(JS::NonnullGCPtr<HTMLElement> element) const
{
// The action of an element is the value of the element's formaction attribute, if the element is a submit button
// and has such an attribute, or the value of its form owner's action attribute, if it has one, or else the empty
@ -314,7 +314,7 @@ DeprecatedString HTMLFormElement::action_from_form_element(JS::NonnullGCPtr<HTML
if (this->has_attribute(AttributeNames::action))
return deprecated_attribute(AttributeNames::action);
return DeprecatedString::empty();
return ByteString::empty();
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-attributes:attr-fs-method-2

View file

@ -35,7 +35,7 @@ class HTMLFormElement final : public HTMLElement {
public:
virtual ~HTMLFormElement() override;
DeprecatedString action_from_form_element(JS::NonnullGCPtr<HTMLElement> element) const;
ByteString action_from_form_element(JS::NonnullGCPtr<HTMLElement> element) const;
enum class MethodAttributeState {
#define __ENUMERATE_FORM_METHOD_ATTRIBUTE(_, state) state,

View file

@ -50,7 +50,7 @@ String HTMLHyperlinkElementUtils::origin() const
return String {};
// 3. Return the serialization of this element's url's origin.
return MUST(String::from_deprecated_string(m_url->serialize_origin()));
return MUST(String::from_byte_string(m_url->serialize_origin()));
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-protocol
@ -294,7 +294,7 @@ String HTMLHyperlinkElementUtils::pathname() const
// 4. If url's cannot-be-a-base-URL is true, then return url's path[0].
// 5. If url's path is empty, then return the empty string.
// 6. Return "/", followed by the strings in url's path (including empty strings), separated from each other by "/".
return MUST(String::from_deprecated_string(m_url->serialize_path()));
return MUST(String::from_byte_string(m_url->serialize_path()));
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-pathname
@ -437,7 +437,7 @@ String HTMLHyperlinkElementUtils::href() const
return href_content_attribute.release_value();
// 5. Return url, serialized.
return MUST(String::from_deprecated_string(url->serialize()));
return MUST(String::from_byte_string(url->serialize()));
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-href
@ -505,7 +505,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_
return;
// 10. If that is successful, let URL be the resulting URL string.
auto url_string = url.to_deprecated_string();
auto url_string = url.to_byte_string();
// 12. If hyperlinkSuffix is non-null, then append it to URL.
if (hyperlink_suffix.has_value()) {
@ -513,7 +513,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_
url_builder.append(url_string);
url_builder.append(*hyperlink_suffix);
url_string = url_builder.to_deprecated_string();
url_string = url_builder.to_byte_string();
}
// FIXME: 12. If subject's link types includes the noreferrer keyword, then set referrerPolicy to "no-referrer".

View file

@ -349,7 +349,7 @@ ErrorOr<void> HTMLImageElement::update_the_image_data(bool restart_animations, b
// then set selected source to the value of the element's src attribute
// and set selected pixel density to 1.0.
if (!uses_srcset_or_picture() && has_attribute(HTML::AttributeNames::src) && !deprecated_attribute(HTML::AttributeNames::src).is_empty()) {
selected_source = TRY(String::from_deprecated_string(deprecated_attribute(HTML::AttributeNames::src)));
selected_source = TRY(String::from_byte_string(deprecated_attribute(HTML::AttributeNames::src)));
selected_pixel_density = 1.0f;
}
@ -361,7 +361,7 @@ ErrorOr<void> HTMLImageElement::update_the_image_data(bool restart_animations, b
// 1. Parse selected source, relative to the element's node document.
// If that is not successful, then abort this inner set of steps.
// Otherwise, let urlString be the resulting URL string.
auto url_string = document().parse_url(selected_source.value().to_deprecated_string());
auto url_string = document().parse_url(selected_source.value().to_byte_string());
if (!url_string.is_valid())
goto after_step_7;
@ -460,7 +460,7 @@ after_step_7:
}
// 12. Parse selected source, relative to the element's node document, and let urlString be the resulting URL string.
auto url_string = document().parse_url(selected_source.value().url.to_deprecated_string());
auto url_string = document().parse_url(selected_source.value().url.to_byte_string());
// If that is not successful, then:
if (!url_string.is_valid()) {
// 1. Abort the image request for the current request and the pending request.

View file

@ -39,8 +39,8 @@ public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
DeprecatedString alt() const { return deprecated_attribute(HTML::AttributeNames::alt); }
DeprecatedString src() const { return deprecated_attribute(HTML::AttributeNames::src); }
ByteString alt() const { return deprecated_attribute(HTML::AttributeNames::alt); }
ByteString src() const { return deprecated_attribute(HTML::AttributeNames::src); }
RefPtr<Gfx::ImmutableBitmap> immutable_bitmap() const;
RefPtr<Gfx::Bitmap const> bitmap() const;

View file

@ -519,7 +519,7 @@ String HTMLInputElement::placeholder() const
}
// https://html.spec.whatwg.org/multipage/input.html#attr-input-placeholder
Optional<DeprecatedString> HTMLInputElement::placeholder_value() const
Optional<ByteString> HTMLInputElement::placeholder_value() const
{
if (!m_text_node || !m_text_node->data().is_empty())
return {};
@ -527,7 +527,7 @@ Optional<DeprecatedString> HTMLInputElement::placeholder_value() const
return {};
if (!has_attribute(HTML::AttributeNames::placeholder))
return {};
return placeholder().to_deprecated_string();
return placeholder().to_byte_string();
}
void HTMLInputElement::create_shadow_tree_if_needed()
@ -966,7 +966,7 @@ void HTMLInputElement::legacy_pre_activation_behavior()
// has its checkedness set to true, if any, and then set this element's
// checkedness to true.
if (type_state() == TypeAttributeState::RadioButton) {
DeprecatedString name = this->name();
ByteString name = this->name();
document().for_each_in_inclusive_subtree_of_type<HTML::HTMLInputElement>([&](auto& element) {
if (element.checked() && is_in_same_radio_button_group(*this, element)) {

View file

@ -63,8 +63,8 @@ public:
TypeAttributeState type_state() const { return m_type; }
WebIDL::ExceptionOr<void> set_type(String const&);
DeprecatedString default_value() const { return deprecated_attribute(HTML::AttributeNames::value); }
DeprecatedString name() const { return deprecated_attribute(HTML::AttributeNames::name); }
ByteString default_value() const { return deprecated_attribute(HTML::AttributeNames::value); }
ByteString name() const { return deprecated_attribute(HTML::AttributeNames::name); }
virtual String value() const override;
WebIDL::ExceptionOr<void> set_value(String const&);
@ -72,7 +72,7 @@ public:
void commit_pending_changes();
String placeholder() const;
Optional<DeprecatedString> placeholder_value() const;
Optional<ByteString> placeholder_value() const;
bool checked() const { return m_checked; }
enum class ChangeSource {

View file

@ -29,9 +29,9 @@ public:
virtual void inserted() override;
DeprecatedString rel() const { return deprecated_attribute(HTML::AttributeNames::rel); }
DeprecatedString type() const { return deprecated_attribute(HTML::AttributeNames::type); }
DeprecatedString href() const { return deprecated_attribute(HTML::AttributeNames::href); }
ByteString rel() const { return deprecated_attribute(HTML::AttributeNames::rel); }
ByteString type() const { return deprecated_attribute(HTML::AttributeNames::type); }
ByteString href() const { return deprecated_attribute(HTML::AttributeNames::href); }
bool has_loaded_icon() const;
bool load_favicon_and_use_if_window_is_active();

View file

@ -578,7 +578,7 @@ public:
// empty string, then end the synchronous section, and jump down to the failed with elements step below.
String candiate_src;
if (m_candidate->has_attribute(HTML::AttributeNames::src))
candiate_src = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_candidate->deprecated_attribute(HTML::AttributeNames::src)));
candiate_src = TRY_OR_THROW_OOM(vm, String::from_byte_string(m_candidate->deprecated_attribute(HTML::AttributeNames::src)));
if (candiate_src.is_empty()) {
TRY(failed_with_elements());
@ -589,7 +589,7 @@ public:
// would have resulted from parsing the URL specified by candidate's src attribute's value relative to the
// candidate's node document when the src attribute was last changed.
auto url_record = m_candidate->document().parse_url(candiate_src);
auto url_string = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url_record.to_deprecated_string()));
auto url_string = TRY_OR_THROW_OOM(vm, String::from_byte_string(url_record.to_byte_string()));
// 4. ⌛ If urlString was not obtained successfully, then end the synchronous section, and jump down to the failed
// with elements step below.
@ -837,7 +837,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::select_resource()
// 3. ⌛ If urlString was obtained successfully, set the currentSrc attribute to urlString.
if (url_record.is_valid())
m_current_src = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url_record.to_deprecated_string()));
m_current_src = TRY_OR_THROW_OOM(vm, String::from_byte_string(url_record.to_byte_string()));
// 4. End the synchronous section, continuing the remaining steps in parallel.

View file

@ -170,7 +170,7 @@ void HTMLObjectElement::resource_did_load()
// 4.8. Determine the resource type, as follows:
// 1. Let the resource type be unknown.
Optional<DeprecatedString> resource_type;
Optional<ByteString> resource_type;
// FIXME: 2. If the user agent is configured to strictly obey Content-Type headers for this resource, and the resource has associated Content-Type metadata, then let the resource type be the type specified in the resource's Content-Type metadata, and jump to the step below labeled handler.
// FIXME: 3. If there is a type attribute present on the object element, and that attribute's value is not a type that the user agent supports, but it is a type that a plugin supports, then let the resource type be the type specified in that type attribute, and jump to the step below labeled handler.
@ -203,7 +203,7 @@ void HTMLObjectElement::resource_did_load()
}
// * Otherwise, if the resource does not have associated Content-Type metadata
else {
Optional<DeprecatedString> tentative_type;
Optional<ByteString> tentative_type;
// 1. If there is a type attribute present on the object element, then let the tentative type be the type specified in that type attribute.
// Otherwise, let tentative type be the computed type of the resource.
@ -235,7 +235,7 @@ static bool is_xml_mime_type(StringView resource_type)
}
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element:plugin-11
void HTMLObjectElement::run_object_representation_handler_steps(Optional<DeprecatedString> resource_type)
void HTMLObjectElement::run_object_representation_handler_steps(Optional<ByteString> resource_type)
{
// 4.9. Handler: Handle the content as given by the first of the following cases that matches:

View file

@ -40,7 +40,7 @@ public:
String data() const;
void set_data(String const& data) { MUST(set_attribute(HTML::AttributeNames::data, data)); }
DeprecatedString type() const { return deprecated_attribute(HTML::AttributeNames::type); }
ByteString type() const { return deprecated_attribute(HTML::AttributeNames::type); }
// ^FormAssociatedElement
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
@ -58,7 +58,7 @@ private:
bool has_ancestor_media_element_or_object_element_not_showing_fallback_content() const;
void queue_element_task_to_run_object_representation_steps();
void run_object_representation_handler_steps(Optional<DeprecatedString> resource_type);
void run_object_representation_handler_steps(Optional<ByteString> resource_type);
void run_object_representation_completed_steps(Representation);
void run_object_representation_fallback_steps();

View file

@ -23,9 +23,9 @@ class HTMLOutputElement final
public:
virtual ~HTMLOutputElement() override;
DeprecatedString const& type() const
ByteString const& type() const
{
static DeprecatedString output = "output";
static ByteString output = "output";
return output;
}

View file

@ -177,7 +177,7 @@ void HTMLScriptElement::prepare_script()
// - el has a type attribute whose value is the empty string;
// - el has no type attribute but it has a language attribute and that attribute's value is the empty string; or
// - el has neither a type attribute nor a language attribute
DeprecatedString script_block_type;
ByteString script_block_type;
bool has_type_attribute = has_attribute(HTML::AttributeNames::type);
bool has_language_attribute = has_attribute(HTML::AttributeNames::language);
if ((has_type_attribute && deprecated_attribute(HTML::AttributeNames::type).is_empty())
@ -194,7 +194,7 @@ void HTMLScriptElement::prepare_script()
// Otherwise, el has a non-empty language attribute;
else if (!deprecated_attribute(HTML::AttributeNames::language).is_empty()) {
// let the script block's type string be the concatenation of "text/" and the value of el's language attribute.
script_block_type = DeprecatedString::formatted("text/{}", deprecated_attribute(HTML::AttributeNames::language));
script_block_type = ByteString::formatted("text/{}", deprecated_attribute(HTML::AttributeNames::language));
}
// 9. If the script block's type string is a JavaScript MIME type essence match,
@ -307,7 +307,7 @@ void HTMLScriptElement::prepare_script()
String integrity_metadata;
if (has_attribute(HTML::AttributeNames::integrity)) {
auto integrity = deprecated_attribute(HTML::AttributeNames::integrity);
integrity_metadata = String::from_deprecated_string(integrity).release_value_but_fixme_should_propagate_errors();
integrity_metadata = String::from_byte_string(integrity).release_value_but_fixme_should_propagate_errors();
}
// 26. Let referrer policy be the current state of el's referrerpolicy content attribute.
@ -409,7 +409,7 @@ void HTMLScriptElement::prepare_script()
if (m_script_type == ScriptType::Classic) {
// 1. Let script be the result of creating a classic script using source text, settings object, base URL, and options.
// FIXME: Pass options.
auto script = ClassicScript::create(m_document->url().to_deprecated_string(), source_text, settings_object, base_url, m_source_line_number);
auto script = ClassicScript::create(m_document->url().to_byte_string(), source_text, settings_object, base_url, m_source_line_number);
// 2. Mark as ready el given script.
mark_as_ready(Result(move(script)));
@ -429,7 +429,7 @@ void HTMLScriptElement::prepare_script()
// 2. Fetch an inline module script graph, given source text, base URL, settings object, options, and with the following steps given result:
// FIXME: Pass options
fetch_inline_module_script_graph(realm(), m_document->url().to_deprecated_string(), source_text.to_deprecated_string(), base_url, document().relevant_settings_object(), steps);
fetch_inline_module_script_graph(realm(), m_document->url().to_byte_string(), source_text.to_byte_string(), base_url, document().relevant_settings_object(), steps);
}
// -> "importmap"
else if (m_script_type == ScriptType::ImportMap) {

View file

@ -44,7 +44,7 @@ void HTMLTableElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_t_bodies);
}
static unsigned parse_border(DeprecatedString const& value)
static unsigned parse_border(ByteString const& value)
{
return value.to_uint().value_or(0);
}

View file

@ -30,15 +30,15 @@ void HTMLTitleElement::children_changed()
{
HTMLElement::children_changed();
if (navigable() && navigable()->is_traversable()) {
navigable()->traversable_navigable()->page().client().page_did_change_title(document().title().to_deprecated_string());
navigable()->traversable_navigable()->page().client().page_did_change_title(document().title().to_byte_string());
}
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text
DeprecatedString HTMLTitleElement::text()
ByteString HTMLTitleElement::text()
{
// The text attribute's getter must return this title element's child text content.
return child_text_content().to_deprecated_string();
return child_text_content().to_byte_string();
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text

View file

@ -17,7 +17,7 @@ class HTMLTitleElement final : public HTMLElement {
public:
virtual ~HTMLTitleElement() override;
DeprecatedString text();
ByteString text();
void set_text(String const& value);
private:

View file

@ -172,7 +172,7 @@ WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value v
if (url.has_value() && !url->is_empty()) {
// 1. Parse url, relative to the relevant settings object of history.
auto parsed_url = relevant_settings_object(*this).parse_url(url->to_deprecated_string());
auto parsed_url = relevant_settings_object(*this).parse_url(url->to_byte_string());
// 2. If that fails, then throw a "SecurityError" DOMException.
if (!parsed_url.is_valid())

View file

@ -116,7 +116,7 @@ WebIDL::ExceptionOr<String> Location::href() const
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
// 2. Return this's url, serialized.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url().serialize()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(url().serialize()));
}
// https://html.spec.whatwg.org/multipage/history.html#the-location-interface:dom-location-href-2
@ -131,7 +131,7 @@ WebIDL::ExceptionOr<void> Location::set_href(String const& new_href)
return {};
// 2. Parse the given value relative to the entry settings object. If that failed, throw a TypeError exception.
auto href_url = window.associated_document().parse_url(new_href.to_deprecated_string());
auto href_url = window.associated_document().parse_url(new_href.to_byte_string());
if (!href_url.is_valid())
return vm.throw_completion<JS::URIError>(TRY_OR_THROW_OOM(vm, String::formatted("Invalid URL '{}'", new_href)));
@ -152,7 +152,7 @@ WebIDL::ExceptionOr<String> Location::origin() const
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
// 2. Return the serialization of this's url's origin.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url().serialize_origin()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(url().serialize_origin()));
}
// https://html.spec.whatwg.org/multipage/history.html#dom-location-protocol
@ -269,7 +269,7 @@ WebIDL::ExceptionOr<String> Location::pathname() const
return WebIDL::SecurityError::create(realm(), "Location's relevant document is not same origin-domain with the entry settings object's origin"_fly_string);
// 2. Return the result of URL path serializing this Location object's url.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url().serialize_path()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(url().serialize_path()));
}
WebIDL::ExceptionOr<void> Location::set_pathname(String const&)

View file

@ -674,7 +674,7 @@ static WebIDL::ExceptionOr<Variant<Empty, NavigationParams, NonFetchSchemeNaviga
request->set_credentials_mode(Fetch::Infrastructure::Request::CredentialsMode::Include);
request->set_use_url_credentials(true);
request->set_redirect_mode(Fetch::Infrastructure::Request::RedirectMode::Manual);
auto replaces_client_id = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(active_document.relevant_settings_object().id));
auto replaces_client_id = TRY_OR_THROW_OOM(vm, String::from_byte_string(active_document.relevant_settings_object().id));
request->set_replaces_client_id(replaces_client_id);
request->set_mode(Fetch::Infrastructure::Request::Mode::Navigate);
request->set_referrer(entry->document_state->request_referrer());

View file

@ -43,7 +43,7 @@ void NavigationDestination::visit_edges(JS::Cell::Visitor& visitor)
WebIDL::ExceptionOr<String> NavigationDestination::url() const
{
// The url getter steps are to return this's URL, serialized.
return TRY_OR_THROW_OOM(vm(), String::from_deprecated_string(m_url.serialize()));
return TRY_OR_THROW_OOM(vm(), String::from_byte_string(m_url.serialize()));
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationdestination-key

View file

@ -65,7 +65,7 @@ WebIDL::ExceptionOr<Optional<String>> NavigationHistoryEntry::url() const
return OptionalNone {};
// 5. Return she's URL, serialized.
return TRY_OR_THROW_OOM(vm(), String::from_deprecated_string(she->url.serialize()));
return TRY_OR_THROW_OOM(vm(), String::from_byte_string(she->url.serialize()));
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationhistoryentry-key

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibWeb/HTML/NavigatorID.h>
#include <LibWeb/Loader/ResourceLoader.h>

View file

@ -45,7 +45,7 @@ public:
// NOTE: If the navigator compatibility mode is Gecko, then the user agent must also support the following partial interface:
// bool taint_enabled()
// DeprecatedString oscpu()
// ByteString oscpu()
};
}

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/URL.h>
#include <AK/URLParser.h>
@ -16,7 +16,7 @@ namespace Web::HTML {
class Origin {
public:
Origin() = default;
Origin(Optional<DeprecatedString> const& scheme, AK::URL::Host const& host, u16 port)
Origin(Optional<ByteString> const& scheme, AK::URL::Host const& host, u16 port)
: m_scheme(scheme)
, m_host(host)
, m_port(port)
@ -72,7 +72,7 @@ public:
}
// https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin
DeprecatedString serialize() const
ByteString serialize() const
{
// 1. If origin is an opaque origin, then return "null"
if (is_opaque())
@ -86,15 +86,15 @@ public:
result.append("://"sv);
// 4. Append origin's host, serialized, to result.
result.append(URLParser::serialize_host(host()).release_value_but_fixme_should_propagate_errors().to_deprecated_string());
result.append(URLParser::serialize_host(host()).release_value_but_fixme_should_propagate_errors().to_byte_string());
// 5. If origin's port is non-null, append a U+003A COLON character (:), and origin's port, serialized, to result.
if (port() != 0) {
result.append(':');
result.append(DeprecatedString::number(port()));
result.append(ByteString::number(port()));
}
// 6. Return result
return result.to_deprecated_string();
return result.to_byte_string();
}
// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-effective-domain
@ -113,7 +113,7 @@ public:
bool operator==(Origin const& other) const { return is_same_origin(other); }
private:
Optional<DeprecatedString> m_scheme;
Optional<ByteString> m_scheme;
AK::URL::Host m_host;
u16 m_port { 0 };
};

View file

@ -35,7 +35,7 @@ bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& positi
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#algorithm-for-extracting-a-character-encoding-from-a-meta-element
Optional<StringView> extract_character_encoding_from_meta_element(DeprecatedString const& string)
Optional<StringView> extract_character_encoding_from_meta_element(ByteString const& string)
{
// Checking for "charset" is case insensitive, as is getting an encoding.
// Therefore, stick to lowercase from the start for simplicity.
@ -158,7 +158,7 @@ value:
}
// https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding
Optional<DeprecatedString> run_prescan_byte_stream_algorithm(DOM::Document& document, ByteBuffer const& input)
Optional<ByteString> run_prescan_byte_stream_algorithm(DOM::Document& document, ByteBuffer const& input)
{
// https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding
@ -191,7 +191,7 @@ Optional<DeprecatedString> run_prescan_byte_stream_algorithm(DOM::Document& docu
Vector<FlyString> attribute_list {};
bool got_pragma = false;
Optional<bool> need_pragma {};
Optional<DeprecatedString> charset {};
Optional<ByteString> charset {};
while (true) {
auto attribute = prescan_get_attribute(document, input, position);
@ -205,7 +205,7 @@ Optional<DeprecatedString> run_prescan_byte_stream_algorithm(DOM::Document& docu
if (attribute_name == "http-equiv") {
got_pragma = attribute->value() == "content-type";
} else if (attribute_name == "content") {
auto encoding = extract_character_encoding_from_meta_element(attribute->value().to_deprecated_string());
auto encoding = extract_character_encoding_from_meta_element(attribute->value().to_byte_string());
if (encoding.has_value() && !charset.has_value()) {
charset = encoding.value();
need_pragma = true;
@ -213,7 +213,7 @@ Optional<DeprecatedString> run_prescan_byte_stream_algorithm(DOM::Document& docu
} else if (attribute_name == "charset") {
auto maybe_charset = TextCodec::get_standardized_encoding(attribute->value());
if (maybe_charset.has_value()) {
charset = Optional<DeprecatedString> { maybe_charset };
charset = Optional<ByteString> { maybe_charset };
need_pragma = { false };
}
}
@ -247,7 +247,7 @@ Optional<DeprecatedString> run_prescan_byte_stream_algorithm(DOM::Document& docu
}
// https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding
DeprecatedString run_encoding_sniffing_algorithm(DOM::Document& document, ByteBuffer const& input)
ByteString run_encoding_sniffing_algorithm(DOM::Document& document, ByteBuffer const& input)
{
if (input.size() >= 2) {
if (input[0] == 0xFE && input[1] == 0xFF) {

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Optional.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Forward.h>
@ -16,9 +16,9 @@ namespace Web::HTML {
bool prescan_should_abort(ByteBuffer const& input, size_t const& position);
bool prescan_is_whitespace_or_slash(u8 const& byte);
bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position);
Optional<StringView> extract_character_encoding_from_meta_element(DeprecatedString const&);
Optional<StringView> extract_character_encoding_from_meta_element(ByteString const&);
JS::GCPtr<DOM::Attr> prescan_get_attribute(DOM::Document&, ByteBuffer const& input, size_t& position);
Optional<DeprecatedString> run_prescan_byte_stream_algorithm(DOM::Document&, ByteBuffer const& input);
DeprecatedString run_encoding_sniffing_algorithm(DOM::Document&, ByteBuffer const& input);
Optional<ByteString> run_prescan_byte_stream_algorithm(DOM::Document&, ByteBuffer const& input);
ByteString run_encoding_sniffing_algorithm(DOM::Document&, ByteBuffer const& input);
}

View file

@ -132,7 +132,7 @@ static bool is_html_integration_point(DOM::Element const& element)
return false;
}
HTMLParser::HTMLParser(DOM::Document& document, StringView input, DeprecatedString const& encoding)
HTMLParser::HTMLParser(DOM::Document& document, StringView input, ByteString const& encoding)
: m_tokenizer(input, encoding)
, m_scripting_enabled(document.is_scripting_enabled())
, m_document(JS::make_handle(document))
@ -219,7 +219,7 @@ void HTMLParser::run()
void HTMLParser::run(const AK::URL& url)
{
m_document->set_url(url);
m_document->set_source(MUST(String::from_deprecated_string(m_tokenizer.source())));
m_document->set_source(MUST(String::from_byte_string(m_tokenizer.source())));
run();
the_end();
m_document->detach_parser({});
@ -4223,13 +4223,13 @@ JS::NonnullGCPtr<HTMLParser> HTMLParser::create_for_scripting(DOM::Document& doc
JS::NonnullGCPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input)
{
if (document.has_encoding())
return document.heap().allocate_without_realm<HTMLParser>(document, input, document.encoding().value().to_deprecated_string());
return document.heap().allocate_without_realm<HTMLParser>(document, input, document.encoding().value().to_byte_string());
auto encoding = run_encoding_sniffing_algorithm(document, input);
dbgln_if(HTML_PARSER_DEBUG, "The encoding sniffing algorithm returned encoding '{}'", encoding);
return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
}
JS::NonnullGCPtr<HTMLParser> HTMLParser::create(DOM::Document& document, StringView input, DeprecatedString const& encoding)
JS::NonnullGCPtr<HTMLParser> HTMLParser::create(DOM::Document& document, StringView input, ByteString const& encoding)
{
return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
}
@ -4545,7 +4545,7 @@ RefPtr<CSS::StyleValue> parse_nonzero_dimension_value(StringView string)
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-a-legacy-colour-value
Optional<Color> parse_legacy_color_value(DeprecatedString input)
Optional<Color> parse_legacy_color_value(ByteString input)
{
// 1. Let input be the string being parsed
// 2. If input is the empty string, then return an error.
@ -4591,7 +4591,7 @@ Optional<Color> parse_legacy_color_value(DeprecatedString input)
}
// 7. Replace any code points greater than U+FFFF in input (i.e., any characters that are not in the basic multilingual plane) with the two-character string "00".
auto replace_non_basic_multilingual_code_points = [](StringView string) -> DeprecatedString {
auto replace_non_basic_multilingual_code_points = [](StringView string) -> ByteString {
StringBuilder builder;
for (auto code_point : Utf8View { string }) {
if (code_point > 0xFFFF)
@ -4599,7 +4599,7 @@ Optional<Color> parse_legacy_color_value(DeprecatedString input)
else
builder.append_code_point(code_point);
}
return builder.to_deprecated_string();
return builder.to_byte_string();
};
input = replace_non_basic_multilingual_code_points(input);
@ -4612,7 +4612,7 @@ Optional<Color> parse_legacy_color_value(DeprecatedString input)
input = input.substring(1);
// 10. Replace any character in input that is not an ASCII hex digit with the character U+0030 DIGIT ZERO (0).
auto replace_non_ascii_hex = [](StringView string) -> DeprecatedString {
auto replace_non_ascii_hex = [](StringView string) -> ByteString {
StringBuilder builder;
for (auto code_point : Utf8View { string }) {
if (is_ascii_hex_digit(code_point))
@ -4620,7 +4620,7 @@ Optional<Color> parse_legacy_color_value(DeprecatedString input)
else
builder.append_code_point('0');
}
return builder.to_deprecated_string();
return builder.to_byte_string();
};
input = replace_non_ascii_hex(input);
@ -4629,7 +4629,7 @@ Optional<Color> parse_legacy_color_value(DeprecatedString input)
builder.append(input);
while (builder.length() == 0 || (builder.length() % 3 != 0))
builder.append_code_point('0');
input = builder.to_deprecated_string();
input = builder.to_byte_string();
// 12. Split input into three strings of equal code point length, to obtain three components. Let length be the code point length that all of those components have (one third the code point length of input).
auto length = input.length() / 3;

View file

@ -51,7 +51,7 @@ public:
static JS::NonnullGCPtr<HTMLParser> create_for_scripting(DOM::Document&);
static JS::NonnullGCPtr<HTMLParser> create_with_uncertain_encoding(DOM::Document&, ByteBuffer const& input);
static JS::NonnullGCPtr<HTMLParser> create(DOM::Document&, StringView input, DeprecatedString const& encoding);
static JS::NonnullGCPtr<HTMLParser> create(DOM::Document&, StringView input, ByteString const& encoding);
void run();
void run(const AK::URL&);
@ -82,7 +82,7 @@ public:
size_t script_nesting_level() const { return m_script_nesting_level; }
private:
HTMLParser(DOM::Document&, StringView input, DeprecatedString const& encoding);
HTMLParser(DOM::Document&, StringView input, ByteString const& encoding);
HTMLParser(DOM::Document&);
virtual void visit_edges(Cell::Visitor&) override;
@ -202,6 +202,6 @@ private:
RefPtr<CSS::StyleValue> parse_dimension_value(StringView);
RefPtr<CSS::StyleValue> parse_nonzero_dimension_value(StringView);
Optional<Color> parse_legacy_color_value(DeprecatedString input);
Optional<Color> parse_legacy_color_value(ByteString input);
}

View file

@ -2788,11 +2788,11 @@ HTMLTokenizer::HTMLTokenizer()
m_source_positions.empend(0u, 0u);
}
HTMLTokenizer::HTMLTokenizer(StringView input, DeprecatedString const& encoding)
HTMLTokenizer::HTMLTokenizer(StringView input, ByteString const& encoding)
{
auto decoder = TextCodec::decoder_for(encoding);
VERIFY(decoder.has_value());
m_decoded_input = decoder->to_utf8(input).release_value_but_fixme_should_propagate_errors().to_deprecated_string();
m_decoded_input = decoder->to_utf8(input).release_value_but_fixme_should_propagate_errors().to_byte_string();
m_utf8_view = Utf8View(m_decoded_input);
m_utf8_iterator = m_utf8_view.begin();
m_prev_utf8_iterator = m_utf8_view.begin();
@ -2808,7 +2808,7 @@ void HTMLTokenizer::insert_input_at_insertion_point(StringView input)
builder.append(m_decoded_input.substring(0, m_insertion_point.position));
builder.append(input);
builder.append(m_decoded_input.substring(m_insertion_point.position));
m_decoded_input = builder.to_deprecated_string();
m_decoded_input = builder.to_byte_string();
m_utf8_view = Utf8View(m_decoded_input);
m_utf8_iterator = m_utf8_view.iterator_at_byte_offset(utf8_iterator_byte_offset);

View file

@ -103,7 +103,7 @@ namespace Web::HTML {
class HTMLTokenizer {
public:
explicit HTMLTokenizer();
explicit HTMLTokenizer(StringView input, DeprecatedString const& encoding);
explicit HTMLTokenizer(StringView input, ByteString const& encoding);
enum class State {
#define __ENUMERATE_TOKENIZER_STATE(state) state,
@ -124,7 +124,7 @@ public:
void set_blocked(bool b) { m_blocked = b; }
bool is_blocked() const { return m_blocked; }
DeprecatedString source() const { return m_decoded_input; }
ByteString source() const { return m_decoded_input; }
void insert_input_at_insertion_point(StringView input);
void insert_eof();
@ -184,7 +184,7 @@ private:
Vector<u32> m_temporary_buffer;
DeprecatedString m_decoded_input;
ByteString m_decoded_input;
struct InsertionPoint {
size_t position { 0 };
@ -200,7 +200,7 @@ private:
HTMLToken m_current_token;
StringBuilder m_current_builder;
Optional<DeprecatedString> m_last_emitted_start_tag_name;
Optional<ByteString> m_last_emitted_start_tag_name;
bool m_explicit_eof_inserted { false };
bool m_has_emitted_eof { false };

View file

@ -18,7 +18,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(ClassicScript);
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script
JS::NonnullGCPtr<ClassicScript> ClassicScript::create(DeprecatedString filename, StringView source, EnvironmentSettingsObject& environment_settings_object, AK::URL base_url, size_t source_line_number, MutedErrors muted_errors)
JS::NonnullGCPtr<ClassicScript> ClassicScript::create(ByteString filename, StringView source, EnvironmentSettingsObject& environment_settings_object, AK::URL base_url, size_t source_line_number, MutedErrors muted_errors)
{
auto& vm = environment_settings_object.realm().vm();
@ -56,7 +56,7 @@ JS::NonnullGCPtr<ClassicScript> ClassicScript::create(DeprecatedString filename,
// 11. If result is a list of errors, then:
if (result.is_error()) {
auto& parse_error = result.error().first();
dbgln_if(HTML_SCRIPT_DEBUG, "ClassicScript: Failed to parse: {}", parse_error.to_deprecated_string());
dbgln_if(HTML_SCRIPT_DEBUG, "ClassicScript: Failed to parse: {}", parse_error.to_byte_string());
// 1. Set script's parse error and its error to rethrow to result[0].
script->set_parse_error(JS::SyntaxError::create(environment_settings_object.realm(), parse_error.to_string().release_value_but_fixme_should_propagate_errors()));
@ -147,7 +147,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors, JS::GCPtr<JS::En
// Return Completion { [[Type]]: throw, [[Value]]: a new "QuotaExceededError" DOMException, [[Target]]: empty }.
}
ClassicScript::ClassicScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
ClassicScript::ClassicScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
: Script(move(base_url), move(filename), environment_settings_object)
{
}

View file

@ -24,7 +24,7 @@ public:
No,
Yes,
};
static JS::NonnullGCPtr<ClassicScript> create(DeprecatedString filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url, size_t source_line_number = 1, MutedErrors = MutedErrors::No);
static JS::NonnullGCPtr<ClassicScript> create(ByteString filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url, size_t source_line_number = 1, MutedErrors = MutedErrors::No);
JS::Script* script_record() { return m_script_record; }
JS::Script const* script_record() const { return m_script_record; }
@ -38,7 +38,7 @@ public:
MutedErrors muted_errors() const { return m_muted_errors; }
private:
ClassicScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
ClassicScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -308,7 +308,7 @@ bool EnvironmentSettingsObject::is_scripting_disabled() const
}
// https://html.spec.whatwg.org/multipage/webappapis.html#module-type-allowed
bool EnvironmentSettingsObject::module_type_allowed(AK::DeprecatedString const& module_type) const
bool EnvironmentSettingsObject::module_type_allowed(AK::ByteString const& module_type) const
{
// 1. If moduleType is not "javascript", "css", or "json", then return false.
if (module_type != "javascript"sv && module_type != "css"sv && module_type != "json"sv)

View file

@ -20,7 +20,7 @@ struct Environment {
virtual ~Environment() = default;
// An id https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-id
DeprecatedString id;
ByteString id;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-creation-url
AK::URL creation_url;
@ -69,7 +69,7 @@ struct EnvironmentSettingsObject
virtual JS::GCPtr<DOM::Document> responsible_document() = 0;
// https://html.spec.whatwg.org/multipage/webappapis.html#api-url-character-encoding
virtual DeprecatedString api_url_character_encoding() = 0;
virtual ByteString api_url_character_encoding() = 0;
// https://html.spec.whatwg.org/multipage/webappapis.html#api-base-url
virtual AK::URL api_base_url() = 0;
@ -111,7 +111,7 @@ struct EnvironmentSettingsObject
bool is_scripting_enabled() const;
bool is_scripting_disabled() const;
bool module_type_allowed(DeprecatedString const& module_type) const;
bool module_type_allowed(ByteString const& module_type) const;
void disallow_further_import_maps();

View file

@ -54,10 +54,10 @@ ScriptFetchOptions default_classic_script_fetch_options()
}
// https://html.spec.whatwg.org/multipage/webappapis.html#module-type-from-module-request
DeprecatedString module_type_from_module_request(JS::ModuleRequest const& module_request)
ByteString module_type_from_module_request(JS::ModuleRequest const& module_request)
{
// 1. Let moduleType be "javascript".
DeprecatedString module_type = "javascript"sv;
ByteString module_type = "javascript"sv;
// 2. If moduleRequest.[[Attributes]] has a Record entry such that entry.[[Key]] is "type", then:
for (auto const& entry : module_request.attributes) {
@ -77,7 +77,7 @@ DeprecatedString module_type_from_module_request(JS::ModuleRequest const& module
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, DeprecatedString const& specifier)
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier)
{
// 1. Let settingsObject and baseURL be null.
Optional<EnvironmentSettingsObject&> settings_object;
@ -153,7 +153,7 @@ WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referrin
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolving-an-imports-match
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(DeprecatedString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const& specifier_map)
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(ByteString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const& specifier_map)
{
// 1. For each specifierKey → resolutionResult of specifierMap:
for (auto const& [specifier_key, resolution_result] : specifier_map) {
@ -220,7 +220,7 @@ WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(DeprecatedString co
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolving-a-url-like-module-specifier
Optional<AK::URL> resolve_url_like_module_specifier(DeprecatedString const& specifier, AK::URL const& base_url)
Optional<AK::URL> resolve_url_like_module_specifier(ByteString const& specifier, AK::URL const& base_url)
{
// 1. If specifier starts with "/", "./", or "../", then:
if (specifier.starts_with("/"sv) || specifier.starts_with("./"sv) || specifier.starts_with("../"sv)) {
@ -331,7 +331,7 @@ WebIDL::ExceptionOr<void> fetch_classic_script(JS::NonnullGCPtr<HTMLScriptElemen
// options, and muted errors.
// FIXME: Pass options.
auto response_url = response->url().value_or({});
auto script = ClassicScript::create(response_url.to_deprecated_string(), source_text, settings_object, response_url, 1, muted_errors);
auto script = ClassicScript::create(response_url.to_byte_string(), source_text, settings_object, response_url, 1, muted_errors);
// 8. Run onComplete given script.
on_complete->function()(script);
@ -401,7 +401,7 @@ WebIDL::ExceptionOr<void> fetch_classic_worker_script(AK::URL const& url, Enviro
// 5. Let script be the result of creating a classic script using sourceText, settingsObject,
// response's URL, and the default classic script fetch options.
auto response_url = response->url().value_or({});
auto script = ClassicScript::create(response_url.to_deprecated_string(), source_text, settings_object, response_url);
auto script = ClassicScript::create(response_url.to_byte_string(), source_text, settings_object, response_url);
// 6. Run onComplete given script.
on_complete->function()(script);
@ -562,7 +562,7 @@ void fetch_single_module_script(JS::Realm& realm,
OnFetchScriptComplete on_complete)
{
// 1. Let moduleType be "javascript".
DeprecatedString module_type = "javascript"sv;
ByteString module_type = "javascript"sv;
// 2. If moduleRequest was given, then set moduleType to the result of running the module type from module request steps given moduleRequest.
if (module_request.has_value())
@ -688,7 +688,7 @@ void fetch_external_module_script_graph(JS::Realm& realm, AK::URL const& url, En
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-an-inline-module-script-graph
void fetch_inline_module_script_graph(JS::Realm& realm, DeprecatedString const& filename, DeprecatedString const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete)
void fetch_inline_module_script_graph(JS::Realm& realm, ByteString const& filename, ByteString const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete)
{
// 1. Disallow further import maps given settingsObject.
settings_object.disallow_further_import_maps();

View file

@ -81,16 +81,16 @@ private:
}
};
DeprecatedString module_type_from_module_request(JS::ModuleRequest const&);
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, DeprecatedString const& specifier);
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(DeprecatedString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const&);
Optional<AK::URL> resolve_url_like_module_specifier(DeprecatedString const& specifier, AK::URL const& base_url);
ByteString module_type_from_module_request(JS::ModuleRequest const&);
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier);
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(ByteString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const&);
Optional<AK::URL> resolve_url_like_module_specifier(ByteString const& specifier, AK::URL const& base_url);
WebIDL::ExceptionOr<void> fetch_classic_script(JS::NonnullGCPtr<HTMLScriptElement>, AK::URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete);
WebIDL::ExceptionOr<void> fetch_classic_worker_script(AK::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
void fetch_internal_module_script_graph(JS::Realm&, JS::ModuleRequest const& module_request, EnvironmentSettingsObject& fetch_client_settings_object, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, Script& referring_script, HashTable<ModuleLocationTuple> const& visited_set, OnFetchScriptComplete on_complete);
void fetch_external_module_script_graph(JS::Realm&, AK::URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions const&, OnFetchScriptComplete on_complete);
void fetch_inline_module_script_graph(JS::Realm&, DeprecatedString const& filename, DeprecatedString const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete);
void fetch_inline_module_script_graph(JS::Realm&, ByteString const& filename, ByteString const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete);
void fetch_single_imported_module_script(JS::Realm&, AK::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, EnvironmentSettingsObject& settings_object, Fetch::Infrastructure::Request::Referrer, JS::ModuleRequest const&, OnFetchScriptComplete on_complete);
void fetch_descendants_of_a_module_script(JS::Realm&, JavaScriptModuleScript& module_script, EnvironmentSettingsObject& fetch_client_settings_object, Fetch::Infrastructure::Request::Destination, HashTable<ModuleLocationTuple> visited_set, OnFetchScriptComplete callback);

View file

@ -10,7 +10,7 @@
namespace Web::HTML {
using ModuleSpecifierMap = HashMap<DeprecatedString, Optional<AK::URL>>;
using ModuleSpecifierMap = HashMap<ByteString, Optional<AK::URL>>;
// https://html.spec.whatwg.org/multipage/webappapis.html#import-map
class ImportMap {

View file

@ -21,17 +21,17 @@ void ModuleMap::visit_edges(Visitor& visitor)
visitor.visit(callback);
}
bool ModuleMap::is_fetching(AK::URL const& url, DeprecatedString const& type) const
bool ModuleMap::is_fetching(AK::URL const& url, ByteString const& type) const
{
return is(url, type, EntryType::Fetching);
}
bool ModuleMap::is_failed(AK::URL const& url, DeprecatedString const& type) const
bool ModuleMap::is_failed(AK::URL const& url, ByteString const& type) const
{
return is(url, type, EntryType::Failed);
}
bool ModuleMap::is(AK::URL const& url, DeprecatedString const& type, EntryType entry_type) const
bool ModuleMap::is(AK::URL const& url, ByteString const& type, EntryType entry_type) const
{
auto value = m_values.get({ url, type });
if (!value.has_value())
@ -40,12 +40,12 @@ bool ModuleMap::is(AK::URL const& url, DeprecatedString const& type, EntryType e
return value->type == entry_type;
}
Optional<ModuleMap::Entry> ModuleMap::get(AK::URL const& url, DeprecatedString const& type) const
Optional<ModuleMap::Entry> ModuleMap::get(AK::URL const& url, ByteString const& type) const
{
return m_values.get({ url, type });
}
AK::HashSetResult ModuleMap::set(AK::URL const& url, DeprecatedString const& type, Entry entry)
AK::HashSetResult ModuleMap::set(AK::URL const& url, ByteString const& type, Entry entry)
{
// NOTE: Re-entering this function while firing wait_for_change callbacks is not allowed.
VERIFY(!m_firing_callbacks);
@ -63,7 +63,7 @@ AK::HashSetResult ModuleMap::set(AK::URL const& url, DeprecatedString const& typ
return value;
}
void ModuleMap::wait_for_change(JS::Heap& heap, AK::URL const& url, DeprecatedString const& type, Function<void(Entry)> callback)
void ModuleMap::wait_for_change(JS::Heap& heap, AK::URL const& url, ByteString const& type, Function<void(Entry)> callback)
{
m_callbacks.ensure({ url, type }).append(JS::create_heap_function(heap, move(callback)));
}

View file

@ -15,14 +15,14 @@ namespace Web::HTML {
class ModuleLocationTuple {
public:
ModuleLocationTuple(AK::URL url, DeprecatedString type)
ModuleLocationTuple(AK::URL url, ByteString type)
: m_url(move(url))
, m_type(move(type))
{
}
AK::URL const& url() const { return m_url; }
DeprecatedString const& type() const { return m_type; }
ByteString const& type() const { return m_type; }
bool operator==(ModuleLocationTuple const& other) const
{
@ -31,7 +31,7 @@ public:
private:
AK::URL m_url;
DeprecatedString m_type;
ByteString m_type;
};
// https://html.spec.whatwg.org/multipage/webappapis.html#module-map
@ -56,16 +56,16 @@ public:
using CallbackFunction = JS::NonnullGCPtr<JS::HeapFunction<void(Entry)>>;
bool is_fetching(AK::URL const& url, DeprecatedString const& type) const;
bool is_failed(AK::URL const& url, DeprecatedString const& type) const;
bool is_fetching(AK::URL const& url, ByteString const& type) const;
bool is_failed(AK::URL const& url, ByteString const& type) const;
bool is(AK::URL const& url, DeprecatedString const& type, EntryType) const;
bool is(AK::URL const& url, ByteString const& type, EntryType) const;
Optional<Entry> get(AK::URL const& url, DeprecatedString const& type) const;
Optional<Entry> get(AK::URL const& url, ByteString const& type) const;
AK::HashSetResult set(AK::URL const& url, DeprecatedString const& type, Entry);
AK::HashSetResult set(AK::URL const& url, ByteString const& type, Entry);
void wait_for_change(JS::Heap&, AK::URL const& url, DeprecatedString const& type, Function<void(Entry)> callback);
void wait_for_change(JS::Heap&, AK::URL const& url, ByteString const& type, Function<void(Entry)> callback);
private:
virtual void visit_edges(JS::Cell::Visitor&) override;
@ -84,7 +84,7 @@ template<>
struct Traits<Web::HTML::ModuleLocationTuple> : public DefaultTraits<Web::HTML::ModuleLocationTuple> {
static unsigned hash(Web::HTML::ModuleLocationTuple const& tuple)
{
return pair_int_hash(tuple.url().to_deprecated_string().hash(), tuple.type().hash());
return pair_int_hash(tuple.url().to_byte_string().hash(), tuple.type().hash());
}
};

View file

@ -17,20 +17,20 @@ JS_DEFINE_ALLOCATOR(JavaScriptModuleScript);
ModuleScript::~ModuleScript() = default;
ModuleScript::ModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
ModuleScript::ModuleScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
: Script(move(base_url), move(filename), environment_settings_object)
{
}
JavaScriptModuleScript::~JavaScriptModuleScript() = default;
JavaScriptModuleScript::JavaScriptModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
JavaScriptModuleScript::JavaScriptModuleScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
: ModuleScript(move(base_url), move(filename), environment_settings_object)
{
}
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-javascript-module-script
WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> JavaScriptModuleScript::create(DeprecatedString const& filename, StringView source, EnvironmentSettingsObject& settings_object, AK::URL base_url)
WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> JavaScriptModuleScript::create(ByteString const& filename, StringView source, EnvironmentSettingsObject& settings_object, AK::URL base_url)
{
// 1. If scripting is disabled for settings, then set source to the empty string.
if (settings_object.is_scripting_disabled())
@ -59,7 +59,7 @@ WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> JavaScriptModuleScript::c
// 8. If result is a list of errors, then:
if (result.is_error()) {
auto& parse_error = result.error().first();
dbgln("JavaScriptModuleScript: Failed to parse: {}", parse_error.to_deprecated_string());
dbgln("JavaScriptModuleScript: Failed to parse: {}", parse_error.to_byte_string());
// 1. Set script's parse error to result[0].
script->set_parse_error(JS::SyntaxError::create(settings_object.realm(), parse_error.to_string().release_value_but_fixme_should_propagate_errors()));

View file

@ -19,7 +19,7 @@ public:
virtual ~ModuleScript() override;
protected:
ModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
ModuleScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
};
class JavaScriptModuleScript final : public ModuleScript {
@ -29,7 +29,7 @@ class JavaScriptModuleScript final : public ModuleScript {
public:
virtual ~JavaScriptModuleScript() override;
static WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> create(DeprecatedString const& filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url);
static WebIDL::ExceptionOr<JS::GCPtr<JavaScriptModuleScript>> create(ByteString const& filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url);
enum class PreventErrorReporting {
Yes,
@ -42,7 +42,7 @@ public:
JS::SourceTextModule* record() { return m_record.ptr(); }
protected:
JavaScriptModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
JavaScriptModuleScript(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
private:
virtual void visit_edges(JS::Cell::Visitor&) override;

View file

@ -11,7 +11,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(Script);
Script::Script(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
Script::Script(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
: m_base_url(move(base_url))
, m_filename(move(filename))
, m_settings_object(environment_settings_object)

View file

@ -24,7 +24,7 @@ public:
virtual ~Script() override;
AK::URL const& base_url() const { return m_base_url; }
DeprecatedString const& filename() const { return m_filename; }
ByteString const& filename() const { return m_filename; }
EnvironmentSettingsObject& settings_object() { return m_settings_object; }
@ -35,7 +35,7 @@ public:
void set_parse_error(JS::Value value) { m_parse_error = value; }
protected:
Script(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
Script(AK::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object);
virtual void visit_edges(Visitor&) override;
@ -43,7 +43,7 @@ private:
virtual void visit_host_defined_self(JS::Cell::Visitor&) override;
AK::URL m_base_url;
DeprecatedString m_filename;
ByteString m_filename;
JS::NonnullGCPtr<EnvironmentSettingsObject> m_settings_object;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-parse-error

View file

@ -51,7 +51,7 @@ void WindowEnvironmentSettingsObject::setup(Page& page, AK::URL const& creation_
settings_object->target_browsing_context = reserved_environment->target_browsing_context;
// 2. Set reservedEnvironment's id to the empty string.
reserved_environment->id = DeprecatedString::empty();
reserved_environment->id = ByteString::empty();
}
// 5. Otherwise, ...
@ -60,7 +60,7 @@ void WindowEnvironmentSettingsObject::setup(Page& page, AK::URL const& creation_
// settings object's target browsing context to null,
// and settings object's active service worker to null.
static i64 next_id = 1;
settings_object->id = DeprecatedString::number(next_id++);
settings_object->id = ByteString::number(next_id++);
settings_object->target_browsing_context = nullptr;
}
@ -90,10 +90,10 @@ JS::GCPtr<DOM::Document> WindowEnvironmentSettingsObject::responsible_document()
}
// https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:api-url-character-encoding
DeprecatedString WindowEnvironmentSettingsObject::api_url_character_encoding()
ByteString WindowEnvironmentSettingsObject::api_url_character_encoding()
{
// Return the current character encoding of window's associated Document.
return m_window->associated_document().encoding_or_default().to_deprecated_string();
return m_window->associated_document().encoding_or_default().to_byte_string();
}
// https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:api-base-url

View file

@ -21,7 +21,7 @@ public:
virtual ~WindowEnvironmentSettingsObject() override;
virtual JS::GCPtr<DOM::Document> responsible_document() override;
virtual DeprecatedString api_url_character_encoding() override;
virtual ByteString api_url_character_encoding() override;
virtual AK::URL api_base_url() override;
virtual Origin origin() override;
virtual PolicyContainer policy_container() override;

View file

@ -29,7 +29,7 @@ public:
virtual ~WorkerEnvironmentSettingsObject() override = default;
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
DeprecatedString api_url_character_encoding() override { return m_api_url_character_encoding; }
ByteString api_url_character_encoding() override { return m_api_url_character_encoding; }
AK::URL api_base_url() override { return m_url; }
Origin origin() override { return m_origin; }
PolicyContainer policy_container() override { return m_policy_container; }
@ -38,7 +38,7 @@ public:
private:
virtual void visit_edges(JS::Cell::Visitor&) override;
DeprecatedString m_api_url_character_encoding;
ByteString m_api_url_character_encoding;
AK::URL m_url;
HTML::Origin m_origin;
HTML::PolicyContainer m_policy_container;

View file

@ -78,7 +78,7 @@ struct SessionHistoryEntry final : public JS::Cell {
// FIXME: scroll position data, which is scroll position data for the document's restorable scrollable regions
// browsing context name, a browsing context name or null, initially null
Optional<DeprecatedString> browsing_context_name;
Optional<ByteString> browsing_context_name;
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#she-other
// FIXME: persisted user state, which is implementation-defined, initially null

View file

@ -231,8 +231,8 @@ public:
// Note: A Regex<ECMA262> object is perfectly happy to be reconstructed with just the source+flags
// In the future, we could optimize the work being done on the deserialize step by serializing
// more of the internal state (the [[RegExpMatcher]] internal slot)
TRY(serialize_string(m_serialized, TRY_OR_THROW_OOM(m_vm, String::from_deprecated_string(regexp_object.pattern()))));
TRY(serialize_string(m_serialized, TRY_OR_THROW_OOM(m_vm, String::from_deprecated_string(regexp_object.flags()))));
TRY(serialize_string(m_serialized, TRY_OR_THROW_OOM(m_vm, String::from_byte_string(regexp_object.pattern()))));
TRY(serialize_string(m_serialized, TRY_OR_THROW_OOM(m_vm, String::from_byte_string(regexp_object.flags()))));
}
// 13. Otherwise, if value has an [[ArrayBufferData]] internal slot, then:
@ -847,7 +847,7 @@ public:
auto deserialized_value = TRY(deserialize());
// 2. Let result be ! CreateDataProperty(value, entry.[[Key]], deserializedValue).
auto result = MUST(object.create_data_property(key.to_deprecated_string(), deserialized_value));
auto result = MUST(object.create_data_property(key.to_byte_string(), deserialized_value));
// 3. Assert: result is true.
VERIFY(result);

View file

@ -7,7 +7,7 @@
*/
#include <AK/Base64.h>
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/GenericLexer.h>
#include <AK/Utf8View.h>
#include <LibIPC/File.h>
@ -165,10 +165,10 @@ static StringView normalize_feature_name(StringView name)
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-window-open-features-tokenize
static OrderedHashMap<DeprecatedString, DeprecatedString> tokenize_open_features(StringView features)
static OrderedHashMap<ByteString, ByteString> tokenize_open_features(StringView features)
{
// 1. Let tokenizedFeatures be a new ordered map.
OrderedHashMap<DeprecatedString, DeprecatedString> tokenized_features;
OrderedHashMap<ByteString, ByteString> tokenized_features;
// 2. Let position point at the first code point of features.
GenericLexer lexer(features);
@ -181,10 +181,10 @@ static OrderedHashMap<DeprecatedString, DeprecatedString> tokenize_open_features
// 3. While position is not past the end of features:
while (!lexer.is_eof()) {
// 1. Let name be the empty string.
DeprecatedString name;
ByteString name;
// 2. Let value be the empty string.
DeprecatedString value;
ByteString value;
// 3. Collect a sequence of code points that are feature separators from features given position. This skips past leading separators before the name.
lexer.ignore_while(is_feature_separator);
@ -246,7 +246,7 @@ static T parse_boolean_feature(StringView value)
}
// https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested
static TokenizedFeature::Popup check_if_a_popup_window_is_requested(OrderedHashMap<DeprecatedString, DeprecatedString> const& tokenized_features)
static TokenizedFeature::Popup check_if_a_popup_window_is_requested(OrderedHashMap<ByteString, ByteString> const& tokenized_features)
{
// 1. If tokenizedFeatures is empty, then return false.
if (tokenized_features.is_empty())
@ -1078,7 +1078,7 @@ WebIDL::ExceptionOr<void> Window::window_post_message_steps(JS::Value message, W
// with the origin attribute initialized to origin and the source attribute initialized to source, and then return.
if (deserialize_record_or_error.is_exception()) {
MessageEventInit message_event_init {};
message_event_init.origin = MUST(String::from_deprecated_string(origin));
message_event_init.origin = MUST(String::from_byte_string(origin));
message_event_init.source = JS::make_handle(source);
auto message_error_event = MessageEvent::create(target_realm, EventNames::messageerror, message_event_init);
@ -1104,7 +1104,7 @@ WebIDL::ExceptionOr<void> Window::window_post_message_steps(JS::Value message, W
// the source attribute initialized to source, the data attribute initialized to messageClone, and the ports attribute
// initialized to newPorts.
MessageEventInit message_event_init {};
message_event_init.origin = MUST(String::from_deprecated_string(origin));
message_event_init.origin = MUST(String::from_byte_string(origin));
message_event_init.source = JS::make_handle(source);
message_event_init.data = message_clone;
message_event_init.ports = move(new_ports);

View file

@ -70,7 +70,7 @@ WebIDL::ExceptionOr<String> WindowOrWorkerGlobalScopeMixin::origin() const
auto& vm = this_impl().vm();
// The origin getter steps are to return this's relevant settings object's origin, serialized.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(relevant_settings_object(this_impl()).origin().serialize()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(relevant_settings_object(this_impl()).origin().serialize()));
}
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-issecurecontext

View file

@ -241,7 +241,7 @@ JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> WindowProxy::internal_own_pro
// 5. Repeat while index < maxProperties,
for (size_t i = 0; i < max_properties; ++i) {
// 1. Add ! ToString(index) as the last element of keys.
keys.append(JS::PrimitiveString::create(vm, DeprecatedString::number(i)));
keys.append(JS::PrimitiveString::create(vm, ByteString::number(i)));
// 2. Increment index by 1.
}

View file

@ -61,7 +61,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(String const& scrip
auto& outside_settings = document.relevant_settings_object();
// 3. Parse the scriptURL argument relative to outside settings.
auto url = document.parse_url(script_url.to_deprecated_string());
auto url = document.parse_url(script_url.to_byte_string());
// 4. If this fails, throw a "SyntaxError" DOMException.
if (!url.is_valid()) {

View file

@ -19,7 +19,7 @@ ErrorOr<String> application_directory()
{
auto current_executable_path = TRY(Core::System::current_executable_path());
auto dirname = LexicalPath::dirname(current_executable_path);
return String::from_deprecated_string(dirname);
return String::from_byte_string(dirname);
}
ErrorOr<Vector<String>> get_paths_for_helper_process(StringView process_name)

View file

@ -17,7 +17,7 @@ WebIDL::ExceptionOr<String> WorkerLocation::href() const
{
auto& vm = realm().vm();
// The href getter steps are to return this's WorkerGlobalScope object's url, serialized.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_global_scope->url().serialize()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_global_scope->url().serialize()));
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-origin
@ -25,7 +25,7 @@ WebIDL::ExceptionOr<String> WorkerLocation::origin() const
{
auto& vm = realm().vm();
// The origin getter steps are to return the serialization of this's WorkerGlobalScope object's url's origin.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_global_scope->url().serialize_origin()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_global_scope->url().serialize_origin()));
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-protocol
@ -95,7 +95,7 @@ WebIDL::ExceptionOr<String> WorkerLocation::pathname() const
{
auto& vm = realm().vm();
// The pathname getter steps are to return the result of URL path serializing this's WorkerGlobalScope object's url.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_global_scope->url().serialize_path()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_global_scope->url().serialize_path()));
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-search

View file

@ -24,25 +24,25 @@ ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType
case CSS::ListStyleType::DisclosureOpen:
break;
case CSS::ListStyleType::Decimal:
m_text = DeprecatedString::formatted("{}.", m_index);
m_text = ByteString::formatted("{}.", m_index);
break;
case CSS::ListStyleType::DecimalLeadingZero:
// This is weird, but in accordance to spec.
m_text = m_index < 10 ? DeprecatedString::formatted("0{}.", m_index) : DeprecatedString::formatted("{}.", m_index);
m_text = m_index < 10 ? ByteString::formatted("0{}.", m_index) : ByteString::formatted("{}.", m_index);
break;
case CSS::ListStyleType::LowerAlpha:
case CSS::ListStyleType::LowerLatin:
m_text = DeprecatedString::bijective_base_from(m_index - 1).to_lowercase();
m_text = ByteString::bijective_base_from(m_index - 1).to_lowercase();
break;
case CSS::ListStyleType::UpperAlpha:
case CSS::ListStyleType::UpperLatin:
m_text = DeprecatedString::bijective_base_from(m_index - 1);
m_text = ByteString::bijective_base_from(m_index - 1);
break;
case CSS::ListStyleType::LowerRoman:
m_text = DeprecatedString::roman_number_from(m_index).to_lowercase();
m_text = ByteString::roman_number_from(m_index).to_lowercase();
break;
case CSS::ListStyleType::UpperRoman:
m_text = DeprecatedString::roman_number_from(m_index);
m_text = ByteString::roman_number_from(m_index);
break;
case CSS::ListStyleType::None:
break;

View file

@ -18,7 +18,7 @@ public:
explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, CSS::ListStylePosition, size_t index, NonnullRefPtr<CSS::StyleProperties>);
virtual ~ListItemMarkerBox() override;
Optional<DeprecatedString> const& text() const { return m_text; }
Optional<ByteString> const& text() const { return m_text; }
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
@ -33,7 +33,7 @@ private:
CSS::ListStylePosition m_list_style_position { CSS::ListStylePosition::Outside };
size_t m_index;
Optional<DeprecatedString> m_text {};
Optional<ByteString> m_text {};
};
template<>

View file

@ -880,7 +880,7 @@ bool Node::is_root_element() const
return is<HTML::HTMLHtmlElement>(*dom_node());
}
DeprecatedString Node::debug_description() const
ByteString Node::debug_description() const
{
StringBuilder builder;
builder.append(class_name());
@ -896,7 +896,7 @@ DeprecatedString Node::debug_description() const
} else {
builder.append("(anonymous)"sv);
}
return builder.to_deprecated_string();
return builder.to_byte_string();
}
CSS::Display Node::display() const

View file

@ -85,7 +85,7 @@ public:
bool is_root_element() const;
DeprecatedString debug_description() const;
ByteString debug_description() const;
bool has_style() const { return m_has_style; }
bool has_style_or_parent_with_style() const;

View file

@ -24,7 +24,7 @@ bool ContentFilter::is_filtered(const AK::URL& url) const
if (url.scheme() == "data")
return false;
auto url_string = url.to_deprecated_string();
auto url_string = url.to_byte_string();
for (auto& pattern : m_patterns) {
if (url_string.matches(pattern.text, CaseSensitivity::CaseSensitive))

View file

@ -8,13 +8,13 @@
namespace Web {
FileRequest::FileRequest(DeprecatedString path, Function<void(ErrorOr<i32>)> on_file_request_finish_callback)
FileRequest::FileRequest(ByteString path, Function<void(ErrorOr<i32>)> on_file_request_finish_callback)
: on_file_request_finish(move(on_file_request_finish_callback))
, m_path(move(path))
{
}
DeprecatedString FileRequest::path() const
ByteString FileRequest::path() const
{
return m_path;
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Error.h>
#include <AK/Function.h>
@ -14,14 +14,14 @@ namespace Web {
class FileRequest {
public:
FileRequest(DeprecatedString path, Function<void(ErrorOr<i32>)> on_file_request_finish);
FileRequest(ByteString path, Function<void(ErrorOr<i32>)> on_file_request_finish);
DeprecatedString path() const;
ByteString path() const;
Function<void(ErrorOr<i32>)> on_file_request_finish;
private:
DeprecatedString m_path {};
ByteString m_path {};
};
}

View file

@ -54,13 +54,13 @@ ErrorOr<String> load_error_page(AK::URL const& url)
{
// Generate HTML error page from error template file
// FIXME: Use an actual templating engine (our own one when it's built, preferably with a way to check these usages at compile time)
auto template_path = AK::URL::create_with_url_or_path(error_page_url().to_deprecated_string()).serialize_path();
auto template_path = AK::URL::create_with_url_or_path(error_page_url().to_byte_string()).serialize_path();
auto template_file = TRY(Core::File::open(template_path, Core::File::OpenMode::Read));
auto template_contents = TRY(template_file->read_until_eof());
StringBuilder builder;
SourceGenerator generator { builder };
generator.set("resource_directory_url", resource_directory_url());
generator.set("failed_url", url.to_deprecated_string());
generator.set("failed_url", url.to_byte_string());
generator.append(template_contents);
return TRY(String::from_utf8(generator.as_string_view()));
}
@ -70,7 +70,7 @@ ErrorOr<String> load_file_directory_page(LoadRequest const& request)
// Generate HTML contents entries table
auto lexical_path = LexicalPath(request.url().serialize_path());
Core::DirIterator dt(lexical_path.string(), Core::DirIterator::Flags::SkipParentAndBaseDir);
Vector<DeprecatedString> names;
Vector<ByteString> names;
while (dt.has_next())
names.append(dt.next_path());
quick_sort(names);
@ -88,7 +88,7 @@ ErrorOr<String> load_file_directory_page(LoadRequest const& request)
contents.appendff("<td><span class=\"{}\"></span></td>", is_directory ? "folder" : "file");
contents.appendff("<td><a href=\"file://{}\">{}</a></td><td>&nbsp;</td>"sv, path, name);
contents.appendff("<td>{:10}</td><td>&nbsp;</td>", is_directory ? "-" : human_readable_size(st.st_size));
contents.appendff("<td>{}</td>"sv, Core::DateTime::from_timestamp(st.st_mtime).to_deprecated_string());
contents.appendff("<td>{}</td>"sv, Core::DateTime::from_timestamp(st.st_mtime).to_byte_string());
contents.append("</tr>\n"sv);
}
}
@ -96,7 +96,7 @@ ErrorOr<String> load_file_directory_page(LoadRequest const& request)
// Generate HTML directory page from directory template file
// FIXME: Use an actual templating engine (our own one when it's built, preferably with a way to check these usages at compile time)
auto template_path = AK::URL::create_with_url_or_path(directory_page_url().to_deprecated_string()).serialize_path();
auto template_path = AK::URL::create_with_url_or_path(directory_page_url().to_byte_string()).serialize_path();
auto template_file = TRY(Core::File::open(template_path, Core::File::OpenMode::Read));
auto template_contents = TRY(template_file->read_until_eof());
StringBuilder builder;
@ -104,7 +104,7 @@ ErrorOr<String> load_file_directory_page(LoadRequest const& request)
generator.set("resource_directory_url", resource_directory_url());
generator.set("path", escape_html_entities(lexical_path.string()));
generator.set("parent_path", escape_html_entities(lexical_path.parent().string()));
generator.set("contents", contents.to_deprecated_string());
generator.set("contents", contents.to_byte_string());
generator.append(template_contents);
return TRY(String::from_utf8(generator.as_string_view()));
}

View file

@ -16,7 +16,7 @@ LoadRequest LoadRequest::create_for_url_on_page(const AK::URL& url, Page* page)
request.set_url(url);
if (page) {
DeprecatedString cookie = page->client().page_did_request_cookie(url, Cookie::Source::Http);
ByteString cookie = page->client().page_did_request_cookie(url, Cookie::Source::Http);
if (!cookie.is_empty())
request.set_header("Cookie", cookie);
request.set_page(*page);

Some files were not shown because too many files have changed in this diff Show more