+ Handle the case of inability to write into cache correctly.
+ Be more aggressive about clearing the UPDATE_IN_PROGRESS flag on the cache entry git-svn-id: svn://10.0.0.236/trunk@55699 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
14
mozilla/netwerk/cache/mgr/nsCachedNetData.cpp
vendored
14
mozilla/netwerk/cache/mgr/nsCachedNetData.cpp
vendored
@@ -1064,6 +1064,9 @@ public:
|
||||
nsresult Init(PRUint32 aStartingOffset) {
|
||||
nsresult rv;
|
||||
|
||||
// Just in case the protocol handler forgot to set this flag...
|
||||
mCacheEntry->SetFlag(nsCachedNetData::UPDATE_IN_PROGRESS);
|
||||
|
||||
rv = mCacheEntry->NewChannel(0, 0, getter_AddRefs(mChannel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
@@ -1083,7 +1086,7 @@ public:
|
||||
else
|
||||
mCacheEntry->ClearFlag(nsCachedNetData::TRUNCATED_CONTENT);
|
||||
mCacheEntry->ClearFlag(nsCachedNetData::VESTIGIAL);
|
||||
|
||||
mCacheEntry->ClearFlag(nsCachedNetData::UPDATE_IN_PROGRESS);
|
||||
return mOriginalListener->OnStopRequest(channel, ctxt, status, errorMsg);
|
||||
}
|
||||
|
||||
@@ -1109,7 +1112,11 @@ public:
|
||||
rv = mOriginalStream->Read(buf, count, aActualBytes);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
write(buf, *aActualBytes);
|
||||
rv = write(buf, *aActualBytes);
|
||||
|
||||
// If the cache fills up, mark entry as partial content
|
||||
if (NS_FAILED(rv))
|
||||
mCacheEntry->SetFlag(nsCachedNetData::TRUNCATED_CONTENT);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1146,9 +1153,6 @@ nsCachedNetData::InterceptAsyncRead(nsIStreamListener *aOriginalListener,
|
||||
rv = interceptListener->Init(aStartingOffset);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Just in case the protocol handler forgot to set this flag...
|
||||
SetFlag(UPDATE_IN_PROGRESS);
|
||||
|
||||
NS_ADDREF(interceptListener);
|
||||
*aResult = interceptListener;
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user