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 { |