Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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 | } |