Closed Bug 1874203 Opened 2 years ago Closed 5 months ago

Expose a chrome-only way to tell the size of the clipboard

Categories

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

task

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox153 --- fixed

People

(Reporter: mak, Assigned: daisuke)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(1 external file)

In cases like Bug 1866710 we'd like to periodically poll the text in the clipboard and enable some UI if what we find matches our expectations.
Unfortunately that (https://searchfox.org/mozilla-central/rev/961a9e56a0b5fa96ceef22c61c5e75fb6ba53395/browser/base/content/browser.js#3060) may be particularly slow if the clipboard contains a very large chunk of text, like 100MB.
It would be nice to have an API to either:

  • get the size, or an estimate of what's in the clipboard
  • getDataIfSmallerThan(transfer, clipboard, maxsize)

Thoughts or suggestions on how we could workaround the problem otherwise are welcome.

Blocks: 1866710
See Also: → 1894614
Assignee: nobody → daisuke
Attachment #9540276 - Attachment description: WIP: Bug 1874203: Introduce nsIClipboard.getDataIfSmallerThan() → Bug 1874203: Introduce nsIClipboard.getDataIfSmallerThan()
Attachment #9540276 - Attachment description: Bug 1874203: Introduce nsIClipboard.getDataIfSmallerThan() → ;QQQBug 1874203: Introduce nsIClipboard.getDataIfSmallerThan()
Attachment #9540276 - Attachment description: ;QQQBug 1874203: Introduce nsIClipboard.getDataIfSmallerThan() → Bug 1874203: Introduce nsIClipboard.getDataIfSmallerThan()
Pushed by dakatsuka.birchill@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/31e276101e9d https://hg.mozilla.org/integration/autoland/rev/9a6593fc63d4 Introduce nsIClipboard.getDataIfSmallerThan() r=mak,win-reviewers,geckoview-reviewers,nalexander,gstoll
Regressions: 2042062
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
QA Whiteboard: [qa-triage-done-c154/b153]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: