tor-browser

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

commit 49beffa1c06658c2098602c62e68fb6697c6439a
parent 71057c48576bd1b6be46857d5e5f6b515bf1f7b5
Author: Jeff Muizelaar <jmuizelaar@mozilla.com>
Date:   Thu, 13 Nov 2025 20:31:19 +0000

Bug 1993095. Don't include "application/x-moz-file" in types. r=tschuster

The existance of kFileMime ("application/x-moz-file") in types
is breaking drag and drop on fiverr.com. We don't seem to need it.

Differential Revision: https://phabricator.services.mozilla.com/D268167

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+++-------
Mdom/events/test/clipboard/test_paste_image.html | 2+-
Mtoolkit/components/contentanalysis/tests/browser/browser_clipboard_paste_file_content_analysis.js | 16++++------------
Mtoolkit/components/contentanalysis/tests/browser/clipboard_paste_file.html | 6++----
6 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/browser/base/content/test/general/browser_clipboard_pastefile.js b/browser/base/content/test/general/browser_clipboard_pastefile.js @@ -78,13 +78,9 @@ add_task(async function () { "paste", function (event) { let dt = event.clipboardData; - is(dt.types.length, 3, "number of types"); + is(dt.types.length, 2, "number of types"); ok(dt.types.includes("text/plain"), "text/plain exists in types"); - 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'"); + is(dt.types[1], "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,11 +22,9 @@ function is(a, b, msg) { async function checkPasteHelper(event) { let dt = event.clipboardData; - is(dt.types.length, 2, "Correct number of types"); + is(dt.types.length, 1, "Correct number of types"); - // 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.types[0], "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,13 +450,9 @@ void DataTransferItemList::GetTypes(nsTArray<nsString>& aTypes, continue; } - // 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)) { + if (item->Kind() != DataTransferItem::KIND_FILE) { + nsAutoString type; + item->GetType(type); aTypes.AppendElement(type); } } diff --git a/dom/events/test/clipboard/test_paste_image.html b/dom/events/test/clipboard/test_paste_image.html @@ -107,7 +107,7 @@ window.addEventListener("paste", async (e) => { isDeeply(e.clipboardData.types, (navigator.platform.includes("Win") && imageAsFileEnabled) ? - ["application/x-moz-file", "Files"] : ["text/html", "text/plain", "Files"]); + ["Files"] : ["text/html", "text/plain", "Files"]); await onPaste(e, imageAsFileEnabled); resolve(); }, { once: true }); diff --git a/toolkit/components/contentanalysis/tests/browser/browser_clipboard_paste_file_content_analysis.js b/toolkit/components/contentanalysis/tests/browser/browser_clipboard_paste_file_content_analysis.js @@ -182,13 +182,9 @@ async function testClipboardPasteFileWithContentAnalysis(allowPaste) { "paste", function (event) { let dt = event.clipboardData; - is(dt.types.length, 3, "number of types"); + is(dt.types.length, 2, "number of types"); ok(dt.types.includes("text/plain"), "text/plain exists in types"); - 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'"); + is(dt.types[1], "Files", "Last type should be 'Files'"); ok( dt.mozTypesAt(0).contains("text/plain"), "text/plain exists in mozTypesAt" @@ -347,13 +343,9 @@ async function testClipboardPasteDirectoryWithContentAnalysis(allowPaste) { "paste", function (event) { let dt = event.clipboardData; - is(dt.types.length, 3, "number of types"); + is(dt.types.length, 2, "number of types"); ok(dt.types.includes("text/plain"), "text/plain exists in types"); - 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'"); + is(dt.types[1], "Files", "Last type should be 'Files'"); ok( dt.mozTypesAt(0).contains("text/plain"), "text/plain exists in mozTypesAt" diff --git a/toolkit/components/contentanalysis/tests/browser/clipboard_paste_file.html b/toolkit/components/contentanalysis/tests/browser/clipboard_paste_file.html @@ -25,12 +25,10 @@ async function checkPasteHelper(event) { let filePasteAllowed = document.getElementById("pasteAllowed").checked; let pasteIsDir = document.getElementById("pasteIsDir").checked; - is(dt.types.length, filePasteAllowed ? 2 : 0, "Correct number of types"); + is(dt.types.length, filePasteAllowed ? 1 : 0, "Correct number of types"); if (filePasteAllowed) { - // 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.types[0], "Files", "Last type must be Files"); } is(dt.getData("text/plain"), "", "text/plain found with getData");