Move indexedDB implementation to dom/indexedDB, add more interfaces and stub implementations, integrate with DOMClassInfo.
authorBen Turner <bent.mozilla@gmail.com>
Thu, 22 Apr 2010 21:38:51 -0700
changeset 43951 13aa9dbfe1e0c16718ea1dab7706506c6945ff99
parent 43950 368acf5610028dfc4ac152b2293fd0df61f7af29
child 43952 78d2e371f02e7af71c3418cad155d721f6690dda
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone1.9.3a5pre
Move indexedDB implementation to dom/indexedDB, add more interfaces and stub implementations, integrate with DOMClassInfo.
content/events/src/nsDOMEventTargetHelper.h
dom/Makefile.in
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/base/nsGlobalWindow.cpp
dom/indexedDB/IDBDatabaseError.cpp
dom/indexedDB/IDBDatabaseError.h
dom/indexedDB/IDBDatabaseRequest.cpp
dom/indexedDB/IDBDatabaseRequest.h
dom/indexedDB/IDBRequest.cpp
dom/indexedDB/IDBRequest.h
dom/indexedDB/IndexedDatabase.h
dom/indexedDB/IndexedDatabaseRequest.cpp
dom/indexedDB/IndexedDatabaseRequest.h
dom/indexedDB/Makefile.in
dom/indexedDB/nsIIDBDatabase.idl
dom/indexedDB/nsIIDBDatabaseError.idl
dom/indexedDB/nsIIDBDatabaseRequest.idl
dom/indexedDB/nsIIDBRequest.idl
dom/indexedDB/nsIIDBTransaction.idl
dom/indexedDB/nsIIDBTransactionRequest.idl
dom/indexedDB/nsIIndexedDatabaseRequest.idl
dom/indexedDB/test/Makefile.in
dom/indexedDB/test/test_property_on_window.html
dom/interfaces/storage/Makefile.in
dom/interfaces/storage/nsIIDBRequest.idl
dom/interfaces/storage/nsIIndexedDatabaseRequest.idl
dom/src/Makefile.in
dom/src/storage/IDBRequest.cpp
dom/src/storage/IDBRequest.h
dom/src/storage/Makefile.in
dom/tests/mochitest/Makefile.in
dom/tests/mochitest/indexeddb/Makefile.in
dom/tests/mochitest/indexeddb/test_property_on_window.html
js/src/xpconnect/src/dom_quickstubs.qsconf
layout/build/Makefile.in
--- a/content/events/src/nsDOMEventTargetHelper.h
+++ b/content/events/src/nsDOMEventTargetHelper.h
@@ -44,16 +44,17 @@
 #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/dom/Makefile.in
+++ b/dom/Makefile.in
@@ -75,16 +75,17 @@ 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
@@ -461,16 +461,21 @@
 
 // Simple gestures include
 #include "nsIDOMSimpleGestureEvent.h"
 
 #include "nsIDOMNSMouseEvent.h"
 
 #include "nsIEventListenerService.h"
 
+#include "mozilla/dom/indexedDB/IndexedDatabaseRequest.h"
+#include "mozilla/dom/indexedDB/IDBRequest.h"
+#include "mozilla/dom/indexedDB/IDBDatabaseError.h"
+#include "mozilla/dom/indexedDB/IDBDatabaseRequest.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.
 
@@ -1366,16 +1371,25 @@ static nsDOMClassInfoData sClassInfoData
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(EventListenerInfo, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(TransitionEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(FormData, 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(IDBDatabaseError, nsDOMGenericSH,
+                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
 };
 
 // Objects that should be constructable through |new Name();|
 struct nsContractIDMapData
 {
   PRInt32 mDOMClassInfoID;
   const char *mContractID;
 };
@@ -3795,16 +3809,33 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMTransitionEvent)
     DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(FormData, nsIDOMFormData)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMFormData)
   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_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(IDBDatabaseError, nsIIDBDatabaseError)
+    DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabaseError)
+  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
@@ -461,8 +461,13 @@ DOMCI_CLASS(PaintRequestList)
 DOMCI_CLASS(ScrollAreaEvent)
 DOMCI_CLASS(PopStateEvent)
 
 DOMCI_CLASS(EventListenerInfo)
 
 DOMCI_CLASS(TransitionEvent)
 
 DOMCI_CLASS(FormData)
+
+DOMCI_CLASS(IndexedDatabaseRequest)
+DOMCI_CLASS(IDBRequest)
+DOMCI_CLASS(IDBDatabaseRequest)
+DOMCI_CLASS(IDBDatabaseError)
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -204,16 +204,18 @@
 #include "nsIDragService.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
 
 nsIDOMStorageList *nsGlobalWindow::sGlobalStorageList  = nsnull;
 
 static nsIEntropyCollector *gEntropyCollector          = nsnull;
 static PRInt32              gRefCnt                    = 0;
@@ -7475,20 +7477,23 @@ nsGlobalWindow::GetLocalStorage(nsIDOMSt
                                                      getter_AddRefs(mLocalStorage));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   NS_ADDREF(*aLocalStorage = mLocalStorage);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsGlobalWindow::GetIndexedDB(nsIIndexedDatabaseRequest** _indexedDB)
-{
-  *_indexedDB = nsnull;
+nsGlobalWindow::GetIndexedDB(nsIIndexedDatabaseRequest** _retval)
+{
+  nsCOMPtr<nsIIndexedDatabaseRequest> indexedDB =
+    mozilla::dom::indexedDB::IndexedDatabaseRequest::Create();
+  NS_ENSURE_TRUE(indexedDB, NS_ERROR_FAILURE);
+
+  indexedDB.forget(_retval);
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsGlobalWindow::nsIInterfaceRequestor
 //*****************************************************************************
 
 NS_IMETHODIMP
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IDBDatabaseError.cpp
@@ -0,0 +1,84 @@
+/* -*- 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 "IDBDatabaseError.h"
+
+#include "nsDOMClassInfo.h"
+#include "nsDOMClassInfoID.h"
+
+USING_INDEXEDDB_NAMESPACE
+
+NS_IMPL_ADDREF(IDBDatabaseError)
+NS_IMPL_RELEASE(IDBDatabaseError)
+
+NS_INTERFACE_MAP_BEGIN(IDBDatabaseError)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIIDBDatabaseError)
+  NS_INTERFACE_MAP_ENTRY(nsIIDBDatabaseError)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBDatabaseError)
+NS_INTERFACE_MAP_END
+
+DOMCI_DATA(IDBDatabaseError, IDBDatabaseError)
+
+NS_IMETHODIMP
+IDBDatabaseError::GetCode(PRUint16* aCode)
+{
+  *aCode = mCode;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseError::SetCode(PRUint16 aCode)
+{
+  mCode = aCode;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseError::GetMessage(nsAString& aMessage)
+{
+  aMessage.Assign(mMessage);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseError::SetMessage(const nsAString& aMessage)
+{
+  mMessage.Assign(aMessage);
+  return NS_OK;
+}
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IDBDatabaseError.h
@@ -0,0 +1,76 @@
+/* -*- 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_idbdatabaseerror_h__
+#define mozilla_dom_indexeddb_idbdatabaseerror_h__
+
+#include "mozilla/dom/indexedDB/IndexedDatabase.h"
+
+#include "nsIIDBDatabaseError.h"
+
+#include "nsStringGlue.h"
+
+BEGIN_INDEXEDDB_NAMESPACE
+
+class IDBRequest;
+
+class IDBDatabaseError : public nsIIDBDatabaseError
+{
+  friend class IDBRequest;
+
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIIDBDATABASEERROR
+
+protected:
+  // Only called by IDBRequest.
+  IDBDatabaseError(PRUint16 aCode,
+                   const nsAString& aMessage)
+  : mCode(aCode),
+    mMessage(aMessage)
+  { }
+
+protected:
+  PRUint16 mCode;
+  nsString mMessage;
+};
+
+END_INDEXEDDB_NAMESPACE
+
+#endif // mozilla_dom_indexeddb_idbdatabaseerror_h__
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IDBDatabaseRequest.cpp
@@ -0,0 +1,219 @@
+/* -*- 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 "nsDOMClassInfo.h"
+
+#include "IDBRequest.h"
+
+USING_INDEXEDDB_NAMESPACE
+
+namespace {
+
+const PRUint32 kDefaultTimeoutMS = 5000;
+  
+} // anonymous namespace
+
+IDBDatabaseRequest::IDBDatabaseRequest()
+{
+  
+}
+
+NS_IMPL_ADDREF(IDBDatabaseRequest)
+NS_IMPL_RELEASE(IDBDatabaseRequest)
+
+NS_INTERFACE_MAP_BEGIN(IDBDatabaseRequest)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIIDBDatabaseRequest)
+  NS_INTERFACE_MAP_ENTRY(nsIIDBDatabaseRequest)
+  NS_INTERFACE_MAP_ENTRY(nsIIDBDatabase)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBDatabaseRequest)
+NS_INTERFACE_MAP_END
+
+DOMCI_DATA(IDBDatabaseRequest, IDBDatabaseRequest)
+
+NS_IMETHODIMP
+IDBDatabaseRequest::GetName(nsAString& aName)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::GetDescription(nsAString& aDescription)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::GetVersion(nsAString& aVersion)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::GetObjectStores(nsIDOMDOMStringList** aObjectStores)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::GetIndexes(nsIDOMDOMStringList** aIndexes)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::GetCurrentTransaction(nsIIDBTransaction** aTransaction)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::CreateObjectStore(const nsAString& aName,
+                                      const nsAString& aKeyPath,
+                                      PRBool aAutoIncrement,
+                                      nsIIDBRequest** _retval)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::OpenObjectStore(const nsAString& aName,
+                                    PRUint16 aMode,
+                                    nsIIDBRequest** _retval)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::CreateIndex(const nsAString& aName,
+                                const nsAString& aStoreName,
+                                const nsAString& aKeyPath,
+                                PRBool aUnique,
+                                nsIIDBRequest** _retval)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::OpenIndex(const nsAString& aName,
+                              nsIIDBRequest** _retval)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::RemoveObjectStore(const nsAString& aStoreName,
+                                      nsIIDBRequest** _retval)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::RemoveIndex(const nsAString& aIndexName,
+                                nsIIDBRequest** _retval)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::SetVersion(const nsAString& aVersion,
+                               nsIIDBRequest** _retval)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBDatabaseRequest::OpenTransaction(nsIDOMDOMStringList* aStoreNames,
+                                    PRUint32 aTimeout,
+                                    PRUint8 aArgCount,
+                                    nsIIDBRequest** _retval)
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+
+  if (aArgCount < 2) {
+    aTimeout = kDefaultTimeoutMS;
+  }
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+
+  return NS_OK;
+}
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IDBDatabaseRequest.h
@@ -0,0 +1,62 @@
+/* -*- 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/IndexedDatabase.h"
+
+#include "nsIIDBDatabaseRequest.h"
+
+BEGIN_INDEXEDDB_NAMESPACE
+
+class IDBDatabaseRequest : public nsIIDBDatabaseRequest
+{
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIIDBDATABASE
+  NS_DECL_NSIIDBDATABASEREQUEST
+
+protected:
+  IDBDatabaseRequest();
+};
+
+END_INDEXEDDB_NAMESPACE
+
+#endif // mozilla_dom_indexeddb_idbdatabaserequest_h__
rename from dom/src/storage/IDBRequest.cpp
rename to dom/indexedDB/IDBRequest.cpp
--- a/dom/src/storage/IDBRequest.cpp
+++ b/dom/indexedDB/IDBRequest.cpp
@@ -8,114 +8,160 @@
  * 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 code.
+ * The Original Code is Indexed Database.
  *
  * The Initial Developer of the Original Code is
- * Mozilla Foundation.
+ * 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 "nsString.h"
+
 #include "nsIScriptContext.h"
+#include "nsIVariant.h"
 
-namespace mozilla {
-namespace dom {
-namespace idb {
+#include "nsComponentManagerUtils.h"
+#include "nsDOMClassInfo.h"
+#include "nsStringGlue.h"
+
+USING_INDEXEDDB_NAMESPACE
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Request
 
 #define SUCCESS_EVT_STR "success"
 #define ERROR_EVT_STR "error"
 
-Request::Request()
-: mReadyState(INITIAL)
+IDBRequest::IDBRequest(nsISupports* aSource)
+: mReadyState(INITIAL),
+  mSource(aSource)
+{
+  NS_ASSERTION(mSource, "Null source!");
+}
+
+IDBRequest::~IDBRequest()
 {
+  if (mListenerManager) {
+    mListenerManager->Disconnect();
+  }
+}
+
+nsresult
+IDBRequest::SetResult(nsISupports* aResult)
+{
+  if (!mResult) {
+    mResult = do_CreateInstance(NS_VARIANT_CONTRACTID);
+    NS_ENSURE_TRUE(mResult, NS_ERROR_FAILURE);
+  }
+
+  return mResult->SetAsISupports(aResult);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIIDBRequest
 
 NS_IMETHODIMP
-Request::GetReadyState(PRUint16* aReadyState)
+IDBRequest::Abort()
+{
+  NS_NOTYETIMPLEMENTED("Implement me!");
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+IDBRequest::GetReadyState(PRUint16* aReadyState)
 {
   *aReadyState = mReadyState;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-Request::SetOnsuccess(nsIDOMEventListener* aSuccessListener)
+IDBRequest::GetError(nsIIDBDatabaseError** aError)
+{
+  nsCOMPtr<nsIIDBDatabaseError> error(mError);
+  error.forget(aError);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBRequest::GetResult(nsIVariant** aResult)
+{
+  nsCOMPtr<nsIVariant> result(mResult);
+  result.forget(aResult);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+IDBRequest::SetOnsuccess(nsIDOMEventListener* aSuccessListener)
 {
   return RemoveAddEventListener(NS_LITERAL_STRING(SUCCESS_EVT_STR),
                                 mOnSuccessListener, aSuccessListener);
 }
 
 NS_IMETHODIMP
-Request::GetOnsuccess(nsIDOMEventListener** aSuccessListener)
+IDBRequest::GetOnsuccess(nsIDOMEventListener** aSuccessListener)
 {
   return GetInnerEventListener(mOnSuccessListener, aSuccessListener);
 }
 
 NS_IMETHODIMP
-Request::SetOnerror(nsIDOMEventListener* aErrorListener)
+IDBRequest::SetOnerror(nsIDOMEventListener* aErrorListener)
 {
   return RemoveAddEventListener(NS_LITERAL_STRING(ERROR_EVT_STR),
                                 mOnErrorListener, aErrorListener);
 }
 
 NS_IMETHODIMP
-Request::GetOnerror(nsIDOMEventListener** aErrorListener)
+IDBRequest::GetOnerror(nsIDOMEventListener** aErrorListener)
 {
   return GetInnerEventListener(mOnErrorListener, aErrorListener);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsISupports
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(Request)
+NS_IMPL_CYCLE_COLLECTION_CLASS(IDBRequest)
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(Request,
+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(Request,
+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(Request)
+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(Request, nsDOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(Request, nsDOMEventTargetHelper)
+NS_IMPL_ADDREF_INHERITED(IDBRequest, nsDOMEventTargetHelper)
+NS_IMPL_RELEASE_INHERITED(IDBRequest, nsDOMEventTargetHelper)
 
-} // namespace idb
-} // namepsace dom
-} // namespace mozilla
+DOMCI_DATA(IDBRequest, IDBRequest)
rename from dom/src/storage/IDBRequest.h
rename to dom/indexedDB/IDBRequest.h
--- a/dom/src/storage/IDBRequest.h
+++ b/dom/indexedDB/IDBRequest.h
@@ -8,69 +8,83 @@
  * 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 code.
+ * The Original Code is Indexed Database.
  *
  * The Initial Developer of the Original Code is
- * Mozilla Foundation.
+ * 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_idb_request_h__
-#define mozilla_dom_idb_request_h__
+#ifndef mozilla_dom_indexeddb_idbrequest_h__
+#define mozilla_dom_indexeddb_idbrequest_h__
+
+#include "mozilla/dom/indexedDB/IndexedDatabase.h"
+#include "mozilla/dom/indexedDB/IDBDatabaseError.h"
 
 #include "nsIIDBRequest.h"
+#include "nsIVariant.h"
+
 #include "nsDOMEventTargetHelper.h"
 #include "nsCycleCollectionParticipant.h"
+#include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 
-namespace mozilla {
-namespace dom {
-namespace idb {
+BEGIN_INDEXEDDB_NAMESPACE
 
-class Request : public nsDOMEventTargetHelper
-              , public nsIIDBRequest
+class IndexedDatabaseRequest;
+class IDBDatabaseRequest;
+
+class IDBRequest : public nsDOMEventTargetHelper,
+                   public nsIIDBRequest
 
 {
+  friend class IndexedDatabaseRequest;
+  friend class IDBDatabaseRequest;
+
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIIDBREQUEST
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Request,
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IDBRequest,
                                            nsDOMEventTargetHelper)
 
-  Request();
+  nsresult SetResult(nsISupports* aResult);
+
+protected:
+  IDBRequest(nsISupports* aSource);
+  ~IDBRequest();
 
 protected:
   PRUint16 mReadyState;
-
-private:
   nsRefPtr<nsDOMEventListenerWrapper> mOnSuccessListener;
   nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener;
+  nsRefPtr<IDBDatabaseError> mError;
+  nsCOMPtr<nsIWritableVariant> mResult;
+  nsCOMPtr<nsISupports> mSource;
 };
 
-} // namespace idb
-} // namepsace dom
-} // namespace mozilla
+END_INDEXEDDB_NAMESPACE
 
-#endif // mozilla_dom_idb_request_h__
+#endif // mozilla_dom_indexeddb_idbrequest_h__
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IndexedDatabase.h
@@ -0,0 +1,55 @@
+/* -*- 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_indexeddatabase_h__
+#define mozilla_dom_indexeddb_indexeddatabase_h__
+
+#include "nsIProgrammingLanguage.h"
+
+#define BEGIN_INDEXEDDB_NAMESPACE \
+  namespace mozilla { namespace dom { namespace indexedDB {
+
+#define END_INDEXEDDB_NAMESPACE \
+  } /* namespace indexedDB */ } /* namepsace dom */ } /* namespace mozilla */
+
+#define USING_INDEXEDDB_NAMESPACE \
+  using namespace mozilla::dom::indexedDB;
+
+#endif // mozilla_dom_indexeddb_indexeddatabase_h__
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IndexedDatabaseRequest.cpp
@@ -0,0 +1,87 @@
+/* -*- 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 "IndexedDatabaseRequest.h"
+
+#include "nsDOMClassInfo.h"
+
+#include "IDBRequest.h"
+
+USING_INDEXEDDB_NAMESPACE
+
+// static
+already_AddRefed<nsIIndexedDatabaseRequest>
+IndexedDatabaseRequest::Create()
+{
+  nsCOMPtr<nsIIndexedDatabaseRequest> request(new IndexedDatabaseRequest());
+  return request.forget();
+}
+
+IndexedDatabaseRequest::IndexedDatabaseRequest()
+{
+  
+}
+
+NS_IMPL_ADDREF(IndexedDatabaseRequest)
+NS_IMPL_RELEASE(IndexedDatabaseRequest)
+
+NS_INTERFACE_MAP_BEGIN(IndexedDatabaseRequest)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIIndexedDatabaseRequest)
+  NS_INTERFACE_MAP_ENTRY(nsIIndexedDatabaseRequest)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IndexedDatabaseRequest)
+NS_INTERFACE_MAP_END
+
+DOMCI_DATA(IndexedDatabaseRequest, IndexedDatabaseRequest)
+
+NS_IMETHODIMP
+IndexedDatabaseRequest::Open(const nsAString& aName,
+                             const nsAString& aDescription,
+                             PRBool aModifyDatabase,
+                             PRUint8 aArgCount,
+                             nsIIDBRequest** _retval)
+{
+  if (aArgCount < 3) {
+    // aModifyDatabase defaults to true.
+    aModifyDatabase = PR_TRUE;
+  }
+
+  nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
+  request.forget(_retval);
+  return NS_OK;
+}
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/IndexedDatabaseRequest.h
@@ -0,0 +1,66 @@
+/* -*- 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_indexeddatabaserequest_h__
+#define mozilla_dom_indexeddb_indexeddatabaserequest_h__
+
+#include "mozilla/dom/indexedDB/IndexedDatabase.h"
+
+#include "nsIIndexedDatabaseRequest.h"
+
+#include "nsCOMPtr.h"
+
+BEGIN_INDEXEDDB_NAMESPACE
+
+class IndexedDatabaseRequest : public nsIIndexedDatabaseRequest
+{
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIINDEXEDDATABASEREQUEST
+
+  static already_AddRefed<nsIIndexedDatabaseRequest> Create();
+
+protected:
+  // Only called by Create().
+  IndexedDatabaseRequest();
+};
+
+END_INDEXEDDB_NAMESPACE
+
+#endif // mozilla_dom_indexeddb_indexeddatabaserequest_h__
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/Makefile.in
@@ -0,0 +1,90 @@
+# ***** 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 *****
+
+DEPTH = ../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = dom
+LIBRARY_NAME = domindexedDB_s
+XPIDL_MODULE = domindexedDB
+LIBXUL_LIBRARY = 1
+FORCE_STATIC_LIB = 1
+
+EXPORTS_NAMESPACES = mozilla/dom/indexedDB
+
+CPPSRCS = \
+  IDBDatabaseError.cpp \
+  IDBDatabaseRequest.cpp \
+  IDBRequest.cpp \
+  IndexedDatabaseRequest.cpp \
+  $(NULL)
+
+EXPORTS_mozilla/dom/indexedDB = \
+  IDBDatabaseError.h \
+  IDBDatabaseRequest.h \
+  IDBRequest.h \
+  IndexedDatabase.h \
+  IndexedDatabaseRequest.h \
+  $(NULL)
+
+LOCAL_INCLUDES = \
+  -I$(topsrcdir)/dom/base \
+  -I$(topsrcdir)/content/events/src
+  $(NULL)
+
+DEFINES += -D_IMPL_NS_LAYOUT
+
+XPIDLSRCS = \
+  nsIIDBDatabase.idl \
+  nsIIDBDatabaseError.idl \
+  nsIIDBDatabaseRequest.idl \
+  nsIIDBRequest.idl \
+  nsIIDBTransaction.idl \
+  nsIIDBTransactionRequest.idl \
+  nsIIndexedDatabaseRequest.idl \
+  $(NULL)
+
+ifdef ENABLE_TESTS
+DIRS += test
+endif
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/nsIIDBDatabase.idl
@@ -0,0 +1,64 @@
+/* -*- 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 "nsISupports.idl"
+
+interface nsIDOMDOMStringList;
+interface nsIIDBTransaction;
+
+/**
+ * IDBDatabase interface.  See
+ * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDatabase for more
+ * information.
+ */
+[scriptable, uuid(828a5080-6912-4e4d-afe0-57846788eb2e)]
+interface nsIIDBDatabase : nsISupports
+{
+  readonly attribute DOMString name;
+
+  readonly attribute DOMString description;
+
+  readonly attribute DOMString version;
+
+  readonly attribute nsIDOMDOMStringList objectStores;
+
+  readonly attribute nsIDOMDOMStringList indexes;
+
+  readonly attribute nsIIDBTransaction currentTransaction;
+};
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/nsIIDBDatabaseError.idl
@@ -0,0 +1,64 @@
+/* -*- 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 "nsISupports.idl"
+
+/**
+ * IDBDatabaseError interface.  See
+ * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDatabaseError for more
+ * information.
+ */
+[scriptable, uuid(7369d3ad-8742-4642-a538-e93bfcf896b3)]
+interface nsIIDBDatabaseError : nsISupports
+{
+  const unsigned short UNKNOWN_ERR = 0;
+  const unsigned short NON_TRANSIENT_ERR = 1;
+  const unsigned short NOT_FOUND_ERR = 2;
+  const unsigned short CONSTRAINT_ERR = 3;
+  const unsigned short DATA_ERR = 4;
+  const unsigned short NOT_ALLOWED_ERR = 5;
+  const unsigned short SERIAL_ERR = 11;
+  const unsigned short RECOVERABLE_ERR = 21;
+  const unsigned short TRANSIENT_ERR = 31;
+  const unsigned short TIMEOUT_ERR = 32;
+  const unsigned short DEADLOCK_ERR = 33;
+  attribute unsigned short code;
+
+  attribute DOMString message;
+};
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/nsIIDBDatabaseRequest.idl
@@ -0,0 +1,87 @@
+/* -*- 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 "nsIIDBDatabase.idl"
+
+interface nsIDOMDOMStringList;
+interface nsIIDBRequest;
+
+/**
+ * IDBDatabaseRequest interface.  See
+ * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDatabaseRequest for
+ * more information.
+ */
+[scriptable, uuid(8f475c0a-e332-41ba-ba27-156370a63486)]
+interface nsIIDBDatabaseRequest : nsIIDBDatabase
+{
+  nsIIDBRequest
+  createObjectStore(in DOMString name,
+                    in DOMString keyPath,
+                    [optional /* false */] in boolean autoIncrement);
+
+  const unsigned short READ_WRITE = 0;
+  const unsigned short READ_ONLY = 1;
+  const unsigned short SNAPSHOT_READ = 2;
+  nsIIDBRequest
+  openObjectStore(in DOMString name,
+                  [optional /* READ_WRITE */] in unsigned short mode);
+
+  nsIIDBRequest
+  createIndex(in DOMString name,
+              in DOMString storeName,
+              in DOMString keyPath,
+              [optional /* false */] in boolean unique);
+
+  nsIIDBRequest
+  openIndex(in DOMString name);
+
+  nsIIDBRequest
+  removeObjectStore(in DOMString storeName);
+
+  nsIIDBRequest
+  removeIndex(in DOMString indexName);
+
+  nsIIDBRequest
+  setVersion(in DOMString version);
+
+  [optional_argc]
+  nsIIDBRequest
+  openTransaction([optional /* null */]in nsIDOMDOMStringList storeNames,
+                  [optional /* 5000ms */] in unsigned long timeout);
+};
rename from dom/interfaces/storage/nsIIDBRequest.idl
rename to dom/indexedDB/nsIIDBRequest.idl
--- a/dom/interfaces/storage/nsIIDBRequest.idl
+++ b/dom/indexedDB/nsIIDBRequest.idl
@@ -8,55 +8,58 @@
  * 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 code.
+ * The Original Code is Indexed Database.
  *
  * The Initial Developer of the Original Code is
- * Mozilla Foundation.
+ * 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 "nsISupports.idl"
+
+interface nsIDOMEventListener;
 interface nsIIDBDatabaseError;
 interface nsIVariant;
-interface nsIDOMEventListener;
 
 /**
  * IDBReqeust interface.  See
  * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBRequest for more
  * information.
  */
 [scriptable, uuid(2cff021d-e80e-48a7-bb45-00172df02c1c)]
 // TODO inherit from nsIEventTarget when the spec is updated.
 interface nsIIDBRequest : nsISupports
 {
-  void abort();
+  void
+  abort();
 
   const unsigned short INITIAL = 0;
   const unsigned short LOADING = 1;
   const unsigned short DONE = 2;
   readonly attribute unsigned short readyState;
 
   readonly attribute nsIIDBDatabaseError error;
 
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/nsIIDBTransaction.idl
@@ -0,0 +1,55 @@
+/* -*- 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 "nsISupports.idl"
+
+interface nsIIDBDatabase;
+
+/**
+ * IDBDTransaction interface.  See
+ * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDTransaction for more
+ * information.
+ */
+[scriptable, uuid(00c3f651-f4bf-416b-9dc4-759135a35fa9)]
+interface nsIIDBTransaction : nsISupports
+{
+  attribute boolean static;
+
+  attribute nsIIDBDatabase db;
+};
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/nsIIDBTransactionRequest.idl
@@ -0,0 +1,57 @@
+/* -*- 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 "nsIIDBTransaction.idl"
+
+interface nsIIDBRequest;
+
+/**
+ * IDBDTransactionRequest interface.  See
+ * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDTransactionRequest for
+ * more information.
+ */
+[scriptable, uuid(073f5f2e-fecc-4f96-bba2-d8a90532c926)]
+interface nsIIDBTransactionRequest : nsIIDBTransaction
+{
+  nsIIDBRequest
+  abort();
+
+  nsIIDBRequest
+  commit();
+};
rename from dom/interfaces/storage/nsIIndexedDatabaseRequest.idl
rename to dom/indexedDB/nsIIndexedDatabaseRequest.idl
--- a/dom/interfaces/storage/nsIIndexedDatabaseRequest.idl
+++ b/dom/indexedDB/nsIIndexedDatabaseRequest.idl
@@ -8,25 +8,26 @@
  * 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 code.
+ * The Original Code is Indexed Database.
  *
  * The Initial Developer of the Original Code is
- * Mozilla Foundation.
+ * 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
@@ -34,17 +35,24 @@
  * 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 "nsISupports.idl"
 
+interface nsIIDBRequest;
+
 /**
  * Interface that defines the indexedDB property on a window.  See
  * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IndexedDatabaseRequest
  * for more information.
  */
 [scriptable, uuid(043161e0-93b8-43b4-94d8-f34046d679b4)]
 interface nsIIndexedDatabaseRequest : nsISupports
 {
+  [optional_argc]
+  nsIIDBRequest
+  open(in DOMString name,
+       in DOMString description,
+       [optional /* true */] in boolean modifyDatabase);
 };
rename from dom/tests/mochitest/indexeddb/Makefile.in
rename to dom/indexedDB/test/Makefile.in
--- a/dom/tests/mochitest/indexeddb/Makefile.in
+++ b/dom/indexedDB/test/Makefile.in
@@ -9,17 +9,17 @@
 # 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 Test Code.
 #
 # The Initial Developer of the Original Code is
-# Mozilla Foundation.
+# 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
@@ -30,21 +30,21 @@
 # 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 *****
 
-DEPTH = ../../../..
+DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
-relativesrcdir = dom/tests/mochitest/indexeddb
+relativesrcdir = dom/src/indexeddb/test
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES = \
   test_property_on_window.html \
   $(NULL)
 
rename from dom/tests/mochitest/indexeddb/test_property_on_window.html
rename to dom/indexedDB/test/test_property_on_window.html
--- a/dom/interfaces/storage/Makefile.in
+++ b/dom/interfaces/storage/Makefile.in
@@ -58,13 +58,11 @@ XPIDLSRCS =                             
 SDK_XPIDLSRCS =                      \
         nsIDOMStorage.idl        \
         nsIDOMStorageObsolete.idl\
         nsIDOMStorageEvent.idl   \
         nsIDOMStorageEventObsolete.idl \
         nsIDOMStorageItem.idl    \
         nsIDOMStorageList.idl    \
         nsIDOMStorageWindow.idl  \
-        nsIIndexedDatabaseRequest.idl \
-        nsIIDBRequest.idl \
        $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/src/Makefile.in
+++ b/dom/src/Makefile.in
@@ -30,18 +30,26 @@
 # 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 *****
 
-DEPTH		= ../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
+DEPTH     = ../..
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS		= jsurl events storage offline json geolocation threads
+DIRS = \
+  jsurl \
+  events \
+  storage \
+  offline \
+  json \
+  geolocation \
+  threads \
+  $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/src/storage/Makefile.in
+++ b/dom/src/storage/Makefile.in
@@ -48,17 +48,16 @@ LIBXUL_LIBRARY = 1
 
 
 
 CPPSRCS = \
   nsDOMStorage.cpp \
   nsDOMStorageDBWrapper.cpp \
   nsDOMStoragePersistentDB.cpp \
   nsDOMStorageMemoryDB.cpp \
-  IDBRequest.cpp \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 LOCAL_INCLUDES = \
                 -I$(topsrcdir)/dom/base \
 		-I$(topsrcdir)/content/events/src
--- a/dom/tests/mochitest/Makefile.in
+++ b/dom/tests/mochitest/Makefile.in
@@ -51,13 +51,12 @@ DIRS	+= \
 	bugs \
 	chrome \
 	general \
 	whatwg \
 	geolocation \
 	localstorage \
 	sessionstorage \
 	storageevent \
-	indexeddb \
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
--- a/js/src/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/src/xpconnect/src/dom_quickstubs.qsconf
@@ -378,16 +378,25 @@ members = [
     'nsIDOMNSHTMLOptionElement.text',
     'nsIDOMNSHTMLSelectElement.item',
     'nsIDOMNSHTMLTextAreaElement.setSelectionRange',
     'nsIDOMNSHTMLTextAreaElement.selectionStart',
     'nsIDOMNSHTMLTextAreaElement.selectionEnd',
     'nsIDOMNSHTMLTextAreaElement.textLength',
     'nsIDOMNSHTMLTextAreaElement.wrap',
 
+    # dom/interfaces/indexedDB
+    'nsIIDBDatabase.*',
+    'nsIIDBDatabaseError.*',
+    'nsIIDBDatabaseRequest.*',
+    'nsIIDBRequest.*',
+    'nsIIDBTransaction.*',
+    'nsIIDBTransactionRequest.*',
+    'nsIIndexedDatabaseRequest.*',
+
     # dom/interfaces/json - None.
     # All 4 methods of nsIJSON call GetCurrentNativeCallContext.
 
     # dom/interfaces/load-save - None.
 
     # dom/interfaces/offline - None.
 
     # dom/interfaces/range
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -100,16 +100,17 @@ SHARED_LIBRARY_LIBS = \
 	$(DEPTH)/dom/base/$(LIB_PREFIX)jsdombase_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/events/$(LIB_PREFIX)jsdomevents_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/json/$(LIB_PREFIX)json_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/jsurl/$(LIB_PREFIX)jsurl_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/storage/$(LIB_PREFIX)jsdomstorage_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/offline/$(LIB_PREFIX)jsdomoffline_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/geolocation/$(LIB_PREFIX)jsdomgeolocation_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/threads/$(LIB_PREFIX)domthreads_s.$(LIB_SUFFIX) \
+	$(DEPTH)/dom/indexedDB/$(LIB_PREFIX)domindexedDB_s.$(LIB_SUFFIX) \
 	$(DEPTH)/editor/libeditor/text/$(LIB_PREFIX)texteditor_s.$(LIB_SUFFIX) \
 	$(DEPTH)/editor/libeditor/base/$(LIB_PREFIX)editorbase_s.$(LIB_SUFFIX) \
 	$(DEPTH)/parser/html/$(LIB_PREFIX)html5p_s.$(LIB_SUFFIX) \
 	$(NULL)
 
 ifdef MOZ_MEDIA
 SHARED_LIBRARY_LIBS 	+= \
 	$(DEPTH)/content/media/$(LIB_PREFIX)gkconmedia_s.$(LIB_SUFFIX) \