bluebird
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -8,3 +8,3 @@ "use strict"; | ||
Promise.prototype._pushContext = function() {}; | ||
Promise.prototype._popContext = function() {return 0;}; | ||
Promise.prototype._popContext = function() {return null;}; | ||
Promise._peekContext = Promise.prototype._peekContext = function() {}; | ||
@@ -17,3 +17,3 @@ | ||
if (this._trace !== undefined) { | ||
this._trace._promisesCreated = 0; | ||
this._trace._promiseCreated = null; | ||
contextStack.push(this._trace); | ||
@@ -26,7 +26,7 @@ } | ||
var trace = contextStack.pop(); | ||
var ret = trace._promisesCreated; | ||
trace._promisesCreated = 0; | ||
var ret = trace._promiseCreated; | ||
trace._promiseCreated = null; | ||
return ret; | ||
} | ||
return 0; | ||
return null; | ||
}; | ||
@@ -54,3 +54,3 @@ | ||
var ctx = this._peekContext(); | ||
if (ctx) ctx._promisesCreated++; | ||
if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; | ||
}; | ||
@@ -57,0 +57,0 @@ }; |
@@ -79,4 +79,4 @@ "use strict"; | ||
Promise.prototype._warn = function(message, shouldUseOwnTrace) { | ||
return warn(message, shouldUseOwnTrace, this); | ||
Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { | ||
return warn(message, shouldUseOwnTrace, promise || this); | ||
}; | ||
@@ -260,5 +260,5 @@ | ||
function checkForgottenReturns(returnValue, promisesCreated, name, promise) { | ||
function checkForgottenReturns(returnValue, promiseCreated, name, promise) { | ||
if (returnValue === undefined && | ||
promisesCreated > 0 && | ||
promiseCreated !== null && | ||
config.longStackTraces && | ||
@@ -268,3 +268,3 @@ config.warnings) { | ||
" handler but was not returned from it"; | ||
promise._warn(msg); | ||
promise._warn(msg, true, promiseCreated); | ||
} | ||
@@ -758,3 +758,3 @@ } | ||
var color = isSoft ? "\u001b[33m" : "\u001b[31m"; | ||
process.stderr.write(color + message + "\u001b[0m\n"); | ||
console.warn(color + message + "\u001b[0m\n"); | ||
}; | ||
@@ -761,0 +761,0 @@ } else if (!util.isNode && typeof (new Error().stack) === "string") { |
@@ -58,6 +58,6 @@ "use strict"; | ||
var ret = tryCatch(callback).call(receiver, value, index, length); | ||
var promisesCreated = promise._popContext(); | ||
var promiseCreated = promise._popContext(); | ||
debug.checkForgottenReturns( | ||
ret, | ||
promisesCreated, | ||
promiseCreated, | ||
preservedValues !== null ? "Promise.filter" : "Promise.map", | ||
@@ -64,0 +64,0 @@ promise |
@@ -490,3 +490,3 @@ "use strict"; | ||
} | ||
var promisesCreatedDuringHandlerInvocation = promise._popContext(); | ||
var promiseCreatedDuringHandlerInvocation = promise._popContext(); | ||
bitField = promise._bitField; | ||
@@ -502,7 +502,8 @@ if (((bitField & 65536) !== 0)) return; | ||
if (x === undefined && | ||
promisesCreatedDuringHandlerInvocation > 0 && | ||
promiseCreatedDuringHandlerInvocation !== null && | ||
debug.longStackTraces() && | ||
debug.warnings()) { | ||
promise._warn("a promise was created in a handler but " + | ||
"none were returned from it", true); | ||
"none were returned from it", true, | ||
promiseCreatedDuringHandlerInvocation); | ||
} | ||
@@ -509,0 +510,0 @@ promise._resolveCallback(x); |
@@ -153,6 +153,6 @@ "use strict"; | ||
} | ||
var promisesCreated = promise._popContext(); | ||
var promiseCreated = promise._popContext(); | ||
debug.checkForgottenReturns( | ||
ret, | ||
promisesCreated, | ||
promiseCreated, | ||
array._eachValues !== undefined ? "Promise.each" : "Promise.reduce", | ||
@@ -159,0 +159,0 @@ promise |
@@ -185,5 +185,5 @@ "use strict"; | ||
? fn.apply(undefined, inspections) : fn(inspections); | ||
var promisesCreated = promise._popContext(); | ||
var promiseCreated = promise._popContext(); | ||
debug.checkForgottenReturns( | ||
ret, promisesCreated, "Promise.using", promise); | ||
ret, promiseCreated, "Promise.using", promise); | ||
return ret; | ||
@@ -190,0 +190,0 @@ }); |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"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
408294
9620