blob: 1ef8a018ea03e5980a30775dda58077cb7d9a694 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<!DOCTYPE HTML>
<html>
<head>
<title>Test for BroadcastChannel - message after close</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script>
SimpleTest.waitForExplicitFinish();
let a = new BroadcastChannel('a');
let b = new BroadcastChannel('a');
let count = 0;
a.onmessage = function(e) {
++count;
a.close();
setTimeout(() => {
is(count, 1, "Only 1 message received");
SimpleTest.finish();
}, 0);
}
for (let i = 0; i < 100; ++i) {
b.postMessage(42);
}
</script>
</body>
</html>
|