diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-06 22:17:27 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-07 16:43:06 +0000 |
commit | 525f22d018cb5f9c4c6ea0e2b5544fdcab8da483 (patch) | |
tree | 2488bac4fab4acec0d258c9bac2338bc95ee6398 /Userland/Libraries/LibWeb/HTML | |
parent | 5db38d7ba1a8caa5138dd65cc06be0c0e5a568e4 (diff) | |
download | serenity-525f22d018cb5f9c4c6ea0e2b5544fdcab8da483.zip |
LibJS: Replace standalone js_string() with PrimitiveString::create()
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
4 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp b/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp index a109b92f32..f1dcf32c69 100644 --- a/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/HTML/CrossOrigin/AbstractOperations.cpp @@ -236,10 +236,10 @@ JS::MarkedVector<JS::Value> cross_origin_own_property_keys(Variant<Bindings::Loc // 2. For each e of CrossOriginProperties(O), append e.[[Property]] to keys. for (auto& entry : cross_origin_properties(object)) - keys.append(JS::js_string(vm, move(entry.property))); + keys.append(JS::PrimitiveString::create(vm, move(entry.property))); // 3. Return the concatenation of keys and ยซ "then", @@toStringTag, @@hasInstance, @@isConcatSpreadable ยป. - keys.append(JS::js_string(vm, vm.names.then.as_string())); + keys.append(JS::PrimitiveString::create(vm, vm.names.then.as_string())); keys.append(vm.well_known_symbol_to_string_tag()); keys.append(vm.well_known_symbol_has_instance()); keys.append(vm.well_known_symbol_is_concat_spreadable()); diff --git a/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp b/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp index 60dff8eb6d..904e09a96b 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp +++ b/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp @@ -185,7 +185,7 @@ bool DOMStringMap::delete_existing_named_property(DeprecatedString const& name) JS::Value DOMStringMap::named_item_value(FlyString const& name) const { - return js_string(vm(), determine_value_of_named_property(name)); + return JS::PrimitiveString::create(vm(), determine_value_of_named_property(name)); } } diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 55f9bff4f8..2314e854cd 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -1252,7 +1252,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::prompt) auto response = impl->prompt_impl(message, default_); if (response.is_null()) return JS::js_null(); - return JS::js_string(vm, response); + return JS::PrimitiveString::create(vm, response); } static JS::ThrowCompletionOr<TimerHandler> make_timer_handler(JS::VM& vm, JS::Value handler) @@ -1406,7 +1406,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::atob) // decode_base64() returns a byte string. LibJS uses UTF-8 for strings. Use Latin1Decoder to convert bytes 128-255 to UTF-8. auto decoder = TextCodec::decoder_for("windows-1252"); VERIFY(decoder); - return JS::js_string(vm, decoder->to_utf8(decoded.value())); + return JS::PrimitiveString::create(vm, decoder->to_utf8(decoded.value())); } JS_DEFINE_NATIVE_FUNCTION(Window::btoa) @@ -1424,7 +1424,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::btoa) } auto encoded = encode_base64(byte_string.span()); - return JS::js_string(vm, move(encoded)); + return JS::PrimitiveString::create(vm, move(encoded)); } // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus @@ -1752,7 +1752,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::scroll_by) options = JS::Object::create(realm, nullptr); MUST(options->set("left", vm.argument(0), ShouldThrowExceptions::No)); MUST(options->set("top", vm.argument(1), ShouldThrowExceptions::No)); - MUST(options->set("behavior", JS::js_string(vm, "auto"), ShouldThrowExceptions::No)); + MUST(options->set("behavior", JS::PrimitiveString::create(vm, "auto"), ShouldThrowExceptions::No)); } auto left_value = TRY(options->get("left")); @@ -1845,7 +1845,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::structured_clone) JS_DEFINE_NATIVE_FUNCTION(Window::origin_getter) { auto* impl = TRY(impl_from(vm)); - return JS::js_string(vm, impl->associated_document().origin().serialize()); + return JS::PrimitiveString::create(vm, impl->associated_document().origin().serialize()); } JS_DEFINE_NATIVE_FUNCTION(Window::local_storage_getter) @@ -1863,7 +1863,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::session_storage_getter) JS_DEFINE_NATIVE_FUNCTION(Window::name_getter) { auto* impl = TRY(impl_from(vm)); - return JS::js_string(vm, impl->name()); + return JS::PrimitiveString::create(vm, impl->name()); } JS_DEFINE_NATIVE_FUNCTION(Window::name_setter) diff --git a/Userland/Libraries/LibWeb/HTML/WindowProxy.cpp b/Userland/Libraries/LibWeb/HTML/WindowProxy.cpp index 835a856590..0a741b73ec 100644 --- a/Userland/Libraries/LibWeb/HTML/WindowProxy.cpp +++ b/Userland/Libraries/LibWeb/HTML/WindowProxy.cpp @@ -233,7 +233,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::js_string(vm, DeprecatedString::number(i))); + keys.append(JS::PrimitiveString::create(vm, DeprecatedString::number(i))); // 2. Increment index by 1. } |