Bug 508471 - Password Manager should use setProperty instead of setPropertyAsInterface for non-interface objects. r=gavin
authorJustin Dolske <dolske@mozilla.com>
Wed, 05 Aug 2009 13:46:30 -0700
changeset 31159 d3f5cbab7b445b97e36b9825486f61d57db77fac
parent 31158 415d1cdd5d7fc48d5c827fed12404a33e0f068f9
child 31160 c7a96c0ced3673eec246f502e25f503f4e74cfc4
push id8400
push userjdolske@mozilla.com
push dateWed, 05 Aug 2009 20:46:55 +0000
treeherdermozilla-central@d3f5cbab7b44 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs508471
milestone1.9.2a1pre
Bug 508471 - Password Manager should use setProperty instead of setPropertyAsInterface for non-interface objects. r=gavin
toolkit/components/passwordmgr/src/nsLoginManager.js
--- a/toolkit/components/passwordmgr/src/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/src/nsLoginManager.js
@@ -1239,23 +1239,27 @@ LoginManager.prototype = {
      *
      * @param selectedLogin   {nsILoginInfo}
      *        the nsILoginInfo that was/would be used to fill the form, if any;
      *        otherwise null; whether or not it was actually used depends on
      *        the value of the didntFillReason parameter
      */
     _notifyFoundLogins : function (didntFillReason, usernameField,
                                    passwordField, foundLogins, selectedLogin) {
+        // We need .setProperty(), which is a method on the original
+        // nsIWritablePropertyBag. Strangley enough, nsIWritablePropertyBag2
+        // doesn't inherit from that, so the additional QI is needed.
         let formInfo = Cc["@mozilla.org/hash-property-bag;1"].
-                       createInstance(Ci.nsIWritablePropertyBag2);
+                       createInstance(Ci.nsIWritablePropertyBag2).
+                       QueryInterface(Ci.nsIWritablePropertyBag);
 
         formInfo.setPropertyAsACString("didntFillReason", didntFillReason);
         formInfo.setPropertyAsInterface("usernameField", usernameField);
         formInfo.setPropertyAsInterface("passwordField", passwordField);
-        formInfo.setPropertyAsInterface("foundLogins", foundLogins.concat());
+        formInfo.setProperty("foundLogins", foundLogins.concat());
         formInfo.setPropertyAsInterface("selectedLogin", selectedLogin);
 
         this._observerService.notifyObservers(formInfo,
                                               "passwordmgr-found-logins",
                                               null);
     },
 
     /*