()
| 1087 | } |
| 1088 | |
| 1089 | var csp = function() { |
| 1090 | if (!isDefined(csp.rules)) { |
| 1091 | |
| 1092 | |
| 1093 | var ngCspElement = (document.querySelector('[ng-csp]') || |
| 1094 | document.querySelector('[data-ng-csp]')); |
| 1095 | |
| 1096 | if (ngCspElement) { |
| 1097 | var ngCspAttribute = ngCspElement.getAttribute('ng-csp') || |
| 1098 | ngCspElement.getAttribute('data-ng-csp'); |
| 1099 | csp.rules = { |
| 1100 | noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1), |
| 1101 | noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1) |
| 1102 | }; |
| 1103 | } else { |
| 1104 | csp.rules = { |
| 1105 | noUnsafeEval: noUnsafeEval(), |
| 1106 | noInlineStyle: false |
| 1107 | }; |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | return csp.rules; |
| 1112 | |
| 1113 | function noUnsafeEval() { |
| 1114 | try { |
| 1115 | /* jshint -W031, -W054 */ |
| 1116 | new Function(''); |
| 1117 | /* jshint +W031, +W054 */ |
| 1118 | return false; |
| 1119 | } catch (e) { |
| 1120 | return true; |
| 1121 | } |
| 1122 | } |
| 1123 | }; |
| 1124 | |
| 1125 | /** |
| 1126 | * @ngdoc directive |
no test coverage detected