Bug 1509389 - Use toolbar default set if current set doesn't exist. r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 27 Nov 2018 14:50:56 +1300
changeset 33790 ebdff9e200098f7232a184f28fe9e34434941e66
parent 33789 096fefc1934f9102b2b00d9ca75632898e4191b6
child 33791 b682f20af95a900492a0ac707000e93a86a537f3
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersmkmelin
bugs1509389
Bug 1509389 - Use toolbar default set if current set doesn't exist. r=mkmelin
mail/components/extensions/ExtensionToolbarButtons.jsm
--- a/mail/components/extensions/ExtensionToolbarButtons.jsm
+++ b/mail/components/extensions/ExtensionToolbarButtons.jsm
@@ -137,17 +137,20 @@ this.ToolbarButtonAPI = class extends Ex
       return;
     }
     let button = this.makeButton(window);
     if (toolbox.palette) {
       toolbox.palette.appendChild(button);
     } else {
       toolbar.appendChild(button);
     }
-    let currentSet = toolbar.getAttribute("currentset").split(",");
+    let currentSet = toolbar.hasAttribute("currentset") ?
+                     toolbar.getAttribute("currentset") :
+                     toolbar.getAttribute("defaultset");
+    currentSet = currentSet.split(",");
     if (currentSet.includes(this.id)) {
       toolbar.currentSet = currentSet.join(",");
     } else {
       currentSet.push(this.id);
       toolbar.currentSet = currentSet.join(",");
 
       let persistAttribute = toolbar.getAttribute("persist");
       if (persistAttribute && persistAttribute.split(/\s+/).includes("currentset")) {