Skip to content

Commit 2987946

Browse files
bsep-chromiumCommit Bot
authored andcommitted
Stop manual unescaping of script source data when preprocessing logs.
It appears that the fields are already being unescaped elsewhere, perhaps by the JSON writer. So if we unescape when adding the source filename and contents, unescaping will happen again later and plain backslashes will be interpreted as escape codes. Bug: v8:6240 Change-Id: Ic66b9017ae685d6dd12944ee8d254991e26fbd32 Reviewed-on: https://chromium-review.googlesource.com/1186625 Reviewed-by: Jaroslav Sevcik <[email protected]> Commit-Queue: Bret Sepulveda <[email protected]> Cr-Commit-Position: refs/heads/master@{#55401}
1 parent f1aef71 commit 2987946

1 file changed

Lines changed: 2 additions & 25 deletions

File tree

tools/profile.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,33 +1002,10 @@ JsonProfile.prototype.addSourcePositions = function(
10021002
};
10031003
};
10041004

1005-
function unescapeString(s) {
1006-
s = s.split("\\");
1007-
for (var i = 1; i < s.length; i++) {
1008-
if (s[i] === "") {
1009-
// Double backslash.
1010-
s[i] = "\\";
1011-
} else if (i > 0 && s[i].startsWith("x")) {
1012-
// Escaped Ascii character.
1013-
s[i] = String.fromCharCode(parseInt(s[i].substring(1, 3), 16)) +
1014-
s[i].substring(3);
1015-
} else if (i > 0 && s[i].startsWith("u")) {
1016-
// Escaped unicode character.
1017-
s[i] = String.fromCharCode(parseInt(s[i].substring(1, 5), 16)) +
1018-
s[i].substring(5);
1019-
} else {
1020-
if (i > 0 && s[i - 1] !== "\\") {
1021-
printErr("Malformed source string");
1022-
}
1023-
}
1024-
}
1025-
return s.join("");
1026-
}
1027-
10281005
JsonProfile.prototype.addScriptSource = function(script, url, source) {
10291006
this.scripts_[script] = {
1030-
name : unescapeString(url),
1031-
source : unescapeString(source)
1007+
name : url,
1008+
source : source
10321009
};
10331010
};
10341011

0 commit comments

Comments
 (0)