W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2008

Re: [whatwg] WebIDL and HTML5

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Tue, 26 Aug 2008 19:35:29 -0700
Message-ID: <c9e12660808261935j3db1413en398f28a219794d74@mail.gmail.com>
To: "Boris Zbarsky" <bzbarsky@mit.edu>
Cc: "Web Applications Working Group WG" <public-webapps@w3.org>

On Tue, Aug 26, 2008 at 5:29 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> Garrett Smith wrote:
>>>>>
>>>>> That can be the default, perhaps.  But I suspect usually null should
>>>>> become
>>>>> "", not "null".
>>>>
>>>> Why?
>>>
>>> Honestly?  Because that's what Firefox does right now, except in certain
>>
>> That is not true. Firefox has Spidermonkey.
>
> The Spidermonkey part is irrelevant for purposes of this discussion, except

For native function calls, Spidermonkey converts native EcmaScript
value null to "null" using ToString.
Example:

 "null".indexOf(null); // => 0

I mentioned this because it is what developers in that language
expect. It would be inconsistent to serialize null to something other
than "null".

It would be OK for the method or setter to raise on null, or to have
specified behavior if null were passed in.

Null is not the empty string.

> in places where JS_ValueToString is used (basically DOM0 special-cases).
>  What matters is the XPConnect glue layer which converts JS function calls
> into C++ function calls in the general case.
>
> In fact, the relevant code for Gecko 1.9 is right here:
>
> http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/js/src/xpconnect/src/xpcconvert.cpp&rev=1.129&mark=743-751#731
>
> and
>
> http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/js/src/xpconnect/src/xpcprivate.h&rev=1.283&mark=932-934#922
>
> It converts a JSVAL_NULL into an empty nsAString with the IS_VOID bit set.
>

Although I would like to understand that code, I do not. I'll just
have to take you word for it.

I can appreciate that there was work that went into that, and I can
certainly appreciate the value of Firefox.

Garrett

> -Boris
>
Received on Wednesday, 27 August 2008 02:36:04 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:27 GMT