-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't throw oob exception when setting numeric indexes on TAs
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: #645
- Loading branch information
Showing
4 changed files
with
23 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"use strict"; | ||
|
||
const u8 = new Uint8Array(1); | ||
u8[100] = 123; // Should not throw. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
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 })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { assert, assertThrows } from "../assert.js"; | ||
const ab = new ArrayBuffer(16, { maxByteLength: 32 }); | ||
const u8 = new Uint8Array(ab, 16); | ||
ab.resize(8); | ||
assert(ab.byteLength, 8); | ||
u8[1] = 123; // Doesn't throw. | ||
assertThrows(TypeError, () => Object.defineProperty(u8, "1", { value: 123 })); |