From 9195cb181ec705f03bd42ad03d118d7565fbb69d Mon Sep 17 00:00:00 2001
From: Mounir Lamouri
handle permissions on the Web platform. Web APIs have different ways to
deal with permissions. The [[notifications]] API allows developers to
request a permission and check the permission status explicitly. Others
- might only expose the status to web pages. Some, like [[geolocation-API]]
- will keep the page unaware of the permission associated with the
- feature.
+ might only expose the status to web pages. Some, like
+ [[geolocation-API]] will keep the page unaware of the permission
+ associated with the feature.
Being able to know whether an API call is going to prompt is mandatory @@ -410,14 +410,33 @@
+ A Permissions instance is exposed on the navigator
+ object for Window
and Worker
contexts.
+
@@ -427,17 +446,12 @@
permission
argument if
- permission
is of type Permission
, otherwise,
- create a Permission
instead for which name
is
- set to the permission
argument value.
- permissions.query()
to accept a sequence<> too.
<script> - Permissions.query('geolocation').then(function(result) { + navigator.permissions.query('geolocation').then(function(result) { if (result.status == 'granted') { showLocalNewsWithGeolocation(); } else if (result.status == 'prompt') { @@ -482,7 +496,7 @@document.getElementById('chat-notification-button').disabled = (permission.status == 'denied'); } - Permissions.query('notifications').then(function(result) { + navigator.permissions.query('notifications').then(function(result) { updateNotificationButton(result); result.addEventListener('change', function() { @@ -493,7 +507,6 @@