Comparing version 3.0.5 to 3.0.6
@@ -22,2 +22,6 @@ "use strict"; | ||
Async.prototype.enableTrampoline = function() { | ||
this._trampolineEnabled = true; | ||
}; | ||
Async.prototype.disableTrampolineIfNecessary = function() { | ||
@@ -24,0 +28,0 @@ if (util.hasDevTools) { |
@@ -44,3 +44,17 @@ "use strict"; | ||
Context.create = createContext; | ||
Context.deactivateLongStackTraces = function() {}; | ||
Context.activateLongStackTraces = function() { | ||
var Promise_pushContext = Promise.prototype._pushContext; | ||
var Promise_popContext = Promise.prototype._popContext; | ||
var Promise_PeekContext = Promise._peekContext; | ||
var Promise_peekContext = Promise.prototype._peekContext; | ||
var Promise_promiseCreated = Promise.prototype._promiseCreated; | ||
Context.deactivateLongStackTraces = function() { | ||
Promise.prototype._pushContext = Promise_pushContext; | ||
Promise.prototype._popContext = Promise_popContext; | ||
Promise._peekContext = Promise_PeekContext; | ||
Promise.prototype._peekContext = Promise_peekContext; | ||
Promise.prototype._promiseCreated = Promise_promiseCreated; | ||
longStackTraces = false; | ||
}; | ||
longStackTraces = true; | ||
@@ -47,0 +61,0 @@ Promise.prototype._pushContext = Context.prototype._pushContext; |
@@ -97,2 +97,3 @@ "use strict"; | ||
var disableLongStackTraces = function() {}; | ||
Promise.longStackTraces = function () { | ||
@@ -103,3 +104,15 @@ if (async.haveItemsQueued() && !config.longStackTraces) { | ||
if (!config.longStackTraces && longStackTracesIsSupported()) { | ||
var Promise_captureStackTrace = Promise.prototype._captureStackTrace; | ||
var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; | ||
config.longStackTraces = true; | ||
disableLongStackTraces = function() { | ||
if (async.haveItemsQueued() && !config.longStackTraces) { | ||
throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); | ||
} | ||
Promise.prototype._captureStackTrace = Promise_captureStackTrace; | ||
Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; | ||
Context.deactivateLongStackTraces(); | ||
async.enableTrampoline(); | ||
config.longStackTraces = false; | ||
}; | ||
Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; | ||
@@ -118,4 +131,8 @@ Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; | ||
opts = Object(opts); | ||
if ("longStackTraces" in opts && opts.longStackTraces) { | ||
Promise.longStackTraces(); | ||
if ("longStackTraces" in opts) { | ||
if (opts.longStackTraces) { | ||
Promise.longStackTraces(); | ||
} else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { | ||
disableLongStackTraces(); | ||
} | ||
} | ||
@@ -122,0 +139,0 @@ if ("warnings" in opts) { |
@@ -189,2 +189,3 @@ "use strict"; | ||
ret = new Promise(INTERNAL); | ||
ret._captureStackTrace(); | ||
ret._setFulfilled(); | ||
@@ -191,0 +192,0 @@ ret._rejectionHandler0 = obj; |
@@ -6,3 +6,3 @@ "use strict"; | ||
var afterTimeout = function (promise, message) { | ||
var afterTimeout = function (promise, message, parent) { | ||
if (!promise.isPending()) return; | ||
@@ -22,2 +22,3 @@ var err; | ||
promise._reject(err); | ||
parent.cancel(); | ||
}; | ||
@@ -59,5 +60,6 @@ | ||
ms = +ms; | ||
var ret = this.then(); | ||
var parent = this.then(); | ||
var ret = parent.then(); | ||
var handle = setTimeout(function timeoutTimeout() { | ||
afterTimeout(ret, message); | ||
afterTimeout(ret, message, parent); | ||
}, ms); | ||
@@ -64,0 +66,0 @@ return ret._then(successClear, failureClear, undefined, handle, undefined); |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "promise", |
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
412746
9689