Bug 1023547 - Fix intermittent dom/workers/test/test_promise.html failure. r=bz
☠☠ backed out by 131e77486177 ☠ ☠
authorNikhil Marathe <nsm.nikhil@gmail.com>
Fri, 18 Jul 2014 18:13:47 -0700
changeset 195120 38bfa2af2bd8ba1af78fa917d67dd2488b9f7edb
parent 195119 fc53a345824fade142f043cb771a1179b56487b3
child 195121 917fbaf92fa280cbb1011d924175d23e4dff772a
push id46520
push userryanvm@gmail.com
push dateSun, 20 Jul 2014 18:46:11 +0000
treeherdermozilla-inbound@1cda8d9d66ba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1023547
milestone33.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 1023547 - Fix intermittent dom/workers/test/test_promise.html failure. r=bz
dom/promise/tests/test_promise.html
dom/workers/test/promise_worker.js
--- a/dom/promise/tests/test_promise.html
+++ b/dom/promise/tests/test_promise.html
@@ -631,21 +631,24 @@ function promiseResolveThenableCleanStac
   var results = [];
 
   Promise.resolve(thenable).then(incX);
   results.push(x);
 
   // check what happens after all "next cycle" steps
   // have had a chance to complete
   setTimeout(function(){
-    results.push(x);
     // Result should be [0, 2] since `thenable` will be called async.
     is(results[0], 0, "Expected thenable to be called asynchronously");
-    is(results[1], 2, "Expected thenable to be called asynchronously");
-    runTest();
+    // See Bug 1023547 comment 13 for why this check has to be gated on p.
+    p.then(function() {
+      results.push(x);
+      is(results[1], 2, "Expected thenable to be called asynchronously");
+      runTest();
+    });
   },1000);
 }
 
 // Bug 1008467 - Promise fails with "too much recursion".
 // The bug was that the callbacks passed to a thenable would resolve the
 // promise synchronously when the fulfill handler returned a non-thenable.
 //
 // For example:
--- a/dom/workers/test/promise_worker.js
+++ b/dom/workers/test/promise_worker.js
@@ -667,21 +667,21 @@ function promiseResolveThenableCleanStac
   var results = [];
 
   var p = Promise.resolve(thenable).then(incX);
   results.push(x);
 
   // check what happens after all "next cycle" steps
   // have had a chance to complete
   setTimeout(function(){
-    results.push(x);
     // Result should be [0, 2] since `thenable` will be called async.
     is(results[0], 0, "Expected thenable to be called asynchronously");
     // See Bug 1023547 comment 13 for why this check has to be gated on p.
     p.then(function() {
+      results.push(x);
       is(results[1], 2, "Expected thenable to be called asynchronously");
       runTest();
     });
   },1000);
 }
 
 var tests = [
     promiseResolve,