diff options
Diffstat (limited to 'Source/WebCore/storage')
-rw-r--r-- | Source/WebCore/storage/Database.cpp | 11 | ||||
-rw-r--r-- | Source/WebCore/storage/IDBCursorBackendImpl.cpp | 6 | ||||
-rw-r--r-- | Source/WebCore/storage/IDBDatabase.idl | 2 | ||||
-rw-r--r-- | Source/WebCore/storage/IDBDatabaseException.h | 3 | ||||
-rw-r--r-- | Source/WebCore/storage/IDBDatabaseException.idl | 1 | ||||
-rw-r--r-- | Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp | 16 |
6 files changed, 23 insertions, 16 deletions
diff --git a/Source/WebCore/storage/Database.cpp b/Source/WebCore/storage/Database.cpp index 920f75b..8ef780e 100644 --- a/Source/WebCore/storage/Database.cpp +++ b/Source/WebCore/storage/Database.cpp @@ -36,7 +36,7 @@ #include "DatabaseThread.h" #include "DatabaseTracker.h" #include "Document.h" -#include "InspectorController.h" +#include "InspectorInstrumentation.h" #include "Logging.h" #include "NotImplemented.h" #include "Page.h" @@ -106,13 +106,8 @@ PassRefPtr<Database> Database::openDatabase(ScriptExecutionContext* context, con DatabaseTracker::tracker().setDatabaseDetails(context->securityOrigin(), name, displayName, estimatedSize); context->setHasOpenDatabases(); -#if ENABLE(INSPECTOR) - if (context->isDocument()) { - Document* document = static_cast<Document*>(context); - if (Page* page = document->page()) - page->inspectorController()->didOpenDatabase(database, context->securityOrigin()->host(), name, expectedVersion); - } -#endif + + InspectorInstrumentation::didOpenDatabase(context, database.get(), context->securityOrigin()->host(), name, expectedVersion); // If it's a new database and a creation callback was provided, reset the expected // version to "" and schedule the creation callback. Because of some subtle String diff --git a/Source/WebCore/storage/IDBCursorBackendImpl.cpp b/Source/WebCore/storage/IDBCursorBackendImpl.cpp index 9b4e4f1..d75e28d 100644 --- a/Source/WebCore/storage/IDBCursorBackendImpl.cpp +++ b/Source/WebCore/storage/IDBCursorBackendImpl.cpp @@ -166,12 +166,6 @@ void IDBCursorBackendImpl::deleteFunction(PassRefPtr<IDBCallbacks> prpCallbacks, return; } - // FIXME: Check that the transaction is READ_WRITE - // if (m_transaction->mode() == IDBTransaction::READ_ONLY) { - // FIXME: We must return READ_ONLY_ERR here. Fix this when we update IDBDatabaseException to match the spec. - // ec = IDBDatabaseException::NOT_ALLOWED_ERR; - // return; - // } RefPtr<IDBKey> key = m_currentIDBKeyValue ? m_currentIDBKeyValue : m_currentKey; m_objectStore->deleteFunction(key.release(), prpCallbacks, m_transaction.get(), ec); } diff --git a/Source/WebCore/storage/IDBDatabase.idl b/Source/WebCore/storage/IDBDatabase.idl index c6edd48..7eb43e9 100644 --- a/Source/WebCore/storage/IDBDatabase.idl +++ b/Source/WebCore/storage/IDBDatabase.idl @@ -38,7 +38,7 @@ module storage { raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest setVersion(in DOMString version) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext] IDBTransaction transaction (in [Optional] OptionsObject optionsObject) + [CallWith=ScriptExecutionContext] IDBTransaction transaction(in [Optional] OptionsObject optionsObject) raises (IDBDatabaseException); // FIXME: Implement. //void close(); diff --git a/Source/WebCore/storage/IDBDatabaseException.h b/Source/WebCore/storage/IDBDatabaseException.h index 936b05a..174fe5b 100644 --- a/Source/WebCore/storage/IDBDatabaseException.h +++ b/Source/WebCore/storage/IDBDatabaseException.h @@ -53,7 +53,8 @@ public: RECOVERABLE_ERR = IDBDatabaseExceptionOffset + 8, TRANSIENT_ERR = IDBDatabaseExceptionOffset + 9, TIMEOUT_ERR = IDBDatabaseExceptionOffset + 10, - DEADLOCK_ERR = IDBDatabaseExceptionOffset + 11 + DEADLOCK_ERR = IDBDatabaseExceptionOffset + 11, + READ_ONLY_ERR = IDBDatabaseExceptionOffset + 12 }; static int ErrorCodeToExceptionCode(int errorCode) diff --git a/Source/WebCore/storage/IDBDatabaseException.idl b/Source/WebCore/storage/IDBDatabaseException.idl index a56f4c7..9027e05 100644 --- a/Source/WebCore/storage/IDBDatabaseException.idl +++ b/Source/WebCore/storage/IDBDatabaseException.idl @@ -50,6 +50,7 @@ module storage { const unsigned short TRANSIENT_ERR = 9; const unsigned short TIMEOUT_ERR = 10; const unsigned short DEADLOCK_ERR = 11; + const unsigned short READ_ONLY_ERR = 12; }; } 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; |