Based off what I have read, I think Firefox detects passwords by form.elements[n].type == "password"
(iterating through all form elements) and then detects the username field by searching backwards through form elements for the text field immediately before the password field (more info here). You might try something similar in Javascript and see if you can detect your password field.
From what I can tell, your login form needs to be part of a <form>
or Firefox won’t detect it. Setting id="password"
on your password field probably couldn’t hurt either.
If this is still giving you a lot of problems, I would recommend asking on one of the Mozilla project’s developer mailing lists (you might even get a response from the developer who designed the feature).