Chromium Code Reviews| Index: src/inspector/inspected-context.cc |
| diff --git a/src/inspector/inspected-context.cc b/src/inspector/inspected-context.cc |
| index 0509683789d6762e9ff865d49f02eaf235238958..30d756761d240cc52c2cb9946c14987fcaa0362b 100644 |
| --- a/src/inspector/inspected-context.cc |
| +++ b/src/inspector/inspected-context.cc |
| @@ -27,17 +27,15 @@ InspectedContext::InspectedContext(V8InspectorImpl* inspector, |
| v8::Isolate* isolate = m_inspector->isolate(); |
| info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), |
| v8::Int32::New(isolate, contextId)); |
| + if (!info.hasMemoryOnConsole) return; |
| v8::Local<v8::Object> global = info.context->Global(); |
| - v8::Local<v8::Object> console = |
| - m_inspector->console()->createConsole(info.context); |
| - if (info.hasMemoryOnConsole) { |
| - m_inspector->console()->installMemoryGetter(info.context, console); |
| - } |
| - if (!global |
| - ->Set(info.context, toV8StringInternalized(isolate, "console"), |
| - console) |
| - .FromMaybe(false)) { |
| - return; |
| + v8::Local<v8::Value> console; |
| + if (global->Get(info.context, toV8String(m_inspector->isolate(), "console")) |
| + .ToLocal(&console) && |
| + console->IsObject()) { |
| + v8::Context::Scope contextScope(info.context); |
|
dgozman
2017/04/03 20:19:42
Can we remove this scope?
kozy
2017/04/03 22:34:41
Done.
|
| + m_inspector->console()->installMemoryGetter( |
| + info.context, v8::Local<v8::Object>::Cast(console)); |
| } |
| } |