зеркало из https://github.com/mozilla/gecko-dev.git
bug 302531: QuoteString doesn't deal with not outputting anything. Also fix some whitespace nits. r=shaver a=brendan
This commit is contained in:
Родитель
e246c70e9d
Коммит
b2ecd424ea
|
@ -4710,15 +4710,15 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||
|
||||
JS_ASSERT(pn->pn_type == TOK_XMLLIST || pn->pn_count != 0);
|
||||
switch (pn->pn_head->pn_type) {
|
||||
case TOK_XMLETAGO:
|
||||
JS_ASSERT(0);
|
||||
/* FALL THROUGH */
|
||||
case TOK_XMLPTAGC:
|
||||
case TOK_XMLSTAGO:
|
||||
break;
|
||||
default:
|
||||
if (js_Emit1(cx, cg, JSOP_STARTXML) < 0)
|
||||
return JS_FALSE;
|
||||
case TOK_XMLETAGO:
|
||||
JS_ASSERT(0);
|
||||
/* FALL THROUGH */
|
||||
case TOK_XMLPTAGC:
|
||||
case TOK_XMLSTAGO:
|
||||
break;
|
||||
default:
|
||||
if (js_Emit1(cx, cg, JSOP_STARTXML) < 0)
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
for (pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) {
|
||||
|
|
|
@ -431,6 +431,13 @@ QuoteString(Sprinter *sp, JSString *str, jschar quote)
|
|||
/* Sprint the closing quote and return the quoted string. */
|
||||
if (quote && Sprint(sp, "%c", (char)quote) < 0)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* If we haven't Sprint'd anything yet, Sprint an empty string so that
|
||||
* the OFF2STR below gives a valid result.
|
||||
*/
|
||||
if (off == sp->offset && Sprint(sp, "") < 0)
|
||||
return NULL;
|
||||
return OFF2STR(sp, off);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче