summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-12 23:46:48 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-12 23:46:48 +0000
commit0bcfb5e18bb89fc298aec90c2dd342d65bf63836 (patch)
treed2767588dc37c7380ac3e06c215e0c91a75f5bfb /chrome_frame
parent3549af06edb307b89050b8064b4c22e816326471 (diff)
downloadchromium_src-0bcfb5e18bb89fc298aec90c2dd342d65bf63836.zip
chromium_src-0bcfb5e18bb89fc298aec90c2dd342d65bf63836.tar.gz
chromium_src-0bcfb5e18bb89fc298aec90c2dd342d65bf63836.tar.bz2
The chrome frame net tests would not complete at times on the IE6 builder. This was due to a regression introduced recently where we removed
the chrome frame stream cache from the urlmon request object and instead cached the stream passed in. While this was all fine, we failed to handle the case where an attempt to read from this stream in response to a read request from chrome returned S_FALSE which means end of data, in which case we should release the stream. Not doing this caused us to not send over the end request notification to chrome, thus causing the tests to indefinitely wait. Review URL: http://codereview.chromium.org/2001019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/urlmon_url_request.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index 17d2825..f767ab1 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -36,6 +36,9 @@ HRESULT ReadStream(IStream* stream, size_t size, std::string* data) {
DCHECK_EQ(read, data->length());
} else {
data->clear();
+ // Return S_FALSE if the underlying stream returned S_OK and zero bytes.
+ if (hr == S_OK)
+ hr = S_FALSE;
}
return hr;
@@ -233,6 +236,12 @@ size_t UrlmonUrlRequest::SendDataToDelegate(size_t bytes_to_read) {
if (read_data.empty()) {
pending_read_size_ = pending_data_read_save;
}
+ // If we received S_FALSE it indicates that there is no more data in the
+ // stream. Clear it to ensure that OnStopBinding correctly sends over the
+ // response end notification to chrome.
+ if (hr == S_FALSE) {
+ pending_data_.Release();
+ }
}
bytes_copied = read_data.length();
@@ -389,13 +398,14 @@ STDMETHODIMP UrlmonUrlRequest::OnStopBinding(HRESULT result, LPCWSTR error) {
// The network policy in Chrome network is that error code/end_of_stream
// should be returned only as a result of read (or start) request.
// Here are the possible cases:
- // cached_data|pending_read
+ // pending_data_|pending_read
// FALSE |FALSE => EndRequest if no headers, otherwise wait for Read.
// FALSE |TRUE => EndRequest.
// TRUE |FALSE => Wait for Read.
// TRUE |TRUE => Something went wrong!!
if (pending_data_) {
+ DCHECK(pending_read_size_ == 0);
ReleaseBindings();
return S_OK;
}