mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +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
|
@ -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 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();
|
||||
|
|
|
@ -53,11 +53,11 @@ JS::ThrowCompletionOr<JS::Object*> HeadersIterator::next()
|
|||
|
||||
switch (m_iteration_kind) {
|
||||
case JS::Object::PropertyKind::Key:
|
||||
return create_iterator_result_object(vm(), JS::js_string(vm(), StringView { pair.name }), false);
|
||||
return create_iterator_result_object(vm(), JS::PrimitiveString::create(vm(), StringView { pair.name }), false);
|
||||
case JS::Object::PropertyKind::Value:
|
||||
return create_iterator_result_object(vm(), JS::js_string(vm(), StringView { pair.value }), false);
|
||||
return create_iterator_result_object(vm(), JS::PrimitiveString::create(vm(), StringView { pair.value }), false);
|
||||
case JS::Object::PropertyKind::KeyAndValue: {
|
||||
auto* array = JS::Array::create_from(realm(), { JS::js_string(vm(), StringView { pair.name }), JS::js_string(vm(), StringView { pair.value }) });
|
||||
auto* array = JS::Array::create_from(realm(), { JS::PrimitiveString::create(vm(), StringView { pair.name }), JS::PrimitiveString::create(vm(), StringView { pair.value }) });
|
||||
return create_iterator_result_object(vm(), array, false);
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -49,7 +49,7 @@ JS::NonnullGCPtr<JS::PromiseCapability> Body::fully_read_as_promise() const
|
|||
// FIXME: Implement the streams spec - this is completely made up for now :^)
|
||||
if (auto const* byte_buffer = m_source.get_pointer<ByteBuffer>()) {
|
||||
auto result = DeprecatedString::copy(*byte_buffer);
|
||||
return WebIDL::create_resolved_promise(realm, JS::js_string(vm, move(result)));
|
||||
return WebIDL::create_resolved_promise(realm, JS::PrimitiveString::create(vm, move(result)));
|
||||
}
|
||||
// Empty, Blob, FormData
|
||||
return WebIDL::create_rejected_promise(realm, JS::InternalError::create(realm, "Reading body isn't fully implemented"sv));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue