Re: Setting plugin activation state from addons

Georg Fritzsche <[email protected]> Tue, 11 Mar 2014 15:31:00 +0100
Newsgroups gmane.comp.mozilla.devel.plugins
Message-ID <[email protected]>
… 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 <[email protected]> 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
>