4 https://bugzilla.mozilla.org/show_bug.cgi?id=172261
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" />
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=172261">Mozilla Bug
172261</a>
15 <iframe id=
"test"></iframe>
17 <div id=
"content" style=
"display: none">
21 <script class=
"testbody" type=
"text/javascript">
22 /** Test for Bug
172261 **/
23 SimpleTest.waitForExplicitFinish();
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>");
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>");
45 $("test").onload
= goForward
;
49 function goForward() {
50 $("test").onload
= doTest
;
51 doTestInIframe
= true;
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");