mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
LibJS: Implement the missing step 20 in %TypedArray%.prototype.set
This commit is contained in:
parent
20d3869182
commit
9839e2eeb6
Notes:
sideshowbarker
2024-07-17 19:08:29 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/9839e2eeb6 Pull-request: https://github.com/SerenityOS/serenity/pull/12365 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg ✅
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/AbstractOperations.h>
|
#include <LibJS/Runtime/AbstractOperations.h>
|
||||||
|
#include <LibJS/Runtime/ArrayBufferConstructor.h>
|
||||||
#include <LibJS/Runtime/ArrayIterator.h>
|
#include <LibJS/Runtime/ArrayIterator.h>
|
||||||
#include <LibJS/Runtime/GlobalObject.h>
|
#include <LibJS/Runtime/GlobalObject.h>
|
||||||
#include <LibJS/Runtime/TypedArray.h>
|
#include <LibJS/Runtime/TypedArray.h>
|
||||||
|
@ -694,10 +695,14 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::set)
|
||||||
// 20. If same is true, then
|
// 20. If same is true, then
|
||||||
if (same) {
|
if (same) {
|
||||||
// a. Let srcByteLength be source.[[ByteLength]].
|
// a. Let srcByteLength be source.[[ByteLength]].
|
||||||
|
auto source_byte_length = source_typed_array.byte_length();
|
||||||
|
|
||||||
// b. Set srcBuffer to ? CloneArrayBuffer(srcBuffer, srcByteOffset, srcByteLength, %ArrayBuffer%).
|
// b. Set srcBuffer to ? CloneArrayBuffer(srcBuffer, srcByteOffset, srcByteLength, %ArrayBuffer%).
|
||||||
|
source_buffer = TRY(clone_array_buffer(global_object, *source_buffer, source_byte_offset, source_byte_length, *global_object.array_buffer_constructor()));
|
||||||
// c. NOTE: %ArrayBuffer% is used to clone srcBuffer because is it known to not have any observable side-effects.
|
// c. NOTE: %ArrayBuffer% is used to clone srcBuffer because is it known to not have any observable side-effects.
|
||||||
|
|
||||||
// d. Let srcByteIndex be 0.
|
// d. Let srcByteIndex be 0.
|
||||||
TODO();
|
source_byte_index = 0;
|
||||||
} else {
|
} else {
|
||||||
// 21. Else, let srcByteIndex be srcByteOffset.
|
// 21. Else, let srcByteIndex be srcByteOffset.
|
||||||
source_byte_index = source_byte_offset;
|
source_byte_index = source_byte_offset;
|
||||||
|
|
Loading…
Reference in a new issue