Bug 159484 - Multiple Picture Sources Downloading e.g. webp and jpeg
Summary: Multiple Picture Sources Downloading e.g. webp and jpeg
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: Safari 9
Hardware: Mac OS X 10.11
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
: 177068 215805 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-07-06 12:19 PDT by Lee
Modified: 2024-07-22 03:24 PDT (History)
11 users (show)

See Also:


Attachments
Example html file and screenshot, as on gist.github.com. (34.07 KB, application/zip)
2016-07-06 12:19 PDT, Lee
no flags Details
Example using external javascript (35.07 KB, application/zip)
2017-09-19 02:45 PDT, Anders
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lee 2016-07-06 12:19:56 PDT
Created attachment 282923 [details]
Example html file and screenshot, as on gist.github.com.

I think I've found an odd bug in Safari related to the picture element and downloading multiple sources, which I've been advised may be a Webkit thing. See example html: https://gist.github.com/notlee/73ebe50c3af907f3cde875afd9cd61c1

Actual:
For the picture element seen in the example above, both the webp source and jpeg img fallback downloads unless (oddly) you delete the script tag, remove the new line between the opening and closing of the script tag, or delete the link tag href contents. ¯\_(ツ)_/¯ 

Expected:
The expected behaviour being to only download one picture source or the img element fallback. In this case ignore the webp picture source, given Safari doesn't support it, and therefore only download the jpeg img.

Observed on:
OSX 10.11.5
Safari Version 9.1.1 (11601.6.17)
Safari Preview Version 9.1.2 (11601.7.4, 11602.1.37)
Comment 1 Radar WebKit Bug Importer 2016-07-12 09:33:35 PDT
<rdar://problem/27301646>
Comment 2 Anders 2017-09-19 02:45:55 PDT
Created attachment 321191 [details]
Example using external javascript

Just to confirm that this still appears to the an open issue. The example HTML from Lee worked fine for me, but a slightly modified one has the same issue. It looks like any external script BEFORE the picture tag causes the issue. Moving the script tag to after the picture tag seems to solve it.

Observed on:
OS X 10.12.6
Safari Version 10.1.2 (12603.3.8)
Safari Technology Preview 39 (Safari 11.1, Webkit 12605.1.4.0.1)
Webkit Nightly 222202 - with cache disabled (works if the external file is cached)
Comment 3 Colin Bendell 2017-11-16 12:11:58 PST
I believe this is a duplicate of bug 179231
Comment 4 Maciej Stachowiak 2020-07-09 04:23:09 PDT
This case isn't exactly identical, in that there are not multiple <source> elements, but it does seem similar, and may have been fixed by that change.
Comment 5 Said Abou-Hallawa 2020-09-01 09:25:18 PDT
*** Bug 177068 has been marked as a duplicate of this bug. ***
Comment 6 Said Abou-Hallawa 2020-09-01 09:27:42 PDT
*** Bug 215805 has been marked as a duplicate of this bug. ***
Comment 7 Yoav Weiss 2024-07-22 03:24:56 PDT
https://github.com/WebKit/WebKit/pull/31055 addresses this