diff --git a/js/src/jsemit.c b/js/src/jsemit.c index ada2f137437..2aa2b409024 100644 --- a/js/src/jsemit.c +++ b/js/src/jsemit.c @@ -2262,6 +2262,11 @@ EmitElemOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg) if (!js_EmitTree(cx, cg, left)) return JS_FALSE; } + /* The right side of the descendant operator is implicitly quoted. */ + if (op == JSOP_DESCENDANTS && right->pn_op == JSOP_STRING && + js_NewSrcNote(cx, cg, SRC_UNQUOTE) < 0) { + return JS_FALSE; + } if (!js_EmitTree(cx, cg, right)) return JS_FALSE; if (js_NewSrcNote2(cx, cg, SRC_PCBASE, CG_OFFSET(cg) - top) < 0) @@ -4953,7 +4958,7 @@ JS_FRIEND_DATA(JSSrcNoteSpec) js_SrcNoteSpec[] = { {"pcdelta", 1, 0, 1}, {"assignop", 0, 0, 0}, {"cond", 1, 0, 1}, - {"reserved0", 0, 0, 0}, + {"unquote", 0, 0, 0}, {"hidden", 0, 0, 0}, {"pcbase", 1, 0, -1}, {"label", 1, 0, 0}, diff --git a/js/src/jsemit.h b/js/src/jsemit.h index d147f231136..1a854a8695b 100644 --- a/js/src/jsemit.h +++ b/js/src/jsemit.h @@ -415,7 +415,7 @@ typedef enum JSSrcNoteType { gets and sets */ SRC_ASSIGNOP = 8, /* += or another assign-op follows */ SRC_COND = 9, /* JSOP_IFEQ is from conditional ?: operator */ - SRC_RESERVED0 = 10, /* reserved for future use */ + SRC_UNQUOTE = 10, /* don't quote a JSOP_STRING */ SRC_HIDDEN = 11, /* opcode shouldn't be decompiled */ SRC_PCBASE = 12, /* distance back from annotated get- or setprop op to first obj.prop.subprop bytecode */ diff --git a/js/src/jsopcode.c b/js/src/jsopcode.c index ffe9a580093..f08f97ec0d3 100644 --- a/js/src/jsopcode.c +++ b/js/src/jsopcode.c @@ -2128,8 +2128,11 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb) END_LITOPX_CASE BEGIN_LITOPX_CASE(JSOP_STRING) + sn = js_GetSrcNote(jp->script, pc); rval = QuoteString(&ss->sprinter, ATOM_TO_STRING(atom), - (jschar)(inXML ? 0 : '"')); + (jschar)((inXML || + (sn && SN_TYPE(sn) == SRC_UNQUOTE)) + ? 0 : '"')); if (!rval) return JS_FALSE; todo = STR2OFF(&ss->sprinter, rval);