(unsafeScript: any)
| 160 | * @codeGenApi |
| 161 | */ |
| 162 | export function ɵɵsanitizeScript(unsafeScript: any): TrustedScript | string { |
| 163 | const sanitizer = getSanitizer(); |
| 164 | if (sanitizer) { |
| 165 | return trustedScriptFromStringBypass( |
| 166 | sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || '', |
| 167 | ); |
| 168 | } |
| 169 | if (allowSanitizationBypassAndThrow(unsafeScript, BypassType.Script)) { |
| 170 | return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript)); |
| 171 | } |
| 172 | throw new RuntimeError( |
| 173 | RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT, |
| 174 | ngDevMode && 'unsafe value used in a script context', |
| 175 | ); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * A template tag function for promoting the associated constant literal to a |
no test coverage detected