From 7f027c657a013e18b2af4cee4c32efcc60be32c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 1 Jun 2022 15:14:42 +1000 Subject: [PATCH 1/6] Chore: update PULL_REQUEST_TEMPLATE.md for WebKit WebKit now implements the spec --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c5eb0e9..b6ac8ff 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,4 +8,4 @@ Implementation commitment: * [ ] Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=) * [ ] Gecko (https://bugzilla.mozilla.org/show_bug.cgi?id=) - * WebKit - not implemented. + * [ ] WebKit (https://bugs.webkit.org/show_bug.cgi?id=) From e2c35370c17cc187aa878e855620c976f1480bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 2 Jun 2022 14:43:08 +1000 Subject: [PATCH 2/6] Remove redudant secure context check (#349) --- index.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/index.html b/index.html index a40f96c..3ba3636 100644 --- a/index.html +++ b/index.html @@ -556,9 +556,6 @@

  • Return |promise| and continue the following steps asynchronously.
  • -
  • If the current settings object is not a [=secure context=], reject |promise| - with a {{DOMException}} whose name is {{"SecurityError"}} and terminate these steps. -
  • If the |options| argument includes a non-null value for the {{PushSubscriptionOptions/applicationServerKey}} attribute, run the following sub-steps:
      From 843a52841f814d0067352fa19ed72dc3ba73fae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 2 Jun 2022 16:25:44 +1000 Subject: [PATCH 3/6] Editorial: remove byte dfn --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3ba3636..05dac93 100644 --- a/index.html +++ b/index.html @@ -931,7 +931,7 @@

      };

      - PushMessageData objects have an associated bytes (a byte sequence) set on + PushMessageData objects have an associated [=byte sequence=] set on creation, which is `null` if there was no data in the push message.

      From 5429a604796559e64065696bcb6f2b6797023e10 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 Jun 2022 16:35:47 +1000 Subject: [PATCH 4/6] chore: Tidy up document using tidy-html5 (#351) Co-authored-by: marcoscaceres --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 05dac93..275be05 100644 --- a/index.html +++ b/index.html @@ -931,8 +931,8 @@

      };

      - PushMessageData objects have an associated [=byte sequence=] set on - creation, which is `null` if there was no data in the push message. + PushMessageData objects have an associated [=byte sequence=] set on creation, which + is `null` if there was no data in the push message.

      The arrayBuffer() method, when invoked, MUST return an {{ArrayBuffer}} whose From 629bb64e959d27d8ec739e549a7e453d0ee07969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 2 Jun 2022 16:37:00 +1000 Subject: [PATCH 5/6] chore(tidy.yml): flip title and commit-message --- .github/workflows/tidy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tidy.yml b/.github/workflows/tidy.yml index 2d000f6..c5b778b 100644 --- a/.github/workflows/tidy.yml +++ b/.github/workflows/tidy.yml @@ -15,6 +15,6 @@ jobs: - run: tidy -config tidyconf.txt -o index.html index.html - uses: peter-evans/create-pull-request@v3 with: - title: "chore(tidy): tidy up document" - commit-message: "Tidied up document using tidy-html5" + title: "Tidied up document using tidy-html5" + commit-message: "chore(tidy): tidy up document" branch: html-tidy From febe56bc064f1b86bde499c2e9d4d83da3a1a532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 30 Jun 2022 16:13:05 +1000 Subject: [PATCH 6/6] Rewrite .subscribe() to fix various bugs (#350) --- index.html | 151 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 101 insertions(+), 50 deletions(-) diff --git a/index.html b/index.html index 275be05..9fbeca9 100644 --- a/index.html +++ b/index.html @@ -25,6 +25,12 @@ companyURL: "https://www.mozilla.org/", w3cid: "68503" }, + { + name: "Marcos Caceres", + company: "Apple Inc.", + companyURL: "https://www.apple.com/", + w3cid: "39125" + }, { name: "Bryan Sullivan", company: "AT&T", @@ -195,13 +201,17 @@

      subscription having the new keys as |newSubscription|.

      - To create a push subscription, given an PushSubscriptionOptions object - of |options|, the user agent must run the following steps: + To create a push subscription, given an {{PushSubscriptionOptionsInit}} + |optionsDictionary:PushSubscriptionOptionsInit|:

      -
        -
      1. Let |subscription| be a new push subscription. +
          +
        1. Let |subscription:PushSubscription| be a new {{PushSubscription}}. +
        2. +
        3. Let |options:PushSubscriptionOptions| be a newly created {{PushSubscriptionOptions}} + object, initializing its attributes with the corresponding members and values of + |optionsDictionary|.
        4. -
        5. Set the `options` attribute of |subscription| to be a copy of |options|. +
        6. Set |subscription|'s {{PushSubscription/options}} attribute to |options|.
        7. Generate a new P-256 ECDH key pair [[ANSI-X9-62]]. Store the private key in an internal slot on |subscription|; this value MUST NOT be made available to applications. @@ -214,11 +224,21 @@

          key can be retrieved by calling the {{PushSubscription/getKey()}} method of the {{PushSubscription}} with an argument of {{PushEncryptionKeyName/"auth"}}.

        8. -
        9. Make a request to the push service to create a new push subscription. - Include the {{PushSubscriptionOptions/applicationServerKey}} attribute of |options| when - it has been set. +
        10. Request a new push subscription. Include the + {{PushSubscriptionOptions/applicationServerKey}} attribute of |options| when it has been + set. Rethrow any [=exceptions=]. +
        11. +
        12. When the push subscription request has completed successfully: +
            +
          1. Set |subscription|'s {{PushSubscription/endpoint}} attribute to the [=URL=] + provided by the push subscription. +
          2. +
          3. If provided by the push subscription, set |subscription|'s + {{PushSubscription/expirationTime}}. +
          4. +
        13. -
        14. When the request has completed, return |subscription|. +
        15. Return |subscription|.
        @@ -548,73 +568,104 @@

        MAY support content codings defined in previous versions of the draft for compatibility reasons.

        +

        + `subscribe()` method +

        - The subscribe method when invoked MUST run the following steps: + The subscribe() method when invoked MUST run the following steps:

        -
          -
        1. Let |promise| be a new promise. +
            +
          1. Let |promise| be [=a new promise=].
          2. -
          3. Return |promise| and continue the following steps asynchronously. +
          4. Let |global| be [=this=]' [=relevant global object=]. +
          5. +
          6. Return |promise| and continue [=in parallel=]. + +
          7. +
          8. 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| {{"NotAllowedError"}} + {{DOMException}} +
          9. +
          10. 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}}.
          11. If the |options| argument includes a non-null value for the {{PushSubscriptionOptions/applicationServerKey}} attribute, run the following sub-steps:
              -
            1. If the |applicationServerKey| is provided as a {{DOMString}}, set its value to an - {{ArrayBuffer}} containing the sequence of octets that result from decoding - |applicationServerKey| using the base64url encoding [[RFC7515]]. If decoding fails, - reject promise with a {{DOMException}} whose name is {{"InvalidCharacterError"}} and - terminate these steps. +
            2. 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]]. +
            3. +
            4. 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.
            5. -
            6. Ensure that |applicationServerKey| describes a valid point on the P-256 curve. If - the |applicationServerKey| value is invalid, reject |promise| with a {{DOMException}} - whose name is {{"InvalidAccessError"}} and terminate these steps. +
            7. 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.
          12. -
          13. If the |options| argument does not include a non-null value for the - {{PushSubscriptionOptions/applicationServerKey}} attribute, and the push service - requires one to be given, reject |promise| with a {{DOMException}} whose name is - {{"NotSupportedError"}} and terminate these steps. -
          14. -
          15. Let |registration| be the {{PushManager}}'s associated service worker +
          16. Let |registration:ServiceWorkerRegistration| be [=this=]'s associated service worker registration.
          17. -
          18. If |registration|'s [=service worker registration/active worker=] is null, reject - |promise| with a {{DOMException}} whose name is {{"InvalidStateError"}} and terminate these - steps. +
          19. If |registration|'s [=service worker registration/active worker=] is null, [=queue a + global task=] on the [=networking task source=] using |global| to [=reject=] |promise| with + an {{"InvalidStateError"}} {{DOMException}} and terminate these steps. +
          20. +
          21. Let |sw| be |registration|'s [=service worker registration/active worker=].
          22. Let |permission| be [=request permission to use=] "push".
          23. -
          24. If |permission| is "denied", reject |promise| with a {{DOMException}} whose name is - {{"NotAllowedError"}} and terminate these steps. +
          25. 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.
          26. -
          27. If the Service Worker is already subscribed, run the following substeps: +
          28. If |sw| is already subscribed, run the following sub-steps:
              -
            1. Retrieve the push subscription associated with the Service Worker. +
            2. Try to retrieve the push subscription associated with the |sw|. If there is + an error, [=queue a global task=] on the [=networking task source=] using |global| to + [=reject=] |promise| with an {{"AbortError"}} {{DOMException}} and terminate these + steps.
            3. -
            4. If there is an error, reject |promise| with a {{DOMException}} whose name is - {{"AbortError"}} and terminate these steps. +
            5. Let |subscription| be the push subscription associated with |sw|.
            6. -
            7. Let |subscription| be the retrieved subscription. +
            8. Compare the |options| argument with the `options` attribute of |subscription|. The + contents of {{BufferSource}} values are compared for equality rather than + [=ECMAScript/reference record|reference=].
            9. -
            10. Compare the |options| argument with the `options` attribute of |subscription|. If - any attribute on |options| contains a different value to that stored for - |subscription|, then reject |promise| with an {{InvalidStateError}} and terminate these - steps. The contents of {{BufferSource}} values are compared for equality rather than - references. +
            11. If any attribute on |options| contains a different value to that stored for + |subscription|, then [=queue a global task=] on the [=networking task source=] using + |global| to [=reject=] |promise| with an {{"InvalidStateError"}} {{DOMException}} and + terminate these steps.
            12. -
            13. When the request has been completed, resolve |promise| with |subscription|. +
            14. 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.
          29. -
          30. Let |subscription| be the result of running the create a push subscription steps - given |options|. -
          31. -
          32. If there is an error, reject |promise| with a {{DOMException}} whose name is - {{"AbortError"}} and terminate these steps. +
          33. Let |subscription| be the result of trying to [=create a push subscription=] with + |options|. If creating the subscription [=exception/throws=] an [=exception=], [=queue a + global task=] on the [=networking task source=] using |global| to [=reject=] |promise| with + a that [=exception=] and terminate these these steps.
          34. -
          35. Resolve |promise| with a {{PushSubscription}} providing the details of the new +
          36. Otherwise, [=queue a global task=] on the [=networking task source=] using |global| to + [=resolve=] |promise| with a {{PushSubscription}} providing the details of the new |subscription|.