Skip to content
Permalink
Browse files
2010-01-22 Maciej Stachowiak <mjs@apple.com>
        Reviewed by Adam Roben.

        Use stale cache data when going back and forward but not using WebCore’s page cache
        https://bugs.webkit.org/show_bug.cgi?id=33993
        <rdar://problem/7383392>

        No tests since this is a performance change.

        * loader/CachePolicy.h:
        (WebCore::): Add CachePolicyAllowStale.
        * loader/DocLoader.cpp:
        (WebCore::DocLoader::checkForReload): Never reload in the case of
        CachePolicyAllowStale.
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::subresourceCachePolicy): Return CachePolicyAllowStale
        if the main resource is being loaded to allow stale data.
        (WebCore::FrameLoader::addExtraFieldsToRequest): Use ReturnCacheDataElseLoad
        on back/forward loads - needed when going back of forward to a page with frames.


Canonical link: https://commits.webkit.org/45136@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@53737 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
othermaciej committed Jan 23, 2010
1 parent a70921a commit 6b3a13ddc694dda1aef8d1228d4c2b9b9f637a8a
Showing 4 changed files with 30 additions and 4 deletions.
@@ -1,3 +1,24 @@
2010-01-22 Maciej Stachowiak <mjs@apple.com>

Reviewed by Adam Roben.

Use stale cache data when going back and forward but not using WebCore’s page cache
https://bugs.webkit.org/show_bug.cgi?id=33993
<rdar://problem/7383392>

No tests since this is a performance change.

* loader/CachePolicy.h:
(WebCore::): Add CachePolicyAllowStale.
* loader/DocLoader.cpp:
(WebCore::DocLoader::checkForReload): Never reload in the case of
CachePolicyAllowStale.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::subresourceCachePolicy): Return CachePolicyAllowStale
if the main resource is being loaded to allow stale data.
(WebCore::FrameLoader::addExtraFieldsToRequest): Use ReturnCacheDataElseLoad
on back/forward loads - needed when going back of forward to a page with frames.

2010-01-22 Kelly Norton <knorton@google.com>

Reviewed by Pavel Feldman.
@@ -32,7 +32,8 @@ namespace WebCore {
CachePolicyCache,
CachePolicyVerify,
CachePolicyRevalidate,
CachePolicyReload
CachePolicyReload,
CachePolicyAllowStale
};

}
@@ -111,8 +111,8 @@ void DocLoader::checkForReload(const KURL& fullURL)
case CachePolicyRevalidate:
cache()->revalidateResource(existing, this);
break;
default:
ASSERT_NOT_REACHED();
case CachePolicyAllowStale:
return;
}

m_reloadedURLs.add(fullURL.string());
@@ -2902,6 +2902,9 @@ CachePolicy FrameLoader::subresourceCachePolicy() const
if (m_loadType == FrameLoadTypeReload)
return CachePolicyRevalidate;

if (request.cachePolicy() == ReturnCacheDataElseLoad)
return CachePolicyAllowStale;

return CachePolicyVerify;
}

@@ -3219,7 +3222,8 @@ void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadTyp
request.setCachePolicy(ReloadIgnoringCacheData);
request.setHTTPHeaderField("Cache-Control", "no-cache");
request.setHTTPHeaderField("Pragma", "no-cache");
}
} else if (isBackForwardLoadType(loadType) && !request.url().protocolIs("https"))
request.setCachePolicy(ReturnCacheDataElseLoad);

if (mainResource)
request.setHTTPAccept(defaultAcceptHeader);

0 comments on commit 6b3a13d

Please sign in to comment.