|
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 function test() { |
|
6 /** Test for Bug 367052 **/ |
|
7 |
|
8 waitForExplicitFinish(); |
|
9 |
|
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); |
|
14 |
|
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"); |
|
20 |
|
21 ss.setTabState(tab, JSON.stringify({ entries: [] })); |
|
22 whenTabRestored(tab, function() { |
|
23 ok(history.count == 0, "the tab was restored without any history whatsoever"); |
|
24 |
|
25 gBrowser.removeTab(tab); |
|
26 ok(ss.getClosedTabCount(window) == closedTabCount, |
|
27 "The closed blank tab wasn't added to Recently Closed Tabs"); |
|
28 |
|
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 } |