Skip to content

Conversation

hamishwillee
Copy link
Contributor

@hamishwillee hamishwillee commented Sep 12, 2025

This adds Trusted Type info for a number of API. I am working of Firefox. Where possible I have attempted to determine Chrome and Safari data. Where not found I have marked as false. Supporting data for each case linked inline.

APIs added

@github-actions github-actions bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Sep 12, 2025
"chrome_android": "mirror",
"edge": "mirror",
"firefox": {
"version_added": "136",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@github-actions github-actions bot added the size:m [PR only] 25-100 LoC changed label Sep 12, 2025
Copy link
Contributor

github-actions bot commented Sep 12, 2025

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

"description": "Requires `TrustedScriptURL` instance when trusted types are enforced",
"support": {
"chrome": {
"version_added": "141"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

},
"enforces_trusted_types": {
"__compat": {
"description": "Requires `TrustedScriptURL` instance when trusted types are enforced",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note, no spec url. Spec update in w3c/svgwg#934 but seems to be no corresponding online link.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI there should be a web-type but following previous direction leaving it to BCD team to update.

"opera": "mirror",
"opera_android": "mirror",
"safari": {
"version_added": false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't find evidence for Safari. Likely is supported as it has pretty good coverage on WPT, but there is not WPT test for this.

"chrome_android": "mirror",
"edge": "mirror",
"firefox": {
"version_added": "136",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"opera": "mirror",
"opera_android": "mirror",
"safari": {
"version_added": "26"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is from running just one of the importScript tests (https://wpt.live/trusted-types/DedicatedWorker-importScripts.html) on the latest Safari on browserstack. The next earliest version is 18 AFAIK and it didn't run on that.

@github-actions github-actions bot added size:l [PR only] 101-1000 LoC changed and removed size:m [PR only] 25-100 LoC changed labels Sep 12, 2025
"chrome_android": "mirror",
"edge": "mirror",
"firefox": {
"version_added": "136",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"description": "`scriptURL` parameter requires `TrustedScriptURL` instance when trusted types are enforced",
"support": {
"chrome": {
"version_added": "140"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So this is from https://issues.chromium.org/issues/330516530#comment25 which LOOKs to be related. Traced that to v140 via https://chromiumdash.appspot.com/commits?commit=882e7efd3bffedad411e53beed79a2f3e8e335e9&platform=Android

Note, the tests https://wpt.live/trusted-types/ (that include register) pass for many versions, so are not a good indicator of support

"opera": "mirror",
"opera_android": "mirror",
"safari": {
"version_added": "26"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the first version on browserstack that understands trusted types (at all). It passes the register tests in https://wpt.live/trusted-types/ but as above I don't have great faith in these.

@github-actions github-actions bot added the data:http Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP label Sep 12, 2025
"firefox": {
"version_added": false,
"impl_url": "https://bugzil.la/1508286"
"version_added": "138",
Copy link
Contributor Author

@hamishwillee hamishwillee Sep 12, 2025

Choose a reason for hiding this comment

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

@hamishwillee hamishwillee marked this pull request as ready for review September 12, 2025 07:13
"firefox": {
"version_added": false,
"impl_url": "https://bugzil.la/1508286"
"version_added": "135",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is require-trusted-types-for.
This was implemented in https://bugzilla.mozilla.org/show_bug.cgi?id=1905678 but as noted in https://bugzilla.mozilla.org/show_bug.cgi?id=1905678#c1 this is "honored" in a number of other issues. The first of those is https://bugzilla.mozilla.org/show_bug.cgi?id=1905706 which delivered in 135.

Technically this is a partial implementation since enforcement will not enforce everything. But that has more to do with the things to be enforced still rolling out. Since at the end it will all be implemented, I think it makes sense to treat this part of the story (the directive) as fully implemented behind flag.

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

LGTM overall, just one case where I found a different Chrome version.

@hamishwillee
Copy link
Contributor Author

Thanks. Trust your research more than mine.

@caugner caugner changed the title Trusted type support updates for various APIs Add Trusted Types subfeatures to various APIs Sep 19, 2025
@caugner caugner merged commit 28ba312 into mdn:main Sep 19, 2025
6 of 7 checks passed
@mdn-bot mdn-bot mentioned this pull request Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API data:http Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP size:l [PR only] 101-1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants