Open paulirish opened 11 months ago
swap
or optional
. (or if you very deliberately say you want to make the user wait with block
or fallback
.) But the doc policy is going for something slightly different (right?!). That said, the impl looks clear enough for us to add a trace event there. 🖖uses-responsive-images
audit logic. Possibility there to reuse. 👍 optimized-images
. would skip actually re-encoding, but... that's probably ok.. 👍 unsized-images
. Plus we'd pick up support for video/svg. 👍
Mostly brain dumping my research for future us...
The history of "Document Policy" is weird... Feature-Policy (i have a PR to retitle Eric's nice blogpost..) was introduced in 2018. It had features to control access to permissions and then a handful of UX-y checks/controls for common UX problems.
The whole thing was split into Permission Policy and Document Policy. Though weirdly
document.featurePolicy.allowedFeatures()
still exists and has a listing of the union.The permission policy stuff got fairly formalized and adopted. But theres this handful of old UX-y checks in Document-Policy that are VERY similar to Lighthouse audits. They may be useful to us as we consider some core refactors..
resources
document policy features
animations
: reports layout-causing (non composited) animationsfont-display-late-swap
: something about use offont-display: optional
.... I think if the font is loading late (and thusoptional
would help), it notify and maybe overrides? Not sure if it reports use of other values.sync-script
: Don't do inline scripts orscript[src]
without defer/async.oversized-images
: Don't use images that are naturally too big and therefore excessively scaled down into their container. Has a user-configurable "downscale ratio" parameter.lossless-images-strict-max-bpp
,lossless-images-max-bpp
,lossy-images-max-bpp
. Like our optimized-images audit, with a customizable byte-per-pixel ratio.unsized-media
: like our unsized-images audit.document-write
: Can block usage.sync-xhr
(in permissions policy, actually): reports when sync xhrs are usedjs-profiling
~: Enables use of JS self profiling api. very unrelated.force-load-at-top
~. Allows pages to opt out of scrolling on pageload (like to a fragment). Not relevant for us.I'm not sure that all of these can currently run in report-only mode, but.. it should be possible to add trace events, etc. (related)