diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2023-04-02 08:34:56 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-09 21:45:39 +0200 |
commit | 0c441fa7af9c90e76931203c2e1a3cc9be6fe144 (patch) | |
tree | a03c194792f79e226e87b615b9d5cec2359cd6a3 /Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp | |
parent | c421b6113c3f5e7cef3013e77a59da8db999f2c9 (diff) | |
download | serenity-0c441fa7af9c90e76931203c2e1a3cc9be6fe144.zip |
LibWeb: Implement WritableStreamDefaultWriter.abort()
Diffstat (limited to 'Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp index 2fb167a3bc..509518da8e 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp @@ -1308,6 +1308,19 @@ void writable_stream_update_backpressure(WritableStream& stream, bool backpressu stream.set_backpressure(backpressure); } +// https://streams.spec.whatwg.org/#writable-stream-default-writer-abort +WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> writable_stream_default_writer_abort(WritableStreamDefaultWriter& writer, JS::Value reason) +{ + // 1. Let stream be writer.[[stream]]. + auto stream = writer.stream(); + + // 2. Assert: stream is not undefined. + VERIFY(stream); + + // 3. Return ! WritableStreamAbort(stream, reason). + return writable_stream_abort(*stream, reason); +} + // https://streams.spec.whatwg.org/#writable-stream-default-writer-ensure-ready-promise-rejected void writable_stream_default_writer_ensure_ready_promise_rejected(WritableStreamDefaultWriter& writer, JS::Value error) { |