Csp.fromMap constructor
Constructs CSP declaration from the map.
Throws ArgumentError if the argument contains invalid strings.
Implementation
Csp.fromMap(Map<String, List<String>> directivesMap)
: directivesMap = _immutableOptimizeddirectivesMap(directivesMap),
_source = null {
for (var argumentList in directivesMap.values) {
for (var argument in argumentList) {
// Look for illegal/unusual characters
if (argument.codeUnits.any((e) => e <= 32 || e == 127) ||
argument.contains(';')) {
throw ArgumentError('Unsupported CSP pattern: `$argument`');
}
}
}
}