more JSON spec questions

Oliver Hunt oliver at apple.com
Wed Aug 26 15:37:11 PDT 2009


> 2) The grammar and an existing test in the json.org test suite  
> disallows final commas in array input (JSON.parse('[1,]') should  
> apparently throw) - IE8, Safari 4 and Firefox 3.5 all seem to  
> happily accept it though, as does the yet-to-go-public Opera  
> implementation. I'd like some reassurance from other browser vendors  
> that you consider this a bug and intend to fix it before I push for  
> a fix here because this is the kind of thing that might cause compat  
> problems :-o (Guess this is more a question for the implementers on  
> the list than for the spec authors.)
This is definitely a bug in the WebKit implementation (we disallow the  
trailing comma in object literals, i'm saddened that we allow the  
trailing comma in [] :-/ )

>
> 4) (Editorial) - spec says "The abstract operation Str(key, holder)  
> has access  to
> PropertyList and ReplacerFunction" - the algorithm does not actually  
> use
> PropertyList (very trivial issue, of course)
PropertyList is used in the abstract function JO

> Quick word about the test suite: it's current home is http://testsuites.opera.com/JSON/ 
>  where you can have a look at the README, load runner.htm to run all  
> tests (Warning: if you do that in IE8 something makes it eat all  
> your memory and make the PC entirely unusable!) or browse through  
> folders to individual tests. Hope it's useful to all you  
> implementers out there. Feedback welcome :)

There are also reasonably extensive tests in the WebKit repository --  
unfortunately they are designed primarily as regression tests so their  
output isn't astonishingly nice -- Browsers without a native JSON  
implementation just fail everything somewhat catastrophically with no  
obvious indication as to why.  That said the tests do cover most edge  
cases (although not the [] with terminating comma thing apparently :- 
( ) such as order of execution, number of times properties are  
accessed, etc.

http://trac.webkit.org/export/HEAD/trunk/LayoutTests/fast/js/JSON-stringify-replacer.html
http://trac.webkit.org/export/HEAD/trunk/LayoutTests/fast/js/JSON-parse.html
http://trac.webkit.org/export/HEAD/trunk/LayoutTests/fast/js/JSON-stringify.html 
  (this one takes quite a while)

--Oliver

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090826/5ba3f14b/attachment.html>


More information about the es-discuss mailing list