Bug 1020419 - Extend nsHttpChannel to skip validation for IsForcedValid. r=michal
authorJeremy Poulin <jpoulin@cs.uml.edu>
Fri, 18 Jul 2014 11:52:30 -0700
changeset 219590 27a066378f6954b688c4c56ee75e43d6b24a86b4
parent 219589 90c9b3d8f5bfa3a2d33eb8ea6b13bd3d32401249
child 219591 24266caa6b44765f2b7be5b1a48dc63a35917d5f
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal
bugs1020419
milestone34.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 1020419 - Extend nsHttpChannel to skip validation for IsForcedValid. r=michal
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2802,22 +2802,31 @@ nsHttpChannel::OnCacheEntryCheck(nsICach
 
     bool usingSSL = false;
     rv = mURI->SchemeIs("https", &usingSSL);
     NS_ENSURE_SUCCESS(rv,rv);
 
     bool doValidation = false;
     bool canAddImsHeader = true;
 
+    bool isForcedValid = false;
+    entry->GetIsForcedValid(&isForcedValid);
+
     // Cached entry is not the entity we request (see bug #633743)
     if (ResponseWouldVary(entry)) {
         LOG(("Validating based on Vary headers returning TRUE\n"));
         canAddImsHeader = false;
         doValidation = true;
     }
+    // Check isForcedValid to see if it is possible to skip validation
+    // See netwerk/cache2/nsICacheEntry.idl for details
+    else if (isForcedValid) {
+        LOG(("NOT validating based on isForcedValid being true.\n"));
+        doValidation = false;
+    }
     // If the LOAD_FROM_CACHE flag is set, any cached data can simply be used
     else if (mLoadFlags & nsIRequest::LOAD_FROM_CACHE) {
         LOG(("NOT validating based on LOAD_FROM_CACHE load flag\n"));
         doValidation = false;
     }
     // If the VALIDATE_ALWAYS flag is set, any cached data won't be used until
     // it's revalidated with the server.
     else if (mLoadFlags & nsIRequest::VALIDATE_ALWAYS) {