Index: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp |
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp |
index dcb45e613de65eaca79ce0e064c99d073b2aaaf1..3b8d91635f62dce926abd78b261eb71b6d301f1d 100644 |
--- a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp |
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp |
@@ -215,7 +215,7 @@ void V8RuntimeAgentImpl::compileScript(ErrorString* errorString, const String& e |
*scriptId = scriptValueId; |
} |
-void V8RuntimeAgentImpl::runScript(ErrorString* errorString, const ScriptId& scriptId, int executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<ExceptionDetails>& exceptionDetails) |
+void V8RuntimeAgentImpl::runScript(ErrorString* errorString, const ScriptId& scriptId, int executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* includeCommandLineAPI, RefPtr<RemoteObject>& result, RefPtr<ExceptionDetails>& exceptionDetails) |
{ |
if (!m_enabled) { |
*errorString = "Runtime agent is not enabled"; |
@@ -248,6 +248,15 @@ void V8RuntimeAgentImpl::runScript(ErrorString* errorString, const ScriptId& scr |
return; |
} |
v8::TryCatch tryCatch(isolate); |
+ |
+ v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPISymbol(isolate); |
dgozman
2016/02/17 23:47:43
Let's move this to InjectedScript to avoid exposin
kozy
2016/02/18 00:27:33
Done.
|
+ v8::Local<v8::Object> global = context->Global(); |
+ if (asBool(includeCommandLineAPI)) { |
+ v8::Local<v8::Value> commandLineAPI = injectedScript->commandLineAPI(); |
+ if (commandLineAPI->IsObject()) |
+ global->Set(commandLineAPISymbolValue, commandLineAPI->ToObject(isolate)); |
+ } |
+ |
v8::Local<v8::Value> value; |
v8::MaybeLocal<v8::Value> maybeValue = m_debugger->client()->runCompiledScript(context, script); |
if (maybeValue.IsEmpty()) { |
@@ -259,6 +268,9 @@ void V8RuntimeAgentImpl::runScript(ErrorString* errorString, const ScriptId& scr |
value = maybeValue.ToLocalChecked(); |
} |
+ if (asBool(includeCommandLineAPI)) |
+ global->Delete(context, commandLineAPISymbolValue); |
+ |
if (value.IsEmpty()) { |
*errorString = "Script execution failed"; |
return; |