Roll inspector_protocol to 35e8d2d89cb017d72cf905362672de77c978e1e

Change-Id: I81ff7fca841015ebc8cee66546ab40efb3065731
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2892842
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74575}
This commit is contained in:
Andrey Kosyakov 2021-05-12 10:08:08 -07:00 committed by V8 LUCI CQ
parent aebe382ab7
commit 1dd758e33b
7 changed files with 17 additions and 5 deletions

View File

@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0
Revision: 94298cef795ec994106bdaff002c41182911b767
Revision: 35e8d2d89cb017d72cf905362672de77c978e1e6
License: BSD
License File: LICENSE
Security Critical: no

View File

@ -4,6 +4,8 @@
#include "serializable.h"
#include <utility>
namespace v8_crdtp {
// =============================================================================
// Serializable - An object to be emitted as a sequence of bytes.
@ -18,7 +20,8 @@ std::vector<uint8_t> Serializable::Serialize() const {
namespace {
class PreSerialized : public Serializable {
public:
explicit PreSerialized(std::vector<uint8_t> bytes) : bytes_(bytes) {}
explicit PreSerialized(std::vector<uint8_t> bytes)
: bytes_(std::move(bytes)) {}
void AppendSerialized(std::vector<uint8_t>* out) const override {
out->insert(out->end(), bytes_.begin(), bytes_.end());

View File

@ -113,6 +113,8 @@ std::string Status::Message() const {
return "BINDINGS: string8 value expected";
case Error::BINDINGS_BINARY_VALUE_EXPECTED:
return "BINDINGS: binary value expected";
case Error::BINDINGS_DICTIONARY_VALUE_EXPECTED:
return "BINDINGS: dictionary value expected";
}
// Some compilers can't figure out that we can't get here.
return "INVALID ERROR CODE";

View File

@ -77,6 +77,7 @@ enum class Error {
BINDINGS_STRING_VALUE_EXPECTED = 0x34,
BINDINGS_STRING8_VALUE_EXPECTED = 0x35,
BINDINGS_BINARY_VALUE_EXPECTED = 0x36,
BINDINGS_DICTIONARY_VALUE_EXPECTED = 0x37,
};
// A status value with position that can be copied. The default status

View File

@ -96,6 +96,10 @@ bool ProtocolTypeTraits<std::unique_ptr<DictionaryValue>>::Deserialize(
std::unique_ptr<Value> res;
if (!ProtocolTypeTraits<std::unique_ptr<Value>>::Deserialize(state, &res))
return false;
if (res->type() != Value::TypeObject) {
state->RegisterError(Error::BINDINGS_DICTIONARY_VALUE_EXPECTED);
return false;
}
*value = DictionaryValue::cast(std::move(res));
return true;
}

View File

@ -11,7 +11,6 @@
#include "base/base64.h"
#include "base/json/json_reader.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@ -141,7 +140,7 @@ std::unique_ptr<base::Value> toBaseValue(Value* value, int depth) {
// static
String StringUtil::fromUTF16LE(const uint16_t* data, size_t length) {
std::string utf8;
base::UTF16ToUTF8(reinterpret_cast<const base::char16*>(data), length, &utf8);
base::UTF16ToUTF8(reinterpret_cast<const char16_t*>(data), length, &utf8);
return utf8;
}

View File

@ -27,6 +27,9 @@ def assignType(item, type, is_array=False, map_binary_to_string=False):
type = 'string'
if map_binary_to_string and type == 'binary':
type = 'string'
if 'description' in item:
item['description'] = (item['description'] +
' (Encoded as a base64 string when passed over JSON)')
if type in primitiveTypes:
item['type'] = type
else: