Re: [w3c/push-api] Expose pushManager on Window (PR #393)

@annevk commented on this pull request.



>              </li>
-            <li>When the request has been completed, [=queue a global task=] on the [=networking
-            task source=] using |global| to [=resolve=] |promise| with |subscription| and terminate
-            these steps.
+            <li>If |permission| is {{PermissionState/"denied"}}, [=queue a global task=] on the
+            [=user interaction task source=] using |global| to [=reject=] |promise| with a
+            {{"NotAllowedError"}} {{DOMException}} and terminate these steps.
+            </li>
+            <li>If |subscription| is non-null:
+              <ol>
+                <li>If there is an error with |subscription|, then [=queue a global task=] on the

I'm happy to file a follow-up issue for this and then people more experienced with these algorithms can figure it out.

> -          <a>push subscription</a> is associated with a <a>service worker registration</a> and a
-          <a>service worker registration</a> has at most one <a>push subscription</a>.
+          <a>user agent</a> and the <a>push service</a> on behalf of a web application.
+        </p>
+        <p>
+          A [=push subscription=] has an associated <dfn data-dfn-for=
+          "push subscription">scope</dfn>, which is a [=/URL=].
+        </p>
+        <p>
+          A [=push subscription=] is considered to have a <dfn data-dfn-for=
+          "push subscription">window-accessible scope</dfn> when its [=push subscription/scope=]'s
+          [=url/path=] is a [=/list=] of [=list/size=] 1 and [=push subscription/scope=]'s
+          [=url/path=][0] is the empty string.
+        </p>
+        <p class="note">
+          I.e., the [=url/path=] component of the [=/URL=] serializes as "`/`".

It would be slightly different if you somehow ended up with a URL object that violates the contract. That's a bug of course, but I'd rather do the correct thing here and not hide the gory details.

>            </aside>
           <ol>
+            <li>If |scope| is failure or is a [=/URL=] whose [=url/scheme=] is not "`https`", then

Right, it's more consistent to do it here. And no, we don't want to grab state while in parallel.

> @@ -1103,6 +1157,27 @@ <h3>
         </li>
         <li>Let |global| be [=this=]'s [=relevant global object=].
         </li>
+        <li>Let |scope| be null.
+        </li>
+        <li>Let |registration| be null.
+        </li>
+        <li>If [=this=]'s [=PushManager/service worker registration=] is null:
+          <ol>
+            <li>Set |scope| to the result of running the [=basic URL parser=] given "`/`" and
+            |global|'s <a>associated <code>Document</code></a>'s [=Document/URL=].
+            </li>
+            <!-- Should the scope be validated here or do we trust the permission story to take care of that? Hmm. -->

Now that I added the failure check below this note is indeed no longer needed.

> @@ -1644,20 +1777,34 @@ <h2>
           it MUST run the following steps.
         </p>
         <ol>
-          <li>Let |registration| be the <a>service worker registration</a> corresponding to the <a>
-            push message</a>.
-          </li>
-          <li>If |registration| is not found, abort these steps.
+          <li>
+            <p>
+              Let |subscription| be the active <a>push subscription</a> corresponding to the
+              <a>push message</a>.

Yeah, I can file another issue on that. This seems okay since it was already vague.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/pull/393#discussion_r2330458245
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/push-api/pull/393/review/3196827711@github.com>

Received on Monday, 8 September 2025 14:40:06 UTC