browser/components/sessionstore/test/browser_367052.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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 function test() {
michael@0 6 /** Test for Bug 367052 **/
michael@0 7
michael@0 8 waitForExplicitFinish();
michael@0 9
michael@0 10 // make sure that the next closed tab will increase getClosedTabCount
michael@0 11 let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo");
michael@0 12 gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
michael@0 13 let closedTabCount = ss.getClosedTabCount(window);
michael@0 14
michael@0 15 // restore a blank tab
michael@0 16 let tab = gBrowser.addTab("about:");
michael@0 17 whenBrowserLoaded(tab.linkedBrowser, function() {
michael@0 18 let history = tab.linkedBrowser.webNavigation.sessionHistory;
michael@0 19 ok(history.count >= 1, "the new tab does have at least one history entry");
michael@0 20
michael@0 21 ss.setTabState(tab, JSON.stringify({ entries: [] }));
michael@0 22 whenTabRestored(tab, function() {
michael@0 23 ok(history.count == 0, "the tab was restored without any history whatsoever");
michael@0 24
michael@0 25 gBrowser.removeTab(tab);
michael@0 26 ok(ss.getClosedTabCount(window) == closedTabCount,
michael@0 27 "The closed blank tab wasn't added to Recently Closed Tabs");
michael@0 28
michael@0 29 // clean up
michael@0 30 if (gPrefService.prefHasUserValue("browser.sessionstore.max_tabs_undo"))
michael@0 31 gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
michael@0 32 finish();
michael@0 33 });
michael@0 34 });
michael@0 35 }

mercurial