browser/components/sessionstore/test/browser_581937.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/sessionstore/test/browser_581937.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +// Tests that an about:blank tab with no history will not be saved into
     1.9 +// session store and thus, it will not show up in Recently Closed Tabs.
    1.10 +
    1.11 +let tab;
    1.12 +function test() {
    1.13 +  waitForExplicitFinish();
    1.14 +
    1.15 +  gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", 0);
    1.16 +  gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
    1.17 +
    1.18 +  is(ss.getClosedTabCount(window), 0, "should be no closed tabs");
    1.19 +
    1.20 +  gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
    1.21 +
    1.22 +  tab = gBrowser.addTab();
    1.23 +}
    1.24 +
    1.25 +function onTabOpen(aEvent) {
    1.26 +  gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
    1.27 +
    1.28 +  // Let other listeners react to the TabOpen event before removing the tab.
    1.29 +  executeSoon(function() {
    1.30 +    is(gBrowser.browsers[1].currentURI.spec, "about:blank",
    1.31 +       "we will be removing an about:blank tab");
    1.32 +
    1.33 +    gBrowser.removeTab(tab);
    1.34 +
    1.35 +    is(ss.getClosedTabCount(window), 0, "should still be no closed tabs");
    1.36 +
    1.37 +    executeSoon(finish);
    1.38 +  });
    1.39 +}

mercurial