зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1111581 - Fix prefetch for e10s. r=mayhemer
This commit is contained in:
Родитель
8d0fc0855c
Коммит
96651496de
|
@ -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<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;
|
||||
|
@ -262,17 +262,8 @@ nsPrefetchNode::OnStartRequest(nsIRequest *aRequest,
|
|||
// 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"));
|
||||
|
|
Загрузка…
Ссылка в новой задаче