This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
fulfill, resolve and reject algorithms take the synchronous flag. If it is set the callbacks are processed synchronously i.e. simply called. If we chain promises and fulfill the original resolver, the promises will be resolved synchronously, which means stack frames in proportion to the length of the chain will be consumed. For example, the following statements leads to a stack overflow error in Chrome. var resolver; var id = 0; var N = 10000; var promise = new Promise(function(r) {resolver = r;}); for (var i = 0; i < N; ++i) { promise = promise.then(function() {console.log(id++)}); } resolver.resolve(4); Promise.every(Promise.every(...(Promise.every(promise))...)) has the same problem.
This is solved by the replacement hosted here: https://github.com/domenic/promises-unwrapping