Closed Bug 1364722 Opened 7 years ago Closed 7 years ago

Unnecessary requests re-sent for a cached image with only the hash at the end of the URL changed

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 1027106

People

(Reporter: mardeg, Unassigned)

Details

Attachments

(7 files)

Attached image SVG file for testcase
Tested in latest Nightly on Linux 32-bit, in the devtools network monitor I'm seeing the same URL request being re-sent when javascript is used only to change the part of an SVG image address after the # (it's a sprite sheet of a dozen images with <view>s of each.

STR: 
1. Open the attached testcase and devtools network monitor.
2. Choose a version of the image by host (please don't hammer imgh.us)
3. Click the image to see the next sprite
4. Check the network requests.

Actual behaviour: Each time the image is clicked the same URL is re-requested over the internet.

Expected behaviour: There should be a check done when the img .src attribute is set and no part before the # has changed, to prevent an unneeded round trip to a server. Chromium does this check and the image changes instantly in response to clicks.
Attached file img src testcase
Note the #dc01 at the end of the img src URL ascends to #dc02 etc. for the next sprite up to #dc12 and cycles back to the beginning.
Component: Networking: Cache → DOM
I am 95% positive that we have tests that depend on the fragment behavior not hitting in the image cache.
No longer blocks: 1347376
Daniel, do I remember correctly that this is a known issue with SVG images?  I remember running into a similar issue when working on tab audio indicators where we also use SVG images with URLs with hashes at the end where we refetch the image similarly...  I can't find the bug# right now.
Flags: needinfo?(dholbert)
Preserving a comment here from bug 1347376 comment 9

> it occurs to me the best way to make LoadImage() faster is not to call it at all.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
tnikkel found the correct dupe-target -- thanks!

(Per bug 1121693 comment 8, this isn't SVG-specific -- it happens for whatever.jpg#dc01, whatever.jpg#dc02, etc. too -- though it's more likely that someone would want to use a #ref with a SVG image.)
Flags: needinfo?(dholbert)
Component: DOM → ImageLib
Attached file testcase #2
Shows how crucial having no delay from a "load" cycle is.
OS: Linux → All
Hardware: x86 → All
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: