1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_bug724239.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,33 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +function test() { 1.8 + waitForExplicitFinish(); 1.9 + BrowserOpenTab(); 1.10 + 1.11 + let tab = gBrowser.selectedTab; 1.12 + let browser = tab.linkedBrowser; 1.13 + 1.14 + registerCleanupFunction(function () { gBrowser.removeTab(tab); }); 1.15 + 1.16 + whenBrowserLoaded(browser, function () { 1.17 + browser.loadURI("http://example.com/"); 1.18 + 1.19 + whenBrowserLoaded(browser, function () { 1.20 + ok(!gBrowser.canGoBack, "about:newtab wasn't added to the session history"); 1.21 + finish(); 1.22 + }); 1.23 + }); 1.24 +} 1.25 + 1.26 +function whenBrowserLoaded(aBrowser, aCallback) { 1.27 + if (aBrowser.contentDocument.readyState == "complete") { 1.28 + executeSoon(aCallback); 1.29 + return; 1.30 + } 1.31 + 1.32 + aBrowser.addEventListener("load", function onLoad() { 1.33 + aBrowser.removeEventListener("load", onLoad, true); 1.34 + executeSoon(aCallback); 1.35 + }, true); 1.36 +}