mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
LibWeb: Implement Streams AO CanTransferArrayBuffer
This commit is contained in:
parent
9d0700e770
commit
0245be70d8
2 changed files with 19 additions and 0 deletions
|
@ -3736,6 +3736,24 @@ bool is_non_negative_number(JS::Value value)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://streams.spec.whatwg.org/#can-transfer-array-buffer
|
||||||
|
bool can_transfer_array_buffer(JS::ArrayBuffer const& array_buffer)
|
||||||
|
{
|
||||||
|
// 1. Assert: Type(O) is Object.
|
||||||
|
// 2. Assert: O has an [[ArrayBufferData]] internal slot.
|
||||||
|
|
||||||
|
// 3. If ! IsDetachedBuffer(O) is true, return false.
|
||||||
|
if (array_buffer.is_detached())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 4. If SameValue(O.[[ArrayBufferDetachKey]], undefined) is false, return false.
|
||||||
|
if (!JS::same_value(array_buffer.detach_key(), JS::js_undefined()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 5. Return true.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// https://streams.spec.whatwg.org/#close-sentinel
|
// https://streams.spec.whatwg.org/#close-sentinel
|
||||||
// Non-standard function that implements the "close sentinel" value.
|
// Non-standard function that implements the "close sentinel" value.
|
||||||
JS::Value create_close_sentinel()
|
JS::Value create_close_sentinel()
|
||||||
|
|
|
@ -168,6 +168,7 @@ WebIDL::ExceptionOr<void> transform_stream_error_writable_and_unblock_write(Tran
|
||||||
WebIDL::ExceptionOr<void> transform_stream_set_backpressure(TransformStream&, bool backpressure);
|
WebIDL::ExceptionOr<void> transform_stream_set_backpressure(TransformStream&, bool backpressure);
|
||||||
|
|
||||||
bool is_non_negative_number(JS::Value);
|
bool is_non_negative_number(JS::Value);
|
||||||
|
bool can_transfer_array_buffer(JS::ArrayBuffer const& array_buffer);
|
||||||
|
|
||||||
JS::Value create_close_sentinel();
|
JS::Value create_close_sentinel();
|
||||||
bool is_close_sentinel(JS::Value);
|
bool is_close_sentinel(JS::Value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue