Make about:cache do something sane when cache is disabled. Bug 207709, patch

by Alfred Kayser <alfredkayser@nl.ibm.com>, r+sr=darin
This commit is contained in:
bzbarsky%mit.edu 2005-09-29 00:53:53 +00:00
parent 99bbb4116a
commit 339344c671

View File

@ -130,13 +130,16 @@ nsAboutCache::NewChannel(nsIURI *aURI, nsIChannel **result)
mStream = outputStream;
rv = cacheService->VisitEntries(this);
if (NS_FAILED(rv)) return rv;
mBuffer.Truncate();
if (rv == NS_ERROR_NOT_AVAILABLE) {
mBuffer.AppendLiteral("<h2>The cache is disabled.</h2>\n");
}
else if (NS_FAILED(rv)) {
return rv;
}
if (!mDeviceID.IsEmpty()) {
mBuffer.AssignLiteral("</pre>\n");
}
else {
mBuffer.Truncate();
mBuffer.AppendLiteral("</pre>\n");
}
mBuffer.AppendLiteral("</div>\n</body>\n</html>\n");
outputStream->Write(mBuffer.get(), mBuffer.Length(), &bytesWritten);