checkSource method

void checkSource({
  1. required String type,
  2. required Uri uri,
  3. required Uri? selfUri,
})

Throws CspViolationError if the action is not allowed.

Implementation

void checkSource({
  required String type,
  required Uri uri,
  required Uri? selfUri,
}) {
  if (!isAllowedSource(type: type, uri: uri, selfUri: selfUri)) {
    throw CspViolationError(
      action: type,
      uri: uri,
      csp: this,
    );
  }
}