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

Side by Side 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: Update testharness-based test to allow onerror 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/indexeddb/IDBRequest.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 14 matching lines...) Expand all
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "modules/indexeddb/IDBRequest.h" 30 #include "modules/indexeddb/IDBRequest.h"
31 31
32 #include "bindings/v8/ExceptionState.h" 32 #include "bindings/v8/ExceptionState.h"
33 #include "bindings/v8/ExceptionStatePlaceholder.h" 33 #include "bindings/v8/ExceptionStatePlaceholder.h"
34 #include "bindings/v8/IDBBindingUtilities.h" 34 #include "bindings/v8/IDBBindingUtilities.h"
35 #include "bindings/v8/ScriptCallStackFactory.h"
35 #include "core/dom/ExecutionContext.h" 36 #include "core/dom/ExecutionContext.h"
36 #include "core/events/EventQueue.h" 37 #include "core/events/EventQueue.h"
38 #include "core/inspector/ScriptCallFrame.h"
39 #include "core/inspector/ScriptCallStack.h"
37 #include "modules/indexeddb/IDBCursorWithValue.h" 40 #include "modules/indexeddb/IDBCursorWithValue.h"
38 #include "modules/indexeddb/IDBDatabase.h" 41 #include "modules/indexeddb/IDBDatabase.h"
39 #include "modules/indexeddb/IDBEventDispatcher.h" 42 #include "modules/indexeddb/IDBEventDispatcher.h"
40 #include "modules/indexeddb/IDBTracing.h" 43 #include "modules/indexeddb/IDBTracing.h"
41 #include "platform/SharedBuffer.h" 44 #include "platform/SharedBuffer.h"
42 #include "public/platform/WebBlobInfo.h" 45 #include "public/platform/WebBlobInfo.h"
43 46
44 using blink::WebIDBCursor; 47 using blink::WebIDBCursor;
45 48
46 namespace WebCore { 49 namespace WebCore {
(...skipping 18 matching lines...) Expand all
65 , m_source(source) 68 , m_source(source)
66 , m_hasPendingActivity(true) 69 , m_hasPendingActivity(true)
67 , m_cursorType(IndexedDB::CursorKeyAndValue) 70 , m_cursorType(IndexedDB::CursorKeyAndValue)
68 , m_cursorDirection(blink::WebIDBCursor::Next) 71 , m_cursorDirection(blink::WebIDBCursor::Next)
69 , m_pendingCursor(nullptr) 72 , m_pendingCursor(nullptr)
70 , m_didFireUpgradeNeededEvent(false) 73 , m_didFireUpgradeNeededEvent(false)
71 , m_preventPropagation(false) 74 , m_preventPropagation(false)
72 , m_resultDirty(true) 75 , m_resultDirty(true)
73 { 76 {
74 ScriptWrappable::init(this); 77 ScriptWrappable::init(this);
78
79 if (scriptState->isolate()->InContext())
80 m_creationStackTrace = createScriptCallStack(ScriptCallStack::maxCallSta ckSizeToCapture, true);
Mike West 2014/06/13 09:27:52 I'm a little worried about the performance impact
jsbell 2014/06/13 16:58:41 We do have perf tests and I'm worried. Since it'
75 } 81 }
76 82
77 IDBRequest::~IDBRequest() 83 IDBRequest::~IDBRequest()
78 { 84 {
79 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !executionConte xt()); 85 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !executionConte xt());
80 handleBlobAcks(); 86 handleBlobAcks();
81 } 87 }
82 88
83 void IDBRequest::trace(Visitor* visitor) 89 void IDBRequest::trace(Visitor* visitor)
84 { 90 {
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 } 492 }
487 493
488 if (cursorToNotify) 494 if (cursorToNotify)
489 cursorToNotify->postSuccessHandlerCallback(); 495 cursorToNotify->postSuccessHandlerCallback();
490 496
491 // An upgradeneeded event will always be followed by a success or error even t, so must 497 // An upgradeneeded event will always be followed by a success or error even t, so must
492 // be kept alive. 498 // be kept alive.
493 if (m_readyState == DONE && event->type() != EventTypeNames::upgradeneeded) 499 if (m_readyState == DONE && event->type() != EventTypeNames::upgradeneeded)
494 m_hasPendingActivity = false; 500 m_hasPendingActivity = false;
495 501
502 if (!m_preventPropagation && dontPreventDefault && event->type() == EventTyp eNames::error && m_creationStackTrace && m_creationStackTrace->size()) {
503 const ScriptCallFrame& frame = m_creationStackTrace->at(0);
504
505 // FIXME: SharableCrossOrigin or NotSharableCrossOrigin?
Mike West 2014/06/13 09:27:52 If you set this to "ShareableCrossOrigin", then `o
jsbell 2014/06/13 16:58:40 Thanks for the explanation/confirmation!
506 const AccessControlStatus corsStatus = NotSharableCrossOrigin;
507
508 RefPtr<ErrorEvent> errorEvent;
509 if (executionContext()->shouldSanitizeScriptError(frame.sourceURL(), cor sStatus)) {
510 errorEvent = ErrorEvent::createSanitizedError(&m_scriptState->world( ));
511 } else {
512 // FIXME: Firefox just uses error's name. Should we include the mess age?
Mike West 2014/06/13 09:27:52 We have better messages than Firefox. We should us
jsbell 2014/06/13 16:58:41 I thought you'd say that. :)
513 String message = m_error->name() + ": " + m_error->message();
514 errorEvent = ErrorEvent::create(message, frame.sourceURL(), frame.li neNumber(), frame.columnNumber(), &m_scriptState->world());
515 }
516 executionContext()->reportException(errorEvent, m_creationStackTrace, co rsStatus);
517 }
518
496 return dontPreventDefault; 519 return dontPreventDefault;
497 } 520 }
498 521
499 void IDBRequest::uncaughtExceptionInEventHandler() 522 void IDBRequest::uncaughtExceptionInEventHandler()
500 { 523 {
501 if (m_transaction && !m_requestAborted) { 524 if (m_transaction && !m_requestAborted) {
502 m_transaction->setError(DOMError::create(AbortError, "Uncaught exception in event handler.")); 525 m_transaction->setError(DOMError::create(AbortError, "Uncaught exception in event handler."));
503 m_transaction->abort(IGNORE_EXCEPTION); 526 m_transaction->abort(IGNORE_EXCEPTION);
504 } 527 }
505 } 528 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 563
541 void IDBRequest::dequeueEvent(Event* event) 564 void IDBRequest::dequeueEvent(Event* event)
542 { 565 {
543 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { 566 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
544 if (m_enqueuedEvents[i].get() == event) 567 if (m_enqueuedEvents[i].get() == event)
545 m_enqueuedEvents.remove(i); 568 m_enqueuedEvents.remove(i);
546 } 569 }
547 } 570 }
548 571
549 } // namespace WebCore 572 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBRequest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698