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

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

Issue 1021713003: [bindings] Let NativeValueTraits<T>::nativeValue be variadic function and merge various convers… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed the compiler error behind ASSERT flag 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698