b=450088 backing out (new reftest failed)
[wine-gecko.git] / testing / mochitest / tests / test_bug172261.html
blobd47de4159b929853dc17c90708b9dea8c4ed3461
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=172261
5 -->
6 <head>
7 <title>Test for Bug 172261</title>
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="text/javascript" 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=172261">Mozilla Bug 172261</a>
14 <p id="display">
15 <iframe id="test"></iframe>
16 </p>
17 <div id="content" style="display: none">
19 </div>
20 <pre id="test">
21 <script class="testbody" type="text/javascript">
22 /** Test for Bug 172261 **/
23 SimpleTest.waitForExplicitFinish();
25 var callable = false;
26 function toggleCallable() { callable = true; }
28 var doTestInIframe = false;
30 // Shouldn't do history stuff from inside onload
31 addLoadEvent(function() { setTimeout(startTest, 10) });
33 function startTest() {
34 // First, create a dummy document. Use onunload handlers to make sure
35 // bfcache doesn't screw us up.
36 var doc = $("test").contentDocument;
38 doc.write("<html><body onunload=''>First</body></html>");
39 doc.close();
41 // Now write our test document
42 doc.write("<html><script>window.onerror = parent.onerror; if (parent.doTestInIframe) { parent.is(document.domain, parent.document.domain, 'Domains should match'); parent.toggleCallable(); } <" + "/script><body>Second</body></html>");
43 doc.close();
45 $("test").onload = goForward;
46 history.back();
49 function goForward() {
50 $("test").onload = doTest;
51 doTestInIframe = true;
52 history.forward();
55 function doTest() {
56 is($("test").contentDocument.domain, document.domain,
57 "Domains should match 2");
58 // Make that into an is() once bug 269270 is fixed.
59 todo($("test").contentDocument.location.href == location.href,
60 "Locations should match");
61 is(callable, true, "Subframe should be able to call us");
62 SimpleTest.finish();
64 </script>
65 </pre>
66 </body>
67 </html>