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

Improve TT tests for SVG and HTML script innerHTML #50442

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

lukewarlow
Copy link
Member

The previous tests were wrong and don't pass in either of the two implementations (Chromium or WebKit).

SVGScriptElement is intended to behave as close to HTMLScriptElement as possible and innerHTML doesn't work differently for HTMLScriptElement compared with other elements.

Copy link
Contributor

@fred-wang fred-wang left a comment

Choose a reason for hiding this comment

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

This looks ok, but I believe you can now really just copy

https://searchfox.org/mozilla-central/source/testing/web-platform/tests/trusted-types/trusted-types-reporting-for-Element-innerHTML.html

with createElement("div") replaced with createElementNS(NSURI_SVG, "script") (and use support/namespaces.js).

That will exercise clipping of sample.

trusted-types/trusted-types-svg-script.html Show resolved Hide resolved
trusted-types/trusted-types-svg-script.html Outdated Show resolved Hide resolved
@lukewarlow lukewarlow force-pushed the trusted-types-svg-script-fixes branch from 9eee087 to d18c8bc Compare February 3, 2025 14:35
Copy link
Contributor

@fred-wang fred-wang left a comment

Choose a reason for hiding this comment

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

Thanks, these newer tests are better indeed.

@lukewarlow lukewarlow changed the title Update tests for SVGScriptElement innerHTML to match reality Improve TT tests for SVG and HTML script innerHTML Feb 3, 2025
@lukewarlow lukewarlow enabled auto-merge (squash) February 3, 2025 14:37
@lukewarlow lukewarlow merged commit 50c5225 into master Feb 3, 2025
17 checks passed
@lukewarlow lukewarlow deleted the trusted-types-svg-script-fixes branch February 3, 2025 15:41
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