@@ -317,6 +317,15 @@ meaning "<code>granted</code>". In that case
317
317
"<code> granted</code> " is simply returned as there would be no reason
318
318
for the application to ask for <a>permission</a> .
319
319
320
+ <h3 id="permissions-integration">Permissions integration</h3>
321
+
322
+ <p> The Notifications API is a <a>powerful feature</a> which is identified by the string
323
+ "notifications" and has its <a for="powerful feature">allowed in non-secure contexts</a> flag set.
324
+ [[!Permissions]]
325
+
326
+ <p class="note"> This specification's "<code> default</code> " <a>permission</a>
327
+ state maps to the [=permission/prompt=] permission state in the Permissions API.
328
+
320
329
321
330
<h3 id=direction>Direction</h3>
322
331
@@ -729,8 +738,20 @@ constructor steps are:
729
738
return the <a>permission</a> for the <a>current settings object</a> 's
730
739
<a for="environment settings object">origin</a> .
731
740
732
- <p class=note> If you edit standards please refrain from copying the above. Synchronous
733
- permissions are like synchronous IO, a bad idea.
741
+ <div class=note>
742
+ <p> If you edit standards please refrain from copying the above. Synchronous permissions are like
743
+ synchronous IO, a bad idea.
744
+
745
+ <p> Developers are encouraged to use the Permissions {{Permissions/query()}} method
746
+ instead. [[Permissions]]
747
+
748
+ <pre class="example" id="permissions-query-example">
749
+ const permission = await navigator.permissions.query({name: "notifications"});
750
+ if (permission.state === "granted") {
751
+ // We have permission to use the API…
752
+ }
753
+ </pre>
754
+ </div>
734
755
735
756
<p> The static
736
757
<dfn method for=Notification><code>requestPermission(<var>deprecatedCallback</var>)</code></dfn>
@@ -739,35 +760,38 @@ method steps are:
739
760
<ol>
740
761
<li><p> Let <var> global</var> be the <a>current global object</a> .
741
762
742
- <li><p> Let <var> origin</var> be the <a>current settings object</a> 's
743
- <a for="environment settings object">origin</a> .
744
- <!-- Arguably this should snapshot origin somehow so that changes to it do not impact the
745
- in parallel part. -->
763
+ <li><p> Let <var> permissionDescriptor</var> be the {{PermissionDescriptor}} with
764
+ {{PermissionDescriptor/name}} set to "<code> notifications</code> ".
765
+
766
+ <li><p> Let <var> permissionStatus</var> be the result of
767
+ <a lt="create a PermissionStatus">creating a `PermissionStatus`</a> for
768
+ <var> permissionDescriptor</var> .
746
769
747
770
<li><p> Let <var> promise</var> be <a for=/>a new promise</a> in <a>this</a> 's <a>relevant Realm</a> .
748
771
749
772
<li>
750
773
<p> Run these steps <a>in parallel</a> :
751
774
752
775
<ol>
753
- <li><p> Let <var> permission</var> be <a>permission</a> for <var> origin</var> .
776
+ <li><p> Run the <a for="powerful feature">permission query algorithm</a> with
777
+ <var> permissionDescriptor</var> and <var> permissionStatus</var> .
754
778
755
- <li><p> If <var> permission</var> is "<code> default</code> ", then ask the user whether showing
756
- notifications for <var> origin</var> is acceptable. If it is, then set <var> permission</var> to
757
- "<code> granted</code> "; otherwise "<code> denied</code> ".
779
+ <li><p> Let <var> permissionState</var> be <var> permissionStatus</var> 's
780
+ {{PermissionStatus/state}} .
781
+
782
+ <li><p> If <var> permissionState</var> is {{PermissionState/"prompt"}} , then set
783
+ <var> permissionState</var> to "<code> default</code> ".
758
784
759
785
<li>
760
786
<p> <a>Queue a global task</a> on the <a>DOM manipulation task source</a> given <var> global</var>
761
787
to run these steps:
762
788
763
789
<ol>
764
- <li><p> Set <a>permission</a> for <var> origin</var> to <var> permission</var> .
765
-
766
790
<li><p> If <var> deprecatedCallback</var> is given, then <a for=/>invoke</a>
767
- <var> deprecatedCallback</var> with « <var> permission </var> ». If this throws an exception, then
768
- <a>report the exception</a> .
791
+ <var> deprecatedCallback</var> with « <var> permissionState </var> ». If this throws an
792
+ exception, then <a>report the exception</a> .
769
793
770
- <li><p> <a for=/>Resolve</a> <var> promise</var> with <var> permission </var> .
794
+ <li><p> <a for=/>Resolve</a> <var> promise</var> with <var> permissionState </var> .
771
795
</ol>
772
796
</ol>
773
797
@@ -1186,6 +1210,7 @@ Michael Cooper,
1186
1210
Michael Henretty,
1187
1211
Michael™ Smith,
1188
1212
Michael van Ouwerkerk,
1213
+ Mike Taylor,
1189
1214
Nicolás Satragno,
1190
1215
Olli Pettay,
1191
1216
Peter Beverloo,
0 commit comments