Index: chrome/content/ui/sendReport.js |
=================================================================== |
--- a/chrome/content/ui/sendReport.js |
+++ b/chrome/content/ui/sendReport.js |
@@ -612,30 +612,35 @@ var errorsDataSource = |
{ |
let file = FileUtils.getDir(pathID, [], false); |
censored[file.path.replace(/[\\\/]+$/, '')] = placeholder; |
let uri = Utils.ioService.newFileURI(file); |
censored[uri.spec.replace(/[\\\/]+$/, '')] = placeholder; |
} catch(e) {} |
} |
+ function str2regexp(str, flags) |
+ { |
+ return new RegExp(str.replace(/(\W)/g, "\\$1"), flags); |
Thomas Greiner
2016/01/12 17:53:39
You can avoid the creation of the capturing group
Wladimir Palant
2016/01/12 17:59:12
Done.
|
+ } |
+ |
let errors = reportElement("errors"); |
for (let i = 0; i < messages.length; i++) |
{ |
let message = messages[i]; |
let text = message.errorMessage; |
for (let path in censored) |
- text = text.replace(path, censored[path], "gi"); |
+ text = text.replace(str2regexp(path, "gi"), censored[path]); |
if (text.length > 256) |
text = text.substr(0, 256) + "..."; |
let file = message.sourceName; |
for (let path in censored) |
- file = file.replace(path, censored[path], "gi"); |
+ file = file.replace(str2regexp(path, "gi"), censored[path]); |
if (file.length > 256) |
file = file.substr(0, 256) + "..."; |
let sourceLine = message.sourceLine; |
if (sourceLine.length > 256) |
sourceLine = sourceLine.substr(0, 256) + "..."; |
appendElement(errors, "error", { |