Bug 188957

Summary: [Attachment Support] [WK2] Images copied from Mail message view paste with the wrong file name in compose
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, bdakin, commit-queue, darin, mitz, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Depends on webkit.org/b/188903
none
Rebase on trunk
darin: review+
Patch for landing none

Description Wenson Hsieh 2018-08-26 16:57:00 PDT
The resulting file names of the _WKAttachments end up looking something like "6E69C86F-D0D3-4451-830F-E2C96FD063E0@scv.apple.com".
Comment 1 Radar WebKit Bug Importer 2018-08-26 17:03:35 PDT
<rdar://problem/43737715>
Comment 2 Wenson Hsieh 2018-08-26 17:13:17 PDT
Created attachment 348105 [details]
Depends on webkit.org/b/188903
Comment 3 Wenson Hsieh 2018-08-26 19:57:42 PDT
Created attachment 348113 [details]
Rebase on trunk
Comment 4 Darin Adler 2018-08-27 08:36:26 PDT
Comment on attachment 348113 [details]
Rebase on trunk

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

> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:1334
> +    auto mainResource = adoptNS([[WebResource alloc] initWithData:markupData URL:[NSURL URLWithString:@"foo.html"] MIMEType:@"text/html" textEncodingName:@"utf-8" frameName:nil]);
> +    auto pngResource = adoptNS([[WebResource alloc] initWithData:testImageData() URL:[NSURL URLWithString:@"1.png"] MIMEType:@"image/png" textEncodingName:nil frameName:nil]);
> +    auto gifResource = adoptNS([[WebResource alloc] initWithData:testGIFData() URL:[NSURL URLWithString:@"2.gif"] MIMEType:@"image/gif" textEncodingName:nil frameName:nil]);
> +    auto archive = adoptNS([[WebArchive alloc] initWithMainResource:mainResource.get() subresources:@[ pngResource.get(), gifResource.get() ] subframeArchives:@[ ]]);

We should start using ARC for our unit tests.
Comment 5 Wenson Hsieh 2018-08-27 08:50:55 PDT
Comment on attachment 348113 [details]
Rebase on trunk

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

>> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:1334
>> +    auto archive = adoptNS([[WebArchive alloc] initWithMainResource:mainResource.get() subresources:@[ pngResource.get(), gifResource.get() ] subframeArchives:@[ ]]);
> 
> We should start using ARC for our unit tests.

Noted!

I suppose a good first step towards this is to add bridging casts as needed (in fact, there are several places in this file that directly cast NSStrings to CFStringRefs and vice versa). I'll be fixing these as I go, in subsequent patches.
Comment 6 Wenson Hsieh 2018-08-27 09:07:20 PDT
Created attachment 348148 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2018-08-27 09:45:31 PDT
Comment on attachment 348148 [details]
Patch for landing

Clearing flags on attachment: 348148

Committed r235375: <https://trac.webkit.org/changeset/235375>