diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-07-19 14:31:45 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-07-19 14:35:59 -0700 |
commit | 25acb4d62c7ad130a02f3ede767f3f08fa9ec896 (patch) | |
tree | 09d7d4086fc185fa254b1cd50fae80d4ba63ab68 | |
parent | 270cfa2ede60e91b9b851267d01a232578a8198f (diff) | |
download | qtlocation-mapboxgl-upstream/fix-8812.tar.gz |
[node] Protect against synchronous request implementationsupstream/fix-8812
-rw-r--r-- | platform/node/index.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/node/index.js b/platform/node/index.js index 54ba5c0dc6..5902f0bf59 100644 --- a/platform/node/index.js +++ b/platform/node/index.js @@ -19,7 +19,12 @@ var Map = function(options) { return new constructor(Object.assign(options, { request: function(req) { request(req, function() { - req.respond.apply(req, arguments); + var args = arguments; + // Protect ourselves from `request` implementations that try to release Zalgo. + // http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony + setImmediate(function() { + req.respond.apply(req, args); + }); }); } })); |