FireFox API install extension - windows

How do I install, update, uninstall FireFox extensions on Windows?
The article (https://developer.mozilla.org/en/Adding_Extensions_using_the_Windows_Registry) seems like a legacy information...
I have installed FireFox 3.6.3.
However, I don't see "HKEY_LOCAL_MACHINE\Software\Mozilla\Firefox\Extensions" in my registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.6.3 (en-GB)]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.6.3 (en-GB)\Main]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.6.3 (en-GB)\Uninstall]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox 3.6.3]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox 3.6.3\bin]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox 3.6.3\extensions]
For example, I want to install my_ext.xpi (ID: my_ext#my_site.com, Path: c:\myapp\ff_addons\my_ext.xpi).
Could you talk me how can I install my extension ?
Which firefox's versions support this method ?

The extension registry key (HKEY_LOCAL_MACHINE\Software\Mozilla\Firefox\Extensions) doesn't exist by default - simply create it and register your extension there as detailed in Mozilla's instructions (which you linked to).
This method has been working fine for me for over a year now.
You also have another option (which also works on non-Windows machines): Installing Extensions

The windows registry method is not a legacy method, and it's the supported way of installing an add-on for all users on a machine (and all Firefox profiles).
I'm curious as to why you felt it was a legacy method.

Are you talking about an extension or a plug-in?
Extensions are generally installed by having Firefox open an .xpi file. And .xpi files are just .zip files with a manifest (.rdf) and your various scripts and libraries. You can install it manually by creating the right directory structure. On my machine extensions live here: C:\Users\[username]\AppData\Roaming\Mozilla\Firefox\Profiles\[random-number].default\extensions. You create a subdirectory there called yourextension#yourcompany.com and then unzip the contents of your XPI inside the subdirectory. The next time the user re-starts firefox, your extension will be installed. There are a few gotcha's though:
Users have to manually restart Firefox.
You don't know which profile to use if there is more than one. The profile is identified by the [random-number] above. Many users have more than one profile.
On Mac and Linux this is a different directory, though the same basic idea applies.
Plugins are things like Flash that run inside a webpage. You can install those by setting a registry key, but I think in general there is a well-known folder where Firefox looks and loads anything that starts with NP (e.g. NPSWF32.dll). Seriously, it looks for NP. And each plugin must export certain NPAPI functions that Firefox uses to negotiate... stuff.

Related

How to install and enable Firefox extensions using bash script

I need to install & enable a series of Firefox add-ons, for a singe profile, without user input, using a bash script. It is a matter of editing a config file in the user's profile folder, as copying an entire, manually installed folder worked.
Any online resources I could find are extremely outdated.
Just downloading the .xpi files into ~/.mozilla/firefox/*123abc.profilename/extensions does install the add-ons, but requires user input to enable.
user_pref("extensions.webextensions.ExtensionStorageIDB.migrated.*extensionid*", true); is inserted into prefs.js by manual enabling, but doesn't enable the addon itseld
extenstions.json [1] & extension-settings.json also have no effect.
extension-preferences.json is only observed to be affected by allowing addons to run in private windows.
Thank you in advance.
Corrections:
[1] My Testing indicates that extenstion.json is what i'm looking for, but I am not yet sure what needs to be modified as it has no white space, making it hard to read. Will edit with any updates.

How to download a Firefox add-on without Firefox

I am in a corporate network and wanted to install some developer tools for Firefox. Unfortunately policies forbid that Firefox can access the internet directly, but there are other browsers available to go there. Now: how can I download an xpi-file directly without Firefox?
The problem when I access the addons-page for Firefox: the Download-Button is replaced with something similar to "only available in Firefox - download Firefox". Unfortunately I don't have other developer tools available yet, so I can not even inspect the site and look whether an actual link is available. But maybe there is some pattern, how the link could be derived? Or another site where the add-ons are listed?
I found two (and a half) ways overcoming that problem for now. One is simply using another device, that has firefox on it and copy the link from there (as also stated in the comment).
Another variant was to look in the source code of the add-on-page. Hidden within some json-data is the actual download-url, e.g.:
"url":"https:\u002F\u002Faddons.mozilla.org\u002Ffirefox\u002Fdownloads\u002Ffile\u002F<plugin- or download-id>\u002F<plugin-file-name>.xpi?src="
After transforming that url back (basically only replacing the \u002F to / (and any other special symbol)), I could download the xpi without problem.
I also found a page where you could copy&paste the add-on-page into it and it started a plugin download. However I do not know anything about that site otherwise (so use at your own risk). It's name was "XPI Downloader". A pity it doesn't just list the actual url to the add-on itself :-/

Redirect Firefox extension updates to official add-ons site?

Now that Mozilla requires Firefox extensions to be signed, I've decided to only host my personal extensions at the official Add-ons for Firefox (AMO) site. Previously, I hosted my extensions at my personal website, using the requisite update manifest machinery.
I'd like to redirect users who installed my extensions directly from my personal website to the new versions at AMO. I was under the impression that if I released an update of my extension without the custom updateURL in the extension's manifest, that it would check AMO by default. That doesn't seem to be the case, however.
How can I make it so that users who installed my extension via my personal site can get updates going forward from the official add-ons site? Are they essentially forced to uninstall / reinstall to pick up this change? Or can I trigger it somehow?
I should point out that the extension ID for my extension is the same, regardless of my distribution point. This is one reason I thought that simply removing the updateURL from the installer manifest would do the right thing.
Update: Here's further details on the scenario I'm trying to solve:
User installed version 2.6.5 of my extension from my personal website some time in the past.
I released version 2.6.6 of the extension on my personal website, removing the updateURL node from that version's installer manifest in the process.
I release version 2.6.7 of the extension on AMO only. I expect that the user from step 1 should be able to automatically upgrade their install to 2.6.7, but this isn't the case. It's as if Firefox doesn't know to check AMO for that given extension, even though the extension ID is the same.
Update 2: My installer manifest for version 2.6.6 contained the updateKey node, but not the updateURL node. When I remove the updateKey from the installer manifest, repackage the extension, and install it, the updates available at AMO are then found successfully. This shifts the problem, however, to the update manifest on my website. In order for an extension update to be found via my website, it needs the updateKey (unless I'm missing something obvious). How can I automatically push an update to an extension that (a) isn't hosted on AMO and (b) has neither an updateKey or an updateURL present in its installer manifest?
If you have your extension hosted on AMO, it will be automatically updated for the user (unless the user has 'Automatic updates' turned off for your particular add-on via Tools > Add-ons > Extensions > (your extension) > More.
And yes, you should remove the updateURL tag from your install.rdf file.
You can find more information at the MDM site.

Method to install multiple Firefox extensions or addons in with least user intervention?

The Question:
How do I install multiple Firefox extensions into a fresh Firefox v11+ profile, with the least amount of user wasted motion (reduced mouse clicks and keyboard presses) other than the bare minimum for verifying security constraints (e.g., a single "scare" prompt)?
The Constraints:
The methodology should be exactly the same on both Linux and Windows installations of Firefox, and not require administrators rights (exceptions made for Windows, maybe) or root privileges (Firefox installed locally in the users home directory, not under /bin).
Any extensions that are automatically updated via whatever mechanism is currently used should continue to update those extensions. (Exception maybe for keyconfig extension (see below) if it doesn't automatically update itself upon new revisions, but I don't know if that is the case or not).
The methodology should work for extensions that do not show up in the "Get Addons" search under Tools/Add-ons (e.g., keyconfig mentioned below in the "almost" solutions section).
The "Almost" Solutions:
Below are various things I've tried but that do not do exactly what is needed. The key constraint here is reducing the amount of wasted motion I spend when installing Firefox extensions.
The command-line way:
I can get almost what I want via invoking Firefox with the fully-qualified paths to .xpi files stored locally on my filesystem (tested only on Linux 64-bit machines; not on Windows yet but may work there too) via this type of command-line:
firefox some_extension1.xpi \
some_extension2.xpi \
some_extension3.xpi \
... \
some_extensionN.xpi
where some_extensionN.xpi are fully-qualified paths to specific extensions I desire to be installed. But that is not workable because Firefox prompts multiple times, once per each extension to be installed, when only one security prompt is necessary. Multiple promptings are a show-stopper.
The Massive Extender Way:
Massive Extender extension kept me mostly happy, but was rendered inoperable because of the dropping of support for the AddOn Collections extension. Waiting for someone to get around to supporting extensions in Firefox Sync is probably not an option: I believe that they will disallow syncing of extensions that are not registered through some official channel such as the one that shows up in searches from the Tools>Addons menu entry in Firefox. An example of a extremely useful extension that does not seem to be managed via the official channel is the keyconfig extension.
The FEBE Extension way:
The FEBE extension comes close, but is not workable either because, well, it crashes Firefox when trying to restore from Box.net (as of 2014-04-05).
You should create a multi-item package. You basically ZIP up an install.rdf file and several XPI files and rename the archive into something.xpi. The install.rdf file should look like this:
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>foobar#example.com</em:id>
<em:type>32</em:type>
<em:targetApplication>
<Description>
<!-- Firefox -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>10.0</em:minVersion>
<em:maxVersion>11.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
You probably want to choose some ID for your bundle that is different from foobar#example.com and adjust the compatible Firefox versions. Then you can simply trigger the installation of this bundle and it will install all the extensions inside.
Important note: install.rdf has to be located at the top level of the ZIP archive, not inside a subdirectory.

What is the most reliable way to check for firefox installation?

I am making a software that comes bundled with a firefox extension. In my instalation script I want to prompt a user weather he wants to install the extension. But for that I need:
A way to tell if firefox is installed or not
A way to tell which version of firefox is installed
How would I do these two things in InnoSetup or C#? I tried manually checking the path to default firefox install dir or checking for uninstall records in registry. I think that these methods are not reliable at all.
The recommended way is checking whether HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox registry key exists. There will be a subkey for each installed version. If you are paranoid, you can also check the value HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\<version>\Main\PathToExe - if that file exists then Firefox is really installed and you aren't looking at a stale registry key.
Note that you can only detect a Firefox installation only if the installer was actually used. You can always "install" Firefox manually, simply by unpacking the setup executable with 7zip - into any directory. Nightly builds are also available as regular zip files that are easier to unpack. This will work just fine but won't add any registry keys that will allow you to find this installation.
Here is a shortened list of created keys (by Firefox 27.0.1 installation)
HKLM\SOFTWARE\Classes\FirefoxHTML\
HKLM\SOFTWARE\Classes\FirefoxURL\
HKLM\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe\
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe\Path
HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox 27.0.1 (x86 en-US)\
HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe\
HKLM\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\27.0.1 (en-US)\
HKLM\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox 27.0.1\
HKLM\SOFTWARE\Wow6432Node\Clients\StartMenuInternet\FIREFOX.EXE\
One of our client did not have the "Uninstall" one so we'll use another from that list.
I am going to use: "firefox is installed when at least one of the following keys exists:"
HKLM\SOFTWARE\Mozilla\Mozilla Firefox\
HKLM\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\
HKLM\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\
HKLM\SOFTWARE\Wow6432Node\Clients\StartMenuInternet\FIREFOX.EXE\
I think HKLM\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE key isn't dependent from OS bits, so I suggest this.

Resources