diff options
author | Jesse Hallett <jesse@galois.com> | 2013-12-19 13:31:57 -0800 |
---|---|---|
committer | Jesse Hallett <jesse@galois.com> | 2013-12-19 13:37:46 -0800 |
commit | db04931179b585bb02f88f096c044f3a10e9ed34 (patch) | |
tree | 6999becb1c23c995c4c536d31a3d6a240b9c303d | |
parent | 17477f77fd6ca5ad1fee20a0d6a3f794a9182678 (diff) |
Restores behavior of running rules in scope of assembleRules function
-rw-r--r-- | src/js/fiveui/injected/compute.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/js/fiveui/injected/compute.js b/src/js/fiveui/injected/compute.js index 7c48cb9..2a0cc74 100644 --- a/src/js/fiveui/injected/compute.js +++ b/src/js/fiveui/injected/compute.js @@ -356,17 +356,21 @@ } } - var ruleStrList = __assembleRules_ruleDescr.rules; - for(__assembleRules_i=0; __assembleRules_i<ruleStrList.length; ++__assembleRules_i) { - var __assembleRules_moduleFunc = new Function('exports', ruleStrList[__assembleRules_i]); + var __assembleRules_ruleStrList = __assembleRules_ruleDescr.rules; + for(__assembleRules_i=0; __assembleRules_i<__assembleRules_ruleStrList.length; ++__assembleRules_i) { + var __assembleRules_moduleStr = + [ '(function(){' + , __assembleRules_ruleStrList[__assembleRules_i] + , '})()' + ].join('\n'); try { - var __assembleRules_exported = {}; - __assembleRules_moduleFunc(__assembleRules_exported); - __assembleRules_ruleList.push(__assembleRules_exported); + var exports = {}; + eval(__assembleRules_moduleStr); + __assembleRules_ruleList.push(exports); } catch (x) { console.error('Could not evaluate rule module: ' + x); - console.error(__assembleRules_moduleFunc); + console.error(__assembleRules_moduleStr); } } return __assembleRules_ruleList; |