blob: 5cf1d5dbe2be0813aed8139dbdb0b6c10a3a051c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* vim: set ts=2 sw=2 et tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
export class ContextMenuParent extends JSWindowActorParent {
receiveMessage(message) {
if (message.name != "contextmenu") {
return;
}
let browser = this.manager.rootFrameLoader.ownerElement;
let win = browser.ownerGlobal.top;
// Send events from a message display browser to about:3pane or
// about:message if possible.
let tabmail = win.document.getElementById("tabmail");
if (tabmail) {
let chromeBrowser = tabmail.currentTabInfo.chromeBrowser;
if (
chromeBrowser?.contentWindow.openContextMenu(message, browser, this)
) {
return;
}
}
let messageBrowser = win.document.getElementById("messageBrowser");
if (messageBrowser?.contentWindow.openContextMenu(message, browser, this)) {
return;
}
// Otherwise, send them to the outer window.
if ("openContextMenu" in win) {
win.openContextMenu(message, browser, this);
}
}
hiding() {
try {
this.sendAsyncMessage("ContextMenu:Hiding", {});
} catch (e) {
// This will throw if the content goes away while the
// context menu is still open.
}
}
}
|