Thanks! I guess I should ended my question this way: ...and because developers want to write code that works in browsers and not, perhaps ES can have a solution that is not as silly as the ones we are using now.
jjb On Thu, Aug 23, 2012 at 6:41 PM, Andrea Giammarchi <[email protected]> wrote: > the non eval solution for ES3 is > > var global = function(){return this}(); > > and not with eval ... > > In ES5 usually window is not writable/configurable but enumerable so > theoretically you can rely in the `window` object unless your code is not > evaluated through eval inside a function with a window variable redefined. > > On Thu, Aug 23, 2012 at 11:59 PM, John J Barton > <[email protected]> wrote: >> >> 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 >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss > > _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

