Bug 698565 (2/6) - stop excluding keys when calling JSON.stringify() [r=dietrich]

Move _tabStillLoading from data to the browser.
This commit is contained in:
Paul O’Shannessy 2011-11-08 15:23:43 -08:00
Родитель 5ca5474f71
Коммит 38a992475a
2 изменённых файлов: 8 добавлений и 5 удалений

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

@ -545,6 +545,7 @@ SessionStoreService.prototype = {
this._forEachBrowserWindow(function(aWindow) { this._forEachBrowserWindow(function(aWindow) {
Array.forEach(aWindow.gBrowser.tabs, function(aTab) { Array.forEach(aWindow.gBrowser.tabs, function(aTab) {
delete aTab.linkedBrowser.__SS_data; delete aTab.linkedBrowser.__SS_data;
delete aTab.linkedBrowser.__SS_tabStillLoading;
if (aTab.linkedBrowser.__SS_restoreState) if (aTab.linkedBrowser.__SS_restoreState)
this._resetTabRestoringState(aTab); this._resetTabRestoringState(aTab);
}); });
@ -1041,6 +1042,7 @@ SessionStoreService.prototype = {
browser.removeEventListener("DOMAutoComplete", this, true); browser.removeEventListener("DOMAutoComplete", this, true);
delete browser.__SS_data; delete browser.__SS_data;
delete browser.__SS_tabStillLoading;
// If this tab was in the middle of restoring or still needs to be restored, // If this tab was in the middle of restoring or still needs to be restored,
// we need to reset that state. If the tab was restoring, we will attempt to // we need to reset that state. If the tab was restoring, we will attempt to
@ -1120,6 +1122,7 @@ SessionStoreService.prototype = {
} }
delete aBrowser.__SS_data; delete aBrowser.__SS_data;
delete aBrowser.__SS_tabStillLoading;
this.saveStateDelayed(aWindow); this.saveStateDelayed(aWindow);
// attempt to update the current URL we send in a crash report // attempt to update the current URL we send in a crash report
@ -1703,7 +1706,7 @@ SessionStoreService.prototype = {
if (!browser || !browser.currentURI) if (!browser || !browser.currentURI)
// can happen when calling this function right after .addTab() // can happen when calling this function right after .addTab()
return tabData; return tabData;
else if (browser.__SS_data && browser.__SS_data._tabStillLoading) { else if (browser.__SS_data && browser.__SS_tabStillLoading) {
// use the data to be restored when the tab hasn't been completely loaded // use the data to be restored when the tab hasn't been completely loaded
tabData = browser.__SS_data; tabData = browser.__SS_data;
if (aTab.pinned) if (aTab.pinned)
@ -2039,7 +2042,7 @@ SessionStoreService.prototype = {
var browsers = aWindow.gBrowser.browsers; var browsers = aWindow.gBrowser.browsers;
this._windows[aWindow.__SSi].tabs.forEach(function (tabData, i) { this._windows[aWindow.__SSi].tabs.forEach(function (tabData, i) {
if (browsers[i].__SS_data && if (browsers[i].__SS_data &&
browsers[i].__SS_data._tabStillLoading) browsers[i].__SS_tabStillLoading)
return; // ignore incompletely initialized tabs return; // ignore incompletely initialized tabs
try { try {
this._updateTextAndScrollDataForTab(aWindow, browsers[i], tabData); this._updateTextAndScrollDataForTab(aWindow, browsers[i], tabData);
@ -2859,7 +2862,7 @@ SessionStoreService.prototype = {
for (let name in tabData.attributes) for (let name in tabData.attributes)
this.xulAttributes[name] = true; this.xulAttributes[name] = true;
tabData._tabStillLoading = true; browser.__SS_tabStillLoading = true;
// keep the data around to prevent dataloss in case // keep the data around to prevent dataloss in case
// a tab gets closed before it's been properly restored // a tab gets closed before it's been properly restored
@ -2926,7 +2929,7 @@ SessionStoreService.prototype = {
restoreHistory: restoreHistory:
function sss_restoreHistory(aWindow, aTabs, aTabData, aIdMap, aDocIdentMap) { function sss_restoreHistory(aWindow, aTabs, aTabData, aIdMap, aDocIdentMap) {
var _this = this; var _this = this;
while (aTabs.length > 0 && (!aTabData[0]._tabStillLoading || !aTabs[0].parentNode)) { while (aTabs.length > 0 && (!aTabs[0].linkedBrowser.__SS_tabStillLoading || !aTabs[0].parentNode)) {
aTabs.shift(); // this tab got removed before being completely restored aTabs.shift(); // this tab got removed before being completely restored
aTabData.shift(); aTabData.shift();
} }

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

@ -50,7 +50,7 @@ function test() {
// Undo pinning // Undo pinning
gBrowser.unpinTab(tab1); gBrowser.unpinTab(tab1);
is(tab1.linkedBrowser.__SS_data._tabStillLoading, true, is(tab1.linkedBrowser.__SS_tabStillLoading, true,
"_tabStillLoading should be true."); "_tabStillLoading should be true.");
// Close and restore tab // Close and restore tab