test_invalidState.html (584B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test for BroadcastChannel.postMessage invalid State</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 7 </head> 8 <body> 9 10 <div id="content"></div> 11 12 <script type="application/javascript"> 13 14 var c = new BroadcastChannel("foo"); 15 c.close(); 16 17 try { 18 c.postMessage("bar"); 19 ok(false, "This should throw!"); 20 } catch (e) { 21 ok(true, "This should throw!"); 22 is(e.name, "InvalidStateError", "Correct invalid-state exception thrown"); 23 } 24 25 </script> 26 </body> 27 </html>