Skip to content

Commit 8554a68

Browse files
committed
Define all members and correct some minor errors
1 parent d564f28 commit 8554a68

File tree

1 file changed

+247
-28
lines changed

1 file changed

+247
-28
lines changed

index.html

Lines changed: 247 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,19 @@ <h2>
195195
}
196196
}
197197
</pre>
198+
<section>
199+
<h3>
200+
Miscellaneous
201+
</h3>
202+
<p>
203+
A <dfn>64-bit unsigned integer</dfn> is an integer in the range 0 to
204+
18446744073709551615 (2<sup>64</sup> − 1), inclusive.
205+
</p>
206+
<p>
207+
A <dfn>32-bit unsigned integer</dfn> is an integer in the range 0 to 4294967295
208+
(2<sup>32</sup> − 1), inclusive.
209+
</p>
210+
</section>
198211
<section>
199212
<h3>
200213
Members
@@ -217,8 +230,10 @@ <h3>
217230
</dt>
218231
<dd>
219232
<p>
220-
A JSON object consisting of the following members, many being analogous to
221-
Notifications API features. [[NOTIFICATIONS]]
233+
A JSON object consisting of the following members, all analogous to Notifications
234+
API features, though sometimes with a slightly stricter type. Apart from
235+
<code>title</code> all members are derived from the {{NotificationOptions}}
236+
dictionary and are expected to be maintained in tandem. [[NOTIFICATIONS]]
222237
</p>
223238
<dl>
224239
<dt>
@@ -254,7 +269,7 @@ <h3>
254269
</p>
255270
</dd>
256271
<dt>
257-
<code>url</code> (required)
272+
<code>navigate</code> (required)
258273
</dt>
259274
<dd>
260275
<p>
@@ -269,6 +284,14 @@ <h3>
269284
A string.
270285
</p>
271286
</dd>
287+
<dt>
288+
<code>image</code>
289+
</dt>
290+
<dd>
291+
<p>
292+
A string that holds a URL.
293+
</p>
294+
</dd>
272295
<dt>
273296
<code>icon</code>
274297
</dt>
@@ -277,6 +300,38 @@ <h3>
277300
A string that holds a URL.
278301
</p>
279302
</dd>
303+
<dt>
304+
<code>badge</code>
305+
</dt>
306+
<dd>
307+
<p>
308+
A string that holds a URL.
309+
</p>
310+
</dd>
311+
<dt>
312+
<code>vibrate</code>
313+
</dt>
314+
<dd>
315+
<p>
316+
An array of [=32-bit unsigned integers=].
317+
</p>
318+
</dd>
319+
<dt>
320+
<code>timestamp</code>
321+
</dt>
322+
<dd>
323+
<p>
324+
A [=64-bit unsigned integer=].
325+
</p>
326+
</dd>
327+
<dt>
328+
<code>renotify</code>
329+
</dt>
330+
<dd>
331+
<p>
332+
A boolean.
333+
</p>
334+
</dd>
280335
<dt>
281336
<code>silent</code>
282337
</dt>
@@ -285,6 +340,14 @@ <h3>
285340
A boolean.
286341
</p>
287342
</dd>
343+
<dt>
344+
<code>require_interaction</code>
345+
</dt>
346+
<dd>
347+
<p>
348+
A boolean.
349+
</p>
350+
</dd>
288351
<dt>
289352
<code>data</code>
290353
</dt>
@@ -293,14 +356,57 @@ <h3>
293356
Any JSON value.
294357
</p>
295358
</dd>
359+
<dt>
360+
<code>actions</code>
361+
</dt>
362+
<dd>
363+
<p>
364+
An array of JSON objects consisting of the following members, all derived from
365+
the {{NotificationAction}} dictionary and to be maintained in tandem.
366+
</p>
367+
<dl>
368+
<dt>
369+
<code>action</code> (required)
370+
</dt>
371+
<dd>
372+
<p>
373+
A string.
374+
</p>
375+
</dd>
376+
<dt>
377+
<code>title</code> (required)
378+
</dt>
379+
<dd>
380+
<p>
381+
A string.
382+
</p>
383+
</dd>
384+
<dt>
385+
<code>navigate</code> (required)
386+
</dt>
387+
<dd>
388+
<p>
389+
A string that holds a URL.
390+
</p>
391+
</dd>
392+
<dt>
393+
<code>icon</code>
394+
</dt>
395+
<dd>
396+
<p>
397+
A string that holds a URL.
398+
</p>
399+
</dd>
400+
</dl>
401+
</dd>
296402
</dl>
297403
</dd>
298404
<dt>
299405
<code>app_badge</code>
300406
</dt>
301407
<dd>
302408
<p>
303-
An integer in the range 0 to 18446744073709551615 (2<sup>64</sup> − 1), inclusive.
409+
A [=64-bit unsigned integer=].
304410
</p>
305411
<p class="note">
306412
Platform conventions are likely to impose a lower limit with regards to what is
@@ -350,12 +456,8 @@ <h3>
350456
</li>
351457
<li>
352458
<p>
353-
If <var>message</var>["`web_push`"] does not [=map/exist=], then return failure.
354-
</p>
355-
</li>
356-
<li>
357-
<p>
358-
If <var>message</var>["`web_push`"] is not 8030, then return failure.
459+
If <var>message</var>["`web_push`"] does not [=map/exist=] or is not 8030, then
460+
return failure.
359461
</p>
360462
</li>
361463
<li>
@@ -399,24 +501,21 @@ <h3>
399501
</li>
400502
<li>
401503
<p>
402-
If <var>notificationInput</var>["`dir`"] [=map/exists=] and
403-
<var>notificationInput</var>["`dir`"] is "`auto`", "`ltr`", or "`rtl`", then set
404-
<var>notificationOptions</var>["{{NotificationOptions/dir}}"] to
405-
<var>notificationInput</var>["`dir`"].
504+
If <var>notificationInput</var>["`dir`"] [=map/exists=] and is "`auto`", "`ltr`",
505+
or "`rtl`", then set <var>notificationOptions</var>["{{NotificationOptions/dir}}"]
506+
to <var>notificationInput</var>["`dir`"].
406507
</p>
407508
</li>
408509
<li>
409510
<p>
410-
If <var>notificationInput</var>["`lang`"] [=map/exists=] and
411-
<var>notificationInput</var>["`lang`"] is a string, then set
511+
If <var>notificationInput</var>["`lang`"] [=map/exists=] and is a string, then set
412512
<var>notificationOptions</var>["{{NotificationOptions/lang}}"] to
413513
<var>notificationInput</var>["`lang`"].
414514
</p>
415515
</li>
416516
<li>
417517
<p>
418-
If <var>notificationInput</var>["`body`"] [=map/exists=] and
419-
<var>notificationInput</var>["`body`"] is a string, then set
518+
If <var>notificationInput</var>["`body`"] [=map/exists=] and is a string, then set
420519
<var>notificationOptions</var>["{{NotificationOptions/body}}"] to
421520
<var>notificationInput</var>["`body`"].
422521
</p>
@@ -429,28 +528,70 @@ <h3>
429528
</li>
430529
<li>
431530
<p>
432-
If <var>notificationInput</var>["`tag`"] [=map/exists=] and
433-
<var>notificationInput</var>["`tag`"] is a string, then set
531+
If <var>notificationInput</var>["`tag`"] [=map/exists=] and is a string, then set
434532
<var>notificationOptions</var>["{{NotificationOptions/tag}}"] to
435533
<var>notificationInput</var>["`tag`"].
436534
</p>
437535
</li>
438536
<li>
439537
<p>
440-
If <var>notificationInput</var>["`icon`"] [=map/exists=] and
441-
<var>notificationInput</var>["`icon`"] is a string, then set
538+
If <var>notificationInput</var>["`image`"] [=map/exists=] and is a string, then set
539+
<var>notificationOptions</var>["{{NotificationOptions/image}}"] to
540+
<var>notificationInput</var>["`image`"], [=string/converted=].
541+
</p>
542+
</li>
543+
<li>
544+
<p>
545+
If <var>notificationInput</var>["`icon`"] [=map/exists=] and is a string, then set
442546
<var>notificationOptions</var>["{{NotificationOptions/icon}}"] to
443547
<var>notificationInput</var>["`icon`"], [=string/converted=].
444548
</p>
445549
</li>
446550
<li>
447551
<p>
448-
If <var>notificationInput</var>["`silent`"] [=map/exists=] and
449-
<var>notificationInput</var>["`silent`"] is a boolean, then set
450-
<var>notificationOptions</var>["{{NotificationOptions/silent}}"] to
552+
If <var>notificationInput</var>["`badge`"] [=map/exists=] and is a string, then set
553+
<var>notificationOptions</var>["{{NotificationOptions/badge}}"] to
554+
<var>notificationInput</var>["`badge`"], [=string/converted=].
555+
</p>
556+
</li>
557+
<li>
558+
<p>
559+
If <var>notificationInput</var>["`vibrate`"] [=map/exists=] and is a [=/list=] of
560+
which each [=list/item=] is a [=32-bit unsigned integer=], then set
561+
<var>notificationOptions</var>["{{NotificationOptions/vibrate}}"] to
562+
<var>notificationInput</var>["`vibrate`"].
563+
</p>
564+
</li>
565+
<li>
566+
<p>
567+
If <var>notificationInput</var>["`timestamp`"] [=map/exists=] and is a [=64-bit
568+
unsigned integer=], then set
569+
<var>notificationOptions</var>["{{NotificationOptions/timestamp}}"] to
570+
<var>notificationInput</var>["`timestamp`"].
571+
</p>
572+
</li>
573+
<li>
574+
<p>
575+
If <var>notificationInput</var>["`renotify`"] [=map/exists=] and is a boolean, then
576+
set <var>notificationOptions</var>["{{NotificationOptions/renotify}}"] to
577+
<var>notificationInput</var>["`renotify`"].
578+
</p>
579+
</li>
580+
<li>
581+
<p>
582+
If <var>notificationInput</var>["`silent`"] [=map/exists=] and is a boolean, then
583+
set <var>notificationOptions</var>["{{NotificationOptions/silent}}"] to
451584
<var>notificationInput</var>["`silent`"].
452585
</p>
453586
</li>
587+
<li>
588+
<p>
589+
If <var>notificationInput</var>["`require_interaction`"] [=map/exists=] and is a
590+
boolean, then set
591+
<var>notificationOptions</var>["{{NotificationOptions/requireInteraction}}"] to
592+
<var>notificationInput</var>["`require_interaction`"].
593+
</p>
594+
</li>
454595
<li>
455596
<p>
456597
If <var>notificationInput</var>["`data`"] [=map/exists=], then set
@@ -459,6 +600,79 @@ <h3>
459600
<var>notificationInput</var>["`data`"].
460601
</p>
461602
</li>
603+
<li>
604+
<p>
605+
If <var>notificationInput</var>["`actions`"] [=map/exists=] and is a [=/list=]:
606+
</p>
607+
<ol>
608+
<li>
609+
<p>
610+
Let <var>notificationActions</var> be « ».
611+
</p>
612+
</li>
613+
<li>
614+
<p>
615+
[=list/For each=] <var>actionInput</var> of
616+
<var>notificationInput</var>["`actions`"]:
617+
</p>
618+
<ol>
619+
<li>
620+
<p>
621+
If <var>actionInput</var>["`action`"] does not [=map/exist=] or is not a
622+
string, then [=iteration/continue=].
623+
</p>
624+
</li>
625+
<li>
626+
<p>
627+
If <var>actionInput</var>["`title`"] does not [=map/exist=] or is not a
628+
string, then [=iteration/continue=].
629+
</p>
630+
</li>
631+
<li>
632+
<p>
633+
If <var>actionInput</var>["`navigate`"] does not [=map/exist=] or is not a
634+
string, then [=iteration/continue=].
635+
</p>
636+
</li>
637+
<!-- We still need to check the final action for a navigation URL regardless, but failing early seems good as per above. -->
638+
<li>
639+
<p>
640+
Let <var>actionNavigate</var> be <var>actionInput</var>["`navigate`"],
641+
[=string/converted=].
642+
</p>
643+
</li>
644+
<li>
645+
<p>
646+
Let <var>notificationAction</var> be the {{NotificationAction}} dictionary
647+
«[ "{{NotificationAction/action}}" → <var>actionInput</var>["`action`"],
648+
"{{NotificationAction/title}}" → <var>actionInput</var>["`title`"],
649+
"{{NotificationAction/navigate}}" → <var>actionNavigate</var> ]».
650+
</p>
651+
</li>
652+
<!-- Initialize the dictionary mostly at once here to account for required members. -->
653+
<li>
654+
<p>
655+
If <var>actionInput</var>["`icon`"] [=map/exists=] and is a string, then
656+
set <var>notificationAction</var>["{{NotificationAction/icon}}"] to
657+
<var>actionInput</var>["`icon`"], [=string/converted=].
658+
</p>
659+
</li>
660+
<li>
661+
<p>
662+
[=list/Append=] <var>notificationAction</var> to
663+
<var>notificationActions</var>.
664+
</p>
665+
</li>
666+
</ol>
667+
</li>
668+
<li>
669+
<p>
670+
Set <var>notificationOptions</var>["{{NotificationOptions/actions}}"] to
671+
<var>notificationActions</var>.
672+
</p>
673+
</li>
674+
</ol>
675+
</li>
462676
<li>
463677
<p>
464678
Let <var>notification</var> be the result of <a data-lt=
@@ -474,6 +688,12 @@ <h3>
474688
failure.
475689
</p>
476690
</li>
691+
<li>
692+
<p>
693+
If the [=action/navigation URL=] of any [=/action=] of <var>notification</var>'s
694+
[=notification/actions=] is null, then return failure.
695+
</p>
696+
</li>
477697
<li>
478698
<p>
479699
Let <var>appBadge</var> be null.
@@ -482,9 +702,8 @@ <h3>
482702
<li>
483703
<p>
484704
If <var>message</var>["`app_badge`"] [=map/exists=] and
485-
<var>message</var>["`app_badge`"] is an integer in the range 0 to
486-
18446744073709551615 (2<sup>64</sup> − 1), inclusive, then set <var>appBadge</var>
487-
to <var>message</var>["`app_badge`"].
705+
<var>message</var>["`app_badge`"] is a [=64-bit unsigned integer=], then set
706+
<var>appBadge</var> to <var>message</var>["`app_badge`"].
488707
</p><!-- unsigned long long in Web IDL -->
489708
</li>
490709
<li>

0 commit comments

Comments
 (0)