Bad cache expiration policy for images loaded with Javascript

RESOLVED WONTFIX

Status

()

Firefox
General
--
major
RESOLVED WONTFIX
9 years ago
6 years ago

People

(Reporter: yannack, Unassigned)

Tracking

3.6 Branch
x86
Windows Vista
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [testday-20120615])

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4

i am working with some caching issues. I have some javascript code which loads images from various websites, and refreshes these images, by simply clearing the source of the img or by changing the background of the iframe, depending on the type of display. However, I have found that in many cases, Firefox doesn't reload the image from source but uses the cached version; and this despite the fact that there is a Expires, last Modified, and Cache-control:max-age set so as to have an expiration after one second. Internet Explorer does not have this problem. I can successfully reproduce this issue on Firefox 2 with Linux, Firefox 3.0 with Ubuntu-Linux, Firefox 3.1beta2 with a custom Linux, and Firefox 3.0.4 for Vista.


Here is a sample html page which doesn't reload properly with firefox, but does with IE:

<html>
<script>

function clearbg(){
	document.getElementById("myframe").style.background="none";
	document.getElementById("mypic").src="";
	setTimeout("setbg()",1000);
	
}

function setbg(){
	document.getElementById("myframe").style.background="url('http://www.sytadin.equipement.gouv.fr/tempsreel/parisint.gif')";
	document.getElementById("mypic").src="http://www.sytadin.equipement.gouv.fr/tempsreel/parisint.gif";
	setTimeout("clearbg()",1000);
}

</script>
<body onload="setbg();">
<div id="mydiv"></div>
<iframe id="myframe" src="">
</iframe>
<img src="" id="mypic">
</body>
</html>


Reproducible: Always

Steps to Reproduce:
1. make a webpage which uses JS to show and then hide an image which shouldn't be cached for more than a second
2. set the refresh timers to above a second
3. observe Firefox not reloading image
Actual Results:  
Firefox doesn't reload images where it should

Expected Results:  
It should reload the images
This is a mass search for bugs which are in the Firefox General component, are
UNCO, have not been changed for 500 days and have an unspecified version. 

Reporter, can you please update to Firefox 3.6.10 or later, create a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles, and test again. If you still see the issue, please update this bug. If the issue is gone, please set the status to RESOLVED > WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]
(Reporter)

Comment 2

7 years ago
I have juste performed the test as I had described the first time around, using a different image for the source as this source is no longer available. 
I confirm this problem is still present, there is no way of having the image be refreshed when reloaded into a page, even if it has expired.
:(
Whiteboard: [CLOSEME 2010-11-01]

Updated

7 years ago
Version: unspecified → 3.6 Branch

Comment 3

7 years ago
I am running into a similar problem with my development. I am modifying an img tag's src attribute and if I end up putting the src attribute to a previous URL, that the browser had made a request, for it will not request the image again.

An example of the code is here:

http://jsbin.com/ulobo5/5

The first image is cached so it shouldn't re-request it. The second image which is a no-store, no-cache is not being requested when it is set a second time.

If the browser was respecting the caching header the captcha should be a different image each time the captcha comes up.

Comment 4

7 years ago
Bug 183470 seems to be addressing a similar issue but it has deviated a bit.
Firefox 3.6 is now EOL, please try latest version of Firefox and feel free to open if it reproducible on latest build
* http://getfirefox.com
for support
* https://support.mozilla.org/questions/new
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
Whiteboard: [testday-20120615]
You need to log in before you can comment on or make changes to this bug.