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();
});