Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/ui/sendReport.js

Issue 29333409: Issue 3505 - Fixed: Issue reporter calls String.replace() with deprecated flags parameter (Closed)
Patch Set: Removed capturing group Created Jan. 12, 2016, 5:58 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, "\\$&"), flags);
+ }
+
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", {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld