Title: [198453] trunk/Source/WebKit2
- Revision
- 198453
- Author
- beid...@apple.com
- Date
- 2016-03-18 16:53:44 -0700 (Fri, 18 Mar 2016)
Log Message
NSURLSession: Set download resume data when a download fails due to an error.
https://bugs.webkit.org/show_bug.cgi?id=155665
Reviewed by Alex Christensen.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): Save the resume data from the
NSError userInfo if it exists.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (198452 => 198453)
--- trunk/Source/WebKit2/ChangeLog 2016-03-18 23:50:13 UTC (rev 198452)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-18 23:53:44 UTC (rev 198453)
@@ -1,3 +1,14 @@
+2016-03-18 Brady Eidson <beid...@apple.com>
+
+ NSURLSession: Set download resume data when a download fails due to an error.
+ https://bugs.webkit.org/show_bug.cgi?id=155665
+
+ Reviewed by Alex Christensen.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): Save the resume data from the
+ NSError userInfo if it exists.
+
2016-03-18 Chris Dumez <cdu...@apple.com>
Speculative revalidation requests do not have their HTTP user-agent set
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (198452 => 198453)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-03-18 23:50:13 UTC (rev 198452)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-03-18 23:53:44 UTC (rev 198453)
@@ -170,8 +170,18 @@
else if (error) {
auto downloadID = _session->takeDownloadID(task.taskIdentifier);
if (downloadID.downloadID()) {
- if (auto* download = WebKit::NetworkProcess::singleton().downloadManager().download(downloadID))
- download->didFail(error, { });
+ if (auto* download = WebKit::NetworkProcess::singleton().downloadManager().download(downloadID)) {
+ NSData *resumeData = nil;
+ if (id userInfo = error.userInfo) {
+ if ([userInfo isKindOfClass:[NSDictionary class]])
+ resumeData = userInfo[@"NSURLSessionDownloadTaskResumeData"];
+ }
+
+ if (resumeData && [resumeData isKindOfClass:[NSData class]])
+ download->didFail(error, { static_cast<const uint8_t*>(resumeData.bytes), resumeData.length });
+ else
+ download->didFail(error, { });
+ }
}
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes