Bug 176000

Summary: Add WKUIDelegatePrivate equivalent of WKPageUIClient's saveDataToFileInDownloadsFolder
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, berto, buildbot, cgarcia, gustavo, mcatanzaro, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

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]
Patch
Comment 2 Andy Estes 2017-08-25 16:17:16 PDT
Comment on attachment 319109 [details]
Patch

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]
Patch
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
http://trac.webkit.org/r221216
Comment 6 Radar WebKit Bug Importer 2017-08-25 17:14:35 PDT
<rdar://problem/34092924>