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

Unified Diff: Source/core/inspector/InjectedScriptBase.cpp

Issue 1020233002: [bindings] [devtools] Migrate the usage of ScriptValue.toJSONValue() to ScriptValue::to<JSONValuePt… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 5 years, 9 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 | « Source/core/inspector/InjectedScriptBase.h ('k') | Source/modules/indexeddb/InspectorIndexedDBAgent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InjectedScriptBase.cpp
diff --git a/Source/core/inspector/InjectedScriptBase.cpp b/Source/core/inspector/InjectedScriptBase.cpp
index 4e95872e3e94e5c50834c398ebc33dac98c00a4b..6df147e3d3ee8b137e3a4000fccf6c5f41147c77 100644
--- a/Source/core/inspector/InjectedScriptBase.cpp
+++ b/Source/core/inspector/InjectedScriptBase.cpp
@@ -34,6 +34,7 @@
#include "core/inspector/InjectedScriptBase.h"
#include "bindings/core/v8/ScriptFunctionCall.h"
+#include "bindings/core/v8/V8Binding.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "platform/JSONValues.h"
@@ -44,6 +45,15 @@ using blink::TypeBuilder::Runtime::RemoteObject;
namespace blink {
+PassRefPtr<JSONValue> toJSONValue(const ScriptValue& value)
+{
+ ScriptState* scriptState = value.scriptState();
+ ASSERT(scriptState->contextIsValid());
+ ScriptState::Scope scope(scriptState);
+ NonThrowableExceptionState exceptionState;
+ return ScriptValue::to<JSONValuePtr>(scriptState->isolate(), value, exceptionState);
+}
+
static PassRefPtr<TypeBuilder::Debugger::ExceptionDetails> toExceptionDetails(PassRefPtr<JSONObject> object)
{
String text;
@@ -166,7 +176,7 @@ void InjectedScriptBase::makeCall(ScriptFunctionCall& function, RefPtr<JSONValue
ASSERT(!hadException);
if (!hadException) {
- *result = resultValue.toJSONValue(m_injectedScriptObject.scriptState());
+ *result = toJSONValue(resultValue);
if (!*result)
*result = JSONString::create(String::format("Object has too long reference chain(must not be longer than %d)", JSONValue::maxDepth));
} else {
« no previous file with comments | « Source/core/inspector/InjectedScriptBase.h ('k') | Source/modules/indexeddb/InspectorIndexedDBAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698