Changeset 219129 in webkit
- Timestamp:
- Jul 5, 2017, 9:07:27 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
r219128 r219129 1 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219128. 4 5 Spoke with engineer who originally submitted, Patch for APi 6 test to follow. 7 8 Reverted changeset: 9 10 "Unreviewed, rolling out r219070." 11 https://bugs.webkit.org/show_bug.cgi?id=174082 12 http://trac.webkit.org/changeset/219128 13 1 14 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 15 -
trunk/Source/WebCore/platform/PlatformPasteboard.h
r219128 r219129 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; 105 106 #endif 106 107 -
trunk/Source/WebCore/platform/ios/AbstractPasteboard.h
r219128 r219129 35 35 @property (readonly, nonatomic) NSInteger numberOfItems; 36 36 37 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000 38 @property (nonatomic, copy, nullable) NSArray<__kindof NSItemProvider *> *itemProviders; 39 #endif 40 37 41 - (NSArray<NSString *> *)pasteboardTypes; 38 42 - (NSArray *)dataForPasteboardType:(NSString *)pasteboardType inItemSet:(NSIndexSet *)itemSet; -
trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
r219128 r219129 216 216 } 217 217 218 bool PlatformPasteboard::allowReadingURLAtIndex(const URL& url, int index) const 219 { 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 #else 230 231 bool PlatformPasteboard::allowReadingURLAtIndex(const URL&, int) const 232 { 233 return true; 234 } 235 218 236 #endif 219 237 … … 427 445 } else if (type == String(kUTTypeURL)) { 428 446 ASSERT([value isKindOfClass:[NSURL class]]); 429 if ([value isKindOfClass:[NSURL class]] )447 if ([value isKindOfClass:[NSURL class]] && allowReadingURLAtIndex((NSURL *)value, index)) 430 448 return [(NSURL *)value absoluteString]; 431 449 } … … 448 466 return URL(); 449 467 468 if (!allowReadingURLAtIndex((NSURL *)value, index)) 469 return { }; 470 450 471 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000 451 472 title = [value _title]; -
trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.h
r219128 r219129 80 80 - (UIItemProvider *)itemProviderAtIndex:(NSUInteger)index; 81 81 82 @property (copy, nonatomic, nullable) NSArray< UIItemProvider *> *itemProviders;82 @property (copy, nonatomic, nullable) NSArray<__kindof NSItemProvider *> *itemProviders; 83 83 @property (readonly, nonatomic) NSInteger numberOfItems; 84 84 @property (readonly, nonatomic) NSInteger changeCount; -
trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm
r219128 r219129 223 223 } 224 224 225 - (NSArray< UIItemProvider *> *)itemProviders225 - (NSArray<__kindof NSItemProvider *> *)itemProviders 226 226 { 227 227 return _itemProviders.get(); 228 228 } 229 229 230 - (void)setItemProviders:(NSArray< UIItemProvider *> *)itemProviders230 - (void)setItemProviders:(NSArray<__kindof NSItemProvider *> *)itemProviders 231 231 { 232 232 itemProviders = itemProviders ?: [NSArray array]; -
trunk/Source/WebKit2/ChangeLog
r219128 r219129 1 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219128. 4 5 Spoke with engineer who originally submitted, Patch for APi 6 test to follow. 7 8 Reverted changeset: 9 10 "Unreviewed, rolling out r219070." 11 https://bugs.webkit.org/show_bug.cgi?id=174082 12 http://trac.webkit.org/changeset/219128 13 1 14 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 15 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
r219128 r219129 628 628 } 629 629 630 - (void)_setDOMPasteAllowed:(BOOL)domPasteAllowed 631 { 632 _preferences->setDOMPasteAllowed(domPasteAllowed); 633 } 634 635 - (BOOL)_domPasteAllowed 636 { 637 return _preferences->domPasteAllowed(); 638 } 639 630 640 - (void)_setMediaDocumentEntersFullscreenAutomatically:(BOOL)mediaDocumentEntersFullscreenAutomatically 631 641 { -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
r219128 r219129 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)); 110 111 111 112 @property (nonatomic, setter=_setMediaDocumentEntersFullscreenAutomatically:) BOOL _mediaDocumentEntersFullscreenAutomatically WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Tools/ChangeLog
r219128 r219129 1 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r219128. 4 5 Spoke with engineer who originally submitted, Patch for APi 6 test to follow. 7 8 Reverted changeset: 9 10 "Unreviewed, rolling out r219070." 11 https://bugs.webkit.org/show_bug.cgi?id=174082 12 http://trac.webkit.org/changeset/219128 13 1 14 2017-07-05 Matt Lewis <jlewis3@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm
r219128 r219129 32 32 #import <MobileCoreServices/MobileCoreServices.h> 33 33 #import <UIKit/UIPasteboard.h> 34 #import <WebCore/SoftLinking.h> 34 35 #import <WebKit/WKPreferencesPrivate.h> 35 36 #import <WebKit/WKWebViewPrivate.h> 37 38 SOFT_LINK_FRAMEWORK(UIKit) 39 SOFT_LINK(UIKit, UIApplicationInitialize, void, (void), ()) 36 40 37 41 namespace TestWebKitAPI { … … 44 48 RetainPtr<TestWKWebView> setUpWebViewForPasteboardTests() 45 49 { 50 // UIPasteboard's type coercion codepaths only take effect when the UIApplication has been initialized. 51 UIApplicationInitialize(); 52 46 53 [UIPasteboard generalPasteboard].items = @[]; 47 54 EXPECT_TRUE(!dataForPasteboardType(kUTTypeUTF8PlainText).length); … … 49 56 50 57 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 51 [webView configuration].preferences._javaScriptCanAccessClipboard = YES; 58 WKPreferences *preferences = [webView configuration].preferences; 59 preferences._javaScriptCanAccessClipboard = YES; 60 preferences._domPasteAllowed = YES; 52 61 [webView synchronouslyLoadTestPageNamed:@"rich-and-plain-text"]; 53 62 return webView; … … 78 87 } 79 88 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 80 140 } // namespace TestWebKitAPI 81 141
Note:
See TracChangeset
for help on using the changeset viewer.