Open Bug 1965097 Opened 1 year ago Updated 1 year ago

Consider modifying nsIClipboardDataSnapshot.getData{Sync}() to support retrieving data for multiple types at once

Categories

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

enhancement

Tracking

()

People

(Reporter: edgar, Assigned: edgar)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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).

After bug 1951225, {Async}GetNativeClipboardData() is more flexible to use, which makes the implementation easier.

Blocks: 1938618
Assignee: nobody → echen

After bug 1951225, {Async}GetNativeClipboardData() became more flexible to use.
We can now have nsIClipboardDataSnapshot.getData{Sync}() load all available types
without accidentally including types not in the flavor list.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: