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

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

Issue 1158973007: IndexedDB: Rely on bindings for enum validation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 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/IDBDatabase.cpp ('k') | Source/modules/indexeddb/IDBObjectStore.cpp » ('j') | 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return nullptr; 79 return nullptr;
80 } 80 }
81 if (m_transaction->isFinished() || m_transaction->isFinishing()) { 81 if (m_transaction->isFinished() || m_transaction->isFinishing()) {
82 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage); 82 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage);
83 return nullptr; 83 return nullptr;
84 } 84 }
85 if (!m_transaction->isActive()) { 85 if (!m_transaction->isActive()) {
86 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage); 86 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage);
87 return nullptr; 87 return nullptr;
88 } 88 }
89 WebIDBCursorDirection direction = IDBCursor::stringToDirection(directionStri ng, exceptionState); 89 WebIDBCursorDirection direction = IDBCursor::stringToDirection(directionStri ng);
90 if (exceptionState.hadException())
91 return nullptr;
92
93 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionC ontext(), range, exceptionState); 90 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionC ontext(), range, exceptionState);
94 if (exceptionState.hadException()) 91 if (exceptionState.hadException())
95 return nullptr; 92 return nullptr;
96 93
97 if (!backendDB()) { 94 if (!backendDB()) {
98 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage); 95 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage);
99 return nullptr; 96 return nullptr;
100 } 97 }
101 98
102 return openCursor(scriptState, keyRange, direction); 99 return openCursor(scriptState, keyRange, direction);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return nullptr; 145 return nullptr;
149 } 146 }
150 if (m_transaction->isFinished() || m_transaction->isFinishing()) { 147 if (m_transaction->isFinished() || m_transaction->isFinishing()) {
151 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage); 148 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage);
152 return nullptr; 149 return nullptr;
153 } 150 }
154 if (!m_transaction->isActive()) { 151 if (!m_transaction->isActive()) {
155 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage); 152 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage);
156 return nullptr; 153 return nullptr;
157 } 154 }
158 WebIDBCursorDirection direction = IDBCursor::stringToDirection(directionStri ng, exceptionState); 155 WebIDBCursorDirection direction = IDBCursor::stringToDirection(directionStri ng);
159 if (exceptionState.hadException())
160 return nullptr;
161
162 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionC ontext(), range, exceptionState); 156 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionC ontext(), range, exceptionState);
163 if (exceptionState.hadException()) 157 if (exceptionState.hadException())
164 return nullptr; 158 return nullptr;
165 if (!backendDB()) { 159 if (!backendDB()) {
166 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage); 160 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage);
167 return nullptr; 161 return nullptr;
168 } 162 }
169 163
170 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); 164 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
171 request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); 165 request->setCursorDetails(IndexedDB::CursorKeyOnly, direction);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 { 269 {
276 return m_transaction->backendDB(); 270 return m_transaction->backendDB();
277 } 271 }
278 272
279 bool IDBIndex::isDeleted() const 273 bool IDBIndex::isDeleted() const
280 { 274 {
281 return m_deleted || m_objectStore->isDeleted(); 275 return m_deleted || m_objectStore->isDeleted();
282 } 276 }
283 277
284 } // namespace blink 278 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.cpp ('k') | Source/modules/indexeddb/IDBObjectStore.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698