[wpt-sync] Sync PR 62906 - [Blink] Resolve CSS Image and Font values per-document
Categories
(Core :: DOM: Security, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 62906 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/62906
Details from upstream follow.
Hoch Hochkeppel <mhochk@microsoft.com> wrote:
[Blink] Resolve CSS Image and Font values per-document
CSS style resources referenced from a stylesheet were cached directly on
theCSSValueobjects owned byStyleSheetContents. Because two
same-origin documents that link the same stylesheet share a single
StyleSheetContentsinstance, a resource already fetched by the first
document was reused by the second document without any fetch of its own.
This let the second document display a resource that its own Content
Security Policy would have blocked, defeating per-document CSP
enforcement.This change caches each fetched style resource in a per-ResourceFetcher
map keyed on the requesting document's fetcher, rather than in a single
shared slot. A document whose fetcher has not fetched the resource now
re-fetches it under its own CSP. The performance and memory impact
should usually be minimal due to the re-fetch resolving in the
MemoryCacheinstead of the network, but that is not guaranteed (e.g.
if the resource was marked no-store). Same-fetcher lookups still hit the
cache, so there is no additional fetching within a single document.A null
ResourceFetcherroute is still supported for contexts that have
no fetcher (e.g. cross-thread style values).A route for taking a snapshot (used by
StyleFetchedImage) is also
introduced, with the snapshot being available in all contexts regardless
ofResourceFetcher.The new behavior is on-by-default, but gated behind the
StyleResourceFetcherIdentityCheckruntime-enabled feature in case it
needs to be stopped.This change does not attempt to key based on the CSP or an initial
CanRequestresult. That would validate only the starting CSP decision,
not the full set of per-document request checks an actual fetch performs
(e.g. each stage of redirects, or resulting URL differing from requested
URL).Authorship of these WPTs is attributed to Dileep, based on
crrev.com/c/7867457Fixed: 504107363
Change-Id: Icd98ac13320cfc7238a7236c23e83143b7359144
Reviewed-on: https://chromium-review.googlesource.com/8410893
WPT-Export-Revision: 318df78cd096958b702299c348fc6b38f3eb2aa0
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 1•1 month ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=111269
| Assignee | ||
Comment 2•27 days ago
|
||
CI Results
Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 28 tests and 1 subtests
Status Summary
Firefox
OK : 2[GitHub] 21[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] 22[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 : 5[GitHub] 25[Gecko-windows11-32-25h2-opt] 26[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-windows11-32-25h2-debug] 27[Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug] 28[Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL : 1[Gecko-windows11-32-25h2-debug] 2[Gecko-windows11-32-25h2-opt] 3[GitHub] 4[Gecko-android-em-14-x86_64-opt-geckoview] 5[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 6[Gecko-linux2404-64-debug]
Chrome
OK : 2
PASS : 4
FAIL : 4
Safari
OK : 2
PASS : 3
FAIL : 2
TIMEOUT: 3
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
- /content-security-policy/img-src/shared-stylesheet-image-cache-bypass.html [wpt.fyi]:
FAIL(Chrome:FAIL, Safari:PASS) - /content-security-policy/img-src/shared-stylesheet-image-set-cache-bypass-strict-first.html [wpt.fyi]:
FAIL(Chrome:FAIL, Safari:TIMEOUT) - /content-security-policy/img-src/shared-stylesheet-image-set-cache-bypass.html [wpt.fyi]:
FAIL[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-64-25h2-debug,Gecko-windows11-64-25h2-opt],PASS[GitHub] (Chrome:PASS, Safari:PASS) - /content-security-policy/img-src/shared-stylesheet-mask-cache-bypass-strict-first.html [wpt.fyi]:
FAIL[Gecko-linux2404-64-debug],PASS[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-opt,Gecko-windows11-64-25h2-debug,Gecko-windows11-64-25h2-opt,GitHub] (Chrome:FAIL, Safari:TIMEOUT) - /content-security-policy/img-src/icon-blocked.sub.html [wpt.fyi]:
OK[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],SKIP[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] - /content-security-policy/font-src/shared-stylesheet-font-cache-bypass-strict-first.html [wpt.fyi]
- A strict iframe loading first must not poison the shared CSSFontFaceSrcValue cache:
FAIL[Gecko-android-em-14-x86_64-debug-geckoview,Gecko-android-em-14-x86_64-lite-opt-geckoview,Gecko-linux2404-64-debug,Gecko-linux2404-64-opt,Gecko-windows11-32-25h2-opt,Gecko-windows11-64-25h2-debug,Gecko-windows11-64-25h2-opt],PASS[Gecko-android-em-14-x86_64-opt-geckoview,Gecko-windows11-32-25h2-debug,GitHub] (Chrome:PASS, Safari:PASS)
- A strict iframe loading first must not poison the shared CSSFontFaceSrcValue cache:
- /content-security-policy/font-src/shared-stylesheet-font-cache-bypass.html [wpt.fyi]
- font-src "none" is enforced even when the stylesheet is already in the MemoryCache:
FAIL(Chrome:FAIL, Safari:FAIL)
- font-src "none" is enforced even when the stylesheet is already in the MemoryCache:
Tests Disabled in Gecko Infrastructure
- /content-security-policy/img-src/icon-blocked.sub.html [wpt.fyi]:
OK[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],SKIP[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]
Comment 4•24 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/be99995da7db
https://hg.mozilla.org/mozilla-central/rev/10786cc3cb9b
Description
•