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 | test_tab("about:blank"); |
michael@0 | 6 | test_tab("about:license"); |
michael@0 | 7 | } |
michael@0 | 8 | |
michael@0 | 9 | function test_tab(url) { |
michael@0 | 10 | let originalTab = gBrowser.selectedTab; |
michael@0 | 11 | let newTab = gBrowser.addTab(url, {skipAnimation: true}); |
michael@0 | 12 | is(tabIsActive(newTab), false, "newly added " + url + " tab is not active"); |
michael@0 | 13 | is(tabIsActive(originalTab), true, "original tab is active initially"); |
michael@0 | 14 | |
michael@0 | 15 | gBrowser.selectedTab = newTab; |
michael@0 | 16 | is(tabIsActive(newTab), true, "newly added " + url + " tab is active after selection"); |
michael@0 | 17 | is(tabIsActive(originalTab), false, "original tab is not active while unselected"); |
michael@0 | 18 | |
michael@0 | 19 | gBrowser.selectedTab = originalTab; |
michael@0 | 20 | is(tabIsActive(newTab), false, "newly added " + url + " tab is not active after switch back"); |
michael@0 | 21 | is(tabIsActive(originalTab), true, "original tab is active again after switch back"); |
michael@0 | 22 | |
michael@0 | 23 | gBrowser.removeTab(newTab); |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | function tabIsActive(tab) { |
michael@0 | 27 | let browser = tab.linkedBrowser; |
michael@0 | 28 | return browser.docShell.isActive; |
michael@0 | 29 | } |