Closed Bug 373678 Opened 18 years ago Closed 18 years ago

Missing quotes around string in decompilation, with for..in and do..while

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: jruderman, Assigned: igor)

References

Details

(Keywords: regression, testcase)

Attachments

(1 file)

js> function() { do {for(a.b in []) { } } while("c\\d"); } function () { do { for (a.b in []) { } } while (c\d); }
More qnamepart fun not turning off inXML.
(In reply to comment #1) > More qnamepart fun not turning off inXML. > I suspect that this is caused by the abuse of JSOP_QNAMEPART in EmitElemOp from jsemit.c. This XML-only bytecode is used just to allow to decompile JSOP_STRING as name. I think we should just add a new source note for JSOP_STRING and replace JSOP_QNAMEPART/JSOP_TOATTRNAME pair by a single JSOP_ATTRNAME.
Assignee: general → igor
What part of this testcase is interpreted as being E4X-related?
js> dis(function() { do {for(a.b in []) { } } while("c\\d"); }) flags: LAMBDA INTERPRETED main: 00000: nop 00001: callname "Array" 00004: newinit 00005: endinit 00006: forin 00007: forelem 00008: ifeq 21 (13) 00011: name "a" 00014: qnamepart "b" 00017: enumelem 00018: goto 7 (-11) 00021: enditer 00022: string "c\\\\d" 00025: ifne 1 (-24) 00028: stop inXML gets turned on for the qnamepart bytecode, and nothing turns it off.
(In reply to comment #3) > What part of this testcase is interpreted as being E4X-related? The emitter uses JSOP_QNAMEPART (defined only for JS_HAS_XML_SUPPORT) in the code that has nothing to with E4X. This is done to take advantage of the fact that compared with JSOP_STRING, JSOP_QNAMEPART when decompiling treats its atom as a name and does not put "" around it. This use of xml-only bytecode is wrong even ignoring the fact that JSOP_QNAMEPART incorrectly sets inXML.
I have a patch to rename JSOP_QNAMEPART to JSOP_LOCALNAME. Remember that namespaces are coming in ES4/JS2. I don't think the emitter is abusing this op; rather, inXML should not be set for this op. (As usual, the decompiler is the hack to clean up.) Would that fix things? /be
Attached patch Minimal fix v1Splinter Review
The fix just removes inXML = JS_TRUE from JSOP_QNAMEPART. Fixing proliferation of JSOP_STRING synonymous is a subject of bug 373772.
Attachment #258425 - Flags: review?(brendan)
Comment on attachment 258425 [details] [diff] [review] Minimal fix v1 r=me, and I will link bug to js1.7src. Easy branch patch if possible. /be
Attachment #258425 - Flags: review?(brendan)
Attachment #258425 - Flags: review+
Attachment #258425 - Flags: approval1.8.1.4?
Attachment #258425 - Flags: approval1.8.0.12?
Blocks: js1.7src
I committed the patch from comment 7 to the trunk: Checking in jsopcode.c; /cvsroot/mozilla/js/src/jsopcode.c,v <-- jsopcode.c new revision: 3.217; previous revision: 3.216 done
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
/cvsroot/mozilla/js/tests/js1_5/decompilation/regress-373678.js,v <-- regress-373678.js initial revision: 1.1 /cvsroot/mozilla/js/tests/js1_5/decompilation/browser.js,v <-- browser.js initial revision: 1.1 /cvsroot/mozilla/js/tests/js1_5/decompilation/shell.js,v <-- shell.js initial revision: 1.1 /cvsroot/mozilla/js/tests/e4x/decompilation/regress-373678.js,v <-- regress-373678.js initial revision: 1.1 note 1.8.1 passes this already while 1.8.0 will fail due to decompilation of a.b as a["b"].
Flags: in-testsuite+
verified fixed 1.9.0 20070320 win/mac*/linux
Status: RESOLVED → VERIFIED
Comment on attachment 258425 [details] [diff] [review] Minimal fix v1 approved for 1.8.0.12 and 1.8.1.4, a=dveditz for release-drivers
Attachment #258425 - Flags: approval1.8.1.4?
Attachment #258425 - Flags: approval1.8.1.4+
Attachment #258425 - Flags: approval1.8.0.12?
Attachment #258425 - Flags: approval1.8.0.12+
The patch fixes trunk-only regression caused by bug 352285. Since that bug is not nominated for branches, the approval flags from the patch should be dropped.
Blocks: 352285
Keywords: regression
Comment on attachment 258425 [details] [diff] [review] Minimal fix v1 The patch is not applicable to branches.
Attachment #258425 - Flags: approval1.8.1.4+
Attachment #258425 - Flags: approval1.8.0.12+
This regressed the test <?f b\n\nc\nc?> in e4x/decompilation/decompile-xml-escapes.js: FAILED!: Actual value: FAILED!: 'function anonymous() { FAILED!: return <?f b\n\nc\nc?>; FAILED!: }' does not contain '<?f b FAILED!: FAILED!: c FAILED!: c?>'!
Depends on: 379846
filed Bug 379846 on the regression
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: