Last active
April 24, 2018 16:20
-
-
Save nulltask/7412711 to your computer and use it in GitHub Desktop.
javascript global leak detector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var leak = (function() { | |
var leak = []; | |
var iframe = document.createElement('iframe'); | |
iframe.style = 'display: none;'; | |
document.body.appendChild(iframe); | |
var window = iframe.contentWindow; | |
for (var p in this) { | |
if (void 0 === window[p]) leak.push(p); | |
} | |
document.body.removeChild(iframe); | |
iframe.remove(); | |
return leak; | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment