Skip to content

Commit

Permalink
Bug 1944474 [wpt PR 50360] - Use assert_throws_js in content-security…
Browse files Browse the repository at this point in the history
…-policy/securitypolicyviolation/source-file.html, a=testonly

Automatic update from web-platform-tests
Use assert_throws_js in content-security-policy/securitypolicyviolation/source-file.html (#50360)

Currently it's using the pattern

`try { ...; assert_unreached(); } catch (e) {}`

but then the assertion thrown by assert_unreached() is ignored by the catch.
--

wpt-commits: 9b9efcb6e431c7c82555f64a03029b397ec3fb72
wpt-pr: 50360
  • Loading branch information
fred-wang authored and moz-wptsync-bot committed Feb 1, 2025
1 parent 3631b41 commit 8354df3
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
eval('');
//# sourceURL=${input}
`)
try {
eval(trusted_script);
assert_unreached();
} catch (e) {}

assert_throws_js(EvalError, _ => eval(trusted_script));
assert_equals((await violation).sourceFile, output);
}, description);
};
Expand Down

0 comments on commit 8354df3

Please sign in to comment.