Tests/LibWeb: Initialize 'arrayBuffer' to an UInt8Array

This initializes 'arrayBuffer' to an UInt8Array so that we can
manipulate the contents of 'arrayBuffer'. The test verifies that the
internal buffer is an ArrayBuffer.

Also:
* Correct comparison in test so that we compare arrayBuffer to
  arrayClone, not to itself.
* Remove FIXME, this outputs [object ArrayBuffer] in Firefox and Chrome
  too.
This commit is contained in:
Kenneth Myhra 2024-05-26 21:43:31 +02:00 committed by Andreas Kling
parent 95b9d77536
commit dacba5e610

View file

@ -24,18 +24,14 @@
println(result === result["b"]);
{
let arrayBuffer = new ArrayBuffer(6);
for (let i = 0; i < arrayBuffer.byteLength; ++i) {
arrayBuffer[i] = i;
}
let arrayBuffer = new Uint8Array([1, 2, 3, 4, 5, 6 ]);
let arrayClone = structuredClone(arrayBuffer);
for (let i = 0; i < arrayBuffer.byteLength; ++i) {
if (arrayBuffer[i] !== arrayBuffer[i]) {
if (arrayClone[i] !== arrayBuffer[i]) {
println("FAILED");
}
}
// FIXME: This should print something like ArrayBuffer { byteLength: 6 }
println(arrayClone);
println(arrayClone.buffer);
}
try {