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

Open
hax opened this Issue Feb 2, 2015 · 9 comments

Comments

Projects
None yet
3 participants
@hax
Copy link

hax commented Feb 2, 2015

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.

@domenic

This comment has been minimized.

Copy link
Member

domenic commented Feb 2, 2015

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.

@hax

This comment has been minimized.

Copy link

hax commented Feb 2, 2015

I wrote the tests and my-promise implementation as the previous draft (rev 30). Are there any changes about promise in rev 31?

@petkaantonov

This comment has been minimized.

Copy link
Contributor

petkaantonov commented Feb 2, 2015

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 x.then(...) (that's why some Promises/A+ implementations in the report have not logged any "then" at all)

@hax

This comment has been minimized.

Copy link

hax commented Feb 2, 2015

@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

@petkaantonov

This comment has been minimized.

Copy link
Contributor

petkaantonov commented Feb 2, 2015

@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)

@hax

This comment has been minimized.

Copy link

hax commented Feb 2, 2015

@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.

@petkaantonov

This comment has been minimized.

Copy link
Contributor

petkaantonov commented Feb 2, 2015

Version 42.0.2292.0 canary still leaks as much as any other... there are no changes to V8's promise implementation in the last 2 months either.

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):

leak

@hax

This comment has been minimized.

Copy link

hax commented Mar 18, 2015

Any updates? ping @domenic :)

@hax

This comment has been minimized.

Copy link

hax commented May 20, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment