()
| 1070 | } |
| 1071 | |
| 1072 | var csp = function () { |
| 1073 | if (!isDefined(csp.rules)) { |
| 1074 | var ngCspElement = (document.querySelector('[ng-csp]') || |
| 1075 | document.querySelector('[data-ng-csp]')); |
| 1076 | |
| 1077 | if (ngCspElement) { |
| 1078 | var ngCspAttribute = ngCspElement.getAttribute('ng-csp') || |
| 1079 | ngCspElement.getAttribute('data-ng-csp'); |
| 1080 | csp.rules = { |
| 1081 | noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1), |
| 1082 | noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1) |
| 1083 | }; |
| 1084 | } else { |
| 1085 | csp.rules = { |
| 1086 | noUnsafeEval: noUnsafeEval(), |
| 1087 | noInlineStyle: false |
| 1088 | }; |
| 1089 | } |
| 1090 | } |
| 1091 | |
| 1092 | return csp.rules; |
| 1093 | |
| 1094 | function noUnsafeEval() { |
| 1095 | try { |
| 1096 | /* jshint -W031, -W054 */ |
| 1097 | new Function(''); |
| 1098 | /* jshint +W031, +W054 */ |
| 1099 | return false; |
| 1100 | } catch (e) { |
| 1101 | return true; |
| 1102 | } |
| 1103 | } |
| 1104 | }; |
| 1105 | |
| 1106 | /** |
| 1107 | * @ngdoc directive |
no test coverage detected