Closed Bug 522463 Opened 15 years ago Closed 7 years ago

XHR with If-Modified-Since header isn't cached, fails to invalidate cache entry for previous request

Categories

(Core :: DOM: Core & HTML, defect)

1.9.2 Branch
x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 482934
Tracking Status
blocking2.0 --- -

People

(Reporter: jsmilam, Unassigned)

References

Details

Attachments

(3 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2b1pre) Gecko/20091014 Namoroka/3.6b1pre (.NET CLR 3.5.30729) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2b1pre) Gecko/20091014 Namoroka/3.6b1pre (.NET CLR 3.5.30729) A XMLHttpRequest for a given URL (for instance '/resource') with a response header of "Cache-Control: max-age=300" is cached in the disk cache as expected. A second XHR is made with an "If-Modified-Since: Wed Dec 31 1969 19:00:00 GMT-0500 (EST)" header. The response to the second request comes back with fresh data, but it is not cached in the disk cache even though a "Cache-Control: max-age=300" header is present. This would be acceptable except when a third request is made for the same URL it returns a stale response from the first XHR made as long as the 300 second max-age has not expired. Reproducible: Always Steps to Reproduce: 1. Make a XHR to a URL which will respond with a Cache-Control: max-age=300 header to a URL which will return different results on each request 2. Make a XHR with a Request header of "If-Modified-Since: Wed Dec 31 1969 19:00:00 GMT-0500 (EST)" and a response header of "Cache-Control: max-age=300" 3. Make a XHR matching the first request Actual Results: Responses from the 1st and 3rd XHR are the same because the 3rd request is served from cache. The 2nd request is different from the 1st and second. Expected Results: I would expect that the 3rd request match the 2nd request. Or that all requests have unique responses.
Version: unspecified → 3.6 Branch
Status: UNCONFIRMED → NEW
Ever confirmed: true
Honza, could you take a look at this and double check the cache headers? I plan to ask for blocking here since this is a subtle bug that could make lots of XHR sites fail in ways that would be hard to sort out. To resummarize: the 3rd GET response comes from the cache of the 1st GET response.
I ran the test case from comment 3 on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a1pre) Gecko/20091021 Minefield/3.7a1pre It still fails.
(In reply to comment #6) > I ran the test case from comment 3 on > Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a1pre) Gecko/20091021 > Minefield/3.7a1pre > It still fails. Are you sure the build already contained the fix? It has been landed the same day.
Attached image test passed screenshot
For me this is fixed.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Correctly this is duplicate of bug 475156.
Depends on: 475156
Resolution: FIXED → DUPLICATE
I think the test case only passes now because the test case is faulty. The behaviour on 3.6 was the third request returned the cached response of the first request, while the second request (containing the If-Modified-Since header) returned a fresh response. It seems that on the 3.7 build, where the test is passing, that both the second and third requests return cached responses of the first. I also tried refreshing the browser cache using Cache-Control directives, min-age, min-fresh, no-cache, and max-age. None of them force the cache to be refreshed.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Changing line 36 of b522463/b522463-XHR-cache-fails.html from if( time1 == time3 && time2 != time3 ){ to if( (time1 == time3 && time2 != time3) || (time1 == time2 && time1 == time3) ){ would be a more correct test case.
-> me will take a look at this.
Assignee: nobody → honzab.moz
Status: REOPENED → ASSIGNED
blocking2.0: --- → ?
Did this get lost?
No, just dropped lower in my todo list. It has not been approved as blocking so far.
It's a bug, but not blocker-level.
blocking2.0: ? → -
Releasing for now. Anyone feel free to take it or let me know this is still a priority and I can take it back.
Assignee: honzab.moz → nobody
Status: ASSIGNED → NEW
Component: General → DOM: Mozilla Extensions
Product: Firefox → Core
QA Contact: general → general
Version: 3.6 Branch → 1.9.2 Branch
I bet this will be fixed when bug 482934 is fixed.
Depends on: 482934
Component: DOM: Mozilla Extensions → DOM
honza, is this still an issue? The test in the URL in comment 3 is passing for me, even if I use a proxy to alter its script to have the fix suggested in comment 11. Did bug 482934 perhaps end up fixing it as believed?
Flags: needinfo?(honzab.moz)
I think we can duplicated this to bug 482934.
Status: NEW → RESOLVED
Closed: 15 years ago7 years ago
Flags: needinfo?(honzab.moz)
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: