Bug 1350324 - Be more rigorous about ignoring the initial about:blank load for tab progress listeners. r=Gijs

The initial about:blank that we load in a new <xul:browser> is not a load we usually
care about. We have code in tabbrowser.xml that ignores the state changes for that
initial load, but I guess it's not perfect - there's a case where we were getting
a STATE_STOP for that initial about:blank load (since the DocShell will call
Stop() on itself before loading that initial about:blank), and then a STATE_START
once the about:blank actually started to load. The initial STATE_STOP was ignored,
but cleared the "ignore" flag for the STATE_START to come through and show the
loading throbber. Then, when flipping remoteness, the "busy" state was not cleared.

This patch makes it so that we ignore that initial STATE_STOP (differentiated from
other STATE_STOPS because we notice that no loads were currently in progress).

MozReview-Commit-ID: IPTxuVGsCYN
This commit is contained in:
Mike Conley
2017-04-10 17:45:28 -04:00
parent 9471a57d1d
commit df2dc15dbf

View File

@@ -576,11 +576,20 @@
return true;
},
_isForInitialAboutBlank(aWebProgress, aLocation) {
_isForInitialAboutBlank(aWebProgress, aStateFlags, aLocation) {
if (!this.mBlank || !aWebProgress.isTopLevel) {
return false;
}
// If the state has STATE_STOP, and no requests were in flight, then this
// must be the initial "stop" for the initial about:blank document.
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
this.mRequestCount == 0 &&
!aLocation) {
return true;
}
let location = aLocation ? aLocation.spec : "";
return location == "about:blank";
},
@@ -623,7 +632,9 @@
originalLocation = aRequest.originalURI;
} catch (ex) {}
let ignoreBlank = this._isForInitialAboutBlank(aWebProgress, location);
let ignoreBlank = this._isForInitialAboutBlank(aWebProgress, aStateFlags,
location);
// If we were ignoring some messages about the initial about:blank, and we
// got the STATE_STOP for it, we'll want to pay attention to those messages
// from here forward. Similarly, if we conclude that this state change