()
| 1262 | } |
| 1263 | |
| 1264 | var csp = function() { |
| 1265 | if (!isDefined(csp.rules)) { |
| 1266 | |
| 1267 | |
| 1268 | var ngCspElement = (window.document.querySelector('[ng-csp]') || |
| 1269 | window.document.querySelector('[data-ng-csp]')); |
| 1270 | |
| 1271 | if (ngCspElement) { |
| 1272 | var ngCspAttribute = ngCspElement.getAttribute('ng-csp') || |
| 1273 | ngCspElement.getAttribute('data-ng-csp'); |
| 1274 | csp.rules = { |
| 1275 | noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1), |
| 1276 | noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1) |
| 1277 | }; |
| 1278 | } else { |
| 1279 | csp.rules = { |
| 1280 | noUnsafeEval: noUnsafeEval(), |
| 1281 | noInlineStyle: false |
| 1282 | }; |
| 1283 | } |
| 1284 | } |
| 1285 | |
| 1286 | return csp.rules; |
| 1287 | |
| 1288 | function noUnsafeEval() { |
| 1289 | try { |
| 1290 | // eslint-disable-next-line no-new, no-new-func |
| 1291 | new Function(''); |
| 1292 | return false; |
| 1293 | } catch (e) { |
| 1294 | return true; |
| 1295 | } |
| 1296 | } |
| 1297 | }; |
| 1298 | |
| 1299 | /** |
| 1300 | * @ngdoc directive |
no test coverage detected