browser/components/sessionstore/test/browser_581937.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 // Tests that an about:blank tab with no history will not be saved into
michael@0 6 // session store and thus, it will not show up in Recently Closed Tabs.
michael@0 7
michael@0 8 let tab;
michael@0 9 function test() {
michael@0 10 waitForExplicitFinish();
michael@0 11
michael@0 12 gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", 0);
michael@0 13 gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
michael@0 14
michael@0 15 is(ss.getClosedTabCount(window), 0, "should be no closed tabs");
michael@0 16
michael@0 17 gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
michael@0 18
michael@0 19 tab = gBrowser.addTab();
michael@0 20 }
michael@0 21
michael@0 22 function onTabOpen(aEvent) {
michael@0 23 gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
michael@0 24
michael@0 25 // Let other listeners react to the TabOpen event before removing the tab.
michael@0 26 executeSoon(function() {
michael@0 27 is(gBrowser.browsers[1].currentURI.spec, "about:blank",
michael@0 28 "we will be removing an about:blank tab");
michael@0 29
michael@0 30 gBrowser.removeTab(tab);
michael@0 31
michael@0 32 is(ss.getClosedTabCount(window), 0, "should still be no closed tabs");
michael@0 33
michael@0 34 executeSoon(finish);
michael@0 35 });
michael@0 36 }

mercurial