Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=509055 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 509055</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=509055">Mozilla Bug 509055</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="status"></div> |
michael@0 | 16 | <div id="content"> |
michael@0 | 17 | </div> |
michael@0 | 18 | <pre id="test"> |
michael@0 | 19 | <script type="application/javascript;version=1.7"> |
michael@0 | 20 | |
michael@0 | 21 | /** Test for Bug 509055 **/ |
michael@0 | 22 | |
michael@0 | 23 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 24 | |
michael@0 | 25 | var gGen; |
michael@0 | 26 | |
michael@0 | 27 | function shortWait() { |
michael@0 | 28 | setTimeout(function() { gGen.next(); }, 0, false); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | function onChildHashchange(e) { |
michael@0 | 32 | // gGen might be undefined when we refresh the page, so we have to check here |
michael@0 | 33 | dump("onChildHashchange() called.\n"); |
michael@0 | 34 | if(gGen) |
michael@0 | 35 | gGen.next(); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function onChildLoad(e) { |
michael@0 | 39 | if(gGen) |
michael@0 | 40 | gGen.next(); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | function runTest() { |
michael@0 | 44 | var popup = window.open("file_bug509055.html", "popup 0", |
michael@0 | 45 | "height=200,width=200,location=yes," + |
michael@0 | 46 | "menubar=yes,status=yes,toolbar=yes,dependent=yes"); |
michael@0 | 47 | popup.hashchangeCallback = onChildHashchange; |
michael@0 | 48 | popup.onload = onChildLoad; |
michael@0 | 49 | dump('Waiting for initial load.\n'); |
michael@0 | 50 | yield undefined; |
michael@0 | 51 | |
michael@0 | 52 | // Without this wait, the change to location.hash below doesn't create a |
michael@0 | 53 | // SHEntry or enable the back button. |
michael@0 | 54 | shortWait(); |
michael@0 | 55 | dump('Got initial load. Spinning event loop.\n'); |
michael@0 | 56 | yield undefined; |
michael@0 | 57 | |
michael@0 | 58 | popup.location.hash = "#1"; |
michael@0 | 59 | dump('Waiting for hashchange.\n'); |
michael@0 | 60 | yield undefined; |
michael@0 | 61 | |
michael@0 | 62 | popup.history.back(); |
michael@0 | 63 | dump('Waiting for second hashchange.\n'); |
michael@0 | 64 | yield undefined; // wait for hashchange |
michael@0 | 65 | |
michael@0 | 66 | popup.document.title = "Changed"; |
michael@0 | 67 | |
michael@0 | 68 | // Wait for listeners to be notified of the title change. |
michael@0 | 69 | shortWait(); |
michael@0 | 70 | dump('Got second hashchange. Spinning event loop.\n'); |
michael@0 | 71 | yield undefined; |
michael@0 | 72 | |
michael@0 | 73 | var sh = SpecialPowers.wrap(popup) |
michael@0 | 74 | .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor) |
michael@0 | 75 | .getInterface(SpecialPowers.Ci.nsIWebNavigation) |
michael@0 | 76 | .sessionHistory; |
michael@0 | 77 | |
michael@0 | 78 | // Get the title of the inner popup's current SHEntry |
michael@0 | 79 | var sheTitle = sh.getEntryAtIndex(sh.index, false).title; |
michael@0 | 80 | is(sheTitle, "Changed", "SHEntry's title should change when we change."); |
michael@0 | 81 | |
michael@0 | 82 | popup.close(); |
michael@0 | 83 | |
michael@0 | 84 | SimpleTest.executeSoon(SimpleTest.finish); |
michael@0 | 85 | dump('Final yield.\n'); |
michael@0 | 86 | yield undefined; |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | window.addEventListener('load', function() { |
michael@0 | 90 | gGen = runTest(); |
michael@0 | 91 | gGen.next(); |
michael@0 | 92 | }, false); |
michael@0 | 93 | |
michael@0 | 94 | </script> |
michael@0 | 95 | |
michael@0 | 96 | </body> |
michael@0 | 97 | </html> |
michael@0 | 98 |