diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-15 20:56:47 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-15 20:56:47 +0000 |
commit | ea2a7b919337fb796c8602f1701b60d8fa2d7f42 (patch) | |
tree | 61ab4cb64a4aa0c64e94a5280a7d7f4e35062855 /webkit/appcache/web_application_cache_host_impl.cc | |
parent | c468f9498bcb426edb87cb803a03a63e793e8222 (diff) | |
download | chromium_src-ea2a7b919337fb796c8602f1701b60d8fa2d7f42.zip chromium_src-ea2a7b919337fb796c8602f1701b60d8fa2d7f42.tar.gz chromium_src-ea2a7b919337fb796c8602f1701b60d8fa2d7f42.tar.bz2 |
Select a more appropiate appcache based on the opener or the parent or the target frame of the new document. The change determines a 'preferred manifest url' in these cases:
* <iframe> loading, we prefer the parent frame's manifest url
* window.open() loading, we prefer the opener frame's manifest url
* href clicking to navigate a frame in place, we prefer the manifest url of the document in the frame when the navigation starts
BUG=68479
Review URL: http://codereview.chromium.org/6727006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/web_application_cache_host_impl.cc')
-rw-r--r-- | webkit/appcache/web_application_cache_host_impl.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/webkit/appcache/web_application_cache_host_impl.cc b/webkit/appcache/web_application_cache_host_impl.cc index 981894d..4fbcc21 100644 --- a/webkit/appcache/web_application_cache_host_impl.cc +++ b/webkit/appcache/web_application_cache_host_impl.cc @@ -53,7 +53,7 @@ WebApplicationCacheHostImpl* WebApplicationCacheHostImpl::FromId(int id) { } WebApplicationCacheHostImpl* WebApplicationCacheHostImpl::FromFrame( - WebFrame* frame) { + const WebFrame* frame) { if (!frame) return NULL; WebDataSource* data_source = frame->dataSource(); @@ -166,10 +166,15 @@ void WebApplicationCacheHostImpl::willStartMainResourceRequest( DCHECK(method == StringToUpperASCII(method)); if (frame) { - if (WebApplicationCacheHostImpl* parent = FromFrame(frame->parent())) - backend_->SetSpawningHostId(host_id_, parent->host_id()); - else if (WebApplicationCacheHostImpl* opener = FromFrame(frame->opener())) - backend_->SetSpawningHostId(host_id_, opener->host_id()); + const WebFrame* spawning_frame = frame->parent(); + if (!spawning_frame) + spawning_frame = frame->opener(); + if (!spawning_frame) + spawning_frame = frame; + + WebApplicationCacheHostImpl* spawning_host = FromFrame(spawning_frame); + if (spawning_host && (spawning_host != this)) + backend_->SetSpawningHostId(host_id_, spawning_host->host_id()); } } |