diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:00:38 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:00:38 -0500 |
commit | 8148615da179fdd60f19018e13b4e94b95609cc6 (patch) | |
tree | 771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/components/sessionstore/test/browser_636279.js | |
parent | 494802c1be7888025b95260d23db187467d2b9dd (diff) | |
download | UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.gz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.lz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.xz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.zip |
Remove browser tests - Part 1: The Tests (except for experiments)
Diffstat (limited to 'browser/components/sessionstore/test/browser_636279.js')
-rw-r--r-- | browser/components/sessionstore/test/browser_636279.js | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/browser/components/sessionstore/test/browser_636279.js b/browser/components/sessionstore/test/browser_636279.js deleted file mode 100644 index 250995606..000000000 --- a/browser/components/sessionstore/test/browser_636279.js +++ /dev/null @@ -1,101 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -var stateBackup = ss.getBrowserState(); - -var statePinned = {windows:[{tabs:[ - {entries:[{url:"http://example.com#1"}], pinned: true} -]}]}; - -var state = {windows:[{tabs:[ - {entries:[{url:"http://example.com#1"}]}, - {entries:[{url:"http://example.com#2"}]}, - {entries:[{url:"http://example.com#3"}]}, - {entries:[{url:"http://example.com#4"}]}, -]}]}; - -function test() { - waitForExplicitFinish(); - - registerCleanupFunction(function () { - TabsProgressListener.uninit(); - ss.setBrowserState(stateBackup); - }); - - - TabsProgressListener.init(); - - window.addEventListener("SSWindowStateReady", function onReady() { - window.removeEventListener("SSWindowStateReady", onReady, false); - - let firstProgress = true; - - TabsProgressListener.setCallback(function (needsRestore, isRestoring) { - if (firstProgress) { - firstProgress = false; - is(isRestoring, 3, "restoring 3 tabs concurrently"); - } else { - ok(isRestoring <= 3, "restoring max. 2 tabs concurrently"); - } - - if (0 == needsRestore) { - TabsProgressListener.unsetCallback(); - waitForFocus(finish); - } - }); - - ss.setBrowserState(JSON.stringify(state)); - }, false); - - ss.setBrowserState(JSON.stringify(statePinned)); -} - -function countTabs() { - let needsRestore = 0, isRestoring = 0; - let windowsEnum = Services.wm.getEnumerator("navigator:browser"); - - while (windowsEnum.hasMoreElements()) { - let window = windowsEnum.getNext(); - if (window.closed) - continue; - - for (let i = 0; i < window.gBrowser.tabs.length; i++) { - let browser = window.gBrowser.tabs[i].linkedBrowser; - if (browser.__SS_restoreState == TAB_STATE_RESTORING) - isRestoring++; - else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE) - needsRestore++; - } - } - - return [needsRestore, isRestoring]; -} - -var TabsProgressListener = { - init: function () { - Services.obs.addObserver(this, "sessionstore-debug-tab-restored", false); - }, - - uninit: function () { - Services.obs.removeObserver(this, "sessionstore-debug-tab-restored"); - this.unsetCallback(); - }, - - setCallback: function (callback) { - this.callback = callback; - }, - - unsetCallback: function () { - delete this.callback; - }, - - observe: function (browser, topic, data) { - TabsProgressListener.onRestored(browser); - }, - - onRestored: function (browser) { - if (this.callback && browser.__SS_restoreState == TAB_STATE_RESTORING) { - this.callback.apply(null, countTabs()); - } - } -} |