Closed Bug 380959 Opened 18 years ago Closed 16 years ago

uneval(window) gives me something I can't pass to eval

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: jruderman)

Details

(Keywords: testcase)

Attachments

(1 file)

javascript:a = 3; alert(uneval(window)); result: "{}" expected: at least something I can pass to eval, such as "({})", but "({a:3})" would be nice.
Assignee: general → jruderman
Status: NEW → ASSIGNED
Attachment #382206 - Flags: review?(jst)
Attachment #382206 - Flags: superreview+
Attachment #382206 - Flags: review?(jst)
Attachment #382206 - Flags: review+
Comment on attachment 382206 [details] [diff] [review] patch changing {} to ({}) >diff --git a/js/src/xpconnect/src/xpcwrappednativejsops.cpp b/js/src/xpconnect/src/xpcwrappednativejsops.cpp >+ static const char empty[] = "({})"; This is fine. It'll end up with extra parens in, e.g. uneval({a:window}) => ({a: ({})}) but that's better than too few parentheses stopping compilation altogether! > *vp = STRING_TO_JSVAL(JS_NewStringCopyN(cx, empty, sizeof(empty)-1)); Please make this: JSString *str = JS_NewStringCopyN(cx, empty, sizeof(empty)-1); if(!str) return JS_FALSE; *vp = STRING_TO_JSVAL(str); > return JS_TRUE; > }
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Was this individually landed on TM branch? (whatever the case, it eventually will be once m-c gets synchronized onto TM branch)
No, I only landed this on mozilla-central. It's in DOM/XPConnect code, not JavaScript Engine code.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: