Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazyload images cannot load immediately from the list of available im… #42780

Conversation

pgorszkowski-igalia
Copy link
Contributor

…ages if they differ with 'crossorigin'

In #updating-the-image-data [1], all images including lazyloaded ones are able to load immediately from the list of available images. Each image in list is identified by a tuple consisting of an absolute URL and CORS settings attribute mode (with origin if mode is NO-CORS). So if the crossorigin attribute of the lazyloaded image and the one from "list of available images" are different then lazyloaded one is not able to load immediately from the list of available images.

This CL adds a test for the case when eagerly loaded image does not contain 'crossorigin' attribute and the lazyloaded one (out-of-viewport) contains crossorigin="anonymous". In this case lazyloaded one is not loaded immediately from the list of available images.

[1] https://html.spec.whatwg.org/multipage/images.html#updating-the-image-data
[2] https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attribute

…ages if they differ with 'crossorigin'

In #updating-the-image-data [1], all images including lazyloaded ones are able to
load immediately from the list of available images. Each image in list is identified
by a tuple consisting of an absolute URL and CORS settings attribute mode (with
origin if mode is NO-CORS). So if the crossorigin attribute of the lazyloaded image
and the one from "list of available images" are different then lazyloaded one is not
able to load immediately from the list of available images.

This CL adds a test for the case when eagerly loaded image does not contain 'crossorigin'
attribute and the lazyloaded one (out-of-viewport) contains crossorigin="anonymous". In
this case lazyloaded one is not loaded immediately from the list of available images.

[1] https://html.spec.whatwg.org/multipage/images.html#updating-the-image-data
[2] https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attribute
@pgorszkowski-igalia pgorszkowski-igalia force-pushed the pgorszkowski/image_loading_lazy_different_crossorigin branch from 84504bf to 9d4a7e7 Compare November 3, 2023 09:41
@pgorszkowski-igalia
Copy link
Contributor Author

One more thing: my test covers only the case when eagerly loaded image does not have crossorigin and lazyloaded one has crossorigin='anonymous' but there can be more options/combinations (A. missing crossorigin, B. crossorigin='', C. crossorigin='anonymous', D. crossorigin='use-credentials'). B and C options are equal, but the rest of combinations should be tested separately, should I add them here?

@domfarolino
Copy link
Member

B and C options are equal, but the rest of combinations should be tested separately, should I add them here?

I actually think we don't need to be 100% exhaustive in testing all possible combinations. Using what you have here as a fair representation of non-matching "list of available image" cache keys seems fine to me.

@domfarolino
Copy link
Member

It seems that every browser currently passes this test (https://wpt.fyi/results/?label=pr_head&max-count=1&pr=42780), is that your understanding too? That is, all browsers are interoperable in this case?

@domfarolino domfarolino merged commit f4e82dd into web-platform-tests:master Nov 3, 2023
20 checks passed
@pgorszkowski-igalia
Copy link
Contributor Author

pgorszkowski-igalia commented Nov 5, 2023

It seems that every browser currently passes this test (https://wpt.fyi/results/?label=pr_head&max-count=1&pr=42780), is that your understanding too? That is, all browsers are interoperable in this case?

yes, that is expected. I tested it also with FireFox , Chrome and WebKitGTK.

I would say that if browser passes both tests:
html/semantics/embedded-content/the-img-element/image-loading-lazy-use-list-of-available-images.html
html/semantics/embedded-content/the-img-element/image-loading-lazy-different-crossorigin.html

it means that browser support using list of available images by lazy loaded img.

In case when browser does not support correctly using of list of available images by lazy loaded img, browser can pass html/semantics/embedded-content/the-img-element/image-loading-lazy-different-crossorigin.html but not html/semantics/embedded-content/the-img-element/image-loading-lazy-use-list-of-available-images.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants