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
git-svn-id: svn://10.0.0.236/trunk@192831 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
50a61482bf
commit
0e66fb4d39
@ -3414,14 +3414,9 @@ nsBrowserStatusHandler.prototype =
|
||||
// and progress bars and such
|
||||
if (aRequest) {
|
||||
var msg = "";
|
||||
// Get the channel if the request is a channel
|
||||
var channel;
|
||||
try {
|
||||
channel = aRequest.QueryInterface(nsIChannel);
|
||||
}
|
||||
catch(e) { };
|
||||
if (channel) {
|
||||
var location = channel.URI;
|
||||
// Get the URI either from a channel or a pseudo-object
|
||||
if (aRequest instanceof nsIChannel || "URI" in aRequest) {
|
||||
var location = aRequest.URI;
|
||||
|
||||
// For keyword URIs clear the user typed value since they will be changed into real URIs
|
||||
if (location.scheme == "keyword" && aWebProgress.DOMWindow == content)
|
||||
@ -3645,6 +3640,27 @@ nsBrowserStatusHandler.prototype =
|
||||
lockIcon.setAttribute("tooltiptext", securityUI.tooltipText);
|
||||
},
|
||||
|
||||
// simulate all change notifications after switching tabs
|
||||
onUpdateCurrentBrowser : function(aStateFlags, aStatus, aMessage, aTotalProgress)
|
||||
{
|
||||
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
||||
var loadingDone = aStateFlags & nsIWebProgressListener.STATE_STOP;
|
||||
// use a pseudo-object instead of a (potentially non-existing) channel for getting
|
||||
// a correct error message - and make sure that the UI is always either in
|
||||
// loading (STATE_START) or done (STATE_STOP) mode
|
||||
this.onStateChange(
|
||||
gBrowser.webProgress,
|
||||
{ URI: gBrowser.currentURI },
|
||||
loadingDone ? nsIWebProgressListener.STATE_STOP : nsIWebProgressListener.STATE_START,
|
||||
aStatus
|
||||
);
|
||||
// status message and progress value are undefined if we're done with loading
|
||||
if (loadingDone)
|
||||
return;
|
||||
this.onStatusChange(gBrowser.webProgress, null, 0, aMessage);
|
||||
this.onProgressChange(gBrowser.webProgress, 0, 0, aTotalProgress, 1);
|
||||
},
|
||||
|
||||
startDocumentLoad : function(aRequest)
|
||||
{
|
||||
// It's okay to clear what the user typed when we start
|
||||
|
||||
@ -295,6 +295,12 @@
|
||||
mBlank: aStartsBlank,
|
||||
mLastURI: null,
|
||||
|
||||
// cache flags for correct status bar update after tab switching
|
||||
mStateFlags: 0,
|
||||
mStatus: 0,
|
||||
mMessage: "",
|
||||
mTotalProgress: 0,
|
||||
|
||||
onProgressChange : function (aWebProgress, aRequest,
|
||||
aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress)
|
||||
@ -308,6 +314,8 @@
|
||||
aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
}
|
||||
|
||||
this.mTotalProgress = aMaxTotalProgress ? aCurTotalProgress / aMaxTotalProgress : 0;
|
||||
},
|
||||
|
||||
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
|
||||
@ -377,6 +385,15 @@
|
||||
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)
|
||||
@ -410,6 +427,8 @@
|
||||
p.onStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
}
|
||||
}
|
||||
|
||||
this.mMessage = aMessage;
|
||||
},
|
||||
|
||||
onSecurityChange : function(aWebProgress, aRequest, aState)
|
||||
@ -690,6 +709,14 @@
|
||||
p.onLocationChange(webProgress, null, loc);
|
||||
if (securityUI)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user