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