Bug 1289564 - Don't try to modify cacheability for non-http(s) resources. r?mayhemer draft
authorNicholas Hurley <hurley@todesschaf.org>
Tue, 26 Jul 2016 12:40:55 -0700
changeset 393027 ee6e16d443cd4ba457eeea1d309fce239bea19e1
parent 392950 ceb63dec9267e9bb62f5e5e1f4c9d32d3ac1fbac
child 526465 26630559152932c273e81e97f3219ac1107b046e
push id24184
push userbmo:hurley@todesschaf.org
push dateTue, 26 Jul 2016 19:41:35 +0000
reviewersmayhemer
bugs1289564
milestone50.0a1
Bug 1289564 - Don't try to modify cacheability for non-http(s) resources. r?mayhemer MozReview-Commit-ID: 1sfBrTlzsLo
netwerk/base/Predictor.cpp
--- a/netwerk/base/Predictor.cpp
+++ b/netwerk/base/Predictor.cpp
@@ -2427,16 +2427,26 @@ Predictor::UpdateCacheability(nsIURI *so
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (lci && lci->IsPrivate()) {
     PREDICTOR_LOG(("Predictor::UpdateCacheability in PB mode - ignoring"));
     return;
   }
 
+  if (!sourceURI || !targetURI) {
+    PREDICTOR_LOG(("Predictor::UpdateCacheability missing source or target uri"));
+    return;
+  }
+
+  if (!IsNullOrHttp(sourceURI) || !IsNullOrHttp(targetURI)) {
+    PREDICTOR_LOG(("Predictor::UpdateCacheability non-http(s) uri"));
+    return;
+  }
+
   RefPtr<Predictor> self = sSelf;
   if (self) {
     nsAutoCString method;
     requestHead.Method(method);
     self->UpdateCacheabilityInternal(sourceURI, targetURI, httpStatus,
                                      method);
   }
 }