[w3c/push-api] Queue a task before settling getSubscription() promises (PR #429)

From b544329230cd14a199e1e3cad8d48e5810334260 Mon Sep 17 00:00:00 2001
From: Ikram Mohamed <ikram.ahamed@gmail.com>
Date: Fri, 30 Oct 2026 22:06:23 -0400
Subject: [PATCH] Queue tasks when settling getSubscription() promises

In PushManager.getSubscription(), promise resolve/reject ran inside
in-parallel steps. Queue a global task on the networking task source
(matching subscribe() / permissionState()) before settling.

Also terminate after resolving with null so later steps cannot settle
the promise a second time.

Closes #407.
---
 index.html | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/index.html b/index.html
index 27932e8..533ed7a 100644
--- a/index.html
+++ b/index.html
@@ -1311,12 +1311,15 @@
                 </li>
               </ol>
             </li>
-            <li>If |subscription| is null, then resolve |promise| with null.
+            <li>If |subscription| is null, then [=queue a global task=] on the [=networking task
+            source=] using |global| to [=resolve=] |promise| with null and terminate these steps.
             </li>
-            <li>If there is an error with |subscription|, reject |promise| with a {{DOMException}}
-            whose name is {{"AbortError"}} and terminate these steps.
+            <li>If there is an error with |subscription|, then [=queue a global task=] on the
+            [=networking task source=] using |global| to [=reject=] |promise| with an
+            {{"AbortError"}} {{DOMException}} and terminate these steps.
             </li>
-            <li>Resolve |promise| with a {{PushSubscription}} corresponding to |subscription|.
+            <li>[=Queue a global task=] on the [=networking task source=] using |global| to
+            [=resolve=] |promise| with a {{PushSubscription}} corresponding to |subscription|.
             </li>
           </ol>
         </li>
-- 
2.47.3


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://pr-preview.s3.amazonaws.com/ikram1201/push-api/pull/429.html" title="Last updated on Nov 5, 2026, 3:02 AM UTC (3556233)">Preview</a> | <a href="https://pr-preview.s3.amazonaws.com/w3c/push-api/429/9adf83e...ikram1201:3556233.html" title="Last updated on Nov 5, 2026, 3:02 AM UTC (3556233)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/push-api/pull/429

-- Commit Summary --

  * Queue tasks when settling getSubscription() promises

-- File Changes --

    M index.html (11)

-- Patch Links --

https://github.com/w3c/push-api/pull/429.patch
https://github.com/w3c/push-api/pull/429.diff

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

Message ID: <w3c/push-api/pull/429@github.com>

Received on Thursday, 5 November 2026 03:03:21 UTC