Bug 1513707 - [release 108] Fix tab context menu item size checks (#7420). r=davidwalsh
authorJason Laster <jlaster@mozilla.com>
Wed, 12 Dec 2018 16:34:13 -0500
changeset 507888 f0bfa5f4300c0ac6d505cf16fde1c8f7f0a8c3d0
parent 507887 6cc7f2b947410d566e9a8b4fcd91765959f09517
child 507889 e48826dd7a2c44ccd4d332ecece46ac5e0e31cba
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidwalsh
bugs1513707
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1513707 - [release 108] Fix tab context menu item size checks (#7420). r=davidwalsh
devtools/client/debugger/new/src/components/Editor/Tab.js
--- a/devtools/client/debugger/new/src/components/Editor/Tab.js
+++ b/devtools/client/debugger/new/src/components/Editor/Tab.js
@@ -63,16 +63,17 @@ class Tab extends PureComponent<Props> {
       closeTab,
       closeTabs,
       tabSources,
       showSource,
       togglePrettyPrint,
       selectedSource
     } = this.props;
 
+    const tabCount = tabSources.length;
     const otherTabs = tabSources.filter(t => t.id !== tab);
     const sourceTab = tabSources.find(t => t.id == tab);
     const tabURLs = tabSources.map(t => t.url);
     const otherTabURLs = otherTabs.map(t => t.url);
 
     if (!sourceTab) {
       return;
     }
@@ -84,31 +85,31 @@ class Tab extends PureComponent<Props> {
         item: {
           ...tabMenuItems.closeTab,
           click: () => closeTab(sourceTab)
         }
       },
       {
         item: {
           ...tabMenuItems.closeOtherTabs,
-          click: () => closeTabs(otherTabURLs)
-        },
-        hidden: () => tabSources.size === 1
+          click: () => closeTabs(otherTabURLs),
+          disabled: () => tabCount === 1
+        }
       },
       {
         item: {
           ...tabMenuItems.closeTabsToEnd,
           click: () => {
             const tabIndex = tabSources.findIndex(t => t.id == tab);
             closeTabs(tabURLs.filter((t, i) => i > tabIndex));
-          }
-        },
-        hidden: () =>
-          tabSources.size === 1 ||
-          tabSources.some((t, i) => t === tab && tabSources.size - 1 === i)
+          },
+          disabled: () =>
+            tabCount === 1 ||
+            tabSources.some((t, i) => t === tab && tabCount - 1 === i)
+        }
       },
       {
         item: { ...tabMenuItems.closeAllTabs, click: () => closeTabs(tabURLs) }
       },
       { item: { type: "separator" } },
       {
         item: {
           ...tabMenuItems.copyToClipboard,