-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite Trusted types tests for CSP violations #50124
base: master
Are you sure you want to change the base?
Conversation
Currently the listener to "securitypolicyviolation" is added before actually running the statement that triggers violations, so it could be possible that some violations are not caught. This bad pattern is duplicated in several `trusted-types*reporting*` tests. This patch adds a new helper file to properly wrap the listener registration and statement execution in a promise, and reuses it in existing tests. w3c/trusted-types#576
cc @lukewarlow This gives much better results for me in Firefox. Still need to convert the other reporting files and though. |
It seems there are more tests for violation but they use a slightly different approach, so probably will handle them in separate PRs. (also, some of these tests will probably need review and updates too, but for now let's keep the current expectations) |
@lukewarlow I fixed more tests this morning. The remaining ones using securitypolicyviolation are:
|
Currently the listener to "securitypolicyviolation" is added before actually running the statement that triggers violations, so it could be possible that some violations are not caught. This bad pattern is duplicated in several
trusted-types*reporting*
tests.This patch adds a new helper file to properly wrap the listener registration and statement execution in a promise, and reuses it in existing tests.
w3c/trusted-types#576