NEW 160857
Promise API does not fully process microtask checkpoint: spec violation
https://bugs.webkit.org/show_bug.cgi?id=160857
Summary Promise API does not fully process microtask checkpoint: spec violation
Aleksandar Totic
Reported 2016-08-15 12:19:08 PDT
Created attachment 286076 [details] This file will demonstrate the bug Promises microtask queue does not fully process microtasks queued while microtask is running. According to spec, microtask queue should loop until it is empty. Why is this bug important? Promises are often used by developers for scheduling. When they are, developers assume Promise.resolve() means "execute this function right after this script returns". This bug violates this promise. FF/Edge/Chrome get this right. It'd be great if all browsers worked the same. Example: Promise.resolved() .then(() => { console.log("Promise 1"); return Promise.resolve(); }) .then(() => { console.log("Promise 2"); } window.setTimeout(function() { console.log('timeout'); }, 0); Might also be related to Bug #140043. I've attached a test case.
Attachments
This file will demonstrate the bug (3.13 KB, text/html)
2016-08-15 12:19 PDT, Aleksandar Totic
no flags
Aleksandar Totic
Comment 1 2016-08-16 13:47:01 PDT
Noticed that my example was not clear. The example should print: Promise 1 Promise 2 timeout In Safari, it prints Promise 1 timeout Promise 2
Note You need to log in before you can comment on or make changes to this bug.