Changeset 219128 in webkit
- Timestamp:
- Jul 5, 2017, 8:59:45 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/PlatformPasteboard.h (modified) (1 diff)
-
Source/WebCore/platform/ios/AbstractPasteboard.h (modified) (1 diff)
-
Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (modified) (3 diffs)
-
Source/WebCore/platform/ios/WebItemProviderPasteboard.h (modified) (1 diff)
-
Source/WebCore/platform/ios/WebItemProviderPasteboard.mm (modified) (1 diff)
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r219127 r219128 1 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219070. 4 5 This revision caused consistent failures of the API test 6 UIPasteboardTests.DoNotPastePlainTextAsURL on iOS. 7 8 Reverted changeset: 9 10 "Pasting single words copied to UIPasteboard inserts URLs in 11 editable areas" 12 https://bugs.webkit.org/show_bug.cgi?id=174082 13 http://trac.webkit.org/changeset/219070 14 1 15 2017-07-05 Youenn Fablet <youenn@apple.com> 2 16 -
trunk/Source/WebCore/platform/PlatformPasteboard.h
r219070 r219128 103 103 WEBCORE_EXPORT void writeObjectRepresentations(const String& pasteboardType, const String& text); 104 104 WEBCORE_EXPORT void writeObjectRepresentations(const PasteboardURL&); 105 bool allowReadingURLAtIndex(const URL&, int index) const;106 105 #endif 107 106 -
trunk/Source/WebCore/platform/ios/AbstractPasteboard.h
r219070 r219128 35 35 @property (readonly, nonatomic) NSInteger numberOfItems; 36 36 37 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 11000038 @property (nonatomic, copy, nullable) NSArray<__kindof NSItemProvider *> *itemProviders;39 #endif40 41 37 - (NSArray<NSString *> *)pasteboardTypes; 42 38 - (NSArray *)dataForPasteboardType:(NSString *)pasteboardType inItemSet:(NSIndexSet *)itemSet; -
trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
r219070 r219128 216 216 } 217 217 218 bool PlatformPasteboard::allowReadingURLAtIndex(const URL& url, int index) const219 {220 NSItemProvider *itemProvider = (NSUInteger)index < [m_pasteboard itemProviders].count ? [[m_pasteboard itemProviders] objectAtIndex:index] : nil;221 for (NSString *type in itemProvider.registeredTypeIdentifiers) {222 if (UTTypeConformsTo((CFStringRef)type, kUTTypeURL))223 return true;224 }225 226 return url.isValid();227 }228 229 #else230 231 bool PlatformPasteboard::allowReadingURLAtIndex(const URL&, int) const232 {233 return true;234 }235 236 218 #endif 237 219 … … 445 427 } else if (type == String(kUTTypeURL)) { 446 428 ASSERT([value isKindOfClass:[NSURL class]]); 447 if ([value isKindOfClass:[NSURL class]] && allowReadingURLAtIndex((NSURL *)value, index))429 if ([value isKindOfClass:[NSURL class]]) 448 430 return [(NSURL *)value absoluteString]; 449 431 } … … 466 448 return URL(); 467 449 468 if (!allowReadingURLAtIndex((NSURL *)value, index))469 return { };470 471 450 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000 472 451 title = [value _title]; -
trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.h
r219070 r219128 80 80 - (UIItemProvider *)itemProviderAtIndex:(NSUInteger)index; 81 81 82 @property (copy, nonatomic, nullable) NSArray< __kindof NSItemProvider *> *itemProviders;82 @property (copy, nonatomic, nullable) NSArray<UIItemProvider *> *itemProviders; 83 83 @property (readonly, nonatomic) NSInteger numberOfItems; 84 84 @property (readonly, nonatomic) NSInteger changeCount; -
trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm
r219070 r219128 223 223 } 224 224 225 - (NSArray< __kindof NSItemProvider *> *)itemProviders225 - (NSArray<UIItemProvider *> *)itemProviders 226 226 { 227 227 return _itemProviders.get(); 228 228 } 229 229 230 - (void)setItemProviders:(NSArray< __kindof NSItemProvider *> *)itemProviders230 - (void)setItemProviders:(NSArray<UIItemProvider *> *)itemProviders 231 231 { 232 232 itemProviders = itemProviders ?: [NSArray array]; -
trunk/Source/WebKit2/ChangeLog
r219126 r219128 1 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219070. 4 5 This revision caused consistent failures of the API test 6 UIPasteboardTests.DoNotPastePlainTextAsURL on iOS. 7 8 Reverted changeset: 9 10 "Pasting single words copied to UIPasteboard inserts URLs in 11 editable areas" 12 https://bugs.webkit.org/show_bug.cgi?id=174082 13 http://trac.webkit.org/changeset/219070 14 1 15 2017-07-05 Zan Dobersek <zdobersek@igalia.com> 2 16 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
r219070 r219128 628 628 } 629 629 630 - (void)_setDOMPasteAllowed:(BOOL)domPasteAllowed631 {632 _preferences->setDOMPasteAllowed(domPasteAllowed);633 }634 635 - (BOOL)_domPasteAllowed636 {637 return _preferences->domPasteAllowed();638 }639 640 630 - (void)_setMediaDocumentEntersFullscreenAutomatically:(BOOL)mediaDocumentEntersFullscreenAutomatically 641 631 { -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
r219070 r219128 108 108 109 109 @property (nonatomic, setter=_setJavaScriptCanAccessClipboard:) BOOL _javaScriptCanAccessClipboard WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 110 @property (nonatomic, setter=_setDOMPasteAllowed:) BOOL _domPasteAllowed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));111 110 112 111 @property (nonatomic, setter=_setMediaDocumentEntersFullscreenAutomatically:) BOOL _mediaDocumentEntersFullscreenAutomatically WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Tools/ChangeLog
r219122 r219128 1 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219070. 4 5 This revision caused consistent failures of the API test 6 UIPasteboardTests.DoNotPastePlainTextAsURL on iOS. 7 8 Reverted changeset: 9 10 "Pasting single words copied to UIPasteboard inserts URLs in 11 editable areas" 12 https://bugs.webkit.org/show_bug.cgi?id=174082 13 http://trac.webkit.org/changeset/219070 14 1 15 2017-07-04 Michael Catanzaro <mcatanzaro@igalia.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm
r219070 r219128 32 32 #import <MobileCoreServices/MobileCoreServices.h> 33 33 #import <UIKit/UIPasteboard.h> 34 #import <WebCore/SoftLinking.h>35 34 #import <WebKit/WKPreferencesPrivate.h> 36 35 #import <WebKit/WKWebViewPrivate.h> 37 38 SOFT_LINK_FRAMEWORK(UIKit)39 SOFT_LINK(UIKit, UIApplicationInitialize, void, (void), ())40 36 41 37 namespace TestWebKitAPI { … … 48 44 RetainPtr<TestWKWebView> setUpWebViewForPasteboardTests() 49 45 { 50 // UIPasteboard's type coercion codepaths only take effect when the UIApplication has been initialized.51 UIApplicationInitialize();52 53 46 [UIPasteboard generalPasteboard].items = @[]; 54 47 EXPECT_TRUE(!dataForPasteboardType(kUTTypeUTF8PlainText).length); … … 56 49 57 50 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 58 WKPreferences *preferences = [webView configuration].preferences; 59 preferences._javaScriptCanAccessClipboard = YES; 60 preferences._domPasteAllowed = YES; 51 [webView configuration].preferences._javaScriptCanAccessClipboard = YES; 61 52 [webView synchronouslyLoadTestPageNamed:@"rich-and-plain-text"]; 62 53 return webView; … … 87 78 } 88 79 89 TEST(UIPasteboardTests, DoNotPastePlainTextAsURL)90 {91 auto webView = setUpWebViewForPasteboardTests();92 93 NSString *testString = @"[helloworld]";94 [UIPasteboard generalPasteboard].string = testString;95 96 [webView stringByEvaluatingJavaScript:@"selectPlainText()"];97 [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];98 EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"plain.value"]);99 100 [webView stringByEvaluatingJavaScript:@"selectRichText()"];101 [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];102 EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"rich.textContent"]);103 EXPECT_FALSE([webView stringByEvaluatingJavaScript:@"!!rich.querySelector('a')"].boolValue);104 }105 106 TEST(UIPasteboardTests, PastePlainTextAsURL)107 {108 auto webView = setUpWebViewForPasteboardTests();109 110 NSString *testString = @"https://www.apple.com/iphone";111 [UIPasteboard generalPasteboard].string = testString;112 113 [webView stringByEvaluatingJavaScript:@"selectPlainText()"];114 [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];115 EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"plain.value"]);116 117 [webView stringByEvaluatingJavaScript:@"selectRichText()"];118 [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];119 EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"rich.textContent"]);120 EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"!!rich.querySelector('a')"].boolValue);121 }122 123 TEST(UIPasteboardTests, PasteURLWithPlainTextAsURL)124 {125 auto webView = setUpWebViewForPasteboardTests();126 127 NSString *testString = @"thisisdefinitelyaurl";128 [UIPasteboard generalPasteboard].URL = [NSURL URLWithString:testString];129 130 [webView stringByEvaluatingJavaScript:@"selectPlainText()"];131 [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];132 EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"plain.value"]);133 134 [webView stringByEvaluatingJavaScript:@"selectRichText()"];135 [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];136 EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"rich.textContent"]);137 EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"!!rich.querySelector('a')"].boolValue);138 }139 140 80 } // namespace TestWebKitAPI 141 81
Note:
See TracChangeset
for help on using the changeset viewer.