Closed Bug 1966171 Opened 2 months ago Closed 2 months ago

Clean up GlobalPopupNotifications.sys.mjs to remove "Argument 1 is not an object" error

Categories

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

defect

Tracking

(Not tracked)

RESOLVED FIXED
140 Branch

People

(Reporter: TbSync, Assigned: TbSync)

References

Details

Attachments

(1 file)

We forked toolkit's PopupNotifications.sys.mjs as GlobalPopupNotifications.sys.mjs. We have missed an upstream change in one of its dependencies, which causes the following error

ChromeUtils.getClassName: Argument 1 is not an object

Component: Security → Add-Ons: General

We forked toolkit's PopupNotifications.sys.mjs 1 as
GlobalPopupNotifications.sys.mjs 2, but missed an upstream change in
one of its dependencies, which causes the following error

ChromeUtils.getClassName: Argument 1 is not an object

when installing an add-on and acknowledging the required notification
popups. A test case which throws the error without this patch is the
following add-on:

https://addons.thunderbird.net/addon/openai-proofreader

STR:

  • download the add-on's XPI file
  • open Thunderbird's add-on manager
  • click on the gear icon and select "install from file"
  • select the downloaded XPI file
  • click "Add" on the shown notification
  • observe the error in the console
  • click "Ok" on the second notification
  • observe the error in the console

There are two reasons for the fail:

  1. We register event listeners to directly call PopupNotifications,
    which is a function (prototyped to behave like a class) defined in the
    same file, instead of ownerGlobal.PopupNotifications, which is the
    lazy getter defined in messenger.js 3 to the global instance of
    that class. The constructor of course does not know what to do with the
    passed in event and dies.

  2. There is no reason at all to register these listeners, as those
    events are already handled by popupnotification.js 4. They could be
    registered to prevent the default event handler, but we are also not
    doing that.

This patch is also following upstream in how to handle the no-shadow
lint issue, to make it easier to find relevant code.

Assignee: nobody → john
Status: NEW → ASSIGNED
See Also: → 1961490
Target Milestone: --- → 140 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/6a1aa977133b
Clean up GlobalPopupNotifications.sys.mjs to remove "Argument 1 is not an object" error. r=arschmitz

Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: