mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
LibJS: Partially implement resizable ArrayBuffer objects
This is (part of) a normative change in the ECMA-262 spec. See:
a9ae96e
This implements just support for resizing ArrayBuffer objects. This does
not implement the SharedArrayBuffer changes, as we do not have enough
support to do so.
This commit is contained in:
parent
a1e2f131c4
commit
29ac6e3689
13 changed files with 369 additions and 14 deletions
|
@ -17,3 +17,18 @@ test("ArrayBuffer size limit", () => {
|
|||
new ArrayBuffer(2 ** 53);
|
||||
}).toThrowWithMessage(RangeError, "Invalid array buffer length");
|
||||
});
|
||||
|
||||
test("invalid ArrayBuffer maximum size option", () => {
|
||||
expect(() => {
|
||||
new ArrayBuffer(10, { maxByteLength: -1 });
|
||||
}).toThrowWithMessage(RangeError, "Index must be a positive integer");
|
||||
});
|
||||
|
||||
test("ArrayBuffer size exceeds maximum size", () => {
|
||||
expect(() => {
|
||||
new ArrayBuffer(10, { maxByteLength: 5 });
|
||||
}).toThrowWithMessage(
|
||||
RangeError,
|
||||
"ArrayBuffer byte length of 10 exceeds the max byte length of 5"
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue