[Webkit-unassigned] [Bug 179231] New: Preloader ignores type attribute on Source tag causing overdownloading

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 2 22:27:12 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=179231

            Bug ID: 179231
           Summary: Preloader ignores type attribute on Source tag causing
                    overdownloading
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Images
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: colin at bendell.ca

The `type` attribute in <source> tags are ignored by the preloader. A common pattern is to use the <source> tag for content negotiation selection to specify webp for chrome and jp2 for safari. For example:

<picture>
  <source type="image/webp" srcset="foo.webp">
  <source type="image/jp2" srcset="foo.jp2">
  <img src="foo.jpg">
</picture>

However, the HTMLPreloadScanner only considers the media query when selecting (or not) the appropriate <source> element. As a result the preloader greedily selects the foo.webp and then later requests the correct foo.jpg. It should also evaluate the `type` attribute. 

A more complete example below that demonstrates this bug. Here we use the Souder's cuzillion service to create a slow, blocking js to ensure the preloader is used:

<html>
<head>
  <script src="http://1.cuzillion.com/bin/resource.cgi?type=js&sleep=1&expires=-1"></script>  
</head>
<body>
  <picture>
    <source type="image/bad" srcset="https://webkit.org/wp-content/themes/webkit/images/squirrelfish-lives.svg"/>
    <img src="https://webkit.org/wp-content/themes/webkit/images/webkit.svg">
  </picture>
</body>
</html>

In this example you will see both the squirrelfish-lives.svg and the webkit.svg file are retrieved. But only the webkit.svg is displayed. 

Chrome previously had this same issue and it was addressed in Chrome 52 (See Blink bug 615473)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171103/971a689a/attachment.html>


More information about the webkit-unassigned mailing list