Closed Bug 688443 Opened 13 years ago Closed 9 years ago

btoa() and atob() should stringify null to "null", not ""

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: ayg, Unassigned)

Details

Spec:

http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#atob

It doesn't have [TreatNullAs=EmptyString], so it should be treated as "null".  No one does this currently for btoa() or atob() -- Firefox 8.0a2, Chrome 15 dev, and Opera 11.50 stringify to "".  (IE doesn't support the functions.)  But it seems like consensus is that browsers should change here, not the spec:

http://krijnhoetmer.nl/irc-logs/whatwg/20110922#l-230 (first two lines)
http://krijnhoetmer.nl/irc-logs/whatwg/20110922#l-554 (continuation)

zcorpan reports Opera has already changed, and Ms2ger says Gecko should change too.  I'll update my tests to test for this.
If every existing implementation behaves identically, why does the spec specify a different behavior?
The status quo seems to be that null is stringified differently by different methods at random.  What I was told is that it's been agreed that we should standardize on stringifying to "null" wherever possible, for consistency, and that stringifying to "" should only be kept where demonstrably needed for compat.  It doesn't matter to me if this is WONTFIX; then I'll file a bug to get the spec changed instead.  But Ms2ger said I should file a bug asking Gecko to change.

WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=68618
I'm not saying that we will or won't do this, I just wanted to understand why we want to change an already interoperable behavior.  If it varies randomly across methods that is a fairly convincing reason.
Version: 2.0 Branch → Trunk
This was fixed at some point, presumably by the new DOM bindings.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.