Backout indexedDB for test failure
authorBen Turner <bent.mozilla@gmail.com>
Mon, 21 Jun 2010 21:33:37 -0700
changeset 44116 7e0ef763cf6ebf65a6c47dbcf3282dd9d029011f
parent 44115 89aaaa116328d7b780918e3f8e03b583943abd95
child 44117 e9ee970f085a16be6bdf9be339eb53c7ce4eb98d
push idunknown
push userunknown
push dateunknown
milestone1.9.3a6pre
Backout indexedDB for test failure
.hgtags
browser/installer/package-manifest.in
configure.in
content/events/src/nsDOMEventTargetHelper.h
db/sqlite3/src/Makefile.in
db/sqlite3/src/sqlite.def
dom/Makefile.in
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/indexedDB/AsyncConnectionHelper.cpp
dom/indexedDB/AsyncConnectionHelper.h
dom/indexedDB/DatabaseInfo.cpp
dom/indexedDB/DatabaseInfo.h
dom/indexedDB/IDBCursorRequest.cpp
dom/indexedDB/IDBCursorRequest.h
dom/indexedDB/IDBDatabaseRequest.cpp
dom/indexedDB/IDBDatabaseRequest.h
dom/indexedDB/IDBEvents.cpp
dom/indexedDB/IDBEvents.h
dom/indexedDB/IDBIndexRequest.cpp
dom/indexedDB/IDBIndexRequest.h
dom/indexedDB/IDBKeyRange.cpp
dom/indexedDB/IDBKeyRange.h
dom/indexedDB/IDBObjectStoreRequest.cpp
dom/indexedDB/IDBObjectStoreRequest.h
dom/indexedDB/IDBRequest.cpp
dom/indexedDB/IDBRequest.h
dom/indexedDB/IDBTransactionRequest.cpp
dom/indexedDB/IDBTransactionRequest.h
dom/indexedDB/IndexedDatabase.h
dom/indexedDB/IndexedDatabaseRequest.cpp
dom/indexedDB/IndexedDatabaseRequest.h
dom/indexedDB/LazyIdleThread.cpp
dom/indexedDB/LazyIdleThread.h
dom/indexedDB/Makefile.in
dom/indexedDB/Savepoint.h
dom/indexedDB/TransactionThreadPool.cpp
dom/indexedDB/TransactionThreadPool.h
dom/indexedDB/nsIIDBCursor.idl
dom/indexedDB/nsIIDBCursorRequest.idl
dom/indexedDB/nsIIDBDatabase.idl
dom/indexedDB/nsIIDBDatabaseException.idl
dom/indexedDB/nsIIDBDatabaseRequest.idl
dom/indexedDB/nsIIDBErrorEvent.idl
dom/indexedDB/nsIIDBEvent.idl
dom/indexedDB/nsIIDBIndex.idl
dom/indexedDB/nsIIDBIndexRequest.idl
dom/indexedDB/nsIIDBKeyRange.idl
dom/indexedDB/nsIIDBObjectStore.idl
dom/indexedDB/nsIIDBObjectStoreRequest.idl
dom/indexedDB/nsIIDBRequest.idl
dom/indexedDB/nsIIDBSuccessEvent.idl
dom/indexedDB/nsIIDBTransaction.idl
dom/indexedDB/nsIIDBTransactionEvent.idl
dom/indexedDB/nsIIDBTransactionRequest.idl
dom/indexedDB/nsIIndexedDatabaseRequest.idl
dom/indexedDB/test/Makefile.in
dom/indexedDB/test/helpers.js
dom/indexedDB/test/test_add_twice_failure.html
dom/indexedDB/test/test_bad_keypath.html
dom/indexedDB/test/test_create_index.html
dom/indexedDB/test/test_create_objectStore.html
dom/indexedDB/test/test_cursor_update_updates_indexes.html
dom/indexedDB/test/test_cursors.html
dom/indexedDB/test/test_event_source.html
dom/indexedDB/test/test_getAll.html
dom/indexedDB/test/test_global_data.html
dom/indexedDB/test/test_index_getAll.html
dom/indexedDB/test/test_index_getAllObjects.html
dom/indexedDB/test/test_indexes.html
dom/indexedDB/test/test_indexes_bad_values.html
dom/indexedDB/test/test_key_requirements.html
dom/indexedDB/test/test_null_keys.html
dom/indexedDB/test/test_objectStore_inline_autoincrement_key_added_on_put.html
dom/indexedDB/test/test_objectStore_remove_values.html
dom/indexedDB/test/test_open_empty_db.html
dom/indexedDB/test/test_open_objectStore.html
dom/indexedDB/test/test_overlapping_transactions.html
dom/indexedDB/test/test_put_get_values.html
dom/indexedDB/test/test_put_get_values_autoIncrement.html
dom/indexedDB/test/test_readonly_transactions.html
dom/indexedDB/test/test_remove_index.html
dom/indexedDB/test/test_remove_objectStore.html
dom/indexedDB/test/test_request_readyState.html
dom/indexedDB/test/test_setVersion.html
dom/indexedDB/test/test_transaction_abort.html
dom/indexedDB/test/test_writer_starvation.html
dom/interfaces/storage/nsIDOMStorageWindow.idl
dom/src/storage/Makefile.in
js/src/xpconnect/src/dom_quickstubs.qsconf
layout/build/Makefile.in
media/libvpx/update.sh
storage/src/mozStorageAsyncStatement.cpp
storage/src/mozStorageAsyncStatementExecution.cpp
storage/src/mozStorageConnection.cpp
storage/src/mozStoragePrivateHelpers.cpp
storage/src/mozStoragePrivateHelpers.h
storage/src/mozStorageStatement.cpp
storage/test/Makefile.in
storage/test/storage_test_harness.h
storage/test/test_unlock_notify.cpp
testing/mozmill/installmozmill.py
testing/mozmill/tests/addons/toolbar@google.com/testToolbarInstalled.js
testing/mozmill/tests/scripts/update.py
testing/mozmill/virtualenv/virtualenv.py
--- a/.hgtags
+++ b/.hgtags
@@ -33,10 +33,8 @@ f817a4378f32b1ad0a7c4b5a9949586dba816da5
 5c1e7c779b6edc8ff912001990edc579f80597f4 FENNEC_B1
 fe9cc55b8db7f56f7e68a246acba363743854979 UPDATE_PACKAGING_R8
 6fd4bb500d425c406c1b52f66e5b195b20ae5e0a chromium-import-r15462
 6fd4bb500d425c406c1b52f66e5b195b20ae5e0a chromium-import-latest
 376b78fc72230aaf2ca4e279a8f4ef1efd4a1d9f GECKO_1_9_2_BASE
 138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R9
 138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R10
 138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R11
-b2f7bc2aa0bcd02460d457472a0157ec42f0b23f FIREFOX_3_7a5_BUILD1
-b2f7bc2aa0bcd02460d457472a0157ec42f0b23f FIREFOX_3_7a5_RELEASE
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -141,17 +141,16 @@
 @BINPATH@/components/dom.xpt
 @BINPATH@/components/dom_base.xpt
 @BINPATH@/components/dom_canvas.xpt
 @BINPATH@/components/dom_core.xpt
 @BINPATH@/components/dom_css.xpt
 @BINPATH@/components/dom_events.xpt
 @BINPATH@/components/dom_geolocation.xpt
 @BINPATH@/components/dom_html.xpt
-@BINPATH@/components/dom_indexeddb.xpt
 @BINPATH@/components/dom_offline.xpt
 @BINPATH@/components/dom_json.xpt
 @BINPATH@/components/dom_range.xpt
 @BINPATH@/components/dom_sidebar.xpt
 @BINPATH@/components/dom_storage.xpt
 @BINPATH@/components/dom_stylesheets.xpt
 @BINPATH@/components/dom_threads.xpt
 @BINPATH@/components/dom_traversal.xpt
--- a/configure.in
+++ b/configure.in
@@ -6698,17 +6698,17 @@ else
     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
     fi
 
     dnl ================================
     dnl === SQLITE_ENABLE_FTS3 check ===
     dnl ================================
     dnl check to see if the system SQLite package is compiled with
-    dnl SQLITE_ENABLE_FTS3 enabled.
+    dnl SQLITE_THREADSAFE enabled.
     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
     _SAVE_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
     _SAVE_LIBS="$LIBS"
     LIBS="$LIBS $SQLITE_LIBS"
     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
         AC_TRY_RUN([
             #include "sqlite3.h"
@@ -6722,45 +6722,16 @@ else
         )
     ])
     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
     CFLAGS="$_SAVE_CFLAGS"
     LIBS="$_SAVE_LIBS"
     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
     fi
-
-    dnl =========================================
-    dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
-    dnl =========================================
-    dnl check to see if the system SQLite package is compiled with
-    dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
-    AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
-    _SAVE_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
-    _SAVE_LIBS="$LIBS"
-    LIBS="$LIBS $SQLITE_LIBS"
-    AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
-        AC_TRY_RUN([
-            #include "sqlite3.h"
-
-            int main(int argc, char **argv){
-              return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
-            }],
-            ac_cv_sqlite_enable_unlock_notify=yes,
-            ac_cv_sqlite_enable_unlock_notify=no,
-            ac_cv_sqlite_enable_unlock_notify=no
-        )
-    ])
-    AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
-    CFLAGS="$_SAVE_CFLAGS"
-    LIBS="$_SAVE_LIBS"
-    if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
-        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
-    fi
 fi
 
 AC_SUBST(MOZ_NATIVE_SQLITE)
 
 dnl ========================================================
 dnl = Enable help viewer (off by default)
 dnl ========================================================
 if test -n "$MOZ_HELP_VIEWER"; then
--- a/content/events/src/nsDOMEventTargetHelper.h
+++ b/content/events/src/nsDOMEventTargetHelper.h
@@ -44,17 +44,16 @@
 #include "nsPIDOMEventTarget.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMNSEventTarget.h"
 #include "nsIDOMEventTarget.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsPIDOMWindow.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIEventListenerManager.h"
-#include "nsIScriptContext.h"
 
 class nsDOMEventListenerWrapper : public nsIDOMEventListener
 {
 public:
   nsDOMEventListenerWrapper(nsIDOMEventListener* aListener)
   : mListener(aListener) {}
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
--- a/db/sqlite3/src/Makefile.in
+++ b/db/sqlite3/src/Makefile.in
@@ -101,17 +101,16 @@ CSRCS = \
 # -DSQLITE_ENABLE_FTS3=1 enables the full-text index module.
 # -DSQLITE_CORE=1 statically links that module into the SQLite library.
 # Note: Be sure to update the configure.in checks when these change!
 DEFINES = \
   -DSQLITE_SECURE_DELETE=1 \
   -DSQLITE_THREADSAFE=1 \
   -DSQLITE_CORE=1 \
   -DSQLITE_ENABLE_FTS3=1 \
-  -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 \
   $(NULL)
 
 # -DSQLITE_ENABLE_LOCKING_STYLE=1 to help with AFP folders
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 DEFINES += -DSQLITE_ENABLE_LOCKING_STYLE=1
 endif
 
 # Turn on SQLite's assertions in debug builds.
--- a/db/sqlite3/src/sqlite.def
+++ b/db/sqlite3/src/sqlite.def
@@ -153,17 +153,16 @@ EXPORTS
         sqlite3_snprintf
         sqlite3_sql
         sqlite3_step
         sqlite3_stmt_status
         sqlite3_thread_cleanup
         sqlite3_total_changes
         sqlite3_trace
         sqlite3_transfer_bindings
-        sqlite3_unlock_notify
         sqlite3_update_hook
         sqlite3_user_data
         sqlite3_value_blob
         sqlite3_value_bytes
         sqlite3_value_bytes16
         sqlite3_value_double
         sqlite3_value_int
         sqlite3_value_int64
--- a/dom/Makefile.in
+++ b/dom/Makefile.in
@@ -75,17 +75,16 @@ DIRS += interfaces/smil
 endif
 
 DIRS += \
   public/coreEvents \
   base \
   src \
   locales \
   plugins \
-  indexedDB \
   $(NULL)
 
 ifdef ENABLE_TESTS
 DIRS += tests
 endif
 
 include $(topsrcdir)/config/rules.mk
 
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -474,26 +474,16 @@
 #include "nsIDOMNSMouseEvent.h"
 
 #include "nsIEventListenerService.h"
 #include "nsIFrameMessageManager.h"
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla::dom;
 
-#include "mozilla/dom/indexedDB/IndexedDatabaseRequest.h"
-#include "mozilla/dom/indexedDB/IDBRequest.h"
-#include "mozilla/dom/indexedDB/IDBDatabaseRequest.h"
-#include "mozilla/dom/indexedDB/IDBEvents.h"
-#include "mozilla/dom/indexedDB/IDBObjectStoreRequest.h"
-#include "mozilla/dom/indexedDB/IDBTransactionRequest.h"
-#include "mozilla/dom/indexedDB/IDBCursorRequest.h"
-#include "mozilla/dom/indexedDB/IDBKeyRange.h"
-#include "mozilla/dom/indexedDB/IDBIndexRequest.h"
-
 static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
 
 static const char kDOMStringBundleURL[] =
   "chrome://global/locale/dom/dom.properties";
 
 // NOTE: DEFAULT_SCRIPTABLE_FLAGS and DOM_DEFAULT_SCRIPTABLE_FLAGS
 //       are defined in nsIDOMClassInfo.h.
 
@@ -1412,39 +1402,16 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(FormData, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(WebSocket, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(CloseEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
-
-  NS_DEFINE_CLASSINFO_DATA(IndexedDatabaseRequest, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBRequest, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBDatabaseRequest, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBErrorEvent, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBSuccessEvent, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBTransactionEvent, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBObjectStoreRequest, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBTransactionRequest, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBCursorRequest, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBKeyRange, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(IDBIndexRequest, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
 };
 
 // Objects that should be constructable through |new Name();|
 struct nsContractIDMapData
 {
   PRInt32 mDOMClassInfoID;
   const char *mContractID;
 };
@@ -3916,76 +3883,16 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(CloseEvent, nsIDOMCloseEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCloseEvent)
     DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(IndexedDatabaseRequest, nsIIndexedDatabaseRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIndexedDatabaseRequest)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBRequest, nsIIDBRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBDatabaseRequest, nsIIDBDatabaseRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabaseRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabase)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBErrorEvent, nsIIDBErrorEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBErrorEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBSuccessEvent, nsIIDBSuccessEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBSuccessEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBTransactionEvent, nsIIDBTransactionEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBTransactionEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBSuccessEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBObjectStoreRequest, nsIIDBObjectStoreRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBObjectStoreRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBObjectStore)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBTransactionRequest, nsIIDBTransactionRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBTransactionRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBTransaction)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBCursorRequest, nsIIDBCursorRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBCursorRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBCursor)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBKeyRange, nsIIDBKeyRange)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBKeyRange)
