test_window_extensible.html (1146B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=856384 5 --> 6 <head> 7 <meta charset="UTF-8"> 8 <title>Test for Bug 856384</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=856384">Mozilla Bug 856384</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 </div> 17 <iframe name="constructor" src="about:blank"></iframe> 18 <pre id="test"> 19 <script type="application/javascript"> 20 SimpleTest.waitForExplicitFinish(); 21 22 function run() 23 { 24 is(Object.isExtensible(window), true, "Windows are extensible by default"); 25 26 try 27 { 28 Object.preventExtensions(window); 29 throw "didn't throw"; 30 } 31 catch (e) 32 { 33 is(e instanceof TypeError, true, 34 "preventExtensions(window) should throw a TypeError, instead got: " + e); 35 is(Object.isExtensible(window), true, 36 'Windows are extensible after an extensibility "change" attempt'); 37 } 38 39 SimpleTest.finish(); 40 } 41 42 window.addEventListener("load", run); 43 </script> 44 </pre> 45 </body> 46 </html>