diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 19:21:49 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 19:21:49 +0000 |
commit | fd2fa3fe2b81d0125c20a6d6f352386bac4a8e23 (patch) | |
tree | 52bfc2fa1ab2389fbded937f8e5361ec51d87095 | |
parent | 5dd6904cd76766fe227f5c8b92d5743706f87ff9 (diff) | |
download | chromium_src-fd2fa3fe2b81d0125c20a6d6f352386bac4a8e23.zip chromium_src-fd2fa3fe2b81d0125c20a6d6f352386bac4a8e23.tar.gz chromium_src-fd2fa3fe2b81d0125c20a6d6f352386bac4a8e23.tar.bz2 |
* Add appCacheManifestUrl data member to WebURLResponse, and use it to detect 'foreign' entries.
* Complete the 'contextID' to 'hostID' renaming since that terminology is now used in webcore ResourceRequest.
This patch depends on a corresponding webkit change in the chromium port.https://bugs.webkit.org/show_bug.cgi?id=28960
Review URL: http://codereview.chromium.org/201026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25646 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/api/public/WebURLRequest.h | 6 | ||||
-rw-r--r-- | webkit/api/public/WebURLResponse.h | 3 | ||||
-rw-r--r-- | webkit/api/src/WebURLRequest.cpp | 8 | ||||
-rw-r--r-- | webkit/api/src/WebURLResponse.cpp | 12 | ||||
-rw-r--r-- | webkit/appcache/web_application_cache_host_impl.cc | 23 | ||||
-rw-r--r-- | webkit/glue/weburlloader_impl.cc | 5 |
6 files changed, 38 insertions, 19 deletions
diff --git a/webkit/api/public/WebURLRequest.h b/webkit/api/public/WebURLRequest.h index 0cdd71b..5e312d1 100644 --- a/webkit/api/public/WebURLRequest.h +++ b/webkit/api/public/WebURLRequest.h @@ -129,9 +129,9 @@ namespace WebKit { WEBKIT_API int requestorProcessID() const; WEBKIT_API void setRequestorProcessID(int); - // Allows the request to be matched up with its app cache context. - WEBKIT_API int appCacheContextID() const; - WEBKIT_API void setAppCacheContextID(int id); + // Allows the request to be matched up with its app cache host. + WEBKIT_API int appCacheHostID() const; + WEBKIT_API void setAppCacheHostID(int id); #if defined(WEBKIT_IMPLEMENTATION) WebCore::ResourceRequest& toMutableResourceRequest(); diff --git a/webkit/api/public/WebURLResponse.h b/webkit/api/public/WebURLResponse.h index cb17d65..1674f21 100644 --- a/webkit/api/public/WebURLResponse.h +++ b/webkit/api/public/WebURLResponse.h @@ -100,6 +100,9 @@ namespace WebKit { WEBKIT_API long long appCacheID() const; WEBKIT_API void setAppCacheID(long long); + WEBKIT_API WebURL appCacheManifestURL() const; + WEBKIT_API void setAppCacheManifestURL(const WebURL&); + // A consumer controlled value intended to be used to record opaque // security info related to this request. WEBKIT_API WebCString securityInfo() const; diff --git a/webkit/api/src/WebURLRequest.cpp b/webkit/api/src/WebURLRequest.cpp index 57d2ae0..a688f98 100644 --- a/webkit/api/src/WebURLRequest.cpp +++ b/webkit/api/src/WebURLRequest.cpp @@ -225,14 +225,14 @@ void WebURLRequest::setRequestorProcessID(int requestorProcessID) m_private->m_resourceRequest->setRequestorProcessID(requestorProcessID); } -int WebURLRequest::appCacheContextID() const +int WebURLRequest::appCacheHostID() const { - return m_private->m_resourceRequest->appCacheContextID(); + return m_private->m_resourceRequest->appCacheHostID(); } -void WebURLRequest::setAppCacheContextID(int appCacheContextID) +void WebURLRequest::setAppCacheHostID(int appCacheHostID) { - m_private->m_resourceRequest->setAppCacheContextID(appCacheContextID); + m_private->m_resourceRequest->setAppCacheHostID(appCacheHostID); } ResourceRequest& WebURLRequest::toMutableResourceRequest() diff --git a/webkit/api/src/WebURLResponse.cpp b/webkit/api/src/WebURLResponse.cpp index e96a3f0..105689c 100644 --- a/webkit/api/src/WebURLResponse.cpp +++ b/webkit/api/src/WebURLResponse.cpp @@ -210,7 +210,7 @@ void WebURLResponse::setIsContentFiltered(bool isContentFiltered) long long WebURLResponse::appCacheID() const { - return m_private->m_resourceResponse->getAppCacheID(); + return m_private->m_resourceResponse->appCacheID(); } void WebURLResponse::setAppCacheID(long long appCacheID) @@ -218,6 +218,16 @@ void WebURLResponse::setAppCacheID(long long appCacheID) m_private->m_resourceResponse->setAppCacheID(appCacheID); } +WebURL WebURLResponse::appCacheManifestURL() const +{ + return m_private->m_resourceResponse->appCacheManifestURL(); +} + +void WebURLResponse::setAppCacheManifestURL(const WebURL& url) +{ + m_private->m_resourceResponse->setAppCacheManifestURL(url); +} + WebCString WebURLResponse::securityInfo() const { // FIXME: getSecurityInfo is misnamed. diff --git a/webkit/appcache/web_application_cache_host_impl.cc b/webkit/appcache/web_application_cache_host_impl.cc index d5d50fb..379a80d 100644 --- a/webkit/appcache/web_application_cache_host_impl.cc +++ b/webkit/appcache/web_application_cache_host_impl.cc @@ -63,12 +63,12 @@ void WebApplicationCacheHostImpl::OnEventRaised(appcache::EventID event_id) { void WebApplicationCacheHostImpl::willStartMainResourceRequest( WebURLRequest& request) { - request.setAppCacheContextID(host_id_); + request.setAppCacheHostID(host_id_); } void WebApplicationCacheHostImpl::willStartSubResourceRequest( WebURLRequest& request) { - request.setAppCacheContextID(host_id_); + request.setAppCacheHostID(host_id_); } void WebApplicationCacheHostImpl::selectCacheWithoutManifest() { @@ -89,20 +89,23 @@ bool WebApplicationCacheHostImpl::selectCacheWithManifest( has_status_ = false; has_cached_status_ = false; + GURL manifest_gurl(manifest_url); + if (manifest_gurl.has_ref()) { + GURL::Replacements replacements; + replacements.ClearRef(); + manifest_gurl = manifest_gurl.ReplaceComponents(replacements); + } + // Check for new 'master' entries. if (main_response_.appCacheID() == kNoCacheId) { should_capture_main_response_ = is_in_http_family_ ? YES : NO; backend_->SelectCache(host_id_, main_response_url_, - kNoCacheId, manifest_url); + kNoCacheId, manifest_gurl); return true; } // Check for 'foreign' entries. - // TODO(michaeln): add manifestUrl() accessor to WebURLResponse, - // for now we don't really detect 'foreign' entries. - // TODO(michaeln): put an == operator on WebURL? - GURL manifest_gurl(manifest_url); - GURL main_response_manifest_gurl(manifest_url); // = mainResp.manifestUrl() + GURL main_response_manifest_gurl(main_response_.appCacheManifestURL()); if (main_response_manifest_gurl != manifest_gurl) { backend_->MarkAsForeignEntry(host_id_, main_response_url_, main_response_.appCacheID()); @@ -129,10 +132,14 @@ void WebApplicationCacheHostImpl::didReceiveResponseForMainResource( void WebApplicationCacheHostImpl::didReceiveDataForMainResource( const char* data, int len) { + if (should_capture_main_response_ == NO) + return; // TODO(michaeln): write me } void WebApplicationCacheHostImpl::didFinishLoadingMainResource(bool success) { + if (should_capture_main_response_ == NO) + return; // TODO(michaeln): write me } diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc index c76d738..b6d82c9 100644 --- a/webkit/glue/weburlloader_impl.cc +++ b/webkit/glue/weburlloader_impl.cc @@ -151,8 +151,7 @@ void PopulateURLResponse( response->setExpectedContentLength(info.content_length); response->setSecurityInfo(info.security_info); response->setAppCacheID(info.appcache_id); - // TODO(michaeln): - // response->setAppCacheManifestUrl(info.appcache_manifest_url); + response->setAppCacheManifestURL(info.appcache_manifest_url); const net::HttpResponseHeaders* headers = info.headers; if (!headers) @@ -338,7 +337,7 @@ void WebURLLoaderImpl::Context::Start( load_flags, requestor_pid, FromTargetType(request.targetType()), - request.appCacheContextID(), + request.appCacheHostID(), request.requestorID())); if (!request.httpBody().isNull()) { |