private static void ValidateBeforeSettingNoneSource(ICspDirectiveBasicConfiguration basicDirective) { if (basicDirective.SelfSrc || (basicDirective.CustomSources != null && basicDirective.CustomSources.Any())) { throw new InvalidOperationException("It is a logical error to combine the \"None\" source with other sources."); } if (basicDirective is ICspDirectiveUnsafeInlineConfiguration unsafeInline && unsafeInline.UnsafeInlineSrc) { throw new InvalidOperationException("It is a logical error to combine the \"None\" source with other sources."); } if (basicDirective is ICspDirectiveConfiguration directive && (directive.UnsafeEvalSrc || directive.StrictDynamicSrc)) { throw new InvalidOperationException("It is a logical error to combine the \"None\" source with other sources."); } }
private static void ValidateBeforeSettingNoneSource(ICspDirectiveBasicConfiguration directive) { if (directive.SelfSrc || (directive.CustomSources != null && directive.CustomSources.Any())) { throw new InvalidOperationException("It is a logical error to combine the \"None\" source with other sources."); } var unsafeInline = directive as ICspDirectiveUnsafeInlineConfiguration; if (unsafeInline != null && unsafeInline.UnsafeInlineSrc) { throw new InvalidOperationException("It is a logical error to combine the \"None\" source with other sources."); } var unsafeEval = directive as ICspDirectiveConfiguration; if (unsafeEval != null && unsafeEval.UnsafeEvalSrc) { throw new InvalidOperationException("It is a logical error to combine the \"None\" source with other sources."); } }