I’m sure I saw somewhere an example how to use JavaScript modules in Firefox extensions and I just used that snippet. Anyway, I was recently caught by a conflict between New Tab Jumpstart extension and NetVideoHunter Basically they could not work together and whichever was loaded first was working properly, second loaded wasn’t.
It turns out that conflict was due to both extensions registering modules folder with the same alias modules. Both extensions would thus import their files with a similar uri: Components.utils.import(“resource://modules/some_module.js”);
The reason why this was failing is resource://modules will be registered for the first loaded extension so for one of the extensions some_module.js file will not be found in the registered location (or even worse it will be found but would be completely wrong).
It was simply fixed by changing registration in chrome.manifest to: resource jumpstart content/modules/ and replacing resource://modules to resource://jumpstart in all files.
Now when I look at it it’s completely logical but you do it once, don’t think about it at the time and you forget about it but it comes back to bite you later. All in all, if you plan on using modules in your extension do not register your modules folder with modules alias or similar, use your extension’s alias.
Comments