| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 150 } |
| 151 if (m_transaction->isFinished()) { | 151 if (m_transaction->isFinished()) { |
| 152 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF
inishedErrorMessage); | 152 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF
inishedErrorMessage); |
| 153 return 0; | 153 return 0; |
| 154 } | 154 } |
| 155 if (!m_transaction->isActive()) { | 155 if (!m_transaction->isActive()) { |
| 156 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI
nactiveErrorMessage); | 156 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI
nactiveErrorMessage); |
| 157 return 0; | 157 return 0; |
| 158 } | 158 } |
| 159 if (m_transaction->isReadOnly()) { | 159 if (m_transaction->isReadOnly()) { |
| 160 es.throwDOMException(ReadOnlyError); | 160 es.throwUninformativeAndGenericDOMException(ReadOnlyError); |
| 161 return 0; | 161 return 0; |
| 162 } | 162 } |
| 163 | 163 |
| 164 // FIXME: Make serialize etc take an ExceptionState or use ScriptState::setD
OMException. | 164 // FIXME: Make serialize etc take an ExceptionState or use ScriptState::setD
OMException. |
| 165 bool didThrow = false; | 165 bool didThrow = false; |
| 166 RefPtr<SerializedScriptValue> serializedValue = value.serialize(state, 0, 0,
didThrow); | 166 RefPtr<SerializedScriptValue> serializedValue = value.serialize(state, 0, 0,
didThrow); |
| 167 if (didThrow) | 167 if (didThrow) |
| 168 return 0; | 168 return 0; |
| 169 | 169 |
| 170 if (serializedValue->blobURLs().size() > 0) { | 170 if (serializedValue->blobURLs().size() > 0) { |
| 171 // FIXME: Add Blob/File/FileList support | 171 // FIXME: Add Blob/File/FileList support |
| 172 es.throwDOMException(DataCloneError); | 172 es.throwUninformativeAndGenericDOMException(DataCloneError); |
| 173 return 0; | 173 return 0; |
| 174 } | 174 } |
| 175 | 175 |
| 176 const IDBKeyPath& keyPath = m_metadata.keyPath; | 176 const IDBKeyPath& keyPath = m_metadata.keyPath; |
| 177 const bool usesInLineKeys = !keyPath.isNull(); | 177 const bool usesInLineKeys = !keyPath.isNull(); |
| 178 const bool hasKeyGenerator = autoIncrement(); | 178 const bool hasKeyGenerator = autoIncrement(); |
| 179 | 179 |
| 180 ScriptExecutionContext* context = state->scriptExecutionContext(); | 180 ScriptExecutionContext* context = state->scriptExecutionContext(); |
| 181 DOMRequestState requestState(context); | 181 DOMRequestState requestState(context); |
| 182 | 182 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 if (m_transaction->isFinished()) { | 239 if (m_transaction->isFinished()) { |
| 240 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF
inishedErrorMessage); | 240 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF
inishedErrorMessage); |
| 241 return 0; | 241 return 0; |
| 242 } | 242 } |
| 243 if (!m_transaction->isActive()) { | 243 if (!m_transaction->isActive()) { |
| 244 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI
nactiveErrorMessage); | 244 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI
nactiveErrorMessage); |
| 245 return 0; | 245 return 0; |
| 246 } | 246 } |
| 247 if (m_transaction->isReadOnly()) { | 247 if (m_transaction->isReadOnly()) { |
| 248 es.throwDOMException(ReadOnlyError); | 248 es.throwUninformativeAndGenericDOMException(ReadOnlyError); |
| 249 return 0; | 249 return 0; |
| 250 } | 250 } |
| 251 | 251 |
| 252 RefPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, es
); | 252 RefPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, es
); |
| 253 if (es.hadException()) | 253 if (es.hadException()) |
| 254 return 0; | 254 return 0; |
| 255 if (!keyRange) { | 255 if (!keyRange) { |
| 256 es.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage
); | 256 es.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage
); |
| 257 return 0; | 257 return 0; |
| 258 } | 258 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 271 } | 271 } |
| 272 if (m_transaction->isFinished()) { | 272 if (m_transaction->isFinished()) { |
| 273 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF
inishedErrorMessage); | 273 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF
inishedErrorMessage); |
| 274 return 0; | 274 return 0; |
| 275 } | 275 } |
| 276 if (!m_transaction->isActive()) { | 276 if (!m_transaction->isActive()) { |
| 277 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI
nactiveErrorMessage); | 277 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI
nactiveErrorMessage); |
| 278 return 0; | 278 return 0; |
| 279 } | 279 } |
| 280 if (m_transaction->isReadOnly()) { | 280 if (m_transaction->isReadOnly()) { |
| 281 es.throwDOMException(ReadOnlyError); | 281 es.throwUninformativeAndGenericDOMException(ReadOnlyError); |
| 282 return 0; | 282 return 0; |
| 283 } | 283 } |
| 284 | 284 |
| 285 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this
), m_transaction.get()); | 285 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this
), m_transaction.get()); |
| 286 backendDB()->clear(m_transaction->id(), id(), request); | 286 backendDB()->clear(m_transaction->id(), id(), request); |
| 287 return request.release(); | 287 return request.release(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 namespace { | 290 namespace { |
| 291 // This class creates the index keys for a given index by extracting | 291 // This class creates the index keys for a given index by extracting |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 } | 582 } |
| 583 return IDBIndexMetadata::InvalidId; | 583 return IDBIndexMetadata::InvalidId; |
| 584 } | 584 } |
| 585 | 585 |
| 586 IDBDatabaseBackendInterface* IDBObjectStore::backendDB() const | 586 IDBDatabaseBackendInterface* IDBObjectStore::backendDB() const |
| 587 { | 587 { |
| 588 return m_transaction->backendDB(); | 588 return m_transaction->backendDB(); |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace WebCore | 591 } // namespace WebCore |
| OLD | NEW |