Bug 1108382 - Part 2: Do not use non-standard flag argument of String.prototype.match/replace in browser/components/translation/. r=felipe

This commit is contained in:
Tooru Fujisawa 2015-03-01 09:51:33 +09:00
parent fe0f61d6b1
commit bfb908ee6f

View File

@ -207,7 +207,7 @@ this.BingTranslator.prototype = {
if (root.isSimpleRoot) {
// Workaround for Bing's service problem in which "&" chars in
// plain-text TranslationItems are double-escaped.
result = result.replace("&", "&", "g");
result = result.replace(/&/g, "&");
}
root.parseResult(result);
@ -422,11 +422,11 @@ let BingTokenManager = {
*/
function escapeXML(aStr) {
return aStr.toString()
.replace("&", "&", "g")
.replace('"', """, "g")
.replace("'", "'", "g")
.replace("<", "&lt;", "g")
.replace(">", "&gt;", "g");
.replace(/&/g, "&amp;")
.replace(/\"/g, "&quot;")
.replace(/\'/g, "&apos;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
}
/**