void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event, int scriptId, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, AccessControlStatus corsStatus) { 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))); 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); 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); } m_pendingExceptions.clear(); }