| Index: Source/core/dom/ExecutionContext.cpp
|
| diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
|
| index 4ec9a88c8031b8d3d83268850358998f581dc5d5..a19793c73a2f48af665fc8146e5fdcd036cda7ba 100644
|
| --- a/Source/core/dom/ExecutionContext.cpp
|
| +++ b/Source/core/dom/ExecutionContext.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "core/events/EventTarget.h"
|
| #include "core/html/PublicURLManager.h"
|
| #include "core/inspector/InspectorInstrumentation.h"
|
| +#include "core/inspector/ScriptArguments.h"
|
| #include "core/inspector/ScriptCallStack.h"
|
| #include "core/workers/WorkerGlobalScope.h"
|
| #include "core/workers/WorkerThread.h"
|
| @@ -45,18 +46,20 @@ namespace blink {
|
| class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFinalized<ExecutionContext::PendingException> {
|
| WTF_MAKE_NONCOPYABLE(PendingException);
|
| public:
|
| - PendingException(const String& errorMessage, int lineNumber, int columnNumber, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack)
|
| + PendingException(const String& errorMessage, int lineNumber, int columnNumber, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, PassRefPtrWillBeRawPtr<ScriptArguments> arguments)
|
| : m_errorMessage(errorMessage)
|
| , m_lineNumber(lineNumber)
|
| , m_columnNumber(columnNumber)
|
| , m_scriptId(scriptId)
|
| , m_sourceURL(sourceURL)
|
| , m_callStack(callStack)
|
| + , m_arguments(arguments)
|
| {
|
| }
|
| void trace(Visitor* visitor)
|
| {
|
| visitor->trace(m_callStack);
|
| + visitor->trace(m_arguments);
|
| }
|
| String m_errorMessage;
|
| int m_lineNumber;
|
| @@ -64,6 +67,7 @@ public:
|
| int m_scriptId;
|
| String m_sourceURL;
|
| RefPtrWillBeMember<ScriptCallStack> m_callStack;
|
| + RefPtrWillBeMember<ScriptArguments> m_arguments;
|
| };
|
|
|
| ExecutionContext::ExecutionContext()
|
| @@ -132,26 +136,27 @@ bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
|
| return !(securityOrigin()->canRequest(completeURL(sourceURL)) || corsStatus == SharableCrossOrigin);
|
| }
|
|
|
| -void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event, int scriptId, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, AccessControlStatus corsStatus)
|
| +void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event, int scriptId, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, PassRefPtrWillBeRawPtr<ScriptArguments> arguments, AccessControlStatus corsStatus, bool isPromiseReject)
|
| {
|
| RefPtrWillBeRawPtr<ErrorEvent> errorEvent = event;
|
| if (m_inDispatchErrorEvent) {
|
| if (!m_pendingExceptions)
|
| m_pendingExceptions = adoptPtrWillBeNoop(new WillBeHeapVector<OwnPtrWillBeMember<PendingException> >());
|
| - m_pendingExceptions->append(adoptPtrWillBeNoop(new PendingException(errorEvent->messageForConsole(), errorEvent->lineno(), errorEvent->colno(), scriptId, errorEvent->filename(), callStack)));
|
| + m_pendingExceptions->append(adoptPtrWillBeNoop(new PendingException(errorEvent->messageForConsole(), errorEvent->lineno(), errorEvent->colno(), scriptId, errorEvent->filename(), callStack, arguments)));
|
| return;
|
| }
|
|
|
| // First report the original exception and only then all the nested ones.
|
| - if (!dispatchErrorEvent(errorEvent, corsStatus))
|
| - logExceptionToConsole(errorEvent->messageForConsole(), scriptId, errorEvent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack);
|
| + // FIXME: Do not dispatch uncaught Promise rejects until the window.onerror spec is finalized.
|
| + if (isPromiseReject || !dispatchErrorEvent(errorEvent, corsStatus))
|
| + logExceptionToConsole(errorEvent->messageForConsole(), scriptId, errorEvent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack, arguments);
|
|
|
| if (!m_pendingExceptions)
|
| return;
|
|
|
| for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
|
| PendingException* e = m_pendingExceptions->at(i).get();
|
| - logExceptionToConsole(e->m_errorMessage, e->m_scriptId, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack);
|
| + logExceptionToConsole(e->m_errorMessage, e->m_scriptId, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack, e->m_arguments);
|
| }
|
| m_pendingExceptions.clear();
|
| }
|
|
|