Reduce eval scope in test env

This commit is contained in:
kpdecker
2013-10-14 22:49:23 -05:00
parent 84049bf0c5
commit 6f94fc0a3b
3 changed files with 18 additions and 3 deletions
+6 -1
View File
@@ -1,3 +1,4 @@
/*global handlebarsEnv */
require('./common');
global.Handlebars = require('../../lib');
@@ -5,9 +6,13 @@ global.Handlebars = require('../../lib');
global.CompilerContext = {
compile: function(template, options) {
var templateSpec = handlebarsEnv.precompile(template, options);
return handlebarsEnv.template(eval('(' + templateSpec + ')'));
return handlebarsEnv.template(safeEval(templateSpec));
},
compileWithPartial: function(template, options) {
return handlebarsEnv.compile(template, options);
}
};
function safeEval(templateSpec) {
return eval('(' + templateSpec + ')');
}