Unreviewed, rolling out r219070.
authorjlewis3@apple.com <jlewis3@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jul 2017 15:59:45 +0000 (15:59 +0000)
committerjlewis3@apple.com <jlewis3@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jul 2017 15:59:45 +0000 (15:59 +0000)
This revision caused consistent failures of the API test
UIPasteboardTests.DoNotPastePlainTextAsURL on iOS.

Reverted changeset:

"Pasting single words copied to UIPasteboard inserts URLs in
editable areas"
https://bugs.webkit.org/show_bug.cgi?id=174082
http://trac.webkit.org/changeset/219070

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219128 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/PlatformPasteboard.h
Source/WebCore/platform/ios/AbstractPasteboard.h
Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
Source/WebCore/platform/ios/WebItemProviderPasteboard.h
Source/WebCore/platform/ios/WebItemProviderPasteboard.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm

index 68c5bae..fecd51e 100644 (file)
@@ -1,3 +1,17 @@
+2017-07-05  Matt Lewis  <jlewis3@apple.com>
+
+        Unreviewed, rolling out r219070.
+
+        This revision caused consistent failures of the API test
+        UIPasteboardTests.DoNotPastePlainTextAsURL on iOS.
+
+        Reverted changeset:
+
+        "Pasting single words copied to UIPasteboard inserts URLs in
+        editable areas"
+        https://bugs.webkit.org/show_bug.cgi?id=174082
+        http://trac.webkit.org/changeset/219070
+
 2017-07-05  Youenn Fablet  <youenn@apple.com>
 
         Receiving tracks should be ended when peer connection is being closed
index 700e428..f4439de 100644 (file)
@@ -102,7 +102,6 @@ private:
     WEBCORE_EXPORT void writeObjectRepresentations(const PasteboardImage&);
     WEBCORE_EXPORT void writeObjectRepresentations(const String& pasteboardType, const String& text);
     WEBCORE_EXPORT void writeObjectRepresentations(const PasteboardURL&);
-    bool allowReadingURLAtIndex(const URL&, int index) const;
 #endif
 
 #if PLATFORM(MAC)
index a413075..b744fe2 100644 (file)
@@ -34,10 +34,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (readonly, nonatomic) NSInteger numberOfItems;
 
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
-@property (nonatomic, copy, nullable) NSArray<__kindof NSItemProvider *> *itemProviders;
-#endif
-
 - (NSArray<NSString *> *)pasteboardTypes;
 - (NSArray *)dataForPasteboardType:(NSString *)pasteboardType inItemSet:(NSIndexSet *)itemSet;
 - (NSArray *)valuesForPasteboardType:(NSString *)pasteboardType inItemSet:(NSIndexSet *)itemSet;
index 0da7038..5b87ed6 100644 (file)
@@ -215,24 +215,6 @@ static void addRepresentationsForPlainText(WebItemProviderRegistrationInfoList *
     [itemsToRegister addData:[(NSString *)plainText dataUsingEncoding:NSUTF8StringEncoding] forType:(NSString *)kUTTypeUTF8PlainText];
 }
 
-bool PlatformPasteboard::allowReadingURLAtIndex(const URL& url, int index) const
-{
-    NSItemProvider *itemProvider = (NSUInteger)index < [m_pasteboard itemProviders].count ? [[m_pasteboard itemProviders] objectAtIndex:index] : nil;
-    for (NSString *type in itemProvider.registeredTypeIdentifiers) {
-        if (UTTypeConformsTo((CFStringRef)type, kUTTypeURL))
-            return true;
-    }
-
-    return url.isValid();
-}
-
-#else
-
-bool PlatformPasteboard::allowReadingURLAtIndex(const URL&, int) const
-{
-    return true;
-}
-
 #endif
 
 void PlatformPasteboard::writeObjectRepresentations(const PasteboardWebContent& content)
@@ -444,7 +426,7 @@ String PlatformPasteboard::readString(int index, const String& type)
             return [(NSAttributedString *)value string];
     } else if (type == String(kUTTypeURL)) {
         ASSERT([value isKindOfClass:[NSURL class]]);
-        if ([value isKindOfClass:[NSURL class]] && allowReadingURLAtIndex((NSURL *)value, index))
+        if ([value isKindOfClass:[NSURL class]])
             return [(NSURL *)value absoluteString];
     }
 
@@ -465,9 +447,6 @@ URL PlatformPasteboard::readURL(int index, const String& type, String& title)
     if (![value isKindOfClass:[NSURL class]])
         return URL();
 
-    if (!allowReadingURLAtIndex((NSURL *)value, index))
-        return { };
-
 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
     title = [value _title];
 #else
index 3048371..9f302fd 100644 (file)
@@ -79,7 +79,7 @@ WEBCORE_EXPORT @interface WebItemProviderPasteboard : NSObject<AbstractPasteboar
 - (WebItemProviderRegistrationInfoList *)registrationInfoAtIndex:(NSUInteger)index;
 - (UIItemProvider *)itemProviderAtIndex:(NSUInteger)index;
 
-@property (copy, nonatomic, nullable) NSArray<__kindof NSItemProvider *> *itemProviders;
+@property (copy, nonatomic, nullable) NSArray<UIItemProvider *> *itemProviders;
 @property (readonly, nonatomic) NSInteger numberOfItems;
 @property (readonly, nonatomic) NSInteger changeCount;
 
index 8d4e62e..a4dd0c6 100644 (file)
@@ -222,12 +222,12 @@ typedef NSDictionary<NSString *, NSURL *> TypeToFileURLMap;
     return _cachedTypeIdentifiers.get();
 }
 
-- (NSArray<__kindof NSItemProvider *> *)itemProviders
+- (NSArray<UIItemProvider *> *)itemProviders
 {
     return _itemProviders.get();
 }
 
-- (void)setItemProviders:(NSArray<__kindof NSItemProvider *> *)itemProviders
+- (void)setItemProviders:(NSArray<UIItemProvider *> *)itemProviders
 {
     itemProviders = itemProviders ?: [NSArray array];
     if (_itemProviders == itemProviders || [_itemProviders isEqualToArray:itemProviders])
index db00179..63fb340 100644 (file)
@@ -1,3 +1,17 @@
+2017-07-05  Matt Lewis  <jlewis3@apple.com>
+
+        Unreviewed, rolling out r219070.
+
+        This revision caused consistent failures of the API test
+        UIPasteboardTests.DoNotPastePlainTextAsURL on iOS.
+
+        Reverted changeset:
+
+        "Pasting single words copied to UIPasteboard inserts URLs in
+        editable areas"
+        https://bugs.webkit.org/show_bug.cgi?id=174082
+        http://trac.webkit.org/changeset/219070
+
 2017-07-05  Zan Dobersek  <zdobersek@igalia.com>
 
         [GLib] Incorrect <glib/gi18n.h> include in WebKitWebsiteData
index 48c1577..e28a5cf 100644 (file)
@@ -627,16 +627,6 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     return _preferences->javaScriptCanAccessClipboard();
 }
 
-- (void)_setDOMPasteAllowed:(BOOL)domPasteAllowed
-{
-    _preferences->setDOMPasteAllowed(domPasteAllowed);
-}
-
-- (BOOL)_domPasteAllowed
-{
-    return _preferences->domPasteAllowed();
-}
-
 - (void)_setMediaDocumentEntersFullscreenAutomatically:(BOOL)mediaDocumentEntersFullscreenAutomatically
 {
     _preferences->setMediaDocumentEntersFullscreenAutomatically(mediaDocumentEntersFullscreenAutomatically);
index 19295d6..0dcc409 100644 (file)
@@ -107,7 +107,6 @@ typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
 @property (nonatomic, setter=_setWebRTCLegacyAPIEnabled:) BOOL _webRTCLegacyAPIEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic, setter=_setJavaScriptCanAccessClipboard:) BOOL _javaScriptCanAccessClipboard WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
-@property (nonatomic, setter=_setDOMPasteAllowed:) BOOL _domPasteAllowed WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic, setter=_setMediaDocumentEntersFullscreenAutomatically:) BOOL _mediaDocumentEntersFullscreenAutomatically WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
index 4dd0e85..ab41c73 100644 (file)
@@ -1,3 +1,17 @@
+2017-07-05  Matt Lewis  <jlewis3@apple.com>
+
+        Unreviewed, rolling out r219070.
+
+        This revision caused consistent failures of the API test
+        UIPasteboardTests.DoNotPastePlainTextAsURL on iOS.
+
+        Reverted changeset:
+
+        "Pasting single words copied to UIPasteboard inserts URLs in
+        editable areas"
+        https://bugs.webkit.org/show_bug.cgi?id=174082
+        http://trac.webkit.org/changeset/219070
+
 2017-07-04  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Remove unused EFL logo from bot watcher dashboard
index 1d33ac6..c3adebb 100644 (file)
 #import "TestWKWebView.h"
 #import <MobileCoreServices/MobileCoreServices.h>
 #import <UIKit/UIPasteboard.h>
-#import <WebCore/SoftLinking.h>
 #import <WebKit/WKPreferencesPrivate.h>
 #import <WebKit/WKWebViewPrivate.h>
 
-SOFT_LINK_FRAMEWORK(UIKit)
-SOFT_LINK(UIKit, UIApplicationInitialize, void, (void), ())
-
 namespace TestWebKitAPI {
 
 NSData *dataForPasteboardType(CFStringRef type)
@@ -47,17 +43,12 @@ NSData *dataForPasteboardType(CFStringRef type)
 
 RetainPtr<TestWKWebView> setUpWebViewForPasteboardTests()
 {
-    // UIPasteboard's type coercion codepaths only take effect when the UIApplication has been initialized.
-    UIApplicationInitialize();
-
     [UIPasteboard generalPasteboard].items = @[];
     EXPECT_TRUE(!dataForPasteboardType(kUTTypeUTF8PlainText).length);
     EXPECT_TRUE(!dataForPasteboardType(kUTTypeUTF16PlainText).length);
 
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
-    WKPreferences *preferences = [webView configuration].preferences;
-    preferences._javaScriptCanAccessClipboard = YES;
-    preferences._domPasteAllowed = YES;
+    [webView configuration].preferences._javaScriptCanAccessClipboard = YES;
     [webView synchronouslyLoadTestPageNamed:@"rich-and-plain-text"];
     return webView;
 }
@@ -86,57 +77,6 @@ TEST(UIPasteboardTests, CopyRichTextWritesConcreteTypes)
     EXPECT_WK_STREQ("Hello world", [utf16Result UTF8String]);
 }
 
-TEST(UIPasteboardTests, DoNotPastePlainTextAsURL)
-{
-    auto webView = setUpWebViewForPasteboardTests();
-
-    NSString *testString = @"[helloworld]";
-    [UIPasteboard generalPasteboard].string = testString;
-
-    [webView stringByEvaluatingJavaScript:@"selectPlainText()"];
-    [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];
-    EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"plain.value"]);
-
-    [webView stringByEvaluatingJavaScript:@"selectRichText()"];
-    [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];
-    EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"rich.textContent"]);
-    EXPECT_FALSE([webView stringByEvaluatingJavaScript:@"!!rich.querySelector('a')"].boolValue);
-}
-
-TEST(UIPasteboardTests, PastePlainTextAsURL)
-{
-    auto webView = setUpWebViewForPasteboardTests();
-
-    NSString *testString = @"https://www.apple.com/iphone";
-    [UIPasteboard generalPasteboard].string = testString;
-
-    [webView stringByEvaluatingJavaScript:@"selectPlainText()"];
-    [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];
-    EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"plain.value"]);
-
-    [webView stringByEvaluatingJavaScript:@"selectRichText()"];
-    [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];
-    EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"rich.textContent"]);
-    EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"!!rich.querySelector('a')"].boolValue);
-}
-
-TEST(UIPasteboardTests, PasteURLWithPlainTextAsURL)
-{
-    auto webView = setUpWebViewForPasteboardTests();
-
-    NSString *testString = @"thisisdefinitelyaurl";
-    [UIPasteboard generalPasteboard].URL = [NSURL URLWithString:testString];
-
-    [webView stringByEvaluatingJavaScript:@"selectPlainText()"];
-    [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];
-    EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"plain.value"]);
-
-    [webView stringByEvaluatingJavaScript:@"selectRichText()"];
-    [webView stringByEvaluatingJavaScript:@"document.execCommand('paste')"];
-    EXPECT_WK_STREQ(testString, [webView stringByEvaluatingJavaScript:@"rich.textContent"]);
-    EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"!!rich.querySelector('a')"].boolValue);
-}
-
 } // namespace TestWebKitAPI
 
 #endif