summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_request_handler.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-03 02:29:14 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-03 02:29:14 +0000
commit6ed2a5a54b7bb8ccd33da7bc948fee169f128459 (patch)
tree3752c15899760eef346dc2c1f66768aa2f3e676a /webkit/appcache/appcache_request_handler.cc
parentd6bb669008e0308f3ee6e04e77fe903698864e7b (diff)
downloadchromium_src-6ed2a5a54b7bb8ccd33da7bc948fee169f128459.zip
chromium_src-6ed2a5a54b7bb8ccd33da7bc948fee169f128459.tar.gz
chromium_src-6ed2a5a54b7bb8ccd33da7bc948fee169f128459.tar.bz2
Fix for WKBug 47000: a failure mode given bad content (in an unlikely form). The error occurs when an html page is put in an appcache as a fallback resource (so it's listed in a fallback section), but it contains a manifest attribute that refers to a different manifest file. The system should mark the resource as foreign and exclude it from main resource loads, but it was failing to do so. The fix is to do that.
BUG=WK47000 TEST=http/tests/appcache/foreign-fallback.html Review URL: http://codereview.chromium.org/3529009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64868 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_request_handler.cc')
-rw-r--r--webkit/appcache/appcache_request_handler.cc25
1 files changed, 18 insertions, 7 deletions
diff --git a/webkit/appcache/appcache_request_handler.cc b/webkit/appcache/appcache_request_handler.cc
index f193139..8cbb805 100644
--- a/webkit/appcache/appcache_request_handler.cc
+++ b/webkit/appcache/appcache_request_handler.cc
@@ -101,7 +101,8 @@ AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect(
// get the resource of the fallback entry.
job_ = new AppCacheURLRequestJob(request, storage());
DeliverAppCachedResponse(
- found_fallback_entry_, found_cache_id_, found_manifest_url_, true);
+ found_fallback_entry_, found_cache_id_, found_manifest_url_,
+ true, found_fallback_url_);
} else if (!found_network_namespace_) {
// 6.9.6, step 6: Fail the resource load.
job_ = new AppCacheURLRequestJob(request, storage());
@@ -142,7 +143,8 @@ AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForResponse(
// or there were network errors, get the resource of the fallback entry.
job_ = new AppCacheURLRequestJob(request, storage());
DeliverAppCachedResponse(
- found_fallback_entry_, found_cache_id_, found_manifest_url_, true);
+ found_fallback_entry_, found_cache_id_, found_manifest_url_,
+ true, found_fallback_url_);
return job_;
}
@@ -160,9 +162,15 @@ void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) {
void AppCacheRequestHandler::DeliverAppCachedResponse(
const AppCacheEntry& entry, int64 cache_id, const GURL& manifest_url,
- bool is_fallback) {
- DCHECK(job_ && job_->is_waiting());
+ bool is_fallback, const GURL& fallback_url) {
+ DCHECK(host_ && job_ && job_->is_waiting());
DCHECK(entry.has_response_id());
+
+ if (ResourceType::IsFrame(resource_type_) && is_fallback) {
+ DCHECK(!fallback_url.is_empty());
+ host_->NotifyMainResourceFallback(fallback_url);
+ }
+
job_->DeliverAppCachedResponse(manifest_url, cache_id, entry, is_fallback);
}
@@ -189,7 +197,7 @@ void AppCacheRequestHandler::MaybeLoadMainResource(URLRequest* request) {
void AppCacheRequestHandler::OnMainResponseFound(
const GURL& url, const AppCacheEntry& entry,
- const AppCacheEntry& fallback_entry,
+ const GURL& fallback_url, const AppCacheEntry& fallback_entry,
int64 cache_id, const GURL& manifest_url,
bool was_blocked_by_policy) {
DCHECK(host_);
@@ -218,6 +226,7 @@ void AppCacheRequestHandler::OnMainResponseFound(
// 6.11.1 Navigating across documents, steps 10 and 14.
found_entry_ = entry;
+ found_fallback_url_ = fallback_url;
found_fallback_entry_ = fallback_entry;
found_cache_id_ = cache_id;
found_manifest_url_ = manifest_url;
@@ -225,7 +234,8 @@ void AppCacheRequestHandler::OnMainResponseFound(
if (found_entry_.has_response_id()) {
DeliverAppCachedResponse(
- found_entry_, found_cache_id_, found_manifest_url_, false);
+ found_entry_, found_cache_id_, found_manifest_url_,
+ false, GURL());
} else {
DeliverNetworkResponse();
}
@@ -275,7 +285,8 @@ void AppCacheRequestHandler::ContinueMaybeLoadSubResource() {
found_cache_id_ = cache->cache_id();
found_manifest_url_ = cache->owning_group()->manifest_url();
DeliverAppCachedResponse(
- found_entry_, found_cache_id_, found_manifest_url_, false);
+ found_entry_, found_cache_id_, found_manifest_url_,
+ false, GURL());
return;
}