Don't test promise results on their thenability multiple times

Bergi a.d.bergi at web.de
Thu Apr 16 17:28:52 UTC 2015


Another, maybe simpler way to put this:

`Promise.resolve` needs to become idempotent, i.e. for all values `x` 
the expression

     Promise.resolve(x)

must behave exactly as the expression

     Promise.resolve(Promise.resolve(x));

where it accesses `x.then` only exactly once. The current spec would 
test for it twice, which even gives way to fulfilling promises with 
thenables - if only the `then` method is attached to your object after 
you have resolved your promise with it. Which could cause some quite 
unexpected results.

  Bergi


More information about the es-discuss mailing list