Bug 1120336 - Land the test-only changes on beta. r=khuey, a=test-only
authorBen Turner <bent.mozilla@gmail.com>
Tue, 13 Jan 2015 14:15:04 -0800
changeset 242993 a6e5dedbd0c0
parent 242992 e8effa80da5b
child 242994 4036f72a0b10
push id4357
push userryanvm@gmail.com
push date2015-01-22 19:21 +0000
treeherdermozilla-beta@3096b7b44265 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey, test-only
bugs1120336
milestone36.0
Bug 1120336 - Land the test-only changes on beta. r=khuey, a=test-only
dom/indexedDB/test/mochitest.ini
dom/indexedDB/test/test_blob_worker_xhr_post_multifile.html
dom/indexedDB/test/test_blob_worker_xhr_read_slice.html
--- a/dom/indexedDB/test/mochitest.ini
+++ b/dom/indexedDB/test/mochitest.ini
@@ -119,18 +119,22 @@ skip-if = (buildapp == 'b2g' && toolkit 
 # This test can only run in the main process.
 skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
 [test_blob_simple.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
 [test_blob_worker_crash.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
 [test_blob_worker_xhr_post.html]
 skip-if = ((buildapp == 'b2g' && toolkit != 'gonk') || (e10s && toolkit == 'windows')) # Bug 931116
+[test_blob_worker_xhr_post_multifile.html]
+skip-if = ((buildapp == 'b2g' && toolkit != 'gonk') || (e10s && toolkit == 'windows')) # Bug 931116
 [test_blob_worker_xhr_read.html]
 skip-if = ((buildapp == 'b2g' && toolkit != 'gonk') || (e10s && toolkit == 'windows')) # Bug 931116
+[test_blob_worker_xhr_read_slice.html]
+skip-if = ((buildapp == 'b2g' && toolkit != 'gonk') || (e10s && toolkit == 'windows')) # Bug 931116
 [test_blocked_order.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
 [test_bug937006.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
 [test_clear.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
 [test_complex_keyPaths.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
copy from dom/indexedDB/test/test_blob_worker_xhr_post.html
copy to dom/indexedDB/test/test_blob_worker_xhr_post_multifile.html
--- a/dom/indexedDB/test/test_blob_worker_xhr_post.html
+++ b/dom/indexedDB/test/test_blob_worker_xhr_post_multifile.html
@@ -5,16 +5,22 @@
 <html>
 <head>
   <title>Indexed Database Property Test</title>
 
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 
   <script type="text/javascript;version=1.7">
+  /**
+   * Create a composite/multi-file Blob on the worker, then post it as an XHR
+   * payload and ensure that we don't hang/generate an assertion/etc. but
+   * instead generate the expected 404.  This test is basically the same as
+   * test_blob_worker_xhr_post.html except for the composite Blob.
+   */
   function testSteps()
   {
     const BLOB_DATA = ["fun ", "times ", "all ", "around!"];
     const BLOB_TYPE = "text/plain";
     const BLOB_SIZE = BLOB_DATA.join("").length;
 
     info("Setting up");
 
@@ -57,46 +63,40 @@
     event = yield undefined;
 
     blob = event.target.result;
 
     ok(blob instanceof Blob, "Got a blob");
     is(blob.size, BLOB_SIZE, "Correct size");
     is(blob.type, BLOB_TYPE, "Correct type");
 
-    let slice = blob.slice(0, BLOB_DATA[0].length, BLOB_TYPE);
-
-    ok(slice instanceof Blob, "Slice returned a blob");
-    is(slice.size, BLOB_DATA[0].length, "Correct size for slice");
-    is(slice.type, BLOB_TYPE, "Correct type for slice");
-
-    info("Sending slice to a worker");
-
     function workerScript() {
       onmessage = function(event) {
         var blob = event.data;
+        var compositeBlob = new Blob(["preceding string. ", blob],
+                                     { type: "text/plain" });
         var xhr = new XMLHttpRequest();
         // We just want to make sure the error case doesn't fire; it's fine for
         // us to just want a 404.
         xhr.open('POST', 'http://mochi.test:8888/does-not-exist', true);
         xhr.onload = function() {
           postMessage({ status: xhr.status });
         };
         xhr.onerror = function() {
           postMessage({ status: 'error' });
         }
-        xhr.send(blob);
+        xhr.send(compositeBlob);
       }
     }
 
     let workerScriptUrl =
       URL.createObjectURL(new Blob(["(", workerScript.toSource(), ")()"]));
 
     let xhrWorker = new Worker(workerScriptUrl);
-    xhrWorker.postMessage(slice);
+    xhrWorker.postMessage(blob);
     xhrWorker.onmessage = grabEventAndContinueHandler;
     event = yield undefined;
 
     is(event.data.status, 404, "XHR generated the expected 404");
     xhrWorker.terminate();
 
     URL.revokeObjectURL(workerScriptUrl);
 
copy from dom/indexedDB/test/test_blob_worker_xhr_read.html
copy to dom/indexedDB/test/test_blob_worker_xhr_read_slice.html
--- a/dom/indexedDB/test/test_blob_worker_xhr_read.html
+++ b/dom/indexedDB/test/test_blob_worker_xhr_read_slice.html
@@ -7,18 +7,19 @@
   <title>Indexed Database Blob Read From Worker</title>
 
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 
   <script type="text/javascript;version=1.7">
   /**
    * Create an IndexedDB-backed Blob, send it to the worker, try and read the
-   * contents of the Blob from the worker using an XHR.  Ideally, we don't
-   * deadlock the main thread.
+   * *SLICED* contents of the Blob from the worker using an XHR.  This is
+   * (as of the time of writing this) basically the same as
+   * test_blob_worker_xhr_read.html but with slicing added.
    */
   function testSteps()
   {
     const BLOB_DATA = ["Green"];
     const BLOB_TYPE = "text/plain";
     const BLOB_SIZE = BLOB_DATA.join("").length;
 
     info("Setting up");
@@ -67,17 +68,18 @@
     is(blob.size, BLOB_SIZE, "Correct size");
     is(blob.type, BLOB_TYPE, "Correct type");
 
     info("Sending blob to a worker");
 
     function workerScript() {
       onmessage = function(event) {
         var blob = event.data;
-        var blobUrl = URL.createObjectURL(blob);
+        var slicedBlob = blob.slice(0, 3, "text/plain");
+        var blobUrl = URL.createObjectURL(slicedBlob);
         var xhr = new XMLHttpRequest();
         xhr.open('GET', blobUrl, true);
         xhr.responseType = 'text';
         xhr.onload = function() {
           postMessage({ data: xhr.response });
           URL.revokeObjectURL(blobUrl);
         };
         xhr.onerror = function() {
@@ -91,17 +93,17 @@
     let workerScriptUrl =
       URL.createObjectURL(new Blob(["(", workerScript.toSource(), ")()"]));
 
     let xhrWorker = new Worker(workerScriptUrl);
     xhrWorker.postMessage(blob);
     xhrWorker.onmessage = grabEventAndContinueHandler;
     event = yield undefined;
 
-    is(event.data.data, "Green", "XHR returned expected payload.");
+    is(event.data.data, "Gre", "XHR returned expected sliced payload.");
     xhrWorker.terminate();
 
     URL.revokeObjectURL(workerScriptUrl);
 
     finishTest();
     yield undefined;
   }
   </script>