mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Expand entities only in TSF_XMLONLYMODE (r=mrbkap, who helped a great deal; a=me).
This commit is contained in:
parent
881abecab8
commit
ecbf37a541
@ -1015,7 +1015,7 @@ GetXMLEntity(JSContext *cx, JSTokenStream *ts)
|
||||
badncr:
|
||||
msg = JSMSG_BAD_XML_NCR;
|
||||
bad:
|
||||
/* No match: throw a TypeError per 10.3.2.1 step 8(a). */
|
||||
/* No match: throw a TypeError per ECMA-357 10.3.2.1 step 8(a). */
|
||||
FastAppendChar(&ts->tokenbuf, ';');
|
||||
bytes = js_DeflateString(cx, bp + 1,
|
||||
PTRDIFF(ts->tokenbuf.ptr, bp, jschar) - 2);
|
||||
@ -1139,7 +1139,7 @@ js_GetToken(JSContext *cx, JSTokenStream *ts)
|
||||
qc = (ts->flags & TSF_XMLONLYMODE) ? '<' : '{';
|
||||
|
||||
while ((c = GetChar(ts)) != qc && c != '<' && c != EOF) {
|
||||
if (c == '&') {
|
||||
if (c == '&' && qc == '<') {
|
||||
if (!GetXMLEntity(cx, ts))
|
||||
goto error;
|
||||
tt = TOK_XMLTEXT;
|
||||
@ -1245,7 +1245,7 @@ js_GetToken(JSContext *cx, JSTokenStream *ts)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '&') {
|
||||
if (c == '&' && (ts->flags & TSF_XMLONLYMODE)) {
|
||||
if (!GetXMLEntity(cx, ts))
|
||||
goto error;
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user