Bug 859586 - Remove {Start,End,Fail}DocumentLoad notifications (r=felipe)

This commit is contained in:
Bill McCloskey 2013-04-15 15:34:27 -07:00
parent ba2c42a767
commit 5d9440c391

View File

@ -3745,6 +3745,7 @@ var XULBrowserWindow = {
aMaxTotalProgress);
},
// This function fires only for the currently selected tab.
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
const nsIWebProgressListener = Ci.nsIWebProgressListener;
const nsIChannel = Ci.nsIChannel;
@ -3752,8 +3753,13 @@ var XULBrowserWindow = {
if (aStateFlags & nsIWebProgressListener.STATE_START &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
if (aRequest && aWebProgress.DOMWindow == content)
this.startDocumentLoad(aRequest);
if (aRequest && aWebProgress.DOMWindow == content) {
// clear out feed data
gBrowser.selectedBrowser.feeds = null;
// clear out search-engine data
gBrowser.selectedBrowser.engines = null;
}
this.isBusy = true;
@ -3770,11 +3776,6 @@ var XULBrowserWindow = {
}
}
else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK &&
aWebProgress.DOMWindow == content &&
aRequest)
this.endDocumentLoad(aRequest, aStatus);
// This (thanks to the filter) is a network stop or the last
// request stop outside of loading the document, stop throbbers
// and progress bars and such
@ -4073,30 +4074,6 @@ var XULBrowserWindow = {
if (loadingDone)
return;
this.onStatusChange(gBrowser.webProgress, null, 0, aMessage);
},
startDocumentLoad: function XWB_startDocumentLoad(aRequest) {
// clear out feed data
gBrowser.selectedBrowser.feeds = null;
// clear out search-engine data
gBrowser.selectedBrowser.engines = null;
var uri = aRequest.QueryInterface(Ci.nsIChannel).URI;
try {
Services.obs.notifyObservers(content, "StartDocumentLoad", uri.spec);
} catch (e) {
}
},
endDocumentLoad: function XWB_endDocumentLoad(aRequest, aStatus) {
var urlStr = aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec;
var notification = Components.isSuccessCode(aStatus) ? "EndDocumentLoad" : "FailDocumentLoad";
try {
Services.obs.notifyObservers(content, notification, urlStr);
} catch (e) {
}
}
};