1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

LibWeb: Implement size attribute of ByteLengthQueuingStrategy

Co-authored-by: Matthew Olsson <mattco@serenityos.org>
This commit is contained in:
Shannon Booth 2023-06-23 08:49:12 +12:00 committed by Andreas Kling
parent b2a51e86e5
commit a975fca42e
5 changed files with 42 additions and 1 deletions

View file

@ -1,11 +1,13 @@
/*
* Copyright (c) 2023, Shannon Booth <shannon.ml.booth@gmail.com>
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/ByteLengthQueuingStrategyPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Streams/ByteLengthQueuingStrategy.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@ -27,6 +29,13 @@ ByteLengthQueuingStrategy::ByteLengthQueuingStrategy(JS::Realm& realm, double hi
ByteLengthQueuingStrategy::~ByteLengthQueuingStrategy() = default;
// https://streams.spec.whatwg.org/#blqs-size
WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::CallbackType>> ByteLengthQueuingStrategy::size()
{
// 1. Return this's relevant global object's byte length queuing strategy size function.
return global_object().byte_length_queuing_strategy_size_function();
}
JS::ThrowCompletionOr<void> ByteLengthQueuingStrategy::initialize(JS::Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));