1
0
Fork 0
firefox/testing/web-platform/tests/content-security-policy/connect-src/connect-src-json-import-allowed.sub.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

25 lines
919 B
HTML

<!DOCTYPE html>
<html>
<head>
<title>connect-src-json-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/dummy.json")) {
reject("Should not raise securitypolicyviolation.");
}
});
import("/common/dummy.json", { with: { type: "json" } }).then(resolve, reject)
}), "import should be allowed");
</script>
</body>
</html>