diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /browser/components/sessionstore/test/browser_586147.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/components/sessionstore/test/browser_586147.js')
-rw-r--r-- | browser/components/sessionstore/test/browser_586147.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_586147.js b/browser/components/sessionstore/test/browser_586147.js new file mode 100644 index 000000000..fbfec53c7 --- /dev/null +++ b/browser/components/sessionstore/test/browser_586147.js @@ -0,0 +1,52 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +function observeOneRestore(callback) { + let topic = "sessionstore-browser-state-restored"; + Services.obs.addObserver(function onRestore() { + Services.obs.removeObserver(onRestore, topic); + callback(); + }, topic, false); +}; + +function test() { + waitForExplicitFinish(); + + // There should be one tab when we start the test + let [origTab] = gBrowser.visibleTabs; + let hiddenTab = gBrowser.addTab(); + + is(gBrowser.visibleTabs.length, 2, "should have 2 tabs before hiding"); + gBrowser.showOnlyTheseTabs([origTab]); + is(gBrowser.visibleTabs.length, 1, "only 1 after hiding"); + ok(hiddenTab.hidden, "sanity check that it's hidden"); + + let extraTab = gBrowser.addTab(); + let state = ss.getBrowserState(); + let stateObj = JSON.parse(state); + let tabs = stateObj.windows[0].tabs; + is(tabs.length, 3, "just checking that browser state is correct"); + ok(!tabs[0].hidden, "first tab is visible"); + ok(tabs[1].hidden, "second is hidden"); + ok(!tabs[2].hidden, "third is visible"); + + // Make the third tab hidden and then restore the modified state object + tabs[2].hidden = true; + + observeOneRestore(function() { + let testWindow = Services.wm.getEnumerator("navigator:browser").getNext(); + is(testWindow.gBrowser.visibleTabs.length, 1, "only restored 1 visible tab"); + let tabs = testWindow.gBrowser.tabs; + ok(!tabs[0].hidden, "first is still visible"); + ok(tabs[1].hidden, "second tab is still hidden"); + ok(tabs[2].hidden, "third tab is now hidden"); + + // Restore the original state and clean up now that we're done + gBrowser.removeTab(hiddenTab); + gBrowser.removeTab(extraTab); + + finish(); + }); + ss.setBrowserState(JSON.stringify(stateObj)); +} |