mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00
LibJS: Revert partial resizable ArrayBuffer implementation
This is a manual but clean revert of all commits from #12595. Adding a partial implementation of the resizable ArrayBuffer proposal without implementing all the updates to TypedArray infrastructure that is also covered by the spec introduced a bunch of crashes, so we decided to revert it for now until a full implementation is completed.
This commit is contained in:
parent
69a385f559
commit
028a6b90b1
12 changed files with 10 additions and 309 deletions
|
@ -11,57 +11,3 @@ test("ArrayBuffer constructor must be invoked with 'new'", () => {
|
|||
ArrayBuffer();
|
||||
}).toThrowWithMessage(TypeError, "ArrayBuffer constructor must be called with 'new'");
|
||||
});
|
||||
|
||||
describe("resizable array buffer", () => {
|
||||
test("construct with options", () => {
|
||||
expect(new ArrayBuffer(5, { maxByteLength: 5 })).toBeInstanceOf(ArrayBuffer);
|
||||
});
|
||||
|
||||
test("resizable when provided max byte length", () => {
|
||||
expect(new ArrayBuffer(1).resizable).toEqual(false);
|
||||
expect(new ArrayBuffer(1, {}).resizable).toEqual(false);
|
||||
expect(new ArrayBuffer(1, { maxByteLength: undefined }).resizable).toEqual(false);
|
||||
expect(new ArrayBuffer(1, { maxByteLength: 1 }).resizable).toEqual(true);
|
||||
});
|
||||
|
||||
test("byte length must be shorter than max byte length", () => {
|
||||
expect(() => {
|
||||
new ArrayBuffer(1, { maxByteLength: 0 });
|
||||
}).toThrowWithMessage(RangeError, "Byte length exceeds maxByteLength option");
|
||||
});
|
||||
|
||||
test("max byte length cannot be too large", () => {
|
||||
expect(() => {
|
||||
new ArrayBuffer(0, { maxByteLength: 9007199254740992 });
|
||||
}).toThrowWithMessage(RangeError, "Index must be a positive integer");
|
||||
});
|
||||
|
||||
test("max byte length cannot be negative", () => {
|
||||
expect(() => {
|
||||
new ArrayBuffer(0, { maxByteLength: -1 });
|
||||
}).toThrowWithMessage(RangeError, "Index must be a positive integer");
|
||||
});
|
||||
|
||||
test("invalid max byte length object", () => {
|
||||
expect(() => {
|
||||
new ArrayBuffer(0, {
|
||||
maxByteLength: {
|
||||
toString: function () {
|
||||
return {};
|
||||
},
|
||||
valueOf: function () {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
});
|
||||
}).toThrowWithMessage(TypeError, "Cannot convert object to number");
|
||||
|
||||
expect(() => {
|
||||
new ArrayBuffer(0, {
|
||||
get maxByteLength() {
|
||||
throw "Exception";
|
||||
},
|
||||
});
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue