diff --git a/browser/bundle.js b/browser/bundle.js index c279a571e..1545155d5 100644 --- a/browser/bundle.js +++ b/browser/bundle.js @@ -5785,6 +5785,8 @@ function Promise$_follow(promise) { promise._getCarriedStackTrace()); } + if (promise._isRejectionUnhandled()) promise._unsetRejectionIsUnhandled(); + if (debugging && promise._traceParent == null) { promise._traceParent = this; @@ -10307,6 +10309,8 @@ function Promise$_follow(promise) { promise._getCarriedStackTrace()); } + if (promise._isRejectionUnhandled()) promise._unsetRejectionIsUnhandled(); + if (debugging && promise._traceParent == null) { promise._traceParent = this; @@ -31911,7 +31915,37 @@ describe("immediate failures with .then", function(done) { }); }); +describe("gh-118", function() { + specify("eventually rejected promise", function(done) { + onUnhandledFail(); + + Promise.resolve().then(function() { + return new Promise(function(_, reject) { + setTimeout(function() { + reject(13); + }, 13); + }); + }).caught(async(done)); + }); + + specify("already rejected promise", function(done) { + onUnhandledFail(); + + Promise.resolve().then(function() { + return Promise.reject(13); + }).caught(async(done)); + }); + + specify("immediately rejected promise", function(done) { + onUnhandledFail(); + Promise.resolve().then(function() { + return new Promise(function(_, reject) { + reject(13); + }); + }).caught(async(done)); + }); +}); if (Promise.hasLongStackTraces()) { describe("Gives long stack traces for non-errors", function() { diff --git a/js/browser/bluebird.js b/js/browser/bluebird.js index c01a7dc7e..2dca4e773 100644 --- a/js/browser/bluebird.js +++ b/js/browser/bluebird.js @@ -1,5 +1,5 @@ /** - * bluebird build version 1.0.6 + * bluebird build version 1.0.7 * Features enabled: core, timers, race, any, call_get, filter, generators, map, nodeify, promisify, props, reduce, settle, some, progress, cancel, synchronous_inspection */ /** @@ -2416,6 +2416,8 @@ function Promise$_follow(promise) { promise._getCarriedStackTrace()); } + if (promise._isRejectionUnhandled()) promise._unsetRejectionIsUnhandled(); + if (debugging && promise._traceParent == null) { promise._traceParent = this; diff --git a/package.json b/package.json index d6cfc1014..9ef176f54 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bluebird", "description": "Full featured Promises/A+ implementation with exceptionally good performance", - "version": "1.0.6", + "version": "1.0.7", "keywords": [ "promise", "performance", diff --git a/test/mocha/unhandled_rejections.js b/test/mocha/unhandled_rejections.js index 4080e4a3c..fa21c3187 100644 --- a/test/mocha/unhandled_rejections.js +++ b/test/mocha/unhandled_rejections.js @@ -543,7 +543,7 @@ describe("immediate failures with .then", function(done) { }); }); -describe("gh-117", function() { +describe("gh-118", function() { specify("eventually rejected promise", function(done) { onUnhandledFail();