Closed Bug 1809713 Opened 3 years ago Closed 1 year ago

Change nsIClipboard constant lists to be a CEnum type

Categories

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

task

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: edgar, Assigned: tschuster)

References

Details

Attachments

(4 files, 1 obsolete file)

Turn https://searchfox.org/mozilla-central/rev/fb9a504ca73529fa550efe488db2a012a4bf5169/widget/nsIClipboard.idl#26-30 into something like

cenum ClipboardType : 8 {
  kSelectionClipboard = 0,
  kGlobalClipboard = 1,
  kFindClipboard = 2,
  kSelectionCache = 3,
};

When creating a DataTransfer object, we assign a clipboard type to it, and use that to pass to nsIClipboard. Ideally DataTransfer should use the same type defined in nsIClipboard, but there are some place use -1 as clipboard type to create a DataTransfer, e.g.

We need to sort out how to deal with that first.

No longer blocks: 1773707
See Also: → CVE-2024-6606

We also use an invalid ClipboardType in EditorBase::PasteTransferableAsAction: https://searchfox.org/mozilla-central/rev/b11735b86bb4d416c918e2b2413456561beff50c/editor/libeditor/EditorBase.cpp#1977-1979

    // Use an invalid value for the clipboard type as data comes from
    // aTransferable and we don't currently implement a way to put that in the
    // data transfer in TextEditor yet.
Assignee: nobody → tschuster
Attachment #9408385 - Attachment description: WIP: Bug 1809713 - Make nsIClipboard ClipboardType an enum. r?edgar → Bug 1809713 - Make nsIClipboard ClipboardType an enum. r?edgar
Status: NEW → ASSIGNED
Attachment #9408931 - Attachment is obsolete: true
Attachment #9408931 - Attachment is obsolete: true
Attachment #9408385 - Attachment description: Bug 1809713 - Make nsIClipboard ClipboardType an enum. r?edgar → Bug 1809713 - Make nsIClipboard ClipboardType an enum. r?nika
Keywords: leave-open
Pushed by tschuster@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f7f2bc943b32 Make nsIClipboard ClipboardType an enum. r=nika
Attachment #9416256 - Attachment description: WIP: Bug 1809713 - Change nsIClipboard to use the ClipboardType enum → Bug 1809713 - Change nsIClipboard to use the ClipboardType enum. r?nika

Even with the last patch there are still places where we could use the ClipboardType enum, e.g. in GTK's nsRetrievalContext.

Keywords: leave-open
Pushed by tschuster@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/faacd4575132 Use ClipboardType in editor. r=masayuki https://hg.mozilla.org/integration/autoland/rev/9fa01e6facf7 Make DataTransfer use Maybe<ClipboardType>. r=edgar https://hg.mozilla.org/integration/autoland/rev/9cad26af81b2 Change nsIClipboard to use the ClipboardType enum. r=nika,geckoview-reviewers,win-reviewers,gstoll,m_kato
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
See Also: → 1966621
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: