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]);