Bug 1111581 - Fix prefetch for e10s. r=mayhemer
☠☠ backed out by 138f4bb6fbde ☠ ☠
authorDragana Damjanovic <dd.mozilla@gmail.com>
Wed, 25 Feb 2015 04:57:00 -0500
changeset 231090 af0e56fc81b3ae0ad9a3767b40af778dacde3fd9
parent 231089 d7d9bbfa72c5b58e01aff2ba7fc524e6203889e5
child 231091 b1f4b4120e21d33abf0ec5b6b57fa4c4ce9eb8fe
push id28344
push userryanvm@gmail.com
push dateFri, 27 Feb 2015 18:20:08 +0000
treeherdermozilla-central@9dd9d1e5b43c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1111581
milestone39.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 1111581 - Fix prefetch for e10s. r=mayhemer
uriloader/prefetch/nsPrefetchService.cpp
--- a/uriloader/prefetch/nsPrefetchService.cpp
+++ b/uriloader/prefetch/nsPrefetchService.cpp
@@ -4,17 +4,17 @@
 
 #include "nsPrefetchService.h"
 #include "nsICacheEntry.h"
 #include "nsIServiceManager.h"
 #include "nsICategoryManager.h"
 #include "nsIObserverService.h"
 #include "nsIWebProgress.h"
 #include "nsCURILoader.h"
-#include "nsICachingChannel.h"
+#include "nsICacheInfoChannel.h"
 #include "nsIHttpChannel.h"
 #include "nsIURL.h"
 #include "nsISimpleEnumerator.h"
 #include "nsNetUtil.h"
 #include "nsString.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
 #include "nsStreamUtils.h"
@@ -241,43 +241,34 @@ NS_IMPL_ISUPPORTS(nsPrefetchNode,
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsPrefetchNode::OnStartRequest(nsIRequest *aRequest,
                                nsISupports *aContext)
 {
     nsresult rv;
 
-    nsCOMPtr<nsICachingChannel> cachingChannel =
+    nsCOMPtr<nsICacheInfoChannel> cacheInfoChannel =
         do_QueryInterface(aRequest, &rv);
     if (NS_FAILED(rv)) return rv;
-
+ 
     // no need to prefetch a document that is already in the cache
     bool fromCache;
-    if (NS_SUCCEEDED(cachingChannel->IsFromCache(&fromCache)) &&
+    if (NS_SUCCEEDED(cacheInfoChannel->IsFromCache(&fromCache)) &&
         fromCache) {
         LOG(("document is already in the cache; canceling prefetch\n"));
         return NS_BINDING_ABORTED;
     }
 
     //
     // no need to prefetch a document that must be requested fresh each
     // and every time.
     //
-    nsCOMPtr<nsISupports> cacheToken;
-    cachingChannel->GetCacheToken(getter_AddRefs(cacheToken));
-    if (!cacheToken)
-        return NS_ERROR_ABORT; // bail, no cache entry
-
-    nsCOMPtr<nsICacheEntry> entryInfo =
-        do_QueryInterface(cacheToken, &rv);
-    if (NS_FAILED(rv)) return rv;
-
     uint32_t expTime;
-    if (NS_SUCCEEDED(entryInfo->GetExpirationTime(&expTime))) {
+    if (NS_SUCCEEDED(cacheInfoChannel->GetCacheTokenExpirationTime(&expTime))) {
         if (NowInSeconds() >= expTime) {
             LOG(("document cannot be reused from cache; "
                  "canceling prefetch\n"));
             return NS_BINDING_ABORTED;
         }
     }
 
     return NS_OK;