-  DOM_CLASSINFO_MAP_END
-
-  DOM_CLASSINFO_MAP_BEGIN(IDBIndexRequest, nsIIDBIndexRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBIndexRequest)
-    DOM_CLASSINFO_MAP_ENTRY(nsIIDBIndex)
-  DOM_CLASSINFO_MAP_END
-
 #ifdef NS_DEBUG
   {
     PRUint32 i = NS_ARRAY_LENGTH(sClassInfoData);
 
     if (i != eDOMClassInfoIDCount) {
       NS_ERROR("The number of items in sClassInfoData doesn't match the "
                "number of nsIDOMClassInfo ID's, this is bad! Fix it!");
 
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -474,20 +474,8 @@ DOMCI_CLASS(EventListenerInfo)
 DOMCI_CLASS(TransitionEvent)
 DOMCI_CLASS(ContentFrameMessageManager)
 
 DOMCI_CLASS(FormData)
 
 // WebSocket
 DOMCI_CLASS(WebSocket)
 DOMCI_CLASS(CloseEvent)
-
-DOMCI_CLASS(IndexedDatabaseRequest)
-DOMCI_CLASS(IDBRequest)
-DOMCI_CLASS(IDBDatabaseRequest)
-DOMCI_CLASS(IDBErrorEvent)
-DOMCI_CLASS(IDBSuccessEvent)
-DOMCI_CLASS(IDBTransactionEvent)
-DOMCI_CLASS(IDBObjectStoreRequest)
-DOMCI_CLASS(IDBTransactionRequest)
-DOMCI_CLASS(IDBCursorRequest)
-DOMCI_CLASS(IDBKeyRange)
-DOMCI_CLASS(IDBIndexRequest)
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -211,18 +211,16 @@
 #include "mozilla/FunctionTimer.h"
 
 #ifdef MOZ_LOGGING
 // so we can get logging even in release builds
 #define FORCE_PR_LOG 1
 #endif
 #include "prlog.h"
 
-#include "mozilla/dom/indexedDB/IndexedDatabaseRequest.h"
-
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gDOMLeakPRLog;
 #endif
 
 using namespace mozilla::dom;
 
 nsIDOMStorageList *nsGlobalWindow::sGlobalStorageList  = nsnull;
 
@@ -929,17 +927,16 @@ nsGlobalWindow::CleanUp(PRBool aIgnoreMo
   mToolbar = nsnull;
   mLocationbar = nsnull;
   mPersonalbar = nsnull;
   mStatusbar = nsnull;
   mScrollbars = nsnull;
   mLocation = nsnull;
   mFrames = nsnull;
   mApplicationCache = nsnull;
-  mIndexedDB = nsnull;
 
   ClearControllers();
 
   mOpener = nsnull;             // Forces Release
   if (mContext) {
 #ifdef DEBUG
     nsCycleCollector_DEBUG_shouldBeFreed(mContext);
 #endif
@@ -1099,18 +1096,16 @@ nsGlobalWindow::FreeInnerObjects(PRBool 
   mDocument = nsnull;
   mDoc = nsnull;
 
   if (mApplicationCache) {
     static_cast<nsDOMOfflineResourceList*>(mApplicationCache.get())->Disconnect();
     mApplicationCache = nsnull;
   }
 
-  mIndexedDB = nsnull;
-
   if (aClearScope) {
     // NB: This might not clear our scope, but fire an event to do so
     // instead.
     ReallyClearScope(nsnull);
   }
 
   if (mDummyJavaPluginOwner) {
     // Tear down the dummy java plugin.
@@ -7591,29 +7586,16 @@ nsGlobalWindow::GetLocalStorage(nsIDOMSt
                                                      getter_AddRefs(mLocalStorage));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   NS_ADDREF(*aLocalStorage = mLocalStorage);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsGlobalWindow::GetMoz_indexedDB(nsIIndexedDatabaseRequest** _retval)
-{
-  if (!mIndexedDB) {
-    mIndexedDB = mozilla::dom::indexedDB::IndexedDatabaseRequest::Create();
-    NS_ENSURE_TRUE(mIndexedDB, NS_ERROR_FAILURE);
-  }
-
-  nsCOMPtr<nsIIndexedDatabaseRequest> request(mIndexedDB);
-  request.forget(_retval);
-  return NS_OK;
-}
-
 //*****************************************************************************
 // nsGlobalWindow::nsIInterfaceRequestor
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsGlobalWindow::GetInterface(const nsIID & aIID, void **aSink)
 {
   NS_ENSURE_ARG_POINTER(aSink);
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -96,17 +96,16 @@
 #include "nsIDOMStorageObsolete.h"
 #include "nsIDOMStorageList.h"
 #include "nsIDOMStorageWindow.h"
 #include "nsIDOMStorageEvent.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsPIDOMEventTarget.h"
 #include "nsIArray.h"
 #include "nsIContent.h"
-#include "nsIIndexedDatabaseRequest.h"
 #include "nsFrameMessageManager.h"
 
 #define DEFAULT_HOME_PAGE "www.mozilla.org"
 #define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
 
 class nsIDOMBarProp;
 class nsIDocument;
 class nsPresContext;
@@ -825,18 +824,16 @@ protected:
   PRBool mCleanedUp, mCallCleanUpAfterModalDialogCloses;
 
   nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
 
   nsDataHashtable<nsVoidPtrHashKey, void*> mCachedXBLPrototypeHandlers;
 
   nsCOMPtr<nsIDocument> mSuspendedDoc;
 
-  nsCOMPtr<nsIIndexedDatabaseRequest> mIndexedDB;
-
   // A unique (as long as our 64-bit counter doesn't roll over) id for
   // this window.
   PRUint64 mWindowID;
 
   friend class nsDOMScriptableHelper;
   friend class nsDOMWindowUtils;
   friend class PostMessageEvent;
   static nsIDOMStorageList* sGlobalStorageList;
deleted file mode 100644
--- a/dom/indexedDB/AsyncConnectionHelper.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "AsyncConnectionHelper.h"
-
-#include "nsIIDBDatabaseException.h"
-
-#include "mozilla/storage.h"
-#include "nsComponentManagerUtils.h"
-#include "nsProxyRelease.h"
-#include "nsThreadUtils.h"
-
-#include "IDBEvents.h"
-#include "IDBTransactionRequest.h"
-#include "TransactionThreadPool.h"
-
-using mozilla::TimeStamp;
-using mozilla::TimeDuration;
-
-USING_INDEXEDDB_NAMESPACE
-
-namespace {
-
-const PRUint32 kProgressHandlerGranularity = 1000;
-const PRUint32 kDefaultTimeoutMS = 30000;
-
-NS_STACK_CLASS
-class TransactionPoolEventTarget : public nsIEventTarget
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIEVENTTARGET
-
-  TransactionPoolEventTarget(IDBTransactionRequest* aTransaction)
-  : mTransaction(aTransaction)
-  { }
-
-private:
-  IDBTransactionRequest* mTransaction;
-};
-
-} // anonymous namespace
-
-AsyncConnectionHelper::AsyncConnectionHelper(IDBDatabaseRequest* aDatabase,
-                                             IDBRequest* aRequest)
-: mDatabase(aDatabase),
-  mRequest(aRequest),
-  mTimeoutDuration(TimeDuration::FromMilliseconds(kDefaultTimeoutMS)),
-  mErrorCode(0),
-  mError(PR_FALSE)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(mRequest, "Null request!");
-}
-
-AsyncConnectionHelper::AsyncConnectionHelper(IDBTransactionRequest* aTransaction,
-                                             IDBRequest* aRequest)
-: mDatabase(aTransaction->mDatabase),
-  mTransaction(aTransaction),
-  mRequest(aRequest),
-  mTimeoutDuration(TimeDuration::FromMilliseconds(kDefaultTimeoutMS)),
-  mErrorCode(0),
-  mError(PR_FALSE)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(mRequest, "Null request!");
-}
-
-AsyncConnectionHelper::~AsyncConnectionHelper()
-{
-  if (!NS_IsMainThread()) {
-    NS_ASSERTION(mErrorCode == NOREPLY || !mRequest,
-                 "This should only happen if NOREPLY was returned or if the "
-                 "runnable already ran on the main thread!");
-
-    IDBDatabaseRequest* database;
-    mDatabase.forget(&database);
-
-    IDBTransactionRequest* transaction;
-    mTransaction.forget(&transaction);
-
-    IDBRequest* request;
-    mRequest.forget(&request);
-
-    nsCOMPtr<nsIThread> mainThread;
-    NS_GetMainThread(getter_AddRefs(mainThread));
-    NS_WARN_IF_FALSE(mainThread, "Couldn't get the main thread!");
-
-    if (mainThread) {
-      if (database) {
-        NS_ProxyRelease(mainThread, static_cast<nsIIDBDatabase*>(database));
-      }
-      if (transaction) {
-        NS_ProxyRelease(mainThread,
-                        static_cast<nsIIDBTransaction*>(transaction));
-      }
-      if (request) {
-        NS_ProxyRelease(mainThread, static_cast<nsIDOMEventTarget*>(request));
-      }
-    }
-  }
-
-  NS_ASSERTION(!mOldProgressHandler, "Should not have anything here!");
-}
-
-NS_IMPL_THREADSAFE_ISUPPORTS2(AsyncConnectionHelper, nsIRunnable,
-                                                     mozIStorageProgressHandler)
-
-NS_IMETHODIMP
-AsyncConnectionHelper::Run()
-{
-  if (NS_IsMainThread()) {
-    if (mRequest->mAborted) {
-      NS_ASSERTION(mRequest->mReadyState == nsIIDBRequest::DONE,
-                   "Wrong state!");
-      mError = true;
-      mErrorCode = nsIIDBDatabaseException::UNKNOWN_ERR;
-    }
-    else {
-      NS_ASSERTION(mRequest->mReadyState == nsIIDBRequest::LOADING,
-                   "Wrong state!");
-      mRequest->mReadyState = nsIIDBRequest::DONE;
-    }
-
-    // Call OnError if the database had an error or if the OnSuccess handler
-    // has an error.
-    if (mError || ((mErrorCode = OnSuccess(mRequest)) != OK)) {
-      OnError(mRequest, mErrorCode);
-    }
-
-    if (mTransaction) {
-      mTransaction->OnRequestFinished();
-    }
-
-    mDatabase = nsnull;
-    mTransaction = nsnull;
-    mRequest = nsnull;
-    return NS_OK;
-  }
-
-  nsresult rv = NS_OK;
-  nsCOMPtr<mozIStorageConnection> connection;
-
-  if (mTransaction) {
-    rv = mTransaction->GetOrCreateConnection(getter_AddRefs(connection));
-    if (NS_SUCCEEDED(rv)) {
-      NS_ASSERTION(connection, "This should never be null!");
-    }
-  }
-  else if (mDatabase) {
-    rv = mDatabase->GetOrCreateConnection(getter_AddRefs(connection));
-    if (NS_SUCCEEDED(rv)) {
-      NS_ASSERTION(connection, "This should never be null!");
-    }
-  }
-
-  NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "GetOrCreateConnection failed!");
-
-  if (connection) {
-    rv = connection->SetProgressHandler(kProgressHandlerGranularity, this,
-                                        getter_AddRefs(mOldProgressHandler));
-    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "SetProgressHandler failed!");
-    if (NS_SUCCEEDED(rv)) {
-      mStartTime = TimeStamp::Now();
-    }
-  }
-
-  if (NS_SUCCEEDED(rv)) {
-    mErrorCode = DoDatabaseWork(connection);
-  }
-  else {
-    mErrorCode = nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  if (!mStartTime.IsNull()) {
-    nsCOMPtr<mozIStorageProgressHandler> handler;
-    rv = connection->RemoveProgressHandler(getter_AddRefs(handler));
-    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "RemoveProgressHandler failed!");
-#ifdef DEBUG
-    if (NS_SUCCEEDED(rv)) {
-      nsCOMPtr<nsISupports> handlerSupports(do_QueryInterface(handler));
-      nsCOMPtr<nsISupports> thisSupports =
-        do_QueryInterface(static_cast<nsIRunnable*>(this));
-      NS_ASSERTION(thisSupports == handlerSupports, "Mismatch!");
-    }
-#endif
-    mStartTime = TimeStamp();
-  }
-
-  if (mErrorCode != NOREPLY) {
-    mError = mErrorCode != OK;
-
-    return NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-AsyncConnectionHelper::OnProgress(mozIStorageConnection* aConnection,
-                                  PRBool* _retval)
-{
-  TimeDuration elapsed = TimeStamp::Now() - mStartTime;
-  if (elapsed >= mTimeoutDuration) {
-    *_retval = PR_TRUE;
-    return NS_OK;
-  }
-
-  if (mOldProgressHandler) {
-    return mOldProgressHandler->OnProgress(aConnection, _retval);
-  }
-
-  *_retval = PR_FALSE;
-  return NS_OK;
-}
-
-nsresult
-AsyncConnectionHelper::Dispatch(nsIEventTarget* aDatabaseThread)
-{
-#ifdef DEBUG
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  {
-    PRBool sameThread;
-    nsresult rv = aDatabaseThread->IsOnCurrentThread(&sameThread);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "IsOnCurrentThread failed!");
-    NS_ASSERTION(!sameThread, "Dispatching to main thread not supported!");
-  }
-#endif
-
-  nsresult rv = Init();
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  NS_ASSERTION(mRequest->mReadyState == nsIIDBRequest::INITIAL,
-               "Wrong readyState!");
-  mRequest->mReadyState = nsIIDBRequest::LOADING;
-
-  rv = aDatabaseThread->Dispatch(this, NS_DISPATCH_NORMAL);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (mTransaction) {
-    mTransaction->OnNewRequest();
-  }
-
-  return NS_OK;
-}
-
-nsresult
-AsyncConnectionHelper::DispatchToTransactionPool()
-{
-  NS_ASSERTION(mTransaction, "Only ok to call this with a transaction!");
-  TransactionPoolEventTarget target(mTransaction);
-  return Dispatch(&target);
-}
-
-nsresult
-AsyncConnectionHelper::Init()
-{
-  return NS_OK;
-}
-
-PRUint16
-AsyncConnectionHelper::OnSuccess(nsIDOMEventTarget* aTarget)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsCOMPtr<nsIWritableVariant> variant =
-    do_CreateInstance(NS_VARIANT_CONTRACTID);
-  if (!variant) {
-    NS_ERROR("Couldn't create variant!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  PRUint16 result = GetSuccessResult(variant);
-  if (result != OK) {
-    return result;
-  }
-
-  if (NS_FAILED(variant->SetWritable(PR_FALSE))) {
-    NS_ERROR("Failed to make variant readonly!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  nsCOMPtr<nsIDOMEvent> event =
-    IDBSuccessEvent::Create(mRequest, variant, mTransaction);
-  if (!event) {
-    NS_ERROR("Failed to create event!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  PRBool dummy;
-  aTarget->DispatchEvent(event, &dummy);
-  return OK;
-}
-
-void
-AsyncConnectionHelper::OnError(nsIDOMEventTarget* aTarget,
-                               PRUint16 aErrorCode)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  // Make an error event and fire it at the target.
-  nsCOMPtr<nsIDOMEvent> event(IDBErrorEvent::Create(mRequest, aErrorCode));
-  if (!event) {
-    NS_ERROR("Failed to create event!");
-    return;
-  }
-
-  PRBool dummy;
-  aTarget->DispatchEvent(event, &dummy);
-}
-
-PRUint16
-AsyncConnectionHelper::GetSuccessResult(nsIWritableVariant* /* aResult */)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  // Leave the variant remain set to empty.
-
-  return OK;
-}
-
-NS_IMETHODIMP_(nsrefcnt)
-TransactionPoolEventTarget::AddRef()
-{
-  NS_NOTREACHED("Don't call me!");
-  return 2;
-}
-
-NS_IMETHODIMP_(nsrefcnt)
-TransactionPoolEventTarget::Release()
-{
-  NS_NOTREACHED("Don't call me!");
-  return 1;
-}
-
-NS_IMPL_QUERY_INTERFACE1(TransactionPoolEventTarget, nsIEventTarget)
-
-NS_IMETHODIMP
-TransactionPoolEventTarget::Dispatch(nsIRunnable* aRunnable,
-                                     PRUint32 aFlags)
-{
-  NS_ASSERTION(aRunnable, "Null pointer!");
-  NS_ASSERTION(aFlags == NS_DISPATCH_NORMAL, "Unsupported!");
-
-  TransactionThreadPool* pool = TransactionThreadPool::GetOrCreate();
-  NS_ENSURE_TRUE(pool, NS_ERROR_FAILURE);
-
-  return pool->Dispatch(mTransaction, aRunnable, false);
-}
-
-NS_IMETHODIMP
-TransactionPoolEventTarget::IsOnCurrentThread(PRBool* aResult)
-{
-  *aResult = PR_FALSE;
-  return NS_OK;
-}
deleted file mode 100644
--- a/dom/indexedDB/AsyncConnectionHelper.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_asyncconnectionhelper_h__
-#define mozilla_dom_indexeddb_asyncconnectionhelper_h__
-
-// Only meant to be included in IndexedDB source files, not exported.
-#include "IndexedDatabase.h"
-#include "IDBDatabaseRequest.h"
-#include "IDBRequest.h"
-
-#include "mozIStorageProgressHandler.h"
-#include "nsIRunnable.h"
-#include "nsIThread.h"
-#include "nsIVariant.h"
-
-#include "mozilla/TimeStamp.h"
-
-class mozIStorageConnection;
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class IDBTransactionRequest;
-
-/**
- * Must be subclassed. The subclass must implement DoDatabaseWork. It may then
- * choose to implement OnSuccess and OnError depending on the needs of the
- * subclass. If the default implementation of OnSuccess is desired then the
- * subclass can implement GetSuccessResult to properly set the result of the
- * success event. Call Dispatch to start the database operation. Must be created
- * and Dispatched from the main thread only. Target thread may not be the main
- * thread.
- */
-class AsyncConnectionHelper : public nsIRunnable,
-                              public mozIStorageProgressHandler
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIRUNNABLE
-  NS_DECL_MOZISTORAGEPROGRESSHANDLER
-
-  /**
-   * Return this code from DoDatabaseWork to signal the main thread that the
-   * database operation suceeded. Once the main thread receives this
-   * notification the OnSuccess callback will be invoked allowing the subclass
-   * to fire a success event or otherwise note the completed operation.
-   */
-  static const PRUint16 OK = PR_UINT16_MAX;
-
-  /**
-   * Return this code from DoDatabaseWork to prevent the helper from firing a
-   * response to the main thread. Note that you must hold an additional
-   * reference to the helper somewhere if further processing is needed or else
-   * the helper will be deleted after returning from DoDatabaseWork.
-   */
-  static const PRUint16 NOREPLY = OK - 1;
-
-  nsresult Dispatch(nsIEventTarget* aDatabaseThread);
-
-  // Only for transactions!
-  nsresult DispatchToTransactionPool();
-
-protected:
-  AsyncConnectionHelper(IDBDatabaseRequest* aDatabase,
-                        IDBRequest* aRequest);
-
-  AsyncConnectionHelper(IDBTransactionRequest* aTransaction,
-                        IDBRequest* aRequest);
-
-  virtual ~AsyncConnectionHelper();
-
-  /**
-   * Set the timeout duration in milliseconds.
-   */
-  void SetTimeoutMS(PRUint32 aTimeoutMS)
-  {
-    mTimeoutDuration = TimeDuration::FromMilliseconds(aTimeoutMS);
-  }
-
-  /**
-   * This is called on the main thread after Dispatch is called but before the
-   * runnable is actually dispatched to the database thread. Allows the subclass
-   * to initialize itself. The default implementation does nothing and returns
-   * NS_OK.
-   */
-  virtual nsresult Init();
-
-  /**
-   * This callback is run on the database thread. It should return a valid error
-   * code from nsIIDBDatabaseError or one of the two special values above.
-   */
-  virtual PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection) = 0;
-
-  /**
-   * This callback is run on the main thread if the DoDatabaseWork returned OK.
-   * The default implementation constructs an IDBSuccessEvent with its result
-   * property set to the value returned by GetSuccessResult. The event is then
-   * fired at the target. Returning anything other than OK from the OnSuccess
-   * callback will trigger the OnError callback.
-   */
-  virtual PRUint16 OnSuccess(nsIDOMEventTarget* aTarget);
-
-  /**
-   * This callback is run on the main thread if DoDatabaseWork returned an error
-   * code. The default implementation constructs an IDBErrorEvent for the error
-   * code and fires it at the target.
-   */
-  virtual void OnError(nsIDOMEventTarget* aTarget,
-                       PRUint16 aErrorCode);
-
-  /**
-   * This function is called from the default implementation of OnSuccess. A
-   * valid nsIWritableVariant is passed into the function which can be modified
-   * by the subclass. The default implementation returns an nsIVariant that is
-   * set to nsIDataType::VTYPE_EMPTY. Returning anything other than OK from the
-   * GetSuccessResult function will trigger the OnError callback.
-   */
-  virtual PRUint16 GetSuccessResult(nsIWritableVariant* aVariant);
-
-protected:
-  nsRefPtr<IDBDatabaseRequest> mDatabase;
-  nsRefPtr<IDBTransactionRequest> mTransaction;
-  nsRefPtr<IDBRequest> mRequest;
-
-private:
-  nsCOMPtr<mozIStorageProgressHandler> mOldProgressHandler;
-
-  mozilla::TimeStamp mStartTime;
-  mozilla::TimeDuration mTimeoutDuration;
-
-  PRUint16 mErrorCode;
-  PRPackedBool mError;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_asyncconnectionhelper_h__
deleted file mode 100644
--- a/dom/indexedDB/DatabaseInfo.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "DatabaseInfo.h"
-
-#include "nsClassHashtable.h"
-#include "nsHashKeys.h"
-#include "nsThreadUtils.h"
-
-USING_INDEXEDDB_NAMESPACE
-
-namespace {
-
-typedef nsClassHashtable<nsStringHashKey, ObjectStoreInfo>
-        ObjectStoreInfoHash;
-
-struct DatabaseInfoHash
-{
-  DatabaseInfoHash(DatabaseInfo* aInfo) {
-    NS_ASSERTION(aInfo, "Null pointer!");
-    info = aInfo;
-  }
-
-  nsAutoPtr<DatabaseInfo> info;
-  nsAutoPtr<ObjectStoreInfoHash> objectStoreHash;
-};
-
-typedef nsClassHashtable<nsUint32HashKey, DatabaseInfoHash>
-        DatabaseHash;
-
-DatabaseHash* gDatabaseHash = nsnull;
-
-PLDHashOperator
-EnumerateObjectStoreNames(const nsAString& aKey,
-                          ObjectStoreInfo* aData,
-                          void* aUserArg)
-{
-  nsTArray<nsString>* array = static_cast<nsTArray<nsString>*>(aUserArg);
-  if (!array->AppendElement(aData->name)) {
-    NS_ERROR("Out of memory?");
-    return PL_DHASH_STOP;
-  }
-  return PL_DHASH_NEXT;
-}
-
-}
-
-// static
-bool
-DatabaseInfo::Get(PRUint32 aId,
-                  DatabaseInfo** aInfo)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aId, "Bad id!");
-
-  if (gDatabaseHash) {
-    DatabaseInfoHash* hash;
-    if (gDatabaseHash->Get(aId, &hash)) {
-      if (aInfo) {
-        *aInfo = hash->info;
-      }
-      return true;
-    }
-  }
-  return false;
-}
-
-// static
-bool
-DatabaseInfo::Put(DatabaseInfo* aInfo)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aInfo, "Null pointer!");
-
-  if (!gDatabaseHash) {
-    nsAutoPtr<DatabaseHash> databaseHash(new DatabaseHash());
-    if (!databaseHash->Init()) {
-      NS_ERROR("Failed to initialize hashtable!");
-      return false;
-    }
-
-    gDatabaseHash = databaseHash.forget();
-  }
-
-  if (gDatabaseHash->Get(aInfo->id, nsnull)) {
-    NS_ERROR("Already know about this database!");
-    return false;
-  }
-
-  nsAutoPtr<DatabaseInfoHash> hash(new DatabaseInfoHash(aInfo));
-  if (!gDatabaseHash->Put(aInfo->id, hash)) {
-    NS_ERROR("Put failed!");
-    return false;
-  }
-
-  hash.forget();
-  return true;
-}
-
-// static
-void
-DatabaseInfo::Remove(PRUint32 aId)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(Get(aId, nsnull), "Don't know anything about this one!");
-
-  if (gDatabaseHash) {
-    gDatabaseHash->Remove(aId);
-
-    if (!gDatabaseHash->Count()) {
-      delete gDatabaseHash;
-      gDatabaseHash = nsnull;
-    }
-  }
-}
-
-bool
-DatabaseInfo::GetObjectStoreNames(nsTArray<nsString>& aNames)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(Get(id, nsnull), "Don't know anything about this one!");
-
-  if (!gDatabaseHash) {
-    return false;
-  }
-
-  DatabaseInfoHash* info;
-  if (!gDatabaseHash->Get(id, &info)) {
-    return false;
-  }
-
-  aNames.Clear();
-  if (info->objectStoreHash) {
-    info->objectStoreHash->EnumerateRead(EnumerateObjectStoreNames, &aNames);
-  }
-  return true;
-}
-
-// static
-bool
-DatabaseInfo::ContainsStoreName(const nsAString& aName)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(Get(id, nsnull), "Don't know anything about this one!");
-
-  if (!gDatabaseHash) {
-    return false;
-  }
-
-  DatabaseInfoHash* info;
-  if (!gDatabaseHash->Get(id, &info)) {
-    return false;
-  }
-
-  return info && info->objectStoreHash &&
-         info->objectStoreHash->Get(aName, nsnull);
-}
-
-// static
-bool
-ObjectStoreInfo::Get(PRUint32 aDatabaseId,
-                     const nsAString& aName,
-                     ObjectStoreInfo** aInfo)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(!aName.IsEmpty(), "Empty object store name!");
-
-  if (gDatabaseHash) {
-    DatabaseInfoHash* hash;
-    if (gDatabaseHash->Get(aDatabaseId, &hash)) {
-      if (hash->objectStoreHash) {
-        return !!hash->objectStoreHash->Get(aName, aInfo);
-      }
-    }
-  }
-
-  return false;
-}
-
-// static
-bool
-ObjectStoreInfo::Put(ObjectStoreInfo* aInfo)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aInfo, "Null pointer!");
-
-  if (!gDatabaseHash) {
-    NS_ERROR("No databases known!");
-    return false;
-  }
-
-  DatabaseInfoHash* hash;
-  if (!gDatabaseHash->Get(aInfo->databaseId, &hash)) {
-    NS_ERROR("Don't know about this database!");
-    return false;
-  }
-
-  if (!hash->objectStoreHash) {
-    nsAutoPtr<ObjectStoreInfoHash> objectStoreHash(new ObjectStoreInfoHash());
-    if (!objectStoreHash->Init()) {
-      NS_ERROR("Failed to initialize hashtable!");
-      return false;
-    }
-    hash->objectStoreHash = objectStoreHash.forget();
-  }
-
-  if (hash->objectStoreHash->Get(aInfo->name, nsnull)) {
-    NS_ERROR("Already have an entry for this objectstore!");
-    return false;
-  }
-
-  return !!hash->objectStoreHash->Put(aInfo->name, aInfo);
-}
-
-// static
-void
-ObjectStoreInfo::Remove(PRUint32 aDatabaseId,
-                        const nsAString& aName)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(Get(aDatabaseId, aName, nsnull), "Don't know about this one!");
-
-  if (gDatabaseHash) {
-    DatabaseInfoHash* hash;
-    if (gDatabaseHash->Get(aDatabaseId, &hash) && hash->objectStoreHash) {
-      hash->objectStoreHash->Remove(aName);
-    }
-  }
-}
deleted file mode 100644
--- a/dom/indexedDB/DatabaseInfo.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_databaseinfo_h__
-#define mozilla_dom_indexeddb_databaseinfo_h__
-
-// Only meant to be included in IndexedDB source files, not exported.
-#include "IndexedDatabase.h"
-
-#include "IDBObjectStoreRequest.h"
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-struct DatabaseInfo
-{
-  nsString name;
-  nsString description;
-  nsString version;
-  PRUint32 id;
-  nsString filePath;
-
-  nsAutoRefCnt referenceCount;
-
-  DatabaseInfo()
-  : id(0) { }
-
-  static bool Get(PRUint32 aId,
-                  DatabaseInfo** aInfo);
-
-  static bool Put(DatabaseInfo* aInfo);
-
-  static void Remove(PRUint32 aId);
-
-  bool GetObjectStoreNames(nsTArray<nsString>& aNames);
-  bool ContainsStoreName(const nsAString& aName);
-};
-
-struct IndexInfo
-{
-  IndexInfo()
-  : id(LL_MININT), unique(false), autoIncrement(false) { }
-
-  PRInt64 id;
-  nsString name;
-  nsString keyPath;
-  bool unique;
-  bool autoIncrement;
-};
-
-struct ObjectStoreInfo
-{
-  nsString name;
-  PRInt64 id;
-  nsString keyPath;
-  bool autoIncrement;
-  PRUint32 databaseId;
-  nsTArray<IndexInfo> indexes;
-
-  ObjectStoreInfo()
-  : id(0), autoIncrement(false), databaseId(0) { }
-
-  static bool Get(PRUint32 aDatabaseId,
-                  const nsAString& aName,
-                  ObjectStoreInfo** aInfo);
-
-  static bool Put(ObjectStoreInfo* aInfo);
-
-  static void Remove(PRUint32 aDatabaseId,
-                     const nsAString& aName);
-};
-
-struct IndexUpdateInfo
-{
-  IndexInfo info;
-  Key value;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_databaseinfo_h__
-
deleted file mode 100644
--- a/dom/indexedDB/IDBCursorRequest.cpp
+++ /dev/null
@@ -1,872 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-// XXX remove once we can get jsvals out of XPIDL
-#include "jscntxt.h"
-#include "jsapi.h"
-
-#include "IDBCursorRequest.h"
-
-#include "nsIIDBDatabaseException.h"
-#include "nsIVariant.h"
-
-#include "mozilla/storage.h"
-#include "nsComponentManagerUtils.h"
-#include "nsContentUtils.h"
-#include "nsDOMClassInfo.h"
-#include "nsJSON.h"
-#include "nsJSUtils.h"
-#include "nsThreadUtils.h"
-
-#include "AsyncConnectionHelper.h"
-#include "DatabaseInfo.h"
-#include "IDBEvents.h"
-#include "IDBIndexRequest.h"
-#include "IDBObjectStoreRequest.h"
-#include "IDBTransactionRequest.h"
-#include "Savepoint.h"
-#include "TransactionThreadPool.h"
-
-USING_INDEXEDDB_NAMESPACE
-
-namespace {
-
-class UpdateHelper : public AsyncConnectionHelper
-{
-public:
-  UpdateHelper(IDBTransactionRequest* aTransaction,
-               IDBRequest* aRequest,
-               PRInt64 aObjectStoreID,
-               const nsAString& aValue,
-               const Key& aKey,
-               bool aAutoIncrement,
-               nsTArray<IndexUpdateInfo>& aIndexUpdateInfo)
-  : AsyncConnectionHelper(aTransaction, aRequest), mOSID(aObjectStoreID),
-    mValue(aValue), mKey(aKey), mAutoIncrement(aAutoIncrement)
-  {
-    mIndexUpdateInfo.SwapElements(aIndexUpdateInfo);
-  }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  // In-params.
-  const PRInt64 mOSID;
-  const nsString mValue;
-  const Key mKey;
-  const bool mAutoIncrement;
-  nsTArray<IndexUpdateInfo> mIndexUpdateInfo;
-};
-
-class RemoveHelper : public AsyncConnectionHelper
-{
-public:
-  RemoveHelper(IDBTransactionRequest* aTransaction,
-               IDBRequest* aRequest,
-               PRInt64 aObjectStoreID,
-               const Key& aKey,
-               bool aAutoIncrement)
-  : AsyncConnectionHelper(aTransaction, aRequest), mOSID(aObjectStoreID),
-    mKey(aKey), mAutoIncrement(aAutoIncrement)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  // In-params.
-  const PRInt64 mOSID;
-  const nsString mValue;
-  const Key mKey;
-  const bool mAutoIncrement;
-};
-
-} // anonymous namespace
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class ContinueRunnable : public nsRunnable
-{
-public:
-  NS_DECL_NSIRUNNABLE
-
-  ContinueRunnable(IDBCursorRequest* aCursor,
-                   const Key& aKey)
-  : mCursor(aCursor), mKey(aKey)
-  { }
-
-private:
-  nsRefPtr<IDBCursorRequest> mCursor;
-  const Key mKey;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-// static
-already_AddRefed<IDBCursorRequest>
-IDBCursorRequest::Create(IDBRequest* aRequest,
-                         IDBTransactionRequest* aTransaction,
-                         IDBObjectStoreRequest* aObjectStore,
-                         PRUint16 aDirection,
-                         nsTArray<KeyValuePair>& aData)
-{
-  NS_ASSERTION(aObjectStore, "Null pointer!");
-
-  nsRefPtr<IDBCursorRequest> cursor =
-    IDBCursorRequest::CreateCommon(aRequest, aTransaction, aDirection);
-
-  cursor->mObjectStore = aObjectStore;
-
-  if (!cursor->mData.SwapElements(aData)) {
-    NS_ERROR("Out of memory?!");
-    return nsnull;
-  }
-  NS_ASSERTION(!cursor->mData.IsEmpty(), "Should never have an empty set!");
-
-  cursor->mDataIndex = cursor->mData.Length() - 1;
-  cursor->mType = OBJECTSTORE;
-
-  return cursor.forget();
-}
-
-// static
-already_AddRefed<IDBCursorRequest>
-IDBCursorRequest::Create(IDBRequest* aRequest,
-                         IDBTransactionRequest* aTransaction,
-                         IDBIndexRequest* aIndex,
-                         PRUint16 aDirection,
-                         nsTArray<KeyKeyPair>& aData)
-{
-  NS_ASSERTION(aIndex, "Null pointer!");
-
-  nsRefPtr<IDBCursorRequest> cursor =
-    IDBCursorRequest::CreateCommon(aRequest, aTransaction, aDirection);
-
-  cursor->mObjectStore = aIndex->ObjectStore();
-  cursor->mIndex = aIndex;
-
-  if (!cursor->mKeyData.SwapElements(aData)) {
-    NS_ERROR("Out of memory?!");
-    return nsnull;
-  }
-  NS_ASSERTION(!cursor->mKeyData.IsEmpty(), "Should never have an empty set!");
-
-  cursor->mDataIndex = cursor->mKeyData.Length() - 1;
-  cursor->mType = INDEX;
-
-  return cursor.forget();
-}
-
-// static
-already_AddRefed<IDBCursorRequest>
-IDBCursorRequest::Create(IDBRequest* aRequest,
-                         IDBTransactionRequest* aTransaction,
-                         IDBIndexRequest* aIndex,
-                         PRUint16 aDirection,
-                         nsTArray<KeyValuePair>& aData)
-{
-  NS_ASSERTION(aIndex, "Null pointer!");
-
-  nsRefPtr<IDBCursorRequest> cursor =
-    IDBCursorRequest::CreateCommon(aRequest, aTransaction, aDirection);
-
-  cursor->mObjectStore = aIndex->ObjectStore();
-  cursor->mIndex = aIndex;
-
-  if (!cursor->mData.SwapElements(aData)) {
-    NS_ERROR("Out of memory?!");
-    return nsnull;
-  }
-  NS_ASSERTION(!cursor->mData.IsEmpty(), "Should never have an empty set!");
-
-  cursor->mDataIndex = cursor->mData.Length() - 1;
-  cursor->mType = INDEXOBJECT;
-
-  return cursor.forget();
-}
-
-// static
-already_AddRefed<IDBCursorRequest>
-IDBCursorRequest::CreateCommon(IDBRequest* aRequest,
-                               IDBTransactionRequest* aTransaction,
-                               PRUint16 aDirection)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aRequest, "Null pointer!");
-  NS_ASSERTION(aTransaction, "Null pointer!");
-
-  nsRefPtr<IDBCursorRequest> cursor(new IDBCursorRequest());
-  cursor->mRequest = aRequest;
-  cursor->mTransaction = aTransaction;
-  cursor->mDirection = aDirection;
-
-  return cursor.forget();
-}
-
-IDBCursorRequest::IDBCursorRequest()
-: mDirection(nsIIDBCursor::NEXT),
-  mCachedValue(JSVAL_VOID),
-  mHaveCachedValue(false),
-  mJSRuntime(nsnull),
-  mContinueCalled(false),
-  mDataIndex(0),
-  mType(OBJECTSTORE)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-}
-
-IDBCursorRequest::~IDBCursorRequest()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (mJSRuntime) {
-    JS_RemoveRootRT(mJSRuntime, &mCachedValue);
-  }
-}
-
-NS_IMPL_ADDREF(IDBCursorRequest)
-NS_IMPL_RELEASE(IDBCursorRequest)
-
-NS_INTERFACE_MAP_BEGIN(IDBCursorRequest)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, IDBRequest::Generator)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBCursorRequest)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBCursor)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBCursorRequest)
-NS_INTERFACE_MAP_END
-
-DOMCI_DATA(IDBCursorRequest, IDBCursorRequest)
-
-NS_IMETHODIMP
-IDBCursorRequest::GetDirection(PRUint16* aDirection)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  *aDirection = mDirection;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBCursorRequest::GetKey(nsIVariant** aKey)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mCachedKey) {
-    nsresult rv;
-    nsCOMPtr<nsIWritableVariant> variant =
-      do_CreateInstance(NS_VARIANT_CONTRACTID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    const Key& key = mType == INDEX ?
-                     mKeyData[mDataIndex].key :
-                     mData[mDataIndex].key;
-    NS_ASSERTION(!key.IsUnset() && !key.IsNull(), "Bad key!");
-
-    if (key.IsString()) {
-      rv = variant->SetAsAString(key.StringValue());
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
-    else if (key.IsInt()) {
-      rv = variant->SetAsInt64(key.IntValue());
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
-    else {
-      NS_NOTREACHED("Huh?!");
-    }
-
-    rv = variant->SetWritable(PR_FALSE);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsIWritableVariant* result;
-    variant.forget(&result);
-
-    mCachedKey = dont_AddRef(static_cast<nsIVariant*>(result));
-  }
-
-  nsCOMPtr<nsIVariant> result(mCachedKey);
-  result.forget(aKey);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBCursorRequest::GetValue(nsIVariant** aValue)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsresult rv;
-
-  if (mType == INDEX) {
-    nsCOMPtr<nsIWritableVariant> variant =
-      do_CreateInstance(NS_VARIANT_CONTRACTID);
-    if (!variant) {
-      NS_ERROR("Couldn't create variant!");
-      return NS_ERROR_FAILURE;
-    }
-
-    const Key& value = mKeyData[mDataIndex].value;
-    NS_ASSERTION(!value.IsUnset() && !value.IsNull(), "Bad key!");
-    if (value.IsInt()) {
-      rv = variant->SetAsInt64(value.IntValue());
-    }
-    else if (value.IsString()) {
-      rv = variant->SetAsAString(value.StringValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key type!");
-    }
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = variant->SetWritable(PR_FALSE);;
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsIWritableVariant* result;
-    variant.forget(&result);
-    *aValue = result;
-    return NS_OK;
-  }
-
-  NS_WARNING("Using a slow path for GetValue! Fix this now!");
-
-  nsIXPConnect* xpc = nsContentUtils::XPConnect();
-  NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
-
-  nsAXPCNativeCallContext* cc;
-  rv = xpc->GetCurrentNativeCallContext(&cc);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
-
-  jsval* retval;
-  rv = cc->GetRetValPtr(&retval);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (!mHaveCachedValue) {
-    JSContext* cx;
-    rv = cc->GetJSContext(&cx);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    JSAutoRequest ar(cx);
-
-    if (!mJSRuntime) {
-      JSRuntime* rt = JS_GetRuntime(cx);
-
-      JSBool ok = JS_AddNamedRootRT(rt, &mCachedValue,
-                                   "IDBCursorRequest::mCachedValue");
-      NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-      mJSRuntime = rt;
-    }
-
-    nsCOMPtr<nsIJSON> json(new nsJSON());
-    rv = json->DecodeToJSVal(mData[mDataIndex].value, cx, &mCachedValue);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    mHaveCachedValue = true;
-  }
-
-  *retval = mCachedValue;
-  cc->SetReturnValueWasSet(PR_TRUE);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBCursorRequest::Continue(nsIVariant* aKey,
-                           PRUint8 aOptionalArgCount,
-                           PRBool* _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mObjectStore->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (mContinueCalled) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  Key key;
-  nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (key.IsNull()) {
-    if (aOptionalArgCount) {
-      return NS_ERROR_INVALID_ARG;
-    }
-    else {
-      key = Key::UNSETKEY;
-    }
-  }
-
-  TransactionThreadPool* pool = TransactionThreadPool::GetOrCreate();
-  NS_ENSURE_TRUE(pool, NS_ERROR_FAILURE);
-
-  nsRefPtr<ContinueRunnable> runnable(new ContinueRunnable(this, key));
-
-  rv = pool->Dispatch(mTransaction, runnable);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mTransaction->OnNewRequest();
-
-  mContinueCalled = true;
-
-  *_retval = PR_TRUE;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBCursorRequest::Update(nsIVariant* aValue,
-                         nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (mType != OBJECTSTORE) {
-    NS_NOTYETIMPLEMENTED("Implement me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  if (!mObjectStore->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (!mObjectStore->IsWriteAllowed()) {
-    return NS_ERROR_OBJECT_IS_IMMUTABLE;
-  }
-
-  const Key& key = mData[mDataIndex].key;
-  NS_ASSERTION(!key.IsUnset() && !key.IsNull(), "Bad key!");
-
-  // This is the slow path, need to do this better once XPIDL can have raw
-  // jsvals as arguments.
-  NS_WARNING("Using a slow path for Update! Fix this now!");
-
-  nsIXPConnect* xpc = nsContentUtils::XPConnect();
-  NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
-
-  nsAXPCNativeCallContext* cc;
-  nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
-
-  PRUint32 argc;
-  rv = cc->GetArgc(&argc);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (argc < 1) {
-    return NS_ERROR_XPC_NOT_ENOUGH_ARGS;
-  }
-
-  jsval* argv;
-  rv = cc->GetArgvPtr(&argv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  JSContext* cx;
-  rv = cc->GetJSContext(&cx);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  JSAutoRequest ar(cx);
-
-  js::AutoValueRooter clone(cx);
-  rv = nsContentUtils::CreateStructuredClone(cx, argv[0], clone.addr());
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  if (!mObjectStore->KeyPath().IsEmpty()) {
-    // Make sure the object given has the correct keyPath value set on it or
-    // we will add it.
-    const nsString& keyPath = mObjectStore->KeyPath();
-    const jschar* keyPathChars = reinterpret_cast<const jschar*>(keyPath.get());
-    const size_t keyPathLen = keyPath.Length();
-
-    js::AutoValueRooter prop(cx);
-    JSBool ok = JS_GetUCProperty(cx, JSVAL_TO_OBJECT(clone.value()),
-                                 keyPathChars, keyPathLen, prop.addr());
-    NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-    if (JSVAL_IS_VOID(prop.value())) {
-      if (key.IsInt()) {
-        ok = JS_NewNumberValue(cx, key.IntValue(), prop.addr());
-        NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-      }
-      else if (key.IsString()) {
-        const nsString& keyString = key.StringValue();
-        JSString* str =
-          JS_NewUCStringCopyN(cx,
-                              reinterpret_cast<const jschar*>(keyString.get()),
-                              keyString.Length());
-        NS_ENSURE_TRUE(str, NS_ERROR_FAILURE);
-
-        prop.set(STRING_TO_JSVAL(str));
-      }
-      else {
-        NS_NOTREACHED("Bad key!");
-      }
-
-      ok = JS_DefineUCProperty(cx, JSVAL_TO_OBJECT(clone.value()), keyPathChars,
-                               keyPathLen, prop.value(), nsnull, nsnull,
-                               JSPROP_ENUMERATE);
-      NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-    }
-
-    if (JSVAL_IS_NULL(prop.value())) {
-      return NS_ERROR_INVALID_ARG;
-    }
-
-    if (JSVAL_IS_INT(prop.value())) {
-      if (!key.IsInt() || JSVAL_TO_INT(prop.value()) != key.IntValue()) {
-        return NS_ERROR_INVALID_ARG;
-      }
-    }
-
-    if (JSVAL_IS_DOUBLE(prop.value())) {
-      if (!key.IsInt() || *JSVAL_TO_DOUBLE(prop.value()) != key.IntValue()) {
-        return NS_ERROR_INVALID_ARG;
-      }
-    }
-
-    if (JSVAL_IS_STRING(prop.value())) {
-      if (!key.IsString()) {
-        return NS_ERROR_INVALID_ARG;
-      }
-
-      if (key.StringValue() != nsDependentJSString(prop.value())) {
-        return NS_ERROR_INVALID_ARG;
-      }
-    }
-  }
-
-  nsTArray<IndexUpdateInfo> indexUpdateInfo;
-  rv = IDBObjectStoreRequest::GetIndexUpdateInfo(mObjectStore->GetObjectStoreInfo(),
-                                                 cx, clone.value(),
-                                                 indexUpdateInfo);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIJSON> json(new nsJSON());
-
-  nsString jsonValue;
-  rv = json->EncodeFromJSVal(clone.addr(), cx, jsonValue);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<UpdateHelper> helper =
-    new UpdateHelper(mTransaction, request, mObjectStore->Id(), jsonValue, key,
-                     mObjectStore->IsAutoIncrement(), indexUpdateInfo);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBCursorRequest::Remove(nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (mType != OBJECTSTORE) {
-    NS_NOTYETIMPLEMENTED("Implement me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  if (!mObjectStore->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (!mObjectStore->IsWriteAllowed()) {
-    return NS_ERROR_OBJECT_IS_IMMUTABLE;
-  }
-
-  const Key& key = mData[mDataIndex].key;
-  NS_ASSERTION(!key.IsUnset() && !key.IsNull(), "Bad key!");
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<RemoveHelper> helper =
-    new RemoveHelper(mTransaction, request, mObjectStore->Id(), key,
-                     mObjectStore->IsAutoIncrement());
-  nsresult rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-PRUint16
-UpdateHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_PRECONDITION(aConnection, "Passed a null connection!");
-
-  nsresult rv;
-  NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Badness!");
-
-  nsCOMPtr<mozIStorageStatement> stmt =
-    mTransaction->AddStatement(false, true, mAutoIncrement);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  Savepoint savepoint(mTransaction);
-
-  NS_NAMED_LITERAL_CSTRING(keyValue, "key_value");
-
-  rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mOSID);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (mKey.IsInt()) {
-    rv = stmt->BindInt64ByName(keyValue, mKey.IntValue());
-  }
-  else if (mKey.IsString()) {
-    rv = stmt->BindStringByName(keyValue, mKey.StringValue());
-  }
-  else {
-    NS_NOTREACHED("Unknown key type!");
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindStringByName(NS_LITERAL_CSTRING("data"), mValue);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (NS_FAILED(stmt->Execute())) {
-    return nsIIDBDatabaseException::CONSTRAINT_ERR;
-  }
-
-  // Update our indexes if needed.
-  if (!mIndexUpdateInfo.IsEmpty()) {
-    PRInt64 objectDataId = mAutoIncrement ? mKey.IntValue() : LL_MININT;
-    rv = IDBObjectStoreRequest::UpdateIndexes(mTransaction, mOSID, mKey,
-                                              mAutoIncrement, true,
-                                              objectDataId, mIndexUpdateInfo);
-    if (rv == NS_ERROR_STORAGE_CONSTRAINT) {
-      return nsIIDBDatabaseException::CONSTRAINT_ERR;
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  rv = savepoint.Release();
-  return NS_SUCCEEDED(rv) ? OK : nsIIDBDatabaseException::UNKNOWN_ERR;
-}
-
-PRUint16
-UpdateHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Badness!");
-
-  if (mKey.IsString()) {
-    aResult->SetAsAString(mKey.StringValue());
-  }
-  else if (mKey.IsInt()) {
-    aResult->SetAsInt64(mKey.IntValue());
-  }
-  else {
-    NS_NOTREACHED("Bad key!");
-  }
-  return OK;
-}
-
-PRUint16
-RemoveHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_PRECONDITION(aConnection, "Passed a null connection!");
-
-  nsCOMPtr<mozIStorageStatement> stmt =
-    mTransaction->RemoveStatement(mAutoIncrement);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mOSID);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Must have a key here!");
-
-  NS_NAMED_LITERAL_CSTRING(key_value, "key_value");
-
-  if (mKey.IsInt()) {
-    rv = stmt->BindInt64ByName(key_value, mKey.IntValue());
-  }
-  else if (mKey.IsString()) {
-    rv = stmt->BindStringByName(key_value, mKey.StringValue());
-  }
-  else {
-    NS_NOTREACHED("Unknown key type!");
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  // Search for it!
-  rv = stmt->Execute();
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  return OK;
-}
-
-PRUint16
-RemoveHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Badness!");
-
-  if (mKey.IsString()) {
-    aResult->SetAsAString(mKey.StringValue());
-  }
-  else if (mKey.IsInt()) {
-    aResult->SetAsInt64(mKey.IntValue());
-  }
-  else {
-    NS_NOTREACHED("Unknown key type!");
-  }
-  return OK;
-}
-
-NS_IMETHODIMP
-ContinueRunnable::Run()
-{
-  nsresult rv;
-
-  if (!NS_IsMainThread()) {
-    rv = NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    return NS_OK;
-  }
-
-  // Remove cached stuff from last time.
-  mCursor->mCachedKey = nsnull;
-  mCursor->mCachedValue = JSVAL_VOID;
-  mCursor->mHaveCachedValue = false;
-  mCursor->mContinueCalled = false;
-
-  if (mCursor->mType == IDBCursorRequest::INDEX) {
-    mCursor->mKeyData.RemoveElementAt(mCursor->mDataIndex);
-  }
-  else {
-    mCursor->mData.RemoveElementAt(mCursor->mDataIndex);
-  }
-  if (mCursor->mDataIndex) {
-    mCursor->mDataIndex--;
-  }
-
-  nsCOMPtr<nsIWritableVariant> variant =
-    do_CreateInstance(NS_VARIANT_CONTRACTID);
-  if (!variant) {
-    NS_ERROR("Couldn't create variant!");
-    return NS_ERROR_FAILURE;
-  }
-
-  PRBool empty = mCursor->mType == IDBCursorRequest::INDEX ?
-                 mCursor->mKeyData.IsEmpty() :
-                 mCursor->mData.IsEmpty();
-
-  if (empty) {
-    rv = variant->SetAsEmpty();
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-  else {
-    if (!mKey.IsUnset()) {
-      NS_ASSERTION(!mKey.IsNull(), "Huh?!");
-
-      NS_WARNING("Using a slow O(n) search for continue(key), do something "
-                 "smarter!");
-
-      // Skip ahead to our next key match.
-      PRInt32 index = PRInt32(mCursor->mDataIndex);
-
-      if (mCursor->mType == IDBCursorRequest::INDEX) {
-        while (index >= 0) {
-          const Key& key = mCursor->mKeyData[index].key;
-          if (mKey == key) {
-            break;
-          }
-          if (key < mKey) {
-            index--;
-            continue;
-          }
-          index = -1;
-          break;
-        }
-
-        if (index >= 0) {
-          mCursor->mDataIndex = PRUint32(index);
-          mCursor->mKeyData.RemoveElementsAt(index + 1,
-                                             mCursor->mKeyData.Length() - index
-                                             - 1);
-        }
-      }
-      else {
-        while (index >= 0) {
-          const Key& key = mCursor->mData[index].key;
-          if (mKey == key) {
-            break;
-          }
-          if (key < mKey) {
-            index--;
-            continue;
-          }
-          index = -1;
-          break;
-        }
-
-        if (index >= 0) {
-          mCursor->mDataIndex = PRUint32(index);
-          mCursor->mData.RemoveElementsAt(index + 1,
-                                          mCursor->mData.Length() - index - 1);
-        }
-      }
-    }
-
-    rv = variant->SetAsISupports(static_cast<IDBRequest::Generator*>(mCursor));
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  rv = variant->SetWritable(PR_FALSE);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMEvent> event =
-    IDBSuccessEvent::Create(mCursor->mRequest, variant, mCursor->mTransaction);
-  if (!event) {
-    NS_ERROR("Failed to create event!");
-    return NS_ERROR_FAILURE;
-  }
-
-  PRBool dummy;
-  mCursor->mRequest->DispatchEvent(event, &dummy);
-
-  mCursor->mTransaction->OnRequestFinished();
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/dom/indexedDB/IDBCursorRequest.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_idbcursorrequest_h__
-#define mozilla_dom_indexeddb_idbcursorrequest_h__
-
-#include "mozilla/dom/indexedDB/IDBObjectStoreRequest.h"
-#include "nsIIDBCursorRequest.h"
-
-#include "jsapi.h"
-
-class nsIRunnable;
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class IDBIndexRequest;
-class IDBRequest;
-class IDBObjectStoreRequest;
-class IDBTransactionRequest;
-
-struct KeyValuePair
-{
-  Key key;
-  nsString value;
-};
-
-struct KeyKeyPair
-{
-  Key key;
-  Key value;
-};
-
-class ContinueRunnable;
-
-class IDBCursorRequest : public IDBRequest::Generator,
-                         public nsIIDBCursorRequest
-{
-  friend class ContinueRunnable;
-
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIIDBCURSOR
-  NS_DECL_NSIIDBCURSORREQUEST
-
-  static
-  already_AddRefed<IDBCursorRequest>
-  Create(IDBRequest* aRequest,
-         IDBTransactionRequest* aTransaction,
-         IDBObjectStoreRequest* aObjectStore,
-         PRUint16 aDirection,
-         nsTArray<KeyValuePair>& aData);
-
-  static
-  already_AddRefed<IDBCursorRequest>
-  Create(IDBRequest* aRequest,
-         IDBTransactionRequest* aTransaction,
-         IDBIndexRequest* aIndex,
-         PRUint16 aDirection,
-         nsTArray<KeyKeyPair>& aData);
-
-  static
-  already_AddRefed<IDBCursorRequest>
-  Create(IDBRequest* aRequest,
-         IDBTransactionRequest* aTransaction,
-         IDBIndexRequest* aIndex,
-         PRUint16 aDirection,
-         nsTArray<KeyValuePair>& aData);
-
-  enum Type
-  {
-    OBJECTSTORE = 0,
-    INDEX,
-    INDEXOBJECT
-  };
-
-protected:
-  IDBCursorRequest();
-  ~IDBCursorRequest();
-
-  static
-  already_AddRefed<IDBCursorRequest>
-  CreateCommon(IDBRequest* aRequest,
-               IDBTransactionRequest* aTransaction,
-               PRUint16 aDirection);
-
-  nsRefPtr<IDBRequest> mRequest;
-  nsRefPtr<IDBTransactionRequest> mTransaction;
-  nsRefPtr<IDBObjectStoreRequest> mObjectStore;
-  nsRefPtr<IDBIndexRequest> mIndex;
-
-  PRUint16 mDirection;
-
-  nsCOMPtr<nsIVariant> mCachedKey;
-  jsval mCachedValue;
-  bool mHaveCachedValue;
-  JSRuntime* mJSRuntime;
-
-  bool mContinueCalled;
-  PRUint32 mDataIndex;
-
-  Type mType;
-  nsTArray<KeyValuePair> mData;
-  nsTArray<KeyKeyPair> mKeyData;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_idbcursorrequest_h__
deleted file mode 100644
--- a/dom/indexedDB/IDBDatabaseRequest.cpp
+++ /dev/null
@@ -1,809 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "IDBDatabaseRequest.h"
-
-#include "nsIIDBDatabaseException.h"
-#include "nsIIDBTransactionRequest.h"
-
-#include "mozilla/storage.h"
-#include "nsDOMClassInfo.h"
-#include "nsProxyRelease.h"
-#include "nsThreadUtils.h"
-
-#include "AsyncConnectionHelper.h"
-#include "DatabaseInfo.h"
-#include "IDBEvents.h"
-#include "IDBObjectStoreRequest.h"
-#include "IDBTransactionRequest.h"
-#include "IndexedDatabaseRequest.h"
-#include "LazyIdleThread.h"
-
-USING_INDEXEDDB_NAMESPACE
-
-namespace {
-
-const PRUint32 kDefaultDatabaseTimeoutSeconds = 30;
-
-inline
-nsISupports*
-isupports_cast(IDBDatabaseRequest* aClassPtr)
-{
-  return static_cast<nsISupports*>(
-    static_cast<IDBRequest::Generator*>(aClassPtr));
-}
-
-class SetVersionHelper : public AsyncConnectionHelper
-{
-public:
-  SetVersionHelper(IDBTransactionRequest* aTransaction,
-                   IDBRequest* aRequest,
-                   const nsAString& aVersion)
-  : AsyncConnectionHelper(aTransaction, aRequest), mVersion(aVersion)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  // In-params
-  nsString mVersion;
-};
-
-class CreateObjectStoreHelper : public AsyncConnectionHelper
-{
-public:
-  CreateObjectStoreHelper(IDBTransactionRequest* aTransaction,
-                          IDBRequest* aRequest,
-                          const nsAString& aName,
-                          const nsAString& aKeyPath,
-                          bool aAutoIncrement)
-  : AsyncConnectionHelper(aTransaction, aRequest), mName(aName),
-    mKeyPath(aKeyPath), mAutoIncrement(aAutoIncrement),
-    mId(LL_MININT)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-protected:
-  // In-params.
-  nsString mName;
-  nsString mKeyPath;
-  bool mAutoIncrement;
-
-  // Out-params.
-  PRInt64 mId;
-};
-
-class RemoveObjectStoreHelper : public AsyncConnectionHelper
-{
-public:
-  RemoveObjectStoreHelper(IDBTransactionRequest* aTransaction,
-                          IDBRequest* aRequest,
-                          const nsAString& aName)
-  : AsyncConnectionHelper(aTransaction, aRequest), mName(aName)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  // In-params.
-  nsString mName;
-};
-
-class AutoFree
-{
-public:
-  AutoFree(void* aPtr) : mPtr(aPtr) { }
-  ~AutoFree() { NS_Free(mPtr); }
-private:
-  void* mPtr;
-};
-
-inline
-nsresult
-ConvertVariantToStringArray(nsIVariant* aVariant,
-                            nsTArray<nsString>& aStringArray)
-{
-#ifdef DEBUG
-  PRUint16 type;
-  NS_ASSERTION(NS_SUCCEEDED(aVariant->GetDataType(&type)) &&
-               type == nsIDataType::VTYPE_ARRAY, "Bad arg!");
-#endif
-
-  PRUint16 valueType;
-  nsIID iid;
-  PRUint32 valueCount;
-  void* rawArray;
-
-  nsresult rv = aVariant->GetAsArray(&valueType, &iid, &valueCount, &rawArray);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  AutoFree af(rawArray);
-
-  // Just delete anything that we don't expect and return.
-  if (valueType != nsIDataType::VTYPE_WCHAR_STR) {
-    switch (valueType) {
-      case nsIDataType::VTYPE_ID:
-      case nsIDataType::VTYPE_CHAR_STR: {
-        char** charArray = reinterpret_cast<char**>(rawArray);
-        for (PRUint32 index = 0; index < valueCount; index++) {
-          if (charArray[index]) {
-            NS_Free(charArray[index]);
-          }
-        }
-      } break;
-
-      case nsIDataType::VTYPE_INTERFACE:
-      case nsIDataType::VTYPE_INTERFACE_IS: {
-        nsISupports** supportsArray = reinterpret_cast<nsISupports**>(rawArray);
-        for (PRUint32 index = 0; index < valueCount; index++) {
-          NS_IF_RELEASE(supportsArray[index]);
-        }
-      } break;
-
-      default: {
-        // The other types are primitives that do not need to be freed.
-      }
-    }
-
-    return NS_ERROR_ILLEGAL_VALUE;
-  }
-
-  PRUnichar** strings = reinterpret_cast<PRUnichar**>(rawArray);
-
-  for (PRUint32 index = 0; index < valueCount; index++) {
-    nsString* newString = aStringArray.AppendElement();
-
-    if (!newString) {
-      NS_ERROR("Out of memory?");
-      for (; index < valueCount; index++) {
-        NS_Free(strings[index]);
-      }
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-
-    newString->Adopt(strings[index], -1);
-  }
-
-  return NS_OK;
-}
-
-} // anonymous namespace
-
-// static
-already_AddRefed<IDBDatabaseRequest>
-IDBDatabaseRequest::Create(DatabaseInfo* aDatabaseInfo,
-                           LazyIdleThread* aThread,
-                           nsCOMPtr<mozIStorageConnection>& aConnection)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aDatabaseInfo, "Null pointer!");
-  NS_ASSERTION(aThread, "Null pointer!");
-  NS_ASSERTION(aConnection, "Null pointer!");
-
-  nsRefPtr<IDBDatabaseRequest> db(new IDBDatabaseRequest());
-
-  db->mDatabaseId = aDatabaseInfo->id;
-  db->mName = aDatabaseInfo->name;
-  db->mDescription = aDatabaseInfo->description;
-  db->mFilePath = aDatabaseInfo->filePath;
-
-  aThread->SetWeakIdleObserver(db);
-  db->mConnectionThread = aThread;
-
-  db->mConnection.swap(aConnection);
-
-  return db.forget();
-}
-
-IDBDatabaseRequest::IDBDatabaseRequest()
-: mDatabaseId(0)
-{
-
-}
-
-IDBDatabaseRequest::~IDBDatabaseRequest()
-{
-  if (mConnectionThread) {
-    mConnectionThread->SetWeakIdleObserver(nsnull);
-  }
-
-  CloseConnection();
-
-  if (mDatabaseId) {
-    DatabaseInfo* info;
-    if (!DatabaseInfo::Get(mDatabaseId, &info)) {
-      NS_ERROR("This should never fail!");
-    }
-
-    NS_ASSERTION(info->referenceCount, "Bad reference count!");
-    if (--info->referenceCount == 0) {
-      DatabaseInfo::Remove(mDatabaseId);
-    }
-  }
-}
-
-nsresult
-IDBDatabaseRequest::GetOrCreateConnection(mozIStorageConnection** aResult)
-{
-  NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
-
-  if (!mConnection) {
-    mConnection = IndexedDatabaseRequest::GetConnection(mFilePath);
-    NS_ENSURE_TRUE(mConnection, NS_ERROR_FAILURE);
-  }
-
-  nsCOMPtr<mozIStorageConnection> result(mConnection);
-  result.forget(aResult);
-  return NS_OK;
-}
-
-void
-IDBDatabaseRequest::CloseConnection()
-{
-  if (mConnection) {
-    if (mConnectionThread) {
-      NS_ProxyRelease(mConnectionThread, mConnection, PR_TRUE);
-    }
-    else {
-      NS_ERROR("Leaking connection!");
-      mozIStorageConnection* leak;
-      mConnection.forget(&leak);
-    }
-  }
-}
-
-NS_IMPL_ADDREF(IDBDatabaseRequest)
-NS_IMPL_RELEASE(IDBDatabaseRequest)
-
-NS_INTERFACE_MAP_BEGIN(IDBDatabaseRequest)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, IDBRequest::Generator)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBDatabaseRequest)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBDatabase)
-  NS_INTERFACE_MAP_ENTRY(nsIObserver)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBDatabaseRequest)
-NS_INTERFACE_MAP_END
-
-DOMCI_DATA(IDBDatabaseRequest, IDBDatabaseRequest)
-
-NS_IMETHODIMP
-IDBDatabaseRequest::GetName(nsAString& aName)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  aName.Assign(mName);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::GetDescription(nsAString& aDescription)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  aDescription.Assign(mDescription);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::GetVersion(nsAString& aVersion)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  DatabaseInfo* info;
-  if (!DatabaseInfo::Get(mDatabaseId, &info)) {
-    NS_ERROR("This should never fail!");
-    return NS_ERROR_UNEXPECTED;
-  }
-  aVersion.Assign(info->version);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::GetObjectStoreNames(nsIDOMDOMStringList** aObjectStores)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  DatabaseInfo* info;
-  if (!DatabaseInfo::Get(mDatabaseId, &info)) {
-    NS_ERROR("This should never fail!");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  nsAutoTArray<nsString, 10> objectStoreNames;
-  if (!info->GetObjectStoreNames(objectStoreNames)) {
-    NS_WARNING("Couldn't get names!");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  nsRefPtr<nsDOMStringList> list(new nsDOMStringList());
-  PRUint32 count = objectStoreNames.Length();
-  for (PRUint32 index = 0; index < count; index++) {
-    NS_ENSURE_TRUE(list->Add(objectStoreNames[index]), NS_ERROR_OUT_OF_MEMORY);
-  }
-
-  list.forget(aObjectStores);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::CreateObjectStore(const nsAString& aName,
-                                      const nsAString& aKeyPath,
-                                      PRBool aAutoIncrement,
-                                      nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (aName.IsEmpty()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  // XPConnect makes "null" into a void string, we need an empty string.
-  nsString keyPath(aKeyPath);
-  if (keyPath.IsVoid()) {
-    keyPath.Truncate();
-  }
-
-  DatabaseInfo* info;
-  if (!DatabaseInfo::Get(mDatabaseId, &info)) {
-    NS_ERROR("This should never fail!");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (info->ContainsStoreName(aName)) {
-    return NS_ERROR_ALREADY_INITIALIZED;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsTArray<nsString> objectStores;
-  nsString* name = objectStores.AppendElement(aName);
-  if (!name) {
-    NS_ERROR("Out of memory?");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  nsRefPtr<IDBTransactionRequest> transaction =
-    IDBTransactionRequest::Create(this, objectStores,
-                                  nsIIDBTransaction::READ_WRITE,
-                                  kDefaultDatabaseTimeoutSeconds);
-
-  nsRefPtr<CreateObjectStoreHelper> helper =
-    new CreateObjectStoreHelper(transaction, request, aName, keyPath,
-                                !!aAutoIncrement);
-  nsresult rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::RemoveObjectStore(const nsAString& aName,
-                                      nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (aName.IsEmpty()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  DatabaseInfo* info;
-  if (!DatabaseInfo::Get(mDatabaseId, &info)) {
-    NS_ERROR("This should never fail!");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (!info->ContainsStoreName(aName)) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  nsTArray<nsString> storesToOpen;
-  if (!storesToOpen.AppendElement(aName)) {
-    NS_ERROR("Out of memory!");
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  nsRefPtr<IDBTransactionRequest> transaction =
-    IDBTransactionRequest::Create(this, storesToOpen,
-                                  nsIIDBTransaction::READ_WRITE,
-                                  kDefaultDatabaseTimeoutSeconds);
-  NS_ENSURE_TRUE(transaction, NS_ERROR_FAILURE);
-
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-
-  nsRefPtr<RemoveObjectStoreHelper> helper =
-    new RemoveObjectStoreHelper(transaction, request, aName);
-  nsresult rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::SetVersion(const nsAString& aVersion,
-                               nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  DatabaseInfo* info;
-  if (!DatabaseInfo::Get(mDatabaseId, &info)) {
-    NS_ERROR("This should never fail!");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-
-  // Lock the whole database
-  nsTArray<nsString> storesToOpen;
-  nsRefPtr<IDBTransactionRequest> transaction =
-    IDBTransactionRequest::Create(this, storesToOpen,
-                                  IDBTransactionRequest::FULL_LOCK,
-                                  kDefaultDatabaseTimeoutSeconds);
-  NS_ENSURE_TRUE(transaction, NS_ERROR_FAILURE);
-
-  nsRefPtr<SetVersionHelper> helper =
-    new SetVersionHelper(transaction, request, aVersion);
-  nsresult rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::Transaction(nsIVariant* aStoreNames,
-                                PRUint16 aMode,
-                                PRUint32 aTimeout,
-                                PRUint8 aOptionalArgCount,
-                                nsIIDBTransactionRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (aOptionalArgCount) {
-    if (aMode != nsIIDBTransaction::READ_WRITE &&
-        aMode != nsIIDBTransaction::READ_ONLY &&
-        aMode != nsIIDBTransaction::SNAPSHOT_READ) {
-      return NS_ERROR_INVALID_ARG;
-    }
-    if (aMode == nsIIDBTransaction::SNAPSHOT_READ) {
-      NS_NOTYETIMPLEMENTED("Implement me!");
-      return NS_ERROR_NOT_IMPLEMENTED;
-    }
-  }
-  else {
-    aMode = nsIIDBTransaction::READ_ONLY;
-  }
-
-  if (aOptionalArgCount <= 1) {
-    aTimeout = kDefaultDatabaseTimeoutSeconds;
-  }
-
-  PRUint16 type;
-  nsresult rv = aStoreNames->GetDataType(&type);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  DatabaseInfo* info;
-  if (!DatabaseInfo::Get(mDatabaseId, &info)) {
-    NS_ERROR("This should never fail!");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  nsTArray<nsString> storesToOpen;
-
-  switch (type) {
-    case nsIDataType::VTYPE_VOID:
-    case nsIDataType::VTYPE_EMPTY:
-    case nsIDataType::VTYPE_EMPTY_ARRAY: {
-      // Empty, request all object stores
-      if (!info->GetObjectStoreNames(storesToOpen)) {
-        NS_ERROR("Out of memory?");
-        return NS_ERROR_OUT_OF_MEMORY;
-      }
-    } break;
-
-    case nsIDataType::VTYPE_WSTRING_SIZE_IS: {
-      // Single name
-      nsString name;
-      rv = aStoreNames->GetAsAString(name);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      if (!info->ContainsStoreName(name)) {
-        return NS_ERROR_NOT_AVAILABLE;
-      }
-
-      if (!storesToOpen.AppendElement(name)) {
-        NS_ERROR("Out of memory?");
-        return NS_ERROR_OUT_OF_MEMORY;
-      }
-    } break;
-
-    case nsIDataType::VTYPE_ARRAY: {
-      nsTArray<nsString> names;
-      rv = ConvertVariantToStringArray(aStoreNames, names);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      PRUint32 nameCount = names.Length();
-      for (PRUint32 nameIndex = 0; nameIndex < nameCount; nameIndex++) {
-        nsString& name = names[nameIndex];
-
-        if (!info->ContainsStoreName(name)) {
-          return NS_ERROR_NOT_AVAILABLE;
-        }
-
-        if (!storesToOpen.AppendElement(name)) {
-          NS_ERROR("Out of memory?");
-          return NS_ERROR_OUT_OF_MEMORY;
-        }
-      }
-      NS_ASSERTION(nameCount == storesToOpen.Length(), "Should have bailed!");
-    } break;
-
-    case nsIDataType::VTYPE_INTERFACE:
-    case nsIDataType::VTYPE_INTERFACE_IS: {
-      nsCOMPtr<nsISupports> supports;
-      nsID *iid;
-      rv = aStoreNames->GetAsInterface(&iid, getter_AddRefs(supports));
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      NS_Free(iid);
-
-      nsCOMPtr<nsIDOMDOMStringList> stringList(do_QueryInterface(supports));
-      if (!stringList) {
-        // We don't support anything other than nsIDOMDOMStringList.
-        return NS_ERROR_ILLEGAL_VALUE;
-      }
-
-      PRUint32 stringCount;
-      rv = stringList->GetLength(&stringCount);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      for (PRUint32 stringIndex = 0; stringIndex < stringCount; stringIndex++) {
-        nsString name;
-        rv = stringList->Item(stringIndex, name);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (!info->ContainsStoreName(name)) {
-          return NS_ERROR_NOT_AVAILABLE;
-        }
-
-        if (!storesToOpen.AppendElement(name)) {
-          NS_ERROR("Out of memory?");
-          return NS_ERROR_OUT_OF_MEMORY;
-        }
-      }
-    } break;
-
-    default:
-      return NS_ERROR_ILLEGAL_VALUE;
-  }
-
-  nsRefPtr<IDBTransactionRequest> transaction =
-    IDBTransactionRequest::Create(this, storesToOpen, aMode,
-                                  kDefaultDatabaseTimeoutSeconds);
-  NS_ENSURE_TRUE(transaction, NS_ERROR_FAILURE);
-
-  transaction.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::ObjectStore(const nsAString& aName,
-                                PRUint16 aMode,
-                                PRUint8 aOptionalArgCount,
-                                nsIIDBObjectStoreRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (aName.IsEmpty()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  if (aOptionalArgCount) {
-    if (aMode != nsIIDBTransaction::READ_WRITE &&
-        aMode != nsIIDBTransaction::READ_ONLY &&
-        aMode != nsIIDBTransaction::SNAPSHOT_READ) {
-      return NS_ERROR_INVALID_ARG;
-    }
-  }
-  else {
-    aMode = nsIIDBTransaction::READ_ONLY;
-  }
-
-  DatabaseInfo* info;
-  if (!DatabaseInfo::Get(mDatabaseId, &info)) {
-    NS_ERROR("This should never fail!");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (!info->ContainsStoreName(aName)) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  nsTArray<nsString> storesToOpen;
-  if (!storesToOpen.AppendElement(aName)) {
-    NS_ERROR("Out of memory?");
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  nsRefPtr<IDBTransactionRequest> transaction =
-    IDBTransactionRequest::Create(this, storesToOpen, aMode,
-                                  kDefaultDatabaseTimeoutSeconds);
-  NS_ENSURE_TRUE(transaction, NS_ERROR_FAILURE);
-
-  nsresult rv = transaction->ObjectStore(aName, _retval);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBDatabaseRequest::Observe(nsISupports* aSubject,
-                            const char* aTopic,
-                            const PRUnichar* aData)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ENSURE_FALSE(strcmp(aTopic, IDLE_THREAD_TOPIC), NS_ERROR_UNEXPECTED);
-
-  CloseConnection();
-
-  return NS_OK;
-}
-
-PRUint16
-SetVersionHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_PRECONDITION(aConnection, "Passing a null connection!");
-
-  nsCOMPtr<mozIStorageStatement> stmt;
-  nsresult rv = aConnection->CreateStatement(NS_LITERAL_CSTRING(
-    "UPDATE database "
-    "SET version = :version"
-  ), getter_AddRefs(stmt));
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindStringByName(NS_LITERAL_CSTRING("version"), mVersion);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (NS_FAILED(stmt->Execute())) {
-    return nsIIDBDatabaseException::CONSTRAINT_ERR;
-  }
-
-  return OK;
-}
-
-PRUint16
-SetVersionHelper::GetSuccessResult(nsIWritableVariant* /* aResult */)
-{
-  DatabaseInfo* info;
-  if (!DatabaseInfo::Get(mDatabase->Id(), &info)) {
-    NS_ERROR("This should never fail!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-  info->version = mVersion;
-
-  return OK;
-}
-
-PRUint16
-CreateObjectStoreHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  // Insert the data into the database.
-  nsCOMPtr<mozIStorageStatement> stmt;
-  nsresult rv = aConnection->CreateStatement(NS_LITERAL_CSTRING(
-    "INSERT INTO object_store (name, key_path, auto_increment) "
-    "VALUES (:name, :key_path, :auto_increment)"
-  ), getter_AddRefs(stmt));
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mName);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindStringByName(NS_LITERAL_CSTRING("key_path"), mKeyPath);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("auto_increment"),
-                             mAutoIncrement ? 1 : 0);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (NS_FAILED(stmt->Execute())) {
-    return nsIIDBDatabaseException::CONSTRAINT_ERR;
-  }
-
-  // Get the id of this object store, and store it for future use.
-  (void)aConnection->GetLastInsertRowID(&mId);
-
-  return OK;
-}
-
-PRUint16
-CreateObjectStoreHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  nsAutoPtr<ObjectStoreInfo> info(new ObjectStoreInfo());
-
-  info->name = mName;
-  info->id = mId;
-  info->keyPath = mKeyPath;
-  info->autoIncrement = mAutoIncrement;
-  info->databaseId = mDatabase->Id();
-
-  if (!ObjectStoreInfo::Put(info)) {
-    NS_ERROR("Put failed!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-  info.forget();
-
-  nsCOMPtr<nsIIDBObjectStoreRequest> result;
-  nsresult rv = mTransaction->ObjectStore(mName, getter_AddRefs(result));
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  aResult->SetAsISupports(result);
-
-  return OK;
-}
-
-PRUint16
-RemoveObjectStoreHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  nsCOMPtr<mozIStorageStatement> stmt;
-  nsresult rv = aConnection->CreateStatement(NS_LITERAL_CSTRING(
-    "DELETE FROM object_store "
-    "WHERE name = :name "
-  ), getter_AddRefs(stmt));
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mName);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (NS_FAILED(stmt->Execute())) {
-    return nsIIDBDatabaseException::NOT_FOUND_ERR;
-  }
-
-  return OK;
-}
-
-PRUint16
-RemoveObjectStoreHelper::GetSuccessResult(nsIWritableVariant* /* aResult */)
-{
-  ObjectStoreInfo::Remove(mDatabase->Id(), mName);
-  return OK;
-}
deleted file mode 100644
--- a/dom/indexedDB/IDBDatabaseRequest.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_idbdatabaserequest_h__
-#define mozilla_dom_indexeddb_idbdatabaserequest_h__
-
-#include "mozilla/dom/indexedDB/IDBRequest.h"
-#include "mozilla/dom/indexedDB/LazyIdleThread.h"
-
-#include "mozIStorageConnection.h"
-#include "nsIIDBDatabaseRequest.h"
-#include "nsIObserver.h"
-
-#include "nsDOMLists.h"
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class AsyncConnectionHelper;
-struct DatabaseInfo;
-class IDBTransactionRequest;
-
-class IDBDatabaseRequest : public IDBRequest::Generator,
-                           public nsIIDBDatabaseRequest,
-                           public nsIObserver
-{
-  friend class AsyncConnectionHelper;
-
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIIDBDATABASE
-  NS_DECL_NSIIDBDATABASEREQUEST
-  NS_DECL_NSIOBSERVER
-
-  static already_AddRefed<IDBDatabaseRequest>
-  Create(DatabaseInfo* aDatabaseInfo,
-         LazyIdleThread* aThread,
-         nsCOMPtr<mozIStorageConnection>& aConnection);
-
-  nsIThread* ConnectionThread() {
-    return mConnectionThread;
-  }
-
-  void CloseConnection();
-
-  PRUint32 Id() {
-    return mDatabaseId;
-  }
-
-  const nsString& FilePath() {
-    return mFilePath;
-  }
-
-protected:
-  IDBDatabaseRequest();
-  ~IDBDatabaseRequest();
-
-  // Only meant to be called on mStorageThread!
-  nsresult GetOrCreateConnection(mozIStorageConnection** aConnection);
-
-private:
-  PRUint32 mDatabaseId;
-  nsString mName;
-  nsString mDescription;
-  nsString mFilePath;
-
-  nsRefPtr<LazyIdleThread> mConnectionThread;
-
-  // Only touched on mStorageThread! These must be destroyed in the
-  // FireCloseConnectionRunnable method.
-  nsCOMPtr<mozIStorageConnection> mConnection;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_idbdatabaserequest_h__
deleted file mode 100644
--- a/dom/indexedDB/IDBEvents.cpp
+++ /dev/null
@@ -1,623 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "IDBEvents.h"
-
-#include "nsIIDBDatabaseException.h"
-#include "nsIPrivateDOMEvent.h"
-
-#include "jscntxt.h"
-#include "nsContentUtils.h"
-#include "nsDOMClassInfo.h"
-#include "nsJSON.h"
-#include "nsThreadUtils.h"
-
-#include "IDBRequest.h"
-#include "IDBTransactionRequest.h"
-
-#define NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(_class, _condition)  \
-  if ((_condition) && (aIID.Equals(NS_GET_IID(nsIClassInfo)) ||               \
-                       aIID.Equals(NS_GET_IID(nsXPCClassInfo)))) {            \
-    foundInterface = NS_GetDOMClassInfoInstance(eDOMClassInfo_##_class##_id); \
-    if (!foundInterface) {                                                    \
-      *aInstancePtr = nsnull;                                                 \
-      return NS_ERROR_OUT_OF_MEMORY;                                          \
-    }                                                                         \
-  } else
-
-USING_INDEXEDDB_NAMESPACE
-
-namespace {
-
-template<class Class>
-inline
-nsIDOMEvent*
-idomevent_cast(Class* aClassPtr)
-{
-  return static_cast<nsIDOMEvent*>(static_cast<nsDOMEvent*>(aClassPtr));
-}
-
-template<class Class>
-inline
-nsIDOMEvent*
-idomevent_cast(nsRefPtr<Class> aClassAutoPtr)
-{
-  return idomevent_cast(aClassAutoPtr.get());
-}
-
-class EventFiringRunnable : public nsRunnable
-{
-public:
-  EventFiringRunnable(nsIDOMEventTarget* aTarget,
-                      nsIDOMEvent* aEvent)
-  : mTarget(aTarget), mEvent(aEvent)
-  { }
-
-  NS_IMETHOD Run() {
-    PRBool dummy;
-    return mTarget->DispatchEvent(mEvent, &dummy);
-  }
-
-private:
-  nsCOMPtr<nsIDOMEventTarget> mTarget;
-  nsCOMPtr<nsIDOMEvent> mEvent;
-};
-
-void
-GetMessageForErrorCode(PRUint16 aCode,
-                       nsAString& aMessage)
-{
-  switch (aCode) {
-    case nsIIDBDatabaseException::NON_TRANSIENT_ERR:
-      aMessage.AssignLiteral("This error occurred because an operation was not "
-                             "allowed on an object. A retry of the same "
-                             "operation would fail unless the cause of the "
-                             "error is corrected.");
-      break;
-    case nsIIDBDatabaseException::NOT_FOUND_ERR:
-      aMessage.AssignLiteral("The operation failed because the requested "
-                             "database object could not be found. For example, "
-                             "an object store did not exist but was being "
-                             "opened.");
-      break;
-    case nsIIDBDatabaseException::CONSTRAINT_ERR:
-      aMessage.AssignLiteral("A mutation operation in the transaction failed "
-                             "due to a because a constraint was not satisfied. "
-                             "For example, an object such as an object store "
-                             "or index already exists and a new one was being "
-                             "attempted to be created.");
-      break;
-    case nsIIDBDatabaseException::DATA_ERR:
-      aMessage.AssignLiteral("Data provided to an operation does not meet "
-                             "requirements.");
-      break;
-    case nsIIDBDatabaseException::NOT_ALLOWED_ERR:
-      aMessage.AssignLiteral("A mutation operation was attempted on a database "
-                             "that did not allow mutations.");
-      break;
-    case nsIIDBDatabaseException::SERIAL_ERR:
-      aMessage.AssignLiteral("The operation failed because of the size of the "
-                             "data set being returned or because there was a "
-                             "problem in serializing or deserializing the "
-                             "object being processed.");
-      break;
-    case nsIIDBDatabaseException::RECOVERABLE_ERR:
-      aMessage.AssignLiteral("The operation failed because the database was "
-                             "prevented from taking an action. The operation "
-                             "might be able to succeed if the application "
-                             "performs some recovery steps and retries the "
-                             "entire transaction. For example, there was not "
-                             "enough remaining storage space, or the storage "
-                             "quota was reached and the user declined to give "
-                             "more space to the database.");
-      break;
-    case nsIIDBDatabaseException::TRANSIENT_ERR:
-      aMessage.AssignLiteral("The operation failed because of some temporary "
-                             "problems. The failed operation might be able to "
-                             "succeed when the operation is retried without "
-                             "any intervention by application-level "
-                             "functionality.");
-      break;
-    case nsIIDBDatabaseException::TIMEOUT_ERR:
-      aMessage.AssignLiteral("A lock for the transaction could not be obtained "
-                             "in a reasonable time.");
-      break;
-    case nsIIDBDatabaseException::DEADLOCK_ERR:
-      aMessage.AssignLiteral("The current transaction was automatically rolled "
-                             "back by the database becuase of deadlock or "
-                             "other transaction serialization failures.");
-      break;
-    case nsIIDBDatabaseException::UNKNOWN_ERR:
-      // Fall through.
-    default:
-      aMessage.AssignLiteral("The operation failed for reasons unrelated to "
-                             "the database itself and not covered by any other "
-                             "error code.");
-  }
-}
-
-} // anonymous namespace
-
-// static
-already_AddRefed<nsIDOMEvent>
-IDBEvent::CreateGenericEvent(const nsAString& aType)
-{
-  nsRefPtr<nsDOMEvent> event(new nsDOMEvent(nsnull, nsnull));
-  nsresult rv = event->InitEvent(aType, PR_FALSE, PR_FALSE);
-  NS_ENSURE_SUCCESS(rv, nsnull);
-
-  rv = event->SetTrusted(PR_TRUE);
-  NS_ENSURE_SUCCESS(rv, nsnull);
-
-  nsDOMEvent* result;
-  event.forget(&result);
-  return result;
-}
-
-// static
-already_AddRefed<nsIRunnable>
-IDBEvent::CreateGenericEventRunnable(const nsAString& aType,
-                                     nsIDOMEventTarget* aTarget)
-{
-  nsCOMPtr<nsIDOMEvent> event(IDBEvent::CreateGenericEvent(aType));
-  NS_ENSURE_TRUE(event, nsnull);
-
-  nsCOMPtr<nsIRunnable> runnable(new EventFiringRunnable(aTarget, event));
-  return runnable.forget();
-}
-
-NS_IMPL_ADDREF_INHERITED(IDBEvent, nsDOMEvent)
-NS_IMPL_RELEASE_INHERITED(IDBEvent, nsDOMEvent)
-
-NS_INTERFACE_MAP_BEGIN(IDBEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
-
-NS_IMETHODIMP
-IDBEvent::GetSource(nsISupports** aSource)
-{
-  nsCOMPtr<nsISupports> source(mSource);
-  source.forget(aSource);
-  return NS_OK;
-}
-
-// static
-already_AddRefed<nsIDOMEvent>
-IDBErrorEvent::Create(IDBRequest* aRequest,
-                      PRUint16 aCode)
-{
-  nsRefPtr<IDBErrorEvent> event(new IDBErrorEvent());
-
-  event->mSource = aRequest->GetGenerator();
-  event->mCode = aCode;
-  GetMessageForErrorCode(aCode, event->mMessage);
-
-  nsresult rv = event->InitEvent(NS_LITERAL_STRING(ERROR_EVT_STR), PR_FALSE,
-                                 PR_FALSE);
-  NS_ENSURE_SUCCESS(rv, nsnull);
-
-  rv = event->SetTrusted(PR_TRUE);
-  NS_ENSURE_SUCCESS(rv, nsnull);
-
-  IDBErrorEvent* result;
-  event.forget(&result);
-  return idomevent_cast(result);
-}
-
-// static
-already_AddRefed<nsIRunnable>
-IDBErrorEvent::CreateRunnable(IDBRequest* aRequest,
-                              PRUint16 aCode)
-{
-  nsCOMPtr<nsIDOMEvent> event(IDBErrorEvent::Create(aRequest, aCode));
-  NS_ENSURE_TRUE(event, nsnull);
-
-  nsCOMPtr<nsIRunnable> runnable(new EventFiringRunnable(aRequest, event));
-  return runnable.forget();
-}
-
-NS_IMPL_ADDREF_INHERITED(IDBErrorEvent, IDBEvent)
-NS_IMPL_RELEASE_INHERITED(IDBErrorEvent, IDBEvent)
-
-NS_INTERFACE_MAP_BEGIN(IDBErrorEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBErrorEvent)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBErrorEvent)
-NS_INTERFACE_MAP_END_INHERITING(IDBEvent)
-
-DOMCI_DATA(IDBErrorEvent, IDBErrorEvent)
-
-NS_IMETHODIMP
-IDBErrorEvent::GetCode(PRUint16* aCode)
-{
-  *aCode = mCode;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBErrorEvent::SetCode(PRUint16 aCode)
-{
-  mCode = aCode;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBErrorEvent::GetMessage(nsAString& aMessage)
-{
-  aMessage.Assign(mMessage);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBErrorEvent::SetMessage(const nsAString& aMessage)
-{
-  mMessage.Assign(aMessage);
-  return NS_OK;
-}
-
-// static
-already_AddRefed<nsIDOMEvent>
-IDBSuccessEvent::Create(IDBRequest* aRequest,
-                        nsIVariant* aResult,
-                        nsIIDBTransactionRequest* aTransaction)
-{
-  nsRefPtr<IDBSuccessEvent> event(new IDBSuccessEvent());
-
-  event->mSource = aRequest->GetGenerator();
-  event->mResult = aResult;
-  event->mTransaction = aTransaction;
-
-  nsresult rv = event->InitEvent(NS_LITERAL_STRING(SUCCESS_EVT_STR), PR_FALSE,
-                                 PR_FALSE);
-  NS_ENSURE_SUCCESS(rv, nsnull);
-
-  rv = event->SetTrusted(PR_TRUE);
-  NS_ENSURE_SUCCESS(rv, nsnull);
-
-  IDBSuccessEvent* result;
-  event.forget(&result);
-  return idomevent_cast(result);
-}
-
-// static
-already_AddRefed<nsIRunnable>
-IDBSuccessEvent::CreateRunnable(IDBRequest* aRequest,
-                                nsIVariant* aResult,
-                                nsIIDBTransactionRequest* aTransaction)
-{
-  nsCOMPtr<nsIDOMEvent> event =
-    IDBSuccessEvent::Create(aRequest, aResult, aTransaction);
-  NS_ENSURE_TRUE(event, nsnull);
-
-  nsCOMPtr<nsIRunnable> runnable(new EventFiringRunnable(aRequest, event));
-  return runnable.forget();
-}
-
-NS_IMPL_ADDREF_INHERITED(IDBSuccessEvent, IDBEvent)
-NS_IMPL_RELEASE_INHERITED(IDBSuccessEvent, IDBEvent)
-
-NS_INTERFACE_MAP_BEGIN(IDBSuccessEvent)
-  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIIDBTransactionEvent, mTransaction)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(IDBTransactionEvent,
-                                                   mTransaction)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBSuccessEvent)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBSuccessEvent)
-NS_INTERFACE_MAP_END_INHERITING(IDBEvent)
-
-DOMCI_DATA(IDBSuccessEvent, IDBSuccessEvent)
-DOMCI_DATA(IDBTransactionEvent, IDBSuccessEvent)
-
-NS_IMETHODIMP
-IDBSuccessEvent::GetResult(nsIVariant** aResult)
-{
-  nsCOMPtr<nsIVariant> result(mResult);
-  result.forget(aResult);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBSuccessEvent::GetTransaction(nsIIDBTransactionRequest** aTransaction)
-{
-  nsCOMPtr<nsIIDBTransactionRequest> transaction(mTransaction);
-  transaction.forget(aTransaction);
-  return NS_OK;
-}
-
-nsresult
-GetSuccessEvent::Init(IDBRequest* aRequest,
-                      IDBTransactionRequest* aTransaction)
-{
-  mSource = aRequest->GetGenerator();
-  mTransaction = aTransaction;
-
-  nsresult rv = InitEvent(NS_LITERAL_STRING(SUCCESS_EVT_STR), PR_FALSE,
-                          PR_FALSE);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = SetTrusted(PR_TRUE);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-GetSuccessEvent::GetResult(nsIVariant** /* aResult */)
-{
-  // This is the slow path, need to do this better once XPIDL can pass raw
-  // jsvals.
-  NS_WARNING("Using a slow path for GetResult! Fix this now!");
-
-  nsIXPConnect* xpc = nsContentUtils::XPConnect();
-  NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
-
-  nsAXPCNativeCallContext* cc;
-  nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
-
-  jsval* retval;
-  rv = cc->GetRetValPtr(&retval);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (mValue.IsVoid()) {
-    *retval = JSVAL_VOID;
-    return NS_OK;
-  }
-
-  if (!mJSRuntime) {
-    nsString jsonValue = mValue;
-    mValue.Truncate();
-
-    JSContext* cx;
-    rv = cc->GetJSContext(&cx);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    JSAutoRequest ar(cx);
-
-    JSRuntime* rt = JS_GetRuntime(cx);
-
-    JSBool ok = JS_AddNamedRootRT(rt, &mCachedValue,
-                                  "GetSuccessEvent::mCachedValue");
-    NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-    mJSRuntime = rt;
-
-    nsCOMPtr<nsIJSON> json(new nsJSON());
-    rv = json->DecodeToJSVal(jsonValue, cx, &mCachedValue);
-    if (NS_FAILED(rv)) {
-      mCachedValue = JSVAL_VOID;
-
-      NS_ERROR("Failed to decode!");
-      return rv;
-    }
-  }
-
-  *retval = mCachedValue;
-  cc->SetReturnValueWasSet(PR_TRUE);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-GetAllSuccessEvent::GetResult(nsIVariant** /* aResult */)
-{
-  // This is the slow path, need to do this better once XPIDL can pass raw
-  // jsvals.
-  NS_WARNING("Using a slow path for GetResult! Fix this now!");
-
-  nsIXPConnect* xpc = nsContentUtils::XPConnect();
-  NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
-
-  nsAXPCNativeCallContext* cc;
-  nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
-
-  jsval* retval;
-  rv = cc->GetRetValPtr(&retval);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (!mJSRuntime) {
-    JSContext* cx;
-    rv = cc->GetJSContext(&cx);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    JSAutoRequest ar(cx);
-
-    JSRuntime* rt = JS_GetRuntime(cx);
-
-    JSBool ok = JS_AddNamedRootRT(rt, &mCachedValue,
-                                  "GetSuccessEvent::mCachedValue");
-    NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-    mJSRuntime = rt;
-
-    // Swap into a stack array so that we don't hang on to the strings if
-    // something fails.
-    nsTArray<nsString> values;
-    if (!mValues.SwapElements(values)) {
-      NS_ERROR("Failed to swap elements!");
-      return NS_ERROR_FAILURE;
-    }
-
-    JSObject* array = JS_NewArrayObject(cx, 0, NULL);
-    if (!array) {
-      NS_ERROR("Failed to make array!");
-      return NS_ERROR_FAILURE;
-    }
-
-    mCachedValue = OBJECT_TO_JSVAL(array);
-
-    if (!values.IsEmpty()) {
-      if (!JS_SetArrayLength(cx, array, jsuint(values.Length()))) {
-        mCachedValue = JSVAL_VOID;
-        NS_ERROR("Failed to set array length!");
-        return NS_ERROR_FAILURE;
-      }
-
-      nsCOMPtr<nsIJSON> json(new nsJSON());
-      js::AutoValueRooter value(cx);
-
-      jsint count = jsint(values.Length());
-
-      for (jsint index = 0; index < count; index++) {
-        nsString jsonValue = values[index];
-        values[index].Truncate();
-
-        rv = json->DecodeToJSVal(jsonValue, cx, value.addr());
-        if (NS_FAILED(rv)) {
-          mCachedValue = JSVAL_VOID;
-          NS_ERROR("Failed to decode!");
-          return rv;
-        }
-
-        if (!JS_SetElement(cx, array, index, value.addr())) {
-          mCachedValue = JSVAL_VOID;
-          NS_ERROR("Failed to set array element!");
-          return NS_ERROR_FAILURE;
-        }
-      }
-    }
-  }
-
-  *retval = mCachedValue;
-  cc->SetReturnValueWasSet(PR_TRUE);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-GetAllKeySuccessEvent::GetResult(nsIVariant** /* aResult */)
-{
-  // This is the slow path, need to do this better once XPIDL can pass raw
-  // jsvals.
-  NS_WARNING("Using a slow path for GetResult! Fix this now!");
-
-  nsIXPConnect* xpc = nsContentUtils::XPConnect();
-  NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
-
-  nsAXPCNativeCallContext* cc;
-  nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
-
-  jsval* retval;
-  rv = cc->GetRetValPtr(&retval);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (!mJSRuntime) {
-    JSContext* cx;
-    rv = cc->GetJSContext(&cx);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    JSAutoRequest ar(cx);
-
-    JSRuntime* rt = JS_GetRuntime(cx);
-
-    JSBool ok = JS_AddNamedRootRT(rt, &mCachedValue,
-                                  "GetSuccessEvent::mCachedValue");
-    NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-    mJSRuntime = rt;
-
-    // Swap into a stack array so that we don't hang on to the strings if
-    // something fails.
-    nsTArray<Key> keys;
-    if (!mKeys.SwapElements(keys)) {
-      NS_ERROR("Failed to swap elements!");
-      return NS_ERROR_FAILURE;
-    }
-
-    JSObject* array = JS_NewArrayObject(cx, 0, NULL);
-    if (!array) {
-      NS_ERROR("Failed to make array!");
-      return NS_ERROR_FAILURE;
-    }
-
-    mCachedValue = OBJECT_TO_JSVAL(array);
-
-    if (!keys.IsEmpty()) {
-      if (!JS_SetArrayLength(cx, array, jsuint(keys.Length()))) {
-        mCachedValue = JSVAL_VOID;
-        NS_ERROR("Failed to set array length!");
-        return NS_ERROR_FAILURE;
-      }
-
-      js::AutoValueRooter value(cx);
-
-      jsint count = jsint(keys.Length());
-
-      for (jsint index = 0; index < count; index++) {
-        const Key& key = keys[index];
-        NS_ASSERTION(!key.IsUnset() && !key.IsNull(), "Bad key!");
-
-        if (key.IsInt()) {
-          if (!JS_NewNumberValue(cx, key.IntValue(), value.addr())) {
-            mCachedValue = JSVAL_VOID;
-            NS_ERROR("Failed to make number value!");
-            return NS_ERROR_FAILURE;
-          }
-        }
-        else if (key.IsString()) {
-          const nsString& keyString = key.StringValue();
-          JSString* str = JS_NewUCStringCopyN(cx,
-                            reinterpret_cast<const jschar*>(keyString.get()),
-                            keyString.Length());
-          if (!str) {
-            mCachedValue = JSVAL_VOID;
-            NS_ERROR("Failed to make new string value!");
-            return NS_ERROR_FAILURE;
-          }
-
-          value.set(STRING_TO_JSVAL(str));
-        }
-        else {
-          NS_NOTREACHED("Bad key!");
-        }
-
-        if (!JS_SetElement(cx, array, index, value.addr())) {
-          mCachedValue = JSVAL_VOID;
-          NS_ERROR("Failed to set array element!");
-          return NS_ERROR_FAILURE;
-        }
-      }
-    }
-  }
-
-  *retval = mCachedValue;
-  cc->SetReturnValueWasSet(PR_TRUE);
-  return NS_OK;
-}
deleted file mode 100644
--- a/dom/indexedDB/IDBEvents.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_idbevents_h__
-#define mozilla_dom_indexeddb_idbevents_h__
-
-#include "mozilla/dom/indexedDB/IndexedDatabase.h"
-
-#include "nsIIDBEvent.h"
-#include "nsIIDBErrorEvent.h"
-#include "nsIIDBSuccessEvent.h"
-#include "nsIIDBTransactionEvent.h"
-#include "nsIIDBTransactionRequest.h"
-#include "nsIRunnable.h"
-#include "nsIVariant.h"
-
-#include "jsapi.h"
-#include "nsDOMEvent.h"
-
-#include "mozilla/dom/indexedDB/IDBObjectStoreRequest.h"
-
-#define SUCCESS_EVT_STR "success"
-#define ERROR_EVT_STR "error"
-#define COMPLETE_EVT_STR "complete"
-#define ABORT_EVT_STR "abort"
-#define TIMEOUT_EVT_STR "timeout"
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class IDBRequest;
-class IDBTransactionRequest;
-
-class IDBEvent : public nsDOMEvent,
-                 public nsIIDBEvent
-{
-public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIIDBEVENT
-  NS_FORWARD_TO_NSDOMEVENT
-
-  static already_AddRefed<nsIDOMEvent>
-  CreateGenericEvent(const nsAString& aType);
-
-  static already_AddRefed<nsIRunnable>
-  CreateGenericEventRunnable(const nsAString& aType,
-                             nsIDOMEventTarget* aTarget);
-
-protected:
-  IDBEvent() : nsDOMEvent(nsnull, nsnull) { }
-  virtual ~IDBEvent() { }
-
-  nsCOMPtr<nsISupports> mSource;
-};
-
-class IDBErrorEvent : public IDBEvent,
-                      public nsIIDBErrorEvent
-{
-public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIIDBERROREVENT
-  NS_FORWARD_NSIDOMEVENT(IDBEvent::)
-  NS_FORWARD_NSIIDBEVENT(IDBEvent::)
-
-  static already_AddRefed<nsIDOMEvent>
-  Create(IDBRequest* aRequest,
-         PRUint16 aCode);
-
-  static already_AddRefed<nsIRunnable>
-  CreateRunnable(IDBRequest* aRequest,
-                 PRUint16 aCode);
-
-protected:
-  IDBErrorEvent() { }
-
-  PRUint16 mCode;
-  nsString mMessage;
-};
-
-class IDBSuccessEvent : public IDBEvent,
-                        public nsIIDBTransactionEvent
-{
-public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIIDBSUCCESSEVENT
-  NS_DECL_NSIIDBTRANSACTIONEVENT
-  NS_FORWARD_NSIDOMEVENT(IDBEvent::)
-  NS_FORWARD_NSIIDBEVENT(IDBEvent::)
-
-  static already_AddRefed<nsIDOMEvent>
-  Create(IDBRequest* aRequest,
-         nsIVariant* aResult,
-         nsIIDBTransactionRequest* aTransaction);
-
-  static already_AddRefed<nsIRunnable>
-  CreateRunnable(IDBRequest* aRequest,
-                 nsIVariant* aResult,
-                 nsIIDBTransactionRequest* aTransaction);
-
-protected:
-  IDBSuccessEvent() { }
-
-  nsCOMPtr<nsIVariant> mResult;
-  nsCOMPtr<nsIIDBTransactionRequest> mTransaction;
-};
-
-class GetSuccessEvent : public IDBSuccessEvent
-{
-public:
-  GetSuccessEvent(const nsAString& aValue)
-  : mValue(aValue),
-    mCachedValue(JSVAL_VOID),
-    mJSRuntime(nsnull)
-  { }
-
-  ~GetSuccessEvent()
-  {
-    if (mJSRuntime) {
-      JS_RemoveRootRT(mJSRuntime, &mCachedValue);
-    }
-  }
-
-  NS_IMETHOD GetResult(nsIVariant** aResult);
-
-  nsresult Init(IDBRequest* aRequest,
-                IDBTransactionRequest* aTransaction);
-
-private:
-  nsString mValue;
-
-protected:
-  jsval mCachedValue;
-  JSRuntime* mJSRuntime;
-};
-
-class GetAllSuccessEvent : public GetSuccessEvent
-{
-public:
-  GetAllSuccessEvent(nsTArray<nsString>& aValues)
-  : GetSuccessEvent(EmptyString())
-  {
-    if (!mValues.SwapElements(aValues)) {
-      NS_ERROR("Failed to swap elements!");
-    }
-  }
-
-  NS_IMETHOD GetResult(nsIVariant** aResult);
-
-private:
-  nsTArray<nsString> mValues;
-};
-
-class GetAllKeySuccessEvent : public GetSuccessEvent
-{
-public:
-  GetAllKeySuccessEvent(nsTArray<Key>& aKeys)
-  : GetSuccessEvent(EmptyString())
-  {
-    if (!mKeys.SwapElements(aKeys)) {
-      NS_ERROR("Failed to swap elements!");
-    }
-  }
-
-  NS_IMETHOD GetResult(nsIVariant** aResult);
-
-private:
-  nsTArray<Key> mKeys;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_idbevents_h__
deleted file mode 100644
--- a/dom/indexedDB/IDBIndexRequest.cpp
+++ /dev/null
@@ -1,1355 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Shawn Wilsher <me@shawnwilsher.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-#include "IDBIndexRequest.h"
-
-#include "nsIIDBDatabaseException.h"
-#include "nsIIDBKeyRange.h"
-
-#include "nsDOMClassInfo.h"
-#include "nsThreadUtils.h"
-#include "mozilla/storage.h"
-
-#include "AsyncConnectionHelper.h"
-#include "IDBCursorRequest.h"
-#include "IDBEvents.h"
-#include "IDBObjectStoreRequest.h"
-#include "IDBTransactionRequest.h"
-#include "DatabaseInfo.h"
-
-USING_INDEXEDDB_NAMESPACE
-
-namespace {
-
-class GetHelper : public AsyncConnectionHelper
-{
-public:
-  GetHelper(IDBTransactionRequest* aTransaction,
-            IDBRequest* aRequest,
-            const Key& aKey,
-            PRInt64 aId,
-            bool aUnique,
-            bool aAutoIncrement)
-  : AsyncConnectionHelper(aTransaction, aRequest), mKey(aKey), mId(aId),
-    mUnique(aUnique), mAutoIncrement(aAutoIncrement)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-protected:
-  // In-params.
-  Key mKey;
-  const PRInt64 mId;
-  const bool mUnique;
-  const bool mAutoIncrement;
-};
-
-class GetObjectHelper : public GetHelper
-{
-public:
-  GetObjectHelper(IDBTransactionRequest* aTransaction,
-                  IDBRequest* aRequest,
-                  const Key& aKey,
-                  PRInt64 aId,
-                  bool aUnique,
-                  bool aAutoIncrement)
-  : GetHelper(aTransaction, aRequest, aKey, aId, aUnique, aAutoIncrement)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 OnSuccess(nsIDOMEventTarget* aTarget);
-
-protected:
-  nsString mValue;
-};
-
-class GetAllHelper : public GetHelper
-{
-public:
-  GetAllHelper(IDBTransactionRequest* aTransaction,
-               IDBRequest* aRequest,
-               const Key& aKey,
-               PRInt64 aId,
-               bool aUnique,
-               bool aAutoIncrement,
-               const PRUint32 aLimit)
-  : GetHelper(aTransaction, aRequest, aKey, aId, aUnique, aAutoIncrement),
-    mLimit(aLimit)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 OnSuccess(nsIDOMEventTarget* aTarget);
-
-protected:
-  const PRUint32 mLimit;
-  nsTArray<Key> mKeys;
-};
-
-class GetAllObjectsHelper : public GetHelper
-{
-public:
-  GetAllObjectsHelper(IDBTransactionRequest* aTransaction,
-                      IDBRequest* aRequest,
-                      const Key& aKey,
-                      PRInt64 aId,
-                      bool aUnique,
-                      bool aAutoIncrement,
-                      const PRUint32 aLimit)
-  : GetHelper(aTransaction, aRequest, aKey, aId, aUnique, aAutoIncrement),
-    mLimit(aLimit)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 OnSuccess(nsIDOMEventTarget* aTarget);
-
-protected:
-  const PRUint32 mLimit;
-  nsTArray<nsString> mValues;
-};
-
-class OpenCursorHelper : public AsyncConnectionHelper
-{
-public:
-  OpenCursorHelper(IDBTransactionRequest* aTransaction,
-                   IDBRequest* aRequest,
-                   IDBIndexRequest* aIndex,
-                   PRInt64 aId,
-                   bool aUnique,
-                   bool aAutoIncrement,
-                   const Key& aLeftKey,
-                   const Key& aRightKey,
-                   PRUint16 aKeyRangeFlags,
-                   PRUint16 aDirection,
-                   PRBool aPreload)
-  : AsyncConnectionHelper(aTransaction, aRequest), mIndex(aIndex), mId(aId),
-    mUnique(aUnique), mAutoIncrement(aAutoIncrement), mLeftKey(aLeftKey),
-    mRightKey(aRightKey), mKeyRangeFlags(aKeyRangeFlags),
-    mDirection(aDirection), mPreload(aPreload)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  // In-params.
-  nsRefPtr<IDBIndexRequest> mIndex;
-  const PRInt64 mId;
-  const bool mUnique;
-  const bool mAutoIncrement;
-  const Key mLeftKey;
-  const Key mRightKey;
-  const PRUint16 mKeyRangeFlags;
-  const PRUint16 mDirection;
-  const PRBool mPreload;
-
-  // Out-params.
-  nsTArray<KeyKeyPair> mData;
-};
-
-class OpenObjectCursorHelper : public AsyncConnectionHelper
-{
-public:
-  OpenObjectCursorHelper(IDBTransactionRequest* aTransaction,
-                         IDBRequest* aRequest,
-                         IDBIndexRequest* aIndex,
-                         PRInt64 aId,
-                         bool aUnique,
-                         bool aAutoIncrement,
-                         const Key& aLeftKey,
-                         const Key& aRightKey,
-                         PRUint16 aKeyRangeFlags,
-                         PRUint16 aDirection,
-                         PRBool aPreload)
-  : AsyncConnectionHelper(aTransaction, aRequest), mIndex(aIndex), mId(aId),
-    mUnique(aUnique), mAutoIncrement(aAutoIncrement), mLeftKey(aLeftKey),
-    mRightKey(aRightKey), mKeyRangeFlags(aKeyRangeFlags),
-    mDirection(aDirection), mPreload(aPreload)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  // In-params.
-  nsRefPtr<IDBIndexRequest> mIndex;
-  const PRInt64 mId;
-  const bool mUnique;
-  const bool mAutoIncrement;
-  const Key mLeftKey;
-  const Key mRightKey;
-  const PRUint16 mKeyRangeFlags;
-  const PRUint16 mDirection;
-  const PRBool mPreload;
-
-  // Out-params.
-  nsTArray<KeyValuePair> mData;
-};
-
-} // anonymous namespace
-
-// static
-already_AddRefed<IDBIndexRequest>
-IDBIndexRequest::Create(IDBObjectStoreRequest* aObjectStore,
-                        const IndexInfo* aIndexInfo)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aObjectStore, "Null pointer!");
-  NS_ASSERTION(aIndexInfo, "Null pointer!");
-
-  nsRefPtr<IDBIndexRequest> index = new IDBIndexRequest();
-
-  index->mObjectStore = aObjectStore;
-  index->mId = aIndexInfo->id;
-  index->mName = aIndexInfo->name;
-  index->mKeyPath = aIndexInfo->keyPath;
-  index->mUnique = aIndexInfo->unique;
-  index->mAutoIncrement = aIndexInfo->autoIncrement;
-
-  return index.forget();
-}
-
-IDBIndexRequest::IDBIndexRequest()
-: mId(LL_MININT),
-  mUnique(false),
-  mAutoIncrement(false)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-}
-
-IDBIndexRequest::~IDBIndexRequest()
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-}
-
-NS_IMPL_ADDREF(IDBIndexRequest)
-NS_IMPL_RELEASE(IDBIndexRequest)
-
-NS_INTERFACE_MAP_BEGIN(IDBIndexRequest)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, IDBRequest::Generator)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBIndexRequest)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBIndex)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBIndexRequest)
-NS_INTERFACE_MAP_END
-
-DOMCI_DATA(IDBIndexRequest, IDBIndexRequest)
-
-NS_IMETHODIMP
-IDBIndexRequest::GetName(nsAString& aName)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  aName.Assign(mName);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::GetStoreName(nsAString& aStoreName)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  return mObjectStore->GetName(aStoreName);
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::GetKeyPath(nsAString& aKeyPath)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  aKeyPath.Assign(mKeyPath);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::GetUnique(PRBool* aUnique)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  *aUnique = mUnique;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::Get(nsIVariant* aKey,
-                     nsIIDBRequest** _retval)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  NS_WARNING("Using a slow path for Get! Fix this now!");
-
-  Key key;
-  nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (key.IsUnset() || key.IsNull()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<GetHelper> helper =
-    new GetHelper(mObjectStore->Transaction(), request, key, mId, mUnique,
-                  mAutoIncrement);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::GetObject(nsIVariant* aKey,
-                           nsIIDBRequest** _retval)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  NS_WARNING("Using a slow path for Get! Fix this now!");
-
-  Key key;
-  nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (key.IsUnset() || key.IsNull()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<GetObjectHelper> helper =
-    new GetObjectHelper(mObjectStore->Transaction(), request, key, mId, mUnique,
-                        mAutoIncrement);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::GetAll(nsIVariant* aKey,
-                        PRUint32 aLimit,
-                        PRUint8 aOptionalArgCount,
-                        nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  Key key;
-  nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (key.IsNull()) {
-    key = Key::UNSETKEY;
-  }
-
-  if (aOptionalArgCount < 2) {
-    aLimit = PR_UINT32_MAX;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<GetAllHelper> helper =
-    new GetAllHelper(mObjectStore->Transaction(), request, key, mId, mUnique,
-                     mAutoIncrement, aLimit);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::GetAllObjects(nsIVariant* aKey,
-                               PRUint32 aLimit,
-                               PRUint8 aOptionalArgCount,
-                               nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  Key key;
-  nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (key.IsNull()) {
-    key = Key::UNSETKEY;
-  }
-
-  if (aOptionalArgCount < 2) {
-    aLimit = PR_UINT32_MAX;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<GetAllObjectsHelper> helper =
-    new GetAllObjectsHelper(mObjectStore->Transaction(), request, key, mId,
-                            mUnique, mAutoIncrement, aLimit);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::OpenCursor(nsIIDBKeyRange* aKeyRange,
-                            PRUint16 aDirection,
-                            PRBool aPreload,
-                            PRUint8 aOptionalArgCount,
-                            nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mObjectStore->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  nsresult rv;
-  Key leftKey, rightKey;
-  PRUint16 keyRangeFlags = 0;
-
-  if (aKeyRange) {
-    rv = aKeyRange->GetFlags(&keyRangeFlags);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIVariant> variant;
-    rv = aKeyRange->GetLeft(getter_AddRefs(variant));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = IDBObjectStoreRequest::GetKeyFromVariant(variant, leftKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = aKeyRange->GetRight(getter_AddRefs(variant));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = IDBObjectStoreRequest::GetKeyFromVariant(variant, rightKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  if (aOptionalArgCount >= 2) {
-    if (aDirection != nsIIDBCursor::NEXT &&
-        aDirection != nsIIDBCursor::NEXT_NO_DUPLICATE &&
-        aDirection != nsIIDBCursor::PREV &&
-        aDirection != nsIIDBCursor::PREV_NO_DUPLICATE) {
-      return NS_ERROR_INVALID_ARG;
-    }
-  }
-  else {
-    aDirection = nsIIDBCursor::NEXT;
-  }
-
-  if (aPreload) {
-    NS_NOTYETIMPLEMENTED("Implement me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<OpenCursorHelper> helper =
-    new OpenCursorHelper(mObjectStore->Transaction(), request, this, mId,
-                         mUnique, mAutoIncrement, leftKey, rightKey,
-                         keyRangeFlags, aDirection, aPreload);
-
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBIndexRequest::OpenObjectCursor(nsIIDBKeyRange* aKeyRange,
-                                  PRUint16 aDirection,
-                                  PRBool aPreload,
-                                  PRUint8 aOptionalArgCount,
-                                  nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mObjectStore->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  nsresult rv;
-  Key leftKey, rightKey;
-  PRUint16 keyRangeFlags = 0;
-
-  if (aKeyRange) {
-    rv = aKeyRange->GetFlags(&keyRangeFlags);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIVariant> variant;
-    rv = aKeyRange->GetLeft(getter_AddRefs(variant));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = IDBObjectStoreRequest::GetKeyFromVariant(variant, leftKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = aKeyRange->GetRight(getter_AddRefs(variant));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = IDBObjectStoreRequest::GetKeyFromVariant(variant, rightKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  if (aOptionalArgCount >= 2) {
-    if (aDirection != nsIIDBCursor::NEXT &&
-        aDirection != nsIIDBCursor::NEXT_NO_DUPLICATE &&
-        aDirection != nsIIDBCursor::PREV &&
-        aDirection != nsIIDBCursor::PREV_NO_DUPLICATE) {
-      return NS_ERROR_INVALID_ARG;
-    }
-  }
-  else {
-    aDirection = nsIIDBCursor::NEXT;
-  }
-
-  if (aPreload) {
-    NS_NOTYETIMPLEMENTED("Implement me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<OpenObjectCursorHelper> helper =
-    new OpenObjectCursorHelper(mObjectStore->Transaction(), request, this, mId,
-                               mUnique, mAutoIncrement, leftKey, rightKey,
-                               keyRangeFlags, aDirection, aPreload);
-
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-PRUint16
-GetHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_ASSERTION(aConnection, "Passed a null connection!");
-
-  nsCOMPtr<mozIStorageStatement> stmt =
-    mTransaction->IndexGetStatement(mUnique, mAutoIncrement);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"), mId);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  NS_NAMED_LITERAL_CSTRING(value, "value");
-
-  if (mKey.IsInt()) {
-    rv = stmt->BindInt64ByName(value, mKey.IntValue());
-  }
-  else if (mKey.IsString()) {
-    rv = stmt->BindStringByName(value, mKey.StringValue());
-  }
-  else {
-    NS_NOTREACHED("Bad key type!");
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mKey = Key::UNSETKEY;
-
-  PRBool hasResult;
-  rv = stmt->ExecuteStep(&hasResult);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (hasResult) {
-    PRInt32 keyType;
-    rv = stmt->GetTypeOfIndex(0, &keyType);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    NS_ASSERTION(keyType == mozIStorageStatement::VALUE_TYPE_INTEGER ||
-                 keyType == mozIStorageStatement::VALUE_TYPE_TEXT,
-                 "Bad key type!");
-
-    if (keyType == mozIStorageStatement::VALUE_TYPE_INTEGER) {
-      mKey = stmt->AsInt64(0);
-    }
-    else if (keyType == mozIStorageStatement::VALUE_TYPE_TEXT) {
-      rv = stmt->GetString(0, mKey.ToString());
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-    }
-    else {
-      NS_NOTREACHED("Bad SQLite type!");
-    }
-  }
-
-  return OK;
-}
-
-PRUint16
-GetHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  NS_ASSERTION(!mKey.IsNull(), "Badness!");
-
-  if (mKey.IsUnset()) {
-    aResult->SetAsEmpty();
-  }
-  else if (mKey.IsString()) {
-    aResult->SetAsAString(mKey.StringValue());
-  }
-  else if (mKey.IsInt()) {
-    aResult->SetAsInt64(mKey.IntValue());
-  }
-  else {
-    NS_NOTREACHED("Unknown key type!");
-  }
-  return OK;
-}
-
-PRUint16
-GetObjectHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_ASSERTION(aConnection, "Passed a null connection!");
-
-  nsCOMPtr<mozIStorageStatement> stmt =
-    mTransaction->IndexGetObjectStatement(mUnique, mAutoIncrement);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"), mId);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  NS_NAMED_LITERAL_CSTRING(value, "value");
-
-  if (mKey.IsInt()) {
-    rv = stmt->BindInt64ByName(value, mKey.IntValue());
-  }
-  else if (mKey.IsString()) {
-    rv = stmt->BindStringByName(value, mKey.StringValue());
-  }
-  else {
-    NS_NOTREACHED("Bad key type!");
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mKey = Key::UNSETKEY;
-
-  PRBool hasResult;
-  rv = stmt->ExecuteStep(&hasResult);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (hasResult) {
-    rv = stmt->GetString(0, mValue);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-  else {
-    mValue.SetIsVoid(PR_TRUE);
-  }
-
-  return OK;
-}
-
-PRUint16
-GetObjectHelper::OnSuccess(nsIDOMEventTarget* aTarget)
-{
-  nsRefPtr<GetSuccessEvent> event(new GetSuccessEvent(mValue));
-  nsresult rv = event->Init(mRequest, mTransaction);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  PRBool dummy;
-  aTarget->DispatchEvent(static_cast<nsDOMEvent*>(event), &dummy);
-  return OK;
-}
-
-PRUint16
-GetAllHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_ASSERTION(aConnection, "Passed a null connection!");
-
-  if (!mKeys.SetCapacity(50)) {
-    NS_ERROR("Out of memory!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  nsCString keyColumn;
-  nsCString tableName;
-
-  if (mAutoIncrement) {
-    keyColumn.AssignLiteral("ai_object_data_id");
-    if (mUnique) {
-      tableName.AssignLiteral("unique_ai_index_data");
-    }
-    else {
-      tableName.AssignLiteral("ai_index_data");
-    }
-  }
-  else {
-    keyColumn.AssignLiteral("object_data_key");
-    if (mUnique) {
-      tableName.AssignLiteral("unique_index_data");
-    }
-    else {
-      tableName.AssignLiteral("index_data");
-    }
-  }
-
-  NS_NAMED_LITERAL_CSTRING(indexId, "index_id");
-  NS_NAMED_LITERAL_CSTRING(value, "value");
-
-  nsCString keyClause;
-  if (!mKey.IsUnset()) {
-    keyClause = NS_LITERAL_CSTRING(" AND ") + value +
-                NS_LITERAL_CSTRING(" = :") + value;
-  }
-
-  nsCString limitClause;
-  if (mLimit != PR_UINT32_MAX) {
-    limitClause = NS_LITERAL_CSTRING(" LIMIT ");
-    limitClause.AppendInt(mLimit);
-  }
-
-  nsCString query = NS_LITERAL_CSTRING("SELECT ") + keyColumn +
-                    NS_LITERAL_CSTRING(" FROM ") + tableName +
-                    NS_LITERAL_CSTRING(" WHERE ") + indexId  +
-                    NS_LITERAL_CSTRING(" = :") + indexId + keyClause +
-                    limitClause;
-  
-  nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(indexId, mId);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (!mKey.IsUnset()) {
-    if (mKey.IsInt()) {
-      rv = stmt->BindInt64ByName(value, mKey.IntValue());
-    }
-    else if (mKey.IsString()) {
-      rv = stmt->BindStringByName(value, mKey.StringValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key type!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  PRBool hasResult;
-  while(NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    if (mKeys.Capacity() == mKeys.Length()) {
-      if (!mKeys.SetCapacity(mKeys.Capacity() * 2)) {
-        NS_ERROR("Out of memory!");
-        return nsIIDBDatabaseException::UNKNOWN_ERR;
-      }
-    }
-
-    Key* key = mKeys.AppendElement();
-    NS_ASSERTION(key, "This shouldn't fail!");
-
-    PRInt32 keyType;
-    rv = stmt->GetTypeOfIndex(0, &keyType);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    NS_ASSERTION(keyType == mozIStorageStatement::VALUE_TYPE_INTEGER ||
-                 keyType == mozIStorageStatement::VALUE_TYPE_TEXT,
-                 "Bad key type!");
-
-    if (keyType == mozIStorageStatement::VALUE_TYPE_INTEGER) {
-      *key = stmt->AsInt64(0);
-    }
-    else if (keyType == mozIStorageStatement::VALUE_TYPE_TEXT) {
-      rv = stmt->GetString(0, key->ToString());
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-    }
-    else {
-      NS_NOTREACHED("Bad SQLite type!");
-    }
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  return OK;
-}
-
-PRUint16
-GetAllHelper::OnSuccess(nsIDOMEventTarget* aTarget)
-{
-  nsRefPtr<GetAllKeySuccessEvent> event(new GetAllKeySuccessEvent(mKeys));
-
-  NS_ASSERTION(mKeys.IsEmpty(), "Should have swapped!");
-
-  nsresult rv = event->Init(mRequest, mTransaction);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  PRBool dummy;
-  aTarget->DispatchEvent(static_cast<nsDOMEvent*>(event), &dummy);
-  return OK;
-}
-
-PRUint16
-GetAllObjectsHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_ASSERTION(aConnection, "Passed a null connection!");
-
-  if (!mValues.SetCapacity(50)) {
-    NS_ERROR("Out of memory!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  nsCString dataTableName;
-  nsCString objectDataId;
-  nsCString indexTableName;
-
-  if (mAutoIncrement) {
-    dataTableName.AssignLiteral("ai_object_data");
-    objectDataId.AssignLiteral("ai_object_data_id");
-    if (mUnique) {
-      indexTableName.AssignLiteral("ai_unique_index_data");
-    }
-    else {
-      indexTableName.AssignLiteral("ai_index_data");
-    }
-  }
-  else {
-    dataTableName.AssignLiteral("object_data");
-    objectDataId.AssignLiteral("object_data_id");
-    if (mUnique) {
-      indexTableName.AssignLiteral("unique_index_data");
-    }
-    else {
-      indexTableName.AssignLiteral("index_data");
-    }
-  }
-
-  NS_NAMED_LITERAL_CSTRING(indexId, "index_id");
-  NS_NAMED_LITERAL_CSTRING(value, "value");
-
-  nsCString keyClause;
-  if (!mKey.IsUnset()) {
-    keyClause = NS_LITERAL_CSTRING(" AND ") + value +
-                NS_LITERAL_CSTRING(" = :") + value;
-  }
-
-  nsCString limitClause;
-  if (mLimit != PR_UINT32_MAX) {
-    limitClause = NS_LITERAL_CSTRING(" LIMIT ");
-    limitClause.AppendInt(mLimit);
-  }
-
-  nsCString query = NS_LITERAL_CSTRING("SELECT data FROM ") + dataTableName +
-                    NS_LITERAL_CSTRING(" INNER JOIN ") + indexTableName  +
-                    NS_LITERAL_CSTRING(" ON ") + dataTableName +
-                    NS_LITERAL_CSTRING(".id = ") + indexTableName +
-                    NS_LITERAL_CSTRING(".") + objectDataId +
-                    NS_LITERAL_CSTRING(" WHERE ") + indexId  +
-                    NS_LITERAL_CSTRING(" = :") + indexId + keyClause +
-                    limitClause;
-
-  nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(indexId, mId);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (!mKey.IsUnset()) {
-    if (mKey.IsInt()) {
-      rv = stmt->BindInt64ByName(value, mKey.IntValue());
-    }
-    else if (mKey.IsString()) {
-      rv = stmt->BindStringByName(value, mKey.StringValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key type!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  PRBool hasResult;
-  while(NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    if (mValues.Capacity() == mValues.Length()) {
-      if (!mValues.SetCapacity(mValues.Capacity() * 2)) {
-        NS_ERROR("Out of memory!");
-        return nsIIDBDatabaseException::UNKNOWN_ERR;
-      }
-    }
-
-    nsString* value = mValues.AppendElement();
-    NS_ASSERTION(value, "This shouldn't fail!");
-
-#ifdef DEBUG
-    {
-      PRInt32 keyType;
-      NS_ASSERTION(NS_SUCCEEDED(stmt->GetTypeOfIndex(0, &keyType)) &&
-                   keyType == mozIStorageStatement::VALUE_TYPE_TEXT,
-                   "Bad SQLITE type!");
-    }
-#endif
-
-    rv = stmt->GetString(0, *value);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  return OK;
-}
-
-PRUint16
-GetAllObjectsHelper::OnSuccess(nsIDOMEventTarget* aTarget)
-{
-  nsRefPtr<GetAllSuccessEvent> event(new GetAllSuccessEvent(mValues));
-
-  NS_ASSERTION(mValues.IsEmpty(), "Should have swapped!");
-
-  nsresult rv = event->Init(mRequest, mTransaction);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  PRBool dummy;
-  aTarget->DispatchEvent(static_cast<nsDOMEvent*>(event), &dummy);
-  return OK;
-}
-
-PRUint16
-OpenCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_ASSERTION(aConnection, "Passed a null connection!");
-
-  if (!mData.SetCapacity(50)) {
-    NS_ERROR("Out of memory!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  nsCString table;
-  nsCString keyColumn;
-
-  if (mAutoIncrement) {
-    keyColumn.AssignLiteral("ai_object_data_id");
-    if (mUnique) {
-      table.AssignLiteral("unique_ai_index_data");
-    }
-    else {
-      table.AssignLiteral("ai_index_data");
-    }
-  }
-  else {
-    keyColumn.AssignLiteral("object_data_key");
-    if (mUnique) {
-      table.AssignLiteral("unique_index_data");
-    }
-    else {
-      table.AssignLiteral("index_data");
-    }
-  }
-
-  NS_NAMED_LITERAL_CSTRING(indexId, "index_id");
-  NS_NAMED_LITERAL_CSTRING(leftKeyName, "left_key");
-  NS_NAMED_LITERAL_CSTRING(rightKeyName, "right_key");
-
-  nsCAutoString keyRangeClause;
-  if (!mLeftKey.IsUnset()) {
-    keyRangeClause = NS_LITERAL_CSTRING(" AND value");
-    if (mKeyRangeFlags & nsIIDBKeyRange::LEFT_OPEN) {
-      keyRangeClause.AppendLiteral(" > :");
-    }
-    else {
-      NS_ASSERTION(mKeyRangeFlags & nsIIDBKeyRange::LEFT_BOUND, "Bad flags!");
-      keyRangeClause.AppendLiteral(" >= :");
-    }
-    keyRangeClause.Append(leftKeyName);
-  }
-
-  if (!mRightKey.IsUnset()) {
-    keyRangeClause.AppendLiteral(" AND value");
-    if (mKeyRangeFlags & nsIIDBKeyRange::RIGHT_OPEN) {
-      keyRangeClause.AppendLiteral(" < :");
-    }
-    else {
-      NS_ASSERTION(mKeyRangeFlags & nsIIDBKeyRange::RIGHT_BOUND, "Bad flags!");
-      keyRangeClause.AppendLiteral(" <= :");
-    }
-    keyRangeClause.Append(rightKeyName);
-  }
-
-  nsCString groupClause;
-  switch (mDirection) {
-    case nsIIDBCursor::NEXT:
-    case nsIIDBCursor::PREV:
-      break;
-
-    case nsIIDBCursor::NEXT_NO_DUPLICATE:
-    case nsIIDBCursor::PREV_NO_DUPLICATE:
-      groupClause = NS_LITERAL_CSTRING(" GROUP BY value");
-      break;
-
-    default:
-      NS_NOTREACHED("Unknown direction!");
-  }
-
-  nsCString directionClause;
-  switch (mDirection) {
-    case nsIIDBCursor::NEXT:
-    case nsIIDBCursor::NEXT_NO_DUPLICATE:
-      directionClause = NS_LITERAL_CSTRING("DESC");
-      break;
-
-    case nsIIDBCursor::PREV:
-    case nsIIDBCursor::PREV_NO_DUPLICATE:
-      directionClause = NS_LITERAL_CSTRING("ASC");
-      break;
-
-    default:
-      NS_NOTREACHED("Unknown direction!");
-  }
-
-  nsCString query = NS_LITERAL_CSTRING("SELECT value, ") + keyColumn +
-                    NS_LITERAL_CSTRING(" FROM ") + table +
-                    NS_LITERAL_CSTRING(" WHERE index_id = :") + indexId +
-                    keyRangeClause + groupClause +
-                    NS_LITERAL_CSTRING(" ORDER BY value ") + directionClause;
-
-  nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(indexId, mId);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (!mLeftKey.IsUnset()) {
-    if (mLeftKey.IsString()) {
-      rv = stmt->BindStringByName(leftKeyName, mLeftKey.StringValue());
-    }
-    else if (mLeftKey.IsInt()) {
-      rv = stmt->BindInt64ByName(leftKeyName, mLeftKey.IntValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  if (!mRightKey.IsUnset()) {
-    if (mRightKey.IsString()) {
-      rv = stmt->BindStringByName(rightKeyName, mRightKey.StringValue());
-    }
-    else if (mRightKey.IsInt()) {
-      rv = stmt->BindInt64ByName(rightKeyName, mRightKey.IntValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  PRBool hasResult;
-  while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    if (mData.Capacity() == mData.Length()) {
-      if (!mData.SetCapacity(mData.Capacity() * 2)) {
-        NS_ERROR("Out of memory!");
-        return nsIIDBDatabaseException::UNKNOWN_ERR;
-      }
-    }
-
-    KeyKeyPair* pair = mData.AppendElement();
-    NS_ASSERTION(pair, "Shouldn't fail if SetCapacity succeeded!");
-
-    PRInt32 keyType;
-    rv = stmt->GetTypeOfIndex(0, &keyType);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    NS_ASSERTION(keyType == mozIStorageStatement::VALUE_TYPE_INTEGER ||
-                 keyType == mozIStorageStatement::VALUE_TYPE_TEXT,
-                 "Bad key type!");
-
-    if (keyType == mozIStorageStatement::VALUE_TYPE_INTEGER) {
-      pair->key = stmt->AsInt64(0);
-    }
-    else if (keyType == mozIStorageStatement::VALUE_TYPE_TEXT) {
-      rv = stmt->GetString(0, pair->key.ToString());
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-    }
-    else {
-      NS_NOTREACHED("Bad SQLite type!");
-    }
-
-    rv = stmt->GetTypeOfIndex(1, &keyType);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    NS_ASSERTION(keyType == mozIStorageStatement::VALUE_TYPE_INTEGER ||
-                 keyType == mozIStorageStatement::VALUE_TYPE_TEXT,
-                 "Bad key type!");
-
-    if (keyType == mozIStorageStatement::VALUE_TYPE_INTEGER) {
-      pair->value = stmt->AsInt64(1);
-    }
-    else if (keyType == mozIStorageStatement::VALUE_TYPE_TEXT) {
-      rv = stmt->GetString(1, pair->value.ToString());
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-    }
-    else {
-      NS_NOTREACHED("Bad SQLite type!");
-    }
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  return OK;
-}
-
-PRUint16
-OpenCursorHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  if (mData.IsEmpty()) {
-    aResult->SetAsEmpty();
-    return OK;
-  }
-
-  nsRefPtr<IDBCursorRequest> cursor =
-    IDBCursorRequest::Create(mRequest, mTransaction, mIndex, mDirection,
-                             mData);
-  NS_ENSURE_TRUE(cursor, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  aResult->SetAsISupports(static_cast<IDBRequest::Generator*>(cursor));
-
-  mIndex = nsnull;
-
-  return OK;
-}
-
-PRUint16
-OpenObjectCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_ASSERTION(aConnection, "Passed a null connection!");
-
-  if (!mData.SetCapacity(50)) {
-    NS_ERROR("Out of memory!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  nsCString indexTable;
-  nsCString objectTable;
-
-  if (mAutoIncrement) {
-    objectTable.AssignLiteral("ai_object_data");
-    if (mUnique) {
-      indexTable.AssignLiteral("unique_ai_index_data");
-    }
-    else {
-      indexTable.AssignLiteral("ai_index_data");
-    }
-  }
-  else {
-    objectTable.AssignLiteral("object_data");
-    if (mUnique) {
-      indexTable.AssignLiteral("unique_index_data");
-    }
-    else {
-      indexTable.AssignLiteral("index_data");
-    }
-  }
-
-  NS_NAMED_LITERAL_CSTRING(indexId, "index_id");
-  NS_NAMED_LITERAL_CSTRING(leftKeyName, "left_key");
-  NS_NAMED_LITERAL_CSTRING(rightKeyName, "right_key");
-  NS_NAMED_LITERAL_CSTRING(value, "value");
-  NS_NAMED_LITERAL_CSTRING(data, "data");
-
-  nsCAutoString keyRangeClause;
-  if (!mLeftKey.IsUnset()) {
-    keyRangeClause = NS_LITERAL_CSTRING(" AND value");
-    if (mKeyRangeFlags & nsIIDBKeyRange::LEFT_OPEN) {
-      keyRangeClause.AppendLiteral(" > :");
-    }
-    else {
-      NS_ASSERTION(mKeyRangeFlags & nsIIDBKeyRange::LEFT_BOUND, "Bad flags!");
-      keyRangeClause.AppendLiteral(" >= :");
-    }
-    keyRangeClause.Append(leftKeyName);
-  }
-
-  if (!mRightKey.IsUnset()) {
-    keyRangeClause += NS_LITERAL_CSTRING(" AND value");
-    if (mKeyRangeFlags & nsIIDBKeyRange::RIGHT_OPEN) {
-      keyRangeClause.AppendLiteral(" < :");
-    }
-    else {
-      NS_ASSERTION(mKeyRangeFlags & nsIIDBKeyRange::RIGHT_BOUND, "Bad flags!");
-      keyRangeClause.AppendLiteral(" <= :");
-    }
-    keyRangeClause.Append(rightKeyName);
-  }
-
-  nsCString groupClause;
-  switch (mDirection) {
-    case nsIIDBCursor::NEXT:
-    case nsIIDBCursor::PREV:
-      break;
-
-    case nsIIDBCursor::NEXT_NO_DUPLICATE:
-    case nsIIDBCursor::PREV_NO_DUPLICATE:
-      groupClause = NS_LITERAL_CSTRING(" GROUP BY ") + indexTable +
-                    NS_LITERAL_CSTRING(".") + value;
-      break;
-
-    default:
-      NS_NOTREACHED("Unknown direction!");
-  }
-
-  nsCString directionClause;
-  switch (mDirection) {
-    case nsIIDBCursor::NEXT:
-    case nsIIDBCursor::NEXT_NO_DUPLICATE:
-      directionClause = NS_LITERAL_CSTRING(" DESC");
-      break;
-
-    case nsIIDBCursor::PREV:
-    case nsIIDBCursor::PREV_NO_DUPLICATE:
-      directionClause = NS_LITERAL_CSTRING(" ASC");
-      break;
-
-    default:
-      NS_NOTREACHED("Unknown direction!");
-  }
-
-  nsCString query = NS_LITERAL_CSTRING("SELECT ") + indexTable +
-                    NS_LITERAL_CSTRING(".") + value +
-                    NS_LITERAL_CSTRING(", ") + objectTable +
-                    NS_LITERAL_CSTRING(".") + data +
-                    NS_LITERAL_CSTRING(" FROM ") + objectTable +
-                    NS_LITERAL_CSTRING(" INNER JOIN ") + indexTable +
-                    NS_LITERAL_CSTRING(" ON ") + indexTable +
-                    NS_LITERAL_CSTRING(".object_data_id = ") + objectTable +
-                    NS_LITERAL_CSTRING(".id WHERE ") + indexId +
-                    NS_LITERAL_CSTRING(" = :") + indexId + keyRangeClause +
-                    groupClause + NS_LITERAL_CSTRING(" ORDER BY ") +
-                    indexTable + NS_LITERAL_CSTRING(".") + value +
-                    directionClause;
-
-  nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(indexId, mId);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (!mLeftKey.IsUnset()) {
-    if (mLeftKey.IsString()) {
-      rv = stmt->BindStringByName(leftKeyName, mLeftKey.StringValue());
-    }
-    else if (mLeftKey.IsInt()) {
-      rv = stmt->BindInt64ByName(leftKeyName, mLeftKey.IntValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  if (!mRightKey.IsUnset()) {
-    if (mRightKey.IsString()) {
-      rv = stmt->BindStringByName(rightKeyName, mRightKey.StringValue());
-    }
-    else if (mRightKey.IsInt()) {
-      rv = stmt->BindInt64ByName(rightKeyName, mRightKey.IntValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  PRBool hasResult;
-  while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    if (mData.Capacity() == mData.Length()) {
-      if (!mData.SetCapacity(mData.Capacity() * 2)) {
-        NS_ERROR("Out of memory!");
-        return nsIIDBDatabaseException::UNKNOWN_ERR;
-      }
-    }
-
-    KeyValuePair* pair = mData.AppendElement();
-    NS_ASSERTION(pair, "Shouldn't fail if SetCapacity succeeded!");
-
-    PRInt32 keyType;
-    rv = stmt->GetTypeOfIndex(0, &keyType);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    NS_ASSERTION(keyType == mozIStorageStatement::VALUE_TYPE_INTEGER ||
-                 keyType == mozIStorageStatement::VALUE_TYPE_TEXT,
-                 "Bad key type!");
-
-    if (keyType == mozIStorageStatement::VALUE_TYPE_INTEGER) {
-      pair->key = stmt->AsInt64(0);
-    }
-    else if (keyType == mozIStorageStatement::VALUE_TYPE_TEXT) {
-      rv = stmt->GetString(0, pair->key.ToString());
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-    }
-    else {
-      NS_NOTREACHED("Bad SQLite type!");
-    }
-
-    rv = stmt->GetString(1, pair->value);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  return OK;
-}
-
-PRUint16
-OpenObjectCursorHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  if (mData.IsEmpty()) {
-    aResult->SetAsEmpty();
-    return OK;
-  }
-
-  nsRefPtr<IDBCursorRequest> cursor =
-    IDBCursorRequest::Create(mRequest, mTransaction, mIndex, mDirection,
-                             mData);
-  NS_ENSURE_TRUE(cursor, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  aResult->SetAsISupports(static_cast<IDBRequest::Generator*>(cursor));
-
-  mIndex = nsnull;
-
-  return OK;
-}
deleted file mode 100644
--- a/dom/indexedDB/IDBIndexRequest.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Shawn Wilsher <me@shawnwilsher.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_idbindexrequest_h__
-#define mozilla_dom_indexeddb_idbindexrequest_h__
-
-#include "mozilla/dom/indexedDB/IDBRequest.h"
-
-#include "nsIIDBIndexRequest.h"
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class IDBObjectStoreRequest;
-struct IndexInfo;
-
-class IDBIndexRequest : public IDBRequest::Generator,
-                        public nsIIDBIndexRequest
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIIDBINDEX
-  NS_DECL_NSIIDBINDEXREQUEST
-
-  static already_AddRefed<IDBIndexRequest>
-  Create(IDBObjectStoreRequest* aObjectStore,
-         const IndexInfo* aIndexInfo);
-
-  IDBObjectStoreRequest* ObjectStore()
-  {
-    return mObjectStore;
-  }
-
-protected:
-  IDBIndexRequest();
-  ~IDBIndexRequest();
-
-private:
-  nsRefPtr<IDBObjectStoreRequest> mObjectStore;
-
-  PRInt64 mId;
-  nsString mName;
-  nsString mKeyPath;
-  bool mUnique;
-  bool mAutoIncrement;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_idbindexrequest_h__
deleted file mode 100644
--- a/dom/indexedDB/IDBKeyRange.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "IDBKeyRange.h"
-
-#include "nsDOMClassInfo.h"
-#include "nsThreadUtils.h"
-
-USING_INDEXEDDB_NAMESPACE
-
-// static
-already_AddRefed<IDBKeyRange>
-IDBKeyRange::Create(nsIVariant* aLeft,
-                    nsIVariant* aRight,
-                    PRUint16 aFlags)
-{
-  nsRefPtr<IDBKeyRange> keyRange(new IDBKeyRange());
-  keyRange->mLeft = aLeft;
-  keyRange->mRight = aRight;
-  keyRange->mFlags = aFlags;
-
-  return keyRange.forget();
-}
-
-NS_IMPL_ADDREF(IDBKeyRange)
-NS_IMPL_RELEASE(IDBKeyRange)
-
-NS_INTERFACE_MAP_BEGIN(IDBKeyRange)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIIDBKeyRange)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBKeyRange)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBKeyRange)
-NS_INTERFACE_MAP_END
-
-DOMCI_DATA(IDBKeyRange, IDBKeyRange)
-
-NS_IMETHODIMP
-IDBKeyRange::GetFlags(PRUint16* aFlags)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  *aFlags = mFlags;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBKeyRange::GetLeft(nsIVariant** aLeft)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsCOMPtr<nsIVariant> result(mLeft);
-  result.forget(aLeft);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBKeyRange::GetRight(nsIVariant** aRight)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsCOMPtr<nsIVariant> result(mRight);
-  result.forget(aRight);
-  return NS_OK;
-}
deleted file mode 100644
--- a/dom/indexedDB/IDBKeyRange.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_idbkeyrange_h__
-#define mozilla_dom_indexeddb_idbkeyrange_h__
-
-#include "mozilla/dom/indexedDB/IndexedDatabase.h"
-
-#include "nsIIDBKeyRange.h"
-#include "nsIVariant.h"
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class IndexedDatabaseRequest;
-
-class IDBKeyRange : public nsIIDBKeyRange
-{
-  friend class IndexedDatabaseRequest;
-
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIIDBKEYRANGE
-
-protected:
-  static
-  already_AddRefed<IDBKeyRange> Create(nsIVariant* aLeft,
-                                       nsIVariant* aRight,
-                                       PRUint16 aFlags);
-
-  IDBKeyRange()
-  : mFlags(0)
-  { }
-
-  ~IDBKeyRange() { }
-
-  nsCOMPtr<nsIVariant> mLeft;
-  nsCOMPtr<nsIVariant> mRight;
-  PRUint16 mFlags;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_idbkeyrange_h__
deleted file mode 100644
--- a/dom/indexedDB/IDBObjectStoreRequest.cpp
+++ /dev/null
@@ -1,2172 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-// XXX remove once we can get jsvals out of XPIDL
-#include "jscntxt.h"
-#include "jsapi.h"
-#include "nsContentUtils.h"
-#include "nsJSON.h"
-#include "IDBEvents.h"
-
-#include "IDBObjectStoreRequest.h"
-#include "IDBIndexRequest.h"
-
-#include "nsIIDBDatabaseException.h"
-#include "nsIJSContextStack.h"
-#include "nsIUUIDGenerator.h"
-#include "nsIVariant.h"
-
-#include "nsDOMClassInfo.h"
-#include "nsJSUtils.h"
-#include "nsServiceManagerUtils.h"
-#include "nsThreadUtils.h"
-#include "mozilla/storage.h"
-
-#include "AsyncConnectionHelper.h"
-#include "IDBCursorRequest.h"
-#include "IDBKeyRange.h"
-#include "IDBTransactionRequest.h"
-#include "DatabaseInfo.h"
-#include "Savepoint.h"
-
-USING_INDEXEDDB_NAMESPACE
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-END_INDEXEDDB_NAMESPACE
-
-namespace {
-
-class AddHelper : public AsyncConnectionHelper
-{
-public:
-  AddHelper(IDBTransactionRequest* aTransaction,
-            IDBRequest* aRequest,
-            PRInt64 aObjectStoreID,
-            const nsAString& aKeyPath,
-            const nsAString& aValue,
-            const Key& aKey,
-            bool aAutoIncrement,
-            bool aCreate,
-            bool aOverwrite,
-            nsTArray<IndexUpdateInfo>& aIndexUpdateInfo)
-  : AsyncConnectionHelper(aTransaction, aRequest), mOSID(aObjectStoreID),
-    mKeyPath(aKeyPath), mValue(aValue), mKey(aKey),
-    mAutoIncrement(aAutoIncrement), mCreate(aCreate), mOverwrite(aOverwrite)
-  {
-    mIndexUpdateInfo.SwapElements(aIndexUpdateInfo);
-  }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-  nsresult ModifyValueForNewKey();
-  nsresult UpdateIndexes(mozIStorageConnection* aConnection,
-                         PRInt64 aObjectDataId);
-
-private:
-  // In-params.
-  const PRInt64 mOSID;
-  const nsString mKeyPath;
-  // These may change in the autoincrement case.
-  nsString mValue;
-  Key mKey;
-  const bool mAutoIncrement;
-  const bool mCreate;
-  const bool mOverwrite;
-  nsTArray<IndexUpdateInfo> mIndexUpdateInfo;
-};
-
-class GetHelper : public AsyncConnectionHelper
-{
-public:
-  GetHelper(IDBTransactionRequest* aTransaction,
-            IDBRequest* aRequest,
-            PRInt64 aObjectStoreID,
-            const Key& aKey,
-            bool aAutoIncrement)
-  : AsyncConnectionHelper(aTransaction, aRequest), mOSID(aObjectStoreID),
-    mKey(aKey), mAutoIncrement(aAutoIncrement)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 OnSuccess(nsIDOMEventTarget* aTarget);
-
-protected:
-  // In-params.
-  const PRInt64 mOSID;
-  const Key mKey;
-  const bool mAutoIncrement;
-
-private:
-  // Out-params.
-  nsString mValue;
-};
-
-class RemoveHelper : public GetHelper
-{
-public:
-  RemoveHelper(IDBTransactionRequest* aTransaction,
-               IDBRequest* aRequest,
-               PRInt64 aObjectStoreID,
-               const Key& aKey,
-               bool aAutoIncrement)
-  : GetHelper(aTransaction, aRequest, aObjectStoreID, aKey, aAutoIncrement)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 OnSuccess(nsIDOMEventTarget* aTarget);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-};
-
-class OpenCursorHelper : public AsyncConnectionHelper
-{
-public:
-  OpenCursorHelper(IDBTransactionRequest* aTransaction,
-                   IDBRequest* aRequest,
-                   IDBObjectStoreRequest* aObjectStore,
-                   const Key& aLeftKey,
-                   const Key& aRightKey,
-                   PRUint16 aKeyRangeFlags,
-                   PRUint16 aDirection,
-                   PRBool aPreload)
-  : AsyncConnectionHelper(aTransaction, aRequest), mObjectStore(aObjectStore),
-    mLeftKey(aLeftKey), mRightKey(aRightKey), mKeyRangeFlags(aKeyRangeFlags),
-    mDirection(aDirection), mPreload(aPreload)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  // In-params.
-  nsRefPtr<IDBObjectStoreRequest> mObjectStore;
-  const Key mLeftKey;
-  const Key mRightKey;
-  const PRUint16 mKeyRangeFlags;
-  const PRUint16 mDirection;
-  const PRBool mPreload;
-
-  // Out-params.
-  nsTArray<KeyValuePair> mData;
-};
-
-class CreateIndexHelper : public AsyncConnectionHelper
-{
-public:
-  CreateIndexHelper(IDBTransactionRequest* aTransaction,
-                    IDBRequest* aRequest,
-                    const nsAString& aName,
-                    const nsAString& aKeyPath,
-                    bool aUnique,
-                    bool aAutoIncrement,
-                    IDBObjectStoreRequest* aObjectStore)
-  : AsyncConnectionHelper(aTransaction, aRequest), mName(aName),
-    mKeyPath(aKeyPath), mUnique(aUnique), mAutoIncrement(aAutoIncrement),
-    mObjectStore(aObjectStore), mId(LL_MININT)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  PRUint16 InsertDataFromObjectStore(mozIStorageConnection* aConnection);
-
-  // In-params.
-  nsString mName;
-  nsString mKeyPath;
-  const bool mUnique;
-  const bool mAutoIncrement;
-  nsRefPtr<IDBObjectStoreRequest> mObjectStore;
-
-  // Out-params.
-  PRInt64 mId;
-};
-
-class RemoveIndexHelper : public AsyncConnectionHelper
-{
-public:
-  RemoveIndexHelper(IDBTransactionRequest* aDatabase,
-                    IDBRequest* aRequest,
-                    const nsAString& aName,
-                    IDBObjectStoreRequest* aObjectStore)
-  : AsyncConnectionHelper(aDatabase, aRequest), mName(aName),
-    mObjectStore(aObjectStore)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 GetSuccessResult(nsIWritableVariant* aResult);
-
-private:
-  // In-params
-  nsString mName;
-  nsRefPtr<IDBObjectStoreRequest> mObjectStore;
-};
-
-class GetAllHelper : public AsyncConnectionHelper
-{
-public:
-  GetAllHelper(IDBTransactionRequest* aTransaction,
-               IDBRequest* aRequest,
-               PRInt64 aObjectStoreID,
-               const Key& aLeftKey,
-               const Key& aRightKey,
-               const PRUint16 aKeyRangeFlags,
-               const PRUint32 aLimit,
-               bool aAutoIncrement)
-  : AsyncConnectionHelper(aTransaction, aRequest), mOSID(aObjectStoreID),
-    mLeftKey(aLeftKey), mRightKey(aRightKey), mKeyRangeFlags(aKeyRangeFlags),
-    mLimit(aLimit), mAutoIncrement(aAutoIncrement)
-  { }
-
-  PRUint16 DoDatabaseWork(mozIStorageConnection* aConnection);
-  PRUint16 OnSuccess(nsIDOMEventTarget* aTarget);
-
-protected:
-  // In-params.
-  const PRInt64 mOSID;
-  const Key mLeftKey;
-  const Key mRightKey;
-  const PRUint16 mKeyRangeFlags;
-  const PRUint32 mLimit;
-  const bool mAutoIncrement;
-
-private:
-  // Out-params.
-  nsTArray<nsString> mValues;
-};
-
-inline
-nsresult
-GetKeyFromObject(JSContext* aCx,
-                 JSObject* aObj,
-                 const nsString& aKeyPath,
-                 Key& aKey)
-{
-  NS_PRECONDITION(aCx && aObj, "Null pointers!");
-  NS_ASSERTION(!aKeyPath.IsVoid(), "This will explode!");
-
-  const jschar* keyPathChars = reinterpret_cast<const jschar*>(aKeyPath.get());
-  const size_t keyPathLen = aKeyPath.Length();
-
-  jsval key;
-  JSBool ok = JS_GetUCProperty(aCx, aObj, keyPathChars, keyPathLen, &key);
-  NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-  if (JSVAL_IS_VOID(key)) {
-    aKey = Key::UNSETKEY;
-    return NS_OK;
-  }
-
-  if (JSVAL_IS_NULL(key)) {
-    aKey = Key::NULLKEY;
-    return NS_OK;
-  }
-
-  if (JSVAL_IS_INT(key)) {
-    aKey = JSVAL_TO_INT(key);
-    return NS_OK;
-  }
-
-  if (JSVAL_IS_DOUBLE(key)) {
-    aKey = *JSVAL_TO_DOUBLE(key);
-    return NS_OK;
-  }
-
-  if (JSVAL_IS_STRING(key)) {
-    aKey = nsDependentJSString(key);
-    return NS_OK;
-  }
-
-  // We only support those types.
-  return NS_ERROR_INVALID_ARG;
-}
-
-} // anonymous namespace
-
-// static
-already_AddRefed<IDBObjectStoreRequest>
-IDBObjectStoreRequest::Create(IDBDatabaseRequest* aDatabase,
-                              IDBTransactionRequest* aTransaction,
-                              const ObjectStoreInfo* aStoreInfo,
-                              PRUint16 aMode)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsRefPtr<IDBObjectStoreRequest> objectStore = new IDBObjectStoreRequest();
-
-  objectStore->mDatabase = aDatabase;
-  objectStore->mTransaction = aTransaction;
-  objectStore->mName = aStoreInfo->name;
-  objectStore->mId = aStoreInfo->id;
-  objectStore->mKeyPath = aStoreInfo->keyPath;
-  objectStore->mAutoIncrement = aStoreInfo->autoIncrement;
-  objectStore->mDatabaseId = aStoreInfo->databaseId;
-  objectStore->mMode = aMode;
-
-  return objectStore.forget();
-}
-
-// static
-nsresult
-IDBObjectStoreRequest::GetKeyFromVariant(nsIVariant* aKeyVariant,
-                                         Key& aKey)
-{
-  if (!aKeyVariant) {
-    aKey = Key::UNSETKEY;
-    return NS_OK;
-  }
-
-  PRUint16 type;
-  nsresult rv = aKeyVariant->GetDataType(&type);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // See xpcvariant.cpp, these are the only types we should expect.
-  switch (type) {
-    case nsIDataType::VTYPE_VOID:
-      aKey = Key::UNSETKEY;
-      break;
-
-    case nsIDataType::VTYPE_EMPTY:
-      aKey = Key::NULLKEY;
-      break;
-
-    case nsIDataType::VTYPE_WSTRING_SIZE_IS:
-      rv = aKeyVariant->GetAsAString(aKey.ToString());
-      NS_ENSURE_SUCCESS(rv, rv);
-      break;
-
-    case nsIDataType::VTYPE_INT32:
-    case nsIDataType::VTYPE_DOUBLE:
-      rv = aKeyVariant->GetAsInt64(aKey.ToIntPtr());
-      NS_ENSURE_SUCCESS(rv, rv);
-      break;
-
-    default:
-      return NS_ERROR_INVALID_ARG;
-  }
-
-  return NS_OK;
-}
-
-// static
-nsresult
-IDBObjectStoreRequest::GetJSONFromArg0(/* jsval arg0, */
-                                       nsAString& aJSON)
-{
-  nsIXPConnect* xpc = nsContentUtils::XPConnect();
-  NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
-
-  nsAXPCNativeCallContext* cc;
-  nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
-
-  PRUint32 argc;
-  rv = cc->GetArgc(&argc);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (argc < 1) {
-    return NS_ERROR_XPC_NOT_ENOUGH_ARGS;
-  }
-
-  jsval* argv;
-  rv = cc->GetArgvPtr(&argv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  JSContext* cx;
-  rv = cc->GetJSContext(&cx);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  JSAutoRequest ar(cx);
-
-  js::AutoValueRooter clone(cx);
-  rv = nsContentUtils::CreateStructuredClone(cx, argv[0], clone.addr());
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  nsCOMPtr<nsIJSON> json(new nsJSON());
-
-  rv = json->EncodeFromJSVal(clone.addr(), cx, aJSON);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-// static
-nsresult
-IDBObjectStoreRequest::GetKeyPathValueFromJSON(const nsAString& aJSON,
-                                               const nsAString& aKeyPath,
-                                               JSContext** aCx,
-                                               Key& aValue)
-{
-  NS_ASSERTION(!aJSON.IsEmpty(), "Empty JSON!");
-  NS_ASSERTION(!aKeyPath.IsEmpty(), "Empty keyPath!");
-  NS_ASSERTION(aCx, "Null pointer!");
-
-  nsresult rv;
-
-  if (!*aCx) {
-    rv = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(aCx);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  JSAutoRequest ar(*aCx);
-
-  js::AutoValueRooter clone(*aCx);
-
-  nsCOMPtr<nsIJSON> json(new nsJSON());
-  rv = json->DecodeToJSVal(aJSON, *aCx, clone.addr());
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (JSVAL_IS_PRIMITIVE(clone.value())) {
-    // This isn't an object, so just leave the key unset.
-    aValue = Key::UNSETKEY;
-    return NS_OK;
-  }
-
-  JSObject* obj = JSVAL_TO_OBJECT(clone.value());
-
-  const jschar* keyPathChars =
-    reinterpret_cast<const jschar*>(aKeyPath.BeginReading());
-  const size_t keyPathLen = aKeyPath.Length();
-
-  js::AutoValueRooter value(*aCx);
-  JSBool ok = JS_GetUCProperty(*aCx, obj, keyPathChars, keyPathLen,
-                               value.addr());
-  NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-  if (JSVAL_IS_INT(value.value())) {
-    aValue = JSVAL_TO_INT(value.value());
-  }
-  else if (JSVAL_IS_DOUBLE(value.value())) {
-    aValue = *JSVAL_TO_DOUBLE(value.value());
-  }
-  else if (JSVAL_IS_STRING(value.value())) {
-    aValue = nsDependentJSString(value.value());
-  }
-  else {
-    // If the object doesn't have a value for our index then we leave it unset.
-    aValue = Key::UNSETKEY;
-  }
-
-  return NS_OK;
-}
-
-/* static */
-nsresult
-IDBObjectStoreRequest::GetIndexUpdateInfo(ObjectStoreInfo* aObjectStoreInfo,
-                                          JSContext* aCx,
-                                          jsval aObject,
-                                          nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
-{
-  JSObject* cloneObj = nsnull;
-
-  PRUint32 count = aObjectStoreInfo->indexes.Length();
-  if (count && !JSVAL_IS_PRIMITIVE(aObject)) {
-    if (!aUpdateInfoArray.SetCapacity(count)) {
-      NS_ERROR("Out of memory!");
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-
-    cloneObj = JSVAL_TO_OBJECT(aObject);
-
-    for (PRUint32 indexesIndex = 0; indexesIndex < count; indexesIndex++) {
-      const IndexInfo& indexInfo = aObjectStoreInfo->indexes[indexesIndex];
-
-      const jschar* keyPathChars =
-        reinterpret_cast<const jschar*>(indexInfo.keyPath.BeginReading());
-      const size_t keyPathLen = indexInfo.keyPath.Length();
-
-      jsval keyPathValue;
-      JSBool ok = JS_GetUCProperty(aCx, cloneObj, keyPathChars, keyPathLen,
-                                   &keyPathValue);
-      NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-      Key value;
-
-      if (JSVAL_IS_INT(keyPathValue)) {
-        value = JSVAL_TO_INT(keyPathValue);
-      }
-      else if (JSVAL_IS_DOUBLE(keyPathValue)) {
-        value = *JSVAL_TO_DOUBLE(keyPathValue);
-      }
-      else if (JSVAL_IS_STRING(keyPathValue)) {
-        JSString* str = JSVAL_TO_STRING(keyPathValue);
-        size_t len = JS_GetStringLength(str);
-        if (len) {
-          const PRUnichar* chars =
-            reinterpret_cast<PRUnichar*>(JS_GetStringChars(str));
-          value = nsDependentString(chars, len);
-        }
-        else {
-          value = EmptyString();
-        }
-      }
-      else {
-        // Not a value we can do anything with, ignore it.
-        continue;
-      }
-
-      IndexUpdateInfo* updateInfo = aUpdateInfoArray.AppendElement();
-      updateInfo->info = indexInfo;
-      updateInfo->value = value;
-    }
-  }
-  else {
-    aUpdateInfoArray.Clear();
-  }
-
-  return NS_OK;
-}
-
-/* static */
-nsresult
-IDBObjectStoreRequest::UpdateIndexes(IDBTransactionRequest* aTransaction,
-                                     PRInt64 aObjectStoreId,
-                                     const Key& aObjectStoreKey,
-                                     bool aAutoIncrement,
-                                     bool aOverwrite,
-                                     PRInt64 aObjectDataId,
-                                     const nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
-{
-#ifdef DEBUG
-  if (aAutoIncrement) {
-    NS_ASSERTION(aObjectDataId != LL_MININT, "Bad objectData id!");
-  }
-  else {
-    NS_ASSERTION(aObjectDataId == LL_MININT, "Bad objectData id!");
-  }
-#endif
-
-  PRUint32 indexCount = aUpdateInfoArray.Length();
-  NS_ASSERTION(indexCount, "Don't call me!");
-
-  nsCOMPtr<mozIStorageStatement> stmt;
-  nsresult rv;
-
-  if (!aAutoIncrement) {
-    stmt = aTransaction->GetCachedStatement(
-      "SELECT id "
-      "FROM object_data "
-      "WHERE object_store_id = :osid "
-      "AND key_value = :key_value"
-    );
-    NS_ENSURE_TRUE(stmt, NS_ERROR_FAILURE);
-
-    mozStorageStatementScoper scoper(stmt);
-
-    rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), aObjectStoreId);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    NS_ASSERTION(!aObjectStoreKey.IsUnset(), "This shouldn't happen!");
-
-    NS_NAMED_LITERAL_CSTRING(keyValue, "key_value");
-
-    if (aObjectStoreKey.IsInt()) {
-      rv = stmt->BindInt64ByName(keyValue, aObjectStoreKey.IntValue());
-    }
-    else if (aObjectStoreKey.IsString()) {
-      rv = stmt->BindStringByName(keyValue, aObjectStoreKey.StringValue());
-    }
-    else {
-      NS_NOTREACHED("Unknown key type!");
-    }
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    PRBool hasResult;
-    rv = stmt->ExecuteStep(&hasResult);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (!hasResult) {
-      NS_ERROR("This is bad, we just added this value! Where'd it go?!");
-      return NS_ERROR_FAILURE;
-    }
-
-    aObjectDataId = stmt->AsInt64(0);
-  }
-
-  NS_ASSERTION(aObjectDataId != LL_MININT, "Bad objectData id!");
-
-  for (PRUint32 indexIndex = 0; indexIndex < indexCount; indexIndex++) {
-    const IndexUpdateInfo& updateInfo = aUpdateInfoArray[indexIndex];
-
-    stmt = aTransaction->IndexUpdateStatement(updateInfo.info.autoIncrement,
-                                              updateInfo.info.unique,
-                                              aOverwrite);
-    NS_ENSURE_TRUE(stmt, NS_ERROR_FAILURE);
-
-    mozStorageStatementScoper scoper2(stmt);
-
-    rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"),
-                               updateInfo.info.id);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("object_data_id"),
-                               aObjectDataId);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    NS_NAMED_LITERAL_CSTRING(objectDataKey, "object_data_key");
-
-    if (aObjectStoreKey.IsInt()) {
-      rv = stmt->BindInt64ByName(objectDataKey, aObjectStoreKey.IntValue());
-    }
-    else if (aObjectStoreKey.IsString()) {
-      rv = stmt->BindStringByName(objectDataKey, aObjectStoreKey.StringValue());
-    }
-    else {
-      NS_NOTREACHED("Unknown key type!");
-    }
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    NS_NAMED_LITERAL_CSTRING(value, "value");
-
-    if (updateInfo.value.IsInt()) {
-      rv = stmt->BindInt64ByName(value, updateInfo.value.IntValue());
-    }
-    else if (updateInfo.value.IsString()) {
-      rv = stmt->BindStringByName(value, updateInfo.value.StringValue());
-    }
-    else if (updateInfo.value.IsUnset()) {
-      rv = stmt->BindStringByName(value, updateInfo.value.StringValue());
-    }
-    else {
-      NS_NOTREACHED("Unknown key type!");
-    }
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = stmt->Execute();
-    if (NS_FAILED(rv)) {
-      return rv;
-    }
-  }
-
-  return NS_OK;
-}
-
-ObjectStoreInfo*
-IDBObjectStoreRequest::GetObjectStoreInfo()
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  ObjectStoreInfo* info;
-  if (!ObjectStoreInfo::Get(mDatabaseId, mName, &info)) {
-    NS_ERROR("This should never fail!");
-    return nsnull;
-  }
-  return info;
-}
-
-IDBObjectStoreRequest::IDBObjectStoreRequest()
-: mId(LL_MININT),
-  mAutoIncrement(PR_FALSE),
-  mMode(nsIIDBTransaction::READ_WRITE)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-}
-
-IDBObjectStoreRequest::~IDBObjectStoreRequest()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-}
-
-nsresult
-IDBObjectStoreRequest::GetAddInfo(/* jsval aValue, */
-                                  nsIVariant* aKeyVariant,
-                                  nsString& aJSON,
-                                  Key& aKey,
-                                  nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
-{
-  // This is the slow path, need to do this better once XPIDL can have raw
-  // jsvals as arguments.
-  NS_WARNING("Using a slow path for Add! Fix this now!");
-
-  nsIXPConnect* xpc = nsContentUtils::XPConnect();
-  NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
-
-  nsAXPCNativeCallContext* cc;
-  nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
-
-  PRUint32 argc;
-  rv = cc->GetArgc(&argc);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (argc < 1) {
-    return NS_ERROR_XPC_NOT_ENOUGH_ARGS;
-  }
-
-  jsval* argv;
-  rv = cc->GetArgvPtr(&argv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  JSContext* cx;
-  rv = cc->GetJSContext(&cx);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  JSAutoRequest ar(cx);
-
-  js::AutoValueRooter clone(cx);
-  rv = nsContentUtils::CreateStructuredClone(cx, argv[0], clone.addr());
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  if (mKeyPath.IsEmpty()) {
-    // Key was passed in.
-    if (argc < 2) {
-      // Actually, nothing was passed in, and we can skip this.
-      aKey = Key::UNSETKEY;
-    }
-    else {
-      rv = GetKeyFromVariant(aKeyVariant, aKey);
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
-  }
-  else {
-    // Inline keys live on the object. Make sure it is an object.
-    if (JSVAL_IS_PRIMITIVE(clone.value())) {
-      return NS_ERROR_INVALID_ARG;
-    }
-
-    rv = GetKeyFromObject(cx, JSVAL_TO_OBJECT(clone.value()), mKeyPath, aKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    // Except if null was passed, in which case we're supposed to generate the
-    // key.
-    if (aKey.IsUnset() && argc >= 2 && JSVAL_IS_NULL(argv[1])) {
-      aKey = Key::NULLKEY;
-    }
-  }
-
-  if (aKey.IsUnset() && !mAutoIncrement) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  // Figure out indexes and the index values to update here.
-  ObjectStoreInfo* objectStoreInfo = GetObjectStoreInfo();
-  NS_ENSURE_TRUE(objectStoreInfo, NS_ERROR_FAILURE);
-
-  rv = GetIndexUpdateInfo(objectStoreInfo, cx, clone.value(), aUpdateInfoArray);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIJSON> json(new nsJSON());
-  rv = json->EncodeFromJSVal(clone.addr(), cx, aJSON);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-NS_IMPL_ADDREF(IDBObjectStoreRequest)
-NS_IMPL_RELEASE(IDBObjectStoreRequest)
-
-NS_INTERFACE_MAP_BEGIN(IDBObjectStoreRequest)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, IDBRequest::Generator)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBObjectStoreRequest)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBObjectStore)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBObjectStoreRequest)
-NS_INTERFACE_MAP_END
-
-DOMCI_DATA(IDBObjectStoreRequest, IDBObjectStoreRequest)
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::GetName(nsAString& aName)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  aName.Assign(mName);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::GetKeyPath(nsAString& aKeyPath)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  aKeyPath.Assign(mKeyPath);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::GetIndexNames(nsIDOMDOMStringList** aIndexNames)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  ObjectStoreInfo* info = GetObjectStoreInfo();
-  NS_ENSURE_TRUE(info, NS_ERROR_UNEXPECTED);
-
-  nsRefPtr<nsDOMStringList> list(new nsDOMStringList());
-
-  PRUint32 count = info->indexes.Length();
-  for (PRUint32 index = 0; index < count; index++) {
-    NS_ENSURE_TRUE(list->Add(info->indexes[index].name),
-                   NS_ERROR_OUT_OF_MEMORY);
-  }
-
-  list.forget(aIndexNames);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::Get(nsIVariant* aKey,
-                           nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  Key key;
-  nsresult rv = GetKeyFromVariant(aKey, key);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (key.IsUnset()) {
-    return NS_ERROR_ILLEGAL_VALUE;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<GetHelper> helper =
-    new GetHelper(mTransaction, request, mId, key, !!mAutoIncrement);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::GetAll(nsIIDBKeyRange* aKeyRange,
-                              PRUint32 aLimit,
-                              PRUint8 aOptionalArgCount,
-                              nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (aOptionalArgCount < 2) {
-    aLimit = PR_UINT32_MAX;
-  }
-
-  Key leftKey, rightKey;
-  PRUint16 keyRangeFlags = 0;
-
-  nsresult rv;
-  if (aKeyRange) {
-    rv = aKeyRange->GetFlags(&keyRangeFlags);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIVariant> variant;
-    rv = aKeyRange->GetLeft(getter_AddRefs(variant));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = GetKeyFromVariant(variant, leftKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = aKeyRange->GetRight(getter_AddRefs(variant));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = GetKeyFromVariant(variant, rightKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<GetAllHelper> helper =
-    new GetAllHelper(mTransaction, request, mId, leftKey, rightKey,
-                     keyRangeFlags, aLimit, mAutoIncrement);
-
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::Add(nsIVariant* /* aValue */,
-                           nsIVariant* aKey,
-                           nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (mMode != nsIIDBTransaction::READ_WRITE) {
-    return NS_ERROR_OBJECT_IS_IMMUTABLE;
-  }
-
-  nsString jsonValue;
-  Key key;
-  nsTArray<IndexUpdateInfo> updateInfo;
-
-  nsresult rv = GetAddInfo(aKey, jsonValue, key, updateInfo);
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  if (key.IsUnset() && !mAutoIncrement) {
-    return NS_ERROR_ILLEGAL_VALUE;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<AddHelper> helper =
-    new AddHelper(mTransaction, request, mId, mKeyPath, jsonValue, key,
-                  !!mAutoIncrement, true, false, updateInfo);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::Modify(nsIVariant* /* aValue */,
-                              nsIVariant* aKey,
-                              nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (mMode != nsIIDBTransaction::READ_WRITE) {
-    return NS_ERROR_OBJECT_IS_IMMUTABLE;
-  }
-
-  nsString jsonValue;
-  Key key;
-  nsTArray<IndexUpdateInfo> updateInfo;
-
-  nsresult rv = GetAddInfo(aKey, jsonValue, key, updateInfo);
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  if (key.IsUnset() || key.IsNull()) {
-    return NS_ERROR_ILLEGAL_VALUE;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<AddHelper> helper =
-    new AddHelper(mTransaction, request, mId, mKeyPath, jsonValue, key,
-                  !!mAutoIncrement, false, true, updateInfo);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::AddOrModify(nsIVariant* /* aValue */,
-                                   nsIVariant* aKey,
-                                   nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (mMode != nsIIDBTransaction::READ_WRITE) {
-    return NS_ERROR_OBJECT_IS_IMMUTABLE;
-  }
-
-  nsString jsonValue;
-  Key key;
-  nsTArray<IndexUpdateInfo> updateInfo;
-
-  nsresult rv = GetAddInfo(aKey, jsonValue, key, updateInfo);
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  if (key.IsUnset() || key.IsNull()) {
-    return NS_ERROR_ILLEGAL_VALUE;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<AddHelper> helper =
-    new AddHelper(mTransaction, request, mId, mKeyPath, jsonValue, key,
-                  !!mAutoIncrement, true, true, updateInfo);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::Remove(nsIVariant* aKey,
-                              nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (mMode != nsIIDBTransaction::READ_WRITE) {
-    return NS_ERROR_OBJECT_IS_IMMUTABLE;
-  }
-
-  Key key;
-  nsresult rv = GetKeyFromVariant(aKey, key);
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  if (key.IsUnset() || key.IsNull()) {
-    return NS_ERROR_ILLEGAL_VALUE;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<RemoveHelper> helper =
-    new RemoveHelper(mTransaction, request, mId, key, !!mAutoIncrement);
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::OpenCursor(nsIIDBKeyRange* aKeyRange,
-                                  PRUint16 aDirection,
-                                  PRBool aPreload,
-                                  PRUint8 aOptionalArgCount,
-                                  nsIIDBRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  nsresult rv;
-
-  Key leftKey, rightKey;
-  PRUint16 keyRangeFlags = 0;
-
-  if (aKeyRange) {
-    rv = aKeyRange->GetFlags(&keyRangeFlags);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIVariant> variant;
-    rv = aKeyRange->GetLeft(getter_AddRefs(variant));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = GetKeyFromVariant(variant, leftKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = aKeyRange->GetRight(getter_AddRefs(variant));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = GetKeyFromVariant(variant, rightKey);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  if (aOptionalArgCount >= 2) {
-    if (aDirection != nsIIDBCursor::NEXT &&
-        aDirection != nsIIDBCursor::NEXT_NO_DUPLICATE &&
-        aDirection != nsIIDBCursor::PREV &&
-        aDirection != nsIIDBCursor::PREV_NO_DUPLICATE) {
-      return NS_ERROR_INVALID_ARG;
-    }
-  }
-  else {
-    aDirection = nsIIDBCursor::NEXT;
-  }
-
-  if (aPreload) {
-    NS_NOTYETIMPLEMENTED("Implement me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<OpenCursorHelper> helper =
-    new OpenCursorHelper(mTransaction, request, this, leftKey, rightKey,
-                         keyRangeFlags, aDirection, aPreload);
-
-  rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::CreateIndex(const nsAString& aName,
-                                   const nsAString& aKeyPath,
-                                   PRBool aUnique,
-                                   nsIIDBRequest** _retval)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  if (aName.IsEmpty()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  ObjectStoreInfo* info = GetObjectStoreInfo();
-  NS_ENSURE_TRUE(info, NS_ERROR_UNEXPECTED);
-
-  bool found = false;
-  PRUint32 indexCount = info->indexes.Length();
-  for (PRUint32 index = 0; index < indexCount; index++) {
-    if (info->indexes[index].name == aName) {
-      found = true;
-      break;
-    }
-  }
-
-  if (found) {
-    return NS_ERROR_ALREADY_INITIALIZED;
-  }
-
-  if (aKeyPath.IsEmpty()) {
-    NS_NOTYETIMPLEMENTED("Implement me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-  NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);
-
-  nsRefPtr<CreateIndexHelper> helper =
-    new CreateIndexHelper(mTransaction, request, aName, aKeyPath, !!aUnique,
-                          mAutoIncrement, this);
-  nsresult rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::Index(const nsAString& aName,
-                             nsIIDBIndexRequest** _retval)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (aName.IsEmpty()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  ObjectStoreInfo* info = GetObjectStoreInfo();
-  NS_ENSURE_TRUE(info, NS_ERROR_UNEXPECTED);
-
-  IndexInfo* indexInfo = nsnull;
-  PRUint32 indexCount = info->indexes.Length();
-  for (PRUint32 index = 0; index < indexCount; index++) {
-    if (info->indexes[index].name == aName) {
-      indexInfo = &(info->indexes[index]);
-      break;
-    }
-  }
-
-  if (!indexInfo) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  nsRefPtr<IDBIndexRequest> request =
-    IDBIndexRequest::Create(this, indexInfo);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBObjectStoreRequest::RemoveIndex(const nsAString& aName,
-                                   nsIIDBRequest** _retval)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!mTransaction->TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (aName.IsEmpty()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  ObjectStoreInfo* info = GetObjectStoreInfo();
-  NS_ENSURE_TRUE(info, NS_ERROR_UNEXPECTED);
-
-  bool found = false;
-  PRUint32 indexCount = info->indexes.Length();
-  for (PRUint32 index = 0; index < indexCount; index++) {
-    if (info->indexes[index].name == aName) {
-      found = true;
-      break;
-    }
-  }
-
-  if (!found) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  nsRefPtr<IDBRequest> request = GenerateWriteRequest();
-
-  nsRefPtr<RemoveIndexHelper> helper =
-    new RemoveIndexHelper(mTransaction, request, aName, this);
-  nsresult rv = helper->DispatchToTransactionPool();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  request.forget(_retval);
-  return NS_OK;
-}
-
-PRUint16
-AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_PRECONDITION(aConnection, "Passed a null connection!");
-
-  nsresult rv;
-  if (mKey.IsNull()) {
-    NS_WARNING("Using a UUID for null keys, probably can do something faster!");
-
-    nsCOMPtr<nsIUUIDGenerator> uuidGen =
-      do_GetService("@mozilla.org/uuid-generator;1", &rv);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    nsID id;
-    rv = uuidGen->GenerateUUIDInPlace(&id);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    char idString[NSID_LENGTH] = { 0 };
-    id.ToProvidedString(idString);
-
-    mKey = NS_ConvertASCIItoUTF16(idString);
-  }
-
-  bool mayOverwrite = mOverwrite;
-  bool unsetKey = mKey.IsUnset();
-
-  if (unsetKey) {
-    NS_ASSERTION(mAutoIncrement, "Must have a key for non-autoIncrement!");
-
-    // Will need to add first and then set the key later.
-    mayOverwrite = false;
-  }
-
-  if (mAutoIncrement && !unsetKey) {
-    mayOverwrite = true;
-  }
-
-  Savepoint savepoint(mTransaction);
-
-  nsCOMPtr<mozIStorageStatement> stmt;
-  if (!mOverwrite && !unsetKey) {
-    // Make sure the key doesn't exist already
-    stmt = mTransaction->GetStatement(mAutoIncrement);
-    NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    mozStorageStatementScoper scoper(stmt);
-
-    rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mOSID);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    NS_NAMED_LITERAL_CSTRING(id, "id");
-
-    if (mKey.IsInt()) {
-      rv = stmt->BindInt64ByName(id, mKey.IntValue());
-    }
-    else if (mKey.IsString()) {
-      rv = stmt->BindStringByName(id, mKey.StringValue());
-    }
-    else {
-      NS_NOTREACHED("Unknown key type!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    PRBool hasResult;
-    rv = stmt->ExecuteStep(&hasResult);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    if (hasResult) {
-      return nsIIDBDatabaseException::CONSTRAINT_ERR;
-    }
-  }
-
-  // Now we add it to the database (or update, depending on our variables).
-  stmt = mTransaction->AddStatement(mCreate, mayOverwrite, mAutoIncrement);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  NS_NAMED_LITERAL_CSTRING(keyValue, "key_value");
-
-  rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mOSID);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (!mAutoIncrement || mayOverwrite) {
-    NS_ASSERTION(!mKey.IsUnset(), "This shouldn't happen!");
-
-    if (mKey.IsInt()) {
-      rv = stmt->BindInt64ByName(keyValue, mKey.IntValue());
-    }
-    else if (mKey.IsString()) {
-      rv = stmt->BindStringByName(keyValue, mKey.StringValue());
-    }
-    else {
-      NS_NOTREACHED("Unknown key type!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  rv = stmt->BindStringByName(NS_LITERAL_CSTRING("data"), mValue);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (NS_FAILED(stmt->Execute())) {
-    return nsIIDBDatabaseException::CONSTRAINT_ERR;
-  }
-
-  // If we are supposed to generate a key, get the new id.
-  if (mAutoIncrement && mCreate && !mOverwrite) {
-#ifdef DEBUG
-    PRInt64 oldKey = unsetKey ? 0 : mKey.IntValue();
-#endif
-
-    rv = aConnection->GetLastInsertRowID(mKey.ToIntPtr());
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-#ifdef DEBUG
-    NS_ASSERTION(mKey.IsInt(), "Bad key value!");
-    if (!unsetKey) {
-      NS_ASSERTION(mKey.IntValue() == oldKey, "Something went haywire!");
-    }
-#endif
-
-    if (!mKeyPath.IsEmpty() && unsetKey) {
-      // Special case where someone put an object into an autoIncrement'ing
-      // objectStore with no key in its keyPath set. We needed to figure out
-      // which row id we would get above before we could set that properly.
-      rv = ModifyValueForNewKey();
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-      scoper.Abandon();
-      rv = stmt->Reset();
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-      stmt = mTransaction->AddStatement(false, true, true);
-      NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-      mozStorageStatementScoper scoper2(stmt);
-
-      rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mOSID);
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-      rv = stmt->BindInt64ByName(keyValue, mKey.IntValue());
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-      rv = stmt->BindStringByName(NS_LITERAL_CSTRING("data"), mValue);
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-      rv = stmt->Execute();
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-    }
-  }
-
-  // Update our indexes if needed.
-  if (!mIndexUpdateInfo.IsEmpty()) {
-    PRInt64 objectDataId = mAutoIncrement ? mKey.IntValue() : LL_MININT;
-    rv = IDBObjectStoreRequest::UpdateIndexes(mTransaction, mOSID, mKey,
-                                              mAutoIncrement, mOverwrite,
-                                              objectDataId, mIndexUpdateInfo);
-    if (rv == NS_ERROR_STORAGE_CONSTRAINT) {
-      return nsIIDBDatabaseException::CONSTRAINT_ERR;
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  rv = savepoint.Release();
-  return NS_SUCCEEDED(rv) ? OK : nsIIDBDatabaseException::UNKNOWN_ERR;
-}
-
-PRUint16
-AddHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Badness!");
-
-  if (mKey.IsString()) {
-    aResult->SetAsAString(mKey.StringValue());
-  }
-  else if (mKey.IsInt()) {
-    aResult->SetAsInt64(mKey.IntValue());
-  }
-  else {
-    NS_NOTREACHED("Unknown key type!");
-  }
-  return OK;
-}
-
-nsresult
-AddHelper::ModifyValueForNewKey()
-{
-  NS_ASSERTION(mAutoIncrement && !mKeyPath.IsEmpty() && mKey.IsInt(),
-               "Don't call me!");
-
-  JSContext* cx;
-  nsresult rv = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  JSAutoRequest ar(cx);
-
-  js::AutoValueRooter clone(cx);
-
-  nsCOMPtr<nsIJSON> json(new nsJSON());
-  rv = json->DecodeToJSVal(mValue, cx, clone.addr());
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  JSObject* obj = JSVAL_TO_OBJECT(clone.value());
-  JSBool ok;
-  js::AutoValueRooter key(cx);
-
-  const jschar* keyPathChars = reinterpret_cast<const jschar*>(mKeyPath.get());
-  const size_t keyPathLen = mKeyPath.Length();
-
-#ifdef DEBUG
-  ok = JS_GetUCProperty(cx, obj, keyPathChars, keyPathLen, key.addr());
-  NS_ASSERTION(ok && JSVAL_IS_VOID(key.value()), "Already has a key prop!");
-#endif
-
-  ok = JS_NewNumberValue(cx, mKey.IntValue(), key.addr());
-  NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-  ok = JS_DefineUCProperty(cx, obj, keyPathChars, keyPathLen, key.value(),
-                           nsnull, nsnull, JSPROP_ENUMERATE);
-  NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-  rv = json->EncodeFromJSVal(clone.addr(), cx, mValue);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-PRUint16
-GetHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_PRECONDITION(aConnection, "Passed a null connection!");
-
-  nsCOMPtr<mozIStorageStatement> stmt =
-    mTransaction->GetStatement(mAutoIncrement);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mOSID);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Must have a key here!");
-
-  NS_NAMED_LITERAL_CSTRING(id, "id");
-
-  if (mKey.IsInt()) {
-    rv = stmt->BindInt64ByName(id, mKey.IntValue());
-  }
-  else if (mKey.IsString()) {
-    rv = stmt->BindStringByName(id, mKey.StringValue());
-  }
-  else {
-    NS_NOTREACHED("Unknown key type!");
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  // Search for it!
-  PRBool hasResult;
-  rv = stmt->ExecuteStep(&hasResult);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (!hasResult) {
-    return nsIIDBDatabaseException::NOT_FOUND_ERR;
-  }
-
-  // Set the value based on results.
-  (void)stmt->GetString(0, mValue);
-
-  return OK;
-}
-
-PRUint16
-GetHelper::OnSuccess(nsIDOMEventTarget* aTarget)
-{
-  nsRefPtr<GetSuccessEvent> event(new GetSuccessEvent(mValue));
-  nsresult rv = event->Init(mRequest, mTransaction);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  PRBool dummy;
-  aTarget->DispatchEvent(static_cast<nsDOMEvent*>(event), &dummy);
-  return OK;
-}
-
-PRUint16
-RemoveHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_PRECONDITION(aConnection, "Passed a null connection!");
-
-  nsCOMPtr<mozIStorageStatement> stmt =
-    mTransaction->RemoveStatement(mAutoIncrement);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mOSID);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Must have a key here!");
-
-  NS_NAMED_LITERAL_CSTRING(key_value, "key_value");
-
-  if (mKey.IsInt()) {
-    rv = stmt->BindInt64ByName(key_value, mKey.IntValue());
-  }
-  else if (mKey.IsString()) {
-    rv = stmt->BindStringByName(key_value, mKey.StringValue());
-  }
-  else {
-    NS_NOTREACHED("Unknown key type!");
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  // Search for it!
-  rv = stmt->Execute();
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  return OK;
-}
-
-PRUint16
-RemoveHelper::OnSuccess(nsIDOMEventTarget* aTarget)
-{
-  return AsyncConnectionHelper::OnSuccess(aTarget);
-}
-
-PRUint16
-RemoveHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Badness!");
-
-  if (mKey.IsString()) {
-    aResult->SetAsAString(mKey.StringValue());
-  }
-  else if (mKey.IsInt()) {
-    aResult->SetAsInt64(mKey.IntValue());
-  }
-  else {
-    NS_NOTREACHED("Unknown key type!");
-  }
-  return OK;
-}
-
-PRUint16
-OpenCursorHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  nsCString table;
-  nsCString keyColumn;
-
-  if (mObjectStore->IsAutoIncrement()) {
-    table.AssignLiteral("ai_object_data");
-    keyColumn.AssignLiteral("id");
-  }
-  else {
-    table.AssignLiteral("object_data");
-    keyColumn.AssignLiteral("key_value");
-  }
-
-  NS_NAMED_LITERAL_CSTRING(osid, "osid");
-  NS_NAMED_LITERAL_CSTRING(leftKeyName, "left_key");
-  NS_NAMED_LITERAL_CSTRING(rightKeyName, "right_key");
-
-  nsCAutoString keyRangeClause;
-  if (!mLeftKey.IsUnset()) {
-    keyRangeClause = NS_LITERAL_CSTRING(" AND ") + keyColumn;
-    if (mKeyRangeFlags & nsIIDBKeyRange::LEFT_OPEN) {
-      keyRangeClause.AppendLiteral(" > :");
-    }
-    else {
-      NS_ASSERTION(mKeyRangeFlags & nsIIDBKeyRange::LEFT_BOUND, "Bad flags!");
-      keyRangeClause.AppendLiteral(" >= :");
-    }
-    keyRangeClause.Append(leftKeyName);
-  }
-
-  if (!mRightKey.IsUnset()) {
-    keyRangeClause += NS_LITERAL_CSTRING(" AND ") + keyColumn;
-    if (mKeyRangeFlags & nsIIDBKeyRange::RIGHT_OPEN) {
-      keyRangeClause.AppendLiteral(" < :");
-    }
-    else {
-      NS_ASSERTION(mKeyRangeFlags & nsIIDBKeyRange::RIGHT_BOUND, "Bad flags!");
-      keyRangeClause.AppendLiteral(" <= :");
-    }
-    keyRangeClause.Append(rightKeyName);
-  }
-
-  nsCString directionClause;
-  switch (mDirection) {
-    case nsIIDBCursor::NEXT:
-    case nsIIDBCursor::NEXT_NO_DUPLICATE:
-      directionClause = NS_LITERAL_CSTRING(" DESC");
-      break;
-
-    case nsIIDBCursor::PREV:
-    case nsIIDBCursor::PREV_NO_DUPLICATE:
-      directionClause = NS_LITERAL_CSTRING(" ASC");
-      break;
-
-    default:
-      NS_NOTREACHED("Unknown direction type!");
-  }
-
-  nsCString query = NS_LITERAL_CSTRING("SELECT ") + keyColumn +
-                    NS_LITERAL_CSTRING(", data FROM ") + table +
-                    NS_LITERAL_CSTRING(" WHERE object_store_id = :") + osid +
-                    keyRangeClause + NS_LITERAL_CSTRING(" ORDER BY ") +
-                    keyColumn + directionClause;
-
-  if (!mData.SetCapacity(50)) {
-    NS_ERROR("Out of memory!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(osid, mObjectStore->Id());
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (!mLeftKey.IsUnset()) {
-    if (mLeftKey.IsString()) {
-      rv = stmt->BindStringByName(leftKeyName, mLeftKey.StringValue());
-    }
-    else if (mLeftKey.IsInt()) {
-      rv = stmt->BindInt64ByName(leftKeyName, mLeftKey.IntValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  if (!mRightKey.IsUnset()) {
-    if (mRightKey.IsString()) {
-      rv = stmt->BindStringByName(rightKeyName, mRightKey.StringValue());
-    }
-    else if (mRightKey.IsInt()) {
-      rv = stmt->BindInt64ByName(rightKeyName, mRightKey.IntValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  NS_WARNING("Copying all results for cursor snapshot, do something smarter!");
-
-  PRBool hasResult;
-  while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    if (mData.Capacity() == mData.Length()) {
-      if (!mData.SetCapacity(mData.Capacity() * 2)) {
-        NS_ERROR("Out of memory!");
-        return nsIIDBDatabaseException::UNKNOWN_ERR;
-      }
-    }
-
-    KeyValuePair* pair = mData.AppendElement();
-    NS_ASSERTION(pair, "Shouldn't fail if SetCapacity succeeded!");
-
-    PRInt32 keyType;
-    rv = stmt->GetTypeOfIndex(0, &keyType);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    NS_ASSERTION(keyType == mozIStorageStatement::VALUE_TYPE_INTEGER ||
-                 keyType == mozIStorageStatement::VALUE_TYPE_TEXT,
-                 "Bad key type!");
-
-    if (keyType == mozIStorageStatement::VALUE_TYPE_INTEGER) {
-      pair->key = stmt->AsInt64(0);
-    }
-    else if (keyType == mozIStorageStatement::VALUE_TYPE_TEXT) {
-      rv = stmt->GetString(0, pair->key.ToString());
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-    }
-    else {
-      NS_NOTREACHED("Bad SQLite type!");
-    }
-
-#ifdef DEBUG
-    {
-      PRInt32 valueType;
-      NS_ASSERTION(NS_SUCCEEDED(stmt->GetTypeOfIndex(1, &valueType)) &&
-                   valueType == mozIStorageStatement::VALUE_TYPE_TEXT,
-                   "Bad value type!");
-    }
-#endif
-
-    rv = stmt->GetString(1, pair->value);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  return OK;
-}
-
-PRUint16
-OpenCursorHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  if (mData.IsEmpty()) {
-    aResult->SetAsEmpty();
-    return OK;
-  }
-
-  nsRefPtr<IDBCursorRequest> cursor =
-    IDBCursorRequest::Create(mRequest, mTransaction, mObjectStore, mDirection,
-                             mData);
-  NS_ENSURE_TRUE(cursor, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  aResult->SetAsISupports(static_cast<IDBRequest::Generator*>(cursor));
-
-  mObjectStore = nsnull;
-
-  return OK;
-}
-
-PRUint16
-CreateIndexHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  Savepoint savepoint(mTransaction);
-
-  // Insert the data into the database.
-  nsCOMPtr<mozIStorageStatement> stmt =
-    mTransaction->GetCachedStatement(
-    "INSERT INTO object_store_index (name, key_path, unique_index, "
-      "object_store_id, object_store_autoincrement) "
-    "VALUES (:name, :key_path, :unique, :osid, :os_auto_increment)"
-  );
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mName);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindStringByName(NS_LITERAL_CSTRING("key_path"), mKeyPath);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("unique"),
-                             mUnique ? 1 : 0);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mObjectStore->Id());
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("os_auto_increment"),
-                             mAutoIncrement ? 1 : 0);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (NS_FAILED(stmt->Execute())) {
-    return nsIIDBDatabaseException::CONSTRAINT_ERR;
-  }
-
-  // Get the id of this object store, and store it for future use.
-  (void)aConnection->GetLastInsertRowID(&mId);
-
-  // Now we need to populate the index with data from the object store.
-  PRUint16 rc = InsertDataFromObjectStore(aConnection);
-  NS_ENSURE_TRUE(rc == OK, rc);
-
-  rv = savepoint.Release();
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  return OK;
-}
-
-PRUint16
-CreateIndexHelper::InsertDataFromObjectStore(mozIStorageConnection* aConnection)
-{
-  nsCAutoString table;
-  nsCAutoString columns;
-  if (mAutoIncrement) {
-    table.AssignLiteral("ai_object_data");
-    columns.AssignLiteral("id, data");
-  }
-  else {
-    table.AssignLiteral("object_data");
-    columns.AssignLiteral("id, data, key_value");
-  }
-
-  nsCString query = NS_LITERAL_CSTRING("SELECT ") + columns +
-                    NS_LITERAL_CSTRING(" FROM ") + table +
-                    NS_LITERAL_CSTRING(" WHERE object_store_id = :osid");
-
-  nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"),
-                                      mObjectStore->Id());
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  PRBool hasResult;
-  while (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
-    nsCOMPtr<mozIStorageStatement> insertStmt =
-      mTransaction->IndexUpdateStatement(mAutoIncrement, mUnique, false);
-    NS_ENSURE_TRUE(insertStmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    mozStorageStatementScoper scoper2(insertStmt);
-
-    rv = insertStmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"), mId);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    rv = insertStmt->BindInt64ByName(NS_LITERAL_CSTRING("object_data_id"),
-                                     stmt->AsInt64(0));
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    if (!mAutoIncrement) {
-      // XXX does this cause problems with the affinity?
-      nsString key;
-      rv = stmt->GetString(2, key);
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-      rv = insertStmt->BindStringByName(NS_LITERAL_CSTRING("object_data_key"),
-                                        key);
-      NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-    }
-
-    nsString json;
-    rv = stmt->GetString(1, json);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    Key key;
-    JSContext* cx = nsnull;
-    rv = IDBObjectStoreRequest::GetKeyPathValueFromJSON(json, mKeyPath, &cx,
-                                                        key);
-    // XXX this should be a constraint error maybe?
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    NS_NAMED_LITERAL_CSTRING(value, "value");
-
-    if (key.IsUnset()) {
-      continue;
-    }
-
-    if (key.IsInt()) {
-      rv = insertStmt->BindInt64ByName(value, key.IntValue());
-    }
-    else if (key.IsString()) {
-      rv = insertStmt->BindStringByName(value, key.StringValue());
-    }
-    else {
-      return nsIIDBDatabaseException::CONSTRAINT_ERR;
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-    rv = insertStmt->Execute();
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  return OK;
-}
-
-PRUint16
-CreateIndexHelper::GetSuccessResult(nsIWritableVariant* aResult)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  ObjectStoreInfo* info = mObjectStore->GetObjectStoreInfo();
-  if (!info) {
-    NS_ERROR("Couldn't get info!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-#ifdef DEBUG
-  {
-    bool found = false;
-    PRUint32 indexCount = info->indexes.Length();
-    for (PRUint32 index = 0; index < indexCount; index++) {
-      if (info->indexes[index].name == mName) {
-        found = true;
-        break;
-      }
-    }
-    NS_ASSERTION(!found, "Alreayd have this index!");
-  }
-#endif
-
-  IndexInfo* newInfo = info->indexes.AppendElement();
-  if (!newInfo) {
-    NS_ERROR("Couldn't add index name!  Out of memory?");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  newInfo->id = mId;
-  newInfo->name = mName;
-  newInfo->keyPath = mKeyPath;
-  newInfo->unique = mUnique;
-  newInfo->autoIncrement = mAutoIncrement;
-
-  nsCOMPtr<nsIIDBIndexRequest> result;
-  nsresult rv = mObjectStore->Index(mName, getter_AddRefs(result));
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  aResult->SetAsISupports(result);
-  return OK;
-}
-
-PRUint16
-RemoveIndexHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  NS_PRECONDITION(!NS_IsMainThread(), "Wrong thread!");
-
-  nsCOMPtr<mozIStorageStatement> stmt =
-    mTransaction->GetCachedStatement(
-      "DELETE FROM object_store_index "
-      "WHERE name = :name "
-    );
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mName);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (NS_FAILED(stmt->Execute())) {
-    return nsIIDBDatabaseException::NOT_FOUND_ERR;
-  }
-
-  return OK;
-}
-
-PRUint16
-RemoveIndexHelper::GetSuccessResult(nsIWritableVariant* /* aResult */)
-{
-  NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
-
-  ObjectStoreInfo* info = mObjectStore->GetObjectStoreInfo();
-  if (!info) {
-    NS_ERROR("Unable to get object store info!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-#ifdef DEBUG
-  {
-    bool found = false;
-    PRUint32 indexCount = info->indexes.Length();
-    for (PRUint32 index = 0; index < indexCount; index++) {
-      if (info->indexes[index].name == mName) {
-        found = true;
-        break;
-      }
-    }
-    NS_ASSERTION(found, "Didn't know about this one!");
-  }
-#endif
-
-  PRUint32 indexCount = info->indexes.Length();
-  for (PRUint32 index = 0; index < indexCount; index++) {
-    if (info->indexes[index].name == mName) {
-      info->indexes.RemoveElementAt(index);
-      break;
-    }
-  }
-
-  return OK;
-}
-
-PRUint16
-GetAllHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
-{
-  nsCString table;
-  nsCString keyColumn;
-
-  if (mAutoIncrement) {
-    table.AssignLiteral("ai_object_data");
-    keyColumn.AssignLiteral("id");
-  }
-  else {
-    table.AssignLiteral("object_data");
-    keyColumn.AssignLiteral("key_value");
-  }
-
-  NS_NAMED_LITERAL_CSTRING(osid, "osid");
-  NS_NAMED_LITERAL_CSTRING(leftKeyName, "left_key");
-  NS_NAMED_LITERAL_CSTRING(rightKeyName, "right_key");
-
-  nsCAutoString keyRangeClause;
-  if (!mLeftKey.IsUnset()) {
-    keyRangeClause = NS_LITERAL_CSTRING(" AND ") + keyColumn;
-    if (mKeyRangeFlags & nsIIDBKeyRange::LEFT_OPEN) {
-      keyRangeClause.AppendLiteral(" > :");
-    }
-    else {
-      NS_ASSERTION(mKeyRangeFlags & nsIIDBKeyRange::LEFT_BOUND, "Bad flags!");
-      keyRangeClause.AppendLiteral(" >= :");
-    }
-    keyRangeClause.Append(leftKeyName);
-  }
-
-  if (!mRightKey.IsUnset()) {
-    keyRangeClause += NS_LITERAL_CSTRING(" AND ") + keyColumn;
-    if (mKeyRangeFlags & nsIIDBKeyRange::RIGHT_OPEN) {
-      keyRangeClause.AppendLiteral(" < :");
-    }
-    else {
-      NS_ASSERTION(mKeyRangeFlags & nsIIDBKeyRange::RIGHT_BOUND, "Bad flags!");
-      keyRangeClause.AppendLiteral(" <= :");
-    }
-    keyRangeClause.Append(rightKeyName);
-  }
-
-  nsCAutoString limitClause;
-  if (mLimit != PR_UINT32_MAX) {
-    limitClause.AssignLiteral(" LIMIT ");
-    limitClause.AppendInt(mLimit);
-  }
-
-  nsCString query = NS_LITERAL_CSTRING("SELECT data FROM ") + table +
-                    NS_LITERAL_CSTRING(" WHERE object_store_id = :") + osid +
-                    keyRangeClause + NS_LITERAL_CSTRING(" ORDER BY ") +
-                    keyColumn + NS_LITERAL_CSTRING(" ASC") + limitClause;
-
-  if (!mValues.SetCapacity(50)) {
-    NS_ERROR("Out of memory!");
-    return nsIIDBDatabaseException::UNKNOWN_ERR;
-  }
-
-  nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
-  NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = stmt->BindInt64ByName(osid, mOSID);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  if (!mLeftKey.IsUnset()) {
-    if (mLeftKey.IsString()) {
-      rv = stmt->BindStringByName(leftKeyName, mLeftKey.StringValue());
-    }
-    else if (mLeftKey.IsInt()) {
-      rv = stmt->BindInt64ByName(leftKeyName, mLeftKey.IntValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  if (!mRightKey.IsUnset()) {
-    if (mRightKey.IsString()) {
-      rv = stmt->BindStringByName(rightKeyName, mRightKey.StringValue());
-    }
-    else if (mRightKey.IsInt()) {
-      rv = stmt->BindInt64ByName(rightKeyName, mRightKey.IntValue());
-    }
-    else {
-      NS_NOTREACHED("Bad key!");
-    }
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-
-  PRBool hasResult;
-  while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    if (mValues.Capacity() == mValues.Length()) {
-      if (!mValues.SetCapacity(mValues.Capacity() * 2)) {
-        NS_ERROR("Out of memory!");
-        return nsIIDBDatabaseException::UNKNOWN_ERR;
-      }
-    }
-
-    nsString* value = mValues.AppendElement();
-    NS_ASSERTION(value, "Shouldn't fail if SetCapacity succeeded!");
-
-    rv = stmt->GetString(0, *value);
-    NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-  }
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  return OK;
-}
-
-PRUint16
-GetAllHelper::OnSuccess(nsIDOMEventTarget* aTarget)
-{
-  NS_ASSERTION(mValues.Length() <= mLimit, "Too many results!");
-
-  nsRefPtr<GetAllSuccessEvent> event(new GetAllSuccessEvent(mValues));
-
-  NS_ASSERTION(mValues.IsEmpty(), "Should have swapped!");
-
-  nsresult rv = event->Init(mRequest, mTransaction);
-  NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
-
-  PRBool dummy;
-  aTarget->DispatchEvent(static_cast<nsDOMEvent*>(event), &dummy);
-  return OK;
-}
deleted file mode 100644
--- a/dom/indexedDB/IDBObjectStoreRequest.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_idbobjectstorerequest_h__
-#define mozilla_dom_indexeddb_idbobjectstorerequest_h__
-
-#include "mozilla/dom/indexedDB/IDBRequest.h"
-#include "mozilla/dom/indexedDB/IDBDatabaseRequest.h"
-#include "mozilla/dom/indexedDB/IDBTransactionRequest.h"
-
-#include "nsIIDBObjectStoreRequest.h"
-
-struct JSContext;
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-struct ObjectStoreInfo;
-struct IndexInfo;
-struct IndexUpdateInfo;
-
-class Key
-{
-public:
-  enum Type { UNSETKEY, NULLKEY, STRINGKEY, INTKEY };
-
-  Key()
-  : mType(UNSETKEY), mInt(0)
-  { }
-
-  Key(const Key& aOther)
-  {
-    *this = aOther;
-  }
-
-  Key& operator=(const Key& aOther)
-  {
-    if (this != &aOther) {
-      mType = aOther.mType;
-      mString = aOther.mString;
-      mInt = aOther.mInt;
-    }
-    return *this;
-  }
-
-  Key& operator=(Type aType)
-  {
-    NS_ASSERTION(aType == UNSETKEY || aType == NULLKEY,
-                 "Use one of the other operators to assign your value!");
-    mType = aType;
-    mString.Truncate();
-    mInt = 0;
-    return *this;
-  }
-
-  Key& operator=(const nsAString& aString)
-  {
-    mType = STRINGKEY;
-    mString = aString;
-    mInt = 0;
-    return *this;
-  }
-
-  Key& operator=(PRInt64 aInt)
-  {
-    mType = INTKEY;
-    mString.Truncate();
-    mInt = aInt;
-    return *this;
-  }
-
-  bool operator==(const Key& aOther) const
-  {
-    if (mType == aOther.mType) {
-      switch (mType) {
-        case UNSETKEY:
-        case NULLKEY:
-          return true;
-
-        case STRINGKEY:
-          return mString == aOther.mString;
-
-        case INTKEY:
-          return mInt == aOther.mInt;
-
-        default:
-          NS_NOTREACHED("Unknown type!");
-      }
-    }
-    return false;
-  }
-
-  bool operator<(const Key& aOther) const
-  {
-    switch (mType) {
-      case UNSETKEY:
-        if (aOther.mType == UNSETKEY) {
-          return false;
-        }
-        return true;
-
-      case NULLKEY:
-        if (aOther.mType == UNSETKEY ||
-            aOther.mType == NULLKEY) {
-          return false;
-        }
-        return true;
-
-      case STRINGKEY:
-        if (aOther.mType == UNSETKEY ||
-            aOther.mType == NULLKEY ||
-            aOther.mType == INTKEY) {
-          return false;
-        }
-        NS_ASSERTION(aOther.mType == STRINGKEY, "Unknown type!");
-        return mString < aOther.mString;
-
-      case INTKEY:
-        if (aOther.mType == UNSETKEY ||
-            aOther.mType == NULLKEY) {
-          return false;
-        }
-        if (aOther.mType == STRINGKEY) {
-          return true;
-        }
-        NS_ASSERTION(aOther.mType == INTKEY, "Unknown type!");
-        return mInt < aOther.mInt;
-
-      default:
-        NS_NOTREACHED("Unknown type!");
-    }
-    return false;
-  }
-
-  bool operator>(const Key& aOther) const
-  {
-    return !(*this == aOther || *this < aOther);
-  }
-
-  bool IsUnset() const { return mType == UNSETKEY; }
-  bool IsNull() const { return mType == NULLKEY; }
-  bool IsString() const { return mType == STRINGKEY; }
-  bool IsInt() const { return mType == INTKEY; }
-
-  const nsString& StringValue() const {
-    NS_ASSERTION(IsString(), "Wrong type!");
-    return mString;
-  }
-
-  PRInt64 IntValue() const {
-    NS_ASSERTION(IsInt(), "Wrong type!");
-    return mInt;
-  }
-
-  nsAString& ToString() {
-    mType = STRINGKEY;
-    mInt = 0;
-    return mString;
-  }
-
-  PRInt64* ToIntPtr() {
-    mType = INTKEY;
-    mString.Truncate();
-    return &mInt;
-  }
-
-private:
-  Type mType;
-  nsString mString;
-  PRInt64 mInt;
-};
-
-class IDBObjectStoreRequest : public IDBRequest::Generator,
-                              public nsIIDBObjectStoreRequest
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIIDBOBJECTSTORE
-  NS_DECL_NSIIDBOBJECTSTOREREQUEST
-
-  static already_AddRefed<IDBObjectStoreRequest>
-  Create(IDBDatabaseRequest* aDatabase,
-         IDBTransactionRequest* aTransaction,
-         const ObjectStoreInfo* aInfo,
-         PRUint16 aMode);
-
-  static nsresult
-  GetKeyFromVariant(nsIVariant* aKeyVariant,
-                    Key& aKey);
-
-  static nsresult
-  GetJSONFromArg0(/* jsval arg0, */
-                  nsAString& aJSON);
-
-  static nsresult
-  GetKeyPathValueFromJSON(const nsAString& aJSON,
-                          const nsAString& aKeyPath,
-                          JSContext** aCx,
-                          Key& aValue);
-
-  static nsresult
-  GetIndexUpdateInfo(ObjectStoreInfo* aObjectStoreInfo,
-                     JSContext* aCx,
-                     jsval aObject,
-                     nsTArray<IndexUpdateInfo>& aUpdateInfoArray);
-
-  static nsresult
-  UpdateIndexes(IDBTransactionRequest* aTransaction,
-                PRInt64 aObjectStoreId,
-                const Key& aObjectStoreKey,
-                bool aAutoIncrement,
-                bool aOverwrite,
-                PRInt64 aObjectDataId,
-                const nsTArray<IndexUpdateInfo>& aUpdateInfoArray);
-
-
-  bool TransactionIsOpen() const
-  {
-    return mTransaction->TransactionIsOpen();
-  }
-
-  bool IsAutoIncrement() const
-  {
-    return mAutoIncrement;
-  }
-
-  bool IsWriteAllowed() const
-  {
-    return mTransaction->IsWriteAllowed();
-  }
-
-  PRInt64 Id() const
-  {
-    return mId;
-  }
-
-  const nsString& KeyPath() const
-  {
-    return mKeyPath;
-  }
-
-  IDBTransactionRequest* Transaction()
-  {
-    return mTransaction;
-  }
-
-  ObjectStoreInfo* GetObjectStoreInfo();
-
-protected:
-  IDBObjectStoreRequest();
-  ~IDBObjectStoreRequest();
-
-  nsresult GetAddInfo(/* jsval aValue, */
-                      nsIVariant* aKeyVariant,
-                      nsString& aJSON,
-                      Key& aKey,
-                      nsTArray<IndexUpdateInfo>& aUpdateInfoArray);
-
-private:
-  nsRefPtr<IDBDatabaseRequest> mDatabase;
-  nsRefPtr<IDBTransactionRequest> mTransaction;
-
-  PRInt64 mId;
-  nsString mName;
-  nsString mKeyPath;
-  PRBool mAutoIncrement;
-  PRUint32 mDatabaseId;
-  PRUint16 mMode;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_idbobjectstorerequest_h__
deleted file mode 100644
--- a/dom/indexedDB/IDBRequest.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Shawn Wilsher <me@shawnwilsher.com>
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "IDBRequest.h"
-
-#include "nsIScriptContext.h"
-#include "nsIVariant.h"
-
-#include "nsComponentManagerUtils.h"
-#include "nsDOMClassInfo.h"
-#include "nsStringGlue.h"
-#include "nsThreadUtils.h"
-
-#include "IDBEvents.h"
-
-USING_INDEXEDDB_NAMESPACE
-
-IDBRequest::IDBRequest(Generator* aGenerator,
-                       bool aWriteRequest)
-: mGenerator(aGenerator),
-  mReadyState(nsIIDBRequest::INITIAL),
-  mAborted(false),
-  mWriteRequest(aWriteRequest)
-{
-  NS_ASSERTION(aGenerator, "Null generator!");
-}
-
-IDBRequest::~IDBRequest()
-{
-  mGenerator->NoteDyingRequest(this);
-
-  if (mListenerManager) {
-    mListenerManager->Disconnect();
-  }
-}
-
-NS_IMETHODIMP
-IDBRequest::Abort()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (mAborted || mReadyState != nsIIDBRequest::LOADING) {
-    return NS_OK;
-  }
-
-  if (mWriteRequest) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  mAborted = true;
-  mReadyState = nsIIDBRequest::DONE;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBRequest::GetReadyState(PRUint16* aReadyState)
-{
-  *aReadyState = mReadyState;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBRequest::SetOnsuccess(nsIDOMEventListener* aSuccessListener)
-{
-  return RemoveAddEventListener(NS_LITERAL_STRING(SUCCESS_EVT_STR),
-                                mOnSuccessListener, aSuccessListener);
-}
-
-NS_IMETHODIMP
-IDBRequest::GetOnsuccess(nsIDOMEventListener** aSuccessListener)
-{
-  return GetInnerEventListener(mOnSuccessListener, aSuccessListener);
-}
-
-NS_IMETHODIMP
-IDBRequest::SetOnerror(nsIDOMEventListener* aErrorListener)
-{
-  return RemoveAddEventListener(NS_LITERAL_STRING(ERROR_EVT_STR),
-                                mOnErrorListener, aErrorListener);
-}
-
-NS_IMETHODIMP
-IDBRequest::GetOnerror(nsIDOMEventListener** aErrorListener)
-{
-  return GetInnerEventListener(mOnErrorListener, aErrorListener);
-}
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(IDBRequest)
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBRequest,
-                                                  nsDOMEventTargetHelper)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnSuccessListener)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnErrorListener)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IDBRequest,
-                                                nsDOMEventTargetHelper)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnSuccessListener)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnErrorListener)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBRequest)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBRequest)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBRequest)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
-
-NS_IMPL_ADDREF_INHERITED(IDBRequest, nsDOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(IDBRequest, nsDOMEventTargetHelper)
-
-DOMCI_DATA(IDBRequest, IDBRequest)
deleted file mode 100644
--- a/dom/indexedDB/IDBRequest.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Shawn Wilsher <me@shawnwilsher.com>
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_indexeddb_idbrequest_h__
-#define mozilla_dom_indexeddb_idbrequest_h__
-
-#include "mozilla/dom/indexedDB/IndexedDatabase.h"
-
-#include "nsIIDBRequest.h"
-#include "nsIVariant.h"
-
-#include "nsDOMEventTargetHelper.h"
-#include "nsCycleCollectionParticipant.h"
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class AsyncConnectionHelper;
-class IndexedDatabaseRequest;
-class IDBDatabaseRequest;
-
-class IDBRequest : public nsDOMEventTargetHelper,
-                   public nsIIDBRequest
-{
-  friend class AsyncConnectionHelper;
-
-public:
-  class Generator : public nsISupports
-  {
-    protected:
-      friend class IDBRequest;
-
-      Generator() { }
-
-      virtual ~Generator() {
-        NS_ASSERTION(mLiveRequests.IsEmpty(), "Huh?!");
-      }
-
-      IDBRequest* GenerateRequest() {
-        IDBRequest* request = new IDBRequest(this, false);
-        if (!mLiveRequests.AppendElement(request)) {
-          NS_ERROR("Append failed!");
-        }
-        return request;
-      }
-
-      IDBRequest* GenerateWriteRequest() {
-        IDBRequest* request = new IDBRequest(this, true);
-        if (!mLiveRequests.AppendElement(request)) {
-          NS_ERROR("Append failed!");
-        }
-        return request;
-      }
-
-      void NoteDyingRequest(IDBRequest* aRequest) {
-        NS_ASSERTION(mLiveRequests.Contains(aRequest), "Unknown request!");
-        mLiveRequests.RemoveElement(aRequest);
-      }
-
-    private:
-      // XXXbent Assuming infallible nsTArray here, make sure it lands!
-      nsAutoTArray<IDBRequest*, 1> mLiveRequests;
-  };
-
-  friend class IDBRequestGenerator;
-
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIIDBREQUEST
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IDBRequest,
-                                           nsDOMEventTargetHelper)
-
-  already_AddRefed<nsISupports> GetGenerator()
-  {
-    nsCOMPtr<nsISupports> generator(mGenerator);
-    return generator.forget();
-  }
-
-private:
-  // Only called by IDBRequestGenerator::Generate().
-  IDBRequest(Generator* aGenerator,
-             bool aWriteRequest);
-
-  nsRefPtr<Generator> mGenerator;
-
-protected:
-  // Called by Release().
-  ~IDBRequest();
-
-  PRUint16 mReadyState;
-  PRBool mAborted;
-  PRBool mWriteRequest;
-  nsRefPtr<nsDOMEventListenerWrapper> mOnSuccessListener;
-  nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-#endif // mozilla_dom_indexeddb_idbrequest_h__
deleted file mode 100644
--- a/dom/indexedDB/IDBTransactionRequest.cpp
+++ /dev/null
@@ -1,811 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Indexed Database.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "IDBTransactionRequest.h"
-
-#include "mozilla/storage.h"
-#include "nsDOMClassInfo.h"
-#include "nsProxyRelease.h"
-#include "nsThreadUtils.h"
-
-#include "IDBEvents.h"
-#include "IDBCursorRequest.h"
-#include "IDBObjectStoreRequest.h"
-#include "IndexedDatabaseRequest.h"
-#include "DatabaseInfo.h"
-#include "TransactionThreadPool.h"
-
-#define SAVEPOINT_INITIAL "initial"
-#define SAVEPOINT_INTERMEDIATE "intermediate"
-
-USING_INDEXEDDB_NAMESPACE
-
-namespace {
-
-PLDHashOperator
-DoomCachedStatements(const nsACString& aQuery,
-                     nsCOMPtr<mozIStorageStatement>& aStatement,
-                     void* aUserArg)
-{
-  CloseConnectionRunnable* runnable =
-    static_cast<CloseConnectionRunnable*>(aUserArg);
-  runnable->AddDoomedObject(aStatement);
-  return PL_DHASH_REMOVE;
-}
-
-} // anonymous namespace
-
-BEGIN_INDEXEDDB_NAMESPACE
-
-class CommitHelper : public nsRunnable
-{
-public:
-  CommitHelper(IDBTransactionRequest* aTransaction)
-  : mTransaction(aTransaction)
-  { }
-
-  NS_IMETHOD Run();
-
-private:
-  nsRefPtr<IDBTransactionRequest> mTransaction;
-};
-
-END_INDEXEDDB_NAMESPACE
-
-// static
-already_AddRefed<IDBTransactionRequest>
-IDBTransactionRequest::Create(IDBDatabaseRequest* aDatabase,
-                              nsTArray<nsString>& aObjectStoreNames,
-                              PRUint16 aMode,
-                              PRUint32 aTimeout)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsRefPtr<IDBTransactionRequest> transaction = new IDBTransactionRequest();
-
-  transaction->mDatabase = aDatabase;
-  transaction->mMode = aMode;
-  transaction->mTimeout = aTimeout;
-
-  if (!transaction->mObjectStoreNames.AppendElements(aObjectStoreNames)) {
-    NS_ERROR("Out of memory!");
-    return nsnull;
-  }
-
-  if (!transaction->mCachedStatements.Init()) {
-    NS_ERROR("Failed to initialize hash!");
-    return nsnull;
-  }
-
-  return transaction.forget();
-}
-
-IDBTransactionRequest::IDBTransactionRequest()
-: mReadyState(nsIIDBTransaction::INITIAL),
-  mMode(nsIIDBTransaction::READ_ONLY),
-  mTimeout(0),
-  mPendingRequests(0),
-  mSavepointCount(0),
-  mHasInitialSavepoint(false),
-  mAborted(false)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-}
-
-IDBTransactionRequest::~IDBTransactionRequest()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(!mPendingRequests, "Should have no pending requests here!");
-  NS_ASSERTION(!mSavepointCount, "Should have released them all!");
-  NS_ASSERTION(!mConnection, "Should have called CloseConnection!");
-
-  if (mListenerManager) {
-    mListenerManager->Disconnect();
-  }
-}
-
-void
-IDBTransactionRequest::OnNewRequest()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  if (!mPendingRequests) {
-    NS_ASSERTION(mReadyState == nsIIDBTransaction::INITIAL,
-                 "Reusing a transaction!");
-    mReadyState = nsIIDBTransaction::LOADING;
-  }
-  ++mPendingRequests;
-}
-
-void
-IDBTransactionRequest::OnRequestFinished()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(mPendingRequests, "Mismatched calls!");
-  --mPendingRequests;
-  if (!mPendingRequests) {
-    if (!mAborted) {
-      NS_ASSERTION(mReadyState == nsIIDBTransaction::LOADING, "Bad state!");
-    }
-    mReadyState = nsIIDBTransaction::DONE;
-
-    CommitOrRollback();
-  }
-}
-
-nsresult
-IDBTransactionRequest::CommitOrRollback()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(mReadyState == nsIIDBTransaction::DONE, "Bad readyState!");
-
-  TransactionThreadPool* pool = TransactionThreadPool::GetOrCreate();
-  NS_ENSURE_TRUE(pool, NS_ERROR_FAILURE);
-
-  nsRefPtr<CommitHelper> helper(new CommitHelper(this));
-
-  nsresult rv = pool->Dispatch(this, helper);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-bool
-IDBTransactionRequest::StartSavepoint()
-{
-  NS_PRECONDITION(!NS_IsMainThread(), "Wrong thread!");
-  NS_PRECONDITION(mConnection, "No connection!");
-
-  nsresult rv;
-
-  if (!mHasInitialSavepoint) {
-    NS_NAMED_LITERAL_CSTRING(beginSavepoint,
-                             "SAVEPOINT " SAVEPOINT_INITIAL);
-    rv = mConnection->ExecuteSimpleSQL(beginSavepoint);
-    NS_ENSURE_SUCCESS(rv, false);
-
-    mHasInitialSavepoint = true;
-  }
-
-  NS_ASSERTION(!mSavepointCount, "Mismatch!");
-  mSavepointCount = 1;
-
-  // TODO try to cache this statement
-  NS_NAMED_LITERAL_CSTRING(savepoint, "SAVEPOINT " SAVEPOINT_INTERMEDIATE);
-  rv = mConnection->ExecuteSimpleSQL(savepoint);
-  NS_ENSURE_SUCCESS(rv, false);
-
-  return true;
-}
-
-nsresult
-IDBTransactionRequest::ReleaseSavepoint()
-{
-  NS_PRECONDITION(!NS_IsMainThread(), "Wrong thread!");
-  NS_PRECONDITION(mConnection, "No connection!");
-
-  NS_ASSERTION(mSavepointCount == 1, "Mismatch!");
-  mSavepointCount = 0;
-
-  // TODO try to cache this statement
-  NS_NAMED_LITERAL_CSTRING(savepoint, "RELEASE " SAVEPOINT_INTERMEDIATE);
-  nsresult rv = mConnection->ExecuteSimpleSQL(savepoint);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-void
-IDBTransactionRequest::RollbackSavepoint()
-{
-  NS_PRECONDITION(!NS_IsMainThread(), "Wrong thread!");
-  NS_PRECONDITION(mConnection, "No connection!");
-
-  NS_ASSERTION(mSavepointCount == 1, "Mismatch!");
-  mSavepointCount = 0;
-
-  // TODO try to cache this statement
-  NS_NAMED_LITERAL_CSTRING(savepoint, "ROLLBACK TO " SAVEPOINT_INTERMEDIATE);
-  if (NS_FAILED(mConnection->ExecuteSimpleSQL(savepoint))) {
-    NS_ERROR("Rollback failed!");
-  }
-}
-
-nsresult
-IDBTransactionRequest::GetOrCreateConnection(mozIStorageConnection** aResult)
-{
-  NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
-
-  if (!mConnection) {
-    nsCOMPtr<mozIStorageConnection> connection =
-      IndexedDatabaseRequest::GetConnection(mDatabase->FilePath());
-    NS_ENSURE_TRUE(connection, NS_ERROR_FAILURE);
-
-    connection.swap(mConnection);
-  }
-
-  nsCOMPtr<mozIStorageConnection> result(mConnection);
-  result.forget(aResult);
-  return NS_OK;
-}
-
-already_AddRefed<mozIStorageStatement>
-IDBTransactionRequest::AddStatement(bool aCreate,
-                                    bool aOverwrite,
-                                    bool aAutoIncrement)
-{
-#ifdef DEBUG
-  if (!aCreate) {
-    NS_ASSERTION(aOverwrite, "Bad param combo!");
-  }
-#endif
-
-  if (aAutoIncrement) {
-    if (aCreate) {
-      if (aOverwrite) {
-        return GetCachedStatement(
-          "INSERT OR REPLACE INTO ai_object_data (object_store_id, id, data) "
-          "VALUES (:osid, :key_value, :data)"
-        );
-      }
-      return GetCachedStatement(
-        "INSERT INTO ai_object_data (object_store_id, data) "
-        "VALUES (:osid, :data)"
-      );
-    }
-    return GetCachedStatement(
-      "UPDATE ai_object_data "
-      "SET data = :data "
-      "WHERE object_store_id = :osid "
-      "AND id = :key_value"
-    );
-  }
-  if (aCreate) {
-    if (aOverwrite) {
-      return GetCachedStatement(
-        "INSERT OR REPLACE INTO object_data (object_store_id, key_value, data) "
-        "VALUES (:osid, :key_value, :data)"
-      );
-    }
-    return GetCachedStatement(
-      "INSERT INTO object_data (object_store_id, key_value, data) "
-      "VALUES (:osid, :key_value, :data)"
-    );
-  }
-  return GetCachedStatement(
-    "UPDATE object_data "
-    "SET data = :data "
-    "WHERE object_store_id = :osid "
-    "AND key_value = :key_value"
-  );
-}
-
-already_AddRefed<mozIStorageStatement>
-IDBTransactionRequest::RemoveStatement(bool aAutoIncrement)
-{
-  if (aAutoIncrement) {
-    return GetCachedStatement(
-      "DELETE FROM ai_object_data "
-      "WHERE id = :key_value "
-      "AND object_store_id = :osid"
-    );
-  }
-  return GetCachedStatement(
-    "DELETE FROM object_data "
-    "WHERE key_value = :key_value "
-    "AND object_store_id = :osid"
-  );
-}
-
-already_AddRefed<mozIStorageStatement>
-IDBTransactionRequest::GetStatement(bool aAutoIncrement)
-{
-  if (aAutoIncrement) {
-    return GetCachedStatement(
-      "SELECT data "
-      "FROM ai_object_data "
-      "WHERE id = :id "
-      "AND object_store_id = :osid"
-    );
-  }
-  return GetCachedStatement(
-    "SELECT data "
-    "FROM object_data "
-    "WHERE key_value = :id "
-    "AND object_store_id = :osid"
-  );
-}
-
-already_AddRefed<mozIStorageStatement>
-IDBTransactionRequest::IndexGetStatement(bool aUnique,
-                                         bool aAutoIncrement)
-{
-  if (aAutoIncrement) {
-    if (aUnique) {
-      return GetCachedStatement(
-        "SELECT ai_object_data_id "
-        "FROM ai_unique_index_data "
-        "WHERE index_id = :index_id "
-        "AND value = :value"
-      );
-    }
-    return GetCachedStatement(
-      "SELECT ai_object_data_id "
-      "FROM ai_index_data "
-      "WHERE index_id = :index_id "
-      "AND value = :value"
-    );
-  }
-  if (aUnique) {
-    return GetCachedStatement(
-      "SELECT object_data_key "
-      "FROM unique_index_data "
-      "WHERE index_id = :index_id "
-      "AND value = :value"
-    );
-  }
-  return GetCachedStatement(
-    "SELECT object_data_key "
-    "FROM index_data "
-    "WHERE index_id = :index_id "
-    "AND value = :value"
-  );
-}
-
-already_AddRefed<mozIStorageStatement>
-IDBTransactionRequest::IndexGetObjectStatement(bool aUnique,
-                                               bool aAutoIncrement)
-{
-  if (aAutoIncrement) {
-    if (aUnique) {
-      return GetCachedStatement(
-        "SELECT data "
-        "FROM ai_object_data "
-        "INNER JOIN ai_unique_index_data "
-        "ON ai_object_data.id = ai_unique_index_data.ai_object_data_id "
-        "WHERE index_id = :index_id "
-        "AND value = :value"
-      );
-    }
-    return GetCachedStatement(
-      "SELECT data "
-      "FROM ai_object_data "
-      "INNER JOIN ai_index_data "
-      "ON ai_object_data.id = ai_index_data.ai_object_data_id "
-      "WHERE index_id = :index_id "
-      "AND value = :value"
-    );
-  }
-  if (aUnique) {
-    return GetCachedStatement(
-      "SELECT data "
-      "FROM object_data "
-      "INNER JOIN unique_index_data "
-      "ON object_data.id = unique_index_data.object_data_id "
-      "WHERE index_id = :index_id "
-      "AND value = :value"
-    );
-  }
-  return GetCachedStatement(
-    "SELECT data "
-    "FROM object_data "
-    "INNER JOIN index_data "
-    "ON object_data.id = index_data.object_data_id "
-    "WHERE index_id = :index_id "
-    "AND value = :value"
-  );
-}
-
-already_AddRefed<mozIStorageStatement>
-IDBTransactionRequest::IndexUpdateStatement(bool aAutoIncrement,
-                                            bool aUnique,
-                                            bool aOverwrite)
-{
-  if (aAutoIncrement) {
-    if (aUnique) {
-      if (aOverwrite) {
-        return GetCachedStatement(
-          "INSERT OR REPLACE INTO ai_unique_index_data "
-            "(index_id, ai_object_data_id, id, value) "
-          "VALUES (:index_id, :object_data_id, :object_data_key, :value)"
-        );
-      }
-      return GetCachedStatement(
-        "INSERT INTO ai_unique_index_data "
-          "(index_id, aI_object_data_id, id, value) "
-        "VALUES (:index_id, :object_data_id, :object_data_key, :value)"
-      );
-    }
-    if (aOverwrite) {
-      return GetCachedStatement(
-        "INSERT OR REPLACE INTO ai_index_data "
-          "(index_id, ai_object_data_id, id, value) "
-        "VALUES (:index_id, :object_data_id, :object_data_key, :value)"
-      );
-    }
-    return GetCachedStatement(
-      "INSERT INTO ai_index_data "
-        "(index_id, ai_object_data_id, id, value) "
-      "VALUES (:index_id, :object_data_id, :object_data_key, :value)"
-    );
-  }
-  if (aUnique) {
-    if (aOverwrite) {
-      return GetCachedStatement(
-        "INSERT OR REPLACE INTO unique_index_data "
-          "(index_id, object_data_id, object_data_key, value) "
-        "VALUES (:index_id, :object_data_id, :object_data_key, :value)"
-      );
-    }
-    return GetCachedStatement(
-      "INSERT INTO unique_index_data "
-        "(index_id, object_data_id, object_data_key, value) "
-      "VALUES (:index_id, :object_data_id, :object_data_key, :value)"
-    );
-  }
-  if (aOverwrite) {
-    return GetCachedStatement(
-      "INSERT INTO index_data ("
-        "index_id, object_data_id, object_data_key, value) "
-      "VALUES (:index_id, :object_data_id, :object_data_key, :value)"
-    );
-  }
-  return GetCachedStatement(
-    "INSERT INTO index_data ("
-      "index_id, object_data_id, object_data_key, value) "
-    "VALUES (:index_id, :object_data_id, :object_data_key, :value)"
-  );
-}
-
-already_AddRefed<mozIStorageStatement>
-IDBTransactionRequest::GetCachedStatement(const nsACString& aQuery)
-{
-  NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(!aQuery.IsEmpty(), "Empty sql statement!");
-  NS_ASSERTION(mConnection, "No connection!");
-
-  nsCOMPtr<mozIStorageStatement> stmt;
-
-  if (!mCachedStatements.Get(aQuery, getter_AddRefs(stmt))) {
-    nsresult rv = mConnection->CreateStatement(aQuery, getter_AddRefs(stmt));
-#ifdef DEBUG
-    if (NS_FAILED(rv)) {
-      nsCString error;
-      error.AppendLiteral("The statement `");
-      error.Append(aQuery);
-      error.AppendLiteral("` failed to compile with the error message `");
-      nsCString msg;
-      (void)mConnection->GetLastErrorString(msg);
-      error.Append(msg);
-      error.AppendLiteral("`.");
-      NS_ERROR(error.get());
-    }
-#endif
-    NS_ENSURE_SUCCESS(rv, nsnull);
-
-    if (!mCachedStatements.Put(aQuery, stmt)) {
-      NS_ERROR("Out of memory?!");
-    }
-  }
-
-  return stmt.forget();
-}
-
-void
-IDBTransactionRequest::CloseConnection()
-{
-  TransactionThreadPool* pool = TransactionThreadPool::GetOrCreate();
-  if (!pool) {
-    NS_ASSERTION(!mConnection, "Should have closed already!");
-    return;
-  }
-
-  nsRefPtr<CloseConnectionRunnable> runnable(new CloseConnectionRunnable());
-
-  mCachedStatements.Enumerate(DoomCachedStatements, runnable);
-  NS_ASSERTION(!mCachedStatements.Count(), "Statements left!");
-
-  if (!runnable->AddDoomedObject(mConnection)) {
-    NS_ERROR("Out of memory!");
-  }
-
-  if (NS_FAILED(pool->Dispatch(this, runnable, true))) {
-    NS_ERROR("Failed to dispatch close runnable!");
-  }
-}
-
-#ifdef DEBUG
-bool
-IDBTransactionRequest::TransactionIsOpen() const
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  return mReadyState == nsIIDBTransaction::INITIAL ||
-         mReadyState == nsIIDBTransaction::LOADING;
-}
-
-bool
-IDBTransactionRequest::IsWriteAllowed() const
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  return mMode == nsIIDBTransaction::READ_WRITE;
-}
-#endif
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(IDBTransactionRequest)
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBTransactionRequest,
-                                                  nsDOMEventTargetHelper)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnCompleteListener)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnAbortListener)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnTimeoutListener)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IDBTransactionRequest,
-                                                nsDOMEventTargetHelper)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnCompleteListener)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnAbortListener)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnTimeoutListener)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBTransactionRequest)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBTransactionRequest)
-  NS_INTERFACE_MAP_ENTRY(nsIIDBTransaction)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBTransactionRequest)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
-
-NS_IMPL_ADDREF_INHERITED(IDBTransactionRequest, nsDOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(IDBTransactionRequest, nsDOMEventTargetHelper)
-
-DOMCI_DATA(IDBTransactionRequest, IDBTransactionRequest)
-
-NS_IMETHODIMP
-IDBTransactionRequest::GetDb(nsIIDBDatabase** aDB)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  NS_ADDREF(*aDB = mDatabase);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::GetReadyState(PRUint16* aReadyState)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  *aReadyState = mReadyState;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::GetMode(PRUint16* aMode)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  *aMode = mMode == IDBTransactionRequest::FULL_LOCK ?
-           nsIIDBTransaction::READ_WRITE : mMode;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::GetObjectStoreNames(nsIDOMDOMStringList** aObjectStores)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsRefPtr<nsDOMStringList> list(new nsDOMStringList());
-
-  nsTArray<nsString> stackArray;
-  nsTArray<nsString>* arrayOfNames;
-
-  if (mMode == IDBTransactionRequest::FULL_LOCK) {
-    DatabaseInfo* info;
-    if (!DatabaseInfo::Get(mDatabase->Id(), &info)) {
-      NS_ERROR("This should never fail!");
-      return NS_ERROR_UNEXPECTED;
-    }
-
-    if (!info->GetObjectStoreNames(stackArray)) {
-      NS_ERROR("Out of memory!");
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-
-    arrayOfNames = &stackArray;
-  }
-  else {
-    arrayOfNames = &mObjectStoreNames;
-  }
-
-  PRUint32 count = arrayOfNames->Length();
-  for (PRUint32 index = 0; index < count; index++) {
-    NS_ENSURE_TRUE(list->Add(arrayOfNames->ElementAt(index)),
-                   NS_ERROR_OUT_OF_MEMORY);
-  }
-  list.forget(aObjectStores);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::ObjectStore(const nsAString& aName,
-                                   nsIIDBObjectStoreRequest** _retval)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  ObjectStoreInfo* info = nsnull;
-
-  PRUint32 count = mObjectStoreNames.Length();
-  for (PRUint32 index = 0; index < count; index++) {
-    nsString& name = mObjectStoreNames[index];
-    if (name == aName) {
-      if (!ObjectStoreInfo::Get(mDatabase->Id(), aName, &info)) {
-        NS_ERROR("Don't know about this one?!");
-      }
-      break;
-    }
-  }
-
-  if (!info) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  nsRefPtr<IDBObjectStoreRequest> objectStore =
-    IDBObjectStoreRequest::Create(mDatabase, this, info, mMode);
-  NS_ENSURE_TRUE(objectStore, NS_ERROR_FAILURE);
-
-  objectStore.forget(_retval);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::Abort()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  if (!TransactionIsOpen()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  mAborted = true;
-  mReadyState = nsIIDBTransaction::DONE;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::GetOncomplete(nsIDOMEventListener** aOncomplete)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  return GetInnerEventListener(mOnCompleteListener, aOncomplete);
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::SetOncomplete(nsIDOMEventListener* aOncomplete)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  return RemoveAddEventListener(NS_LITERAL_STRING(COMPLETE_EVT_STR),
-                                mOnCompleteListener, aOncomplete);
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::GetOnabort(nsIDOMEventListener** aOnabort)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  return GetInnerEventListener(mOnAbortListener, aOnabort);
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::SetOnabort(nsIDOMEventListener* aOnabort)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  return RemoveAddEventListener(NS_LITERAL_STRING(ABORT_EVT_STR),
-                                mOnAbortListener, aOnabort);
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::GetOntimeout(nsIDOMEventListener** aOntimeout)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  return GetInnerEventListener(mOnTimeoutListener, aOntimeout);
-}
-
-NS_IMETHODIMP
-IDBTransactionRequest::SetOntimeout(nsIDOMEventListener* aOntimeout)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  return RemoveAddEventListener(NS_LITERAL_STRING(TIMEOUT_EVT_STR),
-                                mOnTimeoutListener, aOntimeout);
-}
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(CloseConnectionRunnable, nsIRunnable)
-
-NS_IMETHODIMP
-CloseConnectionRunnable::Run()
-{
-  mDoomedObjects.Clear();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-CommitHelper::Run()
-{
-  nsresult rv;
-
-  if (NS_IsMainThread()) {
-    mTransaction->CloseConnection();
-
-    nsCOMPtr<nsIDOMEvent> event;
-    if (mTransaction->mAborted) {
-      event = IDBEvent::CreateGenericEvent(NS_LITERAL_STRING(ABORT_EVT_STR));
-    }
-    else {
-      event = IDBEvent::CreateGenericEvent(NS_LITERAL_STRING(COMPLETE_EVT_STR));
-    }
-    NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
-
-    PRBool dummy;
-    rv = mTransaction->DispatchEvent(event, &dummy);
-    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Dispatch failed!");
-
-    mTransaction = nsnull;
-    return rv;
-  }
-
-  if (mTransaction->mAborted) {
-    NS_ASSERTION(mTransaction->mConnection, "This had better not be null!");
-
-    NS_NAMED_LITERAL_CSTRING(savepoint, "ROLLBACK TRANSACTION");
-    rv = mTransaction->mConnection->ExecuteSimpleSQL(savepoint);
-  }
-  else if (mTransaction->mHasInitialSavepoint) {
-    NS_ASSERTION(mTransaction->mConnection, "This had better not be null!");
-
-    NS_NAMED_LITERAL_CSTRING(savepoint, "RELEASE " SAVEPOINT_INITIAL);
-    rv = mTransaction->mConnection->ExecuteSimpleSQL(savepoint);
-  }
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
-}
deleted file mode 100644
--- a/dom/indexedDB/IDBTransactionRequest.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/