Skip to content

Commit aa98452

Browse files
committed
deps: cherry-pick 2987946 from upstream V8
Original commit message: 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 <jarin@chromium.org> Commit-Queue: Bret Sepulveda <bsep@chromium.org> Cr-Commit-Position: refs/heads/master@{#55401} Refs: v8/v8@2987946
1 parent 20430ae commit aa98452

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
# Reset this number to 0 on major V8 upgrades.
3535
# Increment by one for each non-official patch applied to deps/v8.
36-
'v8_embedder_string': '-node.44',
36+
'v8_embedder_string': '-node.45',
3737

3838
# Enable disassembler for `--print-code` v8 options
3939
'v8_enable_disassembler': 1,

deps/v8/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)