Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Jan 31, 2024

First step to fix w3c/trusted-types#425.

Will add separate commits for the other tests requested at above ticket.

@ghost
Copy link
Author

ghost commented Feb 1, 2024

Stumbled on #44352, which either needs to be fixed or worked around.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Thanks, this looks like the correct test.

I wonder if we should also test the inverse. That when you take an element out of a TT global, TT is no longer enforced for it.

@ghost
Copy link
Author

ghost commented Apr 11, 2024

Thanks, this looks like the correct test.

I wonder if we should also test the inverse. That when you take an element out of a TT global, TT is no longer enforced for it.

I don't know how relevant that scenario is.

@koto: any experience with that?

@annevk
Copy link
Member

annevk commented Apr 11, 2024

It's relevant for ensuring the specification is implemented correctly.

@ghost
Copy link
Author

ghost commented Apr 15, 2024

It's relevant for ensuring the specification is implemented correctly.

True; but is that scenario actually relevant in practice?

@annevk
Copy link
Member

annevk commented Apr 15, 2024

That does not matter for conformance tests. The whole point is that we can't know what websites might do and might rely on.

@ghost
Copy link
Author

ghost commented Apr 15, 2024

That does not matter for conformance tests. The whole point is that we can't know what websites might do and might rely on.

Agreed. Added w3c/trusted-types#425 (comment) so that another test will be added.

@ghost
Copy link
Author

ghost commented Apr 15, 2024

@annevk: can you please merge this test, I lack rights.

@annevk annevk merged commit 560c8d6 into web-platform-tests:master Apr 15, 2024
@fred-wang
Copy link
Contributor

For future reference, this test has the following issues:

  1. It's relying on iframes with srcdoc attribute, so per https://w3c.github.io/webappsec-csp/#security-inherit-csp they are inheriting the CSP policy from the main frame which contains a require-trusted-types-for directive. So we are actually moving from a TT realm to another TT realm, which is not what the test means to check. If you remove the document.body.append(sourceElement) line, you see that the setAttribute* calls continue to assert (which shouldn't be the case if they were in a non-TT realm)

  2. assert_throws_js is expecting the iframe realm's TypeError rather than the main frame realm's TypeError. IIUC this was changed after discussion on assert_throws_js fails for an element adopted from an iframe #45405 but I believe this is wrong: assert_throws_js fails for an element adopted from an iframe #45405 (comment)

I'll fix the test in https://bugzilla.mozilla.org/show_bug.cgi?id=1950626, probably moving the "which realm the TypeError is coming from" check into a separate test since that was not really what the initial test meant to check anyway.

moz-wptsync-bot pushed a commit that referenced this pull request Feb 28, 2025
…-globals-CSP-after-adoption-from-non-TT-realm.html.

See #44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1950626
gecko-commit: cfc415b178e0e9719e0124df703b3125d1484251
gecko-reviewers: smaug
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Feb 28, 2025
…de-documents-globals-CSP-after-adoption-from-non-TT-realm.html. r=smaug

See web-platform-tests/wpt#44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Feb 28, 2025
…de-documents-globals-CSP-after-adoption-from-non-TT-realm.html. r=smaug

See web-platform-tests/wpt#44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894
moz-wptsync-bot pushed a commit that referenced this pull request Feb 28, 2025
…-globals-CSP-after-adoption-from-non-TT-realm.html.

See #44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1950626
gecko-commit: cfc415b178e0e9719e0124df703b3125d1484251
gecko-reviewers: smaug
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 1, 2025
…de-documents-globals-CSP-after-adoption-from-non-TT-realm.html. r=smaug

See web-platform-tests/wpt#44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894

UltraBlame original commit: cfc415b178e0e9719e0124df703b3125d1484251
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 1, 2025
…de-documents-globals-CSP-after-adoption-from-non-TT-realm.html. r=smaug

See web-platform-tests/wpt#44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894

UltraBlame original commit: cfc415b178e0e9719e0124df703b3125d1484251
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 1, 2025
…de-documents-globals-CSP-after-adoption-from-non-TT-realm.html. r=smaug

See web-platform-tests/wpt#44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894

UltraBlame original commit: cfc415b178e0e9719e0124df703b3125d1484251
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Mar 5, 2025
…de-documents-globals-CSP-after-adoption-from-non-TT-realm.html. r=smaug

See web-platform-tests/wpt#44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894
glandium pushed a commit to mozilla-firefox/firefox that referenced this pull request Apr 1, 2025
…de-documents-globals-CSP-after-adoption-from-non-TT-realm.html. r=smaug

See web-platform-tests/wpt#44323 (comment)

Also add a more direct test for the TypeError realm.

Differential Revision: https://phabricator.services.mozilla.com/D239894
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.

Improve test coverage for DOM integration in WPT
7 participants