Bug 771288 - Multiprocess FileHandle support (FileHandle on PBackground); Part 1 - Remove unused stuff; r=bent
authorJan Varga <jan.varga@gmail.com>
Sat, 06 Dec 2014 07:31:53 -0800
changeset 244448 ba5e60f0a2580680a382d64bbdeebc1071d31bd2
parent 244447 d5af1ac09adaff2fad47de3138c1584633519401
child 244449 96dbd5483c059a498a98062077ed8e81d4cc6b7e
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs771288
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 771288 - Multiprocess FileHandle support (FileHandle on PBackground); Part 1 - Remove unused stuff; r=bent
dom/asmjscache/AsmJSCache.cpp
dom/filehandle/FileService.cpp
dom/filehandle/FileService.h
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/ActorsParent.h
dom/indexedDB/IDBFactory.cpp
dom/indexedDB/TransactionThreadPool.cpp
dom/indexedDB/TransactionThreadPool.h
dom/ipc/PContent.ipdl
dom/quota/AcquireListener.h
dom/quota/Client.h
dom/quota/QuotaManager.cpp
dom/quota/QuotaManager.h
dom/quota/moz.build
dom/quota/nsIOfflineStorage.h
ipc/glue/BackgroundChildImpl.cpp
ipc/glue/BackgroundChildImpl.h
ipc/glue/BackgroundParentImpl.cpp
ipc/glue/BackgroundParentImpl.h
ipc/glue/PBackground.ipdl
--- a/dom/asmjscache/AsmJSCache.cpp
+++ b/dom/asmjscache/AsmJSCache.cpp
@@ -1853,28 +1853,16 @@ public:
   virtual void
   WaitForStoragesToComplete(nsTArray<nsIOfflineStorage*>& aStorages,
                             nsIRunnable* aCallback) MOZ_OVERRIDE
   {
     MOZ_ASSERT_UNREACHABLE("There are no storages");
   }
 
   virtual void
-  AbortTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE
-  {
-    MOZ_ASSERT_UNREACHABLE("There are no storages");
-  }
-
-  virtual bool
-  HasTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE
-  {
-    return false;
-  }
-
-  virtual void
   ShutdownTransactionService() MOZ_OVERRIDE
   { }
 
 private:
   nsAutoRefCnt mRefCnt;
   NS_DECL_OWNINGTHREAD
 };
 
--- a/dom/filehandle/FileService.cpp
+++ b/dom/filehandle/FileService.cpp
@@ -286,30 +286,16 @@ FileService::AbortFileHandlesForStorage(
   storageInfo->CollectRunningAndDelayedFileHandles(aStorage, fileHandles);
 
   for (uint32_t index = 0; index < fileHandles.Length(); index++) {
     ErrorResult ignored;
     fileHandles[index]->Abort(ignored);
   }
 }
 
-bool
-FileService::HasFileHandlesForStorage(nsIOfflineStorage* aStorage)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
-  MOZ_ASSERT(aStorage, "Null pointer!");
-
-  StorageInfo* storageInfo;
-  if (!mStorageInfos.Get(aStorage->Id(), &storageInfo)) {
-    return false;
-  }
-
-  return storageInfo->HasRunningFileHandles(aStorage);
-}
-
 NS_IMPL_ISUPPORTS(FileService, nsIObserver)
 
 NS_IMETHODIMP
 FileService::Observe(nsISupports* aSubject, const char*  aTopic,
                      const char16_t* aData)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(!strcmp(aTopic, "profile-before-change"), "Wrong topic!");
@@ -488,28 +474,16 @@ FileService::StorageInfo::RemoveFileHand
     DelayedEnqueueInfo& delayedEnqueueInfo = delayedEnqueueInfos[index];
     if (NS_FAILED(gInstance->Enqueue(delayedEnqueueInfo.mFileHandle,
                                      delayedEnqueueInfo.mFileHelper))) {
       NS_WARNING("Enqueue failed!");
     }
   }
 }
 
-bool
-FileService::StorageInfo::HasRunningFileHandles(nsIOfflineStorage* aStorage)
-{
-  for (uint32_t index = 0; index < mFileHandleQueues.Length(); index++) {
-    FileHandleBase* fileHandle = mFileHandleQueues[index]->mFileHandle;
-    if (fileHandle->MutableFile()->Storage() == aStorage) {
-      return true;
-    }
-  }
-  return false;
-}
-
 FileService::DelayedEnqueueInfo*
 FileService::StorageInfo::CreateDelayedEnqueueInfo(FileHandleBase* aFileHandle,
                                                    FileHelper* aFileHelper)
 {
   DelayedEnqueueInfo* info = mDelayedEnqueueInfos.AppendElement();
   info->mFileHandle = aFileHandle;
   info->mFileHelper = aFileHelper;
   return info;
--- a/dom/filehandle/FileService.h
+++ b/dom/filehandle/FileService.h
@@ -57,19 +57,16 @@ public:
 
   void
   WaitForStoragesToComplete(nsTArray<nsCOMPtr<nsIOfflineStorage> >& aStorages,
                             nsIRunnable* aCallback);
 
   void
   AbortFileHandlesForStorage(nsIOfflineStorage* aStorage);
 
-  bool
-  HasFileHandlesForStorage(nsIOfflineStorage* aStorage);
-
   nsIEventTarget*
   StreamTransportTarget()
   {
     NS_ASSERTION(mStreamTransportTarget, "This should never be null!");
     return mStreamTransportTarget;
   }
 
 private:
@@ -130,19 +127,16 @@ private:
     RemoveFileHandleQueue(FileHandleBase* aFileHandle);
 
     bool
     HasRunningFileHandles()
     {
       return !mFileHandleQueues.IsEmpty();
     }
 
-    inline bool
-    HasRunningFileHandles(nsIOfflineStorage* aStorage);
-
     inline DelayedEnqueueInfo*
     CreateDelayedEnqueueInfo(FileHandleBase* aFileHandle,
                              FileHelper* aFileHelper);
 
     inline void
     CollectRunningAndDelayedFileHandles(
                               nsIOfflineStorage* aStorage,
                               nsTArray<nsRefPtr<FileHandleBase>>& aFileHandles);
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -2774,29 +2774,27 @@ private:
 
 class Factory MOZ_FINAL
   : public PBackgroundIDBFactoryParent
 {
   // Counts the number of "live" Factory instances that have not yet had
   // ActorDestroy called.
   static uint64_t sFactoryInstanceCount;
 
-  const OptionalWindowId mOptionalWindowId;
-
   DebugOnly<bool> mActorDestroyed;
 
 public:
   static already_AddRefed<Factory>
-  Create(const OptionalWindowId& aOptionalWindowId);
+  Create();
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(mozilla::dom::indexedDB::Factory)
 
 private:
   // Only constructed in Create().
-  explicit Factory(const OptionalWindowId& aOptionalWindowId);
+  explicit Factory();
 
   // Reference counted.
   ~Factory();
 
   // IPDL methods are only called by IPDL.
   virtual void
   ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
 
@@ -2839,17 +2837,16 @@ class Database MOZ_FINAL
   nsRefPtr<FileManager> mFileManager;
   nsRefPtr<DatabaseOfflineStorage> mOfflineStorage;
   nsTHashtable<nsPtrHashKey<TransactionBase>> mTransactions;
   const PrincipalInfo mPrincipalInfo;
   const nsCString mGroup;
   const nsCString mOrigin;
   const nsCString mId;
   const nsString mFilePath;
-  Atomic<bool> mInvalidatedOnAnyThread;
   const PersistenceType mPersistenceType;
   const bool mChromeWriteAccessAllowed;
   bool mClosed;
   bool mInvalidated;
   bool mActorWasAlive;
   bool mActorDestroyed;
   bool mMetadataCleanedUp;
 
@@ -4045,42 +4042,41 @@ struct FactoryOp::MaybeBlockedDatabaseIn
 class OpenDatabaseOp MOZ_FINAL
   : public FactoryOp
 {
   friend class Database;
   friend class VersionChangeTransaction;
 
   class VersionChangeOp;
 
-  const OptionalWindowId mOptionalWindowId;
-  const OptionalWindowId mOptionalContentParentId;
+  const OptionalContentId mOptionalContentParentId;
 
   nsRefPtr<FullDatabaseMetadata> mMetadata;
 
   uint64_t mRequestedVersion;
   nsString mDatabaseFilePath;
   nsRefPtr<FileManager> mFileManager;
 
   nsRefPtr<Database> mDatabase;
   nsRefPtr<VersionChangeTransaction> mVersionChangeTransaction;
 
   nsRefPtr<DatabaseOfflineStorage> mOfflineStorage;
 
 public:
   OpenDatabaseOp(Factory* aFactory,
                  already_AddRefed<ContentParent> aContentParent,
-                 const OptionalWindowId& aOptionalWindowId,
                  const CommonFactoryRequestParams& aParams);
 
   bool
   IsOtherProcessActor() const
   {
-    MOZ_ASSERT(mOptionalContentParentId.type() != OptionalWindowId::T__None);
-
-    return mOptionalContentParentId.type() == OptionalWindowId::Tuint64_t;
+    MOZ_ASSERT(mOptionalContentParentId.type() != OptionalContentId::T__None);
+
+    return mOptionalContentParentId.type() ==
+             OptionalContentId::TContentParentId;
   }
 
 private:
   ~OpenDatabaseOp()
   { }
 
   nsresult
   LoadDatabaseInformation(mozIStorageConnection* aConnection);
@@ -5142,22 +5138,16 @@ public:
   virtual bool
   IsTransactionServiceActivated() MOZ_OVERRIDE;
 
   virtual void
   WaitForStoragesToComplete(nsTArray<nsIOfflineStorage*>& aStorages,
                             nsIRunnable* aCallback) MOZ_OVERRIDE;
 
   virtual void
-  AbortTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE;
-
-  virtual bool
-  HasTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE;
-
-  virtual void
   ShutdownTransactionService() MOZ_OVERRIDE;
 
 private:
   ~QuotaClient();
 
   nsresult
   GetDirectory(PersistenceType aPersistenceType,
                const nsACString& aOrigin,
@@ -5259,34 +5249,31 @@ class DatabaseOfflineStorage MOZ_FINAL
   nsRefPtr<QuotaClient> mStrongQuotaClient;
 
   // Only used on the main thread.
   QuotaClient* mWeakQuotaClient;
 
   // Only used on the background thread.
   Database* mDatabase;
 
-  const OptionalWindowId mOptionalWindowId;
-  const OptionalWindowId mOptionalContentParentId;
+  const OptionalContentId mOptionalContentParentId;
   const nsCString mOrigin;
   const nsCString mId;
   nsCOMPtr<nsIEventTarget> mOwningThread;
-  Atomic<uint32_t> mTransactionCount;
 
   bool mClosedOnMainThread;
   bool mClosedOnOwningThread;
   bool mInvalidatedOnMainThread;
   bool mInvalidatedOnOwningThread;
 
   DebugOnly<bool> mRegisteredWithQuotaManager;
 
 public:
   DatabaseOfflineStorage(QuotaClient* aQuotaClient,
-                         const OptionalWindowId& aOptionalWindowId,
-                         const OptionalWindowId& aOptionalContentParentId,
+                         const OptionalContentId& aOptionalContentParentId,
                          const nsACString& aGroup,
                          const nsACString& aOrigin,
                          const nsACString& aId,
                          PersistenceType aPersistenceType,
                          nsIEventTarget* aOwningThread);
 
   static void
   UnregisterOnOwningThread(
@@ -5297,43 +5284,16 @@ public:
   {
     AssertIsOnBackgroundThread();
     MOZ_ASSERT(aDatabase);
     MOZ_ASSERT(!mDatabase);
 
     mDatabase = aDatabase;
   }
 
-  void
-  NoteNewTransaction()
-  {
-    AssertIsOnBackgroundThread();
-    MOZ_ASSERT(mTransactionCount < UINT32_MAX);
-
-    mTransactionCount++;
-  }
-
-  void
-  NoteFinishedTransaction()
-  {
-    AssertIsOnBackgroundThread();
-    MOZ_ASSERT(mTransactionCount);
-
-    mTransactionCount--;
-  }
-
-  bool
-  HasOpenTransactions() const
-  {
-    MOZ_ASSERT(NS_IsMainThread());
-
-    // XXX This is racy, is this correct?
-    return !!mTransactionCount;
-  }
-
   nsIEventTarget*
   OwningThread() const
   {
     return mOwningThread;
   }
 
   void
   NoteRegisteredWithQuotaManager()
@@ -5572,41 +5532,30 @@ StaticRefPtr<DEBUGThreadSlower> gDEBUGTh
 
 } // anonymous namespace
 
 /*******************************************************************************
  * Exported functions
  ******************************************************************************/
 
 PBackgroundIDBFactoryParent*
-AllocPBackgroundIDBFactoryParent(PBackgroundParent* aManager,
-                                 const OptionalWindowId& aOptionalWindowId)
-{
-  AssertIsOnBackgroundThread();
-  MOZ_ASSERT(aOptionalWindowId.type() != OptionalWindowId::T__None);
-
-  if (BackgroundParent::IsOtherProcessActor(aManager)) {
-    if (NS_WARN_IF(aOptionalWindowId.type() != OptionalWindowId::Tvoid_t)) {
-      ASSERT_UNLESS_FUZZING();
-      return nullptr;
-    }
-  }
+AllocPBackgroundIDBFactoryParent()
+{
+  AssertIsOnBackgroundThread();
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonMainThread())) {
     return nullptr;
   }
 
-  nsRefPtr<Factory> actor = Factory::Create(aOptionalWindowId);
+  nsRefPtr<Factory> actor = Factory::Create();
   return actor.forget().take();
 }
 
 bool
-RecvPBackgroundIDBFactoryConstructor(PBackgroundParent* /* aManager */,
-                                     PBackgroundIDBFactoryParent* aActor,
-                                     const OptionalWindowId& aOptionalWindowId)
+RecvPBackgroundIDBFactoryConstructor(PBackgroundIDBFactoryParent* aActor)
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aActor);
   MOZ_ASSERT(!QuotaClient::IsShuttingDownOnNonMainThread());
 
   return true;
 }
 
@@ -5779,32 +5728,31 @@ FullDatabaseMetadata::Duplicate() const
 }
 
 /*******************************************************************************
  * Factory
  ******************************************************************************/
 
 uint64_t Factory::sFactoryInstanceCount = 0;
 
-Factory::Factory(const OptionalWindowId& aOptionalWindowId)
-  : mOptionalWindowId(aOptionalWindowId)
-  , mActorDestroyed(false)
+Factory::Factory()
+  : mActorDestroyed(false)
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!QuotaClient::IsShuttingDownOnNonMainThread());
 }
 
 Factory::~Factory()
 {
   MOZ_ASSERT(mActorDestroyed);
 }
 
 // static
 already_AddRefed<Factory>
-Factory::Create(const OptionalWindowId& aOptionalWindowId)
+Factory::Create()
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!QuotaClient::IsShuttingDownOnNonMainThread());
 
   // If this is the first instance then we need to do some initialization.
   if (!sFactoryInstanceCount) {
     if (!gTransactionThreadPool) {
       nsRefPtr<TransactionThreadPool> threadPool =
@@ -5842,17 +5790,17 @@ Factory::Create(const OptionalWindowId& 
 
       gDEBUGThreadSlower = new DEBUGThreadSlower();
 
       MOZ_ALWAYS_TRUE(NS_SUCCEEDED(thread->AddObserver(gDEBUGThreadSlower)));
     }
 #endif // DEBUG
   }
 
-  nsRefPtr<Factory> actor = new Factory(aOptionalWindowId);
+  nsRefPtr<Factory> actor = new Factory();
 
   sFactoryInstanceCount++;
 
   return actor.forget();
 }
 
 void
 Factory::ActorDestroy(ActorDestroyReason aWhy)
@@ -5961,17 +5909,16 @@ Factory::AllocPBackgroundIDBFactoryReque
 
   nsRefPtr<ContentParent> contentParent =
     BackgroundParent::GetContentParent(Manager());
 
   nsRefPtr<FactoryOp> actor;
   if (aParams.type() == FactoryRequestParams::TOpenDatabaseRequestParams) {
     actor = new OpenDatabaseOp(this,
                                contentParent.forget(),
-                               mOptionalWindowId,
                                *commonParams);
   } else {
     actor = new DeleteDatabaseOp(this, contentParent.forget(), *commonParams);
   }
 
   // Transfer ownership to IPDL.
   return actor.forget().take();
 }
@@ -6150,37 +6097,32 @@ Database::RegisterTransaction(Transactio
   MOZ_ASSERT(aTransaction);
   MOZ_ASSERT(!mTransactions.GetEntry(aTransaction));
   MOZ_ASSERT(mOfflineStorage);
 
   if (NS_WARN_IF(!mTransactions.PutEntry(aTransaction, fallible))) {
     return false;
   }
 
-  mOfflineStorage->NoteNewTransaction();
   return true;
 }
 
 void
 Database::UnregisterTransaction(TransactionBase* aTransaction)
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aTransaction);
   MOZ_ASSERT(mTransactions.GetEntry(aTransaction));
 
   mTransactions.RemoveEntry(aTransaction);
 
-  if (mOfflineStorage) {
-    mOfflineStorage->NoteFinishedTransaction();
-
-    if (!mTransactions.Count() && IsClosed()) {
-      DatabaseOfflineStorage::UnregisterOnOwningThread(
-        mOfflineStorage.forget());
-      CleanupMetadata();
-    }
+  if (mOfflineStorage && !mTransactions.Count() && IsClosed()) {
+    DatabaseOfflineStorage::UnregisterOnOwningThread(
+      mOfflineStorage.forget());
+    CleanupMetadata();
   }
 }
 
 void
 Database::SetActorAlive()
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!mActorWasAlive);
@@ -9511,40 +9453,16 @@ QuotaClient::WaitForStoragesToComplete(n
 
   nsCOMPtr<nsIRunnable> runnable =
     new WaitForTransactionsRunnable(this, databaseIds, aCallback);
   MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
     backgroundThread->Dispatch(runnable, NS_DISPATCH_NORMAL)));
 }
 
 void
-QuotaClient::AbortTransactionsForStorage(nsIOfflineStorage* aStorage)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aStorage);
-  MOZ_ASSERT(aStorage->GetClient() == this);
-
-  static_cast<DatabaseOfflineStorage*>(aStorage)->
-    AssertInvalidatedOnMainThread();
-
-  // Nothing to do here, calling DatabaseOfflineStorage::Close() should have
-  // aborted any transactions already.
-}
-
-bool
-QuotaClient::HasTransactionsForStorage(nsIOfflineStorage* aStorage)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aStorage);
-  MOZ_ASSERT(aStorage->GetClient() == this);
-
-  return static_cast<DatabaseOfflineStorage*>(aStorage)->HasOpenTransactions();
-}
-
-void
 QuotaClient::ShutdownTransactionService()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!mShutdownRunnable);
   MOZ_ASSERT(!mShutdownRequested);
 
   mShutdownRequested = true;
 
@@ -9797,47 +9715,38 @@ ShutdownTransactionThreadPoolRunnable::R
   return NS_OK;
 }
 
 /*******************************************************************************
  * DatabaseOfflineStorage
  ******************************************************************************/
 
 DatabaseOfflineStorage::DatabaseOfflineStorage(
-                               QuotaClient* aQuotaClient,
-                               const OptionalWindowId& aOptionalWindowId,
-                               const OptionalWindowId& aOptionalContentParentId,
-                               const nsACString& aGroup,
-                               const nsACString& aOrigin,
-                               const nsACString& aId,
-                               PersistenceType aPersistenceType,
-                               nsIEventTarget* aOwningThread)
+                              QuotaClient* aQuotaClient,
+                              const OptionalContentId& aOptionalContentParentId,
+                              const nsACString& aGroup,
+                              const nsACString& aOrigin,
+                              const nsACString& aId,
+                              PersistenceType aPersistenceType,
+                              nsIEventTarget* aOwningThread)
   : mStrongQuotaClient(aQuotaClient)
   , mWeakQuotaClient(aQuotaClient)
   , mDatabase(nullptr)
-  , mOptionalWindowId(aOptionalWindowId)
   , mOptionalContentParentId(aOptionalContentParentId)
   , mOrigin(aOrigin)
   , mId(aId)
   , mOwningThread(aOwningThread)
-  , mTransactionCount(0)
   , mClosedOnMainThread(false)
   , mClosedOnOwningThread(false)
   , mInvalidatedOnMainThread(false)
   , mInvalidatedOnOwningThread(false)
   , mRegisteredWithQuotaManager(false)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aQuotaClient);
-  MOZ_ASSERT(aOptionalWindowId.type() != OptionalWindowId::T__None);
-  MOZ_ASSERT_IF(aOptionalWindowId.type() == OptionalWindowId::Tuint64_t,
-                aOptionalContentParentId.type() == OptionalWindowId::Tvoid_t);
-  MOZ_ASSERT(aOptionalContentParentId.type() != OptionalWindowId::T__None);
-  MOZ_ASSERT_IF(aOptionalContentParentId.type() == OptionalWindowId::Tuint64_t,
-                aOptionalWindowId.type() == OptionalWindowId::Tvoid_t);
   MOZ_ASSERT(aOwningThread);
 
   DebugOnly<bool> current;
   MOZ_ASSERT(NS_SUCCEEDED(aOwningThread->IsOnCurrentThread(&current)));
   MOZ_ASSERT(!current);
 
   mGroup = aGroup;
   mPersistenceType = aPersistenceType;
@@ -9887,21 +9796,16 @@ DatabaseOfflineStorage::CloseOnMainThrea
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mClosedOnMainThread) {
     return;
   }
 
   mClosedOnMainThread = true;
-
-  QuotaManager* quotaManager = QuotaManager::Get();
-  MOZ_ASSERT(quotaManager);
-
-  quotaManager->OnStorageClosed(this);
 }
 
 void
 DatabaseOfflineStorage::InvalidateOnMainThread()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mInvalidatedOnMainThread) {
@@ -9970,34 +9874,24 @@ NS_IMETHODIMP_(Client*)
 DatabaseOfflineStorage::GetClient()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   return mWeakQuotaClient;
 }
 
 NS_IMETHODIMP_(bool)
-DatabaseOfflineStorage::IsOwnedByWindow(nsPIDOMWindow* aOwner)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aOwner);
-  MOZ_ASSERT(aOwner->IsInnerWindow());
-
-  return mOptionalWindowId.type() == OptionalWindowId::Tuint64_t &&
-         mOptionalWindowId.get_uint64_t() == aOwner->WindowID();
-}
-
-NS_IMETHODIMP_(bool)
 DatabaseOfflineStorage::IsOwnedByProcess(ContentParent* aOwner)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aOwner);
 
-  return mOptionalContentParentId.type() == OptionalWindowId::Tuint64_t &&
-         mOptionalContentParentId.get_uint64_t() == aOwner->ChildID();
+  return mOptionalContentParentId.type() ==
+           OptionalContentId::TContentParentId &&
+         mOptionalContentParentId.get_ContentParentId() == aOwner->ChildID();
 }
 
 NS_IMETHODIMP_(const nsACString&)
 DatabaseOfflineStorage::Origin()
 {
   return mOrigin;
 }
 
@@ -10005,24 +9899,16 @@ NS_IMETHODIMP_(nsresult)
 DatabaseOfflineStorage::Close()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   InvalidateOnMainThread();
   return NS_OK;
 }
 
-NS_IMETHODIMP_(bool)
-DatabaseOfflineStorage::IsClosed()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  return mClosedOnMainThread;
-}
-
 NS_IMETHODIMP_(void)
 DatabaseOfflineStorage::Invalidate()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   InvalidateOnMainThread();
 }
 
@@ -11116,28 +11002,23 @@ FactoryOp::RecvPermissionRetry()
   mState = State_PermissionRetry;
   MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(this)));
 
   return true;
 }
 
 OpenDatabaseOp::OpenDatabaseOp(Factory* aFactory,
                                already_AddRefed<ContentParent> aContentParent,
-                               const OptionalWindowId& aOptionalWindowId,
                                const CommonFactoryRequestParams& aParams)
   : FactoryOp(aFactory, Move(aContentParent), aParams, /* aDeleting */ false)
