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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceLoader.cpp

Issue 1802693002: Fix triggered RELEASE_ASSERT in ResourceLoader::didReceiveResponse() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 releaseResources(); 172 releaseResources();
173 return; 173 return;
174 } 174 }
175 175
176 ResourceError nonNullError = error.isNull() ? ResourceError::cancelledError( m_resource->lastResourceRequest().url()) : error; 176 ResourceError nonNullError = error.isNull() ? ResourceError::cancelledError( m_resource->lastResourceRequest().url()) : error;
177 177
178 WTF_LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().getS tring().latin1().data()); 178 WTF_LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().getS tring().latin1().data());
179 m_state = ConnectionStateCanceled; 179 m_state = ConnectionStateCanceled;
180 m_resource->setResourceError(nonNullError); 180 m_resource->setResourceError(nonNullError);
181 181
182 // If we don't immediately clear m_loader when cancelling, we might get
183 // unexpected reentrancy. m_resource->error() can trigger JS events, which
184 // could start a modal dialog. Normally, a modal dialog would defer loading
185 // and prevent receiving messages for a cancelled ResourceLoader, but
186 // m_fetcher->didFailLoading() severs the connection by which all of a
187 // page's loads are deferred. A response can then arrive, see m_state
188 // is ConnectionStateCanceled, and ASSERT or break in other ways.
189 if (m_loader) {
190 m_loader->cancel();
191 m_loader.clear();
192 }
193
182 if (!m_notifiedLoadComplete) { 194 if (!m_notifiedLoadComplete) {
183 m_notifiedLoadComplete = true; 195 m_notifiedLoadComplete = true;
184 m_fetcher->didFailLoading(m_resource.get(), nonNullError); 196 m_fetcher->didFailLoading(m_resource.get(), nonNullError);
185 } 197 }
186 198
187 if (m_state != ConnectionStateReleased) 199 if (m_state != ConnectionStateReleased)
188 m_resource->error(Resource::LoadError); 200 m_resource->error(Resource::LoadError);
189 if (m_state != ConnectionStateReleased) 201 if (m_state != ConnectionStateReleased)
190 releaseResources(); 202 releaseResources();
191 } 203 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // empty buffer is a noop in most cases, but is destructive in the case of 406 // empty buffer is a noop in most cases, but is destructive in the case of
395 // a 304, where it will overwrite the cached data we should be reusing. 407 // a 304, where it will overwrite the cached data we should be reusing.
396 if (dataOut.size()) { 408 if (dataOut.size()) {
397 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size (), encodedDataLength); 409 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size (), encodedDataLength);
398 m_resource->setResourceBuffer(dataOut); 410 m_resource->setResourceBuffer(dataOut);
399 } 411 }
400 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); 412 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength);
401 } 413 }
402 414
403 } // namespace blink 415 } // 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