browser/components/sessionstore/test/browser_367052.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.

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

mercurial