tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit a9582148b310718125a86b373c57aaf4dc444337
parent 1461b2e40d9b23d0e0142e579f1279b8f6267fa0
Author: Sandor Molnar <smolnar@mozilla.com>
Date:   Fri, 24 Oct 2025 19:21:05 +0300

Revert "Bug 1993095. Don't include "application/x-moz-file" in types. r=tschuster" for causing bc failures @ browser_clipboard_paste_file_content_analysis.js

This reverts commit 781eb0294d9ad538fa78cf5814eaee7dc4c898ff.

Diffstat:
Mbrowser/base/content/test/general/browser_clipboard_pastefile.js | 8++++++--
Mbrowser/base/content/test/general/clipboard_pastefile.html | 6++++--
Mdom/events/DataTransferItemList.cpp | 10+++++++---
3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/browser/base/content/test/general/browser_clipboard_pastefile.js b/browser/base/content/test/general/browser_clipboard_pastefile.js @@ -78,9 +78,13 @@ add_task(async function () { "paste", function (event) { let dt = event.clipboardData; - is(dt.types.length, 2, "number of types"); + is(dt.types.length, 3, "number of types"); ok(dt.types.includes("text/plain"), "text/plain exists in types"); - is(dt.types[1], "Files", "Last type should be 'Files'"); + ok( + dt.types.includes("application/x-moz-file"), + "application/x-moz-file exists in types" + ); + is(dt.types[2], "Files", "Last type should be 'Files'"); ok( dt.mozTypesAt(0).contains("text/plain"), "text/plain exists in mozTypesAt" diff --git a/browser/base/content/test/general/clipboard_pastefile.html b/browser/base/content/test/general/clipboard_pastefile.html @@ -22,9 +22,11 @@ function is(a, b, msg) { async function checkPasteHelper(event) { let dt = event.clipboardData; - is(dt.types.length, 1, "Correct number of types"); + is(dt.types.length, 2, "Correct number of types"); - is(dt.types[0], "Files", "Last type must be Files"); + // TODO: Remove application/x-moz-file from content. + is(dt.types[0], "application/x-moz-file", "First type") + is(dt.types[1], "Files", "Last type must be Files"); is(dt.getData("text/plain"), "", "text/plain found with getData"); is(dt.getData("application/x-moz-file"), "", "application/x-moz-file found with getData"); diff --git a/dom/events/DataTransferItemList.cpp b/dom/events/DataTransferItemList.cpp @@ -450,9 +450,13 @@ void DataTransferItemList::GetTypes(nsTArray<nsString>& aTypes, continue; } - if (item->Kind() != DataTransferItem::KIND_FILE) { - nsAutoString type; - item->GetType(type); + // NOTE: The reason why we get the internal type here is because we want + // kFileMime to appear in the types list for backwards compatibility + // reasons. + nsAutoString type; + item->GetInternalType(type); + if (item->Kind() != DataTransferItem::KIND_FILE || + type.EqualsASCII(kFileMime)) { aTypes.AppendElement(type); } }