Comparing version 2.9.22 to 2.9.23
@@ -0,1 +1,7 @@ | ||
## 2.9.23 (2015-04-02) | ||
Bugfixes: | ||
- Fix node.js domain propagation ([#521](.)). | ||
## 2.9.22 (2015-04-02) | ||
@@ -2,0 +8,0 @@ |
@@ -6,3 +6,2 @@ "use strict"; | ||
var Queue = require("./queue.js"); | ||
var _process = typeof process !== "undefined" ? process : undefined; | ||
var util = require("./util.js"); | ||
@@ -42,11 +41,2 @@ | ||
Async.prototype._withDomain = function(fn) { | ||
if (_process !== undefined && | ||
_process.domain != null && | ||
!fn.domain) { | ||
fn = _process.domain.bind(fn); | ||
} | ||
return fn; | ||
}; | ||
Async.prototype.throwLater = function(fn, arg) { | ||
@@ -57,3 +47,4 @@ if (arguments.length === 1) { | ||
} | ||
fn = this._withDomain(fn); | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) fn = domain.bind(fn); | ||
if (typeof setTimeout !== "undefined") { | ||
@@ -72,4 +63,37 @@ setTimeout(function() { | ||
Async.prototype._getDomain = function() {}; | ||
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 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) { | ||
fn = this._withDomain(fn); | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) fn = domain.bind(fn); | ||
this._lateQueue.push(fn, receiver, arg); | ||
@@ -80,3 +104,4 @@ this._queueTick(); | ||
function AsyncInvoke(fn, receiver, arg) { | ||
fn = this._withDomain(fn); | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) fn = domain.bind(fn); | ||
this._normalQueue.push(fn, receiver, arg); | ||
@@ -87,3 +112,9 @@ this._queueTick(); | ||
function AsyncSettlePromises(promise) { | ||
this._normalQueue._pushOne(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._queueTick(); | ||
@@ -129,3 +160,4 @@ } | ||
Async.prototype.invokeFirst = function (fn, receiver, arg) { | ||
fn = this._withDomain(fn); | ||
var domain = this._getDomain(); | ||
if (domain !== undefined) fn = domain.bind(fn); | ||
this._normalQueue.unshift(fn, receiver, arg); | ||
@@ -132,0 +164,0 @@ this._queueTick(); |
@@ -171,6 +171,8 @@ "use strict"; | ||
function toFastProperties(obj) { | ||
/*jshint -W027*/ | ||
/*jshint -W027,-W055,-W031*/ | ||
function f() {} | ||
f.prototype = obj; | ||
return f; | ||
var l = 8; | ||
while (l--) new f(); | ||
return obj; | ||
eval(obj); | ||
@@ -177,0 +179,0 @@ } |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "2.9.22", | ||
"version": "2.9.23", | ||
"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
442697
8969