Chromium Code Reviews| Index: Source/core/inspector/InjectedScript.cpp |
| diff --git a/Source/core/inspector/InjectedScript.cpp b/Source/core/inspector/InjectedScript.cpp |
| index 8916b46ba5eb2b7cae9796a436ae299c4067ef7e..dec7d0412c4af75c07a4f78390f2c9d15e4db67f 100644 |
| --- a/Source/core/inspector/InjectedScript.cpp |
| +++ b/Source/core/inspector/InjectedScript.cpp |
| @@ -34,6 +34,7 @@ |
| #include "core/inspector/InjectedScript.h" |
| #include "bindings/core/v8/ScriptFunctionCall.h" |
| +#include "bindings/core/v8/V8Binding.h" |
| #include "core/inspector/InjectedScriptHost.h" |
| #include "core/inspector/JSONParser.h" |
| #include "platform/JSONValues.h" |
| @@ -280,7 +281,10 @@ PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& |
| bool hadException = false; |
| ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadException); |
| ASSERT(!hadException); |
| - RefPtr<JSONValue> result = callFramesValue.toJSONValue(scriptState()); |
| + ScriptState* state = scriptState(); |
| + ScriptState::Scope scope(state); |
|
haraken
2015/03/19 23:26:13
You sometimes enter a ScriptState::Scope but somet
|
| + NonThrowableExceptionState exceptionState; |
|
bashi
2015/03/19 23:53:41
It would be better not to use NonThrowableExceptio
|
| + RefPtr<JSONValue> result = ScriptValue::to<JSONValuePtr>(state->isolate(), callFramesValue, exceptionState); |
| if (result && result->type() == JSONValue::TypeArray) |
| return Array<CallFrame>::runtimeCast(result); |
| return Array<CallFrame>::create(); |
| @@ -298,7 +302,10 @@ PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const |
| ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); |
| if (hadException) |
| return nullptr; |
| - RefPtr<JSONObject> rawResult = r.toJSONValue(scriptState())->asObject(); |
| + ScriptState* state = scriptState(); |
| + ScriptState::Scope scope(state); |
| + NonThrowableExceptionState exceptionState; |
| + RefPtr<JSONObject> rawResult = ScriptValue::to<JSONValuePtr>(state->isolate(), r, exceptionState)->asObject(); |
| return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); |
| } |
| @@ -316,7 +323,10 @@ PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapTable(const S |
| ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException); |
| if (hadException) |
| return nullptr; |
| - RefPtr<JSONObject> rawResult = r.toJSONValue(scriptState())->asObject(); |
| + ScriptState* state = scriptState(); |
| + ScriptState::Scope scope(state); |
| + NonThrowableExceptionState exceptionState; |
| + RefPtr<JSONObject> rawResult = ScriptValue::to<JSONValuePtr>(state->isolate(), r, exceptionState)->asObject(); |
| return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); |
| } |