mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 676780 - Fennec is unable to load webpages and close tabs (corrupt sessionstore) [r=mbrubeck]
This commit is contained in:
parent
b646a65f01
commit
b66f130b05
@ -355,10 +355,12 @@ var Browser = {
|
||||
// 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 dummy = this.addTab("about:blank", true);
|
||||
let dummyCleanup = {
|
||||
observe: function() {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(dummyCleanup, "sessionstore-windows-restored");
|
||||
if (aData == "fail")
|
||||
Browser.addTab(commandURL || Browser.getHomePage(), true);
|
||||
dummy.chromeTab.ignoreUndo = true;
|
||||
Browser.closeTab(dummy, { forceClose: true });
|
||||
}
|
||||
|
@ -707,14 +707,16 @@ SessionStore.prototype = {
|
||||
},
|
||||
|
||||
restoreLastSession: function ss_restoreLastSession(aBringToFront) {
|
||||
// The previous session data has already been renamed to the backup file
|
||||
if (!this._sessionFileBackup.exists())
|
||||
return;
|
||||
|
||||
let self = this;
|
||||
function notifyObservers() {
|
||||
function notifyObservers(aMessage) {
|
||||
self._clearCache();
|
||||
Services.obs.notifyObservers(null, "sessionstore-windows-restored", "");
|
||||
Services.obs.notifyObservers(null, "sessionstore-windows-restored", aMessage || "");
|
||||
}
|
||||
|
||||
// The previous session data has already been renamed to the backup file
|
||||
if (!this._sessionFileBackup.exists()) {
|
||||
notifyObservers("fail")
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -723,7 +725,7 @@ SessionStore.prototype = {
|
||||
NetUtil.asyncFetch(channel, function(aStream, aResult) {
|
||||
if (!Components.isSuccessCode(aResult)) {
|
||||
Cu.reportError("SessionStore: Could not read from sessionstore.bak file");
|
||||
notifyObservers();
|
||||
notifyObservers("fail");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -742,14 +744,17 @@ SessionStore.prototype = {
|
||||
}
|
||||
|
||||
if (!data || data.windows.length == 0) {
|
||||
notifyObservers();
|
||||
notifyObservers("fail");
|
||||
return;
|
||||
}
|
||||
|
||||
let window = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
let selected = data.windows[0].selected;
|
||||
let tabs = data.windows[0].tabs;
|
||||
let selected = data.windows[0].selected;
|
||||
if (selected > tabs.length) // Clamp the selected index if it's bogus
|
||||
selected = 1;
|
||||
|
||||
for (let i=0; i<tabs.length; i++) {
|
||||
let tabData = tabs[i];
|
||||
|
||||
@ -795,7 +800,7 @@ SessionStore.prototype = {
|
||||
});
|
||||
} catch (ex) {
|
||||
Cu.reportError("SessionStore: Could not read from sessionstore.bak file: " + ex);
|
||||
notifyObservers();
|
||||
notifyObservers("fail");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user