A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/paulmillr/es6-shim/commit/2367e0953edd01ae9a5628e1f47cf14b0377a7d6 below:

Avoid CSP errors in Chrome apps by using global var detection. · paulmillr/es6-shim@2367e09 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+9

-1

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+9

-1

lines changed Original file line number Diff line number Diff line change

@@ -144,7 +144,15 @@

144 144

}());

145 145 146 146

/*jshint evil: true */

147 -

var getGlobal = new Function('return this;');

147 +

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 +

};

148 156

/*jshint evil: false */

149 157 150 158

var globals = getGlobal();

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4