Do I need to create an .xpi file to test my Firefox extension?

1.6k views Asked by At

I have a Firefox extension. When I change the source code, every time I have to create the zip file including the source code and then make it as a .xpi file. Can I avoid this making *.xpi file steps?

2

There are 2 answers

1
Makyen On BEST ANSWER

For all types of Firefox extensions you can test your extension without the need to create an .xpi file for each iteration.

WebExtensions

  • WebExtensions can be directly loaded as a temporary extension from the directory containing the manifest.json file. This is done from about:debugging.

  • You can use web-ext run to test your extension in a temporary profile.

  • They can be installed as an unpacked extension (all files not in a .xpi file). In addition, you can use a Firefox extension proxy file to have your extension files located in any directory you choose, not just under the profile's extensions directory.

Add-on SDK extensions

  • You can use jpm run to test your extension without directly dealing with the .xpi file.
  • Add-on SDK extensions can not be loaded as temporary extensions without first explicitly creating the .xpi file with jpm xpi. However, as an .xpi, they can be loaded as temporary extensions.
  • Add-on SDK extensions can not directly be loaded as unpacked extensions. You would need to package the extension first using jpn xpi, then manually unpacking the extension.

Bootstrap/Restartless extensions

  • Bootstrap/Restartless extensions can be directly loaded as a temporary extension from the directory containing the chrome.manifest and install.rdf files. This is done from about:debugging.

  • They can be installed as an unpacked extension (all files not in a .xpi file). In addition, you can use a Firefox extension proxy file to have your extension files located in any directory you choose, not just under the profile's extensions directory.

Overlay/Legacy/XUL based extensions

  • Overlay/Legacy/XUL based extensions can not be loaded as a temporary extension.

  • They can be installed as an unpacked extension (all files not in a .xpi file). In addition, you can use a Firefox extension proxy file to have your extension files located in any directory you choose, not just under the profile's extensions directory.

Additional information

I would suggest you read Installing add-ons for development and Installing a Temporary Add-on which cover these issues in more detail.

0
Santosh On

With WebExtensions, you don't need to create the .xpi file. You can directly go to about:debugging in the address bar and load your temporary add-on file. You can also click on debug to debug your webExtension. Have a look at this for more information on loading your first firefox add-on.