mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 352437 - Part c: Escape quotes in tagify; r=jorendorff
This commit is contained in:
parent
468ea070bf
commit
f9da755325
@ -2931,8 +2931,13 @@ tagify(JSContext *cx, const char *begin, JSLinearString *param, const char *end,
|
|||||||
size_t beglen = strlen(begin);
|
size_t beglen = strlen(begin);
|
||||||
size_t taglen = 1 + beglen + 1; /* '<begin' + '>' */
|
size_t taglen = 1 + beglen + 1; /* '<begin' + '>' */
|
||||||
if (param) {
|
if (param) {
|
||||||
size_t parlen = param->length();
|
size_t numChars = param->length();
|
||||||
taglen += 2 + parlen + 1; /* '="param"' */
|
const jschar *parchars = param->chars();
|
||||||
|
for (size_t i = 0, parlen = numChars; i < parlen; ++i) {
|
||||||
|
if (parchars[i] == '"')
|
||||||
|
numChars += 5; /* len(") - len(") */
|
||||||
|
}
|
||||||
|
taglen += 2 + numChars + 1; /* '="param"' */
|
||||||
}
|
}
|
||||||
size_t endlen = strlen(end);
|
size_t endlen = strlen(end);
|
||||||
taglen += str->length() + 2 + endlen + 1; /* 'str</end>' */
|
taglen += str->length() + 2 + endlen + 1; /* 'str</end>' */
|
||||||
@ -2949,7 +2954,14 @@ tagify(JSContext *cx, const char *begin, JSLinearString *param, const char *end,
|
|||||||
if (param) {
|
if (param) {
|
||||||
sb.infallibleAppend('=');
|
sb.infallibleAppend('=');
|
||||||
sb.infallibleAppend('"');
|
sb.infallibleAppend('"');
|
||||||
MOZ_ALWAYS_TRUE(sb.append(param));
|
const jschar *parchars = param->chars();
|
||||||
|
for (size_t i = 0, parlen = param->length(); i < parlen; ++i) {
|
||||||
|
if (parchars[i] != '"') {
|
||||||
|
sb.infallibleAppend(parchars[i]);
|
||||||
|
} else {
|
||||||
|
MOZ_ALWAYS_TRUE(sb.append("""));
|
||||||
|
}
|
||||||
|
}
|
||||||
sb.infallibleAppend('"');
|
sb.infallibleAppend('"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user