Bug 1436488 - Move window related functions into calWindowUtils.jsm - automatic changes. r=MakeMyDay
authorPhilipp Kewisch <mozilla@kewis.ch>
Sat, 03 Feb 2018 14:51:15 +0100
changeset 30262 1fad79cf6e7f60f20ca6ab7541c6e202c70193f2
parent 30261 6101dbce66cca8ac8a2e8895595bde34a0075296
child 30263 e2c686325a54c7ac2d0546085784392d2cea47e0
push id2140
push userclokep@gmail.com
push dateMon, 12 Mar 2018 19:42:51 +0000
treeherdercomm-beta@2d485f0d3723 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMakeMyDay
bugs1436488
Bug 1436488 - Move window related functions into calWindowUtils.jsm - automatic changes. r=MakeMyDay MozReview-Commit-ID: 1ruRja2emWp
calendar/base/content/calendar-common-sets.js
calendar/base/content/dialogs/calendar-alarm-dialog.js
calendar/base/content/widgets/calendar-list-tree.xml
calendar/base/modules/calAuthUtils.jsm
calendar/base/modules/calProviderUtils.jsm
calendar/base/src/calCalendarManager.js
calendar/itip/calItipEmailTransport.js
calendar/providers/caldav/calDavCalendar.js
calendar/providers/gdata/modules/gdataSession.jsm
--- a/calendar/base/content/calendar-common-sets.js
+++ b/calendar/base/content/calendar-common-sets.js
@@ -351,20 +351,20 @@ var calendarController = {
             case "calendar_modify_todo_command":
                 modifyTaskFromContext(null, cal.dtz.getDefaultStartDate(currentView().selectedDay));
                 break;
             case "calendar_modify_todo_todaypane_command":
                 modifyTaskFromContext(null, cal.dtz.getDefaultStartDate(agendaListbox.today.start));
                 break;
 
             case "calendar_new_calendar_command":
-                cal.openCalendarWizard(window);
+                cal.window.openCalendarWizard(window);
                 break;
             case "calendar_edit_calendar_command":
-                cal.openCalendarProperties(window, getSelectedCalendar());
+                cal.window.openCalendarProperties(window, getSelectedCalendar());
                 break;
             case "calendar_delete_calendar_command":
                 promptDeleteCalendar(getSelectedCalendar());
                 break;
 
             case "calendar_import_command":
                 loadEventsFromFile();
                 break;
@@ -734,17 +734,17 @@ var calendarController2 = {
             case "cmd_redo":
                 redo();
                 break;
             case "cmd_pageSetup":
                 PrintUtils.showPageSetup();
                 break;
             case "button_print":
             case "cmd_print":
-                cal.calPrint(window);
+                cal.window.openPrintDialog(window);
                 break;
 
             // Thunderbird commands
             case "cmd_goForward":
                 currentView().moveView(1);
                 break;
             case "cmd_goBack":
                 currentView().moveView(-1);
--- a/calendar/base/content/dialogs/calendar-alarm-dialog.js
+++ b/calendar/base/content/dialogs/calendar-alarm-dialog.js
@@ -77,17 +77,17 @@ function onDismissAllAlarms() {
  * Event handler fired when the alarm widget's "Details..." label was clicked.
  * Open the event dialog in the most recent Thunderbird window.
  *
  * @param event     The itemdetails event.
  */
 function onItemDetails(event) {
     // We want this to happen in a calendar window if possible. Otherwise open
     // it using our window.
-    let calWindow = cal.getCalendarWindow();
+    let calWindow = cal.window.getCalendarWindow();
     if (calWindow) {
         calWindow.modifyEventWithDialog(event.target.item, null, true);
     } else {
         modifyEventWithDialog(event.target.item, null, true);
     }
 }
 
 /**
--- a/calendar/base/content/widgets/calendar-list-tree.xml
+++ b/calendar/base/content/widgets/calendar-list-tree.xml
@@ -153,19 +153,19 @@
           let calendar = this.getCalendarFromEvent(event, col);
           if (event.button != 0 ||
               (col.value && col.value.element &&
                col.value.element.getAttribute("anonid") == "checkbox-treecol")) {
               // Only left clicks that are not on the checkbox column
               return;
           }
           if (calendar) {
-              cal.openCalendarProperties(window, calendar);
+              cal.window.openCalendarProperties(window, calendar);
           } else {
-              cal.openCalendarWizard(window);
+              cal.window.openCalendarWizard(window);
           }
       ]]></handler>
     </handlers>
   </binding>
 
   <binding id="calendar-list-tree">
     <content>
       <xul:tree anonid="tree"
--- a/calendar/base/modules/calAuthUtils.jsm
+++ b/calendar/base/modules/calAuthUtils.jsm
@@ -11,17 +11,17 @@ ChromeUtils.import("resource://gre/modul
  */
 
 this.EXPORTED_SYMBOLS = ["cal"]; // even though it's defined in calUtils.jsm, import needs this
 cal.auth = {
     /**
      * Auth prompt implementation - Uses password manager if at all possible.
      */
     Prompt: function() {
-        this.mWindow = cal.getCalendarWindow();
+        this.mWindow = cal.window.getCalendarWindow();
         this.mReturnedLogins = {};
     },
 
     /**
      * Tries to get the username/password combination of a specific calendar name
      * from the password manager or asks the user.
      *
      * @param   in aTitle           The dialog title.
@@ -331,17 +331,17 @@ cal.auth.Prompt.prototype = {
         gAuthCache.planForAuthInfo(hostKey);
 
         function queuePrompt() {
             let asyncprompter = Components.classes["@mozilla.org/messenger/msgAsyncPrompter;1"]
                                           .getService(Components.interfaces.nsIMsgAsyncPrompter);
             asyncprompter.queueAsyncAuthPrompt(hostKey, false, promptlistener);
         }
 
-        self.mWindow = cal.getCalendarWindow();
+        self.mWindow = cal.window.getCalendarWindow();
 
         // the prompt will fail if we are too early
         if (self.mWindow.document.readyState == "complete") {
             queuePrompt();
         } else {
             self.mWindow.addEventListener("load", queuePrompt, true);
         }
     }
--- a/calendar/base/modules/calProviderUtils.jsm
+++ b/calendar/base/modules/calProviderUtils.jsm
@@ -152,17 +152,17 @@ cal.BadCertHandler.prototype = {
     QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIBadCertListener2]),
     timer: null,
 
     notifyCertProblem: function(socketInfo, status, targetSite) {
         // Unfortunately we can't pass js objects using the window watcher, so
         // we'll just take the first available calendar window. We also need to
         // do this on a timer so that the modal window doesn't block the
         // network request.
-        let calWindow = cal.getCalendarWindow();
+        let calWindow = cal.window.getCalendarWindow();
 
         let timerCallback = {
             thisProvider: this.thisProvider,
             notify: function(timer) {
                 let params = {
                     exceptionAdded: false,
                     sslStatus: status,
                     prefetchCert: true,
@@ -419,17 +419,17 @@ cal.toRFC3339 = function(aDateTime) {
             // ZULU Time, according to ISO8601's timezone-offset
             str += "Z";
         }
     }
     return str;
 };
 
 cal.promptOverwrite = function(aMode, aItem) {
-    let window = cal.getCalendarWindow();
+    let window = cal.window.getCalendarWindow();
     let args = {
         item: aItem,
         mode: aMode,
         overwrite: false
     };
 
     window.openDialog("chrome://calendar/content/calendar-conflicts-dialog.xul",
                       "calendarConflictsDialog",
--- a/calendar/base/src/calCalendarManager.js
+++ b/calendar/base/src/calCalendarManager.js
@@ -1097,17 +1097,17 @@ var gCalendarManagerAddonListener = {
         }
 
         let args = { shouldUninstall: false, extension: aAddon };
 
         // Now find a window. The best choice would be the most recent
         // addons window, otherwise the most recent calendar window, or we
         // create a new toplevel window.
         let win = Services.wm.getMostRecentWindow("Extension:Manager") ||
-                  cal.getCalendarWindow();
+                  cal.window.getCalendarWindow();
         if (win) {
             win.openDialog(uri, "CalendarProviderUninstallDialog", features, args);
         } else {
             // Use the window watcher to open a parentless window.
             Services.ww.openWindow(null, uri, "CalendarProviderUninstallWindow", features, args);
         }
 
         // Now that we are done, check if the dialog was accepted or canceled.
--- a/calendar/itip/calItipEmailTransport.js
+++ b/calendar/itip/calItipEmailTransport.js
@@ -238,17 +238,17 @@ calItipEmailTransport.prototype = {
                         "or text/html part as first part of the message.\n" +
                         "This will disable OL (up to 2003) to consume the mail as an iTIP invitation showing\n" +
                         "the usual calendar buttons.");
                 // To somehow have a last resort before sending spam, the user can choose to send the mail.
                 let prefCompatMode = Preferences.get("calendar.itip.compatSendMode", 0);
                 let inoutCheck = { value: prefCompatMode == 1 };
                 let parent = Services.wm.getMostRecentWindow(null);
                 if (parent.closed) {
-                    parent = cal.getCalendarWindow();
+                    parent = cal.window.getCalendarWindow();
                 }
                 if (Services.prompt.confirmEx(parent,
                                               cal.calGetString("lightning", "imipSendMail.title", null, "lightning"),
                                               cal.calGetString("lightning", "imipSendMail.text", null, "lightning"),
                                               Services.prompt.STD_YES_NO_BUTTONS,
                                               null,
                                               null,
                                               null,
--- a/calendar/providers/caldav/calDavCalendar.js
+++ b/calendar/providers/caldav/calDavCalendar.js
@@ -1653,17 +1653,17 @@ calDavCalendar.prototype = {
             if (this.oauth.accessToken) {
                 authSuccess();
             } else {
                 // bug 901329: If the calendar window isn't loaded yet the
                 // master password prompt will show just the buttons and
                 // possibly hang. If we postpone until the window is loaded,
                 // all is well.
                 setTimeout(function postpone() { // eslint-disable-line func-names
-                    let win = cal.getCalendarWindow();
+                    let win = cal.window.getCalendarWindow();
                     if (!win || win.document.readyState != "complete") {
                         setTimeout(postpone, 0);
                     } else {
                         connect();
                     }
                 }, 0);
             }
         } else {
@@ -1729,17 +1729,17 @@ calDavCalendar.prototype = {
 
                 let promptTitle = cal.calGetString("calendar", "caldavRedirectTitle", [self.name]);
                 let promptText = cal.calGetString("calendar", "caldavRedirectText", [self.name]) +
                                  "\n\n" + request.URI.spec;
                 let button1Title = cal.calGetString("calendar", "caldavRedirectDisableCalendar");
                 let flags = (nIPS.BUTTON_TITLE_YES * nIPS.BUTTON_POS_0) +
                             (nIPS.BUTTON_TITLE_IS_STRING * nIPS.BUTTON_POS_1);
 
-                let res = Services.prompt.confirmEx(cal.getCalendarWindow(),
+                let res = Services.prompt.confirmEx(cal.window.getCalendarWindow(),
                                                     promptTitle, promptText,
                                                     flags, null, button1Title,
                                                     null, null, {});
 
                 if (res == 0) { // YES
                     let newUri = request.URI;
                     cal.LOG("CalDAV: Migrating url due to redirect: " +
                             self.mUri.spec + " -> " + newUri.spec);
--- a/calendar/providers/gdata/modules/gdataSession.jsm
+++ b/calendar/providers/gdata/modules/gdataSession.jsm
@@ -101,30 +101,30 @@ calGoogleSession.prototype = {
 
     notifyQuotaExceeded: function() {
         let now = new Date();
         let tt = (now - this.mLastNotified);
         if (!this.mLastNotified || (now - this.mLastNotified) > NOTIFY_TIMEOUT) {
             this.mLastNotified = now;
             let title = getProviderString("extensions.{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}.name");
             let quotaString = getProviderString("quotaExceeded", this.id);
-            Services.prompt.alert(cal.getCalendarWindow(), title, quotaString);
+            Services.prompt.alert(cal.window.getCalendarWindow(), title, quotaString);
         } else {
             cal.LOG("[calGoogleCalendar] Throttling quota notification, last was " + (now - this.mLastNotified) + " ms ago");
         }
     },
 
     notifyOutdated: function() {
         let now = new Date();
         let tt = (now - this.mLastNotified);
         if (!this.mLastNotified || (now - this.mLastNotified) > NOTIFY_TIMEOUT) {
             this.mLastNotified = now;
             let title = getProviderString("extensions.{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}.name");
             let outdatedString = getProviderString("providerOutdated");
-            Services.prompt.alert(cal.getCalendarWindow(), title, outdatedString);
+            Services.prompt.alert(cal.window.getCalendarWindow(), title, outdatedString);
         } else {
             cal.LOG("[calGoogleCalendar] Throttling outdated notification, last was " + (now - this.mLastNotified) + " ms ago");
         }
     },
 
     setupOAuth: function setupOAuth() {
         let sessionId = this.mId;
         let authDescr = getProviderString("requestWindowDescription", sessionId);
@@ -297,17 +297,17 @@ calGoogleSession.prototype = {
             } else {
                 cal.LOG("[calGoogleCalendar] No access token for " + this.mId +
                         ", refreshing token");
                 // bug 901329: If the calendar window isn't loaded yet the
                 // master password prompt will show just the buttons and
                 // possibly hang. If we postpone until the window is loaded,
                 // all is well.
                 setTimeout(function postpone() {
-                    let win = cal.getCalendarWindow();
+                    let win = cal.window.getCalendarWindow();
                     if (!win || win.document.readyState != "complete") {
                         setTimeout(postpone, 400);
                     } else {
                         connect();
                     }
                 }, 0);
             }
         } catch (e) {