Bug 1360185 - Use of IPCBlob in IndexedDB - part 1 - Replacement of PBlob with IPCBlob, r=janv
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 23 May 2017 07:50:33 +0200
changeset 410542 f95212c33517a22afe320c0dc65e9e2f12b5080f
parent 410541 3b40bb20354a124e370d918550f94ba08481637e
child 410543 71c72184817762288854adb28fddf0f463cebec8
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanv
bugs1360185
milestone55.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 1360185 - Use of IPCBlob in IndexedDB - part 1 - Replacement of PBlob with IPCBlob, r=janv
dom/indexedDB/ActorsChild.cpp
dom/indexedDB/ActorsChild.h
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/IDBDatabase.cpp
dom/indexedDB/IDBDatabase.h
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/PBackgroundIDBCursor.ipdl
dom/indexedDB/PBackgroundIDBDatabase.ipdl
dom/indexedDB/PBackgroundIDBRequest.ipdl
dom/indexedDB/PBackgroundIDBSharedTypes.ipdlh
dom/indexedDB/PBackgroundIDBVersionChangeTransaction.ipdl
--- a/dom/indexedDB/ActorsChild.cpp
+++ b/dom/indexedDB/ActorsChild.cpp
@@ -22,17 +22,17 @@
 #include "mozilla/CycleCollectedJSRuntime.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/TypeTraits.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseFileChild.h"
 #include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
-#include "mozilla/dom/ipc/BlobChild.h"
+#include "mozilla/dom/IPCBlobUtils.h"
 #include "mozilla/ipc/BackgroundUtils.h"
 #include "nsCOMPtr.h"
 #include "nsContentUtils.h"
 #include "nsIBFCacheEntry.h"
 #include "nsIDocument.h"
 #include "nsIDOMEvent.h"
 #include "nsIEventTarget.h"
 #include "nsIFileStreams.h"
@@ -610,28 +610,25 @@ DeserializeStructuredCloneFiles(
     for (uint32_t index = 0; index < count; index++) {
       const SerializedStructuredCloneFile& serializedFile =
         aSerializedFiles[index];
 
       const BlobOrMutableFile& blobOrMutableFile = serializedFile.file();
 
       switch (serializedFile.type()) {
         case StructuredCloneFile::eBlob: {
-          MOZ_ASSERT(blobOrMutableFile.type() == BlobOrMutableFile::TPBlobChild);
-
-          auto* actor =
-            static_cast<BlobChild*>(blobOrMutableFile.get_PBlobChild());
-
-          RefPtr<BlobImpl> blobImpl = actor->GetBlobImpl();
+          MOZ_ASSERT(blobOrMutableFile.type() == BlobOrMutableFile::TIPCBlob);
+
+          const IPCBlob& ipcBlob = blobOrMutableFile.get_IPCBlob();
+
+          RefPtr<BlobImpl> blobImpl = IPCBlobUtils::Deserialize(ipcBlob);
           MOZ_ASSERT(blobImpl);
 
           RefPtr<Blob> blob = Blob::Create(aDatabase->GetOwner(), blobImpl);
 
-          aDatabase->NoteReceivedBlob(blob);
-
           StructuredCloneFile* file = aFiles.AppendElement();
           MOZ_ASSERT(file);
 
           file->mType = StructuredCloneFile::eBlob;
           file->mBlob.swap(blob);
 
           break;
         }
@@ -705,29 +702,25 @@ DeserializeStructuredCloneFiles(
 
             if (serializedFile.type() == StructuredCloneFile::eWasmCompiled) {
               moduleIndex++;
             }
 
             break;
           }
 
-          MOZ_ASSERT(blobOrMutableFile.type() ==
-                       BlobOrMutableFile::TPBlobChild);
-
-          auto* actor =
-            static_cast<BlobChild*>(blobOrMutableFile.get_PBlobChild());
-
-          RefPtr<BlobImpl> blobImpl = actor->GetBlobImpl();
+          MOZ_ASSERT(blobOrMutableFile.type() == BlobOrMutableFile::TIPCBlob);
+
+          const IPCBlob& ipcBlob = blobOrMutableFile.get_IPCBlob();
+
+          RefPtr<BlobImpl> blobImpl = IPCBlobUtils::Deserialize(ipcBlob);
           MOZ_ASSERT(blobImpl);
 
           RefPtr<Blob> blob = Blob::Create(aDatabase->GetOwner(), blobImpl);
 
-          aDatabase->NoteReceivedBlob(blob);
-
           StructuredCloneFile* file = aFiles.AppendElement();
           MOZ_ASSERT(file);
 
           file->mType = serializedFile.type();
           file->mBlob.swap(blob);
 
           break;
         }
@@ -1791,17 +1784,17 @@ BackgroundDatabaseChild::ActorDestroy(Ac
 #ifdef DEBUG
     mDatabase = nullptr;
 #endif
   }
 }
 
 PBackgroundIDBDatabaseFileChild*
 BackgroundDatabaseChild::AllocPBackgroundIDBDatabaseFileChild(
-                                                         PBlobChild* aBlobChild)
+                                                        const IPCBlob& aIPCBlob)
 {
   MOZ_CRASH("PBackgroundIDBFileChild actors should be manually constructed!");
 }
 
 bool
 BackgroundDatabaseChild::DeallocPBackgroundIDBDatabaseFileChild(
                                         PBackgroundIDBDatabaseFileChild* aActor)
 {
--- a/dom/indexedDB/ActorsChild.h
+++ b/dom/indexedDB/ActorsChild.h
@@ -360,18 +360,17 @@ private:
   void
   ReleaseDOMObject();
 
   // IPDL methods are only called by IPDL.
   virtual void
   ActorDestroy(ActorDestroyReason aWhy) override;
 
   virtual PBackgroundIDBDatabaseFileChild*
-  AllocPBackgroundIDBDatabaseFileChild(PBlobChild* aBlobChild)
-                                       override;
+  AllocPBackgroundIDBDatabaseFileChild(const IPCBlob& aIPCBlob) override;
 
   virtual bool
   DeallocPBackgroundIDBDatabaseFileChild(
                                         PBackgroundIDBDatabaseFileChild* aActor)
                                         override;
 
   virtual PBackgroundIDBDatabaseRequestChild*
   AllocPBackgroundIDBDatabaseRequestChild(const DatabaseRequestParams& aParams)
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -47,17 +47,17 @@
 #include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseRequestParent.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBFactoryParent.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBFactoryRequestParent.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBRequestParent.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBTransactionParent.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBVersionChangeTransactionParent.h"
 #include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsParent.h"
 #include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestParent.h"
-#include "mozilla/dom/ipc/BlobParent.h"
+#include "mozilla/dom/IPCBlobUtils.h"
 #include "mozilla/dom/quota/Client.h"
 #include "mozilla/dom/quota/FileStreams.h"
 #include "mozilla/dom/quota/OriginScope.h"
 #include "mozilla/dom/quota/QuotaManager.h"
 #include "mozilla/dom/quota/UsageInfo.h"
 #include "mozilla/ipc/BackgroundParent.h"
 #include "mozilla/ipc/BackgroundUtils.h"
 #include "mozilla/ipc/InputStreamParams.h"
@@ -6641,18 +6641,17 @@ private:
   bool
   VerifyRequestParams(const DatabaseRequestParams& aParams) const;
 
   // IPDL methods are only called by IPDL.
   void
   ActorDestroy(ActorDestroyReason aWhy) override;
 
   PBackgroundIDBDatabaseFileParent*
-  AllocPBackgroundIDBDatabaseFileParent(PBlobParent* aBlobParent)
-                                        override;
+  AllocPBackgroundIDBDatabaseFileParent(const IPCBlob& aIPCBlob) override;
 
   bool
   DeallocPBackgroundIDBDatabaseFileParent(
                                        PBackgroundIDBDatabaseFileParent* aActor)
                                        override;
 
   PBackgroundIDBDatabaseRequestParent*
   AllocPBackgroundIDBDatabaseRequestParent(const DatabaseRequestParams& aParams)
@@ -6758,22 +6757,21 @@ private:
  *   files directory.
  * - Blobs retrieved from other databases (that are therefore !IsShareable())
  *   or from anywhere else that will need to be written to this database's files
  *   directory.  In this case we will hold a reference to its BlobImpl in
  *   mBlobImpl until we have successfully written the Blob to disk.
  *
  * Relevant Blob context: Blobs sent from the parent process to child processes
  * are automatically linked back to their source BlobImpl when the child process
- * references the Blob via IPC.  (This is true even when a new "KnownBlob" actor
- * must be created because the reference is occurring on a different thread than
- * the PBlob actor created when the blob was sent to the child.)  However, when
- * getting an actor in the child process for sending an in-child-created Blob to
- * the parent process, there is (currently) no Blob machinery to automatically
- * establish and reuse a long-lived Actor.  As a result, without IDB's weak-map
+ * references the Blob via IPC. This is done using the internal IPCBlob
+ * inputStream ID and IPCBlobInputStreamStorage. However, when getting an actor
+ * in the child process for sending an in-child-created Blob to the parent
+ * process, there is (currently) no Blob machinery to automatically establish
+ * and reuse a long-lived Actor.  As a result, without IDB's weak-map
  * cleverness, a memory-backed Blob repeatedly sent from the child to the parent
  * would appear as a different Blob each time, requiring the Blob data to be
  * sent over IPC each time as well as potentially needing to be written to disk
  * each time.
  *
  * This object remains alive as long as there is an active child actor or an
  * ObjectStoreAddOrPutRequestOp::StoredFileInfo for a queued or active add/put
  * op is holding a reference to us.
@@ -10158,28 +10156,28 @@ SerializeStructuredCloneFiles(
     }
 
     switch (file.mType) {
       case StructuredCloneFile::eBlob: {
         RefPtr<BlobImpl> impl = new BlobImplStoredFile(nativeFile,
                                                        file.mFileInfo,
                                                        /* aSnapshot */ false);
 
-        PBlobParent* actor =
-          BackgroundParent::GetOrCreateActorForBlobImpl(aBackgroundActor, impl);
-        if (!actor) {
+        IPCBlob ipcBlob;
+        nsresult rv = IPCBlobUtils::Serialize(impl, aBackgroundActor, ipcBlob);
+        if (NS_WARN_IF(NS_FAILED(rv))) {
           // This can only fail if the child has crashed.
           IDB_REPORT_INTERNAL_ERR();
           return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
         }
 
         SerializedStructuredCloneFile* file = aResult.AppendElement(fallible);
         MOZ_ASSERT(file);
 
-        file->file() = actor;
+        file->file() = ipcBlob;
         file->type() = StructuredCloneFile::eBlob;
 
         break;
       }
 
       case StructuredCloneFile::eMutableFile: {
         if (aDatabase->IsFileHandleDisabled()) {
           SerializedStructuredCloneFile* file = aResult.AppendElement(fallible);
@@ -10235,30 +10233,30 @@ SerializeStructuredCloneFiles(
 
           serializedFile->file() = null_t();
           serializedFile->type() = file.mType;
         } else {
           RefPtr<BlobImpl> impl = new BlobImplStoredFile(nativeFile,
                                                          file.mFileInfo,
                                                          /* aSnapshot */ false);
 
-          PBlobParent* actor =
-            BackgroundParent::GetOrCreateActorForBlobImpl(aBackgroundActor,
-                                                          impl);
-          if (!actor) {
+          IPCBlob ipcBlob;
+          nsresult rv =
+            IPCBlobUtils::Serialize(impl, aBackgroundActor, ipcBlob);
+          if (NS_WARN_IF(NS_FAILED(rv))) {
             // This can only fail if the child has crashed.
             IDB_REPORT_INTERNAL_ERR();
             return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
           }
 
           SerializedStructuredCloneFile* serializedFile =
             aResult.AppendElement(fallible);
           MOZ_ASSERT(serializedFile);
 
-          serializedFile->file() = actor;
+          serializedFile->file() = ipcBlob;
           serializedFile->type() = file.mType;
         }
 
         break;
       }
 
       default:
         MOZ_CRASH("Should never get here!");
@@ -14534,23 +14532,21 @@ Database::ActorDestroy(ActorDestroyReaso
   mActorDestroyed = true;
 
   if (!IsInvalidated()) {
     Invalidate();
   }
 }
 
 PBackgroundIDBDatabaseFileParent*
-Database::AllocPBackgroundIDBDatabaseFileParent(PBlobParent* aBlobParent)
-{
-  AssertIsOnBackgroundThread();
-  MOZ_ASSERT(aBlobParent);
-
-  RefPtr<BlobImpl> blobImpl =
-    static_cast<BlobParent*>(aBlobParent)->GetBlobImpl();
+Database::AllocPBackgroundIDBDatabaseFileParent(const IPCBlob& aIPCBlob)
+{
+  AssertIsOnBackgroundThread();
+
+  RefPtr<BlobImpl> blobImpl = IPCBlobUtils::Deserialize(aIPCBlob);
   MOZ_ASSERT(blobImpl);
 
   RefPtr<FileInfo> fileInfo;
   RefPtr<DatabaseFile> actor;
 
   RefPtr<BlobImplStoredFile> storedFileImpl = do_QueryObject(blobImpl);
   if (storedFileImpl && storedFileImpl->IsShareable(mFileManager)) {
     // This blob was previously shared with the child.
--- a/dom/indexedDB/IDBDatabase.cpp
+++ b/dom/indexedDB/IDBDatabase.cpp
@@ -25,21 +25,20 @@
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/DOMStringListBinding.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/IDBDatabaseBinding.h"
 #include "mozilla/dom/IDBObjectStoreBinding.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseFileChild.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h"
+#include "mozilla/dom/IPCBlobUtils.h"
+#include "mozilla/dom/quota/QuotaManager.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/BackgroundUtils.h"
-#include "mozilla/dom/ipc/BlobChild.h"
-#include "mozilla/dom/ipc/nsIRemoteBlob.h"
-#include "mozilla/dom/quota/QuotaManager.h"
 #include "mozilla/ipc/FileDescriptor.h"
 #include "mozilla/ipc/InputStreamParams.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsIDocument.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
@@ -922,73 +921,37 @@ IDBDatabase::GetOrCreateFileActorForBlob
   MOZ_ASSERT(weakRef);
 
   PBackgroundIDBDatabaseFileChild* actor = nullptr;
 
   if (!mFileActors.Get(weakRef, &actor)) {
     BlobImpl* blobImpl = aBlob->Impl();
     MOZ_ASSERT(blobImpl);
 
-    if (mReceivedBlobs.GetEntry(weakRef)) {
-      // This blob was previously retrieved from the database.
-      nsCOMPtr<nsIRemoteBlob> remoteBlob = do_QueryObject(blobImpl);
-      MOZ_ASSERT(remoteBlob);
-
-      BlobChild* blobChild = remoteBlob->GetBlobChild();
-      MOZ_ASSERT(blobChild);
-
-#ifdef DEBUG
-      {
-        PBackgroundChild* backgroundManager = blobChild->GetBackgroundManager();
-        MOZ_ASSERT(backgroundManager);
-
-        PBackgroundChild* thisManager = mBackgroundActor->Manager()->Manager();
-        MOZ_ASSERT(thisManager);
-
-        MOZ_ASSERT(thisManager == backgroundManager);
-      }
-#endif
-      auto* dbFile = new DatabaseFile(this);
+    PBackgroundChild* backgroundManager =
+      mBackgroundActor->Manager()->Manager();
+    MOZ_ASSERT(backgroundManager);
 
-      actor =
-        mBackgroundActor->SendPBackgroundIDBDatabaseFileConstructor(dbFile,
-                                                                    blobChild);
-      if (NS_WARN_IF(!actor)) {
-        return nullptr;
-      }
-
-      MOZ_ASSERT(actor->GetActorEventTarget(),
-        "The event target shall be inherited from its manager actor.");
-    } else {
-      // Make sure that the input stream we get here is one that can actually be
-      // serialized to PBackground.
-      PBackgroundChild* backgroundManager =
-        mBackgroundActor->Manager()->Manager();
-      MOZ_ASSERT(backgroundManager);
-
-      auto* blobChild =
-        static_cast<BlobChild*>(
-          BackgroundChild::GetOrCreateActorForBlob(backgroundManager, aBlob));
-      MOZ_ASSERT(blobChild);
-
-      auto* dbFile = new DatabaseFile(this);
-
-      actor =
-        mBackgroundActor->SendPBackgroundIDBDatabaseFileConstructor(dbFile,
-                                                                    blobChild);
-      if (NS_WARN_IF(!actor)) {
-        return nullptr;
-      }
-
-      MOZ_ASSERT(actor->GetActorEventTarget(),
-        "The event target shall be inherited from its manager actor.");
+    IPCBlob ipcBlob;
+    nsresult rv = IPCBlobUtils::Serialize(blobImpl, backgroundManager, ipcBlob);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return nullptr;
     }
 
-    MOZ_ASSERT(actor);
+    auto* dbFile = new DatabaseFile(this);
 
+    actor =
+      mBackgroundActor->SendPBackgroundIDBDatabaseFileConstructor(dbFile,
+                                                                  ipcBlob);
+    if (NS_WARN_IF(!actor)) {
+      return nullptr;
+    }
+
+    MOZ_ASSERT(actor->GetActorEventTarget(),
+     "The event target shall be inherited from its manager actor.");
     mFileActors.Put(weakRef, actor);
   }
 
   MOZ_ASSERT(actor);
 
   return actor;
 }
 
@@ -1005,52 +968,16 @@ IDBDatabase::NoteFinishedFileActor(PBack
 
     if (actor == aFileActor) {
       iter.Remove();
     }
   }
 }
 
 void
-IDBDatabase::NoteReceivedBlob(Blob* aBlob)
-{
-  AssertIsOnOwningThread();
-  MOZ_ASSERT(aBlob);
-  MOZ_ASSERT(mBackgroundActor);
-
-#ifdef DEBUG
-  {
-    RefPtr<BlobImpl> blobImpl = aBlob->Impl();
-    MOZ_ASSERT(blobImpl);
-
-    nsCOMPtr<nsIRemoteBlob> remoteBlob = do_QueryObject(blobImpl);
-    MOZ_ASSERT(remoteBlob);
-
-    BlobChild* blobChild = remoteBlob->GetBlobChild();
-    MOZ_ASSERT(blobChild);
-
-    PBackgroundChild* backgroundManager = blobChild->GetBackgroundManager();
-    MOZ_ASSERT(backgroundManager);
-
-    PBackgroundChild* thisManager = mBackgroundActor->Manager()->Manager();
-    MOZ_ASSERT(thisManager);
-
-    MOZ_ASSERT(thisManager == backgroundManager);
-  }
-#endif
-
-  nsCOMPtr<nsIDOMBlob> blob = aBlob;
-  nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(blob);
-  MOZ_ASSERT(weakRef);
-
-  // It's ok if this entry already exists in the table.
-  mReceivedBlobs.PutEntry(weakRef);
-}
-
-void
 IDBDatabase::DelayedMaybeExpireFileActors()
 {
   AssertIsOnOwningThread();
 
   if (!mBackgroundActor || !mFileActors.Count()) {
     return;
   }
 
@@ -1151,35 +1078,16 @@ IDBDatabase::ExpireFileActors(bool aExpi
       }
     }
     if (aExpireAll) {
       mFileActors.Clear();
     }
   } else {
     MOZ_ASSERT(!mFileActors.Count());
   }
-
-  if (mReceivedBlobs.Count()) {
-    if (aExpireAll) {
-      mReceivedBlobs.Clear();
-    } else {
-      for (auto iter = mReceivedBlobs.Iter(); !iter.Done(); iter.Next()) {
-        nsISupports* key = iter.Get()->GetKey();
-        MOZ_ASSERT(key);
-
-        nsCOMPtr<nsIWeakReference> weakRef = do_QueryInterface(key);
-        MOZ_ASSERT(weakRef);
-
-        nsCOMPtr<nsISupports> referent = do_QueryReferent(weakRef);
-        if (!referent) {
-          iter.Remove();
-        }
-      }
-    }
-  }
 }
 
 void
 IDBDatabase::NoteLiveMutableFile(IDBMutableFile* aMutableFile)
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(aMutableFile);
   aMutableFile->AssertIsOnOwningThread();
--- a/dom/indexedDB/IDBDatabase.h
+++ b/dom/indexedDB/IDBDatabase.h
@@ -72,18 +72,16 @@ class IDBDatabase final
 
   indexedDB::BackgroundDatabaseChild* mBackgroundActor;
 
   nsTHashtable<nsPtrHashKey<IDBTransaction>> mTransactions;
 
   nsDataHashtable<nsISupportsHashKey, indexedDB::PBackgroundIDBDatabaseFileChild*>
     mFileActors;
 
-  nsTHashtable<nsISupportsHashKey> mReceivedBlobs;
-
   RefPtr<Observer> mObserver;
 
   // Weak refs, IDBMutableFile strongly owns this IDBDatabase object.
   nsTArray<IDBMutableFile*> mLiveMutableFiles;
 
   const bool mFileHandleDisabled;
   bool mClosed;
   bool mInvalidated;
@@ -193,19 +191,16 @@ public:
 
   indexedDB::PBackgroundIDBDatabaseFileChild*
   GetOrCreateFileActorForBlob(Blob* aBlob);
 
   void
   NoteFinishedFileActor(indexedDB::PBackgroundIDBDatabaseFileChild* aFileActor);
 
   void
-  NoteReceivedBlob(Blob* aBlob);
-
-  void
   DelayedMaybeExpireFileActors();
 
   // XXX This doesn't really belong here... It's only needed for IDBMutableFile
   //     serialization and should be removed or fixed someday.
   nsresult
   GetQuotaInfo(nsACString& aOrigin, PersistenceType* aPersistenceType);
 
   bool
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -34,17 +34,16 @@
 #include "mozilla/dom/IDBMutableFileBinding.h"
 #include "mozilla/dom/BlobBinding.h"
 #include "mozilla/dom/IDBObjectStoreBinding.h"
 #include "mozilla/dom/MemoryBlobImpl.h"
 #include "mozilla/dom/StructuredCloneHolder.h"
 #include "mozilla/dom/StructuredCloneTags.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h"
 #include "mozilla/dom/ipc/BlobChild.h"
-#include "mozilla/dom/ipc/BlobParent.h"
 #include "mozilla/dom/ipc/nsIRemoteBlob.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/PBackgroundSharedTypes.h"
 #include "nsCOMPtr.h"
 #include "nsQueryObject.h"
 #include "ProfilerHelpers.h"
 #include "ReportInternalError.h"
 #include "WorkerPrivate.h"
--- a/dom/indexedDB/PBackgroundIDBCursor.ipdl
+++ b/dom/indexedDB/PBackgroundIDBCursor.ipdl
@@ -1,16 +1,19 @@
 /* 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/. */
 
 include protocol PBackgroundIDBTransaction;
 include protocol PBackgroundIDBVersionChangeTransaction;
 include protocol PBackgroundMutableFile;
-include protocol PBlob;
+include protocol PChildToParentStream; // FIXME: bug 792908
+include protocol PFileDescriptorSet; // FIXME: bug 792908
+include protocol PIPCBlobInputStream; // FIXME: bug 792908
+include protocol PParentToChildStream; // FIXME: bug 792908
 
 include PBackgroundIDBSharedTypes;
 
 include "mozilla/dom/indexedDB/SerializationHelpers.h";
 
 using struct mozilla::void_t
   from "ipc/IPCMessageUtils.h";
 
--- a/dom/indexedDB/PBackgroundIDBDatabase.ipdl
+++ b/dom/indexedDB/PBackgroundIDBDatabase.ipdl
@@ -3,18 +3,22 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include protocol PBackgroundIDBDatabaseFile;
 include protocol PBackgroundIDBDatabaseRequest;
 include protocol PBackgroundIDBFactory;
 include protocol PBackgroundIDBTransaction;
 include protocol PBackgroundIDBVersionChangeTransaction;
 include protocol PBackgroundMutableFile;
-include protocol PBlob;
+include protocol PChildToParentStream; // FIXME: bug 792908
+include protocol PFileDescriptorSet; // FIXME: bug 792908
+include protocol PIPCBlobInputStream; // FIXME: bug 792908
+include protocol PParentToChildStream; // FIXME: bug 792908
 
+include IPCBlob;
 include InputStreamParams;
 include PBackgroundIDBSharedTypes;
 
 include "mozilla/dom/indexedDB/SerializationHelpers.h";
 
 using struct mozilla::null_t
   from "ipc/IPCMessageUtils.h";
 
@@ -54,17 +58,17 @@ sync protocol PBackgroundIDBDatabase
 
 parent:
   async DeleteMe();
 
   async Blocked();
 
   async Close();
 
-  async PBackgroundIDBDatabaseFile(PBlob blob);
+  async PBackgroundIDBDatabaseFile(IPCBlob blob);
 
   async PBackgroundIDBDatabaseRequest(DatabaseRequestParams params);
 
   async PBackgroundIDBTransaction(nsString[] objectStoreNames, Mode mode);
 
 child:
   async __delete__();
 
--- a/dom/indexedDB/PBackgroundIDBRequest.ipdl
+++ b/dom/indexedDB/PBackgroundIDBRequest.ipdl
@@ -1,16 +1,19 @@
 /* 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/. */
 
 include protocol PBackgroundIDBTransaction;
 include protocol PBackgroundIDBVersionChangeTransaction;
 include protocol PBackgroundMutableFile;
-include protocol PBlob;
+include protocol PChildToParentStream; // FIXME: bug 792908
+include protocol PFileDescriptorSet; // FIXME: bug 792908
+include protocol PIPCBlobInputStream; // FIXME: bug 792908
+include protocol PParentToChildStream; // FIXME: bug 792908
 
 include PBackgroundIDBSharedTypes;
 
 include "mozilla/dom/indexedDB/SerializationHelpers.h";
 
 using struct mozilla::void_t
   from "ipc/IPCMessageUtils.h";
 
--- a/dom/indexedDB/PBackgroundIDBSharedTypes.ipdlh
+++ b/dom/indexedDB/PBackgroundIDBSharedTypes.ipdlh
@@ -1,17 +1,21 @@
 /* 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/. */
 
 include protocol PBackgroundIDBDatabaseFile;
 include protocol PBackgroundMutableFile;
-include protocol PBlob;
+include protocol PChildToParentStream; // FIXME: bug 792908
+include protocol PFileDescriptorSet; // FIXME: bug 792908
+include protocol PIPCBlobInputStream; // FIXME: bug 792908
+include protocol PParentToChildStream; // FIXME: bug 792908
 
 include DOMTypes;
+include IPCBlob;
 include ProtocolTypes;
 
 include "mozilla/dom/indexedDB/SerializationHelpers.h";
 include "mozilla/dom/quota/SerializationHelpers.h";
 
 using struct mozilla::null_t
   from "ipc/IPCMessageUtils.h";
 
@@ -47,17 +51,17 @@ struct SerializedKeyRange
   bool lowerOpen;
   bool upperOpen;
   bool isOnly;
 };
 
 union BlobOrMutableFile
 {
   null_t;
-  PBlob;
+  IPCBlob;
   PBackgroundMutableFile;
 };
 
 struct SerializedStructuredCloneFile
 {
   BlobOrMutableFile file;
   FileType type;
 };
--- a/dom/indexedDB/PBackgroundIDBVersionChangeTransaction.ipdl
+++ b/dom/indexedDB/PBackgroundIDBVersionChangeTransaction.ipdl
@@ -2,17 +2,20 @@
  * 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/. */
 
 include protocol PBackgroundIDBCursor;
 include protocol PBackgroundIDBDatabase;
 include protocol PBackgroundIDBDatabaseFile;
 include protocol PBackgroundIDBRequest;
 include protocol PBackgroundMutableFile;
-include protocol PBlob;
+include protocol PChildToParentStream; // FIXME: bug 792908
+include protocol PFileDescriptorSet; // FIXME: bug 792908
+include protocol PIPCBlobInputStream; // FIXME: bug 792908
+include protocol PParentToChildStream; // FIXME: bug 792908
 
 include PBackgroundIDBSharedTypes;
 
 namespace mozilla {
 namespace dom {
 namespace indexedDB {
 
 protocol PBackgroundIDBVersionChangeTransaction