From 96651496def365146ec61cfa93cdcec283d7d4bf Mon Sep 17 00:00:00 2001 From: Dragana Damjanovic Date: Wed, 25 Feb 2015 04:57:00 -0500 Subject: [PATCH] Bug 1111581 - Fix prefetch for e10s. r=mayhemer --- uriloader/prefetch/nsPrefetchService.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index 71d04d8dbcf1..43b6859cd3fc 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -9,7 +9,7 @@ #include "nsIObserverService.h" #include "nsIWebProgress.h" #include "nsCURILoader.h" -#include "nsICachingChannel.h" +#include "nsICacheInfoChannel.h" #include "nsIHttpChannel.h" #include "nsIURL.h" #include "nsISimpleEnumerator.h" @@ -246,13 +246,13 @@ nsPrefetchNode::OnStartRequest(nsIRequest *aRequest, { nsresult rv; - nsCOMPtr cachingChannel = + nsCOMPtr 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; @@ -262,17 +262,8 @@ nsPrefetchNode::OnStartRequest(nsIRequest *aRequest, // no need to prefetch a document that must be requested fresh each // and every time. // - nsCOMPtr cacheToken; - cachingChannel->GetCacheToken(getter_AddRefs(cacheToken)); - if (!cacheToken) - return NS_ERROR_ABORT; // bail, no cache entry - - nsCOMPtr 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"));