4 https://bugzilla.mozilla.org/show_bug.cgi?id=509055
7 <title>Test for Bug
509055</title>
8 <script type=
"application/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <script type=
"application/javascript" src=
"/tests/SimpleTest/EventUtils.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=509055">Mozilla Bug
509055</a>
15 <div id=
"status"></div>
19 <script type=
"application/javascript;version=1.7">
21 /** Test for Bug
509055 **/
23 SimpleTest.waitForExplicitFinish();
27 function shortWait() {
28 setTimeout(function() { gGen.next(); },
0, false);
31 function onChildHashchange(e) {
32 // gGen might be undefined when we refresh the page, so we have to check here
33 dump(
"onChildHashchange() called.\n");
38 function onChildLoad(e) {
44 var popup = window.open(
"file_bug509055.html",
"popup 0",
45 "height=200,width=200,location=yes," +
46 "menubar=yes,status=yes,toolbar=yes,dependent=yes");
47 popup.hashchangeCallback = onChildHashchange;
48 popup.onload = onChildLoad;
49 dump('Waiting for initial load.\n');
52 // Without this wait, the change to location.hash below doesn't create a
53 // SHEntry or enable the back button.
55 dump('Got initial load. Spinning event loop.\n');
58 popup.location.hash =
"#1";
59 dump('Waiting for hashchange.\n');
63 dump('Waiting for second hashchange.\n');
64 yield undefined; // wait for hashchange
66 popup.document.title =
"Changed";
68 // Wait for listeners to be notified of the title change.
70 dump('Got second hashchange. Spinning event loop.\n');
73 var sh = SpecialPowers.wrap(popup)
74 .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
75 .getInterface(SpecialPowers.Ci.nsIWebNavigation)
78 // Get the title of the inner popup's current SHEntry
79 var sheTitle = sh.getEntryAtIndex(sh.index, false).title;
80 is(sheTitle,
"Changed",
"SHEntry's title should change when we change.");
84 SimpleTest.executeSoon(SimpleTest.finish);
85 dump('Final yield.\n');
89 window.addEventListener('load', function() {