Bug 653655 - Fix errors when opening List All Tabs menu. r=dolske
authorFrank Yan <fyan@mozilla.com>
Thu, 28 Apr 2011 22:21:13 -0700
changeset 69548 48c0f02f4614fe670a736f6eb8924a4c3c3e60e5
parent 69547 f937f55b4a7f8e80b997403ab49a8885408b23da
child 69549 62b546e8060411c69a5c0c1e957063634db5c473
push idunknown
push userunknown
push dateunknown
reviewersdolske
bugs653655
milestone6.0a1
Bug 653655 - Fix errors when opening List All Tabs menu. r=dolske
browser/base/content/browser.xul
browser/base/content/tabbrowser.xml
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -839,19 +839,18 @@
                      removable="true">
         <menupopup id="alltabs-popup"
                    position="after_end">
           <menuitem id="menu_tabview"
                     class="menuitem-iconic"
                     key="key_tabview"
                     label="&viewTabGroups.label;"
                     command="Browser:ToggleTabView"
-                    observes="tabviewGroupsNumber"
-                    keepme="true"/>
-          <menuseparator id="alltabs-popup-separator" keepme="true"/>
+                    observes="tabviewGroupsNumber"/>
+          <menuseparator id="alltabs-popup-separator"/>
         </menupopup>
       </toolbarbutton>
 
       <toolbarbutton id="tabs-closebutton"
                      class="close-button tabs-closebutton"
                      command="cmd_close"
                      label="&closeTab.label;"
                      tooltiptext="&closeTab.label;"/>
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -3733,17 +3733,22 @@
         <body><![CDATA[
           var tabContainer = gBrowser.tabContainer;
           // We don't want menu item decoration unless there is overflow.
           if (tabContainer.getAttribute("overflow") != "true")
             return;
 
           var tabstripBO = tabContainer.mTabstrip.scrollBoxObject;
           for (var i = 0; i < this.childNodes.length; i++) {
-            var curTabBO = this.childNodes[i].tab.boxObject;
+            let curTab = this.childNodes[i].tab;
+            if (!curTab) // "Tab Groups" menuitem and its menuseparator
+              continue;
+            let curTabBO = curTab.boxObject;
+            if (!curTabBO) // "Tabs From Other Computers" menuitem
+              continue;
             if (curTabBO.screenX >= tabstripBO.screenX &&
                 curTabBO.screenX + curTabBO.width <= tabstripBO.screenX + tabstripBO.width)
               this.childNodes[i].setAttribute("tabIsVisible", "true"); 
             else
               this.childNodes[i].removeAttribute("tabIsVisible");
           }
         ]]></body>
       </method>
@@ -3810,17 +3815,17 @@
         this._updateTabsVisibilityStatus();
       ]]></handler>
 
       <handler event="popuphidden">
       <![CDATA[
         // clear out the menu popup and remove the listeners
         for (let i = this.childNodes.length - 1; i > 0; i--) {
           let menuItem = this.childNodes[i];
-          if (!menuItem.hasAttribute("keepme")) {
+          if (menuItem.tab) {
             menuItem.removeEventListener("command", this, false);
             menuItem.tab.mCorrespondingMenuitem = null;
             this.removeChild(menuItem);
           }
         }
         var tabcontainer = gBrowser.tabContainer;
         tabcontainer.mTabstrip.removeEventListener("scroll", this, false);
         tabcontainer.removeEventListener("TabOpen", this, false);