Index: Source/bindings/core/dart/DartInjectedScript.cpp |
diff --git a/Source/bindings/core/dart/DartInjectedScript.cpp b/Source/bindings/core/dart/DartInjectedScript.cpp |
index 1114532c3bcb94beee9f9c13e2db9e75635de9ad..a4456555b829bd83e8b6d4050654c70991aa0616 100644 |
--- a/Source/bindings/core/dart/DartInjectedScript.cpp |
+++ b/Source/bindings/core/dart/DartInjectedScript.cpp |
@@ -40,6 +40,7 @@ |
#include "bindings/core/dart/DartUtilities.h" |
#include "bindings/core/dart/V8Converter.h" |
#include "bindings/core/v8/ScriptFunctionCall.h" |
+#include "bindings/core/v8/V8InjectedScriptHost.h" |
#include "core/inspector/InjectedScriptHost.h" |
#include "core/inspector/JSONParser.h" |
#include "platform/JSONValues.h" |
@@ -269,21 +270,25 @@ DartInjectedScript::~DartInjectedScript() |
Dart_DeletePersistentHandle(m_consoleApi); |
} |
+// Copied from V8injectedScriptManager. |
+v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeRawPtr<InjectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ return V8DOMWrapper::createWrapper(creationContext, &V8InjectedScriptHost::wrapperTypeInfo, |
+ host->toScriptWrappableBase(), isolate); |
+} |
+ |
Dart_Handle DartInjectedScript::consoleApi() |
{ |
-/* TODO(terry): Need to re-enable when we figure out how to do: |
- * |
- * Dart_Handle host = DartInjectedScriptHost::toDart(m_host); |
- */ |
-#if 0 |
if (!m_consoleApi) { |
- Dart_Handle host = DartInjectedScriptHost::toDart(m_host); |
+ V8Scope v8scope(DartDOMData::current()); |
+ v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper(m_host, m_injectedScriptManager, m_scriptState->v8ScriptState()->context()->Global(), v8::Isolate::GetCurrent()); |
+ |
+ Dart_Handle host = JsInterop::toDart(scriptHostWrapper, false); |
Dart_SetPeer(host, this); |
Dart_Handle consoleApi = DartUtilities::invokeUtilsMethod("consoleApi", 1, &host); |
ASSERT(!Dart_IsError(consoleApi)); |
m_consoleApi = Dart_NewPersistentHandle(consoleApi); |
} |
-#endif |
return m_consoleApi; |
} |
@@ -1200,6 +1205,8 @@ void DartInjectedScript::getProperty(ErrorString* errorString, const String& obj |
Node* DartInjectedScript::nodeForObjectId(const String& objectId) |
{ |
DartIsolateScope scope(m_scriptState->isolate()); |
+ DartDOMData* domData = DartDOMData::current(); |
+ V8Scope v8scope(domData); |
DartApiScope apiScope; |
DartDebuggerObject* object = lookupObject(objectId); |