window.atob() should ignore spaces in input as per: https://html.spec.whatwg.org/#dom-windowbase64-atob (Step 3) Currently, WebKit throws an exception and it is the only browser to do so. Firefox and Chrome behavior according to the specification. This causes us to fail 10 checks in the following W3C HTML test: http://w3c-test.org/html/webappapis/atob/base64.html
<rdar://problem/24357822>
Created attachment 269945 [details] WIP Patch
I'm pretty sure that we have an old bug with a discussion of what a stupid idea this was :(
(In reply to comment #3) > I'm pretty sure that we have an old bug with a discussion of what a stupid > idea this was :( I forgot about it but now that you mention it, it does ring a bell. The thing is that the spec has not changed since, other browsers still strip whitespaces as well. It is now covered by the W3C web-platform-tests too.
bug 123830
(In reply to comment #5) > bug 123830 The fact at this point is that other browsers and the specification have been stripping spaces for several years now. Not doing this in WebKit is a compatibility risk and I think we should do this.
I'm afraid so, yes. It will probably change back eventually though.
Created attachment 270009 [details] Patch
Comment on attachment 270009 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=270009&action=review > Source/WTF/wtf/text/Base64.cpp:182 > } Don't forget to update the copyright on this file. > LayoutTests/fast/dom/Window/atob-btoa-expected.txt:29 > +PASS window.atob(" YQ==") is "a" Can you please add tests covering the error cases? There are 3 "hadError = true;". Each should have a test.
Created attachment 270041 [details] Patch
Created attachment 270044 [details] Patch
Comment on attachment 270044 [details] Patch Clearing flags on attachment: 270044 Committed r195694: <http://trac.webkit.org/changeset/195694>
All reviewed patches have been landed. Closing bug.