Skip to content
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

Add tests for setAttribute/setAttributeNS and non-event-handler attri… #50046

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

fred-wang
Copy link
Contributor

…butes

This is a tentative test for [1] covering bullet 3 from [2]. There is a separate PR to cover the bullet 2 [3]. Most of these are probably already covered by other tests but assertions are scattered into multiple files as a side check in the default policy callback, so they are hard to understand and to guarantee they actually run (some mistakes were previously found about this in the past).

Additionnaly, this new test cover both setAttribute and setAttributeNS and ensure the correct callback is called exactly once with proper attributes (e.g. to verify a call to setAttribute does not trigger the callback with the parameters of a reflected IDL attribute).

[1] whatwg/dom#1268
[2] https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-data-for-attribute
[3] #50025

@fred-wang
Copy link
Contributor Author

This new test passes in Firefox Nightly, Safari Tech Preview but not in Chromium (it uses "Element setAttribute" as a sink name).

@fred-wang fred-wang requested a review from lukewarlow January 13, 2025 09:36
…butes

This is a tentative test for [1] covering bullet 3 from [2]. There is
a separate PR to cover the bullet 2 [3]. Most of these are probably
already covered by other tests but assertions are scattered into
multiple files as a side check in the default policy callback, so they
are hard to understand and to guarantee they actually run (some mistakes
were previously found about this in the past).

Additionnaly, this new test cover both setAttribute and setAttributeNS
and ensure the correct callback is called exactly once with proper
attributes (e.g. to verify a call to setAttribute does not trigger the
callback with the parameters of a reflected IDL attribute).

[1] whatwg/dom#1268
[2] https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-data-for-attribute
[3] #50025
Copy link
Member

@lukewarlow lukewarlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fred-wang fred-wang merged commit 35de054 into master Jan 13, 2025
18 checks passed
@fred-wang fred-wang deleted the set-attribute branch January 13, 2025 15:17
sadym-chromium pushed a commit that referenced this pull request Jan 14, 2025
…butes (#50046)

This is a tentative test for [1] covering bullet 3 from [2]. There is
a separate PR to cover the bullet 2 [3]. Most of these are probably
already covered by other tests but assertions are scattered into
multiple files as a side check in the default policy callback, so they
are hard to understand and to guarantee they actually run (some mistakes
were previously found about this in the past).

Additionally, this new test cover both setAttribute and setAttributeNS
and ensure the correct callback is called exactly once with proper
attributes (e.g. to verify a call to setAttribute does not trigger the
callback with the parameters of a reflected IDL attribute).

[1] whatwg/dom#1268
[2] https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-data-for-attribute
[3] #50025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants