Index: Source/modules/indexeddb/IDBRequest.cpp |
diff --git a/Source/modules/indexeddb/IDBRequest.cpp b/Source/modules/indexeddb/IDBRequest.cpp |
index 36f55b078d368cbf20fe8c09ae2660ad5fe85efc..b967d07e3dfa2b7cd0aa6fc7797c5e6a152509a8 100644 |
--- a/Source/modules/indexeddb/IDBRequest.cpp |
+++ b/Source/modules/indexeddb/IDBRequest.cpp |
@@ -31,9 +31,14 @@ |
#include "bindings/core/v8/ExceptionState.h" |
#include "bindings/core/v8/ExceptionStatePlaceholder.h" |
+#include "bindings/core/v8/ScriptCallStackFactory.h" |
#include "bindings/modules/v8/IDBBindingUtilities.h" |
#include "core/dom/ExecutionContext.h" |
+#include "core/events/ErrorEvent.h" |
#include "core/events/EventQueue.h" |
+#include "core/inspector/InspectorInstrumentation.h" |
+#include "core/inspector/ScriptCallFrame.h" |
+#include "core/inspector/ScriptCallStack.h" |
#include "modules/IndexedDBNames.h" |
#include "modules/indexeddb/IDBCursorWithValue.h" |
#include "modules/indexeddb/IDBDatabase.h" |
@@ -72,6 +77,9 @@ IDBRequest::IDBRequest(ScriptState* scriptState, IDBAny* source, IDBTransaction* |
, m_preventPropagation(false) |
, m_resultDirty(true) |
{ |
+ const size_t stackSize = InspectorInstrumentation::consoleAgentEnabled(scriptState->executionContext()) ? ScriptCallStack::maxCallStackSizeToCapture : 1; |
+ m_creationStackTrace = createScriptCallStack(stackSize, false); |
aandrey
2014/12/19 00:40:28
use createScriptCallStackForConsole().
if you need
|
+ ASSERT(m_creationStackTrace && m_creationStackTrace->size()); |
} |
IDBRequest::~IDBRequest() |
@@ -97,6 +105,7 @@ void IDBRequest::trace(Visitor* visitor) |
visitor->trace(m_pendingCursor); |
visitor->trace(m_cursorKey); |
visitor->trace(m_cursorPrimaryKey); |
+ visitor->trace(m_creationStackTrace); |
EventTargetWithInlineData::trace(visitor); |
} |
@@ -503,6 +512,20 @@ bool IDBRequest::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) |
if (m_readyState == DONE && event->type() != EventTypeNames::upgradeneeded) |
m_hasPendingActivity = false; |
+ // Fire window.onerror (or the equivalent for workers) for errors that were not prevented. |
+ if (!m_preventPropagation && dontPreventDefault && event->type() == EventTypeNames::error) { |
+ const ScriptCallFrame& frame = m_creationStackTrace->at(0); |
+ const AccessControlStatus corsStatus = NotSharableCrossOrigin; |
+ RefPtrWillBeRawPtr<ErrorEvent> errorEvent; |
+ if (executionContext()->shouldSanitizeScriptError(frame.sourceURL(), corsStatus)) { |
+ errorEvent = ErrorEvent::createSanitizedError(&m_scriptState->world()); |
+ } else { |
+ String message = m_error->name() + ": " + m_error->message(); |
+ errorEvent = ErrorEvent::create(message, frame.sourceURL(), frame.lineNumber(), frame.columnNumber(), &m_scriptState->world()); |
+ } |
+ executionContext()->reportException(errorEvent, frame.scriptId().toInt(), m_creationStackTrace, corsStatus); |
+ } |
+ |
return dontPreventDefault; |
} |