diff --git a/Userland/Libraries/LibWeb/Streams/WritableStream.cpp b/Userland/Libraries/LibWeb/Streams/WritableStream.cpp index 76449faf7a..1775a85893 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/WritableStream.cpp @@ -17,7 +17,7 @@ namespace Web::Streams { // https://streams.spec.whatwg.org/#ws-constructor -WebIDL::ExceptionOr> WritableStream::construct_impl(JS::Realm& realm, Optional> const& underlying_sink_object) +WebIDL::ExceptionOr> WritableStream::construct_impl(JS::Realm& realm, Optional> const& underlying_sink_object, QueuingStrategy const& strategy) { auto& vm = realm.vm(); @@ -36,11 +36,11 @@ WebIDL::ExceptionOr> WritableStream::construct_ // 4. Perform ! InitializeWritableStream(this). // Note: This AO configures slot values which are already specified in the class's field initializers. - // FIXME: 5. Let sizeAlgorithm be ! ExtractSizeAlgorithm(strategy). - SizeAlgorithm size_algorithm = [](auto const&) { return JS::normal_completion(JS::Value(1)); }; + // 5. Let sizeAlgorithm be ! ExtractSizeAlgorithm(strategy). + auto size_algorithm = extract_size_algorithm(strategy); - // FIXME: 6. Let highWaterMark be ? ExtractHighWaterMark(strategy, 1). - auto high_water_mark = 1.0; + // 6. Let highWaterMark be ? ExtractHighWaterMark(strategy, 1). + auto high_water_mark = TRY(extract_high_water_mark(strategy, 1)); // 7. Perform ? SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, underlyingSinkDict, highWaterMark, sizeAlgorithm). TRY(set_up_writable_stream_default_controller_from_underlying_sink(*writable_stream, underlying_sink, underlying_sink_dict, high_water_mark, move(size_algorithm))); diff --git a/Userland/Libraries/LibWeb/Streams/WritableStream.h b/Userland/Libraries/LibWeb/Streams/WritableStream.h index 9e02e9a382..43b9eef25a 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStream.h +++ b/Userland/Libraries/LibWeb/Streams/WritableStream.h @@ -11,6 +11,7 @@ #include #include #include +#include #include namespace Web::Streams { @@ -42,7 +43,7 @@ public: Errored, }; - static WebIDL::ExceptionOr> construct_impl(JS::Realm& realm, Optional> const& underlying_sink); + static WebIDL::ExceptionOr> construct_impl(JS::Realm& realm, Optional> const& underlying_sink, QueuingStrategy const& = {}); virtual ~WritableStream() = default; diff --git a/Userland/Libraries/LibWeb/Streams/WritableStream.idl b/Userland/Libraries/LibWeb/Streams/WritableStream.idl index 19977cfb85..f445e24cc8 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStream.idl +++ b/Userland/Libraries/LibWeb/Streams/WritableStream.idl @@ -1,9 +1,9 @@ +#import #import [Exposed=*, Transferable] interface WritableStream { - // FIXME: optional QueuingStrategy strategy = {} - constructor(optional object underlyingSink); + constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); readonly attribute boolean locked;