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 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:
-
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}}.
-
-
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}}.
+
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]].
-
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}}.
+
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.
-
If the |options| argument includes a non-null value for the
- {{PushSubscriptionOptions/applicationServerKey}} attribute:
-
-
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]].
-
-
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.
-
-
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.
-
-
+
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.
+
+
+
Run these steps [=in parallel=]:
+
Let |subscription| be null.
If |scope| is non-null:
@@ -1229,7 +1216,7 @@
[=/Assert=]: |registration| is non-null.
-
If |registration|'s [=service worker registration/active worker=] is null,
+
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.