Bug 137322

Summary: WKDownloadCopyRequest() returns 0 until the download starts
Product: WebKit Reporter: Jeff Miller <jeffm>
Component: WebKit2Assignee: Jeff Miller <jeffm>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, conrad_shultz, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch andersca: review+

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>