Backed out changeset dec83a85f824 (bug 1358109) for failing mochitest dom/indexedDB/test/test_blob_worker_xhr_read_slice.html. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 24 Apr 2017 15:44:10 +0200
changeset 354648 d8868683036b331ec66764056fad6ca8234427a6
parent 354647 9f488fa8dae133819c3b26a7ffee8758962e16bf
child 354649 8aa21851c1f3426451a28aea1dac5301b74af5b1
push id31707
push userkwierso@gmail.com
push dateMon, 24 Apr 2017 22:53:41 +0000
treeherdermozilla-central@abdcc8dfc283 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1358109
milestone55.0a1
backs outdec83a85f824c2afb541ecbda08dab6aa1abcff0
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
Backed out changeset dec83a85f824 (bug 1358109) for failing mochitest dom/indexedDB/test/test_blob_worker_xhr_read_slice.html. r=backout
dom/file/ipc/IPCBlobUtils.h
dom/ipc/FilePickerParent.cpp
dom/ipc/PFilePicker.ipdl
widget/nsFilePickerProxy.cpp
--- a/dom/file/ipc/IPCBlobUtils.h
+++ b/dom/file/ipc/IPCBlobUtils.h
@@ -149,23 +149,21 @@ already_AddRefed<BlobImpl>
 Deserialize(const IPCBlob& aIPCBlob);
 
 // These 4 methods serialize aBlobImpl into aIPCBlob using the right manager.
 
 nsresult
 Serialize(BlobImpl* aBlobImpl, nsIContentChild* aManager, IPCBlob& aIPCBlob);
 
 nsresult
-Serialize(BlobImpl* aBlobImpl, mozilla::ipc::PBackgroundChild* aManager,
-          IPCBlob& aIPCBlob);
+Serialize(BlobImpl* aBlobImpl, PBackgroundChild* aManager, IPCBlob& aIPCBlob);
 
 nsresult
 Serialize(BlobImpl* aBlobImpl, nsIContentParent* aManager, IPCBlob& aIPCBlob);
 
 nsresult
-Serialize(BlobImpl* aBlobImpl, mozilla::ipc::PBackgroundParent* aManager,
-          IPCBlob& aIPCBlob);
+Serialize(BlobImpl* aBlobImpl, PBackgroundParent* aManager, IPCBlob& aIPCBlob);
 
 } // IPCBlobUtils
 } // dom namespace
 } // mozilla namespace
 
 #endif // mozilla_dom_IPCBlobUtils_h
--- a/dom/ipc/FilePickerParent.cpp
+++ b/dom/ipc/FilePickerParent.cpp
@@ -12,17 +12,17 @@
 #include "nsIFile.h"
 #include "nsISimpleEnumerator.h"
 #include "mozilla/Unused.h"
 #include "mozilla/dom/FileBlobImpl.h"
 #include "mozilla/dom/FileSystemSecurity.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/TabParent.h"
-#include "mozilla/dom/IPCBlobUtils.h"
+#include "mozilla/dom/ipc/BlobParent.h"
 
 using mozilla::Unused;
 using namespace mozilla::dom;
 
 NS_IMPL_ISUPPORTS(FilePickerParent::FilePickerShownCallback,
                   nsIFilePickerShownCallback);
 
 NS_IMETHODIMP
@@ -39,16 +39,21 @@ FilePickerParent::FilePickerShownCallbac
 {
   mFilePickerParent = nullptr;
 }
 
 FilePickerParent::~FilePickerParent()
 {
 }
 
+// Before sending a blob to the child, we need to get its size and modification
+// date. Otherwise it will be sent as a "mystery blob" by
+// GetOrCreateActorForBlob, which will cause problems for the child
+// process. This runnable stat()s the file off the main thread.
+//
 // We run code in three places:
 // 1. The main thread calls Dispatch() to start the runnable.
 // 2. The stream transport thread stat()s the file in Run() and then dispatches
 // the same runnable on the main thread.
 // 3. The main thread sends the results over IPC.
 FilePickerParent::IORunnable::IORunnable(FilePickerParent *aFPParent,
                                          nsTArray<nsCOMPtr<nsIFile>>& aFiles,
                                          bool aIsDirectory)
