mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibJS+Everywhere: Make PrimitiveString and Utf16String fallible
This makes construction of Utf16String fallible in OOM conditions. The immediate impact is that PrimitiveString must then be fallible as well, as it may either transcode UTF-8 to UTF-16, or create a UTF-16 string from ropes. There are a couple of places where it is very non-trivial to propagate the error further. A FIXME has been added to those locations.
This commit is contained in:
parent
d793262beb
commit
115baa7e32
57 changed files with 306 additions and 295 deletions
|
@ -163,7 +163,7 @@ JS::NonnullGCPtr<JS::Promise> consume_body(JS::Realm& realm, BodyMixin const& ob
|
|||
// 4. Let steps be to return the result of package data with the first argument given, type, and object’s MIME type.
|
||||
auto steps = [&vm, &realm, &object, type](JS::Value value) -> WebIDL::ExceptionOr<JS::Value> {
|
||||
VERIFY(value.is_string());
|
||||
auto bytes = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(value.as_string().deprecated_string().bytes()));
|
||||
auto bytes = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(TRY(value.as_string().deprecated_string()).bytes()));
|
||||
return package_data(realm, move(bytes), type, object.mime_type_impl());
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue