Bug 176557

Summary: [WK2] Add C API to retrieve the originating page of a WKDownload
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, benjamin, buildbot, cmarcelo, commit-queue, dbates, ggaren, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2017-09-07 13:09:38 PDT
Add C API to retrieve the original page of a WKDownload. This is the C API equivalent to _WKDownload.originatingWebView in ObjC.
Comment 1 Radar WebKit Bug Importer 2017-09-07 13:09:59 PDT
<rdar://problem/34314776>
Comment 2 Chris Dumez 2017-09-07 14:11:44 PDT
Created attachment 320177 [details]
Patch
Comment 3 Alex Christensen 2017-09-07 14:33:07 PDT
Comment on attachment 320177 [details]
Patch

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

> Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp:102
> +    m_originatingPage = page ? page->createWeakPtr() : WeakPtr<WebPageProxy>();

will nullptr not work?

> Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:265
> +void PageClientImpl::handleDownloadRequest(DownloadProxy*)
>  {
> -    ASSERT_ARG(download, download);
> -    ASSERT([download->wrapper() isKindOfClass:[_WKDownload class]]);
> -    [static_cast<_WKDownload *>(download->wrapper()) setOriginatingWebView:m_webView];
>  }

It would be nice if we could remove this PageClient call completely and make all platforms do this the same way.  It seems like that's all GTK is doing here, and WPE is in progress.
Comment 4 Chris Dumez 2017-09-07 15:21:27 PDT
Created attachment 320189 [details]
Patch
Comment 5 Build Bot 2017-09-07 15:23:36 PDT
Attachment 320189 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/WeakPtr.h:95:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 1 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 WebKit Commit Bot 2017-09-07 15:50:01 PDT
Comment on attachment 320189 [details]
Patch

Clearing flags on attachment: 320189

Committed r221766: <http://trac.webkit.org/changeset/221766>
Comment 7 WebKit Commit Bot 2017-09-07 15:50:03 PDT
All reviewed patches have been landed.  Closing bug.