WebKit Bugzilla
Attachment 373435 Details for
Bug 199480
: UI process exception when dragging an <attachment> with no content type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199480-20190703164356.patch (text/plain), 5.03 KB, created by
Tim Horton
on 2019-07-03 16:43:57 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2019-07-03 16:43:57 PDT
Size:
5.03 KB
patch
obsolete
>Subversion Revision: 247100 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index c81df1f881583d617bcbe7e56a7e2fd8502cb30c..64954eb4c945957ebf7e141cc07cc01aed3cac03 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2019-07-03 Tim Horton <timothy_horton@apple.com> >+ >+ UI process exception when dragging an <attachment> with no content type >+ https://bugs.webkit.org/show_bug.cgi?id=199480 >+ <rdar://problem/44351353> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/API/Cocoa/APIAttachmentCocoa.mm: >+ (API::Attachment::mimeType const): >+ (API::Attachment::utiType const): >+ * UIProcess/Cocoa/WebViewImpl.mm: >+ (WebKit::WebViewImpl::startDrag): >+ Make null or empty contentType fail the drag, instead of crashing. >+ > 2019-07-03 Zalan Bujtas <zalan@apple.com> > > [ContentChangeObserver] REGRESSION (r244356): Drop down menus collapse without user input - Ebay.com >diff --git a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm b/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >index 1653afe29e4e37e78f2ffc5b6d317333e0a82290..a0c1416a2dcd5a091130ff9cf577c1688da73308 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >@@ -70,6 +70,8 @@ void Attachment::invalidateGeneratedFileWrapper() > WTF::String Attachment::mimeType() const > { > NSString *contentType = m_contentType.isEmpty() ? mimeTypeInferredFromFileExtension(*this) : m_contentType; >+ if (!contentType.length) >+ return nullString(); > if (!isDeclaredOrDynamicTypeIdentifier(contentType)) > return contentType; > >@@ -79,6 +81,8 @@ WTF::String Attachment::mimeType() const > WTF::String Attachment::utiType() const > { > NSString *contentType = m_contentType.isEmpty() ? mimeTypeInferredFromFileExtension(*this) : m_contentType; >+ if (!contentType.length) >+ return nullString(); > if (isDeclaredOrDynamicTypeIdentifier(contentType)) > return contentType; > >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >index b9075386b556358c06cd5c27948c28d9afdac0aa..bfd43340337ad6ab425321820262c7f44f9db4d3 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >@@ -4125,6 +4125,11 @@ void WebViewImpl::startDrag(const WebCore::DragItem& item, const ShareableBitmap > fileName = attachment->fileName(); > } > >+ if (!utiType.length) { >+ m_page->dragCancelled(); >+ return; >+ } >+ > auto provider = adoptNS([[NSFilePromiseProvider alloc] initWithFileType:utiType delegate:(id <NSFilePromiseProviderDelegate>)m_view.getAutoreleased()]); > auto context = adoptNS([[WKPromisedAttachmentContext alloc] initWithIdentifier:info.attachmentIdentifier blobURL:info.blobURL fileName:fileName]); > [provider setUserInfo:context.get()]; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 8fb514c040e8b79e58f9a69aa66f178723b22714..eb009095060b900b021f29221f1a248d60e0cc0a 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,15 @@ >+2019-07-03 Tim Horton <timothy_horton@apple.com> >+ >+ UI process exception when dragging an <attachment> with no content type >+ https://bugs.webkit.org/show_bug.cgi?id=199480 >+ <rdar://problem/44351353> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: >+ (TestWebKitAPI::TEST): >+ Add a test; before the change, it crashes. >+ > 2019-07-03 Aakash Jain <aakash_jain@apple.com> > > Unreviewed follow-up fix to r247049, default the platform to '*' when platform property is not set. >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >index 5bb401884151e934c7ed917ee5360787a0ac5b99..3f98a5a2af71a407cc904083cd1fcc719bde75c8 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >@@ -1627,6 +1627,22 @@ TEST(WKAttachmentTestsMac, DragAttachmentAsFilePromise) > EXPECT_FALSE(isCompletelyTransparent([simulator draggingInfo].draggedImage)); > } > >+TEST(WKAttachmentTestsMac, DragAttachmentWithNoTypeShouldNotCrash) >+{ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ [configuration _setAttachmentElementEnabled:YES]; >+ auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebViewFrame:NSMakeRect(0, 0, 400, 400) configuration:configuration.get()]); >+ TestWKWebView *webView = [simulator webView]; >+ [webView synchronouslyLoadHTMLString:attachmentEditingTestMarkup]; >+ >+ [webView stringByEvaluatingJavaScript:@"document.body.appendChild(document.createElement('attachment')); 0"]; >+ >+ [simulator runFrom:[webView attachmentElementMidPoint] to:CGPointMake(300, 300)]; >+ >+ NSArray<NSURL *> *urls = [simulator receivePromisedFiles]; >+ EXPECT_EQ(0U, urls.count); >+} >+ > #endif // PLATFORM(MAC) > > #if PLATFORM(IOS_FAMILY)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199480
: 373435