Bug 1582796 - Fix task menus and related MozMill test. r=mkmelin
authorPaul Morris <paul@thunderbird.net>
Fri, 20 Sep 2019 13:00:40 -0400
changeset 36891 90a977469503284f3c7293b8fe0bb780442bf5b7
parent 36890 b4cd90465304c1255669d738be976b6145c737f3
child 36892 cf15df787db95f1906c28b646005e56081a5b670
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersmkmelin
bugs1582796, 1555497
Bug 1582796 - Fix task menus and related MozMill test. r=mkmelin These task menus broke when menupopup binding was converted to a custom element (in bug 1555497) that uses shadow DOM.
calendar/base/content/calendar-menus.js
calendar/test/mozmill/views/testTaskView.js
--- a/calendar/base/content/calendar-menus.js
+++ b/calendar/base/content/calendar-menus.js
@@ -67,18 +67,17 @@
   class CalendarTaskProgressMenupopup extends MozElements.MozMenuPopup {
     connectedCallback() {
       if (this.delayConnectedCallback() || this.hasConnected) {
         return;
       }
       // this.hasConnected is set to true in super.connectedCallback
       super.connectedCallback();
 
-      const scrollbox = this.querySelector(".popup-internal-box");
-      scrollbox.appendChild(
+      this.appendChild(
         MozXULElement.parseXULToFragment(
           `
                 <menuitem class="percent-0-menuitem"
                           type="checkbox"
                           label="&progress.level.0;"
                           accesskey="&progress.level.0.accesskey;"
                           observes="calendar_percentComplete-0_command"
                           command="calendar_percentComplete-0_command"/>
@@ -108,17 +107,17 @@
                           command="calendar_percentComplete-100_command"/>
                 `,
           ["chrome://calendar/locale/calendar.dtd"]
         )
       );
 
       this.addEventListener(
         "popupshowing",
-        updateMenuItemsState.bind(null, scrollbox, "percentComplete"),
+        updateMenuItemsState.bind(null, this, "percentComplete"),
         true
       );
     }
   }
 
   customElements.define("calendar-task-progress-menupopup", CalendarTaskProgressMenupopup, {
     extends: "menupopup",
   });
@@ -132,18 +131,17 @@
   class CalendarTaskPriorityMenupopup extends MozElements.MozMenuPopup {
     connectedCallback() {
       if (this.delayConnectedCallback() || this.hasConnected) {
         return;
       }
       // this.hasConnected is set to true in super.connectedCallback
       super.connectedCallback();
 
-      const scrollbox = this.querySelector(".popup-internal-box");
-      scrollbox.appendChild(
+      this.appendChild(
         MozXULElement.parseXULToFragment(
           `
                 <menuitem class="priority-0-menuitem"
                           type="checkbox"
                           label="&priority.level.none;"
                           accesskey="&priority.level.none.accesskey;"
                           command="calendar_priority-0_command"
                           observes="calendar_priority-0_command"/>
@@ -167,17 +165,17 @@
                           observes="calendar_priority-1_command"/>
                 `,
           ["chrome://calendar/locale/calendar.dtd"]
         )
       );
 
       this.addEventListener(
         "popupshowing",
-        updateMenuItemsState.bind(null, scrollbox, "priority"),
+        updateMenuItemsState.bind(null, this, "priority"),
         true
       );
     }
   }
 
   customElements.define("calendar-task-priority-menupopup", CalendarTaskPriorityMenupopup, {
     extends: "menupopup",
   });
--- a/calendar/test/mozmill/views/testTaskView.js
+++ b/calendar/test/mozmill/views/testTaskView.js
@@ -115,17 +115,17 @@ function testTaskView() {
   controller.click(eid("task-actions-priority"));
   sleep();
   controller.click(
     lookup(
       `${TASK_VIEW}/{"flex":"1"}/id("calendar-task-details-container")/
         id("calendar-task-details")/id("other-actions-box")/
         id("task-actions-toolbox")/id("task-actions-toolbar")/
         id("task-actions-priority")/id("task-actions-priority-menupopup")/
-        {"class":"popup-internal-box"}/{"class":"priority-1-menuitem"}`
+        {"class":"priority-1-menuitem"}`
     )
   );
   sleep();
   let priorityNode = eid("calendar-task-details-priority-high");
   controller.assertNotDOMProperty(priorityNode, "hidden");
 
   // Verify that tooltip shows status, priority and percent complete.
   let toolTipNode = lookup(toolTip).getNode();