Bug 1378524 - Fix exception raised on tooltip created for a removed tab. draft
authorLuca Greco <lgreco@mozilla.com>
Mon, 25 Sep 2017 12:46:17 +0200
changeset 669835 e056f8c6fa80dc214dadd8ae964c9bdbd98f3c3c
parent 669834 c282aab44b8ce72df14ecdf70845a7f201584e4f
child 733051 11dab1d1444d931123ad53851d51952c2a7335b8
push id81427
push userluca.greco@alcacoop.it
push dateMon, 25 Sep 2017 11:52:41 +0000
bugs1378524
milestone57.0
Bug 1378524 - Fix exception raised on tooltip created for a removed tab. MozReview-Commit-ID: 2jG4AWFc1T0
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -5466,17 +5466,19 @@
                 onget="return this.mCurrentBrowser.userTypedValue;"
                 onset="return this.mCurrentBrowser.userTypedValue = val;"/>
 
       <method name="createTooltip">
         <parameter name="event"/>
         <body><![CDATA[
           event.stopPropagation();
           var tab = document.tooltipNode;
-          if (tab.localName != "tab") {
+
+          // Early exit if the tooltip node doesn't exist anymore or it is not a tab.
+          if (!tab || tab.localName != "tab") {
             event.preventDefault();
             return;
           }
 
           let stringWithShortcut = (stringId, keyElemId) => {
             let keyElem = document.getElementById(keyElemId);
             let shortcut = ShortcutUtils.prettifyShortcut(keyElem);
             return this.mStringBundle.getFormattedString(stringId, [shortcut]);