mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:47:46 +00:00
LibJS: Implement the missing step 20 in %TypedArray%.prototype.set
This commit is contained in:
parent
20d3869182
commit
9839e2eeb6
1 changed files with 6 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue