1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17: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

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