1

I want to create a new profile with an addon preinstalled.

What works:

  • run firefox a first time.
  • add the addon.xpi to profile/extensions/addon.xpi.
  • edit profile profile/extensions.ini and add Extension0=/full/path/to/extension.xpi.
  • start firefox again.

What i need:

  • add the addon to profile/extensions/addon.xpi.
  • edit extensions.ini or something similiar.
  • use only relative paths, if possible (seems not to be implemented for extensions.ini)

Finally i want to create a zip file with some firefox preferences/addons, which can be unziped into a profilefolder to create a fresh profile with some preinstalled stuff. For this, it would be important, that everything works with relative paths. If it is definitely not possible, i can add some script to it. But i would prefer some "just unzip" solution.

I think it may be a bit harder, because mozilla wanted to prevent other software from adding toolbars and similiar to firefox by making external addon installation harder. What i already found is the key extensions.autoDisableScopes=0.

allo
  • 3,955
  • 8
  • 40
  • 71

2 Answers2

1

What you can do is open firefox with command line options. And pass the file path to your xpi file, so you don't have to mess with all this internals you are over there.

So do this:

"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "C:\my.xpi"

and on launch it will open a tab and prompt to install your addon.

Noitidart
  • 35,443
  • 37
  • 154
  • 323
  • Nice idea. The problem is, i want to create a whole profile template with more than one extension. And if possible, without one install dialog per extension on the first start. Something like the dialog after an upgrade: please choose, which extension should stay enabled would be good, too. – allo Sep 21 '15 at 13:37
  • You can pass multiple URLs. But the problem is you dont want those dialogs huh? Then the approach you are taking sounds right, but i havent done it before so i dont know quite the internals. Whatever knowledge you learn from it, it would be awesome if you can share. – Noitidart Sep 21 '15 at 13:39
  • I would like to avoid the dialogs, but the more important thing is, that i would like to avoid writing (platform specific) scripts. It should just be "create a profile. Delete all default files. unpack this zip. Start firefox again." to use the profile template. Or for more advanced users: "unpack the template into the firefox directory. edit profiles.ini and add the path to the new profile". – allo Sep 21 '15 at 13:43
0

In the prefs.js:

pref("extensions.autoDisableScopes", 14); // 0x1 not set

See https://developer.mozilla.org/en-US/Add-ons/Installing_extensions#Disabling_install_locations

Then put the addons into extensions/myaddonid.xpi, making sure the filename is the id given in the install.rdf file inside the addon.xpi (zip-)file as <em:id>addon_id</em:id> tag.

On the next start the addons will be silently installed. Some addons needed one restart to work, at least the toolbar buttons were not added on the first start.

Not sure, if this will still work, when firefox decides to allow only addons signed by addons.mozilla.org. On the other hand, they will allow self-hosting addons, as soon as they are signed by AMO, so preinstalling addons downloaded from there will have a good chance.

allo
  • 3,955
  • 8
  • 40
  • 71