From 9d0856221255f3e9d19bfd8b5e5ef2980b1d6948 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 18 Nov 2025 16:42:43 +0100 Subject: [PATCH 1/2] Remove the note that suggests subscribe()'s step order does not matter And move a number of steps to happen before we go in parallel to make it easier to introduce user activation checks in the future. We also make a couple of editorial changes that more closely aligns the language with Infra. This helps with #346. --- index.html | 75 ++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/index.html b/index.html index 3399a4f..7b3a0d3 100644 --- a/index.html +++ b/index.html @@ -1168,53 +1168,40 @@

-
  • Run these steps [=in parallel=]: - +
  • If |scope| is failure or is a [=/URL=] whose [=url/scheme=] is not "`https`", then + [=queue a global task=] on the [=networking task source=] using |global| to [=reject=] + |promise| with a {{"NotAllowedError"}} {{DOMException}} and terminate these steps. +
  • +
  • If |options|["{{PushSubscriptionOptionsInit/userVisibleOnly}}"] is false and the user + agent requires it to be true, then [=queue a global task=] on the [=networking task + source=] using |global| to [=reject=] |promise| with a {{"NotAllowedError"}} + {{DOMException}} and terminate these steps. +
  • +
  • If |options|["{{PushSubscriptionOptionsInit/applicationServerKey}}"] is not non-null + and the push service requires it to be non-null, then [=queue a global task=] on the + [=networking task source=] using |global| to [=reject=] |promise| with a + {{"NotSupportedError"}} {{DOMException}} and terminate these steps. +
  • +
  • If |options|["{{PushSubscriptionOptions/applicationServerKey}}"] is non-null:
      -
    1. If |scope| is failure or is a [=/URL=] whose [=url/scheme=] is not "`https`", then - [=queue a global task=] on the [=networking task source=] using |global| to [=reject=] - |promise| with a {{"NotAllowedError"}} {{DOMException}}. -
    2. -
    3. If the |options| argument has a {{PushSubscriptionOptionsInit/userVisibleOnly}} - value set to `false` and the user agent requires it to be `true`, [=queue a global - task=] on the [=networking task source=] using |global| to [=reject=] |promise| with a - {{"NotAllowedError"}} {{DOMException}}. +
    4. If |options|["{{PushSubscriptionOptions/applicationServerKey}}"] is a string, then + set its value to an {{ArrayBuffer}} containing the sequence of octets that result from + decoding |options|["{{PushSubscriptionOptions/applicationServerKey}}"] using the + base64url encoding [[RFC7515]].
    5. -
    6. If the |options| argument does not include a non-null value for the - {{PushSubscriptionOptionsInit/applicationServerKey}} member, and the push - service requires one to be given, [=queue a global task=] on the [=networking task - source=] using |global| to [=reject=] |promise| with a {{"NotSupportedError"}} - {{DOMException}}. +
    7. If decoding fails, then [=queue a global task=] on the [=networking task source=] + using |global| to [=reject=] |promise| with an {{"InvalidCharacterError"}} + {{DOMException}} and terminate these steps.
    8. -
    9. If the |options| argument includes a non-null value for the - {{PushSubscriptionOptions/applicationServerKey}} attribute: -
        -
      1. If |options|'s {{PushSubscriptionOptionsInit/applicationServerKey}} is a - {{DOMString}}, set its value to an {{ArrayBuffer}} containing the sequence of - octets that result from decoding |options|'s - {{PushSubscriptionOptionsInit/applicationServerKey}} using the base64url encoding - [[RFC7515]]. -
      2. -
      3. If decoding fails, [=queue a global task=] on the [=networking task source=] - using |global| to [=reject=] |promise| with an {{"InvalidCharacterError"}} - {{DOMException}} and terminate these steps. -
      4. -
      5. Ensure that |options|'s {{PushSubscriptionOptionsInit/applicationServerKey}} - describes a valid point on the P-256 curve. If its value is invalid, [=queue a - global task=] on the [=networking task source=] using |global| to [=reject=] - |promise| with an {{"InvalidAccessError"}} {{DOMException}} and terminate these - steps. -
      6. -
      +
    10. Ensure that |options|["{{PushSubscriptionOptions/applicationServerKey}}"] describes + a valid point on the P-256 curve. If its value is invalid, then [=queue a global task=] + on the [=networking task source=] using |global| to [=reject=] |promise| with an + {{"InvalidAccessError"}} {{DOMException}} and terminate these steps.
    11. +
    +
  • +
  • Run these steps [=in parallel=]: +
    1. Let |subscription| be null.
    2. If |scope| is non-null: @@ -1229,7 +1216,7 @@

      1. [=/Assert=]: |registration| is non-null.
      2. -
      3. If |registration|'s [=service worker registration/active worker=] is null, +
      4. If |registration|'s [=service worker registration/active worker=] is null, then [=queue a global task=] on the [=networking task source=] using |global| to [=reject=] |promise| with an {{"InvalidStateError"}} {{DOMException}} and terminate these steps. From 5582b93fdb58ccc5ec652616749c639b7e35e630 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 24 Nov 2025 16:03:39 +0100 Subject: [PATCH 2/2] not non-null -> null --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 7b3a0d3..6294dfe 100644 --- a/index.html +++ b/index.html @@ -1177,8 +1177,8 @@

        source=] using |global| to [=reject=] |promise| with a {{"NotAllowedError"}} {{DOMException}} and terminate these steps.

      5. -
      6. If |options|["{{PushSubscriptionOptionsInit/applicationServerKey}}"] is not non-null - and the push service requires it to be non-null, then [=queue a global task=] on the +
      7. If |options|["{{PushSubscriptionOptionsInit/applicationServerKey}}"] is null and the + push service requires it to be non-null, then [=queue a global task=] on the [=networking task source=] using |global| to [=reject=] |promise| with a {{"NotSupportedError"}} {{DOMException}} and terminate these steps.