Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | function test() { |
michael@0 | 5 | waitForExplicitFinish(); |
michael@0 | 6 | |
michael@0 | 7 | let newTab = gBrowser.loadOneTab("http://www.example.com/#1", |
michael@0 | 8 | { inBackground: false }); |
michael@0 | 9 | |
michael@0 | 10 | // The executeSoon() call is really needed here because there's callback |
michael@0 | 11 | // waiting to be fired after gBrowser.loadOneTab(). After that the browser is |
michael@0 | 12 | // in a state where loadURI() will create a new entry in the session history |
michael@0 | 13 | // (that is vital for back/forward functionality). |
michael@0 | 14 | afterAllTabsLoaded(function() { |
michael@0 | 15 | executeSoon(function() { |
michael@0 | 16 | ok(!newTab.linkedBrowser.canGoBack, |
michael@0 | 17 | "Browser should not be able to go back in history"); |
michael@0 | 18 | |
michael@0 | 19 | newTab.linkedBrowser.loadURI("http://www.example.com/#2"); |
michael@0 | 20 | |
michael@0 | 21 | afterAllTabsLoaded(function() { |
michael@0 | 22 | ok(newTab.linkedBrowser.canGoBack, |
michael@0 | 23 | "Browser can go back in history after loading another URL"); |
michael@0 | 24 | |
michael@0 | 25 | showTabView(function() { |
michael@0 | 26 | let contentWindow = document.getElementById("tab-view").contentWindow; |
michael@0 | 27 | |
michael@0 | 28 | EventUtils.synthesizeKey("VK_BACK_SPACE", { type: "keyup" }, contentWindow); |
michael@0 | 29 | |
michael@0 | 30 | // check after a delay |
michael@0 | 31 | executeSoon(function() { |
michael@0 | 32 | ok(newTab.linkedBrowser.canGoBack, |
michael@0 | 33 | "Browser can still go back in history"); |
michael@0 | 34 | |
michael@0 | 35 | hideTabView(function() { |
michael@0 | 36 | gBrowser.removeTab(newTab); |
michael@0 | 37 | finish(); |
michael@0 | 38 | }); |
michael@0 | 39 | }); |
michael@0 | 40 | }); |
michael@0 | 41 | }); |
michael@0 | 42 | }); |
michael@0 | 43 | }); |
michael@0 | 44 | } |
michael@0 | 45 |