1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

LibWeb: Accept explicit "type: undefined" in UnderlyingSource

This commit is contained in:
Matthew Olsson 2023-04-22 01:57:12 -07:00 committed by Andreas Kling
parent 5d48ade508
commit bdfc14f24d

View file

@ -26,13 +26,13 @@ JS::ThrowCompletionOr<UnderlyingSource> UnderlyingSource::from_value(JS::VM& vm,
.auto_allocate_chunk_size = {},
};
if (TRY(object.has_property("type"))) {
auto type_value = TRY(TRY(object.get("type")).to_string(vm));
if (type_value == "bytes"sv) {
auto type_value = TRY(object.get("type"));
if (!type_value.is_undefined()) {
auto type_string = TRY(type_value.to_string(vm));
if (type_string == "bytes"sv)
underlying_source.type = ReadableStreamType::Bytes;
} else {
else
return vm.throw_completion<JS::TypeError>(DeprecatedString::formatted("Unknown stream type '{}'", type_value));
}
}
if (TRY(object.has_property("autoAllocateChunkSize")))