Bug 137322 - WKDownloadCopyRequest() returns 0 until the download starts
Summary: WKDownloadCopyRequest() returns 0 until the download starts
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac Unspecified
: P2 Normal
Assignee: Jeff Miller
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-10-01 16:25 PDT by Jeff Miller
Modified: 2014-10-02 14:01 PDT (History)
3 users (show)

See Also:


Attachments
Patch (13.63 KB, patch)
2014-10-02 11:03 PDT, Jeff Miller
no flags Details | Formatted Diff | Diff
Patch (13.70 KB, patch)
2014-10-02 11:42 PDT, Jeff Miller
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Miller 2014-10-01 16:25:27 PDT
If a client creates a download using WKContextDownloadURLRequest(), WKDownloadCopyRequest() won't return the request until the download starts.
Comment 1 Radar WebKit Bug Importer 2014-10-01 16:25:56 PDT
<rdar://problem/18521011>
Comment 2 Jeff Miller 2014-10-01 16:26:47 PDT
The actual Radar bug is <rdar://problem/10046884>
Comment 3 Jeff Miller 2014-10-02 11:03:42 PDT
Created attachment 239119 [details]
Patch
Comment 4 Anders Carlsson 2014-10-02 11:32:19 PDT
Comment on attachment 239119 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239119&action=review

> Source/WebKit2/UIProcess/WebPageProxy.cpp:1791
> +        ASSERT(m_decidePolicyForResponseRequest);

I don't think this is guaranteed to not be null.
Comment 5 Jeff Miller 2014-10-02 11:36:45 PDT
Comment on attachment 239119 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239119&action=review

>> Source/WebKit2/UIProcess/WebPageProxy.cpp:1791
>> +        ASSERT(m_decidePolicyForResponseRequest);
> 
> I don't think this is guaranteed to not be null.

I wasn't 100% sure about this, either. I'll update the patch to pass a reference to ResourceRequest() if it is null.
Comment 6 Jeff Miller 2014-10-02 11:42:20 PDT
Created attachment 239123 [details]
Patch
Comment 7 Anders Carlsson 2014-10-02 13:48:54 PDT
Comment on attachment 239123 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239123&action=review

> Source/WebKit2/UIProcess/WebPageProxy.cpp:1792
> +        const ResourceRequest& downloadRequest = m_decidePolicyForResponseRequest ? *m_decidePolicyForResponseRequest : ResourceRequest();
> +        DownloadProxy* download = m_process->context().createDownloadProxy(downloadRequest);

I'd add a FIXME about ensuring that this ResourceRequest is never empty.
Comment 8 Jeff Miller 2014-10-02 14:01:33 PDT
Committed r174230: <http://trac.webkit.org/changeset/174230>