Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference for stage-3 arraybuffer-base64 #36387

Merged
merged 7 commits into from
Nov 4, 2024

Conversation

Josh-Cena
Copy link
Member

This adds documentation for a new API: https://github.com/tc39/proposal-arraybuffer-base64. Based on tc39/proposal-arraybuffer-base64#51, it is in FF 133 and Safari TP 202.

cc @bakkot

Verified

This commit was signed with the committer’s verified signature.
Josh-Cena Joshua Chen
@Josh-Cena Josh-Cena requested review from a team as code owners October 17, 2024 05:53
@Josh-Cena Josh-Cena requested review from Elchi3 and removed request for a team October 17, 2024 05:53
@github-actions github-actions bot added Content:WebAPI Web API docs Content:JS JavaScript docs Content:Glossary Glossary entries size/l [PR only] 501-1000 LoC changed labels Oct 17, 2024
Copy link
Contributor

github-actions bot commented Oct 17, 2024

Preview URLs (12 pages)
External URLs (9)

URL: /en-US/docs/Glossary/Base64
Title: Base64


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64
Title: Uint8Array.prototype.toBase64()


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/setFromBase64
Title: Uint8Array.prototype.setFromBase64()


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/setFromHex
Title: Uint8Array.setFromHex()


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toHex
Title: Uint8Array.prototype.toHex()


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromHex
Title: Uint8Array.fromHex()


URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64
Title: Uint8Array.fromBase64()

(comment last updated: 2024-11-04 22:24:34)

Copy link
Contributor

@bakkot bakkot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I left a few comments, which you can take or not.

Josh-Cena and others added 2 commits October 18, 2024 02:24

Verified

This commit was signed with the committer’s verified signature.
Josh-Cena Joshua Chen
Co-authored-by: Kevin Gibbons <[email protected]>

Verified

This commit was signed with the committer’s verified signature.
Josh-Cena Joshua Chen
@bakkot
Copy link
Contributor

bakkot commented Oct 23, 2024

LGTM

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@@ -62,8 +62,6 @@ console.log(self.btoa(ok)); // YQ==
console.log(self.btoa(notOK)); // error
```
Copy link
Collaborator

@hamishwillee hamishwillee Nov 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about replace this whole section with

Base64, by design, expects binary data as its input. In terms of JavaScript strings, this means strings in which the code point of each character occupies only one byte. So if you pass a string into btoa() containing characters that occupy more than one byte, you will get an error, because this is not considered binary data.

For more information and workarounds see [LINK TO YOUR WINDOW info]

Or for consistency duplicate the content that you added in Window.btoa

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to not update non-JS pages in this PR... I only did:

  1. Add links to JS in the glossary
  2. Move stuff that are no longer pertinent thanks to the new JS API out of glossary
  3. Remove references to glossary because the referenced section doesn't exist anymore, and readers would generally know to check Window.btoa when they are on WorkerGlobalScope.btoa anyway

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree - mostly on 3. I've made the edit myself so I can merge this.

@Elchi3 Elchi3 removed their request for review November 4, 2024 13:19

Verified

This commit was signed with the committer’s verified signature.
Josh-Cena Joshua Chen

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…/setfrombase64/index.md

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sorting this out @Josh-Cena. Very clear, as usual.

@hamishwillee hamishwillee merged commit 087a73e into mdn:main Nov 4, 2024
8 checks passed
@Josh-Cena Josh-Cena deleted the uint8-base64-hex branch November 4, 2024 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Glossary Glossary entries Content:JS JavaScript docs Content:WebAPI Web API docs size/l [PR only] 501-1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants