summaryrefslogtreecommitdiffstats
path: root/dom/promise/tests/file_promise_and_timeout_ordering.js
blob: c83b5a6ac0b280d0cd350c9f60b4c3cc7ba1b05a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var log = [];
var resolvedPromise = Promise.resolve(null);
function schedulePromiseTask(f) {
  resolvedPromise.then(f);
}

setTimeout(function() {
  log.push('t1start');
  schedulePromiseTask(function() {
    log.push('promise');
  });
  log.push('t1end');
}, 10);

setTimeout(function() {
  log.push('t2');
  postMessage(log.join(', '));
}, 10);