Comparing version 2.9.30 to 2.9.31
@@ -0,1 +1,10 @@ | ||
## 2.9.31 (2015-07-03) | ||
Bugfixes: | ||
- Fix Promises/A+ compliance issue regarding circular thenables: the correct behavior is to go into an infinite loop instead of warning with an error (Fixes [#682](.)). | ||
- Fix "(node) warning: possible EventEmitter memory leak detected" ([#661](.)). | ||
- Fix callbacks sometimes being called with a wrong node.js domain ([#664](.)). | ||
- Fix callbacks sometimes not being called at all in iOS 8.1 WebApp mode ([#666](.), [#687](.)). | ||
## 2.9.30 (2015-06-14) | ||
@@ -2,0 +11,0 @@ |
@@ -45,4 +45,2 @@ "use strict"; | ||
} | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) fn = domain.bind(fn); | ||
if (typeof setTimeout !== "undefined") { | ||
@@ -61,50 +59,3 @@ setTimeout(function() { | ||
Async.prototype._getDomain = function() {}; | ||
if (!false) { | ||
if (util.isNode) { | ||
var EventsModule = require("events"); | ||
var domainGetter = function() { | ||
var domain = process.domain; | ||
if (domain === null) return undefined; | ||
return domain; | ||
}; | ||
if (EventsModule.usingDomains) { | ||
Async.prototype._getDomain = domainGetter; | ||
} else { | ||
var descriptor = | ||
Object.getOwnPropertyDescriptor(EventsModule, "usingDomains"); | ||
if (descriptor) { | ||
if (!descriptor.configurable) { | ||
process.on("domainsActivated", function() { | ||
Async.prototype._getDomain = domainGetter; | ||
}); | ||
} else { | ||
var usingDomains = false; | ||
Object.defineProperty(EventsModule, "usingDomains", { | ||
configurable: false, | ||
enumerable: true, | ||
get: function() { | ||
return usingDomains; | ||
}, | ||
set: function(value) { | ||
if (usingDomains || !value) return; | ||
usingDomains = true; | ||
Async.prototype._getDomain = domainGetter; | ||
util.toFastProperties(process); | ||
process.emit("domainsActivated"); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
function AsyncInvokeLater(fn, receiver, arg) { | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) fn = domain.bind(fn); | ||
this._lateQueue.push(fn, receiver, arg); | ||
@@ -115,4 +66,2 @@ this._queueTick(); | ||
function AsyncInvoke(fn, receiver, arg) { | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) fn = domain.bind(fn); | ||
this._normalQueue.push(fn, receiver, arg); | ||
@@ -123,9 +72,3 @@ this._queueTick(); | ||
function AsyncSettlePromises(promise) { | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) { | ||
var fn = domain.bind(promise._settlePromises); | ||
this._normalQueue.push(fn, promise, undefined); | ||
} else { | ||
this._normalQueue._pushOne(promise); | ||
} | ||
this._normalQueue._pushOne(promise); | ||
this._queueTick(); | ||
@@ -176,4 +119,2 @@ } | ||
Async.prototype.invokeFirst = function (fn, receiver, arg) { | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) fn = domain.bind(fn); | ||
this._normalQueue.unshift(fn, receiver, arg); | ||
@@ -180,0 +121,0 @@ this._queueTick(); |
"use strict"; | ||
module.exports = function(Promise, CapturedTrace) { | ||
var getDomain = Promise._getDomain; | ||
var async = require("./async.js"); | ||
@@ -122,7 +123,13 @@ var Warning = require("./errors.js").Warning; | ||
Promise.onPossiblyUnhandledRejection = function (fn) { | ||
possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined; | ||
var domain = getDomain(); | ||
possiblyUnhandledRejection = | ||
typeof fn === "function" ? (domain === null ? fn : domain.bind(fn)) | ||
: undefined; | ||
}; | ||
Promise.onUnhandledRejectionHandled = function (fn) { | ||
unhandledRejectionHandled = typeof fn === "function" ? fn : undefined; | ||
var domain = getDomain(); | ||
unhandledRejectionHandled = | ||
typeof fn === "function" ? (domain === null ? fn : domain.bind(fn)) | ||
: undefined; | ||
}; | ||
@@ -129,0 +136,0 @@ |
@@ -12,3 +12,19 @@ "use strict"; | ||
}; | ||
var util = require("./util.js"); | ||
var getDomain; | ||
if (util.isNode) { | ||
getDomain = function() { | ||
var ret = process.domain; | ||
if (ret === undefined) ret = null; | ||
return ret; | ||
}; | ||
} else { | ||
getDomain = function() { | ||
return null; | ||
}; | ||
} | ||
util.notEnumerableProp(Promise, "_getDomain", getDomain); | ||
var async = require("./async.js"); | ||
@@ -212,4 +228,8 @@ var errors = require("./errors.js"); | ||
var callbackIndex = | ||
target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver); | ||
var callbackIndex = target._addCallbacks(didFulfill, | ||
didReject, | ||
didProgress, | ||
ret, | ||
receiver, | ||
getDomain()); | ||
@@ -326,3 +346,3 @@ if (target._isResolved() && !target._isSettlePromisesQueued()) { | ||
if (promise instanceof Promise) promise._setIsMigrated(); | ||
this._addCallbacks(fulfill, reject, progress, promise, receiver); | ||
this._addCallbacks(fulfill, reject, progress, promise, receiver, null); | ||
}; | ||
@@ -335,3 +355,4 @@ | ||
promise, | ||
receiver | ||
receiver, | ||
domain | ||
) { | ||
@@ -348,6 +369,14 @@ var index = this._length(); | ||
if (receiver !== undefined) this._receiver0 = receiver; | ||
if (typeof fulfill === "function" && !this._isCarryingStackTrace()) | ||
this._fulfillmentHandler0 = fulfill; | ||
if (typeof reject === "function") this._rejectionHandler0 = reject; | ||
if (typeof progress === "function") this._progressHandler0 = progress; | ||
if (typeof fulfill === "function" && !this._isCarryingStackTrace()) { | ||
this._fulfillmentHandler0 = | ||
domain === null ? fulfill : domain.bind(fulfill); | ||
} | ||
if (typeof reject === "function") { | ||
this._rejectionHandler0 = | ||
domain === null ? reject : domain.bind(reject); | ||
} | ||
if (typeof progress === "function") { | ||
this._progressHandler0 = | ||
domain === null ? progress : domain.bind(progress); | ||
} | ||
} else { | ||
@@ -357,8 +386,14 @@ var base = index * 5 - 5; | ||
this[base + 4] = receiver; | ||
if (typeof fulfill === "function") | ||
this[base + 0] = fulfill; | ||
if (typeof reject === "function") | ||
this[base + 1] = reject; | ||
if (typeof progress === "function") | ||
this[base + 2] = progress; | ||
if (typeof fulfill === "function") { | ||
this[base + 0] = | ||
domain === null ? fulfill : domain.bind(fulfill); | ||
} | ||
if (typeof reject === "function") { | ||
this[base + 1] = | ||
domain === null ? reject : domain.bind(reject); | ||
} | ||
if (typeof progress === "function") { | ||
this[base + 2] = | ||
domain === null ? progress : domain.bind(progress); | ||
} | ||
} | ||
@@ -656,3 +691,6 @@ this._setLength(index + 1); | ||
Promise._makeSelfResolutionError = makeSelfResolutionError; | ||
util.notEnumerableProp(Promise, | ||
"_makeSelfResolutionError", | ||
makeSelfResolutionError); | ||
require("./progress.js")(Promise, PromiseArray); | ||
@@ -659,0 +697,0 @@ require("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection); |
@@ -13,3 +13,6 @@ "use strict"; | ||
: function(fn) { ProcessNextTick.call(process, fn); }; | ||
} else if (typeof MutationObserver !== "undefined") { | ||
} else if ((typeof MutationObserver !== "undefined") && | ||
!(typeof window !== "undefined" && | ||
window.navigator && | ||
window.navigator.standalone)) { | ||
schedule = function(fn) { | ||
@@ -16,0 +19,0 @@ var div = document.createElement("div"); |
@@ -64,8 +64,3 @@ "use strict"; | ||
if (!promise) return; | ||
if (x === value) { | ||
promise._rejectCallback( | ||
Promise._makeSelfResolutionError(), false, true); | ||
} else { | ||
promise._resolveCallback(value); | ||
} | ||
promise._resolveCallback(value); | ||
promise = null; | ||
@@ -72,0 +67,0 @@ } |
@@ -295,3 +295,6 @@ "use strict"; | ||
})(); | ||
if (ret.isNode) ret.toFastProperties(process); | ||
try {throw new Error(); } catch (e) {ret.lastLineError = e;} | ||
module.exports = ret; |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "2.9.30", | ||
"version": "2.9.31", | ||
"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
434614
8771