Index: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp |
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp |
index 53f471674c78bdea0d03b675e2ceaa13dbb4aabe..aa50b37873b777d6f412b5881b3ba96791af1b4b 100644 |
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp |
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp |
@@ -35,6 +35,7 @@ |
#include "platform/v8_inspector/DebuggerScript.h" |
#include "platform/v8_inspector/InspectedContext.h" |
#include "platform/v8_inspector/ScriptBreakpoint.h" |
+#include "platform/v8_inspector/V8Console.h" |
#include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
#include "platform/v8_inspector/V8InspectorSessionImpl.h" |
#include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
@@ -766,6 +767,8 @@ void V8DebuggerImpl::contextCreated(const V8ContextInfo& info) |
v8::Context::Scope contextScope(info.context); |
info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), toV8String(m_isolate, debugData)); |
+ installConsole(info.context); |
+ |
if (!m_contexts.contains(info.contextGroupId)) |
m_contexts.set(info.contextGroupId, adoptPtr(new ContextByIdMap())); |
ASSERT(!m_contexts.get(info.contextGroupId)->contains(contextId)); |
@@ -778,6 +781,13 @@ void V8DebuggerImpl::contextCreated(const V8ContextInfo& info) |
session->runtimeAgentImpl()->reportExecutionContextCreated(inspectedContext); |
} |
+bool V8DebuggerImpl::installConsole(v8::Local<v8::Context> context) |
+{ |
+ v8::Isolate* isolate = context->GetIsolate(); |
+ v8::Local<v8::Object> global = context->Global(); |
+ return global->Set(context, toV8StringInternalized(isolate, "console"), V8Console::create(context, m_client)).FromMaybe(false); |
+} |
+ |
void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context) |
{ |
int contextId = V8Debugger::contextId(context); |