Setting plugin activation state from addons

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting plugin activation state from addons

Georg Fritzsche-3
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

_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins
Reply | Threaded
Open this post in threaded view
|

Re: Setting plugin activation state from addons

Georg Fritzsche-3
… 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.

On 11 Mar 2014, at 13:02, Georg Fritzsche <[hidden email]> wrote:

> 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
>

_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins
Reply | Threaded
Open this post in threaded view
|

RE: Setting plugin activation state from addons

Marcin Pijanowski
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=[hidden email].
org] On Behalf Of Georg Fritzsche
Sent: Tuesday, March 11, 2014 3:31 PM
To: [hidden email]
Subject: Re: Setting plugin activation state from addons

. 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.

On 11 Mar 2014, at 13:02, Georg Fritzsche <[hidden email]> wrote:

> 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/nsI
> PermissionManager#add%28%29 [2]
> http://hg.mozilla.org//mozilla-central/annotate/67485526e241/browser/b
> ase/content/browser-plugins.js#l729
>

_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins

_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins
Reply | Threaded
Open this post in threaded view
|

Re: Setting plugin activation state from addons

David E. Ross-3
In reply to this post by Georg Fritzsche-3
On 3/11/2014 5:02 AM, Georg Fritzsche wrote:

> 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
>

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.
_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins
Reply | Threaded
Open this post in threaded view
|

Re: Setting plugin activation state from addons

Benjamin Smedberg
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

_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins
Reply | Threaded
Open this post in threaded view
|

Re: Setting plugin activation state from addons

Georg Fritzsche-3
In reply to this post by Georg Fritzsche-3
On 13 Mar 2014, at 14:37, Marcin Pijanowski <[hidden email]> 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
_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins
Reply | Threaded
Open this post in threaded view
|

Re: Setting plugin activation state from addons

Georg Fritzsche-3
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 <[hidden email]> 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:[hidden email]]
> Sent: Thursday, March 13, 2014 2:56 PM
> To: Marcin Pijanowski
> Cc: [hidden email]
> Subject: Re: Setting plugin activation state from addons
>  
> On 13 Mar 2014, at 14:37, Marcin Pijanowski <[hidden email]> 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
> <activePlugin.zip>

_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins
Reply | Threaded
Open this post in threaded view
|

Re: Setting plugin activation state from addons

Georg Fritzsche-3
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

On 13 Mar 2014, at 21:24, Georg Fritzsche <[hidden email]> wrote:

> 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 <[hidden email]> 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:[hidden email]]
>> Sent: Thursday, March 13, 2014 2:56 PM
>> To: Marcin Pijanowski
>> Cc: [hidden email]
>> Subject: Re: Setting plugin activation state from addons
>>  
>> On 13 Mar 2014, at 14:37, Marcin Pijanowski <[hidden email]> 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
>> <activePlugin.zip>
>

_______________________________________________
dev-tech-plugins mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-plugins