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

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

Issue 1855393003: [DevTools] Fix custom formatters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 aa45ee8510521a655894109bb2fae7b977daf3da..9a7e5d179a57cff091dda0f3de021b1499d22d1d 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
@@ -108,12 +108,15 @@ void V8RuntimeAgentImpl::evaluate(
return;
}
+ IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
+ v8::TryCatch tryCatch(injectedScript->isolate());
+
v8::MaybeLocal<v8::Object> commandLineAPI = includeCommandLineAPI.fromMaybe(false) ? injectedScript->commandLineAPI(errorString) : v8::MaybeLocal<v8::Object>();
if (includeCommandLineAPI.fromMaybe(false) && commandLineAPI.IsEmpty())
return;
+ InjectedScript::ScopedGlobalObjectExtension scopeExtension(injectedScript, commandLineAPI);
- v8::TryCatch tryCatch(injectedScript->isolate());
- v8::MaybeLocal<v8::Value> maybeResultValue = evaluateInternal(injectedScript, doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false), expression, commandLineAPI);
+ v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->compileAndRunInternalScript(injectedScript->context(), toV8String(injectedScript->isolate(), expression));
// InjectedScript may be gone after any evaluate call - find it again.
injectedScript = m_injectedScriptManager->findInjectedScript(errorString, executionContextId.fromJust());
@@ -131,13 +134,6 @@ void V8RuntimeAgentImpl::evaluate(
exceptionDetails);
}
-v8::MaybeLocal<v8::Value> V8RuntimeAgentImpl::evaluateInternal(InjectedScript* injectedScript, bool doNotPauseOnExceptionsAndMuteConsole, const String& expression, v8::MaybeLocal<v8::Object> extension)
-{
- InjectedScript::ScopedGlobalObjectExtension scopeExtension(injectedScript, extension);
- IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole ? m_debugger : nullptr);
- return m_debugger->compileAndRunInternalScript(injectedScript->context(), toV8String(injectedScript->isolate(), expression));
-}
-
void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
const String16& objectId,
const String16& expression,
@@ -184,13 +180,9 @@ void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
}
IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
-
- v8::MaybeLocal<v8::Object> remoteObjectAPI = injectedScript->remoteObjectAPI(errorString, objectGroupName);
- if (remoteObjectAPI.IsEmpty())
- return;
-
v8::TryCatch tryCatch(injectedScript->isolate());
- v8::MaybeLocal<v8::Value> maybeFunctionValue = evaluateInternal(injectedScript, doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false), "(" + expression + ")", remoteObjectAPI);
+
+ v8::MaybeLocal<v8::Value> maybeFunctionValue = m_debugger->compileAndRunInternalScript(injectedScript->context(), toV8String(injectedScript->isolate(), "(" + expression + ")"));
// InjectedScript may be gone after any evaluate call - find it again.
injectedScript = m_injectedScriptManager->findInjectedScript(errorString, remoteId.get());
if (!injectedScript)
@@ -207,6 +199,11 @@ void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
return;
}
+ v8::MaybeLocal<v8::Object> remoteObjectAPI = injectedScript->remoteObjectAPI(errorString, objectGroupName);
+ if (remoteObjectAPI.IsEmpty())
+ return;
+ InjectedScript::ScopedGlobalObjectExtension scopeExtension(injectedScript, remoteObjectAPI);
+
v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->callFunction(functionValue.As<v8::Function>(), injectedScript->context(), object, argc, argv.get());
// InjectedScript may be gone after any evaluate call - find it again.
injectedScript = m_injectedScriptManager->findInjectedScript(errorString, remoteId.get());

Powered by Google App Engine
This is Rietveld 408576698