[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jorlow at chromium.org
jorlow at chromium.org
Wed Dec 22 14:36:24 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit b49ea0e6af360551cbf78e1604acee18e77c61e3
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 14 00:39:06 2010 +0000
2010-10-13 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Nate Chapin.
IndexedDB should fire some errors synchronously
https://bugs.webkit.org/show_bug.cgi?id=47530
* storage/indexeddb/objectstore-basics-expected.txt:
* storage/indexeddb/objectstore-basics.html:
* storage/indexeddb/objectstore-removeobjectstore-expected.txt:
* storage/indexeddb/objectstore-removeobjectstore.html:
2010-10-13 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Nate Chapin.
IndexedDB should fire some errors synchronously
https://bugs.webkit.org/show_bug.cgi?id=47530
Add dumb plumbing to pass around exception codes.
Utilize that plumbing in the backend to fire some
errors synchronously.
Verify that create/remove* functions are only called
in setVersionTransactions (and raise when not).
Remove plumbing for obsolete IDBDatabase.objectStore
Remove obsolete mode param.
* storage/IDBCursor.cpp:
(WebCore::IDBCursor::update):
(WebCore::IDBCursor::continueFunction):
(WebCore::IDBCursor::remove):
* storage/IDBCursor.h:
(WebCore::IDBCursor::continueFunction):
* storage/IDBCursor.idl:
* storage/IDBCursorBackendImpl.cpp:
(WebCore::IDBCursorBackendImpl::update):
(WebCore::IDBCursorBackendImpl::continueFunction):
(WebCore::IDBCursorBackendImpl::remove):
* storage/IDBCursorBackendImpl.h:
* storage/IDBCursorBackendInterface.h:
* storage/IDBDatabase.cpp:
(WebCore::IDBDatabase::IDBDatabase):
(WebCore::IDBDatabase::createObjectStore):
(WebCore::IDBDatabase::removeObjectStore):
(WebCore::IDBDatabase::setVersion):
(WebCore::IDBDatabase::transaction):
* storage/IDBDatabase.h:
(WebCore::IDBDatabase::createObjectStore):
(WebCore::IDBDatabase::transaction):
* storage/IDBDatabase.idl:
* storage/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::createObjectStore):
(WebCore::IDBDatabaseBackendImpl::objectStore):
(WebCore::IDBDatabaseBackendImpl::removeObjectStore):
(WebCore::IDBDatabaseBackendImpl::setVersion):
(WebCore::IDBDatabaseBackendImpl::transaction):
* storage/IDBDatabaseBackendImpl.h:
* storage/IDBDatabaseBackendInterface.h:
* storage/IDBFactory.cpp:
(WebCore::IDBFactory::open):
* storage/IDBFactory.h:
(WebCore::IDBFactory::open):
* storage/IDBFactory.idl:
* storage/IDBIndex.cpp:
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
(WebCore::IDBIndex::get):
(WebCore::IDBIndex::getKey):
* storage/IDBIndex.h:
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
* storage/IDBIndex.idl:
* storage/IDBIndexBackendImpl.cpp:
(WebCore::IDBIndexBackendImpl::openCursor):
(WebCore::IDBIndexBackendImpl::openKeyCursor):
(WebCore::IDBIndexBackendImpl::get):
(WebCore::IDBIndexBackendImpl::getKey):
* storage/IDBIndexBackendImpl.h:
* storage/IDBIndexBackendInterface.h:
* storage/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::get):
(WebCore::IDBObjectStore::add):
(WebCore::IDBObjectStore::put):
(WebCore::IDBObjectStore::remove):
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::index):
(WebCore::IDBObjectStore::removeIndex):
(WebCore::IDBObjectStore::openCursor):
* storage/IDBObjectStore.h:
(WebCore::IDBObjectStore::add):
(WebCore::IDBObjectStore::put):
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::openCursor):
* storage/IDBObjectStore.idl:
* storage/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::get):
(WebCore::IDBObjectStoreBackendImpl::put):
(WebCore::IDBObjectStoreBackendImpl::remove):
(WebCore::IDBObjectStoreBackendImpl::createIndex):
(WebCore::IDBObjectStoreBackendImpl::index):
(WebCore::IDBObjectStoreBackendImpl::removeIndex):
(WebCore::IDBObjectStoreBackendImpl::openCursor):
* storage/IDBObjectStoreBackendImpl.h:
(WebCore::IDBObjectStoreBackendImpl::name):
(WebCore::IDBObjectStoreBackendImpl::keyPath):
(WebCore::IDBObjectStoreBackendImpl::autoIncrement):
* storage/IDBObjectStoreBackendInterface.h:
* storage/IDBTransaction.cpp:
(WebCore::IDBTransaction::objectStore):
* storage/IDBTransaction.h:
* storage/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::objectStore):
2010-10-13 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Nate Chapin.
IndexedDB should fire some errors synchronously
https://bugs.webkit.org/show_bug.cgi?id=47530
* public/WebIDBCursor.h:
* public/WebIDBDatabase.h:
(WebKit::WebIDBDatabase::transaction):
* public/WebIDBFactory.h:
(WebKit::WebIDBFactory::open):
* public/WebIDBObjectStore.h:
* public/WebIDBTransactionCallbacks.h:
* src/IDBCursorBackendProxy.cpp:
(WebCore::IDBCursorBackendProxy::update):
(WebCore::IDBCursorBackendProxy::continueFunction):
(WebCore::IDBCursorBackendProxy::remove):
* src/IDBCursorBackendProxy.h:
* src/IDBDatabaseProxy.cpp:
(WebCore::IDBDatabaseProxy::createObjectStore):
(WebCore::IDBDatabaseProxy::removeObjectStore):
(WebCore::IDBDatabaseProxy::setVersion):
(WebCore::IDBDatabaseProxy::transaction):
* src/IDBDatabaseProxy.h:
* src/IDBIndexBackendProxy.cpp:
(WebCore::IDBIndexBackendProxy::openCursor):
(WebCore::IDBIndexBackendProxy::openKeyCursor):
(WebCore::IDBIndexBackendProxy::get):
(WebCore::IDBIndexBackendProxy::getKey):
* src/IDBIndexBackendProxy.h:
* src/IDBObjectStoreProxy.cpp:
(WebCore::IDBObjectStoreProxy::get):
(WebCore::IDBObjectStoreProxy::put):
(WebCore::IDBObjectStoreProxy::remove):
(WebCore::IDBObjectStoreProxy::createIndex):
(WebCore::IDBObjectStoreProxy::index):
(WebCore::IDBObjectStoreProxy::removeIndex):
(WebCore::IDBObjectStoreProxy::openCursor):
* src/IDBObjectStoreProxy.h:
* src/WebIDBCursorImpl.cpp:
(WebKit::WebIDBCursorImpl::update):
(WebKit::WebIDBCursorImpl::continueFunction):
(WebKit::WebIDBCursorImpl::remove):
* src/WebIDBCursorImpl.h:
* src/WebIDBDatabaseImpl.cpp:
(WebKit::WebIDBDatabaseImpl::createObjectStore):
(WebKit::WebIDBDatabaseImpl::removeObjectStore):
(WebKit::WebIDBDatabaseImpl::setVersion):
(WebKit::WebIDBDatabaseImpl::transaction):
* src/WebIDBDatabaseImpl.h:
* src/WebIDBIndexImpl.cpp:
(WebKit::WebIDBIndexImpl::openObjectCursor):
(WebKit::WebIDBIndexImpl::openKeyCursor):
(WebKit::WebIDBIndexImpl::getObject):
(WebKit::WebIDBIndexImpl::getKey):
* src/WebIDBIndexImpl.h:
* src/WebIDBObjectStoreImpl.cpp:
(WebKit::WebIDBObjectStoreImpl::get):
(WebKit::WebIDBObjectStoreImpl::put):
(WebKit::WebIDBObjectStoreImpl::remove):
(WebKit::WebIDBObjectStoreImpl::createIndex):
(WebKit::WebIDBObjectStoreImpl::index):
(WebKit::WebIDBObjectStoreImpl::removeIndex):
(WebKit::WebIDBObjectStoreImpl::openCursor):
* src/WebIDBObjectStoreImpl.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b43c0c2..67a983b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-13 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ IndexedDB should fire some errors synchronously
+ https://bugs.webkit.org/show_bug.cgi?id=47530
+
+ * storage/indexeddb/objectstore-basics-expected.txt:
+ * storage/indexeddb/objectstore-basics.html:
+ * storage/indexeddb/objectstore-removeobjectstore-expected.txt:
+ * storage/indexeddb/objectstore-removeobjectstore.html:
+
2010-10-13 Adam Barth <abarth at webkit.org>
Reviewed by Darin Adler.
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
index e14e791..e534e2e 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
@@ -52,8 +52,7 @@ PASS storeNames.contains('storeName') is true
PASS storeNames.length is 1
Ask for an index that doesn't exist:
index = store.index('asdf')
-PASS index is null
-PASS index is null
+PASS Exception thrown.
createIndex():
index = store.createIndex('indexName', 'x', true)
PASS index !== null is true
@@ -62,8 +61,7 @@ index = store.index('indexName')
PASS index !== null is true
Ask for an index that doesn't exist:
index = store.index('asdf')
-PASS index is null
-PASS index is null.
+PASS Exception thrown.
db.setVersion("version fail")
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html
index e50bb27..77e33b0 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics.html
+++ b/LayoutTests/storage/indexeddb/objectstore-basics.html
@@ -59,11 +59,11 @@ function createObjectStore()
debug("Ask for an index that doesn't exist:");
try {
- index = evalAndLog("index = store.index('asdf')");
- shouldBeNull("index"); // Returning null is wrong, but less wrong than returning an actual object!
- testPassed("index is null");
- // FIXME: testFailed("Asking for a store that doesn't exist should have thrown.");
+ debug("index = store.index('asdf')");
+ index = store.index('asdf');
+ testFailed("Asking for a store that doesn't exist should have thrown.");
} catch (err) {
+ testPassed("Exception thrown.");
// FIXME: Verify the correct exception thrown.
}
@@ -78,16 +78,17 @@ function createIndex()
shouldBeTrue("store.indexNames.contains('indexName')");
index = evalAndLog("index = store.index('indexName')");
shouldBeTrue("index !== null");
-
- debug("Ask for an index that doesn't exist:");
- try {
- index = evalAndLog("index = store.index('asdf')");
- shouldBeNull("index"); // Returning null is wrong, but less wrong than returning an actual object!
- testPassed("index is null.");
- // FIXME: testFailed("Asking for a store that doesn't exist should have thrown.");
- } catch (err) {
- // FIXME: Verify the correct exception thrown.
- }
+
+ debug("Ask for an index that doesn't exist:");
+ try {
+ debug("index = store.index('asdf')");
+ index = store.index('asdf');
+ testFailed("Asking for a store that doesn't exist should have thrown.");
+ } catch (err) {
+ testPassed("Exception thrown.");
+ // FIXME: Verify the correct exception thrown.
+ }
+
commitAndContinue();
}
diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
index 50aede5..b6b20a2 100644
--- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
@@ -42,6 +42,8 @@ trans = event.result
PASS trans !== null is true
Deleted all object stores.
store = db.createObjectStore('storeName', null)
+store.createIndex('indexName', '')
+PASS store.indexNames.contains('indexName') is true
store.add('value', 'key')
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
@@ -79,8 +81,6 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.result is "value"
-event.source.createIndex('indexName', '')
-PASS event.source.indexNames.contains('indexName') is true
db.setVersion('new version')
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
index 1067d75..c4418bc 100644
--- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
+++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
@@ -44,7 +44,11 @@ function deleteExisting()
function createObjectStoreAndAddValue()
{
- var store = evalAndLog("store = db.createObjectStore('storeName', null)");
+ store = evalAndLog("store = db.createObjectStore('storeName', null)");
+
+ window.index = evalAndLog("store.createIndex('indexName', '')");
+ shouldBeTrue("store.indexNames.contains('indexName')");
+
result = evalAndLog("store.add('value', 'key')");
verifyResult(result);
result.onsuccess = getValue;
@@ -70,14 +74,6 @@ function addIndex()
verifySuccessEvent(event);
shouldBeEqualToString("event.result", "value");
- window.index = evalAndLog("event.source.createIndex('indexName', '')");
- shouldBeTrue("event.source.indexNames.contains('indexName')");
- // Let the transaction commit.
- window.setTimeout('secondSetVersion()', 0);
-}
-
-function secondSetVersion()
-{
result = evalAndLog("db.setVersion('new version')");
verifyResult(result);
result.onsuccess = removeObjectStore;
@@ -91,7 +87,7 @@ function removeObjectStore()
shouldBeTrue("trans !== null");
trans.onabort = unexpectedAbortCallback;
- evalAndLog("db.removeObjectStore('storeName')");
+ evalAndLog("db.removeObjectStore('storeName')");
createObjectStoreAgain();
}
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f638ff1..452c245 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,104 @@
+2010-10-13 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ IndexedDB should fire some errors synchronously
+ https://bugs.webkit.org/show_bug.cgi?id=47530
+
+ Add dumb plumbing to pass around exception codes.
+ Utilize that plumbing in the backend to fire some
+ errors synchronously.
+ Verify that create/remove* functions are only called
+ in setVersionTransactions (and raise when not).
+ Remove plumbing for obsolete IDBDatabase.objectStore
+ Remove obsolete mode param.
+
+ * storage/IDBCursor.cpp:
+ (WebCore::IDBCursor::update):
+ (WebCore::IDBCursor::continueFunction):
+ (WebCore::IDBCursor::remove):
+ * storage/IDBCursor.h:
+ (WebCore::IDBCursor::continueFunction):
+ * storage/IDBCursor.idl:
+ * storage/IDBCursorBackendImpl.cpp:
+ (WebCore::IDBCursorBackendImpl::update):
+ (WebCore::IDBCursorBackendImpl::continueFunction):
+ (WebCore::IDBCursorBackendImpl::remove):
+ * storage/IDBCursorBackendImpl.h:
+ * storage/IDBCursorBackendInterface.h:
+ * storage/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::IDBDatabase):
+ (WebCore::IDBDatabase::createObjectStore):
+ (WebCore::IDBDatabase::removeObjectStore):
+ (WebCore::IDBDatabase::setVersion):
+ (WebCore::IDBDatabase::transaction):
+ * storage/IDBDatabase.h:
+ (WebCore::IDBDatabase::createObjectStore):
+ (WebCore::IDBDatabase::transaction):
+ * storage/IDBDatabase.idl:
+ * storage/IDBDatabaseBackendImpl.cpp:
+ (WebCore::IDBDatabaseBackendImpl::createObjectStore):
+ (WebCore::IDBDatabaseBackendImpl::objectStore):
+ (WebCore::IDBDatabaseBackendImpl::removeObjectStore):
+ (WebCore::IDBDatabaseBackendImpl::setVersion):
+ (WebCore::IDBDatabaseBackendImpl::transaction):
+ * storage/IDBDatabaseBackendImpl.h:
+ * storage/IDBDatabaseBackendInterface.h:
+ * storage/IDBFactory.cpp:
+ (WebCore::IDBFactory::open):
+ * storage/IDBFactory.h:
+ (WebCore::IDBFactory::open):
+ * storage/IDBFactory.idl:
+ * storage/IDBIndex.cpp:
+ (WebCore::IDBIndex::openCursor):
+ (WebCore::IDBIndex::openKeyCursor):
+ (WebCore::IDBIndex::get):
+ (WebCore::IDBIndex::getKey):
+ * storage/IDBIndex.h:
+ (WebCore::IDBIndex::openCursor):
+ (WebCore::IDBIndex::openKeyCursor):
+ * storage/IDBIndex.idl:
+ * storage/IDBIndexBackendImpl.cpp:
+ (WebCore::IDBIndexBackendImpl::openCursor):
+ (WebCore::IDBIndexBackendImpl::openKeyCursor):
+ (WebCore::IDBIndexBackendImpl::get):
+ (WebCore::IDBIndexBackendImpl::getKey):
+ * storage/IDBIndexBackendImpl.h:
+ * storage/IDBIndexBackendInterface.h:
+ * storage/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::get):
+ (WebCore::IDBObjectStore::add):
+ (WebCore::IDBObjectStore::put):
+ (WebCore::IDBObjectStore::remove):
+ (WebCore::IDBObjectStore::createIndex):
+ (WebCore::IDBObjectStore::index):
+ (WebCore::IDBObjectStore::removeIndex):
+ (WebCore::IDBObjectStore::openCursor):
+ * storage/IDBObjectStore.h:
+ (WebCore::IDBObjectStore::add):
+ (WebCore::IDBObjectStore::put):
+ (WebCore::IDBObjectStore::createIndex):
+ (WebCore::IDBObjectStore::openCursor):
+ * storage/IDBObjectStore.idl:
+ * storage/IDBObjectStoreBackendImpl.cpp:
+ (WebCore::IDBObjectStoreBackendImpl::get):
+ (WebCore::IDBObjectStoreBackendImpl::put):
+ (WebCore::IDBObjectStoreBackendImpl::remove):
+ (WebCore::IDBObjectStoreBackendImpl::createIndex):
+ (WebCore::IDBObjectStoreBackendImpl::index):
+ (WebCore::IDBObjectStoreBackendImpl::removeIndex):
+ (WebCore::IDBObjectStoreBackendImpl::openCursor):
+ * storage/IDBObjectStoreBackendImpl.h:
+ (WebCore::IDBObjectStoreBackendImpl::name):
+ (WebCore::IDBObjectStoreBackendImpl::keyPath):
+ (WebCore::IDBObjectStoreBackendImpl::autoIncrement):
+ * storage/IDBObjectStoreBackendInterface.h:
+ * storage/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::objectStore):
+ * storage/IDBTransaction.h:
+ * storage/IDBTransactionBackendImpl.cpp:
+ (WebCore::IDBTransactionBackendImpl::objectStore):
+
2010-10-13 Sergio Villar Senin <svillar at igalia.com>
Reviewed by Martin Robinson.
diff --git a/WebCore/storage/IDBCursor.cpp b/WebCore/storage/IDBCursor.cpp
index 078a551..1aaff9d 100644
--- a/WebCore/storage/IDBCursor.cpp
+++ b/WebCore/storage/IDBCursor.cpp
@@ -68,26 +68,31 @@ PassRefPtr<IDBAny> IDBCursor::value() const
return m_backend->value();
}
-PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value)
+PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_backend->update(value, request);
+ m_backend->update(value, request, ec);
+ if (ec)
+ return 0;
return request.release();
}
-void IDBCursor::continueFunction(PassRefPtr<IDBKey> key)
+void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec)
{
// FIXME: We're not using the context from when continue was called, which means the callback
// will be on the original context openCursor was called on. Is this right?
if (m_request->resetReadyState(m_transaction.get()))
- m_backend->continueFunction(key, m_request);
- // FIXME: Else throw?
+ m_backend->continueFunction(key, m_request, ec);
+ else
+ ASSERT_NOT_REACHED();
}
-PassRefPtr<IDBRequest> IDBCursor::remove(ScriptExecutionContext* context)
+PassRefPtr<IDBRequest> IDBCursor::remove(ScriptExecutionContext* context, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_backend->remove(request);
+ m_backend->remove(request, ec);
+ if (ec)
+ return 0;
return request.release();
}
diff --git a/WebCore/storage/IDBCursor.h b/WebCore/storage/IDBCursor.h
index 5ad2d61..6f3a940 100644
--- a/WebCore/storage/IDBCursor.h
+++ b/WebCore/storage/IDBCursor.h
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include "ExceptionCode.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -57,13 +58,16 @@ public:
}
~IDBCursor();
+ // FIXME: Try to modify the code generator so this is unneeded.
+ void continueFunction(ExceptionCode& ec) { continueFunction(0, ec); }
+
// Implement the IDL
unsigned short direction() const;
PassRefPtr<IDBKey> key() const;
PassRefPtr<IDBAny> value() const;
- PassRefPtr<IDBRequest> update(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>);
- void continueFunction(PassRefPtr<IDBKey> = 0);
- PassRefPtr<IDBRequest> remove(ScriptExecutionContext*);
+ PassRefPtr<IDBRequest> update(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, ExceptionCode&);
+ void continueFunction(PassRefPtr<IDBKey>, ExceptionCode&);
+ PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, ExceptionCode&);
private:
explicit IDBCursor(PassRefPtr<IDBCursorBackendInterface>, IDBRequest*, IDBTransactionBackendInterface*);
diff --git a/WebCore/storage/IDBCursor.idl b/WebCore/storage/IDBCursor.idl
index 232842b..0cef3f9 100644
--- a/WebCore/storage/IDBCursor.idl
+++ b/WebCore/storage/IDBCursor.idl
@@ -37,8 +37,11 @@ module storage {
readonly attribute IDBKey key;
readonly attribute IDBAny value;
- [CallWith=ScriptExecutionContext] IDBRequest update(in SerializedScriptValue value);
- [ImplementationFunction=continueFunction] void continue(in [Optional] IDBKey key);
- [CallWith=ScriptExecutionContext] IDBRequest remove();
+ [CallWith=ScriptExecutionContext] IDBRequest update(in SerializedScriptValue value)
+ raises (IDBDatabaseException);
+ [ImplementationFunction=continueFunction] void continue(in [Optional] IDBKey key)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest remove()
+ raises (IDBDatabaseException);
};
}
diff --git a/WebCore/storage/IDBCursorBackendImpl.cpp b/WebCore/storage/IDBCursorBackendImpl.cpp
index fa2855c..40b46c6 100644
--- a/WebCore/storage/IDBCursorBackendImpl.cpp
+++ b/WebCore/storage/IDBCursorBackendImpl.cpp
@@ -88,13 +88,14 @@ PassRefPtr<IDBAny> IDBCursorBackendImpl::value() const
return IDBAny::create(m_currentIDBKeyValue.get());
}
-void IDBCursorBackendImpl::update(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBCallbacks> prpCallbacks)
+void IDBCursorBackendImpl::update(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec)
{
RefPtr<IDBCursorBackendImpl> cursor = this;
RefPtr<SerializedScriptValue> value = prpValue;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
+ // FIXME: Throw DATA_ERR and SERIAL_ERR when appropriate.
if (!m_transaction->scheduleTask(createCallbackTask(&IDBCursorBackendImpl::updateInternal, cursor, value, callbacks)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "update must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
void IDBCursorBackendImpl::updateInternal(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl> cursor, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBCallbacks> callbacks)
@@ -126,13 +127,13 @@ void IDBCursorBackendImpl::updateInternal(ScriptExecutionContext*, PassRefPtr<ID
callbacks->onSuccess();
}
-void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks)
+void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec)
{
RefPtr<IDBCursorBackendImpl> cursor = this;
RefPtr<IDBKey> key = prpKey;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
if (!m_transaction->scheduleTask(createCallbackTask(&IDBCursorBackendImpl::continueFunctionInternal, cursor, key, callbacks)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "continue must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
void IDBCursorBackendImpl::continueFunctionInternal(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl> prpCursor, PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> callbacks)
@@ -167,12 +168,12 @@ void IDBCursorBackendImpl::continueFunctionInternal(ScriptExecutionContext*, Pas
callbacks->onSuccess(cursor.get());
}
-void IDBCursorBackendImpl::remove(PassRefPtr<IDBCallbacks> prpCallbacks)
+void IDBCursorBackendImpl::remove(PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec)
{
RefPtr<IDBCursorBackendImpl> cursor = this;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
if (!m_transaction->scheduleTask(createCallbackTask(&IDBCursorBackendImpl::removeInternal, cursor, callbacks)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "remove must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
void IDBCursorBackendImpl::removeInternal(ScriptExecutionContext*, PassRefPtr<IDBCursorBackendImpl> cursor, PassRefPtr<IDBCallbacks> callbacks)
diff --git a/WebCore/storage/IDBCursorBackendImpl.h b/WebCore/storage/IDBCursorBackendImpl.h
index 211d38d..5dd45f2 100644
--- a/WebCore/storage/IDBCursorBackendImpl.h
+++ b/WebCore/storage/IDBCursorBackendImpl.h
@@ -60,9 +60,9 @@ public:
virtual unsigned short direction() const;
virtual PassRefPtr<IDBKey> key() const;
virtual PassRefPtr<IDBAny> value() const;
- virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>);
- virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>);
- virtual void remove(PassRefPtr<IDBCallbacks>);
+ virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>, ExceptionCode&);
+ virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, ExceptionCode&);
+ virtual void remove(PassRefPtr<IDBCallbacks>, ExceptionCode&);
private:
IDBCursorBackendImpl(PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, IDBCursor::Direction, PassOwnPtr<SQLiteStatement> query, IDBTransactionBackendInterface*);
diff --git a/WebCore/storage/IDBCursorBackendInterface.h b/WebCore/storage/IDBCursorBackendInterface.h
index 4b209c4..e1ac274 100644
--- a/WebCore/storage/IDBCursorBackendInterface.h
+++ b/WebCore/storage/IDBCursorBackendInterface.h
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include "ExceptionCode.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Threading.h>
@@ -48,9 +49,9 @@ public:
virtual PassRefPtr<IDBKey> key() const = 0;
virtual PassRefPtr<IDBAny> value() const = 0;
- virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>) = 0;
- virtual void continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0;
- virtual void remove(PassRefPtr<IDBCallbacks>) = 0;
+ virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0;
+ virtual void continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0;
+ virtual void remove(PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp
index 45f4976..1ee0fa9 100644
--- a/WebCore/storage/IDBDatabase.cpp
+++ b/WebCore/storage/IDBDatabase.cpp
@@ -30,6 +30,7 @@
#include "IDBDatabaseError.h"
#include "IDBDatabaseException.h"
#include "IDBFactoryBackendInterface.h"
+#include "IDBIndex.h"
#include "IDBObjectStore.h"
#include "IDBRequest.h"
#include "IDBTransaction.h"
@@ -42,7 +43,7 @@ namespace WebCore {
IDBDatabase::IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface> backend)
: m_backend(backend)
{
- // We pass a reference to this object before it can be adopted.
+ // We pass a reference of this object before it can be adopted.
relaxAdoptionRequirement();
}
@@ -55,41 +56,43 @@ void IDBDatabase::setSetVersionTransaction(IDBTransactionBackendInterface* trans
m_setVersionTransaction = transaction;
}
-PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const String& keyPath, bool autoIncrement)
+PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, ExceptionCode& ec)
{
if (!m_setVersionTransaction) {
- // FIXME: Raise a NOT_ALLOWED_ERR if m_setVersionTransaction is 0.
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
return 0;
}
- RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->createObjectStore(name, keyPath, autoIncrement, m_setVersionTransaction.get());
+ RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->createObjectStore(name, keyPath, autoIncrement, m_setVersionTransaction.get(), ec);
if (!objectStore)
return 0;
return IDBObjectStore::create(objectStore.release(), m_setVersionTransaction.get());
}
-void IDBDatabase::removeObjectStore(const String& name)
+void IDBDatabase::removeObjectStore(const String& name, ExceptionCode& ec)
{
- // FIXME: Raise a NOT_ALLOWED_ERR if m_setVersionTransaction is 0.
- if (!m_setVersionTransaction)
+ if (!m_setVersionTransaction) {
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
return;
- m_backend->removeObjectStore(name, m_setVersionTransaction.get());
+ }
+
+ m_backend->removeObjectStore(name, m_setVersionTransaction.get(), ec);
}
-PassRefPtr<IDBRequest> IDBDatabase::setVersion(ScriptExecutionContext* context, const String& version)
+PassRefPtr<IDBRequest> IDBDatabase::setVersion(ScriptExecutionContext* context, const String& version, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0);
- m_backend->setVersion(version, request);
+ m_backend->setVersion(version, request, ec);
return request;
}
-PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, DOMStringList* storeNames, unsigned short mode, unsigned long timeout)
+PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, DOMStringList* storeNames, unsigned short mode, unsigned long timeout, ExceptionCode& ec)
{
// We need to create a new transaction synchronously. Locks are acquired asynchronously. Operations
// can be queued against the transaction at any point. They will start executing as soon as the
// appropriate locks have been acquired.
// Also note that each backend object corresponds to exactly one IDBTransaction object.
- RefPtr<IDBTransactionBackendInterface> transactionBackend = m_backend->transaction(storeNames, mode, timeout);
+ RefPtr<IDBTransactionBackendInterface> transactionBackend = m_backend->transaction(storeNames, mode, timeout, ec);
RefPtr<IDBTransaction> transaction = IDBTransaction::create(context, transactionBackend, this);
transactionBackend->setCallbacks(transaction.get());
return transaction.release();
diff --git a/WebCore/storage/IDBDatabase.h b/WebCore/storage/IDBDatabase.h
index 43837d9..df56f46 100644
--- a/WebCore/storage/IDBDatabase.h
+++ b/WebCore/storage/IDBDatabase.h
@@ -27,7 +27,9 @@
#define IDBDatabase_h
#include "DOMStringList.h"
+#include "ExceptionCode.h"
#include "IDBDatabaseBackendInterface.h"
+#include "IDBObjectStore.h"
#include "IDBTransaction.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -38,7 +40,6 @@
namespace WebCore {
class IDBAny;
-class IDBObjectStore;
class IDBRequest;
class ScriptExecutionContext;
@@ -57,11 +58,17 @@ public:
String version() const { return m_backend->version(); }
PassRefPtr<DOMStringList> objectStores() const { return m_backend->objectStores(); }
- PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const String& keyPath = String(), bool autoIncrement = false);
- void removeObjectStore(const String& name);
- PassRefPtr<IDBRequest> setVersion(ScriptExecutionContext*, const String& version);
- PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, DOMStringList* storeNames = 0, unsigned short mode = IDBTransaction::READ_ONLY,
- unsigned long timeout = 0); // FIXME: what should the default timeout be?
+ // FIXME: Try to modify the code generator so this is unneeded.
+ PassRefPtr<IDBObjectStore> createObjectStore(const String& name, ExceptionCode& ec) { return createObjectStore(name, String(), ec); }
+ PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const String& keyPath, ExceptionCode& ec) { return createObjectStore(name, keyPath, false, ec); }
+ PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext* context, ExceptionCode& ec) { return transaction(context, 0, ec); }
+ PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext* context, DOMStringList* storeNames, ExceptionCode& ec) { return transaction(context, storeNames, IDBTransaction::READ_ONLY, ec); }
+ PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext* context, DOMStringList* storeNames, unsigned short mode, ExceptionCode& ec) { return transaction(context, storeNames, mode, 0, ec); } // FIXME: what should the default timeout be?
+
+ PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, ExceptionCode&);
+ void removeObjectStore(const String& name, ExceptionCode&);
+ PassRefPtr<IDBRequest> setVersion(ScriptExecutionContext*, const String& version, ExceptionCode&);
+ PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, DOMStringList*, unsigned short mode, unsigned long timeout, ExceptionCode&);
void close();
private:
diff --git a/WebCore/storage/IDBDatabase.idl b/WebCore/storage/IDBDatabase.idl
index 3f57437..b529c9a 100644
--- a/WebCore/storage/IDBDatabase.idl
+++ b/WebCore/storage/IDBDatabase.idl
@@ -32,10 +32,14 @@ module storage {
readonly attribute DOMString version;
readonly attribute DOMStringList objectStores;
- IDBObjectStore createObjectStore(in DOMString name, in [Optional, ConvertNullToNullString] DOMString keyPath, in [Optional] boolean autoIncrement);
- void removeObjectStore(in DOMString name);
- [CallWith=ScriptExecutionContext] IDBRequest setVersion(in DOMString version);
- [CallWith=ScriptExecutionContext] IDBTransaction transaction (in [Optional] DOMStringList storeNames, in [Optional] unsigned short mode, in [Optional] unsigned long timeout);
+ IDBObjectStore createObjectStore(in DOMString name, in [Optional, ConvertNullToNullString] DOMString keyPath, in [Optional] boolean autoIncrement)
+ raises (IDBDatabaseException);
+ void removeObjectStore(in DOMString name)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest setVersion(in DOMString version)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBTransaction transaction (in [Optional] DOMStringList storeNames, in [Optional] unsigned short mode, in [Optional] unsigned long timeout)
+ raises (IDBDatabaseException);
void close();
};
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp
index 0401ffe..86637f0 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.cpp
+++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp
@@ -127,7 +127,7 @@ PassRefPtr<DOMStringList> IDBDatabaseBackendImpl::objectStores() const
return objectStoreNames.release();
}
-PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr)
+PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
{
if (m_objectStores.contains(name)) {
// FIXME: Throw CONSTRAINT_ERR in this case.
@@ -167,12 +167,9 @@ void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*,
transaction->didCompleteTaskEvents();
}
-// FIXME: Do not expose this method via IDL.
-PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::objectStore(const String& name, unsigned short mode)
+PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::objectStore(const String& name)
{
- ASSERT_UNUSED(mode, !mode); // FIXME: Remove the mode parameter. Transactions have modes, not object stores.
- RefPtr<IDBObjectStoreBackendInterface> objectStore = m_objectStores.get(name);
- return objectStore.release();
+ return m_objectStores.get(name);
}
static void doDelete(SQLiteDatabase& db, const char* sql, int64_t id)
@@ -185,18 +182,18 @@ static void doDelete(SQLiteDatabase& db, const char* sql, int64_t id)
ASSERT_UNUSED(ok, ok); // FIXME: Better error handling.
}
-void IDBDatabaseBackendImpl::removeObjectStore(const String& name, IDBTransactionBackendInterface* transactionPtr)
+void IDBDatabaseBackendImpl::removeObjectStore(const String& name, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
{
RefPtr<IDBObjectStoreBackendImpl> objectStore = m_objectStores.get(name);
if (!objectStore) {
- // FIXME: Raise NOT_FOUND_ERR.
+ ec = IDBDatabaseException::NOT_FOUND_ERR;
return;
}
RefPtr<IDBDatabaseBackendImpl> database = this;
RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr;
if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::removeObjectStoreInternal, database, objectStore, transaction),
createCallbackTask(&IDBDatabaseBackendImpl::addObjectStoreToMap, database, objectStore))) {
- // FIXME: Raise NOT_ALLOWED_ERR if the above fails.
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
return;
}
m_objectStores.remove(name);
@@ -212,7 +209,7 @@ void IDBDatabaseBackendImpl::removeObjectStoreInternal(ScriptExecutionContext*,
transaction->didCompleteTaskEvents();
}
-void IDBDatabaseBackendImpl::setVersion(const String& version, PassRefPtr<IDBCallbacks> prpCallbacks)
+void IDBDatabaseBackendImpl::setVersion(const String& version, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec)
{
RefPtr<IDBDatabaseBackendImpl> database = this;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
@@ -220,7 +217,7 @@ void IDBDatabaseBackendImpl::setVersion(const String& version, PassRefPtr<IDBCal
RefPtr<IDBTransactionBackendInterface> transaction = m_transactionCoordinator->createTransaction(objectStores.get(), IDBTransaction::VERSION_CHANGE, 0, this);
if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::setVersionInternal, database, version, callbacks, transaction),
createCallbackTask(&IDBDatabaseBackendImpl::resetVersion, database, m_version))) {
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "setVersion must be called from within a setVersion transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
}
@@ -236,8 +233,9 @@ void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRef
callbacks->onSuccess(transaction);
}
-PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout)
+PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, ExceptionCode&)
{
+ // FIXME: Return not allowed err if close has been called.
return m_transactionCoordinator->createTransaction(objectStores, mode, timeout, this);
}
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h
index 84bd42c..bb6429c 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.h
+++ b/WebCore/storage/IDBDatabaseBackendImpl.h
@@ -55,13 +55,13 @@ public:
virtual String version() const { return m_version; }
virtual PassRefPtr<DOMStringList> objectStores() const;
- virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface*);
- virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode);
- virtual void removeObjectStore(const String& name, IDBTransactionBackendInterface*);
- virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>);
- virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout);
+ virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void removeObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, ExceptionCode&);
+ virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout, ExceptionCode&);
virtual void close();
+ PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name);
IDBTransactionCoordinator* transactionCoordinator() const { return m_transactionCoordinator.get(); }
private:
diff --git a/WebCore/storage/IDBDatabaseBackendInterface.h b/WebCore/storage/IDBDatabaseBackendInterface.h
index 4a5bb41..4b0255d 100644
--- a/WebCore/storage/IDBDatabaseBackendInterface.h
+++ b/WebCore/storage/IDBDatabaseBackendInterface.h
@@ -26,6 +26,7 @@
#ifndef IDBDatabaseBackendInterface_h
#define IDBDatabaseBackendInterface_h
+#include "ExceptionCode.h"
#include "PlatformString.h"
#include <wtf/PassRefPtr.h>
#include <wtf/Threading.h>
@@ -54,11 +55,10 @@ public:
virtual String version() const = 0;
virtual PassRefPtr<DOMStringList> objectStores() const = 0;
- virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface*) = 0;
- virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode) = 0;
- virtual void removeObjectStore(const String& name, IDBTransactionBackendInterface*) = 0;
- virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>) = 0;
- virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout) = 0;
+ virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
+ virtual void removeObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
+ virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, ExceptionCode&) = 0;
+ virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout, ExceptionCode&) = 0;
virtual void close() = 0;
};
diff --git a/WebCore/storage/IDBFactory.cpp b/WebCore/storage/IDBFactory.cpp
index 23dbbca..a9ec429 100644
--- a/WebCore/storage/IDBFactory.cpp
+++ b/WebCore/storage/IDBFactory.cpp
@@ -56,7 +56,7 @@ IDBFactory::~IDBFactory()
{
}
-PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, const String& description)
+PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, const String& description, ExceptionCode& ec)
{
if (!context->isDocument()) {
// FIXME: make this work with workers.
@@ -67,6 +67,9 @@ PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const S
if (!document->frame() || !document->page())
return 0;
+
+ // FIXME: Raise a NON_TRANSIENT_ERR if the name is invalid.
+
RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this), 0);
GroupSettings* groupSettings = document->page()->group().groupSettings();
m_factoryBackend->open(name, description, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath(), groupSettings->indexedDBQuotaBytes());
diff --git a/WebCore/storage/IDBFactory.h b/WebCore/storage/IDBFactory.h
index a96aa38..cbdda93 100644
--- a/WebCore/storage/IDBFactory.h
+++ b/WebCore/storage/IDBFactory.h
@@ -31,6 +31,7 @@
#include "DOMStringList.h"
#include "ExceptionCode.h"
#include "IDBFactoryBackendInterface.h"
+#include "IDBRequest.h"
#include "PlatformString.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -42,7 +43,6 @@ namespace WebCore {
class IDBKey;
class IDBKeyRange;
-class IDBRequest;
class IDBFactoryBackendInterface;
class ScriptExecutionContext;
@@ -54,7 +54,10 @@ public:
}
~IDBFactory();
- PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description = String());
+ // FIXME: Try to modify the code generator so this is unneeded.
+ PassRefPtr<IDBRequest> open(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { return open(context, name, String(), ec); }
+
+ PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description, ExceptionCode&);
private:
IDBFactory(IDBFactoryBackendInterface*);
diff --git a/WebCore/storage/IDBFactory.idl b/WebCore/storage/IDBFactory.idl
index 215d67c..a5a9e53 100644
--- a/WebCore/storage/IDBFactory.idl
+++ b/WebCore/storage/IDBFactory.idl
@@ -28,7 +28,8 @@ module storage {
interface [
Conditional=INDEXED_DATABASE
] IDBFactory {
- [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in [Optional, ConvertUndefinedOrNullToNullString] DOMString description);
+ [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in [Optional, ConvertUndefinedOrNullToNullString] DOMString description)
+ raises (IDBDatabaseException);
};
}
diff --git a/WebCore/storage/IDBIndex.cpp b/WebCore/storage/IDBIndex.cpp
index baaef0a..a008470 100644
--- a/WebCore/storage/IDBIndex.cpp
+++ b/WebCore/storage/IDBIndex.cpp
@@ -49,31 +49,39 @@ IDBIndex::~IDBIndex()
{
}
-PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction)
+PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_backend->openCursor(keyRange, direction, request, m_transaction.get());
+ m_backend->openCursor(keyRange, direction, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request;
}
-PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction)
+PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_backend->openKeyCursor(keyRange, direction, request, m_transaction.get());
+ m_backend->openKeyCursor(keyRange, direction, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request;
}
-PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_backend->get(key, request, m_transaction.get());
+ m_backend->get(key, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request;
}
-PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_backend->getKey(key, request, m_transaction.get());
+ m_backend->getKey(key, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request;
}
diff --git a/WebCore/storage/IDBIndex.h b/WebCore/storage/IDBIndex.h
index ae39c13..4a1a666 100644
--- a/WebCore/storage/IDBIndex.h
+++ b/WebCore/storage/IDBIndex.h
@@ -28,6 +28,8 @@
#include "IDBCursor.h"
#include "IDBIndexBackendInterface.h"
+#include "IDBKeyRange.h"
+#include "IDBRequest.h"
#include "PlatformString.h"
#include <wtf/Forward.h>
@@ -49,10 +51,16 @@ public:
String keyPath() const { return m_backend->keyPath(); }
bool unique() const { return m_backend->unique(); }
- PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange> = 0, unsigned short direction = IDBCursor::NEXT);
- PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange> = 0, unsigned short direction = IDBCursor::NEXT);
- PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>);
- PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, PassRefPtr<IDBKey>);
+ // FIXME: Try to modify the code generator so this is unneeded.
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, 0, ec); }
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::NEXT, ec); }
+ PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openKeyCursor(context, 0, ec); }
+ PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openKeyCursor(context, keyRange, IDBCursor::NEXT, ec); }
+
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&);
+ PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&);
+ PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
+ PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
private:
IDBIndex(PassRefPtr<IDBIndexBackendInterface>, IDBTransactionBackendInterface* transaction);
diff --git a/WebCore/storage/IDBIndex.idl b/WebCore/storage/IDBIndex.idl
index b0548ae..7c2c962 100644
--- a/WebCore/storage/IDBIndex.idl
+++ b/WebCore/storage/IDBIndex.idl
@@ -33,11 +33,14 @@ module storage {
readonly attribute DOMString keyPath;
readonly attribute boolean unique;
- // FIXME: All of these should raise on certain errors.
- [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction);
- [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction);
- [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key);
- [CallWith=ScriptExecutionContext] IDBRequest getKey(in IDBKey key);
+ [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest getKey(in IDBKey key)
+ raises (IDBDatabaseException);
};
}
diff --git a/WebCore/storage/IDBIndexBackendImpl.cpp b/WebCore/storage/IDBIndexBackendImpl.cpp
index 39cbd72..2a991fa 100644
--- a/WebCore/storage/IDBIndexBackendImpl.cpp
+++ b/WebCore/storage/IDBIndexBackendImpl.cpp
@@ -110,24 +110,24 @@ void IDBIndexBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr
callbacks->onSuccess(cursor.release());
}
-void IDBIndexBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr)
+void IDBIndexBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
{
RefPtr<IDBIndexBackendImpl> index = this;
RefPtr<IDBKeyRange> keyRange = prpKeyRange;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr;
if (!transaction->scheduleTask(createCallbackTask(&openCursorInternal, index, keyRange, direction, true, callbacks, transaction)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "Get must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
-void IDBIndexBackendImpl::openKeyCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr)
+void IDBIndexBackendImpl::openKeyCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
{
RefPtr<IDBIndexBackendImpl> index = this;
RefPtr<IDBKeyRange> keyRange = prpKeyRange;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr;
if (!transaction->scheduleTask(createCallbackTask(&openCursorInternal, index, keyRange, direction, false, callbacks, transaction)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "Get must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
void IDBIndexBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBKey> key, bool getObject, PassRefPtr<IDBCallbacks> callbacks)
@@ -155,22 +155,22 @@ void IDBIndexBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBInd
ASSERT(query.step() != SQLResultRow);
}
-void IDBIndexBackendImpl::get(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction)
+void IDBIndexBackendImpl::get(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
RefPtr<IDBIndexBackendImpl> index = this;
RefPtr<IDBKey> key = prpKey;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
if (!transaction->scheduleTask(createCallbackTask(&getInternal, index, key, true, callbacks)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "Get must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
-void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction)
+void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
RefPtr<IDBIndexBackendImpl> index = this;
RefPtr<IDBKey> key = prpKey;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
if (!transaction->scheduleTask(createCallbackTask(&getInternal, index, key, false, callbacks)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "Get must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
static String whereClause(IDBKey* key)
diff --git a/WebCore/storage/IDBIndexBackendImpl.h b/WebCore/storage/IDBIndexBackendImpl.h
index 4572a3f..d5e81ae 100644
--- a/WebCore/storage/IDBIndexBackendImpl.h
+++ b/WebCore/storage/IDBIndexBackendImpl.h
@@ -64,10 +64,10 @@ public:
virtual String keyPath() { return m_keyPath; }
virtual bool unique() { return m_unique; }
- virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- virtual void getKey(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+ virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void getKey(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
IDBObjectStoreBackendImpl* objectStore() const { return m_objectStore.get(); }
diff --git a/WebCore/storage/IDBIndexBackendInterface.h b/WebCore/storage/IDBIndexBackendInterface.h
index 798ca38..e0e578d 100644
--- a/WebCore/storage/IDBIndexBackendInterface.h
+++ b/WebCore/storage/IDBIndexBackendInterface.h
@@ -26,6 +26,7 @@
#ifndef IDBIndexBackendInterface_h
#define IDBIndexBackendInterface_h
+#include "ExceptionCode.h"
#include "PlatformString.h"
#include <wtf/Forward.h>
@@ -47,10 +48,10 @@ public:
virtual String keyPath() = 0;
virtual bool unique() = 0;
- virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
- virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
- virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
- virtual void getKey(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
+ virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
+ virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
+ virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
+ virtual void getKey(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBObjectStore.cpp b/WebCore/storage/IDBObjectStore.cpp
index c481099..c30243e 100644
--- a/WebCore/storage/IDBObjectStore.cpp
+++ b/WebCore/storage/IDBObjectStore.cpp
@@ -64,60 +64,71 @@ PassRefPtr<DOMStringList> IDBObjectStore::indexNames() const
return m_objectStore->indexNames();
}
-PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_objectStore->get(key, request, m_transaction.get());
+ m_objectStore->get(key, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request.release();
}
-PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_objectStore->put(value, key, true, request, m_transaction.get());
+ m_objectStore->put(value, key, true, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request;
}
-PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_objectStore->put(value, key, false, request, m_transaction.get());
+ m_objectStore->put(value, key, false, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request;
}
-PassRefPtr<IDBRequest> IDBObjectStore::remove(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+PassRefPtr<IDBRequest> IDBObjectStore::remove(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_objectStore->remove(key, request, m_transaction.get());
+ m_objectStore->remove(key, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request;
}
-PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const String& keyPath, bool unique)
+PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const String& keyPath, bool unique, ExceptionCode& ec)
{
- RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, m_transaction.get());
+ RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, m_transaction.get(), ec);
+ ASSERT(!index != !ec); // If we didn't get an index, we should have gotten an exception code. And vice versa.
if (!index)
return 0;
return IDBIndex::create(index.release(), m_transaction.get());
}
-PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name)
+PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name, ExceptionCode& ec)
{
- // FIXME: If this is null, we should raise a NOT_FOUND_ERR.
- RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name);
+ RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name, ec);
+ ASSERT(!index != !ec); // If we didn't get an index, we should have gotten an exception code. And vice versa.
if (!index)
return 0;
return IDBIndex::create(index.release(), m_transaction.get());
}
-void IDBObjectStore::removeIndex(const String& name)
+void IDBObjectStore::removeIndex(const String& name, ExceptionCode& ec)
{
- m_objectStore->removeIndex(name, m_transaction.get());
+ m_objectStore->removeIndex(name, m_transaction.get(), ec);
}
-PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction)
+PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction, ExceptionCode& ec)
{
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
- m_objectStore->openCursor(range, direction, request, m_transaction.get());
+ m_objectStore->openCursor(range, direction, request, m_transaction.get(), ec);
+ if (ec)
+ return 0;
return request.release();
}
diff --git a/WebCore/storage/IDBObjectStore.h b/WebCore/storage/IDBObjectStore.h
index a173b68..dc92233 100644
--- a/WebCore/storage/IDBObjectStore.h
+++ b/WebCore/storage/IDBObjectStore.h
@@ -27,10 +27,13 @@
#define IDBObjectStore_h
#include "IDBCursor.h"
+#include "IDBIndex.h"
+#include "IDBKey.h"
#include "IDBKeyRange.h"
#include "IDBObjectStoreBackendInterface.h"
#include "IDBRequest.h"
#include "PlatformString.h"
+#include "SerializedScriptValue.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -41,10 +44,7 @@ namespace WebCore {
class DOMStringList;
class IDBAny;
-class IDBIndexRequest;
-class IDBKey;
class IDBTransactionBackendInterface;
-class SerializedScriptValue;
class IDBObjectStore : public RefCounted<IDBObjectStore> {
public:
@@ -58,16 +58,23 @@ public:
String keyPath() const;
PassRefPtr<DOMStringList> indexNames() const;
- PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey> key);
- PassRefPtr<IDBRequest> add(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key = 0);
- PassRefPtr<IDBRequest> put(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key = 0);
- PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<IDBKey> key);
+ // FIXME: Try to modify the code generator so this is unneeded.
+ PassRefPtr<IDBRequest> add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, ExceptionCode& ec) { return add(context, value, 0, ec); }
+ PassRefPtr<IDBRequest> put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, ExceptionCode& ec) { return put(context, value, 0, ec); }
+ PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, ExceptionCode& ec) { return createIndex(name, keyPath, false, ec); }
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, 0, ec); }
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::NEXT, ec); }
- PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, bool unique = false);
- PassRefPtr<IDBIndex> index(const String& name);
- void removeIndex(const String& name);
+ PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
+ PassRefPtr<IDBRequest> add(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&);
+ PassRefPtr<IDBRequest> put(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&);
+ PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<IDBKey> key, ExceptionCode&);
- PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange> = 0, unsigned short direction = IDBCursor::NEXT);
+ PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, bool unique, ExceptionCode&);
+ PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&);
+ void removeIndex(const String& name, ExceptionCode&);
+
+ PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&);
private:
IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface>, IDBTransactionBackendInterface* transaction);
diff --git a/WebCore/storage/IDBObjectStore.idl b/WebCore/storage/IDBObjectStore.idl
index ef3aad8..31eb865 100644
--- a/WebCore/storage/IDBObjectStore.idl
+++ b/WebCore/storage/IDBObjectStore.idl
@@ -32,17 +32,21 @@ module storage {
readonly attribute [ConvertNullStringTo=Null] DOMString keyPath;
readonly attribute DOMStringList indexNames;
- // FIXME: Many of these should raise on certain errors.
- [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key);
- [CallWith=ScriptExecutionContext] IDBRequest add(in SerializedScriptValue value, in [Optional] IDBKey key);
- [CallWith=ScriptExecutionContext] IDBRequest put(in SerializedScriptValue value, in [Optional] IDBKey key);
- [CallWith=ScriptExecutionContext] IDBRequest remove(in IDBKey key);
- // FIXME: write openCursor
- IDBIndex createIndex(in DOMString name, in [ConvertNullToNullString] DOMString keyPath, in [Optional] boolean unique);
- // FIXME: This needs to raise an IDBDatabaseException on errors.
- IDBIndex index(in DOMString name);
- void removeIndex(in DOMString name);
-
- [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction);
+ [CallWith=ScriptExecutionContext] IDBRequest put(in SerializedScriptValue value, in [Optional] IDBKey key)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest add(in SerializedScriptValue value, in [Optional] IDBKey key)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest remove(in IDBKey key)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key)
+ raises (IDBDatabaseException);
+ [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction)
+ raises (IDBDatabaseException);
+ IDBIndex createIndex(in DOMString name, in [ConvertNullToNullString] DOMString keyPath, in [Optional] boolean unique)
+ raises (IDBDatabaseException);
+ IDBIndex index(in DOMString name)
+ raises (IDBDatabaseException);
+ void removeIndex(in DOMString name)
+ raises (IDBDatabaseException);
};
}
diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
index 37879f2..1f98612 100644
--- a/WebCore/storage/IDBObjectStoreBackendImpl.cpp
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
@@ -90,13 +90,13 @@ static void bindWhereClause(SQLiteStatement& query, int64_t id, IDBKey* key)
key->bind(query, 2);
}
-void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
RefPtr<IDBKey> key = prpKey;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::getInternal, objectStore, key, callbacks)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "get must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
void IDBObjectStoreBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
@@ -173,15 +173,17 @@ static int putIndexData(SQLiteDatabase& db, IDBKey* key, int64_t indexId, int64_
return putQuery.step() == SQLResultDone;
}
-void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr)
+void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
{
RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
RefPtr<SerializedScriptValue> value = prpValue;
RefPtr<IDBKey> key = prpKey;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr;
+ // FIXME: This should throw a SERIAL_ERR on structured clone problems.
+ // FIXME: This should throw a DATA_ERR when the wrong key/keyPath data is supplied.
if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, addOnly, callbacks, transaction)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "put must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction)
@@ -252,13 +254,13 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<
callbacks->onSuccess(key.get());
}
-void IDBObjectStoreBackendImpl::remove(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreBackendImpl::remove(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
RefPtr<IDBKey> key = prpKey;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::removeInternal, objectStore, key, callbacks)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "remove must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
void IDBObjectStoreBackendImpl::removeInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
@@ -276,10 +278,14 @@ void IDBObjectStoreBackendImpl::removeInternal(ScriptExecutionContext*, PassRefP
callbacks->onSuccess();
}
-PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface* transaction)
+PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
if (m_indexes.contains(name)) {
- // FIXME: Raise CONSTRAINT_ERR.
+ ec = IDBDatabaseException::CONSTRAINT_ERR;
+ return 0;
+ }
+ if (transaction->mode() != IDBTransaction::VERSION_CHANGE) {
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
return 0;
}
@@ -290,6 +296,7 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(cons
RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction;
if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::createIndexInternal, objectStore, index, transaction),
createCallbackTask(&IDBObjectStoreBackendImpl::removeIndexFromMap, objectStore, index))) {
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
return 0;
}
@@ -317,9 +324,14 @@ void IDBObjectStoreBackendImpl::createIndexInternal(ScriptExecutionContext*, Pas
transaction->didCompleteTaskEvents();
}
-PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::index(const String& name)
+PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::index(const String& name, ExceptionCode& ec)
{
- return m_indexes.get(name);
+ RefPtr<IDBIndexBackendInterface> index = m_indexes.get(name);
+ if (!index) {
+ ec = IDBDatabaseException::NOT_FOUND_ERR;
+ return 0;
+ }
+ return index.release();
}
static void doDelete(SQLiteDatabase& db, const char* sql, int64_t id)
@@ -332,11 +344,11 @@ static void doDelete(SQLiteDatabase& db, const char* sql, int64_t id)
ASSERT_UNUSED(ok, ok); // FIXME: Better error handling.
}
-void IDBObjectStoreBackendImpl::removeIndex(const String& name, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreBackendImpl::removeIndex(const String& name, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
RefPtr<IDBIndexBackendImpl> index = m_indexes.get(name);
if (!index) {
- // FIXME: Raise NOT_FOUND_ERR.
+ ec = IDBDatabaseException::NOT_FOUND_ERR;
return;
}
@@ -344,7 +356,7 @@ void IDBObjectStoreBackendImpl::removeIndex(const String& name, IDBTransactionBa
RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction;
if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::removeIndexInternal, objectStore, index, transactionPtr),
createCallbackTask(&IDBObjectStoreBackendImpl::addIndexToMap, objectStore, index))) {
- // FIXME: Raise NOT_ALLOWED_ERR if the above statement fails.
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
return;
}
m_indexes.remove(name);
@@ -358,14 +370,14 @@ void IDBObjectStoreBackendImpl::removeIndexInternal(ScriptExecutionContext*, Pas
transaction->didCompleteTaskEvents();
}
-void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr)
+void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
{
RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
RefPtr<IDBKeyRange> range = prpRange;
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr;
if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::openCursorInternal, objectStore, range, direction, callbacks, transaction)))
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "openCursor must be called in the context of a transaction."));
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
}
void IDBObjectStoreBackendImpl::openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKeyRange> range, unsigned short tmpDirection, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction)
diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.h b/WebCore/storage/IDBObjectStoreBackendImpl.h
index f6d9b3b..09223b1 100644
--- a/WebCore/storage/IDBObjectStoreBackendImpl.h
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.h
@@ -50,7 +50,7 @@ public:
{
return adoptRef(new IDBObjectStoreBackendImpl(database, name, keyPath, autoIncrement));
}
- ~IDBObjectStoreBackendImpl();
+ virtual ~IDBObjectStoreBackendImpl();
int64_t id() const
{
@@ -58,20 +58,21 @@ public:
return m_id;
}
void setId(int64_t id) { m_id = id; }
- String name() const { return m_name; }
- String keyPath() const { return m_keyPath; }
- PassRefPtr<DOMStringList> indexNames() const;
- bool autoIncrement() const { return m_autoIncrement; }
- void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- void put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+ virtual String name() const { return m_name; }
+ virtual String keyPath() const { return m_keyPath; }
+ virtual PassRefPtr<DOMStringList> indexNames() const;
+ virtual bool autoIncrement() const { return m_autoIncrement; }
- PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface*);
- PassRefPtr<IDBIndexBackendInterface> index(const String& name);
- void removeIndex(const String& name, IDBTransactionBackendInterface*);
+ virtual void get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
- void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+ virtual PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name, ExceptionCode&);
+ virtual void removeIndex(const String& name, IDBTransactionBackendInterface*, ExceptionCode&);
+
+ virtual void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
IDBDatabaseBackendImpl* database() const { return m_database.get(); }
diff --git a/WebCore/storage/IDBObjectStoreBackendInterface.h b/WebCore/storage/IDBObjectStoreBackendInterface.h
index 6d9fcb8..8763d90 100644
--- a/WebCore/storage/IDBObjectStoreBackendInterface.h
+++ b/WebCore/storage/IDBObjectStoreBackendInterface.h
@@ -26,6 +26,7 @@
#ifndef IDBObjectStoreBackendInterface_h
#define IDBObjectStoreBackendInterface_h
+#include "ExceptionCode.h"
#include "PlatformString.h"
#include <wtf/Threading.h>
@@ -49,15 +50,15 @@ public:
virtual String keyPath() const = 0;
virtual PassRefPtr<DOMStringList> indexNames() const = 0;
- virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
- virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, bool addOnly, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
- virtual void remove(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
+ virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
+ virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, bool addOnly, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
+ virtual void remove(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
- virtual PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface*) = 0;
- virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name) = 0;
- virtual void removeIndex(const String& name, IDBTransactionBackendInterface*) = 0;
+ virtual PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
+ virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name, ExceptionCode&) = 0;
+ virtual void removeIndex(const String& name, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
- virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
+ virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBTransaction.cpp b/WebCore/storage/IDBTransaction.cpp
index 1e14326..334c001 100644
--- a/WebCore/storage/IDBTransaction.cpp
+++ b/WebCore/storage/IDBTransaction.cpp
@@ -34,6 +34,7 @@
#include "IDBCompleteEvent.h"
#include "IDBDatabase.h"
#include "IDBDatabaseException.h"
+#include "IDBIndex.h"
#include "IDBObjectStore.h"
#include "IDBObjectStoreBackendInterface.h"
#include "IDBPendingTransactionMonitor.h"
@@ -68,15 +69,15 @@ IDBDatabase* IDBTransaction::db()
return m_database.get();
}
-PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, const ExceptionCode&)
+PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, ExceptionCode& ec)
{
if (!m_backend) {
- // FIXME: throw IDBDatabaseException::NOT_ALLOWED_ERR.
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
return 0;
}
RefPtr<IDBObjectStoreBackendInterface> objectStoreBackend = m_backend->objectStore(name);
if (!objectStoreBackend) {
- // FIXME: throw IDBDatabaseException::NOT_ALLOWED_ERR.
+ ec = IDBDatabaseException::NOT_ALLOWED_ERR;
return 0;
}
RefPtr<IDBObjectStore> objectStore = IDBObjectStore::create(objectStoreBackend, m_backend.get());
diff --git a/WebCore/storage/IDBTransaction.h b/WebCore/storage/IDBTransaction.h
index 26c9215..8db5205 100644
--- a/WebCore/storage/IDBTransaction.h
+++ b/WebCore/storage/IDBTransaction.h
@@ -60,7 +60,7 @@ public:
unsigned short mode() const;
IDBDatabase* db();
- PassRefPtr<IDBObjectStore> objectStore(const String& name, const ExceptionCode&);
+ PassRefPtr<IDBObjectStore> objectStore(const String& name, ExceptionCode&);
void abort();
DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
diff --git a/WebCore/storage/IDBTransactionBackendImpl.cpp b/WebCore/storage/IDBTransactionBackendImpl.cpp
index 3ec3bb4..5016a3f 100644
--- a/WebCore/storage/IDBTransactionBackendImpl.cpp
+++ b/WebCore/storage/IDBTransactionBackendImpl.cpp
@@ -57,7 +57,7 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStor
{
if (m_state == Finished)
return 0;
- return m_database->objectStore(name, 0); // FIXME: remove mode param.
+ return m_database->objectStore(name);
}
bool IDBTransactionBackendImpl::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task, PassOwnPtr<ScriptExecutionContext::Task> abortTask)
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 1efaf82..7048774 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,70 @@
+2010-10-13 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ IndexedDB should fire some errors synchronously
+ https://bugs.webkit.org/show_bug.cgi?id=47530
+
+ * public/WebIDBCursor.h:
+ * public/WebIDBDatabase.h:
+ (WebKit::WebIDBDatabase::transaction):
+ * public/WebIDBFactory.h:
+ (WebKit::WebIDBFactory::open):
+ * public/WebIDBObjectStore.h:
+ * public/WebIDBTransactionCallbacks.h:
+ * src/IDBCursorBackendProxy.cpp:
+ (WebCore::IDBCursorBackendProxy::update):
+ (WebCore::IDBCursorBackendProxy::continueFunction):
+ (WebCore::IDBCursorBackendProxy::remove):
+ * src/IDBCursorBackendProxy.h:
+ * src/IDBDatabaseProxy.cpp:
+ (WebCore::IDBDatabaseProxy::createObjectStore):
+ (WebCore::IDBDatabaseProxy::removeObjectStore):
+ (WebCore::IDBDatabaseProxy::setVersion):
+ (WebCore::IDBDatabaseProxy::transaction):
+ * src/IDBDatabaseProxy.h:
+ * src/IDBIndexBackendProxy.cpp:
+ (WebCore::IDBIndexBackendProxy::openCursor):
+ (WebCore::IDBIndexBackendProxy::openKeyCursor):
+ (WebCore::IDBIndexBackendProxy::get):
+ (WebCore::IDBIndexBackendProxy::getKey):
+ * src/IDBIndexBackendProxy.h:
+ * src/IDBObjectStoreProxy.cpp:
+ (WebCore::IDBObjectStoreProxy::get):
+ (WebCore::IDBObjectStoreProxy::put):
+ (WebCore::IDBObjectStoreProxy::remove):
+ (WebCore::IDBObjectStoreProxy::createIndex):
+ (WebCore::IDBObjectStoreProxy::index):
+ (WebCore::IDBObjectStoreProxy::removeIndex):
+ (WebCore::IDBObjectStoreProxy::openCursor):
+ * src/IDBObjectStoreProxy.h:
+ * src/WebIDBCursorImpl.cpp:
+ (WebKit::WebIDBCursorImpl::update):
+ (WebKit::WebIDBCursorImpl::continueFunction):
+ (WebKit::WebIDBCursorImpl::remove):
+ * src/WebIDBCursorImpl.h:
+ * src/WebIDBDatabaseImpl.cpp:
+ (WebKit::WebIDBDatabaseImpl::createObjectStore):
+ (WebKit::WebIDBDatabaseImpl::removeObjectStore):
+ (WebKit::WebIDBDatabaseImpl::setVersion):
+ (WebKit::WebIDBDatabaseImpl::transaction):
+ * src/WebIDBDatabaseImpl.h:
+ * src/WebIDBIndexImpl.cpp:
+ (WebKit::WebIDBIndexImpl::openObjectCursor):
+ (WebKit::WebIDBIndexImpl::openKeyCursor):
+ (WebKit::WebIDBIndexImpl::getObject):
+ (WebKit::WebIDBIndexImpl::getKey):
+ * src/WebIDBIndexImpl.h:
+ * src/WebIDBObjectStoreImpl.cpp:
+ (WebKit::WebIDBObjectStoreImpl::get):
+ (WebKit::WebIDBObjectStoreImpl::put):
+ (WebKit::WebIDBObjectStoreImpl::remove):
+ (WebKit::WebIDBObjectStoreImpl::createIndex):
+ (WebKit::WebIDBObjectStoreImpl::index):
+ (WebKit::WebIDBObjectStoreImpl::removeIndex):
+ (WebKit::WebIDBObjectStoreImpl::openCursor):
+ * src/WebIDBObjectStoreImpl.h:
+
2010-10-13 Brett Wilson <brettw at chromium.org>
Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/public/WebIDBCursor.h b/WebKit/chromium/public/WebIDBCursor.h
index a17365b..2e5e98b 100644
--- a/WebKit/chromium/public/WebIDBCursor.h
+++ b/WebKit/chromium/public/WebIDBCursor.h
@@ -53,40 +53,9 @@ public:
// One or the other will set, depending on what type of cursor this is.
virtual void value(WebSerializedScriptValue& serializedScriptValue, WebIDBKey& idbKey) const { WEBKIT_ASSERT_NOT_REACHED(); }
- // FIXME: Remove.
- virtual void update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks, WebExceptionCode&)
- {
- update(value, callbacks);
- }
- virtual void update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks)
- {
- WebExceptionCode ec = 0;
- update(value, callbacks, ec);
- }
- virtual void continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks, WebExceptionCode&)
- {
- continueFunction(key, callbacks);
- }
- virtual void continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks)
- {
- WebExceptionCode ec = 0;
- continueFunction(key, callbacks, ec);
- }
- virtual void remove(WebIDBCallbacks* callbacks, WebExceptionCode&)
- {
- remove(callbacks);
- }
- virtual void remove(WebIDBCallbacks* callbacks)
- {
- WebExceptionCode ec = 0;
- remove(callbacks, ec);
- }
-
- /*
virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void remove(WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
- */
};
} // namespace WebKit
diff --git a/WebKit/chromium/public/WebIDBDatabase.h b/WebKit/chromium/public/WebIDBDatabase.h
index 4e92bdb..c67a117 100644
--- a/WebKit/chromium/public/WebIDBDatabase.h
+++ b/WebKit/chromium/public/WebIDBDatabase.h
@@ -63,49 +63,6 @@ public:
return WebDOMStringList();
}
- // FIXME: Remove after next roll.
- virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode)
- {
- WEBKIT_ASSERT_NOT_REACHED();
- return 0;
- }
- virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode&)
- {
- return createObjectStore(name, keyPath, autoIncrement, transaction);
- }
- virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction& transaction)
- {
- WebExceptionCode ec = 0;
- return createObjectStore(name, keyPath, autoIncrement, transaction, ec);
- }
- virtual void removeObjectStore(const WebString& name, const WebIDBTransaction& transaction, WebExceptionCode&)
- {
- removeObjectStore(name, transaction);
- }
- virtual void removeObjectStore(const WebString& name, const WebIDBTransaction& transaction)
- {
- WebExceptionCode ec = 0;
- removeObjectStore(name, transaction, ec);
- }
- virtual void setVersion(const WebString& version, WebIDBCallbacks* callbacks, WebExceptionCode&)
- {
- setVersion(version, callbacks);
- }
- virtual void setVersion(const WebString& version, WebIDBCallbacks* callbacks)
- {
- WebExceptionCode ec = 0;
- setVersion(version, callbacks, ec);
- }
- virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout, WebExceptionCode&)
- {
- return transaction(names, mode, timeout);
- }
- virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout)
- {
- WebExceptionCode ec = 0;
- return transaction(names, mode, timeout, ec);
- }
-/*
virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&)
{
WEBKIT_ASSERT_NOT_REACHED();
@@ -119,7 +76,6 @@ public:
WEBKIT_ASSERT_NOT_REACHED();
return 0;
}
-*/
virtual void close() { WEBKIT_ASSERT_NOT_REACHED(); }
};
diff --git a/WebKit/chromium/public/WebIDBObjectStore.h b/WebKit/chromium/public/WebIDBObjectStore.h
index 9933b21..f5f1473 100755
--- a/WebKit/chromium/public/WebIDBObjectStore.h
+++ b/WebKit/chromium/public/WebIDBObjectStore.h
@@ -59,72 +59,6 @@ public:
return WebDOMStringList();
}
- // FIXME: Remove.
- virtual void get(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode&)
- {
- get(key, callbacks, transaction);
- }
- virtual void get(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
- {
- WebExceptionCode ec = 0;
- get(key, callbacks, transaction, ec);
- }
- virtual void put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode&)
- {
- put(value, key, addOnly, callbacks, transaction);
- }
- virtual void put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
- {
- WebExceptionCode ec = 0;
- put(value, key, addOnly, callbacks, transaction, ec);
- }
- virtual void remove(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode&)
- {
- remove(key, callbacks, transaction);
- }
- virtual void remove(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
- {
- WebExceptionCode ec = 0;
- remove(key, callbacks, transaction, ec);
- }
- virtual WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction& transaction, WebExceptionCode&)
- {
- return createIndex(name, keyPath, unique, transaction);
- }
- virtual WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction& transaction)
- {
- WebExceptionCode ec = 0;
- return createIndex(name, keyPath, unique, transaction, ec);
- }
- virtual WebIDBIndex* index(const WebString& name, WebExceptionCode&)
- {
- return index(name);
- }
- virtual WebIDBIndex* index(const WebString& name)
- {
- WebExceptionCode ec = 0;
- return index(name, ec);
- }
- virtual void removeIndex(const WebString& name, const WebIDBTransaction& transaction, WebExceptionCode&)
- {
- removeIndex(name, transaction);
- }
- virtual void removeIndex(const WebString& name, const WebIDBTransaction& transaction)
- {
- WebExceptionCode ec = 0;
- removeIndex(name, transaction, ec);
- }
- virtual void openCursor(const WebIDBKeyRange& range, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode&)
- {
- openCursor(range, direction, callbacks, transaction);
- }
- virtual void openCursor(const WebIDBKeyRange& range, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
- {
- WebExceptionCode ec = 0;
- openCursor(range, direction, callbacks, transaction, ec);
- }
-
- /*
virtual void get(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void put(const WebSerializedScriptValue&, const WebIDBKey&, bool addOnly, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void remove(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
@@ -141,7 +75,6 @@ public:
}
virtual void removeIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
- */
};
} // namespace WebKit
diff --git a/WebKit/chromium/public/WebIDBTransactionCallbacks.h b/WebKit/chromium/public/WebIDBTransactionCallbacks.h
index 508925d..c9b6b05 100644
--- a/WebKit/chromium/public/WebIDBTransactionCallbacks.h
+++ b/WebKit/chromium/public/WebIDBTransactionCallbacks.h
@@ -33,13 +33,6 @@ class WebIDBTransactionCallbacks {
public:
virtual ~WebIDBTransactionCallbacks() { }
- // FIXME: Remove.
- virtual int id()
- {
- WEBKIT_ASSERT_NOT_REACHED();
- return 0;
- }
-
virtual void onAbort() { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void onComplete() { WEBKIT_ASSERT_NOT_REACHED(); }
virtual void onTimeout() { WEBKIT_ASSERT_NOT_REACHED(); }
diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/WebKit/chromium/src/IDBCursorBackendProxy.cpp
index cf18917..94491f9 100644
--- a/WebKit/chromium/src/IDBCursorBackendProxy.cpp
+++ b/WebKit/chromium/src/IDBCursorBackendProxy.cpp
@@ -75,19 +75,19 @@ PassRefPtr<IDBAny> IDBCursorBackendProxy::value() const
return IDBAny::create<IDBKey>(webKey);
}
-void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks)
+void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec)
{
- m_idbCursor->update(value, new WebIDBCallbacksImpl(callbacks));
+ m_idbCursor->update(value, new WebIDBCallbacksImpl(callbacks), ec);
}
-void IDBCursorBackendProxy::continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+void IDBCursorBackendProxy::continueFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec)
{
- m_idbCursor->continueFunction(key, new WebIDBCallbacksImpl(callbacks));
+ m_idbCursor->continueFunction(key, new WebIDBCallbacksImpl(callbacks), ec);
}
-void IDBCursorBackendProxy::remove(PassRefPtr<IDBCallbacks> callbacks)
+void IDBCursorBackendProxy::remove(PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec)
{
- m_idbCursor->remove(new WebIDBCallbacksImpl(callbacks));
+ m_idbCursor->remove(new WebIDBCallbacksImpl(callbacks), ec);
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.h b/WebKit/chromium/src/IDBCursorBackendProxy.h
index d8b621a..0a7a288 100644
--- a/WebKit/chromium/src/IDBCursorBackendProxy.h
+++ b/WebKit/chromium/src/IDBCursorBackendProxy.h
@@ -45,9 +45,9 @@ public:
virtual unsigned short direction() const;
virtual PassRefPtr<IDBKey> key() const;
virtual PassRefPtr<IDBAny> value() const;
- virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>);
- virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>);
- virtual void remove(PassRefPtr<IDBCallbacks>);
+ virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>, ExceptionCode&);
+ virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, ExceptionCode&);
+ virtual void remove(PassRefPtr<IDBCallbacks>, ExceptionCode&);
private:
IDBCursorBackendProxy(PassOwnPtr<WebKit::WebIDBCursor>);
diff --git a/WebKit/chromium/src/IDBDatabaseProxy.cpp b/WebKit/chromium/src/IDBDatabaseProxy.cpp
index 1dec18a..4fecf1b 100644
--- a/WebKit/chromium/src/IDBDatabaseProxy.cpp
+++ b/WebKit/chromium/src/IDBDatabaseProxy.cpp
@@ -76,42 +76,34 @@ PassRefPtr<DOMStringList> IDBDatabaseProxy::objectStores() const
return m_webIDBDatabase->objectStores();
}
-PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseProxy::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction)
+PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseProxy::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- WebKit::WebIDBObjectStore* objectStore = m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, *transactionProxy->getWebIDBTransaction());
+ WebKit::WebIDBObjectStore* objectStore = m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, *transactionProxy->getWebIDBTransaction(), ec);
if (!objectStore)
return 0;
return IDBObjectStoreProxy::create(objectStore);
}
-PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseProxy::objectStore(const String& name, unsigned short mode)
-{
- WebKit::WebIDBObjectStore* objectStore = m_webIDBDatabase->objectStore(name, mode);
- if (!objectStore)
- return 0;
- return IDBObjectStoreProxy::create(objectStore);
-}
-
-void IDBDatabaseProxy::removeObjectStore(const String& name, IDBTransactionBackendInterface* transaction)
+void IDBDatabaseProxy::removeObjectStore(const String& name, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBDatabase->removeObjectStore(name, *transactionProxy->getWebIDBTransaction());
+ m_webIDBDatabase->removeObjectStore(name, *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBDatabaseProxy::setVersion(const String& version, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseProxy::setVersion(const String& version, PassRefPtr<IDBCallbacks> callbacks, ExceptionCode& ec)
{
- m_webIDBDatabase->setVersion(version, new WebIDBCallbacksImpl(callbacks));
+ m_webIDBDatabase->setVersion(version, new WebIDBCallbacksImpl(callbacks), ec);
}
-PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseProxy::transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout)
+PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseProxy::transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout, ExceptionCode& ec)
{
WebKit::WebDOMStringList names(storeNames);
- WebKit::WebIDBTransaction* transaction = m_webIDBDatabase->transaction(names, mode, timeout);
+ WebKit::WebIDBTransaction* transaction = m_webIDBDatabase->transaction(names, mode, timeout, ec);
return IDBTransactionBackendProxy::create(transaction);
}
diff --git a/WebKit/chromium/src/IDBDatabaseProxy.h b/WebKit/chromium/src/IDBDatabaseProxy.h
index 1494ef0..5d20073 100644
--- a/WebKit/chromium/src/IDBDatabaseProxy.h
+++ b/WebKit/chromium/src/IDBDatabaseProxy.h
@@ -47,11 +47,10 @@ public:
virtual String version() const;
virtual PassRefPtr<DOMStringList> objectStores() const;
- virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface*);
- virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name, unsigned short mode);
- virtual void removeObjectStore(const String& name, IDBTransactionBackendInterface*);
- virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>);
- virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout);
+ virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void removeObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, ExceptionCode&);
+ virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout, ExceptionCode&);
virtual void close();
private:
diff --git a/WebKit/chromium/src/IDBIndexBackendProxy.cpp b/WebKit/chromium/src/IDBIndexBackendProxy.cpp
index 710e408..410750e 100644
--- a/WebKit/chromium/src/IDBIndexBackendProxy.cpp
+++ b/WebKit/chromium/src/IDBIndexBackendProxy.cpp
@@ -73,36 +73,36 @@ bool IDBIndexBackendProxy::unique()
return m_webIDBIndex->unique();
}
-void IDBIndexBackendProxy::openCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBIndexBackendProxy::openCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBIndex->openObjectCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+ m_webIDBIndex->openObjectCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBIndexBackendProxy::openKeyCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBIndexBackendProxy::openKeyCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBIndex->openKeyCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+ m_webIDBIndex->openKeyCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBIndexBackendProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBIndexBackendProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBIndex->getObject(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+ m_webIDBIndex->getObject(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBIndexBackendProxy::getKey(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBIndexBackendProxy::getKey(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBIndex->getKey(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+ m_webIDBIndex->getKey(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/IDBIndexBackendProxy.h b/WebKit/chromium/src/IDBIndexBackendProxy.h
index a3f29ce..e9de05a 100644
--- a/WebKit/chromium/src/IDBIndexBackendProxy.h
+++ b/WebKit/chromium/src/IDBIndexBackendProxy.h
@@ -46,10 +46,10 @@ public:
virtual String keyPath();
virtual bool unique();
- virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- virtual void getKey(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+ virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void openKeyCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void getKey(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
private:
IDBIndexBackendProxy(PassOwnPtr<WebKit::WebIDBIndex>);
diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp
index a009aa8..e537718 100755
--- a/WebKit/chromium/src/IDBObjectStoreProxy.cpp
+++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp
@@ -72,63 +72,63 @@ PassRefPtr<DOMStringList> IDBObjectStoreProxy::indexNames() const
return m_webIDBObjectStore->indexNames();
}
-void IDBObjectStoreProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBObjectStore->get(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+ m_webIDBObjectStore->get(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBObjectStoreProxy::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreProxy::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBObjectStore->put(value, key, addOnly, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+ m_webIDBObjectStore->put(value, key, addOnly, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBObjectStoreProxy::remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreProxy::remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBObjectStore->remove(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+ m_webIDBObjectStore->remove(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
-PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface* transaction)
+PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- WebKit::WebIDBIndex* index = m_webIDBObjectStore->createIndex(name, keyPath, unique, *transactionProxy->getWebIDBTransaction());
+ WebKit::WebIDBIndex* index = m_webIDBObjectStore->createIndex(name, keyPath, unique, *transactionProxy->getWebIDBTransaction(), ec);
if (!index)
return 0;
return IDBIndexBackendProxy::create(index);
}
-PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::index(const String& name)
+PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::index(const String& name, ExceptionCode& ec)
{
- WebKit::WebIDBIndex* index = m_webIDBObjectStore->index(name);
+ WebKit::WebIDBIndex* index = m_webIDBObjectStore->index(name, ec);
if (!index)
return 0;
return IDBIndexBackendProxy::create(index);
}
-void IDBObjectStoreProxy::removeIndex(const String& name, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreProxy::removeIndex(const String& name, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBObjectStore->removeIndex(name, *transactionProxy->getWebIDBTransaction());
+ m_webIDBObjectStore->removeIndex(name, *transactionProxy->getWebIDBTransaction(), ec);
}
-void IDBObjectStoreProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
{
// The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
// all implementations of IDB interfaces are proxy objects.
IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
- m_webIDBObjectStore->openCursor(range, direction, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+ m_webIDBObjectStore->openCursor(range, direction, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h
index 86b9c68..1e19279 100755
--- a/WebKit/chromium/src/IDBObjectStoreProxy.h
+++ b/WebKit/chromium/src/IDBObjectStoreProxy.h
@@ -46,15 +46,15 @@ public:
virtual String keyPath() const;
virtual PassRefPtr<DOMStringList> indexNames() const;
- virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, bool addOnly, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
- virtual void remove(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+ virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, bool addOnly, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
+ virtual void remove(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
- PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface*);
- PassRefPtr<IDBIndexBackendInterface> index(const String& name);
- void removeIndex(const String& name, IDBTransactionBackendInterface*);
+ PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface*, ExceptionCode&);
+ PassRefPtr<IDBIndexBackendInterface> index(const String& name, ExceptionCode&);
+ void removeIndex(const String& name, IDBTransactionBackendInterface*, ExceptionCode&);
- virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+ virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
private:
IDBObjectStoreProxy(PassOwnPtr<WebKit::WebIDBObjectStore>);
diff --git a/WebKit/chromium/src/WebIDBCursorImpl.cpp b/WebKit/chromium/src/WebIDBCursorImpl.cpp
index 6a1053e..eca5d42 100644
--- a/WebKit/chromium/src/WebIDBCursorImpl.cpp
+++ b/WebKit/chromium/src/WebIDBCursorImpl.cpp
@@ -70,19 +70,19 @@ void WebIDBCursorImpl::value(WebSerializedScriptValue& serializedScriptValue, We
ASSERT_NOT_REACHED();
}
-void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks)
+void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks, WebExceptionCode& ec)
{
- m_idbCursorBackend->update(value, IDBCallbacksProxy::create(callbacks));
+ m_idbCursorBackend->update(value, IDBCallbacksProxy::create(callbacks), ec);
}
-void WebIDBCursorImpl::continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks)
+void WebIDBCursorImpl::continueFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks, WebExceptionCode& ec)
{
- m_idbCursorBackend->continueFunction(key, IDBCallbacksProxy::create(callbacks));
+ m_idbCursorBackend->continueFunction(key, IDBCallbacksProxy::create(callbacks), ec);
}
-void WebIDBCursorImpl::remove(WebIDBCallbacks* callbacks)
+void WebIDBCursorImpl::remove(WebIDBCallbacks* callbacks, WebExceptionCode& ec)
{
- m_idbCursorBackend->remove(IDBCallbacksProxy::create(callbacks));
+ m_idbCursorBackend->remove(IDBCallbacksProxy::create(callbacks), ec);
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/WebIDBCursorImpl.h b/WebKit/chromium/src/WebIDBCursorImpl.h
index 5fb9e1c..39fa44b 100644
--- a/WebKit/chromium/src/WebIDBCursorImpl.h
+++ b/WebKit/chromium/src/WebIDBCursorImpl.h
@@ -27,6 +27,7 @@
#define WebIDBCursorImpl_h
#include "WebCommon.h"
+#include "WebExceptionCode.h"
#include "WebIDBCursor.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -44,9 +45,9 @@ public:
virtual unsigned short direction() const;
virtual WebIDBKey key() const;
virtual void value(WebSerializedScriptValue&, WebIDBKey&) const;
- virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*);
- virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*);
- virtual void remove(WebIDBCallbacks*);
+ virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*, WebExceptionCode&);
+ virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&);
+ virtual void remove(WebIDBCallbacks*, WebExceptionCode&);
private:
WTF::RefPtr<WebCore::IDBCursorBackendInterface> m_idbCursorBackend;
diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
index c8d81d6..2d95e21 100644
--- a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
+++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
@@ -69,36 +69,28 @@ WebDOMStringList WebIDBDatabaseImpl::objectStores() const
return m_databaseBackend->objectStores();
}
-WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction& transaction)
+WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, transaction.getIDBTransactionBackendInterface());
+ RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, transaction.getIDBTransactionBackendInterface(), ec);
if (!objectStore)
return 0;
return new WebIDBObjectStoreImpl(objectStore);
}
-WebIDBObjectStore* WebIDBDatabaseImpl::objectStore(const WebString& name, unsigned short mode)
+void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->objectStore(name, mode);
- if (!objectStore)
- return 0;
- return new WebIDBObjectStoreImpl(objectStore);
-}
-
-void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, const WebIDBTransaction& transaction)
-{
- m_databaseBackend->removeObjectStore(name, transaction.getIDBTransactionBackendInterface());
+ m_databaseBackend->removeObjectStore(name, transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBDatabaseImpl::setVersion(const WebString& version, WebIDBCallbacks* callbacks)
+void WebIDBDatabaseImpl::setVersion(const WebString& version, WebIDBCallbacks* callbacks, WebExceptionCode& ec)
{
- m_databaseBackend->setVersion(version, IDBCallbacksProxy::create(callbacks));
+ m_databaseBackend->setVersion(version, IDBCallbacksProxy::create(callbacks), ec);
}
-WebIDBTransaction* WebIDBDatabaseImpl::transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout)
+WebIDBTransaction* WebIDBDatabaseImpl::transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout, WebExceptionCode& ec)
{
RefPtr<DOMStringList> nameList = PassRefPtr<DOMStringList>(names);
- RefPtr<IDBTransactionBackendInterface> transaction = m_databaseBackend->transaction(nameList.get(), mode, timeout);
+ RefPtr<IDBTransactionBackendInterface> transaction = m_databaseBackend->transaction(nameList.get(), mode, timeout, ec);
if (!transaction)
return 0;
return new WebIDBTransactionImpl(transaction);
diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h
index 8e360da..fda4265 100644
--- a/WebKit/chromium/src/WebIDBDatabaseImpl.h
+++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h
@@ -27,6 +27,7 @@
#define WebIDBDatabaseImpl_h
#include "WebCommon.h"
+#include "WebExceptionCode.h"
#include "WebIDBDatabase.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -49,11 +50,10 @@ public:
virtual WebString version() const;
virtual WebDOMStringList objectStores() const;
- virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction&);
- virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode);
- virtual void removeObjectStore(const WebString& name, const WebIDBTransaction&);
- virtual void setVersion(const WebString& version, WebIDBCallbacks* callbacks);
- virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout);
+ virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&);
+ virtual void removeObjectStore(const WebString& name, const WebIDBTransaction&, WebExceptionCode&);
+ virtual void setVersion(const WebString& version, WebIDBCallbacks* callbacks, WebExceptionCode&);
+ virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout, WebExceptionCode&);
virtual void close();
private:
diff --git a/WebKit/chromium/src/WebIDBIndexImpl.cpp b/WebKit/chromium/src/WebIDBIndexImpl.cpp
index 4f663d0..6e8e1f2 100644
--- a/WebKit/chromium/src/WebIDBIndexImpl.cpp
+++ b/WebKit/chromium/src/WebIDBIndexImpl.cpp
@@ -68,24 +68,24 @@ bool WebIDBIndexImpl::unique() const
return m_backend->unique();
}
-void WebIDBIndexImpl::openObjectCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBIndexImpl::openObjectCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_backend->openCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+ m_backend->openCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBIndexImpl::openKeyCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBIndexImpl::openKeyCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_backend->openKeyCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+ m_backend->openKeyCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBIndexImpl::getObject(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBIndexImpl::getObject(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_backend->get(keyRange, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+ m_backend->get(keyRange, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBIndexImpl::getKey(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBIndexImpl::getKey(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_backend->getKey(keyRange, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+ m_backend->getKey(keyRange, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec);
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/WebIDBIndexImpl.h b/WebKit/chromium/src/WebIDBIndexImpl.h
index e8203f7..f68da7f 100644
--- a/WebKit/chromium/src/WebIDBIndexImpl.h
+++ b/WebKit/chromium/src/WebIDBIndexImpl.h
@@ -46,10 +46,10 @@ public:
virtual WebString keyPath() const;
virtual bool unique() const;
- virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&);
- virtual void openKeyCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&);
- virtual void getObject(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&);
- virtual void getKey(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&);
+ virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
+ virtual void openKeyCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
+ virtual void getObject(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
+ virtual void getKey(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
private:
WTF::RefPtr<WebCore::IDBIndexBackendInterface> m_backend;
diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
index 9fb7ab6..96495fe 100755
--- a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
+++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
@@ -66,45 +66,45 @@ WebDOMStringList WebIDBObjectStoreImpl::indexNames() const
return m_objectStore->indexNames();
}
-void WebIDBObjectStoreImpl::get(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBObjectStoreImpl::get(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_objectStore->get(key, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+ m_objectStore->get(key, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBObjectStoreImpl::put(const WebSerializedScriptValue& value, const WebIDBKey& key, bool addOnly, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_objectStore->put(value, key, addOnly, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+ m_objectStore->put(value, key, addOnly, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBObjectStoreImpl::remove(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBObjectStoreImpl::remove(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_objectStore->remove(key, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+ m_objectStore->remove(key, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec);
}
-WebIDBIndex* WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction& transaction)
+WebIDBIndex* WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, transaction.getIDBTransactionBackendInterface());
+ RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, transaction.getIDBTransactionBackendInterface(), ec);
if (!index)
return 0;
return new WebIDBIndexImpl(index);
}
-WebIDBIndex* WebIDBObjectStoreImpl::index(const WebString& name)
+WebIDBIndex* WebIDBObjectStoreImpl::index(const WebString& name, WebExceptionCode& ec)
{
- RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name);
+ RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name, ec);
if (!index)
return 0;
return new WebIDBIndexImpl(index);
}
-void WebIDBObjectStoreImpl::removeIndex(const WebString& name, const WebIDBTransaction& transaction)
+void WebIDBObjectStoreImpl::removeIndex(const WebString& name, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_objectStore->removeIndex(name, transaction.getIDBTransactionBackendInterface());
+ m_objectStore->removeIndex(name, transaction.getIDBTransactionBackendInterface(), ec);
}
-void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
{
- m_objectStore->openCursor(IDBKeyRange::create(keyRange.left(), keyRange.right(), keyRange.flags()), direction, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+ m_objectStore->openCursor(IDBKeyRange::create(keyRange.left(), keyRange.right(), keyRange.flags()), direction, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface(), ec);
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/WebKit/chromium/src/WebIDBObjectStoreImpl.h
index ee1ec0b..9148118 100755
--- a/WebKit/chromium/src/WebIDBObjectStoreImpl.h
+++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.h
@@ -47,15 +47,15 @@ public:
WebString keyPath() const;
WebDOMStringList indexNames() const;
- void get(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&);
- void put(const WebSerializedScriptValue&, const WebIDBKey& key, bool addOnly, WebIDBCallbacks*, const WebIDBTransaction&);
- void remove(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&);
+ void get(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
+ void put(const WebSerializedScriptValue&, const WebIDBKey& key, bool addOnly, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
+ void remove(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
- WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction&);
- WebIDBIndex* index(const WebString& name);
- void removeIndex(const WebString& name, const WebIDBTransaction&);
+ WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction&, WebExceptionCode&);
+ WebIDBIndex* index(const WebString& name, WebExceptionCode&);
+ void removeIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&);
- void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&);
+ void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
private:
WTF::RefPtr<WebCore::IDBObjectStoreBackendInterface> m_objectStore;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list