Title: [233753] trunk
Revision
233753
Author
rn...@webkit.org
Date
2018-07-11 19:57:53 -0700 (Wed, 11 Jul 2018)

Log Message

REGRESSION (231276): Attempting to copy an image fails
https://bugs.webkit.org/show_bug.cgi?id=187212
Source/WebCore:

<rdar://problem/41540074>

Patch by Aditya Keerthi <akeer...@apple.com> on 2018-07-11
Reviewed by Ryosuke Niwa.

Renamed methods to make it clear that one URL and one title are being passed in.

Test: editing/mac/pasteboard/can-copy-url-without-title.html

* platform/PasteboardStrategy.h:
* platform/PlatformPasteboard.h:
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::setURL):
* platform/mac/PasteboardMac.mm:
(WebCore::writeURLForTypes):
(WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
* platform/mac/PlatformPasteboardMac.mm:
(WebCore::PlatformPasteboard::setURL):

Source/WebKit:

<rdar://problem/41540074>

Patch by Aditya Keerthi <akeer...@apple.com> on 2018-07-11
Reviewed by Ryosuke Niwa.

r210683 introduced logic to prevent file URLs from being copied to the clipboard
in unexpected cases. In order to achieve this functionality,
checkURLReceivedFromWebProcess was called on all items in the pathnames array
passed into WebPasteboardProxy::setPasteboardPathnamesForType. However, this
method is a misnomer, as the pathnames array always contains exactly one URL and
one title for the URL.

Renamed methods to make it clear that one URL and one title are being passed in
and updated logic to ensure that checkURLReceivedFromWebProcess is only called
on the URL and not the title.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<PasteboardURL>::encode):
(IPC::ArgumentCoder<PasteboardURL>::decode):
* Shared/WebCoreArgumentCoders.h:
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::setPasteboardURL):
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::setURL):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

Source/WebKitLegacy/mac:

<rdar://problem/41540074>

Patch by Aditya Keerthi <akeer...@apple.com> on 2018-07-11
Reviewed by Ryosuke Niwa.

Renamed methods to make it clear that one URL and one title are being passed in.

* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::setURL):

Tools:


Patch by Aditya Keerthi <akeer...@apple.com> on 2018-07-11
Reviewed by Ryosuke Niwa.
<rdar://problem/41540074>

Augmented test to include a URL where the lastPathComponent looks similar to a
file URL.

* TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html:
* TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm:
(TestWebKitAPI::TEST):

LayoutTests:

<rdar://problem/41540074>

Patch by Aditya Keerthi <akeer...@apple.com> on 2018-07-11
Reviewed by Ryosuke Niwa.

Added test to ensure that we can copy a URL without a title, and the URL's
lastPathComponent appears like a file URL.

* editing/mac/pasteboard/can-copy-url-without-title-expected.txt: Added.
* editing/mac/pasteboard/can-copy-url-without-title.html: Added.
* platform/mac-wk1/TestExpectations: The added test is WK2-only due to webkit.org/b/187230.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (233752 => 233753)


--- trunk/LayoutTests/ChangeLog	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/LayoutTests/ChangeLog	2018-07-12 02:57:53 UTC (rev 233753)
@@ -1,3 +1,18 @@
+2018-07-11  Aditya Keerthi  <akeer...@apple.com>
+
+        REGRESSION (231276): Attempting to copy an image fails
+        https://bugs.webkit.org/show_bug.cgi?id=187212
+        <rdar://problem/41540074>
+
+        Reviewed by Ryosuke Niwa.
+
+        Added test to ensure that we can copy a URL without a title, and the URL's
+        lastPathComponent appears like a file URL.
+
+        * editing/mac/pasteboard/can-copy-url-without-title-expected.txt: Added.
+        * editing/mac/pasteboard/can-copy-url-without-title.html: Added.
+        * platform/mac-wk1/TestExpectations: The added test is WK2-only due to webkit.org/b/187230.
+
 2018-07-11  Ross Kirsling  <ross.kirsl...@sony.com>
 
         [WinCairo] Unreviewed test gardening.

Added: trunk/LayoutTests/editing/mac/pasteboard/can-copy-url-without-title-expected.txt (0 => 233753)


--- trunk/LayoutTests/editing/mac/pasteboard/can-copy-url-without-title-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/mac/pasteboard/can-copy-url-without-title-expected.txt	2018-07-12 02:57:53 UTC (rev 233753)
@@ -0,0 +1,2 @@
+
+https://en.wikipedia.org/wiki/Gary_Busey/media/File:Texas_Wheelers_cast.JPG

Added: trunk/LayoutTests/editing/mac/pasteboard/can-copy-url-without-title.html (0 => 233753)


--- trunk/LayoutTests/editing/mac/pasteboard/can-copy-url-without-title.html	                        (rev 0)
+++ trunk/LayoutTests/editing/mac/pasteboard/can-copy-url-without-title.html	2018-07-12 02:57:53 UTC (rev 233753)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function runTest() {
+    if (window.testRunner && window.eventSender) {
+        testRunner.dumpAsText();
+
+        const link = document.getElementById("link");
+        const x = link.offsetLeft + link.offsetWidth / 2;
+        const y = link.offsetTop + link.offsetHeight / 2;
+
+        eventSender.mouseMoveTo(x, y);
+        items = eventSender.contextClick();
+
+        for (var i = 0; i < items.length; i++)
+        {
+            if (items[i].title.match("Copy Link")) {
+                items[i].click();
+            }
+        }
+
+        const input = document.getElementById("input");
+        input.focus();
+        document.execCommand("paste");
+        const pastedContent = document.createElement('p');
+        pastedContent.textContent = input.value;
+        document.body.appendChild(pastedContent);
+    }
+}
+</script>
+</head>
+<body _onload_="runTest();">
+    <a id="link" href='' style='background: #000000; display: block; width: 200px; height: 200px;'></a>
+    <input id="input"/>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (233752 => 233753)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2018-07-12 02:57:53 UTC (rev 233753)
@@ -100,6 +100,8 @@
 # WK1 does not support sync XHR redirections as does WK2
 http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-sync-xhr-in-main-frame.html [ Skip ]
 
+webkit.org/b/187230 editing/mac/pasteboard/can-copy-url-without-title.html [ Skip ]
+
 ### END OF (1) Failures with bug reports
 ########################################
 

Modified: trunk/Source/WebCore/ChangeLog (233752 => 233753)


--- trunk/Source/WebCore/ChangeLog	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebCore/ChangeLog	2018-07-12 02:57:53 UTC (rev 233753)
@@ -1,3 +1,25 @@
+2018-07-11  Aditya Keerthi  <akeer...@apple.com>
+
+        REGRESSION (231276): Attempting to copy an image fails
+        https://bugs.webkit.org/show_bug.cgi?id=187212
+        <rdar://problem/41540074>
+
+        Reviewed by Ryosuke Niwa.
+
+        Renamed methods to make it clear that one URL and one title are being passed in.
+
+        Test: editing/mac/pasteboard/can-copy-url-without-title.html
+
+        * platform/PasteboardStrategy.h:
+        * platform/PlatformPasteboard.h:
+        * platform/ios/PlatformPasteboardIOS.mm:
+        (WebCore::PlatformPasteboard::setURL):
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::writeURLForTypes):
+        (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
+        * platform/mac/PlatformPasteboardMac.mm:
+        (WebCore::PlatformPasteboard::setURL):
+
 2018-07-11  Alex Christensen  <achristen...@webkit.org>
 
         Add SPI for immediate injection of user scripts

Modified: trunk/Source/WebCore/platform/PasteboardStrategy.h (233752 => 233753)


--- trunk/Source/WebCore/platform/PasteboardStrategy.h	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebCore/platform/PasteboardStrategy.h	2018-07-12 02:57:53 UTC (rev 233753)
@@ -70,7 +70,7 @@
     virtual long addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) = 0;
     virtual long setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) = 0;
     virtual long setBufferForType(SharedBuffer*, const String& pasteboardType, const String& pasteboardName) = 0;
-    virtual long setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) = 0;
+    virtual long setURL(const PasteboardURL&, const String& pasteboardName) = 0;
     virtual long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) = 0;
 #endif
 

Modified: trunk/Source/WebCore/platform/PlatformPasteboard.h (233752 => 233753)


--- trunk/Source/WebCore/platform/PlatformPasteboard.h	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebCore/platform/PlatformPasteboard.h	2018-07-12 02:57:53 UTC (rev 233753)
@@ -84,7 +84,7 @@
     // These methods will return 0 if pasteboard ownership has been taken from us.
     WEBCORE_EXPORT long copy(const String& fromPasteboard);
     WEBCORE_EXPORT long setBufferForType(SharedBuffer*, const String& pasteboardType);
-    WEBCORE_EXPORT long setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType);
+    WEBCORE_EXPORT long setURL(const PasteboardURL&);
     WEBCORE_EXPORT long setStringForType(const String&, const String& pasteboardType);
     WEBCORE_EXPORT void write(const PasteboardWebContent&);
     WEBCORE_EXPORT void write(const PasteboardImage&);

Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (233752 => 233753)


--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2018-07-12 02:57:53 UTC (rev 233753)
@@ -249,7 +249,7 @@
     return 0;
 }
 
-long PlatformPasteboard::setPathnamesForType(const Vector<String>&, const String&)
+long PlatformPasteboard::setURL(const PasteboardURL&)
 {
     return 0;
 }

Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (233752 => 233753)


--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm	2018-07-12 02:57:53 UTC (rev 233753)
@@ -197,10 +197,8 @@
     }
 
     if (types.contains(WebURLsWithTitlesPboardType)) {
-        Vector<String> paths;
-        paths.append([cocoaURL absoluteString]);
-        paths.append(String(title).stripWhiteSpace());
-        newChangeCount = platformStrategies()->pasteboardStrategy()->setPathnamesForType(paths, WebURLsWithTitlesPboardType, pasteboardName);
+        PasteboardURL url = { pasteboardURL.url, String(title).stripWhiteSpace(), emptyString() };
+        newChangeCount = platformStrategies()->pasteboardStrategy()->setURL(url, pasteboardName);
     }
     if (types.contains(String(legacyURLPasteboardType())))
         newChangeCount = platformStrategies()->pasteboardStrategy()->setStringForType([cocoaURL absoluteString], legacyURLPasteboardType(), pasteboardName);
@@ -221,9 +219,8 @@
 
 void Pasteboard::writeTrustworthyWebURLsPboardType(const PasteboardURL& pasteboardURL)
 {
-    NSURL *cocoaURL = pasteboardURL.url;
-    Vector<String> paths = { [cocoaURL absoluteString], pasteboardURL.title.stripWhiteSpace() };
-    m_changeCount = platformStrategies()->pasteboardStrategy()->setPathnamesForType(paths, WebURLsWithTitlesPboardType, m_pasteboardName);
+    PasteboardURL url = { pasteboardURL.url, pasteboardURL.title.stripWhiteSpace(), emptyString() };
+    m_changeCount = platformStrategies()->pasteboardStrategy()->setURL(url, m_pasteboardName);
 }
 
 static NSFileWrapper* fileWrapper(const PasteboardImage& pasteboardImage)

Modified: trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm (233752 => 233753)


--- trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm	2018-07-12 02:57:53 UTC (rev 233753)
@@ -262,14 +262,15 @@
     return changeCount();
 }
 
-long PlatformPasteboard::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType)
+long PlatformPasteboard::setURL(const PasteboardURL& pasteboardURL)
 {
-    RetainPtr<NSMutableArray> paths = adoptNS([[NSMutableArray alloc] init]);
-    for (size_t i = 0; i < pathnames.size(); ++i)
-        [paths.get() addObject:[NSArray arrayWithObject:pathnames[i]]];
-    BOOL didWriteData = [m_pasteboard.get() setPropertyList:paths.get() forType:pasteboardType];
+    NSURL *cocoaURL = pasteboardURL.url;
+    NSArray *urlWithTitle = @[ @[ cocoaURL.absoluteString ], @[ pasteboardURL.title ] ];
+    NSString *pasteboardType = [NSString stringWithUTF8String:WebURLsWithTitlesPboardType];
+    BOOL didWriteData = [m_pasteboard.get() setPropertyList:urlWithTitle forType:pasteboardType];
     if (!didWriteData)
         return 0;
+
     return changeCount();
 }
 

Modified: trunk/Source/WebKit/ChangeLog (233752 => 233753)


--- trunk/Source/WebKit/ChangeLog	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKit/ChangeLog	2018-07-12 02:57:53 UTC (rev 233753)
@@ -1,3 +1,34 @@
+2018-07-11  Aditya Keerthi  <akeer...@apple.com>
+
+        REGRESSION (231276): Attempting to copy an image fails
+        https://bugs.webkit.org/show_bug.cgi?id=187212
+        <rdar://problem/41540074>
+
+        Reviewed by Ryosuke Niwa.
+
+        r210683 introduced logic to prevent file URLs from being copied to the clipboard
+        in unexpected cases. In order to achieve this functionality,
+        checkURLReceivedFromWebProcess was called on all items in the pathnames array
+        passed into WebPasteboardProxy::setPasteboardPathnamesForType. However, this
+        method is a misnomer, as the pathnames array always contains exactly one URL and
+        one title for the URL.
+
+        Renamed methods to make it clear that one URL and one title are being passed in
+        and updated logic to ensure that checkURLReceivedFromWebProcess is only called
+        on the URL and not the title.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<PasteboardURL>::encode):
+        (IPC::ArgumentCoder<PasteboardURL>::decode):
+        * Shared/WebCoreArgumentCoders.h:
+        * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
+        (WebKit::WebPasteboardProxy::setPasteboardURL):
+        * UIProcess/WebPasteboardProxy.h:
+        * UIProcess/WebPasteboardProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::setURL):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
 2018-07-11  Alex Christensen  <achristen...@webkit.org>
 
         Add SPI for immediate injection of user scripts

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (233752 => 233753)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2018-07-12 02:57:53 UTC (rev 233753)
@@ -1656,6 +1656,38 @@
     return true;
 }
 
+void ArgumentCoder<PasteboardURL>::encode(Encoder& encoder, const PasteboardURL& content)
+{
+    encoder << content.url;
+    encoder << content.title;
+#if PLATFORM(MAC)
+    encoder << content.userVisibleForm;
+#endif
+#if PLATFORM(GTK)
+    encoder << content.markup;
+#endif
+}
+
+bool ArgumentCoder<PasteboardURL>::decode(Decoder& decoder, PasteboardURL& content)
+{
+    if (!decoder.decode(content.url))
+        return false;
+
+    if (!decoder.decode(content.title))
+        return false;
+
+#if PLATFORM(MAC)
+    if (!decoder.decode(content.userVisibleForm))
+        return false;
+#endif
+#if PLATFORM(GTK)
+    if (!decoder.decode(content.markup))
+        return false;
+#endif
+
+    return true;
+}
+
 #if PLATFORM(IOS)
 
 void ArgumentCoder<Highlight>::encode(Encoder& encoder, const Highlight& highlight)
@@ -1694,23 +1726,6 @@
     return true;
 }
 
-void ArgumentCoder<PasteboardURL>::encode(Encoder& encoder, const PasteboardURL& content)
-{
-    encoder << content.url;
-    encoder << content.title;
-}
-
-bool ArgumentCoder<PasteboardURL>::decode(Decoder& decoder, PasteboardURL& content)
-{
-    if (!decoder.decode(content.url))
-        return false;
-
-    if (!decoder.decode(content.title))
-        return false;
-
-    return true;
-}
-
 void ArgumentCoder<PasteboardWebContent>::encode(Encoder& encoder, const PasteboardWebContent& content)
 {
     encoder << content.contentOrigin;

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (233752 => 233753)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2018-07-12 02:57:53 UTC (rev 233753)
@@ -413,11 +413,6 @@
     static bool decode(Decoder&, WebCore::PasteboardWebContent&);
 };
 
-template<> struct ArgumentCoder<WebCore::PasteboardURL> {
-    static void encode(Encoder&, const WebCore::PasteboardURL&);
-    static bool decode(Decoder&, WebCore::PasteboardURL&);
-};
-
 template<> struct ArgumentCoder<WebCore::PasteboardImage> {
     static void encode(Encoder&, const WebCore::PasteboardImage&);
     static bool decode(Decoder&, WebCore::PasteboardImage&);
@@ -429,6 +424,11 @@
     static bool decode(Decoder&, WebCore::PasteboardCustomData&);
 };
 
+template<> struct ArgumentCoder<WebCore::PasteboardURL> {
+    static void encode(Encoder&, const WebCore::PasteboardURL&);
+    static bool decode(Decoder&, WebCore::PasteboardURL&);
+};
+
 #if USE(SOUP)
 template<> struct ArgumentCoder<WebCore::SoupNetworkProxySettings> {
     static void encode(Encoder&, const WebCore::SoupNetworkProxySettings&);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (233752 => 233753)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm	2018-07-12 02:57:53 UTC (rev 233753)
@@ -29,6 +29,7 @@
 #import "SandboxExtension.h"
 #import "WebProcessProxy.h"
 #import <WebCore/Color.h>
+#import <WebCore/Pasteboard.h>
 #import <WebCore/PasteboardItemInfo.h>
 #import <WebCore/PlatformPasteboard.h>
 #import <WebCore/SharedBuffer.h>
@@ -120,19 +121,18 @@
     newChangeCount = PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);
 }
 
-void WebPasteboardProxy::setPasteboardPathnamesForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const Vector<String>& pathnames, uint64_t& newChangeCount)
+void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, uint64_t& newChangeCount)
 {
     for (auto* webProcessProxy : m_webProcessProxyList) {
         if (!webProcessProxy->hasConnection(connection))
             continue;
-        
-        for (const auto& pathname : pathnames) {
-            if (!webProcessProxy->checkURLReceivedFromWebProcess(pathname)) {
-                newChangeCount = 0;
-                return;
-            }
+
+        if (!webProcessProxy->checkURLReceivedFromWebProcess(pasteboardURL.url.string())) {
+            newChangeCount = 0;
+            return;
         }
-        newChangeCount = PlatformPasteboard(pasteboardName).setPathnamesForType(pathnames, pasteboardType);
+
+        newChangeCount = PlatformPasteboard(pasteboardName).setURL(pasteboardURL);
         return;
     }
     newChangeCount = 0;

Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h (233752 => 233753)


--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h	2018-07-12 02:57:53 UTC (rev 233753)
@@ -95,7 +95,7 @@
     void getPasteboardURL(const String& pasteboardName, WTF::String&);
     void addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount);
     void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount);
-    void setPasteboardPathnamesForType(IPC::Connection&, const String& pasteboardName, const String& pasteboardType, const Vector<String>& pathnames, uint64_t& newChangeCount);
+    void setPasteboardURL(IPC::Connection&, const WebCore::PasteboardURL&, const String& pasteboardName, uint64_t& newChangeCount);
     void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, uint64_t& newChangeCount);
     void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, uint64_t& newChangeCount);
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in (233752 => 233753)


--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in	2018-07-12 02:57:53 UTC (rev 233753)
@@ -53,7 +53,7 @@
     GetPasteboardURL(String pasteboardName) -> (String urlString)
     AddPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount)
     SetPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount)
-    SetPasteboardPathnamesForType(String pasteboardName, String pasteboardType, Vector<String> pathnames) -> (uint64_t changeCount) WantsConnection
+    SetPasteboardURL(struct WebCore::PasteboardURL pasteboardURL, String pasteboardName) -> (uint64_t changeCount) WantsConnection
     SetPasteboardStringForType(String pasteboardName, String pasteboardType, String string) -> (uint64_t changeCount)
     SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (uint64_t changeCount)
 #endif

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (233752 => 233753)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2018-07-12 02:57:53 UTC (rev 233753)
@@ -268,10 +268,10 @@
     return newChangeCount;
 }
 
-long WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
+long WebPlatformStrategies::setURL(const PasteboardURL& pasteboardURL, const String& pasteboardName)
 {
-    uint64_t newChangeCount { 0 };
-    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardPathnamesForType(pasteboardName, pasteboardType, pathnames), Messages::WebPasteboardProxy::SetPasteboardPathnamesForType::Reply(newChangeCount), 0);
+    uint64_t newChangeCount;
+    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardURL(pasteboardURL, pasteboardName), Messages::WebPasteboardProxy::SetPasteboardURL::Reply(newChangeCount), 0);
     return newChangeCount;
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h (233752 => 233753)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2018-07-12 02:57:53 UTC (rev 233753)
@@ -84,7 +84,7 @@
     long addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
     long setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
     long setBufferForType(WebCore::SharedBuffer*, const String& pasteboardType, const String& pasteboardName) override;
-    long setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) override;
+    long setURL(const WebCore::PasteboardURL&, const String& pasteboardName) override;
     long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
 #endif
 #if PLATFORM(GTK)

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (233752 => 233753)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-07-12 02:57:53 UTC (rev 233753)
@@ -1,3 +1,17 @@
+2018-07-11  Aditya Keerthi  <akeer...@apple.com>
+
+        REGRESSION (231276): Attempting to copy an image fails
+        https://bugs.webkit.org/show_bug.cgi?id=187212
+        <rdar://problem/41540074>
+
+        Reviewed by Ryosuke Niwa.
+
+        Renamed methods to make it clear that one URL and one title are being passed in.
+
+        * WebCoreSupport/WebPlatformStrategies.h:
+        * WebCoreSupport/WebPlatformStrategies.mm:
+        (WebPlatformStrategies::setURL):
+
 2018-07-10  Ryosuke Niwa  <rn...@webkit.org>
 
         Disable cross-origin-window-policy by default

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h (233752 => 233753)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h	2018-07-12 02:57:53 UTC (rev 233753)
@@ -87,7 +87,7 @@
     long addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
     long setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
     long setBufferForType(WebCore::SharedBuffer*, const String& pasteboardType, const String& pasteboardName) override;
-    long setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) override;
+    long setURL(const WebCore::PasteboardURL&, const String& pasteboardName) override;
     long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
 };
 

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (233752 => 233753)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm	2018-07-12 02:57:53 UTC (rev 233753)
@@ -164,9 +164,9 @@
     return PlatformPasteboard(pasteboardName).setBufferForType(buffer, pasteboardType);
 }
 
-long WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
+long WebPlatformStrategies::setURL(const PasteboardURL& pasteboardURL, const String& pasteboardName)
 {
-    return PlatformPasteboard(pasteboardName).setPathnamesForType(pathnames, pasteboardType);
+    return PlatformPasteboard(pasteboardName).setURL(pasteboardURL);
 }
 
 long WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)

Modified: trunk/Tools/ChangeLog (233752 => 233753)


--- trunk/Tools/ChangeLog	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Tools/ChangeLog	2018-07-12 02:57:53 UTC (rev 233753)
@@ -1,3 +1,18 @@
+2018-07-11  Aditya Keerthi  <akeer...@apple.com>
+
+        REGRESSION (231276): Attempting to copy an image fails
+        https://bugs.webkit.org/show_bug.cgi?id=187212
+
+        Reviewed by Ryosuke Niwa.
+        <rdar://problem/41540074>
+
+        Augmented test to include a URL where the lastPathComponent looks similar to a
+        file URL.
+
+        * TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html:
+        * TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm:
+        (TestWebKitAPI::TEST):
+
 2018-07-11  Alex Christensen  <achristen...@webkit.org>
 
         Add SPI for immediate injection of user scripts

Modified: trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html (233752 => 233753)


--- trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.html	2018-07-12 02:57:53 UTC (rev 233753)
@@ -1,4 +1,4 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 </head>
-Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href=''>Click me</a>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href=''>
 http://💩.la</a>.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href='' style='background: #000000; display: block; width: 200px; height: 200px;'></a>
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href=''>Click me</a>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href=''>h
 ttp://💩.la</a>.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<a href='' style='background: #000000; display: block; width: 200px; height: 200px;'></a><a href='' style='background: #000000; display: block; width: 200px; height: 200px;'></a>

Modified: trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm (233752 => 233753)


--- trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm	2018-07-12 02:32:19 UTC (rev 233752)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm	2018-07-12 02:57:53 UTC (rev 233753)
@@ -117,6 +117,13 @@
     titles = [WebURLsWithTitles titlesFromPasteboard:[NSPasteboard generalPasteboard]];
     EXPECT_WK_STREQ(@"https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", [[urls objectAtIndex:0] absoluteString]);
     EXPECT_WK_STREQ(@"big_buck_bunny.mp4", [titles objectAtIndex:0]);
+
+    contextMenuCopyLink(webView.get(), 3);
+
+    urls = [WebURLsWithTitles URLsFromPasteboard:[NSPasteboard generalPasteboard]];
+    titles = [WebURLsWithTitles titlesFromPasteboard:[NSPasteboard generalPasteboard]];
+    EXPECT_WK_STREQ(@"https://en.wikipedia.org/wiki/Gary_Busey/media/File:Texas_Wheelers_cast.JPG", [[urls objectAtIndex:0] absoluteString]);
+    EXPECT_WK_STREQ(@"File:Texas_Wheelers_cast.JPG", [titles objectAtIndex:0]);
 }
 
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to