Closed Bug 243362 Opened 21 years ago Closed 21 years ago

Copy Qualified name needs to do some escaping

Categories

(Other Applications Graveyard :: Venkman JS Debugger, defect)

x86
Windows XP
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: bugzilla-mozilla-20000923)

Details

Attachments

(1 file)

consider: a={"test-case":0} copy qualified name results in: this.a.test-case Caught exception: “SyntaxError: syntax error”
Since the Copy qualified Name function litterally just sticks the expression into the clipboard, I think we need the escaping around line 799/808 in here: http://lxr.mozilla.org/mozilla/source/extensions/venkman/resources/content/venkman-views.js#787 I would suggest anything that contains non-alphanumerics, or doesn't start with a letter, should be escaped into a ["..."] format (with \" escaping). Would this be suitable?
spidermonkey actually has a way to do this stuff. iirc brendan poked things that messed up near the decompiler recently.
Not escaping, quoting and indexing (a["test-case"], not a.test-case). But since Venkman is doing its own "decompiling", it will have to handle the non-identifier case -- there's nothing SpiderMonkey can do to help here, short of exposing native helper functions, which doesn't seem like a good trade to me. /be
I've been away from this for a while, but what about just changing: cx.expression = cur.displayName + "." + cx.expression; to cx.expression = cur.displayName + "[" + cx.expression.quote() + "]"; ?
This changes the way cx.expression is generated so that items are escaped as needed. It matches numbers (for foo[42]), 'words' (for foo.bar) and everything else is fully escaped (for foo[".!%"]). I also added support for the two ECMA properties, __proto__ and __parent__.
Attachment #150573 - Flags: review?(rginda)
Comment on attachment 150573 [details] [diff] [review] Escape expressions used for Copy Qual Name r=rginda
Attachment #150573 - Flags: review?(rginda) → review+
__proto__ and __parent__ are SpiderMonkey extensions, not part of ECMA-262. /be
Checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Core → Other Applications
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: