MCPcopy Index your code
hub / github.com/angular/angular / ɵɵsanitizeScript

Function ɵɵsanitizeScript

packages/core/src/sanitization/sanitization.ts:148–162  ·  view source on GitHub ↗
(unsafeScript: any)

Source from the content-addressed store, hash-verified

146 * @codeGenApi
147 */
148export 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

Callers 1

Calls 5

unwrapSafeValueFunction · 0.90
getSanitizerFunction · 0.85
sanitizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…