RESOLVED FIXED 118844
Make atob() / btoa() argument non optional
https://bugs.webkit.org/show_bug.cgi?id=118844
Summary Make atob() / btoa() argument non optional
Chris Dumez
Reported 2013-07-18 04:45:50 PDT
According to the latest specification, the argument to atob() / btoa() should not be optional: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#windowbase64 This patch makes WebKit behave according to the specification. The argument is also mandatory in Firefox, IE10 and Blink. atob() / btoa() are also moved to their own WindowBase64 interface which the Window interface implements. This does not change the behavior but this is closer to the specification and it will make exposing those methods to workers easier later on. Corresponding Blink revision: https://src.chromium.org/viewvc/blink?revision=154419&view=revision
Attachments
Patch (10.17 KB, patch)
2013-07-18 04:57 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2013-07-18 04:57:07 PDT
Kentaro Hara
Comment 2 2013-07-18 05:56:57 PDT
Comment on attachment 206981 [details] Patch LGTM. Thanks for keeping cross-browser compatibility.
Alexey Proskuryakov
Comment 3 2013-07-18 09:29:48 PDT
Weird, why was the argument optional? Did you check svn history?
Chris Dumez
Comment 4 2013-07-18 10:16:59 PDT
(In reply to comment #3) > Weird, why was the argument optional? Did you check svn history? From what I understand, a [LegacyDefaultOptionalArguments] extended attribute was added to the DOMWindow interface in <http://trac.webkit.org/changeset/89148>. This basically means that arguments are optional for all operations of the interface (Apparently used to be the default behavior in WebIDL. Then, the interface-level extended attribute was replaced by an argument-level [Optional] extended attribute in <http://trac.webkit.org/changeset/92313> (no behavior change). This optional extended attribute was then never removed. Summary: So this seems like a legacy from Web IDL, at a time when we did not throw when arguments were missing. These methods were simply never updated after that to match the specification. With that in mind, any objection about me landing this change?
Alexey Proskuryakov
Comment 5 2013-07-18 11:44:04 PDT
Comment on attachment 206981 [details] Patch Seems OK to me. Even though we're making exceptions happen where they didn't use to, it seems very unlikely that anyone calls these functions without arguments. Changing behavior for null seems slightly more likely to affect sites, but also probably not bad enough.
WebKit Commit Bot
Comment 6 2013-07-18 12:06:20 PDT
Comment on attachment 206981 [details] Patch Clearing flags on attachment: 206981 Committed r152859: <http://trac.webkit.org/changeset/152859>
WebKit Commit Bot
Comment 7 2013-07-18 12:06:25 PDT
All reviewed patches have been landed. Closing bug.
Alexey Shvayka
Comment 8 2021-04-24 11:59:00 PDT
*** Bug 68618 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.