-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
buffer,lib: update atob to align wpt's base64.json #43901
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to remove the equal signs from the string, couldn't we simply count them and throw if there's more than two or if a different char after the first equal sign?
@@ -1277,13 +1280,36 @@ function atob(input) { | |||
// The first 5 elements of `kForgivingBase64AllowedChars` are | |||
// ASCII whitespace char codes. | |||
nonAsciiWhitespaceCharCount++; | |||
|
|||
if (index === kEqualSignIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you put this check here, you don't need to repeat the throw lazyDOMException
part, right?
if (index === kEqualSignIndex) { | |
if (index === kEqualSignIndex && equalCharCount !== 2) { |
Other than that, LGTM
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob-dev Refs: https://infra.spec.whatwg.org/#forgiving-base64-decode PR-URL: #43901 Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 3a7fcdc |
Refs: https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob-dev Refs: https://infra.spec.whatwg.org/#forgiving-base64-decode PR-URL: #43901 Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob-dev
Refs: https://infra.spec.whatwg.org/#forgiving-base64-decode