Created
August 11, 2011 13:35
-
-
Save aheckmann/1139664 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
global.hi = "Hello"; | |
goodbye = "See ya"; | |
global = Object.freeze(global); | |
console.error('global.hi: %s', hi); | |
console.error('global.goodbye: %s', goodbye); | |
hi = "Nice to see you"; | |
console.error('global.hi overridden? %s', hi === "Nice to see you"); | |
try { | |
x = "oops i leaked a global variable"; | |
} catch (err) { | |
//console.error(err.stack); | |
} | |
console.error('successfully leaked a variable?: %s', 'undefined' !== typeof x); | |
console.error('lets require some shiz'); | |
require('./module'); |
This file contains hidden or 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
try { | |
y = "leaked"; | |
} catch (err) {} | |
console.error('leaked a global in a module? %s', 'undefined' !== typeof y); | |
hi = "howdy"; | |
console.error('can override a global within in module? %s', hi === 'howdy'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dropping window = Object.freeze(window); in our intranet! Thanks! :-)