-  , mOptionalWindowId(aOptionalWindowId)
   , mMetadata(new FullDatabaseMetadata(aParams.metadata()))
   , mRequestedVersion(aParams.metadata().version())
 {
-  MOZ_ASSERT_IF(mContentParent,
-                mOptionalWindowId.type() == OptionalWindowId::Tvoid_t);
-
   auto& optionalContentParentId =
-    const_cast<OptionalWindowId&>(mOptionalContentParentId);
+    const_cast<OptionalContentId&>(mOptionalContentParentId);
 
   if (mContentParent) {
     // This is a little scary but it looks safe to call this off the main thread
     // for now.
     optionalContentParentId = mContentParent->ChildID();
   } else {
     optionalContentParentId = void_t();
   }
@@ -11157,17 +11038,16 @@ OpenDatabaseOp::QuotaManagerOpen()
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
   QuotaManager* quotaManager = QuotaManager::Get();
   MOZ_ASSERT(quotaManager);
 
   nsRefPtr<DatabaseOfflineStorage> offlineStorage =
     new DatabaseOfflineStorage(quotaClient,
-                               mOptionalWindowId,
                                mOptionalContentParentId,
                                mGroup,
                                mOrigin,
                                mDatabaseId,
                                mCommonParams.metadata().persistenceType(),
                                mOwningThread);
 
   if (NS_WARN_IF(!quotaManager->RegisterStorage(offlineStorage))) {
--- a/dom/indexedDB/ActorsParent.h
+++ b/dom/indexedDB/ActorsParent.h
@@ -6,46 +6,36 @@
 #define mozilla_dom_indexeddb_actorsparent_h__
 
 template <class> struct already_AddRefed;
 class nsCString;
 class nsIPrincipal;
 class nsPIDOMWindow;
 
 namespace mozilla {
-namespace ipc {
-
-class PBackgroundParent;
-
-} // namespace ipc
-
 namespace dom {
 
 class TabParent;
 
 namespace quota {
 
 class Client;
 
 } // namespace quota
 
 namespace indexedDB {
 
-class OptionalWindowId;
 class PBackgroundIDBFactoryParent;
 class PIndexedDBPermissionRequestParent;
 
 PBackgroundIDBFactoryParent*
-AllocPBackgroundIDBFactoryParent(mozilla::ipc::PBackgroundParent* aManager,
-                                 const OptionalWindowId& aOptionalWindowId);
+AllocPBackgroundIDBFactoryParent();
 
 bool
-RecvPBackgroundIDBFactoryConstructor(mozilla::ipc::PBackgroundParent* aManager,
-                                     PBackgroundIDBFactoryParent* aActor,
-                                     const OptionalWindowId& aOptionalWindowId);
+RecvPBackgroundIDBFactoryConstructor(PBackgroundIDBFactoryParent* aActor);
 
 bool
 DeallocPBackgroundIDBFactoryParent(PBackgroundIDBFactoryParent* aActor);
 
 PIndexedDBPermissionRequestParent*
 AllocPIndexedDBPermissionRequestParent(nsPIDOMWindow* aWindow,
                                        nsIPrincipal* aPrincipal);
 
--- a/dom/indexedDB/IDBFactory.cpp
+++ b/dom/indexedDB/IDBFactory.cpp
@@ -588,28 +588,19 @@ IDBFactory::BackgroundActorCreated(PBack
   MOZ_ASSERT(!mBackgroundActor);
   MOZ_ASSERT(!mBackgroundActorFailed);
 
   {
     BackgroundFactoryChild* actor = new BackgroundFactoryChild(this);
 
     MOZ_ASSERT(NS_IsMainThread(), "Fix this windowId stuff for workers!");
 
-    OptionalWindowId windowId;
-    if (mWindow && IndexedDatabaseManager::IsMainProcess()) {
-      MOZ_ASSERT(mWindow->IsInnerWindow());
-      windowId = mWindow->WindowID();
-    } else {
-      windowId = void_t();
-    }
-
     mBackgroundActor =
       static_cast<BackgroundFactoryChild*>(
-        aBackgroundActor->SendPBackgroundIDBFactoryConstructor(actor,
-                                                               windowId));
+        aBackgroundActor->SendPBackgroundIDBFactoryConstructor(actor));
   }
 
   if (NS_WARN_IF(!mBackgroundActor)) {
     BackgroundActorFailed();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
   nsresult rv = NS_OK;
--- a/dom/indexedDB/TransactionThreadPool.cpp
+++ b/dom/indexedDB/TransactionThreadPool.cpp
@@ -729,34 +729,16 @@ TransactionThreadPool::FindTransaction(c
     info->found = true;
     return PL_DHASH_STOP;
   }
 
   return PL_DHASH_NEXT;
 }
 
 bool
-TransactionThreadPool::HasTransactionsForDatabase(const nsACString& aDatabaseId)
-{
-  AssertIsOnOwningThread();
-  MOZ_ASSERT(!aDatabaseId.IsEmpty(), "An empty DatabaseId!");
-
-  DatabaseTransactionInfo* dbTransactionInfo = nullptr;
-  dbTransactionInfo = mTransactionsInProgress.Get(aDatabaseId);
-  if (!dbTransactionInfo) {
-    return false;
-  }
-
-  TransactionSearchInfo info(aDatabaseId);
-  dbTransactionInfo->transactions.EnumerateRead(FindTransaction, &info);
-
-  return info.found;
-}
-
-bool
 TransactionThreadPool::MaybeFireCallback(DatabasesCompleteCallback* aCallback)
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(aCallback);
   MOZ_ASSERT(!aCallback->mDatabaseIds.IsEmpty());
   MOZ_ASSERT(aCallback->mCallback);
 
   PROFILER_LABEL("IndexedDB",
--- a/dom/indexedDB/TransactionThreadPool.h
+++ b/dom/indexedDB/TransactionThreadPool.h
@@ -67,19 +67,16 @@ public:
                 const nsACString& aDatabaseId,
                 nsIRunnable* aRunnable,
                 bool aFinish,
                 FinishCallback* aFinishCallback);
 
   void WaitForDatabasesToComplete(nsTArray<nsCString>& aDatabaseIds,
                                   nsIRunnable* aCallback);
 
-  // Returns true if there are running or pending transactions for aDatabase.
-  bool HasTransactionsForDatabase(const nsACString& aDatabaseId);
-
   NS_INLINE_DECL_REFCOUNTING(TransactionThreadPool)
 
   void Shutdown();
 
   void AssertIsOnOwningThread() const
 #ifdef DEBUG
   ;
 #else
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -326,16 +326,22 @@ struct ClipboardCapabilities {
   bool supportsFindClipboard;
 };
 
 union MaybeFileDesc {
     FileDescriptor;
     void_t;
 };
 
+union OptionalContentId
+{
+  ContentParentId;
+  void_t;
+};
+
 prio(normal upto urgent) intr protocol PContent
 {
     parent spawns PPluginModule;
 
     parent opens PCompositor;
     parent opens PSharedBufferManager;
     parent opens PImageBridge;
     child opens PBackground;
deleted file mode 100644
--- a/dom/quota/AcquireListener.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_quota_acquirelistener_h__
-#define mozilla_dom_quota_acquirelistener_h__
-
-#include "mozilla/dom/quota/QuotaCommon.h"
-
-BEGIN_QUOTA_NAMESPACE
-
-class AcquireListener
-{
-public:
-  NS_IMETHOD_(MozExternalRefCountType)
-  AddRef() = 0;
-
-  NS_IMETHOD_(MozExternalRefCountType)
-  Release() = 0;
-
-  virtual nsresult
-  OnExclusiveAccessAcquired() = 0;
-};
-
-END_QUOTA_NAMESPACE
-
-#endif // mozilla_dom_quota_acquirelistener_h__
--- a/dom/quota/Client.h
+++ b/dom/quota/Client.h
@@ -109,22 +109,16 @@ public:
   virtual bool
   IsTransactionServiceActivated() = 0;
 
   virtual void
   WaitForStoragesToComplete(nsTArray<nsIOfflineStorage*>& aStorages,
                             nsIRunnable* aCallback) = 0;
 
   virtual void
-  AbortTransactionsForStorage(nsIOfflineStorage* aStorage) = 0;
-
-  virtual bool
-  HasTransactionsForStorage(nsIOfflineStorage* aStorage) = 0;
-
-  virtual void
   ShutdownTransactionService() = 0;
 
 protected:
   virtual ~Client()
   { }
 };
 
 END_QUOTA_NAMESPACE
--- a/dom/quota/QuotaManager.cpp
+++ b/dom/quota/QuotaManager.cpp
@@ -44,17 +44,16 @@
 #include "nsDirectoryServiceUtils.h"
 #include "nsNetUtil.h"
 #include "nsPrintfCString.h"
 #include "nsScriptSecurityManager.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
 #include "xpcpublic.h"
 
-#include "AcquireListener.h"
 #include "CheckQuotaHelper.h"
 #include "OriginCollection.h"
 #include "OriginOrPatternString.h"
 #include "QuotaObject.h"
 #include "StorageMatcher.h"
 #include "UsageInfo.h"
 #include "Utilities.h"
 
@@ -153,19 +152,18 @@ struct SynchronizedOp
   DelayRunnable(nsIRunnable* aRunnable);
 
   void
   DispatchDelayedRunnables();
 
   const OriginOrPatternString mOriginOrPattern;
   Nullable<PersistenceType> mPersistenceType;
   nsCString mId;
-  nsRefPtr<AcquireListener> mListener;
+  nsCOMPtr<nsIRunnable> mRunnable;
   nsTArray<nsCOMPtr<nsIRunnable> > mDelayedRunnables;
-  ArrayCluster<nsIOfflineStorage*> mStorages;
 };
 
 class CollectOriginsHelper MOZ_FINAL : public nsRunnable
 {
 public:
   CollectOriginsHelper(mozilla::Mutex& aMutex, uint64_t aMinSizeToBeFreed);
 
   NS_IMETHOD
@@ -194,18 +192,17 @@ private:
 // Responsible for clearing the storage files for a particular origin on the
 // IO thread. Created when nsIQuotaManager::ClearStoragesForURI is called.
 // Runs three times, first on the main thread, next on the IO thread, and then
 // finally again on the main thread. While on the IO thread the runnable will
 // actually remove the origin's storage files and the directory that contains
 // them before dispatching itself back to the main thread. When back on the main
 // thread the runnable will notify the QuotaManager that the job has been
 // completed.
-class OriginClearRunnable MOZ_FINAL : public nsRunnable,
-                                      public AcquireListener
+class OriginClearRunnable MOZ_FINAL : public nsRunnable
 {
   enum CallbackState {
     // Not yet run.
     Pending = 0,
 
     // Running on the main thread in the callback for OpenAllowed.
     OpenAllowed,
 
@@ -224,20 +221,16 @@ public:
   : mOriginOrPattern(aOriginOrPattern),
     mPersistenceType(aPersistenceType),
     mCallbackState(Pending)
   { }
 
   NS_IMETHOD
   Run();
 
-  // AcquireListener override
-  virtual nsresult
-  OnExclusiveAccessAcquired() MOZ_OVERRIDE;
-
   void
   AdvanceState()
   {
     switch (mCallbackState) {
       case Pending:
         mCallbackState = OpenAllowed;
         return;
       case OpenAllowed:
@@ -246,20 +239,16 @@ public:
       case IO:
         mCallbackState = Complete;
         return;
       default:
         NS_NOTREACHED("Can't advance past Complete!");
     }
   }
 
-  static void
-  InvalidateOpenedStorages(nsTArray<nsCOMPtr<nsIOfflineStorage> >& aStorages,
-                           void* aClosure);
-
   void
   DeleteFiles(QuotaManager* aQuotaManager,
               PersistenceType aPersistenceType);
 
 private:
   ~OriginClearRunnable() {}
 
   OriginOrPatternString mOriginOrPattern;
@@ -349,18 +338,17 @@ private:
   uint32_t mAppId;
   nsCString mGroup;
   OriginOrPatternString mOrigin;
   CallbackState mCallbackState;
   bool mInMozBrowserOnly;
   const bool mIsApp;
 };
 
-class ResetOrClearRunnable MOZ_FINAL : public nsRunnable,
-                                       public AcquireListener
+class ResetOrClearRunnable MOZ_FINAL : public nsRunnable
 {
   enum CallbackState {
     // Not yet run.
     Pending = 0,
 
     // Running on the main thread in the callback for OpenAllowed.
     OpenAllowed,
 
@@ -377,20 +365,16 @@ public:
   explicit ResetOrClearRunnable(bool aClear)
   : mCallbackState(Pending),
     mClear(aClear)
   { }
 
   NS_IMETHOD
   Run();
 
-  // AcquireListener override
-  virtual nsresult
-  OnExclusiveAccessAcquired() MOZ_OVERRIDE;
-
   void
   AdvanceState()
   {
     switch (mCallbackState) {
       case Pending:
         mCallbackState = OpenAllowed;
         return;
       case OpenAllowed:
@@ -399,20 +383,16 @@ public:
       case IO:
         mCallbackState = Complete;
         return;
       default:
         NS_NOTREACHED("Can't advance past Complete!");
     }
   }
 
-  static void
-  InvalidateOpenedStorages(nsTArray<nsCOMPtr<nsIOfflineStorage> >& aStorages,
-                           void* aClosure);
-
   void
   DeleteFiles(QuotaManager* aQuotaManager);
 
 private:
   ~ResetOrClearRunnable() {}
 
   CallbackState mCallbackState;
   bool mClear;
@@ -535,18 +515,17 @@ bool gTestingEnabled = false;
 // with a SetVersion/DeleteDatabase/etc.
 class WaitForTransactionsToFinishRunnable MOZ_FINAL : public nsRunnable
 {
 public:
   explicit WaitForTransactionsToFinishRunnable(SynchronizedOp* aOp)
   : mOp(aOp), mCountdown(1)
   {
     NS_ASSERTION(mOp, "Why don't we have a runnable?");
-    NS_ASSERTION(mOp->mStorages.IsEmpty(), "We're here too early!");
-    NS_ASSERTION(mOp->mListener,
+    NS_ASSERTION(mOp->mRunnable,
                  "What are we supposed to do when we're done?");
     NS_ASSERTION(mCountdown, "Wrong countdown!");
   }
 
   NS_IMETHOD
   Run();
 
   void
@@ -1761,160 +1740,47 @@ QuotaManager::UnregisterStorage(nsIOffli
   if (array->IsEmpty()) {
     liveStorageTable.Remove(origin);
 
     UpdateOriginAccessTime(aStorage->Type(), aStorage->Group(), origin);
   }
 }
 
 void
-QuotaManager::OnStorageClosed(nsIOfflineStorage* aStorage)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aStorage, "Null pointer!");
-
-  // Check through the list of SynchronizedOps to see if any are waiting for
-  // this storage to close before proceeding.
-  SynchronizedOp* op =
-    FindSynchronizedOp(aStorage->Origin(),
-                       Nullable<PersistenceType>(aStorage->Type()),
-                       aStorage->Id());
-  if (op) {
-    Client::Type clientType = aStorage->GetClient()->GetType();
-
-    // This storage is in the scope of this SynchronizedOp.  Remove it
-    // from the list if necessary.
-    if (op->mStorages[clientType].RemoveElement(aStorage)) {
-      // Now set up the helper if there are no more live storages.
-      NS_ASSERTION(op->mListener,
-                   "How did we get rid of the listener before removing the "
-                    "last storage?");
-      if (op->mStorages[clientType].IsEmpty()) {
-        // At this point, all storages are closed, so no new transactions
-        // can be started.  There may, however, still be outstanding
-        // transactions that have not completed.  We need to wait for those
-        // before we dispatch the helper.
-        if (NS_FAILED(RunSynchronizedOp(aStorage, op))) {
-          NS_WARNING("Failed to run synchronized op!");
-        }
-      }
-    }
-  }
-}
-
-template <class OwnerClass>
-struct OwnerTraits;
-
-template <>
-struct OwnerTraits<nsPIDOMWindow>
-{
-  static bool
-  IsOwned(nsIOfflineStorage* aStorage, nsPIDOMWindow* aOwner)
-  {
-    return aStorage->IsOwnedByWindow(aOwner);
-  }
-};
-
-template <>
-struct OwnerTraits<mozilla::dom::ContentParent>
-{
-  static bool
-  IsOwned(nsIOfflineStorage* aStorage, mozilla::dom::ContentParent* aOwner)
-  {
-    return aStorage->IsOwnedByProcess(aOwner);
-  }
-};
-
-template <class OwnerClass>
-void
-QuotaManager::AbortCloseStoragesFor(OwnerClass* aOwnerClass)
+QuotaManager::AbortCloseStoragesForProcess(ContentParent* aContentParent)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aOwnerClass);
+  MOZ_ASSERT(aContentParent);
 
   FileService* service = FileService::Get();
 
   StorageMatcher<ArrayCluster<nsIOfflineStorage*>> liveStorages;
   liveStorages.Find(mLiveStorages);
 
   for (uint32_t i = 0; i < Client::TYPE_MAX; i++) {
     nsRefPtr<Client>& client = mClients[i];
     bool utilized = service && client->IsFileServiceUtilized();
-    bool activated = client->IsTransactionServiceActivated();
 
     nsTArray<nsIOfflineStorage*>& array = liveStorages[i];
     for (uint32_t j = 0; j < array.Length(); j++) {
       nsCOMPtr<nsIOfflineStorage> storage = array[j];
 
-      if (OwnerTraits<OwnerClass>::IsOwned(storage, aOwnerClass)) {
+      if (storage->IsOwnedByProcess(aContentParent)) {
         if (NS_FAILED(storage->Close())) {
-          NS_WARNING("Failed to close storage for dying window!");
+          NS_WARNING("Failed to close storage for dying process!");
         }
 
         if (utilized) {
           service->AbortFileHandlesForStorage(storage);
         }
-
-        if (activated) {
-          client->AbortTransactionsForStorage(storage);
-        }
       }
     }
   }
 }
 
-void
-QuotaManager::AbortCloseStoragesForWindow(nsPIDOMWindow* aWindow)
-{
-  AbortCloseStoragesFor(aWindow);
-}
-
-void
-QuotaManager::AbortCloseStoragesForProcess(ContentParent* aContentParent)
-{
-  AbortCloseStoragesFor(aContentParent);
-}
-
-bool
-QuotaManager::HasOpenTransactions(nsPIDOMWindow* aWindow)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aWindow, "Null pointer!");
-
-  FileService* service = FileService::Get();
-
-  nsAutoPtr<StorageMatcher<ArrayCluster<nsIOfflineStorage*> > > liveStorages;
-
-  for (uint32_t i = 0; i < Client::TYPE_MAX; i++) {
-    nsRefPtr<Client>& client = mClients[i];
-    bool utilized = service && client->IsFileServiceUtilized();
-    bool activated = client->IsTransactionServiceActivated();
-
-    if (utilized || activated) {
-      if (!liveStorages) {
-        liveStorages = new StorageMatcher<ArrayCluster<nsIOfflineStorage*> >();
-        liveStorages->Find(mLiveStorages);
-      }
-
-      nsTArray<nsIOfflineStorage*>& storages = liveStorages->ArrayAt(i);
-      for (uint32_t j = 0; j < storages.Length(); j++) {
-        nsIOfflineStorage*& storage = storages[j];
-
-        if (storage->IsOwnedByWindow(aWindow) &&
-            ((utilized && service->HasFileHandlesForStorage(storage)) ||
-             (activated && client->HasTransactionsForStorage(storage)))) {
-          return true;
-        }
-      }
-    }
-  }
-
-  return false;
-}
-
 nsresult
 QuotaManager::WaitForOpenAllowed(const OriginOrPatternString& aOriginOrPattern,
                                  Nullable<PersistenceType> aPersistenceType,
                                  const nsACString& aId, nsIRunnable* aRunnable)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(!aOriginOrPattern.IsEmpty() || aOriginOrPattern.IsNull(),
                "Empty pattern!");
@@ -1977,18 +1843,16 @@ QuotaManager::AllowNextSynchronizedOp(
 
   uint32_t count = mSynchronizedOps.Length();
   for (uint32_t index = 0; index < count; index++) {
     nsAutoPtr<SynchronizedOp>& op = mSynchronizedOps[index];
     if (op->mOriginOrPattern.IsOrigin() == aOriginOrPattern.IsOrigin() &&
         op->mOriginOrPattern == aOriginOrPattern &&
         op->mPersistenceType == aPersistenceType) {
       if (op->mId == aId) {
-        NS_ASSERTION(op->mStorages.IsEmpty(), "How did this happen?");
-
         op->DispatchDelayedRunnables();
 
         mSynchronizedOps.RemoveElementAt(index);
         return;
       }
 
       // If one or the other is for an origin clear, we should have matched
       // solely on origin.
@@ -3355,180 +3219,91 @@ QuotaManager::LockedRemoveQuotaForOrigin
       }
     }
   }
 }
 
 nsresult
 QuotaManager::AcquireExclusiveAccess(const nsACString& aPattern,
                                      Nullable<PersistenceType> aPersistenceType,
-                                     nsIOfflineStorage* aStorage,
-                                     AcquireListener* aListener,
-                                     WaitingOnStoragesCallback aCallback,
-                                     void* aClosure)
+                                     nsIRunnable* aRunnable)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aListener, "Need a listener!");
+  NS_ASSERTION(aRunnable, "Need a runnable!");
 
   // Find the right SynchronizedOp.
   SynchronizedOp* op =
-    FindSynchronizedOp(aPattern, aPersistenceType,
-                       aStorage ? aStorage->Id() : EmptyCString());
+    FindSynchronizedOp(aPattern, aPersistenceType, EmptyCString());
 
   NS_ASSERTION(op, "We didn't find a SynchronizedOp?");
-  NS_ASSERTION(!op->mListener, "SynchronizedOp already has a listener?!?");
-
-  nsTArray<nsCOMPtr<nsIOfflineStorage> > liveStorages;
-
-  if (aStorage) {
-    // We need to wait for the storages to go away.
-    // Hold on to all storage objects that represent the same storage file
-    // (except the one that is requesting this version change).
-
-    Client::Type clientType = aStorage->GetClient()->GetType();
-
-    StorageMatcher<nsAutoTArray<nsIOfflineStorage*, 20> > matches;
-    matches.Find(mLiveStorages, aPattern, clientType);
-
-    if (!matches.IsEmpty()) {
-      // Grab all storages that are not yet closed but whose storage id match
-      // the one we're looking for.
-      for (uint32_t index = 0; index < matches.Length(); index++) {
-        nsIOfflineStorage*& storage = matches[index];
-        if (!storage->IsClosed() &&
-            storage != aStorage &&
-            storage->Id() == aStorage->Id() &&
-            (aPersistenceType.IsNull() ||
-             aPersistenceType.Value() == storage->Type())) {
-          liveStorages.AppendElement(storage);
-        }
-      }
-    }
-
-    if (!liveStorages.IsEmpty()) {
-      NS_ASSERTION(op->mStorages[clientType].IsEmpty(),
-                   "How do we already have storages here?");
-      op->mStorages[clientType].AppendElements(liveStorages);
-    }
+  NS_ASSERTION(!op->mRunnable, "SynchronizedOp already has a runnable?!?");
+
+  ArrayCluster<nsIOfflineStorage*> liveStorages;
+
+  StorageMatcher<ArrayCluster<nsIOfflineStorage*> > matches;
+  if (aPattern.IsVoid()) {
+    matches.Find(mLiveStorages);
   }
   else {
-    StorageMatcher<ArrayCluster<nsIOfflineStorage*> > matches;
-    if (aPattern.IsVoid()) {
-      matches.Find(mLiveStorages);
-    }
-    else {
-      matches.Find(mLiveStorages, aPattern);
-    }
-
-    NS_ASSERTION(op->mStorages.IsEmpty(),
-               "How do we already have storages here?");
-
-    // We want *all* storages that match the given persistence type, even those
-    // that are closed, when we're going to clear the origin.
-    if (!matches.IsEmpty()) {
-      for (uint32_t i = 0; i < Client::TYPE_MAX; i++) {
-        nsTArray<nsIOfflineStorage*>& storages = matches.ArrayAt(i);
-        for (uint32_t j = 0; j < storages.Length(); j++) {
-          nsIOfflineStorage* storage = storages[j];
-          if (aPersistenceType.IsNull() ||
-              aPersistenceType.Value() == storage->Type()) {
-            liveStorages.AppendElement(storage);
-            op->mStorages[i].AppendElement(storage);
-          }
+    matches.Find(mLiveStorages, aPattern);
+  }
+
+  // We want *all* storages that match the given persistence type, even those
+  // that are closed, when we're going to clear the origin.
+  if (!matches.IsEmpty()) {
+    for (uint32_t i = 0; i < Client::TYPE_MAX; i++) {
+      nsTArray<nsIOfflineStorage*>& storages = matches.ArrayAt(i);
+      for (uint32_t j = 0; j < storages.Length(); j++) {
+        nsIOfflineStorage* storage = storages[j];
+        if (aPersistenceType.IsNull() ||
+            aPersistenceType.Value() == storage->Type()) {
+          storage->Invalidate();
+          liveStorages[i].AppendElement(storage);
         }
       }
     }
   }
 
-  op->mListener = aListener;
+  op->mRunnable = aRunnable;
+
+  nsRefPtr<WaitForTransactionsToFinishRunnable> runnable =
+    new WaitForTransactionsToFinishRunnable(op);
 
   if (!liveStorages.IsEmpty()) {
-    // Give our callback the storages so it can decide what to do with them.
-    aCallback(liveStorages, aClosure);
-
-    NS_ASSERTION(liveStorages.IsEmpty(),
-                 "Should have done something with the array!");
-
-    if (aStorage) {
-      // Wait for those storages to close.
-      return NS_OK;
-    }
-  }
-
-  // If we're trying to open a storage and nothing blocks it, or if we're
-  // clearing an origin, then go ahead and schedule the op.
-  nsresult rv = RunSynchronizedOp(aStorage, op);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-nsresult
-QuotaManager::RunSynchronizedOp(nsIOfflineStorage* aStorage,
-                                SynchronizedOp* aOp)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(aOp, "Null pointer!");
-  NS_ASSERTION(aOp->mListener, "No listener on this op!");
-  NS_ASSERTION(!aStorage ||
-               aOp->mStorages[aStorage->GetClient()->GetType()].IsEmpty(),
-               "This op isn't ready to run!");
-
-  ArrayCluster<nsIOfflineStorage*> storages;
-
-  uint32_t startIndex;
-  uint32_t endIndex;
-
-  if (aStorage) {
-    Client::Type clientType = aStorage->GetClient()->GetType();
-
-    storages[clientType].AppendElement(aStorage);
-
-    startIndex = clientType;
-    endIndex = clientType + 1;
-  }
-  else {
-    aOp->mStorages.SwapElements(storages);
-
-    startIndex = 0;
-    endIndex = Client::TYPE_MAX;
-  }
-
-  nsRefPtr<WaitForTransactionsToFinishRunnable> runnable =
-    new WaitForTransactionsToFinishRunnable(aOp);
-
-  // Ask the file service to call us back when it's done with this storage.
-  FileService* service = FileService::Get();
-
-  if (service) {
-    // Have to copy here in case a transaction service needs a list too.
-    nsTArray<nsCOMPtr<nsIOfflineStorage>> array;
-
-    for (uint32_t index = startIndex; index < endIndex; index++)  {
-      if (!storages[index].IsEmpty() &&
-          mClients[index]->IsFileServiceUtilized()) {
-        array.AppendElements(storages[index]);
+    // Ask the file service to call us back when it's done with this storage.
+    FileService* service = FileService::Get();
+
+    if (service) {
+      // Have to copy here in case a transaction service needs a list too.
+      nsTArray<nsCOMPtr<nsIOfflineStorage>> array;
+
+      for (uint32_t index = 0; index < Client::TYPE_MAX; index++)  {
+        if (!liveStorages[index].IsEmpty() &&
+            mClients[index]->IsFileServiceUtilized()) {
+          array.AppendElements(liveStorages[index]);
+        }
+      }
+
+      if (!array.IsEmpty()) {
+        runnable->AddRun();
+
+        service->WaitForStoragesToComplete(array, runnable);
       }
     }
 
-    if (!array.IsEmpty()) {
-      runnable->AddRun();
-
-      service->WaitForStoragesToComplete(array, runnable);
-    }
-  }
-
-  // Ask each transaction service to call us back when they're done with this
-  // storage.
-  for (uint32_t index = startIndex; index < endIndex; index++)  {
-    nsRefPtr<Client>& client = mClients[index];
-    if (!storages[index].IsEmpty() && client->IsTransactionServiceActivated()) {
-      runnable->AddRun();
-
-      client->WaitForStoragesToComplete(storages[index], runnable);
+    // Ask each transaction service to call us back when they're done with this
+    // storage.
+    for (uint32_t index = 0; index < Client::TYPE_MAX; index++)  {
+      nsRefPtr<Client>& client = mClients[index];
+      if (!liveStorages[index].IsEmpty() &&
+          client->IsTransactionServiceActivated()) {
+        runnable->AddRun();
+
+        client->WaitForStoragesToComplete(liveStorages[index], runnable);
+      }
     }
   }
 
   nsresult rv = runnable->Run();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
@@ -4142,17 +3917,17 @@ SynchronizedOp::DelayRunnable(nsIRunnabl
 
   mDelayedRunnables.AppendElement(aRunnable);
 }
 
 void
 SynchronizedOp::DispatchDelayedRunnables()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-  NS_ASSERTION(!mListener, "Any listener should be gone by now!");
+  NS_ASSERTION(!mRunnable, "Any runnable should be gone by now!");
 
   uint32_t count = mDelayedRunnables.Length();
   for (uint32_t index = 0; index < count; index++) {
     NS_DispatchToCurrentThread(mDelayedRunnables[index]);
   }
 
   mDelayedRunnables.Clear();
 }
@@ -4205,44 +3980,16 @@ CollectOriginsHelper::Run()
   mOriginInfos.SwapElements(originInfos);
   mSizeToBeFreed = sizeToBeFreed;
   mWaiting = false;
   mCondVar.Notify();
 
   return NS_OK;
 }
 
-nsresult
-OriginClearRunnable::OnExclusiveAccessAcquired()
-{
-  QuotaManager* quotaManager = QuotaManager::Get();
-  NS_ASSERTION(quotaManager, "This should never fail!");
-
-  nsresult rv = quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-// static
-void
-OriginClearRunnable::InvalidateOpenedStorages(
-                              nsTArray<nsCOMPtr<nsIOfflineStorage> >& aStorages,
-                              void* aClosure)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsTArray<nsCOMPtr<nsIOfflineStorage> > storages;
-  storages.SwapElements(aStorages);
-
-  for (uint32_t index = 0; index < storages.Length(); index++) {
-    storages[index]->Invalidate();
-  }
-}
-
 void
 OriginClearRunnable::DeleteFiles(QuotaManager* aQuotaManager,
                                  PersistenceType aPersistenceType)
 {
   AssertIsOnIOThread();
   NS_ASSERTION(aQuotaManager, "Don't pass me null!");
 
   nsresult rv;
@@ -4344,18 +4091,17 @@ OriginClearRunnable::Run()
       NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
       AdvanceState();
 
       // Now we have to wait until the thread pool is done with all of the
       // storages we care about.
       nsresult rv =
         quotaManager->AcquireExclusiveAccess(mOriginOrPattern, mPersistenceType,
-                                             this, InvalidateOpenedStorages,
-                                             nullptr);
+                                             this);
       NS_ENSURE_SUCCESS(rv, rv);
 
       return NS_OK;
     }
 
     case IO: {
       AssertIsOnIOThread();
 
@@ -4635,44 +4381,16 @@ AsyncUsageRunnable::Cancel()
   if (mCanceled.exchange(true)) {
     NS_WARNING("Canceled more than once?!");
     return NS_ERROR_UNEXPECTED;
   }
 
   return NS_OK;
 }
 
-nsresult
-ResetOrClearRunnable::OnExclusiveAccessAcquired()
-{
-  QuotaManager* quotaManager = QuotaManager::Get();
-  NS_ASSERTION(quotaManager, "This should never fail!");
-
-  nsresult rv = quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-// static
-void
-ResetOrClearRunnable::InvalidateOpenedStorages(
-                              nsTArray<nsCOMPtr<nsIOfflineStorage> >& aStorages,
-                              void* aClosure)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
-
-  nsTArray<nsCOMPtr<nsIOfflineStorage> > storages;
-  storages.SwapElements(aStorages);
-
-  for (uint32_t index = 0; index < storages.Length(); index++) {
-    storages[index]->Invalidate();
-  }
-}
-
 void
 ResetOrClearRunnable::DeleteFiles(QuotaManager* aQuotaManager)
 {
   AssertIsOnIOThread();
   NS_ASSERTION(aQuotaManager, "Don't pass me null!");
 
   nsresult rv;
 
@@ -4710,18 +4428,17 @@ ResetOrClearRunnable::Run()
       NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
       AdvanceState();
 
       // Now we have to wait until the thread pool is done with all of the
       // storages we care about.
       nsresult rv =
         quotaManager->AcquireExclusiveAccess(NullCString(),
-                                             Nullable<PersistenceType>(), this,
-                                             InvalidateOpenedStorages, nullptr);
+                                             Nullable<PersistenceType>(), this);
       NS_ENSURE_SUCCESS(rv, rv);
 
       return NS_OK;
     }
 
     case IO: {
       AssertIsOnIOThread();
 
@@ -4856,30 +4573,34 @@ FinalizeOriginEvictionRunnable::RunImmed
   return this->Run();
 }
 
 NS_IMETHODIMP
 WaitForTransactionsToFinishRunnable::Run()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(mOp, "Null op!");
-  NS_ASSERTION(mOp->mListener, "Nothing to run!");
+  NS_ASSERTION(mOp->mRunnable, "Nothing to run!");
   NS_ASSERTION(mCountdown, "Wrong countdown!");
 
   if (--mCountdown) {
     return NS_OK;
   }
 
-  // Don't hold the listener alive longer than necessary.
-  nsRefPtr<AcquireListener> listener;
-  listener.swap(mOp->mListener);
+  // Don't hold the runnable alive longer than necessary.
+  nsCOMPtr<nsIRunnable> runnable;
+  runnable.swap(mOp->mRunnable);
 
   mOp = nullptr;
 
-  nsresult rv = listener->OnExclusiveAccessAcquired();
+  QuotaManager* quotaManager = QuotaManager::Get();
+  NS_ASSERTION(quotaManager, "This should never fail!");
+
+  nsresult rv =
+    quotaManager->IOThread()->Dispatch(runnable, NS_DISPATCH_NORMAL);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // The listener is responsible for calling
   // QuotaManager::AllowNextSynchronizedOp.
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/dom/quota/QuotaManager.h
+++ b/dom/quota/QuotaManager.h
@@ -85,19 +85,16 @@ class QuotaManager MOZ_FINAL : public ns
 
   enum MozBrowserPatternFlag
   {
     MozBrowser = 0,
     NotMozBrowser,
     IgnoreMozBrowser
   };
 
-  typedef void
-  (*WaitingOnStoragesCallback)(nsTArray<nsCOMPtr<nsIOfflineStorage> >&, void*);
-
   typedef nsClassHashtable<nsCStringHashKey,
                            nsTArray<nsIOfflineStorage*>> LiveStorageTable;
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIQUOTAMANAGER
   NS_DECL_NSIOBSERVER
 
@@ -188,69 +185,28 @@ public:
   // Called when a storage is created.
   bool
   RegisterStorage(nsIOfflineStorage* aStorage);
 
   // Called when a storage is being unlinked or destroyed.
   void
   UnregisterStorage(nsIOfflineStorage* aStorage);
 
-  // Called when a storage has been closed.
-  void
-  OnStorageClosed(nsIOfflineStorage* aStorage);
-
-  // Called when a window is being purged from the bfcache or the user leaves
-  // a page which isn't going into the bfcache. Forces any live storage
-  // objects to close themselves and aborts any running transactions.
-  void
-  AbortCloseStoragesForWindow(nsPIDOMWindow* aWindow);
-
   // Called when a process is being shot down. Forces any live storage objects
   // to close themselves and aborts any running transactions.
   void
   AbortCloseStoragesForProcess(ContentParent* aContentParent);
 
-  // Used to check if there are running transactions in a given window.
-  bool
-  HasOpenTransactions(nsPIDOMWindow* aWindow);
-
   // Waits for storages to be cleared and for version change transactions to
   // complete before dispatching the given runnable.
   nsresult
   WaitForOpenAllowed(const OriginOrPatternString& aOriginOrPattern,
                      Nullable<PersistenceType> aPersistenceType,
                      const nsACString& aId, nsIRunnable* aRunnable);
 
-  // Acquire exclusive access to the storage given (waits for all others to
-  // close).  If storages need to close first, the callback will be invoked
-  // with an array of said storages.
-  nsresult
-  AcquireExclusiveAccess(nsIOfflineStorage* aStorage,
-                         const nsACString& aOrigin,
-                         Nullable<PersistenceType> aPersistenceType,
-                         AcquireListener* aListener,
-                         WaitingOnStoragesCallback aCallback,
-                         void* aClosure)
-  {
-    NS_ASSERTION(aStorage, "Need a storage here!");
-    return AcquireExclusiveAccess(aOrigin, aPersistenceType, aStorage,
-                                  aListener, aCallback, aClosure);
-  }
-
-  nsresult
-  AcquireExclusiveAccess(const nsACString& aOrigin,
-                         Nullable<PersistenceType> aPersistenceType,
-                         AcquireListener* aListener,
-                         WaitingOnStoragesCallback aCallback,
-                         void* aClosure)
-  {
-    return AcquireExclusiveAccess(aOrigin, aPersistenceType, nullptr,
-                                  aListener, aCallback, aClosure);
-  }
-
   void
   AllowNextSynchronizedOp(const OriginOrPatternString& aOriginOrPattern,
                           Nullable<PersistenceType> aPersistenceType,
                           const nsACString& aId);
 
   bool
   IsClearOriginPending(const nsACString& aPattern,
                        Nullable<PersistenceType> aPersistenceType)
@@ -428,29 +384,22 @@ private:
   void
   LockedRemoveQuotaForOrigin(PersistenceType aPersistenceType,
                              const nsACString& aGroup,
                              const nsACString& aOrigin);
 
   nsresult
   AcquireExclusiveAccess(const nsACString& aOrigin,
                          Nullable<PersistenceType> aPersistenceType,
-                         nsIOfflineStorage* aStorage,
-                         AcquireListener* aListener,
-                         WaitingOnStoragesCallback aCallback,
-                         void* aClosure);
+                         nsIRunnable* aRunnable);
 
   void
   AddSynchronizedOp(const OriginOrPatternString& aOriginOrPattern,
                     Nullable<PersistenceType> aPersistenceType);
 
-  nsresult
-  RunSynchronizedOp(nsIOfflineStorage* aStorage,
-                    SynchronizedOp* aOp);
-
   SynchronizedOp*
   FindSynchronizedOp(const nsACString& aPattern,
                      Nullable<PersistenceType> aPersistenceType,
                      const nsACString& aId);
 
   nsresult
   MaybeUpgradeIndexedDBDirectory();
 
@@ -500,20 +449,16 @@ private:
   {
     AssertIsOnIOThread();
 
     for (uint32_t index = 0; index < Client::TYPE_MAX; index++) {
       mClients[index]->ReleaseIOThreadObjects();
     }
   }
 
-  template <class OwnerClass>
-  void
-  AbortCloseStoragesFor(OwnerClass* aOwnerClass);
-
   LiveStorageTable&
   GetLiveStorageTable(PersistenceType aPersistenceType);
 
   static void
   GetOriginPatternString(uint32_t aAppId,
                          MozBrowserPatternFlag aBrowserFlag,
                          const nsACString& aOrigin,
                          nsAutoCString& _retval);
--- a/dom/quota/moz.build
+++ b/dom/quota/moz.build
@@ -12,17 +12,16 @@ XPIDL_SOURCES += [
 
 XPIDL_MODULE = 'dom_quota'
 
 EXPORTS += [
     'nsIOfflineStorage.h',
 ]
 
 EXPORTS.mozilla.dom.quota += [
-    'AcquireListener.h',
     'ArrayCluster.h',
     'Client.h',
     'FileStreams.h',
     'OriginOrPatternString.h',
     'PersistenceType.h',
     'QuotaCommon.h',
     'QuotaManager.h',
     'QuotaObject.h',
--- a/dom/quota/nsIOfflineStorage.h
+++ b/dom/quota/nsIOfflineStorage.h
@@ -38,19 +38,16 @@ public:
 
   NS_IMETHOD_(const nsACString&)
   Id() = 0;
 
   NS_IMETHOD_(Client*)
   GetClient() = 0;
 
   NS_IMETHOD_(bool)
-  IsOwnedByWindow(nsPIDOMWindow* aOwner) = 0;
-
-  NS_IMETHOD_(bool)
   IsOwnedByProcess(ContentParent* aOwner) = 0;
 
   NS_IMETHOD_(PersistenceType)
   Type()
   {
     return mPersistenceType;
   }
 
@@ -63,20 +60,16 @@ public:
   NS_IMETHOD_(const nsACString&)
   Origin() = 0;
 
   // Implementation of this method should close the storage (without aborting
   // running operations nor discarding pending operations).
   NS_IMETHOD_(nsresult)
   Close() = 0;
 
-  // Whether or not the storage has had Close called on it.
-  NS_IMETHOD_(bool)
-  IsClosed() = 0;
-
   // Implementation of this method should close the storage, all running
   // operations should be aborted and pending operations should be discarded.
   NS_IMETHOD_(void)
   Invalidate() = 0;
 
 protected:
   nsIOfflineStorage()
   : mPersistenceType(mozilla::dom::quota::PERSISTENCE_TYPE_INVALID)
@@ -94,26 +87,20 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIOffline
 #define NS_DECL_NSIOFFLINESTORAGE                                              \
   NS_IMETHOD_(const nsACString&)                                               \
   Id() MOZ_OVERRIDE;                                                           \
                                                                                \
   NS_IMETHOD_(Client*)                                                         \
   GetClient() MOZ_OVERRIDE;                                                    \
                                                                                \
   NS_IMETHOD_(bool)                                                            \
-  IsOwnedByWindow(nsPIDOMWindow* aOwner) MOZ_OVERRIDE;                         \
-                                                                               \
-  NS_IMETHOD_(bool)                                                            \
   IsOwnedByProcess(ContentParent* aOwner) MOZ_OVERRIDE;                        \
                                                                                \
   NS_IMETHOD_(const nsACString&)                                               \
   Origin() MOZ_OVERRIDE;                                                       \
                                                                                \
   NS_IMETHOD_(nsresult)                                                        \
   Close() MOZ_OVERRIDE;                                                        \
                                                                                \
-  NS_IMETHOD_(bool)                                                            \
-  IsClosed() MOZ_OVERRIDE;                                                     \
-                                                                               \
   NS_IMETHOD_(void)                                                            \
   Invalidate() MOZ_OVERRIDE;
 
 #endif // nsIOfflineStorage_h__
--- a/ipc/glue/BackgroundChildImpl.cpp
+++ b/ipc/glue/BackgroundChildImpl.cpp
@@ -131,18 +131,17 @@ BackgroundChildImpl::DeallocPBackgroundT
 {
   MOZ_ASSERT(aActor);
 
   delete static_cast<TestChild*>(aActor);
   return true;
 }
 
 BackgroundChildImpl::PBackgroundIDBFactoryChild*
-BackgroundChildImpl::AllocPBackgroundIDBFactoryChild(
-                                      const OptionalWindowId& aOptionalWindowId)
+BackgroundChildImpl::AllocPBackgroundIDBFactoryChild()
 {
   MOZ_CRASH("PBackgroundIDBFactoryChild actors should be manually "
             "constructed!");
 }
 
 bool
 BackgroundChildImpl::DeallocPBackgroundIDBFactoryChild(
                                              PBackgroundIDBFactoryChild* aActor)
--- a/ipc/glue/BackgroundChildImpl.h
+++ b/ipc/glue/BackgroundChildImpl.h
@@ -48,18 +48,17 @@ protected:
 
   virtual PBackgroundTestChild*
   AllocPBackgroundTestChild(const nsCString& aTestArg) MOZ_OVERRIDE;
 
   virtual bool
   DeallocPBackgroundTestChild(PBackgroundTestChild* aActor) MOZ_OVERRIDE;
 
   virtual PBackgroundIDBFactoryChild*
-  AllocPBackgroundIDBFactoryChild(const OptionalWindowId& aOptionalWindowId)
-                                  MOZ_OVERRIDE;
+  AllocPBackgroundIDBFactoryChild() MOZ_OVERRIDE;
 
   virtual bool
   DeallocPBackgroundIDBFactoryChild(PBackgroundIDBFactoryChild* aActor)
                                     MOZ_OVERRIDE;
 
   virtual PBlobChild*
   AllocPBlobChild(const BlobConstructorParams& aParams) MOZ_OVERRIDE;
 
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -114,40 +114,38 @@ BackgroundParentImpl::DeallocPBackground
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aActor);
 
   delete static_cast<TestParent*>(aActor);
   return true;
 }
 
 auto
-BackgroundParentImpl::AllocPBackgroundIDBFactoryParent(
-                                      const OptionalWindowId& aOptionalWindowId)
+BackgroundParentImpl::AllocPBackgroundIDBFactoryParent()
   -> PBackgroundIDBFactoryParent*
 {
   using mozilla::dom::indexedDB::AllocPBackgroundIDBFactoryParent;
 
   AssertIsInMainProcess();
   AssertIsOnBackgroundThread();
 
-  return AllocPBackgroundIDBFactoryParent(this, aOptionalWindowId);
+  return AllocPBackgroundIDBFactoryParent();
 }
 
 bool
 BackgroundParentImpl::RecvPBackgroundIDBFactoryConstructor(
-                                      PBackgroundIDBFactoryParent* aActor,
-                                      const OptionalWindowId& aOptionalWindowId)
+                                            PBackgroundIDBFactoryParent* aActor)
 {
   using mozilla::dom::indexedDB::RecvPBackgroundIDBFactoryConstructor;
 
   AssertIsInMainProcess();
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aActor);
 
-  return RecvPBackgroundIDBFactoryConstructor(this, aActor, aOptionalWindowId);
+  return RecvPBackgroundIDBFactoryConstructor(aActor);
 }
 
 bool
 BackgroundParentImpl::DeallocPBackgroundIDBFactoryParent(
                                             PBackgroundIDBFactoryParent* aActor)
 {
   AssertIsInMainProcess();
   AssertIsOnBackgroundThread();
--- a/ipc/glue/BackgroundParentImpl.h
+++ b/ipc/glue/BackgroundParentImpl.h
@@ -28,24 +28,21 @@ protected:
   virtual bool
   RecvPBackgroundTestConstructor(PBackgroundTestParent* aActor,
                                  const nsCString& aTestArg) MOZ_OVERRIDE;
 
   virtual bool
   DeallocPBackgroundTestParent(PBackgroundTestParent* aActor) MOZ_OVERRIDE;
 
   virtual PBackgroundIDBFactoryParent*
-  AllocPBackgroundIDBFactoryParent(const OptionalWindowId& aOptionalWindowId)
-                                   MOZ_OVERRIDE;
+  AllocPBackgroundIDBFactoryParent() MOZ_OVERRIDE;
 
   virtual bool
-  RecvPBackgroundIDBFactoryConstructor(
-                                      PBackgroundIDBFactoryParent* aActor,
-                                      const OptionalWindowId& aOptionalWindowId)
-                                      MOZ_OVERRIDE;
+  RecvPBackgroundIDBFactoryConstructor(PBackgroundIDBFactoryParent* aActor)
+                                       MOZ_OVERRIDE;
 
   virtual bool
   DeallocPBackgroundIDBFactoryParent(PBackgroundIDBFactoryParent* aActor)
                                      MOZ_OVERRIDE;
 
   virtual PBlobParent*
   AllocPBlobParent(const BlobConstructorParams& aParams) MOZ_OVERRIDE;
 
--- a/ipc/glue/PBackground.ipdl
+++ b/ipc/glue/PBackground.ipdl
@@ -4,46 +4,31 @@
 
 include protocol PBackgroundIDBFactory;
 include protocol PBackgroundTest;
 include protocol PBlob;
 include protocol PFileDescriptorSet;
 
 include DOMTypes;
 
-using struct mozilla::void_t
-  from "ipc/IPCMessageUtils.h";
-
 namespace mozilla {
-namespace dom {
-namespace indexedDB {
-
-union OptionalWindowId
-{
-  uint64_t;
-  void_t;
-};
-
-} // namespace indexedDB
-} // namespace dom
-
 namespace ipc {
 
 sync protocol PBackground
 {
   manages PBackgroundIDBFactory;
   manages PBackgroundTest;
   manages PBlob;
   manages PFileDescriptorSet;
 
 parent:
   // Only called at startup during mochitests to check the basic infrastructure.
   PBackgroundTest(nsCString testArg);
 
-  PBackgroundIDBFactory(OptionalWindowId optionalWindowId);
+  PBackgroundIDBFactory();
 
 both:
   PBlob(BlobConstructorParams params);
 
   PFileDescriptorSet(FileDescriptor fd);
 };
 
 } // namespace ipc