|
50 | 50 | };
|
51 | 51 | </script>
|
52 | 52 | </head>
|
53 |
| - <body data-cite="service-workers FILEAPI secure-contexts hr-time ECMASCRIPT"> |
| 53 | + <body data-cite="service-workers FILEAPI secure-contexts hr-time permissions ECMASCRIPT"> |
54 | 54 | <section id="abstract">
|
55 | 55 | <p>
|
56 | 56 | The <cite>Push API</cite> enables sending of a <a>push message</a> to a web application via
|
@@ -303,9 +303,24 @@ <h2>
|
303 | 303 | Permission
|
304 | 304 | </h2>
|
305 | 305 | <p>
|
306 |
| - The term <dfn>express permission</dfn> refers to an act by the user, e.g. via user |
307 |
| - interface or host device platform features, via which the user approves the use of the |
308 |
| - Push API by the web application. |
| 306 | + The Push API is a [=powerful feature=], requiring [=express permission=] to be used. |
| 307 | + </p> |
| 308 | + <p> |
| 309 | + For integration with the [[[Permissions]]] specification, this specification defines the |
| 310 | + {{PushPermissionDescriptor}} [=powerful feature/permission descriptor type=]. |
| 311 | + </p> |
| 312 | + <pre class="idl"> |
| 313 | + dictionary PushPermissionDescriptor : PermissionDescriptor { |
| 314 | + boolean userVisibleOnly = false; |
| 315 | + }; |
| 316 | + </pre> |
| 317 | + <p data-dfn-for="PushPermissionDescriptor"> |
| 318 | + The <dfn>userVisibleOnly</dfn> has the same semantics as |
| 319 | + {{PushSubscriptionOptionsInit/userVisibleOnly}}. |
| 320 | + </p> |
| 321 | + <p> |
| 322 | + `{name: "push", userVisibleOnly: false}` is [=PermissionDescriptor/stronger than=] |
| 323 | + `{name: "push", userVisibleOnly: true}`. |
309 | 324 | </p>
|
310 | 325 | </section>
|
311 | 326 | </section>
|
|
518 | 533 |
|
519 | 534 | Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {});
|
520 | 535 | Promise<PushSubscription?> getSubscription();
|
521 |
| - Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); |
| 536 | + Promise<PermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); |
522 | 537 | };
|
523 | 538 | </pre>
|
524 | 539 | <p>
|
@@ -570,13 +585,9 @@ <h2>
|
570 | 585 | |promise| with a {{DOMException}} whose name is {{"InvalidStateError"}} and terminate these
|
571 | 586 | steps.
|
572 | 587 | </li>
|
573 |
| - <li>Ask the user whether they allow the web application to receive <a>push messages</a>, |
574 |
| - unless a prearranged trust relationship applies or the user has already granted or denied |
575 |
| - permission explicitly for this web application. Note that a <a>user agent</a> that needs to |
576 |
| - request permission might be unable to do so if {{PushManager/subscribe}} is invoked from a |
577 |
| - service worker, in which case permission will be denied automatically. |
| 588 | + <li>Let |permission| be [=request permission to use=] "push". |
578 | 589 | </li>
|
579 |
| - <li>If not granted, reject |promise| with a {{DOMException}} whose name is |
| 590 | + <li>If |permission| is "denied", reject |promise| with a {{DOMException}} whose name is |
580 | 591 | {{"NotAllowedError"}} and terminate these steps.
|
581 | 592 | </li>
|
582 | 593 | <li>If the <a>Service Worker</a> is already subscribed, run the following substeps:
|
@@ -630,21 +641,20 @@ <h2>
|
630 | 641 | </li>
|
631 | 642 | </ol>
|
632 | 643 | <p>
|
633 |
| - The <dfn data-dfn-for="PushManager">permissionState</dfn> method when invoked MUST run the |
634 |
| - following steps: |
| 644 | + The <dfn data-dfn-for="PushManager">permissionState()</dfn> method when invoked MUST run |
| 645 | + the following steps: |
635 | 646 | </p>
|
636 | 647 | <ol>
|
637 | 648 | <li>Let |promise| be <a>a new promise</a>.
|
638 | 649 | </li>
|
639 | 650 | <li>Return |promise| and continue the following steps asynchronously.
|
640 | 651 | </li>
|
641 |
| - <li>Retrieve the push permission status (<a>PushPermissionState</a>) of the requesting web |
642 |
| - application. |
| 652 | + <li>Let |descriptor| be a new {{PermissionDescriptor}} with the |
| 653 | + {{PermissionDescriptor/name}}} initialized to "push". |
643 | 654 | </li>
|
644 |
| - <li>If there is an error, reject |promise| with no arguments and terminate these steps. |
| 655 | + <li>let |state| be the [=permission state=] of |descriptor| and the result. |
645 | 656 | </li>
|
646 |
| - <li>When the request has been completed, resolve |promise| with <a>PushPermissionState</a> |
647 |
| - providing the push permission status. |
| 657 | + <li>Resolve |promise| with |state|. |
648 | 658 | </li>
|
649 | 659 | </ol>
|
650 | 660 | <p>
|
@@ -1219,52 +1229,6 @@ <h2>
|
1219 | 1229 | </section>
|
1220 | 1230 | </section>
|
1221 | 1231 | </section>
|
1222 |
| - <section data-dfn-for="PushPermissionState"> |
1223 |
| - <h2> |
1224 |
| - <dfn>PushPermissionState</dfn> Enumeration |
1225 |
| - </h2> |
1226 |
| - <pre class="idl"> |
1227 |
| - enum PushPermissionState { |
1228 |
| - "denied", |
1229 |
| - "granted", |
1230 |
| - "prompt", |
1231 |
| - }; |
1232 |
| - </pre> |
1233 |
| - <table class="simple"> |
1234 |
| - <tr> |
1235 |
| - <th> |
1236 |
| - Enumeration |
1237 |
| - </th> |
1238 |
| - <th> |
1239 |
| - Description |
1240 |
| - </th> |
1241 |
| - </tr> |
1242 |
| - <tr> |
1243 |
| - <td> |
1244 |
| - <dfn>granted</dfn> |
1245 |
| - </td> |
1246 |
| - <td> |
1247 |
| - The web application has permission to use the Push API. |
1248 |
| - </td> |
1249 |
| - </tr> |
1250 |
| - <tr> |
1251 |
| - <td> |
1252 |
| - <dfn>denied</dfn> |
1253 |
| - </td> |
1254 |
| - <td> |
1255 |
| - The web application has been denied permission to use the Push API. |
1256 |
| - </td> |
1257 |
| - </tr> |
1258 |
| - <tr> |
1259 |
| - <td> |
1260 |
| - <dfn>prompt</dfn> |
1261 |
| - </td> |
1262 |
| - <td> |
1263 |
| - The web application needs to ask for permission in order to use the Push API. |
1264 |
| - </td> |
1265 |
| - </tr> |
1266 |
| - </table> |
1267 |
| - </section> |
1268 | 1232 | <section>
|
1269 | 1233 | <h2>
|
1270 | 1234 | Accessibility
|
|
0 commit comments