[Pkg-mozext-commits] [firebug] 01/17: Remove usages of non-standard method "".replace(_, _, flags)
David Prévot
taffit at moszumanska.debian.org
Fri Oct 30 19:16:18 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firebug.
commit 5468d96637099a755191740df8a80f3b1b109d6e
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date: Wed Aug 5 11:51:36 2015 +0200
Remove usages of non-standard method "".replace(_, _, flags)
About to be removed in https://bugzilla.mozilla.org/show_bug.cgi?id=1108382.
---
extension/content/firebug/lib/domplate.js | 2 +-
extension/content/firebug/lib/string.js | 8 ++++----
extension/content/firebug/lib/url.js | 4 +---
extension/modules/locale.js | 6 +++---
extension/modules/require-debug.js | 5 ++---
5 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/extension/content/firebug/lib/domplate.js b/extension/content/firebug/lib/domplate.js
index 4464481..a924303 100644
--- a/extension/content/firebug/lib/domplate.js
+++ b/extension/content/firebug/lib/domplate.js
@@ -868,7 +868,7 @@ function parseParts(str)
if (!index)
{
// Double quotes in strings need to be escaped (see issue 6710)
- return str.replace("\\", "\\\\", "g").replace('"', '\\"', "g");
+ return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
}
// If we have data after our last matched index we append it here as the final step
diff --git a/extension/content/firebug/lib/string.js b/extension/content/firebug/lib/string.js
index b890919..eb520d3 100644
--- a/extension/content/firebug/lib/string.js
+++ b/extension/content/firebug/lib/string.js
@@ -406,8 +406,8 @@ Str.stripNewLines = function(value)
Str.escapeSingleQuoteJS = function(value)
{
- return value.replace("\\", "\\\\", "g").replace(/\r/gm, "\\r")
- .replace(/\n/gm, "\\n").replace("'", "\\'", "g");
+ return value.replace(/\\/g, "\\\\").replace(/\r/gm, "\\r")
+ .replace(/\n/gm, "\\n").replace(/'/g, "\\'");
};
Str.reverseString = function(value)
@@ -417,8 +417,8 @@ Str.reverseString = function(value)
Str.escapeJS = function(value)
{
- return value.replace("\\", "\\\\", "g").replace(/\r/gm, "\\r")
- .replace(/\n/gm, "\\n").replace('"', '\\"', "g");
+ return value.replace(/\\/g, "\\\\").replace(/\r/gm, "\\r")
+ .replace(/\n/gm, "\\n").replace(/"/g, '\\"');
};
Str.cropString = function(text, limit, alternativeText)
diff --git a/extension/content/firebug/lib/url.js b/extension/content/firebug/lib/url.js
index 0fbb6ee..00e7295 100644
--- a/extension/content/firebug/lib/url.js
+++ b/extension/content/firebug/lib/url.js
@@ -343,9 +343,7 @@ Url.isAbsoluteUrl = function(url)
Url.absoluteURL = function(url, baseURL)
{
- // Replace "/./" with "/" using regular expressions (don't use string since /./
- // can be treated as regular expressoin too, see 3551).
- return Url.absoluteURLWithDots(url, baseURL).replace(/\/\.\//, "/", "g");
+ return Url.absoluteURLWithDots(url, baseURL).replace(/\/\.\//g, "/");
};
Url.absoluteURLWithDots = function(url, baseURL)
diff --git a/extension/modules/locale.js b/extension/modules/locale.js
index 9734714..2b44586 100644
--- a/extension/modules/locale.js
+++ b/extension/modules/locale.js
@@ -65,7 +65,7 @@ Locale.$STR = function(name, bundle)
if (!name)
return "";
- var strKey = name.replace(" ", "_", "g");
+ var strKey = name.replace(/ /g, "_");
if (!PrefLoader.getPref("useDefaultLocale"))
{
@@ -100,14 +100,14 @@ Locale.$STR = function(name, bundle)
var index = name.lastIndexOf(".");
if (index > 0 && name.charAt(index-1) != "\\")
name = name.substr(index + 1);
- name = name.replace("_", " ", "g");
+ name = name.replace(/_/g, " ");
return name;
};
Locale.$STRF = function(name, args, bundle)
{
- var strKey = name.replace(" ", "_", "g");
+ var strKey = name.replace(/ /g, "_");
if (!PrefLoader.getPref("useDefaultLocale"))
{
diff --git a/extension/modules/require-debug.js b/extension/modules/require-debug.js
index eecaab7..1074614 100644
--- a/extension/modules/require-debug.js
+++ b/extension/modules/require-debug.js
@@ -67,8 +67,7 @@ require.execCbOFF = function (name)
(typeof value == "function"/* || typeof value == "object"*/))
{
var funcName = name + "_" + prop;
- funcName = funcName.replace("/", "_", "g");
- funcName = funcName.replace("-", "_", "g");
+ funcName = funcName.replace(/[\/\-]/g, "_");
var namedFunction = eval("(function(){ return function " + funcName +
"(){return true;} })()");
value.displayName = namedFunction;
@@ -183,4 +182,4 @@ require.onError = function(exc)
{
require.onDebug.apply(require, arguments);
throw exc;
-};
\ No newline at end of file
+};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list