Bug 176000 - Add WKUIDelegatePrivate equivalent of WKPageUIClient's saveDataToFileInDownloadsFolder
Summary: Add WKUIDelegatePrivate equivalent of WKPageUIClient's saveDataToFileInDownlo...
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
Keywords: InRadar
Depends on:
Reported: 2017-08-25 16:06 PDT by Alex Christensen
Modified: 2017-08-25 17:14 PDT (History)
7 users (show)

See Also:

Patch (22.08 KB, patch)
2017-08-25 16:08 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (22.39 KB, patch)
2017-08-25 16:24 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2017-08-25 16:06:48 PDT
Add WKUIDelegatePrivate equivalent of WKPageUIClient's saveDataToFileInDownloadsFolder
Comment 1 Alex Christensen 2017-08-25 16:08:25 PDT
Created attachment 319109 [details]
Comment 2 Andy Estes 2017-08-25 16:17:16 PDT
Comment on attachment 319109 [details]

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

> Source/WebKit/UIProcess/WebPageProxy.cpp:6126
> +    saveDataToFileInDownloadsFolder(WTFMove(suggestedFilename), "application/pdf", WTFMove(originatingURL),

Can you use ASCIILiteral() for "application/pdf"?

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UIDelegate.mm:178
> +    EXPECT_EQ(webView, saveDataToFileArguments.webView);
> +    EXPECT_TRUE([saveDataToFileArguments.data isEqualToData:[NSData dataWithContentsOfURL:pdfURL]]);
> +    EXPECT_STREQ([saveDataToFileArguments.suggestedFilename UTF8String], "test.pdf");
> +    EXPECT_STREQ([saveDataToFileArguments.mimeType UTF8String], "application/pdf");
> +    EXPECT_STREQ([[saveDataToFileArguments.url absoluteString] UTF8String], [[pdfURL absoluteString] UTF8String]);

This is fine, but you could just move these EXPECTs into -_webView:saveDataToFile:suggestedFilename:mimeType:originatingURL: and avoid creating a struct.
Comment 3 Alex Christensen 2017-08-25 16:24:19 PDT
Created attachment 319113 [details]
Comment 4 Build Bot 2017-08-25 16:25:39 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 5 Alex Christensen 2017-08-25 17:14:01 PDT
Comment 6 Radar WebKit Bug Importer 2017-08-25 17:14:35 PDT