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

Unified Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 743153002: [DevTools] Show stack trace for exceptions in dedicated workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@worker-capture-stack
Patch Set: Rebased Created 6 years 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 | « Source/core/workers/WorkerGlobalScope.h ('k') | Source/core/workers/WorkerMessagingProxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/workers/WorkerGlobalScope.cpp
diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp
index b355f28e92bcff44fba64c7b7b7406189f7e0b68..588bf496b6621328c21ed12e5d22f4f75cf6145c 100644
--- a/Source/core/workers/WorkerGlobalScope.cpp
+++ b/Source/core/workers/WorkerGlobalScope.cpp
@@ -60,6 +60,14 @@
#include "platform/weborigin/SecurityOrigin.h"
#include "public/platform/WebURLRequest.h"
+namespace {
+ unsigned long createWorkerExceptionUniqueIdentifier()
+ {
+ static unsigned long s_workerExceptionUniqueIdentifier = 0;
+ return ++s_workerExceptionUniqueIdentifier;
+ }
+}
+
namespace blink {
class CloseWorkerGlobalScopeTask : public ExecutionContextTask {
@@ -267,9 +275,14 @@ EventTarget* WorkerGlobalScope::errorEventTarget()
return this;
}
-void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack>)
+void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack)
{
- thread()->workerReportingProxy().reportException(errorMessage, lineNumber, columnNumber, sourceURL);
+ unsigned long exceptionId = createWorkerExceptionUniqueIdentifier();
+ RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber);
+ consoleMessage->setCallStack(callStack);
+ m_pendingMessages.set(exceptionId, consoleMessage);
+
+ thread()->workerReportingProxy().reportException(errorMessage, lineNumber, columnNumber, sourceURL, exceptionId);
}
void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& directiveText)
@@ -329,6 +342,13 @@ ConsoleMessageStorage* WorkerGlobalScope::messageStorage()
return m_messageStorage.get();
}
+void WorkerGlobalScope::exceptionHandled(int exceptionId, bool isHandled)
+{
+ RefPtr<ConsoleMessage> consoleMessage = m_pendingMessages.take(exceptionId);
+ if (!isHandled)
+ addConsoleMessage(consoleMessage.release());
+}
+
void WorkerGlobalScope::trace(Visitor* visitor)
{
#if ENABLE(OILPAN)
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.h ('k') | Source/core/workers/WorkerMessagingProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698