1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/sessionstore/test/browser_367052.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 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 +function test() { 1.9 + /** Test for Bug 367052 **/ 1.10 + 1.11 + waitForExplicitFinish(); 1.12 + 1.13 + // make sure that the next closed tab will increase getClosedTabCount 1.14 + let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo"); 1.15 + gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1); 1.16 + let closedTabCount = ss.getClosedTabCount(window); 1.17 + 1.18 + // restore a blank tab 1.19 + let tab = gBrowser.addTab("about:"); 1.20 + whenBrowserLoaded(tab.linkedBrowser, function() { 1.21 + let history = tab.linkedBrowser.webNavigation.sessionHistory; 1.22 + ok(history.count >= 1, "the new tab does have at least one history entry"); 1.23 + 1.24 + ss.setTabState(tab, JSON.stringify({ entries: [] })); 1.25 + whenTabRestored(tab, function() { 1.26 + ok(history.count == 0, "the tab was restored without any history whatsoever"); 1.27 + 1.28 + gBrowser.removeTab(tab); 1.29 + ok(ss.getClosedTabCount(window) == closedTabCount, 1.30 + "The closed blank tab wasn't added to Recently Closed Tabs"); 1.31 + 1.32 + // clean up 1.33 + if (gPrefService.prefHasUserValue("browser.sessionstore.max_tabs_undo")) 1.34 + gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo"); 1.35 + finish(); 1.36 + }); 1.37 + }); 1.38 +}