Bug 1491286 - Access selectedItem only once in _setPositionalAttributes. r=florian
authorDão Gottwald <dao@mozilla.com>
Fri, 14 Sep 2018 14:53:52 +0200
changeset 492147 1cae5a527a4b143a6ad6b2aaa5e5de03c43d2076
parent 492088 6c670bc5baed08ac6c7bc194b6eae6d676b872f4
child 492148 58fc7f243f7605a4408454da153e40e27ecc3e81
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1491286
milestone64.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 1491286 - Access selectedItem only once in _setPositionalAttributes. r=florian
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -275,28 +275,28 @@
       </method>
 
       <method name="_setPositionalAttributes">
         <body><![CDATA[
           let visibleTabs = this._getVisibleTabs();
           if (!visibleTabs.length) {
             return;
           }
-          let selectedIndex = visibleTabs.indexOf(this.selectedItem);
-
+          let selectedTab = this.selectedItem;
+          let selectedIndex = visibleTabs.indexOf(selectedTab);
           if (this._beforeSelectedTab) {
             this._beforeSelectedTab.removeAttribute("beforeselected-visible");
           }
 
-          if (this.selectedItem.closing || selectedIndex <= 0) {
+          if (selectedTab.closing || selectedIndex <= 0) {
             this._beforeSelectedTab = null;
           } else {
             let beforeSelectedTab = visibleTabs[selectedIndex - 1];
             let separatedByScrollButton = this.getAttribute("overflow") == "true" &&
-              beforeSelectedTab.pinned && !this.selectedItem.pinned;
+              beforeSelectedTab.pinned && !selectedTab.pinned;
             if (!separatedByScrollButton) {
               this._beforeSelectedTab = beforeSelectedTab;
               this._beforeSelectedTab.setAttribute("beforeselected-visible",
                                                    "true");
             }
           }
 
           if (this._firstTab)