mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-27 11:48:59 +00:00
LibJS: Avoid internal assertion accessing detached TA internal slots
This defers accessing TA internal slots until we know we have a valid, attached TA. Our implementation has assertions that guard against this.
This commit is contained in:
parent
5d85f3a5c8
commit
962441b3cf
Notes:
github-actions[bot]
2024-12-13 15:10:36 +00:00
Author: https://github.com/trflynn89
Commit: 962441b3cf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2899
2 changed files with 27 additions and 6 deletions
|
@ -21,6 +21,24 @@ test("error cases", () => {
|
|||
const array = new Int32Array(4);
|
||||
Atomics.compareExchange(array, 100, 0, 0);
|
||||
}).toThrow(RangeError);
|
||||
|
||||
expect(() => {
|
||||
const array = new Int32Array(4);
|
||||
|
||||
function detachArrayWhileAccessingIndex(array) {
|
||||
return {
|
||||
valueOf() {
|
||||
detachArrayBuffer(array.buffer);
|
||||
return 0;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Atomics.compareExchange(array, detachArrayWhileAccessingIndex(array), 0, 0);
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"TypedArray contains a property which references a value at an index not contained within its buffer's bounds"
|
||||
);
|
||||
});
|
||||
|
||||
test("basic functionality (non-BigInt)", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue