whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.19k stars 2.72k forks source link

Memory cache/list of available images interop meta-issue #6110

Open domenic opened 4 years ago

domenic commented 4 years ago

It's been known for a long time that the spec doesn't match reality when it comes to the "memory cache", which is some sort of in-memory layer in front of the HTTP cache (see https://blog.yoav.ws/tale-of-four-caches/ for a bit more). The spec has a per-document (but also shareable-between-documents) "list of available images", but Blink and WebKit implement something more general. I believe Gecko implements the spec's image cache, but also a non-specced stylesheet cache. There's also some connection to the also-unspecced preload cache, it seems.

The open issues I could find regarding this are: https://github.com/whatwg/html/issues/5674, https://github.com/whatwg/html/issues/2465, https://github.com/whatwg/fetch/issues/590, https://github.com/whatwg/html/issues/154, https://www.w3.org/Bugs/Public/show_bug.cgi?id=25798.

Solving this problem with one grand spec edit seems very hard. And there are so many issues to go through on the conceptual level (e.g. cache scope, cache keys, interaction with preloads, interaction with HTTP headers, etc.) Instead, perhaps we could concentrate on specific non-interoperable scenarios, ideally inspired by bugs that web developers have encountered in the wild, and work toward conclusions on them. That's what I'd like to use this issue for.

Hopefully we can come to an agreement on the desired behavior in each scenario, and then commit a .tentative web platform test for it, and get all browsers to align. Maybe eventually we could write spec text, but staying focused on the interop pain and driving it down through tests + browser bugs seems like the right initial focus.

Folks who have mentioned being interested in this area in the past: @emilio @domfarolino @yoavweiss. I'd also love to hear from some Apple folks if they've run into anything; I believe @smfr and @achristensen07 were at the TPAC meeting where this was discussed.

noamr commented 2 years ago

I took a stab at the tentative test described in the OP: https://github.com/web-platform-tests/wpt/pull/32833 The main differences between browsers seem to be (as far as I'm able to observe):

I believe these things should be spec'ed

noamr commented 2 years ago

One issue that needs to be addressed WRT memory cache is dynamic CSP, see https://github.com/whatwg/html/issues/7686

If something is loaded into the memory cache and later a dynamically added CSP directive blocks that type of resource, should it be allowed or not?