whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.05k stars 2.64k forks source link

Switch btoa() to take ByteString and atob() to return a ByteString? #2911

Open annevk opened 7 years ago

annevk commented 7 years ago

For btoa() you'd get TypeError instead of "InvalidCharacterError", but the conversion to bytes would happen in the IDL layer, which seems better?

The same is true for atob() which effectively returns a byte sequence that the IDL layer can then turn into a string to be exposed to JavaScript.

(The latter is also useful for an upcoming refactoring that allows us to reuse the atob() algorithm for data URLs.)

annevk commented 7 years ago

If we decide not to do this because we want to keep the exception the same, we should still update the text to make use of https://github.com/whatwg/infra/pull/146.