dom/tests/mochitest/bugs/test_bug684544.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:23e584509d1d
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>

mercurial