Bug 1411011 - stop offering context menu (re)move options on skipintoolbarset items, r=jaws
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 06 Nov 2017 14:49:37 +0000
changeset 390357 62b4fc74e72e6592f12827a53a318057fac8a59b
parent 390356 4ccd1fbb5ea660f79c573f5b95d15188de3b8a94
child 390358 40a86fa71825a4ff615d604b10914ec27b9695cd
push id32827
push userccoroiu@mozilla.com
push dateMon, 06 Nov 2017 23:02:00 +0000
treeherdermozilla-central@62aeebcc676e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1411011
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 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;
     }