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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.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/InjectedScript.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
index 3b155d37ca2b13c5130c16966fc79a648c7b91ef..2371a4a6ac9e84b4392f1ac8a48a740a7ac307fc 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -342,6 +342,25 @@ void InjectedScript::releaseObject(const String& objectId)
m_native->unbind(boundId);
}
+v8::MaybeLocal<v8::Value> InjectedScript::runCompiledScript(v8::Local<v8::Script> script, bool includeCommandLineAPI)
+{
+ v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPISymbol(m_isolate);
+ v8::Local<v8::Object> global = context()->Global();
+ if (includeCommandLineAPI) {
+ V8FunctionCall function(m_client, context(), v8Value(), "commandLineAPI");
+ bool hadException = false;
+ v8::Local<v8::Value> commandLineAPI = function.call(hadException, false);
+ if (!hadException)
+ global->Set(commandLineAPISymbolValue, commandLineAPI);
+ }
+
+ v8::MaybeLocal<v8::Value> maybeValue = m_client->runCompiledScript(context(), script);
+ if (includeCommandLineAPI)
+ global->Delete(context(), commandLineAPISymbolValue);
+
+ return maybeValue;
+}
+
PassRefPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object> callFrames, int asyncOrdinal)
{
v8::HandleScope handles(m_isolate);

Powered by Google App Engine
This is Rietveld 408576698