LibWeb/Fetch: Set length synchronously in extract_body

Since we don't currently have streams, we didn't set length anywhere.
However, this is required by XHR's reliance on Fetch to get the total
number of bytes for the progress events.
This commit is contained in:
Luke Wilde 2023-02-28 18:50:42 +00:00 committed by Linus Groh
parent e557602d34
commit acd5382924
Notes: sideshowbarker 2024-07-17 17:40:13 +09:00

View File

@ -117,6 +117,10 @@ WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm& realm,
}));
// FIXME: 11. If source is a byte sequence, then set action to a step that returns source and length to sources length.
// For now, do it synchronously.
if (source.has<ByteBuffer>())
length = source.get<ByteBuffer>().size();
// FIXME: 12. If action is non-null, then run these steps in parallel:
// 13. Let body be a body whose stream is stream, source is source, and length is length.