w3c / paint-timing

Paint Timing
https://w3c.github.io/paint-timing/
Other
256 stars 28 forks source link

Consider to expose decoding time for FCP and LCP? #104

Closed sefeng211 closed 3 days ago

sefeng211 commented 7 months ago

I haven't get a chance to do a proper testing for this, so I'll just refer to Michal's slide for TPAC 2022. Based on the slides, Firefox and Safari doesn't wait for the image to be decoded for FCP, but Chrome does.

Should we update the spec for FCP to wait for the image to be decoded?

I think the spec for LCP only waits for the size of the image to be known, it also doesn't wait for the image to be decoded. Should it also be updated as well?

There's a concern about leaking image decoding time. On one hand, image.decode() can leak the same information, however on the other hand, image.decode() uses a promise, so engines can add arbitrary delays to avoid leaking the same information.

We have some related discussions https://github.com/w3c/largest-contentful-paint/issues/111, https://github.com/WICG/element-timing/issues/65

noamr commented 7 months ago

This is also connected to #62.

noamr commented 3 weeks ago

We've discussed this with the security folks. As for as LCP/element-timing goes, the current restriction with Timing-Allow-Origin doesn't make sense because that's a resource-based protection and render time is for the whole document.

So the current proposal is to remove the TAO restrictions, and instead coarsen the render time by 4ms (and clamp to the load time) when the document is not cross-origin-isolated. This would make trying to use timing attacks to figure out information about cross-origin images based on their decoding time not useful.

noamr commented 3 weeks ago

A more detailed explanation about this for the WG call: