global object in strict mode

John J Barton johnjbarton at johnjbarton.com
Thu Aug 23 15:59:08 PDT 2012


Long ago this list had a subject:

How to retrieve the global object in strict mode?
https://mail.mozilla.org/pipermail/es5-discuss/2011-February/003919.html

Roughly the conclusion was:

  var global = ("global", eval)("this");

However Content Security Policy

https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html

bans 'eval', (as well as all similar forms) making this solution fail.

Is there a non-eval based solution?

jjb


More information about the es-discuss mailing list