New issue
Advanced search Search tips

Issue 690868 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 3
Type: Feature



Sign in to add a comment

Warn when background-image with empty url sends an unnecessary request to the current page

Reported by z...@rhizom.fr, Feb 10 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

Steps to reproduce the problem:
1. Open the linked html file
2. Open chrome dev tools and inspect network
3. A second request to the current html page is made with an image accept type (visible in attached screenshot).

What is the expected behavior?
Similarly to the issue caused by an <img src="" /> (for more info: https://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/).
Apparently an empty src in a img tag does not throw a request anymore, I guess it should be the same in that case.

According to my test, Edge seems to transform background-image: url() to background-image: none.

At least, a specific warning could be added to highlight the fact that an empty url has been encountered which may lead to unnecessary request.

What went wrong?
As explained on the "how to reproduce" part, see the attached screenshot.

Did this work before? No 

Does this work in other browsers? No
 - Can reproduce on Firefox 52.0b4
- No issue on edge (Microsoft Edge 38.14393.0.0/ Microsoft EdgeHTML 14.14393

Chrome version: 55.0.2883.87  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 24.0 r0

 

Comment 1 by z...@rhizom.fr, Feb 10 2017

Something went wrong with attached files, submitting again.
style-empty-url.html
280 bytes View Download
devtool-network_empty-url-test.jpg
98.8 KB View Download
Labels: Needs-Milestone
Components: -Blink>CSS Blink>Loader
Passing on to the loading team for more info on whether this is expected behaviour.

Comment 4 Deleted

Regarding image elements, it's specified at [1].

If the element does not use srcset or picture, and it has a src attribute specified and its value is not the empty string, let selected source be the value of the element's src attribute, and selected pixel density be 1.0. Otherwise, let selected source be null and selected pixel density be undefined. 

So the empty string should be ignored.

I'm not so sure about css: According to [2] (which seems old though), the string should be parsed as URL relative to the base URL, it doesn't mention about an empty string. It seems empty string should be parsed into the base URL.

Adding Blink>CSS expecting CSS people know more.

1: https://html.spec.whatwg.org/multipage/embedded-content.html#updating-the-image-data

2: https://www.w3.org/TR/CSS21/syndata.html#uri

Comment 6 by nainar@chromium.org, Feb 14 2017

Labels: Needs-Bisect
Status: Untriaged (was: Unconfirmed)

Comment 7 by ajha@chromium.org, Feb 15 2017

Cc: ajha@chromium.org
Labels: -Needs-Bisect -Needs-Milestone M-58 OS-Linux OS-Mac
Able to observe the same behavior on the latest canary(58.0.3012.0) of Mac OS 10.12.2 and Linux Ubuntu 14.04.

Tested this on older chrome version: 30.0.1549.0 on Windows 10 and observed the similar behavior there as well. Attached is the screenshot of the same and removing the Needs-Bisect label.
690868.png
89.9 KB View Download
Components: -Blink>Loader
Status: Available (was: Untriaged)
Components: -Blink>CSS Platform>DevTools
Labels: -Type-Bug -Pri-2 Pri-3 Type-Feature
Summary: Warn when background-image with empty url sends an unnecessary request to the current page (was: background-image with empty url throws an unnecessary request to the current page)
Not seeing any spec justification for this behaviour. I advise pursuing this at the spec level.


In the meantime it sounds reasonable that DevTools could warn the developer when this happens. Passing over to them.
Status: WontFix (was: Available)
WontFix due to lack of priority / resources

Sign in to add a comment