MCPcopy Create free account
hub / github.com/cure53/DOMPurify / _assertNotInTrustedTypesPolicy

Function _assertNotInTrustedTypesPolicy

src/purify.ts:328–338  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

326 // the same unbounded recursion.
327 let IN_TRUSTED_TYPES_POLICY = 0;
328 const _assertNotInTrustedTypesPolicy = function (): void {
329 if (IN_TRUSTED_TYPES_POLICY > 0) {
330 throw typeErrorCreate(
331 'A configured TRUSTED_TYPES_POLICY callback (createHTML or ' +
332 'createScriptURL) must not call DOMPurify.sanitize, as that causes ' +
333 'infinite recursion. Do not pass a policy whose callbacks wrap ' +
334 'DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted ' +
335 'Types" section of the README.'
336 );
337 }
338 };
339
340 const _createTrustedHTML = function (html: string): string {
341 _assertNotInTrustedTypesPolicy();

Callers 2

_createTrustedHTMLFunction · 0.85
_createTrustedScriptURLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected