-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Which behavior is correct? #183
Comments
I'll look into this more later but it's worth noting that in general Firefox is very bad at following the ES2015 spec, especially around ordering. |
I wrote the tests and my-promise implementation as the previous draft (rev 30). Are there any changes about promise in rev 31? |
It's not possible to avoid the leak at all if you implement ES6, there is no state adoption relaxation like there is in Promises/A+ - you must always call |
@domenic you are right, FF is not correct (I don't know why I thought it's correct, may be I slept too little :-) @petkaantonov I think opt is possible, you just need to make sure it's instanceof Promise and the then method is same as PromisePrototype.then |
@hax That doesn't help though, the spec needs to be relaxed or a leak is forced (even small leak that you have is a problem for servers) |
@petkaantonov About "then" logs, you may have noticed an interesting thing is that Chrome canary and IE 11 called "then" several times , which no other Promise/A+ implementations do. It seems be able to avoid leak also. I will test them after my vacation. |
The only difference is that the leaks don't show up as Promise constructor anymore, but it's definitely there (running empty tab with nothing but the infinite promise leak loop): |
Any updates? ping @domenic :) |
My update: Firefox 37 now have the same order result as my-promise which I believe is strictly follow the ES6 spec. I will retest all other browsers and libraries this weekend. |
See https://github.com/hax/test-promises/blob/master/promises-spec.md
As my understanding of latest es6 draft, my-promise implementation seem correct.
But maybe some order is not important. Especially the order of "a1 a2 a3 a4 a5 a6 b1 b2 b3 b4 b5 b6". It's relate to tj/co#180 (comment) . When I write my-promise, I found that it's impossible to avoid the leak completely, each nest promise need at least one pointer to preserve the order. bluebird/when have optimized to avoid the leak at all but not preserve the order. So if #179 is a case should be considered, we need relax ES6 spec to allow different order.
The text was updated successfully, but these errors were encountered: