mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1108382 - Part 11: Do not use non-standard flag argument of String.prototype.replace in services/. r=rnewman
This commit is contained in:
parent
b3402c2b87
commit
1a2f7387ed
@ -83,10 +83,10 @@ this.CommonUtils = {
|
||||
* to true for historical reasons.
|
||||
*/
|
||||
encodeBase64URL: function encodeBase64URL(bytes, pad=true) {
|
||||
let s = btoa(bytes).replace("+", "-", "g").replace("/", "_", "g");
|
||||
let s = btoa(bytes).replace(/\+/g, "-").replace(/\//g, "_");
|
||||
|
||||
if (!pad) {
|
||||
s = s.replace("=", "", "g");
|
||||
return s.replace(/=+$/, "");
|
||||
}
|
||||
|
||||
return s;
|
||||
|
@ -545,7 +545,7 @@ AbstractHealthReporter.prototype = Object.freeze({
|
||||
// HealthReporter instances, we need to encode a unique identifier in
|
||||
// the timer ID.
|
||||
try {
|
||||
let timerName = this._branch.replace(".", "-", "g") + "lastDailyCollection";
|
||||
let timerName = this._branch.replace(/\./g, "-") + "lastDailyCollection";
|
||||
let tm = Cc["@mozilla.org/updates/timer-manager;1"]
|
||||
.getService(Ci.nsIUpdateTimerManager);
|
||||
tm.registerTimer(timerName, this.collectMeasurements.bind(this),
|
||||
@ -762,13 +762,18 @@ AbstractHealthReporter.prototype = Object.freeze({
|
||||
// where UAppData is underneath the profile directory (or vice-versa) so we
|
||||
// don't substitute incomplete strings.
|
||||
|
||||
// Return a /g regex that matches the provided string exactly.
|
||||
function regexify(s) {
|
||||
return new RegExp(s.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), "g");
|
||||
}
|
||||
|
||||
function replace(uri, path, thing) {
|
||||
// Try is because .spec can throw on invalid URI.
|
||||
try {
|
||||
recordMessage = recordMessage.replace(uri.spec, '<' + thing + 'URI>', 'g');
|
||||
recordMessage = recordMessage.replace(regexify(uri.spec), "<" + thing + "URI>");
|
||||
} catch (ex) { }
|
||||
|
||||
recordMessage = recordMessage.replace(path, '<' + thing + 'Path>', 'g');
|
||||
recordMessage = recordMessage.replace(regexify(path), "<" + thing + "Path>");
|
||||
}
|
||||
|
||||
if (appData.path.contains(profile.path)) {
|
||||
|
@ -253,14 +253,14 @@ this.Utils = {
|
||||
*/
|
||||
base32ToFriendly: function base32ToFriendly(input) {
|
||||
return input.toLowerCase()
|
||||
.replace("l", '8', "g")
|
||||
.replace("o", '9', "g");
|
||||
.replace(/l/g, '8')
|
||||
.replace(/o/g, '9');
|
||||
},
|
||||
|
||||
base32FromFriendly: function base32FromFriendly(input) {
|
||||
return input.toUpperCase()
|
||||
.replace("8", 'L', "g")
|
||||
.replace("9", 'O', "g");
|
||||
.replace(/8/g, 'L')
|
||||
.replace(/9/g, 'O');
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user