Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /content-security-policy/securitypolicyviolation/worklet-import-report-only.https.sub.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(t => {
let violationCount = 0;
document.addEventListener('securitypolicyviolation',
t.step_func(() => violationCount++));
return CSS.paintWorklet.addModule(
.then(() => {}, () => assert_unreached(
'addModule should succeed since the policy is report-only.'))
.then(() => new Promise(resolve => t.step_timeout(resolve, 0)))
.then(() => assert_equals(violationCount, 1));
}, 'A CSP violation under report-only policy for a worklet\'s top-level ' +
'module script dispatches one securitypolicyviolation event');
</script>