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 | var runs = [ |
michael@0 | 2 | function (win, tabbrowser, tab) { |
michael@0 | 3 | is(tabbrowser.browsers.length, 2, "test_bug462673.html has opened a second tab"); |
michael@0 | 4 | is(tabbrowser.selectedTab, tab.nextSibling, "dependent tab is selected"); |
michael@0 | 5 | tabbrowser.removeTab(tab); |
michael@0 | 6 | // Closing a tab will also close its parent chrome window, but async |
michael@0 | 7 | executeSoon(function() { |
michael@0 | 8 | ok(win.closed, "Window is closed"); |
michael@0 | 9 | testComplete(win); |
michael@0 | 10 | }); |
michael@0 | 11 | }, |
michael@0 | 12 | function (win, tabbrowser, tab) { |
michael@0 | 13 | var newTab = tabbrowser.addTab(); |
michael@0 | 14 | var newBrowser = newTab.linkedBrowser; |
michael@0 | 15 | tabbrowser.removeTab(tab); |
michael@0 | 16 | ok(!win.closed, "Window stays open"); |
michael@0 | 17 | if (!win.closed) { |
michael@0 | 18 | is(tabbrowser.tabContainer.childElementCount, 1, "Window has one tab"); |
michael@0 | 19 | is(tabbrowser.browsers.length, 1, "Window has one browser"); |
michael@0 | 20 | is(tabbrowser.selectedTab, newTab, "Remaining tab is selected"); |
michael@0 | 21 | is(tabbrowser.selectedBrowser, newBrowser, "Browser for remaining tab is selected"); |
michael@0 | 22 | is(tabbrowser.mTabBox.selectedPanel, newBrowser.parentNode.parentNode.parentNode.parentNode, "Panel for remaining tab is selected"); |
michael@0 | 23 | } |
michael@0 | 24 | testComplete(win); |
michael@0 | 25 | } |
michael@0 | 26 | ]; |
michael@0 | 27 | |
michael@0 | 28 | function test() { |
michael@0 | 29 | waitForExplicitFinish(); |
michael@0 | 30 | runOneTest(); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function testComplete(win) { |
michael@0 | 34 | win.close(); |
michael@0 | 35 | if (runs.length) |
michael@0 | 36 | runOneTest(); |
michael@0 | 37 | else |
michael@0 | 38 | finish(); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function runOneTest() { |
michael@0 | 42 | var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no"); |
michael@0 | 43 | |
michael@0 | 44 | win.addEventListener("load", function () { |
michael@0 | 45 | win.removeEventListener("load", arguments.callee, false); |
michael@0 | 46 | |
michael@0 | 47 | var tab = win.gBrowser.tabContainer.firstChild; |
michael@0 | 48 | var browser = tab.linkedBrowser; |
michael@0 | 49 | |
michael@0 | 50 | browser.addEventListener("load", function () { |
michael@0 | 51 | browser.removeEventListener("load", arguments.callee, true); |
michael@0 | 52 | |
michael@0 | 53 | executeSoon(function () { |
michael@0 | 54 | runs.shift()(win, win.gBrowser, tab); |
michael@0 | 55 | }); |
michael@0 | 56 | }, true); |
michael@0 | 57 | |
michael@0 | 58 | var rootDir = getRootDirectory(gTestPath); |
michael@0 | 59 | browser.contentWindow.location = rootDir + "test_bug462673.html" |
michael@0 | 60 | }, false); |
michael@0 | 61 | } |