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

Unified Diff: third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp

Issue 2010603002: Use SourceLocation when reporting runtime exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2004243002
Patch Set: test fixes Created 4 years, 7 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/workers/InProcessWorkerMessagingProxy.cpp
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
index 5204c70567fb95ed7a9849caf1515446d87bca65..85d180321a5ec3e1503bf450df83abdbd2b8655b 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
@@ -52,10 +52,10 @@ namespace blink {
namespace {
-void processExceptionOnWorkerGlobalScope(int exceptionId, bool handled, ExecutionContext* scriptContext)
+void processUnhandledExceptionOnWorkerGlobalScope(const String& errorMessage, PassOwnPtr<SourceLocation> location, ExecutionContext* scriptContext)
{
WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext);
- globalScope->exceptionHandled(exceptionId, handled);
+ globalScope->exceptionUnhandled(errorMessage, std::move(location));
}
void processMessageOnWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels, InProcessWorkerObjectProxy* workerObjectProxy, ExecutionContext* scriptContext)
@@ -158,7 +158,7 @@ void InProcessWorkerMessagingProxy::postTaskToLoader(std::unique_ptr<ExecutionCo
getExecutionContext()->postTask(BLINK_FROM_HERE, std::move(task));
}
-void InProcessWorkerMessagingProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, int exceptionId)
+void InProcessWorkerMessagingProxy::reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location)
{
DCHECK(isParentContextThread());
if (!m_workerObject)
@@ -170,9 +170,9 @@ void InProcessWorkerMessagingProxy::reportException(const String& errorMessage,
// because terminated workers no longer deliver messages (section 4.6 of the
// WebWorker spec), but they do report exceptions.
- ErrorEvent* event = ErrorEvent::create(errorMessage, sourceURL, lineNumber, columnNumber, nullptr);
- DispatchEventResult dispatchResult = m_workerObject->dispatchEvent(event);
- postTaskToWorkerGlobalScope(createCrossThreadTask(&processExceptionOnWorkerGlobalScope, exceptionId, dispatchResult != DispatchEventResult::NotCanceled));
+ ErrorEvent* event = ErrorEvent::create(errorMessage, location->url(), location->lineNumber(), location->columnNumber(), nullptr);
+ if (m_workerObject->dispatchEvent(event) == DispatchEventResult::NotCanceled)
+ postTaskToWorkerGlobalScope(createCrossThreadTask(&processUnhandledExceptionOnWorkerGlobalScope, errorMessage, passed(std::move(location))));
}
void InProcessWorkerMessagingProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)

Powered by Google App Engine
This is Rietveld 408576698