Bug 1411011 - stop offering context menu (re)move options on skipintoolbarset items, r?jaws draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 06 Nov 2017 14:49:37 +0000
changeset 693577 be1701e42d305cea20fadb17032d61cc8a479872
parent 693519 dc45ee24c55d1061951956321bd8481d517ce22a
child 739088 ef5f5f9a673de3be3cef0f64a805e25d20ad69b7
push id87864
push userbmo:gijskruitbosch+bugs@gmail.com
push dateMon, 06 Nov 2017 15:55:37 +0000
reviewersjaws
bugs1411011
milestone58.0a1
Bug 1411011 - stop offering context menu (re)move options on skipintoolbarset items, r?jaws Giving all these nodes ids doesn't seem like the right fix. `buildArea` already ignores skipintoolbarset items before doing anything else with nodes, so bailing out early seemed like the right solution here. MozReview-Commit-ID: H3EyqoospNR
browser/components/customizableui/CustomizableUI.jsm
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -2764,16 +2764,20 @@ var CustomizableUIInternal = {
    * @return {Boolean} whether the widget is removable
    */
   isWidgetRemovable(aWidget) {
     let widgetId;
     let widgetNode;
     if (typeof aWidget == "string") {
       widgetId = aWidget;
     } else {
+      // Skipped items could just not have ids.
+      if (!aWidget.id && aWidget.getAttribute("skipintoolbarset") == "true") {
+        return false;
+      }
       if (!aWidget.id &&
           !["toolbarspring", "toolbarspacer", "toolbarseparator"].includes(aWidget.nodeName)) {
         throw new Error("No nodes without ids that aren't special widgets should ever come into contact with CUI");
       }
       // Use "spring" / "spacer" / "separator" for special widgets without ids
       widgetId = aWidget.id || aWidget.nodeName.substring(7 /* "toolbar".length */);
       widgetNode = aWidget;
     }