summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js')
-rw-r--r--deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js
index 66a5b179c..2f40efd24 100644
--- a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js
+++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js
@@ -4,6 +4,7 @@ module.exports = function(Promise,
apiRejection,
tryConvertToPromise,
INTERNAL) {
+var getDomain = Promise._getDomain;
var async = require("./async.js");
var util = require("./util.js");
var tryCatch = util.tryCatch;
@@ -14,7 +15,8 @@ var EMPTY_ARRAY = [];
function MappingPromiseArray(promises, fn, limit, _filter) {
this.constructor$(promises);
this._promise._captureStackTrace();
- this._callback = fn;
+ var domain = getDomain();
+ this._callback = domain === null ? fn : domain.bind(fn);
this._preservedValues = _filter === INTERNAL
? new Array(this.length())
: null;
@@ -49,7 +51,7 @@ MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
if (preservedValues !== null) preservedValues[index] = value;
var callback = this._callback;
- var receiver = this._promise._boundTo;
+ var receiver = this._promise._boundValue();
this._promise._pushContext();
var ret = tryCatch(callback).call(receiver, value, index, length);
this._promise._popContext();