mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
LibWeb: Make btoa() and atob() correctly handle values between 128 and 255
btoa() takes a byte string, so it must decode the UTF-8 argument into a Vector<u8> before calling encode_base64. Likewise, in atob() decode_base64 returns a byte string, so that needs to be converted to UTF-8. With this, `btoa(String.fromCharCode(255))` is '/w==' as it should be, and `atob(btoa(String.fromCharCode(255))) == String.fromCharCode(255)` remains true.
This commit is contained in:
parent
5ba8aba197
commit
b9ce56aee6
3 changed files with 17 additions and 4 deletions
|
@ -152,6 +152,7 @@
|
|||
M(ToObjectNullOrUndef, "ToObject on null or undefined") \
|
||||
M(UnknownIdentifier, "'%s' is not defined") \
|
||||
/* LibWeb bindings */ \
|
||||
M(NotAByteString, "Argument to %s() must be a byte string") \
|
||||
M(BadArgCountOne, "%s() needs one argument") \
|
||||
M(BadArgCountAtLeastOne, "%s() needs at least one argument") \
|
||||
M(BadArgCountMany, "%s() needs %s arguments")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue