I was just implementing subclassing of Promise in Gecko, when I realized that given a Promise subclass MyPromise these two calls:

  MyPromise.race([])
  MyPromise.all([])

will take MyPromise[@@species] into account when creating the return value, but these two calls:

  MyPromise.resolve()
  MyPromise.reject()

will not; they will invoke MyPromise itself, not MyPromise[@@species].

This is because http://www.ecma-international.org/ecma-262/6.0/#sec-promise.all and http://www.ecma-international.org/ecma-262/6.0/#sec-promise.race do the whole @@species thing but http://www.ecma-international.org/ecma-262/6.0/#sec-promise.reject and http://www.ecma-international.org/ecma-262/6.0/#sec-promise.resolve do not.

Is this behavior intentional? If so, I'd really like to understand the reason for it.

-Boris
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to