@@ -159,33 +164,28 @@ FilePickerParent::SendFilesOrDirectories
                                      aData[0].mDirectoryPath);
 
     InputDirectory input;
     input.directoryPath() = aData[0].mDirectoryPath;
     Unused << Send__delete__(this, input, mResult);
     return;
   }
 
-  InfallibleTArray<IPCBlob> ipcBlobs;
+  InfallibleTArray<PBlobParent*> blobs;
 
   for (unsigned i = 0; i < aData.Length(); i++) {
-    IPCBlob ipcBlob;
-
     MOZ_ASSERT(aData[i].mType == BlobImplOrString::eBlobImpl);
-    nsresult rv = IPCBlobUtils::Serialize(aData[i].mBlobImpl, parent, ipcBlob);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      break;
+    BlobParent* blobParent = parent->GetOrCreateActorForBlobImpl(aData[i].mBlobImpl);
+    if (blobParent) {
+      blobs.AppendElement(blobParent);
     }
-
-    ipcBlobs.AppendElement(ipcBlob);
   }
 
   InputBlobs inblobs;
-  inblobs.blobs().SwapElements(ipcBlobs);
-
+  inblobs.blobsParent().SwapElements(blobs);
   Unused << Send__delete__(this, inblobs, mResult);
 }
 
 void
 FilePickerParent::Done(int16_t aResult)
 {
   mResult = aResult;
 
--- a/dom/ipc/PFilePicker.ipdl
+++ b/dom/ipc/PFilePicker.ipdl
@@ -1,30 +1,25 @@
 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
 /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
 /* 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 PBlob;
 include protocol PBrowser;
-include protocol PChildToParentStream;
-include protocol PIPCBlobInputStream;
-include protocol PFileDescriptorSet;
-include protocol PParentToChildStream;
-
-include IPCBlob;
 
 using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
 
 namespace mozilla {
 namespace dom {
 
 struct InputBlobs
 {
-  IPCBlob[] blobs;
+  PBlob[] blobs;
 };
 
 struct InputDirectory
 {
   nsString directoryPath;
 };
 
 union MaybeInputData
--- a/widget/nsFilePickerProxy.cpp
+++ b/widget/nsFilePickerProxy.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsFilePickerProxy.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIFile.h"
 #include "mozilla/dom/Directory.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/TabChild.h"
-#include "mozilla/dom/IPCBlobUtils.h"
+#include "mozilla/dom/ipc/BlobChild.h"
 
 using namespace mozilla::dom;
 
 NS_IMPL_ISUPPORTS(nsFilePickerProxy, nsIFilePicker)
 
 nsFilePickerProxy::nsFilePickerProxy()
   : mSelectedType(0)
   , mIPCActive(false)
@@ -149,19 +149,20 @@ nsFilePickerProxy::Open(nsIFilePickerSho
   return NS_OK;
 }
 
 mozilla::ipc::IPCResult
 nsFilePickerProxy::Recv__delete__(const MaybeInputData& aData,
                                   const int16_t& aResult)
 {
   if (aData.type() == MaybeInputData::TInputBlobs) {
-    const InfallibleTArray<IPCBlob>& blobs = aData.get_InputBlobs().blobs();
+    const InfallibleTArray<PBlobChild*>& blobs = aData.get_InputBlobs().blobsChild();
     for (uint32_t i = 0; i < blobs.Length(); ++i) {
-      RefPtr<BlobImpl> blobImpl = IPCBlobUtils::Deserialize(blobs[i]);
+      BlobChild* actor = static_cast<BlobChild*>(blobs[i]);
+      RefPtr<BlobImpl> blobImpl = actor->GetBlobImpl();
       NS_ENSURE_TRUE(blobImpl, IPC_OK());
 
       if (!blobImpl->IsFile()) {
         return IPC_OK();
       }
 
       nsPIDOMWindowInner* inner =
         mParent ? mParent->GetCurrentInnerWindow() : nullptr;