Bug 1509389 - Use toolbar default set if current set doesn't exist. r=mkmelin a=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 27 Nov 2018 14:50:56 +1300
changeset 33523 84b7159cc2d5590d4ca37ae99f76b429a8c02eb4
parent 33522 50ff20d2e44b8f64a9521671f2f114409a8bc19d
child 33524 dd975eb905a52f367bb577e994d3ee5a6b38e530
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersmkmelin, jorgk
bugs1509389
Bug 1509389 - Use toolbar default set if current set doesn't exist. r=mkmelin a=jorgk
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")) {