michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function test() { michael@0: /** Test for Bug 367052 **/ michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: // make sure that the next closed tab will increase getClosedTabCount michael@0: let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo"); michael@0: gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1); michael@0: let closedTabCount = ss.getClosedTabCount(window); michael@0: michael@0: // restore a blank tab michael@0: let tab = gBrowser.addTab("about:"); michael@0: whenBrowserLoaded(tab.linkedBrowser, function() { michael@0: let history = tab.linkedBrowser.webNavigation.sessionHistory; michael@0: ok(history.count >= 1, "the new tab does have at least one history entry"); michael@0: michael@0: ss.setTabState(tab, JSON.stringify({ entries: [] })); michael@0: whenTabRestored(tab, function() { michael@0: ok(history.count == 0, "the tab was restored without any history whatsoever"); michael@0: michael@0: gBrowser.removeTab(tab); michael@0: ok(ss.getClosedTabCount(window) == closedTabCount, michael@0: "The closed blank tab wasn't added to Recently Closed Tabs"); michael@0: michael@0: // clean up michael@0: if (gPrefService.prefHasUserValue("browser.sessionstore.max_tabs_undo")) michael@0: gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo"); michael@0: finish(); michael@0: }); michael@0: }); michael@0: }