Bug 1584160 - Restore persisted state of all toolbars possibly affected by an overlay. r=pmorris a=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 05 Nov 2019 12:19:24 +1300
changeset 37242 6dc8bfe20d38d2b280d4cb9c105885408e41340a
parent 37241 97c8a06bf434739007d8fae0efff16f9919e1203
child 37243 01133d7ade6a1467245c07b47842c6423815a623
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewerspmorris, jorgk
bugs1584160
Bug 1584160 - Restore persisted state of all toolbars possibly affected by an overlay. r=pmorris a=jorgk
common/src/Overlays.jsm
--- a/common/src/Overlays.jsm
+++ b/common/src/Overlays.jsm
@@ -346,18 +346,19 @@ class Overlays {
               } could not be found, deferring to later`
             );
             return false;
           }
 
           target = palette;
         }
 
+        this._toolbarsToResolve.push(...box.querySelectorAll("toolbar"));
         this._toolbarsToResolve.push(
-          ...box.querySelectorAll('toolbar:not([type="menubar"])')
+          ...this.document.querySelectorAll(`toolbar[toolboxid="${box.id}"]`)
         );
       } else if (!target) {
         oconsole.debug(
           `The node ${node.id} could not be found, deferring to later`
         );
         return false;
       }
 
@@ -381,16 +382,22 @@ class Overlays {
       if (element.id && this.persistedIDs.has(element.id)) {
         element.setAttribute(
           "value",
           Services.xulStore.getValue(this.location, element.id, "value")
         );
       }
     }
 
+    if (node.localName == "toolbar") {
+      this._toolbarsToResolve.push(node);
+    } else {
+      this._toolbarsToResolve.push(...node.querySelectorAll("toolbar"));
+    }
+
     let wasInserted = false;
     let pos = node.getAttribute("insertafter");
     let after = true;
 
     if (!pos) {
       pos = node.getAttribute("insertbefore");
       after = false;
     }