Modifying a Firefox Addon
Now that FRTV and FRPFE are no longer distributed as user scripts, making
changes to them is more complicated. You have to:
- Download the extension file by right-clicking and saving (or you can
use a command-line tool, such as wget or curl). Here
are the links:
- Make a directory, e.g., frtv.
- Unpack the downloaded frtv.xpi into the frtv directory
(it's just a ZIP archive with a funny extension).
- Delete the META-INF directory. It contains Mozilla's
cryptographic signature assuring that the extension has not been
modified. You are about to make that signature invalid!
- Make your changes to the script.js file. If you want to change
which pages the extension is active on, you need to do that in the
manifest.json file. See the "matches" key.
Now comes the fun part. Since your modified extension is no longer signed by
Mozilla, the standard Firefox distribution will refuse to load it. You have
three options:
- Run the Firefox Nightly Edition. It allows unsigned extensions to run
after a warning.
- Run the Firefox Developer Edition. Like the Nightly, it allows
unsigned extensions. However, it uses a separate profile folder,
meaning other browser extensions, bookmarks, saved passwords, etc.,
will not be present. The idea is, since you're developing, you might
mess up the profile directory, so we don't want it to be your primary
web browsing environment.
- Have Mozilla sign your modified extension. Create an account at
addons.mozilla.org.
Then go to the
Add-on Developer Hub and submit your extension for signing. Be
sure to:
- In the manifest.json file, change the gecko id to
something unique to you. Also, change the name, and update
the version number.
- During the submission process, opt for private distribution.
Private distribution means Mozilla's robot will review the
submission and sign it in a couple of seconds. Public
distribution means you want to add your extension to the App
store. That requires a human review step, and you don't
want it in the App store anyway.
Once the signing process is complete, Mozilla will give you a link from
which you can download the signed .xpi file.