Bug 1360282 - Remove _setVisibility helper now that the sidebar is always shown through show();r=Gijs
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 13 Jun 2017 08:14:57 -0700
changeset 414803 6408339e572e8d24b4fe7e4cfc03a36cbe1a6e70
parent 414802 447cffa065b11ce16a6f97e775a2c812b1500c1b
child 414804 f246c7bba040f9ff030be08dead4952c562d13f2
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1360282
milestone56.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 1360282 - Remove _setVisibility helper now that the sidebar is always shown through show();r=Gijs MozReview-Commit-ID: FWJshLtYZ3h
browser/base/content/browser-sidebar.js
--- a/browser/base/content/browser-sidebar.js
+++ b/browser/base/content/browser-sidebar.js
@@ -253,29 +253,16 @@ var SidebarUI = {
     return this._title.value;
   },
 
   set title(value) {
     this._title.value = value;
   },
 
   /**
-   * Internal helper to show/hide the box and splitter elements.
-   *
-   * @param {bool} visible
-   */
-  _setVisibility(visible) {
-    this._box.hidden = !visible;
-    this._splitter.hidden = !visible;
-    if (visible) {
-      this.setPosition();
-    }
-  },
-
-  /**
    * Toggle the visibility of the sidebar. If the sidebar is hidden or is open
    * with a different commandID, then the sidebar will be opened using the
    * specified commandID. Otherwise the sidebar will be hidden.
    *
    * @param {string} commandID ID of the xul:broadcaster element to use.
    * @return {Promise}
    */
   toggle(commandID = this.currentID) {
@@ -322,17 +309,18 @@ var SidebarUI = {
       for (let broadcaster of broadcasters) {
         if (broadcaster != sidebarBroadcaster) {
           broadcaster.removeAttribute("checked");
         } else {
           sidebarBroadcaster.setAttribute("checked", "true");
         }
       }
 
-      this._setVisibility(true);
+      this._box.hidden = this._splitter.hidden = false;
+      this.setPosition();
 
       this.hideSwitcherPanel();
 
       this._box.setAttribute("sidebarcommand", sidebarBroadcaster.id);
       this.lastOpenedId = sidebarBroadcaster.id;
 
       let title = sidebarBroadcaster.getAttribute("sidebartitle") ||
                   sidebarBroadcaster.getAttribute("label");
@@ -396,17 +384,17 @@ var SidebarUI = {
     // until about:blank has loaded (which does not happen as long as the
     // element is hidden).
     this.browser.setAttribute("src", "about:blank");
     this.browser.docShell.createAboutBlankContentViewer(null);
 
     sidebarBroadcaster.removeAttribute("checked");
     this._box.setAttribute("sidebarcommand", "");
     this._title.value = "";
-    this._setVisibility(false);
+    this._box.hidden = this._splitter.hidden = true;
 
     let selBrowser = gBrowser.selectedBrowser;
     selBrowser.focus();
     selBrowser.messageManager.sendAsyncMessage("Sidebar:VisibilityChange",
       {commandID, isOpen: false}
     );
     BrowserUITelemetry.countSidebarEvent(commandID, "hide");
   },