Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<script nonce="abc" src="/resources/testharness.js"></script>
<script nonce="abc" src="/resources/testharnessreport.js"></script>
<script nonce="abc" src="/content-security-policy/support/testharness-helper.js"></script>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-abc';">
<body>
<script nonce="abc">
async_test(t => {
waitUntilEvent(window, "securitypolicyviolation").then(t.step_func_done(e => {
assert_equals(e.documentURI, document.location.toString());
assert_true(e.blockedURI.endsWith("/support/document.xsl"));
}));
const XSLT_DOC = `
<xsl:include href="/content-security-policy/xslt/support/document.xsl" />
<xsl:template match="/">
<b>test</b>
</xsl:template>
</xsl:stylesheet>`;
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(`<root/>`, "application/xml");
const xsltDoc = parser.parseFromString(XSLT_DOC, "application/xml");
try {
const xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsltDoc);
xsltProcessor.transformToFragment(xmlDoc, document);
} catch {}
});
</script>
</body>