Changeset 246198 in webkit
- Timestamp:
- Jun 7, 2019 7:42:56 AM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r246189 r246198 1 2019-06-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] At least 6 API tests are failing due to an exception when writing NSAttributedString to the pasteboard 4 https://bugs.webkit.org/show_bug.cgi?id=198641 5 <rdar://problem/51266310> 6 7 Reviewed by Tim Horton. 8 9 Work around a bug in a lower-level framework, which currently prevents NSAttributedStrings from being written to 10 UIPasteboard by way of -[NSItemProvider registerObject:visibility:]. This is because, when saving a 11 representation of "public.rtfd" to disk, the default suggested filename (determined using CoreServices APIs 12 _UTTypeCreateSuggestedFilename and UTTypeCopyDescription) ends up being nil; UIKit then subsequently tries to 13 append nil as a path component using -URLByAppendingPathComponent:, which throws an exception. This only 14 reproduces on iOS simulator. 15 16 To work around this for the time being, simply avoid writing a representation of "public.rtfd" to disk. This 17 representation is actually ignored by most clients anyways (including WebKit), in favor of using 18 "com.apple.flat-rtfd". 19 20 * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: 21 (TestWebKitAPI::TEST): 22 * TestWebKitAPI/cocoa/TestWKWebView.mm: 23 (applyWorkaroundToAllowWritingAttributedStringsToItemProviders): 24 (-[TestWKWebView initWithFrame:configuration:addToWindow:]): 25 1 26 2019-06-06 Carlos Garcia Campos <cgarcia@igalia.com> 2 27 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm
r245839 r246198 1011 1011 TEST(WKAttachmentTests, InsertPastedAttributedStringContainingImage) 1012 1012 { 1013 auto webView = webViewForTestingAttachments(); 1013 1014 platformCopyRichTextWithImage(); 1014 1015 1015 1016 RetainPtr<_WKAttachment> attachment; 1016 auto webView = webViewForTestingAttachments();1017 1017 { 1018 1018 ObserveAttachmentUpdatesForScope observer(webView.get()); … … 1037 1037 TEST(WKAttachmentTests, InsertPastedAttributedStringContainingMultipleAttachments) 1038 1038 { 1039 auto webView = webViewForTestingAttachments(); 1039 1040 platformCopyRichTextWithMultipleAttachments(); 1040 1041 … … 1042 1043 RetainPtr<_WKAttachment> zipAttachment; 1043 1044 RetainPtr<_WKAttachment> pdfAttachment; 1044 auto webView = webViewForTestingAttachments();1045 1045 { 1046 1046 ObserveAttachmentUpdatesForScope observer(webView.get()); -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
r244955 r246198 46 46 #if PLATFORM(IOS_FAMILY) 47 47 #import "UIKitSPI.h" 48 #import <MobileCoreServices/MobileCoreServices.h> 48 49 #import <wtf/SoftLinking.h> 49 50 SOFT_LINK_FRAMEWORK(UIKit) … … 273 274 #if PLATFORM(IOS_FAMILY) 274 275 276 static NSArray<NSString *> *writableTypeIdentifiersForItemProviderWithoutPublicRTFD() 277 { 278 return @[ 279 @"com.apple.uikit.attributedstring", 280 (__bridge NSString *)kUTTypeFlatRTFD, 281 (__bridge NSString *)kUTTypeUTF8PlainText, 282 ]; 283 } 284 285 static void applyWorkaroundToAllowWritingAttributedStringsToItemProviders() 286 { 287 // FIXME: Remove this once <rdar://problem/51510554> is fixed. 288 static std::unique_ptr<ClassMethodSwizzler> swizzler; 289 static dispatch_once_t onceToken; 290 dispatch_once(&onceToken, ^{ 291 swizzler = std::make_unique<ClassMethodSwizzler>(NSAttributedString.class, @selector(writableTypeIdentifiersForItemProvider), reinterpret_cast<IMP>(writableTypeIdentifiersForItemProviderWithoutPublicRTFD)); 292 }); 293 } 294 275 295 using InputSessionChangeCount = NSUInteger; 276 296 static InputSessionChangeCount nextInputSessionChangeCount() … … 324 344 _sharedCalloutBarSwizzler = std::make_unique<ClassMethodSwizzler>([UICalloutBar class], @selector(sharedCalloutBar), reinterpret_cast<IMP>(suppressUICalloutBar)); 325 345 _inputSessionChangeCount = 0; 346 applyWorkaroundToAllowWritingAttributedStringsToItemProviders(); 326 347 #endif 327 348
Note: See TracChangeset
for help on using the changeset viewer.