Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / dom / webidl / Clipboard.webidl
blob35463d3c8a09860560660d88abe44b739be60c0b
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * The origin of this IDL file is
7  * https://w3c.github.io/clipboard-apis/
8  *
9  * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10  * liability, trademark and document use rules apply.
11  */
13 typedef sequence<ClipboardItem> ClipboardItems;
15 [SecureContext,
16  Exposed=Window,
17  InstrumentedProps=(read,readText,write)]
18 interface Clipboard : EventTarget {
19   [Pref="dom.events.asyncClipboard.clipboardItem", NewObject, NeedsSubjectPrincipal]
20   Promise<ClipboardItems> read();
21   [Func="Clipboard::ReadTextEnabled", NewObject, NeedsSubjectPrincipal]
22   Promise<DOMString> readText();
24   [Pref="dom.events.asyncClipboard.clipboardItem", NewObject, NeedsSubjectPrincipal]
25   Promise<undefined> write(ClipboardItems data);
27   [NewObject, NeedsSubjectPrincipal]
28   Promise<undefined> writeText(DOMString data);
31 partial interface Clipboard {
32   // @param allowed true, if the user allowed (e.g. clicked) the "Paste" menuitem.
33   //                false, when the menupopup was dismissed.
34   [ChromeOnly]
35   undefined onUserReactedToPasteMenuPopup(boolean allowed);
38 typedef (DOMString or Blob) ClipboardItemDataType;
39 typedef Promise<ClipboardItemDataType> ClipboardItemData;
40 // callback ClipboardItemDelayedCallback = ClipboardItemData ();
42 [SecureContext, Exposed=Window, Pref="dom.events.asyncClipboard.clipboardItem"]
43 interface ClipboardItem {
44   [Throws]
45   constructor(record<DOMString, ClipboardItemData> items,
46               optional ClipboardItemOptions options = {});
48   // static ClipboardItem createDelayed(
49   //     record<DOMString, ClipboardItemDelayedCallback> items,
50   //     optional ClipboardItemOptions options = {});
52   readonly attribute PresentationStyle presentationStyle;
53   // readonly attribute long long lastModified;
54   // readonly attribute boolean delayed;
56   // TODO: Use FrozenArray once available. (Bug 1236777)
57   // readonly attribute FrozenArray<DOMString> types;
58   [Frozen, Cached, Pure]
59   readonly attribute sequence<DOMString> types;
61   [NewObject]
62   Promise<Blob> getType(DOMString type);
65 enum PresentationStyle { "unspecified", "inline", "attachment" };
67 dictionary ClipboardItemOptions {
68   PresentationStyle presentationStyle = "unspecified";