New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 633875 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Sep 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Picture elements removed from DOM still make network requests when resizing browser.

Reported by mark.mur...@bbc.co.uk, Aug 3 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36

Steps to reproduce the problem:
1. Resize browser to <600px width.
2. Load a HTML page containing a picture element with a single source element with a media query set to min-width: 600px.
3. Remove the picture element from the DOM.
4. Resize the browser to >600px.
5. Observe the network panel to see that an image used in the picture element has been requested.

A working example has been created here: http://codepen.io/anon/pen/WxgExr

What is the expected behavior?
No network requests should be made for picture elements that have been removed from the DOM.

What went wrong?
Bandwidth is wasted to load images for picture elements that no longer exist when resizing the browser.

Did this work before? N/A 

Chrome version: 51.0.2704.103  Channel: stable
OS Version: OS X 10.10.5
Flash Version: Shockwave Flash 22.0 r0
 
Components: -Blink Blink>Loader
Owner: y...@yoav.ws
Status: Assigned (was: Unconfirmed)
I think this is a dupe of another issue, but I'm passing to Yoav to make sure. Yoav, PTAL?

Comment 3 by y...@yoav.ws, Aug 13 2016

Status: Started (was: Assigned)
Not a dupe. The HTMLSourceElement doesn't remove its MediaQueryList's listener.
Project Member

Comment 4 by bugdroid1@chromium.org, Sep 4 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/dfdb63d9b535f4d20901a7e95f91bf503978ec2f

commit dfdb63d9b535f4d20901a7e95f91bf503978ec2f
Author: yoav <yoav@yoav.ws>
Date: Sun Sep 04 07:34:53 2016

Remove MediaQueryList listener from removed HTMLSourceElement.

Currently the listener is not removed when HTMLSourceElement is removed from the DOM,
resulting in needless downloads when viewport changes after such removal. This CL fixes that.

BUG= 633875 

Review-Url: https://codereview.chromium.org/2256533002
Cr-Commit-Position: refs/heads/master@{#416468}

[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/image-picture-download-after-shrink-expected.txt
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/image-picture-download-after-shrink.html
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/image-picture-no-download-after-picture-removal-expected.txt
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/image-picture-no-download-after-picture-removal.html
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/image-picture-no-download-after-removal-expected.txt
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/image-picture-no-download-after-removal.html
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/image-picture-no-download-after-source-removal-expected.txt
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/image-picture-no-download-after-source-removal.html
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/resources/image-picture-download-after-shrink-frame.html
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/resources/image-picture-no-download-after-picture-removal-frame.html
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/resources/image-picture-no-download-after-removal-frame.html
[add] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/LayoutTests/http/tests/loading/resources/image-picture-no-download-after-source-removal-frame.html
[modify] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
[modify] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/Source/core/html/HTMLPictureElement.cpp
[modify] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/Source/core/html/HTMLPictureElement.h
[modify] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/Source/core/html/HTMLSourceElement.cpp
[modify] https://crrev.com/dfdb63d9b535f4d20901a7e95f91bf503978ec2f/third_party/WebKit/Source/core/html/HTMLSourceElement.h

Comment 5 by y...@yoav.ws, Sep 5 2016

Status: Fixed (was: Started)

Sign in to add a comment