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.
1 function test() {
2 waitForExplicitFinish();
4 loadAndWait("data:text/plain,1", function () {
5 loadAndWait("data:text/plain,2", function () {
6 loadAndWait("data:text/plain,3", runTests);
7 });
8 });
9 }
11 function runTests() {
12 duplicate(0, "maintained the original index", function () {
13 gBrowser.removeCurrentTab();
15 duplicate(-1, "went back", function () {
16 duplicate(1, "went forward", function () {
17 gBrowser.removeCurrentTab();
18 gBrowser.removeCurrentTab();
19 gBrowser.addTab();
20 gBrowser.removeCurrentTab();
21 finish();
22 });
23 });
24 });
25 }
27 function duplicate(delta, msg, cb) {
28 var start = gBrowser.sessionHistory.index;
30 duplicateTabIn(gBrowser.selectedTab, "tab", delta);
31 let tab = gBrowser.selectedTab;
33 tab.addEventListener("SSTabRestored", function tabRestoredListener() {
34 tab.removeEventListener("SSTabRestored", tabRestoredListener, false);
35 is(gBrowser.sessionHistory.index, start + delta, msg);
36 executeSoon(cb);
37 }, false);
38 }
40 function loadAndWait(url, cb) {
41 gBrowser.selectedBrowser.addEventListener("load", function () {
42 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
43 executeSoon(cb);
44 }, true);
46 gBrowser.loadURI(url);
47 }