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

LibWeb: Port IDL implementations Blob and File to new String

This commit is contained in:
Kenneth Myhra 2023-02-25 10:27:38 +01:00 committed by Linus Groh
parent 31a9bd2bfd
commit 9a5a8d617d
10 changed files with 63 additions and 52 deletions

View file

@ -108,7 +108,7 @@ WebIDL::ExceptionOr<JS::Value> package_data(JS::Realm& realm, ByteBuffer bytes,
case PackageDataType::Blob: {
// Return a Blob whose contents are bytes and type attribute is mimeType.
// NOTE: If extracting the mime type returns failure, other browsers set it to an empty string - not sure if that's spec'd.
auto mime_type_string = mime_type.has_value() ? mime_type->serialized() : DeprecatedString::empty();
auto mime_type_string = mime_type.has_value() ? TRY_OR_THROW_OOM(vm, String::from_deprecated_string(mime_type->serialized())) : String {};
return TRY(FileAPI::Blob::create(realm, move(bytes), move(mime_type_string)));
}
case PackageDataType::FormData: