⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 219128 in webkit


Ignore:
Timestamp:
Jul 5, 2017, 8:59:45 AM (9 years ago)
Author:
Matt Lewis
Message:

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

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r219127 r219128  
     12017-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
    1152017-07-05  Youenn Fablet  <youenn@apple.com>
    216
  • trunk/Source/WebCore/platform/PlatformPasteboard.h

    r219070 r219128  
    103103    WEBCORE_EXPORT void writeObjectRepresentations(const String& pasteboardType, const String& text);
    104104    WEBCORE_EXPORT void writeObjectRepresentations(const PasteboardURL&);
    105     bool allowReadingURLAtIndex(const URL&, int index) const;
    106105#endif
    107106
  • trunk/Source/WebCore/platform/ios/AbstractPasteboard.h

    r219070 r219128  
    3535@property (readonly, nonatomic) NSInteger numberOfItems;
    3636
    37 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
    38 @property (nonatomic, copy, nullable) NSArray<__kindof NSItemProvider *> *itemProviders;
    39 #endif
    40 
    4137- (NSArray<NSString *> *)pasteboardTypes;
    4238- (NSArray *)dataForPasteboardType:(NSString *)pasteboardType inItemSet:(NSIndexSet *)itemSet;
  • trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm

    r219070 r219128  
    216216}
    217217
    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 
    236218#endif
    237219
    … …  
    445427    } else if (type == String(kUTTypeURL)) {
    446428        ASSERT([value isKindOfClass:[NSURL class]]);
    447         if ([value isKindOfClass:[NSURL class]] && allowReadingURLAtIndex((NSURL *)value, index))
     429        if ([value isKindOfClass:[NSURL class]])
    448430            return [(NSURL *)value absoluteString];
    449431    }
    … …  
    466448        return URL();
    467449
    468     if (!allowReadingURLAtIndex((NSURL *)value, index))
    469         return { };
    470 
    471450#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
    472451    title = [value _title];
  • trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.h

    r219070 r219128  
    8080- (UIItemProvider *)itemProviderAtIndex:(NSUInteger)index;
    8181
    82 @property (copy, nonatomic, nullable) NSArray<__kindof NSItemProvider *> *itemProviders;
     82@property (copy, nonatomic, nullable) NSArray<UIItemProvider *> *itemProviders;
    8383@property (readonly, nonatomic) NSInteger numberOfItems;
    8484@property (readonly, nonatomic) NSInteger changeCount;
  • trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm

    r219070 r219128  
    223223}
    224224
    225 - (NSArray<__kindof NSItemProvider *> *)itemProviders
     225- (NSArray<UIItemProvider *> *)itemProviders
    226226{
    227227    return _itemProviders.get();
    228228}
    229229
    230 - (void)setItemProviders:(NSArray<__kindof NSItemProvider *> *)itemProviders
     230- (void)setItemProviders:(NSArray<UIItemProvider *> *)itemProviders
    231231{
    232232    itemProviders = itemProviders ?: [NSArray array];
  • trunk/Source/WebKit2/ChangeLog

    r219126 r219128  
     12017-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
    1152017-07-05  Zan Dobersek  <zdobersek@igalia.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm

    r219070 r219128  
    628628}
    629629
    630 - (void)_setDOMPasteAllowed:(BOOL)domPasteAllowed
    631 {
    632     _preferences->setDOMPasteAllowed(domPasteAllowed);
    633 }
    634 
    635 - (BOOL)_domPasteAllowed
    636 {
    637     return _preferences->domPasteAllowed();
    638 }
    639 
    640630- (void)_setMediaDocumentEntersFullscreenAutomatically:(BOOL)mediaDocumentEntersFullscreenAutomatically
    641631{
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h

    r219070 r219128  
    108108
    109109@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));
    111110
    112111@property (nonatomic, setter=_setMediaDocumentEntersFullscreenAutomatically:) BOOL _mediaDocumentEntersFullscreenAutomatically WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
  • trunk/Tools/ChangeLog

    r219122 r219128  
     12017-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
    1152017-07-04  Michael Catanzaro  <mcatanzaro@igalia.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm

    r219070 r219128  
    3232#import <MobileCoreServices/MobileCoreServices.h>
    3333#import <UIKit/UIPasteboard.h>
    34 #import <WebCore/SoftLinking.h>
    3534#import <WebKit/WKPreferencesPrivate.h>
    3635#import <WebKit/WKWebViewPrivate.h>
    37 
    38 SOFT_LINK_FRAMEWORK(UIKit)
    39 SOFT_LINK(UIKit, UIApplicationInitialize, void, (void), ())
    4036
    4137namespace TestWebKitAPI {
    … …  
    4844RetainPtr<TestWKWebView> setUpWebViewForPasteboardTests()
    4945{
    50     // UIPasteboard's type coercion codepaths only take effect when the UIApplication has been initialized.
    51     UIApplicationInitialize();
    52 
    5346    [UIPasteboard generalPasteboard].items = @[];
    5447    EXPECT_TRUE(!dataForPasteboardType(kUTTypeUTF8PlainText).length);
    … …  
    5649
    5750    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;
    6152    [webView synchronouslyLoadTestPageNamed:@"rich-and-plain-text"];
    6253    return webView;
    … …  
    8778}
    8879
    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 
    14080} // namespace TestWebKitAPI
    14181
Note: See TracChangeset for help on using the changeset viewer.