Bug 1601573 - Resolved context menu for chat-contact and chat-imconv richlistitems. r+a=mkmelin
authorKhushil Mistry <khushil324@gmail.com>
Fri, 06 Dec 2019 11:10:08 +0200
changeset 37661 4c0ded168a1f27f2697dab8b1e950c93358ebab3
parent 37660 148cc4c05d832e1f3bbd05cc6965a777949c0e2b
child 37662 f66c2ed5241cd32076ecadd0ee1f4b6c8671a9f4
push id396
push userclokep@gmail.com
push dateMon, 06 Jan 2020 23:11:57 +0000
bugs1601573
Bug 1601573 - Resolved context menu for chat-contact and chat-imconv richlistitems. r+a=mkmelin
mail/components/im/content/chat-messenger.js
--- a/mail/components/im/content/chat-messenger.js
+++ b/mail/components/im/content/chat-messenger.js
@@ -85,17 +85,21 @@ function enableInlineSpellCheck(aEnableI
     .getElementById("spellCheckEnable")
     .setAttribute("checked", aEnableInlineSpellCheck);
   document
     .getElementById("spellCheckDictionaries")
     .setAttribute("hidden", !aEnableInlineSpellCheck);
 }
 
 function buddyListContextMenu(aXulMenu) {
-  this.target = aXulMenu.triggerNode;
+  this.target = aXulMenu.triggerNode.closest("richlistitem");
+  if (!this.target) {
+    this.shouldDisplay = false;
+    return;
+  }
   this.menu = aXulMenu;
   let localName = this.target.localName;
   this.onContact =
     localName == "richlistitem" &&
     this.target.getAttribute("is") == "chat-contact-richlistitem";
   this.onConv =
     localName == "richlistitem" &&
     this.target.getAttribute("is") == "chat-imconv-richlistitem";