Support running jasmine within CSP (remove eval)

[fixes #503]
This commit is contained in:
Michal Mocny
2014-01-17 10:51:27 -05:00
committed by pivotal
parent 76ca5ef6d4
commit 85fa148f18

View File

@@ -1,4 +1,9 @@
getJasmineRequireObj().base = function(j$) { getJasmineRequireObj().base = (function (jasmineGlobal) {
if (typeof module !== "undefined" && module.exports) {
jasmineGlobal = global;
}
return function(j$) {
j$.unimplementedMethod_ = function() { j$.unimplementedMethod_ = function() {
throw new Error("unimplemented method"); throw new Error("unimplemented method");
}; };
@@ -6,12 +11,9 @@ getJasmineRequireObj().base = function(j$) {
j$.MAX_PRETTY_PRINT_DEPTH = 40; j$.MAX_PRETTY_PRINT_DEPTH = 40;
j$.DEFAULT_TIMEOUT_INTERVAL = 5000; j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
j$.getGlobal = (function() { j$.getGlobal = function() {
var jasmineGlobal = eval.call(null, "this");
return function() {
return jasmineGlobal; return jasmineGlobal;
}; };
})();
j$.getEnv = function(options) { j$.getEnv = function(options) {
var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options); var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
@@ -96,3 +98,4 @@ getJasmineRequireObj().base = function(j$) {
return obj; return obj;
}; };
}; };
})(this);