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

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

Issue 2249743006: [DevTools] Fill ExceptionDetails with more details, unify usage across protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: browser test Created 4 years, 4 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 e370c9260f9ae1063e66af23e0e82399a310ef82..c5a0449c1497d2ffc20a7a42c8f4f10cc747c51b 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8RuntimeAgentImpl.cpp
@@ -50,7 +50,6 @@ static const char customObjectFormatterEnabled[] = "customObjectFormatterEnabled
static const char runtimeEnabled[] = "runtimeEnabled";
};
-using protocol::Runtime::ExceptionDetails;
using protocol::Runtime::RemoteObject;
static bool hasInternalError(ErrorString* errorString, bool hasError)
@@ -106,17 +105,18 @@ private:
DCHECK(handler);
v8::Local<v8::Value> value = info.Length() > 0 ? info[0] : v8::Local<v8::Value>::Cast(v8::Undefined(info.GetIsolate()));
- std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetails;
std::unique_ptr<V8StackTraceImpl> stack = handler->m_inspector->debugger()->captureStackTrace(true);
- if (stack) {
- exceptionDetails = protocol::Runtime::ExceptionDetails::create()
- .setText("Promise was rejected")
- .setLineNumber(!stack->isEmpty() ? stack->topLineNumber() : 0)
- .setColumnNumber(!stack->isEmpty() ? stack->topColumnNumber() : 0)
- .setScriptId(!stack->isEmpty() ? stack->topScriptId() : String16())
- .setStackTrace(stack->buildInspectorObjectImpl())
- .build();
- }
+ std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetails = protocol::Runtime::ExceptionDetails::create()
+ .setExceptionId(handler->m_inspector->nextExceptionId())
+ .setText("Uncaught (in promise)")
+ .setLineNumber(stack && !stack->isEmpty() ? stack->topLineNumber() : 0)
+ .setColumnNumber(stack && !stack->isEmpty() ? stack->topColumnNumber() : 0)
+ .setException(handler->wrapObject(value))
+ .build();
+ if (stack)
+ exceptionDetails->setStackTrace(stack->buildInspectorObjectImpl());
+ if (stack && !stack->isEmpty())
+ exceptionDetails->setScriptId(stack->topScriptId());
handler->m_callback->sendSuccess(handler->wrapObject(value), std::move(exceptionDetails));
}
@@ -411,7 +411,7 @@ void V8RuntimeAgentImpl::getProperties(
const Maybe<bool>& generatePreview,
std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>* result,
Maybe<protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>* internalProperties,
- Maybe<ExceptionDetails>* exceptionDetails)
+ Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
using protocol::Runtime::InternalPropertyDescriptor;
@@ -488,7 +488,7 @@ void V8RuntimeAgentImpl::compileScript(ErrorString* errorString,
bool persistScript,
const Maybe<int>& executionContextId,
Maybe<String16>* scriptId,
- Maybe<ExceptionDetails>* exceptionDetails)
+ Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
if (!m_enabled) {
*errorString = "Runtime agent is not enabled";
@@ -507,9 +507,8 @@ void V8RuntimeAgentImpl::compileScript(ErrorString* errorString,
if (!persistScript)
m_inspector->debugger()->unmuteScriptParsedEvents();
if (script.IsEmpty()) {
- v8::Local<v8::Message> message = scope.tryCatch().Message();
- if (!message.IsEmpty())
- *exceptionDetails = scope.injectedScript()->createExceptionDetails(message);
+ if (scope.tryCatch().HasCaught())
+ *exceptionDetails = scope.injectedScript()->createExceptionDetails(errorString, scope.tryCatch(), String16(), false);
else
*errorString = "Script compilation failed";
return;

Powered by Google App Engine
This is Rietveld 408576698