Bug 235825: "I'm Feeling Lucky" search from address bar doesn't activate Stop toolbar button, patch by Simon Bünzli <zeniko@gmail.com>, r=mconnor

This commit is contained in:
gavin@gavinsharp.com 2007-08-21 22:01:09 -07:00
parent b64425ac30
commit bf4329a629

View File

@ -301,6 +301,9 @@
mMessage: "", mMessage: "",
mTotalProgress: 0, mTotalProgress: 0,
// count of open requests (should always be 0 or 1)
mRequestCount: 0,
onProgressChange : function (aWebProgress, aRequest, onProgressChange : function (aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress, aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) aCurTotalProgress, aMaxTotalProgress)
@ -328,6 +331,21 @@
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener; const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const nsIChannel = Components.interfaces.nsIChannel; const nsIChannel = Components.interfaces.nsIChannel;
if (aStateFlags & nsIWebProgressListener.STATE_START) {
this.mRequestCount++;
}
else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
const NS_ERROR_UNKNOWN_HOST = 2152398878;
if (--this.mRequestCount > 0 && aStatus == NS_ERROR_UNKNOWN_HOST) {
// to prevent bug 235825: wait for the request handled
// by the automatic keyword resolver
return;
}
// since we (try to) only handle STATE_STOP of the last request,
// the count of open requests should now be 0
this.mRequestCount = 0;
}
if (aStateFlags & nsIWebProgressListener.STATE_START && if (aStateFlags & nsIWebProgressListener.STATE_START &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) { aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
// It's okay to clear what the user typed when we start // It's okay to clear what the user typed when we start