diff --git a/Tests/LibWeb/Text/expected/Streams/ReadableStream-autoAllocateChunkSize-constructor.txt b/Tests/LibWeb/Text/expected/Streams/ReadableStream-autoAllocateChunkSize-constructor.txt
new file mode 100644
index 0000000000..1c2dbd9464
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/Streams/ReadableStream-autoAllocateChunkSize-constructor.txt
@@ -0,0 +1 @@
+PASS. Made: ReadableStream
diff --git a/Tests/LibWeb/Text/input/Streams/ReadableStream-autoAllocateChunkSize-constructor.html b/Tests/LibWeb/Text/input/Streams/ReadableStream-autoAllocateChunkSize-constructor.html
new file mode 100644
index 0000000000..73843944f9
--- /dev/null
+++ b/Tests/LibWeb/Text/input/Streams/ReadableStream-autoAllocateChunkSize-constructor.html
@@ -0,0 +1,10 @@
+
+
diff --git a/Userland/Libraries/LibWeb/Streams/UnderlyingSource.cpp b/Userland/Libraries/LibWeb/Streams/UnderlyingSource.cpp
index ec6846f4ca..644f468b8d 100644
--- a/Userland/Libraries/LibWeb/Streams/UnderlyingSource.cpp
+++ b/Userland/Libraries/LibWeb/Streams/UnderlyingSource.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2023, Matthew Olsson
+ * Copyright (c) 2023, Shannon Booth
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -7,7 +8,9 @@
#include
#include
#include
+#include
#include
+#include
namespace Web::Streams {
@@ -35,8 +38,10 @@ JS::ThrowCompletionOr UnderlyingSource::from_value(JS::VM& vm,
return vm.throw_completion(ByteString::formatted("Unknown stream type '{}'", type_value));
}
- if (TRY(object.has_property("autoAllocateChunkSize")))
- underlying_source.auto_allocate_chunk_size = TRY(TRY(object.get("autoAllocateChunkSize")).to_bigint_uint64(vm));
+ if (TRY(object.has_property("autoAllocateChunkSize"))) {
+ auto value = TRY(object.get("autoAllocateChunkSize"));
+ underlying_source.auto_allocate_chunk_size = TRY(WebIDL::convert_to_int(vm, value, WebIDL::EnforceRange::Yes));
+ }
return underlying_source;
}