diff --git a/lib/sandbox.js b/lib/sandbox.js index 6a59d29..8437e11 100644 --- a/lib/sandbox.js +++ b/lib/sandbox.js @@ -53,11 +53,12 @@ function runExtension(sessionContext, key, extCall, callback) { else { re[key] = [callback]; extensions.run(extCall, function(err, fault, res) { + const callbacks = re[key]; + delete re[key]; if (!err && !fault) sessionContext.extensionsCache[key] = res; - for (let c of re[key]) + for (let c of callbacks) c(err, fault); - delete re[key]; }); } }