diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-21 10:42:46 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-22 01:03:13 +0000 |
commit | 34574c5ee8ba634bee6d1f4e40ca7422097d9f6c (patch) | |
tree | d23e66159c351959ace9d9a7708280d3ebfa4d7d /Userland | |
parent | 1bcde5d21611863103203c32488c9772a795259d (diff) | |
download | serenity-34574c5ee8ba634bee6d1f4e40ca7422097d9f6c.zip |
LibJS+LibWeb: Convert empty PrimitiveString invocators to String
Diffstat (limited to 'Userland')
9 files changed, 13 insertions, 13 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp index 904e2c9de8..0fc6b0f3c1 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp @@ -26,7 +26,7 @@ void CollatorCompareFunction::initialize(Realm&) { auto& vm = this->vm(); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); - define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); } // 10.3.3.2 CompareStrings ( collator, x, y ), https://tc39.es/ecma402/#sec-collator-comparestrings diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp index 5fc0912b76..2ef7ca7a41 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp @@ -31,7 +31,7 @@ void DateTimeFormatFunction::initialize(Realm& realm) Base::initialize(realm); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); - define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); } ThrowCompletionOr<Value> DateTimeFormatFunction::call() diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp index 5311dfc7a3..eb0b69a488 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp @@ -29,7 +29,7 @@ void NumberFormatFunction::initialize(Realm& realm) Base::initialize(realm); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); - define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); } ThrowCompletionOr<Value> NumberFormatFunction::call() diff --git a/Userland/Libraries/LibJS/Runtime/Promise.cpp b/Userland/Libraries/LibJS/Runtime/Promise.cpp index 40a721ce22..316ad4f987 100644 --- a/Userland/Libraries/LibJS/Runtime/Promise.cpp +++ b/Userland/Libraries/LibJS/Runtime/Promise.cpp @@ -157,7 +157,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions() // 16. Return undefined. return js_undefined(); }); - resolve_function->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + resolve_function->define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); // 7. Let stepsReject be the algorithm steps defined in Promise Reject Functions. // 8. Let lengthReject be the number of non-optional parameters of the function definition in Promise Reject Functions. @@ -189,7 +189,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions() // 8. Return undefined. return js_undefined(); }); - reject_function->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + reject_function->define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); // 12. Return the Record { [[Resolve]]: resolve, [[Reject]]: reject }. return { *resolve_function, *reject_function }; diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index 8fa851e473..bc265f413f 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -139,7 +139,7 @@ static ThrowCompletionOr<Value> perform_promise_all(VM& vm, Iterator& iterator_r // p. Set onFulfilled.[[Capability]] to resultCapability. // q. Set onFulfilled.[[RemainingElements]] to remainingElementsCount. auto on_fulfilled = PromiseAllResolveElementFunction::create(realm, index, values, result_capability, remaining_elements_count); - on_fulfilled->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + on_fulfilled->define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); // s. Perform ? Invoke(nextPromise, "then", « onFulfilled, resultCapability.[[Reject]] »). return next_promise.invoke(vm, vm.names.then, on_fulfilled, result_capability.reject()); @@ -171,7 +171,7 @@ static ThrowCompletionOr<Value> perform_promise_all_settled(VM& vm, Iterator& it // q. Set onFulfilled.[[Capability]] to resultCapability. // r. Set onFulfilled.[[RemainingElements]] to remainingElementsCount. auto on_fulfilled = PromiseAllSettledResolveElementFunction::create(realm, index, values, result_capability, remaining_elements_count); - on_fulfilled->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + on_fulfilled->define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); // s. Let stepsRejected be the algorithm steps defined in Promise.allSettled Reject Element Functions. // t. Let lengthRejected be the number of non-optional parameters of the function definition in Promise.allSettled Reject Element Functions. @@ -182,7 +182,7 @@ static ThrowCompletionOr<Value> perform_promise_all_settled(VM& vm, Iterator& it // y. Set onRejected.[[Capability]] to resultCapability. // z. Set onRejected.[[RemainingElements]] to remainingElementsCount. auto on_rejected = PromiseAllSettledRejectElementFunction::create(realm, index, values, result_capability, remaining_elements_count); - on_rejected->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + on_rejected->define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); // ab. Perform ? Invoke(nextPromise, "then", « onFulfilled, onRejected »). return next_promise.invoke(vm, vm.names.then, on_fulfilled, on_rejected); @@ -217,7 +217,7 @@ static ThrowCompletionOr<Value> perform_promise_any(VM& vm, Iterator& iterator_r // p. Set onRejected.[[Capability]] to resultCapability. // q. Set onRejected.[[RemainingElements]] to remainingElementsCount. auto on_rejected = PromiseAnyRejectElementFunction::create(realm, index, errors, result_capability, remaining_elements_count); - on_rejected->define_direct_property(vm.names.name, PrimitiveString::create(vm, DeprecatedString::empty()), Attribute::Configurable); + on_rejected->define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); // s. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], onRejected »). return next_promise.invoke(vm, vm.names.then, result_capability.resolve(), on_rejected); diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp index 0fe13a9c21..f4e9368271 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp @@ -83,7 +83,7 @@ ThrowCompletionOr<void> copy_name_and_length(VM& vm, FunctionObject& function, F // 7. If Type(targetName) is not String, set targetName to the empty String. if (!target_name.is_string()) - target_name = PrimitiveString::create(vm, DeprecatedString::empty()); + target_name = PrimitiveString::create(vm, String {}); // 8. Perform SetFunctionName(F, targetName, prefix). function.set_function_name({ TRY(target_name.as_string().deprecated_string()) }, move(prefix)); diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 836c9bfb88..d0bfa88021 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -41,7 +41,7 @@ VM::VM(OwnPtr<CustomData> custom_data) : m_heap(*this) , m_custom_data(move(custom_data)) { - m_empty_string = m_heap.allocate_without_realm<PrimitiveString>(DeprecatedString::empty()); + m_empty_string = m_heap.allocate_without_realm<PrimitiveString>(String {}); for (size_t i = 0; i < 128; ++i) { m_single_ascii_character_strings[i] = m_heap.allocate_without_realm<PrimitiveString>(DeprecatedString::formatted("{:c}", i)); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp index 3281e20f00..3bdb6d5c3c 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp @@ -341,7 +341,7 @@ JS::ThrowCompletionOr<JS::Value> CSSStyleDeclaration::internal_get(JS::PropertyK return Base::internal_get(name, receiver); if (auto maybe_property = property(property_id); maybe_property.has_value()) return { JS::PrimitiveString::create(vm(), maybe_property->value->to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string()) }; - return { JS::PrimitiveString::create(vm(), DeprecatedString::empty()) }; + return { JS::PrimitiveString::create(vm(), String {}) }; } JS::ThrowCompletionOr<bool> CSSStyleDeclaration::internal_set(JS::PropertyKey const& name, JS::Value value, JS::Value receiver) diff --git a/Userland/Libraries/LibWeb/Fetch/Body.cpp b/Userland/Libraries/LibWeb/Fetch/Body.cpp index 6acc57173d..dff2ab6504 100644 --- a/Userland/Libraries/LibWeb/Fetch/Body.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Body.cpp @@ -153,7 +153,7 @@ JS::NonnullGCPtr<JS::Promise> consume_body(JS::Realm& realm, BodyMixin const& ob } // 2. Let promise be a promise resolved with an empty byte sequence. - auto promise = WebIDL::create_resolved_promise(realm, JS::PrimitiveString::create(vm, DeprecatedString::empty())); + auto promise = WebIDL::create_resolved_promise(realm, JS::PrimitiveString::create(vm, String {})); // 3. If object’s body is non-null, then set promise to the result of fully reading body as promise given object’s body. auto const& body = object.body_impl(); |