Bug 1138095 - Do not use non-standard flag argument of String.prototype.replace in mail/. r=mkmelin
authorTooru Fujisawa <arai_a@mac.com>
Mon, 02 Mar 2015 00:36:48 +0900
changeset 17584 da5fd11104e5d0883775fa9a04d3a96648b408a7
parent 17583 3caaa51155f85d962a00e126029dd68ea8afe6e8
child 17585 b78dd3d5691667cf5dbbec24cb5efa5079a2d119
push id10822
push userarai_a@mac.com
push dateSun, 01 Mar 2015 15:42:19 +0000
treeherdercomm-central@b78dd3d56916 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1138095
Bug 1138095 - Do not use non-standard flag argument of String.prototype.replace in mail/. r=mkmelin
mail/base/modules/distribution.js
mail/base/test/unit/test_mailGlue_distribution.js
mail/components/about-support/content/export.js
mail/components/compose/content/MsgComposeCommands.js
--- a/mail/base/modules/distribution.js
+++ b/mail/base/modules/distribution.js
@@ -90,17 +90,17 @@ var TBDistCustomizer = {
                          .createInstance(Ci.nsIPrefLocalizedString);
 
     if (sections["LocalizablePreferences"]) {
       let keys = this._ini.getKeys("LocalizablePreferences");
       while (keys.hasMore()) {
         let key = keys.getNext();
         try {
           let value = eval(this._ini.getString("LocalizablePreferences", key));
-          value = value.replace("%LOCALE%", this._locale, "g");
+          value = value.replace(/%LOCALE%/g, this._locale);
           localizedStr.data = "data:text/plain," + key + "=" + value;
           defaults.setComplexValue(key, Ci.nsIPrefLocalizedString, localizedStr);
         } catch (e) {
           Cu.reportError(e);
         }
       }
     }
 
--- a/mail/base/test/unit/test_mailGlue_distribution.js
+++ b/mail/base/test/unit/test_mailGlue_distribution.js
@@ -110,15 +110,15 @@ function run_test()
   // Any prefs here that aren't found in overrides are not overriden
   //   by LocalizablePrefs-[locale] and should be tested
   s = "LocalizablePreferences";
   keys = testIni.getKeys(s);
   while (keys.hasMore()) {
     let key = keys.getNext();
     if (overrides.indexOf(key) == -1) {
       let value = eval(testIni.getString(s, key));
-      value =  value.replace("%LOCALE%", "en-US", "g");
+      value =  value.replace(/%LOCALE%/g, "en-US");
       value = "data:text/plain," + key + "=" + value;
       do_check_eq(value, Services.prefs.getCharPref(key));
     }
   }
   do_test_finished();
 }
--- a/mail/components/about-support/content/export.js
+++ b/mail/components/about-support/content/export.js
@@ -227,11 +227,11 @@ function generateTextForTextNode(node, i
   // If the text node is the first of a run of text nodes, then start
   // a new line and add the initial indentation.
   let prevNode = node.previousSibling;
   if (!prevNode || prevNode.nodeType == Node.TEXT_NODE)
     textFragmentAccumulator.push("\n" + indent);
 
   // Trim the text node's text content and add proper indentation after
   // any internal line breaks.
-  let text = node.textContent.trim().replace("\n", "\n" + indent, "g");
+  let text = node.textContent.trim().replace(/\n/g, "\n" + indent);
   textFragmentAccumulator.push(text);
 }
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -2200,17 +2200,17 @@ function ComposeStartup(recycled, aParam
     let body = gMsgCompose.compFields.body;
     if (gMsgCompose.composeHTML)
     {
       let cleanBody;
       try {
         cleanBody = decodeURI(body);
       } catch(e) { cleanBody = body; }
 
-      body = body.replace("&", "&amp;", "g");
+      body = body.replace(/&/g, "&amp;");
       gMsgCompose.compFields.body =
         "<br /><a href=\"" + body + "\">" + cleanBody + "</a><br />";
     }
     else
     {
       gMsgCompose.compFields.body = "\n<" + body + ">\n";
     }
   }