Skip to content

Commit 3a9ed21

Browse files
committed
🐛 Fix issue where context menus were being created on external browsers
1 parent f29dee6 commit 3a9ed21

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

actors/DotContextMenuParent.sys.mjs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ export class DotContextMenuParent extends JSWindowActorParent {
88
if (message.name !== "contextmenu") return;
99

1010
const browser = this.manager.rootFrameLoader.ownerElement;
11-
const win = browser.ownerGlobal.top;
11+
const win = browser.ownerGlobal;
1212

13-
const { x, y, context } = message.data;
13+
// Make sure this browser belongs to us before we open the panel
14+
if (win.gDot.tabs.getTabForWebContents(browser)) {
15+
const { x, y, context } = message.data;
1416

15-
const panel = win.gDot.panels.getPanelById("browser-context-menu");
17+
const panel = win.gDot.panels.getPanelById("browser-context-menu");
1618

17-
panel.openPanel({
18-
coordMode: "screen",
19+
panel.openPanel({
20+
coordMode: "screen",
1921

20-
x: x,
21-
y: y,
22+
x: x,
23+
y: y,
2224

23-
args: context
24-
});
25+
args: context
26+
});
27+
}
2528
}
2629

2730
hiding() {

0 commit comments

Comments
 (0)