Bug 1858983 [wpt PR 42532] - Fix case of incorrect removal of dir=auto state in HTMLE...
[gecko.git] / toolkit / actors / ClipboardReadPasteChild.sys.mjs
blobe8b113bd685e77ca4701b57dc0abcb6b043bb0fc
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /**
6  * Propagates "MozClipboardReadPaste" events from a content process to the
7  * chrome process.
8  * Receives messages from the chrome process.
9  */
10 export class ClipboardReadPasteChild extends JSWindowActorChild {
11   constructor() {
12     super();
13   }
15   // EventListener interface.
16   handleEvent(aEvent) {
17     if (aEvent.type == "MozClipboardReadPaste" && aEvent.isTrusted) {
18       this.sendAsyncMessage("ClipboardReadPaste:ShowMenupopup", {});
19     }
20   }
22   // For JSWindowActorChild.
23   receiveMessage(value) {
24     switch (value.name) {
25       case "ClipboardReadPaste:PasteMenuItemClicked": {
26         this.contentWindow.navigator.clipboard.onUserReactedToPasteMenuPopup(
27           true
28         );
29         break;
30       }
31       case "ClipboardReadPaste:PasteMenuItemDismissed": {
32         this.contentWindow.navigator.clipboard.onUserReactedToPasteMenuPopup(
33           false
34         );
35         break;
36       }
37     }
38   }