@@ -721,36 +721,41 @@ permissions are like synchronous IO, a bad idea.
721721
722722<p> The static
723723<dfn method for=Notification><code>requestPermission(<var>deprecatedCallback</var>)</code></dfn>
724- method, when invoked, must run these steps:
724+ method steps are :
725725
726726<ol>
727- <li><p> Let <var> promise</var> be a new promise.
727+ <li><p> Let <var> global</var> be <a>this</a> 's <a>relevant global object</a> .
728+
729+ <li><p> Let <var> origin</var> be <a>this</a> 's <a>relevant settings object</a>' s
730+ <a for="environment settings object">origin</a> .
731+ <!-- Arguably this should snapshot origin somehow so that changes to it do not impact the
732+ in parallel part. -->
733+
734+ <li><p> Let <var> promise</var> be <a for=/>a new promise</a> in <var> global</var> 's
735+ <a for="global object">Realm</a> .
728736
729737 <li>
730738 <p> Run these steps <a>in parallel</a> :
731739
732740 <ol>
733- <li><p> Let <var> permission</var> be <a>permission</a> for
734- <a>entry settings object</a> 's <a for="environment settings object">origin</a> .
735- <!-- XXX context object's global object's environment settings object's origin -->
741+ <li><p> Let <var> permission</var> be <a>permission</a> for <var> origin</var> .
736742
737- <li><p> If <var> permission</var> is "<code> default</code> ", ask the user whether showing
738- notifications for the <a>entry settings object</a> 's
739- <a for="environment settings object">origin</a> is acceptable. If it is, set
740- <var> permission</var> to "<code> granted</code> ", and "<code> denied</code> " otherwise.
743+ <li><p> If <var> permission</var> is "<code> default</code> ", then ask the user whether showing
744+ notifications for <var> origin</var> is acceptable. If it is, then set <var> permission</var> to
745+ "<code> granted</code> "; otherwise "<code> denied</code> ".
741746
742747 <li>
743- <p> <a>Queue a task</a> to run these steps:
748+ <p> <a>Queue a global task</a> on the <a>DOM manipulation task source</a> given <var> global</var>
749+ to run these steps:
744750
745751 <ol>
746- <li><p> Set <a>permission</a> for the <a>entry settings object</a> 's
747- <a for="environment settings object">origin</a> to <var> permission</var> .
752+ <li><p> Set <a>permission</a> for <var> origin</var> to <var> permission</var> .
748753
749- <li><p> If <var> deprecatedCallback</var> is given, invoke
750- <var> deprecatedCallback</var> with <var> permission</var> as single argument . If this
751- throws an exception, <a>report the exception</a> .
754+ <li><p> If <var> deprecatedCallback</var> is given, then <a for=/> invoke</a>
755+ <var> deprecatedCallback</var> with « <var> permission</var> » . If this throws an exception, then
756+ <a>report the exception</a> .
752757
753- <li><p> Fullfil <var> promise</var> with <var> permission</var> .
758+ <li><p> <a for=/>Resolve</a> <var> promise</var> with <var> permission</var> .
754759 </ol>
755760 </ol>
756761
@@ -1002,69 +1007,90 @@ partial interface ServiceWorkerGlobalScope {
10021007};
10031008</pre>
10041009
1005- <p> The
1006- <dfn method for=ServiceWorkerRegistration><code>showNotification(title, options)</code></dfn>
1007- method, when invoked, must run these steps:
1010+ <p> The <dfn method for=ServiceWorkerRegistration><code>showNotification(title, options)</code></dfn>
1011+ method steps are:
10081012
10091013<ol>
1010- <li><p> Let <var> promise </var> be a new promise.
1014+ <li><p> Let <var> global </var> be <a>this</a> 's <a>relevant global object</a>
10111015
1012- <li><p> If the <a>context object</a> 's <a for="service worker registration">active worker</a> is
1013- null, then reject <var> promise</var> with a <code> TypeError</code> exception and return
1014- <var> promise</var> .
1016+ <li><p> Let <var> promise</var> be <a>a new promise</a> in <var> global</var> 's
1017+ <a for="global object">Realm</a> .
10151018
1016- <li><p> Let <var> serviceWorkerRegistration</var> be the <a>context object</a> .
1019+ <li><p> If <a>this</a> 's <a for="service worker registration">active worker</a> is null, then
1020+ <a for=/>reject</a> <var> promise</var> with a {{TypeError}} and return <var> promise</var> .
1021+ <!-- We might have to throw directly here and below, see
1022+ https://github.com/web-platform-tests/wpt/pull/24601 -->
10171023
1018- <li><p> Let <var> notification</var> be the result of <a>creating a notification</a> given
1019- <var> title</var> , <var> options</var> , and <var> serviceWorkerRegistration</var> . If this threw an
1020- exception, reject <var> promise</var> with that exception and return <var> promise</var> .
1024+ <li><p> Let <var> serviceWorkerRegistration</var> be <a>this</a> .
10211025
1022- <li><p> Run these steps <a>in parallel</a> :
1026+ <li><p> Let <var> notification</var> be the result of <a>creating a notification</a> given
1027+ <var> title</var> , <var> options</var> , and <var> serviceWorkerRegistration</var> . If this threw an
1028+ exception, then <a for=/>reject</a> <var> promise</var> with that exception and return
1029+ <var> promise</var> .
1030+
1031+ <li>
1032+ <p> Run these steps <a>in parallel</a> :
10231033
10241034 <ol>
1025- <li><p> If <a>permission</a> for <var> notification</var> 's <a for=notification>origin</a> is not
1026- "<code> granted</code> ", then reject <var> promise</var> with a <code> TypeError</code> exception,
1027- and abort these steps.
1035+ <li><p> If <a>permission</a> for <var> notification</var> 's <a for=notification>origin</a> is not
1036+ "<code> granted</code> ", then <a>queue a global task</a> on the
1037+ <a>DOM manipulation task source</a> given <var> global</var> to <a for=/>reject</a>
1038+ <var> promise</var> with a {{TypeError}} , and abort these steps.
10281039
1029- <li><p> Run the <a>fetch steps</a> for <var> notification</var> .
1040+ <li><p> Run the <a>fetch steps</a> for <var> notification</var> .
10301041
1031- <li><p> Run the <a>show steps</a> for <var> notification</var> .
1042+ <li><p> Run the <a>show steps</a> for <var> notification</var> .
10321043
1033- <li><p> Resolve <var> promise</var> with undefined.
1044+ <li><p> <a>Queue a global task</a> on the <a>DOM manipulation task source</a> given
1045+ <var> global</var> to <a for=/>resolve</a> <var> promise</var> with undefined.
10341046 </ol>
10351047
1036- <li><p> Return <var> promise</var> .
1048+ <li><p> Return <var> promise</var> .
10371049</ol>
10381050
10391051<p> The
10401052<dfn method for=ServiceWorkerRegistration><code>getNotifications(<var>filter</var>)</code></dfn>
1041- method, when invoked, must run these steps:
1053+ method steps are :
10421054
10431055<ol>
1044- <li><p> Let <var> promise </var> be a new promise .
1056+ <li><p> Let <var> global </var> be <a>this</a> 's <a>relevant global object</a> .
10451057
1046- <li><p> Run these steps <a>in parallel</a> :
1058+ <li><p> Let <var> realm</var> be <var> global</var> 's <a for="global object">Realm</a> .
1059+
1060+ <li><p> Let <var> origin</var> be <a>this</a> 's <a>relevant settings object</a>' s
1061+ <a for="environment settings object">origin</a> .
1062+ <!-- Arguably this should snapshot origin somehow so that changes to it do not impact the
1063+ in parallel part. -->
1064+
1065+ <li><p> Let <var> promise</var> be <a for=/>a new promise</a> in <var> realm</var> .
1066+
1067+ <li>
1068+ <p> Run these steps <a>in parallel</a> :
10471069
10481070 <ol>
1049- <li><p> Let <var> tag</var> be <var> filter</var> 's <code> tag</code> .
1071+ <li><p> Let <var> tag</var> be <var> filter</var> 's <code> tag</code> .
10501072
1051- <li><p> Let <var> notifications</var> be a <a for=/>list</a> of all <a>notifications</a> in the
1052- <a>list of notifications</a> whose <a for=notification>origin</a> is the
1053- <a>entry settings object</a> 's <a for="environment settings object">origin</a> , whose
1054- <a for=notification>service worker registration</a> is the <a>context object</a> , and whose
1055- <a for=notification>tag</a> , if <var> tag</var> is not the empty string, is <var> tag</var> .
1073+ <li><p> Let <var> notifications</var> be a <a for=/>list</a> of all <a>notifications</a> in the
1074+ <a>list of notifications</a> whose <a for=notification>origin</a> is <a>same origin</a> with
1075+ <var> origin</var> , whose <a for=notification>service worker registration</a> is <a>this</a> , and
1076+ whose <a for=notification>tag</a> , if <var> tag</var> is not the empty string, is <var> tag</var> .
10561077
1057- <li><p> Let <var> objects</var> be an empty JavaScript array.
1078+ <li>
1079+ <p> <a>Queue a global task</a> on the <a>DOM manipulation task source</a> given <var> global</var>
1080+ to run these steps:</p>
1081+
1082+ <ol>
1083+ <li><p> Let <var> objects</var> be a <a for=/>list</a> .
10581084
1059- <li><p> <a for=list>For each</a> <a>notification</a> in
1060- <var> notifications</var> , in creation order, create a new {{Notification}}
1061- object representing <a>notification</a> and push
1062- that object to <var> objects</var> .
1085+ <li><p> <a for=list>For each</a> <a>notification</a> in <var> notifications</var> , in creation
1086+ order, create a <a for=/>new</a> {{Notification}} object with <var> realm</var> representing
1087+ <a>notification</a> , and <a for=list>append</a> it to <var> objects</var> .
10631088
1064- <li><p> Resolve <var> promise</var> with <var> objects</var> .
1089+ <li><p> <a for=/>Resolve</a> <var> promise</var> with <var> objects</var> .
1090+ </ol>
10651091 </ol>
10661092
1067- <li><p> Return <var> promise</var> .
1093+ <li><p> Return <var> promise</var> .
10681094</ol>
10691095
10701096<p class=note> This method returns zero or more new {{Notification}} objects which might represent
0 commit comments