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

Unified Diff: scripts/astDecompile.js

Issue 29354754: Issue 4467 - Fixed hex encoding of characters in string literal and adjusted tests for newer Spider… (Closed) Base URL: https://hg.adblockplus.org/jshydra
Patch Set: Better approach Created Sept. 23, 2016, 10:57 a.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 | « autotest/test_abprewrite_module.js.expected ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/astDecompile.js
===================================================================
--- a/scripts/astDecompile.js
+++ b/scripts/astDecompile.js
@@ -382,17 +382,17 @@ function sanitize(str, q) {
if (x == '\\') return '\\\\';
if (x == '\b') return '\\b';
if (x == '\f') return '\\f';
if (x == '\n') return '\\n';
if (x == '\r') return '\\r';
if (x == '\t') return '\\t';
if (x == '\v') return '\\v';
let val = x.charCodeAt(0);
- if (x < ' ') return '\\x' + (val - val % 16) / 16 + (val % 16);
+ if (x < ' ') return '\\x' + (val < 16 ? '0' : '') + val.toString(16);
return x;
}
let result = "";
for (let char of str)
result += replace(char);
return result;
}
« no previous file with comments | « autotest/test_abprewrite_module.js.expected ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld