WebKit Bugzilla
Attachment 371559 Details for
Bug 198641
: [iOS] At least 6 API tests are failing due to an exception when writing NSAttributedString to the pasteboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix open source build
bug-198641-20190606221817.patch (text/plain), 5.11 KB, created by
Wenson Hsieh
on 2019-06-06 22:18:17 PDT
(
hide
)
Description:
Fix open source build
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-06-06 22:18:17 PDT
Size:
5.11 KB
patch
obsolete
>Subversion Revision: 246186 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 7ff805d0138e7bcedf0c2899e96b187dae9bdbae..b7156c2e430d3589ce6a4af8e709aa1aa98e9b9e 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,28 @@ >+2019-06-06 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] At least 6 API tests are failing due to an exception when writing NSAttributedString to the pasteboard >+ https://bugs.webkit.org/show_bug.cgi?id=198641 >+ <rdar://problem/51266310> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Work around a bug in a lower-level framework, which currently prevents NSAttributedStrings from being written to >+ UIPasteboard by way of -[NSItemProvider registerObject:visibility:]. This is because, when saving a >+ representation of "public.rtfd" to disk, the default suggested filename (determined using CoreServices APIs >+ _UTTypeCreateSuggestedFilename and UTTypeCopyDescription) ends up being nil; UIKit then subsequently tries to >+ append nil as a path component using -URLByAppendingPathComponent:, which throws an exception. This only >+ reproduces on iOS simulator. >+ >+ To work around this for the time being, simply avoid writing a representation of "public.rtfd" to disk. This >+ representation is actually ignored by most clients anyways (including WebKit), in favor of using >+ "com.apple.flat-rtfd". >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: >+ (TestWebKitAPI::TEST): >+ * TestWebKitAPI/cocoa/TestWKWebView.mm: >+ (applyWorkaroundToAllowWritingAttributedStringsToItemProviders): >+ (-[TestWKWebView initWithFrame:configuration:addToWindow:]): >+ > 2019-06-06 Keith Rollin <krollin@apple.com> > > Remove SSL-based tests from TestWebKitAPI on some configurations >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >index feb8e1ca47bd895d76a001c178976d40e1cad4b0..7d8aa96087df330c0678247e7d1db1c5dc255023 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >@@ -1010,10 +1010,10 @@ TEST(WKAttachmentTests, MovePastedImageByDragging) > > TEST(WKAttachmentTests, InsertPastedAttributedStringContainingImage) > { >+ auto webView = webViewForTestingAttachments(); > platformCopyRichTextWithImage(); > > RetainPtr<_WKAttachment> attachment; >- auto webView = webViewForTestingAttachments(); > { > ObserveAttachmentUpdatesForScope observer(webView.get()); > [webView _synchronouslyExecuteEditCommand:@"Paste" argument:nil]; >@@ -1036,12 +1036,12 @@ TEST(WKAttachmentTests, InsertPastedAttributedStringContainingImage) > > TEST(WKAttachmentTests, InsertPastedAttributedStringContainingMultipleAttachments) > { >+ auto webView = webViewForTestingAttachments(); > platformCopyRichTextWithMultipleAttachments(); > > RetainPtr<_WKAttachment> imageAttachment; > RetainPtr<_WKAttachment> zipAttachment; > RetainPtr<_WKAttachment> pdfAttachment; >- auto webView = webViewForTestingAttachments(); > { > ObserveAttachmentUpdatesForScope observer(webView.get()); > [webView _synchronouslyExecuteEditCommand:@"Paste" argument:nil]; >diff --git a/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm b/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm >index 8a2dd01e932a5ed19f7802487a141ceea6e4037c..34b31126ff07f657fcf612b6ada5f181e241608d 100644 >--- a/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm >+++ b/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm >@@ -45,6 +45,7 @@ > > #if PLATFORM(IOS_FAMILY) > #import "UIKitSPI.h" >+#import <MobileCoreServices/MobileCoreServices.h> > #import <wtf/SoftLinking.h> > SOFT_LINK_FRAMEWORK(UIKit) > SOFT_LINK_CLASS(UIKit, UIWindow) >@@ -272,6 +273,25 @@ @end > > #if PLATFORM(IOS_FAMILY) > >+static NSArray<NSString *> *writableTypeIdentifiersForItemProviderWithoutPublicRTFD() >+{ >+ return @[ >+ @"com.apple.uikit.attributedstring", >+ (__bridge NSString *)kUTTypeFlatRTFD, >+ (__bridge NSString *)kUTTypeUTF8PlainText, >+ ]; >+} >+ >+static void applyWorkaroundToAllowWritingAttributedStringsToItemProviders() >+{ >+ // FIXME: Remove this once <rdar://problem/51510554> is fixed. >+ static std::unique_ptr<ClassMethodSwizzler> swizzler; >+ static dispatch_once_t onceToken; >+ dispatch_once(&onceToken, ^{ >+ swizzler = std::make_unique<ClassMethodSwizzler>(NSAttributedString.class, @selector(writableTypeIdentifiersForItemProvider), reinterpret_cast<IMP>(writableTypeIdentifiersForItemProviderWithoutPublicRTFD)); >+ }); >+} >+ > using InputSessionChangeCount = NSUInteger; > static InputSessionChangeCount nextInputSessionChangeCount() > { >@@ -323,6 +343,7 @@ - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguratio > // FIXME: Remove this workaround once <https://webkit.org/b/175204> is fixed. > _sharedCalloutBarSwizzler = std::make_unique<ClassMethodSwizzler>([UICalloutBar class], @selector(sharedCalloutBar), reinterpret_cast<IMP>(suppressUICalloutBar)); > _inputSessionChangeCount = 0; >+ applyWorkaroundToAllowWritingAttributedStringsToItemProviders(); > #endif > > return self;
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 198641
:
371558
| 371559