Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit fd0e5cb

Browse files
fgmccabemoz-wptsync-bot
authored andcommitted
Bug 1733579 [wpt PR 31041] - [CSP] Added new policy violation source: wasm-eval, a=testonly
Automatic update from web-platform-tests [CSP] Added new policy violation source: wasm-eval This extends the suite of policy violation sources to include a WebAssembly specific source: wasm-eval. This has also been reflected in the PR (w3c/webappsec-csp#293 (review)) against the CSP spec. Added test for proper security violation event of the right form. Bug: 948834 Change-Id: I0b76fd725136b7ddda92e629f147f5ba77c50ffb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3197842 Commit-Queue: Francis McCabe <[email protected]> Reviewed-by: Arthur Sonzogni <[email protected]> Reviewed-by: Mike West <[email protected]> Reviewed-by: Antonio Sartori <[email protected]> Reviewed-by: Andrey Kosyakov <[email protected]> Reviewed-by: David Tseng <[email protected]> Cr-Commit-Position: refs/heads/main@{#931206} -- wpt-commits: 6ccfe6fafab233ee6063b7bfeabb107ad847a205 wpt-pr: 31041
1 parent ca0a95f commit fd0e5cb

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// META: global=window,worker
2+
let code = new Uint8Array([0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0]);
3+
async_test(t => {
4+
self.addEventListener('securitypolicyviolation', t.step_func_done(e => {
5+
assert_equals(e.violatedDirective, "script-src");
6+
assert_equals(e.originalPolicy, "default-src 'self' 'unsafe-inline'")
7+
assert_equals(e.blockedURI, "wasm-eval")
8+
}));
9+
}, "Securitypolicyviolation event looks like it should");
10+
11+
promise_test(t => {
12+
return promise_rejects_js(
13+
t, WebAssembly.CompileError,
14+
WebAssembly.instantiate(code));
15+
});
16+
17+
18+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Content-Security-Policy: default-src 'self' 'unsafe-inline'

0 commit comments

Comments
 (0)