@@ -48,9 +48,6 @@ representation of something that happened, such as the delivery of a message.
48
48
<p> A <a>notification</a> has an associated
49
49
<dfn for=notification id=concept-title>title</dfn> which is a string.
50
50
51
- <p> A <a>notification</a> has an associated
52
- <dfn for=notification id=body>body</dfn> which is a string.
53
-
54
51
<p> A <a>notification</a> has an associated
55
52
<dfn for=notification id=concept-direction>direction</dfn> which is "<code> auto</code> ",
56
53
"<code> ltr</code> ", or "<code> rtl</code> ".
@@ -59,6 +56,12 @@ representation of something that happened, such as the delivery of a message.
59
56
<dfn for=notification id=concept-language>language</dfn> which is a string
60
57
representing either a valid BCP 47 language tag or the empty string.
61
58
59
+ <p> A <a>notification</a> has an associated <dfn for=notification id=body>body</dfn> which is a
60
+ string.
61
+
62
+ <p> A <a>notification</a> has an associated <dfn for=notification>URL</dfn> which is null or a
63
+ <a for=/>URL</a> . It is initially null.
64
+
62
65
<p> A <a>notification</a> has an associated
63
66
<dfn for=notification id=tag>tag</dfn> which is a string.
64
67
@@ -129,12 +132,15 @@ support these features might ignore them.
129
132
for an end user. Each <a for=/>action</a> has an associated:
130
133
131
134
<dl>
132
- <dt> <dfn for=action id=action-title>title </dfn>
135
+ <dt> <dfn for=action id=action-name>name </dfn>
133
136
<dd> A string.
134
137
135
- <dt> <dfn for=action id=action-name>name </dfn>
138
+ <dt> <dfn for=action id=action-title>title </dfn>
136
139
<dd> A string.
137
140
141
+ <dt> <dfn for=action>URL</dfn>
142
+ <dd> Null or a <a for=/>URL</a> . It is initially null.
143
+
138
144
<dt> <dfn for=action>icon URL</dfn>
139
145
<dd> Null or a <a for=/>URL</a> . It is initially null.
140
146
@@ -211,6 +217,24 @@ string <var>title</var>, {{NotificationOptions}} <a for=/>dictionary</a> <var>op
211
217
<li><p> Set <var> notification</var> 's <a for=notification>body</a> to
212
218
<var> options</var> ["{{NotificationOptions/body}}"] .
213
219
220
+ <li>
221
+ <p> If <var> options</var> ["{{NotificationOptions/url}}"] <a for=map>exists</a> :
222
+
223
+ <ol>
224
+ <li><p> Let <var> url</var> be the result of <a lt="URL parser">parsing</a>
225
+ <var> options</var> ["{{NotificationOptions/url}}"] using <var> baseURL</var> .
226
+
227
+ <li>
228
+ <p> If <var> url</var> is not failure:
229
+
230
+ <ol>
231
+ <li><p> If <var> url</var> 's <a for=url>origin</a> is not <a>same origin</a> with
232
+ <var> notification</var> 's <a for=notification>origin</a> , then <a>throw</a> a {{TypeError}} .
233
+
234
+ <li><p> Set <var> notification</var> 's <a for=notification>URL</a> to <var> url</var> .
235
+ </ol>
236
+ </ol>
237
+
214
238
<li><p> Set <var> notification</var> 's <a for=notification>tag</a> to
215
239
<var> options</var> ["{{NotificationOptions/tag}}"] .
216
240
@@ -266,6 +290,24 @@ string <var>title</var>, {{NotificationOptions}} <a for=/>dictionary</a> <var>op
266
290
<li><p> Set <var> action</var> 's <a for=action>title</a> to
267
291
<var> entry</var> ["{{NotificationAction/title}}"] .
268
292
293
+ <li>
294
+ <p> If <var> entry</var> ["{{NotificationAction/url}}"] <a for=map>exists</a> ,
295
+
296
+ <ol>
297
+ <li><p> Let <var> url</var> be the result of <a lt="URL parser">parsing</a>
298
+ <var> entry</var> ["{{NotificationAction/url}}"] using <var> baseURL</var> .
299
+
300
+ <li>
301
+ <p> If <var> url</var> is not failure:
302
+
303
+ <ol>
304
+ <li><p> If <var> url</var> 's <a for=url>origin</a> is not <a>same origin</a> with
305
+ <var> notification</var> 's <a for=notification>origin</a> , then <a>throw</a> a {{TypeError}} .
306
+
307
+ <li><p> Set <var> action</var> 's <a for=action>URL</a> to <var> url</var> .
308
+ </ol>
309
+ </ol>
310
+
269
311
<li><p> If <var> entry</var> ["{{NotificationAction/icon}}"] <a for=map>exists</a> , then
270
312
<a lt="url parser">parse</a> it using <var> baseURL</var> , and if that does not return failure,
271
313
set <var> action</var> 's <a for=action>icon URL</a> to the return value. (Otherwise
@@ -527,14 +569,39 @@ interpreted as a language tag. Validity or well-formedness are not enforced. [[!
527
569
platform supports activation, the user agent must (unless otherwise specified) run these steps:
528
570
529
571
<ol>
572
+ <li><p> Let <var> action</var> be null.
573
+
574
+ <li><p> If one of <var> notification</var> 's <a for=notification>actions</a> was activated by the end
575
+ user, then set <var> action</var> to that <a for=/>action</a> .
576
+
577
+ <li><p> Let <var> url</var> be <var> notification</var> 's <a for=notification>URL</a> .
578
+
579
+ <li>
580
+ <p> If <var> action</var> is non-null, then set <var> url</var> to <var> action</var> 's
581
+ <a for=action>URL</a> .
582
+
583
+ <p class=note> This intentionally makes it so that when an <a for=/>action</a> 's
584
+ <a for=action>URL</a> is null, it falls through to the <code> click</code> event, providing more
585
+ flexibility to the web developer.
586
+
587
+ <li>
588
+ <p> If <var> url</var> is non-null:
589
+
590
+ <ol>
591
+ <li><p> <a>Create a fresh top-level traversable</a> given <var> url</var> .
592
+ <!-- XXX Should maybe set userInvolvement correctly here? -->
593
+
594
+ <li><p> Return.
595
+ </ol>
596
+
530
597
<li>
531
598
<p> If <var> notification</var> is a <a>persistent notification</a> , then:
532
599
533
600
<ol>
534
- <li><p> Let <var> action </var> be the empty string.
601
+ <li><p> Let <var> actionName </var> be the empty string.
535
602
536
- <li><p> If one of <var> notification </var> 's <a for=notification>actions</a> was activated by the
537
- user, then set <var> action </var> to that <a for=/>action</a> 's <a for=action>name</a> .
603
+ <li><p> If <var> action </var> is non-null, then set <var> actionName </var> to <var> action </var> 's
604
+ <a for=action>name</a> .
538
605
539
606
<li> <a>Fire a service worker notification event</a> named "<code> notificationclick</code> " given
540
607
<var> notification</var> and <var> action</var> .
@@ -622,6 +689,7 @@ interface Notification : EventTarget {
622
689
readonly attribute NotificationDirection dir;
623
690
readonly attribute DOMString lang;
624
691
readonly attribute DOMString body;
692
+ readonly attribute USVString url;
625
693
readonly attribute DOMString tag;
626
694
readonly attribute USVString image;
627
695
readonly attribute USVString icon;
@@ -641,6 +709,7 @@ dictionary NotificationOptions {
641
709
NotificationDirection dir = "auto";
642
710
DOMString lang = "";
643
711
DOMString body = "";
712
+ USVString url;
644
713
DOMString tag = "";
645
714
USVString image;
646
715
USVString icon;
@@ -669,6 +738,7 @@ enum NotificationDirection {
669
738
dictionary NotificationAction {
670
739
required DOMString action;
671
740
required DOMString title;
741
+ USVString url;
672
742
USVString icon;
673
743
};
674
744
@@ -824,6 +894,16 @@ return the <a>maximum number of actions</a> supported.
824
894
<p> The <dfn attribute for=Notification><code>body</code></dfn> getter steps are to return
825
895
<a>this</a> 's <a>notification</a>' s <a for=notification>body</a> .
826
896
897
+ <p> The <dfn attribute for=Notification><code>url</code></dfn> getter steps are:
898
+
899
+ <ol>
900
+ <li><p> If <a>this</a> 's <a>notification</a>' s <a for=notification>URL</a> is null, then return the
901
+ empty string.
902
+
903
+ <li><p> Return <a>this</a> 's <a>notification</a>' s <a for=notification>URL</a> ,
904
+ <a lt="URL serializer">serialized</a> .
905
+ </ol>
906
+
827
907
<p> The <dfn attribute for=Notification><code>tag</code></dfn> getter steps are to return
828
908
<a>this</a> 's <a>notification</a>' s <a for=notification>tag</a> .
829
909
@@ -896,6 +976,10 @@ then return null.
896
976
<li><p> Set <var> action</var> ["{{NotificationAction/title}}"] to <var> entry</var> 's
897
977
<a for=action>title</a> .
898
978
979
+ <li><p> If <var> entry</var> 's <a for=action>URL</a> is non-null, then set
980
+ <var> action</var> ["{{NotificationAction/url}}"] to <var> entry</var> 's <a for=action>URL</a> ,
981
+ <a lt="URL serializer">serialized</a> .
982
+
899
983
<li><p> If <var> entry</var> 's <a for=action>icon URL</a> is non-null, then set
900
984
<var> action</var> ["{{NotificationAction/icon}}"] to <var> entry</var> 's
901
985
<a for=action>icon URL</a> , <a lt="URL serializer">serialized</a> .
@@ -937,7 +1021,7 @@ not.onclick = function() { displaySong(this); };</pre>
937
1021
938
1022
<p> Here a service worker shows a notification with a single "Archive" <a for=/>action</a> , allowing
939
1023
users to perform this common task from the notification without having to open the website (for
940
- example the, notification platform might show a button on the notification). The user can also
1024
+ example, the notification platform might show a button on the notification). The user can also
941
1025
activate the main body of the notification to open their inbox.
942
1026
943
1027
<pre class=example id=example-50e7c86c>
0 commit comments