Bug 579879 - Correctly restore pinned tabs to their original position. r=dietrich

This commit is contained in:
Dão Gottwald 2010-07-20 19:36:26 +02:00
parent 416077bdb2
commit 861343537c
3 changed files with 25 additions and 3 deletions

View File

@ -1015,12 +1015,12 @@ SessionStoreService.prototype = {
// create a new tab
let browser = aWindow.gBrowser;
let tab = browser.addTab();
// restore the tab's position
browser.moveTabTo(tab, closedTab.pos);
// restore tab content
this.restoreHistoryPrecursor(aWindow, [tab], [closedTabState], 1, 0, 0);
// restore the tab's position
browser.moveTabTo(tab, closedTab.pos);
// focus the tab's content area
let content = browser.getBrowserForTab(tab).contentWindow;

View File

@ -114,6 +114,7 @@ _BROWSER_TEST_FILES = \
browser_522545.js \
browser_524745.js \
browser_528776.js \
browser_579879.js \
$(NULL)
libs:: $(_BROWSER_TEST_FILES)

View File

@ -0,0 +1,21 @@
function test() {
waitForExplicitFinish();
var tab1 = gBrowser.addTab("data:text/plain,foo");
gBrowser.pinTab(tab1);
tab1.linkedBrowser.addEventListener("load", function () {
var tab2 = gBrowser.addTab();
gBrowser.pinTab(tab2);
is(Array.indexOf(gBrowser.tabs, tab1), 0, "pinned tab 1 is at the first position");
gBrowser.removeTab(tab1);
tab1 = undoCloseTab();
ok(tab1.pinned, "pinned tab 1 has been restored as a pinned tab");
is(Array.indexOf(gBrowser.tabs, tab1), 0, "pinned tab 1 has been restored to the first position");
gBrowser.removeTab(tab1);
gBrowser.removeTab(tab2);
finish();
}, true);
}