Bug 769097 - Remember desktop mode preference after OOM. r=mfinkle

This commit is contained in:
Brian Nicholson 2012-07-02 12:42:11 -07:00
parent 941a001d26
commit d912f51797
3 changed files with 16 additions and 5 deletions

View File

@ -246,6 +246,8 @@ public class Tabs implements GeckoEventListener {
selectTab(tab.getId());
if (message.getBoolean("delayLoad"))
tab.setState(Tab.STATE_DELAYED);
if (message.getBoolean("desktopMode"))
tab.setDesktopMode(true);
} else if (event.equals("Tab:Close")) {
Tab tab = getTab(message.getInt("tabID"));
closeTab(tab);

View File

@ -2083,7 +2083,6 @@ function Tab(aURL, aParams) {
this.browser = null;
this.id = 0;
this.showProgress = true;
this.create(aURL, aParams);
this._zoom = 1.0;
this._drawZoom = 1.0;
this.userScrollPos = { x: 0, y: 0 };
@ -2093,6 +2092,8 @@ function Tab(aURL, aParams) {
this.clickToPlayPluginsActivated = false;
this.desktopMode = false;
this.originalURI = null;
this.create(aURL, aParams);
}
Tab.prototype = {
@ -2122,6 +2123,7 @@ Tab.prototype = {
} catch (e) {}
this.id = ++gTabIDFactory;
this.desktopMode = ("desktopMode" in aParams) ? aParams.desktopMode : false;
let message = {
gecko: {
@ -2132,7 +2134,8 @@ Tab.prototype = {
external: ("external" in aParams) ? aParams.external : false,
selected: ("selected" in aParams) ? aParams.selected : true,
title: aParams.title || aURL,
delayLoad: aParams.delayLoad || false
delayLoad: aParams.delayLoad || false,
desktopMode: this.desktopMode
}
};
sendMessageToJava(message);

View File

@ -405,7 +405,7 @@ SessionStore.prototype = {
let data = { entries: entries, index: index };
delete aBrowser.__SS_data;
this._collectTabData(aBrowser, data);
this._collectTabData(aWindow, aBrowser, data);
this.saveStateNow();
}
@ -478,7 +478,7 @@ SessionStore.prototype = {
return data;
},
_collectTabData: function ss__collectTabData(aBrowser, aHistory) {
_collectTabData: function ss__collectTabData(aWindow, aBrowser, aHistory) {
// If this browser is being restored, skip any session save activity
if (aBrowser.__SS_restore)
return;
@ -489,6 +489,7 @@ SessionStore.prototype = {
tabData.entries = aHistory.entries;
tabData.index = aHistory.index;
tabData.attributes = { image: aBrowser.mIconURL };
tabData.desktopMode = aWindow.BrowserApp.getTabForBrowser(aBrowser).desktopMode;
aBrowser.__SS_data = tabData;
},
@ -948,7 +949,12 @@ SessionStore.prototype = {
let entry = tabData.entries[tabData.index - 1];
// Add a tab, but don't load the URL until we need to
let params = { selected: isSelected, delayLoad: true, title: entry.title };
let params = {
selected: isSelected,
delayLoad: true,
title: entry.title,
desktopMode: tabData.desktopMode == true
};
let tab = window.BrowserApp.addTab(entry.url, params);
if (isSelected) {