| 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 28 matching lines...) Expand all Loading... |
| 39 #include "modules/indexeddb/IDBDatabase.h" | 39 #include "modules/indexeddb/IDBDatabase.h" |
| 40 #include "modules/indexeddb/IDBKeyPath.h" | 40 #include "modules/indexeddb/IDBKeyPath.h" |
| 41 #include "modules/indexeddb/IDBTracing.h" | 41 #include "modules/indexeddb/IDBTracing.h" |
| 42 #include "modules/indexeddb/WebIDBCallbacksImpl.h" | 42 #include "modules/indexeddb/WebIDBCallbacksImpl.h" |
| 43 #include "platform/SharedBuffer.h" | 43 #include "platform/SharedBuffer.h" |
| 44 #include "public/platform/WebBlobInfo.h" | 44 #include "public/platform/WebBlobInfo.h" |
| 45 #include "public/platform/WebData.h" | 45 #include "public/platform/WebData.h" |
| 46 #include "public/platform/WebVector.h" | 46 #include "public/platform/WebVector.h" |
| 47 #include "public/platform/modules/indexeddb/WebIDBKey.h" | 47 #include "public/platform/modules/indexeddb/WebIDBKey.h" |
| 48 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" | 48 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" |
| 49 #include <memory> |
| 49 #include <v8.h> | 50 #include <v8.h> |
| 50 | 51 |
| 51 using blink::WebBlobInfo; | 52 using blink::WebBlobInfo; |
| 52 using blink::WebIDBCallbacks; | 53 using blink::WebIDBCallbacks; |
| 53 using blink::WebIDBCursor; | 54 using blink::WebIDBCursor; |
| 54 using blink::WebIDBDatabase; | 55 using blink::WebIDBDatabase; |
| 55 using blink::WebVector; | 56 using blink::WebVector; |
| 56 | 57 |
| 57 namespace blink { | 58 namespace blink { |
| 58 | 59 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (!keyRange) { | 107 if (!keyRange) { |
| 107 exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRange
ErrorMessage); | 108 exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRange
ErrorMessage); |
| 108 return nullptr; | 109 return nullptr; |
| 109 } | 110 } |
| 110 if (!backendDB()) { | 111 if (!backendDB()) { |
| 111 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 112 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 112 return nullptr; | 113 return nullptr; |
| 113 } | 114 } |
| 114 | 115 |
| 115 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 116 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 116 backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, key
Range, false, WebIDBCallbacksImpl::create(request).leakPtr()); | 117 backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, key
Range, false, WebIDBCallbacksImpl::create(request).release()); |
| 117 return request; | 118 return request; |
| 118 } | 119 } |
| 119 | 120 |
| 120 IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
keyRange, ExceptionState& exceptionState) | 121 IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
keyRange, ExceptionState& exceptionState) |
| 121 { | 122 { |
| 122 return getAll(scriptState, keyRange, std::numeric_limits<uint32_t>::max(), e
xceptionState); | 123 return getAll(scriptState, keyRange, std::numeric_limits<uint32_t>::max(), e
xceptionState); |
| 123 } | 124 } |
| 124 | 125 |
| 125 IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
keyRange, unsigned long maxCount, ExceptionState& exceptionState) | 126 IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
keyRange, unsigned long maxCount, ExceptionState& exceptionState) |
| 126 { | 127 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 142 } | 143 } |
| 143 IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionC
ontext(), keyRange, exceptionState); | 144 IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionC
ontext(), keyRange, exceptionState); |
| 144 if (exceptionState.hadException()) | 145 if (exceptionState.hadException()) |
| 145 return nullptr; | 146 return nullptr; |
| 146 if (!backendDB()) { | 147 if (!backendDB()) { |
| 147 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 148 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 148 return nullptr; | 149 return nullptr; |
| 149 } | 150 } |
| 150 | 151 |
| 151 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 152 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 152 backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId,
range, maxCount, false, WebIDBCallbacksImpl::create(request).leakPtr()); | 153 backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId,
range, maxCount, false, WebIDBCallbacksImpl::create(request).release()); |
| 153 return request; | 154 return request; |
| 154 } | 155 } |
| 155 | 156 |
| 156 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptVal
ue& keyRange, ExceptionState& exceptionState) | 157 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptVal
ue& keyRange, ExceptionState& exceptionState) |
| 157 { | 158 { |
| 158 return getAllKeys(scriptState, keyRange, std::numeric_limits<uint32_t>::max(
), exceptionState); | 159 return getAllKeys(scriptState, keyRange, std::numeric_limits<uint32_t>::max(
), exceptionState); |
| 159 } | 160 } |
| 160 | 161 |
| 161 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptVal
ue& keyRange, unsigned long maxCount, ExceptionState& exceptionState) | 162 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptVal
ue& keyRange, unsigned long maxCount, ExceptionState& exceptionState) |
| 162 { | 163 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 178 } | 179 } |
| 179 IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionC
ontext(), keyRange, exceptionState); | 180 IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionC
ontext(), keyRange, exceptionState); |
| 180 if (exceptionState.hadException()) | 181 if (exceptionState.hadException()) |
| 181 return nullptr; | 182 return nullptr; |
| 182 if (!backendDB()) { | 183 if (!backendDB()) { |
| 183 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 184 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 184 return nullptr; | 185 return nullptr; |
| 185 } | 186 } |
| 186 | 187 |
| 187 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 188 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 188 backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId,
range, maxCount, true, WebIDBCallbacksImpl::create(request).leakPtr()); | 189 backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId,
range, maxCount, true, WebIDBCallbacksImpl::create(request).release()); |
| 189 return request; | 190 return request; |
| 190 } | 191 } |
| 191 | 192 |
| 192 static void generateIndexKeysForValue(v8::Isolate* isolate, const IDBIndexMetada
ta& indexMetadata, const ScriptValue& objectValue, IDBObjectStore::IndexKeys* in
dexKeys) | 193 static void generateIndexKeysForValue(v8::Isolate* isolate, const IDBIndexMetada
ta& indexMetadata, const ScriptValue& objectValue, IDBObjectStore::IndexKeys* in
dexKeys) |
| 193 { | 194 { |
| 194 ASSERT(indexKeys); | 195 ASSERT(indexKeys); |
| 195 NonThrowableExceptionState exceptionState; | 196 NonThrowableExceptionState exceptionState; |
| 196 IDBKey* indexKey = ScriptValue::to<IDBKey*>(isolate, objectValue, exceptionS
tate, indexMetadata.keyPath); | 197 IDBKey* indexKey = ScriptValue::to<IDBKey*>(isolate, objectValue, exceptionS
tate, indexMetadata.keyPath); |
| 197 | 198 |
| 198 if (!indexKey) | 199 if (!indexKey) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 generateIndexKeysForValue(scriptState->isolate(), it.value, clone, &keys
); | 334 generateIndexKeysForValue(scriptState->isolate(), it.value, clone, &keys
); |
| 334 indexIds.append(it.key); | 335 indexIds.append(it.key); |
| 335 indexKeys.append(keys); | 336 indexKeys.append(keys); |
| 336 } | 337 } |
| 337 | 338 |
| 338 IDBRequest* request = IDBRequest::create(scriptState, source, m_transaction.
get()); | 339 IDBRequest* request = IDBRequest::create(scriptState, source, m_transaction.
get()); |
| 339 Vector<char> wireBytes; | 340 Vector<char> wireBytes; |
| 340 serializedValue->toWireBytes(wireBytes); | 341 serializedValue->toWireBytes(wireBytes); |
| 341 RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); | 342 RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); |
| 342 | 343 |
| 343 backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo,
key, static_cast<WebIDBPutMode>(putMode), WebIDBCallbacksImpl::create(request).l
eakPtr(), indexIds, indexKeys); | 344 backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo,
key, static_cast<WebIDBPutMode>(putMode), WebIDBCallbacksImpl::create(request).r
elease(), indexIds, indexKeys); |
| 344 return request; | 345 return request; |
| 345 } | 346 } |
| 346 | 347 |
| 347 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* scriptState, const Scrip
tValue& key, ExceptionState& exceptionState) | 348 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* scriptState, const Scrip
tValue& key, ExceptionState& exceptionState) |
| 348 { | 349 { |
| 349 IDB_TRACE("IDBObjectStore::delete"); | 350 IDB_TRACE("IDBObjectStore::delete"); |
| 350 if (isDeleted()) { | 351 if (isDeleted()) { |
| 351 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 352 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 352 return nullptr; | 353 return nullptr; |
| 353 } | 354 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 370 if (!keyRange) { | 371 if (!keyRange) { |
| 371 exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRange
ErrorMessage); | 372 exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRange
ErrorMessage); |
| 372 return nullptr; | 373 return nullptr; |
| 373 } | 374 } |
| 374 if (!backendDB()) { | 375 if (!backendDB()) { |
| 375 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 376 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 376 return nullptr; | 377 return nullptr; |
| 377 } | 378 } |
| 378 | 379 |
| 379 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 380 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 380 backendDB()->deleteRange(m_transaction->id(), id(), keyRange, WebIDBCallback
sImpl::create(request).leakPtr()); | 381 backendDB()->deleteRange(m_transaction->id(), id(), keyRange, WebIDBCallback
sImpl::create(request).release()); |
| 381 return request; | 382 return request; |
| 382 } | 383 } |
| 383 | 384 |
| 384 IDBRequest* IDBObjectStore::clear(ScriptState* scriptState, ExceptionState& exce
ptionState) | 385 IDBRequest* IDBObjectStore::clear(ScriptState* scriptState, ExceptionState& exce
ptionState) |
| 385 { | 386 { |
| 386 IDB_TRACE("IDBObjectStore::clear"); | 387 IDB_TRACE("IDBObjectStore::clear"); |
| 387 if (isDeleted()) { | 388 if (isDeleted()) { |
| 388 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 389 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 389 return nullptr; | 390 return nullptr; |
| 390 } | 391 } |
| 391 if (m_transaction->isFinished() || m_transaction->isFinishing()) { | 392 if (m_transaction->isFinished() || m_transaction->isFinishing()) { |
| 392 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); | 393 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
| 393 return nullptr; | 394 return nullptr; |
| 394 } | 395 } |
| 395 if (!m_transaction->isActive()) { | 396 if (!m_transaction->isActive()) { |
| 396 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); | 397 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
| 397 return nullptr; | 398 return nullptr; |
| 398 } | 399 } |
| 399 if (m_transaction->isReadOnly()) { | 400 if (m_transaction->isReadOnly()) { |
| 400 exceptionState.throwDOMException(ReadOnlyError, IDBDatabase::transaction
ReadOnlyErrorMessage); | 401 exceptionState.throwDOMException(ReadOnlyError, IDBDatabase::transaction
ReadOnlyErrorMessage); |
| 401 return nullptr; | 402 return nullptr; |
| 402 } | 403 } |
| 403 if (!backendDB()) { | 404 if (!backendDB()) { |
| 404 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 405 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 405 return nullptr; | 406 return nullptr; |
| 406 } | 407 } |
| 407 | 408 |
| 408 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 409 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 409 backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(re
quest).leakPtr()); | 410 backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(re
quest).release()); |
| 410 return request; | 411 return request; |
| 411 } | 412 } |
| 412 | 413 |
| 413 namespace { | 414 namespace { |
| 414 // This class creates the index keys for a given index by extracting | 415 // This class creates the index keys for a given index by extracting |
| 415 // them from the SerializedScriptValue, for all the existing values in | 416 // them from the SerializedScriptValue, for all the existing values in |
| 416 // the objectStore. It only needs to be kept alive by virtue of being | 417 // the objectStore. It only needs to be kept alive by virtue of being |
| 417 // a listener on an IDBRequest object, in the same way that JavaScript | 418 // a listener on an IDBRequest object, in the same way that JavaScript |
| 418 // cursor success handlers are kept alive. | 419 // cursor success handlers are kept alive. |
| 419 class IndexPopulator final : public EventListener { | 420 class IndexPopulator final : public EventListener { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } | 659 } |
| 659 | 660 |
| 660 return openCursor(scriptState, keyRange, direction, WebIDBTaskTypeNormal); | 661 return openCursor(scriptState, keyRange, direction, WebIDBTaskTypeNormal); |
| 661 } | 662 } |
| 662 | 663 |
| 663 IDBRequest* IDBObjectStore::openCursor(ScriptState* scriptState, IDBKeyRange* ra
nge, WebIDBCursorDirection direction, WebIDBTaskType taskType) | 664 IDBRequest* IDBObjectStore::openCursor(ScriptState* scriptState, IDBKeyRange* ra
nge, WebIDBCursorDirection direction, WebIDBTaskType taskType) |
| 664 { | 665 { |
| 665 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 666 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 666 request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); | 667 request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); |
| 667 | 668 |
| 668 backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::Invalid
Id, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).leak
Ptr()); | 669 backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::Invalid
Id, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).rele
ase()); |
| 669 return request; | 670 return request; |
| 670 } | 671 } |
| 671 | 672 |
| 672 IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* scriptState, const Script
Value& range, const String& directionString, ExceptionState& exceptionState) | 673 IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* scriptState, const Script
Value& range, const String& directionString, ExceptionState& exceptionState) |
| 673 { | 674 { |
| 674 IDB_TRACE("IDBObjectStore::openKeyCursor"); | 675 IDB_TRACE("IDBObjectStore::openKeyCursor"); |
| 675 if (isDeleted()) { | 676 if (isDeleted()) { |
| 676 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 677 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 677 return nullptr; | 678 return nullptr; |
| 678 } | 679 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 691 return nullptr; | 692 return nullptr; |
| 692 | 693 |
| 693 if (!backendDB()) { | 694 if (!backendDB()) { |
| 694 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 695 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 695 return nullptr; | 696 return nullptr; |
| 696 } | 697 } |
| 697 | 698 |
| 698 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 699 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 699 request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); | 700 request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); |
| 700 | 701 |
| 701 backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::Invalid
Id, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create
(request).leakPtr()); | 702 backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::Invalid
Id, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create
(request).release()); |
| 702 return request; | 703 return request; |
| 703 } | 704 } |
| 704 | 705 |
| 705 IDBRequest* IDBObjectStore::count(ScriptState* scriptState, const ScriptValue& r
ange, ExceptionState& exceptionState) | 706 IDBRequest* IDBObjectStore::count(ScriptState* scriptState, const ScriptValue& r
ange, ExceptionState& exceptionState) |
| 706 { | 707 { |
| 707 IDB_TRACE("IDBObjectStore::count"); | 708 IDB_TRACE("IDBObjectStore::count"); |
| 708 if (isDeleted()) { | 709 if (isDeleted()) { |
| 709 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 710 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 710 return nullptr; | 711 return nullptr; |
| 711 } | 712 } |
| 712 if (m_transaction->isFinished() || m_transaction->isFinishing()) { | 713 if (m_transaction->isFinished() || m_transaction->isFinishing()) { |
| 713 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); | 714 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
| 714 return nullptr; | 715 return nullptr; |
| 715 } | 716 } |
| 716 if (!m_transaction->isActive()) { | 717 if (!m_transaction->isActive()) { |
| 717 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); | 718 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
| 718 return nullptr; | 719 return nullptr; |
| 719 } | 720 } |
| 720 | 721 |
| 721 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->getExecuti
onContext(), range, exceptionState); | 722 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->getExecuti
onContext(), range, exceptionState); |
| 722 if (exceptionState.hadException()) | 723 if (exceptionState.hadException()) |
| 723 return nullptr; | 724 return nullptr; |
| 724 | 725 |
| 725 if (!backendDB()) { | 726 if (!backendDB()) { |
| 726 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 727 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 727 return nullptr; | 728 return nullptr; |
| 728 } | 729 } |
| 729 | 730 |
| 730 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 731 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 731 backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, k
eyRange, WebIDBCallbacksImpl::create(request).leakPtr()); | 732 backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, k
eyRange, WebIDBCallbacksImpl::create(request).release()); |
| 732 return request; | 733 return request; |
| 733 } | 734 } |
| 734 | 735 |
| 735 void IDBObjectStore::abort() | 736 void IDBObjectStore::abort() |
| 736 { | 737 { |
| 737 for (auto& index : m_createdIndexes) | 738 for (auto& index : m_createdIndexes) |
| 738 index->markDeleted(); | 739 index->markDeleted(); |
| 739 } | 740 } |
| 740 | 741 |
| 741 void IDBObjectStore::transactionFinished() | 742 void IDBObjectStore::transactionFinished() |
| (...skipping 16 matching lines...) Expand all Loading... |
| 758 } | 759 } |
| 759 return IDBIndexMetadata::InvalidId; | 760 return IDBIndexMetadata::InvalidId; |
| 760 } | 761 } |
| 761 | 762 |
| 762 WebIDBDatabase* IDBObjectStore::backendDB() const | 763 WebIDBDatabase* IDBObjectStore::backendDB() const |
| 763 { | 764 { |
| 764 return m_transaction->backendDB(); | 765 return m_transaction->backendDB(); |
| 765 } | 766 } |
| 766 | 767 |
| 767 } // namespace blink | 768 } // namespace blink |
| OLD | NEW |