Bug 1302843 - Don't UpdateCacheabilityInternal if not enabled/initialized. r?mayhemer
MozReview-Commit-ID: HzSu0TM14R2
--- a/netwerk/base/Predictor.cpp
+++ b/netwerk/base/Predictor.cpp
@@ -2402,16 +2402,32 @@ Predictor::UpdateCacheability(nsIURI *so
}
void
Predictor::UpdateCacheabilityInternal(nsIURI *sourceURI, nsIURI *targetURI,
uint32_t httpStatus,
const nsCString &method)
{
PREDICTOR_LOG(("Predictor::UpdateCacheability httpStatus=%u", httpStatus));
+
+ if (!mInitialized) {
+ PREDICTOR_LOG((" not initialized"));
+ return;
+ }
+
+ if (!mEnabled) {
+ PREDICTOR_LOG((" not enabled"));
+ return;
+ }
+
+ if (!mEnablePrefetch) {
+ PREDICTOR_LOG((" prefetch not enabled"));
+ return;
+ }
+
uint32_t openFlags = nsICacheStorage::OPEN_READONLY |
nsICacheStorage::OPEN_SECRETLY |
nsICacheStorage::CHECK_MULTITHREADED;
RefPtr<Predictor::CacheabilityAction> action =
new Predictor::CacheabilityAction(targetURI, httpStatus, method, this);
nsAutoCString uri;
targetURI->GetAsciiSpec(uri);
PREDICTOR_LOG((" uri=%s action=%p", uri.get(), action.get()));