Bug 1404263 - update the bookmarks toolbar item in the bookmarking tools subview when it is shown, r=mikedeboer
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 04 Oct 2017 11:49:14 +0100
changeset 384441 d508870ea425003d897898425573c02cc6f50971
parent 384440 2b4e006bc55a7ecd6ce13ed3c6ad99b31cebbfaf
child 384442 ed7b92c9eca5e1faa1b193918f0b9ddf7fc9c0e5
push id52634
push usergijskruitbosch@gmail.com
push dateWed, 04 Oct 2017 14:07:24 +0000
treeherderautoland@d508870ea425 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1404263
milestone58.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 1404263 - update the bookmarks toolbar item in the bookmarking tools subview when it is shown, r=mikedeboer MozReview-Commit-ID: 1zesvAmYkAM
browser/base/content/browser-places.js
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -1895,16 +1895,29 @@ var BookmarkingUI = {
       switch (button.id) {
         case "panelMenu_toggleBookmarksMenu":
           let placement = CustomizableUI.getPlacementOfWidget(this.BOOKMARK_BUTTON_ID);
           button.setAttribute("checked", !!placement && placement.area == CustomizableUI.AREA_NAVBAR);
           break;
         case "panelMenu_viewBookmarksSidebar":
           button.setAttribute("checked", SidebarUI.currentID == "viewBookmarksSidebar");
           break;
+        case "panelMenu_viewBookmarksToolbar":
+          let toolbar = document.getElementById("PersonalToolbar");
+          // This is an actual toolbarbutton[type=checkbox], and its checked
+          // attribute will get added/removed by the binding when clicked.
+          // Setting the attribute to 'false' breaks showing the toolbar,
+          // because the binding removes the attribute instead of setting it
+          // to 'true' when clicked.
+          if (toolbar.getAttribute("collapsed") != "true") {
+            button.setAttribute("checked", "true");
+          } else {
+            button.removeAttribute("checked");
+          }
+          break;
         default:
           update = false;
           break;
       }
       if (update) {
         updateToggleControlLabel(button);
       }
     }