summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-13 16:23:25 +0100
committerBen Murdoch <benm@google.com>2011-05-16 11:35:02 +0100
commit65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch)
treef478babb801e720de7bfaee23443ffe029f58731 /Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp
parent47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff)
downloadexternal_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp')
-rw-r--r--Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp
index 22d3b8d..396f544 100644
--- a/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp
+++ b/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp
@@ -179,6 +179,11 @@ static bool putIndexData(SQLiteDatabase& db, IDBKey* key, int64_t indexId, int64
void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
{
+ if (transactionPtr->mode() == IDBTransaction::READ_ONLY) {
+ ec = IDBDatabaseException::READ_ONLY_ERR;
+ return;
+ }
+
RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
RefPtr<SerializedScriptValue> value = prpValue;
RefPtr<IDBKey> key = prpKey;
@@ -277,9 +282,15 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<
void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
+ if (transaction->mode() == IDBTransaction::READ_ONLY) {
+ ec = IDBDatabaseException::READ_ONLY_ERR;
+ return;
+ }
+
RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
RefPtr<IDBKey> key = prpKey;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
+
if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::deleteInternal, objectStore, key, callbacks)))
ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
@@ -386,6 +397,11 @@ static void doDelete(SQLiteDatabase& db, const char* sql, int64_t id)
void IDBObjectStoreBackendImpl::deleteIndex(const String& name, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
+ if (transaction->mode() != IDBTransaction::VERSION_CHANGE) {
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
+ return;
+ }
+
RefPtr<IDBIndexBackendImpl> index = m_indexes.get(name);
if (!index) {
ec = IDBDatabaseException::NOT_FOUND_ERR;