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

Side by Side Diff: Source/web/AssociatedURLLoader.cpp

Issue 213383008: Avoid (theorethical) NPE. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen t, unsigned long long totalBytesToBeSent) 194 void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen t, unsigned long long totalBytesToBeSent)
195 { 195 {
196 if (!m_client) 196 if (!m_client)
197 return; 197 return;
198 198
199 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); 199 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent);
200 } 200 }
201 201
202 void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response) 202 void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response)
203 { 203 {
204 if (!m_client)
205 return;
206
204 // Try to use the original ResourceResponse if possible. 207 // Try to use the original ResourceResponse if possible.
205 WebURLResponse validatedResponse = WrappedResourceResponse(response); 208 WebURLResponse validatedResponse = WrappedResourceResponse(response);
206 HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy == WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl); 209 HTTPResponseHeaderValidator validator(m_options.crossOriginRequestPolicy == WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl);
207 if (!m_options.exposeAllResponseHeaders) 210 if (!m_options.exposeAllResponseHeaders)
208 validatedResponse.visitHTTPHeaderFields(&validator); 211 validatedResponse.visitHTTPHeaderFields(&validator);
209 212
210 // If there are blocked headers, copy the response so we can remove them. 213 // If there are blocked headers, copy the response so we can remove them.
211 const HTTPHeaderSet& blockedHeaders = validator.blockedHeaders(); 214 const HTTPHeaderSet& blockedHeaders = validator.blockedHeaders();
212 if (!blockedHeaders.isEmpty()) { 215 if (!blockedHeaders.isEmpty()) {
213 validatedResponse = WebURLResponse(validatedResponse); 216 validatedResponse = WebURLResponse(validatedResponse);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 m_loader->cancel(); 367 m_loader->cancel();
365 } 368 }
366 369
367 void AssociatedURLLoader::setDefersLoading(bool defersLoading) 370 void AssociatedURLLoader::setDefersLoading(bool defersLoading)
368 { 371 {
369 if (m_loader) 372 if (m_loader)
370 m_loader->setDefersLoading(defersLoading); 373 m_loader->setDefersLoading(defersLoading);
371 } 374 }
372 375
373 } // namespace blink 376 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698