Visit Mozilla.org

Talk:Using nsILoginManager

From MDC

Contents

[edit] formSubmitURL

Isn't formSubmitURL not supposed to have a path?[1]--Np 19:33, 31 May 2007 (PDT)

[edit] constructor

Wouldn't it be more JS-like to initialize the object using the constructor? That is, do this instead:

var nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
                  Components.interfaces.nsILoginInfo, "init");
var loginInfo = new nsLoginInfo(hostname, formSubmitURL, httprealm, username, password, usernameField, passwordField);

(Not changing this myself, as it is possible that this was explicitly not used to make it clearer or something...) --Mook 19:48, 2 June 2007 (PDT)

Most people are unaware of Components.Constructor, but fwiw I think it's slightly nicer than the normal XPCOM way. --Nickolay 07:13, 4 June 2007 (PDT)
Do note that the second parameter to C.C is a string, "nsILoginInfo", not an interface ID. More on topic, I tend to think it's sugar that you should use after being exposed to the traditional, more verbose way (just as examples don't abbreviate to Cc/Ci). For example code showing how to use a component or some little bit of functionality (bigger projects can and should use it for more clarity), I think C.C should be avoided. --Waldo 23:41, 5 June 2007 (PDT)

[edit] Supporting older versions of Firefox

Wouldn't it be better to test |if ("@mozilla.org..." in Components.classes)| as opposed to the current way of trying to instantiate each one?

[edit] Supporting older versions of Firefox (2)

What happened to the passwords for extensions using the old "password manager"? I'm trying to get my old passwords with the use of the new method "findLogins", but I don't know what value for "formSubmitURL" or "httprealm" I need to use... Is there any way to have a compatibility?

I found how to do that: actually, for extensions created prior to Firefox 3.0, the "formSubmitURL" field is empty and the "httprealm" field contains the value of the "hostname" field.