nmaier / mintrayr

Mozilla extension: Minimize windows into the system tray (Firefox, Thunderbird, Seamonkey, Instantbird)
https://tn123.org/mintrayr/
Mozilla Public License 2.0
84 stars 37 forks source link

Accommodate preset ids for menu_NewPopup menuitem #144

Closed jeffkowalski closed 8 years ago

jeffkowalski commented 9 years ago

Fixes operation of MinTrayR on Thunderbird 38.2.0

The pre-existing code implemented the "seamonkey hack", which would set the id for the menu_NewPopup menuitem to newNewMsgCmd if an id didn't already exist. It would then use that id (newNewMsgCmd) in subsequent searches. The trouble is, if the id had already been set, the subsequent searches would fail unless the existing value was newNewMsgCmd. In fact, in recent versions of Thunderbird, the pre-existing id is actually menu_newNewMsgCmd, so the searches fail.

The bug in the existing code gives rise to the following startup errors:

  1. Error: Failed to clone newNewMsgCmd Source File: resource://mintrayr/mintrayr.jsm Line: 124
  2. Error: TypeError: document.getElementById(...) is null Source File: chrome://mintrayr/content/messenger/messenger.js Line: 75 And, subsequently, the follow error when invoked:
  3. Error: TypeError: gMinTrayR.minimize is not a function Source File: chrome://messenger/content/messenger.xul Line: 1

The fix is simply to remember the id, whether it was already set or set in the local code, and then to use the remembered value in searches.

This commit fixes the following issues:

As a consequence, it may also resolve some of the complaints of dysfunction in recent reviews (as of Sunday, September 13, 2015): https://addons.mozilla.org/en-US/thunderbird/addon/minimizetotray-revived/reviews/

To test the fix locally,

  1. Get the files from github
  2. At the command line, from within the directory, type python build.py to create the .xpi file.
  3. In Thunderbird, in the "Extensions" tab of the "Add-ons Manager" page (accessible from the "Tools"->"Add-ons" menu), remove the existing extension and restart Thunderbird.
  4. In Thunderbird, again on the "Add-ons Manager" page, select the "Tools for All Add-ons" drop-down near upper-right and choose "Install Add-on From File...".
  5. Select the .xpi that was created in step 2, confirm with "Install Now", and restart Thunderbird.
nmaier commented 8 years ago

Thanks @jeffkowalski and sorry for the massive delay... Besides being busy, I was a tad bit unmotivated regarding all things mozilla