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

Unified Diff: third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp

Issue 2139543002: [DevTools] Report console API calls through Runtime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 5 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/core/inspector/ThreadDebugger.cpp
diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
index e938a9a79731d92f55bf191862f13e3773e26142..59b8cdec328419c500c2e7d88e36529eaf07657f 100644
--- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
+++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
@@ -4,7 +4,7 @@
#include "core/inspector/ThreadDebugger.h"
-#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/SourceLocation.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8DOMException.h"
#include "bindings/core/v8/V8DOMTokenList.h"
@@ -100,6 +100,21 @@ void ThreadDebugger::asyncTaskFinished(void* task)
m_debugger->asyncTaskFinished(task);
}
+unsigned ThreadDebugger::promiseRejected(v8::Local<v8::Context> context, const String16& errorMessage, v8::Local<v8::Value> exception, std::unique_ptr<SourceLocation> location)
+{
+ const String16 defaultMessage = "Uncaught (in promise)";
+ String16 message = errorMessage;
+ if (message.isEmpty())
+ message = defaultMessage;
+ else if (message.startWith("Uncaught "))
+ message = message.substring(0, 8) + " (in promise)" + message.substring(8);
+
+ unsigned result = debugger()->promiseRejected(context, message, exception, location->url(), location->lineNumber(), location->columnNumber(), location->cloneStackTrace(), location->scriptId());
+ // TODO(dgozman): maybe not wrap in ConsoleMessage.
+ reportConsoleMessage(toExecutionContext(context), ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message, std::move(location)));
+ return result;
+}
+
void ThreadDebugger::beginUserGesture()
{
m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcessingNewUserGesture));
@@ -235,7 +250,7 @@ void ThreadDebugger::logCallback(const v8::FunctionCallbackInfo<v8::Value>& info
Event* event = V8Event::toImplWithTypeCheck(info.GetIsolate(), info[0]);
if (!event)
return;
- debugger->debugger()->logToConsole(info.GetIsolate()->GetCurrentContext(), event->type(), v8String(info.GetIsolate(), event->type()), info[0]);
+ debugger->debugger()->logToConsole(info.GetIsolate()->GetCurrentContext(), v8String(info.GetIsolate(), event->type()), info[0]);
}
v8::Local<v8::Function> ThreadDebugger::eventLogFunction()

Powered by Google App Engine
This is Rietveld 408576698