RESOLVED FIXED 188903
[Cocoa] Exception (fileType 'dyn.agq8u' is not a valid UTI) raised when dragging an attachment whose file wrapper is a directory
https://bugs.webkit.org/show_bug.cgi?id=188903
Summary [Cocoa] Exception (fileType 'dyn.agq8u' is not a valid UTI) raised when dragg...
mitz
Reported 2018-08-23 15:30:41 PDT
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
Attachments
Depends on webkit.org/b/188933 (45.14 KB, patch)
2018-08-26 00:04 PDT, Wenson Hsieh
no flags
Rebase on trunk (51.11 KB, patch)
2018-08-26 19:55 PDT, Wenson Hsieh
no flags
Rebase on trunk (108.07 KB, patch)
2018-08-27 09:56 PDT, Wenson Hsieh
thorton: review+
Patch for landing (63.45 KB, patch)
2018-08-27 12:36 PDT, Wenson Hsieh
no flags
mitz
Comment 1 2018-08-23 15:31:09 PDT
s/WebView/WKWebView/ in the description, of course.
Wenson Hsieh
Comment 2 2018-08-23 15:41:21 PDT
This is probably a result of failing to map kUTTypeFolder to a MIME type :(
Wenson Hsieh
Comment 3 2018-08-23 16:38:09 PDT
(I learned from thorton that RenderThemeMac.mm understands MIME types "multipart/x-folder" and "application/vnd.apple.folder")
Radar WebKit Bug Importer
Comment 4 2018-08-24 17:12:44 PDT
Wenson Hsieh
Comment 5 2018-08-24 18:55:07 PDT
Note: this is also reproducible when dropping a folder, or any file with an extension that WebKit doesn't recognize (e.g. *.crash).
Wenson Hsieh
Comment 6 2018-08-26 00:04:18 PDT
Wenson Hsieh
Comment 7 2018-08-26 19:55:36 PDT
Created attachment 348112 [details] Rebase on trunk
Wenson Hsieh
Comment 8 2018-08-27 09:56:27 PDT
Created attachment 348155 [details] Rebase on trunk
Tim Horton
Comment 9 2018-08-27 12:16:06 PDT
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.
Wenson Hsieh
Comment 10 2018-08-27 12:24:14 PDT
(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!
Wenson Hsieh
Comment 11 2018-08-27 12:36:13 PDT
Created attachment 348187 [details] Patch for landing
WebKit Commit Bot
Comment 12 2018-08-27 13:14:29 PDT
Comment on attachment 348187 [details] Patch for landing Clearing flags on attachment: 348187 Committed r235392: <https://trac.webkit.org/changeset/235392>
Note You need to log in before you can comment on or make changes to this bug.