Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp

Issue 1707043002: [DevTools] Support CommandLineAPI in snippets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698