mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 937601 - HTTP cache v2: onCacheEntryCheck not called for R/O callbacks, r=michal
This commit is contained in:
parent
22a8993159
commit
a88c0cbad6
@ -514,20 +514,23 @@ 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 (mState == EMPTY) {
|
|
||||||
// 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
|
|
||||||
// to prevent more then one
|
|
||||||
mState = WRITING;
|
|
||||||
LOG((" advancing to WRITING state"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aCallback.mCallback) {
|
if (!aCallback.mReadOnly) {
|
||||||
// We can be given no callback only in case of recreate, it is ok
|
if (mState == EMPTY) {
|
||||||
// to advance to WRITING state since the caller of recreate is expected
|
// Advance to writing state, we expect to invoke the callback and let
|
||||||
// to write this entry now.
|
// it fill content of this entry. Must set and check the state here
|
||||||
return true;
|
// to prevent more then one
|
||||||
|
mState = WRITING;
|
||||||
|
LOG((" advancing to WRITING state"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aCallback.mCallback) {
|
||||||
|
// We can be given no callback only in case of recreate, it is ok
|
||||||
|
// to advance to WRITING state since the caller of recreate is expected
|
||||||
|
// to write this entry now.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState == READY) {
|
if (mState == READY) {
|
||||||
|
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]
|
||||||
|
Loading…
Reference in New Issue
Block a user