|
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 type="application/javascript" 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.parentNode.removeChild(f); |
|
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 is(win.location, null, "There should be no location object now"); |
|
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 } |
|
43 catch(e) { |
|
44 noException = false; |
|
45 } |
|
46 todo(noException, "Shouldn't throw when setting location."); |
|
47 |
|
48 // And check that we didn't override the slot in the process. |
|
49 is(typeof(win.location), "object", "Location should not have become a string"); |
|
50 is(win.location, null, |
|
51 "There should be no location object for real after the set"); |
|
52 |
|
53 </script> |
|
54 </pre> |
|
55 </body> |
|
56 </html> |