PasteImage tests are failing on debug builds
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Oct 2017 21:44:05 +0000 (21:44 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Oct 2017 21:44:05 +0000 (21:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177778

Reviewed by Wenson Hsieh.

After r222702, PlatformPasteboard is no longer responsible for adding "Files" as a type"
as DataTransfer takes care of it now. Removed the code to do this from PlatformPasteboardIOS.mm
and PlatformPasteboardMac.mm so that we don't fail assertions in debug builds.

* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
* platform/mac/PlatformPasteboardMac.mm:
(WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
(WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
Source/WebCore/platform/mac/PlatformPasteboardMac.mm

index f3ec4c4..ce4c6e9 100644 (file)
@@ -1,3 +1,20 @@
+2017-10-02  Ryosuke Niwa  <rniwa@webkit.org>
+
+        PasteImage tests are failing on debug builds
+        https://bugs.webkit.org/show_bug.cgi?id=177778
+
+        Reviewed by Wenson Hsieh.
+
+        After r222702, PlatformPasteboard is no longer responsible for adding "Files" as a type"
+        as DataTransfer takes care of it now. Removed the code to do this from PlatformPasteboardIOS.mm
+        and PlatformPasteboardMac.mm so that we don't fail assertions in debug builds.
+
+        * platform/ios/PlatformPasteboardIOS.mm:
+        (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
+        * platform/mac/PlatformPasteboardMac.mm:
+        (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
+        (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
+
 2017-10-02  Daniel Bates  <dabates@apple.com>
 
         No need to truncate text after calling InlineTextBox::text()
index 2b8a477..3ebe8d0 100644 (file)
@@ -340,9 +340,6 @@ static const char *safeTypeForDOMToReadAndWriteForPlatformType(const String& pla
     if (UTTypeConformsTo(cfType.get(), kUTTypeURL))
         return ASCIILiteral("text/uri-list");
 
-    if (Pasteboard::shouldTreatCocoaTypeAsFile(platformType))
-        return ASCIILiteral("Files");
-
     return nullptr;
 }
 
index fd500a3..785a02e 100644 (file)
@@ -104,9 +104,6 @@ static const char* safeTypeForDOMToReadAndWriteForPlatformType(const String& pla
     if (platformType == String(NSHTMLPboardType))
         return ASCIILiteral("text/html");
 
-    if (platformType == String(NSFilenamesPboardType) || platformType == String(NSFilesPromisePboardType) || Pasteboard::shouldTreatCocoaTypeAsFile(platformType))
-        return ASCIILiteral("Files");
-
     return nullptr;
 }
 
@@ -126,12 +123,8 @@ Vector<String> PlatformPasteboard::typesSafeForDOMToReadAndWrite() const
 
         if (Pasteboard::isSafeTypeForDOMToReadAndWrite(type))
             domPasteboardTypes.add(type);
-        else if (auto* domType = safeTypeForDOMToReadAndWriteForPlatformType(type)) {
-            auto coercedType = String::fromUTF8(domType);
-            if (coercedType == "Files" && !numberOfFiles())
-                continue;
-            domPasteboardTypes.add(WTFMove(coercedType));
-        }
+        else if (auto* domType = safeTypeForDOMToReadAndWriteForPlatformType(type))
+            domPasteboardTypes.add(String::fromUTF8(domType));
     }
 
     Vector<String> result;