Closed Bug 1852947 Opened 9 months ago Closed 7 months ago

Consider redesigning the async get API in nsIClipboard

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

In bug 1755863, we introduce two async get API in nsIClipboard to make async clipboard API really read the clipboard data asynchronously.

When user read the clipboard data through async clipboard API, it gets the available type first, and then get the actual data for s certain type. There's a potential race condition concern if the clipboard has different data on it when we check the types compared to when we actually get the data. Currently, we get the actual data immediate after getting available types (this also follows spec), so there is only a small chance to hit such racing problem. However, if we would like to get the data only when getType() is called (bug 1691825), that will become a serious issue.

Also, bug 1777448 would like to have a way to track the clipboard data and not show the paste contextmenu when the clipboard data is written by the same-origin page. That also requires a better way of tracking read request and the actual clipboard data/available types and invaliding the request when the clipboard data in system is changed.

Blocks: 1691825, 1777448

And we could also have some tests then.

Assignee: nobody → echen
Depends on: 1851817
Attachment #9353787 - Attachment description: WIP: Bug 1852947 - Part 1: Rename nsIAsyncSetClipboardDataCallback to nsIAsyncClipboardRequestCallback; → Bug 1852947 - Part 1: Rename nsIAsyncSetClipboardDataCallback to nsIAsyncClipboardRequestCallback; r?nika
Attachment #9353788 - Attachment description: WIP: Bug 1852947 - Part 2: Redesign the async clipboard read API; → Bug 1852947 - Part 2: Redesign the async clipboard read API; r?nika
Attachment #9353788 - Attachment description: Bug 1852947 - Part 2: Redesign the async clipboard read API; r?nika → Bug 1852947 - Part 3: Redesign the async clipboard read API; r?nika
Depends on: 1861927

Comment on attachment 9353787 [details]
Bug 1852947 - Part 1: Rename nsIAsyncSetClipboardDataCallback to nsIAsyncClipboardRequestCallback; r?nika

Revision D188526 was moved to bug 1861927. Setting attachment 9353787 [details] to obsolete.

Attachment #9353787 - Attachment is obsolete: true

Comment on attachment 9359322 [details]
Bug 1852947 - Part 2: Add function attribute to nsIAsyncClipboardRequestCallback; r?nika

Revision D191409 was moved to bug 1861927. Setting attachment 9359322 [details] to obsolete.

Attachment #9359322 - Attachment is obsolete: true
Attachment #9353788 - Attachment description: Bug 1852947 - Part 3: Redesign the async clipboard read API; r?nika → Bug 1852947 - Redesign the async clipboard read API; r?nika
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c8561b4726a2
Redesign the async clipboard read API; r=nika

Backed out for causing bustage on nsClipboardProxy.cpp

Backout link

Push with failures

Failure log

Flags: needinfo?(echen)
Flags: needinfo?(echen)
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7355802744d1
Redesign the async clipboard read API; r=nika
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b0ff38a7d9fb
Redesign the async clipboard read API; r=nika
Regressions: 1864211
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b9ca7370b303
Redesign the async clipboard read API; r=nika
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
Flags: needinfo?(echen)
Duplicate of this bug: 1777467
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: