mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
LibWeb: Mostly implement ReadableByteStreamController.[[ReleaseSteps]]
This commit is contained in:
parent
51abecc8bc
commit
bd7809cc18
Notes:
sideshowbarker
2024-07-17 20:19:08 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/bd7809cc18 Pull-request: https://github.com/SerenityOS/serenity/pull/18297 Reviewed-by: https://github.com/linusg
|
@ -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);
|
||||
|
|
|
@ -118,6 +118,7 @@ public:
|
|||
|
||||
WebIDL::ExceptionOr<JS::GCPtr<WebIDL::Promise>> cancel_steps(JS::Value reason);
|
||||
WebIDL::ExceptionOr<void> pull_steps(NonnullRefPtr<ReadRequest>);
|
||||
WebIDL::ExceptionOr<void> release_steps();
|
||||
|
||||
private:
|
||||
explicit ReadableByteStreamController(JS::Realm&);
|
||||
|
|
Loading…
Reference in a new issue