Bug 1111581 - Fix prefetch for e10s. r=mayhemer
authorDragana Damjanovic <dd.mozilla@gmail.com>
Fri, 27 Feb 2015 09:41:21 -0500
changeset 231132 27f56cce61829ff560b7f4eac1791ba231d4958f
parent 231131 81233d5e13943ba99c1af751c99c30c03914d7e1
child 231133 069853eac6ccf1b771bddec4f6e3c389686b08cf
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 CLOSED TREE
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;