1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/bugs/test_bug684544.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id= 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug </title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 + 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script type="application/javascript"> 1.22 + 1.23 +/** Test for Bug **/ 1.24 + 1.25 +var f = document.createElement("iframe"); 1.26 +document.body.appendChild(f); 1.27 +var win = f.contentWindow; 1.28 + 1.29 +// Set location once to make sure it's resolved 1.30 +win.location = "data:text/html,1"; 1.31 + 1.32 +// Now try to make the location object go away. 1.33 +f.parentNode.removeChild(f); 1.34 + 1.35 +// Check that location is now null. If it's not, the test needs changing 1.36 +// (e.g. to use window.close() so that it's null). 1.37 +is("location" in win, true, "Should still have a location property"); 1.38 +is(win.location, null, "There should be no location object now"); 1.39 + 1.40 +// Just set the location. This should not crash but throw an exception. 1.41 +var noException; 1.42 +try { 1.43 + win.location = "data:text/html,2"; 1.44 + noException = true; 1.45 +} 1.46 +catch(e) { 1.47 + noException = false; 1.48 +} 1.49 +todo(noException, "Shouldn't throw when setting location."); 1.50 + 1.51 +// And check that we didn't override the slot in the process. 1.52 +is(typeof(win.location), "object", "Location should not have become a string"); 1.53 +is(win.location, null, 1.54 + "There should be no location object for real after the set"); 1.55 + 1.56 +</script> 1.57 +</pre> 1.58 +</body> 1.59 +</html>