| Index: Source/modules/indexeddb/IDBObjectStore.cpp
|
| diff --git a/Source/modules/indexeddb/IDBObjectStore.cpp b/Source/modules/indexeddb/IDBObjectStore.cpp
|
| index f9e5b740b5af2b838bc640c3048c5793adc94ee8..5d7bb4a856edd368a7fd6e0dda10f5218da8c062 100644
|
| --- a/Source/modules/indexeddb/IDBObjectStore.cpp
|
| +++ b/Source/modules/indexeddb/IDBObjectStore.cpp
|
| @@ -88,7 +88,7 @@ PassRefPtrWillBeRawPtr<DOMStringList> IDBObjectStore::indexNames() const
|
| return indexNames.release();
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::get(ExecutionContext* context, const ScriptValue& key, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::get(ScriptState* scriptState, const ScriptValue& key, ExceptionState& exceptionState)
|
| {
|
| IDB_TRACE("IDBObjectStore::get");
|
| if (isDeleted()) {
|
| @@ -103,7 +103,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::get(ExecutionContext* context
|
| exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
|
| return nullptr;
|
| }
|
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, exceptionState);
|
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), key, exceptionState);
|
| if (exceptionState.hadException())
|
| return nullptr;
|
| if (!keyRange) {
|
| @@ -115,7 +115,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::get(ExecutionContext* context
|
| return nullptr;
|
| }
|
|
|
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
|
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
|
| backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange.release(), false, WebIDBCallbacksImpl::create(request).leakPtr());
|
| return request.release();
|
| }
|
| @@ -143,25 +143,25 @@ static void generateIndexKeysForValue(v8::Isolate* isolate, const IDBIndexMetada
|
| }
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::add(ExecutionContext* executionContext, ScriptValue& value, const ScriptValue& key, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::add(ScriptState* scriptState, ScriptValue& value, const ScriptValue& key, ExceptionState& exceptionState)
|
| {
|
| IDB_TRACE("IDBObjectStore::add");
|
| - return put(executionContext, WebIDBDatabase::AddOnly, IDBAny::create(this), value, key, exceptionState);
|
| + return put(scriptState, WebIDBDatabase::AddOnly, IDBAny::create(this), value, key, exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executionContext, ScriptValue& value, const ScriptValue& key, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ScriptState* scriptState, ScriptValue& value, const ScriptValue& key, ExceptionState& exceptionState)
|
| {
|
| IDB_TRACE("IDBObjectStore::put");
|
| - return put(executionContext, WebIDBDatabase::AddOrUpdate, IDBAny::create(this), value, key, exceptionState);
|
| + return put(scriptState, WebIDBDatabase::AddOrUpdate, IDBAny::create(this), value, key, exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executionContext, WebIDBDatabase::PutMode putMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue& value, const ScriptValue& keyValue, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ScriptState* scriptState, WebIDBDatabase::PutMode putMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue& value, const ScriptValue& keyValue, ExceptionState& exceptionState)
|
| {
|
| - RefPtrWillBeRawPtr<IDBKey> key = keyValue.isUndefined() ? nullptr : scriptValueToIDBKey(toIsolate(executionContext), keyValue);
|
| - return put(executionContext, putMode, source, value, key.release(), exceptionState);
|
| + RefPtrWillBeRawPtr<IDBKey> key = keyValue.isUndefined() ? nullptr : scriptValueToIDBKey(scriptState->isolate(), keyValue);
|
| + return put(scriptState, putMode, source, value, key.release(), exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executionContext, WebIDBDatabase::PutMode putMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue& value, PassRefPtrWillBeRawPtr<IDBKey> prpKey, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ScriptState* scriptState, WebIDBDatabase::PutMode putMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue& value, PassRefPtrWillBeRawPtr<IDBKey> prpKey, ExceptionState& exceptionState)
|
| {
|
| RefPtrWillBeRawPtr<IDBKey> key = prpKey;
|
| if (isDeleted()) {
|
| @@ -183,7 +183,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi
|
|
|
| Vector<WebBlobInfo> blobInfo;
|
|
|
| - RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, &blobInfo, exceptionState, toIsolate(executionContext));
|
| + RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, &blobInfo, exceptionState, scriptState->isolate());
|
| if (exceptionState.hadException())
|
| return nullptr;
|
|
|
| @@ -207,7 +207,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi
|
| return nullptr;
|
| }
|
| if (usesInLineKeys) {
|
| - RefPtrWillBeRawPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(toIsolate(executionContext), value, keyPath);
|
| + RefPtrWillBeRawPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(scriptState->isolate(), value, keyPath);
|
| if (keyPathKey && !keyPathKey->isValid()) {
|
| exceptionState.throwDOMException(DataError, "Evaluating the object store's key path yielded a value that is not a valid key.");
|
| return nullptr;
|
| @@ -217,7 +217,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi
|
| return nullptr;
|
| }
|
| if (hasKeyGenerator && !keyPathKey) {
|
| - if (!canInjectIDBKeyIntoScriptValue(toIsolate(executionContext), value, keyPath)) {
|
| + if (!canInjectIDBKeyIntoScriptValue(scriptState->isolate(), value, keyPath)) {
|
| exceptionState.throwDOMException(DataError, "A generated key could not be inserted into the value.");
|
| return nullptr;
|
| }
|
| @@ -239,12 +239,12 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi
|
| WillBeHeapVector<IndexKeys> indexKeys;
|
| for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it) {
|
| IndexKeys keys;
|
| - generateIndexKeysForValue(toIsolate(executionContext), it->value, value, &keys);
|
| + generateIndexKeysForValue(scriptState->isolate(), it->value, value, &keys);
|
| indexIds.append(it->key);
|
| indexKeys.append(keys);
|
| }
|
|
|
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(executionContext, source, m_transaction.get());
|
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, source, m_transaction.get());
|
| Vector<char> wireBytes;
|
| serializedValue->toWireBytes(wireBytes);
|
| RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes);
|
| @@ -253,7 +253,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi
|
| return request.release();
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::deleteFunction(ExecutionContext* context, const ScriptValue& key, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::deleteFunction(ScriptState* scriptState, const ScriptValue& key, ExceptionState& exceptionState)
|
| {
|
| IDB_TRACE("IDBObjectStore::delete");
|
| if (isDeleted()) {
|
| @@ -273,7 +273,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::deleteFunction(ExecutionConte
|
| return nullptr;
|
| }
|
|
|
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, exceptionState);
|
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), key, exceptionState);
|
| if (exceptionState.hadException())
|
| return nullptr;
|
| if (!keyRange) {
|
| @@ -285,12 +285,12 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::deleteFunction(ExecutionConte
|
| return nullptr;
|
| }
|
|
|
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
|
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
|
| backendDB()->deleteRange(m_transaction->id(), id(), keyRange.release(), WebIDBCallbacksImpl::create(request).leakPtr());
|
| return request.release();
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::clear(ExecutionContext* context, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::clear(ScriptState* scriptState, ExceptionState& exceptionState)
|
| {
|
| IDB_TRACE("IDBObjectStore::clear");
|
| if (isDeleted()) {
|
| @@ -314,7 +314,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::clear(ExecutionContext* conte
|
| return nullptr;
|
| }
|
|
|
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
|
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
|
| backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(request).leakPtr());
|
| return request.release();
|
| }
|
| @@ -348,8 +348,9 @@ private:
|
| {
|
| }
|
|
|
| - virtual void handleEvent(ExecutionContext* context, Event* event) OVERRIDE
|
| + virtual void handleEvent(ExecutionContext* executionContext, Event* event) OVERRIDE
|
| {
|
| + ASSERT(m_scriptState->executionContext() == executionContext);
|
| ASSERT(event->type() == EventTypeNames::success);
|
| EventTarget* target = event->target();
|
| IDBRequest* request = static_cast<IDBRequest*>(target);
|
| @@ -371,7 +372,7 @@ private:
|
| ScriptValue value = cursor->value(m_scriptState.get());
|
|
|
| IDBObjectStore::IndexKeys indexKeys;
|
| - generateIndexKeysForValue(toIsolate(context), m_indexMetadata, value, &indexKeys);
|
| + generateIndexKeysForValue(m_scriptState->isolate(), m_indexMetadata, value, &indexKeys);
|
|
|
| WillBeHeapVector<IDBObjectStore::IndexKeys> indexKeysList;
|
| indexKeysList.append(indexKeys);
|
| @@ -461,7 +462,7 @@ PassRefPtrWillBeRawPtr<IDBIndex> IDBObjectStore::createIndex(ScriptState* script
|
| if (exceptionState.hadException())
|
| return nullptr;
|
|
|
| - RefPtrWillBeRawPtr<IDBRequest> indexRequest = openCursor(scriptState->executionContext(), static_cast<IDBKeyRange*>(0), blink::WebIDBCursor::Next, WebIDBDatabase::PreemptiveTask);
|
| + RefPtrWillBeRawPtr<IDBRequest> indexRequest = openCursor(scriptState, static_cast<IDBKeyRange*>(0), blink::WebIDBCursor::Next, WebIDBDatabase::PreemptiveTask);
|
| indexRequest->preventPropagation();
|
|
|
| // This is kept alive by being the success handler of the request, which is in turn kept alive by the owning transaction.
|
| @@ -547,7 +548,7 @@ void IDBObjectStore::deleteIndex(const String& name, ExceptionState& exceptionSt
|
| }
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ExecutionContext* context, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ScriptState* scriptState, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState)
|
| {
|
| IDB_TRACE("IDBObjectStore::openCursor");
|
| if (isDeleted()) {
|
| @@ -567,7 +568,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ExecutionContext*
|
| if (exceptionState.hadException())
|
| return nullptr;
|
|
|
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, exceptionState);
|
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState);
|
| if (exceptionState.hadException())
|
| return nullptr;
|
|
|
| @@ -576,19 +577,19 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ExecutionContext*
|
| return nullptr;
|
| }
|
|
|
| - return openCursor(context, keyRange, direction, WebIDBDatabase::NormalTask);
|
| + return openCursor(scriptState, keyRange, direction, WebIDBDatabase::NormalTask);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ExecutionContext* context, PassRefPtrWillBeRawPtr<IDBKeyRange> range, WebIDBCursor::Direction direction, WebIDBDatabase::TaskType taskType)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openCursor(ScriptState* scriptState, PassRefPtrWillBeRawPtr<IDBKeyRange> range, WebIDBCursor::Direction direction, WebIDBDatabase::TaskType taskType)
|
| {
|
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
|
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
|
| request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction);
|
|
|
| backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).leakPtr());
|
| return request.release();
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openKeyCursor(ExecutionContext* context, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openKeyCursor(ScriptState* scriptState, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState)
|
| {
|
| IDB_TRACE("IDBObjectStore::openKeyCursor");
|
| if (isDeleted()) {
|
| @@ -608,7 +609,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openKeyCursor(ExecutionContex
|
| if (exceptionState.hadException())
|
| return nullptr;
|
|
|
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, exceptionState);
|
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState);
|
| if (exceptionState.hadException())
|
| return nullptr;
|
|
|
| @@ -617,14 +618,14 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::openKeyCursor(ExecutionContex
|
| return nullptr;
|
| }
|
|
|
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
|
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
|
| request->setCursorDetails(IndexedDB::CursorKeyOnly, direction);
|
|
|
| backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange.release(), direction, true, WebIDBDatabase::NormalTask, WebIDBCallbacksImpl::create(request).leakPtr());
|
| return request.release();
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::count(ExecutionContext* context, const ScriptValue& range, ExceptionState& exceptionState)
|
| +PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::count(ScriptState* scriptState, const ScriptValue& range, ExceptionState& exceptionState)
|
| {
|
| IDB_TRACE("IDBObjectStore::count");
|
| if (isDeleted()) {
|
| @@ -640,7 +641,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::count(ExecutionContext* conte
|
| return nullptr;
|
| }
|
|
|
| - RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, exceptionState);
|
| + RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState);
|
| if (exceptionState.hadException())
|
| return nullptr;
|
|
|
| @@ -649,7 +650,7 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::count(ExecutionContext* conte
|
| return nullptr;
|
| }
|
|
|
| - RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
|
| + RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
|
| backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange.release(), WebIDBCallbacksImpl::create(request).leakPtr());
|
| return request.release();
|
| }
|
|
|