Eat backslashes only for common control characters

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/658
This commit is contained in:
Raymond Hill 2019-07-07 06:29:14 -04:00
parent 2acaf3c433
commit 9d1913a16e
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 1 deletions

View File

@ -160,11 +160,14 @@
);
}
// https://github.com/uBlockOrigin/uBlock-issues/issues/658
// Modified to backslash-escape ONLY widely-used control characters.
function parseString(string) {
return string.replace(/\\(.)/g, function(_, ch) {
if (ch === "n") return "\n";
if (ch === "r") return "\r";
return ch;
if (ch === 't') return '\t';
return _;
});
}