mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:27:45 +00:00
LibJS: Allow TypeArray to become detached in TypedArray.prototype.set
This is a normative change in the ECMA-262 spec. See:
4d570c4
This commit is contained in:
parent
f92312e778
commit
4d0315099f
2 changed files with 42 additions and 48 deletions
|
@ -82,6 +82,28 @@ test("length is 1", () => {
|
|||
});
|
||||
});
|
||||
|
||||
test("detached buffer", () => {
|
||||
TYPED_ARRAYS.forEach(({ array: T }) => {
|
||||
let typedArray = new T(2);
|
||||
typedArray[0] = 1;
|
||||
typedArray[1] = 2;
|
||||
|
||||
let object = { length: 2 };
|
||||
|
||||
Object.defineProperty(object, 0, {
|
||||
get: () => {
|
||||
detachArrayBuffer(typedArray.buffer);
|
||||
},
|
||||
});
|
||||
|
||||
expect(() => {
|
||||
typedArray.set(object);
|
||||
}).not.toThrow();
|
||||
|
||||
expect(typedArray.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
function argumentErrorTests(T) {
|
||||
test(`requires at least one argument (${T.name})`, () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue