summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
diff options
context:
space:
mode:
authorMatthew Olsson <matthewcolsson@gmail.com>2023-04-02 15:15:53 -0700
committerLinus Groh <mail@linusgroh.de>2023-04-06 22:54:58 +0200
commite93560b769f5749e96ca66977886e2be94554550 (patch)
tree7a8ed57b5e1c9646692115a229ea4d53f7bb2f47 /Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
parent78feba401d05966e4339169d0afa48d5f44d9829 (diff)
downloadserenity-e93560b769f5749e96ca66977886e2be94554550.zip
LibWeb: Add the WritableStream interface
Diffstat (limited to 'Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
index 0ed20ddebb..367883635a 100644
--- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
+++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
@@ -13,7 +13,9 @@
#include <LibWeb/Streams/ReadableStreamDefaultController.h>
#include <LibWeb/Streams/ReadableStreamDefaultReader.h>
#include <LibWeb/Streams/ReadableStreamGenericReader.h>
+#include <LibWeb/Streams/UnderlyingSink.h>
#include <LibWeb/Streams/UnderlyingSource.h>
+#include <LibWeb/Streams/WritableStream.h>
#include <LibWeb/WebIDL/AbstractOperations.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
#include <LibWeb/WebIDL/Promise.h>
@@ -734,6 +736,17 @@ WebIDL::ExceptionOr<void> set_up_readable_stream_default_controller_from_underly
return set_up_readable_stream_default_controller(stream, controller, move(start_algorithm), move(pull_algorithm), move(cancel_algorithm), high_water_mark, move(size_algorithm));
}
+// https://streams.spec.whatwg.org/#is-writable-stream-locked
+bool is_writable_stream_locked(WritableStream const& stream)
+{
+ // 1. If stream.[[writer]] is undefined, return false.
+ if (!stream.writer())
+ return false;
+
+ // 2. Return true.
+ return true;
+}
+
// Non-standard function to aid in converting a user-provided function into a WebIDL::Callback. This is essentially
// what the Bindings generator would do at compile time, but at runtime instead.
JS::ThrowCompletionOr<JS::Handle<WebIDL::CallbackType>> property_to_callback(JS::VM& vm, JS::Value value, JS::PropertyKey const& property_key)