Closed Bug 425792 Opened 14 years ago Closed 14 years ago

offline cache updates not validating with the server

Categories

(Core :: Networking: Cache, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: dcamp, Assigned: dcamp)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch v1 (obsolete) — Splinter Review
Bug 405693 changed the update mechanism to use the offline cache as the main cache when refreshing the offline cache.  That's the right thing to do, but it broke updates - when reading from the offline cache, we never validate from the server.

The attached patch allows validating an entry from the offline cache if we're also updating the offline cache.  It also makes sure that the offline cache entry has the correct expiration date.

The included tests make sure the right behavior happens with various caching expiration times.
Flags: blocking1.9?
Attachment #312353 - Flags: superreview?(cbiesinger)
Attachment #312353 - Flags: review?(cbiesinger)
+'ing this as we simply need to fix this.  
Flags: blocking1.9? → blocking1.9+
Priority: -- → P2
Comment on attachment 312353 [details] [diff] [review]
v1

+    // This entry's expiration time should match the main entry's expiration
+    // time.  UpdateExpirationTime() will keep it in sync once the offline
+    // cache entry has been created.
+    PRUint32 expirationTime;
+    nsresult rv = mCacheEntry->GetExpirationTime(&expirationTime);

hm, will there always be an mCacheEntry here?
Attachment #312353 - Flags: superreview?(cbiesinger)
Attachment #312353 - Flags: superreview+
Attachment #312353 - Flags: review?(cbiesinger)
Attachment #312353 - Flags: review+
Whiteboard: [needs landing]
Checking in dom/tests/mochitest/ajax/offline/Makefile.in;
/cvsroot/mozilla/dom/tests/mochitest/ajax/offline/Makefile.in,v  <--  Makefile.in
new revision: 1.8; previous revision: 1.7
done
RCS file: /cvsroot/mozilla/dom/tests/mochitest/ajax/offline/changing1Hour.sjs,v
done
Checking in dom/tests/mochitest/ajax/offline/changing1Hour.sjs;
/cvsroot/mozilla/dom/tests/mochitest/ajax/offline/changing1Hour.sjs,v  <--  changing1Hour.sjs
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/dom/tests/mochitest/ajax/offline/changing1Sec.sjs,v
done
Checking in dom/tests/mochitest/ajax/offline/changing1Sec.sjs;
/cvsroot/mozilla/dom/tests/mochitest/ajax/offline/changing1Sec.sjs,v  <--  changing1Sec.sjs
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/dom/tests/mochitest/ajax/offline/changingManifest.sjs,v
done
Checking in dom/tests/mochitest/ajax/offline/changingManifest.sjs;
/cvsroot/mozilla/dom/tests/mochitest/ajax/offline/changingManifest.sjs,v  <--  changingManifest.sjs
initial revision: 1.1
done
Checking in dom/tests/mochitest/ajax/offline/offlineTests.js;
/cvsroot/mozilla/dom/tests/mochitest/ajax/offline/offlineTests.js,v  <--  offlineTests.js
new revision: 1.3; previous revision: 1.2
done
RCS file: /cvsroot/mozilla/dom/tests/mochitest/ajax/offline/test_changingManifest.html,v
done
Checking in dom/tests/mochitest/ajax/offline/test_changingManifest.html;
/cvsroot/mozilla/dom/tests/mochitest/ajax/offline/test_changingManifest.html,v  <--  test_changingManifest.html
initial revision: 1.1
done
Checking in netwerk/cache/src/nsCacheService.cpp;
/cvsroot/mozilla/netwerk/cache/src/nsCacheService.cpp,v  <--  nsCacheService.cpp
new revision: 1.120; previous revision: 1.119
done
Checking in netwerk/protocol/http/src/nsHttpChannel.cpp;
/cvsroot/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp,v  <--  nsHttpChannel.cpp
new revision: 1.331; previous revision: 1.330
done
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
I added an if (mCacheEntry) around that bit.
Attachment #312353 - Attachment is obsolete: true
Whiteboard: [needs landing]
Blocks: 415983
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.