MCPcopy
hub / github.com/angular-ui/ui-router / csp

Function csp

test/angular/1.6/angular.js:1267–1300  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 2

$ParseProviderFunction · 0.70
$SnifferProviderFunction · 0.70

Calls 2

isDefinedFunction · 0.70
noUnsafeEvalFunction · 0.70

Tested by

no test coverage detected