offline cache updates not validating with the server

RESOLVED FIXED

Status

()

P2
normal
RESOLVED FIXED
11 years ago
10 years ago

People

(Reporter: dcamp, Assigned: dcamp)

Tracking

Trunk
Points:
---
Bug Flags:
blocking1.9 +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

11 years ago
Created attachment 312353 [details] [diff] [review]
v1

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+

Updated

11 years ago
Whiteboard: [needs landing]
(Assignee)

Comment 3

11 years ago
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
Last Resolved: 11 years ago
Resolution: --- → FIXED
(Assignee)

Comment 4

11 years ago
Created attachment 314510 [details] [diff] [review]
patch as committed

I added an if (mCacheEntry) around that bit.
Attachment #312353 - Attachment is obsolete: true
(Assignee)

Updated

11 years ago
Whiteboard: [needs landing]
Blocks: 415983
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.