Closed domenic closed 11 years ago
Why is it more important to detect cycles here than with while(1)?
That's a fair question, and the answer may be that it's not. Fixing Resolve(p, p)
is a clear win, as it's cheap and prevents var p = fulfilledPromise.then(() => p)
. But full cycle detection is almost certainly more costly, and might not be a good idea.
To be clear, the scenario that cycle detection would solve would be
var p1 = fulfilledPromise.then(() => p2);
var p2 = fulfilledPromise.then(() => p1);
Cycle detection would consist of rejecting both p1
and p2
with an error (probably a TypeError
).
I don't see why this needs fixing at all. Devtools can detect it without any spec changes.
That's a great point. Closing.
Resolve(p, p)
.