Chromium Code Reviews| 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); |
|
dgozman
2016/11/15 23:19:57
Let's add a test for compile error in callFunction
kozy
2016/11/16 00:10:50
Done.
|
| + } |
| // 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); |