Bug 937601 - HTTP cache v2: onCacheEntryCheck not called for R/O callbacks, r=michal
This commit is contained in:
@@ -514,7 +514,9 @@ bool CacheEntry::InvokeCallback(Callback & aCallback)
|
|||||||
// mRecheckAfterWrite flag already set means the callback has already passed
|
// mRecheckAfterWrite flag already set means the callback has already passed
|
||||||
// the onCacheEntryCheck call. Until the current write is not finished this
|
// the onCacheEntryCheck call. Until the current write is not finished this
|
||||||
// callback will be bypassed.
|
// callback will be bypassed.
|
||||||
if (!aCallback.mReadOnly && !aCallback.mRecheckAfterWrite) {
|
if (!aCallback.mRecheckAfterWrite) {
|
||||||
|
|
||||||
|
if (!aCallback.mReadOnly) {
|
||||||
if (mState == EMPTY) {
|
if (mState == EMPTY) {
|
||||||
// Advance to writing state, we expect to invoke the callback and let
|
// Advance to writing state, we expect to invoke the callback and let
|
||||||
// it fill content of this entry. Must set and check the state here
|
// it fill content of this entry. Must set and check the state here
|
||||||
@@ -529,6 +531,7 @@ bool CacheEntry::InvokeCallback(Callback & aCallback)
|
|||||||
// to write this entry now.
|
// to write this entry now.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mState == READY) {
|
if (mState == READY) {
|
||||||
// Metadata present, validate the entry
|
// Metadata present, validate the entry
|
||||||
|
|||||||
28
netwerk/test/unit/test_cache2-01a-basic-readonly.js
Normal file
28
netwerk/test/unit/test_cache2-01a-basic-readonly.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
function run_test()
|
||||||
|
{
|
||||||
|
do_get_profile();
|
||||||
|
|
||||||
|
// Open for write, write
|
||||||
|
asyncOpenCacheEntry("http://ro/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
||||||
|
new OpenCallback(NEW, "a1m", "a1d", function(entry) {
|
||||||
|
// Open for read and check
|
||||||
|
asyncOpenCacheEntry("http://ro/", "disk", Ci.nsICacheStorage.OPEN_READONLY, null,
|
||||||
|
new OpenCallback(NORMAL, "a1m", "a1d", function(entry) {
|
||||||
|
// Open for rewrite (truncate), write different meta and data
|
||||||
|
asyncOpenCacheEntry("http://ro/", "disk", Ci.nsICacheStorage.OPEN_TRUNCATE, null,
|
||||||
|
new OpenCallback(NEW, "a2m", "a2d", function(entry) {
|
||||||
|
// Open for read and check
|
||||||
|
asyncOpenCacheEntry("http://ro/", "disk", Ci.nsICacheStorage.OPEN_READONLY, null,
|
||||||
|
new OpenCallback(NORMAL, "a2m", "a2d", function(entry) {
|
||||||
|
finish_cache2_test();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
do_test_pending();
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ support-files =
|
|||||||
test_link.url
|
test_link.url
|
||||||
|
|
||||||
[test_cache2-01-basic.js]
|
[test_cache2-01-basic.js]
|
||||||
|
[test_cache2-01a-basic-readonly.js]
|
||||||
[test_cache2-01b-basic-datasize.js]
|
[test_cache2-01b-basic-datasize.js]
|
||||||
[test_cache2-01c-basic-hasmeta-only.js]
|
[test_cache2-01c-basic-hasmeta-only.js]
|
||||||
[test_cache2-01d-basic-not-wanted.js]
|
[test_cache2-01d-basic-not-wanted.js]
|
||||||
|
|||||||
Reference in New Issue
Block a user