On Sep 1, 2009, at 7:39 AM, Hallvord R. M. Steen wrote:

correctness/045.js uses Number as the object to serialise, but Number
is a function so does not get stringified - JSON.stringify(function()
{ return arguments; }(), ["length"]) should do.

Thanks - though funny that Safari is the only browser here that actually passes the test. So Safari has a bug here? :)
Yes, because shipping Safari serialises function objects as ordinary objects :-(


integration/004.js makes Math.toJSON returns a stringified object
instead of the new object itself,

If that's wrong, I've misunderstood how toJSON() is supposed to work (thought it was meant to return a *string* representation of the object). I see from the algorithm that the output of the toJSON() call goes through the quote operation if it is a string and the JA/ JO serializations if it's array or object, but the spec does not really cover this issue in prose anywhere?! It's a bit late for such feedback but the functionality of a custom toJSON() method seems really underdefined.

toJSON returns the object that is expected to be serialised -- eg. Date.prototype.toJSON returns an unquoted string. Step 2. of the abstract operation Str handles toJSON as (basically)

   if (typeof value.toJSON === "function")
       value = value.toJSON();


integrity/004.js and 005.js have incorrect regexps as they fail to
account for 8.b.iii "if gap is not the empty string"

Fixed.

You also need to check for the new line following every brace or bracket, if there's a gap the output is multiline, so your regexps should be
/\{\n {10}"prop1": \{\}/ and /\{\na{10}"prop1": \{/

--Oliver

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to