summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 19:31:36 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 19:31:36 +0000
commit4718325ce7e91e4f52de4e2e9fca8934e1ba88f0 (patch)
tree47a95eedc52c3c0ca31edf8ad98ce1abb17de41f /chrome_frame
parent4b47c247aeadbf6a7967733120defcee2bc69773 (diff)
downloadchromium_src-4718325ce7e91e4f52de4e2e9fca8934e1ba88f0.zip
chromium_src-4718325ce7e91e4f52de4e2e9fca8934e1ba88f0.tar.gz
chromium_src-4718325ce7e91e4f52de4e2e9fca8934e1ba88f0.tar.bz2
Fix ChromeFrame referrer test which was flaky due to incorrect http header parsing. To pass the referrer
to Chrome during navigation we were converting normalized HTTP headers which are terminated with \r\n to raw headers and attempting to parse them. Converting to raw headers basically replaces \r\n with the NULL terminator which causes the parsing to fail as a result of which we fail to retrieve the referrer. Fix is to not convert the headers to raw and just parse the orignal headers. The other change is to only flag success or failure in the referrer frame test if we are running in Chrome. This page loads initially in IE as well due to the vagaries of the http equiv patch. Flagging an error if we don't find a referrer basically causes the test to fail. This should fix http://code.google.com/p/chromium/issues/detail?id=34812 Will remove the flaky attribute on the ChromeFrame Referrer test in a subsequent CL if all goes well. Bug=34812 Review URL: http://codereview.chromium.org/1128013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/test/data/referrer_frame.html14
-rw-r--r--chrome_frame/urlmon_moniker.cc7
-rw-r--r--chrome_frame/urlmon_url_request.cc4
3 files changed, 11 insertions, 14 deletions
diff --git a/chrome_frame/test/data/referrer_frame.html b/chrome_frame/test/data/referrer_frame.html
index c987a3f..2927445 100644
--- a/chrome_frame/test/data/referrer_frame.html
+++ b/chrome_frame/test/data/referrer_frame.html
@@ -7,13 +7,15 @@
<script type="text/javascript">
function onLoad() {
- var referrer_search = /referrer_main.html/;
- var referrer_pos = document.referrer.search(referrer_search);
+ if (isRunningInChrome()) {
+ var referrer_search = /referrer_main.html/;
+ var referrer_pos = document.referrer.search(referrer_search);
- if (referrer_pos != -1) {
- onSuccess("FullTab_ReferrerTest", 1);
- } else {
- onFailure("FullTab_ReferrerTest", 1, "Failed to find referrer");
+ if (referrer_pos != -1) {
+ onSuccess("FullTab_ReferrerTest", 1);
+ } else {
+ onFailure("FullTab_ReferrerTest", 1, "Failed to find referrer");
+ }
}
}
</script>
diff --git a/chrome_frame/urlmon_moniker.cc b/chrome_frame/urlmon_moniker.cc
index 85fad9f..0873f13 100644
--- a/chrome_frame/urlmon_moniker.cc
+++ b/chrome_frame/urlmon_moniker.cc
@@ -33,11 +33,8 @@ std::string FindReferrerFromHeaders(const wchar_t* headers,
if (!both_headers[i])
continue;
std::string raw_headers_utf8 = WideToUTF8(both_headers[i]);
- std::string http_headers =
- net::HttpUtil::AssembleRawHeaders(raw_headers_utf8.c_str(),
- raw_headers_utf8.length());
- net::HttpUtil::HeadersIterator it(http_headers.begin(),
- http_headers.end(), "\r\n");
+ net::HttpUtil::HeadersIterator it(raw_headers_utf8.begin(),
+ raw_headers_utf8.end(), "\r\n");
while (it.GetNext()) {
if (LowerCaseEqualsASCII(it.name(), "referer")) {
referrer = it.values();
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index 6f1a123..96666a9 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -497,9 +497,7 @@ STDMETHODIMP UrlmonUrlRequest::OnResponse(DWORD dwResponseCode,
// NOTE(slightlyoff): We don't use net::HttpResponseHeaders here because
// of lingering ICU/base_noicu issues.
if (enable_frame_busting_) {
- std::string http_headers = net::HttpUtil::AssembleRawHeaders(
- raw_headers.c_str(), raw_headers.length());
- if (http_utils::HasFrameBustingHeader(http_headers)) {
+ if (http_utils::HasFrameBustingHeader(raw_headers)) {
DLOG(ERROR) << "X-Frame-Options header other than ALLOWALL " <<
"detected, navigation canceled";
return E_FAIL;