Open Bug 1841468 Opened 2 years ago Updated 2 years ago

Adding text/plain and 'text/plain;charset=ISO-8859-1': mime type data in DataTransfer in resulting in two items where as it is adding as one in Chrome and Safari

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

Firefox 114
defect

Tracking

()

Tracking Status
firefox115 --- affected
firefox116 --- affected

People

(Reporter: vissu_nbkr, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15

Steps to reproduce:

Running following code produce the length as 8 in firefox but in chrome and safari has only 1 element.

dataTransfer = new DataTransfer();
[ ["text/plain" ,1 ],
["text/plain;charset=iso-8859-1", 2],
["text/plain;charset=us-ascii", 3],
["text/plain;charset=utf-16", 4],
["text/plain;charset=utf-16be", 5],
["text/plain;charset=utf-16le", 6],
["text/plain;charset=utf-8", 7],
["text/plain;charset=unicode",8 ]
].forEach(item=>dataTransfer.setData(item[0],item[1]));
console.log(dataTransfer.types.length)

Actual results:

8

Expected results:

1

Hello, thank you for the bug report!
Managed to reproduce this issue on:

  • Firefox 115.0;
  • Nightly 116.0a1;

Tested and reproduced on:

  • Windows 10;
  • macOS 12;
  • Ubuntu 22;

Moving the Product to ‘DevTools’ and the Component to ' Console’. Please change if there’s a better fit, thank you.
Setting as NEW so the developers can have a look.

Status: UNCONFIRMED → NEW
Component: Untriaged → Console
Ever confirmed: true
Product: Firefox → DevTools

Not a DevTools bug, this can be reproduced on data:text/html,<meta charset=utf8><output></output><script>x = new DataTransfer(); x.setData("text/plain",1); x.setData("text/plain;charset=utf-16",2);document.querySelector("output").innerText = x.types.join("\n")</script> , without opening DevTools

Component: Console → DOM: UI Events & Focus Handling
Product: DevTools → Core
Severity: -- → S3
Component: DOM: UI Events & Focus Handling → DOM: Copy & Paste and Drag & Drop
You need to log in before you can comment on or make changes to this bug.