test_bug684544.html (1477B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id= 5 --> 6 <head> 7 <title>Test for Bug </title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug */ 21 22 var f = document.createElement("iframe"); 23 document.body.appendChild(f); 24 var win = f.contentWindow; 25 26 // Set location once to make sure it's resolved 27 win.location = "data:text/html,1"; 28 29 // Now try to make the location object go away. 30 f.remove(); 31 32 // Check that location is now null. If it's not, the test needs changing 33 // (e.g. to use window.close() so that it's null). 34 is("location" in win, true, "Should still have a location property"); 35 ok(!!win.location, "Location should not be null"); 36 37 // Just set the location. This should not crash but throw an exception. 38 var noException; 39 try { 40 win.location = "data:text/html,2"; 41 noException = true; 42 } catch(e) { 43 noException = false; 44 } 45 ok(noException, "Shouldn't throw when setting location."); 46 47 // And check that we didn't override the slot in the process. 48 is(typeof(win.location), "object", "Location should not have become a string"); 49 ok(!!win.location, "Location should not be null"); 50 51 </script> 52 </pre> 53 </body> 54 </html>