mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
async clipboard: implement writeText
(#36498)
Implement enough of the Clipboard API to have a working `writeText`. Testing: Unfortunately many clipboard-apis tests require testdriver, so only idlharness ones will pass now. --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
parent
c6dc7c83a8
commit
2bab5d8d52
11 changed files with 173 additions and 41 deletions
|
@ -87,6 +87,10 @@ DOMInterfaces = {
|
|||
'canGc': ['Before', 'After', 'Remove', 'ReplaceWith']
|
||||
},
|
||||
|
||||
'Clipboard': {
|
||||
'canGc': ['WriteText']
|
||||
},
|
||||
|
||||
'ClipboardItem': {
|
||||
'canGc': ['Types']
|
||||
},
|
||||
|
|
|
@ -2,7 +2,17 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://w3c.github.io/clipboard-apis/#clipboard-item-interface
|
||||
// https://w3c.github.io/clipboard-apis
|
||||
|
||||
typedef sequence<ClipboardItem> ClipboardItems;
|
||||
|
||||
[SecureContext, Exposed=Window, Pref="dom_async_clipboard_enabled"]
|
||||
interface Clipboard : EventTarget {
|
||||
// Promise<ClipboardItems> read();
|
||||
// Promise<DOMString> readText();
|
||||
// Promise<undefined> write(ClipboardItems data);
|
||||
Promise<undefined> writeText(DOMString data);
|
||||
};
|
||||
|
||||
typedef Promise<(DOMString or Blob)> ClipboardItemData;
|
||||
|
||||
|
|
|
@ -70,3 +70,8 @@ partial interface Navigator {
|
|||
interface mixin NavigatorConcurrentHardware {
|
||||
readonly attribute unsigned long long hardwareConcurrency;
|
||||
};
|
||||
|
||||
// https://w3c.github.io/clipboard-apis/#navigator-interface
|
||||
partial interface Navigator {
|
||||
[SecureContext, SameObject, Pref="dom_async_clipboard_enabled"] readonly attribute Clipboard clipboard;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue