Consider modifying nsIClipboardDataSnapshot.getData{Sync}() to support retrieving data for multiple types at once
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, enhancement)
Tracking
()
People
(Reporter: edgar, Unassigned)
References
(Blocks 1 open bug)
Details
Currently, nsIClipboardDataSnapshot.getData{Sync}()
retrieves only the first available type of nsITransferable and throws an error if nsITransferable contains a type not in the flavor list. This behavior is primarily due to how each platform implements GetNativeClipboardData()
. So when we would like to get data for multiple types, we would need to create a temporary nsITransferable contains only one type for each type that we want to load, e.g. https://searchfox.org/mozilla-central/rev/3b3c7a0c930a5451be3b4088ed795ce01ddf002e/editor/libeditor/EditorBase.cpp#7368-7402.
I think we could try to make nsIClipboardDataSnapshot.getData{Sync}()
more flexible to use to support load all available type in nsITransferable and ignore the type if it doesn't in the available flavor list (instead of throwing an error).
In order to support this, we might need to modify the GetNativeClipboardData
to make it more flexible to use as well, for example
Result<nsCOMPtr<nsISupports>, nsresult> GetNativeClipboardData(ClipboardType aWhichClipboard, const nsACString& aFlavor);
which takes a MIME type and returns the corresponding data if it is available. Then we could build the behavior we want on the top of it.
Description
•