bredele/bluff

A+ spec

Closed this issue · 0 comments

if x is an object or function,

  • Let then be x.then. [3.5]
  • If retrieving the property x.then results in a thrown exception e, reject promise with e as the reason.
  • If then is a function, call it with x as this, first argument resolvePromise, and second argument rejectPromise, where:
  • If/when resolvePromise is called with a value y, run Resolver
    • If/when rejectPromise is called with a reason r, reject promise with r.
    • If both resolvePromise and rejectPromise are called, or multiple calls to the same argument are made, the first call takes precedence, and any further calls are ignored.
    • If calling then throws an exception e,
    • If resolvePromise or rejectPromise have been called, ignore it.

Otherwise, reject promise with e as the reason.
If then is not a function, fulfill promise with x.