How to examine source code of Firefox extension before installing it?
As Wladimir pointed out the .xpi file is simply a ZIP archive put together in a particular way. Open it with WinRAR, 7-zip or rename it to .zip and open it with your OS's default tool.
EDIT:
(It appears that Mozilla's addons page no longer has this type of "Install" button, so this method won't work.)
To get ahold of the .xpi file use https://addons.mozilla.org instead of the built-in extension manager. From there you can right-click on the install button and choose Save as...
With installed extensions, you can:
- open your Firefox profile folder
- double-click the
extensions
subfolder - identify the
.xsi
file of the desired extension (some are obvious, others not) - right-click on the
.xsi
file and chooseOpen With
(and then possiblyMore Apps
) - choose your zip file management app (ie. WinRAR, 7-Zip, etc) and the extension should open as a compressed folder.
To check a Firefox extension source before installing. This works on macos and linux.
- Got to e.g. https://addons.mozilla.org/en-US/firefox/addon/open-same-tab/
- Right click "+ Add to Firefox" and "Copy Link Location"
- Download and unpack the copied url:
$ curl -L https://addons.mozilla.org/firefox/downloads/file/3570442/open_same_tab-0.1.7-fx.xpi?src=dp-btn-primary > /tmp/extension.xpi
$ unzip /tmp/extension.xpi -d /tmp/extension
The extension source is now in /tmp/extension
.
- To install if you're happy with the review, open
file:///tmp/extension.xpi
in Firefox.