| Index: loader/FrameLoader.cpp
|
| ===================================================================
|
| --- loader/FrameLoader.cpp (revision 44202)
|
| +++ loader/FrameLoader.cpp (working copy)
|
| @@ -98,6 +98,10 @@
|
| #include "ApplicationCacheResource.h"
|
| #endif
|
|
|
| +#if ENABLE(APPLICATION_CACHE)
|
| +#include "ApplicationCacheFrontend.h"
|
| +#endif
|
| +
|
| #if ENABLE(SVG)
|
| #include "SVGDocument.h"
|
| #include "SVGLocatable.h"
|
| @@ -302,6 +306,9 @@
|
| #if ENABLE(WML)
|
| , m_forceReloadWmlDeck(false)
|
| #endif
|
| +#if ENABLE(APPLICATION_CACHE)
|
| + , m_appcacheFrontend(new ApplicationCacheFrontend())
|
| +#endif
|
| {
|
| }
|
|
|
| @@ -331,6 +338,10 @@
|
| m_frame->document()->cancelParsing();
|
| m_creatingInitialEmptyDocument = false;
|
| m_didCallImplicitClose = true;
|
| +
|
| +#if ENABLE(APPLICATION_CACHE)
|
| + appcacheFrontend()->initializeForFrame(m_frame);
|
| +#endif
|
| }
|
|
|
| void FrameLoader::setDefersLoading(bool defers)
|
| @@ -1844,6 +1855,11 @@
|
| && !m_documentLoader->applicationCache()
|
| && !m_documentLoader->candidateApplicationCacheGroup()
|
| #endif
|
| +#if ENABLE(APPLICATION_CACHE)
|
| + // FIXME: We should investigating caching frames that have an associated
|
| + // application cache. <rdar://problem/5917899> tracks that work.
|
| + && appcacheFrontend()->canCacheCurrentDocumentInPageCache()
|
| +#endif
|
| && m_client->canCachePage()
|
| ;
|
| }
|
| @@ -1994,6 +2010,10 @@
|
| if (m_documentLoader->candidateApplicationCacheGroup())
|
| { PCLOG(" -The DocumentLoader has a candidateApplicationCacheGroup"); cannotCache = true; }
|
| #endif
|
| +#if ENABLE(APPLICATION_CACHE)
|
| + if (!appcacheFrontend()->canCacheCurrentDocumentInPageCache())
|
| + { PCLOG(" -Using application cache"); cannotCache = true; }
|
| +#endif
|
| if (!m_client->canCachePage())
|
| { PCLOG(" -The client says this frame cannot be cached"); cannotCache = true; }
|
| } while (false);
|
| @@ -2888,6 +2908,9 @@
|
|
|
| setDocumentLoader(m_provisionalDocumentLoader.get());
|
| setProvisionalDocumentLoader(0);
|
| +#if ENABLE(APPLICATION_CACHE)
|
| + selectInitialApplicationCache();
|
| +#endif
|
| setState(FrameStateCommittedPage);
|
|
|
| // Handle adding the URL to the back/forward list.
|
| @@ -3573,6 +3596,10 @@
|
| else if (Document* document = m_frame->document())
|
| request.setFirstPartyForCookies(document->firstPartyForCookies());
|
| }
|
| +
|
| +#if ENABLE(APPLICATION_CACHE)
|
| + appcacheFrontend()->addExtraFieldsToRequest(request, mainResource);
|
| +#endif
|
|
|
| // The remaining modifications are only necessary for HTTP and HTTPS.
|
| if (!request.url().isEmpty() && !request.url().protocolInHTTPFamily())
|
| @@ -5281,4 +5308,45 @@
|
| return true;
|
| }
|
|
|
| +#if ENABLE(APPLICATION_CACHE)
|
| +
|
| +ApplicationCacheFrontend* FrameLoader::appcacheFrontend() const
|
| +{
|
| + return m_appcacheFrontend.get();
|
| +}
|
| +
|
| +void FrameLoader::selectInitialApplicationCache()
|
| +{
|
| + const KURL& docURL = m_frame->document()->url();
|
| + const ResourceResponse& docResponse = documentLoader()->response();
|
| + appcacheFrontend()->selectInitialCache(docURL,
|
| + docResponse.applicationCacheID());
|
| +}
|
| +
|
| +void FrameLoader::selectApplicationCacheWithoutManifest()
|
| +{
|
| + const KURL& docURL = m_frame->document()->url();
|
| + const ResourceResponse& docResponse = documentLoader()->response();
|
| + appcacheFrontend()->selectCacheWithoutManifest(
|
| + docURL,
|
| + docResponse.applicationCacheID());
|
| +}
|
| +
|
| +void FrameLoader::selectApplicationCacheWithManifest(const KURL& manifestURL)
|
| +{
|
| + const KURL& docURL = m_frame->document()->url();
|
| + const ResourceResponse& docResponse = documentLoader()->response();
|
| + if (!appcacheFrontend()->selectCacheWithManifest(
|
| + docURL,
|
| + docResponse.applicationCacheID(),
|
| + docResponse.manifestURL(),
|
| + manifestURL)) {
|
| + // It's a foreign entry, restart the current navigation from the top of the navigation algorithm.
|
| + // The navigation will not result in the same resource being loaded, because "foreign" entries are
|
| + // never picked during navigation.
|
| + scheduleLocationChange(docURL, referrer(), true);
|
| + }
|
| +}
|
| +#endif
|
| +
|
| } // namespace WebCore
|
|
|