From 8354df31afc5cce42421ec450156bb2d03c2796a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Fri, 31 Jan 2025 15:39:51 +0000 Subject: [PATCH] Bug 1944474 [wpt PR 50360] - Use assert_throws_js in content-security-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 --- .../securitypolicyviolation/source-file.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/testing/web-platform/tests/content-security-policy/securitypolicyviolation/source-file.html b/testing/web-platform/tests/content-security-policy/securitypolicyviolation/source-file.html index 354b8dfd20124..d215d0ede6916 100644 --- a/testing/web-platform/tests/content-security-policy/securitypolicyviolation/source-file.html +++ b/testing/web-platform/tests/content-security-policy/securitypolicyviolation/source-file.html @@ -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); };