Closed Bug 1711841 Opened 3 years ago Closed 3 years ago

Context menu (and "contextmenu" event) is unavailable in tabs provided by an extension

Categories

(Thunderbird :: Add-Ons: General, defect)

defect

Tracking

(thunderbird_esr78 unaffected)

VERIFIED FIXED
90 Branch
Tracking Status
thunderbird_esr78 --- unaffected

People

(Reporter: yuki, Assigned: darktrojan)

References

(Regression)

Details

Attachments

(2 files)

When an extension provides its UI as a tab, the context menu is not opened in the tab. Moreover, "contextmenu" event is also not dispatched. As the result both Thunderbird's own context menu and the extension's custom menu are unavailable.

Steps to reproduce

  1. Start Thudnerbird.
  2. Load an addon including a page.
  3. Open the debugger for the addon.
  4. Open an extension page in a tab, like browser.tabs.create({ url: '/ui.html' }).
  5. Right-click on the content area of the tab.

Actual result

Nothing happens.

Expected result

The default context menu opens.

Environment

  • Windows 10 21H1
  • Thunderbird 89.0b4 (build ID: 20210512134201)
  • Daily 90.0a1 (build ID: 20210518125031)

Here is a testcase.

  1. This adds a toolbar button to the Thunderbird window.
  2. Click the toolbar button "testcase". Then a tab and a popup window are opened.
  3. Open the debugger for the testcase extension.
  4. Try to do right-click on both the opened tab and the popup window.
  5. Then you'll see the context menu only on the popup window. Moreover, you'll see a "contextmenu" event in the console only after you do that in the window.
Summary: Context menu a(and "contextmenu" event) is unavailable in tabs provided by an extension → Context menu (and "contextmenu" event) is unavailable in tabs provided by an extension
Regressed by: 1698723

This is a regression caused by bug 1698723.

It works for me, on the tip of comm-central and mozilla-central.

What landed since yesterday which could have fixed this? Does not work in current daily on Windows. (Will check tip in 1h)

Interesting. It's OS-specific.

This is weird. In some cases the "click" event on a <browser> fires before the "contextmenu" event, and our click handler returning false prevents the context menu event firing. It doesn't seem to affect
ordinary left-clicking. I am not convinced the click event should even happen, but at a guess I'd say it was happening due to the time it takes for the remote browser to fire contextmenu.

This patch changes the return value of contentAreaClick to true in this case. Nothing actually happens if you click on a remote browser in the parent process, so it shouldn't cause problems.

The patch also adds a test for extension content tabs in browser_mailContext.js. I don't think the added test would've picked up this problem but it is an omission that should be corrected.

Assignee: nobody → geoff
Status: NEW → ASSIGNED
Target Milestone: --- → 90 Branch
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED

I've confirmed the problem I saw has been fixed at Daily 90.0a1 (Build ID: 20210521104831). Thanks!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: