()
| 1223 | } |
| 1224 | |
| 1225 | var csp = function() { |
| 1226 | if (!isDefined(csp.rules)) { |
| 1227 | |
| 1228 | |
| 1229 | var ngCspElement = (window.document.querySelector('[ng-csp]') || |
| 1230 | window.document.querySelector('[data-ng-csp]')); |
| 1231 | |
| 1232 | if (ngCspElement) { |
| 1233 | var ngCspAttribute = ngCspElement.getAttribute('ng-csp') || |
| 1234 | ngCspElement.getAttribute('data-ng-csp'); |
| 1235 | csp.rules = { |
| 1236 | noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1), |
| 1237 | noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1) |
| 1238 | }; |
| 1239 | } else { |
| 1240 | csp.rules = { |
| 1241 | noUnsafeEval: noUnsafeEval(), |
| 1242 | noInlineStyle: false |
| 1243 | }; |
| 1244 | } |
| 1245 | } |
| 1246 | |
| 1247 | return csp.rules; |
| 1248 | |
| 1249 | function noUnsafeEval() { |
| 1250 | try { |
| 1251 | // eslint-disable-next-line no-new, no-new-func |
| 1252 | new Function(''); |
| 1253 | return false; |
| 1254 | } catch (e) { |
| 1255 | return true; |
| 1256 | } |
| 1257 | } |
| 1258 | }; |
| 1259 | |
| 1260 | /** |
| 1261 | * @ngdoc directive |
no test coverage detected