On Thu, 13 Nov 2014, at 09:17, Philip Jägenstedt wrote:
> On Wed, Nov 12, 2014 at 7:40 PM, Mounir Lamouri <
mou...@lamouri.fr>
> wrote:
> > On Thu, 13 Nov 2014, at 05:05, Chris Harrelson wrote:
> >> Sounds great!
> >>
> >> Could you post a couple of examples to the thread so everyone can see the
> >> flavor of the API without digging deep into github?
> >
> > I've added two examples in the specification, they will easier to read
> > from there:
> >
https://w3c.github.io/permissions/#examples
>
> Exposing this information sounds great, non-owner LGTM to that!
>
> Why does Permissions.get() return a promise? Are there permissions in
> Chromium where the current state cannot be retrieved synchronously?
For the moment, except a few permissions (that are sent and synchronized
via WebSettings), the permissions are actually asynchronous. We could
make them synchronous in Chromium by keeping a cache of the permission
status in the renderer and have that cache updated by the browser
process but we definitely don't want to write an API with the assumption
that this system is implementable.
I see two downsides of using an asynchronous method here:
- it will be very painful to use in collaboration with a synchronous API
but for now all the candidate APIs to use this system (geolocation,
notifications and push) are asynchronous by nature;
- user gesture bit can be lost between permission check and using the
related API - this is a problem that isn't really specific to this API
but general to Promises in Blink.
> Also, have you given any thought to whether or not this API may evolve
> to request permissions in batch, as a way to avoid many async infobars
> where the app will only work if all of them are approved? If so,
> Permissions.get() would sound a lot like Permissions.request(), in
> which case e.g. Permissions.query() might be a more suitable name for
> the current API.
The initial intent was to have a request method but it has been dropped
because Mozilla wasn't excited by it but were interested to implement
the getting part. Given that we had no short term plan to do request
merging, we dropped that and kept a minimal version that got wide
agreement and on which we can iterate.
You can look at the design doc that was shared to public-webapps, it's a
bit outdated but might give some information:
https://docs.google.com/document/d/12xnZ_8P6rTpcGxBHiDPPCe7AUyCar-ndg8lh2KwMYkM/preview
(Note: that doc is in the Documentation section in the chromestatus page
for some reasons, the Intent to Implement template doesn't include that
section.)
-- Mounir