Closed Bug 1522128 Opened 5 years ago Closed 5 years ago

JavaScript error: chrome://messenger/content/chat/imAccounts.js, line 363: TypeError: document.querySelector(...).forEach is not a function

Categories

(Thunderbird :: Instant Messaging, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 66.0

People

(Reporter: clokep, Assigned: clokep)

References

Details

(Keywords: regression)

Attachments

(1 file)

JavaScript error: chrome://messenger/content/chat/imAccounts.js, line 363: TypeError: document.querySelector(...).forEach is not a function

This seems to be a regression from bug 1508233. A partial diff from that bug:

diff --git a/mail/components/im/content/imAccounts.js b/mail/components/im/content/imAccounts.js
--- a/mail/components/im/content/imAccounts.js
+++ b/mail/components/im/content/imAccounts.js
@@ -355,17 +355,19 @@ var gAccountManager = {
         elt.setAttribute("disabled", "true");
       else
         elt.removeAttribute("disabled");
     }
   },
   onContextMenuShowing: function am_onContextMenuShowing() {
     let targetElt = document.popupNode;
     let isAccount = targetElt instanceof Ci.nsIDOMXULSelectControlItemElement;
-    document.getElementById("contextAccountsItems").hidden = !isAccount;
+    document.querySelector(".im-context-account-item").forEach(e => {
+      e.hidden = !isAccount;
+    });
     if (isAccount) {
       let account = targetElt.account;
       let hiddenItems = {
         connect: !account.disconnected,
         disconnect: account.disconnected || account.disconnecting,
         cancelReconnection: !targetElt.hasAttribute("reconnectPending"),
         accountsItemsSeparator: account.disconnecting,
       };

I suspect this is supposed to be using querySelectorAll() instead, but I'm not 100% sure how this old broadcaster used to work.

Steps to reproduce:

  • Open the accounts manager.
  • Right click on an account.
  • See the error in the logs (and you'll see all entries in the right click menu, not just the ones that currently make sense based on connection status).

This should fix it. To test:

  • Open the accounts manager and right click a disconnected account.
  • You should see a "Connect" option.
  • Click "Connect".
  • Wait for the connection to complete...
  • Right click again and you should see a "Disconnect" option.
Attachment #9038526 - Flags: review?(florian)
Comment on attachment 9038526 [details] [diff] [review]
right-click-fix.diff

Review of attachment 9038526 [details] [diff] [review]:
-----------------------------------------------------------------

lgtm; not tested locally.
Attachment #9038526 - Flags: review?(florian) → review+

Pushed by clokep@gmail.com:
https://hg.mozilla.org/comm-central/rev/043b81dfc262
Fix context sensitive nature of context menu on chat accounts. r=florian

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 66.0
Keywords: regression
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: