mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:37:35 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -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 O’s 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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue