[wpt-sync] Sync PR 62857 - Add tests for the javascript: URL pre-navigation check
Categories
(Core :: DOM: Security, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox159 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 62857 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/62857
Details from upstream follow.
Anne van Kesteren <annevk@annevk.nl> wrote:
Add tests for the javascript: URL pre-navigation check
The existing
trusted-types/navigate-to-javascript-url-*tests all have a frame navigating itself, so they cannot distinguish the document that initiated the navigation from the one being navigated. These two add coverage for the cases where they differ, and for re-entrancy from the default policy.
navigate-to-javascript-url-009.htmlcovers ajavascript:URL in thesrcattribute of a freshly insertediframe, where the default policy removes thatiframebefore the URL is evaluated. This is the one case where navigate to ajavascript:URL runs theiframeload event steps when noDocumentis produced, and by then the navigable has no container.navigate-to-javascript-url-007-crash.htmlcovers the same re-entrancy for awindow.locationnavigation, where that branch is not reached. Passes in Chromium, Gecko, and WebKit.
navigate-to-javascript-url-010.htmlhas one same-origin frame navigate another to ajavascript:URL, with each document's default policy rewriting the script source to its own name, so the result says which document was consulted. Per the standard the synthetic request's policy container is snapshotted from the initiating document, so all three subtests expect the initiating document'srequire-trusted-types-fordirective and default policy to apply.This currently passes in Gecko only. Chromium and WebKit use the navigated document instead, for both the CSP list and the default policy. The second subtest is the notable one: a document that enforces
require-trusted-types-forruns the original, un-vetted script source by aiming thejavascript:URL at a same-origin frame that does not enforce, which is what the pre-navigation check is meant to prevent.See also w3c/trusted-types#548 for which global the default policy is read from.
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 1•2 months ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=95622
| Assignee | ||
Comment 2•2 months ago
|
||
CI Results
Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 239 tests and 1 subtests
Status Summary
Firefox
OK : 2[GitHub] 237[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 1[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 4[GitHub] 3655[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 3656[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 3660[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview]
FAIL: 21
Chrome
OK : 2
PASS: 1
FAIL: 3
Safari
OK : 2
PASS: 1
FAIL: 3
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
- /trusted-types/trusted-types-from-literal.tentative.html [wpt.fyi]
- TrustedHTML.fromLiteral is supported:
FAIL - TrustedHTML.fromLiteral: Basic string literal works.:
FAIL - TrustedHTML.fromLiteral: Empty string literal works.:
FAIL - TrustedHTML.fromLiteral: A very important emoji works.:
FAIL - TrustedHTML.fromLiteral: Multi-line string literal works.:
FAIL - TrustedHTML.fromLiteral: Bound method works.:
FAIL - TrustedScript.fromLiteral is supported:
FAIL - TrustedScript.fromLiteral: Basic string literal works.:
FAIL - TrustedScript.fromLiteral: Empty string literal works.:
FAIL - TrustedScript.fromLiteral: A very important emoji works.:
FAIL - TrustedScript.fromLiteral: Multi-line string literal works.:
FAIL - TrustedScript.fromLiteral: Bound method works.:
FAIL - TrustedScriptURL.fromLiteral is supported:
FAIL - TrustedScriptURL.fromLiteral: Basic string literal works.:
FAIL - TrustedScriptURL.fromLiteral: Empty string literal works.:
FAIL - TrustedScriptURL.fromLiteral: A very important emoji works.:
FAIL - TrustedScriptURL.fromLiteral: Multi-line string literal works.:
FAIL - TrustedScriptURL.fromLiteral: Bound method works.:
FAIL - TrustedHTML.fromLiteral: Normalization of value works.:
FAIL - TrustedScript.fromLiteral: No normalization of value occurs.:
FAIL - TrustedScriptURL.fromLiteral: No normalization of value occurs.:
FAIL
- TrustedHTML.fromLiteral is supported:
Comment 4•2 months ago
|
||
| bugherder | ||
Comment 5•2 months ago
|
||
| bugherder | ||
Description
•