RESOLVED DUPLICATE of bug 118898 104358
base64DecodeInternal() is not conforming to HTML5(window.atob) spec.
https://bugs.webkit.org/show_bug.cgi?id=104358
Summary base64DecodeInternal() is not conforming to HTML5(window.atob) spec.
Sanghyun Park
Reported 2012-12-07 02:58:06 PST
base64DecodeInternal() is not conforming to HTML5(window.atob) spec. Window.atob has not been implemented in accordance with base64 spec(http://www.w3.org/TR/html5/webappapis.html#atob). 4. If the length of input divides by 4 leaving no remainder, then: if input ends with one or two "=" (U+003D) characters, remove them from input. (in spec) 6. If input contains a character that is not in the following list of characters and character ranges, throw an InvalidCharacterError exception and abort these steps (in spec) - Currently in WebKit, if input invalid charater, did not throw an InvalidCharacterError exception and abort. This issue is reproducible at w3c approved test site (http://w3c-test.org/html/tests/approved/base64.html). So, I will upload the patch as soon as possible.
Attachments
Initial patch! (5.71 KB, patch)
2013-01-29 00:34 PST, Sanghyun Park
ossy: review-
ossy: commit-queue-
Glenn Adams
Comment 1 2012-12-07 07:20:39 PST
how does the HTML5 specified behavior compare with other implementations? FF, IE, etc?
Sanghyun Park
Comment 2 2012-12-10 07:32:23 PST
(In reply to comment #1) > how does the HTML5 specified behavior compare with other implementations? FF, IE, etc? In case of WebKit, result of w3c approved test site is "350 pass/18 fail". On the other hand, firefox result is 366 pass / 2 fail. - 2 fails are TC error, so firefox supports the spec, perfectly. Opera is also better than WebKit.(Result : 363 pass / 5 fail).
Glenn Adams
Comment 3 2012-12-10 07:37:35 PST
in the case of tests where one or more other browsers also fail, then care should be given to the validity of the test in question; some evaluation/discussion may be needed before implementing changes to pass the test; in other words, don't simply assume that the w3c tests are always valid
Sanghyun Park
Comment 4 2012-12-10 08:53:09 PST
Thanks for your kind concern. I have tried double-checking to make sure about mismatching between TC and Spec. Failed 14 test cases which are proper. However, 2 failed TCs have below bugs. Let atob("ab="). (- this test is contained the "http://w3c-test.org/html/tests/approved/base64.htm") According to No. 4 of aboved spec, Because length of "ab=" is not divisible by 4, cannot remove the "=". According to No. 6 of aboved spec, "=" is not in the following list of characters and character ranges("+" (U+002B), "/" (U+002F), ASCII digits, uppercase ASCII letters and lowercase ASCII letters). So,should throw an InvalidCharacterError exception and abort. but in Webkit, do not following No. 4 spec and always remove ends with "=" characters, so do not throw an error.
Sanghyun Park
Comment 5 2013-01-29 00:34:47 PST
Created attachment 185186 [details] Initial patch!
Benjamin Poulain
Comment 6 2013-01-29 00:43:17 PST
(In reply to comment #3) > in the case of tests where one or more other browsers also fail, then care should be given to the validity of the test in question; some evaluation/discussion may be needed before implementing changes to pass the test; in other words, don't simply assume that the w3c tests are always valid This is an important point. Thanks for pointing that out.
Csaba Osztrogonác
Comment 7 2015-05-11 02:11:25 PDT
*** This bug has been marked as a duplicate of bug 118898 ***
Note You need to log in before you can comment on or make changes to this bug.