Bug 327604: Status bar message text persists when switching tabs while page is loading, patch by Simon B�nzli <zeniko@gmail.com>, r+a=mconnor

This commit is contained in:
gavin%gavinsharp.com 2007-08-22 05:04:21 +00:00
Родитель f0b4ab88b8
Коммит 61888f4746
1 изменённых файлов: 27 добавлений и 0 удалений

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

@ -295,6 +295,12 @@
mBlank: aStartsBlank, mBlank: aStartsBlank,
mLastURI: null, mLastURI: null,
// cache flags for correct status bar update after tab switching
mStateFlags: 0,
mStatus: 0,
mMessage: "",
mTotalProgress: 0,
onProgressChange : function (aWebProgress, aRequest, onProgressChange : function (aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress, aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) aCurTotalProgress, aMaxTotalProgress)
@ -308,6 +314,8 @@
aCurTotalProgress, aMaxTotalProgress); aCurTotalProgress, aMaxTotalProgress);
} }
} }
this.mTotalProgress = aMaxTotalProgress ? aCurTotalProgress / aMaxTotalProgress : 0;
}, },
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
@ -377,6 +385,15 @@
p.onStateChange(aWebProgress, aRequest, aStateFlags, aStatus); p.onStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
} }
} }
if (aStateFlags & (nsIWebProgressListener.STATE_START |
nsIWebProgressListener.STATE_STOP)) {
// reset cached temporary values at beginning and end
this.mMessage = "";
this.mTotalProgress = 0;
}
this.mStateFlags = aStateFlags;
this.mStatus = aStatus;
}, },
onLocationChange : function(aWebProgress, aRequest, aLocation) onLocationChange : function(aWebProgress, aRequest, aLocation)
@ -410,6 +427,8 @@
p.onStatusChange(aWebProgress, aRequest, aStatus, aMessage); p.onStatusChange(aWebProgress, aRequest, aStatus, aMessage);
} }
} }
this.mMessage = aMessage;
}, },
onSecurityChange : function(aWebProgress, aRequest, aState) onSecurityChange : function(aWebProgress, aRequest, aState)
@ -690,6 +709,14 @@
p.onLocationChange(webProgress, null, loc); p.onLocationChange(webProgress, null, loc);
if (securityUI) if (securityUI)
p.onSecurityChange(webProgress, null, securityUI.state); p.onSecurityChange(webProgress, null, securityUI.state);
// make sure that all status indicators are properly updated
if ("onUpdateCurrentBrowser" in p) {
var listener = this.mTabListeners[this.mTabContainer.selectedIndex] || null;
if (listener && listener.mStateFlags)
p.onUpdateCurrentBrowser(listener.mStateFlags, listener.mStatus,
listener.mMessage, listener.mTotalProgress);
}
} }
} }