forked from mirrors/gecko-dev
		
	move location change listening from ContentPrefSink to nsBrowserStatusHandler to possibly improve performance; r=sayrer, a=mconnor
This commit is contained in:
		
							parent
							
								
									1b7454e98c
								
							
						
					
					
						commit
						6989c455b3
					
				
					 2 changed files with 10 additions and 22 deletions
				
			
		|  | @ -75,14 +75,12 @@ var ContentPrefSink = { | ||||||
|   // Initialization & Destruction
 |   // Initialization & Destruction
 | ||||||
| 
 | 
 | ||||||
|   init: function ContentPrefSink_init() { |   init: function ContentPrefSink_init() { | ||||||
|     gBrowser.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT); |  | ||||||
|     gBrowser.addEventListener("DOMContentLoaded", this, false); |     gBrowser.addEventListener("DOMContentLoaded", this, false); | ||||||
|     // XXX Should we also listen for pageshow and/or load?
 |     // XXX Should we also listen for pageshow and/or load?
 | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   destroy: function ContentPrefSink_destroy() { |   destroy: function ContentPrefSink_destroy() { | ||||||
|     gBrowser.removeEventListener("DOMContentLoaded", this, false); |     gBrowser.removeEventListener("DOMContentLoaded", this, false); | ||||||
|     gBrowser.removeProgressListener(this); |  | ||||||
| 
 | 
 | ||||||
|     // Delete references to XPCOM components to make sure we don't leak them
 |     // Delete references to XPCOM components to make sure we don't leak them
 | ||||||
|     // (although we haven't observed leakage in tests).  Also delete references
 |     // (although we haven't observed leakage in tests).  Also delete references
 | ||||||
|  | @ -99,25 +97,6 @@ var ContentPrefSink = { | ||||||
|   //**************************************************************************//
 |   //**************************************************************************//
 | ||||||
|   // Event Handlers
 |   // 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
 |   // nsIDOMEventListener
 | ||||||
| 
 | 
 | ||||||
|   handleEvent: function ContentPrefSink_handleEvent(event) { |   handleEvent: function ContentPrefSink_handleEvent(event) { | ||||||
|  | @ -125,7 +104,7 @@ var ContentPrefSink = { | ||||||
|     this._handleDOMContentLoaded(event); |     this._handleDOMContentLoaded(event); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   _handleLocationChanged: function ContentPrefSink__handleLocationChanged(uri) { |   handleLocationChanged: function ContentPrefSink_handleLocationChanged(uri) { | ||||||
|     if (!uri) |     if (!uri) | ||||||
|       return; |       return; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3573,6 +3573,15 @@ nsBrowserStatusHandler.prototype = | ||||||
|     }  |     }  | ||||||
|     else |     else | ||||||
|       this.asyncUpdateUI(); |       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 () { |   asyncUpdateUI : function () { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 myk@mozilla.org
						myk@mozilla.org