Commit 0fc5f626 authored by Pavel Feldman's avatar Pavel Feldman Committed by Commit Bot

DevTools: fix corner case of message formatter.

Bug: 833586
Change-Id: I87e956cadfa62a79aa549f22fe09211ee7cf25ce
Reviewed-on: https://chromium-review.googlesource.com/1015773Reviewed-by: default avatarErik Luo <luoe@chromium.org>
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551532}
parent e5c72bb7
test: testEmptyPrefixSuffix
{
0 : {
precision : -1
specifier : "c"
substitutionIndex : 0
type : "specifier"
}
1 : {
precision : -1
specifier : "s"
substitutionIndex : 1
type : "specifier"
}
}
(async function() {
TestRunner.runTests([
function testEmptyPrefixSuffix()
{
const tokens = String.tokenizeFormatString(`%c%s`, {
c: () => {},
s: () => {}
});
TestRunner.addObject(tokens);
},
]);
})();
......@@ -840,6 +840,8 @@ String.tokenizeFormatString = function(format, formatters) {
let substitutionIndex = 0;
function addStringToken(str) {
if (!str)
return;
if (tokens.length && tokens[tokens.length - 1].type === 'string')
tokens[tokens.length - 1].value += str;
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment