move location change listening from ContentPrefSink to nsBrowserStatusHandler to possibly improve performance; r=sayrer, a=mconnor
git-svn-id: svn://10.0.0.236/trunk@237574 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -75,14 +75,12 @@ var ContentPrefSink = {
|
||||
// Initialization & Destruction
|
||||
|
||||
init: function ContentPrefSink_init() {
|
||||
gBrowser.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
|
||||
gBrowser.addEventListener("DOMContentLoaded", this, false);
|
||||
// XXX Should we also listen for pageshow and/or load?
|
||||
},
|
||||
|
||||
destroy: function ContentPrefSink_destroy() {
|
||||
gBrowser.removeEventListener("DOMContentLoaded", this, false);
|
||||
gBrowser.removeProgressListener(this);
|
||||
|
||||
// Delete references to XPCOM components to make sure we don't leak them
|
||||
// (although we haven't observed leakage in tests). Also delete references
|
||||
@@ -99,25 +97,6 @@ var ContentPrefSink = {
|
||||
//**************************************************************************//
|
||||
// Event Handlers
|
||||
|
||||
// nsIWebProgressListener
|
||||
|
||||
onLocationChange: function ContentPrefSink_onLocationChange(progress, request, uri) {
|
||||
// Catch exceptions until bug 376222 gets fixed so that we don't hork
|
||||
// other progress listeners if our code throws an exception.
|
||||
try {
|
||||
this._handleLocationChanged(uri);
|
||||
}
|
||||
catch(ex) {
|
||||
Components.utils.reportError(ex);
|
||||
}
|
||||
},
|
||||
onStateChange: function ContentPrefSink_onStateChange(progress, request, flags, status) {},
|
||||
onProgressChange: function ContentPrefSink_onProgressChange(progress, request, curSelfProgress,
|
||||
maxSelfProgress, curTotalProgress,
|
||||
maxTotalProgress) {},
|
||||
onStatusChange: function ContentPrefSink_onStatusChange(progress, request, status, message) {},
|
||||
onSecurityChange: function ContentPrefSink_onSecurityChange(progress, request, state) {},
|
||||
|
||||
// nsIDOMEventListener
|
||||
|
||||
handleEvent: function ContentPrefSink_handleEvent(event) {
|
||||
@@ -125,7 +104,7 @@ var ContentPrefSink = {
|
||||
this._handleDOMContentLoaded(event);
|
||||
},
|
||||
|
||||
_handleLocationChanged: function ContentPrefSink__handleLocationChanged(uri) {
|
||||
handleLocationChanged: function ContentPrefSink_handleLocationChanged(uri) {
|
||||
if (!uri)
|
||||
return;
|
||||
|
||||
|
||||
@@ -3573,6 +3573,15 @@ nsBrowserStatusHandler.prototype =
|
||||
}
|
||||
else
|
||||
this.asyncUpdateUI();
|
||||
|
||||
// Catch exceptions until bug 376222 gets fixed so we don't hork
|
||||
// other progress listeners if this call throws an exception.
|
||||
try {
|
||||
ContentPrefSink.handleLocationChanged(aLocationURI);
|
||||
}
|
||||
catch(ex) {
|
||||
Components.utils.reportError(ex);
|
||||
}
|
||||
},
|
||||
|
||||
asyncUpdateUI : function () {
|
||||
|
||||
Reference in New Issue
Block a user