* Take a potentially misbehaving resolver function and make sure * onFulfilled and onRejected are only called once. * * Makes no guarantees about asynchrony.
(fn, promise)
| 13153 | * Makes no guarantees about asynchrony. |
| 13154 | */ |
| 13155 | function doResolve(fn, promise) { |
| 13156 | var done = false; |
| 13157 | var res = tryCallTwo(fn, function (value) { |
| 13158 | if (done) return; |
| 13159 | done = true; |
| 13160 | resolve(promise, value); |
| 13161 | }, function (reason) { |
| 13162 | if (done) return; |
| 13163 | done = true; |
| 13164 | reject(promise, reason); |
| 13165 | }) |
| 13166 | if (!done && res === IS_ERROR) { |
| 13167 | done = true; |
| 13168 | reject(promise, LAST_ERROR); |
| 13169 | } |
| 13170 | } |
| 13171 | |
| 13172 | |
| 13173 | /***/ }), |
no test coverage detected