Diff
Modified: trunk/Source/WebCore/ChangeLog (251420 => 251421)
--- trunk/Source/WebCore/ChangeLog 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/ChangeLog 2019-10-22 07:22:19 UTC (rev 251421)
@@ -1,3 +1,103 @@
+2019-10-22 Wenson Hsieh <[email protected]>
+
+ imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https.html is flaky
+ https://bugs.webkit.org/show_bug.cgi?id=203181
+
+ Reviewed by Ryosuke Niwa.
+
+ This test is flaky because its results currently vary depending on whether content already exists on the
+ platform pasteboard. In this test, the page is able to read items from the clipboard since DOM paste and
+ programmatic clipboard access are enabled when running layout tests. However, in the case where the pasteboard
+ is empty, we end up rejecting the promise due to an early return in Clipboard::read(). In contrast, when the
+ pasteboard has at least one item, we'll end up resolving the promise with a sequence of ClipboardItems, which
+ then causes the test to fail because it expects this result to be a DataTransfer instead (which, at time of
+ writing, is incorrect w.r.t. the async clipboard spec).
+
+ To fix this, we remove this early return that rejects the promise when there are no pasteboard items, and
+ instead allow the promise to resolve with no items. However, simply removing this check would mean that if the
+ pasteboard change count changes between the start of the call to Clipboard.read() and retrieval of item
+ information from the platform pasteboard, we'll no longer reject the promimse as expected. This is because we
+ currently iterate through each of the items and check that the item's change count matches, so if there are no
+ items, we simply avoid checking the change count.
+
+ We address this by instead sending the expected change count along with the request for allPasteboardItemInfo(),
+ and refactoring the implementation of allPasteboardItemInfo (and informationForItemAtIndex) to instead check
+ this expected change count against the current change count of the pasteboard.
+
+ * Modules/async-clipboard/Clipboard.cpp:
+ (WebCore::Clipboard::read):
+
+ Remove the `allInfo.isEmpty()` early return, and also remove a FIXME that is addressed by this refactoring.
+
+ * Modules/async-clipboard/Clipboard.h:
+ * platform/Pasteboard.cpp:
+ (WebCore::Pasteboard::allPasteboardItemInfo const):
+ (WebCore::Pasteboard::pasteboardItemInfo const):
+
+ Make these methods require a changeCount; also, make these return optional results.
+
+ * platform/Pasteboard.h:
+ (WebCore::Pasteboard::changeCount const):
+ * platform/PasteboardItemInfo.h:
+ (WebCore::PasteboardItemInfo::encode const):
+ (WebCore::PasteboardItemInfo::decode):
+
+ Remove PasteboardItemInfo's changeCount, now that the check occurs in the client layer.
+
+ * platform/PasteboardStrategy.h:
+ * platform/PlatformPasteboard.h:
+ * platform/cocoa/PasteboardCocoa.mm:
+ (WebCore::Pasteboard::fileContentState):
+ (WebCore::Pasteboard::changeCount const):
+ * platform/cocoa/PlatformPasteboardCocoa.mm:
+ (WebCore::PlatformPasteboard::allPasteboardItemInfo):
+ * platform/gtk/PlatformPasteboardGtk.cpp:
+ (WebCore::PlatformPasteboard::write):
+ * platform/ios/PasteboardIOS.mm:
+ (WebCore::changeCountForPasteboard):
+ (WebCore::Pasteboard::Pasteboard):
+ (WebCore::Pasteboard::read):
+ (WebCore::Pasteboard::readRespectingUTIFidelities):
+ (WebCore::Pasteboard::readPlatformValuesAsStrings):
+
+ Normalize changeCount to be a `int64_t`, which matches iOS and macOS platforms. Before this patch, the notion of
+ changeCount is very ill-defined, with some call sites expecting `long` types, other call sites expecting
+ `int`, and yet others expecting `uint64_t`. This changes all of these to expect `int64_t`.
+
+ (WebCore::Pasteboard::readFilePaths):
+
+ Refactor these methods to bail when the resulting item information has no value (i.e. WTF::nullopt).
+
+ * platform/ios/PlatformPasteboardIOS.mm:
+ (WebCore::PlatformPasteboard::informationForItemAtIndex):
+ (WebCore::PlatformPasteboard::copy):
+ (WebCore::PlatformPasteboard::addTypes):
+ (WebCore::PlatformPasteboard::setTypes):
+ (WebCore::PlatformPasteboard::setBufferForType):
+ (WebCore::PlatformPasteboard::setURL):
+ (WebCore::PlatformPasteboard::setStringForType):
+ (WebCore::PlatformPasteboard::changeCount const):
+ (WebCore::PlatformPasteboard::setColor):
+ (WebCore::PlatformPasteboard::write):
+ * platform/libwpe/PlatformPasteboardLibWPE.cpp:
+ (WebCore::PlatformPasteboard::write):
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::writeURLForTypes):
+ (WebCore::writeFileWrapperAsRTFDAttachment):
+ (WebCore::Pasteboard::read):
+ (WebCore::Pasteboard::readPlatformValuesAsStrings):
+ * platform/mac/PlatformPasteboardMac.mm:
+ (WebCore::PlatformPasteboard::write):
+ (WebCore::PlatformPasteboard::changeCount const):
+ (WebCore::PlatformPasteboard::copy):
+ (WebCore::PlatformPasteboard::addTypes):
+ (WebCore::PlatformPasteboard::setTypes):
+ (WebCore::PlatformPasteboard::setBufferForType):
+ (WebCore::PlatformPasteboard::setURL):
+ (WebCore::PlatformPasteboard::setColor):
+ (WebCore::PlatformPasteboard::setStringForType):
+ (WebCore::PlatformPasteboard::informationForItemAtIndex):
+
2019-10-21 Chris Dumez <[email protected]>
Suspend dedicated worker threads while in the back/forward cache
Modified: trunk/Source/WebCore/Modules/async-clipboard/Clipboard.cpp (251420 => 251421)
--- trunk/Source/WebCore/Modules/async-clipboard/Clipboard.cpp 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/Modules/async-clipboard/Clipboard.cpp 2019-10-22 07:22:19 UTC (rev 251421)
@@ -94,7 +94,7 @@
}
auto pasteboard = Pasteboard::createForCopyAndPaste();
- int changeCountAtStart = pasteboard->changeCount();
+ auto changeCountAtStart = pasteboard->changeCount();
if (!frame->requestDOMPasteAccess()) {
rejectPromiseAndClearActiveSession();
@@ -103,23 +103,15 @@
if (!m_activeSession || m_activeSession->changeCount != changeCountAtStart) {
auto allInfo = pasteboard->allPasteboardItemInfo();
- if (allInfo.isEmpty()) {
+ if (!allInfo) {
rejectPromiseAndClearActiveSession();
return;
}
Vector<Ref<ClipboardItem>> clipboardItems;
- clipboardItems.reserveInitialCapacity(allInfo.size());
- for (auto& itemInfo : allInfo) {
- // FIXME: This should be refactored such that the initial changeCount is delivered to the client, where it is then checked
- // against the current changeCount of the platform pasteboard. For instance, in WebKit2, this would relocate the changeCount
- // check to the UI process instead of the web content process.
- if (itemInfo.changeCount != changeCountAtStart) {
- rejectPromiseAndClearActiveSession();
- return;
- }
+ clipboardItems.reserveInitialCapacity(allInfo->size());
+ for (auto& itemInfo : *allInfo)
clipboardItems.uncheckedAppend(ClipboardItem::create(*this, itemInfo));
- }
m_activeSession = {{ WTFMove(pasteboard), WTFMove(clipboardItems), changeCountAtStart }};
}
Modified: trunk/Source/WebCore/Modules/async-clipboard/Clipboard.h (251420 => 251421)
--- trunk/Source/WebCore/Modules/async-clipboard/Clipboard.h 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/Modules/async-clipboard/Clipboard.h 2019-10-22 07:22:19 UTC (rev 251421)
@@ -67,7 +67,7 @@
struct Session {
std::unique_ptr<Pasteboard> pasteboard;
Vector<Ref<ClipboardItem>> items;
- int changeCount;
+ int64_t changeCount;
};
void refEventTarget() final { ref(); }
Modified: trunk/Source/WebCore/platform/Pasteboard.cpp (251420 => 251421)
--- trunk/Source/WebCore/platform/Pasteboard.cpp 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/Pasteboard.cpp 2019-10-22 07:22:19 UTC (rev 251421)
@@ -62,18 +62,24 @@
#endif
-Vector<PasteboardItemInfo> Pasteboard::allPasteboardItemInfo() const
+Optional<Vector<PasteboardItemInfo>> Pasteboard::allPasteboardItemInfo() const
{
+#if PLATFORM(COCOA)
if (auto* strategy = platformStrategies()->pasteboardStrategy())
- return strategy->allPasteboardItemInfo(name());
- return { };
+ return strategy->allPasteboardItemInfo(name(), m_changeCount);
+#endif
+ return WTF::nullopt;
}
-PasteboardItemInfo Pasteboard::pasteboardItemInfo(size_t index) const
+Optional<PasteboardItemInfo> Pasteboard::pasteboardItemInfo(size_t index) const
{
+#if PLATFORM(COCOA)
if (auto* strategy = platformStrategies()->pasteboardStrategy())
- return strategy->informationForItemAtIndex(index, name());
- return { };
+ return strategy->informationForItemAtIndex(index, name(), m_changeCount);
+#else
+ UNUSED_PARAM(index);
+#endif
+ return WTF::nullopt;
}
String Pasteboard::readString(size_t index, const String& type)
Modified: trunk/Source/WebCore/platform/Pasteboard.h (251420 => 251421)
--- trunk/Source/WebCore/platform/Pasteboard.h 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/Pasteboard.h 2019-10-22 07:22:19 UTC (rev 251421)
@@ -238,7 +238,7 @@
#endif
#if PLATFORM(IOS_FAMILY)
- explicit Pasteboard(long changeCount);
+ explicit Pasteboard(int64_t changeCount);
explicit Pasteboard(const String& pasteboardName);
static NSArray *supportedWebContentPasteboardTypes();
@@ -252,10 +252,10 @@
#if PLATFORM(COCOA)
static bool shouldTreatCocoaTypeAsFile(const String&);
WEBCORE_EXPORT static NSArray *supportedFileUploadPasteboardTypes();
- long changeCount() const;
+ int64_t changeCount() const;
const PasteboardCustomData& readCustomData();
#else
- long changeCount() const { return 0; }
+ int64_t changeCount() const { return 0; }
#endif
#if PLATFORM(COCOA)
@@ -273,8 +273,8 @@
void writeImageToDataObject(Element&, const URL&); // FIXME: Layering violation.
#endif
- Vector<PasteboardItemInfo> allPasteboardItemInfo() const;
- PasteboardItemInfo pasteboardItemInfo(size_t index) const;
+ Optional<Vector<PasteboardItemInfo>> allPasteboardItemInfo() const;
+ Optional<PasteboardItemInfo> pasteboardItemInfo(size_t index) const;
String readString(size_t index, const String& type);
RefPtr<WebCore::SharedBuffer> readBuffer(size_t index, const String& type);
@@ -302,7 +302,7 @@
#if PLATFORM(COCOA)
Vector<String> readFilePaths();
- Vector<String> readPlatformValuesAsStrings(const String& domType, long changeCount, const String& pasteboardName);
+ Vector<String> readPlatformValuesAsStrings(const String& domType, int64_t changeCount, const String& pasteboardName);
static void addHTMLClipboardTypesForCocoaType(ListHashSet<String>& resultTypes, const String& cocoaType);
String readStringForPlatformType(const String&);
Vector<String> readTypesWithSecurityCheck();
@@ -318,7 +318,7 @@
#if PLATFORM(COCOA)
String m_pasteboardName;
- long m_changeCount;
+ int64_t m_changeCount;
Optional<PasteboardCustomData> m_customDataCache;
#endif
Modified: trunk/Source/WebCore/platform/PasteboardItemInfo.h (251420 => 251421)
--- trunk/Source/WebCore/platform/PasteboardItemInfo.h 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/PasteboardItemInfo.h 2019-10-22 07:22:19 UTC (rev 251421)
@@ -73,7 +73,6 @@
bool isNonTextType { false };
bool containsFileURLAndFileUploadContent { false };
Vector<String> webSafeTypesByFidelity;
- int changeCount { 0 };
PasteboardItemPresentationStyle preferredPresentationStyle { PasteboardItemPresentationStyle::Unspecified };
String pathForContentType(const String& type) const
@@ -127,7 +126,7 @@
template<class Encoder>
void PasteboardItemInfo::encode(Encoder& encoder) const
{
- encoder << pathsForFileUpload << platformTypesForFileUpload << platformTypesByFidelity << suggestedFileName << preferredPresentationSize << isNonTextType << containsFileURLAndFileUploadContent << webSafeTypesByFidelity << changeCount;
+ encoder << pathsForFileUpload << platformTypesForFileUpload << platformTypesByFidelity << suggestedFileName << preferredPresentationSize << isNonTextType << containsFileURLAndFileUploadContent << webSafeTypesByFidelity;
encoder.encodeEnum(preferredPresentationStyle);
}
@@ -159,9 +158,6 @@
if (!decoder.decode(result.webSafeTypesByFidelity))
return WTF::nullopt;
- if (!decoder.decode(result.changeCount))
- return WTF::nullopt;
-
if (!decoder.decodeEnum(result.preferredPresentationStyle))
return WTF::nullopt;
Modified: trunk/Source/WebCore/platform/PasteboardStrategy.h (251420 => 251421)
--- trunk/Source/WebCore/platform/PasteboardStrategy.h 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/PasteboardStrategy.h 2019-10-22 07:22:19 UTC (rev 251421)
@@ -54,28 +54,28 @@
virtual void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) = 0;
virtual String stringForType(const String& pasteboardType, const String& pasteboardName) = 0;
virtual Vector<String> allStringsForType(const String& pasteboardType, const String& pasteboardName) = 0;
- virtual long changeCount(const String& pasteboardName) = 0;
+ virtual int64_t changeCount(const String& pasteboardName) = 0;
virtual String uniqueName() = 0;
virtual Color color(const String& pasteboardName) = 0;
virtual URL url(const String& pasteboardName) = 0;
virtual int getNumberOfFiles(const String& pasteboardName) = 0;
- 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 setURL(const PasteboardURL&, const String& pasteboardName) = 0;
- virtual long setColor(const Color&, const String& pasteboardName) = 0;
- virtual long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) = 0;
+ virtual int64_t addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) = 0;
+ virtual int64_t setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) = 0;
+ virtual int64_t setBufferForType(SharedBuffer*, const String& pasteboardType, const String& pasteboardName) = 0;
+ virtual int64_t setURL(const PasteboardURL&, const String& pasteboardName) = 0;
+ virtual int64_t setColor(const Color&, const String& pasteboardName) = 0;
+ virtual int64_t setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) = 0;
#endif
virtual String readStringFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) = 0;
virtual RefPtr<SharedBuffer> readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) = 0;
virtual URL readURLFromPasteboard(size_t index, const String& pasteboardName, String& title) = 0;
- virtual PasteboardItemInfo informationForItemAtIndex(size_t index, const String& pasteboardName) = 0;
- virtual Vector<PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) = 0;
+ virtual Optional<PasteboardItemInfo> informationForItemAtIndex(size_t index, const String& pasteboardName, int64_t changeCount) = 0;
+ virtual Optional<Vector<PasteboardItemInfo>> allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount) = 0;
virtual int getPasteboardItemsCount(const String& pasteboardName) = 0;
virtual Vector<String> typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin) = 0;
- virtual long writeCustomData(const Vector<PasteboardCustomData>&, const String& pasteboardName) = 0;
+ virtual int64_t writeCustomData(const Vector<PasteboardCustomData>&, const String& pasteboardName) = 0;
#if PLATFORM(GTK)
virtual void writeToClipboard(const String& pasteboardName, const SelectionData&) = 0;
Modified: trunk/Source/WebCore/platform/PlatformPasteboard.h (251420 => 251421)
--- trunk/Source/WebCore/platform/PlatformPasteboard.h 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/PlatformPasteboard.h 2019-10-22 07:22:19 UTC (rev 251421)
@@ -62,8 +62,8 @@
WEBCORE_EXPORT PlatformPasteboard();
WEBCORE_EXPORT void updateSupportedTypeIdentifiers(const Vector<String>& types);
#endif
- WEBCORE_EXPORT PasteboardItemInfo informationForItemAtIndex(size_t index);
- WEBCORE_EXPORT Vector<PasteboardItemInfo> allPasteboardItemInfo();
+ WEBCORE_EXPORT Optional<PasteboardItemInfo> informationForItemAtIndex(size_t index, int64_t changeCount);
+ WEBCORE_EXPORT Optional<Vector<PasteboardItemInfo>> allPasteboardItemInfo(int64_t changeCount);
WEBCORE_EXPORT static String uniqueName();
WEBCORE_EXPORT static String platformPasteboardTypeForSafeTypeForDOMToReadAndWrite(const String& domType);
@@ -73,20 +73,20 @@
WEBCORE_EXPORT void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType) const;
WEBCORE_EXPORT String stringForType(const String& pasteboardType) const;
WEBCORE_EXPORT Vector<String> allStringsForType(const String& pasteboardType) const;
- WEBCORE_EXPORT long changeCount() const;
+ WEBCORE_EXPORT int64_t changeCount() const;
WEBCORE_EXPORT Color color();
WEBCORE_EXPORT URL url();
// Take ownership of the pasteboard, and return new change count.
- WEBCORE_EXPORT long addTypes(const Vector<String>& pasteboardTypes);
- WEBCORE_EXPORT long setTypes(const Vector<String>& pasteboardTypes);
+ WEBCORE_EXPORT int64_t addTypes(const Vector<String>& pasteboardTypes);
+ WEBCORE_EXPORT int64_t setTypes(const Vector<String>& pasteboardTypes);
// 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 setURL(const PasteboardURL&);
- WEBCORE_EXPORT long setColor(const Color&);
- WEBCORE_EXPORT long setStringForType(const String&, const String& pasteboardType);
+ WEBCORE_EXPORT int64_t copy(const String& fromPasteboard);
+ WEBCORE_EXPORT int64_t setBufferForType(SharedBuffer*, const String& pasteboardType);
+ WEBCORE_EXPORT int64_t setURL(const PasteboardURL&);
+ WEBCORE_EXPORT int64_t setColor(const Color&);
+ WEBCORE_EXPORT int64_t setStringForType(const String&, const String& pasteboardType);
WEBCORE_EXPORT void write(const PasteboardWebContent&);
WEBCORE_EXPORT void write(const PasteboardImage&);
WEBCORE_EXPORT void write(const String& pasteboardType, const String&);
@@ -96,8 +96,8 @@
WEBCORE_EXPORT URL readURL(size_t index, String& title) const;
WEBCORE_EXPORT int count() const;
WEBCORE_EXPORT int numberOfFiles() const;
- WEBCORE_EXPORT long write(const Vector<PasteboardCustomData>&);
- WEBCORE_EXPORT long write(const PasteboardCustomData&);
+ WEBCORE_EXPORT int64_t write(const Vector<PasteboardCustomData>&);
+ WEBCORE_EXPORT int64_t write(const PasteboardCustomData&);
WEBCORE_EXPORT Vector<String> typesSafeForDOMToReadAndWrite(const String& origin) const;
#if PLATFORM(GTK)
Modified: trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm (251420 => 251421)
--- trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -144,7 +144,10 @@
// an inline piece of text, with no files in the pasteboard (and therefore, no risk of leaking file paths
// to web content). In cases such as these, we should not suppress DataTransfer access.
auto items = allPasteboardItemInfo();
- mayContainFilePaths = items.size() != 1 || notFound != items.findMatching([] (auto& item) {
+ if (!items)
+ return FileContentState::NoFileOrImageData;
+
+ mayContainFilePaths = items->size() != 1 || notFound != items->findMatching([] (auto& item) {
return item.canBeTreatedAsAttachmentOrFile() || item.isNonTextType || item.containsFileURLAndFileUploadContent;
});
}
@@ -280,7 +283,7 @@
m_changeCount = platformStrategies()->pasteboardStrategy()->writeCustomData(data, name());
}
-long Pasteboard::changeCount() const
+int64_t Pasteboard::changeCount() const
{
return platformStrategies()->pasteboardStrategy()->changeCount(m_pasteboardName);
}
Modified: trunk/Source/WebCore/platform/cocoa/PlatformPasteboardCocoa.mm (251420 => 251421)
--- trunk/Source/WebCore/platform/cocoa/PlatformPasteboardCocoa.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/cocoa/PlatformPasteboardCocoa.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -28,15 +28,27 @@
#import "PasteboardItemInfo.h"
+#if PLATFORM(IOS_FAMILY)
+#import "AbstractPasteboard.h"
+#endif
+
namespace WebCore {
-Vector<PasteboardItemInfo> PlatformPasteboard::allPasteboardItemInfo()
+Optional<Vector<PasteboardItemInfo>> PlatformPasteboard::allPasteboardItemInfo(int64_t changeCount)
{
+ if (changeCount != [m_pasteboard changeCount])
+ return WTF::nullopt;
+
Vector<PasteboardItemInfo> itemInfo;
int numberOfItems = count();
itemInfo.reserveInitialCapacity(numberOfItems);
- for (NSInteger itemIndex = 0; itemIndex < numberOfItems; ++itemIndex)
- itemInfo.uncheckedAppend(informationForItemAtIndex(itemIndex));
+ for (NSInteger itemIndex = 0; itemIndex < numberOfItems; ++itemIndex) {
+ auto item = informationForItemAtIndex(itemIndex, changeCount);
+ if (!item)
+ return WTF::nullopt;
+
+ itemInfo.uncheckedAppend(WTFMove(*item));
+ }
return itemInfo;
}
Modified: trunk/Source/WebCore/platform/gtk/PlatformPasteboardGtk.cpp (251420 => 251421)
--- trunk/Source/WebCore/platform/gtk/PlatformPasteboardGtk.cpp 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/gtk/PlatformPasteboardGtk.cpp 2019-10-22 07:22:19 UTC (rev 251421)
@@ -51,12 +51,12 @@
return { };
}
-long PlatformPasteboard::write(const PasteboardCustomData&)
+int64_t PlatformPasteboard::write(const PasteboardCustomData&)
{
return 0;
}
-long PlatformPasteboard::write(const Vector<PasteboardCustomData>&)
+int64_t PlatformPasteboard::write(const Vector<PasteboardCustomData>&)
{
return 0;
}
Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (251420 => 251421)
--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -76,7 +76,7 @@
#endif
-static long changeCountForPasteboard(const String& pasteboardName = { })
+static int64_t changeCountForPasteboard(const String& pasteboardName = { })
{
return platformStrategies()->pasteboardStrategy()->changeCount(pasteboardName);
}
@@ -90,7 +90,7 @@
{
}
-Pasteboard::Pasteboard(long changeCount)
+Pasteboard::Pasteboard(int64_t changeCount)
: m_changeCount(changeCount)
{
}
@@ -313,13 +313,16 @@
if (itemIndex && i != *itemIndex)
continue;
- auto info = strategy.informationForItemAtIndex(i, m_pasteboardName);
+ auto info = strategy.informationForItemAtIndex(i, m_pasteboardName, m_changeCount);
+ if (!info)
+ return;
+
#if ENABLE(ATTACHMENT_ELEMENT)
- if (canReadAttachment && prefersAttachmentRepresentation(info)) {
- auto typeForFileUpload = info.contentTypeForHighestFidelityItem();
+ if (canReadAttachment && prefersAttachmentRepresentation(*info)) {
+ auto typeForFileUpload = info->contentTypeForHighestFidelityItem();
if (auto buffer = strategy.readBufferFromPasteboard(i, typeForFileUpload, m_pasteboardName)) {
readURLAlongsideAttachmentIfNecessary(reader, strategy, typeForFileUpload, m_pasteboardName, i);
- reader.readDataBuffer(*buffer, typeForFileUpload, info.suggestedFileName, info.preferredPresentationSize);
+ reader.readDataBuffer(*buffer, typeForFileUpload, info->suggestedFileName, info->preferredPresentationSize);
continue;
}
}
@@ -330,7 +333,7 @@
if (!isTypeAllowedByReadingPolicy(type, policy))
continue;
- auto itemResult = readPasteboardWebContentDataForType(reader, strategy, type, info, i);
+ auto itemResult = readPasteboardWebContentDataForType(reader, strategy, type, *info, i);
if (itemResult == ReaderResult::PasteboardWasChangedExternally)
return;
@@ -357,13 +360,16 @@
continue;
#if ENABLE(ATTACHMENT_ELEMENT)
- auto info = strategy.informationForItemAtIndex(index, m_pasteboardName);
- auto attachmentFilePath = info.pathForHighestFidelityItem();
+ auto info = strategy.informationForItemAtIndex(index, m_pasteboardName, m_changeCount);
+ if (!info)
+ return;
+
+ auto attachmentFilePath = info->pathForHighestFidelityItem();
bool canReadAttachment = policy == WebContentReadingPolicy::AnyType && RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled() && !attachmentFilePath.isEmpty();
- auto contentType = info.contentTypeForHighestFidelityItem();
- if (canReadAttachment && prefersAttachmentRepresentation(info)) {
+ auto contentType = info->contentTypeForHighestFidelityItem();
+ if (canReadAttachment && prefersAttachmentRepresentation(*info)) {
readURLAlongsideAttachmentIfNecessary(reader, strategy, contentType, m_pasteboardName, index);
- reader.readFilePath(WTFMove(attachmentFilePath), info.preferredPresentationSize, contentType);
+ reader.readFilePath(WTFMove(attachmentFilePath), info->preferredPresentationSize, contentType);
continue;
}
#endif
@@ -370,11 +376,11 @@
// Try to read data from each type identifier that this pasteboard item supports, and WebKit also recognizes. Type identifiers are
// read in order of fidelity, as specified by each pasteboard item.
ReaderResult result = ReaderResult::DidNotReadType;
- for (auto& type : info.platformTypesByFidelity) {
+ for (auto& type : info->platformTypesByFidelity) {
if (!isTypeAllowedByReadingPolicy(type, policy))
continue;
- result = readPasteboardWebContentDataForType(reader, strategy, type, info, index);
+ result = readPasteboardWebContentDataForType(reader, strategy, type, *info, index);
if (result == ReaderResult::PasteboardWasChangedExternally)
return;
if (result == ReaderResult::ReadType)
@@ -382,7 +388,7 @@
}
#if ENABLE(ATTACHMENT_ELEMENT)
if (canReadAttachment && result == ReaderResult::DidNotReadType)
- reader.readFilePath(WTFMove(attachmentFilePath), info.preferredPresentationSize, contentType);
+ reader.readFilePath(WTFMove(attachmentFilePath), info->preferredPresentationSize, contentType);
#endif
}
}
@@ -457,7 +463,7 @@
platformStrategies()->pasteboardStrategy()->writeToPasteboard(String(), String(), m_pasteboardName);
}
-Vector<String> Pasteboard::readPlatformValuesAsStrings(const String& domType, long changeCount, const String& pasteboardName)
+Vector<String> Pasteboard::readPlatformValuesAsStrings(const String& domType, int64_t changeCount, const String& pasteboardName)
{
auto& strategy = *platformStrategies()->pasteboardStrategy();
@@ -524,7 +530,11 @@
auto& strategy = *platformStrategies()->pasteboardStrategy();
for (NSUInteger index = 0, numberOfItems = strategy.getPasteboardItemsCount(m_pasteboardName); index < numberOfItems; ++index) {
// Currently, drag and drop is the only case on iOS where the "pasteboard" may contain file paths.
- auto filePath = strategy.informationForItemAtIndex(index, m_pasteboardName).pathForHighestFidelityItem();
+ auto info = strategy.informationForItemAtIndex(index, m_pasteboardName, m_changeCount);
+ if (!info)
+ return { };
+
+ auto filePath = info->pathForHighestFidelityItem();
if (!filePath.isEmpty())
filePaths.append(WTFMove(filePath));
}
Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (251420 => 251421)
--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -164,11 +164,14 @@
#endif // PASTEBOARD_SUPPORTS_PRESENTATION_STYLE_AND_TEAM_DATA
-PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(size_t index)
+Optional<PasteboardItemInfo> PlatformPasteboard::informationForItemAtIndex(size_t index, int64_t changeCount)
{
if (index >= static_cast<NSUInteger>([m_pasteboard numberOfItems]))
- return { };
+ return WTF::nullopt;
+ if (this->changeCount() != changeCount)
+ return WTF::nullopt;
+
PasteboardItemInfo info;
NSItemProvider *itemProvider = [[m_pasteboard itemProviders] objectAtIndex:index];
if ([m_pasteboard respondsToSelector:@selector(fileUploadURLsAtIndex:fileTypes:)]) {
@@ -230,7 +233,6 @@
info.isNonTextType = true;
}
- info.changeCount = changeCount();
info.webSafeTypesByFidelity = webSafeTypes(registeredTypeIdentifiers, [&] {
return shouldTreatAtLeastOneTypeAsFile(registeredTypeIdentifiers) && !Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles(readString(index, kUTTypeURL));
});
@@ -240,9 +242,9 @@
#else
-PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(size_t)
+Optional<PasteboardItemInfo> PlatformPasteboard::informationForItemAtIndex(size_t, int64_t)
{
- return { };
+ return WTF::nullopt;
}
#endif
@@ -280,37 +282,37 @@
return URL();
}
-long PlatformPasteboard::copy(const String&)
+int64_t PlatformPasteboard::copy(const String&)
{
return 0;
}
-long PlatformPasteboard::addTypes(const Vector<String>&)
+int64_t PlatformPasteboard::addTypes(const Vector<String>&)
{
return 0;
}
-long PlatformPasteboard::setTypes(const Vector<String>&)
+int64_t PlatformPasteboard::setTypes(const Vector<String>&)
{
return 0;
}
-long PlatformPasteboard::setBufferForType(SharedBuffer*, const String&)
+int64_t PlatformPasteboard::setBufferForType(SharedBuffer*, const String&)
{
return 0;
}
-long PlatformPasteboard::setURL(const PasteboardURL&)
+int64_t PlatformPasteboard::setURL(const PasteboardURL&)
{
return 0;
}
-long PlatformPasteboard::setStringForType(const String&, const String&)
+int64_t PlatformPasteboard::setStringForType(const String&, const String&)
{
return 0;
}
-long PlatformPasteboard::changeCount() const
+int64_t PlatformPasteboard::changeCount() const
{
return [m_pasteboard changeCount];
}
@@ -375,7 +377,7 @@
registerItemsToPasteboard(@[ representationsToRegister ], pasteboard);
}
-long PlatformPasteboard::setColor(const Color& color)
+int64_t PlatformPasteboard::setColor(const Color& color)
{
auto representationsToRegister = adoptNS([[WebItemProviderRegistrationInfoList alloc] init]);
UIColor *uiColor = [PAL::getUIColorClass() colorWithCGColor:cachedCGColor(color)];
@@ -613,7 +615,7 @@
return representationsToRegister;
}
-long PlatformPasteboard::write(const Vector<PasteboardCustomData>& itemData)
+int64_t PlatformPasteboard::write(const Vector<PasteboardCustomData>& itemData)
{
auto registrationLists = adoptNS([[NSMutableArray alloc] initWithCapacity:itemData.size()]);
for (auto& data : itemData) {
@@ -626,7 +628,7 @@
#else
-long PlatformPasteboard::setColor(const Color&)
+int64_t PlatformPasteboard::setColor(const Color&)
{
return 0;
}
@@ -657,7 +659,7 @@
return { };
}
-long PlatformPasteboard::write(const Vector<PasteboardCustomData>&)
+int64_t PlatformPasteboard::write(const Vector<PasteboardCustomData>&)
{
return 0;
}
@@ -758,7 +760,7 @@
[m_pasteboard updateSupportedTypeIdentifiers:typesArray];
}
-long PlatformPasteboard::write(const PasteboardCustomData& data)
+int64_t PlatformPasteboard::write(const PasteboardCustomData& data)
{
return write(Vector<PasteboardCustomData> { data });
}
Modified: trunk/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp (251420 => 251421)
--- trunk/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/libwpe/PlatformPasteboardLibWPE.cpp 2019-10-22 07:22:19 UTC (rev 251421)
@@ -122,12 +122,12 @@
return { };
}
-long PlatformPasteboard::write(const PasteboardCustomData&)
+int64_t PlatformPasteboard::write(const PasteboardCustomData&)
{
return 0;
}
-long PlatformPasteboard::write(const Vector<PasteboardCustomData>&)
+int64_t PlatformPasteboard::write(const Vector<PasteboardCustomData>&)
{
return 0;
}
Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (251420 => 251421)
--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -188,7 +188,7 @@
static long writeURLForTypes(const Vector<String>& types, const String& pasteboardName, const PasteboardURL& pasteboardURL)
{
- long newChangeCount = platformStrategies()->pasteboardStrategy()->setTypes(types, pasteboardName);
+ auto newChangeCount = platformStrategies()->pasteboardStrategy()->setTypes(types, pasteboardName);
ASSERT(!pasteboardURL.url.isEmpty());
@@ -242,7 +242,7 @@
return wrapper;
}
-static void writeFileWrapperAsRTFDAttachment(NSFileWrapper *wrapper, const String& pasteboardName, long& newChangeCount)
+static void writeFileWrapperAsRTFDAttachment(NSFileWrapper *wrapper, const String& pasteboardName, int64_t& newChangeCount)
{
NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:wrapper];
NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:attachment];
@@ -323,9 +323,10 @@
auto& strategy = *platformStrategies()->pasteboardStrategy();
Vector<String> types;
- if (itemIndex)
- types = strategy.informationForItemAtIndex(*itemIndex , m_pasteboardName).platformTypesByFidelity;
- else
+ if (itemIndex) {
+ if (auto itemInfo = strategy.informationForItemAtIndex(*itemIndex, m_pasteboardName, m_changeCount))
+ types = itemInfo->platformTypesByFidelity;
+ } else
strategy.getTypes(types, m_pasteboardName);
if (types.contains(String(NSPasteboardTypeString))) {
@@ -406,9 +407,10 @@
auto& strategy = *platformStrategies()->pasteboardStrategy();
Vector<String> types;
- if (itemIndex)
- types = strategy.informationForItemAtIndex(*itemIndex , m_pasteboardName).platformTypesByFidelity;
- else
+ if (itemIndex) {
+ if (auto itemInfo = strategy.informationForItemAtIndex(*itemIndex, m_pasteboardName, m_changeCount))
+ types = itemInfo->platformTypesByFidelity;
+ } else
strategy.getTypes(types, m_pasteboardName);
reader.contentOrigin = readOrigin();
@@ -580,7 +582,7 @@
m_changeCount = platformStrategies()->pasteboardStrategy()->setStringForType(emptyString(), cocoaType, m_pasteboardName);
}
-Vector<String> Pasteboard::readPlatformValuesAsStrings(const String& domType, long changeCount, const String& pasteboardName)
+Vector<String> Pasteboard::readPlatformValuesAsStrings(const String& domType, int64_t changeCount, const String& pasteboardName)
{
auto& strategy = *platformStrategies()->pasteboardStrategy();
auto cocoaType = cocoaTypeFromHTMLClipboardType(domType);
Modified: trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm (251420 => 251421)
--- trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -222,7 +222,7 @@
return copyToVector(domPasteboardTypes);
}
-long PlatformPasteboard::write(const PasteboardCustomData& data)
+int64_t PlatformPasteboard::write(const PasteboardCustomData& data)
{
NSMutableArray *types = [NSMutableArray array];
data.forEachType([&] (auto& type) {
@@ -250,7 +250,7 @@
return changeCount();
}
-long PlatformPasteboard::changeCount() const
+int64_t PlatformPasteboard::changeCount() const
{
return [m_pasteboard.get() changeCount];
}
@@ -284,7 +284,7 @@
return [NSURL URLFromPasteboard:m_pasteboard.get()];
}
-long PlatformPasteboard::copy(const String& fromPasteboard)
+int64_t PlatformPasteboard::copy(const String& fromPasteboard)
{
NSPasteboard* pasteboard = [NSPasteboard pasteboardWithName:fromPasteboard];
NSArray* types = [pasteboard types];
@@ -298,7 +298,7 @@
return changeCount();
}
-long PlatformPasteboard::addTypes(const Vector<String>& pasteboardTypes)
+int64_t PlatformPasteboard::addTypes(const Vector<String>& pasteboardTypes)
{
RetainPtr<NSMutableArray> types = adoptNS([[NSMutableArray alloc] init]);
for (size_t i = 0; i < pasteboardTypes.size(); ++i)
@@ -307,7 +307,7 @@
return [m_pasteboard.get() addTypes:types.get() owner:nil];
}
-long PlatformPasteboard::setTypes(const Vector<String>& pasteboardTypes)
+int64_t PlatformPasteboard::setTypes(const Vector<String>& pasteboardTypes)
{
if (pasteboardTypes.isEmpty())
return [m_pasteboard declareTypes:@[] owner:nil];
@@ -319,7 +319,7 @@
return [m_pasteboard.get() declareTypes:types.get() owner:nil];
}
-long PlatformPasteboard::setBufferForType(SharedBuffer* buffer, const String& pasteboardType)
+int64_t PlatformPasteboard::setBufferForType(SharedBuffer* buffer, const String& pasteboardType)
{
BOOL didWriteData = [m_pasteboard setData:buffer ? buffer->createNSData().get() : nil forType:pasteboardType];
if (!didWriteData)
@@ -327,7 +327,7 @@
return changeCount();
}
-long PlatformPasteboard::setURL(const PasteboardURL& pasteboardURL)
+int64_t PlatformPasteboard::setURL(const PasteboardURL& pasteboardURL)
{
NSURL *cocoaURL = pasteboardURL.url;
NSArray *urlWithTitle = @[ @[ cocoaURL.absoluteString ], @[ pasteboardURL.title ] ];
@@ -339,7 +339,7 @@
return changeCount();
}
-long PlatformPasteboard::setColor(const Color& color)
+int64_t PlatformPasteboard::setColor(const Color& color)
{
NSColor *pasteboardColor = nsColor(color);
[pasteboardColor writeToPasteboard:m_pasteboard.get()];
@@ -346,7 +346,7 @@
return changeCount();
}
-long PlatformPasteboard::setStringForType(const String& string, const String& pasteboardType)
+int64_t PlatformPasteboard::setStringForType(const String& string, const String& pasteboardType)
{
BOOL didWriteData;
@@ -486,7 +486,7 @@
return item;
}
-long PlatformPasteboard::write(const Vector<PasteboardCustomData>& itemData)
+int64_t PlatformPasteboard::write(const Vector<PasteboardCustomData>& itemData)
{
if (itemData.size() == 1)
return write(itemData.first());
@@ -499,11 +499,14 @@
return [m_pasteboard changeCount];
}
-PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(size_t index)
+Optional<PasteboardItemInfo> PlatformPasteboard::informationForItemAtIndex(size_t index, int64_t changeCount)
{
+ if (changeCount != [m_pasteboard changeCount])
+ return WTF::nullopt;
+
NSPasteboardItem *item = itemAtIndex(index);
if (!item)
- return { };
+ return WTF::nullopt;
PasteboardItemInfo info;
NSArray<NSPasteboardType> *platformTypes = [item types];
@@ -520,7 +523,6 @@
}
info.containsFileURLAndFileUploadContent = containsFileURL == ContainsFileURL::Yes;
info.webSafeTypesByFidelity = copyToVector(webSafeTypes);
- info.changeCount = changeCount();
return info;
}
Modified: trunk/Source/WebKit/ChangeLog (251420 => 251421)
--- trunk/Source/WebKit/ChangeLog 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKit/ChangeLog 2019-10-22 07:22:19 UTC (rev 251421)
@@ -1,3 +1,46 @@
+2019-10-22 Wenson Hsieh <[email protected]>
+
+ imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https.html is flaky
+ https://bugs.webkit.org/show_bug.cgi?id=203181
+
+ Reviewed by Ryosuke Niwa.
+
+ Add a changeCount argument to informationForItemAtIndex and allPasteboardItemInfo, and also make then return
+ optional values; also, adjust changeCount to be an `int64_t` in a few places. See WebCore ChangeLog for more
+ details.
+
+ * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
+ (WebKit::WebPasteboardProxy::pasteboardCopy):
+ (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
+ (WebKit::WebPasteboardProxy::addPasteboardTypes):
+ (WebKit::WebPasteboardProxy::setPasteboardTypes):
+ (WebKit::WebPasteboardProxy::setPasteboardURL):
+ (WebKit::WebPasteboardProxy::setPasteboardColor):
+ (WebKit::WebPasteboardProxy::setPasteboardStringForType):
+ (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
+ (WebKit::WebPasteboardProxy::writeCustomData):
+ (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
+ (WebKit::WebPasteboardProxy::informationForItemAtIndex):
+ * UIProcess/WebPasteboardProxy.cpp:
+ (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
+ (WebKit::WebPasteboardProxy::informationForItemAtIndex):
+ * UIProcess/WebPasteboardProxy.h:
+ * UIProcess/WebPasteboardProxy.messages.in:
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ (WebKit::PDFPlugin::writeItemsToPasteboard):
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+ (WebKit::WebPlatformStrategies::changeCount):
+ (WebKit::WebPlatformStrategies::addTypes):
+ (WebKit::WebPlatformStrategies::setTypes):
+ (WebKit::WebPlatformStrategies::setBufferForType):
+ (WebKit::WebPlatformStrategies::setURL):
+ (WebKit::WebPlatformStrategies::setColor):
+ (WebKit::WebPlatformStrategies::setStringForType):
+ (WebKit::WebPlatformStrategies::writeCustomData):
+ (WebKit::WebPlatformStrategies::allPasteboardItemInfo):
+ (WebKit::WebPlatformStrategies::informationForItemAtIndex):
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
2019-10-21 Daniel Bates <[email protected]>
Add some PencilKit extension points
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (251420 => 251421)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -97,12 +97,12 @@
completionHandler(WTFMove(handle), size);
}
-void WebPasteboardProxy::pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, CompletionHandler<void(int64_t)>&& completionHandler)
{
completionHandler(PlatformPasteboard(toPasteboard).copy(fromPasteboard));
}
-void WebPasteboardProxy::getPasteboardChangeCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::getPasteboardChangeCount(const String& pasteboardName, CompletionHandler<void(int64_t)>&& completionHandler)
{
completionHandler(PlatformPasteboard(pasteboardName).changeCount());
}
@@ -122,17 +122,17 @@
completionHandler(PlatformPasteboard(pasteboardName).url().string());
}
-void WebPasteboardProxy::addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(int64_t)>&& completionHandler)
{
completionHandler(PlatformPasteboard(pasteboardName).addTypes(pasteboardTypes));
}
-void WebPasteboardProxy::setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(int64_t)>&& completionHandler)
{
completionHandler(PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes));
}
-void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, CompletionHandler<void(int64_t)>&& completionHandler)
{
for (auto* webProcessProxy : m_webProcessProxyList) {
if (!webProcessProxy->hasConnection(connection))
@@ -146,17 +146,17 @@
completionHandler(0);
}
-void WebPasteboardProxy::setPasteboardColor(const String& pasteboardName, const WebCore::Color& color, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::setPasteboardColor(const String& pasteboardName, const WebCore::Color& color, CompletionHandler<void(int64_t)>&& completionHandler)
{
completionHandler(PlatformPasteboard(pasteboardName).setColor(color));
}
-void WebPasteboardProxy::setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String& string, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String& string, CompletionHandler<void(int64_t)>&& completionHandler)
{
completionHandler(PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType));
}
-void WebPasteboardProxy::setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, CompletionHandler<void(int64_t)>&& completionHandler)
{
if (handle.isNull())
return completionHandler(PlatformPasteboard(pasteboardName).setBufferForType(0, pasteboardType));
@@ -175,19 +175,19 @@
completionHandler(PlatformPasteboard(pasteboardName).typesSafeForDOMToReadAndWrite(origin));
}
-void WebPasteboardProxy::writeCustomData(const Vector<PasteboardCustomData>& data, const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::writeCustomData(const Vector<PasteboardCustomData>& data, const String& pasteboardName, CompletionHandler<void(int64_t)>&& completionHandler)
{
completionHandler(PlatformPasteboard(pasteboardName).write(data));
}
-void WebPasteboardProxy::allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<PasteboardItemInfo>&&)>&& completionHandler)
+void WebPasteboardProxy::allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount, CompletionHandler<void(Optional<Vector<PasteboardItemInfo>>&&)>&& completionHandler)
{
- completionHandler(PlatformPasteboard(pasteboardName).allPasteboardItemInfo());
+ completionHandler(PlatformPasteboard(pasteboardName).allPasteboardItemInfo(changeCount));
}
-void WebPasteboardProxy::informationForItemAtIndex(size_t index, const String& pasteboardName, CompletionHandler<void(PasteboardItemInfo&&)>&& completionHandler)
+void WebPasteboardProxy::informationForItemAtIndex(size_t index, const String& pasteboardName, int64_t changeCount, CompletionHandler<void(Optional<PasteboardItemInfo>&&)>&& completionHandler)
{
- completionHandler(PlatformPasteboard(pasteboardName).informationForItemAtIndex(index));
+ completionHandler(PlatformPasteboard(pasteboardName).informationForItemAtIndex(index, changeCount));
}
void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp (251420 => 251421)
--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp 2019-10-22 07:22:19 UTC (rev 251421)
@@ -75,19 +75,19 @@
completionHandler({ });
}
-void WebPasteboardProxy::writeCustomData(const Vector<WebCore::PasteboardCustomData>&, const String&, CompletionHandler<void(uint64_t)>&& completionHandler)
+void WebPasteboardProxy::writeCustomData(const Vector<WebCore::PasteboardCustomData>&, const String&, CompletionHandler<void(int64_t)>&& completionHandler)
{
completionHandler(0);
}
-void WebPasteboardProxy::allPasteboardItemInfo(const String&, CompletionHandler<void(Vector<WebCore::PasteboardItemInfo>&&)>&& completionHandler)
+void WebPasteboardProxy::allPasteboardItemInfo(const String&, int64_t, CompletionHandler<void(Optional<Vector<WebCore::PasteboardItemInfo>>&&)>&& completionHandler)
{
- completionHandler({ });
+ completionHandler(WTF::nullopt);
}
-void WebPasteboardProxy::informationForItemAtIndex(size_t, const String&, CompletionHandler<void(WebCore::PasteboardItemInfo&&)>&& completionHandler)
+void WebPasteboardProxy::informationForItemAtIndex(size_t, const String&, int64_t, CompletionHandler<void(Optional<WebCore::PasteboardItemInfo>&&)>&& completionHandler)
{
- completionHandler({ });
+ completionHandler(WTF::nullopt);
}
void WebPasteboardProxy::getPasteboardItemsCount(const String&, CompletionHandler<void(uint64_t)>&& completionHandler)
Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h (251420 => 251421)
--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h 2019-10-22 07:22:19 UTC (rev 251421)
@@ -83,17 +83,17 @@
void getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(String&&)>&&);
void getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&&)>&&);
void getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&&);
- void pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, CompletionHandler<void(uint64_t)>&&);
- void getPasteboardChangeCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
+ void pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, CompletionHandler<void(int64_t)>&&);
+ void getPasteboardChangeCount(const String& pasteboardName, CompletionHandler<void(int64_t)>&&);
void getPasteboardUniqueName(CompletionHandler<void(String&&)>&&);
void getPasteboardColor(const String& pasteboardName, CompletionHandler<void(WebCore::Color&&)>&&);
void getPasteboardURL(const String& pasteboardName, CompletionHandler<void(const String&)>&&);
- void addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&&);
- void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&&);
- void setPasteboardURL(IPC::Connection&, const WebCore::PasteboardURL&, const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
- void setPasteboardColor(const String&, const WebCore::Color&, CompletionHandler<void(uint64_t)>&&);
- void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, CompletionHandler<void(uint64_t)>&&);
- void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, CompletionHandler<void(uint64_t)>&&);
+ void addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(int64_t)>&&);
+ void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(int64_t)>&&);
+ void setPasteboardURL(IPC::Connection&, const WebCore::PasteboardURL&, const String& pasteboardName, CompletionHandler<void(int64_t)>&&);
+ void setPasteboardColor(const String&, const WebCore::Color&, CompletionHandler<void(int64_t)>&&);
+ void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, CompletionHandler<void(int64_t)>&&);
+ void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, CompletionHandler<void(int64_t)>&&);
#endif
void readStringFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&&);
@@ -100,10 +100,10 @@
void readURLFromPasteboard(size_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&&);
void readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&&);
void getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
- void informationForItemAtIndex(size_t index, const String& pasteboardName, CompletionHandler<void(WebCore::PasteboardItemInfo&&)>&&);
- void allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<WebCore::PasteboardItemInfo>&&)>&&);
+ void informationForItemAtIndex(size_t index, const String& pasteboardName, int64_t changeCount, CompletionHandler<void(Optional<WebCore::PasteboardItemInfo>&&)>&&);
+ void allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount, CompletionHandler<void(Optional<Vector<WebCore::PasteboardItemInfo>>&&)>&&);
- void writeCustomData(const Vector<WebCore::PasteboardCustomData>&, const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
+ void writeCustomData(const Vector<WebCore::PasteboardCustomData>&, const String& pasteboardName, CompletionHandler<void(int64_t)>&&);
void typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&&);
#if PLATFORM(GTK)
Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in (251420 => 251421)
--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in 2019-10-22 07:22:19 UTC (rev 251421)
@@ -29,10 +29,10 @@
UpdateSupportedTypeIdentifiers(Vector<String> identifiers, String pasteboardName)
#endif
- WriteCustomData(Vector<WebCore::PasteboardCustomData> data, String pasteboardName) -> (uint64_t changeCount) Synchronous
+ WriteCustomData(Vector<WebCore::PasteboardCustomData> data, String pasteboardName) -> (int64_t changeCount) Synchronous
TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) Synchronous
- AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo) Synchronous
- InformationForItemAtIndex(uint64_t index, String pasteboardName) -> (struct WebCore::PasteboardItemInfo info) Synchronous
+ AllPasteboardItemInfo(String pasteboardName, int64_t changeCount) -> (Optional<Vector<WebCore::PasteboardItemInfo>> allInfo) Synchronous
+ InformationForItemAtIndex(uint64_t index, String pasteboardName, int64_t changeCount) -> (Optional<WebCore::PasteboardItemInfo> info) Synchronous
GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount) Synchronous
ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) Synchronous
ReadURLFromPasteboard(uint64_t index, String pasteboardName) -> (String url, String title) Synchronous
@@ -46,17 +46,17 @@
GetPasteboardStringForType(String pasteboardName, String pasteboardType) -> (String string) Synchronous
GetPasteboardStringsForType(String pasteboardName, String pasteboardType) -> (Vector<String> strings) Synchronous
GetPasteboardBufferForType(String pasteboardName, String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Synchronous
- PasteboardCopy(String fromPasteboard, String toPasteboard) -> (uint64_t changeCount) Synchronous
- GetPasteboardChangeCount(String pasteboardName) -> (uint64_t changeCount) Synchronous
+ PasteboardCopy(String fromPasteboard, String toPasteboard) -> (int64_t changeCount) Synchronous
+ GetPasteboardChangeCount(String pasteboardName) -> (int64_t changeCount) Synchronous
GetPasteboardUniqueName() -> (String pasteboardName) Synchronous
GetPasteboardColor(String pasteboardName) -> (WebCore::Color color) Synchronous
GetPasteboardURL(String pasteboardName) -> (String urlString) Synchronous
- AddPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) Synchronous
- SetPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) Synchronous
- SetPasteboardURL(struct WebCore::PasteboardURL pasteboardURL, String pasteboardName) -> (uint64_t changeCount) Synchronous WantsConnection
- SetPasteboardColor(String pasteboardName, WebCore::Color color) -> (uint64_t changeCount) Synchronous
- SetPasteboardStringForType(String pasteboardName, String pasteboardType, String string) -> (uint64_t changeCount) Synchronous
- SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (uint64_t changeCount) Synchronous
+ AddPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (int64_t changeCount) Synchronous
+ SetPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (int64_t changeCount) Synchronous
+ SetPasteboardURL(struct WebCore::PasteboardURL pasteboardURL, String pasteboardName) -> (int64_t changeCount) Synchronous WantsConnection
+ SetPasteboardColor(String pasteboardName, WebCore::Color color) -> (int64_t changeCount) Synchronous
+ SetPasteboardStringForType(String pasteboardName, String pasteboardType, String string) -> (int64_t changeCount) Synchronous
+ SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (int64_t changeCount) Synchronous
#endif
#if PLATFORM(GTK)
Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (251420 => 251421)
--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -1736,7 +1736,7 @@
for (NSString *type in types)
pasteboardTypes.append(type);
- uint64_t newChangeCount;
+ int64_t newChangeCount;
auto& webProcess = WebProcess::singleton();
webProcess.parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardTypes(pasteboardName, pasteboardTypes),
Messages::WebPasteboardProxy::SetPasteboardTypes::Reply(newChangeCount), 0);
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (251420 => 251421)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2019-10-22 07:22:19 UTC (rev 251421)
@@ -156,9 +156,9 @@
return values;
}
-long WebPlatformStrategies::changeCount(const WTF::String &pasteboardName)
+int64_t WebPlatformStrategies::changeCount(const String& pasteboardName)
{
- uint64_t changeCount { 0 };
+ int64_t changeCount { 0 };
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardChangeCount(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardChangeCount::Reply(changeCount), 0);
return changeCount;
}
@@ -184,21 +184,21 @@
return URL({ }, urlString);
}
-long WebPlatformStrategies::addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
+int64_t WebPlatformStrategies::addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
{
- uint64_t newChangeCount { 0 };
+ int64_t newChangeCount { 0 };
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::AddPasteboardTypes(pasteboardName, pasteboardTypes), Messages::WebPasteboardProxy::AddPasteboardTypes::Reply(newChangeCount), 0);
return newChangeCount;
}
-long WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
+int64_t WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
{
- uint64_t newChangeCount { 0 };
+ int64_t newChangeCount { 0 };
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardTypes(pasteboardName, pasteboardTypes), Messages::WebPasteboardProxy::SetPasteboardTypes::Reply(newChangeCount), 0);
return newChangeCount;
}
-long WebPlatformStrategies::setBufferForType(SharedBuffer* buffer, const String& pasteboardType, const String& pasteboardName)
+int64_t WebPlatformStrategies::setBufferForType(SharedBuffer* buffer, const String& pasteboardType, const String& pasteboardName)
{
SharedMemory::Handle handle;
if (buffer && buffer->size()) {
@@ -210,28 +210,28 @@
sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
}
}
- uint64_t newChangeCount { 0 };
+ int64_t newChangeCount { 0 };
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardBufferForType(pasteboardName, pasteboardType, handle, buffer ? buffer->size() : 0), Messages::WebPasteboardProxy::SetPasteboardBufferForType::Reply(newChangeCount), 0);
return newChangeCount;
}
-long WebPlatformStrategies::setURL(const PasteboardURL& pasteboardURL, const String& pasteboardName)
+int64_t WebPlatformStrategies::setURL(const PasteboardURL& pasteboardURL, const String& pasteboardName)
{
- uint64_t newChangeCount;
+ int64_t newChangeCount;
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardURL(pasteboardURL, pasteboardName), Messages::WebPasteboardProxy::SetPasteboardURL::Reply(newChangeCount), 0);
return newChangeCount;
}
-long WebPlatformStrategies::setColor(const Color& color, const String& pasteboardName)
+int64_t WebPlatformStrategies::setColor(const Color& color, const String& pasteboardName)
{
- uint64_t newChangeCount { 0 };
+ int64_t newChangeCount { 0 };
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardColor(pasteboardName, color), Messages::WebPasteboardProxy::SetPasteboardColor::Reply(newChangeCount), 0);
return newChangeCount;
}
-long WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
+int64_t WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
{
- uint64_t newChangeCount { 0 };
+ int64_t newChangeCount { 0 };
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardStringForType(pasteboardName, pasteboardType, string), Messages::WebPasteboardProxy::SetPasteboardStringForType::Reply(newChangeCount), 0);
return newChangeCount;
}
@@ -318,9 +318,9 @@
return types;
}
-long WebPlatformStrategies::writeCustomData(const Vector<PasteboardCustomData>& data, const String& pasteboardName)
+int64_t WebPlatformStrategies::writeCustomData(const Vector<PasteboardCustomData>& data, const String& pasteboardName)
{
- uint64_t newChangeCount { 0 };
+ int64_t newChangeCount { 0 };
WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::WriteCustomData(data, pasteboardName), Messages::WebPasteboardProxy::WriteCustomData::Reply(newChangeCount), 0);
return newChangeCount;
}
@@ -332,17 +332,17 @@
return itemsCount;
}
-Vector<PasteboardItemInfo> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName)
+Optional<Vector<PasteboardItemInfo>> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount)
{
- Vector<PasteboardItemInfo> allInfo;
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::AllPasteboardItemInfo(pasteboardName), Messages::WebPasteboardProxy::AllPasteboardItemInfo::Reply(allInfo), 0);
+ Optional<Vector<PasteboardItemInfo>> allInfo;
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::AllPasteboardItemInfo(pasteboardName, changeCount), Messages::WebPasteboardProxy::AllPasteboardItemInfo::Reply(allInfo), 0);
return allInfo;
}
-PasteboardItemInfo WebPlatformStrategies::informationForItemAtIndex(size_t index, const String& pasteboardName)
+Optional<PasteboardItemInfo> WebPlatformStrategies::informationForItemAtIndex(size_t index, const String& pasteboardName, int64_t changeCount)
{
- PasteboardItemInfo info;
- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::InformationForItemAtIndex(index, pasteboardName), Messages::WebPasteboardProxy::InformationForItemAtIndex::Reply(info), 0);
+ Optional<PasteboardItemInfo> info;
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::InformationForItemAtIndex(index, pasteboardName, changeCount), Messages::WebPasteboardProxy::InformationForItemAtIndex::Reply(info), 0);
return info;
}
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h (251420 => 251421)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h 2019-10-22 07:22:19 UTC (rev 251421)
@@ -59,17 +59,17 @@
void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) override;
String stringForType(const String& pasteboardType, const String& pasteboardName) override;
Vector<String> allStringsForType(const String& pasteboardType, const String& pasteboardName) override;
- long changeCount(const String& pasteboardName) override;
+ int64_t changeCount(const String& pasteboardName) override;
String uniqueName() override;
WebCore::Color color(const String& pasteboardName) override;
URL url(const String& pasteboardName) override;
- 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 setURL(const WebCore::PasteboardURL&, const String& pasteboardName) override;
- long setColor(const WebCore::Color&, const String& pasteboardName) override;
- long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
+ int64_t addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
+ int64_t setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
+ int64_t setBufferForType(WebCore::SharedBuffer*, const String& pasteboardType, const String& pasteboardName) override;
+ int64_t setURL(const WebCore::PasteboardURL&, const String& pasteboardName) override;
+ int64_t setColor(const WebCore::Color&, const String& pasteboardName) override;
+ int64_t setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
#endif
#if PLATFORM(GTK)
void writeToClipboard(const String& pasteboardName, const WebCore::SelectionData&) override;
@@ -85,10 +85,10 @@
RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) override;
URL readURLFromPasteboard(size_t index, const String& pasteboardName, String& title) override;
int getPasteboardItemsCount(const String& pasteboardName) override;
- WebCore::PasteboardItemInfo informationForItemAtIndex(size_t index, const String& pasteboardName) override;
- Vector<WebCore::PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) override;
+ Optional<WebCore::PasteboardItemInfo> informationForItemAtIndex(size_t index, const String& pasteboardName, int64_t changeCount) override;
+ Optional<Vector<WebCore::PasteboardItemInfo>> allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount) override;
Vector<String> typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin) override;
- long writeCustomData(const Vector<WebCore::PasteboardCustomData>&, const String&) override;
+ int64_t writeCustomData(const Vector<WebCore::PasteboardCustomData>&, const String&) override;
};
} // namespace WebKit
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (251420 => 251421)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-10-22 07:22:19 UTC (rev 251421)
@@ -1,3 +1,26 @@
+2019-10-22 Wenson Hsieh <[email protected]>
+
+ imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https.html is flaky
+ https://bugs.webkit.org/show_bug.cgi?id=203181
+
+ Reviewed by Ryosuke Niwa.
+
+ Add a changeCount argument to informationForItemAtIndex and allPasteboardItemInfo, and also make then return
+ optional values. See WebCore ChangeLog for more details.
+
+ * WebCoreSupport/WebPlatformStrategies.h:
+ * WebCoreSupport/WebPlatformStrategies.mm:
+ (WebPlatformStrategies::changeCount):
+ (WebPlatformStrategies::addTypes):
+ (WebPlatformStrategies::setTypes):
+ (WebPlatformStrategies::setBufferForType):
+ (WebPlatformStrategies::setURL):
+ (WebPlatformStrategies::setColor):
+ (WebPlatformStrategies::setStringForType):
+ (WebPlatformStrategies::writeCustomData):
+ (WebPlatformStrategies::informationForItemAtIndex):
+ (WebPlatformStrategies::allPasteboardItemInfo):
+
2019-10-17 Devin Rousso <[email protected]>
Web Inspector: rework frontend agent construction to allow commands/events to be controlled by the related target's type
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h (251420 => 251421)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h 2019-10-22 07:22:19 UTC (rev 251421)
@@ -57,8 +57,8 @@
RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(size_t index, const String& pasteboardType, const String& pasteboardName) override;
URL readURLFromPasteboard(size_t index, const String& pasteboardName, String& title) override;
int getPasteboardItemsCount(const String& pasteboardName) override;
- WebCore::PasteboardItemInfo informationForItemAtIndex(size_t index, const String& pasteboardName) override;
- Vector<WebCore::PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) override;
+ Optional<WebCore::PasteboardItemInfo> informationForItemAtIndex(size_t index, const String& pasteboardName, int64_t changeCount) override;
+ Optional<Vector<WebCore::PasteboardItemInfo>> allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount) override;
int getNumberOfFiles(const String& pasteboardName) override;
void getTypes(Vector<String>& types, const String& pasteboardName) override;
RefPtr<WebCore::SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) override;
@@ -65,19 +65,19 @@
void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) override;
String stringForType(const String& pasteboardType, const String& pasteboardName) override;
Vector<String> allStringsForType(const String& pasteboardType, const String& pasteboardName) override;
- long changeCount(const String& pasteboardName) override;
+ int64_t changeCount(const String& pasteboardName) override;
String uniqueName() override;
WebCore::Color color(const String& pasteboardName) override;
URL url(const String& pasteboardName) override;
- long writeCustomData(const Vector<WebCore::PasteboardCustomData>&, const String& pasteboardName) override;
+ int64_t writeCustomData(const Vector<WebCore::PasteboardCustomData>&, const String& pasteboardName) override;
Vector<String> typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin) override;
- 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 setURL(const WebCore::PasteboardURL&, const String& pasteboardName) override;
- long setColor(const WebCore::Color&, const String& pasteboardName) override;
- long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
+ int64_t addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
+ int64_t setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
+ int64_t setBufferForType(WebCore::SharedBuffer*, const String& pasteboardType, const String& pasteboardName) override;
+ int64_t setURL(const WebCore::PasteboardURL&, const String& pasteboardName) override;
+ int64_t setColor(const WebCore::Color&, const String& pasteboardName) override;
+ int64_t setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
};
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (251420 => 251421)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm 2019-10-22 07:11:25 UTC (rev 251420)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm 2019-10-22 07:22:19 UTC (rev 251421)
@@ -108,7 +108,7 @@
return PlatformPasteboard(pasteboardName).stringForType(pasteboardType);
}
-long WebPlatformStrategies::changeCount(const String &pasteboardName)
+int64_t WebPlatformStrategies::changeCount(const String& pasteboardName)
{
return PlatformPasteboard(pasteboardName).changeCount();
}
@@ -128,32 +128,32 @@
return PlatformPasteboard(pasteboardName).url();
}
-long WebPlatformStrategies::addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
+int64_t WebPlatformStrategies::addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
{
return PlatformPasteboard(pasteboardName).addTypes(pasteboardTypes);
}
-long WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
+int64_t WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
{
return PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);
}
-long WebPlatformStrategies::setBufferForType(SharedBuffer* buffer, const String& pasteboardType, const String& pasteboardName)
+int64_t WebPlatformStrategies::setBufferForType(SharedBuffer* buffer, const String& pasteboardType, const String& pasteboardName)
{
return PlatformPasteboard(pasteboardName).setBufferForType(buffer, pasteboardType);
}
-long WebPlatformStrategies::setURL(const PasteboardURL& pasteboardURL, const String& pasteboardName)
+int64_t WebPlatformStrategies::setURL(const PasteboardURL& pasteboardURL, const String& pasteboardName)
{
return PlatformPasteboard(pasteboardName).setURL(pasteboardURL);
}
-long WebPlatformStrategies::setColor(const Color& color, const String& pasteboardName)
+int64_t WebPlatformStrategies::setColor(const Color& color, const String& pasteboardName)
{
return PlatformPasteboard(pasteboardName).setColor(color);
}
-long WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
+int64_t WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
{
return PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType);
}
@@ -168,19 +168,19 @@
return PlatformPasteboard(pasteboardName).typesSafeForDOMToReadAndWrite(origin);
}
-long WebPlatformStrategies::writeCustomData(const Vector<WebCore::PasteboardCustomData>& data, const String& pasteboardName)
+int64_t WebPlatformStrategies::writeCustomData(const Vector<WebCore::PasteboardCustomData>& data, const String& pasteboardName)
{
return PlatformPasteboard(pasteboardName).write(data);
}
-WebCore::PasteboardItemInfo WebPlatformStrategies::informationForItemAtIndex(size_t index, const String& pasteboardName)
+Optional<WebCore::PasteboardItemInfo> WebPlatformStrategies::informationForItemAtIndex(size_t index, const String& pasteboardName, int64_t changeCount)
{
- return PlatformPasteboard(pasteboardName).informationForItemAtIndex(index);
+ return PlatformPasteboard(pasteboardName).informationForItemAtIndex(index, changeCount);
}
-Vector<WebCore::PasteboardItemInfo> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName)
+Optional<Vector<WebCore::PasteboardItemInfo>> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount)
{
- return PlatformPasteboard(pasteboardName).allPasteboardItemInfo();
+ return PlatformPasteboard(pasteboardName).allPasteboardItemInfo(changeCount);
}
int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)