Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

passing the tests again by saving the eval() function

  • Loading branch information...
commit ba0fe1b5edd31f2138e7dfee2d12a562cd82478b 1 parent f38b997
@substack authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 index.js
View
7 index.js
@@ -60,6 +60,7 @@ Script.prototype.runInContext = function (context) {
document.body.appendChild(iframe);
var win = iframe.contentWindow;
+ var wEval = win.eval, wExecScript = win.execScript;
forEach(Object_keys(context), function (key) {
win[key] = context[key];
@@ -70,14 +71,14 @@ Script.prototype.runInContext = function (context) {
}
});
- if (!win.eval && win.execScript) {
+ if (!wEval && wExecScript) {
// win.eval() magically appears when this is called in IE:
- win.execScript('null');
+ wExecScript.call(win, 'null');
}
var winKeys = Object_keys(win);
- var res = win.eval(this.code);
+ var res = wEval.call(win, this.code);
forEach(Object_keys(win), function (key) {
// Avoid copying circular objects like `top` and `window` by only
Please sign in to comment.
Something went wrong with that request. Please try again.