Closed Bug 1712122 Opened 3 years ago Closed 11 months ago

Implement Promise support in the ClipboardItem constructor

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
115 Branch
Webcompat Priority P2
Tracking Status
firefox115 --- fixed

People

(Reporter: evilpie, Assigned: edgar)

References

(Blocks 3 open bugs)

Details

Attachments

(3 files, 2 obsolete files)

We currently don't support Promises in the ClipboardItem constructor like Chrome. Safari does support it and it's specified in the spec.

Before shipping we need to either implement this or change the spec, because this is apparently causing issues: bug 1619947 comment 25.

Blocks: 1688865

I am pretty sure the ref-counting and CC handling is totally wrong, because it's missing for
mPromises and mResolvedEntries.

I added mResolvedEntries because I remembered some previous discussion that MozPromise can't
hold something alive? I don't actually remember the details.

It does pass all the wpt clipboard-apis tests. However those don't include anything for Promises
in the constructor.

Hey Nika, would you mind taking a look at the CC handling etc. in the patch?

Flags: needinfo?(nika)
Assignee: nobody → evilpies
Flags: needinfo?(nika)
Assignee: evilpies → nobody
Attachment #9223146 - Attachment is obsolete: true
Type: task → enhancement

Changing severity to N/A for enhancement

Severity: -- → N/A

Seems like Chromium is finally working on this feature thanks to Microsoft: https://bugs.chromium.org/p/chromium/issues/detail?id=1014310.

Webcompat Priority: --- → ?
Webcompat Priority: ? → P3
Webcompat Priority: P3 → P2
Assignee: nobody → echen
Attachment #9297338 - Attachment description: WIP: Bug 1712122 - Implement Promise support in the ClipboardItem constructor; → Bug 1712122 - Implement Promise support in the ClipboardItem constructor; r?nika
Attachment #9297338 - Attachment description: Bug 1712122 - Implement Promise support in the ClipboardItem constructor; r?nika → WIP: Bug 1712122 - Implement Promise support in the ClipboardItem constructor;
Attachment #9297338 - Attachment description: WIP: Bug 1712122 - Implement Promise support in the ClipboardItem constructor; → Bug 1712122 - Implement Promise support in the ClipboardItem constructor; r?nika
Attachment #9297338 - Attachment description: Bug 1712122 - Implement Promise support in the ClipboardItem constructor; r?nika → Bug 1712122 - Part 2: Implement Promise support in the ClipboardItem constructor; r?nika

The Async Clipboard API now allows using arbitrary promises for passing write data,
potentially enabling websites to delay writing data to an arbitrary future, which
may surprise the user. This patch introduces a solution: a new write request will
automatically cancel any previous pending request.

To implement that, this patch introduces a new method to nsIClipboard, new XPCOM
interfaces, and new IPC to efficiently track individual write requests. Additionally,
a new helper base class, ClipboardSetDataHelper, is introduced in widget to facilitate
platform code sharing.

Depends on D158710

Comment on attachment 9325955 [details]
Bug 1712122 - Part 4: Disallow clipboard write when page is not in the active tab; r?nika

Revision D174091 was moved to bug 1830340. Setting attachment 9325955 [details] to obsolete.

Attachment #9325955 - Attachment is obsolete: true
Blocks: 1830340
Blocks: 1832701
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/079998facc02
Part 1: Mark some internal utility function as static; r=nika
https://hg.mozilla.org/integration/autoland/rev/cae91f0a02df
Part 2: Implement Promise support in the ClipboardItem constructor; r=nika
https://hg.mozilla.org/integration/autoland/rev/4d1cb082dad7
Part 3: Cancel pending write request when a new write request is made; r=nika,geckoview-reviewers,m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/40005 for changes under testing/web-platform/tests
Regressions: 1833061
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
Upstream PR merged by moz-wptsync-bot
Regressions: 1838593
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: