This repository was archived by the owner on Mar 13, 2018. It is now read-only.
File tree 1 file changed +11
-13
lines changed
1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -11,25 +11,23 @@ window.ShadowDOMPolyfill = {};
11
11
var nativePrototypeTable = new WeakMap ( ) ;
12
12
var wrappers = Object . create ( null ) ;
13
13
14
- // Don't test for eval if document has CSP securityPolicy object and we can
15
- // see that eval is not supported. This avoids an error message in console
16
- // even when the exception is caught
17
- var hasEval = ! ( 'securityPolicy' in document ) ||
18
- document . securityPolicy . allowsEval ;
19
-
20
- if ( typeof chrome !== 'undefined' && chrome . app && chrome . app . runtime ) {
21
- hasEval = false ;
22
- }
14
+ function detectEval ( ) {
15
+ // Don't test for eval if we're running in a Chrome App environment.
16
+ // We check for APIs set that only exist in a Chrome App context.
17
+ if ( typeof chrome !== 'undefined' && chrome . app && chrome . app . runtime ) {
18
+ return false ;
19
+ }
23
20
24
- if ( hasEval ) {
25
21
try {
26
- var f = new Function ( '' , ' return true;') ;
27
- hasEval = f ( ) ;
22
+ var f = new Function ( 'return true;' ) ;
23
+ return f ( ) ;
28
24
} catch ( ex ) {
29
- hasEval = false ;
25
+ return false ;
30
26
}
31
27
}
32
28
29
+ var hasEval = detectEval ( ) ;
30
+
33
31
function assert ( b ) {
34
32
if ( ! b )
35
33
throw new Error ( 'Assertion failed' ) ;
You can’t perform that action at this time.
0 commit comments