* Take a potentially misbehaving resolver function and make sure * onFulfilled and onRejected are only called once. * * Makes no guarantees about asynchrony.
(fn, promise)
| 12993 | * Makes no guarantees about asynchrony. |
| 12994 | */ |
| 12995 | function doResolve(fn, promise) { |
| 12996 | var done = false; |
| 12997 | var res = tryCallTwo(fn, function (value) { |
| 12998 | if (done) return; |
| 12999 | done = true; |
| 13000 | resolve(promise, value); |
| 13001 | }, function (reason) { |
| 13002 | if (done) return; |
| 13003 | done = true; |
| 13004 | reject(promise, reason); |
| 13005 | }) |
| 13006 | if (!done && res === IS_ERROR) { |
| 13007 | done = true; |
| 13008 | reject(promise, LAST_ERROR); |
| 13009 | } |
| 13010 | } |
| 13011 | |
| 13012 | |
| 13013 | /***/ }), |
no test coverage detected