Skip to content

Commit 4dbe5bc

Browse files
antosartchromium-wpt-export-bot
authored andcommitted
[CSP] Fix WPT about worker violation event
The WPT external/wpt/content-security-policy/connect-src/worker-from-guid.sub.html was expecting a securitypolicyviolation event for a Content Security Policy violation in a worker to be raised in the owner document. This is wrong: the securitypolicyviolation event should be triggered in the worker itself. Bug: 694525 Change-Id: I4285e6eee73e4629a6662a05fe2eb067782f6c8a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3178905 Reviewed-by: Arthur Sonzogni <[email protected]> Commit-Queue: Antonio Sartori <[email protected]> Cr-Commit-Position: refs/heads/main@{#924287}
1 parent f781a1c commit 4dbe5bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content-security-policy/connect-src/worker-from-guid.sub.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
with this resource.</p>
1919
<body>
2020
<script>
21-
window.addEventListener('securitypolicyviolation', function(e) {
22-
log("violated-directive=" + e.violatedDirective);
23-
});
2421
try {
2522
var blob = new Blob([
23+
"self.addEventListener('securitypolicyviolation', e => {" +
24+
" postMessage('violated-directive=' + e.violatedDirective);" +
25+
"});" +
2626
"var xhr = new XMLHttpRequest;" +
2727
"xhr.onerror = function () {" +
2828
" postMessage('xhr blocked');" +

0 commit comments

Comments
 (0)