Bug 1902305 - Check if clipboard type is supported in nsBaseClipboard::HasDataMatchingFlavors; r=tschuster

Differential Revision: https://phabricator.services.mozilla.com/D213766
This commit is contained in:
Edgar Chen 2024-06-18 09:18:08 +00:00
parent 9fc3caae0d
commit 4f7cb2c845

View File

@ -777,6 +777,13 @@ nsBaseClipboard::HasDataMatchingFlavors(const nsTArray<nsCString>& aFlavorList,
int32_t aWhichClipboard,
bool* aOutResult) {
MOZ_CLIPBOARD_LOG("%s: clipboard=%d", __FUNCTION__, aWhichClipboard);
if (!nsIClipboard::IsClipboardTypeSupported(aWhichClipboard)) {
MOZ_CLIPBOARD_LOG("%s: clipboard %d is not supported.", __FUNCTION__,
aWhichClipboard);
return NS_ERROR_FAILURE;
}
if (MOZ_CLIPBOARD_LOG_ENABLED()) {
MOZ_CLIPBOARD_LOG(" Asking for content clipboard=%i:\n",
aWhichClipboard);