neubert
neubert

Reputation: 16782

firefox component doesn't seem to be loading

https://github.com/terrafrost/firefox-x-forwarded-for-spoofer

That's an addon I'm trying to revive that's not working in the latest version of Firefox and I'm trying to find out why.

Near as I can tell the component isn't working and I've no idea as to why.

I've tried making the chrome.manifest file read as follows:

content x-forwarded-for chrome/content/
overlay chrome://browser/content/browser.xul chrome://x-forwarded-for/content/overlay.xul
locale x-forwarded-for en-US chrome/locale/en-US/
component ec8030f7-c20a-464f-9b0e-13a3a9e97384 components/x-forwarded-for.js
contract @[email protected]/x-forwarded-for.js;1 ec8030f7-c20a-464f-9b0e-13a3a9e97384

I've also tried @frostjedi.com/x-forwarded-for;1 (which is what x-forwarded-for.js has as the contract id but that didn't help) to no avail.

Any ideas?

Upvotes: 0

Views: 208

Answers (1)

Wladimir Palant
Wladimir Palant

Reputation: 57651

The ID you list in chrome.manifest should be the component ID, not the extension ID. Also, the contract ID seems to be incorrect, probably a copy&paste mistake. The correct lines would be:

component {f3bbf109-6d66-46ca-960e-4b78014023b3} components/x-forwarded-for.js
contract @frostjedi.com/x-forwarded-for;1 {f3bbf109-6d66-46ca-960e-4b78014023b3}

The component itself needs to be modified as well - to be compatible with Firefox 4 and above it should expose an NSGetFactory function instead of NSGetModule. It is highly recommendable to use XPCOMUtils.jsm module for that, it will do most of the work for you. You can throw out the entire module definition and replace it by the following lines:

Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var NSGetFactory = XPCOMUtils.generateNSGetFactory([XForwardedForProxy]);

Note that you no longer have to declare component ID and contract ID in the component itself, the entries in chrome.manifest are sufficient for Firefox 4 and above.

For reference: XPCOM changes in Gecko 2.0

Upvotes: 1

Related Questions