Bug 867097 - Remove re-use of __SS_data, and the superfluous __SS_tabStillLoading property; r=yoric

This commit is contained in:
Tim Taubert 2013-05-02 12:12:30 +02:00
Родитель 1ed8f2da92
Коммит 8a7ab9c6ad
3 изменённых файлов: 6 добавлений и 29 удалений

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

@ -1059,7 +1059,6 @@ let SessionStoreInternal = {
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;
delete aTab.linkedBrowser.__SS_formDataSaved; delete aTab.linkedBrowser.__SS_formDataSaved;
delete aTab.linkedBrowser.__SS_hostSchemeData; delete aTab.linkedBrowser.__SS_hostSchemeData;
if (aTab.linkedBrowser.__SS_restoreState) if (aTab.linkedBrowser.__SS_restoreState)
@ -1251,7 +1250,6 @@ let SessionStoreInternal = {
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this)); MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
delete browser.__SS_data; delete browser.__SS_data;
delete browser.__SS_tabStillLoading;
delete browser.__SS_formDataSaved; delete browser.__SS_formDataSaved;
delete browser.__SS_hostSchemeData; delete browser.__SS_hostSchemeData;
@ -1329,7 +1327,6 @@ let SessionStoreInternal = {
} }
delete aBrowser.__SS_data; delete aBrowser.__SS_data;
delete aBrowser.__SS_tabStillLoading;
delete aBrowser.__SS_formDataSaved; delete aBrowser.__SS_formDataSaved;
this.saveStateDelayed(aWindow); this.saveStateDelayed(aWindow);
@ -1887,7 +1884,7 @@ let SessionStoreInternal = {
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_tabStillLoading) { else if (browser.__SS_data) {
// 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)
@ -1912,16 +1909,7 @@ let SessionStoreInternal = {
} }
catch (ex) { } // this could happen if we catch a tab during (de)initialization catch (ex) { } // this could happen if we catch a tab during (de)initialization
// XXXzeniko anchor navigation doesn't reset __SS_data, so we could reuse if (history && history.count > 0) {
// data even when we shouldn't (e.g. Back, different anchor)
if (history && browser.__SS_data &&
browser.__SS_data.entries[history.index] &&
browser.__SS_data.entries[history.index].url == browser.currentURI.spec &&
history.index < this._sessionhistory_max_entries - 1 && !aFullData) {
tabData = browser.__SS_data;
tabData.index = history.index + 1;
}
else if (history && history.count > 0) {
browser.__SS_hostSchemeData = []; browser.__SS_hostSchemeData = [];
try { try {
for (var j = 0; j < history.count; j++) { for (var j = 0; j < history.count; j++) {
@ -1950,10 +1938,6 @@ let SessionStoreInternal = {
} }
} }
tabData.index = history.index + 1; tabData.index = history.index + 1;
// make sure not to cache privacy sensitive data which shouldn't get out
if (!aFullData)
browser.__SS_data = tabData;
} }
else if (browser.currentURI.spec != "about:blank" || else if (browser.currentURI.spec != "about:blank" ||
browser.contentDocument.body.hasChildNodes()) { browser.contentDocument.body.hasChildNodes()) {
@ -2180,7 +2164,7 @@ let SessionStoreInternal = {
_updateTextAndScrollDataForTab: _updateTextAndScrollDataForTab:
function ssi_updateTextAndScrollDataForTab(aWindow, aBrowser, aTabData, aFullData) { function ssi_updateTextAndScrollDataForTab(aWindow, aBrowser, aTabData, aFullData) {
// we shouldn't update data for incompletely initialized tabs // we shouldn't update data for incompletely initialized tabs
if (aBrowser.__SS_data && aBrowser.__SS_tabStillLoading) if (aBrowser.__SS_data)
return; return;
var tabIndex = (aTabData.index || aTabData.entries.length) - 1; var tabIndex = (aTabData.index || aTabData.entries.length) - 1;
@ -2984,8 +2968,6 @@ let SessionStoreInternal = {
for (let name in tabData.attributes) for (let name in tabData.attributes)
this.xulAttributes[name] = true; this.xulAttributes[name] = 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
browser.__SS_data = tabData; browser.__SS_data = tabData;
@ -4095,15 +4077,13 @@ let SessionStoreInternal = {
/** /**
* Determine if we can restore history into this tab. * Determine if we can restore history into this tab.
* This will be false when a tab has been removed (usually between * This will be false when a tab has been removed (usually between
* restoreHistoryPrecursor && restoreHistory) or if the tab is still marked * restoreHistoryPrecursor && restoreHistory).
* as loading.
* *
* @param aTab * @param aTab
* @returns boolean * @returns boolean
*/ */
_canRestoreTabHistory: function ssi_canRestoreTabHistory(aTab) { _canRestoreTabHistory: function ssi_canRestoreTabHistory(aTab) {
return aTab.parentNode && aTab.linkedBrowser && return aTab.parentNode && aTab.linkedBrowser;
aTab.linkedBrowser.__SS_tabStillLoading;
}, },
/** /**

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

@ -17,9 +17,7 @@ function test() {
// Undo pinning // Undo pinning
gBrowser.unpinTab(tab1); gBrowser.unpinTab(tab1);
ok("__SS_data" in tab1.linkedBrowser, "tab should still be loading");
is(tab1.linkedBrowser.__SS_tabStillLoading, true,
"_tabStillLoading should be true.");
// Close and restore tab // Close and restore tab
gBrowser.removeTab(tab1); gBrowser.removeTab(tab1);

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

@ -39,7 +39,6 @@ function firstOnLoad(aEvent) {
ss.getBrowserState(); ss.getBrowserState();
is(gBrowser.tabs[1], tab, "newly created tab should exist by now"); is(gBrowser.tabs[1], tab, "newly created tab should exist by now");
ok(tab.linkedBrowser.__SS_data, "newly created tab should be in save state");
tab.linkedBrowser.loadURI(URI_TO_LOAD); tab.linkedBrowser.loadURI(URI_TO_LOAD);
} }