summaryrefslogtreecommitdiffstats
path: root/dom/broadcastchannel/tests/test_invalidState.html
blob: 8e4a1df354804155ded587c32cea0fdc1c7e93d1 (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
<!DOCTYPE HTML>
<html>
<head>
  <title>Test for BroadcastChannel.postMessage invalid State</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>

<div id="content"></div>

<script type="application/javascript">

var c = new BroadcastChannel("foo");
c.close();

try  {
  c.postMessage("bar");
  ok(false, "This should throw!");
} catch(e) {
  ok(true, "This should throw!");
  is(e.name, "InvalidStateError", "Correct invalid-state exception thrown");
}

</script>
</body>
</html>