diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2023-04-08 11:49:58 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-14 13:03:34 +0200 |
commit | bd7809cc1825e8836410b8ee4f9187e61d1a2508 (patch) | |
tree | 92192e2312b66663d6087f798431723df3a20d7b /Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp | |
parent | 51abecc8bc747090064f8d85eef8a0eb100c2904 (diff) | |
download | serenity-bd7809cc1825e8836410b8ee4f9187e61d1a2508.zip |
LibWeb: Mostly implement ReadableByteStreamController.[[ReleaseSteps]]
Diffstat (limited to 'Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp b/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp index 1bca783d7a..56b0d19e8c 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp @@ -106,6 +106,27 @@ WebIDL::ExceptionOr<void> ReadableByteStreamController::pull_steps(NonnullRefPtr return {}; } +// https://streams.spec.whatwg.org/#rbs-controller-private-pull +WebIDL::ExceptionOr<void> ReadableByteStreamController::release_steps() +{ + auto& vm = this->vm(); + + // 1. If this.[[pendingPullIntos]] is not empty, + if (!m_pending_pull_intos.is_empty()) { + // 1. Let firstPendingPullInto be this.[[pendingPullIntos]][0]. + auto first_pending_pull_into = m_pending_pull_intos.first(); + + // 2. Set firstPendingPullInto’s reader type to "none". + first_pending_pull_into.reader_type = ReaderType::None; + + // 3. Set this.[[pendingPullIntos]] to the list « firstPendingPullInto ». + m_pending_pull_intos.clear(); + TRY_OR_THROW_OOM(vm, m_pending_pull_intos.try_append(first_pending_pull_into)); + } + + return {}; +} + void ReadableByteStreamController::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); |