I'm doing a Thunderbird extension that will get the stored username/password in Firefox and import those accounts into Thunderbird. This results in the need of nsILoginManager, but I'm not sure how to make it work from a Thunderbird extension. Is it possible to do so?
Asked
Active
Viewed 357 times
1 Answers
1
You pretty much cannot. In addition to XPCOM simply not working across different processes, the complications are:
- What if Firefox isn't running?
- What if the password storage is encrypted with a master password?
- What if there is more than one Firefox profile?
The best you could do would be:
- Start Firefox with a command line like
firefox -url file://foo/bar/extension.xpi
- make sure that Firefox is running and the user is asked to installextension.xpi
. It should be a bootstrapped extension so that no browser restart is required. - That extension gets the necessary data from
nsILoginManager
(which involves a password prompt if the user has a master password defined) and sends it back to Thunderbird. - After that this extension uses the Add-on Manager API to uninstall itself.
This is far from being a smooth user experience of course. As to how the two extensions (one in Thunderbird, the other in Firefox) would communicate - TCP sockets would probably be the easiest way. The Thunderbird extension would create a server socket and wait for the Firefox extension to connect to it.

Community
- 1
- 1

Wladimir Palant
- 56,865
- 12
- 98
- 126
-
Thank you for your answer. To answer your question, nsILoginManager will go to the current profile folder, use key3.db and signons.sqlite, so it doesn't matter if Firefox is running or not if I can copy those 2 files. That also works for multiple Firefox profiles. The problem I'm facing is how to make nsILoginManager to use these new key3.db and signons.sqlite files, since it's impossible to overwrite the current key3.db. Is there a workaround for this? If I cannot use nsILoginManager, I'm thinking to decrypt them directly in my extension, but I can't find any preference to that. – wayne Mar 31 '12 at 07:59