es6-shim: es6-shim breaks Chrome App CSP

Unless sandboxed, es6-shim cannot run inside of Chrome Apps right now due to this line, which triggers the CSP, and is functionally an eval() statement.

I’m unsure if the best fix is reverting https://github.com/paulmillr/es6-shim/commit/ceeb51cc99bbe3729e96eae8c7af966a2d67dfde, or if a better solution can be found.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 1
  • Comments: 32 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Skimming the previous issues, this is a summary of my understanding:

Browsers Node Node Webkit Web Workers
self yes yes
window yes yes broken
global yes broken

Unless I’m missing something on that table, it sounds like checking self, then window, then global and using the first one found would cover all these environments and avoid eval.

@ljharb Using var global = this; before loading es6-shim works with Nashorn too. Thanks!

Perfect, that’s exactly what it’s supposed to do 😃 It appears that in WSH, the only option is to get this in the global context. http://stackoverflow.com/questions/14450424/equivalent-to-window-in-jscript-runtime

I’d suggest then that in wsh, users need to do something like var global = this; in the global context prior to including the es6-shim.