mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-11 20:16:02 +00:00
LibJS: Prevent extensions of TypedArray exotic objects
This is a normative change in the ECMA-262 spec. See:
c1040ff
This commit is contained in:
parent
c6e684791f
commit
53a507303c
Notes:
github-actions[bot]
2024-11-30 10:21:05 +00:00
Author: https://github.com/trflynn89
Commit: 53a507303c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2646
Reviewed-by: https://github.com/shannonbooth ✅
3 changed files with 75 additions and 16 deletions
|
@ -83,3 +83,28 @@ test("freeze with huge number of properties doesn't crash", () => {
|
|||
}
|
||||
Object.freeze(o);
|
||||
});
|
||||
|
||||
test("freeze with TypedArray", () => {
|
||||
const TYPED_ARRAYS = [
|
||||
Uint8Array,
|
||||
Uint8ClampedArray,
|
||||
Uint16Array,
|
||||
Uint32Array,
|
||||
Int8Array,
|
||||
Int16Array,
|
||||
Int32Array,
|
||||
Float16Array,
|
||||
Float32Array,
|
||||
Float64Array,
|
||||
];
|
||||
|
||||
const buffer = new ArrayBuffer(5, { maxByteLength: 10 });
|
||||
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
const typedArray = new T(buffer, 0, 0);
|
||||
|
||||
expect(() => {
|
||||
Object.freeze(typedArray);
|
||||
}).toThrowWithMessage(TypeError, "Could not freeze object");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue