Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Unified Diff: src/inspector/InjectedScript.cpp

Issue 2345263003: [inspector] provide more usefull error message for non serializable value (Closed)
Patch Set: addressed comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/inspector/StringUtil.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/InjectedScript.cpp
diff --git a/src/inspector/InjectedScript.cpp b/src/inspector/InjectedScript.cpp
index ebd26ece673bb1c0dffe526be29082e9b600b650..5b1b2b1b6d34316b8999434bd90183531aefb7d6 100644
--- a/src/inspector/InjectedScript.cpp
+++ b/src/inspector/InjectedScript.cpp
@@ -144,10 +144,10 @@ void InjectedScript::getProperties(
*properties = Array<PropertyDescriptor>::create();
return;
}
-
+ if (hasInternalError(errorString, resultValue.IsEmpty())) return;
std::unique_ptr<protocol::Value> protocolValue =
- toProtocolValue(context, resultValue);
- if (hasInternalError(errorString, !protocolValue)) return;
+ toProtocolValue(errorString, context, resultValue);
+ if (!protocolValue) return;
protocol::ErrorSupport errors(errorString);
std::unique_ptr<Array<PropertyDescriptor>> result =
Array<PropertyDescriptor>::parse(protocolValue.get(), &errors);
@@ -178,10 +178,12 @@ std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(
.ToLocal(&wrappedObject))
return nullptr;
protocol::ErrorSupport errors;
+ std::unique_ptr<protocol::Value> protocolValue =
+ toProtocolValue(errorString, context, wrappedObject);
+ if (!protocolValue) return nullptr;
std::unique_ptr<protocol::Runtime::RemoteObject> remoteObject =
- protocol::Runtime::RemoteObject::parse(
- toProtocolValue(context, wrappedObject).get(), &errors);
- if (!remoteObject) *errorString = "Object has too long reference chain";
+ protocol::Runtime::RemoteObject::parse(protocolValue.get(), &errors);
+ if (!remoteObject) *errorString = errors.errors();
return remoteObject;
}
@@ -272,10 +274,13 @@ std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(
function.appendArgument(columns);
bool hadException = false;
v8::Local<v8::Value> r = function.call(hadException);
- if (hadException) return nullptr;
+ if (hadException || r.IsEmpty()) return nullptr;
+ protocol::ErrorString errorString;
+ std::unique_ptr<protocol::Value> protocolValue =
+ toProtocolValue(&errorString, context, r);
+ if (!protocolValue) return nullptr;
protocol::ErrorSupport errors;
- return protocol::Runtime::RemoteObject::parse(
- toProtocolValue(context, r).get(), &errors);
+ return protocol::Runtime::RemoteObject::parse(protocolValue.get(), &errors);
}
bool InjectedScript::findObject(ErrorString* errorString,
« no previous file with comments | « no previous file | src/inspector/StringUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698