(unsafeScript: any)
| 146 | * @codeGenApi |
| 147 | */ |
| 148 | export function ɵɵsanitizeScript(unsafeScript: any): TrustedScript | string { |
| 149 | const sanitizer = getSanitizer(); |
| 150 | if (sanitizer) { |
| 151 | return trustedScriptFromStringBypass( |
| 152 | sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || '', |
| 153 | ); |
| 154 | } |
| 155 | if (allowSanitizationBypassAndThrow(unsafeScript, BypassType.Script)) { |
| 156 | return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript)); |
| 157 | } |
| 158 | throw new RuntimeError( |
| 159 | RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT, |
| 160 | ngDevMode && 'unsafe value used in a script context', |
| 161 | ); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * A template tag function for promoting the associated constant literal to a |
no test coverage detected
searching dependent graphs…