1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:07:34 +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:
Linus Groh 2022-12-06 22:17:27 +00:00
parent 5db38d7ba1
commit 525f22d018
144 changed files with 656 additions and 672 deletions

View file

@ -134,7 +134,7 @@ WebIDL::ExceptionOr<JS::Value> package_data(JS::Realm& realm, ByteBuffer bytes,
return Infra::parse_json_bytes_to_javascript_value(vm, bytes);
case PackageDataType::Text:
// Return the result of running UTF-8 decode on bytes.
return JS::js_string(vm, DeprecatedString::copy(bytes));
return JS::PrimitiveString::create(vm, DeprecatedString::copy(bytes));
default:
VERIFY_NOT_REACHED();
}
@ -152,7 +152,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::js_string(vm, DeprecatedString::empty()));
auto promise = WebIDL::create_resolved_promise(realm, JS::PrimitiveString::create(vm, DeprecatedString::empty()));
// 3. If objects body is non-null, then set promise to the result of fully reading body as promise given objects body.
auto const& body = object.body_impl();