Closed Bug 1768597 Opened 2 years ago Closed 2 years ago

Use the utility functions for `IPCDataTransfer` conversion

Categories

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

task

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

Details

Attachments

(3 files)

This bug is filed while working on bug 1524237.
In bug 1524237, we would like to use Shmem to pass the large string over IPC for clipboard operation. I found there are duplicate codes for IPCDataTransfer conversion. It would be nice to have a central place doing the conversion, so that changes in bug 1524237 don't need to be applied into multiple places.

If a IPCDataTransferItem fails to be converted, the subsequent IPCDataTransferItems
will be ignored, and the data in Shmem won't be deallocated properly if any.

See also bug 1732920. I don't remember the exact data types involved anymore, but we do handle some types differently depending on whether the data is being send for drag and drop or copy/paste.

Yeah, we do differently on image type for dnd and copy/paste,

But luckily, we setup IPCDataTransferImage only when covering imgIContainer into Shmem type, https://searchfox.org/mozilla-central/rev/390f7009e9e5a9585297aeea5fb9202f800eaf12/dom/base/nsContentUtils.cpp#7896-7901. So we could make IPCDataTransferImage "nullable" in https://searchfox.org/mozilla-central/rev/390f7009e9e5a9585297aeea5fb9202f800eaf12/dom/ipc/DOMTypes.ipdlh#122, and base on that to decide how to handle shmem data for image type.

Blocks: 1524237
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e92cac424950
Part 1: Ensure all Shmem data is deallocated in nsContentUtils::IPCTransferableToTransferable; r=NeilDeakin
https://hg.mozilla.org/integration/autoland/rev/f41095466201
Part 2: Use nsContentUtils::IPCTransferableToTransferable to convert IPCDataTransfer into nsITransferable; r=NeilDeakin
https://hg.mozilla.org/integration/autoland/rev/ae2100095307
Part 3: Use utility function to convert IPCDataTransferItem into nsIVariant; r=NeilDeakin
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: