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

Unified Diff: src/inspector/v8-runtime-agent-impl.cc

Issue 2499273003: [inspector] introduced Script::TYPE_INSPECTOR (Closed)
Patch Set: rebased Created 4 years, 1 month 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
« no previous file with comments | « src/inspector/v8-inspector-impl.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-runtime-agent-impl.cc
diff --git a/src/inspector/v8-runtime-agent-impl.cc b/src/inspector/v8-runtime-agent-impl.cc
index 4dbe60f8f3e8cd2344499860994b84214bafeefe..955da25fa3d9d99705f1ae801f1c4d435f926f29 100644
--- a/src/inspector/v8-runtime-agent-impl.cc
+++ b/src/inspector/v8-runtime-agent-impl.cc
@@ -293,11 +293,11 @@ void V8RuntimeAgentImpl::evaluate(
if (evalIsDisabled) scope.context()->AllowCodeGenerationFromStrings(true);
v8::MaybeLocal<v8::Value> maybeResultValue;
- v8::Local<v8::Script> script = m_inspector->compileScript(
- scope.context(), toV8String(m_inspector->isolate(), expression),
- String16(), false);
- if (!script.IsEmpty())
+ v8::Local<v8::Script> script;
+ if (m_inspector->compileScript(scope.context(), expression, String16())
+ .ToLocal(&script)) {
maybeResultValue = m_inspector->runCompiledScript(scope.context(), script);
+ }
if (evalIsDisabled) scope.context()->AllowCodeGenerationFromStrings(false);
@@ -379,10 +379,14 @@ void V8RuntimeAgentImpl::callFunctionOn(
if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole();
if (userGesture.fromMaybe(false)) scope.pretendUserGesture();
- v8::MaybeLocal<v8::Value> maybeFunctionValue =
- m_inspector->compileAndRunInternalScript(
- scope.context(),
- toV8String(m_inspector->isolate(), "(" + expression + ")"));
+ v8::MaybeLocal<v8::Value> maybeFunctionValue;
+ v8::Local<v8::Script> functionScript;
+ if (m_inspector
+ ->compileScript(scope.context(), "(" + expression + ")", String16())
+ .ToLocal(&functionScript)) {
+ maybeFunctionValue =
+ m_inspector->runCompiledScript(scope.context(), functionScript);
+ }
// Re-initialize after running client's code, as it could have destroyed
// context or session.
response = scope.initialize();
@@ -543,11 +547,11 @@ Response V8RuntimeAgentImpl::compileScript(
if (!response.isSuccess()) return response;
if (!persistScript) m_inspector->debugger()->muteScriptParsedEvents();
- v8::Local<v8::Script> script = m_inspector->compileScript(
- scope.context(), toV8String(m_inspector->isolate(), expression),
- sourceURL, false);
+ v8::Local<v8::Script> script;
+ bool isOk = m_inspector->compileScript(scope.context(), expression, sourceURL)
+ .ToLocal(&script);
if (!persistScript) m_inspector->debugger()->unmuteScriptParsedEvents();
- if (script.IsEmpty()) {
+ if (!isOk) {
if (scope.tryCatch().HasCaught()) {
response = scope.injectedScript()->createExceptionDetails(
scope.tryCatch(), String16(), false, exceptionDetails);
« no previous file with comments | « src/inspector/v8-inspector-impl.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698