Bug 1498588 - Pass commands on to the tabmail controller if calendar is not the active tab. r=philipp DONTBUILD
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 18 Oct 2018 21:47:14 +1300
changeset 33398 855ce13ec8f908a335e6583f0cb110311a75c26a
parent 33397 a312c7cf1c0e033c261b8e6e97e4b2de476a158e
child 33399 6c017363106fef577c07e7af3890c0abf21c8657
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersphilipp
bugs1498588
Bug 1498588 - Pass commands on to the tabmail controller if calendar is not the active tab. r=philipp DONTBUILD
calendar/base/content/calendar-common-sets.js
--- a/calendar/base/content/calendar-common-sets.js
+++ b/calendar/base/content/calendar-common-sets.js
@@ -771,35 +771,23 @@ var calendarController2 = {
                 calendarController.doCommand("calendar_delete_focused_item_command");
                 break;
         }
     }
 };
 
 /**
  * Inserts the command controller into the document. On Lightning, also make
- * sure that it is inserted before the conflicting thunderbird command
+ * sure that it is inserted before the conflicting Thunderbird command
  * controller.
  */
 function injectCalendarCommandController() {
-    // We need to put our new command controller *before* the one that
-    // gets installed by thunderbird. Since we get called pretty early
-    // during startup we need to install the function below as a callback
-    // that periodically checks when the original thunderbird controller
-    // gets alive. Please note that setTimeout with a value of 0 means that
-    // we leave the current thread in order to re-enter the message loop.
-
-    let tbController = top.DefaultController;
-    if (tbController) {
-        calendarController.defaultController = tbController;
-        top.controllers.insertControllerAt(0, calendarController);
-        document.commandDispatcher.updateCommands("calendar_commands");
-    } else {
-        setTimeout(injectCalendarCommandController, 0);
-    }
+    calendarController.defaultController = document.getElementById("tabmail");
+    top.controllers.insertControllerAt(0, calendarController);
+    document.commandDispatcher.updateCommands("calendar_commands");
 }
 
 /**
  * Remove the calendar command controller from the document.
  */
 function removeCalendarCommandController() {
     top.controllers.removeController(calendarController);
 }