Bug 9182
| Summary: | Add support for toSource and/or uneval | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jesse Ruderman <jruderman> |
| Component: | JavaScriptCore | Assignee: | 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
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Jesse Ruderman
I of course meant "toSource", not "toString".
Oliver Hunt
This makes it easier to run jsfunfuzz https://bugzilla.mozilla.org/attachment.cgi?id=240710
Oliver Hunt
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
We support JSON.stringify now which is basically what was being requested