v152 · ua image replacement

What breaks without them

Suppose a browser replaced an image and told nobody. Could a page work it out anyway? This asks every property an image exposes, against a real image, and the answer is the argument for the feature: almost none of it would change.

Everything a page can observe about an image

A sample image, loaded from this site, used to read back the properties a page can observe about it.
Would this change if the browser swapped the pixels?
what a page can readvalue herechanges on replacement?why
Not read yet.
Press the button.

The "changes?" column is reasoning, not measurement — no browser here replaces images, so nothing can be observed changing. What is measured is the left-hand side: every one of those properties is read from a real loaded image, so the list of what a page has to work with is complete and current.

The one thing that would change

The pixels. A page can read them back through a canvas — and for a same-origin image, that works. Whether it would notice a replacement depends on being able to compare against something, which means storing a hash of every image you ship and checking it on every load.

Not hashed yet.

This works, and it is not a solution. It costs a canvas draw and a read-back per image, it fails for cross-origin images because the canvas is tainted, and it tells you that something changed rather than that the browser changed it deliberately at the user's request — which are very different things to respond to.

The furniture that becomes wrong

Page elements that describe an image, and what they claim once it is not that image
elementwhat it assertsafter a replacement

see also