Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | function test() { |
michael@0 | 2 | waitForExplicitFinish(); |
michael@0 | 3 | |
michael@0 | 4 | loadAndWait("data:text/plain,1", function () { |
michael@0 | 5 | loadAndWait("data:text/plain,2", function () { |
michael@0 | 6 | loadAndWait("data:text/plain,3", runTests); |
michael@0 | 7 | }); |
michael@0 | 8 | }); |
michael@0 | 9 | } |
michael@0 | 10 | |
michael@0 | 11 | function runTests() { |
michael@0 | 12 | duplicate(0, "maintained the original index", function () { |
michael@0 | 13 | gBrowser.removeCurrentTab(); |
michael@0 | 14 | |
michael@0 | 15 | duplicate(-1, "went back", function () { |
michael@0 | 16 | duplicate(1, "went forward", function () { |
michael@0 | 17 | gBrowser.removeCurrentTab(); |
michael@0 | 18 | gBrowser.removeCurrentTab(); |
michael@0 | 19 | gBrowser.addTab(); |
michael@0 | 20 | gBrowser.removeCurrentTab(); |
michael@0 | 21 | finish(); |
michael@0 | 22 | }); |
michael@0 | 23 | }); |
michael@0 | 24 | }); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function duplicate(delta, msg, cb) { |
michael@0 | 28 | var start = gBrowser.sessionHistory.index; |
michael@0 | 29 | |
michael@0 | 30 | duplicateTabIn(gBrowser.selectedTab, "tab", delta); |
michael@0 | 31 | let tab = gBrowser.selectedTab; |
michael@0 | 32 | |
michael@0 | 33 | tab.addEventListener("SSTabRestored", function tabRestoredListener() { |
michael@0 | 34 | tab.removeEventListener("SSTabRestored", tabRestoredListener, false); |
michael@0 | 35 | is(gBrowser.sessionHistory.index, start + delta, msg); |
michael@0 | 36 | executeSoon(cb); |
michael@0 | 37 | }, false); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | function loadAndWait(url, cb) { |
michael@0 | 41 | gBrowser.selectedBrowser.addEventListener("load", function () { |
michael@0 | 42 | gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); |
michael@0 | 43 | executeSoon(cb); |
michael@0 | 44 | }, true); |
michael@0 | 45 | |
michael@0 | 46 | gBrowser.loadURI(url); |
michael@0 | 47 | } |