Commit e350e84a authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

[DevTools] Roll inspector_protocol (V8).

New Revision: d48ba2079ffcdaf2d99f4153127aab6dbe32a954

Change-Id: Idde7388b4f92492609c1714fc003ec3234c8bf82
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1686451
Auto-Submit: Johannes Henkel <johannes@chromium.org>
Reviewed-by: 's avatarAlexei Filippov <alph@chromium.org>
Commit-Queue: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62503}
parent 39eab44d
...@@ -15,8 +15,8 @@ https://cs.chromium.org/chromium/src/v8/third_party/inspector_protocol/ ...@@ -15,8 +15,8 @@ https://cs.chromium.org/chromium/src/v8/third_party/inspector_protocol/
See also [Contributing to Chrome Devtools Protocol](https://docs.google.com/document/d/1c-COD2kaK__5iMM5SEx-PzNA7HFmgttcYfOHHX0HaOM/edit). See also [Contributing to Chrome Devtools Protocol](https://docs.google.com/document/d/1c-COD2kaK__5iMM5SEx-PzNA7HFmgttcYfOHHX0HaOM/edit).
We're working on enabling standalone builds for parts of this package for We're working on enabling standalone builds for parts of this package for
testing and development, please feel free to ignore this for now. testing and development.
But, if you're familiar with If you're familiar with
[Chromium's development process](https://www.chromium.org/developers/contributing-code) [Chromium's development process](https://www.chromium.org/developers/contributing-code)
and have the depot_tools installed, you may use these commands and have the depot_tools installed, you may use these commands
to fetch the package (and dependencies) and build and run the tests: to fetch the package (and dependencies) and build and run the tests:
...@@ -24,8 +24,9 @@ to fetch the package (and dependencies) and build and run the tests: ...@@ -24,8 +24,9 @@ to fetch the package (and dependencies) and build and run the tests:
fetch inspector_protocol fetch inspector_protocol
cd src cd src
gn gen out/Release gn gen out/Release
ninja -C out/Release json_parser_test ninja -C out/Release encoding_test bindings_test
out/Release/json_parser_test out/Release/encoding_test
out/Release/bindings_test
You'll probably also need to install g++, since Clang uses this to find the You'll probably also need to install g++, since Clang uses this to find the
standard C++ headers. E.g., standard C++ headers. E.g.,
......
...@@ -2,7 +2,7 @@ Name: inspector protocol ...@@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/ URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0 Version: 0
Revision: aec57d43b6a2c41c37fb0a2507108e89a9342177 Revision: 373efb7fe33a7ae84038868ed08b9f1bd328b55d
License: BSD License: BSD
License File: LICENSE License File: LICENSE
Security Critical: no Security Critical: no
......
...@@ -15,7 +15,9 @@ import pdl ...@@ -15,7 +15,9 @@ import pdl
def main(argv): def main(argv):
if len(argv) < 1: if len(argv) < 1:
sys.stderr.write("Usage: %s <protocol-1> [<protocol-2> [, <protocol-3>...]] <output-file>\n" % sys.argv[0]) sys.stderr.write(
"Usage: %s <protocol-1> [<protocol-2> [, <protocol-3>...]] "
"<output-file>\n" % sys.argv[0])
return 1 return 1
domains = [] domains = []
...@@ -31,7 +33,8 @@ def main(argv): ...@@ -31,7 +33,8 @@ def main(argv):
version = parsed_json["version"] version = parsed_json["version"]
output_file = open(argv[-1], "w") output_file = open(argv[-1], "w")
json.dump({"version": version, "domains": domains}, output_file, indent=4, sort_keys=False, separators=(',', ': ')) json.dump({"version": version, "domains": domains}, output_file,
indent=4, sort_keys=False, separators=(',', ': '))
output_file.close() output_file.close()
......
...@@ -1370,7 +1370,7 @@ class JSONEncoder : public StreamingParserHandler { ...@@ -1370,7 +1370,7 @@ class JSONEncoder : public StreamingParserHandler {
// If we have enough bytes in our input, decode the remaining ones // If we have enough bytes in our input, decode the remaining ones
// belonging to this Unicode character into |codepoint|. // belonging to this Unicode character into |codepoint|.
if (ii + num_bytes_left > chars.size()) if (ii + num_bytes_left >= chars.size())
continue; continue;
while (num_bytes_left > 0) { while (num_bytes_left > 0) {
c = chars[++ii]; c = chars[++ii];
......
...@@ -1366,6 +1366,32 @@ TEST(JsonEncoder, OverlongEncodings) { ...@@ -1366,6 +1366,32 @@ TEST(JsonEncoder, OverlongEncodings) {
EXPECT_EQ("\"\"", out); // Empty string means that 0x7f was rejected (good). EXPECT_EQ("\"\"", out); // Empty string means that 0x7f was rejected (good).
} }
TEST(JsonEncoder, IncompleteUtf8Sequence) {
std::string out;
Status status;
std::unique_ptr<StreamingParserHandler> writer =
NewJSONEncoder(&GetTestPlatform(), &out, &status);
writer->HandleArrayBegin(); // This emits [, which starts an array.
{ // 🌎 takes four bytes to encode in UTF-8. We test with the first three;
// This means we're trying to emit a string that consists solely of an
// incomplete UTF-8 sequence. So the string in the JSON output is emtpy.
std::string world_utf8 = "🌎";
ASSERT_EQ(4u, world_utf8.size());
std::vector<uint8_t> chars(world_utf8.begin(), world_utf8.begin() + 3);
writer->HandleString8(SpanFrom(chars));
EXPECT_EQ("[\"\"", out); // Incomplete sequence rejected: empty string.
}
{ // This time, the incomplete sequence is at the end of the string.
std::string msg = "Hello, \xF0\x9F\x8C";
std::vector<uint8_t> chars(msg.begin(), msg.end());
writer->HandleString8(SpanFrom(chars));
EXPECT_EQ("[\"\",\"Hello, \"", out); // Incomplete sequence dropped at end.
}
}
TEST(JsonStdStringWriterTest, HelloWorld) { TEST(JsonStdStringWriterTest, HelloWorld) {
std::string out; std::string out;
Status status; Status status;
......
...@@ -12,7 +12,8 @@ import sys ...@@ -12,7 +12,8 @@ import sys
description = '' description = ''
primitiveTypes = ['integer', 'number', 'boolean', 'string', 'object', 'any', 'array', 'binary'] primitiveTypes = ['integer', 'number', 'boolean', 'string', 'object',
'any', 'array', 'binary']
def assignType(item, type, is_array=False, map_binary_to_string=False): def assignType(item, type, is_array=False, map_binary_to_string=False):
...@@ -74,9 +75,11 @@ def parse(data, file_name, map_binary_to_string=False): ...@@ -74,9 +75,11 @@ def parse(data, file_name, map_binary_to_string=False):
if len(trimLine) == 0: if len(trimLine) == 0:
continue continue
match = re.compile(r'^(experimental )?(deprecated )?domain (.*)').match(line) match = re.compile(
r'^(experimental )?(deprecated )?domain (.*)').match(line)
if match: if match:
domain = createItem({'domain' : match.group(3)}, match.group(1), match.group(2)) domain = createItem({'domain' : match.group(3)}, match.group(1),
match.group(2))
protocol['domains'].append(domain) protocol['domains'].append(domain)
continue continue
...@@ -87,7 +90,8 @@ def parse(data, file_name, map_binary_to_string=False): ...@@ -87,7 +90,8 @@ def parse(data, file_name, map_binary_to_string=False):
domain['dependencies'].append(match.group(1)) domain['dependencies'].append(match.group(1))
continue continue
match = re.compile(r'^ (experimental )?(deprecated )?type (.*) extends (array of )?([^\s]+)').match(line) match = re.compile(r'^ (experimental )?(deprecated )?type (.*) '
r'extends (array of )?([^\s]+)').match(line)
if match: if match:
if 'types' not in domain: if 'types' not in domain:
domain['types'] = [] domain['types'] = []
...@@ -96,7 +100,8 @@ def parse(data, file_name, map_binary_to_string=False): ...@@ -96,7 +100,8 @@ def parse(data, file_name, map_binary_to_string=False):
domain['types'].append(item) domain['types'].append(item)
continue continue
match = re.compile(r'^ (experimental )?(deprecated )?(command|event) (.*)').match(line) match = re.compile(
r'^ (experimental )?(deprecated )?(command|event) (.*)').match(line)
if match: if match:
list = [] list = []
if match.group(3) == 'command': if match.group(3) == 'command':
...@@ -114,7 +119,9 @@ def parse(data, file_name, map_binary_to_string=False): ...@@ -114,7 +119,9 @@ def parse(data, file_name, map_binary_to_string=False):
list.append(item) list.append(item)
continue continue
match = re.compile(r'^ (experimental )?(deprecated )?(optional )?(array of )?([^\s]+) ([^\s]+)').match(line) match = re.compile(
r'^ (experimental )?(deprecated )?(optional )?'
r'(array of )?([^\s]+) ([^\s]+)').match(line)
if match: if match:
param = createItem({}, match.group(1), match.group(2), match.group(6)) param = createItem({}, match.group(1), match.group(2), match.group(6))
if match.group(3): if match.group(3):
......
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