MCPcopy Create free account
hub / github.com/cure53/dompurify / loadDOMPurifyWithSanityCheck

Function loadDOMPurifyWithSanityCheck

test/bootstrap-test-suite.js:50–69  ·  view source on GitHub ↗
(
    assert,
    addScriptAttribute,
    setup,
    onload
  )

Source from the content-addressed store, hash-verified

48 }
49
50 function loadDOMPurifyWithSanityCheck(
51 assert,
52 addScriptAttribute,
53 setup,
54 onload
55 ) {
56 const beforeOnLoadSanityCheck = function (window) {
57 assert.equal(
58 window.DOMPurify.sanitize('<img src=x onerror=alert(1)>'),
59 '<img src="x">'
60 );
61 };
62 loadDOMPurify(
63 assert,
64 addScriptAttribute,
65 setup,
66 beforeOnLoadSanityCheck,
67 onload
68 );
69 }
70
71 QUnit.test(
72 'sanity check: works in a non-Trusted Type environment',

Callers 1

Calls 1

loadDOMPurifyFunction · 0.85

Tested by

no test coverage detected