OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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); | |
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
| |
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 Loading... | |
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()) { | |
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
| |
503 const ScriptCallFrame& frame = m_creationStackTrace->at(0); | |
504 const AccessControlStatus corsStatus = NotSharableCrossOrigin; | |
505 RefPtr<ErrorEvent> errorEvent; | |
506 if (executionContext()->shouldSanitizeScriptError(frame.sourceURL(), cor sStatus)) { | |
507 errorEvent = ErrorEvent::createSanitizedError(&m_scriptState->world( )); | |
508 } else { | |
509 String message = m_error->name() + ": " + m_error->message(); | |
510 errorEvent = ErrorEvent::create(message, frame.sourceURL(), frame.li neNumber(), frame.columnNumber(), &m_scriptState->world()); | |
511 } | |
512 executionContext()->reportException(errorEvent, m_creationStackTrace, co rsStatus); | |
513 } | |
514 | |
496 return dontPreventDefault; | 515 return dontPreventDefault; |
497 } | 516 } |
498 | 517 |
499 void IDBRequest::uncaughtExceptionInEventHandler() | 518 void IDBRequest::uncaughtExceptionInEventHandler() |
500 { | 519 { |
501 if (m_transaction && !m_requestAborted) { | 520 if (m_transaction && !m_requestAborted) { |
502 m_transaction->setError(DOMError::create(AbortError, "Uncaught exception in event handler.")); | 521 m_transaction->setError(DOMError::create(AbortError, "Uncaught exception in event handler.")); |
503 m_transaction->abort(IGNORE_EXCEPTION); | 522 m_transaction->abort(IGNORE_EXCEPTION); |
504 } | 523 } |
505 } | 524 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 | 559 |
541 void IDBRequest::dequeueEvent(Event* event) | 560 void IDBRequest::dequeueEvent(Event* event) |
542 { | 561 { |
543 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 562 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
544 if (m_enqueuedEvents[i].get() == event) | 563 if (m_enqueuedEvents[i].get() == event) |
545 m_enqueuedEvents.remove(i); | 564 m_enqueuedEvents.remove(i); |
546 } | 565 } |
547 } | 566 } |
548 | 567 |
549 } // namespace WebCore | 568 } // namespace WebCore |
OLD | NEW |