Re: Proposal for a Permissions API

On Wed, 3 Sep 2014, at 04:41, Jonas Sicking wrote:
> I'm generally supportive of this direction.
> 
> I'm not sure that that the PermissionStatus thing is needed. For
> example in order to support bluetooth is might be better to make the
> call look like:
> 
> permissions.has("bluetooth", "fitbit").then(...);

That's more Permission than PermissionStatus, right?

What you proposed here would probably be something like that in WebIDL:
Promise<> has(PermissionName name, any options);

But really, we could make that option bag be a dictionary because it
gives good context about what you are passing like what does "fitbit"
means here? Is that a black listed device or a white listed one? The one
you want to target?

I agree that it might be unusual to have a required "name" than might
often be used alone but it makes the API way more javascript-y and self
explanatory. IMO, this call is nicer to read than the one you wrote
above:
  permissions.has({ name: 'bluetooth', devices: 'fitbit' });
because I understand what the call is trying to do. In addition, as you
pointed, it gives a lot of flexibility.

On Wed, 3 Sep 2014, at 05:45, Boris Zbarsky wrote:
> On 9/2/14, 9:51 AM, Mounir Lamouri wrote:
> >    required PermissionName name;
> 
> Glad to see "required" being put to good use.  ;)

Let say that "required" was added at the right time. My draft had this
odd requirement before ;)

> > interface PermissionManager {
> 
> IDL nit: This needs Exposed=(Window,Worker)
> 
> > [NoInterfaceObject, Exposed=Window,Worker]
> 
> And parens.

The proposal in the document has been updated accordingly.

On Wed, 3 Sep 2014, at 07:10, Dave Raggett wrote:
> Have you considered making this return a promise, as per Nikhil's
> proposal:

It does. navigator.permissions.has({}) returns a
Promise<PermissionStatus>.

> p.s. I will bring your idea to the trust & permissions in the open web 
> platform meeting, we're holding in Paris this week, see:

Adrienne Felt from Chrome Security will be representing Google at that
meeting. She should be able to present the proposal and answer any
questions about it. It was on purpose sent before the meeting FWIW.

-- Mounir

Received on Wednesday, 3 September 2014 10:29:26 UTC