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