()
| 1131 | } |
| 1132 | |
| 1133 | var csp = function() { |
| 1134 | if (!isDefined(csp.rules)) { |
| 1135 | |
| 1136 | |
| 1137 | var ngCspElement = (window.document.querySelector('[ng-csp]') || |
| 1138 | window.document.querySelector('[data-ng-csp]')); |
| 1139 | |
| 1140 | if (ngCspElement) { |
| 1141 | var ngCspAttribute = ngCspElement.getAttribute('ng-csp') || |
| 1142 | ngCspElement.getAttribute('data-ng-csp'); |
| 1143 | csp.rules = { |
| 1144 | noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1), |
| 1145 | noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1) |
| 1146 | }; |
| 1147 | } else { |
| 1148 | csp.rules = { |
| 1149 | noUnsafeEval: noUnsafeEval(), |
| 1150 | noInlineStyle: false |
| 1151 | }; |
| 1152 | } |
| 1153 | } |
| 1154 | |
| 1155 | return csp.rules; |
| 1156 | |
| 1157 | function noUnsafeEval() { |
| 1158 | try { |
| 1159 | // eslint-disable-next-line no-new, no-new-func |
| 1160 | new Function(''); |
| 1161 | return false; |
| 1162 | } catch (e) { |
| 1163 | return true; |
| 1164 | } |
| 1165 | } |
| 1166 | }; |
| 1167 | |
| 1168 | /** |
| 1169 | * @ngdoc directive |
no test coverage detected