Bug 1023547 - Fix intermittent dom/workers/test/test_promise.html failure. r=bz

--HG--
extra : transplant_source : %91%24G%DA%8F%B6%95%CEY%3Ff1%B4%3B%CA%23%DB5%ED%88
This commit is contained in:
Nikhil Marathe 2014-07-11 20:21:54 -07:00
Родитель 95b32dc109
Коммит a12adec32a
1 изменённых файлов: 6 добавлений и 11 удалений

Просмотреть файл

@ -556,14 +556,6 @@ function promiseRaceValuesArray() {
}
function promiseRacePromiseArray() {
function timeoutPromise(n) {
return new Promise(function(resolve) {
setTimeout(function() {
resolve(n);
}, n);
});
}
var arr = [
new Promise(function(resolve) {
resolve("first");
@ -674,7 +666,7 @@ function promiseResolveThenableCleanStack() {
var thenable = { then: immed };
var results = [];
Promise.resolve(thenable).then(incX);
var p = Promise.resolve(thenable).then(incX);
results.push(x);
// check what happens after all "next cycle" steps
@ -683,8 +675,11 @@ function promiseResolveThenableCleanStack() {
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() {
is(results[1], 2, "Expected thenable to be called asynchronously");
runTest();
});
},1000);
}