void ScriptExecutionContext::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, JSC::Exception* exception, RefPtr<ScriptCallStack>&& callStack, CachedScript* cachedScript) { if (m_inDispatchErrorEvent) { if (!m_pendingExceptions) m_pendingExceptions = std::make_unique<Vector<std::unique_ptr<PendingException>>>(); m_pendingExceptions->append(std::make_unique<PendingException>(errorMessage, lineNumber, columnNumber, sourceURL, callStack.copyRef())); return; } // First report the original exception and only then all the nested ones. if (!dispatchErrorEvent(errorMessage, lineNumber, columnNumber, sourceURL, exception, cachedScript)) logExceptionToConsole(errorMessage, sourceURL, lineNumber, columnNumber, callStack.copyRef()); if (!m_pendingExceptions) return; std::unique_ptr<Vector<std::unique_ptr<PendingException>>> pendingExceptions = WTFMove(m_pendingExceptions); for (auto& exception : *pendingExceptions) logExceptionToConsole(exception->m_errorMessage, exception->m_sourceURL, exception->m_lineNumber, exception->m_columnNumber, exception->m_callStack.copyRef()); }
void ScriptExecutionContext::reportException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) { if (m_inDispatchErrorEvent) { if (!m_pendingExceptions) m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >()); m_pendingExceptions->append(adoptPtr(new PendingException(errorMessage, lineNumber, sourceURL, callStack))); return; } // First report the original exception and only then all the nested ones. if (!dispatchErrorEvent(errorMessage, lineNumber, sourceURL)) logExceptionToConsole(errorMessage, lineNumber, sourceURL, 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_lineNumber, e->m_sourceURL, e->m_callStack); } m_pendingExceptions.clear(); }
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(); }