Revert "trying and failing to make a crashing readable streams test" draft
authorAndrew McCreight <continuation@gmail.com>
Mon, 25 Nov 2019 11:49:55 -0800
changeset 2496063 263e5c4688672c30c3a78216f57729b8e441eb24
parent 2496062 0d9e7834e5e0cea4ae2522b96735056b977f2213
child 2496064 cd53a79a4c21e355a9d8c8fb984161e709c43583
push id455279
push useramccreight@mozilla.com
push dateMon, 25 Nov 2019 19:56:04 +0000
treeherdertry@59b13b57567a [default view] [failures only]
milestone72.0a1
Revert "trying and failing to make a crashing readable streams test" This reverts commit 7664a294a0761c323bedec77917fb027d821de89.
dom/tests/mochitest/fetch/common_readableStreams.js
--- a/dom/tests/mochitest/fetch/common_readableStreams.js
+++ b/dom/tests/mochitest/fetch/common_readableStreams.js
@@ -10,29 +10,16 @@ function makeBuffer(size) {
   let value = 0;
   for (let i = 0; i < 1000000; i += 1000) {
     buffer.set([++value % 255], i);
   }
 
   return buffer;
 }
 
-function spammo() {
-  if (self.SpecialPowers) {
-    self.SpecialPowers.forceGC();
-    self.SpecialPowers.forceGC();
-    self.SpecialPowers.forceGC();
-  }
-/*
-  for (let i = 0; i < 1000; i += 1) {
-    makeBuffer(BIG_BUFFER_SIZE);
-  }
-*/
-}
-
 function apply_compartment(compartment, data) {
   if (compartment == SAME_COMPARTMENT) {
     return self[data.func](data.args, self);
   }
 
   if (compartment == IFRAME_COMPARTMENT) {
     const iframe = document.querySelector("#iframe").contentWindow;
     return iframe[data.func](data.args, self);
@@ -98,34 +85,30 @@ async function test_timeout_continue(r, 
     that.ok(true, "We cannot have a blob here!");
   }
 }
 
 async function test_nonNativeStream(compartment) {
   info("test_nonNativeStream");
 
   let buffer = makeBuffer(BIG_BUFFER_SIZE);
-  let sizeo = buffer.byteLength;
-
-  info("Buffer size: " + sizeo);
+  info("Buffer size: " + buffer.byteLength);
 
   let r = new Response(
     new ReadableStream({
       start: controller => {
         controller.enqueue(buffer);
-        buffer = null;
-        spammo();
         controller.close();
       },
     })
   );
 
   return apply_compartment(compartment, {
     func: "test_nonNativeStream_continue",
-    args: { r, buffer : {byteLength: sizeo } },
+    args: { r, buffer },
   });
 }
 
 async function test_nonNativeStream_continue(data, that) {
   that.ok(
     data.r.body instanceof that.ReadableStream,
     "We have a ReadableStream"
   );
@@ -138,23 +121,17 @@ async function test_nonNativeStream_cont
   that.ok(b instanceof that.Response, "We have a cloned Response");
   that.ok(b.body instanceof that.ReadableStream, "We have a ReadableStream");
 
   let blob = await data.r.blob();
 
   that.ok(blob instanceof Blob, "We have a blob");
   let d = await a.body.getReader().read();
 
-  spammo();
   that.ok(!d.done, "We have read something!");
-
-  for (let z in d.value) {
-    that.isnot(z, "ZZZ", "whatever man");
-  }
-
   blob = await b.blob();
 
   that.ok(blob instanceof Blob, "We have a blob");
   that.is(blob.size, data.buffer.byteLength, "Blob size matches");
 }
 
 async function test_noUint8Array(compartment) {
   info("test_noUint8Array");
@@ -185,18 +162,17 @@ async function test_noUint8Array_continu
   }
 }
 
 async function test_pendingStream(compartment) {
   let r = new Response(
     new ReadableStream({
       start: controller => {
         controller.enqueue(makeBuffer(BIG_BUFFER_SIZE));
-        spammo();
-        // Let's keep this controller open.
+        // Let's keep this controler open.
         self.ccc = controller;
       },
     })
   );
 
   return apply_compartment(compartment, {
     func: "test_pendingStream_continue",
     args: r,
@@ -251,26 +227,24 @@ async function test_nonNativeStream_cach
   let buffer = makeBuffer(BIG_BUFFER_SIZE);
   info("Buffer size: " + buffer.byteLength);
 
   info("Storing a body as a string");
   let r = new Response(
     new ReadableStream({
       start: controller => {
         controller.enqueue(buffer);
-        buffer = null;
-        spammo();
         controller.close();
       },
     })
   );
 
   return apply_compartment(compartment, {
     func: "test_nonNativeStream_cache_continue",
-    args: { caches, cache, r },
+    args: { caches, cache, buffer, r },
   });
 }
 
 async function test_nonNativeStream_cache_continue(data, that) {
   await data.cache.put(data.url, data.r);
 
   that.info("Retrieving the stored value");
   let cacheResponse = await data.cache.match(data.url);
@@ -309,18 +283,16 @@ async function test_codeExecution(compar
 
   return apply_compartment(compartment, {
     func: "test_codeExecution_continue",
     args: r,
   });
 }
 
 async function test_codeExecution_continue(r, that) {
-  that.SpecialPowers.forceGC();
-
   function consoleListener() {
     that.SpecialPowers.addObserver(this, "console-api-log-event");
   }
 
   var promise = new Promise(resolve => {
     consoleListener.prototype = {
       observe(aSubject, aTopic, aData) {
         that.ok(true, "Something has been received");