summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-24 17:42:42 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-24 17:42:42 +0000
commit8a3422c9488ce79e305973d29a01811762e35465 (patch)
tree7fc94cb7aa013f7bb2afaf4100b1a8f45208cc00 /webkit
parent5eb64653873981c7dbf693a9aba7c7da011b14a3 (diff)
downloadchromium_src-8a3422c9488ce79e305973d29a01811762e35465.zip
chromium_src-8a3422c9488ce79e305973d29a01811762e35465.tar.gz
chromium_src-8a3422c9488ce79e305973d29a01811762e35465.tar.bz2
This CL adds new UI tests for the SSL UI.
Some more info: SSL UI Tests: Added new tests for redirects and frames. Also improved the mixed-content test to exercise the "block mixed-contents" preference and the show info-bar. Automation: For the new UI tests, added methods to tab_proxy and browser_proxy. The ones of most interest are GetLastNavigatinTime and WaitForNavigation that ensures we wait for a navigation to occur or have occured when taking actions that asynchronously trigger navigations. Resource loading: Added a flag to the response we get when loading a resource that indicates whether that resource was filtered (blocked or altered) by the security peer. We use this flag to notify back the browser when we report a load has been committed. This is so the SSL manager knows a frame has been filtered (in which case we have no cert info but should not consider that as unsafe). BUG=2004 Review URL: http://codereview.chromium.org/3165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/resource_handle_win.cc9
-rw-r--r--webkit/glue/resource_loader_bridge.h7
-rw-r--r--webkit/glue/webresponse.h4
-rw-r--r--webkit/glue/webresponse_impl.h4
-rw-r--r--webkit/port/platform/network/ResourceResponse.h14
-rw-r--r--webkit/tools/test_shell/simple_resource_loader_bridge.cc15
6 files changed, 40 insertions, 13 deletions
diff --git a/webkit/glue/resource_handle_win.cc b/webkit/glue/resource_handle_win.cc
index 09a22c2..da485c1 100644
--- a/webkit/glue/resource_handle_win.cc
+++ b/webkit/glue/resource_handle_win.cc
@@ -200,7 +200,8 @@ class ResourceHandleInternal : public ResourceLoaderBridge::Peer {
// ResourceLoaderBridge::Peer implementation
virtual void OnReceivedRedirect(const GURL& new_url);
virtual void OnReceivedResponse(
- const ResourceLoaderBridge::ResponseInfo& info);
+ const ResourceLoaderBridge::ResponseInfo& info,
+ bool content_filtered);
virtual void OnReceivedData(const char* data, int len);
virtual void OnCompletedRequest(const URLRequestStatus& status);
virtual std::string GetURLForDebugging();
@@ -268,7 +269,7 @@ void ResourceHandleInternal::HandleDataUrl() {
if (GetInfoFromDataUrl(webkit_glue::KURLToGURL(request_.url()), &info, &data,
&status)) {
- OnReceivedResponse(info);
+ OnReceivedResponse(info, false);
if (data.size())
OnReceivedData(data.c_str(), data.size());
@@ -502,11 +503,13 @@ void ResourceHandleInternal::OnReceivedRedirect(const GURL& new_url) {
}
void ResourceHandleInternal::OnReceivedResponse(
- const ResourceLoaderBridge::ResponseInfo& info) {
+ const ResourceLoaderBridge::ResponseInfo& info,
+ bool content_filtered) {
DCHECK(pending_);
// TODO(darin): need a way to properly initialize a ResourceResponse
ResourceResponse response = MakeResourceResponse(request_.url(), info);
+ response.setIsContentFiltered(content_filtered);
expected_content_length_ = response.expectedContentLength();
diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h
index 835a9e7..15414ae 100644
--- a/webkit/glue/resource_loader_bridge.h
+++ b/webkit/glue/resource_loader_bridge.h
@@ -79,8 +79,11 @@ class ResourceLoaderBridge {
virtual void OnReceivedRedirect(const GURL& new_url) = 0;
// Called when response headers are available (after all redirects have
- // been followed).
- virtual void OnReceivedResponse(const ResponseInfo& info) = 0;
+ // been followed). |content_filtered| is set to true if the contents is
+ // altered or replaced (usually for security reasons when the resource is
+ // deemed unsafe).
+ virtual void OnReceivedResponse(const ResponseInfo& info,
+ bool content_filtered) = 0;
// Called when a chunk of response data is available. This method may
// be called multiple times or not at all if an error occurs.
diff --git a/webkit/glue/webresponse.h b/webkit/glue/webresponse.h
index 9e98586..7259057 100644
--- a/webkit/glue/webresponse.h
+++ b/webkit/glue/webresponse.h
@@ -22,6 +22,10 @@ class WebResponse {
// used.
virtual std::string GetSecurityInfo() const = 0;
+ // Returns whether the content of this resource was filtered (usually for
+ // security reasons).
+ virtual bool IsContentFiltered() const = 0;
+
WebResponse() { }
virtual ~WebResponse() { }
diff --git a/webkit/glue/webresponse_impl.h b/webkit/glue/webresponse_impl.h
index 83260e3..504094b 100644
--- a/webkit/glue/webresponse_impl.h
+++ b/webkit/glue/webresponse_impl.h
@@ -38,6 +38,10 @@ class WebResponseImpl : public WebResponse {
response_ = response;
}
+ virtual bool IsContentFiltered() const {
+ return response_.isContentFiltered();
+ }
+
private:
WebCore::ResourceResponse response_;
diff --git a/webkit/port/platform/network/ResourceResponse.h b/webkit/port/platform/network/ResourceResponse.h
index 801f244..cf498bd 100644
--- a/webkit/port/platform/network/ResourceResponse.h
+++ b/webkit/port/platform/network/ResourceResponse.h
@@ -37,14 +37,16 @@ namespace WebCore {
class ResourceResponse : public ResourceResponseBase {
public:
ResourceResponse()
- : ResourceResponseBase()
+ : ResourceResponseBase(),
+ m_isContentFiltered(false)
{
// TODO(ericroman): move this into ResourceResponseBase
m_lastModifiedDate = 0;
}
ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
- : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
+ : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename),
+ m_isContentFiltered(false)
{
// TODO(ericroman): move this into ResourceResponseBase
m_lastModifiedDate = 0;
@@ -55,6 +57,11 @@ public:
m_securityInfo = securityInfo;
}
+ bool isContentFiltered() const { return m_isContentFiltered; }
+ void setIsContentFiltered(bool isContentFiltered) {
+ m_isContentFiltered = isContentFiltered;
+ }
+
private:
friend class ResourceResponseBase;
@@ -68,6 +75,9 @@ private:
notImplemented();
}
+ // Whether the contents for this response has been altered/blocked (usually
+ // for security reasons.
+ bool m_isContentFiltered;
};
} // namespace WebCore
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
index 336e42a..ce7157b 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
@@ -143,9 +143,10 @@ class RequestProxy : public URLRequest::Delegate,
peer_->OnReceivedRedirect(new_url);
}
- void NotifyReceivedResponse(const ResourceLoaderBridge::ResponseInfo& info) {
+ void NotifyReceivedResponse(const ResourceLoaderBridge::ResponseInfo& info,
+ bool content_filtered) {
if (peer_)
- peer_->OnReceivedResponse(info);
+ peer_->OnReceivedResponse(info, content_filtered);
}
void NotifyReceivedData(int bytes_read) {
@@ -231,9 +232,10 @@ class RequestProxy : public URLRequest::Delegate,
}
virtual void OnReceivedResponse(
- const ResourceLoaderBridge::ResponseInfo& info) {
+ const ResourceLoaderBridge::ResponseInfo& info,
+ bool content_filtered) {
owner_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &RequestProxy::NotifyReceivedResponse, info));
+ this, &RequestProxy::NotifyReceivedResponse, info, content_filtered));
}
virtual void OnReceivedData(int bytes_read) {
@@ -263,7 +265,7 @@ class RequestProxy : public URLRequest::Delegate,
info.headers = request->response_headers();
request->GetMimeType(&info.mime_type);
request->GetCharset(&info.charset);
- OnReceivedResponse(info);
+ OnReceivedResponse(info, false);
AsyncReadData(); // start reading
} else {
Done();
@@ -324,7 +326,8 @@ class SyncRequestProxy : public RequestProxy {
}
virtual void OnReceivedResponse(
- const ResourceLoaderBridge::ResponseInfo& info) {
+ const ResourceLoaderBridge::ResponseInfo& info,
+ bool content_filtered) {
*static_cast<ResourceLoaderBridge::ResponseInfo*>(result_) = info;
}