Bug 1892976 - Stop throwing error on nsIClipboard::GetData() when the type isn't available on android; r=geckoview-reviewers,m_kato

Other platforms don't throw error; this patch makes android behave consistently
with other platforms.

Differential Revision: https://phabricator.services.mozilla.com/D208470
This commit is contained in:
Edgar Chen 2024-05-01 20:49:08 +00:00
Родитель 03fe5e116a
Коммит 01c5a3987a
2 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -164,7 +164,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable* aTransferable,
}
}
return NS_ERROR_FAILURE;
return NS_OK;
}
nsresult nsClipboard::EmptyNativeClipboardData(int32_t aWhichClipboard) {

Просмотреть файл

@ -149,5 +149,20 @@ clipboardTypes.forEach(function (clipboardType) {
// Clear all clipboard data.
cleanupAllClipboard();
});
add_task(function test_unsupport_flavor() {
try {
is(
getClipboardData("foo/bar", clipboardType),
null,
`Test getData for clipboard type ${clipboardType}`
);
} catch (e) {
ok(
false,
`getData should not throw error for clipboard type ${clipboardType}`
);
}
});
}
});