summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 16:33:37 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 16:33:37 +0000
commit606334078cffc3385560da493c7882a3e849bc86 (patch)
tree2fe64dd1f55bab598e73f16135b5f8e1671138c0
parent1bf71ed8bf7b58f63101049a85e1d881802aa500 (diff)
downloadchromium_src-606334078cffc3385560da493c7882a3e849bc86.zip
chromium_src-606334078cffc3385560da493c7882a3e849bc86.tar.gz
chromium_src-606334078cffc3385560da493c7882a3e849bc86.tar.bz2
Do not write non-toplevel POST response into the WINInet cache.
BUG=55918 Review URL: http://codereview.chromium.org/3595004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61184 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/url_request_automation_job.cc11
-rw-r--r--chrome/test/automation/automation_messages.h7
-rw-r--r--chrome_frame/npapi_url_request.cc1
-rw-r--r--chrome_frame/plugin_url_request.cc7
-rw-r--r--chrome_frame/plugin_url_request.h5
-rw-r--r--chrome_frame/test/url_request_test.cc4
-rw-r--r--chrome_frame/urlmon_url_request.cc6
7 files changed, 36 insertions, 5 deletions
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc
index 8e96e7a..e29aa70 100644
--- a/chrome/browser/automation/url_request_automation_job.cc
+++ b/chrome/browser/automation/url_request_automation_job.cc
@@ -418,13 +418,22 @@ void URLRequestAutomationJob::StartAsync() {
referrer = GURL();
}
+ // Get the resource type (main_frame/script/image/stylesheet etc.
+ ResourceDispatcherHostRequestInfo* request_info =
+ ResourceDispatcherHost::InfoForRequest(request_);
+ ResourceType::Type resource_type = ResourceType::MAIN_FRAME;
+ if (request_info) {
+ resource_type = request_info->resource_type();
+ }
+
// Ask automation to start this request.
IPC::AutomationURLRequest automation_request = {
request_->url().spec(),
request_->method(),
referrer.spec(),
new_request_headers.ToString(),
- request_->get_upload()
+ request_->get_upload(),
+ resource_type
};
DCHECK(message_filter_);
diff --git a/chrome/test/automation/automation_messages.h b/chrome/test/automation/automation_messages.h
index 7f30828..ad6791c 100644
--- a/chrome/test/automation/automation_messages.h
+++ b/chrome/test/automation/automation_messages.h
@@ -301,6 +301,7 @@ struct AutomationURLRequest {
std::string referrer;
std::string extra_request_headers;
scoped_refptr<net::UploadData> upload_data;
+ int resource_type; // see webkit/glue/resource_type.h
};
// Traits for AutomationURLRequest structure to pack/unpack.
@@ -313,13 +314,15 @@ struct ParamTraits<AutomationURLRequest> {
WriteParam(m, p.referrer);
WriteParam(m, p.extra_request_headers);
WriteParam(m, p.upload_data);
+ WriteParam(m, p.resource_type);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->url) &&
ReadParam(m, iter, &p->method) &&
ReadParam(m, iter, &p->referrer) &&
ReadParam(m, iter, &p->extra_request_headers) &&
- ReadParam(m, iter, &p->upload_data);
+ ReadParam(m, iter, &p->upload_data) &&
+ ReadParam(m, iter, &p->resource_type);
}
static void Log(const param_type& p, std::string* l) {
l->append("(");
@@ -332,6 +335,8 @@ struct ParamTraits<AutomationURLRequest> {
LogParam(p.extra_request_headers, l);
l->append(", ");
LogParam(p.upload_data, l);
+ l->append(", ");
+ LogParam(p.resource_type, l);
l->append(")");
}
};
diff --git a/chrome_frame/npapi_url_request.cc b/chrome_frame/npapi_url_request.cc
index dce5d01..9799a87 100644
--- a/chrome_frame/npapi_url_request.cc
+++ b/chrome_frame/npapi_url_request.cc
@@ -205,6 +205,7 @@ void NPAPIUrlRequestManager::StartRequest(int request_id,
request_info.method, request_info.referrer,
request_info.extra_request_headers,
request_info.upload_data,
+ static_cast<ResourceType::Type>(request_info.resource_type),
enable_frame_busting_)) {
// Add to map.
DCHECK(request_map_.find(request_id) == request_map_.end());
diff --git a/chrome_frame/plugin_url_request.cc b/chrome_frame/plugin_url_request.cc
index ac746c6..ad223a9 100644
--- a/chrome_frame/plugin_url_request.cc
+++ b/chrome_frame/plugin_url_request.cc
@@ -11,7 +11,8 @@ PluginUrlRequest::PluginUrlRequest()
: delegate_(NULL),
remote_request_id_(-1),
post_data_len_(0),
- enable_frame_busting_(false) {
+ enable_frame_busting_(false),
+ resource_type_(ResourceType::MAIN_FRAME) {
}
PluginUrlRequest::~PluginUrlRequest() {
@@ -20,13 +21,15 @@ PluginUrlRequest::~PluginUrlRequest() {
bool PluginUrlRequest::Initialize(PluginUrlRequestDelegate* delegate,
int remote_request_id, const std::string& url, const std::string& method,
const std::string& referrer, const std::string& extra_headers,
- net::UploadData* upload_data, bool enable_frame_busting) {
+ net::UploadData* upload_data, ResourceType::Type resource_type,
+ bool enable_frame_busting) {
delegate_ = delegate;
remote_request_id_ = remote_request_id;
url_ = url;
method_ = method;
referrer_ = referrer;
extra_headers_ = extra_headers;
+ resource_type_ = resource_type;
if (upload_data) {
// We store a pointer to UrlmonUploadDataStream and not net::UploadData
diff --git a/chrome_frame/plugin_url_request.h b/chrome_frame/plugin_url_request.h
index 60e73d4..0026ade 100644
--- a/chrome_frame/plugin_url_request.h
+++ b/chrome_frame/plugin_url_request.h
@@ -16,6 +16,7 @@
#include "ipc/ipc_message.h"
#include "net/base/upload_data.h"
#include "net/url_request/url_request_status.h"
+#include "webkit/glue/resource_type.h"
class PluginUrlRequest;
class PluginUrlRequestDelegate;
@@ -121,7 +122,8 @@ class PluginUrlRequest {
bool Initialize(PluginUrlRequestDelegate* delegate,
int remote_request_id, const std::string& url, const std::string& method,
const std::string& referrer, const std::string& extra_headers,
- net::UploadData* upload_data, bool enable_frame_busting_);
+ net::UploadData* upload_data, ResourceType::Type resource_type,
+ bool enable_frame_busting_);
// Accessors.
int id() const {
@@ -177,6 +179,7 @@ class PluginUrlRequest {
std::string method_;
std::string referrer_;
std::string extra_headers_;
+ ResourceType::Type resource_type_;
ScopedComPtr<IStream> upload_data_;
};
diff --git a/chrome_frame/test/url_request_test.cc b/chrome_frame/test/url_request_test.cc
index a06682b..699ea61 100644
--- a/chrome_frame/test/url_request_test.cc
+++ b/chrome_frame/test/url_request_test.cc
@@ -83,6 +83,7 @@ TEST(UrlmonUrlRequestTest, Simple1) {
"", // referrer
"", // extra request
NULL, // upload data
+ ResourceType::MAIN_FRAME, // resource type
true); // frame busting
testing::InSequence s;
@@ -129,6 +130,7 @@ TEST(UrlmonUrlRequestTest, Head) {
"", // referrer
"", // extra request
NULL, // upload data
+ ResourceType::MAIN_FRAME, // resource type
true); // frame busting
testing::InSequence s;
@@ -169,6 +171,7 @@ TEST(UrlmonUrlRequestTest, UnreachableUrl) {
"", // referrer
"", // extra request
NULL, // upload data
+ ResourceType::MAIN_FRAME, // resource type
true); // frame busting
// Expect headers
@@ -205,6 +208,7 @@ TEST(UrlmonUrlRequestTest, ZeroLengthResponse) {
"", // referrer
"", // extra request
NULL, // upload data
+ ResourceType::MAIN_FRAME, // resource type
true); // frame busting
// Expect headers
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index 6f3e7cb..0466d53 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -447,6 +447,11 @@ STDMETHODIMP UrlmonUrlRequest::GetBindInfo(DWORD* bind_flags,
// these requests to the browser's cache
*bind_flags |= BINDF_GETNEWESTVERSION | BINDF_PRAGMA_NO_CACHE;
+ // Attempt to avoid storing the response for XHR request.
+ // See http://crbug.com/55918
+ if (resource_type_ != ResourceType::MAIN_FRAME)
+ *bind_flags |= BINDF_NOWRITECACHE;
+
// Initialize the STGMEDIUM.
memset(&bind_info->stgmedData, 0, sizeof(STGMEDIUM));
bind_info->grfBindInfoF = 0;
@@ -949,6 +954,7 @@ void UrlmonUrlRequestManager::StartRequest(int request_id,
request_info.referrer,
request_info.extra_request_headers,
request_info.upload_data,
+ static_cast<ResourceType::Type>(request_info.resource_type),
enable_frame_busting_);
new_request->set_parent_window(notification_window_);
new_request->set_privileged_mode(privileged_mode_);