mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
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.
This commit is contained in:
parent
5db38d7ba1
commit
525f22d018
144 changed files with 656 additions and 672 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue