[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andreip at google.com andreip at google.com
Wed Dec 22 14:13:29 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 85ba10db7a8bc94fb969f88842830acb9837e795
Author: andreip at google.com <andreip at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 5 17:10:39 2010 +0000

    2010-10-04  Andrei Popescu  <andreip at google.com>
    
            Reviewed by Jeremy Orlow.
    
            IDBDatabase::createObjectStore/removeObjectStore and IDBObjectStore::createIndex/removeIndex should be synchronous.
            https://bugs.webkit.org/show_bug.cgi?id=46883
    
            * storage/indexeddb/database-basics-expected.txt:
            * storage/indexeddb/database-basics.html:
            * storage/indexeddb/index-basics-expected.txt:
            * storage/indexeddb/index-basics.html:
            * storage/indexeddb/index-cursor-expected.txt:
            * storage/indexeddb/index-cursor.html:
            * storage/indexeddb/objectstore-basics-expected.txt:
            * storage/indexeddb/objectstore-basics.html:
            * storage/indexeddb/objectstore-cursor-expected.txt:
            * storage/indexeddb/objectstore-cursor.html:
            * storage/indexeddb/objectstore-removeobjectstore-expected.txt:
            * storage/indexeddb/objectstore-removeobjectstore.html:
            * storage/indexeddb/open-cursor-expected.txt:
            * storage/indexeddb/open-cursor.html:
            * storage/indexeddb/resources/shared.js:
            (deleteAllObjectStores):
            * storage/indexeddb/transaction-basics-expected.txt:
            * storage/indexeddb/transaction-basics.html:
    2010-10-04  Andrei Popescu  <andreip at google.com>
    
            Reviewed by Jeremy Orlow.
    
            IDBDatabase::createObjectStore/removeObjectStore and IDBObjectStore::createIndex/removeIndex should be synchronous.
            https://bugs.webkit.org/show_bug.cgi?id=46883
    
            Makes the schema manipulation methods synchronous. Modifies the transaction
            logic to support tasks that may have pending events as well as tasks that
            don't have such events.
    
            * storage/IDBDatabase.cpp:
            (WebCore::IDBDatabase::createObjectStore):
            (WebCore::IDBDatabase::removeObjectStore):
            * storage/IDBDatabase.h:
            * storage/IDBDatabase.idl:
            * storage/IDBDatabaseBackendImpl.cpp:
            (WebCore::IDBDatabaseBackendImpl::createObjectStore):
            (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal):
            (WebCore::IDBDatabaseBackendImpl::removeObjectStore):
            (WebCore::IDBDatabaseBackendImpl::removeObjectStoreInternal):
            * storage/IDBDatabaseBackendImpl.h:
            * storage/IDBDatabaseBackendInterface.h:
            * storage/IDBIndexBackendImpl.cpp:
            (WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl):
            * storage/IDBIndexBackendImpl.h:
            (WebCore::IDBIndexBackendImpl::create):
            (WebCore::IDBIndexBackendImpl::id):
            (WebCore::IDBIndexBackendImpl::setId):
            * storage/IDBObjectStore.cpp:
            (WebCore::IDBObjectStore::createIndex):
            (WebCore::IDBObjectStore::removeIndex):
            * storage/IDBObjectStore.h:
            * storage/IDBObjectStore.idl:
            * storage/IDBObjectStoreBackendImpl.cpp:
            (WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
            (WebCore::IDBObjectStoreBackendImpl::createIndex):
            (WebCore::IDBObjectStoreBackendImpl::createIndexInternal):
            (WebCore::IDBObjectStoreBackendImpl::removeIndex):
            (WebCore::IDBObjectStoreBackendImpl::removeIndexInternal):
            * storage/IDBObjectStoreBackendImpl.h:
            (WebCore::IDBObjectStoreBackendImpl::create):
            (WebCore::IDBObjectStoreBackendImpl::id):
            (WebCore::IDBObjectStoreBackendImpl::setId):
            (WebCore::IDBObjectStoreBackendImpl::autoIncrement):
            * storage/IDBObjectStoreBackendInterface.h:
            * storage/IDBTransactionBackendImpl.cpp:
            (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
            (WebCore::IDBTransactionBackendImpl::objectStore):
            (WebCore::IDBTransactionBackendImpl::scheduleTask):
            (WebCore::IDBTransactionBackendImpl::abort):
            (WebCore::IDBTransactionBackendImpl::didCompleteTaskEvents):
            (WebCore::IDBTransactionBackendImpl::run):
            (WebCore::IDBTransactionBackendImpl::taskTimerFired):
            (WebCore::IDBTransactionBackendImpl::taskEventTimerFired):
            * storage/IDBTransactionBackendImpl.h:
    2010-10-04  Andrei Popescu  <andreip at google.com>
    
            Reviewed by Jeremy Orlow.
    
            IDBDatabase::createObjectStore/removeObjectStore and IDBObjectStore::createIndex/removeIndex should be synchronous.
            https://bugs.webkit.org/show_bug.cgi?id=46883
    
            * public/WebIDBDatabase.h:
            (WebKit::WebIDBDatabase::createObjectStore):
            (WebKit::WebIDBDatabase::removeObjectStore):
            * public/WebIDBObjectStore.h:
            (WebKit::WebIDBObjectStore::createIndex):
            (WebKit::WebIDBObjectStore::removeIndex):
            * src/IDBDatabaseProxy.cpp:
            (WebCore::IDBDatabaseProxy::createObjectStore):
            (WebCore::IDBDatabaseProxy::removeObjectStore):
            * src/IDBDatabaseProxy.h:
            * src/IDBObjectStoreProxy.cpp:
            (WebCore::IDBObjectStoreProxy::createIndex):
            (WebCore::IDBObjectStoreProxy::removeIndex):
            * src/IDBObjectStoreProxy.h:
            * src/WebIDBDatabaseImpl.cpp:
            (WebKit::WebIDBDatabaseImpl::createObjectStore):
            (WebKit::WebIDBDatabaseImpl::removeObjectStore):
            * src/WebIDBDatabaseImpl.h:
            * src/WebIDBObjectStoreImpl.cpp:
            (WebKit::WebIDBObjectStoreImpl::createIndex):
            (WebKit::WebIDBObjectStoreImpl::removeIndex):
            * src/WebIDBObjectStoreImpl.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69121 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6bac543..15defe5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,29 @@
+2010-10-04  Andrei Popescu  <andreip at google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        IDBDatabase::createObjectStore/removeObjectStore and IDBObjectStore::createIndex/removeIndex should be synchronous.
+        https://bugs.webkit.org/show_bug.cgi?id=46883
+
+        * storage/indexeddb/database-basics-expected.txt:
+        * storage/indexeddb/database-basics.html:
+        * storage/indexeddb/index-basics-expected.txt:
+        * storage/indexeddb/index-basics.html:
+        * storage/indexeddb/index-cursor-expected.txt:
+        * storage/indexeddb/index-cursor.html:
+        * storage/indexeddb/objectstore-basics-expected.txt:
+        * storage/indexeddb/objectstore-basics.html:
+        * storage/indexeddb/objectstore-cursor-expected.txt:
+        * storage/indexeddb/objectstore-cursor.html:
+        * storage/indexeddb/objectstore-removeobjectstore-expected.txt:
+        * storage/indexeddb/objectstore-removeobjectstore.html:
+        * storage/indexeddb/open-cursor-expected.txt:
+        * storage/indexeddb/open-cursor.html:
+        * storage/indexeddb/resources/shared.js:
+        (deleteAllObjectStores):
+        * storage/indexeddb/transaction-basics-expected.txt:
+        * storage/indexeddb/transaction-basics.html:
+
 2010-10-05  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/storage/indexeddb/database-basics-expected.txt b/LayoutTests/storage/indexeddb/database-basics-expected.txt
index 97ec721..d054778 100644
--- a/LayoutTests/storage/indexeddb/database-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/database-basics-expected.txt
@@ -41,6 +41,7 @@ PASS event.target.readyState is event.target.DONE
 
 trans = event.result
 PASS trans !== null is true
+Deleted all object stores.
 Testing setVersion.
 db.setVersion("version a")
 PASS 'onsuccess' in result is true
@@ -82,22 +83,6 @@ PASS db.objectStores is []
 PASS db.objectStores.length is 0
 PASS db.objectStores.contains('') is false
 db.createObjectStore("test123")
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
 PASS db.objectStores is ['test123']
 PASS db.objectStores.length is 1
 PASS db.objectStores.contains('') is false
diff --git a/LayoutTests/storage/indexeddb/database-basics.html b/LayoutTests/storage/indexeddb/database-basics.html
index 850d30d..2ebcf0b 100644
--- a/LayoutTests/storage/indexeddb/database-basics.html
+++ b/LayoutTests/storage/indexeddb/database-basics.html
@@ -50,7 +50,7 @@ function testSetVersion()
     result = evalAndLog('db.setVersion("version a")');
     verifyResult(result);
     result.onsuccess = setVersionAgain;
-    result.onError = unexpectedErrorCallback;
+    result.onerror = unexpectedErrorCallback;
 }
 
 function setVersionAgain()
@@ -60,7 +60,7 @@ function setVersionAgain()
     result = evalAndLog('db.setVersion("version b")');
     verifyResult(result);
     result.onsuccess = createObjectStore;
-    result.onError = unexpectedErrorCallback;
+    result.onerror = unexpectedErrorCallback;
 }
 
 function createObjectStore()
@@ -72,15 +72,12 @@ function createObjectStore()
     shouldBe("db.objectStores.length", "0");
     shouldBe("db.objectStores.contains('')", "false");
 
-    result = evalAndLog('db.createObjectStore("test123")');
-    verifyResult(result);
-    result.onsuccess = checkObjectStore;
-    result.onError = unexpectedErrorCallback;
+    objectStore = evalAndLog('db.createObjectStore("test123")');
+    checkObjectStore(objectStore);
 }
 
-function checkObjectStore()
+function checkObjectStore(objectStore)
 {
-    verifySuccessEvent(event);
     shouldBe("db.objectStores", "['test123']");
     shouldBe("db.objectStores.length", "1");
     shouldBe("db.objectStores.contains('')", "false");
diff --git a/LayoutTests/storage/indexeddb/index-basics-expected.txt b/LayoutTests/storage/indexeddb/index-basics-expected.txt
index d8d6dcc..8f926d0 100644
--- a/LayoutTests/storage/indexeddb/index-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/index-basics-expected.txt
@@ -41,43 +41,9 @@ PASS event.target.readyState is event.target.DONE
 
 trans = event.result
 PASS trans !== null is true
+Deleted all object stores.
 db.createObjectStore('storeName', null)
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-store = event.result
-event.result.createIndex('indexName', 'x')
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-PASS event.result === null is false
-indexObject = event.result
+store.createIndex('indexName', 'x')
 PASS 'name' in indexObject is true
 PASS indexObject.name is "indexName"
 PASS 'storeName' in indexObject is true
@@ -90,7 +56,7 @@ PASS 'openObjectCursor' in indexObject is true
 PASS 'openCursor' in indexObject is true
 PASS 'getObject' in indexObject is true
 PASS 'get' in indexObject is true
-event.source.add({x: 'value', y: 'zzz'}, 'key')
+store.add({x: 'value', y: 'zzz'}, 'key')
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
 PASS 'readyState' in result is true
diff --git a/LayoutTests/storage/indexeddb/index-basics.html b/LayoutTests/storage/indexeddb/index-basics.html
index 3c8a601..8f6d887 100644
--- a/LayoutTests/storage/indexeddb/index-basics.html
+++ b/LayoutTests/storage/indexeddb/index-basics.html
@@ -41,33 +41,18 @@ function deleteExisting()
     shouldBeTrue("trans !== null");
     trans.onabort = unexpectedAbortCallback;
 
-    deleteAllObjectStores(db, createObjectStore);
-}
-
-function createObjectStore()
-{
-    result = evalAndLog("db.createObjectStore('storeName', null)");
-    verifyResult(result);
-    result.onsuccess = createIndex;
-    result.onerror = unexpectedErrorCallback;
+    deleteAllObjectStores(db, createIndex);
 }
 
 function createIndex()
-{
-    verifySuccessEvent(event);
-    window.store = evalAndLog("store = event.result");
-
-    result = evalAndLog("event.result.createIndex('indexName', 'x')");
-    verifyResult(result);
-    result.onsuccess = addData;
-    result.onerror = unexpectedErrorCallback;
+{
+    window.store = evalAndLog("db.createObjectStore('storeName', null)");
+    window.indexObject = evalAndLog("store.createIndex('indexName', 'x')");
+    addData();
 }
 
 function addData()
 {
-    verifySuccessEvent(event);
-    shouldBeFalse("event.result === null");
-    window.indexObject = evalAndLog("indexObject = event.result");
     shouldBeTrue("'name' in indexObject");
     shouldBeEqualToString("indexObject.name", "indexName");
     shouldBeTrue("'storeName' in indexObject");
@@ -81,7 +66,7 @@ function addData()
     shouldBeTrue("'getObject' in indexObject");
     shouldBeTrue("'get' in indexObject");
 
-    result = evalAndLog("event.source.add({x: 'value', y: 'zzz'}, 'key')");
+    result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
     verifyResult(result);
     result.onsuccess = addMore;
     result.onerror = unexpectedErrorCallback;
diff --git a/LayoutTests/storage/indexeddb/index-cursor-expected.txt b/LayoutTests/storage/indexeddb/index-cursor-expected.txt
index 9724fd0..aefdcd0 100644
--- a/LayoutTests/storage/indexeddb/index-cursor-expected.txt
+++ b/LayoutTests/storage/indexeddb/index-cursor-expected.txt
@@ -40,53 +40,9 @@ PASS event.target.readyState is event.target.DONE
 
 trans = event.result
 PASS trans !== null is true
+Deleted all object stores.
 db.createObjectStore('someObjectStore')
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-objectStore = event.result
 objectStore.createIndex('someIndex', 'x')
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-indexObject = event.result
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
 objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
diff --git a/LayoutTests/storage/indexeddb/index-cursor.html b/LayoutTests/storage/indexeddb/index-cursor.html
index 66b6dc6..5f2cde6 100644
--- a/LayoutTests/storage/indexeddb/index-cursor.html
+++ b/LayoutTests/storage/indexeddb/index-cursor.html
@@ -53,41 +53,21 @@ function deleteExisting()
     shouldBeTrue("trans !== null");
     trans.onabort = unexpectedAbortCallback;
 
-    deleteAllObjectStores(db, createObjectStores);
-}
-
-function createObjectStores()
-{
-    result = evalAndLog("db.createObjectStore('someObjectStore')");
-    verifyResult(result);
-    result.onsuccess = openIndex;
-    result.onerror = unexpectedErrorCallback;
-}
-
-function openIndex()
-{
-    verifySuccessEvent(event);
-    window.objectStore = evalAndLog("objectStore = event.result");
-
-    result = evalAndLog("objectStore.createIndex('someIndex', 'x')");
-    verifyResult(result);
-    result.onsuccess = startAddingData;
-    result.onerror = unexpectedErrorCallback;
+    deleteAllObjectStores(db, startAddingData);
 }
  
 function startAddingData()
 {
-    verifySuccessEvent(event);
-    window.indexObject = evalAndLog("indexObject = event.result");
-
+    window.objectStore = evalAndLog("db.createObjectStore('someObjectStore')");
+    window.indexObject = evalAndLog("objectStore.createIndex('someIndex', 'x')");
     window.nextToAdd = 0;
     addData();
 }
 
 function addData()
 {
-    // We cheat when called for the first time; we're in the context of the objectStore success event.
-    verifySuccessEvent(event);
+    if (window.nextToAdd > 0)
+        verifySuccessEvent(event);
 
     result = evalAndLog("objectStore.add({'x': testData[nextToAdd]}, nextToAdd)");
     verifyResult(result);
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
index 1df5a4e..9f21de0 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
@@ -42,25 +42,9 @@ PASS event.target.readyState is event.target.DONE
 
 trans = event.result
 PASS trans !== null is true
-db.createObjectStore('storeName', null)
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-createSuccess():
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-store = event.result
+Deleted all object stores.
+creatObjectStore():
+store = db.createObjectStore('storeName', null)
 storeNames = db.objectStores
 PASS store.name is "storeName"
 PASS store.keyPath is null
@@ -69,34 +53,18 @@ PASS storeNames.length is 1
 Ask for a store that doesn't exist:
 index = store.index('asdf')
 PASS index is null
-FAIL Asking for a store that doesn't exist should have thrown.
-event.result.createIndex('indexName', 'x', true)
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-addIndexSuccess():
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-PASS event.result !== null is true
-PASS event.source.indexNames.contains('indexName') is true
-index = event.source.index('indexName')
+PASS index is null
+createIndex():
+store.createIndex('indexName', 'x', true)
+PASS index !== null is true
+PASS store.indexNames.contains('indexName') is true
+index = store.index('indexName')
 PASS index !== null is true
 Ask for a store that doesn't exist:
 index = store.index('asdf')
 PASS index is null
-FAIL Asking for a store that doesn't exist should have thrown.
-event.source.add({x: 'value'}, 'key')
+PASS index is null.
+store.add({x: 'value'}, 'key')
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
 PASS 'readyState' in result is true
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html
index 9b00946..d930f4b 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics.html
+++ b/LayoutTests/storage/indexeddb/objectstore-basics.html
@@ -42,22 +42,13 @@ function setVersionSuccess()
     shouldBeTrue("trans !== null");
     trans.onabort = unexpectedAbortCallback;
 
-    deleteAllObjectStores(db, deleteSuccess);
+    deleteAllObjectStores(db, createObjectStore);
 }
-
-function deleteSuccess()
-{
-    result = evalAndLog("db.createObjectStore('storeName', null)");
-    verifyResult(result);
-    result.onsuccess = createSuccess;
-    result.onerror = unexpectedErrorCallback;
-}
-
-function createSuccess()
-{
-    debug("createSuccess():");
-    verifySuccessEvent(event);
-    var store = evalAndLog("store = event.result");
+
+function createObjectStore()
+{
+    debug("creatObjectStore():");
+    var store = evalAndLog("store = db.createObjectStore('storeName', null)");
     var storeNames = evalAndLog("storeNames = db.objectStores");
 
     shouldBeEqualToString("store.name", "storeName");
@@ -68,40 +59,37 @@ function createSuccess()
 
     debug("Ask for a store 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!
-        testFailed("Asking for a store that doesn't exist should have thrown.");
+        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) {
-        testPassed("Error thrown.");
         // FIXME: Verify the correct exception thrown.
-    }
-
-    result = evalAndLog("event.result.createIndex('indexName', 'x', true)"); // true == unique requirement.
-    verifyResult(result);
-    result.onsuccess = addIndexSuccess;
-    result.onerror = unexpectedErrorCallback;
+    }
+
+    createIndex();
 }
 
-function addIndexSuccess()
-{
-    debug("addIndexSuccess():");
-    verifySuccessEvent(event);
-    shouldBeTrue("event.result !== null");
-    shouldBeTrue("event.source.indexNames.contains('indexName')");
-    index = evalAndLog("index = event.source.index('indexName')");
+function createIndex()
+{
+    debug("createIndex():");
+    window.index = evalAndLog("store.createIndex('indexName', 'x', true)"); // true == unique requirement.
+    shouldBeTrue("index !== null");
+    shouldBeTrue("store.indexNames.contains('indexName')");
+    index = evalAndLog("index = store.index('indexName')");
     shouldBeTrue("index !== null");
 
     debug("Ask for a store 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!
-        testFailed("Asking for a store that doesn't exist should have thrown.");
+        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) {
-        testPassed("Error thrown.");
         // FIXME: Verify the correct exception thrown.
     }
 
-    result = evalAndLog("event.source.add({x: 'value'}, 'key')");
+    result = evalAndLog("store.add({x: 'value'}, 'key')");
     verifyResult(result);
     result.onsuccess = addSuccess;
     result.onerror = unexpectedErrorCallback;
diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt b/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt
index f1f13ae..ffe6cd7 100644
--- a/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt
@@ -40,35 +40,8 @@ PASS event.target.readyState is event.target.DONE
 
 trans = event.result
 PASS trans !== null is true
+Deleted all object stores.
 db.createObjectStore('someObjectStore')
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-objectStore = event.result
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
 objectStore.add('', testData[nextToAdd])
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor.html b/LayoutTests/storage/indexeddb/objectstore-cursor.html
index 702076f..92c1a7c 100644
--- a/LayoutTests/storage/indexeddb/objectstore-cursor.html
+++ b/LayoutTests/storage/indexeddb/objectstore-cursor.html
@@ -52,30 +52,20 @@ function deleteExisting()
     shouldBeTrue("trans !== null");
     trans.onabort = unexpectedAbortCallback;
 
-    deleteAllObjectStores(db, openObjectStore);
-}
-
-function openObjectStore()
-{
-    result = evalAndLog("db.createObjectStore('someObjectStore')");
-    verifyResult(result);
-    result.onsuccess = startAddingData;
-    result.onerror = unexpectedErrorCallback;
+    deleteAllObjectStores(db, startAddingData);
 }
  
 function startAddingData()
 {
-    verifySuccessEvent(event);
-    window.objectStore = evalAndLog("objectStore = event.result");
-
+    window.objectStore = evalAndLog("db.createObjectStore('someObjectStore')");
     window.nextToAdd = 0;
     addData();
 }
 
 function addData()
 {
-    // We cheat when called for the first time; we're in the context of the objectStore success event.
-    verifySuccessEvent(event);
+    if (window.nextToAdd > 0)
+        verifySuccessEvent(event);
 
     result = evalAndLog("objectStore.add('', testData[nextToAdd])");
     verifyResult(result);
diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
index b53e47d..38458bd 100644
--- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
@@ -40,24 +40,9 @@ PASS event.target.readyState is event.target.DONE
 
 trans = event.result
 PASS trans !== null is true
-db.createObjectStore('storeName', null)
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-event.result.add('value', 'key')
+Deleted all object stores.
+store = db.createObjectStore('storeName', null)
+store.add('value', 'key')
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
 PASS 'readyState' in result is true
@@ -95,22 +80,6 @@ PASS event.target.readyState is event.target.DONE
 
 PASS event.result is "value"
 event.source.createIndex('indexName', '')
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
 PASS event.source.indexNames.contains('indexName') is true
 db.setVersion('new version')
 PASS 'onsuccess' in result is true
@@ -132,39 +101,7 @@ PASS event.target.readyState is event.target.DONE
 trans = event.result
 PASS trans !== null is true
 db.removeObjectStore('storeName')
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
 db.createObjectStore('storeName', null)
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
 db.transaction()
 store = transaction.objectStore('storeName')
 store.get('key')
diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
index 93dcbf6..3877b1e 100644
--- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
+++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
@@ -39,22 +39,13 @@ function deleteExisting()
     window.trans = evalAndLog("trans = event.result");
     shouldBeTrue("trans !== null");
 
-    deleteAllObjectStores(db, createObjectStore);
+    deleteAllObjectStores(db, createObjectStoreAndAddValue);
 }
 
-function createObjectStore()
+function createObjectStoreAndAddValue()
 {
-    result = evalAndLog("db.createObjectStore('storeName', null)");
-    verifyResult(result);
-    result.onsuccess = addValue;
-    result.onerror = unexpectedErrorCallback;
-}
-
-function addValue()
-{
-    verifySuccessEvent(event);
-
-    result = evalAndLog("event.result.add('value', 'key')");
+    var store = evalAndLog("store = db.createObjectStore('storeName', null)");
+    result = evalAndLog("store.add('value', 'key')");
     verifyResult(result);
     result.onsuccess = getValue;
     result.onerror = unexpectedErrorCallback;
@@ -79,15 +70,7 @@ function addIndex()
     verifySuccessEvent(event);
     shouldBeEqualToString("event.result", "value");
 
-    result = evalAndLog("event.source.createIndex('indexName', '')");
-    verifyResult(result);
-    result.onsuccess = commitTransaction;
-    result.onerror = unexpectedErrorCallback;
-}
-
-function commitTransaction()
-{
-    verifySuccessEvent(event);
+    window.index = evalAndLog("event.source.createIndex('indexName', '')");
     shouldBeTrue("event.source.indexNames.contains('indexName')");
     // Let the transaction commit.
     window.setTimeout('secondSetVersion()', 0);
@@ -108,26 +91,18 @@ function removeObjectStore()
     shouldBeTrue("trans !== null");
     trans.onabort = unexpectedAbortCallback;
 
-    result = evalAndLog("db.removeObjectStore('storeName')");
-    verifyResult(result);
-    result.onsuccess = createObjectStoreAgain;
-    result.onerror = unexpectedErrorCallback;
+    evalAndLog("db.removeObjectStore('storeName')");
+    createObjectStoreAgain();
 }
 
 function createObjectStoreAgain()
 {
-    verifySuccessEvent(event);
-
-    result = evalAndLog("db.createObjectStore('storeName', null)");
-    verifyResult(result);
-    result.onsuccess = getValueAgain;
-    result.onerror = unexpectedErrorCallback;
+    evalAndLog("db.createObjectStore('storeName', null)");
+    getValueAgain();
 }
 
 function getValueAgain()
 {
-    verifySuccessEvent(event);
-
     transaction = evalAndLog("db.transaction()");
     transaction.onabort = unexpectedErrorCallback;
     var store = evalAndLog("store = transaction.objectStore('storeName')");
diff --git a/LayoutTests/storage/indexeddb/open-cursor-expected.txt b/LayoutTests/storage/indexeddb/open-cursor-expected.txt
index 48a689f..0e55be7 100644
--- a/LayoutTests/storage/indexeddb/open-cursor-expected.txt
+++ b/LayoutTests/storage/indexeddb/open-cursor-expected.txt
@@ -41,24 +41,8 @@ PASS event.target.readyState is event.target.DONE
 
 trans = event.result
 PASS trans !== null is true
-db.createObjectStore('test')
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
-objectStore = event.result
+Deleted all object stores.
+objectStore = db.createObjectStore('test')
 objectStore.add('myValue', 'myKey')
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
@@ -66,7 +50,7 @@ PASS 'readyState' in result is true
 An event should fire shortly...
 
 Opening cursor
-objectStore.openCursor(keyRange)
+event.source.openCursor(keyRange)
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
 PASS 'readyState' in result is true
diff --git a/LayoutTests/storage/indexeddb/open-cursor.html b/LayoutTests/storage/indexeddb/open-cursor.html
index 47c7e89..d4a9068 100644
--- a/LayoutTests/storage/indexeddb/open-cursor.html
+++ b/LayoutTests/storage/indexeddb/open-cursor.html
@@ -48,35 +48,21 @@ function openCursor()
 {
     debug("Opening cursor");
     keyRange = IDBKeyRange.leftBound("myKey");
-    result = evalAndLog("objectStore.openCursor(keyRange)");
+    result = evalAndLog("event.source.openCursor(keyRange)");
     verifyResult(result);
     result.onsuccess = cursorSuccess;
     result.onerror = unexpectedErrorCallback;
-}
-
-function populateObjectStore(objectStore)
-{
+}
+
+function createAndPopulateObjectStore() 
+{
+    var objectStore = evalAndLog("objectStore = db.createObjectStore('test')");
     result = evalAndLog("objectStore.add('myValue', 'myKey')");
     verifyResult(result);
     result.onsuccess = openCursor;
     result.onerror = unexpectedErrorCallback;
 }
 
-function createObjectStoreSuccess()
-{
-    verifySuccessEvent(event);
-    var objectStore = evalAndLog("objectStore = event.result");
-    populateObjectStore(objectStore);
-}
-
-function deleteSuccess()
-{
-    result = evalAndLog("db.createObjectStore('test')");
-    verifyResult(result);
-    result.onsuccess = createObjectStoreSuccess;
-    result.onerror = unexpectedErrorCallback;
-}
-
 function setVersionSuccess()
 {
     debug("setVersionSuccess():");
@@ -85,7 +71,7 @@ function setVersionSuccess()
     shouldBeTrue("trans !== null");
     trans.onabort = unexpectedAbortCallback;
 
-    deleteAllObjectStores(db, deleteSuccess);
+    deleteAllObjectStores(db, createAndPopulateObjectStore);
 }
 
 function openSuccess()
diff --git a/LayoutTests/storage/indexeddb/resources/shared.js b/LayoutTests/storage/indexeddb/resources/shared.js
index 7e11406..e695bc4 100644
--- a/LayoutTests/storage/indexeddb/resources/shared.js
+++ b/LayoutTests/storage/indexeddb/resources/shared.js
@@ -79,15 +79,12 @@ function unexpectedAbortCallback()
     done();
 }
 
+// FIXME: remove the onfinished parameter.
 function deleteAllObjectStores(db, onfinished)
-{
-    objectStores = db.objectStores;
-    if (!objectStores.length) {
-        onfinished();
-        return;
-    }
-
-    var request = db.removeObjectStore(objectStores[0]);
-    request.onerror = unexpectedErrorCallback;
-    request.onsuccess = function() { deleteAllObjectStores(db, onfinished); };
+{
+    for (i = 0; i < db.objectStores.length; ++i)
+        db.removeObjectStore(db.objectStores.item(i));
+
+    debug("Deleted all object stores.");
+    onfinished();
 }
diff --git a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
index 103b8c2..5ad34a1 100644
--- a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
@@ -44,23 +44,8 @@ PASS event.target.readyState is event.target.DONE
 
 trans = event.result
 PASS trans !== null is true
+Deleted all object stores.
 db.createObjectStore('storeName', null)
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
-Success event fired:
-PASS 'result' in event is true
-PASS 'code' in event is false
-PASS 'message' in event is false
-PASS 'source' in event is true
-PASS event.source != null is true
-PASS 'onsuccess' in event.target is true
-PASS 'onerror' in event.target is true
-PASS 'readyState' in event.target is true
-PASS event.target.readyState is event.target.DONE
-
 db.transaction()
 store = transaction.objectStore('storeName')
 PASS store.name is "storeName"
diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html
index 62363db..0557708 100644
--- a/LayoutTests/storage/indexeddb/transaction-basics.html
+++ b/LayoutTests/storage/indexeddb/transaction-basics.html
@@ -47,7 +47,16 @@ function setVersionSuccess()
     trans.oncomplete = completeCallback;
     window.completeEventFired = false;
 
-    deleteAllObjectStores(db, finishedDeleting);
+    deleteAllObjectStores(db, createObjectStoreAndStartTransaction);
+}
+
+function createObjectStoreAndStartTransaction()
+{
+    evalAndLog("db.createObjectStore('storeName', null)");
+    transaction = evalAndLog("db.transaction()");
+    transaction.onabort = abortCallback;
+    var store = evalAndLog("store = transaction.objectStore('storeName')");
+    shouldBeEqualToString("store.name", "storeName");
 }
 
 function completeCallback()
@@ -56,23 +65,6 @@ function completeCallback()
     window.completeEventFired = true;
 }
 
-function finishedDeleting()
-{
-    result = evalAndLog("db.createObjectStore('storeName', null)");
-    verifyResult(result);
-    result.onsuccess = createSuccess;
-    result.onerror = unexpectedErrorCallback;
-}
-
-function createSuccess()
-{
-    verifySuccessEvent(event);
-    transaction = evalAndLog("db.transaction()");
-    transaction.onabort = abortCallback;
-    var store = evalAndLog("store = transaction.objectStore('storeName')");
-    shouldBeEqualToString("store.name", "storeName");
-}
-
 function abortCallback()
 {
     verifyAbortEvent(event);
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9edab93..4c08961 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,60 @@
+2010-10-04  Andrei Popescu  <andreip at google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        IDBDatabase::createObjectStore/removeObjectStore and IDBObjectStore::createIndex/removeIndex should be synchronous.
+        https://bugs.webkit.org/show_bug.cgi?id=46883
+
+        Makes the schema manipulation methods synchronous. Modifies the transaction
+        logic to support tasks that may have pending events as well as tasks that
+        don't have such events.
+
+        * storage/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::createObjectStore):
+        (WebCore::IDBDatabase::removeObjectStore):
+        * storage/IDBDatabase.h:
+        * storage/IDBDatabase.idl:
+        * storage/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::createObjectStore):
+        (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal):
+        (WebCore::IDBDatabaseBackendImpl::removeObjectStore):
+        (WebCore::IDBDatabaseBackendImpl::removeObjectStoreInternal):
+        * storage/IDBDatabaseBackendImpl.h:
+        * storage/IDBDatabaseBackendInterface.h:
+        * storage/IDBIndexBackendImpl.cpp:
+        (WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl):
+        * storage/IDBIndexBackendImpl.h:
+        (WebCore::IDBIndexBackendImpl::create):
+        (WebCore::IDBIndexBackendImpl::id):
+        (WebCore::IDBIndexBackendImpl::setId):
+        * storage/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::createIndex):
+        (WebCore::IDBObjectStore::removeIndex):
+        * storage/IDBObjectStore.h:
+        * storage/IDBObjectStore.idl:
+        * storage/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
+        (WebCore::IDBObjectStoreBackendImpl::createIndex):
+        (WebCore::IDBObjectStoreBackendImpl::createIndexInternal):
+        (WebCore::IDBObjectStoreBackendImpl::removeIndex):
+        (WebCore::IDBObjectStoreBackendImpl::removeIndexInternal):
+        * storage/IDBObjectStoreBackendImpl.h:
+        (WebCore::IDBObjectStoreBackendImpl::create):
+        (WebCore::IDBObjectStoreBackendImpl::id):
+        (WebCore::IDBObjectStoreBackendImpl::setId):
+        (WebCore::IDBObjectStoreBackendImpl::autoIncrement):
+        * storage/IDBObjectStoreBackendInterface.h:
+        * storage/IDBTransactionBackendImpl.cpp:
+        (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
+        (WebCore::IDBTransactionBackendImpl::objectStore):
+        (WebCore::IDBTransactionBackendImpl::scheduleTask):
+        (WebCore::IDBTransactionBackendImpl::abort):
+        (WebCore::IDBTransactionBackendImpl::didCompleteTaskEvents):
+        (WebCore::IDBTransactionBackendImpl::run):
+        (WebCore::IDBTransactionBackendImpl::taskTimerFired):
+        (WebCore::IDBTransactionBackendImpl::taskEventTimerFired):
+        * storage/IDBTransactionBackendImpl.h:
+
 2010-10-05  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp
index 4d32213..046e9a9 100644
--- a/WebCore/storage/IDBDatabase.cpp
+++ b/WebCore/storage/IDBDatabase.cpp
@@ -55,26 +55,18 @@ void IDBDatabase::setSetVersionTransaction(IDBTransactionBackendInterface* trans
     m_setVersionTransaction = transaction;
 }
 
-// FIXME: Should be synchronous.
-PassRefPtr<IDBRequest> IDBDatabase::createObjectStore(ScriptExecutionContext* context, const String& name, const String& keyPath, bool autoIncrement)
+PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const String& keyPath, bool autoIncrement)
 {
-    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_setVersionTransaction.get());
-    if (!m_setVersionTransaction)
-        request->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "createObjectStore must be called from within a setVersion transaction."));
-    else
-        m_backend->createObjectStore(name, keyPath, autoIncrement, request, m_setVersionTransaction.get());
-    return request;
+    // FIXME: Raise a NOT_ALLOWED_ERR if m_setVersionTransaction is 0.
+    RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->createObjectStore(name, keyPath, autoIncrement, m_setVersionTransaction.get());
+    if (!objectStore)
+        return 0;
+    return IDBObjectStore::create(objectStore.release(), m_setVersionTransaction.get());
 }
 
-// FIXME: Should be synchronous.
-PassRefPtr<IDBRequest> IDBDatabase::removeObjectStore(ScriptExecutionContext* context, const String& name)
+void IDBDatabase::removeObjectStore(const String& name)
 {
-    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_setVersionTransaction.get());
-    if (!m_setVersionTransaction)
-        request->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "removeObjectStore must be called from within a setVersion transaction."));
-    else
-        m_backend->removeObjectStore(name, request, m_setVersionTransaction.get());
-    return request;
+    m_backend->removeObjectStore(name, m_setVersionTransaction.get());
 }
 
 PassRefPtr<IDBRequest> IDBDatabase::setVersion(ScriptExecutionContext* context, const String& version)
diff --git a/WebCore/storage/IDBDatabase.h b/WebCore/storage/IDBDatabase.h
index cf95317..43837d9 100644
--- a/WebCore/storage/IDBDatabase.h
+++ b/WebCore/storage/IDBDatabase.h
@@ -57,8 +57,8 @@ public:
     String version() const { return m_backend->version(); }
     PassRefPtr<DOMStringList> objectStores() const { return m_backend->objectStores(); }
 
-    PassRefPtr<IDBRequest> createObjectStore(ScriptExecutionContext*, const String& name, const String& keyPath = String(), bool autoIncrement = false);
-    PassRefPtr<IDBRequest> removeObjectStore(ScriptExecutionContext*, const String& name);
+    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?
diff --git a/WebCore/storage/IDBDatabase.idl b/WebCore/storage/IDBDatabase.idl
index 30cdf30..3f57437 100644
--- a/WebCore/storage/IDBDatabase.idl
+++ b/WebCore/storage/IDBDatabase.idl
@@ -32,8 +32,8 @@ module storage {
         readonly attribute DOMString version;
         readonly attribute DOMStringList objectStores;
 
-        [CallWith=ScriptExecutionContext] IDBRequest createObjectStore(in DOMString name, in [Optional, ConvertNullToNullString] DOMString keyPath, in [Optional] boolean autoIncrement);
-        [CallWith=ScriptExecutionContext] IDBRequest removeObjectStore(in DOMString name);
+        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);
         void close();
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp
index 453f85d..67644b1 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.cpp
+++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp
@@ -127,35 +127,38 @@ PassRefPtr<DOMStringList> IDBDatabaseBackendImpl::objectStores() const
     return objectStoreNames.release();
 }
 
-void IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction)
+PassRefPtr<IDBObjectStoreBackendInterface>  IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction)
 {
+    if (m_objectStores.contains(name)) {
+        // FIXME: Throw CONSTRAINT_ERR in this case.
+        return 0;
+    }
+
+    RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(this, name, keyPath, autoIncrement);
+    ASSERT(objectStore->name() == name);
+    m_objectStores.set(name, objectStore);
+
     RefPtr<IDBDatabaseBackendImpl> database = this;
-    RefPtr<IDBCallbacks> callbacks = prpCallbacks;
-    if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::createObjectStoreInternal, database, name, keyPath, autoIncrement, callbacks)))
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "createObjectStore must be called from within a setVersion transaction."));
+    RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction;
+    if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::createObjectStoreInternal, database, objectStore, transactionPtr)))
+        return 0;
+
+    return objectStore.release();
 }
 
-void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore,  PassRefPtr<IDBTransactionBackendInterface> transaction)
 {
-    if (database->m_objectStores.contains(name)) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "An objectStore with that name already exists."));
-        return;
-    }
-
     SQLiteStatement insert(database->sqliteDatabase(), "INSERT INTO ObjectStores (name, keyPath, doAutoIncrement) VALUES (?, ?, ?)");
     bool ok = insert.prepare() == SQLResultOk;
     ASSERT_UNUSED(ok, ok); // FIXME: Better error handling.
-    insert.bindText(1, name);
-    insert.bindText(2, keyPath);
-    insert.bindInt(3, static_cast<int>(autoIncrement));
+    insert.bindText(1, objectStore->name());
+    insert.bindText(2, objectStore->keyPath());
+    insert.bindInt(3, static_cast<int>(objectStore->autoIncrement()));
     ok = insert.step() == SQLResultDone;
     ASSERT_UNUSED(ok, ok); // FIXME: Better error handling.
     int64_t id = database->sqliteDatabase().lastInsertRowID();
-
-    RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(database.get(), id, name, keyPath, autoIncrement);
-    ASSERT(objectStore->name() == name);
-    database->m_objectStores.set(name, objectStore);
-    callbacks->onSuccess(objectStore.get());
+    objectStore->setId(id);
+    transaction->didCompleteTaskEvents();
 }
 
 // FIXME: Do not expose this method via IDL.
@@ -176,29 +179,28 @@ 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, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction)
-{
-    RefPtr<IDBDatabaseBackendImpl> database = this;
-    RefPtr<IDBCallbacks> callbacks = prpCallbacks;
-    if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::removeObjectStoreInternal, database, name, callbacks)))
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "removeObjectStore must be called from within a setVersion transaction."));
-}
-
-void IDBDatabaseBackendImpl::removeObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, const String& name, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::removeObjectStore(const String& name, IDBTransactionBackendInterface* transaction)
 {
-    RefPtr<IDBObjectStoreBackendImpl> objectStore = database->m_objectStores.get(name);
+    RefPtr<IDBObjectStoreBackendImpl> objectStore = m_objectStores.get(name);
     if (!objectStore) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "No objectStore with that name exists."));
+        // FIXME: Raise NOT_FOUND_ERR.
         return;
     }
+    m_objectStores.remove(name);
+    RefPtr<IDBDatabaseBackendImpl> database = this;
+    RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction;
+    transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::removeObjectStoreInternal, database, objectStore, transactionPtr));
+    // FIXME: Raise NOT_ALLOWED_ERR if the above fails.    
+}
 
+void IDBDatabaseBackendImpl::removeObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendInterface> transaction)
+{
     doDelete(database->sqliteDatabase(), "DELETE FROM ObjectStores WHERE id = ?", objectStore->id());
     doDelete(database->sqliteDatabase(), "DELETE FROM ObjectStoreData WHERE objectStoreId = ?", objectStore->id());
     doDelete(database->sqliteDatabase(), "DELETE FROM IndexData WHERE indexId IN (SELECT id FROM Indexes WHERE objectStoreId = ?)", objectStore->id());
     doDelete(database->sqliteDatabase(), "DELETE FROM Indexes WHERE objectStoreId = ?", objectStore->id());
 
-    database->m_objectStores.remove(name);
-    callbacks->onSuccess();
+    transaction->didCompleteTaskEvents();
 }
 
 void IDBDatabaseBackendImpl::setVersion(const String& version, PassRefPtr<IDBCallbacks> prpCallbacks)
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h
index b576fa5..0cb483d 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.h
+++ b/WebCore/storage/IDBDatabaseBackendImpl.h
@@ -55,9 +55,9 @@ public:
     virtual String version() const { return m_version; }
     virtual PassRefPtr<DOMStringList> objectStores() const;
 
-    virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+    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, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+    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 void close();
@@ -69,8 +69,8 @@ private:
 
     void loadObjectStores();
 
-    static void createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>);
-    static void removeObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& name, PassRefPtr<IDBCallbacks>);
+    static void createObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>);
+    static void removeObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>);
     static void setVersionInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl>, const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>);
 
     OwnPtr<SQLiteDatabase> m_sqliteDatabase;
diff --git a/WebCore/storage/IDBDatabaseBackendInterface.h b/WebCore/storage/IDBDatabaseBackendInterface.h
index c01dadf..4a5bb41 100644
--- a/WebCore/storage/IDBDatabaseBackendInterface.h
+++ b/WebCore/storage/IDBDatabaseBackendInterface.h
@@ -54,9 +54,9 @@ public:
     virtual String version() const = 0;
     virtual PassRefPtr<DOMStringList> objectStores() const = 0;
 
-    virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 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, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 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 void close() = 0;
diff --git a/WebCore/storage/IDBIndexBackendImpl.cpp b/WebCore/storage/IDBIndexBackendImpl.cpp
index 18e24b2..742c28e 100644
--- a/WebCore/storage/IDBIndexBackendImpl.cpp
+++ b/WebCore/storage/IDBIndexBackendImpl.cpp
@@ -50,6 +50,15 @@ IDBIndexBackendImpl::IDBIndexBackendImpl(IDBObjectStoreBackendImpl* objectStore,
 {
 }
 
+IDBIndexBackendImpl::IDBIndexBackendImpl(IDBObjectStoreBackendImpl* objectStore, const String& name, const String& keyPath, bool unique)
+    : m_objectStore(objectStore)
+    , m_id(InvalidId)
+    , m_name(name)
+    , m_keyPath(keyPath)
+    , m_unique(unique)
+{
+}
+
 IDBIndexBackendImpl::~IDBIndexBackendImpl()
 {
 }
diff --git a/WebCore/storage/IDBIndexBackendImpl.h b/WebCore/storage/IDBIndexBackendImpl.h
index 2d06c69..ca87148 100644
--- a/WebCore/storage/IDBIndexBackendImpl.h
+++ b/WebCore/storage/IDBIndexBackendImpl.h
@@ -43,9 +43,19 @@ public:
     {
         return adoptRef(new IDBIndexBackendImpl(objectStore, id, name, keyPath, unique));
     }
+    static PassRefPtr<IDBIndexBackendImpl> create(IDBObjectStoreBackendImpl* objectStore, const String& name, const String& keyPath, bool unique)
+    {
+        return adoptRef(new IDBIndexBackendImpl(objectStore, name, keyPath, unique));
+    }
     virtual ~IDBIndexBackendImpl();
 
-    int64_t id() { return m_id; }
+    int64_t id() const
+    {
+        ASSERT(m_id != InvalidId);
+        return m_id;
+    }
+    void setId(int64_t id) { m_id = id; }
+
     bool addingKeyAllowed(IDBKey*);
 
     // Implements IDBIndexBackendInterface.
@@ -63,12 +73,15 @@ public:
 
 private:
     IDBIndexBackendImpl(IDBObjectStoreBackendImpl*, int64_t id, const String& name, const String& keyPath, bool unique);
+    IDBIndexBackendImpl(IDBObjectStoreBackendImpl*, const String& name, const String& keyPath, bool unique);
 
     SQLiteDatabase& sqliteDatabase() const;
 
     static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, bool objectCursor, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>);
     static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKey>, bool getObject, PassRefPtr<IDBCallbacks>);
 
+    static const int64_t InvalidId = 0;
+
     RefPtr<IDBObjectStoreBackendImpl> m_objectStore;
 
     int64_t m_id;
diff --git a/WebCore/storage/IDBObjectStore.cpp b/WebCore/storage/IDBObjectStore.cpp
index a81e17f..c481099 100644
--- a/WebCore/storage/IDBObjectStore.cpp
+++ b/WebCore/storage/IDBObjectStore.cpp
@@ -92,11 +92,12 @@ PassRefPtr<IDBRequest> IDBObjectStore::remove(ScriptExecutionContext* context, P
     return request;
 }
 
-PassRefPtr<IDBRequest> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, const String& keyPath, bool unique)
+PassRefPtr<IDBIndex> IDBObjectStore::createIndex(const String& name, const String& keyPath, bool unique)
 {
-    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
-    m_objectStore->createIndex(name, keyPath, unique, request, m_transaction.get());
-    return request;
+    RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, m_transaction.get());
+    if (!index)
+        return 0;
+    return IDBIndex::create(index.release(), m_transaction.get());
 }
 
 PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name)
@@ -108,11 +109,9 @@ PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name)
     return IDBIndex::create(index.release(), m_transaction.get());
 }
 
-PassRefPtr<IDBRequest> IDBObjectStore::removeIndex(ScriptExecutionContext* context, const String& name)
+void IDBObjectStore::removeIndex(const String& name)
 {
-    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
-    m_objectStore->removeIndex(name, request, m_transaction.get());
-    return request;
+    m_objectStore->removeIndex(name, m_transaction.get());
 }
 
 PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction)
diff --git a/WebCore/storage/IDBObjectStore.h b/WebCore/storage/IDBObjectStore.h
index df5b3f7..a173b68 100644
--- a/WebCore/storage/IDBObjectStore.h
+++ b/WebCore/storage/IDBObjectStore.h
@@ -63,9 +63,9 @@ public:
     PassRefPtr<IDBRequest> put(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key = 0);
     PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<IDBKey> key);
 
-    PassRefPtr<IDBRequest> createIndex(ScriptExecutionContext*, const String& name, const String& keyPath, bool unique = false);
+    PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, bool unique = false);
     PassRefPtr<IDBIndex> index(const String& name);
-    PassRefPtr<IDBRequest> removeIndex(ScriptExecutionContext*, const String& name);
+    void removeIndex(const String& name);
 
     PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange> = 0, unsigned short direction = IDBCursor::NEXT);
 
diff --git a/WebCore/storage/IDBObjectStore.idl b/WebCore/storage/IDBObjectStore.idl
index c8aa35d..ef3aad8 100644
--- a/WebCore/storage/IDBObjectStore.idl
+++ b/WebCore/storage/IDBObjectStore.idl
@@ -37,9 +37,12 @@ module storage {
         [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);
-        [CallWith=ScriptExecutionContext] IDBRequest createIndex(in DOMString name, in [ConvertNullToNullString] DOMString keyPath, in [Optional] boolean unique);
+        // 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);
-        [CallWith=ScriptExecutionContext] IDBRequest removeIndex(in DOMString name);
+        void removeIndex(in DOMString name);
+
         [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction);
     };
 }
diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
index 50a2dec..cfd8a95 100644
--- a/WebCore/storage/IDBObjectStoreBackendImpl.cpp
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
@@ -62,6 +62,15 @@ IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBDatabaseBackendImpl* dat
     loadIndexes();
 }
 
+IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBDatabaseBackendImpl* database, const String& name, const String& keyPath, bool autoIncrement)
+    : m_database(database)
+    , m_id(InvalidId)
+    , m_name(name)
+    , m_keyPath(keyPath)
+    , m_autoIncrement(autoIncrement)
+{
+}
+
 PassRefPtr<DOMStringList> IDBObjectStoreBackendImpl::indexNames() const
 {
     RefPtr<DOMStringList> indexNames = DOMStringList::create();
@@ -254,36 +263,39 @@ void IDBObjectStoreBackendImpl::removeInternal(ScriptExecutionContext*, PassRefP
     callbacks->onSuccess();
 }
 
-void IDBObjectStoreBackendImpl::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction)
+PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface* transaction)
 {
+    if (m_indexes.contains(name)) {
+        // FIXME: Raise CONSTRAINT_ERR.
+        return 0;
+    }
+
+    RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(this, name, keyPath, unique);
+    ASSERT(index->name() == name);
+    m_indexes.set(name, index);
+
     RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
-    RefPtr<IDBCallbacks> callbacks = prpCallbacks;
-    if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::createIndexInternal, objectStore, name, keyPath, unique, callbacks)))
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "createIndex must be called in the context of a transaction."));
+    RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction;
+    if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::createIndexInternal, objectStore, index, transaction)))
+        return 0;
+
+    return index.release();
 }
 
-void IDBObjectStoreBackendImpl::createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks)
+void IDBObjectStoreBackendImpl::createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendInterface> transaction)
 {
-    if (objectStore->m_indexes.contains(name)) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Index name already exists."));
-        return;
-    }
-
     SQLiteStatement insert(objectStore->sqliteDatabase(), "INSERT INTO Indexes (objectStoreId, name, keyPath, isUnique) VALUES (?, ?, ?, ?)");
     bool ok = insert.prepare() == SQLResultOk;
     ASSERT_UNUSED(ok, ok); // FIXME: Better error handling.
     insert.bindInt64(1, objectStore->m_id);
-    insert.bindText(2, name);
-    insert.bindText(3, keyPath);
-    insert.bindInt(4, static_cast<int>(unique));
+    insert.bindText(2, index->name());
+    insert.bindText(3, index->keyPath());
+    insert.bindInt(4, static_cast<int>(index->unique()));
     ok = insert.step() == SQLResultDone;
     ASSERT_UNUSED(ok, ok); // FIXME: Better error handling.
     int64_t id = objectStore->sqliteDatabase().lastInsertRowID();
-
-    RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(objectStore.get(), id, name, keyPath, unique);
-    ASSERT(index->name() == name);
-    objectStore->m_indexes.set(name, index);
-    callbacks->onSuccess(index.get());
+    index->setId(id);
+    transaction->didCompleteTaskEvents();
 }
 
 PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::index(const String& name)
@@ -301,27 +313,26 @@ 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, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction)
-{
-    RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
-    RefPtr<IDBCallbacks> callbacks = prpCallbacks;
-    if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::removeIndexInternal, objectStore, name, callbacks)))
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_ALLOWED_ERR, "createIndex must be called in the context of a transaction."));
-}
-
-void IDBObjectStoreBackendImpl::removeIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, const String& name, PassRefPtr<IDBCallbacks> callbacks)
+void IDBObjectStoreBackendImpl::removeIndex(const String& name, IDBTransactionBackendInterface* transaction)
 {
-    RefPtr<IDBIndexBackendImpl> index = objectStore->m_indexes.get(name);
+    RefPtr<IDBIndexBackendImpl> index = m_indexes.get(name);
     if (!index) {
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Index name does not exist."));
+        // FIXME: Raise NOT_FOUND_ERR.
         return;
     }
+    m_indexes.remove(name);
+    RefPtr<IDBObjectStoreBackendImpl> objectStore = this;
+    RefPtr<IDBTransactionBackendInterface> transactionPtr = transaction;
+    transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::removeIndexInternal, objectStore, index, transactionPtr));
+    // FIXME: Raise NOT_ALLOWED_ERR if the above statement fails.
+}
 
+void IDBObjectStoreBackendImpl::removeIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendInterface> transaction)
+{
     doDelete(objectStore->sqliteDatabase(), "DELETE FROM Indexes WHERE id = ?", index->id());
     doDelete(objectStore->sqliteDatabase(), "DELETE FROM IndexData WHERE indexId = ?", index->id());
 
-    objectStore->m_indexes.remove(name);
-    callbacks->onSuccess();
+    transaction->didCompleteTaskEvents();
 }
 
 void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr)
diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.h b/WebCore/storage/IDBObjectStoreBackendImpl.h
index ed994fb..74fc0dd 100644
--- a/WebCore/storage/IDBObjectStoreBackendImpl.h
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.h
@@ -46,20 +46,30 @@ public:
     {
         return adoptRef(new IDBObjectStoreBackendImpl(database, id, name, keyPath, autoIncrement));
     }
+    static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBDatabaseBackendImpl* database, const String& name, const String& keyPath, bool autoIncrement)
+    {
+        return adoptRef(new IDBObjectStoreBackendImpl(database, name, keyPath, autoIncrement));
+    }
     ~IDBObjectStoreBackendImpl();
 
-    int64_t id() const { return m_id; }
+    int64_t id() const
+    {
+        ASSERT(m_id != InvalidId);
+        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*);
 
-    void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+    PassRefPtr<IDBIndexBackendInterface> createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface*);
     PassRefPtr<IDBIndexBackendInterface> index(const String& name);
-    void removeIndex(const String& name, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+    void removeIndex(const String& name, IDBTransactionBackendInterface*);
 
     void openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
 
@@ -67,6 +77,7 @@ public:
 
 private:
     IDBObjectStoreBackendImpl(IDBDatabaseBackendImpl*, int64_t id, const String& name, const String& keyPath, bool autoIncrement);
+    IDBObjectStoreBackendImpl(IDBDatabaseBackendImpl*, const String& name, const String& keyPath, bool autoIncrement);
 
     void loadIndexes();
     SQLiteDatabase& sqliteDatabase() const;
@@ -74,10 +85,12 @@ private:
     static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>);
     static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>);
     static void removeInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>);
-    static void createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>);
-    static void removeIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, const String& name, PassRefPtr<IDBCallbacks>);
+    static void createIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>);
+    static void removeIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBTransactionBackendInterface>);
     static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>);
 
+    static const int64_t InvalidId = 0;
+
     RefPtr<IDBDatabaseBackendImpl> m_database;
 
     int64_t m_id;
diff --git a/WebCore/storage/IDBObjectStoreBackendInterface.h b/WebCore/storage/IDBObjectStoreBackendInterface.h
index 53ade62..6d9fcb8 100644
--- a/WebCore/storage/IDBObjectStoreBackendInterface.h
+++ b/WebCore/storage/IDBObjectStoreBackendInterface.h
@@ -53,9 +53,9 @@ public:
     virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, bool addOnly, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
     virtual void remove(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
 
-    virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 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, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
+    virtual void removeIndex(const String& name, IDBTransactionBackendInterface*) = 0;
 
     virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*) = 0;
 };
diff --git a/WebCore/storage/IDBTransactionBackendImpl.cpp b/WebCore/storage/IDBTransactionBackendImpl.cpp
index 32a7d70..0ad77f7 100644
--- a/WebCore/storage/IDBTransactionBackendImpl.cpp
+++ b/WebCore/storage/IDBTransactionBackendImpl.cpp
@@ -47,21 +47,22 @@ IDBTransactionBackendImpl::IDBTransactionBackendImpl(DOMStringList* objectStores
     , m_state(Unused)
     , m_database(database)
     , m_transaction(new SQLiteTransaction(database->sqliteDatabase()))
-    , m_timer(this, &IDBTransactionBackendImpl::timerFired)
+    , m_taskTimer(this, &IDBTransactionBackendImpl::taskTimerFired)
+    , m_taskEventTimer(this, &IDBTransactionBackendImpl::taskEventTimerFired)
     , m_pendingEvents(0)
 {
 }
 
 PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStore(const String& name)
 {
-    if (isFinished())
+    if (m_state == Finished)
         return 0;
     return m_database->objectStore(name, 0); // FIXME: remove mode param.
 }
 
 bool IDBTransactionBackendImpl::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task)
 {
-    if (isFinished())
+    if (m_state == Finished)
         return false;
 
     m_taskQueue.append(task);
@@ -73,11 +74,12 @@ bool IDBTransactionBackendImpl::scheduleTask(PassOwnPtr<ScriptExecutionContext::
 
 void IDBTransactionBackendImpl::abort()
 {
-    if (isFinished())
+    if (m_state == Finished)
         return;
 
     m_state = Finished;
-    m_timer.stop();
+    m_taskTimer.stop();
+    m_taskEventTimer.stop();
     m_transaction->rollback();
     m_callbacks->onAbort();
     m_database->transactionCoordinator()->didFinishTransaction(this);
@@ -90,29 +92,18 @@ void IDBTransactionBackendImpl::didCompleteTaskEvents()
 
     ASSERT(m_state == Running);
     ASSERT(m_pendingEvents);
-
     m_pendingEvents--;
 
-    if (!m_pendingEvents && m_taskQueue.isEmpty()) {
-        // The last task event has completed and the task
-        // queue is empty. Commit the transaction.
-        commit();
-        return;
-    }
-
-    // We are still waiting for other events to complete. However,
-    // the task queue is non-empty and the timer is inactive.
-    // We can therfore schedule the timer again.
-    if (!m_taskQueue.isEmpty() && !m_timer.isActive())
-        m_timer.startOneShot(0);
+    if (!m_taskEventTimer.isActive())
+        m_taskEventTimer.startOneShot(0);
 }
 
 void IDBTransactionBackendImpl::run()
 {
     ASSERT(m_state == StartPending || m_state == Running);
-    ASSERT(!m_timer.isActive());
+    ASSERT(!m_taskTimer.isActive());
 
-    m_timer.startOneShot(0);
+    m_taskTimer.startOneShot(0);
 }
 
 void IDBTransactionBackendImpl::start()
@@ -133,7 +124,7 @@ void IDBTransactionBackendImpl::commit()
     m_database->transactionCoordinator()->didFinishTransaction(this);
 }
 
-void IDBTransactionBackendImpl::timerFired(Timer<IDBTransactionBackendImpl>*)
+void IDBTransactionBackendImpl::taskTimerFired(Timer<IDBTransactionBackendImpl>*)
 {
     ASSERT(!m_taskQueue.isEmpty());
 
@@ -153,6 +144,24 @@ void IDBTransactionBackendImpl::timerFired(Timer<IDBTransactionBackendImpl>*)
     }
 }
 
+void IDBTransactionBackendImpl::taskEventTimerFired(Timer<IDBTransactionBackendImpl>*)
+{
+    ASSERT(m_state == Running);
+
+    if (!m_pendingEvents && m_taskQueue.isEmpty()) {
+        // The last task event has completed and the task
+        // queue is empty. Commit the transaction.
+        commit();
+        return;
+    }
+
+    // We are still waiting for other events to complete. However,
+    // the task queue is non-empty and the timer is inactive.
+    // We can therfore schedule the timer again.
+    if (!m_taskQueue.isEmpty() && !m_taskTimer.isActive())
+        m_taskTimer.startOneShot(0);
+}
+
 };
 
 #endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBTransactionBackendImpl.h b/WebCore/storage/IDBTransactionBackendImpl.h
index 09a6a1c..cf40eba 100644
--- a/WebCore/storage/IDBTransactionBackendImpl.h
+++ b/WebCore/storage/IDBTransactionBackendImpl.h
@@ -54,7 +54,6 @@ public:
     virtual void setCallbacks(IDBTransactionCallbacks* callbacks) { m_callbacks = callbacks; }
 
     void run();
-    bool isFinished() const { return m_state == Finished; }
 
 private:
     IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl*);
@@ -69,7 +68,8 @@ private:
     void start();
     void commit();
 
-    void timerFired(Timer<IDBTransactionBackendImpl>*);
+    void taskTimerFired(Timer<IDBTransactionBackendImpl>*);
+    void taskEventTimerFired(Timer<IDBTransactionBackendImpl>*);
 
     RefPtr<DOMStringList> m_objectStoreNames;
     unsigned short m_mode;
@@ -86,7 +86,8 @@ private:
     OwnPtr<SQLiteTransaction> m_transaction;
 
     // FIXME: delete the timer once we have threads instead.
-    Timer<IDBTransactionBackendImpl> m_timer;
+    Timer<IDBTransactionBackendImpl> m_taskTimer;
+    Timer<IDBTransactionBackendImpl> m_taskEventTimer;
     int m_pendingEvents;
 };
 
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 64d21fb..fa41fb5 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,33 @@
+2010-10-04  Andrei Popescu  <andreip at google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        IDBDatabase::createObjectStore/removeObjectStore and IDBObjectStore::createIndex/removeIndex should be synchronous.
+        https://bugs.webkit.org/show_bug.cgi?id=46883
+
+        * public/WebIDBDatabase.h:
+        (WebKit::WebIDBDatabase::createObjectStore):
+        (WebKit::WebIDBDatabase::removeObjectStore):
+        * public/WebIDBObjectStore.h:
+        (WebKit::WebIDBObjectStore::createIndex):
+        (WebKit::WebIDBObjectStore::removeIndex):
+        * src/IDBDatabaseProxy.cpp:
+        (WebCore::IDBDatabaseProxy::createObjectStore):
+        (WebCore::IDBDatabaseProxy::removeObjectStore):
+        * src/IDBDatabaseProxy.h:
+        * src/IDBObjectStoreProxy.cpp:
+        (WebCore::IDBObjectStoreProxy::createIndex):
+        (WebCore::IDBObjectStoreProxy::removeIndex):
+        * src/IDBObjectStoreProxy.h:
+        * src/WebIDBDatabaseImpl.cpp:
+        (WebKit::WebIDBDatabaseImpl::createObjectStore):
+        (WebKit::WebIDBDatabaseImpl::removeObjectStore):
+        * src/WebIDBDatabaseImpl.h:
+        * src/WebIDBObjectStoreImpl.cpp:
+        (WebKit::WebIDBObjectStoreImpl::createIndex):
+        (WebKit::WebIDBObjectStoreImpl::removeIndex):
+        * src/WebIDBObjectStoreImpl.h:
+
 2010-10-04  Andrey Kosyakov  <caseq at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/WebKit/chromium/public/WebIDBDatabase.h b/WebKit/chromium/public/WebIDBDatabase.h
index 8c4b470..fe07ac8 100644
--- a/WebKit/chromium/public/WebIDBDatabase.h
+++ b/WebKit/chromium/public/WebIDBDatabase.h
@@ -61,18 +61,23 @@ public:
         WEBKIT_ASSERT_NOT_REACHED();
         return WebDOMStringList();
     }
+
     // FIXME: Remove once we update Chromium side.
     virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
-    virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks*, const WebIDBTransaction&) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction&)
+    { 
+        WEBKIT_ASSERT_NOT_REACHED();
+        return 0;
+    }
     // Transfers ownership of the WebIDBObjectStore to the caller.
     virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode)
     {
         WEBKIT_ASSERT_NOT_REACHED();
         return 0;
     }
-    // FIXME: Remove once we update Chromium side.
+    // FIXME: Remove after WebKit roll.
     virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks) { WEBKIT_ASSERT_NOT_REACHED(); }
-    virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks, const WebIDBTransaction&) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void removeObjectStore(const WebString& name, const WebIDBTransaction&) { WEBKIT_ASSERT_NOT_REACHED(); }
     virtual void setVersion(const WebString& version, WebIDBCallbacks* callbacks) { WEBKIT_ASSERT_NOT_REACHED(); }
     // Transfers ownership of the WebIDBTransaction to the caller.
     virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout)
diff --git a/WebKit/chromium/public/WebIDBObjectStore.h b/WebKit/chromium/public/WebIDBObjectStore.h
index e157e95..24a432e 100755
--- a/WebKit/chromium/public/WebIDBObjectStore.h
+++ b/WebKit/chromium/public/WebIDBObjectStore.h
@@ -63,7 +63,11 @@ public:
     virtual void remove(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&) { WEBKIT_ASSERT_NOT_REACHED(); }
     // FIXME: Remove once we update Chromium side.
     virtual void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
-    virtual void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks*, const WebIDBTransaction&) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction&)
+    {
+        WEBKIT_ASSERT_NOT_REACHED();
+        return 0;
+    }
     // Transfers ownership of the WebIDBIndex to the caller.
     virtual WebIDBIndex* index(const WebString& name)
     {
@@ -72,7 +76,7 @@ public:
     }
     // FIXME: Remove once we update Chromium side.
     virtual void removeIndex(const WebString& name, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
-    virtual void removeIndex(const WebString& name, WebIDBCallbacks*, const WebIDBTransaction&) { WEBKIT_ASSERT_NOT_REACHED(); }
+    virtual void removeIndex(const WebString& name, const WebIDBTransaction&) { WEBKIT_ASSERT_NOT_REACHED(); }
     virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&) { WEBKIT_ASSERT_NOT_REACHED(); }
     // FIXME: finish.
 };
diff --git a/WebKit/chromium/src/IDBDatabaseProxy.cpp b/WebKit/chromium/src/IDBDatabaseProxy.cpp
index 564fddb..1dec18a 100644
--- a/WebKit/chromium/src/IDBDatabaseProxy.cpp
+++ b/WebKit/chromium/src/IDBDatabaseProxy.cpp
@@ -76,12 +76,15 @@ PassRefPtr<DOMStringList> IDBDatabaseProxy::objectStores() const
     return m_webIDBDatabase->objectStores();
 }
 
-void IDBDatabaseProxy::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseProxy::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction)
 {
     // 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->createObjectStore(name, keyPath, autoIncrement, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+    WebKit::WebIDBObjectStore* objectStore = m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, *transactionProxy->getWebIDBTransaction());
+    if (!objectStore)
+        return 0;
+    return IDBObjectStoreProxy::create(objectStore);
 }
 
 PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseProxy::objectStore(const String& name, unsigned short mode)
@@ -92,12 +95,12 @@ PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseProxy::objectStore(const S
     return IDBObjectStoreProxy::create(objectStore);
 }
 
-void IDBDatabaseProxy::removeObjectStore(const String& name, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBDatabaseProxy::removeObjectStore(const String& name, IDBTransactionBackendInterface* transaction)
 {
     // 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, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+    m_webIDBDatabase->removeObjectStore(name, *transactionProxy->getWebIDBTransaction());
 }
 
 void IDBDatabaseProxy::setVersion(const String& version, PassRefPtr<IDBCallbacks> callbacks)
diff --git a/WebKit/chromium/src/IDBDatabaseProxy.h b/WebKit/chromium/src/IDBDatabaseProxy.h
index eaeeb27..1494ef0 100644
--- a/WebKit/chromium/src/IDBDatabaseProxy.h
+++ b/WebKit/chromium/src/IDBDatabaseProxy.h
@@ -47,9 +47,9 @@ public:
     virtual String version() const;
     virtual PassRefPtr<DOMStringList> objectStores() const;
 
-    virtual void createObjectStore(const String& name, const String& keyPath, bool autoIncrement, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+    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, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+    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 void close();
diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.cpp b/WebKit/chromium/src/IDBObjectStoreProxy.cpp
index 69aa8ca..a009aa8 100755
--- a/WebKit/chromium/src/IDBObjectStoreProxy.cpp
+++ b/WebKit/chromium/src/IDBObjectStoreProxy.cpp
@@ -96,12 +96,15 @@ void IDBObjectStoreProxy::remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks
     m_webIDBObjectStore->remove(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
 }
 
-void IDBObjectStoreProxy::createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::createIndex(const String& name, const String& keyPath, bool unique, IDBTransactionBackendInterface* transaction)
 {
     // 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->createIndex(name, keyPath, unique, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+    WebKit::WebIDBIndex* index = m_webIDBObjectStore->createIndex(name, keyPath, unique, *transactionProxy->getWebIDBTransaction());
+    if (!index)
+        return 0;
+    return IDBIndexBackendProxy::create(index);
 }
 
 PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::index(const String& name)
@@ -112,12 +115,12 @@ PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreProxy::index(const String& na
     return IDBIndexBackendProxy::create(index);
 }
 
-void IDBObjectStoreProxy::removeIndex(const String& name, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
+void IDBObjectStoreProxy::removeIndex(const String& name, IDBTransactionBackendInterface* transaction)
 {
     // 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, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction());
+    m_webIDBObjectStore->removeIndex(name, *transactionProxy->getWebIDBTransaction());
 }
 
 void IDBObjectStoreProxy::openCursor(PassRefPtr<IDBKeyRange> range, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction)
diff --git a/WebKit/chromium/src/IDBObjectStoreProxy.h b/WebKit/chromium/src/IDBObjectStoreProxy.h
index 80e4668..86b9c68 100755
--- a/WebKit/chromium/src/IDBObjectStoreProxy.h
+++ b/WebKit/chromium/src/IDBObjectStoreProxy.h
@@ -50,9 +50,9 @@ public:
     virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, bool addOnly, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
     virtual void remove(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
 
-    virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
-    virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name);
-    virtual void removeIndex(const String& name, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
+    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 openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*);
 
diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
index abe6fbd..c8d81d6 100644
--- a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
+++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
@@ -69,9 +69,12 @@ WebDOMStringList WebIDBDatabaseImpl::objectStores() const
     return m_databaseBackend->objectStores();
 }
 
-void WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction& transaction)
 {
-    m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+    RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, transaction.getIDBTransactionBackendInterface());
+    if (!objectStore)
+        return 0;
+    return new WebIDBObjectStoreImpl(objectStore);
 }
 
 WebIDBObjectStore* WebIDBDatabaseImpl::objectStore(const WebString& name, unsigned short mode)
@@ -82,9 +85,9 @@ WebIDBObjectStore* WebIDBDatabaseImpl::objectStore(const WebString& name, unsign
     return new WebIDBObjectStoreImpl(objectStore);
 }
 
-void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, const WebIDBTransaction& transaction)
 {
-    m_databaseBackend->removeObjectStore(name, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+    m_databaseBackend->removeObjectStore(name, transaction.getIDBTransactionBackendInterface());
 }
 
 void WebIDBDatabaseImpl::setVersion(const WebString& version, WebIDBCallbacks* callbacks)
diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h
index 2274e48..8e360da 100644
--- a/WebKit/chromium/src/WebIDBDatabaseImpl.h
+++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h
@@ -49,9 +49,9 @@ public:
     virtual WebString version() const;
     virtual WebDOMStringList objectStores() const;
 
-    virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks, const WebIDBTransaction&);
+    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, WebIDBCallbacks* callbacks, const WebIDBTransaction&);
+    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 void close();
diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
index 3cf7f25..9fb7ab6 100755
--- a/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
+++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp
@@ -81,9 +81,12 @@ void WebIDBObjectStoreImpl::remove(const WebIDBKey& key, WebIDBCallbacks* callba
     m_objectStore->remove(key, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
 }
 
-void WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+WebIDBIndex* WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction& transaction)
 {
-    m_objectStore->createIndex(name, keyPath, unique, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+    RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, transaction.getIDBTransactionBackendInterface());
+    if (!index)
+        return 0;
+    return new WebIDBIndexImpl(index);
 }
 
 WebIDBIndex* WebIDBObjectStoreImpl::index(const WebString& name)
@@ -94,9 +97,9 @@ WebIDBIndex* WebIDBObjectStoreImpl::index(const WebString& name)
     return new WebIDBIndexImpl(index);
 }
 
-void WebIDBObjectStoreImpl::removeIndex(const WebString& name, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
+void WebIDBObjectStoreImpl::removeIndex(const WebString& name, const WebIDBTransaction& transaction)
 {
-    m_objectStore->removeIndex(name, IDBCallbacksProxy::create(callbacks), transaction.getIDBTransactionBackendInterface());
+    m_objectStore->removeIndex(name, transaction.getIDBTransactionBackendInterface());
 }
 
 void WebIDBObjectStoreImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction)
diff --git a/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/WebKit/chromium/src/WebIDBObjectStoreImpl.h
index 76e414b..ee1ec0b 100755
--- a/WebKit/chromium/src/WebIDBObjectStoreImpl.h
+++ b/WebKit/chromium/src/WebIDBObjectStoreImpl.h
@@ -51,9 +51,9 @@ public:
     void put(const WebSerializedScriptValue&, const WebIDBKey& key, bool addOnly, WebIDBCallbacks*, const WebIDBTransaction&);
     void remove(const WebIDBKey& key, WebIDBCallbacks*, const WebIDBTransaction&);
 
-    void createIndex(const WebString& name, const WebString& keyPath, bool unique, WebIDBCallbacks*, const WebIDBTransaction&);
+    WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, const WebIDBTransaction&);
     WebIDBIndex* index(const WebString& name);
-    void removeIndex(const WebString& name, WebIDBCallbacks*, const WebIDBTransaction&);
+    void removeIndex(const WebString& name, const WebIDBTransaction&);
 
     void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list