bool ApplicationCacheHost::maybeLoadFallbackForRedirect(ResourceLoader* resourceLoader, ResourceRequest& request, const ResourceResponse& redirectResponse) { if (!redirectResponse.isNull() && !protocolHostAndPortAreEqual(request.url(), redirectResponse.url())) if (scheduleLoadFallbackResourceFromApplicationCache(resourceLoader)) return true; return false; }
bool ApplicationCacheHost::maybeLoadFallbackForResponse(ResourceLoader* resourceLoader, const ResourceResponse& response) { if (response.httpStatusCode() / 100 == 4 || response.httpStatusCode() / 100 == 5) if (scheduleLoadFallbackResourceFromApplicationCache(resourceLoader)) return true; return false; }
bool ApplicationCacheHost::maybeLoadFallbackForError(ResourceLoader* resourceLoader, const ResourceError& error) { if (!error.isCancellation()) if (scheduleLoadFallbackResourceFromApplicationCache(resourceLoader)) return true; return false; }
bool ApplicationCacheHost::maybeLoadFallbackForError(ResourceLoader* resourceLoader, const ResourceError& error) { if (!error.isCancellation()) { if (resourceLoader == m_documentLoader->mainResourceLoader()) return maybeLoadFallbackForMainError(resourceLoader->request(), error); if (scheduleLoadFallbackResourceFromApplicationCache(resourceLoader)) return true; } return false; }
void ResourceLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (response.httpStatusCode() / 100 == 4 || response.httpStatusCode() / 100 == 5) { if (scheduleLoadFallbackResourceFromApplicationCache()) return; } #endif didReceiveResponse(response); }
void ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& request, const ResourceResponse& redirectResponse) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (!redirectResponse.isNull() && !protocolHostAndPortAreEqual(request.url(), redirectResponse.url())) { if (scheduleLoadFallbackResourceFromApplicationCache()) return; } #endif willSendRequest(request, redirectResponse); }
bool ApplicationCacheHost::maybeLoadFallbackForMainError(const ResourceRequest& request, const ResourceError& error) { if (!error.isCancellation()) { ASSERT(!m_mainResourceApplicationCache); if (isApplicationCacheEnabled() && !isApplicationCacheBlockedForRequest(request)) { m_mainResourceApplicationCache = ApplicationCacheGroup::fallbackCacheForMainRequest(request, m_documentLoader); if (scheduleLoadFallbackResourceFromApplicationCache(documentLoader()->mainResourceLoader(), m_mainResourceApplicationCache.get())) return true; } } return false; }
bool ApplicationCacheHost::maybeLoadFallbackForMainResponse(const ResourceRequest& request, const ResourceResponse& r) { if (r.httpStatusCode() / 100 == 4 || r.httpStatusCode() / 100 == 5) { ASSERT(!m_mainResourceApplicationCache); if (isApplicationCacheEnabled() && !isApplicationCacheBlockedForRequest(request)) { m_mainResourceApplicationCache = ApplicationCacheGroup::fallbackCacheForMainRequest(request, documentLoader()); if (scheduleLoadFallbackResourceFromApplicationCache(documentLoader()->mainResourceLoader(), m_mainResourceApplicationCache.get())) return true; } } return false; }
void MainResourceLoader::didReceiveResponse(const ResourceResponse& r) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (r.httpStatusCode() / 100 == 4 || r.httpStatusCode() / 100 == 5) { ASSERT(!m_applicationCache); if (m_frame->settings() && m_frame->settings()->offlineWebApplicationCacheEnabled()) { m_applicationCache = ApplicationCacheGroup::fallbackCacheForMainRequest(request(), documentLoader()); if (scheduleLoadFallbackResourceFromApplicationCache(m_applicationCache.get())) return; } } #endif HTTPHeaderMap::const_iterator it = r.httpHeaderFields().find(AtomicString("x-frame-options")); if (it != r.httpHeaderFields().end()) { String content = it->second; if (m_frame->loader()->shouldInterruptLoadForXFrameOptions(content, r.url())) { cancel(); return; } } // There is a bug in CFNetwork where callbacks can be dispatched even when loads are deferred. // See <rdar://problem/6304600> for more details. #if !PLATFORM(CF) ASSERT(shouldLoadAsEmptyDocument(r.url()) || !defersLoading()); #endif if (m_loadingMultipartContent) { frameLoader()->setupForReplaceByMIMEType(r.mimeType()); clearResourceData(); } if (r.isMultipart()) m_loadingMultipartContent = true; // The additional processing can do anything including possibly removing the last // reference to this object; one example of this is 3266216. RefPtr<MainResourceLoader> protect(this); m_documentLoader->setResponse(r); m_response = r; ASSERT(!m_waitingForContentPolicy); m_waitingForContentPolicy = true; ref(); // balanced by deref in continueAfterContentPolicy and didCancel frameLoader()->checkContentPolicy(m_response.mimeType(), callContinueAfterContentPolicy, this); }
void MainResourceLoader::didFail(const ResourceError& error) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) if (!error.isCancellation()) { ASSERT(!m_applicationCache); if (m_frame->settings() && m_frame->settings()->offlineWebApplicationCacheEnabled()) { m_applicationCache = ApplicationCacheGroup::fallbackCacheForMainRequest(request(), documentLoader()); if (scheduleLoadFallbackResourceFromApplicationCache(m_applicationCache.get())) return; } } #endif // There is a bug in CFNetwork where callbacks can be dispatched even when loads are deferred. // See <rdar://problem/6304600> for more details. #if !PLATFORM(CF) ASSERT(!defersLoading()); #endif receivedError(error); }