Bug 9182

Summary: Add support for toSource and/or uneval
Product: WebKit Reporter: Jesse Ruderman <jruderman>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: emacemac7, gavin.sharp, ian, mike, mjs, mrowe, oliver
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   

Jesse Ruderman
Reported 2006-05-31 02:34:35 PDT
Firefox's toString and uneval are pretty handy. It would be nice if I could use them in WebKit, instead of having to serialize strings and objects manually when I want to port something from Gecko to WebKit. uneval("foo") --> "\"foo\"" uneval({a:1}) --> "({a:1})" I'm not sure if uneval and toSource are the same. I have the feeling they're not.
Attachments
Jesse Ruderman
Comment 1 2007-05-09 18:22:45 PDT
I of course meant "toSource", not "toString".
Oliver Hunt
Comment 2 2008-01-24 20:48:58 PST
This makes it easier to run jsfunfuzz https://bugzilla.mozilla.org/attachment.cgi?id=240710
Oliver Hunt
Comment 3 2008-01-24 20:54:55 PST
Hmm, some digging would appear to indicate there is no way to define a self referencing parameter in json :-/ eg. a=[]; a[0]=a; uneval(a); or at a greater extreme: a = {b:{c:a}}; a.c = a.b.c; uneval(a);
Oliver Hunt
Comment 4 2009-07-07 22:49:29 PDT
We support JSON.stringify now which is basically what was being requested
Note You need to log in before you can comment on or make changes to this bug.