I am an advanced user and have some programmer skills but I have installed some firefox add-on and I'd like to add some extra code line to original code. But I've only got .xpi file.
I know it can be opened by any zip utility. But it doesn't work when I change something in there. It stores .js file in CONTENT folder. There is an output-to-file function and I want to format a string a little bit that is being saved into a file.
You can to not mention the beginning of the question but there is the main goal and question: How to recompile or apply any changes to .js files in installed .xpi extensions? Any ways to upgrade them.
Add-ons:
Essentially you just zip up stuff again (non-SDK add-ons). And those add-ons you linked are non-SDK add-ons.
However there are some pitfalls:
META-INF
folder. Modifying stuff will of course invalidate the signature. Just remove the folder to make the (modified) extension unsigned again..xpi
) then contains/some-addon-folder/install.rdf
instead of just/install.rdf
. Make sure to not zip the outer folder, just the files and subfolders within.This is correctly zipped:
This is not correctly zipped (produced by using the OSX compress menu item):
(Aside from the
__MACOSX
crap, it ishttp_request_logger-0.1-fx/install.rdf
now)I recommend you also read Setting up an extension development enviroment, in particular the bits about the proxy file. ;)
When it comes to SDK add-ons (as indicated by the presence of a
harness-options.json
file), re-zipping may or not work. It might be better to just reproduce a package.json and directory structure based on the.xpi
contents and use the SDKcfx
tool to build a new XPI.