Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission API updates #35768

Merged
merged 6 commits into from
Sep 19, 2024
Merged

Conversation

hamishwillee
Copy link
Collaborator

@hamishwillee hamishwillee commented Sep 6, 2024

This is a "refresh" of the Permissions API docs. I'm doing it as part of looking at addition of microphone and camera permissions. The docs are a bit dated - they won't be perfect after this, but they will be better.

The main change is to try to cut back some of the future looking behaviour that was written back when this was created. The story is now stable:

  • Permissions aggregate the permission to use an api from permissions policy, secure context, user prompt, or whatever else accesses it.
  • You can query the current permission.
  • That's it - revoking the permission is not supported in the API, and neither is requesting it.

I also added a security considerations section for the Geolocation overview page. Next iteration of these docs I'd hope to perhaps do this for all the permission using APIs. From that I could add a list of things that cause the permission prompt to this doc.

Related docs work can be tracked in #35765

@github-actions github-actions bot added Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed labels Sep 6, 2024
Copy link
Contributor

github-actions bot commented Sep 6, 2024

@hamishwillee hamishwillee force-pushed the ff_permission_api_fixes branch from cdda306 to 08fa67b Compare September 9, 2024 01:25
Comment on lines -46 to -50
> [!NOTE]
> As of Firefox 44, the permissions for [Notifications](/en-US/docs/Web/API/Notifications_API) and [Push](/en-US/docs/Web/API/Push_API) have been merged. If permission is
> granted (e.g. by the user, in the relevant permissions dialog),
> `navigator.permissions.query()` will return `true` for both
> `notifications` and `push`.
Copy link
Collaborator Author

@hamishwillee hamishwillee Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI have pushed to BCD mdn/browser-compat-data#24359

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super, ty

default state, which is usually `prompt`.
This method is called on the global {{domxref("Permissions")}} object
{{domxref("navigator.permissions")}}.
The **`revoke()`** method of the {{domxref("Permissions")}} interface reverts a currently set permission back to its default state, which is usually `prompt`.
Copy link
Collaborator Author

@hamishwillee hamishwillee Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should delete this page IMO. Am asking on BCD how they feel: mdn/browser-compat-data#24359

EDIT - unfortunately it doesn't meet BCD guidelines for removal, even though this is not implemented except behind a flag.

@hamishwillee hamishwillee marked this pull request as ready for review September 9, 2024 03:01
@hamishwillee hamishwillee requested a review from a team as a code owner September 9, 2024 03:01
@hamishwillee hamishwillee requested review from wbamberg and removed request for a team September 9, 2024 03:01
zhowan2020

This comment was marked as spam.

@zhowan2020

This comment was marked as spam.

## Examples

We have created a simple example called Location Finder.
You can [run the example live](https://chrisdavidmills.github.io/location-finder-permissions-api/), [view the source code on GitHub](https://github.com/chrisdavidmills/location-finder-permissions-api/tree/gh-pages), or read more about how it works in our article [Using the Permissions API](/en-US/docs/Web/API/Permissions_API/Using_the_Permissions_API).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for us it's under chrisdavidmills.github.io

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, saw that. MOve ownership, or create a new repo with sub folders for different APIs?

Copy link
Member

@bsmth bsmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Hamish! A couple of comments, but nothing blocking! Leaving a +1 for when you've had a look

Co-authored-by: Brian Thomas Smith <[email protected]>
@hamishwillee
Copy link
Collaborator Author

Thanks for review @bsmth - I've accepted all (or with slight modification). Merging now because I'm away for a week and this is good.

@hamishwillee hamishwillee merged commit 3fde60e into mdn:main Sep 19, 2024
8 checks passed
fiji-flo pushed a commit that referenced this pull request Oct 2, 2024
* Permission API updates

* Update permissions with geolocation links

* Fix watchposition bug

* Get rid of the forward looking stuff

* Tidy concepts

* Apply suggestions from code review

Co-authored-by: Brian Thomas Smith <[email protected]>

---------

Co-authored-by: Brian Thomas Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants