mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-29 02:57:17 +02:00
LibJS: Add initial implementation for SharedArrayBuffer
None of the actual sharing is implemented yet, but this is enough for
most basic functionality.
Diff Tests:
+260 ✅ -262 ❌ +2 💀
This commit is contained in:
committed by
Linus Groh
parent
1c1aa2c0d0
commit
3781948f0c
Notes:
sideshowbarker
2024-07-17 05:02:35 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/3781948f0c Pull-request: https://github.com/SerenityOS/serenity/pull/19727 Reviewed-by: https://github.com/linusg
@@ -0,0 +1,19 @@
|
||||
test("basic functionality", () => {
|
||||
expect(SharedArrayBuffer).toHaveLength(1);
|
||||
expect(SharedArrayBuffer.name).toBe("SharedArrayBuffer");
|
||||
expect(SharedArrayBuffer.prototype.constructor).toBe(SharedArrayBuffer);
|
||||
expect(new SharedArrayBuffer()).toBeInstanceOf(SharedArrayBuffer);
|
||||
expect(typeof new SharedArrayBuffer()).toBe("object");
|
||||
});
|
||||
|
||||
test("SharedArrayBuffer constructor must be invoked with 'new'", () => {
|
||||
expect(() => {
|
||||
SharedArrayBuffer();
|
||||
}).toThrowWithMessage(TypeError, "SharedArrayBuffer constructor must be called with 'new'");
|
||||
});
|
||||
|
||||
test("SharedArrayBuffer size limit", () => {
|
||||
expect(() => {
|
||||
new SharedArrayBuffer(2 ** 53);
|
||||
}).toThrowWithMessage(RangeError, "Invalid shared array buffer length");
|
||||
});
|
||||
Reference in New Issue
Block a user