Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting plugin activation state from addons

148 views
Skip to first unread message

Georg Fritzsche

unread,
Mar 11, 2014, 8:02:34 AM3/11/14
to dev-tech...@lists.mozilla.org
Hi,

some plugins are delivered to Firefox via XPIs. If you do that, you can add
per-site or global permissions for your plugin and don’t require any white-
listing.

While we don’t have docs yet on the subject, here is an outline i put on bug
982028:

For adding the permissions (per site, preferred if possible) you would use
nsIPermissionManager.add() for every mimetype [1].
* for the type param use nsIPluginManager.getPermissionStringForType().
* the permission param should be Ci.nsIPermissionManager.ALLOW_ACTION
* expire type Ci.nsIPermissionManager.EXPIRE_NEVER or
Ci.nsIPermissionManager.EXPIRE_TIME

You can see similar usage to that in our click-to-play code and check permissions.sqlite
in your profile folder [2].

Globally activating (avoid if possible to reduce exposure) a plugin would be done via
prefs, you can check about:config and filter for "plugin.state." for comparison.


Georg


[1] https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIPermissionManager#add%28%29
[2] http://hg.mozilla.org//mozilla-central/annotate/67485526e241/browser/base/content/browser-plugins.js#l729

Georg Fritzsche

unread,
Mar 11, 2014, 10:31:00 AM3/11/14
to dev-tech...@lists.mozilla.org
… and Benjamin brought up the good point that addons should use EXPIRE_SESSION
instead of EXPIRE_NEVER, as otherwise we get stale data when it is disabled or uninstalled.

Marcin Pijanowski

unread,
Mar 11, 2014, 10:40:40 AM3/11/14
to Georg Fritzsche, dev-tech...@lists.mozilla.org
OK. Thanks.

Is there any version of mozilla where I can check whether the solution
works?
Is http://www.mozilla.org/aurora/ suitable for testing ?

-----Original Message-----
From: dev-tech-plugins
[mailto:dev-tech-plugins-bounces+marcin.pijanowski=comar...@lists.mozilla.
org] On Behalf Of Georg Fritzsche
Sent: Tuesday, March 11, 2014 3:31 PM
To: dev-tech...@lists.mozilla.org
Subject: Re: Setting plugin activation state from addons

. and Benjamin brought up the good point that addons should use
_______________________________________________
dev-tech-plugins mailing list
dev-tech...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-plugins

David E. Ross

unread,
Mar 11, 2014, 5:51:45 PM3/11/14
to
Do you really mean plugins, or do you mean extensions? I have never
seen a plugin installed from an .xpi file.

--

David E. Ross
<http://www.rossde.com/>

On occasion, I filter and ignore all newsgroup messages
posted through GoogleGroups via Google's G2/1.0 user agent
because of spam, flames, and trolling from that source.

Benjamin Smedberg

unread,
Mar 11, 2014, 6:00:05 PM3/11/14
to David E. Ross, dev-tech...@lists.mozilla.org
On 3/11/14 5:51 PM, David E. Ross wrote:
> Do you really mean plugins, or do you mean extensions? I have never
> seen a plugin installed from an .xpi file.
>
Yes, plugins. It's a reasonably common way to deploy some kinds of
plugins to Firefox users.

--BDS

Georg Fritzsche

unread,
Mar 13, 2014, 9:56:21 AM3/13/14
to Marcin Pijanowski, dev-tech...@lists.mozilla.org
On 13 Mar 2014, at 14:37, Marcin Pijanowski <marcin.p...@comarch.pl> wrote:
> Content of signplugin.js.
> pref("dom.ipc.plugins.enabled.npsignplugining.dll", false);
>
> and now I want to add pref - plugin.state.<name>
>
> plugin.state. = 0 ‘never active’
> plugin.state. = 1 ‘always active’
> plugin.state. = 2 ‘default state, does nothing’

The value for plugin.state.yourplugin should be:
* 0 for ‘never activate’ (disable)
* 1 for ‘ask to activate’ (click-to-play)
* 2 for ‘always activate’

The upcoming change sets your plugin state to 1, you want to set it to 2.

> in my case I add
> pref("plugin.state.ING BusinessOnLine", 1);

The name is probably different, here is what you can do to see how this works:
Your plugin should get listed in Tools->Addons->Plugins as ‘ask to activate’.
There, set it to e.g. ‘always activate’. Now check about:config by filtering for
“plugin.state.”. There should be an entry for your plugin, probably
“plugin.state.npsignplugining”.

> pref("dom.ipc.plugins.enabled.npsignplugining.dll", false);

Please don’t use this pref if at all possible, we really want all plugins to run out-
of-process for stability reasons etc.

> How and where to check whether this solution works correctly?

Verify by installing and checking the plugin activates or looking at the prefs.


Georg

Georg Fritzsche

unread,
Mar 13, 2014, 4:24:00 PM3/13/14
to Marcin Pijanowski, dev-tech...@lists.mozilla.org
You can verify this like so:
* use a new profile in Aurora or Nightly
* install the old add-on version that doesn’t have the pref
* check that your plugin is click-to-play on sites that use it (without allowing it there)
* install your add-on
* check that your plugin is now always active on the sites


Georg

On 13 Mar 2014, at 15:33, Marcin Pijanowski <marcin.p...@comarch.pl> wrote:

> I changed to 2.
> Now I have only one pref in signplugin.js.
> pref("plugin.state.npsignplugining", 2);
>
> Attachment includes screenshot after installation plugin. In the attachment is also xpi file. Can you install and check it?
> now is it ok, if not please correct?
>
> --
> Marcin
>
> From: Georg Fritzsche [mailto:georg.f...@gmail.com]
> Sent: Thursday, March 13, 2014 2:56 PM
> To: Marcin Pijanowski
> Cc: dev-tech...@lists.mozilla.org
> Subject: Re: Setting plugin activation state from addons
>
> <activePlugin.zip>

Georg Fritzsche

unread,
Apr 24, 2014, 4:31:11 AM4/24/14
to dev-tech...@lists.mozilla.org, Marcin Pijanowski
We decided to automatically activate plugins that are located in extensions.
This change (bug 982101) will land together with making most plugins click-to-play
by default and the whitelist (bug 992995).
That means that plugins bundled in extensions are not affected by the changes.

Note: This is currently targeted for Firefox 30.

Georg

https://bugzilla.mozilla.org/show_bug.cgi?id=982101
https://bugzilla.mozilla.org/show_bug.cgi?id=992995
0 new messages