1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb/Fetch: Port JS interfaces to new String

Since BodyInit and Headers are tightly coupled to both Request and
Response, I chose to do all of them at once instead of introducing a
bunch of temporary conversion glue code.
This commit is contained in:
Linus Groh 2023-03-02 22:26:12 +00:00
parent f561940e54
commit 7f9ddcf420
13 changed files with 130 additions and 129 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -135,7 +135,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::PrimitiveString::create(vm, DeprecatedString::copy(bytes));
return JS::PrimitiveString::create(vm, TRY_OR_THROW_OOM(vm, String::from_utf8(bytes)));
default:
VERIFY_NOT_REACHED();
}