Backed out changeset c743f069da42 (bug 1307747) for test failures in test_blob_sliced_from_child_process.html
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 05 Oct 2016 17:06:29 +0200
changeset 421219 9f7e86ac265a616423e64d230834d55b716ee3b4
parent 421218 ad3ce51b1324f7b34c3310452666ee5635ed9ae8
child 421259 c52dec387187a918627d39b733dff7314b2f7c52
push id31424
push userbmo:afarre@mozilla.com
push dateWed, 05 Oct 2016 16:04:50 +0000
bugs1307747
milestone52.0a1
backs outc743f069da42cd9d1e87a470b1def45d2d619a73
Backed out changeset c743f069da42 (bug 1307747) for test failures in test_blob_sliced_from_child_process.html
dom/base/test/browser.ini
dom/base/test/browser_bug1307747.js
dom/base/test/empty.html
dom/ipc/Blob.cpp
--- a/dom/base/test/browser.ini
+++ b/dom/base/test/browser.ini
@@ -1,11 +1,10 @@
 [DEFAULT]
 support-files =
-  empty.html
   file_bug1011748_redirect.sjs
   file_bug1011748_OK.sjs
   file_messagemanager_unload.html
   file_use_counter_outer.html
   file_use_counter_svg_getElementById.svg
   file_use_counter_svg_currentScale.svg
   file_use_counter_svg_background.html
   file_use_counter_svg_list_style_image.html
@@ -22,9 +21,8 @@ tags = mcb
 [browser_messagemanager_loadprocessscript.js]
 [browser_messagemanager_targetframeloader.js]
 [browser_messagemanager_unload.js]
 [browser_pagehide_on_tab_close.js]
 skip-if = e10s # this tests non-e10s behavior. it's not expected to work in e10s.
 [browser_state_notifications.js]
 skip-if = true # Bug 1271028
 [browser_use_counters.js]
-[browser_bug1307747.js]
deleted file mode 100644
--- a/dom/base/test/browser_bug1307747.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
-
-var {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
-
-const BASE_URI = "http://mochi.test:8888/browser/dom/base/test/empty.html";
-
-add_task(function* test_initialize() {
-  let tab = gBrowser.addTab(BASE_URI);
-  let browser = gBrowser.getBrowserForTab(tab);
-
-  let blob = yield ContentTask.spawn(browser, null, function() {
-    let blob = new Blob([new Array(1024*1024).join('123456789ABCDEF')]);
-    return blob;
-  });
-
-  ok(blob, "We have a blob!");
-  is(blob.size, new Array(1024*1024).join('123456789ABCDEF').length, "The size matches");
-
-  let status = yield ContentTask.spawn(browser, blob, function(blob) {
-    return new Promise(resolve => {
-      let fr = new content.FileReader();
-      fr.readAsText(blob);
-      fr.onloadend = function() {
-        resolve(fr.result == new Array(1024*1024).join('123456789ABCDEF'));
-      }
-    });
-  });
-
-  ok(status, "Data match!");
-
-  yield BrowserTestUtils.removeTab(tab);
-});
deleted file mode 100644
--- a/dom/ipc/Blob.cpp
+++ b/dom/ipc/Blob.cpp
@@ -718,35 +718,37 @@ CreateBlobImpl(const IPCStream& aStream,
   MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
 
   nsCOMPtr<nsIInputStream> inputStream = DeserializeIPCStream(aStream);
   if (!inputStream) {
     ASSERT_UNLESS_FUZZING();
     return nullptr;
   }
 
+  uint64_t available;
+  MOZ_ALWAYS_SUCCEEDS(inputStream->Available(&available));
+
   RefPtr<BlobImpl> blobImpl;
   if (!aMetadata.mHasRecursed && aMetadata.IsFile()) {
-    if (aMetadata.mLength) {
+    if (available) {
       blobImpl =
         new BlobImplStream(inputStream,
                            aMetadata.mName,
                            aMetadata.mContentType,
                            aMetadata.mLastModifiedDate,
-                           aMetadata.mLength);
+                           available);
     } else {
       blobImpl =
         new EmptyBlobImpl(aMetadata.mName,
                           aMetadata.mContentType,
                           aMetadata.mLastModifiedDate);
     }
-  } else if (aMetadata.mLength) {
+  } else if (available) {
     blobImpl =
-      new BlobImplStream(inputStream, aMetadata.mContentType,
-                         aMetadata.mLength);
+      new BlobImplStream(inputStream, aMetadata.mContentType, available);
   } else {
     blobImpl = new EmptyBlobImpl(aMetadata.mContentType);
   }
 
   MOZ_ALWAYS_SUCCEEDS(blobImpl->SetMutable(false));
 
   return blobImpl.forget();
 }