зеркало из https://github.com/mozilla/gecko-dev.git
Bug 653091 - Use a dummy tab when restoring session to keep the resize code happy [r=mbrubeck]
This commit is contained in:
Родитель
2a052f5161
Коммит
df4a6c7a1b
|
@ -335,6 +335,19 @@ var Browser = {
|
|||
// Should we restore the previous session (crash or some other event)
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
if (ss.shouldRestore()) {
|
||||
// Initial window resizes call functions that assume a tab is in the tab list
|
||||
// and restored tabs are added too late. We add a dummy to to satisfy the resize
|
||||
// code and then remove the dummy after the session has been restored.
|
||||
let dummy = this.addTab("about:blank");
|
||||
let dummyCleanup = {
|
||||
observe: function() {
|
||||
Services.obs.removeObserver(dummyCleanup, "sessionstore-windows-restored");
|
||||
dummy.chromeTab.ignoreUndo = true;
|
||||
Browser.closeTab(dummy, { forceClose: true });
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(dummyCleanup, "sessionstore-windows-restored", false);
|
||||
|
||||
ss.restoreLastSession();
|
||||
|
||||
// Also open any commandline URLs, except the homepage
|
||||
|
@ -679,7 +692,7 @@ var Browser = {
|
|||
tab.browser.messageManager.sendAsyncMessage("Browser:CanUnload", {});
|
||||
},
|
||||
|
||||
_doCloseTab: function _docloseTab(aTab) {
|
||||
_doCloseTab: function _doCloseTab(aTab) {
|
||||
let nextTab = this._getNextTab(aTab);
|
||||
if (!nextTab)
|
||||
return;
|
||||
|
|
|
@ -186,9 +186,9 @@
|
|||
aTab.thumbnail.getContext("2d").drawImage(thumbnailImg, 0, 0);
|
||||
};
|
||||
thumbnailImg.src = oldThumbnail;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
this._tabsUndo.appendChild(aTab);
|
||||
}
|
||||
|
||||
aTab.setAttribute("reload", "true");
|
||||
this._closedTab = aTab;
|
||||
|
|
Загрузка…
Ссылка в новой задаче