Mypal/dom/broadcastchannel/tests/test_invalidState.html
2019-03-11 13:26:37 +03:00

29 lines
615 B
HTML

<!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>