Closed
Bug 1323615
Opened 9 years ago
Closed 9 years ago
unexpected behavior with promise based code inside iterator
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 449811
People
(Reporter: djrmuv, Unassigned)
Details
Attachments
(1 file)
|
371 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161130084355
Steps to reproduce:
ALSO check the attached file
var arr = ['a', 'b', 'c']
for (let item of arr) {
new Promise((resolve, reject) => {
window.setTimeout(function() {
resolve(item);
}, Math.random() * 200);
}).then((v) => {
console.log(v);
})
}
Actual results:
so in chrome it prints a permutation of the arr elements, whereas in firefox it always prints "c" three times. i dont know which should be the correct behavior but the chrome one seems more intuitive
this problem is also present in firefix nightly
Expected results:
logging a permutation of arr
Comment 1•9 years ago
|
||
It should be fixed in Firefox 51 (bug 449811)
can you check if it works as expected on Firefox 51 beta?
Flags: needinfo?(djrmuv)
Updated•9 years ago
|
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
mm yeah it works on the developer edition 51.0a2, but it does not on nightly, but i guess it will also be fixed there thanks.
Comment 3•9 years ago
|
||
if it doesn't work on nightly, can you post the standalone testcase?
and also what's the version and build date of the nightly you've tested?
when I evaluate the code in web console, it prints permutation of arr.
Comment 4•9 years ago
|
||
I've tested on 53.0a1 (2016-12-13) (64-bit).
Comment 6•9 years ago
|
||
okay, thank you :)
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Flags: needinfo?(djrmuv)
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•