From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- widget/tests/test_clipboard_cache_chrome.html | 55 +++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) (limited to 'widget/tests/test_clipboard_cache_chrome.html') diff --git a/widget/tests/test_clipboard_cache_chrome.html b/widget/tests/test_clipboard_cache_chrome.html index 55b6d41589..81d7a652b6 100644 --- a/widget/tests/test_clipboard_cache_chrome.html +++ b/widget/tests/test_clipboard_cache_chrome.html @@ -37,7 +37,12 @@ function testClipboardCache(aClipboardType, aAsync, aIsSupportGetFromCachedTrans addStringToTransferable("text/foo", string, trans); // XXX macOS caches the transferable to implement kSelectionCache type, too, // so it behaves differently than other types. - if (aClipboardType == clipboard.kSelectionCache && !aIsSupportGetFromCachedTransferable) { + if ( + navigator.platform.includes("Mac") && + aClipboardType == clipboard.kSelectionCache && + !aIsSupportGetFromCachedTransferable && + !SpecialPowers.isHeadless + ) { todo_is(getClipboardData("text/foo", aClipboardType), aIsSupportGetFromCachedTransferable ? string : null, `Check text/foo data on clipboard ${aClipboardType}`); @@ -66,7 +71,12 @@ function testClipboardCache(aClipboardType, aAsync, aIsSupportGetFromCachedTrans `Check text/plain data on clipboard ${aClipboardType} again`); // XXX macOS caches the transferable to implement kSelectionCache type, too, // so it behaves differently than other types. - if (aClipboardType == clipboard.kSelectionCache && !aIsSupportGetFromCachedTransferable) { + if ( + navigator.platform.includes("Mac") && + aClipboardType == clipboard.kSelectionCache && + !aIsSupportGetFromCachedTransferable && + !SpecialPowers.isHeadless + ) { todo_is(getClipboardData("text/foo", aClipboardType), aIsSupportGetFromCachedTransferable ? string : null, `Check text/foo data on clipboard ${aClipboardType} again`); @@ -118,7 +128,12 @@ function runClipboardCacheTests(aIsSupportGetFromCachedTransferable) { `Check if there is text/plain flavor on clipboard ${type}`); // XXX macOS caches the transferable to implement kSelectionCache type, too, // so it behaves differently than other types. - if (type == clipboard.kSelectionCache && !aIsSupportGetFromCachedTransferable) { + if ( + navigator.platform.includes("Mac") && + type == clipboard.kSelectionCache && + !aIsSupportGetFromCachedTransferable && + !SpecialPowers.isHeadless + ) { todo_is(clipboard.hasDataMatchingFlavors(["text/foo"], type), aIsSupportGetFromCachedTransferable, `Check if there is text/foo flavor on clipboard ${type}`); @@ -147,7 +162,12 @@ function runClipboardCacheTests(aIsSupportGetFromCachedTransferable) { `Check if there is text/plain flavor on clipboard ${type}`); // XXX macOS caches the transferable to implement kSelectionCache type, too, // so it behaves differently than other types. - if (type == clipboard.kSelectionCache && !aIsSupportGetFromCachedTransferable) { + if ( + navigator.platform.includes("Mac") && + type == clipboard.kSelectionCache && + !aIsSupportGetFromCachedTransferable && + !SpecialPowers.isHeadless + ) { todo_is(clipboard.hasDataMatchingFlavors(["text/foo"], type), aIsSupportGetFromCachedTransferable, `Check if there is text/foo flavor on clipboard ${type}`); @@ -212,6 +232,33 @@ function runClipboardCacheTests(aIsSupportGetFromCachedTransferable) { await testClipboardData(await asyncGetClipboardData(type), clipboardData); }); + add_task(async function test_flavorList_order() { + info(`test_flavorList_order with pref ` + + `${aIsSupportGetFromCachedTransferable ? "enabled" : "disabled"}`); + + const trans = generateNewTransferable("text/plain", generateRandomString()); + addStringToTransferable("text/html", `
${generateRandomString()}
`, trans); + + info(`Writedata to clipboard ${type}`); + clipboard.setData(trans, null, type); + + // Read with reverse order. + let flavors = trans.flavorsTransferableCanExport().reverse(); + let request = await asyncGetClipboardData(type, flavors); + // XXX Not all clipboard type supports html format, e.g. kFindClipboard + // on macOS only support writing text/plain. + if ( + navigator.platform.includes("Mac") && + type == clipboard.kFindClipboard && + !aIsSupportGetFromCachedTransferable && + !SpecialPowers.isHeadless + ) { + isDeeply(request.flavorList, ["text/plain"], "check flavor orders"); + } else { + isDeeply(request.flavorList, flavors, "check flavor orders"); + } + }); + // Test sync set clipboard data. testClipboardCache(type, false, aIsSupportGetFromCachedTransferable); -- cgit v1.2.3