Index: src/inspector/v8-console.cc |
diff --git a/src/inspector/v8-console.cc b/src/inspector/v8-console.cc |
index d2a511e39cf69d835addf7d05aef33a4adc2d92c..82b9603609025bf7f04c14409dae8d2c31f942dd 100644 |
--- a/src/inspector/v8-console.cc |
+++ b/src/inspector/v8-console.cc |
@@ -23,31 +23,49 @@ |
namespace { |
+v8::Local<v8::Private> inspectedContextPrivateKey(v8::Isolate* isolate) { |
+ return v8::Private::ForApi( |
+ isolate, toV8StringInternalized(isolate, "V8Console#InspectedContext")); |
+} |
+ |
class ConsoleHelper { |
public: |
explicit ConsoleHelper(const v8::FunctionCallbackInfo<v8::Value>& info) |
: m_info(info), |
m_isolate(info.GetIsolate()), |
m_context(info.GetIsolate()->GetCurrentContext()), |
- m_contextId(InspectedContext::contextId(m_context)) { |
- m_inspector = static_cast<V8InspectorImpl*>( |
- m_info.Data().As<v8::External>()->Value()); |
- m_groupId = m_inspector->contextGroupId(m_contextId); |
- } |
- |
- V8InspectorImpl* inspector() { return m_inspector; } |
- |
- int contextId() const { return m_contextId; } |
- int groupId() const { return m_groupId; } |
- |
- InjectedScript* injectedScript() { |
- InspectedContext* context = m_inspector->getContext(m_groupId, m_contextId); |
- if (!context) return nullptr; |
- return context->getInjectedScript(); |
- } |
- |
- V8ConsoleMessageStorage* consoleMessageStorage() { |
- return inspector()->ensureConsoleMessageStorage(m_groupId); |
+ m_inspectedContext(nullptr), |
+ m_inspectorClient(nullptr) {} |
+ |
+ v8::Local<v8::Object> ensureConsole() { |
+ if (m_console.IsEmpty()) { |
+ DCHECK(!m_info.Data().IsEmpty()); |
+ DCHECK(!m_info.Data()->IsUndefined()); |
+ m_console = m_info.Data().As<v8::Object>(); |
+ } |
+ return m_console; |
+ } |
+ |
+ InspectedContext* ensureInspectedContext() { |
+ if (m_inspectedContext) return m_inspectedContext; |
+ v8::Local<v8::Object> console = ensureConsole(); |
+ |
+ v8::Local<v8::Private> key = inspectedContextPrivateKey(m_isolate); |
+ v8::Local<v8::Value> inspectedContextValue; |
+ if (!console->GetPrivate(m_context, key).ToLocal(&inspectedContextValue)) |
+ return nullptr; |
+ DCHECK(inspectedContextValue->IsExternal()); |
+ m_inspectedContext = static_cast<InspectedContext*>( |
+ inspectedContextValue.As<v8::External>()->Value()); |
+ return m_inspectedContext; |
+ } |
+ |
+ V8InspectorClient* ensureDebuggerClient() { |
+ if (m_inspectorClient) return m_inspectorClient; |
+ InspectedContext* inspectedContext = ensureInspectedContext(); |
+ if (!inspectedContext) return nullptr; |
+ m_inspectorClient = inspectedContext->inspector()->client(); |
+ return m_inspectorClient; |
} |
void reportCall(ConsoleAPIType type) { |
@@ -73,19 +91,20 @@ |
void reportCall(ConsoleAPIType type, |
const std::vector<v8::Local<v8::Value>>& arguments) { |
+ InspectedContext* inspectedContext = ensureInspectedContext(); |
+ if (!inspectedContext) return; |
+ int contextGroupId = inspectedContext->contextGroupId(); |
+ V8InspectorImpl* inspector = inspectedContext->inspector(); |
std::unique_ptr<V8ConsoleMessage> message = |
V8ConsoleMessage::createForConsoleAPI( |
- m_context, m_contextId, m_groupId, m_inspector, |
- m_inspector->client()->currentTimeMS(), type, arguments, |
- m_inspector->debugger()->captureStackTrace(false)); |
- consoleMessageStorage()->addMessage(std::move(message)); |
+ inspector->client()->currentTimeMS(), type, arguments, |
+ inspector->debugger()->captureStackTrace(false), inspectedContext); |
+ inspector->ensureConsoleMessageStorage(contextGroupId) |
+ ->addMessage(std::move(message)); |
} |
void reportDeprecatedCall(const char* id, const String16& message) { |
- if (!consoleMessageStorage()->shouldReportDeprecationMessage(m_contextId, |
- id)) { |
- return; |
- } |
+ if (checkAndSetPrivateFlagOnConsole(id, false)) return; |
std::vector<v8::Local<v8::Value>> arguments(1, |
toV8String(m_isolate, message)); |
reportCall(ConsoleAPIType::kWarning, arguments); |
@@ -126,6 +145,56 @@ |
return func; |
} |
+ v8::MaybeLocal<v8::Map> privateMap(const char* name) { |
+ v8::Local<v8::Object> console = ensureConsole(); |
+ v8::Local<v8::Private> privateKey = |
+ v8::Private::ForApi(m_isolate, toV8StringInternalized(m_isolate, name)); |
+ v8::Local<v8::Value> mapValue; |
+ if (!console->GetPrivate(m_context, privateKey).ToLocal(&mapValue)) |
+ return v8::MaybeLocal<v8::Map>(); |
+ if (mapValue->IsUndefined()) { |
+ v8::Local<v8::Map> map = v8::Map::New(m_isolate); |
+ if (!console->SetPrivate(m_context, privateKey, map).FromMaybe(false)) |
+ return v8::MaybeLocal<v8::Map>(); |
+ return map; |
+ } |
+ return mapValue->IsMap() ? mapValue.As<v8::Map>() |
+ : v8::MaybeLocal<v8::Map>(); |
+ } |
+ |
+ int32_t getIntFromMap(v8::Local<v8::Map> map, const String16& key, |
+ int32_t defaultValue) { |
+ v8::Local<v8::String> v8Key = toV8String(m_isolate, key); |
+ if (!map->Has(m_context, v8Key).FromMaybe(false)) return defaultValue; |
+ v8::Local<v8::Value> intValue; |
+ if (!map->Get(m_context, v8Key).ToLocal(&intValue)) return defaultValue; |
+ return static_cast<int32_t>(intValue.As<v8::Integer>()->Value()); |
+ } |
+ |
+ void setIntOnMap(v8::Local<v8::Map> map, const String16& key, int32_t value) { |
+ v8::Local<v8::String> v8Key = toV8String(m_isolate, key); |
+ if (!map->Set(m_context, v8Key, v8::Integer::New(m_isolate, value)) |
+ .ToLocal(&map)) |
+ return; |
+ } |
+ |
+ double getDoubleFromMap(v8::Local<v8::Map> map, const String16& key, |
+ double defaultValue) { |
+ v8::Local<v8::String> v8Key = toV8String(m_isolate, key); |
+ if (!map->Has(m_context, v8Key).FromMaybe(false)) return defaultValue; |
+ v8::Local<v8::Value> intValue; |
+ if (!map->Get(m_context, v8Key).ToLocal(&intValue)) return defaultValue; |
+ return intValue.As<v8::Number>()->Value(); |
+ } |
+ |
+ void setDoubleOnMap(v8::Local<v8::Map> map, const String16& key, |
+ double value) { |
+ v8::Local<v8::String> v8Key = toV8String(m_isolate, key); |
+ if (!map->Set(m_context, v8Key, v8::Number::New(m_isolate, value)) |
+ .ToLocal(&map)) |
+ return; |
+ } |
+ |
V8ProfilerAgentImpl* profilerAgent() { |
if (V8InspectorSessionImpl* session = currentSession()) { |
if (session && session->profilerAgent()->enabled()) |
@@ -143,7 +212,10 @@ |
} |
V8InspectorSessionImpl* currentSession() { |
- return m_inspector->sessionForContextGroup(m_groupId); |
+ InspectedContext* inspectedContext = ensureInspectedContext(); |
+ if (!inspectedContext) return nullptr; |
+ return inspectedContext->inspector()->sessionForContextGroup( |
+ inspectedContext->contextGroupId()); |
} |
private: |
@@ -151,9 +223,26 @@ |
v8::Isolate* m_isolate; |
v8::Local<v8::Context> m_context; |
v8::Local<v8::Object> m_console; |
- V8InspectorImpl* m_inspector = nullptr; |
- int m_contextId; |
- int m_groupId; |
+ InspectedContext* m_inspectedContext; |
+ V8InspectorClient* m_inspectorClient; |
+ |
+ bool checkAndSetPrivateFlagOnConsole(const char* name, bool defaultValue) { |
+ v8::Local<v8::Object> console = ensureConsole(); |
+ v8::Local<v8::Private> key = |
+ v8::Private::ForApi(m_isolate, toV8StringInternalized(m_isolate, name)); |
+ v8::Local<v8::Value> flagValue; |
+ if (!console->GetPrivate(m_context, key).ToLocal(&flagValue)) |
+ return defaultValue; |
+ DCHECK(flagValue->IsUndefined() || flagValue->IsBoolean()); |
+ if (flagValue->IsBoolean()) { |
+ DCHECK(flagValue.As<v8::Boolean>()->Value()); |
+ return true; |
+ } |
+ if (!console->SetPrivate(m_context, key, v8::True(m_isolate)) |
+ .FromMaybe(false)) |
+ return defaultValue; |
+ return false; |
+ } |
DISALLOW_COPY_AND_ASSIGN(ConsoleHelper); |
}; |
@@ -164,13 +253,13 @@ |
void createBoundFunctionProperty(v8::Local<v8::Context> context, |
v8::Local<v8::Object> console, |
- v8::Local<v8::Value> data, const char* name, |
+ const char* name, |
v8::FunctionCallback callback, |
const char* description = nullptr) { |
v8::Local<v8::String> funcName = |
toV8StringInternalized(context->GetIsolate(), name); |
v8::Local<v8::Function> func; |
- if (!v8::Function::New(context, callback, data, 0, |
+ if (!v8::Function::New(context, callback, console, 0, |
v8::ConstructorBehavior::kThrow) |
.ToLocal(&func)) |
return; |
@@ -248,13 +337,18 @@ |
void V8Console::clearCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
ConsoleHelper helper(info); |
- helper.inspector()->client()->consoleClear(helper.groupId()); |
+ InspectedContext* context = helper.ensureInspectedContext(); |
+ if (!context) return; |
+ int contextGroupId = context->contextGroupId(); |
+ if (V8InspectorClient* client = helper.ensureDebuggerClient()) |
+ client->consoleClear(contextGroupId); |
helper.reportCallWithDefaultArgument(ConsoleAPIType::kClear, |
String16("console.clear")); |
} |
void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
ConsoleHelper helper(info); |
+ |
String16 title = helper.firstArgToString(String16()); |
String16 identifier; |
if (title.isEmpty()) { |
@@ -268,8 +362,10 @@ |
identifier = title + "@"; |
} |
- int count = |
- helper.consoleMessageStorage()->count(helper.contextId(), identifier); |
+ v8::Local<v8::Map> countMap; |
+ if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) return; |
+ int32_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; |
+ helper.setIntOnMap(countMap, identifier, count); |
String16 countString = String16::fromInteger(count); |
helper.reportCallWithArgument( |
ConsoleAPIType::kCount, |
@@ -319,25 +415,33 @@ |
static void timeFunction(const v8::FunctionCallbackInfo<v8::Value>& info, |
bool timelinePrefix) { |
ConsoleHelper helper(info); |
- V8InspectorClient* client = helper.inspector()->client(); |
- String16 protocolTitle = helper.firstArgToString("default"); |
- if (timelinePrefix) protocolTitle = "Timeline '" + protocolTitle + "'"; |
- client->consoleTime(toStringView(protocolTitle)); |
- helper.consoleMessageStorage()->time(helper.contextId(), protocolTitle); |
+ if (V8InspectorClient* client = helper.ensureDebuggerClient()) { |
+ String16 protocolTitle = helper.firstArgToString("default"); |
+ if (timelinePrefix) protocolTitle = "Timeline '" + protocolTitle + "'"; |
+ client->consoleTime(toStringView(protocolTitle)); |
+ |
+ v8::Local<v8::Map> timeMap; |
+ if (!helper.privateMap("V8Console#timeMap").ToLocal(&timeMap)) return; |
+ helper.setDoubleOnMap(timeMap, protocolTitle, client->currentTimeMS()); |
+ } |
} |
static void timeEndFunction(const v8::FunctionCallbackInfo<v8::Value>& info, |
bool timelinePrefix) { |
ConsoleHelper helper(info); |
- V8InspectorClient* client = helper.inspector()->client(); |
- String16 protocolTitle = helper.firstArgToString("default"); |
- if (timelinePrefix) protocolTitle = "Timeline '" + protocolTitle + "'"; |
- client->consoleTimeEnd(toStringView(protocolTitle)); |
- double elapsed = helper.consoleMessageStorage()->timeEnd(helper.contextId(), |
- protocolTitle); |
- String16 message = |
- protocolTitle + ": " + String16::fromDouble(elapsed) + "ms"; |
- helper.reportCallWithArgument(ConsoleAPIType::kTimeEnd, message); |
+ if (V8InspectorClient* client = helper.ensureDebuggerClient()) { |
+ String16 protocolTitle = helper.firstArgToString("default"); |
+ if (timelinePrefix) protocolTitle = "Timeline '" + protocolTitle + "'"; |
+ client->consoleTimeEnd(toStringView(protocolTitle)); |
+ |
+ v8::Local<v8::Map> timeMap; |
+ if (!helper.privateMap("V8Console#timeMap").ToLocal(&timeMap)) return; |
+ double elapsed = client->currentTimeMS() - |
+ helper.getDoubleFromMap(timeMap, protocolTitle, 0.0); |
+ String16 message = |
+ protocolTitle + ": " + String16::fromDouble(elapsed) + "ms"; |
+ helper.reportCallWithArgument(ConsoleAPIType::kTimeEnd, message); |
+ } |
} |
void V8Console::timelineCallback( |
@@ -369,20 +473,23 @@ |
void V8Console::timeStampCallback( |
const v8::FunctionCallbackInfo<v8::Value>& info) { |
ConsoleHelper helper(info); |
- String16 title = helper.firstArgToString(String16()); |
- helper.inspector()->client()->consoleTimeStamp(toStringView(title)); |
+ if (V8InspectorClient* client = helper.ensureDebuggerClient()) { |
+ String16 title = helper.firstArgToString(String16()); |
+ client->consoleTimeStamp(toStringView(title)); |
+ } |
} |
void V8Console::memoryGetterCallback( |
const v8::FunctionCallbackInfo<v8::Value>& info) { |
- V8InspectorClient* client = ConsoleHelper(info).inspector()->client(); |
- v8::Local<v8::Value> memoryValue; |
- if (!client |
- ->memoryInfo(info.GetIsolate(), |
- info.GetIsolate()->GetCurrentContext()) |
- .ToLocal(&memoryValue)) |
- return; |
- info.GetReturnValue().Set(memoryValue); |
+ if (V8InspectorClient* client = ConsoleHelper(info).ensureDebuggerClient()) { |
+ v8::Local<v8::Value> memoryValue; |
+ if (!client |
+ ->memoryInfo(info.GetIsolate(), |
+ info.GetIsolate()->GetCurrentContext()) |
+ .ToLocal(&memoryValue)) |
+ return; |
+ info.GetReturnValue().Set(memoryValue); |
+ } |
} |
void V8Console::memorySetterCallback( |
@@ -503,9 +610,10 @@ |
void V8Console::lastEvaluationResultCallback( |
const v8::FunctionCallbackInfo<v8::Value>& info) { |
ConsoleHelper helper(info); |
- InjectedScript* injectedScript = helper.injectedScript(); |
- if (!injectedScript) return; |
- info.GetReturnValue().Set(injectedScript->lastEvaluationResult()); |
+ InspectedContext* context = helper.ensureInspectedContext(); |
+ if (!context) return; |
+ if (InjectedScript* injectedScript = context->getInjectedScript()) |
+ info.GetReturnValue().Set(injectedScript->lastEvaluationResult()); |
} |
static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info, |
@@ -514,7 +622,9 @@ |
if (!copyToClipboard) info.GetReturnValue().Set(info[0]); |
ConsoleHelper helper(info); |
- InjectedScript* injectedScript = helper.injectedScript(); |
+ InspectedContext* context = helper.ensureInspectedContext(); |
+ if (!context) return; |
+ InjectedScript* injectedScript = context->getInjectedScript(); |
if (!injectedScript) return; |
std::unique_ptr<protocol::Runtime::RemoteObject> wrappedObject; |
protocol::Response response = |
@@ -525,10 +635,9 @@ |
std::unique_ptr<protocol::DictionaryValue> hints = |
protocol::DictionaryValue::create(); |
if (copyToClipboard) hints->setBoolean("copyToClipboard", true); |
- if (V8InspectorSessionImpl* session = helper.currentSession()) { |
+ if (V8InspectorSessionImpl* session = helper.currentSession()) |
session->runtimeAgent()->inspect(std::move(wrappedObject), |
std::move(hints)); |
- } |
} |
void V8Console::inspectCallback( |
@@ -568,53 +677,49 @@ |
DCHECK(success); |
USE(success); |
- v8::Local<v8::External> data = |
- v8::External::New(isolate, inspectedContext->inspector()); |
- createBoundFunctionProperty(context, console, data, "debug", |
+ createBoundFunctionProperty(context, console, "debug", |
V8Console::debugCallback); |
- createBoundFunctionProperty(context, console, data, "error", |
+ createBoundFunctionProperty(context, console, "error", |
V8Console::errorCallback); |
- createBoundFunctionProperty(context, console, data, "info", |
+ createBoundFunctionProperty(context, console, "info", |
V8Console::infoCallback); |
- createBoundFunctionProperty(context, console, data, "log", |
- V8Console::logCallback); |
- createBoundFunctionProperty(context, console, data, "warn", |
+ createBoundFunctionProperty(context, console, "log", V8Console::logCallback); |
+ createBoundFunctionProperty(context, console, "warn", |
V8Console::warnCallback); |
- createBoundFunctionProperty(context, console, data, "dir", |
- V8Console::dirCallback); |
- createBoundFunctionProperty(context, console, data, "dirxml", |
+ createBoundFunctionProperty(context, console, "dir", V8Console::dirCallback); |
+ createBoundFunctionProperty(context, console, "dirxml", |
V8Console::dirxmlCallback); |
- createBoundFunctionProperty(context, console, data, "table", |
+ createBoundFunctionProperty(context, console, "table", |
V8Console::tableCallback); |
- createBoundFunctionProperty(context, console, data, "trace", |
+ createBoundFunctionProperty(context, console, "trace", |
V8Console::traceCallback); |
- createBoundFunctionProperty(context, console, data, "group", |
+ createBoundFunctionProperty(context, console, "group", |
V8Console::groupCallback); |
- createBoundFunctionProperty(context, console, data, "groupCollapsed", |
+ createBoundFunctionProperty(context, console, "groupCollapsed", |
V8Console::groupCollapsedCallback); |
- createBoundFunctionProperty(context, console, data, "groupEnd", |
+ createBoundFunctionProperty(context, console, "groupEnd", |
V8Console::groupEndCallback); |
- createBoundFunctionProperty(context, console, data, "clear", |
+ createBoundFunctionProperty(context, console, "clear", |
V8Console::clearCallback); |
- createBoundFunctionProperty(context, console, data, "count", |
+ createBoundFunctionProperty(context, console, "count", |
V8Console::countCallback); |
- createBoundFunctionProperty(context, console, data, "assert", |
+ createBoundFunctionProperty(context, console, "assert", |
V8Console::assertCallback); |
- createBoundFunctionProperty(context, console, data, "markTimeline", |
+ createBoundFunctionProperty(context, console, "markTimeline", |
V8Console::markTimelineCallback); |
- createBoundFunctionProperty(context, console, data, "profile", |
+ createBoundFunctionProperty(context, console, "profile", |
V8Console::profileCallback); |
- createBoundFunctionProperty(context, console, data, "profileEnd", |
+ createBoundFunctionProperty(context, console, "profileEnd", |
V8Console::profileEndCallback); |
- createBoundFunctionProperty(context, console, data, "timeline", |
+ createBoundFunctionProperty(context, console, "timeline", |
V8Console::timelineCallback); |
- createBoundFunctionProperty(context, console, data, "timelineEnd", |
+ createBoundFunctionProperty(context, console, "timelineEnd", |
V8Console::timelineEndCallback); |
- createBoundFunctionProperty(context, console, data, "time", |
+ createBoundFunctionProperty(context, console, "time", |
V8Console::timeCallback); |
- createBoundFunctionProperty(context, console, data, "timeEnd", |
+ createBoundFunctionProperty(context, console, "timeEnd", |
V8Console::timeEndCallback); |
- createBoundFunctionProperty(context, console, data, "timeStamp", |
+ createBoundFunctionProperty(context, console, "timeStamp", |
V8Console::timeStampCallback); |
const char* jsConsoleAssert = |
@@ -642,7 +747,7 @@ |
->Call(context, console, 0, nullptr); |
} |
- if (hasMemoryAttribute) { |
+ if (hasMemoryAttribute) |
console->SetAccessorProperty( |
toV8StringInternalized(isolate, "memory"), |
v8::Function::New(context, V8Console::memoryGetterCallback, console, 0, |
@@ -653,9 +758,17 @@ |
v8::ConstructorBehavior::kThrow) |
.ToLocalChecked(), |
static_cast<v8::PropertyAttribute>(v8::None), v8::DEFAULT); |
- } |
- |
+ |
+ console->SetPrivate(context, inspectedContextPrivateKey(isolate), |
+ v8::External::New(isolate, inspectedContext)); |
return console; |
+} |
+ |
+void V8Console::clearInspectedContextIfNeeded(v8::Local<v8::Context> context, |
+ v8::Local<v8::Object> console) { |
+ v8::Isolate* isolate = context->GetIsolate(); |
+ console->SetPrivate(context, inspectedContextPrivateKey(isolate), |
+ v8::External::New(isolate, nullptr)); |
} |
v8::Local<v8::Object> V8Console::createCommandLineAPI( |
@@ -671,70 +784,68 @@ |
DCHECK(success); |
USE(success); |
- v8::Local<v8::External> data = |
- v8::External::New(isolate, inspectedContext->inspector()); |
- createBoundFunctionProperty(context, commandLineAPI, data, "dir", |
+ createBoundFunctionProperty(context, commandLineAPI, "dir", |
V8Console::dirCallback, |
"function dir(value) { [Command Line API] }"); |
- createBoundFunctionProperty(context, commandLineAPI, data, "dirxml", |
+ createBoundFunctionProperty(context, commandLineAPI, "dirxml", |
V8Console::dirxmlCallback, |
"function dirxml(value) { [Command Line API] }"); |
- createBoundFunctionProperty(context, commandLineAPI, data, "profile", |
+ createBoundFunctionProperty(context, commandLineAPI, "profile", |
V8Console::profileCallback, |
"function profile(title) { [Command Line API] }"); |
createBoundFunctionProperty( |
- context, commandLineAPI, data, "profileEnd", |
- V8Console::profileEndCallback, |
+ context, commandLineAPI, "profileEnd", V8Console::profileEndCallback, |
"function profileEnd(title) { [Command Line API] }"); |
- createBoundFunctionProperty(context, commandLineAPI, data, "clear", |
+ createBoundFunctionProperty(context, commandLineAPI, "clear", |
V8Console::clearCallback, |
"function clear() { [Command Line API] }"); |
createBoundFunctionProperty( |
- context, commandLineAPI, data, "table", V8Console::tableCallback, |
+ context, commandLineAPI, "table", V8Console::tableCallback, |
"function table(data, [columns]) { [Command Line API] }"); |
- createBoundFunctionProperty(context, commandLineAPI, data, "keys", |
+ createBoundFunctionProperty(context, commandLineAPI, "keys", |
V8Console::keysCallback, |
"function keys(object) { [Command Line API] }"); |
- createBoundFunctionProperty(context, commandLineAPI, data, "values", |
+ createBoundFunctionProperty(context, commandLineAPI, "values", |
V8Console::valuesCallback, |
"function values(object) { [Command Line API] }"); |
createBoundFunctionProperty( |
- context, commandLineAPI, data, "debug", V8Console::debugFunctionCallback, |
+ context, commandLineAPI, "debug", V8Console::debugFunctionCallback, |
"function debug(function) { [Command Line API] }"); |
createBoundFunctionProperty( |
- context, commandLineAPI, data, "undebug", |
- V8Console::undebugFunctionCallback, |
+ context, commandLineAPI, "undebug", V8Console::undebugFunctionCallback, |
"function undebug(function) { [Command Line API] }"); |
createBoundFunctionProperty( |
- context, commandLineAPI, data, "monitor", |
- V8Console::monitorFunctionCallback, |
+ context, commandLineAPI, "monitor", V8Console::monitorFunctionCallback, |
"function monitor(function) { [Command Line API] }"); |
createBoundFunctionProperty( |
- context, commandLineAPI, data, "unmonitor", |
+ context, commandLineAPI, "unmonitor", |
V8Console::unmonitorFunctionCallback, |
"function unmonitor(function) { [Command Line API] }"); |
createBoundFunctionProperty( |
- context, commandLineAPI, data, "inspect", V8Console::inspectCallback, |
+ context, commandLineAPI, "inspect", V8Console::inspectCallback, |
"function inspect(object) { [Command Line API] }"); |
- createBoundFunctionProperty(context, commandLineAPI, data, "copy", |
+ createBoundFunctionProperty(context, commandLineAPI, "copy", |
V8Console::copyCallback, |
"function copy(value) { [Command Line API] }"); |
- createBoundFunctionProperty(context, commandLineAPI, data, "$_", |
+ createBoundFunctionProperty(context, commandLineAPI, "$_", |
V8Console::lastEvaluationResultCallback); |
- createBoundFunctionProperty(context, commandLineAPI, data, "$0", |
+ createBoundFunctionProperty(context, commandLineAPI, "$0", |
V8Console::inspectedObject0); |
- createBoundFunctionProperty(context, commandLineAPI, data, "$1", |
+ createBoundFunctionProperty(context, commandLineAPI, "$1", |
V8Console::inspectedObject1); |
- createBoundFunctionProperty(context, commandLineAPI, data, "$2", |
+ createBoundFunctionProperty(context, commandLineAPI, "$2", |
V8Console::inspectedObject2); |
- createBoundFunctionProperty(context, commandLineAPI, data, "$3", |
+ createBoundFunctionProperty(context, commandLineAPI, "$3", |
V8Console::inspectedObject3); |
- createBoundFunctionProperty(context, commandLineAPI, data, "$4", |
+ createBoundFunctionProperty(context, commandLineAPI, "$4", |
V8Console::inspectedObject4); |
inspectedContext->inspector()->client()->installAdditionalCommandLineAPI( |
context, commandLineAPI); |
+ |
+ commandLineAPI->SetPrivate(context, inspectedContextPrivateKey(isolate), |
+ v8::External::New(isolate, inspectedContext)); |
return commandLineAPI; |
} |