mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
LibWeb: Propagate error from Notification contructor
This commit is contained in:
committed by
Shannon Booth
parent
3a9a8e38f8
commit
a4aaed5e83
Notes:
github-actions[bot]
2026-02-22 10:38:39 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a4aaed5e83a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8078
@@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
|
||||
<script>
|
||||
self.GLOBAL = {
|
||||
isWindow: function() { return true; },
|
||||
isWorker: function() { return false; },
|
||||
isShadowRealm: function() { return false; },
|
||||
};
|
||||
</script>
|
||||
<script src="../../../../resources/testharness.js"></script>
|
||||
<script src="../../../../resources/testharnessreport.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script src="../../../../html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-notifications-api.any.js"></script>
|
||||
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
test(() => {
|
||||
assert_throws_dom("DataCloneError", () => {
|
||||
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
|
||||
const sab = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer;
|
||||
new Notification("Bob: Hi", { data: sab });
|
||||
})
|
||||
}, "SharedArrayBuffer cloning via the Notifications API's data member: basic case");
|
||||
|
||||
test(() => {
|
||||
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
|
||||
const sab = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer;
|
||||
|
||||
let getter1Called = false;
|
||||
let getter2Called = false;
|
||||
|
||||
assert_throws_dom("DataCloneError", () => {
|
||||
new Notification("Bob: Hi", { data: [
|
||||
{ get x() { getter1Called = true; return 5; } },
|
||||
sab,
|
||||
{ get x() { getter2Called = true; return 5; } }
|
||||
]});
|
||||
});
|
||||
|
||||
assert_true(getter1Called, "The getter before the SAB must have been called");
|
||||
assert_false(getter2Called, "The getter after the SAB must not have been called");
|
||||
}, "SharedArrayBuffer cloning via the Notifications API's data member: is interleaved correctly");
|
||||
Reference in New Issue
Block a user