Bug 245411

Summary: Multiple picture sources downloading when page is served as XHTML
Product: WebKit Reporter: Robin Whittleton <robin>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, ap, cdumez, sabouhallawa, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Mac (Intel)   
OS: Other   
See Also: https://bugs.webkit.org/show_bug.cgi?id=159484
Attachments:
Description Flags
XHTML variant that demonstrates the problem
none
HTML variant that works correctly none

Description Robin Whittleton 2022-09-19 23:18:10 PDT
Created attachment 462466 [details]
XHTML variant that demonstrates the problem

First up, this is quite possibly a dupe of bug #159484, but as the trigger is different I’ll start with filing this issue separately.

Given a page with a picture element with a source element that references a different resource to the img element, both referenced resources will be downloaded if the page is served as an XHTML document with the appropriate xmlns.

I’ve attached a couple of test files that demonstrate the problem.

This was observed in the wild on https://standardebooks.org/ebooks, which doesn’t contain any JS (trigger from bug #159484) and is served as XHTML.
Comment 1 Robin Whittleton 2022-09-19 23:18:29 PDT
Created attachment 462467 [details]
HTML variant that works correctly
Comment 2 Ahmad Saleem 2022-09-23 13:23:32 PDT
Only difference I can find between these two test is:

<html xmlns="http://www.w3.org/1999/xhtml">

vs

<html>

and both have issues while pasting the code in W3C validator:

https://validator.w3.org/#validate_by_input

- Can you share an example with working images in it and reproducible test case in both cases, I don't get any difference. Thanks!
Comment 3 Alexey Proskuryakov 2022-09-24 16:18:39 PDT
What's important here is that the attachments are served with different content types. application/xhtml+xml means that the document is handled as XHTML.

To see the problem, one needs to check errors in Web Inspector. One subresource loading error means passing; two errors means failing. This does reproduce.
Comment 4 Ahmad Saleem 2022-09-24 16:20:10 PDT
(In reply to Alexey Proskuryakov from comment #3)
> What's important here is that the attachments are served with different
> content types. application/xhtml+xml means that the document is handled as
> XHTML.
> 
> To see the problem, one needs to check errors in Web Inspector. One
> subresource loading error means passing; two errors means failing. This does
> reproduce.

Thanks for your input.. New learning for me. Will account for in future testing. :-)
Comment 5 Radar WebKit Bug Importer 2022-09-26 23:19:18 PDT
<rdar://problem/100444926>
Comment 6 Robin Whittleton 2022-09-26 23:25:43 PDT
Note: standardebooks.org (referenced in the original comment) has now been adjusted to not serve any source elements to Safari, effectively bypassing this problem. The bug still stands with the testcases.