summaryrefslogtreecommitdiffstats
path: root/dom/broadcastchannel/tests/test_invalidState.html
blob: 371a58768ac23338e1ba9e3bd2d8179ac3008394 (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
<!DOCTYPE HTML>
<html>
<head>
  <title>Test for BroadcastChannel.postMessage invalid State</title>
  <script 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>