Skip to content

Instantly share code, notes, and snippets.

@giancarlo
Created August 19, 2015 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giancarlo/22bf7494a90dc29ae551 to your computer and use it in GitHub Desktop.
Save giancarlo/22bf7494a90dc29ae551 to your computer and use it in GitHub Desktop.
function del(obj)
{
var
properties = Object.getOwnPropertyNames(obj),
l = properties.length
;
while (l--)
{
try {
delete obj[properties[l]];
} catch(e) {}
}
}
/* jshint evil:true */
var iframe = document.createElement('IFRAME');
iframe.style.display = 'none';
iframe.src = "about:blank";
document.body.appendChild(iframe);
var w = iframe.contentWindow;
var evil = w.eval;
function sandbox(a) {
return evil.call(w,
'(function(window, document, location) { "use strict"; ' +
'return (' + a + '); }).call(undefined);'
);
};
del(w);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment