Index: Source/bindings/core/dart/DartInjectedScript.cpp |
diff --git a/Source/bindings/core/dart/DartInjectedScript.cpp b/Source/bindings/core/dart/DartInjectedScript.cpp |
index 1bd0cf294146a7c75b9cf3213dc9c5c5e111adc3..b5a1648b301686c52394618f69439964d25f1752 100644 |
--- a/Source/bindings/core/dart/DartInjectedScript.cpp |
+++ b/Source/bindings/core/dart/DartInjectedScript.cpp |
@@ -271,30 +271,12 @@ DartInjectedScript::~DartInjectedScript() |
Dart_DeletePersistentHandle(m_consoleApi); |
} |
-// Copied from V8injectedScriptManager. |
-v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeRawPtr<InjectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8::Handle<v8::Context> creationContext, v8::Isolate* isolate) |
-{ |
- // TODO(jacobr): is this correct. |
- v8::Local<v8::FunctionTemplate> wrapperTemplate = host->wrapperTemplate(isolate); |
- ASSERT(!wrapperTemplate.IsEmpty()); |
- if (wrapperTemplate.IsEmpty()) { |
- // Hopefully this isn't needed. |
- wrapperTemplate = V8InjectedScriptHost::createWrapperTemplate(isolate); |
- host->setWrapperTemplate(wrapperTemplate, isolate); |
- } |
- |
- return V8InjectedScriptHost::wrap(wrapperTemplate, creationContext, host); |
-} |
- |
Dart_Handle DartInjectedScript::consoleApi() |
{ |
if (!m_consoleApi) { |
V8Scope v8scope(DartDOMData::current()); |
- v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper(m_host, m_injectedScriptManager, m_scriptState->v8ScriptState()->context(), v8::Isolate::GetCurrent()); |
- |
- Dart_Handle host = JsInterop::toDart(scriptHostWrapper, false); |
- Dart_SetPeer(host, this); |
- Dart_Handle consoleApi = DartUtilities::invokeUtilsMethod("consoleApi", 1, &host); |
+ Dart_Handle injecteScriptV8 = JsInterop::toDart(m_injectedScriptManager->injectedScriptFor(m_scriptState->v8ScriptState()).injectedScriptObject().v8Value(), false); |
+ Dart_Handle consoleApi = DartUtilities::invokeUtilsMethod("consoleApi", 1, &injecteScriptV8); |
ASSERT(!Dart_IsError(consoleApi)); |
m_consoleApi = Dart_NewPersistentHandle(consoleApi); |
} |
@@ -326,9 +308,9 @@ Dart_Handle DartInjectedScript::evaluateHelper(Dart_Handle target, const String& |
v8::Handle<v8::Value> v8Value = value.v8Value(); |
if (v8Value.IsEmpty()) |
break; |
- Dart_Handle dartValue = DartHandleProxy::unwrapValue(v8Value); |
+ Dart_Handle dartValue = JsInterop::toDart(v8Value, true); |
ASSERT(!Dart_IsError(dartValue)); |
- if (Dart_IsNull(dartValue)) |
+ if (Dart_IsError(dartValue) || Dart_IsNull(dartValue)) |
continue; |
locals.append(DartUtilities::stringToDartString(String::format("$%d", i))); |
locals.append(dartValue); |