After using -[WebView _insertAttachmentWithFileWrapper:contentType:options:completion:], passing a NSFileWrapper made from a directory (and nil for the rest of the arguments), dragging the attachment out of the web view causes an exception to be raised: Exception Name: NSInvalidArgumentException Description: fileType 'dyn.agq8u' is not a valid UTI User Info: (null) 0 CoreFoundation 0x00007fff3a1f9e4c __exceptionPreprocess + 291 1 libobjc.A.dylib 0x00007fff67ed9efb objc_exception_throw + 48 2 AppKit 0x00007fff381a8759 -[NSFilePromiseProvider init] + 0 3 WebKit 0x000000010139555d WebKit::WebViewImpl::startDrag(WebCore::DragItem const&, WebKit::ShareableBitmap::Handle const&) + 667 4 WebKit 0x00000001012fa07a void IPC::handleMessage<Messages::WebPageProxy::StartDrag, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(WebCore::DragItem const&, WebKit::ShareableBitmap::Handle const&)>(IPC::Decoder&, WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(WebCore::DragItem const&, WebKit::ShareableBitmap::Handle const&)) + 264
s/WebView/WKWebView/ in the description, of course.
This is probably a result of failing to map kUTTypeFolder to a MIME type :(
(I learned from thorton that RenderThemeMac.mm understands MIME types "multipart/x-folder" and "application/vnd.apple.folder")
<rdar://problem/43702993>
Note: this is also reproducible when dropping a folder, or any file with an extension that WebKit doesn't recognize (e.g. *.crash).
Created attachment 348089 [details] Depends on webkit.org/b/188933
Created attachment 348112 [details] Rebase on trunk
Created attachment 348155 [details] Rebase on trunk
Comment on attachment 348155 [details] Rebase on trunk View in context: https://bugs.webkit.org/attachment.cgi?id=348155&action=review > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:385 > - [self setFileWrapper:fileWrapper.get() contentType:newContentType completion:^(NSError *error) { > + [self setFileWrapper:(__bridge NSFileWrapper *)fileWrapper.get() contentType:newContentType completion:^(NSError *error) { What is going on with all the 🌉? Other than that, r+, but please get rid of bridges for casts not between CF and NS objects.
(In reply to Tim Horton from comment #9) > Comment on attachment 348155 [details] > Rebase on trunk > > View in context: > https://bugs.webkit.org/attachment.cgi?id=348155&action=review > > > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:385 > > - [self setFileWrapper:fileWrapper.get() contentType:newContentType completion:^(NSError *error) { > > + [self setFileWrapper:(__bridge NSFileWrapper *)fileWrapper.get() contentType:newContentType completion:^(NSError *error) { > > What is going on with all the 🌉? Other than that, r+, but please get rid of > bridges for casts not between CF and NS objects. Oh...yeah, most of this bridging (with the exception of CFStringRef <=> NSString) is a mistake. I'll fix this before landing!
Created attachment 348187 [details] Patch for landing
Comment on attachment 348187 [details] Patch for landing Clearing flags on attachment: 348187 Committed r235392: <https://trac.webkit.org/changeset/235392>