From 344f4270f2d05f28e89ca21facabc23a263b9899 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Wed, 28 Mar 2018 16:56:49 -0700 Subject: [PATCH] Fix infinite loop bug in previous commit --- lib/sandbox.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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]; }); } }