Bug 590268 - Provide access to sessionstore tab data sooner [r=dietrich, a=blocking2.0:betaN]

--HG--
extra : rebase_source : 3a1ccadf0571e5a7c6b0305d5c050f7ad1d8caa6
This commit is contained in:
Ian Gilman 2010-10-26 11:55:10 -07:00
Родитель 402adda51b
Коммит a5bfe10145
1 изменённых файлов: 21 добавлений и 4 удалений

Просмотреть файл

@ -1268,15 +1268,32 @@ SessionStoreService.prototype = {
},
getTabValue: function sss_getTabValue(aTab, aKey) {
var data = aTab.__SS_extdata || {};
let data = {};
if (aTab.__SS_extdata) {
data = aTab.__SS_extdata;
}
else if (aTab.linkedBrowser.__SS_data && aTab.linkedBrowser.__SS_data.extData) {
// If the tab hasn't been fully restored, get the data from the to-be-restored data
data = aTab.linkedBrowser.__SS_data.extData;
}
return data[aKey] || "";
},
setTabValue: function sss_setTabValue(aTab, aKey, aStringValue) {
if (!aTab.__SS_extdata) {
aTab.__SS_extdata = {};
// If the tab hasn't been restored, then set the data there, otherwise we
// could lose newly added data.
let saveTo;
if (aTab.__SS_extdata) {
saveTo = aTab.__SS_extdata;
}
aTab.__SS_extdata[aKey] = aStringValue;
else if (aTab.linkedBrowser.__SS_data && aTab.linkedBrowser.__SS_data.extData) {
saveTo = aTab.linkedBrowser.__SS_data.extData;
}
else {
aTab.__SS_extdata = {};
saveTo = aTab.__SS_extdata;
}
saveTo[aKey] = aStringValue;
this.saveStateDelayed(aTab.ownerDocument.defaultView);
},