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 content event handler attributes #50025

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

fred-wang
Copy link
Contributor

@fred-wang fred-wang commented Jan 10, 2025

    Never include unsupported event attributes into attributeNamesWithInterfaceName
    
    This is a small refactoring of https://github.com/web-platform-tests/wpt/pull/49473
    
    Instead of skipping unsupported attributes in the for loop, we filter
    them out when building the list.
    
    Technically, interfaceName is no longer used in the for loop, but we
    keep it in case that's needed for future setAttribute/setAttributeNS
    tests.
    Add tests for setAttribute/setAttributeNS and content event handler attributes
    
    * Factor out the code generating the list of event handler attribute from TrustedTypePolicyFactory-getAttributeType-event-handler-content-attributes.tentative.html into a event-handler-attributes.mjs module.
    * Use this to write tests for setAttribute/setAttributeNS for all event handler attributes.

…erfaceName

This is a small refactoring of #49473

Instead of skipping unsupported attributes in the for loop, we filter
them out when building the list.

Technically, interfaceName is no longer used in the for loop, but we
keep it in case that's needed for future setAttribute/setAttributeNS
tests.
…ttributes

* Factor out the code generating the list of event handler attribute from TrustedTypePolicyFactory-getAttributeType-event-handler-content-attributes.tentative.html into a event-handler-attributes.mjs module.
* Use this to write tests for setAttribute/setAttributeNS for all event handler attributes.
@fred-wang fred-wang changed the title Never include unsupported event attributes into attributeNamesWithInt… Add tests for setAttribute/setAttributeNS and content event handler attributes Jan 10, 2025
fred-wang added a commit that referenced this pull request Jan 13, 2025
…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 added a commit that referenced this pull request Jan 13, 2025
…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

Choose a reason for hiding this comment

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

I don't think this needs an mjs extension? Isn't that a node paradigm rather than a browser one?

If it's used elsewhere in WPT then no worries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no strong opinion on mjs, this is used by many other web platform tests though, so should be fine. IIRC, this was an MDN example too.

About implementing as a module: the rationale was to import WebIDLParser.js from event-handler-attributes.mjs directly, rather than having to do that from all HTML files.

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 - See other comment and decide as appropriate.

@fred-wang fred-wang merged commit d22e0bf into master Jan 13, 2025
19 checks passed
@fred-wang fred-wang deleted the tt-event-handle-attribute-refactoring branch January 13, 2025 15:04
fred-wang added a commit that referenced this pull request Jan 13, 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
sadym-chromium pushed a commit that referenced this pull request Jan 14, 2025
…attributes (#50025)

Add tests for setAttribute/setAttributeNS and content event handler attributes

* Factor out the code generating the list of event handler attribute from TrustedTypePolicyFactory-getAttributeType-event-handler-content-attributes.tentative.html into a event-handler-attributes.mjs module.
* Use this to write tests for setAttribute/setAttributeNS for all event handler attributes.
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
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jan 15, 2025
…S and non-event-handler attri…, a=testonly

Automatic update from web-platform-tests
Add tests for setAttribute/setAttributeNS and non-event-handler attributes (#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] web-platform-tests/wpt#50025
--

wpt-commits: 35de05425036bf714b270c76dd00892900002963
wpt-pr: 50046
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jan 16, 2025
…S and non-event-handler attri…, a=testonly

Automatic update from web-platform-tests
Add tests for setAttribute/setAttributeNS and non-event-handler attributes (#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] web-platform-tests/wpt#50025
--

wpt-commits: 35de05425036bf714b270c76dd00892900002963
wpt-pr: 50046

UltraBlame original commit: 4846e5ab139c44c223566809053c5948cd2d8d16
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Jan 16, 2025
…S and non-event-handler attri…, a=testonly

Automatic update from web-platform-tests
Add tests for setAttribute/setAttributeNS and non-event-handler attributes (#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] web-platform-tests/wpt#50025
--

wpt-commits: 35de05425036bf714b270c76dd00892900002963
wpt-pr: 50046

UltraBlame original commit: 4846e5ab139c44c223566809053c5948cd2d8d16
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jan 16, 2025
…S and non-event-handler attri…, a=testonly

Automatic update from web-platform-tests
Add tests for setAttribute/setAttributeNS and non-event-handler attributes (#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] web-platform-tests/wpt#50025
--

wpt-commits: 35de05425036bf714b270c76dd00892900002963
wpt-pr: 50046

UltraBlame original commit: 4846e5ab139c44c223566809053c5948cd2d8d16
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jan 17, 2025
…S and non-event-handler attri…, a=testonly

Automatic update from web-platform-tests
Add tests for setAttribute/setAttributeNS and non-event-handler attributes (#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] web-platform-tests/wpt#50025
--

wpt-commits: 35de05425036bf714b270c76dd00892900002963
wpt-pr: 50046
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