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

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: 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
Index: Source/core/inspector/InjectedScriptBase.cpp
diff --git a/Source/core/inspector/InjectedScriptBase.cpp b/Source/core/inspector/InjectedScriptBase.cpp
index 4e95872e3e94e5c50834c398ebc33dac98c00a4b..816b14d41623317b43304421e7f6e185e8d68464 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,14 @@ using blink::TypeBuilder::Runtime::RemoteObject;
namespace blink {
+PassRefPtr<JSONValue> toJSONValue(ScriptState* scriptState, const ScriptValue& value)
haraken 2015/03/24 15:23:10 BTW, what's a relationship between scriptState and
+{
+ ASSERT(scriptState->contextIsValid());
+ ScriptState::Scope scope(scriptState);
vivekg 2015/03/24 05:21:49 When I remove above scope, we get this crash log:
+ NonThrowableExceptionState exceptionState;
+ return ScriptValue::to<JSONValuePtr>(scriptState->isolate(), value, exceptionState);
+}
+
static PassRefPtr<TypeBuilder::Debugger::ExceptionDetails> toExceptionDetails(PassRefPtr<JSONObject> object)
{
String text;
@@ -166,7 +175,7 @@ void InjectedScriptBase::makeCall(ScriptFunctionCall& function, RefPtr<JSONValue
ASSERT(!hadException);
if (!hadException) {
- *result = resultValue.toJSONValue(m_injectedScriptObject.scriptState());
+ *result = toJSONValue(m_injectedScriptObject.scriptState(), resultValue);
if (!*result)
*result = JSONString::create(String::format("Object has too long reference chain(must not be longer than %d)", JSONValue::maxDepth));
} else {

Powered by Google App Engine
This is Rietveld 408576698