| Index: src/inspector/string-util.cc
|
| diff --git a/src/inspector/string-util.cc b/src/inspector/string-util.cc
|
| index e6b83a5d7db6f87e5a6c3dcaa2da77d19b67e7f4..e6ad5d0c5b5be8160baf9305eb4993af22f695d1 100644
|
| --- a/src/inspector/string-util.cc
|
| +++ b/src/inspector/string-util.cc
|
| @@ -111,94 +111,6 @@ std::unique_ptr<protocol::Value> parseJSON(const String16& string) {
|
|
|
| } // namespace protocol
|
|
|
| -std::unique_ptr<protocol::Value> toProtocolValue(protocol::String* errorString,
|
| - v8::Local<v8::Context> context,
|
| - v8::Local<v8::Value> value,
|
| - int maxDepth) {
|
| - if (value.IsEmpty()) {
|
| - UNREACHABLE();
|
| - return nullptr;
|
| - }
|
| -
|
| - if (!maxDepth) {
|
| - *errorString = "Object reference chain is too long";
|
| - return nullptr;
|
| - }
|
| - maxDepth--;
|
| -
|
| - if (value->IsNull() || value->IsUndefined()) return protocol::Value::null();
|
| - if (value->IsBoolean())
|
| - return protocol::FundamentalValue::create(value.As<v8::Boolean>()->Value());
|
| - if (value->IsNumber()) {
|
| - double doubleValue = value.As<v8::Number>()->Value();
|
| - int intValue = static_cast<int>(doubleValue);
|
| - if (intValue == doubleValue)
|
| - return protocol::FundamentalValue::create(intValue);
|
| - return protocol::FundamentalValue::create(doubleValue);
|
| - }
|
| - if (value->IsString())
|
| - return protocol::StringValue::create(
|
| - toProtocolString(value.As<v8::String>()));
|
| - if (value->IsArray()) {
|
| - v8::Local<v8::Array> array = value.As<v8::Array>();
|
| - std::unique_ptr<protocol::ListValue> inspectorArray =
|
| - protocol::ListValue::create();
|
| - uint32_t length = array->Length();
|
| - for (uint32_t i = 0; i < length; i++) {
|
| - v8::Local<v8::Value> value;
|
| - if (!array->Get(context, i).ToLocal(&value)) {
|
| - *errorString = "Internal error";
|
| - return nullptr;
|
| - }
|
| - std::unique_ptr<protocol::Value> element =
|
| - toProtocolValue(errorString, context, value, maxDepth);
|
| - if (!element) return nullptr;
|
| - inspectorArray->pushValue(std::move(element));
|
| - }
|
| - return std::move(inspectorArray);
|
| - }
|
| - if (value->IsObject()) {
|
| - std::unique_ptr<protocol::DictionaryValue> jsonObject =
|
| - protocol::DictionaryValue::create();
|
| - v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value);
|
| - v8::Local<v8::Array> propertyNames;
|
| - if (!object->GetPropertyNames(context).ToLocal(&propertyNames)) {
|
| - *errorString = "Internal error";
|
| - return nullptr;
|
| - }
|
| - uint32_t length = propertyNames->Length();
|
| - for (uint32_t i = 0; i < length; i++) {
|
| - v8::Local<v8::Value> name;
|
| - if (!propertyNames->Get(context, i).ToLocal(&name)) {
|
| - *errorString = "Internal error";
|
| - return nullptr;
|
| - }
|
| - // FIXME(yurys): v8::Object should support GetOwnPropertyNames
|
| - if (name->IsString()) {
|
| - v8::Maybe<bool> hasRealNamedProperty = object->HasRealNamedProperty(
|
| - context, v8::Local<v8::String>::Cast(name));
|
| - if (!hasRealNamedProperty.IsJust() || !hasRealNamedProperty.FromJust())
|
| - continue;
|
| - }
|
| - v8::Local<v8::String> propertyName;
|
| - if (!name->ToString(context).ToLocal(&propertyName)) continue;
|
| - v8::Local<v8::Value> property;
|
| - if (!object->Get(context, name).ToLocal(&property)) {
|
| - *errorString = "Internal error";
|
| - return nullptr;
|
| - }
|
| - std::unique_ptr<protocol::Value> propertyValue =
|
| - toProtocolValue(errorString, context, property, maxDepth);
|
| - if (!propertyValue) return nullptr;
|
| - jsonObject->setValue(toProtocolString(propertyName),
|
| - std::move(propertyValue));
|
| - }
|
| - return std::move(jsonObject);
|
| - }
|
| - *errorString = "Object couldn't be returned by value";
|
| - return nullptr;
|
| -}
|
| -
|
| // static
|
| std::unique_ptr<StringBuffer> StringBuffer::create(const StringView& string) {
|
| String16 owner = toString16(string);
|
|
|