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

Unified Diff: Source/modules/indexeddb/IDBRequest.cpp

Issue 243523003: Fire window.onerror for uncaught IndexedDB errors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove FIXMEs Created 6 years, 6 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: Source/modules/indexeddb/IDBRequest.cpp
diff --git a/Source/modules/indexeddb/IDBRequest.cpp b/Source/modules/indexeddb/IDBRequest.cpp
index 7e3660f6095875b61ae72d1b7c460a163a7db414..ff52aaa3ef61c655755c20e93a76da6ec7e84fc5 100644
--- a/Source/modules/indexeddb/IDBRequest.cpp
+++ b/Source/modules/indexeddb/IDBRequest.cpp
@@ -32,8 +32,11 @@
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "bindings/v8/IDBBindingUtilities.h"
+#include "bindings/v8/ScriptCallStackFactory.h"
#include "core/dom/ExecutionContext.h"
#include "core/events/EventQueue.h"
+#include "core/inspector/ScriptCallFrame.h"
+#include "core/inspector/ScriptCallStack.h"
#include "modules/indexeddb/IDBCursorWithValue.h"
#include "modules/indexeddb/IDBDatabase.h"
#include "modules/indexeddb/IDBEventDispatcher.h"
@@ -72,6 +75,9 @@ IDBRequest::IDBRequest(ScriptState* scriptState, IDBAny* source, IDBTransaction*
, m_resultDirty(true)
{
ScriptWrappable::init(this);
+
+ if (scriptState->isolate()->InContext())
+ m_creationStackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
cmumford 2014/06/18 21:32:36 I see that in some places in Blink we don't allow
jsbell 2014/06/18 22:28:46 Can you give me an example? I must be missing some
cmumford 2014/06/23 15:58:04 createScriptCallStackForConsole (used in a few pla
jsbell 2014/07/02 19:40:41 Thanks. It appears (ScriptCallStackFactory.cpp:79)
jsbell 2014/07/02 19:59:13 And FYI, I tried testing w/: [0, 0].forEach(store
}
IDBRequest::~IDBRequest()
@@ -493,6 +499,19 @@ bool IDBRequest::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
if (m_readyState == DONE && event->type() != EventTypeNames::upgradeneeded)
m_hasPendingActivity = false;
+ if (!m_preventPropagation && dontPreventDefault && event->type() == EventTypeNames::error && m_creationStackTrace && m_creationStackTrace->size()) {
ericu 2014/06/19 00:54:06 Under what circumstances would we not have a stack
jsbell 2014/06/19 17:44:38 I believe recent test refactors ensure our unit te
+ const ScriptCallFrame& frame = m_creationStackTrace->at(0);
+ const AccessControlStatus corsStatus = NotSharableCrossOrigin;
+ RefPtr<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, m_creationStackTrace, corsStatus);
+ }
+
return dontPreventDefault;
}

Powered by Google App Engine
This is Rietveld 408576698