Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (260315 => 260316)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2020-04-18 16:33:03 UTC (rev 260315)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2020-04-18 16:35:05 UTC (rev 260316)
@@ -127,9 +127,7 @@
void WebPasteboardProxy::getPasteboardPathnamesForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType,
CompletionHandler<void(Vector<String>&& pathnames, SandboxExtension::HandleArray&& sandboxExtensions)>&& completionHandler)
{
- ASSERT(!pasteboardType.isNull());
- if (pasteboardType.isNull())
- return completionHandler({ }, { });
+ MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }, { }));
// FIXME: This should consult canAccessPasteboardData() as well, and avoid responding with file paths if it returns false.
Vector<String> pathnames;
@@ -153,21 +151,17 @@
void WebPasteboardProxy::getPasteboardStringForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(String&&)>&& completionHandler)
{
+ MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }));
+
if (!canAccessPasteboardData(connection, pasteboardName))
return completionHandler({ });
- ASSERT(!pasteboardType.isNull());
- if (pasteboardType.isNull())
- return completionHandler({ });
-
completionHandler(PlatformPasteboard(pasteboardName).stringForType(pasteboardType));
}
void WebPasteboardProxy::getPasteboardStringsForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
{
- ASSERT(!pasteboardType.isNull());
- if (pasteboardType.isNull())
- return completionHandler({ });
+ MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }));
if (!canAccessPasteboardData(connection, pasteboardName))
return completionHandler({ });
@@ -177,9 +171,7 @@
void WebPasteboardProxy::getPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler)
{
- ASSERT(!pasteboardType.isNull());
- if (pasteboardType.isNull())
- return completionHandler({ }, 0);
+ MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }, 0));
if (!canAccessPasteboardData(connection, pasteboardName))
return completionHandler({ }, 0);
@@ -260,9 +252,7 @@
void WebPasteboardProxy::setPasteboardStringForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const String& string, CompletionHandler<void(int64_t)>&& completionHandler)
{
- ASSERT(!pasteboardType.isNull());
- if (pasteboardType.isNull())
- return completionHandler(0);
+ MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler(0));
auto previousChangeCount = PlatformPasteboard(pasteboardName).changeCount();
auto newChangeCount = PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType);
@@ -287,9 +277,7 @@
void WebPasteboardProxy::setPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, CompletionHandler<void(int64_t)>&& completionHandler)
{
- ASSERT(!pasteboardType.isNull());
- if (pasteboardType.isNull())
- return completionHandler(0);
+ MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler(0));
auto previousChangeCount = PlatformPasteboard(pasteboardName).changeCount();
if (handle.isNull()) {
@@ -315,11 +303,9 @@
completionHandler(PlatformPasteboard(pasteboardName).numberOfFiles());
}
-void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
+void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(IPC::Connection& connection, const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
{
- ASSERT(!origin.isNull());
- if (origin.isNull())
- return completionHandler({ });
+ MESSAGE_CHECK_COMPLETION(!origin.isNull(), completionHandler({ }));
completionHandler(PlatformPasteboard(pasteboardName).typesSafeForDOMToReadAndWrite(origin));
}
@@ -349,9 +335,7 @@
void WebPasteboardProxy::readStringFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&& completionHandler)
{
- ASSERT(!pasteboardType.isNull());
- if (pasteboardType.isNull())
- return completionHandler({ });
+ MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }));
if (!canAccessPasteboardData(connection, pasteboardName))
return completionHandler({ });
@@ -371,9 +355,7 @@
void WebPasteboardProxy::readBufferFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&& completionHandler)
{
- ASSERT(!pasteboardType.isNull());
- if (pasteboardType.isNull())
- return completionHandler({ }, 0);
+ MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }, 0));
if (!canAccessPasteboardData(connection, pasteboardName))
return completionHandler({ }, 0);
@@ -437,4 +419,6 @@
} // namespace WebKit
+#undef MESSAGE_CHECK_COMPLETION
+#undef MESSAGE_CHECK_WITH_RETURN_VALUE
#undef MESSAGE_CHECK
Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h (260315 => 260316)
--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h 2020-04-18 16:33:03 UTC (rev 260315)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h 2020-04-18 16:35:05 UTC (rev 260316)
@@ -111,7 +111,7 @@
void allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount, CompletionHandler<void(Optional<Vector<WebCore::PasteboardItemInfo>>&&)>&&);
void writeCustomData(IPC::Connection&, const Vector<WebCore::PasteboardCustomData>&, const String& pasteboardName, CompletionHandler<void(int64_t)>&&);
- void typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&&);
+ void typesSafeForDOMToReadAndWrite(IPC::Connection&, const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&&);
void containsStringSafeForDOMToReadForType(const String&, const String& pasteboardName, CompletionHandler<void(bool)>&&);
void containsURLStringSuitableForLoading(const String& pasteboardName, CompletionHandler<void(bool)>&&);
void urlStringSuitableForLoading(IPC::Connection&, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&&);
Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in (260315 => 260316)
--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in 2020-04-18 16:33:03 UTC (rev 260315)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in 2020-04-18 16:35:05 UTC (rev 260316)
@@ -30,7 +30,7 @@
#endif
WriteCustomData(Vector<WebCore::PasteboardCustomData> data, String pasteboardName) -> (int64_t changeCount) Synchronous WantsConnection
- TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) Synchronous
+ TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) Synchronous WantsConnection
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