Changeset 207454 in webkit
- Timestamp:
- Oct 17, 2016 11:03:55 PM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r207447 r207454 1 2016-10-17 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 NetworkSession: PendingDownload is leaked if canceled before willDecidePendingDownloadDestination 4 https://bugs.webkit.org/show_bug.cgi?id=163545 5 6 Reviewed by Alex Christensen. 7 8 If a download started by DownloadManager::startDownload() is cancelled before 9 DownloadManager::willDecidePendingDownloadDestination() is called, DownloadManager::cancelDownload() does 10 nothing, because the Download hasn't been created yet and m_downloadsWaitingForDestination map doesn't contain 11 the download ID, and the PendingDownload is never removed from the m_pendingDownloads map. 12 13 * NetworkProcess/Downloads/DownloadManager.cpp: 14 (WebKit::DownloadManager::cancelDownload): Always take the PendingDownload from m_pendingDownloads map. Then, if 15 the download was already in m_downloadsWaitingForDestination map, get the network data task to properly cancel 16 it and then call the completion handler to ignore the request. Otherwise cancel the pending download if exists. 17 * NetworkProcess/Downloads/PendingDownload.cpp: 18 (WebKit::PendingDownload::cancel): Cancel the network load and notify the UI process that the download was canceled. 19 * NetworkProcess/Downloads/PendingDownload.h: 20 1 21 2016-10-17 Megan Gardner <megan_gardner@apple.com> 2 22 -
trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp
r207042 r207454 159 159 { 160 160 if (Download* download = m_downloads.get(downloadID)) { 161 #if USE(NETWORK_SESSION) 162 ASSERT(!m_downloadsWaitingForDestination.contains(downloadID)); 163 ASSERT(!m_pendingDownloads.contains(downloadID)); 164 #endif 161 165 download->cancel(); 162 166 return; 163 167 } 164 168 #if USE(NETWORK_SESSION) 165 if (auto completionHandler = m_downloadsWaitingForDestination.take(downloadID).second) { 169 auto pendingDownload = m_pendingDownloads.take(downloadID); 170 if (m_downloadsWaitingForDestination.contains(downloadID)) { 171 auto pair = m_downloadsWaitingForDestination.take(downloadID); 172 auto networkDataTask = WTFMove(pair.first); 173 auto completionHandler = WTFMove(pair.second); 174 ASSERT(networkDataTask); 175 ASSERT(completionHandler); 176 177 networkDataTask->cancel(); 178 completionHandler(PolicyIgnore); 166 179 m_client.pendingDownloadCanceled(downloadID); 167 completionHandler(PolicyIgnore); 168 return; 169 } 180 return; 181 } 182 183 if (pendingDownload) 184 pendingDownload->cancel(); 170 185 #endif 171 186 } -
trunk/Source/WebKit2/NetworkProcess/Downloads/PendingDownload.cpp
r206988 r207454 59 59 } 60 60 61 void PendingDownload::cancel() 62 { 63 ASSERT(m_networkLoad); 64 m_networkLoad->cancel(); 65 send(Messages::DownloadProxy::DidCancel({ })); 66 } 67 61 68 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 62 69 void PendingDownload::canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace& protectionSpace) -
trunk/Source/WebKit2/NetworkProcess/Downloads/PendingDownload.h
r206583 r207454 52 52 void continueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate); 53 53 #endif 54 void cancel(); 54 55 55 56 private:
Note: See TracChangeset
for help on using the changeset viewer.