browser/components/sessionstore/test/browser_581937.js

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

mercurial