We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a7981c3 commit 2367e09Copy full SHA for 2367e09
es6-shim.js
@@ -144,7 +144,15 @@
144
}());
145
146
/*jshint evil: true */
147
- var getGlobal = new Function('return this;');
+ var getGlobal = function () {
148
+ // the only reliable means to get the global object is
149
+ // `Function('return this')()`
150
+ // However, this causes CSP violations in Chrome apps.
151
+ if (typeof self !== 'undefined') { return self; }
152
+ if (typeof window !== 'undefined') { return window; }
153
+ if (typeof global !== 'undefined') { return global; }
154
+ throw new Error('unable to locate global object');
155
+ };
156
/*jshint evil: false */
157
158
var globals = getGlobal();
0 commit comments