From 9e904470f4755eeb122be27632ff1350c35af17a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 31 Jul 2021 18:22:51 -0700 Subject: [PATCH] inspector: update inspector_protocol to 8ec18cf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply 8ec18cf: "Support STRING16 in the template when converting CBOR map keys" Refs: https://chromium.googlesource.com/deps/inspector_protocol/+/8ec18cf0885bef0b5c2a922c5dc3813cbf63e962 We're over 2 years out of date in the tools/inspector_protocol directory and I have to imagine this will come back to bite us at some point. But I also don't want to do a huge update all at once, so starting with a single commit. I might bundle commits together a bit more if this goes well. PR-URL: https://github.com/nodejs/node/pull/39614 Reviewed-By: Michaël Zasso Reviewed-By: Tobias Nießen --- tools/inspector_protocol/lib/Values_cpp.template | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/inspector_protocol/lib/Values_cpp.template b/tools/inspector_protocol/lib/Values_cpp.template index be3149d50356f2..17c69255851ee7 100644 --- a/tools/inspector_protocol/lib/Values_cpp.template +++ b/tools/inspector_protocol/lib/Values_cpp.template @@ -178,7 +178,12 @@ std::unique_ptr parseMap( key = StringUtil::fromUTF8(key_span.data(), key_span.size()); tokenizer->Next(); } else if (tokenizer->TokenTag() == cbor::CBORTokenTag::STRING16) { - return nullptr; // STRING16 not supported yet. + span key_span = tokenizer->GetString16WireRep(); + if (key_span.size() & 1) return nullptr; // UTF16 is 2 byte multiple. + key = StringUtil::fromUTF16( + reinterpret_cast(key_span.data()), + key_span.size() / 2); + tokenizer->Next(); } else { // Error::CBOR_INVALID_MAP_KEY return nullptr;