Files
sousa-gecko/testing/web-platform/tests/content-security-policy/connect-src/connect-src-text-import-allowed.sub.html
T
Eemeli Aro 47278ee8b8 Bug 2006657 [wpt PR 56812] - Add tests for text modules, a=testonly
Automatic update from web-platform-tests
Add tests for text modules

This is to support the spec changes in:

- https://github.com/tc39/proposal-import-text
- https://github.com/whatwg/html/pull/11933
- https://github.com/whatwg/fetch/pull/1898
- https://github.com/w3c/webappsec-csp/pull/794
--

wpt-commits: 5419f98d72f4b1ae49980581a6a66710d6a3dee7
wpt-pr: 56812
2026-04-17 08:35:15 +00:00

26 lines
927 B
HTML

<!DOCTYPE html>
<html>
<head>
<title>connect-src-text-import-allowed</title>
<meta
http-equiv="Content-Security-Policy"
content="connect-src 'self'; script-src http://{{host}}:{{ports[http][0]}}/resources/testharness.js http://{{host}}:{{ports[http][0]}}/resources/testharnessreport.js 'unsafe-inline';"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(t => new Promise((resolve, reject) => {
window.addEventListener("securitypolicyviolation", (err) => {
if (err.blockedURI.endsWith("/common/text-plain.txt")) {
reject("Should not raise securitypolicyviolation.");
}
});
import("/common/text-plain.txt", { with: { type: "text" } }).then(resolve, reject)
}), "import should be allowed");
</script>
</body>
</html>