[w3c/push-api] Add bytes() method for reading bytes into a Uint8Array (PR #369)

The Fetch API [is getting](https://github.com/whatwg/fetch/pull/1753) a `Uint8Array`-returning `bytes()` method alongside its existing `arrayBuffer()` method, following [the principle](https://github.com/w3ctag/design-principles/pull/480) that APIs should generally vend byte buffers as `Uint8Array`s.

This PR makes the same change for `PushMessageData`, which has its own distinct `arrayBuffer` method.

I'm assuming this is uncontroversial given the support from the three major implementations for doing this on `Body`, but I can open an issue and solicit explicit support separately if you'd prefer. I'll write tests if I get a signal that this is able to go forward.

It's unfortunate that `getKey` and `applicationServerKey` vend `ArrayBuffer`s instead of `Uint8Array`s, but it's too late to fix those now.

 * [ ] Modified Web platform tests (link to pull request)

Implementation commitment:
 
 * [ ] Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=)
 * [ ] Gecko (https://bugzilla.mozilla.org/show_bug.cgi?id=)
 * [ ] WebKit (https://bugs.webkit.org/show_bug.cgi?id=)


<!--
    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/bakkot/push-api/pull/369.html" title="Last updated on May 10, 2024, 4:30 PM UTC (b7ad11f)">Preview</a> | <a href="https://pr-preview.s3.amazonaws.com/w3c/push-api/369/28f2a51...bakkot:b7ad11f.html" title="Last updated on May 10, 2024, 4:30 PM UTC (b7ad11f)">Diff</a>
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add bytes() method for reading bytes into a Uint8Array

-- File Changes --

    M index.html (6)

-- Patch Links --

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

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

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

Received on Friday, 10 May 2024 16:30:30 UTC