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

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

Issue 2376143002: [inspector] fix crash in wrapping result for async Runtime.evaluate (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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 ca9895f25a44df3d3846c8269fa4d63965619db8..640ec317d237521cc8d086c2fae005b9282112ec 100644
--- a/src/inspector/v8-runtime-agent-impl.cc
+++ b/src/inspector/v8-runtime-agent-impl.cc
@@ -116,9 +116,11 @@ class ProtocolPromiseHandler {
info.Length() > 0
? info[0]
: v8::Local<v8::Value>::Cast(v8::Undefined(info.GetIsolate()));
+ std::unique_ptr<protocol::Runtime::RemoteObject> wrappedValue(
+ handler->wrapObject(value));
+ if (!wrappedValue) return;
handler->m_callback->sendSuccess(
- handler->wrapObject(value),
- Maybe<protocol::Runtime::ExceptionDetails>());
+ std::move(wrappedValue), Maybe<protocol::Runtime::ExceptionDetails>());
}
static void catchCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -131,6 +133,10 @@ class ProtocolPromiseHandler {
? info[0]
: v8::Local<v8::Value>::Cast(v8::Undefined(info.GetIsolate()));
+ std::unique_ptr<protocol::Runtime::RemoteObject> wrappedValue(
+ handler->wrapObject(value));
+ if (!wrappedValue) return;
+
std::unique_ptr<V8StackTraceImpl> stack =
handler->m_inspector->debugger()->captureStackTrace(true);
std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetails =
@@ -141,13 +147,13 @@ class ProtocolPromiseHandler {
: 0)
.setColumnNumber(
stack && !stack->isEmpty() ? stack->topColumnNumber() : 0)
- .setException(handler->wrapObject(value))
+ .setException(wrappedValue->clone())
.build();
if (stack)
exceptionDetails->setStackTrace(stack->buildInspectorObjectImpl());
if (stack && !stack->isEmpty())
exceptionDetails->setScriptId(toString16(stack->topScriptId()));
- handler->m_callback->sendSuccess(handler->wrapObject(value),
+ handler->m_callback->sendSuccess(std::move(wrappedValue),
std::move(exceptionDetails));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698