mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:17:35 +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
|
@ -61,6 +61,7 @@
|
|||
#define JS_ENUMERATE_ERROR_SUBCLASSES \
|
||||
__JS_ENUMERATE(EvalError, eval_error, EvalErrorPrototype, EvalErrorConstructor) \
|
||||
__JS_ENUMERATE(InternalError, internal_error, InternalErrorPrototype, InternalErrorConstructor) \
|
||||
__JS_ENUMERATE(InvalidCharacterError, invalid_character_error, InvalidCharacterErrorPrototype, InvalidCharacterErrorConstructor) \
|
||||
__JS_ENUMERATE(RangeError, range_error, RangeErrorPrototype, RangeErrorConstructor) \
|
||||
__JS_ENUMERATE(ReferenceError, reference_error, ReferenceErrorPrototype, ReferenceErrorConstructor) \
|
||||
__JS_ENUMERATE(SyntaxError, syntax_error, SyntaxErrorPrototype, SyntaxErrorConstructor) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue