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

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 33de9c44f033875a3193023ccceeeef2eb80ecdc..fa47175e32f642bc05cdb8e830aa3967a03004a6 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
@@ -107,14 +107,16 @@ void V8RuntimeAgentImpl::evaluate(
return;
}
+ IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
+ MuteConsoleScope muteConsoleScope(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());
- MuteConsoleScope muteConsoleScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
- v8::MaybeLocal<v8::Value> maybeResultValue = evaluateInternal(injectedScript, doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false), expression, commandLineAPI);
-
+ v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->compileAndRunInternalScript(injectedScript->context()->context(), toV8String(injectedScript->isolate(), expression));
// InjectedScript may be gone after any evaluate call - find it again.
injectedScript = m_connection->findInjectedScript(errorString, executionContextId.fromJust());
if (!injectedScript)
@@ -131,13 +133,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()->context(), toV8String(injectedScript->isolate(), expression));
-}
-
void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
const String16& objectId,
const String16& expression,
@@ -185,12 +180,9 @@ void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr);
MuteConsoleScope muteConsoleScope(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()->context(), toV8String(injectedScript->isolate(), "(" + expression + ")"));
// InjectedScript may be gone after any evaluate call - find it again.
injectedScript = m_connection->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()->context(), object, argc, argv.get());
// InjectedScript may be gone after any evaluate call - find it again.
injectedScript = m_connection->findInjectedScript(errorString, remoteId.get());

Powered by Google App Engine
This is Rietveld 408576698