From c152f140c3e21133612dca9e79671933f7b29f4f Mon Sep 17 00:00:00 2001 From: Nikhil Marathe Date: Fri, 18 Jul 2014 18:13:47 -0700 Subject: [PATCH] Bug 1023547 - Fix intermittent dom/workers/test/test_promise.html failure. r=bz --- dom/promise/tests/test_promise.html | 9 ++++++--- dom/workers/test/promise_worker.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dom/promise/tests/test_promise.html b/dom/promise/tests/test_promise.html index 8ca17fbe76df..56e579a63a24 100644 --- a/dom/promise/tests/test_promise.html +++ b/dom/promise/tests/test_promise.html @@ -636,11 +636,14 @@ function promiseResolveThenableCleanStack() { // 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); } diff --git a/dom/workers/test/promise_worker.js b/dom/workers/test/promise_worker.js index d3d1fef17896..97275995fef0 100644 --- a/dom/workers/test/promise_worker.js +++ b/dom/workers/test/promise_worker.js @@ -672,11 +672,11 @@ function promiseResolveThenableCleanStack() { // 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(); });