Bug 639092 - Catch exception accessing nsIRequest.name from nsLoginManager r=dolske
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Mon, 26 Sep 2011 10:48:59 -0700
changeset 78919 03188e4fd2000d87c692e13d900f98a01a694439
parent 78918 fa1a7fb55799ee10971b362a27356187e85cea23
child 78920 e377ae930496ae87be823a759fa4d3a433f0e5ca
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs639092
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 639092 - Catch exception accessing nsIRequest.name from nsLoginManager r=dolske
toolkit/components/passwordmgr/nsLoginManager.js
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -283,20 +283,28 @@ LoginManager.prototype = {
                 return;
 
             var domWin = aWebProgress.DOMWindow;
             var domDoc = domWin.document;
 
             // Only process things which might have HTML forms.
             if (!(domDoc instanceof Ci.nsIDOMHTMLDocument))
                 return;
-
-            this._pwmgr.log("onStateChange accepted: req = " +
-                            (aRequest ?  aRequest.name : "(null)") +
-                            ", flags = 0x" + aStateFlags.toString(16));
+            if (this._pwmgr._debug) {
+                let requestName = "(null)";
+                if (aRequest) {
+                    try {
+                        requestName = aRequest.name;
+                    } catch (ex if ex.result == Components.results.NS_ERROR_NOT_IMPLEMENTED) {
+                        // do nothing - leave requestName = "(null)"
+                    }
+                }
+                this._pwmgr.log("onStateChange accepted: req = " + requestName +
+                                ", flags = 0x" + aStateFlags.toString(16));
+            }
 
             // Fastback doesn't fire DOMContentLoaded, so process forms now.
             if (aStateFlags & Ci.nsIWebProgressListener.STATE_RESTORING) {
                 this._pwmgr.log("onStateChange: restoring document");
                 return this._pwmgr._fillDocument(domDoc);
             }
 
             // Add event listener to process page when DOM is complete.