Closed
Bug 1038631
Opened 9 years ago
Closed 9 years ago
Promises should run before setTimeout
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 1013625
People
(Reporter: floitsch, Unassigned)
References
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.3 Safari/537.36 Steps to reproduce: var p = Promise.resolve(); // Give promise time to resolve. window.setTimeout(function() { // Schedule window.setTimeout(function() {console.log("foo"); }, 0); // Delay current function. var str = ""; for(var i = 0; i < 1000000; i++) { str += i; } glob = str; // Schedule on promise. p.then(function() {console.log("bar"); }); }, 10); Actual results: Prints: "foo" "bar" Expected results: Prints: "bar" "foo" Functions scheduled through a resolved promise should be executed before setTimeouts. Potentially related: issue 1013625
Updated•9 years ago
|
Comment 1•9 years ago
|
||
Confirmed in 33.0a1 (2014-07-20), Win 7
Status: UNCONFIRMED → NEW
Ever confirmed: true
![]() |
||
Comment 2•9 years ago
|
||
Dependency is wrong way around. I think this is exactly a duplicate of bug 1013625, in fact; it's caused by promise resolutions running off the same event queue as timeout handlers.
Comment 3•9 years ago
|
||
If there's a good way for me to help with this, please, let me know. I assumed that promises running alongside timeouts was the intended procedure, and wrote a fair bit of code to work around that.
Updated•9 years ago
|
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Assignee | ||
Updated•4 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•