[Webkit-unassigned] [Bug 28117] Native JSON.stringify does not omit functions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 12 21:45:53 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28117





--- Comment #12 from Luke Smith <lsmith at lucassmith.name>  2009-08-12 21:45:52 PDT ---
I was unaware of this feature until reading your comment.  This behavior is not
in the spec.

section 9.11 specifies IsCallable
If the argument object has an [[Call]] internal method, then return true,
otherwise return false.

The only references in the spec to setting the [[Call]] internal method are
13.2 Creating Function objects
13.2.3 The [[ThrowTypeError]] Function Object
15.3.4.5 Function.prototype.bind (thisArg [, arg1 [, arg2, …]])

Section 15.10.6, defining RegExp, states
The value of the [[Prototype]] internal property of the RegExp prototype object
is the standard built-in 
Object prototype object (15.2.4)

I found that /a/("abc") is implemented (inconsistently) in Firefox 3.0, Firefox
3.5, Safari 3.2.1,  Safari 4, Opera 9.6.3, Opera 10 beta2, Chrome 3 beta, and
the WebKit nightlies.  It is not implemented in IE6, IE7, IE8, or Chrome 2.

Mozilla identifies this feature as a JavaScript extension
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp#RegExp_instances

I infer that such is the case for the others, WebKit included.  The difference
here being that the other browser vendors prevent the spec deviation from
rippling through their implementation to (at least) typeof and recently to
JSON.stringify.

Currently native JSON support is present in Firefox 3.5, IE8, Chrome 3 beta,
and recent WebKit nightlies.  All three of the other currently implementing
browsers agree both that typeof /a/ == 'object' and JSON.stringify(/a/) ==
'{}'.  There is value in interoperability.  If not typeof, please at least
stringify RegExp instances as objects for the sake of convention.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list