domenic / promises-unwrapping

The ES6 promises spec, as per September 2013 TC39 meeting
1.23k stars 94 forks source link

UpdateDerived insufficiently asynchronous #14

Closed erights closed 10 years ago

erights commented 10 years ago

Diagnosis and fix at

http://esdiscuss.org/topic/ap2-bugs https://mail.mozilla.org/pipermail/es-discuss/2013-August/033043.html

seem correct to me.

domenic commented 10 years ago

This is invalid. CallHandler queues a microtask, but his sample implementation of CallHandler does not, leading to the observed bug.

Nathan-Wall commented 10 years ago

Ok, making CallHandler asynchronous does solve the issue as well. In that case, what is the purpose of "queue a microtask" in step 2.1 in UpdateDerived? Is it still necessary?

domenic commented 10 years ago

It's necessary since accessing then could trigger user code, if then were a getter, and additionally we need to call then in a new execution context anyway. @erights can explain in more depth why it's important for user code to always execute in a fresh execution context.

Nathan-Wall commented 10 years ago

Got it. Thanks!