Bug 675493 - Port [Bug 655550 - Persisted tab attribute gets lost after restart twice] and one relevant line from [Bug 644998 - Session should not be restorable after Clear Recent History. r=Neil
This commit is contained in:
Родитель
82d4666220
Коммит
4f5d3245dc
|
@ -174,7 +174,7 @@ SessionStoreService.prototype = {
|
|||
|
||||
// xul:tab attributes to (re)store (extensions might want to hook in here);
|
||||
// the favicon is always saved for the about:sessionrestore page
|
||||
xulAttributes: ["image"],
|
||||
xulAttributes: {"image": true},
|
||||
|
||||
// set default load state
|
||||
_loadState: STATE_STOPPED,
|
||||
|
@ -442,6 +442,7 @@ SessionStoreService.prototype = {
|
|||
// quit-application notification so the browser is about to exit.
|
||||
if (this._loadState == STATE_QUITTING)
|
||||
return;
|
||||
this._lastSessionState = null;
|
||||
let openWindows = {};
|
||||
this._forEachBrowserWindow(function(aWindow) {
|
||||
Array.forEach(aWindow.getBrowser().tabs, function(aTab) {
|
||||
|
@ -1234,10 +1235,10 @@ SessionStoreService.prototype = {
|
|||
},
|
||||
|
||||
persistTabAttribute: function sss_persistTabAttribute(aName) {
|
||||
if (this.xulAttributes.indexOf(aName) != -1)
|
||||
if (aName in this.xulAttributes)
|
||||
return; // this attribute is already being tracked
|
||||
|
||||
this.xulAttributes.push(aName);
|
||||
this.xulAttributes[aName] = true;
|
||||
this.saveStateDelayed();
|
||||
},
|
||||
|
||||
|
@ -1544,12 +1545,10 @@ SessionStoreService.prototype = {
|
|||
else if (tabData.disallow)
|
||||
delete tabData.disallow;
|
||||
|
||||
if (this.xulAttributes.length > 0) {
|
||||
tabData.attributes = {};
|
||||
Array.forEach(aTab.attributes, function(aAttr) {
|
||||
if (this.xulAttributes.indexOf(aAttr.name) > -1)
|
||||
tabData.attributes[aAttr.name] = aAttr.value;
|
||||
}, this);
|
||||
tabData.attributes = {};
|
||||
for (let name in this.xulAttributes) {
|
||||
if (aTab.hasAttribute(name))
|
||||
tabData.attributes[name] = aTab.getAttribute(name);
|
||||
}
|
||||
|
||||
if (aTab.__SS_extdata)
|
||||
|
@ -2503,6 +2502,9 @@ SessionStoreService.prototype = {
|
|||
|
||||
tab.hidden = tabData.hidden;
|
||||
|
||||
for (let name in tabData.attributes)
|
||||
this.xulAttributes[name] = true;
|
||||
|
||||
tabData._tabStillLoading = true;
|
||||
|
||||
// keep the data around to prevent dataloss in case
|
||||
|
@ -2618,9 +2620,8 @@ SessionStoreService.prototype = {
|
|||
CAPABILITIES.forEach(function(aCapability) {
|
||||
browser.docShell["allow" + aCapability] = disallow.indexOf(aCapability) == -1;
|
||||
});
|
||||
Array.filter(tab.attributes, function(aAttr) {
|
||||
return (_this.xulAttributes.indexOf(aAttr.name) > -1);
|
||||
}).forEach(tab.removeAttribute, tab);
|
||||
for (let name in this.xulAttributes)
|
||||
tab.removeAttribute(name);
|
||||
for (let name in tabData.attributes)
|
||||
tab.setAttribute(name, tabData.attributes[name]);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче