Bug 176557 - [WK2] Add C API to retrieve the originating page of a WKDownload
Summary: [WK2] Add C API to retrieve the originating page of a WKDownload
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
Keywords: InRadar
Depends on:
Reported: 2017-09-07 13:09 PDT by Chris Dumez
Modified: 2017-09-07 15:50 PDT (History)
9 users (show)

See Also:

Patch (16.55 KB, patch)
2017-09-07 14:11 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (17.10 KB, patch)
2017-09-07 15:21 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 2 Chris Dumez 2017-09-07 14:11:44 PDT
Created attachment 320177 [details]
Comment 3 Alex Christensen 2017-09-07 14:33:07 PDT
Comment on attachment 320177 [details]

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]
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]

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.