1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

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

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) { function parseString(string) {
return string.replace(/\\(.)/g, function(_, ch) { return string.replace(/\\(.)/g, function(_, ch) {
if (ch === "n") return "\n"; if (ch === "n") return "\n";
if (ch === "r") return "\r"; if (ch === "r") return "\r";
return ch; if (ch === 't') return '\t';
return _;
}); });
} }