WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
137507
WKContext needs to provide an API to resume a download
https://bugs.webkit.org/show_bug.cgi?id=137507
Summary
WKContext needs to provide an API to resume a download
Jeff Miller
Reported
2014-10-07 16:41:24 PDT
We currently have an API to start a new download: WK_EXPORT WKDownloadRef WKContextDownloadURLRequest(WKContextRef context, const WKURLRequestRef request); but there's no API to resume a partially completed download. Presumably, such an API would take the data returned by WKDownloadGetResumeData() as well as a path which can be used by NSURLDownload.
Attachments
Patch
(17.85 KB, patch)
2014-10-08 13:48 PDT
,
Jeff Miller
no flags
Details
Formatted Diff
Diff
Patch
(17.86 KB, patch)
2014-10-15 13:30 PDT
,
Jeff Miller
no flags
Details
Formatted Diff
Diff
Patch
(17.90 KB, patch)
2014-10-20 12:01 PDT
,
Jeff Miller
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2014-10-07 16:42:03 PDT
<
rdar://problem/18576259
>
Jeff Miller
Comment 2
2014-10-08 13:48:08 PDT
Created
attachment 239494
[details]
Patch
Joseph Pecoraro
Comment 3
2014-10-14 18:08:08 PDT
Comment on
attachment 239494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=239494&action=review
> Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm:99 > + m_nsURLDownload = [[NSURLDownload alloc] initWithResumeData:nsData.get() delegate:m_delegate.get() path:path];
Nit: Needs adoptNS(...) here.
Conrad Shultz
Comment 4
2014-10-15 09:46:14 PDT
Comment on
attachment 239494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=239494&action=review
> Source/WebKit2/WebProcess/WebProcess.messages.in:64 > + # three messages.
There are other messages files with fewer messages; since you're having to change the comment I wonder whether this would be an opportune time to spin off a Download.messages.in.
Jeff Miller
Comment 5
2014-10-15 10:46:47 PDT
Comment on
attachment 239494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=239494&action=review
>> Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm:99 >> + m_nsURLDownload = [[NSURLDownload alloc] initWithResumeData:nsData.get() delegate:m_delegate.get() path:path]; > > Nit: Needs adoptNS(...) here.
I'll fix this.
>> Source/WebKit2/WebProcess/WebProcess.messages.in:64 >> + # three messages. > > There are other messages files with fewer messages; since you're having to change the comment I wonder whether this would be an opportune time to spin off a Download.messages.in.
Fair point. I'll do that with a separate bug.
Jeff Miller
Comment 6
2014-10-15 10:49:42 PDT
Comment on
attachment 239494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=239494&action=review
>>> Source/WebKit2/WebProcess/WebProcess.messages.in:64 >>> + # three messages. >> >> There are other messages files with fewer messages; since you're having to change the comment I wonder whether this would be an opportune time to spin off a Download.messages.in. > > Fair point. I'll do that with a separate bug.
I filed
bug 137744
to track this.
Jeff Miller
Comment 7
2014-10-15 13:30:31 PDT
Created
attachment 239891
[details]
Patch
Anders Carlsson
Comment 8
2014-10-20 10:47:14 PDT
Comment on
attachment 239494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=239494&action=review
> Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm:98 > + RetainPtr<NSData> nsData = adoptNS([[NSData alloc] initWithBytes:resumeData.data() length:resumeData.size()]);
Can use auto nsData =
> Source/WebKit2/UIProcess/API/C/WKContext.cpp:285 > +WKDownloadRef WKContextResumeDownload(WKContextRef contextRef, WKDataRef resumeData, WKStringRef path)
I'm not in love with this name, since it reads like a getter. I don't have a better idea though.
Jeff Miller
Comment 9
2014-10-20 12:00:01 PDT
Comment on
attachment 239494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=239494&action=review
>> Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm:98 >> + RetainPtr<NSData> nsData = adoptNS([[NSData alloc] initWithBytes:resumeData.data() length:resumeData.size()]); > > Can use auto nsData =
Fixed.
>> Source/WebKit2/UIProcess/API/C/WKContext.cpp:285 >> +WKDownloadRef WKContextResumeDownload(WKContextRef contextRef, WKDataRef resumeData, WKStringRef path) > > I'm not in love with this name, since it reads like a getter. I don't have a better idea though.
I don't, either.
Jeff Miller
Comment 10
2014-10-20 12:01:00 PDT
Created
attachment 240135
[details]
Patch
Darin Adler
Comment 11
2014-10-20 17:46:03 PDT
Comment on
attachment 240135
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=240135&action=review
> Source/WebKit2/NetworkProcess/NetworkProcess.h:36 > +#include "SandboxExtension.h"
Not needed, because DownloadManager.h now includes this header too.
> Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm:102 > + auto nsData = adoptNS([[NSData alloc] initWithBytes:resumeData.data() length:resumeData.size()]);
Is this always how we turn an IPC::DataReference into an NSData? I would have expected a more streamlined idiom.
> Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm:105 > + m_request = ResourceRequest([m_nsURLDownload request]);
Is the explicit constructor needed here?
> Source/WebKit2/UIProcess/API/C/WKContext.h:113 > WK_EXPORT WKDownloadRef WKContextDownloadURLRequest(WKContextRef context, const WKURLRequestRef request);
Not new to this patch: This const is a mistake.
> Source/WebKit2/UIProcess/WebContext.cpp:908 > +
Should leave out this blank line, I think.
Jeff Miller
Comment 12
2014-10-21 10:42:39 PDT
Comment on
attachment 240135
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=240135&action=review
>> Source/WebKit2/NetworkProcess/NetworkProcess.h:36 >> +#include "SandboxExtension.h" > > Not needed, because DownloadManager.h now includes this header too.
Removed.
>> Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm:102 >> + auto nsData = adoptNS([[NSData alloc] initWithBytes:resumeData.data() length:resumeData.size()]); > > Is this always how we turn an IPC::DataReference into an NSData? I would have expected a more streamlined idiom.
As far as I can tell, yes. I see this idiom used in other places.
>> Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm:105 >> + m_request = ResourceRequest([m_nsURLDownload request]); > > Is the explicit constructor needed here?
It isn't. I'll remove the explicit constructor.
>> Source/WebKit2/UIProcess/API/C/WKContext.h:113 >> WK_EXPORT WKDownloadRef WKContextDownloadURLRequest(WKContextRef context, const WKURLRequestRef request); > > Not new to this patch: This const is a mistake.
I'll fix this in a separate patch.
>> Source/WebKit2/UIProcess/WebContext.cpp:908 >> + > > Should leave out this blank line, I think.
Done.
Jeff Miller
Comment 13
2014-10-21 10:46:07 PDT
Committed
r174987
: <
http://trac.webkit.org/changeset/174987
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug