michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: let newTab = gBrowser.loadOneTab("http://www.example.com/#1", michael@0: { inBackground: false }); michael@0: michael@0: // The executeSoon() call is really needed here because there's callback michael@0: // waiting to be fired after gBrowser.loadOneTab(). After that the browser is michael@0: // in a state where loadURI() will create a new entry in the session history michael@0: // (that is vital for back/forward functionality). michael@0: afterAllTabsLoaded(function() { michael@0: executeSoon(function() { michael@0: ok(!newTab.linkedBrowser.canGoBack, michael@0: "Browser should not be able to go back in history"); michael@0: michael@0: newTab.linkedBrowser.loadURI("http://www.example.com/#2"); michael@0: michael@0: afterAllTabsLoaded(function() { michael@0: ok(newTab.linkedBrowser.canGoBack, michael@0: "Browser can go back in history after loading another URL"); michael@0: michael@0: showTabView(function() { michael@0: let contentWindow = document.getElementById("tab-view").contentWindow; michael@0: michael@0: EventUtils.synthesizeKey("VK_BACK_SPACE", { type: "keyup" }, contentWindow); michael@0: michael@0: // check after a delay michael@0: executeSoon(function() { michael@0: ok(newTab.linkedBrowser.canGoBack, michael@0: "Browser can still go back in history"); michael@0: michael@0: hideTabView(function() { michael@0: gBrowser.removeTab(newTab); michael@0: finish(); michael@0: }); michael@0: }); michael@0: }); michael@0: }); michael@0: }); michael@0: }); michael@0: } michael@0: