mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
e30da0e8bc
Relevant spec section: https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-typedarraysetelement It should only throw if Object.defineProperty is used and the TA is detached or OOB if a RAB is used. Fixes: https://github.com/quickjs-ng/quickjs/issues/645
9 lines
314 B
JavaScript
9 lines
314 B
JavaScript
import { assert, assertThrows } from "../assert.js";
|
|
const ab = new ArrayBuffer(1);
|
|
const u8 = new Uint8Array(ab);
|
|
assert(!ab.detached);
|
|
// Detach the ArrayBuffer.
|
|
ab.transfer();
|
|
assert(ab.detached);
|
|
u8[100] = 123; // Doesn't throw.
|
|
assertThrows(TypeError, () => Object.defineProperty(u8, "100", { value: 123 }));
|