Comparing version 3.1.1 to 3.1.2
@@ -7,2 +7,10 @@ "use strict"; | ||
function PassThroughHandlerContext(promise, type, handler) { | ||
this.promise = promise; | ||
this.type = type; | ||
this.handler = handler; | ||
this.called = false; | ||
this.cancelPromise = null; | ||
} | ||
function FinallyHandlerCancelReaction(finallyHandler) { | ||
@@ -80,9 +88,7 @@ this.finallyHandler = finallyHandler; | ||
if (typeof handler !== "function") return this.then(); | ||
return this._then(success, fail, undefined, { | ||
promise: this, | ||
handler: handler, | ||
called: false, | ||
cancelPromise: null, | ||
type: type | ||
}, undefined); | ||
return this._then(success, | ||
fail, | ||
undefined, | ||
new PassThroughHandlerContext(this, type, handler), | ||
undefined); | ||
}; | ||
@@ -102,3 +108,3 @@ | ||
return finallyHandler; | ||
return PassThroughHandlerContext; | ||
}; |
@@ -14,2 +14,3 @@ "use strict"; | ||
var yieldHandlers = []; | ||
var defineProperty = require("./es5").defineProperty; | ||
@@ -177,3 +178,4 @@ function promiseFromYieldHandler(value, yieldHandlers, traceParent) { | ||
var stack = new Error().stack; | ||
return function () { | ||
function wrap () { | ||
var generator = generatorFunction.apply(this, arguments); | ||
@@ -186,3 +188,12 @@ var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, | ||
return ret; | ||
}; | ||
} | ||
defineProperty(wrap, "length", { | ||
value: generatorFunction.length, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
return wrap; | ||
}; | ||
@@ -189,0 +200,0 @@ |
@@ -54,3 +54,4 @@ "use strict"; | ||
var CapturedTrace = debug.CapturedTrace; | ||
var finallyHandler = require("./finally")(Promise, tryConvertToPromise); | ||
var PassThroughHandlerContext = | ||
require("./finally")(Promise, tryConvertToPromise); | ||
var catchFilter = require("./catch_filter")(NEXT_FILTER); | ||
@@ -172,2 +173,3 @@ var nodebackForPromise = require("./nodeback"); | ||
var ret = new Promise(INTERNAL); | ||
ret._captureStackTrace(); | ||
var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs | ||
@@ -529,3 +531,3 @@ : false; | ||
if (handler === finallyHandler) { | ||
if (receiver instanceof PassThroughHandlerContext) { | ||
receiver.cancelPromise = promise; | ||
@@ -722,3 +724,3 @@ if (tryCatch(handler).call(receiver, value) === errorObj) { | ||
require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); | ||
require('./timers.js')(Promise, INTERNAL); | ||
require('./timers.js')(Promise, INTERNAL, debug); | ||
require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); | ||
@@ -725,0 +727,0 @@ require('./nodeify.js')(Promise); |
"use strict"; | ||
module.exports = function(Promise, INTERNAL) { | ||
module.exports = function(Promise, INTERNAL, debug) { | ||
var util = require("./util"); | ||
@@ -21,3 +21,5 @@ var TimeoutError = Promise.TimeoutError; | ||
promise._reject(err); | ||
parent.cancel(); | ||
if (debug.cancellation()) { | ||
parent.cancel(); | ||
} | ||
}; | ||
@@ -57,2 +59,3 @@ | ||
Promise.prototype.timeout = function (ms, message) { | ||
@@ -65,2 +68,9 @@ ms = +ms; | ||
}, ms); | ||
if (debug.cancellation()) { | ||
ret._setOnCancel({ | ||
_resultCancelled: function() { | ||
clearTimeout(handle); | ||
} | ||
}); | ||
} | ||
return ret._then(successClear, failureClear, undefined, handle, undefined); | ||
@@ -67,0 +77,0 @@ }; |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "promise", |
@@ -14,3 +14,3 @@ <a href="http://promisesaplus.com/"> | ||
See the [bluebird website](http://bluebirdjs.com/docs/getting-started.html) for further documentation, references and instructions. | ||
See the [**bluebird website**](http://bluebirdjs.com/docs/getting-started.html) for further documentation, references and instructions. See the [**API reference**](http://bluebirdjs.com/docs/api-reference.html) here. | ||
@@ -23,2 +23,8 @@ For bluebird 2.x documentation and files, see the [2.x tree](https://github.com/petkaantonov/bluebird/tree/2.x). | ||
## Thanks | ||
Thanks to BrowserStack for providing us with a free account which lets us support old browsers like IE8. | ||
# License | ||
@@ -47,1 +53,2 @@ | ||
THE SOFTWARE. | ||
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
416952
9772
52