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

Side by Side Diff: Source/modules/indexeddb/IDBRequest.cpp

Issue 18398002: Remove IDBNotFoundError ExceptionCode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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
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 11 matching lines...) Expand all
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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"
33 #include "bindings/v8/ExceptionStatePlaceholder.h"
32 #include "bindings/v8/IDBBindingUtilities.h" 34 #include "bindings/v8/IDBBindingUtilities.h"
33 #include "core/dom/DOMError.h" 35 #include "core/dom/DOMError.h"
34 #include "core/dom/EventListener.h" 36 #include "core/dom/EventListener.h"
35 #include "core/dom/EventNames.h" 37 #include "core/dom/EventNames.h"
36 #include "core/dom/EventQueue.h" 38 #include "core/dom/EventQueue.h"
37 #include "core/dom/ExceptionCode.h"
38 #include "core/dom/ExceptionCodePlaceholder.h"
39 #include "core/dom/ScriptExecutionContext.h" 39 #include "core/dom/ScriptExecutionContext.h"
40 #include "modules/indexeddb/IDBCursorBackendInterface.h" 40 #include "modules/indexeddb/IDBCursorBackendInterface.h"
41 #include "modules/indexeddb/IDBCursorWithValue.h" 41 #include "modules/indexeddb/IDBCursorWithValue.h"
42 #include "modules/indexeddb/IDBDatabase.h" 42 #include "modules/indexeddb/IDBDatabase.h"
43 #include "modules/indexeddb/IDBEventDispatcher.h" 43 #include "modules/indexeddb/IDBEventDispatcher.h"
44 #include "modules/indexeddb/IDBTracing.h" 44 #include "modules/indexeddb/IDBTracing.h"
45 #include "modules/indexeddb/IDBTransaction.h" 45 #include "modules/indexeddb/IDBTransaction.h"
46 46
47 namespace WebCore { 47 namespace WebCore {
48 48
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 , m_requestState(context) 85 , m_requestState(context)
86 { 86 {
87 ScriptWrappable::init(this); 87 ScriptWrappable::init(this);
88 } 88 }
89 89
90 IDBRequest::~IDBRequest() 90 IDBRequest::~IDBRequest()
91 { 91 {
92 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !scriptExecutio nContext()); 92 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !scriptExecutio nContext());
93 } 93 }
94 94
95 PassRefPtr<IDBAny> IDBRequest::result(ExceptionCode& ec) const 95 PassRefPtr<IDBAny> IDBRequest::result(ExceptionState& es) const
96 { 96 {
97 if (m_readyState != DONE) { 97 if (m_readyState != DONE) {
98 ec = InvalidStateError; 98 es.throwDOMException(InvalidStateError);
99 return 0; 99 return 0;
100 } 100 }
101 return m_result; 101 return m_result;
102 } 102 }
103 103
104 PassRefPtr<DOMError> IDBRequest::error(ExceptionCode& ec) const 104 PassRefPtr<DOMError> IDBRequest::error(ExceptionState& es) const
105 { 105 {
106 if (m_readyState != DONE) { 106 if (m_readyState != DONE) {
107 ec = InvalidStateError; 107 es.throwDOMException(InvalidStateError);
108 return 0; 108 return 0;
109 } 109 }
110 return m_error; 110 return m_error;
111 } 111 }
112 112
113 PassRefPtr<IDBAny> IDBRequest::source() const 113 PassRefPtr<IDBAny> IDBRequest::source() const
114 { 114 {
115 return m_source; 115 return m_source;
116 } 116 }
117 117
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 bool dontPreventDefault = IDBEventDispatcher::dispatch(event.get(), targets) ; 481 bool dontPreventDefault = IDBEventDispatcher::dispatch(event.get(), targets) ;
482 482
483 if (m_transaction) { 483 if (m_transaction) {
484 if (m_readyState == DONE) 484 if (m_readyState == DONE)
485 m_transaction->unregisterRequest(this); 485 m_transaction->unregisterRequest(this);
486 486
487 // Possibly abort the transaction. This must occur after unregistering ( so this request 487 // Possibly abort the transaction. This must occur after unregistering ( so this request
488 // doesn't receive a second error) and before deactivating (which might trigger commit). 488 // doesn't receive a second error) and before deactivating (which might trigger commit).
489 if (event->type() == eventNames().errorEvent && dontPreventDefault && !m _requestAborted) { 489 if (event->type() == eventNames().errorEvent && dontPreventDefault && !m _requestAborted) {
490 m_transaction->setError(m_error); 490 m_transaction->setError(m_error);
491 m_transaction->abort(IGNORE_EXCEPTION); 491 m_transaction->abort(IGNORE_EXCEPTION_STATE);
492 } 492 }
493 493
494 // If this was the last request in the transaction's list, it may commit here. 494 // If this was the last request in the transaction's list, it may commit here.
495 if (setTransactionActive) 495 if (setTransactionActive)
496 m_transaction->setActive(false); 496 m_transaction->setActive(false);
497 } 497 }
498 498
499 if (cursorToNotify) 499 if (cursorToNotify)
500 cursorToNotify->postSuccessHandlerCallback(); 500 cursorToNotify->postSuccessHandlerCallback();
501 501
502 if (m_readyState == DONE && (!cursorToNotify || m_cursorFinished) && event-> type() != eventNames().upgradeneededEvent) 502 if (m_readyState == DONE && (!cursorToNotify || m_cursorFinished) && event-> type() != eventNames().upgradeneededEvent)
503 m_hasPendingActivity = false; 503 m_hasPendingActivity = false;
504 504
505 return dontPreventDefault; 505 return dontPreventDefault;
506 } 506 }
507 507
508 void IDBRequest::uncaughtExceptionInEventHandler() 508 void IDBRequest::uncaughtExceptionInEventHandler()
509 { 509 {
510 if (m_transaction && !m_requestAborted) { 510 if (m_transaction && !m_requestAborted) {
511 m_transaction->setError(DOMError::create(AbortError, "Uncaught exception in event handler.")); 511 m_transaction->setError(DOMError::create(AbortError, "Uncaught exception in event handler."));
512 m_transaction->abort(IGNORE_EXCEPTION); 512 m_transaction->abort(IGNORE_EXCEPTION_STATE);
513 } 513 }
514 } 514 }
515 515
516 void IDBRequest::transactionDidFinishAndDispatch() 516 void IDBRequest::transactionDidFinishAndDispatch()
517 { 517 {
518 ASSERT(m_transaction); 518 ASSERT(m_transaction);
519 ASSERT(m_transaction->isVersionChange()); 519 ASSERT(m_transaction->isVersionChange());
520 ASSERT(m_readyState == DONE); 520 ASSERT(m_readyState == DONE);
521 ASSERT(scriptExecutionContext()); 521 ASSERT(scriptExecutionContext());
522 m_transaction.clear(); 522 m_transaction.clear();
(...skipping 20 matching lines...) Expand all
543 { 543 {
544 return &m_eventTargetData; 544 return &m_eventTargetData;
545 } 545 }
546 546
547 EventTargetData* IDBRequest::ensureEventTargetData() 547 EventTargetData* IDBRequest::ensureEventTargetData()
548 { 548 {
549 return &m_eventTargetData; 549 return &m_eventTargetData;
550 } 550 }
551 551
552 } // namespace WebCore 552 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698