Update upstream source from tag 'upstream/4.2.5'
Update to upstream version '4.2.5'
with Debian dir 65bc012f9be4232835f0868f4c8545d4886b3029
Julien Puydt
5 years ago
409 | 409 |
let promise = this;
|
410 | 410 |
let constructor = promise.constructor;
|
411 | 411 |
|
412 | |
return promise.then(value => constructor.resolve(callback()).then(() => value),
|
413 | |
reason => constructor.resolve(callback()).then(() => { throw reason; }));
|
|
412 |
if ( isFunction(callback) ) {
|
|
413 |
return promise.then(value => constructor.resolve(callback()).then(() => value),
|
|
414 |
reason => constructor.resolve(callback()).then(() => { throw reason; }));
|
|
415 |
}
|
|
416 |
|
|
417 |
return promise.then(callback, callback);
|
414 | 418 |
}
|
415 | 419 |
}
|
416 | 420 |
|
0 | 0 |
{
|
1 | 1 |
"name": "es6-promise",
|
2 | 2 |
"namespace": "es6-promise",
|
3 | |
"version": "4.2.4",
|
|
3 |
"version": "4.2.5",
|
4 | 4 |
"description": "A lightweight library that provides tools for organizing asynchronous code",
|
5 | 5 |
"main": "dist/es6-promise.js",
|
6 | 6 |
"typings": "es6-promise.d.ts",
|
1257 | 1257 |
done();
|
1258 | 1258 |
});
|
1259 | 1259 |
});
|
|
1260 |
|
|
1261 |
it("preserves the original fulfillment value even if a non-callable callback is given", function(done) {
|
|
1262 |
var fulfillmentValue = 1;
|
|
1263 |
var promise = Promise.resolve(fulfillmentValue);
|
|
1264 |
|
|
1265 |
promise['finally']().then(function(value) {
|
|
1266 |
assert.equal(fulfillmentValue, value);
|
|
1267 |
done();
|
|
1268 |
});
|
|
1269 |
});
|
|
1270 |
|
|
1271 |
it("preserves the original rejection reason even if a non-callable callback is given", function(done) {
|
|
1272 |
var rejectionReason = new Error();
|
|
1273 |
var promise = Promise.reject(rejectionReason);
|
|
1274 |
|
|
1275 |
promise['finally']().then(undefined, function(reason) {
|
|
1276 |
assert.equal(rejectionReason, reason);
|
|
1277 |
done();
|
|
1278 |
});
|
|
1279 |
});
|
1260 | 1280 |
});
|
1261 | 1281 |
|
1262 | 1282 |
describe("exception cases do propogate the failure", function(){
|