Bug 702556 - JS exception "aTabs[0].linkedBrowser is null" in nsSessionStore.js [r=dietrich]

This commit is contained in:
Paul O’Shannessy 2011-11-28 13:02:48 -08:00
Родитель ae077178d1
Коммит 778415b671
1 изменённых файлов: 17 добавлений и 2 удалений

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

@ -2981,8 +2981,9 @@ SessionStoreService.prototype = {
restoreHistory:
function sss_restoreHistory(aWindow, aTabs, aTabData, aIdMap, aDocIdentMap) {
var _this = this;
while (aTabs.length > 0 && (!aTabs[0].linkedBrowser.__SS_tabStillLoading || !aTabs[0].parentNode)) {
aTabs.shift(); // this tab got removed before being completely restored
// if the tab got removed before being completely restored, then skip it
while (aTabs.length > 0 && !(this._canRestoreTabHistory(aTabs[0]))) {
aTabs.shift();
aTabData.shift();
}
if (aTabs.length == 0) {
@ -3996,6 +3997,20 @@ SessionStoreService.prototype = {
!aTabState.userTypedValue);
},
/**
* Determine if we can restore history into this tab.
* This will be false when a tab has been removed (usually between
* restoreHistoryPrecursor && restoreHistory) or if the tab is still marked
* as loading.
*
* @param aTab
* @returns boolean
*/
_canRestoreTabHistory: function sss__canRestoreTabHistory(aTab) {
return aTab.parentNode && aTab.linkedBrowser &&
aTab.linkedBrowser.__SS_tabStillLoading;
},
/**
* This is going to take a state as provided at startup (via
* nsISessionStartup.state) and split it into 2 parts. The first part