| Index: third_party/WebKit/Source/core/inspector/WorkerThreadDebugger.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/WorkerThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/WorkerThreadDebugger.cpp
|
| index 9510b04dbafbff2fc168dd2f30a7be23bb9e8b87..8f2a4cfc60cac67f6bc4cac6ebaa9f20bc13ce96 100644
|
| --- a/third_party/WebKit/Source/core/inspector/WorkerThreadDebugger.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/WorkerThreadDebugger.cpp
|
| @@ -32,7 +32,10 @@
|
|
|
| #include "bindings/core/v8/ScriptState.h"
|
| #include "bindings/core/v8/SourceLocation.h"
|
| +#include "bindings/core/v8/V8ErrorHandler.h"
|
| #include "bindings/core/v8/V8ScriptRunner.h"
|
| +#include "bindings/core/v8/WorkerOrWorkletScriptController.h"
|
| +#include "core/events/ErrorEvent.h"
|
| #include "core/inspector/ConsoleMessage.h"
|
| #include "core/inspector/ConsoleMessageStorage.h"
|
| #include "core/inspector/IdentifiersFactory.h"
|
| @@ -90,12 +93,22 @@ void WorkerThreadDebugger::contextWillBeDestroyed(v8::Local<v8::Context> context
|
| debugger()->contextDestroyed(context);
|
| }
|
|
|
| -void WorkerThreadDebugger::exceptionThrown(const String& errorMessage, std::unique_ptr<SourceLocation> location)
|
| +void WorkerThreadDebugger::exceptionThrown(ErrorEvent* event)
|
| {
|
| if (m_workerThread->workerGlobalScope()->consoleMessageStorage()->isMuted())
|
| return;
|
| - debugger()->exceptionThrown(workerContextGroupId, errorMessage, location->url(), location->lineNumber(), location->columnNumber(), location->cloneStackTrace(), location->scriptId());
|
| - m_workerThread->workerReportingProxy().reportConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage, std::move(location)));
|
| +
|
| + const String16 defaultMessage = "Uncaught";
|
| + ScriptState* scriptState = m_workerThread->workerGlobalScope()->scriptController()->getScriptState();
|
| + if (scriptState && scriptState->contextIsValid()) {
|
| + ScriptState::Scope scope(scriptState);
|
| + v8::Local<v8::Value> exception = V8ErrorHandler::loadExceptionFromErrorEventWrapper(scriptState, event, scriptState->context()->Global());
|
| + SourceLocation* location = event->location();
|
| + debugger()->exceptionThrown(scriptState->context(), defaultMessage, exception, event->messageForConsole(), location->url(), location->lineNumber(), location->columnNumber(), location->cloneStackTrace(), location->scriptId());
|
| + }
|
| +
|
| + // TODO(dgozman): do not wrap in ConsoleMessage.
|
| + m_workerThread->workerReportingProxy().reportConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, event->messageForConsole(), event->location()->clone()));
|
| }
|
|
|
| int WorkerThreadDebugger::contextGroupId()
|
| @@ -146,7 +159,7 @@ void WorkerThreadDebugger::endEnsureAllContextsInGroup(int contextGroupId)
|
| void WorkerThreadDebugger::consoleAPIMessage(int contextGroupId, MessageLevel level, const String16& message, const String16& url, unsigned lineNumber, unsigned columnNumber, V8StackTrace* stackTrace)
|
| {
|
| DCHECK(contextGroupId == workerContextGroupId);
|
| - // TODO(dgozman): maybe not wrap with ConsoleMessage.
|
| + // TODO(dgozman): do not wrap in ConsoleMessage.
|
| ConsoleMessage* consoleMessage = ConsoleMessage::create(ConsoleAPIMessageSource, level, message, SourceLocation::create(url, lineNumber, columnNumber, stackTrace ? stackTrace->clone() : nullptr, 0));
|
| m_workerThread->workerReportingProxy().reportConsoleMessage(consoleMessage);
|
| }
|
|
|