Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: webkit/glue/multipart_response_delegate.cc

Issue 2850023: Fix a crash when the content type of a multipart request (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: cancel -> Cancel Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/multipart_response_delegate.h ('k') | webkit/glue/weburlloader_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/multipart_response_delegate.cc
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index 1b68064831a96f3313bc065e548f8d05c962285b..d7c8c295c739b68ac9ed70d4bce96f885e1a674f 100644
--- a/webkit/glue/multipart_response_delegate.cc
+++ b/webkit/glue/multipart_response_delegate.cc
@@ -125,7 +125,7 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
size_t boundary_pos;
while ((boundary_pos = FindBoundary()) != std::string::npos) {
- if (boundary_pos > 0) {
+ if (boundary_pos > 0 && client_) {
// Send the last data chunk.
client_->didReceiveData(loader_,
data_.data(),
@@ -158,7 +158,8 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
int send_length = data_.length() - boundary_.length();
if (data_[data_.length() - 1] == '\n')
send_length = data_.length();
- client_->didReceiveData(loader_, data_.data(), send_length);
+ if (client_)
+ client_->didReceiveData(loader_, data_.data(), send_length);
data_ = data_.substr(send_length);
}
}
@@ -166,7 +167,7 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
void MultipartResponseDelegate::OnCompletedRequest() {
// If we have any pending data and we're not in a header, go ahead and send
// it to WebCore.
- if (!processing_headers_ && !data_.empty()) {
+ if (!processing_headers_ && !data_.empty() && !stop_sending_ && client_) {
client_->didReceiveData(loader_,
data_.data(),
static_cast<int>(data_.length()));
@@ -247,7 +248,8 @@ bool MultipartResponseDelegate::ParseHeaders() {
response.setIsMultipartPayload(has_sent_first_response_);
has_sent_first_response_ = true;
// Send the response!
- client_->didReceiveResponse(loader_, response);
+ if (client_)
+ client_->didReceiveResponse(loader_, response);
return true;
}
« no previous file with comments | « webkit/glue/multipart_response_delegate.h ('k') | webkit/glue/weburlloader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698