Closed Bug 1893831 Opened 1 year ago Closed 1 year ago

browser.menus.onClicked handler fails when the background script has been stopped (Non-persistent background scripts)

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect

Tracking

(thunderbird_esr115 wontfix)

RESOLVED FIXED
127 Branch
Tracking Status
thunderbird_esr115 --- wontfix

People

(Reporter: standard8, Assigned: john)

Details

Attachments

(2 files)

Attached file addon.xpi

STR

  1. Install the attached add-on as a temporary add-on.
  2. Right click on any folder in the main tab and select "analyse dmarc results".

=> At this stage a new tab is correctly opened to prove it works.

  1. Close the tab, then on the debugging add-ons page, terminate the background script of the add-on.
  2. Right click on any folder in the main tab and select "analyse dmarc results".

Expected Results

The tab is opened

Actual Results

The tab fails to open because the handler wasn't called.

In Thunderbird 115 this error is thrown:

TypeError: linkedBrowser is null ext-menus.js:1415:13

In Thunderbird 127.0a1 it is:

TypeError: can't access property "getTabForBrowser", linkedBrowser.ownerGlobal.gBrowser is undefined ext-menus.js:1456:13

Running the menu item a second time works, because by that time the background script has started.

Assignee: nobody → standard8
Status: NEW → ASSIGNED

There is a much greater issue discovered here. The check for linkedBrowser is coming from m-c code, where every tab has one. However, a mail3pane tab, which is not displaying a message, will not have a linked browser. You can reproduce that by selecting a message and then deselect it again (having a white empty area instead of a message). The onClicked event will then not fire as well.

The fix for this issue will look different. I thank you for bringing this to my attention. If you are ok with it, I will move forward and propose a different fix.

(In reply to John Bieling (:TbSync) from comment #2)

The fix for this issue will look different. I thank you for bringing this to my attention. If you are ok with it, I will move forward and propose a different fix.

Ah yes, I forgot about those. Feel free to steal :)

Assignee: standard8 → nobody
Status: ASSIGNED → NEW
Attachment #9400234 - Attachment is obsolete: true
Assignee: nobody → john
Attachment #9400234 - Attachment is obsolete: false
Status: NEW → ASSIGNED
Attachment #9400234 - Attachment description: Bug 1893831 - Fix issue with browser.menus.onClicked not working when the background script has been stopped. r?john.bieling! → Bug 1893831 - Fix issue with browser.menus.onClicked not working when the background script has been stopped. r=standard8

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/1fe01ebb00d5
Fix issue with browser.menus.onClicked not working when the background script has been stopped. r=standard8

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: