Bug 1468077 - Stop disabling cmd_close and cmd_closeWindow in the bookmark panel since it seems to be half-broken and is inconsistent with other panels. r?mak draft
authorDão Gottwald <dao@mozilla.com>
Fri, 29 Jun 2018 13:33:05 +0200
changeset 812454 6c40ff372b9d777151af86ac8e6672f91469afee
parent 812437 bf149090f6b5db3fe86618b5f1047b70b1bff8b5
push id114553
push userdgottwald@mozilla.com
push dateFri, 29 Jun 2018 11:33:49 +0000
reviewersmak
bugs1468077
milestone63.0a1
Bug 1468077 - Stop disabling cmd_close and cmd_closeWindow in the bookmark panel since it seems to be half-broken and is inconsistent with other panels. r?mak MozReview-Commit-ID: AkKaq5Kon77
browser/base/content/browser-places.js
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -42,45 +42,16 @@ var StarUI = {
     element.addEventListener("compositionstart", this);
     element.addEventListener("compositionend", this);
     element.addEventListener("input", this);
     element.addEventListener("popuphidden", this);
     element.addEventListener("popupshown", this);
     return this.panel = element;
   },
 
-  // Array of command elements to disable when the panel is opened.
-  get _blockedCommands() {
-    delete this._blockedCommands;
-    return this._blockedCommands =
-      ["cmd_close", "cmd_closeWindow"].map(id => this._element(id));
-  },
-
-  _blockCommands: function SU__blockCommands() {
-    this._blockedCommands.forEach(function(elt) {
-      // make sure not to permanently disable this item (see bug 409155)
-      if (elt.hasAttribute("wasDisabled"))
-        return;
-      if (elt.getAttribute("disabled") == "true") {
-        elt.setAttribute("wasDisabled", "true");
-      } else {
-        elt.setAttribute("wasDisabled", "false");
-        elt.setAttribute("disabled", "true");
-      }
-    });
-  },
-
-  _restoreCommandsState: function SU__restoreCommandsState() {
-    this._blockedCommands.forEach(function(elt) {
-      if (elt.getAttribute("wasDisabled") != "true")
-        elt.removeAttribute("disabled");
-      elt.removeAttribute("wasDisabled");
-    });
-  },
-
   // nsIDOMEventListener
   handleEvent(aEvent) {
     switch (aEvent.type) {
       case "mousemove":
         clearTimeout(this._autoCloseTimer);
         // The autoclose timer is not disabled on generic mouseout
         // because the user may not have actually interacted with the popup.
         break;
@@ -93,17 +64,16 @@ var StarUI = {
             // Get the folder first, before we uninit the overlay.
             selectedFolderGuid = gEditItemOverlay.selectedFolderGuid;
             this.quitEditMode();
           }
 
           this._anchorElement.removeAttribute("open");
           this._anchorElement = null;
 
-          this._restoreCommandsState();
           let removeBookmarksOnPopupHidden = this._removeBookmarksOnPopupHidden;
           this._removeBookmarksOnPopupHidden = false;
           let guidsForRemoval = this._itemGuids;
           this._itemGuids = null;
 
           if (this._batching) {
             this.endBatch();
           }
@@ -219,18 +189,16 @@ var StarUI = {
     // cause the panel to flicker.
     if (this.panel.state != "closed") {
       return;
     }
 
     this._isNewBookmark = aIsNewBookmark;
     this._itemGuids = null;
 
-    this._blockCommands(); // un-done in the popuphidden handler
-
     this._element("editBookmarkPanelTitle").value =
       this._isNewBookmark ?
         gNavigatorBundle.getString("editBookmarkPanel.newBookmarkTitle") :
         gNavigatorBundle.getString("editBookmarkPanel.editBookmarkTitle");
 
     // No description; show the Done, Remove;
     this._element("editBookmarkPanelBottomButtons").hidden = false;
     this._element("editBookmarkPanelContent").hidden = false;