Bug 1353082 - don't prefetch is there's a query string r=mcmanus
authorNicholas Hurley <hurley@mozilla.com>
Mon, 27 Mar 2017 14:56:05 -0700
changeset 401647 63005e2a60863c2fa9f3fe8d31656edca3d1296d
parent 401646 9687165d5721ed8b80c767056c90575857b72d6b
child 401648 b68c5d48eebb6bddc7513b71bda2cf976145c526
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1353082
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1353082 - don't prefetch is there's a query string r=mcmanus
netwerk/base/Predictor.cpp
--- a/netwerk/base/Predictor.cpp
+++ b/netwerk/base/Predictor.cpp
@@ -2636,32 +2636,38 @@ Predictor::CacheabilityAction::OnCacheEn
     PREDICTOR_LOG(("    VisitMetaData returned %" PRIx32, static_cast<uint32_t>(rv)));
     return NS_OK;
   }
 
   nsTArray<nsCString> keysToCheck, valuesToCheck;
   keysToCheck.SwapElements(mKeysToCheck);
   valuesToCheck.SwapElements(mValuesToCheck);
 
+  bool hasQueryString = false;
+  nsAutoCString query;
+  if (NS_SUCCEEDED(mTargetURI->GetQuery(query)) && !query.IsEmpty()) {
+    hasQueryString = true;
+  }
+
   MOZ_ASSERT(keysToCheck.Length() == valuesToCheck.Length());
   for (size_t i = 0; i < keysToCheck.Length(); ++i) {
     const char *key = keysToCheck[i].BeginReading();
     const char *value = valuesToCheck[i].BeginReading();
     nsCOMPtr<nsIURI> uri;
     uint32_t hitCount, lastHit, flags;
 
     if (!mPredictor->ParseMetaDataEntry(key, value, getter_AddRefs(uri),
                                         hitCount, lastHit, flags)) {
       PREDICTOR_LOG(("    failed to parse key=%s value=%s", key, value));
       continue;
     }
 
     bool eq = false;
     if (NS_SUCCEEDED(uri->Equals(mTargetURI, &eq)) && eq) {
-      if (mHttpStatus == 200 && mMethod.EqualsLiteral("GET")) {
+      if (mHttpStatus == 200 && mMethod.EqualsLiteral("GET") && !hasQueryString) {
         PREDICTOR_LOG(("    marking %s cacheable", key));
         flags |= FLAG_PREFETCHABLE;
       } else {
         PREDICTOR_LOG(("    marking %s uncacheable", key));
         flags &= ~FLAG_PREFETCHABLE;
       }
       nsCString newValue;
       MakeMetadataEntry(hitCount, lastHit, flags, newValue);