Intent to prototype: Async clipboard API improvement for read()/readText() and write()

259 views
Skip to first unread message

Edgar Chen

unread,
Mar 6, 2023, 8:49:29 AM3/6/23
to dev-pl...@lists.mozilla.org

Summary:
Clipboard writeText API was shipped to security context in Firefox 63 [1], but the readText API is only exposed to web extensions

and read/write APIs are put behind `dom.events.asyncClipboard.clipboardItem` pref, which is disabled by default. 


We are currently working on making read and readText APIs shippable to web pages by improving the security model.
This will show a context menu item to get user confirmation whenever the page tries to read the system clipboard programmatically
and the clipboard data isn’t from the same origin document.

For the write API, we are currently working on making the ClipboardItem constructor take a promise, which is resolved with
the actual write data, as the data type. And the write API also supports non-text type, i.e. image/png, now.


Bug
: https://bugzilla.mozilla.org/show_bug.cgi?id=1619251

Specification
: https://w3c.github.io/clipboard-apis/#async-clipboard-api

Standards Body
: W3C

Platform coverage
: All

Preference: `dom.events.asyncClipboard.readText` for readText()
          `
dom.events.asyncClipboard.clipboardItem` for read()/write()

DevTools bug: N/A

Standards-positions
: https://github.com/mozilla/standards-positions/issues/89

Other browsers:

  • Blink: Shipped (M66) with clipboard permission checks.
  • WebKit: Shipped with the security model, which is similar to what we are implementing, https://webkit.org/blog/10855/.


web-platform-tests
: https://wpt.fyi/results/clipboard-apis?label=experimental&label=master&aligned

[1] https://groups.google.com/g/mozilla.dev.platform/c/ef7O7PrmNh0/m/ud3BS0eBBgAJ 


--

Best Regards,

Edgar Chen

Edgar Chen

unread,
Dec 11, 2023, 7:21:47 AM12/11/23
to dev-pl...@lists.mozilla.org
Hi folks,

Async clipboard API is now enabled on Nightly and early Beta (see Bug 1809106) for testing.

--
Best Regards,
Edgar Chen
Reply all
Reply to author
Forward
0 new messages