Understanding Add-on Scopes

In my earlier post on Integrating Add-ons into Firefox, I indicated the for some of the install methods, you have to set the preference extensions.autoDisableScopes to 0. In the comments, Blair McBride recommended against setting this preference to 0, because it would enable any third-party add-on install. Based on the feedback I’ve seen from enterprises since the release of Firefox 8, they simply want things to work the way they did before Firefox 8. to do that, you set the preference to 0. But Blair’s statement made me realize that a much better explanation of add-on scopes and the two related preferences was in order.

So what exactly are add-on scopes? Firefox divides the locations from which add-ons can be installed into four scopes. Each of these scopes can be turned on or off individually. We’ll talk about the preferences later, but first, let’s understand each of the scopes.

1 (SCOPE_PROFILE)

This is the profile scope. This means any add-on that is in the current profile directory.

2 (SCOPE_USER)

This is the user scope. This means any add-on that is referenced by the current USER’s registry entry or any add-on that is in the user’s extensions directory. On Windows, that means %appdata%\Mozilla\Extensions\{ec8030f7-c20a-464f-9b0e-13a3a9e97384}\. You can get more information here and here.

4 (SCOPE_APPLICATION)

This is the application scope. This means any add-on that is in the extensions directory where the executable is located.

8 (SCOPE_SYSTEM)

This is the system scope. This means any add-on that is referenced by a SYSTEM/MACHINE registry entry or any add-on that is in the system’s extensions directory. Windows does not have a system extension directory. You can get more information here and here.

To use the scopes as preferences values, just add together the values.

There are two preferences that use these scopes, extensions.enabledScopes and extensions.autoDisableScopes. A lot of confusion seems to be arising because the preferences are named similarly. Let’s take each one individually and see if we can make sense of them.

extensions.enabledScopes has been around since Firefox 4. It used to prevent Firefox from even looking in certain locations to find add-ons. You may wonder “why would I ever want to do that?” A good example would be if you were running Firefox from a USB key like SurfEasy or Portable Firefox. You would probably not want add-ons that are on the host computer to be loaded into Firefox. So you would set extensions.enabledScopes to 5 10. That says “don’t read add-ons from the user’s directory or the system.” The default value for this preference is 15 which means that all locations are searched for add-ons.

extensions.autoDisableScopes was introduced in Firefox 8 as part of the effort to crack down on third-party add-ons. It is used to specify the locations from which add-ons will be disabled by default. The default value for this preference is 15 which means that add-ons are disabled by default in all locations. You may wonder how this works, since the user’s profile directory is one of those locations. Add-ons are only disabled by default if they were not explicitly installed by the user. So if an external application places an add-on into the user’s profile directory, it is disabled by default.

Because these preferences are required very early in Firefox’s startup (and for obvious reasons), you cannot set them in your extension. They can only be set by creating a .js file in the defaults/pref directory. The JS file can have any name as long as it ends in .js. Setting them looks like this:

pref("extensions.autoDisableScopes", 0);
pref("extensions.enableScopes", 15);

Also, if you use autoconfig files, you can not set this preference remotely. I recommend only setting this preference in a defaults/pref file.

And that’s how add-on scopes work.

7 Responses to “Understanding Add-on Scopes”

  1. AndyC February 22, 2012 at 5:53 am #

    Hi Mike

    Thanks for the informative posting. I’d just like to clarify one part. You said…

    You would probably not want add-ons that are on the host computer to be loaded into Firefox. So you would set extensions.enabledScopes to 10. That says “don’t read add-ons from the user’s directory or the system.”

    Doesn’t that enable SCOPE_SYSTEM (8) + SCOPE_USER (2) i.e. the exact opposite of what we want?

    • Mike Kaply February 22, 2012 at 7:59 am #

      > Doesn’t that enable SCOPE_SYSTEM (8) + SCOPE_USER (2) i.e. the exact opposite of what we want?

      Yes it does. I was thinking of disabling scopes. See, even I get confused :) . I’ve fixed the post.

  2. James February 22, 2012 at 7:33 pm #

    How does Firefox tell if a user installed an extension themselves?

    • Mike Kaply February 23, 2012 at 8:53 am #

      I’ve had the same question, but haven’t taken the time to investigate. I’ll see if I can figure it out.

  3. Dimas April 13, 2012 at 1:55 am #

    Maybe you can add a note clarifying that setting autoDisableScopes in a autoconfiguration file on a remote server (http://server/firefox_prefs.js) doesn’t work because it is read too late by Firefox.

    The only solution is setting it directly inside /defaults/pref directory, as you said in the enterprise mailing list (thx :-) ).

  4. Raman April 20, 2012 at 6:18 am #

    If I want to enable all third party plugins automatically, will doing a
    user_pref(“extensions.autoDisableScopes”, 0);
    be sufficient to achieve this ?

    • Mike Kaply April 20, 2012 at 7:48 am #

      I assume by third party plugins, you mean third party extensions. If that is the case, yes, that will work.

Leave a Reply:

Gravatar Image