Friday, January 2, 2009

Fix for Firefox’s Password Exporter Add-on

7/23/09 Update: Updated to be compatible up to Firefox 3.5.1.

1/8/09 Update: If you tried installing the .xpi and got “Firefox could not install the file at [...] because: Not a valid install package -207,” please see the revised download instructions below.


I like Firefox’s Password Exporter Add-on, but recently I noticed a bug with version 1.1 (released January 5, 2008) when importing into Firefox 3. Several entries return the following error:

'Can't add a login with both a httpRealm and formSubmitURL.' when calling method: [nsILoginManager::addLogin]


I’ve posted the .xpi at http://www.vicshih.com/files/password_exporter-1.1-fx_tb-formSubmitURL-fix.xpi (90.1KB).

Right-click and Left-click this link, which should prompt Firefox to download to your machine. My web page does a redirect, so right-clicking directly actually saves an intermediate web page, which is not what you want. If in doubt, make sure file size is correct. Drag to a browser window to install.

Here’s the diff, in case you are queasy about installing my unsigned version.

Within the file chrome/content/passwordexporter.jar, in the file content/pwdex-loginmanager.js,


540,541c540,549
<
< var bogusLoginInfo = new nsLoginInfo(entries[i].hostname, 'http://passwordexporter',
---
> var doModify = false;
>
> var formSubmitURL = entries[i].formSubmitURL;
>
> if (formSubmitURL) {
> formSubmitURL = '';
> doModify = true;
> }
>
> var bogusLoginInfo = new nsLoginInfo(entries[i].hostname, formSubmitURL,
548c556
< loginManager.modifyLogin(bogusLoginInfo, entries[i]);
---
> if (doModify) loginManager.modifyLogin(bogusLoginInfo, entries[i]);

22 comments:

  1. Hi Vic,

    Do you have a fix for the:

    "XML parsing error. Passwords could not be imported."

    Error?

    ReplyDelete
  2. Sorry, no, I didn't see that error myself so I don't know anything about that.

    Have you tried opening the file in another XML reader or Firefox itself to see if it's well formed?

    ReplyDelete
  3. Thank you for your quick reply :D

    Which other xml readers are there out there?

    ReplyDelete
  4. Try just opening the .xml file in Firefox via File | Open File...

    If you're still having trouble, go ahead and email me directly; my email address can be found at www.vicshih.com.

    ReplyDelete
  5. Vic! You Legend!

    There was one obsolete password that was jamming it it seemed!

    I am gonna see if I can do it to other exports and see if that is what was holding my particular exports back from being imported!

    If it is, I will report it here :D

    Thank you.

    ReplyDelete
  6. Screenshot of when I opened up the xml in Firefox:

    http://img357.imageshack.us/img357/3193/4012009100841pmqa1.png

    I deleted it, and since have been able to open the xml file, and import my few hundred passwords!

    Again, a warm, heartfelt thank you Vic :)

    ReplyDelete
  7. I dunno Vic I tried it and got:

    Firefox could not install the file at

    file:///E:/2--GOLD_code%20snippets/Format%20stuff%20PENTING!/Password%20stuff/password_exporter-1.1-fx_tb-formSubmitURL-fix.xpi

    because: Not a valid install package
    -207

    ReplyDelete
  8. LETTERS NOT EDITORS, sorry about that. There's something weird about my web page when handling the redirect.

    Instead of right-clicking and saving, try left-clicking, which should prompt Firefox to save to disk.

    I'll update the blog instructions now.

    ReplyDelete
  9. Vic, your fix works like a charm, even in 3.1 beta.

    Thanks!

    ReplyDelete
  10. Wow, Vic, you are a life saver!

    I've been fighting to find a way around this xml parsing error for hours now.. lol Finally found your page and now I have all my MANY passwords saved in my new Firefox profile! Whew!!

    I hope you don't mind, I've posted the fix with a link to your page in a few forums because I see there are a LOT of people with the same problem, and YOU have the only fix!

    Thank you, Thank you, Thank you, and God bless you!!
    ~ MomRee ~

    ReplyDelete
  11. I'm still getting xml parsing error even with your download. is there something i'm missing here?

    ReplyDelete
  12. Carlo, you're talking about the exported xml file?

    Does it open in Firefox?

    You can try chatting with me with the chat bubble.

    ReplyDelete
  13. ah. actually, i've been exporting to csv (Mac OS) - perhaps that's my problem?

    ReplyDelete
  14. @Carlo, ah. Give the XML export a try -- the CSV export won't allow you to use the technique described to catch the XML parse errors.

    ReplyDelete
  15. Dude,

    Thanks for this.
    Had some passes I couldn't import. Your fix worked perfect.

    Stay Cool.

    ReplyDelete
  16. Vic, real thanks for this fix! The recent FF 3.5 has a bug and will not import my passwords from the previous 3.0 profile, no fixes with signons.sql worked and I was left with the password exporter. However, it did not import passwords for basic authentication, with your fix everything went smoothly!

    ReplyDelete
  17. Thanks :o) it works

    ReplyDelete
  18. Works well. Any chance you could update it for 3.5? So far as I can tell, it works just fine in 3.5 (I turned off my compatibility check to try it), but a quickie update to flag it as compatible would be nice. Also, have you communicated at all with the original author? Having this fixed version available from the main mozilla add-on site would be nice.

    ReplyDelete
  19. @worlebird, I've updated maxVersion to 3.5.*. Thanks!

    I posted to the author's forum, and I believe I emailed him, but haven't heard anything.

    ReplyDelete
  20. "XML parsing error. Passwords could not be imported." > solved or better say with workaround. Issue with the codding for the xml.Using CZECH, ENGLISH and BULGARIAN keyboards causes saving passwords in other codding where xml shows this error.
    I tried following.
    1. Export passwords from the new extension where one can be saved.
    2. Open the xml with the old saved passwords.
    3. Copy from the old to the new xml by taking not more then 10 lines so if the error appear while importing to see which line contain characters as "+ a" or similar so to remove them.
    4. Once the error appear you need to export again the newer passwords and save them to new file, the characters already changed the xml coding so wont work anymore.
    It works for me, exported from Firefox portable 2.X to 3.X installed version.

    VirusRemovalTeam@McAfee

    ReplyDelete
  21. Pretty! This has been an incredibly wonderful article.
    Thank you for supplying this information.

    NY

    ReplyDelete