Bug 352097 - E4X XML processing instruction with a target but no data decompiles with an extra space; also fixes bug 352103 - <??> accepted as a valid XML PI. r=brendan

This commit is contained in:
jwalden%mit.edu 2006-09-11 21:08:03 +00:00
Родитель 15bde65400
Коммит d789c52f9b
2 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -3256,8 +3256,9 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
return JS_FALSE;
todo = SprintPut(&ss->sprinter, "<?", 2);
ok = QuoteString(&ss->sprinter, ATOM_TO_STRING(atom), 0) &&
SprintPut(&ss->sprinter, " ", 1) >= 0 &&
SprintCString(&ss->sprinter, rval);
(*rval == '\0' ||
(SprintPut(&ss->sprinter, " ", 1) >= 0 &&
SprintCString(&ss->sprinter, rval)));
JS_free(cx, (char *)rval);
if (!ok)
return JS_FALSE;

Просмотреть файл

@ -1697,19 +1697,21 @@ retry:
}
ADD_TO_TOKENBUF(c);
}
if (targetLength == 0)
goto bad_xml_markup;
if (!TOKENBUF_OK())
goto error;
if (contentIndex < 0) {
atom = cx->runtime->atomState.emptyAtom;
} else {
if (!TOKENBUF_OK())
goto error;
atom = js_AtomizeChars(cx,
&TOKENBUF_CHAR(contentIndex),
TOKENBUF_LENGTH() - contentIndex,
0);
if (!atom)
goto error;
TRIM_TOKENBUF(targetLength);
}
TRIM_TOKENBUF(targetLength);
tp->t_atom2 = atom;
tt = TOK_XMLPI;