summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Fetch
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2023-02-28 18:50:42 +0000
committerLinus Groh <mail@linusgroh.de>2023-03-07 11:51:12 +0000
commitacd538292491a0a9525e50e6f4fb71a87946a4b3 (patch)
tree122626ea6c864a4f198a9538c50ff775c3d6321f /Userland/Libraries/LibWeb/Fetch
parente557602d34eb453e3dce15c46b1956388f5cf53c (diff)
downloadserenity-acd538292491a0a9525e50e6f4fb71a87946a4b3.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/Fetch')
-rw-r--r--Userland/Libraries/LibWeb/Fetch/BodyInit.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp
index 8b94dd38bc..076711867f 100644
--- a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp
@@ -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 source’s 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.