Bug 1458367 - Mass replace the Components.interface/Components.utils uses with Ci/Cu in Calendar. r=MakeMyDay
authorMartin Schroeder <mschroeder@mozilla.x-home.org>
Sun, 23 Sep 2018 01:20:13 +0200
changeset 34200 4ae0c5713dfecf37275060a0695be6702906adfd
parent 34199 7144956c64ee446af66d70d9bc461c7d1cff46cc
child 34201 8015b21deff6cc830908f042f1847e60780178ed
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
reviewersMakeMyDay
bugs1458367
Bug 1458367 - Mass replace the Components.interface/Components.utils uses with Ci/Cu in Calendar. r=MakeMyDay
calendar/.eslintrc.js
calendar/base/backend/calBackendLoader.js
calendar/base/backend/icaljs/calICSService.js
calendar/base/backend/icaljs/calRecurrenceRule.js
calendar/base/content/agenda-listbox.js
calendar/base/content/agenda-listbox.xml
calendar/base/content/calendar-base-view.xml
calendar/base/content/calendar-chrome-startup.js
calendar/base/content/calendar-clipboard.js
calendar/base/content/calendar-dnd-listener.js
calendar/base/content/calendar-extract.js
calendar/base/content/calendar-invitations-manager.js
calendar/base/content/calendar-item-editing.js
calendar/base/content/calendar-management.js
calendar/base/content/calendar-month-view.xml
calendar/base/content/calendar-multiday-view.xml
calendar/base/content/calendar-statusbar.js
calendar/base/content/calendar-task-tree.js
calendar/base/content/calendar-task-tree.xml
calendar/base/content/calendar-task-view.js
calendar/base/content/calendar-view-core.xml
calendar/base/content/calendar-views.js
calendar/base/content/dialogs/calendar-alarm-dialog.js
calendar/base/content/dialogs/calendar-creation.js
calendar/base/content/dialogs/calendar-dialog-utils.js
calendar/base/content/dialogs/calendar-error-prompt.xul
calendar/base/content/dialogs/calendar-event-dialog-attendees.js
calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
calendar/base/content/dialogs/calendar-event-dialog-freebusy.xml
calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
calendar/base/content/dialogs/calendar-event-dialog-reminder.js
calendar/base/content/dialogs/calendar-invitations-list.xml
calendar/base/content/dialogs/calendar-migration-dialog.js
calendar/base/content/dialogs/calendar-print-dialog.js
calendar/base/content/dialogs/calendar-subscriptions-dialog.js
calendar/base/content/dialogs/calendar-summary-dialog.js
calendar/base/content/dialogs/chooseCalendarDialog.js
calendar/base/content/import-export.js
calendar/base/content/preferences/alarms.js
calendar/base/content/preferences/general.js
calendar/base/content/widgets/calendar-alarm-widget.xml
calendar/base/content/widgets/calendar-list-tree.xml
calendar/base/content/widgets/calendar-widgets.xml
calendar/base/modules/calExtract.jsm
calendar/base/modules/calRecurrenceUtils.jsm
calendar/base/modules/calUtils.jsm
calendar/base/modules/utils/calAlarmUtils.jsm
calendar/base/modules/utils/calAsyncUtils.jsm
calendar/base/modules/utils/calAuthUtils.jsm
calendar/base/modules/utils/calDataUtils.jsm
calendar/base/modules/utils/calDateTimeUtils.jsm
calendar/base/modules/utils/calEmailUtils.jsm
calendar/base/modules/utils/calItemUtils.jsm
calendar/base/modules/utils/calItipUtils.jsm
calendar/base/modules/utils/calL10NUtils.jsm
calendar/base/modules/utils/calProviderUtils.jsm
calendar/base/modules/utils/calViewUtils.jsm
calendar/base/src/calAlarm.js
calendar/base/src/calAlarmMonitor.js
calendar/base/src/calAlarmService.js
calendar/base/src/calApplicationUtils.js
calendar/base/src/calAttachment.js
calendar/base/src/calAttendee.js
calendar/base/src/calCachedCalendar.js
calendar/base/src/calCalendarManager.js
calendar/base/src/calCalendarSearchService.js
calendar/base/src/calDefaultACLManager.js
calendar/base/src/calDeletedItems.js
calendar/base/src/calEvent.js
calendar/base/src/calFreeBusyService.js
calendar/base/src/calIcsParser.js
calendar/base/src/calIcsSerializer.js
calendar/base/src/calItemBase.js
calendar/base/src/calItipItem.js
calendar/base/src/calProtocolHandler.js
calendar/base/src/calRecurrenceDate.js
calendar/base/src/calRecurrenceInfo.js
calendar/base/src/calRelation.js
calendar/base/src/calSleepMonitor.js
calendar/base/src/calStartupService.js
calendar/base/src/calTimezoneService.js
calendar/base/src/calTodo.js
calendar/base/src/calTransactionManager.js
calendar/import-export/calHtmlExport.js
calendar/import-export/calIcsImportExport.js
calendar/import-export/calListFormatter.js
calendar/import-export/calMonthGridPrinter.js
calendar/import-export/calOutlookCSVImportExport.js
calendar/import-export/calWeekPrinter.js
calendar/itip/calItipEmailTransport.js
calendar/lightning/components/calItipProtocolHandler.js
calendar/lightning/components/lightningTextCalendarConverter.js
calendar/lightning/content/imip-bar.js
calendar/lightning/content/lightning-item-iframe.js
calendar/lightning/content/lightning-item-panel.js
calendar/lightning/content/lightning-migration.xul
calendar/lightning/content/lightning-utils.js
calendar/lightning/content/messenger-overlay-sidebar.js
calendar/lightning/modules/ltnInvitationUtils.jsm
calendar/providers/caldav/calDavCalendar.js
calendar/providers/caldav/calDavRequestHandlers.js
calendar/providers/composite/calCompositeCalendar.js
calendar/providers/gdata/components/calGoogleCalendar.js
calendar/providers/gdata/content/browserRequest.js
calendar/providers/gdata/content/gdata-calendar-creation.js
calendar/providers/gdata/modules/OAuth2.jsm
calendar/providers/gdata/modules/gdataLogging.jsm
calendar/providers/gdata/modules/gdataRequest.jsm
calendar/providers/gdata/modules/gdataSession.jsm
calendar/providers/gdata/modules/gdataUtils.jsm
calendar/providers/ics/calICSCalendar.js
calendar/providers/memory/calMemoryCalendar.js
calendar/providers/storage/calStorageCalendar.js
calendar/providers/storage/calStorageUpgrade.jsm
calendar/providers/wcap/calWcapCalendar.js
calendar/providers/wcap/calWcapCalendarItems.js
calendar/providers/wcap/calWcapCalendarModule.js
calendar/providers/wcap/calWcapErrors.js
calendar/providers/wcap/calWcapRequest.js
calendar/providers/wcap/calWcapSession.js
calendar/providers/wcap/calWcapUtils.js
calendar/providers/wcap/public/calIWcapCalendar.idl
calendar/resources/content/calendarCreation.js
calendar/resources/content/publish.js
calendar/test/mozmill/testLocalICS.js
calendar/test/unit/head_consts.js
calendar/test/unit/test_alarm.js
calendar/test/unit/test_alarmservice.js
calendar/test/unit/test_bug1199942.js
calendar/test/unit/test_bug350845.js
calendar/test/unit/test_calmgr.js
calendar/test/unit/test_data_bags.js
calendar/test/unit/test_datetimeformatter.js
calendar/test/unit/test_deleted_items.js
calendar/test/unit/test_freebusy.js
calendar/test/unit/test_freebusy_service.js
calendar/test/unit/test_gdata_provider.js
calendar/test/unit/test_ics_parser.js
calendar/test/unit/test_imip.js
calendar/test/unit/test_items.js
calendar/test/unit/test_ltninvitationutils.js
calendar/test/unit/test_providers.js
calendar/test/unit/test_recur.js
calendar/test/unit/test_search_service.js
calendar/test/unit/test_startup_service.js
calendar/test/unit/test_storage.js
calendar/test/unit/test_utils.js
calendar/test/unit/test_webcal.js
--- a/calendar/.eslintrc.js
+++ b/calendar/.eslintrc.js
@@ -1,18 +1,15 @@
 "use strict";
 
 module.exports = {
     "extends": [
         "../../toolkit/.eslintrc.js"
     ],
     "rules": {
-        // Awaiting bug 1458367.
-        "mozilla/use-cc-etc": "off",
-
         // Enforce one true brace style (opening brace on the same line)
         // Allow single line (for now) because of the vast number of changes needed
         "brace-style": [2, "1tbs", { allowSingleLine: true }],
 
         // Enforce newline at the end of file, with no multiple empty lines.
         "eol-last": 2,
 
         // Disallow using variables outside the blocks they are defined
--- a/calendar/base/backend/calBackendLoader.js
+++ b/calendar/base/backend/calBackendLoader.js
@@ -40,17 +40,17 @@ calBackendLoader.prototype = {
             };
 
             // Load ical.js backend
             let scope = {};
             Services.scriptloader.loadSubScript("resource://calendar/components/calICALJSComponents.js", scope);
 
             // Register the icaljs components. We used to unregisterFactory, but this caused all
             // sorts of problems. Just registering over it seems to work quite fine.
-            let registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+            let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
             for (let [contractID, classID] of Object.entries(contracts)) {
                 let newClassID = Components.ID(classID);
                 let newFactory = lazyFactoryFor(scope, newClassID);
                 registrar.registerFactory(newClassID, "", contractID, newFactory);
             }
 
             dump("[calBackendLoader] Using Lightning's icaljs backend\n");
         } else {
--- a/calendar/base/backend/icaljs/calICSService.js
+++ b/calendar/base/backend/icaljs/calICSService.js
@@ -277,17 +277,17 @@ calIcalComponent.prototype = {
     set categories(val) { this.innerObject.updatePropertyWithValue("categories", val); },
 
     get URL() { return this.innerObject.getFirstPropertyValue("url"); },
     set URL(val) { this.innerObject.updatePropertyWithValue("url", val); },
 
     get priority() {
         // If there is no value for this integer property, then we must return
         // the designated INVALID_VALUE.
-        const INVALID_VALUE = Components.interfaces.calIIcalComponent.INVALID_VALUE;
+        const INVALID_VALUE = Ci.calIIcalComponent.INVALID_VALUE;
         let prop = this.innerObject.getFirstProperty("priority");
         let val = prop ? prop.getFirstValue() : null;
         return (val === null ? INVALID_VALUE : val);
     },
     set priority(val) { this.innerObject.updatePropertyWithValue("priority", val); },
 
     _setTimeAttr: function(propName, val) {
         let prop = this.innerObject.updatePropertyWithValue(propName, val);
@@ -422,18 +422,18 @@ calIcalComponent.prototype = {
 
     getReferencedTimezones: function(aCount) {
         let vals = Object.keys(this.mReferencedZones).map(timezone => this.mReferencedZones[timezone]);
         aCount.value = vals.length;
         return vals;
     },
 
     serializeToICSStream: function() {
-        let unicodeConverter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
-                                         .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+        let unicodeConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                                 .createInstance(Ci.nsIScriptableUnicodeConverter);
         unicodeConverter.charset = "UTF-8";
         return unicodeConverter.convertToInputStream(this.innerObject.toString());
     }
 };
 
 function calICSService() {
     this.wrappedJSObject = this;
 }
@@ -450,39 +450,39 @@ calICSService.prototype = {
     },
 
     parseICSAsync: function(serialized, tzProvider, listener) {
         // There are way too many error checking messages here, but I had so
         // much pain with this method that I don't want it to break again.
         try {
             let worker = new ChromeWorker("resource://calendar/calendar-js/calICSService-worker.js");
             worker.onmessage = function(event) {
-                let rc = Components.results.NS_ERROR_FAILURE;
+                let rc = Cr.NS_ERROR_FAILURE;
                 let icalComp = null;
                 try {
                     rc = event.data.rc;
                     icalComp = new calIcalComponent(new ICAL.Component(event.data.data));
                     if (!Components.isSuccessCode(rc)) {
                         cal.ERROR("[calICSService] Error in parser worker: " + data);
                     }
                 } catch (e) {
                     cal.ERROR("[calICSService] Exception parsing item: " + e);
                 }
 
                 listener.onParsingComplete(rc, icalComp);
             };
             worker.onerror = function(event) {
                 cal.ERROR("[calICSService] Error in parser worker: " + event.message);
-                listener.onParsingComplete(Components.results.NS_ERROR_FAILURE, null);
+                listener.onParsingComplete(Cr.NS_ERROR_FAILURE, null);
             };
             worker.postMessage(serialized);
         } catch (e) {
             // If an error occurs above, the calling code will hang. Catch the exception just in case
             cal.ERROR("[calICSService] Error starting parsing worker: " + e);
-            listener.onParsingComplete(Components.results.NS_ERROR_FAILURE, null);
+            listener.onParsingComplete(Cr.NS_ERROR_FAILURE, null);
         }
     },
 
     createIcalComponent: function(kind) {
         return new calIcalComponent(new ICAL.Component(kind.toLowerCase()));
     },
 
     createIcalProperty: function(kind) {
--- a/calendar/base/backend/icaljs/calRecurrenceRule.js
+++ b/calendar/base/backend/icaljs/calRecurrenceRule.js
@@ -6,18 +6,18 @@ var { ICAL, unwrapSetter, unwrapSingle, 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 
 function calRecurrenceRule(innerObject) {
     this.innerObject = innerObject || new ICAL.Recur();
     this.wrappedJSObject = this;
 }
 
 var calRecurrenceRuleInterfaces = [
-    Components.interfaces.calIRecurrenceRule,
-    Components.interfaces.calIRecurrenceItem
+    Ci.calIRecurrenceRule,
+    Ci.calIRecurrenceItem
 ];
 var calRecurrenceRuleClassID = Components.ID("{df19281a-5389-4146-b941-798cb93a7f0d}");
 calRecurrenceRule.prototype = {
     QueryInterface: cal.generateQI(calRecurrenceRuleInterfaces),
     classID: calRecurrenceRuleClassID,
     classInfo: cal.generateCI({
         contractID: "@mozilla.org/calendar/recurrence-rule;1",
         classDescription: "Calendar Recurrence Rule",
@@ -41,17 +41,17 @@ calRecurrenceRule.prototype = {
     },
 
     getOccurrences: function(aStartTime, aRangeStart, aRangeEnd, aMaxCount, aCount) {
         aStartTime = unwrapSingle(ICAL.Time, aStartTime);
         aRangeStart = unwrapSingle(ICAL.Time, aRangeStart);
         aRangeEnd = unwrapSingle(ICAL.Time, aRangeEnd);
 
         if (!aMaxCount && !aRangeEnd && this.count == 0 && this.until == null) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         let occurrences = [];
         let rangeStart = aRangeStart.clone();
         rangeStart.isDate = false;
 
         let dtend = null;
 
@@ -114,17 +114,17 @@ calRecurrenceRule.prototype = {
     get type() { return this.innerObject.freq; },
     set type(val) { this.innerObject.freq = val; },
 
     get interval() { return this.innerObject.interval; },
     set interval(val) { this.innerObject.interval = val; },
 
     get count() {
         if (!this.isByCount) {
-            throw Components.results.NS_ERROR_FAILURE;
+            throw Cr.NS_ERROR_FAILURE;
         }
         return this.innerObject.count || -1;
     },
     set count(val) { this.innerObject.count = (val && val > 0 ? val : null); },
 
     get untilDate() {
         if (this.innerObject.until) {
             return new calDateTime(this.innerObject.until);
--- a/calendar/base/content/agenda-listbox.js
+++ b/calendar/base/content/agenda-listbox.js
@@ -631,17 +631,17 @@ agendaListbox.refreshCalendarQuery = fun
             }
             for (let item of aItems) {
                 this.agendaListbox.addItem(item);
             }
         },
 
         cancel: function() {
             this.cancelled = true;
-            let operation = cal.wrapInstance(this.operation, Components.interfaces.calIOperation);
+            let operation = cal.wrapInstance(this.operation, Ci.calIOperation);
             if (operation && operation.isPending) {
                 operation.cancel();
                 this.operation = null;
             }
         },
 
         execute: function() {
             if (!(aStart || aEnd || aCalendar)) {
@@ -676,17 +676,17 @@ agendaListbox.refreshCalendarQuery = fun
                     this.agendaListbox.mPendingRefreshJobs.delete(this.calId);
                 }
             }
             this.calendar = aCalendar;
 
             let filter = this.calendar.ITEM_FILTER_CLASS_OCCURRENCES |
                          this.calendar.ITEM_FILTER_TYPE_EVENT;
             let operation = this.calendar.getItems(filter, 0, aStart, aEnd, this);
-            operation = cal.wrapInstance(operation, Components.interfaces.calIOperation);
+            operation = cal.wrapInstance(operation, Ci.calIOperation);
             if (operation && operation.isPending) {
                 this.operation = operation;
                 this.agendaListbox.mPendingRefreshJobs.set(this.calId, this);
             }
         }
     };
 
     refreshJob.execute();
@@ -1109,18 +1109,17 @@ function scheduleNextCurrentEventUpdate(
         // Add observer
         Services.obs.addObserver(wakeObserver, "wake_notification");
 
         // Remove observer on unload
         window.addEventListener("unload", () => {
             Services.obs.removeObserver(wakeObserver, "wake_notification");
         });
 
-        gEventTimer = Components.classes["@mozilla.org/timer;1"]
-                                   .createInstance(Components.interfaces.nsITimer);
+        gEventTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     }
     gEventTimer.initWithCallback(udCallback, aMsUntil, gEventTimer.TYPE_ONE_SHOT);
 }
 
 /**
  * Gets a right value for calendar.agendaListbox.soondays preference, avoid
  * erroneus values edited in the lightning.js preference file
  **/
--- a/calendar/base/content/agenda-listbox.xml
+++ b/calendar/base/content/agenda-listbox.xml
@@ -196,18 +196,18 @@
 
     <implementation>
       <method name="setOccurrence">
         <parameter name="aItem"/>
         <parameter name="aPeriod"/>
         <body><![CDATA[
             this.mOccurrence = aItem;
             this.setAttribute("status", aItem.status);
-            let dateFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
-                                          .getService(Components.interfaces.calIDateTimeFormatter);
+            let dateFormatter = Cc["@mozilla.org/calendar/datetime-formatter;1"]
+                                  .getService(Ci.calIDateTimeFormatter);
 
             let periodStartDate = aPeriod.start.clone();
             periodStartDate.isDate = true;
             let periodEndDate = aPeriod.end.clone();
             periodEndDate.day--;
             let start = this.mOccurrence[cal.dtz.startDateProp(this.mOccurrence)]
                             .getInTimezone(cal.dtz.defaultTimezone);
             let end = this.mOccurrence[cal.dtz.endDateProp(this.mOccurrence)]
--- a/calendar/base/content/calendar-base-view.xml
+++ b/calendar/base/content/calendar-base-view.xml
@@ -233,18 +233,18 @@
           this.tasksInView = (document.getElementById(kTasksInViewCommand)
                                   .getAttribute("checked") == "true");
           this.rotated = (document.getElementById(kOrientation)
                                   .getAttribute("checked") == "true");
           this.showCompleted = (document.getElementById(kShowCompleted)
                                   .getAttribute("checked") == "true");
 
           this.mTimezone = cal.dtz.defaultTimezone;
-          let alarmService = Components.classes["@mozilla.org/calendar/alarm-service;1"]
-                                       .getService(Components.interfaces.calIAlarmService);
+          let alarmService = Cc["@mozilla.org/calendar/alarm-service;1"]
+                               .getService(Ci.calIAlarmService);
           alarmService.addObserver(this.mObserver);
           this.setAttribute("type", this.type);
           this.mResizeHandler = () => {
               this.onResize(this);
           };
           this.viewBroadcaster.addEventListener(this.getAttribute("type") + "viewresized", this.mResizeHandler, true);
           // add a preference observer to monitor changes
           Services.prefs.addObserver("calendar.", this.mPrefObserver);
@@ -257,18 +257,18 @@
       ]]></constructor>
 
       <destructor><![CDATA[
           ChromeUtils.import("resource://gre/modules/Services.jsm");
 
           if (this.mCalendar) {
               this.mCalendar.removeObserver(this.mObserver);
           }
-          let alarmService = Components.classes["@mozilla.org/calendar/alarm-service;1"]
-                                       .getService(Components.interfaces.calIAlarmService);
+          let alarmService = Cc["@mozilla.org/calendar/alarm-service;1"]
+                               .getService(Ci.calIAlarmService);
           alarmService.removeObserver(this.mObserver);
           this.viewBroadcaster.removeEventListener(this.getAttribute("type") + "viewresized", this.mResizeHandler, true);
           Services.prefs.removeObserver("calendar.", this.mPrefObserver);
           Services.obs.removeObserver(this.mTimezoneObserver, "defaultTimezoneChanged");
       ]]></destructor>
 
       <property name="type" readonly="true">
         <getter><![CDATA[
@@ -478,17 +478,17 @@
                             this.calView.doAddItem(item);
                         }
                     }
                 },
 
                 cancel: function() {
                     this.calView.mLog.info("Refresh cancelled for calendar " + this.calId);
                     this.cancelled = true;
-                    let operation = cal.wrapInstance(this.operation, Components.interfaces.calIOperation);
+                    let operation = cal.wrapInstance(this.operation, Ci.calIOperation);
                     if (operation && operation.isPending) {
                         operation.cancel();
                         this.operation = null;
                     }
                 },
 
                 execute: function() {
                     if (!this.calView.startDate || !this.calView.endDate || !aCalendar) {
@@ -530,33 +530,33 @@
                         filter |= this.calendar.ITEM_FILTER_TYPE_EVENT;
                     }
 
                     let operation = this.calendar.getItems(filter,
                                                            0,
                                                            this.calView.startDate,
                                                            this.calView.queryEndDate,
                                                            this);
-                    operation = cal.wrapInstance(operation, Components.interfaces.calIOperation);
+                    operation = cal.wrapInstance(operation, Ci.calIOperation);
                     if (operation && operation.isPending) {
                         this.operation = operation;
                         this.calView.mPendingRefreshJobs.set(this.calId, this);
                     }
                 }
             };
 
             refreshJob.execute();
         ]]></body>
       </method>
 
       <method name="deleteItemsFromCalendar">
         <parameter name="aCalendar"/>
         <body><![CDATA[
             /* This method must be implemented in subclasses. */
-            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+            throw Cr.NS_ERROR_NOT_IMPLEMENTED;
         ]]></body>
       </method>
 
       <!-- the end date that should be used for getItems and similar queries -->
       <property name="queryEndDate" readonly="true">
         <getter><![CDATA[
             let end = this.endDate;
             if (!end) {
--- a/calendar/base/content/calendar-chrome-startup.js
+++ b/calendar/base/content/calendar-chrome-startup.js
@@ -31,19 +31,17 @@ async function commonInitCalendar() {
     // Set up the command controller from calendar-common-sets.js
     injectCalendarCommandController();
 
     // Set up item and day selection listeners
     getViewDeck().addEventListener("dayselect", observeViewDaySelect);
     getViewDeck().addEventListener("itemselect", calendarController.onSelectionChanged, true);
 
     // Start alarm service
-    Components.classes["@mozilla.org/calendar/alarm-service;1"]
-              .getService(Components.interfaces.calIAlarmService)
-              .startup();
+    Cc["@mozilla.org/calendar/alarm-service;1"].getService(Ci.calIAlarmService).startup();
     document.getElementById("calsidebar_splitter").addEventListener("command", onCalendarViewResize);
     window.addEventListener("resize", onCalendarViewResize, true);
 
     // Set up the category colors
     categoryManagement.initCategories();
 
     // Set up window pref observers
     calendarWindowPrefs.init();
@@ -141,17 +139,17 @@ var calendarWindowPrefs = {
                     let attributeValue = Preferences.get("calendar.view.useSystemColors", false) && "true";
                     for (let win of fixIterator(Services.ww.getWindowEnumerator())) {
                         setElementValue(win.document.documentElement, attributeValue, "systemcolors");
                     }
                     break;
                 }
             }
         } else if (aTopic == "domwindowopened") {
-            let win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
+            let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
             win.addEventListener("load", () => {
                 let attributeValue = Preferences.get("calendar.view.useSystemColors", false) && "true";
                 setElementValue(win.document.documentElement, attributeValue, "systemcolors");
             });
         }
     }
 };
 
--- a/calendar/base/content/calendar-clipboard.js
+++ b/calendar/base/content/calendar-clipboard.js
@@ -82,33 +82,33 @@ function copyToClipboard(aCalendarItemAr
         aCutMode ? "cut" : "copy"
     );
     if (!response) {
         // The user canceled the dialog, bail out
         return;
     }
 
     let icsSerializer = Cc["@mozilla.org/calendar/ics-serializer;1"]
-                        .createInstance(Ci.calIIcsSerializer);
+                          .createInstance(Ci.calIIcsSerializer);
     icsSerializer.addItems(targetItems, targetItems.length);
     let icsString = icsSerializer.serializeToString();
 
     let clipboard = Services.clipboard;
     let trans = Cc["@mozilla.org/widget/transferable;1"]
-                .createInstance(Ci.nsITransferable);
+                  .createInstance(Ci.nsITransferable);
 
     if (trans && clipboard) {
         // Register supported data flavors
         trans.init(null);
         trans.addDataFlavor("text/calendar");
         trans.addDataFlavor("text/unicode");
 
         // Create the data objects
         let icsWrapper = Cc["@mozilla.org/supports-string;1"]
-                         .createInstance(Ci.nsISupportsString);
+                           .createInstance(Ci.nsISupportsString);
         icsWrapper.data = icsString;
 
         // Add data objects to transferable
         // Both Outlook 2000 client and Lotus Organizer use text/unicode
         // when pasting iCalendar data.
         trans.setTransferData("text/calendar",
                               icsWrapper,
                               icsWrapper.data.length * 2); // double byte data
@@ -156,17 +156,17 @@ function pasteFromClipboard() {
     let flavor = {};
     let data = {};
     trans.getAnyTransferData(flavor, data, {});
     data = data.value.QueryInterface(Ci.nsISupportsString).data;
     switch (flavor.value) {
         case "text/calendar":
         case "text/unicode": {
             let icsParser = Cc["@mozilla.org/calendar/ics-parser;1"]
-                           .createInstance(Ci.calIIcsParser);
+                              .createInstance(Ci.calIIcsParser);
             try {
                 icsParser.parseString(data);
             } catch (e) {
                 // Ignore parser errors from the clipboard data, if it fails
                 // there will just be 0 items.
             }
 
             let items = icsParser.getItems({});
--- a/calendar/base/content/calendar-dnd-listener.js
+++ b/calendar/base/content/calendar-dnd-listener.js
@@ -26,19 +26,19 @@ var itemConversion = {
 
         aItem.calendar = getSelectedCalendar();
         aItem.title = aMsgHdr.mime2DecodedSubject;
 
         cal.dtz.setDefaultStartEndHour(aItem);
         cal.alarms.setDefaultValues(aItem);
 
         let messenger = Cc["@mozilla.org/messenger;1"]
-                        .createInstance(Ci.nsIMessenger);
+                          .createInstance(Ci.nsIMessenger);
         let streamListener = Cc["@mozilla.org/network/sync-stream-listener;1"]
-                             .createInstance(Ci.nsISyncStreamListener);
+                               .createInstance(Ci.nsISyncStreamListener);
         messenger.messageServiceFromURI(msgUri).streamMessage(msgUri,
                                                               streamListener,
                                                               null,
                                                               null,
                                                               false,
                                                               "",
                                                               false);
 
@@ -210,17 +210,17 @@ calDNDBaseObserver.prototype = {
     },
 
     /**
      * Action to take when dropping the event.
      */
 
     onDrop: function(aEvent, aTransferData, aDragSession) {
         let transferable = Cc["@mozilla.org/widget/transferable;1"]
-                           .createInstance(Ci.nsITransferable);
+                             .createInstance(Ci.nsITransferable);
         transferable.init(null);
         transferable.addDataFlavor("text/calendar");
         transferable.addDataFlavor("text/x-moz-url");
         transferable.addDataFlavor("text/x-moz-message");
         transferable.addDataFlavor("text/unicode");
         transferable.addDataFlavor("application/x-moz-file");
 
         aDragSession.getData(transferable, 0);
@@ -553,17 +553,17 @@ calTaskButtonDNDObserver.prototype = {
  * Invoke a drag session for the passed item. The passed box will be used as a
  * source.
  *
  * @param aItem     The item to drag.
  * @param aXULBox   The XUL box to invoke the drag session from.
  */
 function invokeEventDragSession(aItem, aXULBox) {
     let transfer = Cc["@mozilla.org/widget/transferable;1"]
-                   .createInstance(Ci.nsITransferable);
+                     .createInstance(Ci.nsITransferable);
     transfer.init(null);
     transfer.addDataFlavor("text/calendar");
 
     let flavourProvider = {
         QueryInterface: ChromeUtils.generateQI([Ci.nsIFlavorDataProvider]),
 
         item: aItem,
         getFlavorData: function(aInTransferable, aInFlavor, aOutData, aOutDataLen) {
@@ -582,34 +582,33 @@ function invokeEventDragSession(aItem, a
         transfer.setTransferData("application/vnd.x-moz-cal-event", flavourProvider, 0);
     } else if (cal.item.isToDo(aItem)) {
         transfer.addDataFlavor("application/vnd.x-moz-cal-task");
         transfer.setTransferData("application/vnd.x-moz-cal-task", flavourProvider, 0);
     }
 
     // Also set some normal data-types, in case we drag into another app
     let serializer = Cc["@mozilla.org/calendar/ics-serializer;1"]
-                     .createInstance(Ci.calIIcsSerializer);
+                       .createInstance(Ci.calIIcsSerializer);
     serializer.addItems([aItem], 1);
 
     let supportsString = Cc["@mozilla.org/supports-string;1"]
-                         .createInstance(Ci.nsISupportsString);
+                           .createInstance(Ci.nsISupportsString);
     supportsString.data = serializer.serializeToString();
     transfer.setTransferData("text/calendar", supportsString, supportsString.data.length * 2);
     transfer.setTransferData("text/unicode", supportsString, supportsString.data.length * 2);
 
     let action = Ci.nsIDragService.DRAGDROP_ACTION_MOVE;
-    let mutArray = Cc["@mozilla.org/array;1"]
-                   .createInstance(Ci.nsIMutableArray);
+    let mutArray = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
     mutArray.appendElement(transfer);
     aXULBox.sourceObject = aItem;
     try {
         cal.getDragService().invokeDragSession(aXULBox, "", mutArray, action);
     } catch (e) {
-        if (e.result != Components.results.NS_ERROR_FAILURE) {
+        if (e.result != Cr.NS_ERROR_FAILURE) {
             // Pressing Escape on some platforms results in NS_ERROR_FAILURE
             // being thrown. Catch this exception, but throw anything else.
             throw e;
         }
     }
 }
 
 /* exported calendarViewDNDObserver, calendarMailButtonDNDObserver,
--- a/calendar/base/content/calendar-extract.js
+++ b/calendar/base/content/calendar-extract.js
@@ -6,19 +6,19 @@ const { Extractor } = ChromeUtils.import
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var calendarExtract = {
     onShowLocaleMenu: function(target) {
         let localeList = document.getElementById(target.id);
         let langs = [];
-        let chrome = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
-                               .getService(Components.interfaces.nsIXULChromeRegistry);
-        chrome.QueryInterface(Components.interfaces.nsIToolkitChromeRegistry);
+        let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"]
+                       .getService(Ci.nsIXULChromeRegistry)
+                       .QueryInterface(Ci.nsIToolkitChromeRegistry);
         let locales = chrome.getLocalesForPackage("calendar");
         let langRegex = /^(([^-]+)-*(.*))$/;
 
         while (locales.hasMore()) {
             let localeParts = langRegex.exec(locales.getNext());
             let langName = localeParts[2];
 
             try {
@@ -65,20 +65,19 @@ var calendarExtract = {
         let locale = event.target.value;
         this.extractFromEmail(isEvent, true, locale);
     },
 
     extractFromEmail: function(isEvent, fixedLang, fixedLocale) {
         // TODO would be nice to handle multiple selected messages,
         // though old conversion functionality didn't
         let message = gFolderDisplay.selectedMessage;
-        let messenger = Components.classes["@mozilla.org/messenger;1"]
-                                  .createInstance(Components.interfaces.nsIMessenger);
-        let listener = Components.classes["@mozilla.org/network/sync-stream-listener;1"]
-                                 .createInstance(Components.interfaces.nsISyncStreamListener);
+        let messenger = Cc["@mozilla.org/messenger;1"].createInstance(Ci.nsIMessenger);
+        let listener = Cc["@mozilla.org/network/sync-stream-listener;1"]
+                         .createInstance(Ci.nsISyncStreamListener);
         let uri = message.folder.getUriForMsg(message);
         messenger.messageServiceFromURI(uri)
                  .streamMessage(uri, listener, null, null, false, "");
         let folder = message.folder;
         let title = message.mime2DecodedSubject;
         let content = folder.getMsgTextFromStream(listener.inputStream,
                                                   message.Charset,
                                                   65536,
--- a/calendar/base/content/calendar-invitations-manager.js
+++ b/calendar/base/content/calendar-invitations-manager.js
@@ -144,25 +144,25 @@ InvitationsManager.prototype = {
                     this.mInvitationsManager.mItemList.sort((a, b) => {
                         return a.startDate.compare(b.startDate);
                     });
                     for (let listener of listeners) {
                         try {
                             if (this.mInvitationsManager.mItemList.length) {
                                 // Only call if there are actually items
                                 listener.onGetResult(null,
-                                                     Components.results.NS_OK,
-                                                     Components.interfaces.calIItemBase,
+                                                     Cr.NS_OK,
+                                                     Ci.calIItemBase,
                                                      null,
                                                      this.mInvitationsManager.mItemList.length,
                                                      this.mInvitationsManager.mItemList);
                             }
                             listener.onOperationComplete(null,
-                                                         Components.results.NS_OK,
-                                                         Components.interfaces.calIOperationListener.GET,
+                                                         Cr.NS_OK,
+                                                         Ci.calIOperationListener.GET,
                                                          null,
                                                          null);
                         } catch (exc) {
                             cal.ERROR(exc);
                         }
                     }
                 }
             },
@@ -197,24 +197,24 @@ InvitationsManager.prototype = {
             // temporary hack unless calCachedCalendar supports REQUEST_NEEDS_ACTION filter:
             calendar = calendar.getProperty("cache.uncachedCalendar");
             if (!calendar) {
                 opListener.onOperationComplete();
                 continue;
             }
 
             try {
-                calendar = calendar.QueryInterface(Components.interfaces.calICalendar);
+                calendar = calendar.QueryInterface(Ci.calICalendar);
                 let endDate = this.mStartDate.clone();
                 endDate.year += 1;
-                let operation = calendar.getItems(Components.interfaces.calICalendar.ITEM_FILTER_REQUEST_NEEDS_ACTION |
-                                                  Components.interfaces.calICalendar.ITEM_FILTER_TYPE_ALL |
+                let operation = calendar.getItems(Ci.calICalendar.ITEM_FILTER_REQUEST_NEEDS_ACTION |
+                                                  Ci.calICalendar.ITEM_FILTER_TYPE_ALL |
                                                   // we need to retrieve by occurrence to properly filter exceptions,
                                                   // should be fixed with bug 416975
-                                                  Components.interfaces.calICalendar.ITEM_FILTER_CLASS_OCCURRENCES,
+                                                  Ci.calICalendar.ITEM_FILTER_CLASS_OCCURRENCES,
                                                   0, this.mStartDate,
                                                   endDate /* we currently cannot pass null here, because of bug 416975 */,
                                                   opListener);
                 gInvitationsRequestManager.addRequestStatus(calendar, operation);
             } catch (exc) {
                 opListener.onOperationComplete();
                 cal.ERROR(exc);
             }
@@ -269,17 +269,17 @@ InvitationsManager.prototype = {
         operationListener.prototype = {
             QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
             onOperationComplete: function(aCalendar,
                                           aStatus,
                                           aOperationType,
                                           aId,
                                           aDetail) {
                 if (Components.isSuccessCode(aStatus) &&
-                    aOperationType == Components.interfaces.calIOperationListener.MODIFY) {
+                    aOperationType == Ci.calIOperationListener.MODIFY) {
                     cal.itip.checkAndSend(aOperationType, aDetail, this.mOldItem);
                     this.mInvitationsManager.deleteItem(aDetail);
                     this.mInvitationsManager.addItem(aDetail);
                 }
                 this.mInvitationsManager.mJobsPending--;
                 if (this.mInvitationsManager.mJobsPending == 0 &&
                     this.mJobQueueFinishedCallBack) {
                     this.mJobQueueFinishedCallBack();
@@ -404,16 +404,16 @@ InvitationsManager.prototype = {
      * Checks if the item is valid for the invitation manager. Checks if the
      * item is in the range of the invitation manager and if the item is a valid
      * invitation.
      *
      * @param item      The item to check
      * @return          A boolean indicating if the item is a valid invitation.
      */
     validateItem: function(item) {
-        if (item.calendar instanceof Components.interfaces.calISchedulingSupport &&
+        if (item.calendar instanceof Ci.calISchedulingSupport &&
             !item.calendar.isInvitation(item)) {
             return false; // exclude if organizer has invited himself
         }
         let start = item[cal.dtz.startDateProp(item)] || item[cal.dtz.endDateProp(item)];
         return cal.itip.isOpenInvitation(item) && start.compare(this.mStartDate) >= 0;
     }
 };
--- a/calendar/base/content/calendar-item-editing.js
+++ b/calendar/base/content/calendar-item-editing.js
@@ -466,17 +466,17 @@ function openEventDialog(calendarItem, c
     };
 
     // the dialog will reset this to auto when it is done loading.
     window.setCursor("wait");
 
     // ask the provide if this item is an invitation. if this is the case
     // we'll open the summary dialog since the user is not allowed to change
     // the details of the item.
-    let wrappedCalendar = cal.wrapInstance(calendar, Components.interfaces.calISchedulingSupport);
+    let wrappedCalendar = cal.wrapInstance(calendar, Ci.calISchedulingSupport);
     let isInvitation = wrappedCalendar && wrappedCalendar.isInvitation(calendarItem);
 
     // open the dialog modeless
     let url;
     let isEditable = mode == "modify" && !isInvitation && cal.acl.userCanModifyItem(calendarItem);
     if (cal.acl.isCalendarWritable(calendar) && (mode == "new" || isEditable)) {
         if (args.inTab) {
             url = args.useNewItemUI ? "chrome://lightning/content/html-item-editing/lightning-item-iframe.html"
@@ -580,17 +580,17 @@ function promptOccurrenceModification(aI
     }
 
     switch (type) {
         case MODIFY_PARENT:
             pastItems = items.map(item => item.parentItem);
             break;
         case MODIFY_FOLLOWING:
             // TODO tbd in a different bug
-            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+            throw Cr.NS_ERROR_NOT_IMPLEMENTED;
         case MODIFY_OCCURRENCE:
             pastItems = items;
             break;
         case CANCEL:
             // Since we have not set past or futureItem, the return below will
             // take care.
             break;
     }
@@ -603,21 +603,20 @@ function promptOccurrenceModification(aI
 // Undo/Redo code
 
 /**
  * Helper to return the transaction manager service.
  *
  * @return      The calITransactionManager service.
  */
 function getTransactionMgr() {
-    return Components.classes["@mozilla.org/calendar/transactionmanager;1"]
-                     .getService(Components.interfaces.calITransactionManager);
+    return Cc["@mozilla.org/calendar/transactionmanager;1"]
+             .getService(Ci.calITransactionManager);
 }
 
-
 /**
  * Create and commit a transaction with the given arguments to the transaction
  * manager. Also updates the undo/redo menu.
  *
  * @see                 calITransactionManager
  * @param aAction       The action to do.
  * @param aItem         The new item to add/modify/delete
  * @param aCalendar     The calendar to do the transaction on
--- a/calendar/base/content/calendar-management.js
+++ b/calendar/base/content/calendar-management.js
@@ -25,18 +25,18 @@ function getSelectedCalendar() {
 /**
  * Deletes the passed calendar, prompting the user if he really wants to do
  * this. If there is only one calendar left, no calendar is removed and the user
  * is not prompted.
  *
  * @param aCalendar     The calendar to delete.
  */
 function promptDeleteCalendar(aCalendar) {
-    const nIPS = Components.interfaces.nsIPromptService;
-    const cICM = Components.interfaces.calICalendarManager;
+    const nIPS = Ci.nsIPromptService;
+    const cICM = Ci.calICalendarManager;
 
     let calMgr = cal.getCalendarManager();
     let calendars = calMgr.getCalendars({});
     if (calendars.length <= 1) {
         // If this is the last calendar, don't delete it.
         return;
     }
 
@@ -125,17 +125,17 @@ function initHomeCalendar() {
     composite.addCalendar(homeCalendar);
 
     // Wrapping this in a try/catch block, as if any of the migration code
     // fails, the app may not load.
     if (Preferences.get("calendar.migrator.enabled", true)) {
         try {
             gDataMigrator.checkAndMigrate();
         } catch (e) {
-            Components.utils.reportError("Migrator error: " + e);
+            Cu.reportError("Migrator error: " + e);
         }
     }
 
     return homeCalendar;
 }
 
 /**
  * Called to clean up the calendar manager for a window.
@@ -407,27 +407,27 @@ function openCalendarSubscriptionsDialog
 /**
  * Calendar Offline Manager
  */
 var calendarOfflineManager = {
     QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
 
     init: function() {
         if (this.initialized) {
-            throw Components.results.NS_ERROR_ALREADY_INITIALIZED;
+            throw Cr.NS_ERROR_ALREADY_INITIALIZED;
         }
         Services.obs.addObserver(this, "network:offline-status-changed");
 
         this.updateOfflineUI(!this.isOnline());
         this.initialized = true;
     },
 
     uninit: function() {
         if (!this.initialized) {
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
+            throw Cr.NS_ERROR_NOT_INITIALIZED;
         }
         Services.obs.removeObserver(this, "network:offline-status-changed");
         this.initialized = false;
     },
 
     isOnline: function() {
         return !Services.io.offline;
     },
--- a/calendar/base/content/calendar-month-view.xml
+++ b/calendar/base/content/calendar-month-view.xml
@@ -75,18 +75,18 @@
         ]]></getter>
         <setter><![CDATA[
             cal.ASSERT(!this.mOccurrence, "Code changes needed to set the occurrence twice", true);
             this.mOccurrence = val;
             if (cal.item.isEvent(val)) {
                 if (!val.startDate.isDate) {
                     let icon = document.getAnonymousElementByAttribute(this, "anonid", "item-icon");
                     let label = document.getAnonymousElementByAttribute(this, "anonid", "item-label");
-                    let formatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
-                                              .getService(Components.interfaces.calIDateTimeFormatter);
+                    let formatter = Cc["@mozilla.org/calendar/datetime-formatter;1"]
+                                      .getService(Ci.calIDateTimeFormatter);
                     let timezone = this.calendarView ? this.calendarView.mTimezone
                                                      : cal.dtz.defaultTimezone;
                     let parentDate = this.parentBox.date;
                     let parentTime = cal.createDateTime();
                     parentTime.resetTo(parentDate.year, parentDate.month, parentDate.day, 0, 0, 0, timezone);
                     let startTime = val.startDate.getInTimezone(timezone);
                     let endTime = val.endDate.getInTimezone(timezone);
                     let nextDay = parentTime.clone();
@@ -195,17 +195,17 @@
             return val;
         ]]></setter>
       </property>
 
       <method name="setDate">
         <parameter name="aDate"/>
         <body><![CDATA[
             if (!aDate) {
-                throw Components.results.NS_ERROR_NULL_POINTER;
+                throw Cr.NS_ERROR_NULL_POINTER;
             }
 
             // Remove all the old events
             this.mItemHash = {};
             removeChildren(this);
 
             if (this.mDate && this.mDate.compare(aDate) == 0) {
                 return;
@@ -501,17 +501,17 @@
         ]]></setter>
       </property>
 
       <method name="handlePreference">
         <parameter name="aSubject"/>
         <parameter name="aTopic"/>
         <parameter name="aPreference"/>
         <body><![CDATA[
-            aSubject.QueryInterface(Components.interfaces.nsIPrefBranch);
+            aSubject.QueryInterface(Ci.nsIPrefBranch);
 
             switch (aPreference) {
                 case "calendar.previousweeks.inview":
                     this.updateDaysOffPrefs();
                     this.refreshView();
                     break;
 
                 case "calendar.week.start":
@@ -749,17 +749,17 @@
                 }
             }
 
             if (this.mSelectedItems.length) {
                 this.mSelectedItems = [];
             }
 
             if (!this.mStartDate || !this.mEndDate) {
-                throw Components.results.NS_ERROR_FAILURE;
+                throw Cr.NS_ERROR_FAILURE;
             }
 
             // Days that are not in the main month on display are displayed with
             // a gray background.  Unless the month actually starts on a Sunday,
             // this means that mStartDate.month is 1 month less than the main month
             let mainMonth = this.mStartDate.month;
             if (this.mStartDate.day != 1) {
                 mainMonth++;
--- a/calendar/base/content/calendar-multiday-view.xml
+++ b/calendar/base/content/calendar-multiday-view.xml
@@ -37,17 +37,17 @@
 
       <method name="setDayStartEndHours">
         <parameter name="aDayStartHour"/>
         <parameter name="aDayEndHour"/>
         <body><![CDATA[
             if (aDayStartHour * 60 < this.mStartMin ||
                 aDayStartHour > aDayEndHour ||
                 aDayEndHour * 60 > this.mEndMin) {
-                throw Components.results.NS_ERROR_INVALID_ARG;
+                throw Cr.NS_ERROR_INVALID_ARG;
             }
             if (this.mDayStartHour != aDayStartHour ||
                 this.mDayEndHour != aDayEndHour) {
                 this.mDayEndHour = aDayEndHour;
                 this.mDayStartHour = aDayStartHour;
 
                 let topbox = document.getAnonymousElementByAttribute(this, "anonid", "topbox");
                 if (topbox.childNodes.length) {
@@ -635,18 +635,18 @@
 
             // bgbox is used mainly for drawing the grid.  at some point it may
             // also be used for all-day events.
             let otherorient = getOtherOrientation(orient);
             let configBox = document.getAnonymousElementByAttribute(this, "anonid", "config-box");
             configBox.removeAttribute("hidden");
             let minSize = configBox.getOptimalMinSize();
             configBox.setAttribute("hidden", "true");
-            this.mMinDuration = Components.classes["@mozilla.org/calendar/duration;1"]
-                                              .createInstance(Components.interfaces.calIDuration);
+            this.mMinDuration = Cc["@mozilla.org/calendar/duration;1"]
+                                  .createInstance(Ci.calIDuration);
             this.mMinDuration.minutes = Math.trunc(minSize / this.mPixPerMin);
 
             let theMin = this.mStartMin;
             while (theMin < this.mEndMin) {
                 let dur = theMin % 60;
                 theMin += dur;
                 if (dur == 0) {
                     dur = 60;
@@ -1797,17 +1797,17 @@
         <parameter name="aGrabbedElement"/>
         <!-- mouse screenX/screenY from the event -->
         <parameter name="aMouseX"/>
         <parameter name="aMouseY"/>
         <parameter name="aSnapInt"/>
         <body><![CDATA[
             if (!cal.acl.isCalendarWritable(aOccurrence.calendar) ||
                 !cal.acl.userCanModifyItem(aOccurrence) ||
-                (aOccurrence.calendar instanceof Components.interfaces.calISchedulingSupport && aOccurrence.calendar.isInvitation(aOccurrence)) ||
+                (aOccurrence.calendar instanceof Ci.calISchedulingSupport && aOccurrence.calendar.isInvitation(aOccurrence)) ||
                 aOccurrence.calendar.getProperty("capabilities.events.supported") === false) {
                 return;
             }
 
             this.mDragState = {
                 origColumn: this,
                 dragOccurrence: aOccurrence,
                 mouseOffset: 0,
@@ -1982,17 +1982,17 @@
       </method>
 
       <method name="setDayStartEndMinutes">
         <parameter name="aDayStartMin"/>
         <parameter name="aDayEndMin"/>
         <body><![CDATA[
             if (aDayStartMin < this.mStartMin || aDayStartMin > aDayEndMin ||
                 aDayEndMin > this.mEndMin) {
-                throw Components.results.NS_ERROR_INVALID_ARG;
+                throw Cr.NS_ERROR_INVALID_ARG;
             }
             if (this.mDayStartMin != aDayStartMin || this.mDayEndMin != aDayEndMin) {
                 this.mDayStartMin = aDayStartMin;
                 this.mDayEndMin = aDayEndMin;
             }
         ]]></body>
       </method>
 
@@ -2636,17 +2636,17 @@
         ]]></body>
       </method>
 
       <method name="handlePreference">
         <parameter name="aSubject"/>
         <parameter name="aTopic"/>
         <parameter name="aPreference"/>
         <body><![CDATA[
-            aSubject.QueryInterface(Components.interfaces.nsIPrefBranch);
+            aSubject.QueryInterface(Ci.nsIPrefBranch);
             switch (aPreference) {
                 case "calendar.view.daystarthour":
                     this.setDayStartEndMinutes(aSubject.getIntPref(aPreference) * 60,
                                                this.mDayEndMin);
                     this.refreshView();
                     break;
 
                 case "calendar.view.dayendhour":
@@ -3781,17 +3781,17 @@
             if (!("setDayStartEndHours" in this.timebar)) {
                 this.timebar.addEventListener(
                   "bindingattached", () => this.setDayStartEndMinutes(aDayStartMin, aDayEndMin), { once: true }
                 );
                 return;
             }
             if (aDayStartMin < this.mStartMin || aDayStartMin > aDayEndMin ||
                 aDayEndMin > this.mEndMin) {
-                throw Components.results.NS_ERROR_INVALID_ARG;
+                throw Cr.NS_ERROR_INVALID_ARG;
             }
             if (this.mDayStartMin != aDayStartMin ||
                 this.mDayEndMin != aDayEndMin) {
                 this.mDayStartMin = aDayStartMin;
                 this.mDayEndMin = aDayEndMin;
 
                 // Also update on the time-bar
                 this.timebar.setDayStartEndHours(this.mDayStartMin / 60,
@@ -3801,17 +3801,17 @@
         ]]></body>
       </method>
 
       <method name="setVisibleMinutes">
         <parameter name="aVisibleMinutes"/>
         <body><![CDATA[
             if (aVisibleMinutes <= 0 ||
                 aVisibleMinutes > (this.mEndMin - this.mStartMin)) {
-                throw Components.results.NS_ERROR_INVALID_ARG;
+                throw Cr.NS_ERROR_INVALID_ARG;
             }
             if (this.mVisibleMinutes != aVisibleMinutes) {
                 this.mVisibleMinutes = aVisibleMinutes;
             }
             return this.mVisibleMinutes;
         ]]></body>
       </method>
 
--- a/calendar/base/content/calendar-statusbar.js
+++ b/calendar/base/content/calendar-statusbar.js
@@ -13,17 +13,17 @@ var { cal } = ChromeUtils.import("resour
 var gCalendarStatusFeedback = {
     mCalendarStep: 0,
     mCalendarCount: 0,
     mWindow: null,
     mStatusText: null,
     mStatusBar: null,
     mStatusProgressPanel: null,
     mThrobber: null,
-    mProgressMode: Components.interfaces.calIStatusObserver.NO_PROGRESS,
+    mProgressMode: Ci.calIStatusObserver.NO_PROGRESS,
     mCurIndex: 0,
     mInitialized: false,
     mCalendars: {},
 
     QueryInterface: ChromeUtils.generateQI([Ci.calIStatusObserver]),
 
     initialize: function(aWindow) {
         if (!this.mInitialized) {
@@ -40,62 +40,62 @@ var gCalendarStatusFeedback = {
         this.mStatusText.setAttribute("label", status);
     },
 
     get spinning() {
         return this.mProgressMode;
     },
 
     startMeteors: function(aProgressMode, aCalendarCount) {
-        if (aProgressMode != Components.interfaces.calIStatusObserver.NO_PROGRESS) {
+        if (aProgressMode != Ci.calIStatusObserver.NO_PROGRESS) {
             if (!this.mInitialized) {
-                Components.utils.reportError("StatusObserver has not been initialized!");
+                Cu.reportError("StatusObserver has not been initialized!");
                 return;
             }
             this.mCalendars = {};
             this.mCurIndex = 0;
             if (aCalendarCount) {
                 this.mCalendarCount = this.mCalendarCount + aCalendarCount;
                 this.mCalendarStep = Math.trunc(100 / this.mCalendarCount);
             }
             this.mProgressMode = aProgressMode;
             this.mStatusProgressPanel.removeAttribute("collapsed");
-            if (this.mProgressMode == Components.interfaces.calIStatusObserver.DETERMINED_PROGRESS) {
+            if (this.mProgressMode == Ci.calIStatusObserver.DETERMINED_PROGRESS) {
                 this.mStatusBar.value = 0;
                 let commonStatus = cal.l10n.getCalString("gettingCalendarInfoCommon");
                 this.showStatusString(commonStatus);
             }
             if (this.mThrobber) {
                 this.mThrobber.setAttribute("busy", true);
             }
         }
     },
 
     stopMeteors: function() {
         if (!this.mInitialized) {
             return;
         }
-        if (this.spinning != Components.interfaces.calIStatusObserver.NO_PROGRESS) {
-            this.mProgressMode = Components.interfaces.calIStatusObserver.NO_PROGRESS;
+        if (this.spinning != Ci.calIStatusObserver.NO_PROGRESS) {
+            this.mProgressMode = Ci.calIStatusObserver.NO_PROGRESS;
             this.mStatusProgressPanel.collapsed = true;
             this.mStatusBar.value = 0;
             this.mCalendarCount = 0;
             this.showStatusString("");
             if (this.mThrobber) {
                 this.mThrobber.setAttribute("busy", false);
             }
         }
     },
 
     calendarCompleted: function(aCalendar) {
         if (!this.mInitialized) {
             return;
         }
-        if (this.spinning != Components.interfaces.calIStatusObserver.NO_PROGRESS) {
-            if (this.spinning == Components.interfaces.calIStatusObserver.DETERMINED_PROGRESS) {
+        if (this.spinning != Ci.calIStatusObserver.NO_PROGRESS) {
+            if (this.spinning == Ci.calIStatusObserver.DETERMINED_PROGRESS) {
                 if (!this.mCalendars[aCalendar.id] || this.mCalendars[aCalendar.id] === undefined) {
                     this.mCalendars[aCalendar.id] = true;
                     this.mStatusBar.value = parseInt(this.mStatusBar.value, 10) + this.mCalendarStep;
                     this.mCurIndex++;
                     let curStatus = cal.l10n.getCalString("gettingCalendarInfoDetail",
                                                                [this.mCurIndex, this.mCalendarCount]);
                     this.showStatusString(curStatus);
                 }
--- a/calendar/base/content/calendar-task-tree.js
+++ b/calendar/base/content/calendar-task-tree.js
@@ -163,17 +163,17 @@ function changeMenuForTask(aEvent) {
  */
 function contextChangeTaskProgress(aEvent, aProgress) {
     if (gTabmail && gTabmail.currentTabInfo.mode.type == "calendarTask") {
         editToDoStatus(aProgress);
     } else {
         startBatchTransaction();
         let tasks = getSelectedTasks(aEvent);
         for (let task of tasks) {
-            let newTask = task.clone().QueryInterface(Components.interfaces.calITodo);
+            let newTask = task.clone().QueryInterface(Ci.calITodo);
             newTask.percentComplete = aProgress;
             switch (aProgress) {
                 case 0:
                     newTask.isCompleted = false;
                     break;
                 case 100:
                     newTask.isCompleted = true;
                     break;
@@ -215,17 +215,17 @@ function contextChangeTaskCalendar(aEven
 function contextChangeTaskPriority(aEvent, aPriority) {
     let tabType = gTabmail && gTabmail.currentTabInfo.mode.type;
     if (tabType == "calendarTask" || tabType == "calendarEvent") {
         editConfigState({ priority: aPriority });
     } else {
         startBatchTransaction();
         let tasks = getSelectedTasks(aEvent);
         for (let task of tasks) {
-            let newTask = task.clone().QueryInterface(Components.interfaces.calITodo);
+            let newTask = task.clone().QueryInterface(Ci.calITodo);
             newTask.priority = aPriority;
             doTransaction("modify", newTask, newTask.calendar, task, null);
         }
         endBatchTransaction();
     }
 }
 
 /**
--- a/calendar/base/content/calendar-task-tree.xml
+++ b/calendar/base/content/calendar-task-tree.xml
@@ -542,17 +542,17 @@
                 // prevent toggling completed status for parent items of
                 // repeating tasks or when the calendar is read-only.
                 if (!task || task.recurrenceInfo || task.calendar.readOnly) {
                     return;
                 }
                 if (aCol != null) {
                     let content = aCol.element.getAttribute("itemproperty");
                     if (content == "completed") {
-                        let newTask = task.clone().QueryInterface(Components.interfaces.calITodo);
+                        let newTask = task.clone().QueryInterface(Ci.calITodo);
                         newTask.isCompleted = !task.completedDate;
                         doTransaction("modify", newTask, newTask.calendar, task, null);
                     }
                 }
             },
 
             // Called on the view when a header is clicked.
             cycleHeader: function(aCol) {
@@ -779,18 +779,18 @@
                 if (!childElt.value) {
                     return false;
                 }
                 return aRow && aRow.value > -1 && this.binding.mTaskArray[aRow.value];
             },
 
             // Helper function to display datetimes
             _formatDateTime: function(aDateTime) {
-                let dateFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
-                                              .getService(Components.interfaces.calIDateTimeFormatter);
+                let dateFormatter = Cc["@mozilla.org/calendar/datetime-formatter;1"]
+                                      .getService(Ci.calIDateTimeFormatter);
 
                 // datetime is from todo object, it is not a javascript date
                 if (aDateTime && aDateTime.isValid) {
                     let dateTime = aDateTime.getInTimezone(cal.dtz.defaultTimezone);
                     return dateFormatter.formatDateTime(dateTime);
                 }
                 return "";
             }
--- a/calendar/base/content/calendar-task-view.js
+++ b/calendar/base/content/calendar-task-view.js
@@ -18,19 +18,18 @@ var taskDetailsView = {
      * its the only function in taskDetailsView.
      */
     onSelect: function(event) {
         function displayElement(id, flag) {
             setBooleanAttribute(id, "hidden", !flag);
             return flag;
         }
 
-        let dateFormatter =
-            Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
-            .getService(Components.interfaces.calIDateTimeFormatter);
+        let dateFormatter = Cc["@mozilla.org/calendar/datetime-formatter;1"]
+                              .getService(Ci.calIDateTimeFormatter);
 
         let item = document.getElementById("calendar-task-tree").currentTask;
         if (displayElement("calendar-task-details-container", item != null) &&
             displayElement("calendar-task-view-splitter", item != null)) {
             displayElement("calendar-task-details-title-row", true);
             document.getElementById("calendar-task-details-title").textContent =
                 (item.title ? item.title.replace(/\n/g, " ") : "");
 
@@ -406,15 +405,15 @@ function taskViewOnLoad() {
 /**
  * Copy the value of the given link node to the clipboard
  *
  * @param linkNode      The node containing the value to copy to the clipboard
  */
 function taskViewCopyLink(linkNode) {
     if (linkNode) {
         let linkAddress = linkNode.value;
-        let clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
-                                  .getService(Components.interfaces.nsIClipboardHelper);
+        let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+                          .getService(Ci.nsIClipboardHelper);
         clipboard.copyString(linkAddress);
     }
 }
 
 window.addEventListener("load", taskViewOnLoad);
--- a/calendar/base/content/calendar-view-core.xml
+++ b/calendar/base/content/calendar-view-core.xml
@@ -359,17 +359,17 @@
               onMouseOverItem(event);
           }
       ]]></handler>
       <handler event="dragstart"><![CDATA[
           if (event.target.localName == "calendar-event-box") {
               return;
           }
           let item = this.occurrence;
-          let isInvitation = item.calendar instanceof Components.interfaces.calISchedulingSupport && item.calendar.isInvitation(item);
+          let isInvitation = item.calendar instanceof Ci.calISchedulingSupport && item.calendar.isInvitation(item);
           if (!cal.acl.isCalendarWritable(item.calendar) || !cal.acl.userCanModifyItem(item) || isInvitation) {
               return;
           }
           if (!this.selected) {
               this.select(event);
           }
           invokeEventDragSession(item, this);
       ]]></handler>
--- a/calendar/base/content/calendar-views.js
+++ b/calendar/base/content/calendar-views.js
@@ -348,34 +348,32 @@ function scheduleMidnightUpdate(aRefresh
         // Observer for wake after sleep/hibernate/standby to create new timers and refresh UI
         let wakeObserver = {
             observe: function(aSubject, aTopic, aData) {
                 if (aTopic == "wake_notification") {
                     // postpone refresh for another couple of seconds to get netwerk ready:
                     if (this.mTimer) {
                         this.mTimer.cancel();
                     } else {
-                        this.mTimer = Components.classes["@mozilla.org/timer;1"]
-                                                .createInstance(Components.interfaces.nsITimer);
+                        this.mTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
                     }
                     this.mTimer.initWithCallback(udCallback, 10 * 1000,
-                                                 Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+                                                 Ci.nsITimer.TYPE_ONE_SHOT);
                 }
             }
         };
 
         // Add observer
         Services.obs.addObserver(wakeObserver, "wake_notification");
 
         // Remove observer on unload
         window.addEventListener("unload", () => {
             Services.obs.removeObserver(wakeObserver, "wake_notification");
         });
-        gMidnightTimer = Components.classes["@mozilla.org/timer;1"]
-                                   .createInstance(Components.interfaces.nsITimer);
+        gMidnightTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     }
     gMidnightTimer.initWithCallback(udCallback, msUntilTomorrow, gMidnightTimer.TYPE_ONE_SHOT);
 }
 
 /**
  * Retuns a cached copy of the view stylesheet.
  *
  * @return      The view stylesheet object.
--- a/calendar/base/content/dialogs/calendar-alarm-dialog.js
+++ b/calendar/base/content/dialogs/calendar-alarm-dialog.js
@@ -12,18 +12,18 @@ ChromeUtils.import("resource://gre/modul
 
 /**
  * Helper function to get the alarm service and cache it.
  *
  * @return The alarm service component
  */
 function getAlarmService() {
     if (!("mAlarmService" in window)) {
-        window.mAlarmService = Components.classes["@mozilla.org/calendar/alarm-service;1"]
-                                         .getService(Components.interfaces.calIAlarmService);
+        window.mAlarmService = Cc["@mozilla.org/calendar/alarm-service;1"]
+                                 .getService(Ci.calIAlarmService);
     }
     return window.mAlarmService;
 }
 
 /**
  * Event handler for the 'snooze' event. Snoozes the given alarm by the given
  * number of minutes using the alarm service.
  *
@@ -212,17 +212,17 @@ function getDuration(aMinutes) {
 
 /**
  * Check whether the snooze period exceeds the current limitation of the AlarmService and prompt
  * the user with a message if so
  * @param   {calIDuration}   aDuration   The duration to snooze
  * @returns {Boolean}
  */
 function aboveSnoozeLimit(aDuration) {
-    const LIMIT = Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS;
+    const LIMIT = Ci.calIAlarmService.MAX_SNOOZE_MONTHS;
 
     let currentTime = cal.dtz.now().getInTimezone(cal.dtz.UTC);
     let limitTime = currentTime.clone();
     limitTime.month += LIMIT;
 
     let durationUntilLimit = limitTime.subtractDate(currentTime);
     if (aDuration.compare(durationUntilLimit) > 0) {
         let msg = PluralForm.get(LIMIT, cal.l10n.getCalString("alarmSnoozeLimitExceeded"));
--- a/calendar/base/content/dialogs/calendar-creation.js
+++ b/calendar/base/content/dialogs/calendar-creation.js
@@ -6,18 +6,18 @@
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 
 /**
  * Shows the filepicker and creates a new calendar with a local file using the ICS
  * provider.
  */
 function openLocalCalendar() {
-    const nsIFilePicker = Components.interfaces.nsIFilePicker;
-    let picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+    const nsIFilePicker = Ci.nsIFilePicker;
+    let picker = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
     picker.init(window, cal.l10n.getCalString("Open"), nsIFilePicker.modeOpen);
     let wildmat = "*.ics";
     let description = cal.l10n.getCalString("filterIcs", [wildmat]);
     picker.appendFilter(description, wildmat);
     picker.appendFilters(nsIFilePicker.filterAll);
 
     picker.open(rv => {
         if (rv != nsIFilePicker.returnOK || !picker.file) {
--- a/calendar/base/content/dialogs/calendar-dialog-utils.js
+++ b/calendar/base/content/dialogs/calendar-dialog-utils.js
@@ -214,17 +214,17 @@ function updateReminderDetails() {
 }
 
 var gLastAlarmSelection = 0;
 
 function matchCustomReminderToMenuitem(reminder) {
     let defaultAlarmType = getDefaultAlarmType();
     let reminderList = document.getElementById("item-alarm");
     let reminderPopup = reminderList.firstChild;
-    if (reminder.related != Components.interfaces.calIAlarm.ALARM_RELATED_ABSOLUTE &&
+    if (reminder.related != Ci.calIAlarm.ALARM_RELATED_ABSOLUTE &&
         reminder.offset &&
         reminder.action == defaultAlarmType) {
         // Exactly one reminder thats not absolute, we may be able to match up
         // popup items.
         let relation = (reminder.related == reminder.ALARM_RELATED_START ? "START" : "END");
         let origin;
 
         // If the time duration for offset is 0, means the reminder is '0 minutes before'
@@ -532,17 +532,17 @@ function updateLink() {
         } catch (e) {
             // No protocol handler for the given protocol, or invalid uri
             hideOrShow(false);
             return;
         }
 
         // Only show if its either an internal protcol handler, or its external
         // and there is an external app for the scheme
-        handler = cal.wrapInstance(handler, Components.interfaces.nsIExternalProtocolHandler);
+        handler = cal.wrapInstance(handler, Ci.nsIExternalProtocolHandler);
         hideOrShow(!handler || handler.externalAppExistsForScheme(uri.scheme));
 
         setTimeout(() => {
             // HACK the url-link doesn't crop when setting the value in onLoad
             setElementValue("url-link", itemUrlString);
             setElementValue("url-link", itemUrlString, "href");
         }, 0);
     }
@@ -702,17 +702,17 @@ function determineAttendeesInRow() {
  *
  * @param {calIEvent|calIToDo} aItem      Item to apply the change on
  */
 function adaptScheduleAgent(aItem) {
     if (aItem.calendar && aItem.calendar.type == "caldav" &&
         aItem.calendar.getProperty("capabilities.autoschedule.supported")) {
         let identity = aItem.calendar.getProperty("imip.identity");
         let orgEmail = identity &&
-                       identity.QueryInterface(Components.interfaces.nsIMsgIdentity).email;
+                       identity.QueryInterface(Ci.nsIMsgIdentity).email;
         let organizerAction = aItem.organizer && orgEmail &&
                               aItem.organizer.id == "mailto:" + orgEmail;
         if (aItem.calendar.getProperty("forceEmailScheduling")) {
             cal.LOG("Enforcing clientside email based scheduling.");
             // for attendees, we change schedule-agent only in case of an
             // organizer triggered action
             if (organizerAction) {
                 aItem.getAttendees({}).forEach((aAttendee) => {
--- a/calendar/base/content/dialogs/calendar-error-prompt.xul
+++ b/calendar/base/content/dialogs/calendar-error-prompt.xul
@@ -19,17 +19,17 @@
         onload="loadErrorPrompt()"
         persist="screenX screenY"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="500"
         xmlns:nc="http://home.netscape.com/NC-rdf#">
 
     <script type="application/javascript"><![CDATA[
         function loadErrorPrompt() {
-            var args = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
+            var args = window.arguments[0].QueryInterface(Ci.nsIDialogParamBlock);
             document.getElementById("general-text").value = args.GetString(0);
             document.getElementById("error-code").value = args.GetString(1);
             document.getElementById("error-description").value = args.GetString(2);
             this.sizeToContent();
         }
         function toggleDetails() {
             var grid = document.getElementById("details-grid");
             if (grid.collapsed)
--- a/calendar/base/content/dialogs/calendar-event-dialog-attendees.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog-attendees.js
@@ -600,17 +600,17 @@ function onChangeCalendar(calendar) {
     // set 'mIsReadOnly' if the calendar is read-only
     if (calendar && calendar.readOnly) {
         gIsReadOnly = true;
     }
 
     // assume we're the organizer [in case that the calendar
     // does not support the concept of identities].
     gIsInvitation = false;
-    calendar = cal.wrapInstance(args.item.calendar, Components.interfaces.calISchedulingSupport);
+    calendar = cal.wrapInstance(args.item.calendar, Ci.calISchedulingSupport);
     if (calendar) {
         gIsInvitation = calendar.isInvitation(args.item);
     }
 
     if (gIsReadOnly || gIsInvitation) {
         document.getElementById("next-slot")
             .setAttribute("disabled", "true");
         document.getElementById("previous-slot")
--- a/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
+++ b/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
@@ -56,17 +56,17 @@
             this.mIsReadOnly = calendar.readOnly;
 
             // assume we're the organizer [in case that the calendar
             // does not support the concept of identities].
             let organizerID = ((organizer && organizer.id)
                                ? organizer.id
                                : calendar.getProperty("organizerId"));
 
-            calendar = cal.wrapInstance(calendar, Components.interfaces.calISchedulingSupport);
+            calendar = cal.wrapInstance(calendar, Ci.calISchedulingSupport);
             this.mIsInvitation = (calendar && calendar.isInvitation(args.item));
 
             let template = this.querySelector(".addressingWidgetItem");
             template.focus();
 
             if (this.mIsReadOnly || this.mIsInvitation) {
                 this.setAttribute("disabled", "true");
             }
@@ -390,27 +390,27 @@
         <parameter name="entryname"/>
         <body><![CDATA[
             let allAddressBooks = MailServices.ab.directories;
 
             while (allAddressBooks.hasMoreElements()) {
                 let abDir = null;
                 try {
                     abDir = allAddressBooks.getNext()
-                                           .QueryInterface(Components.interfaces.nsIAbDirectory);
+                                           .QueryInterface(Ci.nsIAbDirectory);
                 } catch (ex) {
                     cal.WARN("[eventDialog] Error Encountered" + ex);
                 }
 
                 if (abDir != null && abDir.supportsMailingLists) {
                     let childNodes = abDir.childNodes;
                     while (childNodes.hasMoreElements()) {
                         let dir = null;
                         try {
-                            dir = childNodes.getNext().QueryInterface(Components.interfaces.nsIAbDirectory);
+                            dir = childNodes.getNext().QueryInterface(Ci.nsIAbDirectory);
                         } catch (ex) {
                             cal.WARN("[eventDialog] Error Encountered" + ex);
                         }
 
                         if (dir && dir.isMailList && (dir.dirName == entryname)) {
                             return dir;
                         }
                     }
@@ -422,17 +422,17 @@
 
       <method name="_getListEntriesInt">
         <parameter name="mailingList"/>
         <parameter name="attendees"/>
         <parameter name="allListsUri"/>
         <body><![CDATA[
             let addressLists = mailingList.addressLists;
             for (let i = 0; i < addressLists.length; i++) {
-                let abCard = addressLists.queryElementAt(i, Components.interfaces.nsIAbCard);
+                let abCard = addressLists.queryElementAt(i, Ci.nsIAbCard);
                 let thisId = abCard.primaryEmail;
                 if (abCard.displayName.length > 0) {
                     let rCn = abCard.displayName;
                     if (rCn.includes(",")) {
                         rCn = '"' + rCn + '"';
                     }
                     thisId = rCn + " <" + thisId + ">";
                 }
--- a/calendar/base/content/dialogs/calendar-event-dialog-freebusy.xml
+++ b/calendar/base/content/dialogs/calendar-event-dialog-freebusy.xml
@@ -159,21 +159,18 @@
       <property name="date">
         <setter><![CDATA[
             let date = val.clone();
             date.hour = 0;
             date.minute = 0;
             date.isDate = false;
 
             if (!this.mDateFormatter) {
-                this.mDateFormatter =
-                    Components.classes[
-                        "@mozilla.org/calendar/datetime-formatter;1"]
-                            .getService(
-                                Components.interfaces.calIDateTimeFormatter);
+                this.mDateFormatter = Cc["@mozilla.org/calendar/datetime-formatter;1"]
+                                        .getService(Ci.calIDateTimeFormatter);
             }
 
             // First set the formatted date string as title
             let day =
                 document.getAnonymousElementByAttribute(
                     this, "anonid", "day");
             let dateValue = this.mZoomFactor > 100 ? this.mDateFormatter.formatDateShort(date)
                                                    : this.mDateFormatter.formatDateLong(date);
@@ -620,24 +617,22 @@
           this.onLoad();
       ]]></constructor>
 
       <method name="onLoad">
         <body><![CDATA[
             let numHours = this.mEndHour - this.mStartHour;
             this.mState = new Array(this.mRange * numHours);
             for (let i = 0; i < this.mState.length; i++) {
-                this.mState[i] = Components.interfaces.calIFreeBusyInterval.UNKNOWN;
+                this.mState[i] = Ci.calIFreeBusyInterval.UNKNOWN;
             }
 
             let step_in_minutes = Math.floor(60 * this.mZoomFactor / 100);
-            let formatter = Components.classes[
-                "@mozilla.org/calendar/datetime-formatter;1"]
-                    .getService(
-                        Components.interfaces.calIDateTimeFormatter);
+            let formatter = Cc["@mozilla.org/calendar/datetime-formatter;1"]
+                              .getService(Ci.calIDateTimeFormatter);
             let date = cal.dtz.jsDateToDateTime(new Date());
             date.hour = this.mStartHour;
             date.minute = 0;
             let hours =
                 document.getAnonymousElementByAttribute(
                     this, "anonid", "hours");
             if (hours.childNodes.length <= 0) {
                 let template = createXULElement("text");
@@ -695,17 +690,17 @@
                 start.second = 0;
                 start.timezone = kDefaultTimezone;
                 let end = start.clone();
                 end.day += this.mRange;
                 end.timezone = kDefaultTimezone;
 
                 // First of all set all state slots to 'free'
                 for (let i = 0; i < this.mState.length; i++) {
-                    this.mState[i] = Components.interfaces.calIFreeBusyInterval.FREE;
+                    this.mState[i] = Ci.calIFreeBusyInterval.FREE;
                 }
 
                 // Iterate all incoming freebusy entries
                 for (let entry of aEntries) {
                     let rangeStart = entry.interval.start.getInTimezone(kDefaultTimezone);
                     let rangeEnd = entry.interval.end.getInTimezone(kDefaultTimezone);
 
                     if (rangeStart.compare(start) < 0) {
@@ -790,42 +785,42 @@
                         for (let i = start_offset; i <= end_offset; i++) {
                             this.mState[i] = entry.freeBusyType;
                         }
                     }
                 }
             } else {
                 // First of all set all state slots to 'unknown'
                 for (let i = 0; i < this.mState.length; i++) {
-                    this.mState[i] = Components.interfaces.calIFreeBusyInterval.UNKNOWN;
+                    this.mState[i] = Ci.calIFreeBusyInterval.UNKNOWN;
                 }
             }
 
             this.showState();
         ]]></body>
       </method>
 
       <method name="showState">
         <body><![CDATA[
             let hours =
                 document.getAnonymousElementByAttribute(
                     this, "anonid", "hours");
             for (let i = 0; i < hours.childNodes.length; i++) {
                 let hour = hours.childNodes[i];
                 switch (this.mState[i + this.mOffset]) {
-                    case Components.interfaces.calIFreeBusyInterval.FREE:
+                    case Ci.calIFreeBusyInterval.FREE:
                         hour.setAttribute("state", "free");
                         break;
-                    case Components.interfaces.calIFreeBusyInterval.BUSY:
+                    case Ci.calIFreeBusyInterval.BUSY:
                         hour.setAttribute("state", "busy");
                         break;
-                    case Components.interfaces.calIFreeBusyInterval.BUSY_TENTATIVE:
+                    case Ci.calIFreeBusyInterval.BUSY_TENTATIVE:
                         hour.setAttribute("state", "busy_tentative");
                         break;
-                    case Components.interfaces.calIFreeBusyInterval.BUSY_UNAVAILABLE:
+                    case Ci.calIFreeBusyInterval.BUSY_UNAVAILABLE:
                         hour.setAttribute("state", "busy_unavailable");
                         break;
                     default:
                         hour.removeAttribute("state");
                 }
             }
         ]]></body>
       </method>
@@ -1150,23 +1145,23 @@
                         end.day += this.mRange;
                         // Update with 'no data available' until response will be received
                         freebusy.onFreeBusy(null);
                         try {
                             let listener = new calFreeBusyListener(freebusy, this);
                             let request = fbService.getFreeBusyIntervals(calid,
                                                                          start,
                                                                          end,
-                                                                         Components.interfaces.calIFreeBusyInterval.BUSY_ALL,
+                                                                         Ci.calIFreeBusyInterval.BUSY_ALL,
                                                                          listener);
                             if (request && request.isPending) {
                                 this.mPendingRequests.push(request);
                             }
                         } catch (ex) {
-                            Components.utils.reportError(ex);
+                            Cu.reportError(ex);
                         }
                     }
                 }
             }
         ]]></body>
       </method>
 
       <method name="nextSlot">
--- a/calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog-recurrence.js
@@ -44,20 +44,20 @@ function onLoad() {
     if (recinfo) {
         // Split out rules and exceptions
         try {
             let rrules = splitRecurrenceRules(recinfo);
             let rules = rrules[0];
             // Deal with the rules
             if (rules.length > 0) {
                 // We only handle 1 rule currently
-                rule = cal.wrapInstance(rules[0], Components.interfaces.calIRecurrenceRule);
+                rule = cal.wrapInstance(rules[0], Ci.calIRecurrenceRule);
             }
         } catch (ex) {
-            Components.utils.reportError(ex);
+            Cu.reportError(ex);
         }
     }
     if (!rule) {
         rule = cal.createRecurrenceRule();
         rule.type = "DAILY";
         rule.interval = 1;
         rule.count = -1;
     }
@@ -737,17 +737,17 @@ function changeOrderForElements(aPropKey
     }
 
     try {
         localeOrder = cal.l10n.getString("calendar-event-dialog", aPropKey, aPropParams).split(" ");
     } catch (ex) {
         let msg = "The key " + aPropKey + " in calendar-event-dialog.prop" +
                   "erties has incorrect number of params. Expected " +
                   aPropParams.length + " params.";
-        Components.utils.reportError(msg + " " + ex);
+        Cu.reportError(msg + " " + ex);
         return;
     }
 
     // Add elements in the right order, removing them from their old parent
     for (let i = 0; i < aPropParams.length; i++) {
         let newEl = document.getElementById(localeOrder[i]);
         if (newEl) {
             parents[i].appendChild(newEl);
--- a/calendar/base/content/dialogs/calendar-event-dialog-reminder.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog-reminder.js
@@ -258,17 +258,17 @@ function onReminderSelected() {
         try {
             suppressListUpdate = true;
             let reminder = listitem.reminder;
 
             // Action
             actionType.value = reminder.action;
 
             // Absolute/relative things
-            if (reminder.related == Components.interfaces.calIAlarm.ALARM_RELATED_ABSOLUTE) {
+            if (reminder.related == Ci.calIAlarm.ALARM_RELATED_ABSOLUTE) {
                 relationType.value = "absolute";
 
                 // Date
                 absDate.value = cal.dtz.dateTimeToJsDate(reminder.alarmDate || cal.dtz.getDefaultStartDate());
             } else {
                 relationType.value = "relative";
 
                 // Unit and length
@@ -284,19 +284,19 @@ function onReminderSelected() {
                     length.value = alarmlen;
                 }
 
                 // Relation
                 let relation = (reminder.offset.isNegative ? "before" : "after");
 
                 // Origin
                 let origin;
-                if (reminder.related == Components.interfaces.calIAlarm.ALARM_RELATED_START) {
+                if (reminder.related == Ci.calIAlarm.ALARM_RELATED_START) {
                     origin = "START";
-                } else if (reminder.related == Components.interfaces.calIAlarm.ALARM_RELATED_END) {
+                } else if (reminder.related == Ci.calIAlarm.ALARM_RELATED_END) {
                     origin = "END";
                 }
 
                 relationOrigin.value = [relation, origin].join("-");
             }
         } finally {
             suppressListUpdate = false;
         }
@@ -338,29 +338,29 @@ function updateReminder(event) {
     let absDate = document.getElementById("reminder-absolute-date");
     let action = document.getElementById("reminder-actions-menulist").selectedItem.value;
 
     // Action
     reminder.action = action;
 
     if (relationItem.value == "relative") {
         if (origin == "START") {
-            reminder.related = Components.interfaces.calIAlarm.ALARM_RELATED_START;
+            reminder.related = Ci.calIAlarm.ALARM_RELATED_START;
         } else if (origin == "END") {
-            reminder.related = Components.interfaces.calIAlarm.ALARM_RELATED_END;
+            reminder.related = Ci.calIAlarm.ALARM_RELATED_END;
         }
 
         // Set up offset, taking units and before/after into account
         let offset = cal.createDuration();
         offset[unit.value] = length.value;
         offset.normalize();
         offset.isNegative = (relation == "before");
         reminder.offset = offset;
     } else if (relationItem.value == "absolute") {
-        reminder.related = Components.interfaces.calIAlarm.ALARM_RELATED_ABSOLUTE;
+        reminder.related = Ci.calIAlarm.ALARM_RELATED_ABSOLUTE;
 
         if (absDate.value) {
             reminder.alarmDate = cal.dtz.jsDateToDateTime(absDate.value,
                                                       window.arguments[0].timezone);
         } else {
             reminder.alarmDate = null;
         }
     }
--- a/calendar/base/content/dialogs/calendar-invitations-list.xml
+++ b/calendar/base/content/dialogs/calendar-invitations-list.xml
@@ -201,17 +201,17 @@
             return (att ? att.participationStatus : null);
         ]]></body>
       </method>
 
       <method name="setCalendarItemParticipationStatus">
         <parameter name="aItem"/>
         <parameter name="aStatus"/>
         <body><![CDATA[
-            let calendar = cal.wrapInstance(aItem.calendar, Components.interfaces.calISchedulingSupport);
+            let calendar = cal.wrapInstance(aItem.calendar, Ci.calISchedulingSupport);
             if (calendar) {
                 let att = calendar.getInvitedAttendee(aItem);
                 if (att) {
                     let att_ = att.clone();
                     att_.participationStatus = aStatus;
 
                     // Update attendee
                     aItem.removeAttendee(att);
--- a/calendar/base/content/dialogs/calendar-migration-dialog.js
+++ b/calendar/base/content/dialogs/calendar-migration-dialog.js
@@ -258,17 +258,17 @@ var gDataMigrator = {
             migLOG("nodes: " + nodes.length);
             for (let i = 0; i < nodes.length; i++) {
                 migLOG("Beginning calendar node");
                 let calendar;
                 let node = nodes[i];
                 if (getRDFAttr(node, "remote") == "false") {
                     migLOG("not remote");
                     let localFile = Cc["@mozilla.org/file/local;1"]
-                                    .createInstance(Ci.nsIFile);
+                                      .createInstance(Ci.nsIFile);
                     localFile.initWithPath(getRDFAttr(node, "path"));
                     calendar = gDataMigrator.importICSToStorage(localFile);
                 } else {
                     // Remote subscription
                     // XXX check for duplicates
                     let url = Services.io.newURI(getRDFAttr(node, "remotePath"));
                     calendar = calManager.createCalendar("ics", url);
                 }
@@ -343,21 +343,21 @@ var gDataMigrator = {
                 let dataDir = dirs.getNext().QueryInterface(Ci.nsIFile);
                 let dataStore = dataDir.clone();
                 dataStore.append("corestorage.ics");
                 if (!dataStore.exists()) {
                     continue;
                 }
 
                 let fileStream = Cc["@mozilla.org/network/file-input-stream;1"]
-                                 .createInstance(Ci.nsIFileInputStream);
+                                   .createInstance(Ci.nsIFileInputStream);
 
                 fileStream.init(dataStore, 0x01, parseInt("0444", 8), {});
                 let convIStream = Cc["@mozilla.org/intl/converter-input-stream;1"]
-                                  .getService(Ci.nsIConverterInputStream);
+                                    .getService(Ci.nsIConverterInputStream);
                 convIStream.init(fileStream, "UTF-8", 0, 0x0000);
                 let tmpStr = {};
                 let str = "";
                 while (convIStream.readString(-1, tmpStr)) {
                     str += tmpStr.value;
                 }
 
                 // Strip out the timezone definitions, since it makes the file
@@ -374,20 +374,20 @@ var gDataMigrator = {
                     index = str.indexOf(";TZID=");
                 }
                 let tempFile = gDataMigrator.dirService.get("TmpD", Ci.nsIFile);
                 tempFile.append("icalTemp.ics");
                 tempFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE,
                                       parseInt("0600", 8));
 
                 let stream = Cc["@mozilla.org/network/file-output-stream;1"]
-                             .createInstance(Ci.nsIFileOutputStream);
+                               .createInstance(Ci.nsIFileOutputStream);
                 stream.init(tempFile, 0x2A, parseInt("0600", 8), 0);
                 let convOStream = Cc["@mozilla.org/intl/converter-output-stream;1"]
-                                 .createInstance(Ci.nsIConverterOutputStream);
+                                    .createInstance(Ci.nsIConverterOutputStream);
                 convOStream.init(stream, "UTF-8");
                 convOStream.writeString(str);
 
                 let calendar = gDataMigrator.importICSToStorage(tempFile);
                 calendar.name = "iCalendar"+i;
                 i++;
                 calManager.registerCalendar(calendar);
                 cal.view.getCompositeCalendar(window).addCalendar(calendar);
@@ -530,20 +530,20 @@ var gDataMigrator = {
      */
     importICSToStorage: function(icsFile) {
         const uri = "moz-storage-calendar://";
         let calendar = cal.getCalendarManager().createCalendar(
             "storage",
             Services.io.newURI(uri)
         );
         let icsImporter = Cc["@mozilla.org/calendar/import;1?type=ics"]
-                          .getService(Ci.calIImporter);
+                            .getService(Ci.calIImporter);
 
         let inputStream = Cc["@mozilla.org/network/file-input-stream;1"]
-                          .createInstance(Ci.nsIFileInputStream);
+                            .createInstance(Ci.nsIFileInputStream);
         let items = [];
 
         calendar.id = cal.getUUID();
 
         try {
             inputStream.init(icsFile, MODE_RDONLY, parseInt("0444", 8), {});
             items = icsImporter.importFromStream(inputStream, {});
         } catch (ex) {
--- a/calendar/base/content/dialogs/calendar-print-dialog.js
+++ b/calendar/base/content/dialogs/calendar-print-dialog.js
@@ -37,18 +37,17 @@ function loadCalendarPrintDialog() {
     document.getElementById(theView ? "printCurrentViewRadio" : "custom-range")
             .setAttribute("selected", true);
 
     // Get a list of formatters.
     // Walk the list, adding items to the layout menupopup.
     let layoutList = document.getElementById("layout-field");
     for (let { data } of Services.catMan.enumerateCategory("cal-print-formatters")) {
         let contractid = Services.catMan.getCategoryEntry("cal-print-formatters", data);
-        let formatter = Components.classes[contractid]
-                                  .getService(Components.interfaces.calIPrintFormatter);
+        let formatter = Cc[contractid].getService(Ci.calIPrintFormatter);
         // Use the contractid as value
         layoutList.appendItem(formatter.name, contractid);
     }
     layoutList.selectedIndex = 0;
 
     opener.setCursor("auto");
 
     eventsAndTasksOptions("tasks");
@@ -170,27 +169,27 @@ function getPrintSettings(receiverFunc) 
  * Sets up the filter for a getItems call based on the javascript settings
  * object
  *
  * @param settings      The settings data to base upon
  */
 function getFilter(settings) {
     let filter = 0;
     if (settings.printTasks) {
-        filter |= Components.interfaces.calICalendar.ITEM_FILTER_TYPE_TODO;
+        filter |= Ci.calICalendar.ITEM_FILTER_TYPE_TODO;
         if (settings.printCompletedTasks) {
-            filter |= Components.interfaces.calICalendar.ITEM_FILTER_COMPLETED_ALL;
+            filter |= Ci.calICalendar.ITEM_FILTER_COMPLETED_ALL;
         } else {
-            filter |= Components.interfaces.calICalendar.ITEM_FILTER_COMPLETED_NO;
+            filter |= Ci.calICalendar.ITEM_FILTER_COMPLETED_NO;
         }
     }
 
     if (settings.printEvents) {
-        filter |= Components.interfaces.calICalendar.ITEM_FILTER_TYPE_EVENT |
-                  Components.interfaces.calICalendar.ITEM_FILTER_CLASS_OCCURRENCES;
+        filter |= Ci.calICalendar.ITEM_FILTER_TYPE_EVENT |
+                  Ci.calICalendar.ITEM_FILTER_CLASS_OCCURRENCES;
     }
     return filter;
 }
 
 /**
  * Looks at the selections the user has made (start date, layout, etc.), and
  * updates the HTML in the iframe accordingly. This is also called when a
  * dialog UI element has changed, since we'll want to refresh the preview.
@@ -221,17 +220,17 @@ function refreshHtml(finishFunc) {
                 let portion = {};
                 while (convStream.readString(-1, portion)) {
                     printContent += portion.value;
                 }
             } finally {
                 convStream.close();
             }
         } catch (e) {
-            Components.utils.reportError("Calendar print dialog:refreshHtml: " + e);
+            Cu.reportError("Calendar print dialog:refreshHtml: " + e);
         }
 
         printContent = "data:text/html," + encodeURIComponent(printContent);
         document.getElementById("content").src = printContent;
 
         if (finishFunc) {
             finishFunc();
         }
--- a/calendar/base/content/dialogs/calendar-subscriptions-dialog.js
+++ b/calendar/base/content/dialogs/calendar-subscriptions-dialog.js
@@ -9,17 +9,17 @@
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 
 /**
  * Cancels any pending search operations.
  */
 var gCurrentSearchOperation = null;
 function cancelPendingSearchOperation() {
     if (gCurrentSearchOperation && gCurrentSearchOperation.isPending) {
-        gCurrentSearchOperation.cancel(Components.interfaces.calIErrors.OPERATION_CANCELLED);
+        gCurrentSearchOperation.cancel(Ci.calIErrors.OPERATION_CANCELLED);
     }
     gCurrentSearchOperation = null;
 }
 
 /**
  * Sets up the subscriptions dialog.
  */
 function onLoad() {
--- a/calendar/base/content/dialogs/calendar-summary-dialog.js
+++ b/calendar/base/content/dialogs/calendar-summary-dialog.js
@@ -475,13 +475,13 @@ function openAttachment(aAttachmentId) {
     if (!aAttachmentId) {
         return;
     }
     let args = window.arguments[0];
     let item = args.calendarEvent;
     let attachments = item.getAttachments({})
                           .filter(aAttachment => aAttachment.hashId == aAttachmentId);
     if (attachments.length && attachments[0].uri && attachments[0].uri.spec != "about:blank") {
-        let externalLoader = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
-                             .getService(Ci.nsIExternalProtocolService);
-        externalLoader.loadURI(attachments[0].uri);
+        Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+          .getService(Ci.nsIExternalProtocolService)
+          .loadURI(attachments[0].uri);
     }
 }
--- a/calendar/base/content/dialogs/chooseCalendarDialog.js
+++ b/calendar/base/content/dialogs/chooseCalendarDialog.js
@@ -1,18 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* exported loadCalendars, doOK, doExtra1 */
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 
 function loadCalendars() {
-    const calendarManager = Components.classes["@mozilla.org/calendar/manager;1"]
-                                    .getService(Components.interfaces.calICalendarManager);
+    const calendarManager = Cc["@mozilla.org/calendar/manager;1"]
+                              .getService(Ci.calICalendarManager);
     let listbox = document.getElementById("calendar-list");
     let composite = cal.view.getCompositeCalendar(window.opener);
     let selectedIndex = 0;
     let calendars;
 
     if (window.arguments[0].calendars) {
         calendars = window.arguments[0].calendars;
     } else {
--- a/calendar/base/content/import-export.js
+++ b/calendar/base/content/import-export.js
@@ -14,35 +14,31 @@ var MODE_TRUNCATE = 0x20;
 
 /**
  * Shows a file dialog, reads the selected file(s) and tries to parse events from it.
  *
  * @param aCalendar  (optional) If specified, the items will be imported directly
  *                              into the calendar
  */
 function loadEventsFromFile(aCalendar) {
-    const nsIFilePicker = Components.interfaces.nsIFilePicker;
-
-    let picker = Components.classes["@mozilla.org/filepicker;1"]
-                           .createInstance(nsIFilePicker);
+    let picker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     picker.init(window,
                 cal.l10n.getCalString("filepickerTitleImport"),
-                nsIFilePicker.modeOpen);
+                Ci.nsIFilePicker.modeOpen);
     picker.defaultExtension = "ics";
 
     // Get a list of importers
     let contractids = [];
     let currentListLength = 0;
     let defaultCIDIndex = 0;
     for (let { data } of Services.catMan.enumerateCategory("cal-importers")) {
         let contractid = Services.catMan.getCategoryEntry("cal-importers", data);
         let importer;
         try {
-            importer = Components.classes[contractid]
-                                 .getService(Components.interfaces.calIImporter);
+            importer = Cc[contractid].getService(Ci.calIImporter);
         } catch (e) {
             cal.WARN("Could not initialize importer: " + contractid + "\nError: " + e);
             continue;
         }
         let types = importer.getFileTypes({});
         for (let type of types) {
             picker.appendFilter(type.description, type.extensionFilter);
             if (type.extensionFilter == "*." + picker.defaultExtension) {
@@ -50,44 +46,41 @@ function loadEventsFromFile(aCalendar) {
                 defaultCIDIndex = currentListLength;
             }
             contractids.push(contractid);
             currentListLength++;
         }
     }
 
     picker.open(rv => {
-        if (rv != nsIFilePicker.returnOK || !picker.file || !picker.file.path) {
+        if (rv != Ci.nsIFilePicker.returnOK || !picker.file || !picker.file.path) {
             return;
         }
 
         let filterIndex = picker.filterIndex;
         if (picker.filterIndex < 0 || picker.filterIndex > contractids.length) {
             // For some reason the wrong filter was selected, assume default extension
             filterIndex = defaultCIDIndex;
         }
 
         let filePath = picker.file.path;
-        let importer = Components.classes[contractids[filterIndex]]
-                                 .getService(Components.interfaces.calIImporter);
+        let importer = Cc[contractids[filterIndex]].getService(Ci.calIImporter);
 
-        const nsIFileInputStream = Components.interfaces.nsIFileInputStream;
-
-        let inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"]
-                                    .createInstance(nsIFileInputStream);
+        let inputStream = Cc["@mozilla.org/network/file-input-stream;1"]
+                            .createInstance(Ci.nsIFileInputStream);
         let items = [];
         let exception;
 
         try {
             inputStream.init(picker.file, MODE_RDONLY, parseInt("0444", 8), {});
             items = importer.importFromStream(inputStream, {});
         } catch (ex) {
             exception = ex;
             switch (ex.result) {
-                case Components.interfaces.calIErrors.INVALID_TIMEZONE:
+                case Ci.calIErrors.INVALID_TIMEZONE:
                     cal.showError(cal.l10n.getCalString("timezoneError", [filePath]), window);
                     break;
                 default:
                     cal.showError(cal.l10n.getCalString("unableToRead") + filePath + "\n" + ex, window);
             }
         } finally {
             inputStream.close();
         }
@@ -151,17 +144,17 @@ function putItemsIntoCal(destCal, aItems
     // (example of something very wrong: importing the same file twice.
     //  quite easy to trigger, so we really should do this)
     let lastError;
     let listener = {
         QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
         onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
             count++;
             if (!Components.isSuccessCode(aStatus)) {
-                if (aStatus == Components.interfaces.calIErrors.DUPLICATE_ID) {
+                if (aStatus == Ci.calIErrors.DUPLICATE_ID) {
                     duplicateCount++;
                 } else {
                     failedCount++;
                     lastError = aStatus;
                 }
             }
             // See if it is time to end the calendar's batch.
             if (count == aItems.length) {
@@ -188,17 +181,17 @@ function putItemsIntoCal(destCal, aItems
             destCal.addItem(item, listener);
         } catch (e) {
             failedCount++;
             lastError = e;
             // Call the listener's operationComplete, to increase the
             // counter and not miss failed items. Otherwise, endBatch might
             // never be called.
             listener.onOperationComplete(null, null, null, null, null);
-            Components.utils.reportError("Import error: " + e);
+            Cu.reportError("Import error: " + e);
         }
     }
 
     // End transmgr batch
     endBatchTransaction();
 }
 
 /**
@@ -209,24 +202,21 @@ function putItemsIntoCal(destCal, aItems
  * @param aDefaultFileName   (optional) Initial filename shown in SaveAs dialog.
  */
 function saveEventsToFile(calendarEventArray, aDefaultFileName) {
     if (!calendarEventArray || !calendarEventArray.length) {
         return;
     }
 
     // Show the 'Save As' dialog and ask for a filename to save to
-    const nsIFilePicker = Components.interfaces.nsIFilePicker;
-
-    let picker = Components.classes["@mozilla.org/filepicker;1"]
-                       .createInstance(nsIFilePicker);
+    let picker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
 
     picker.init(window,
                 cal.l10n.getCalString("filepickerTitleExport"),
-                nsIFilePicker.modeSave);
+                Ci.nsIFilePicker.modeSave);
 
     if (aDefaultFileName && aDefaultFileName.length && aDefaultFileName.length > 0) {
         picker.defaultString = aDefaultFileName;
     } else if (calendarEventArray.length == 1 && calendarEventArray[0].title) {
         picker.defaultString = calendarEventArray[0].title;
     } else {
         picker.defaultString = cal.l10n.getCalString("defaultFileName");
     }
@@ -236,18 +226,17 @@ function saveEventsToFile(calendarEventA
     // Get a list of exporters
     let contractids = [];
     let currentListLength = 0;
     let defaultCIDIndex = 0;
     for (let { data } of Services.catMan.enumerateCategory("cal-exporters")) {
         let contractid = Services.catMan.getCategoryEntry("cal-exporters", data);
         let exporter;
         try {
-            exporter = Components.classes[contractid]
-                                 .getService(Components.interfaces.calIExporter);
+            exporter = Cc[contractid].getService(Ci.calIExporter);
         } catch (e) {
             cal.WARN("Could not initialize exporter: " + contractid + "\nError: " + e);
             continue;
         }
         let types = exporter.getFileTypes({});
         for (let type of types) {
             picker.appendFilter(type.description, type.extensionFilter);
             if (type.extensionFilter == "*." + picker.defaultExtension) {
@@ -256,44 +245,42 @@ function saveEventsToFile(calendarEventA
             }
             contractids.push(contractid);
             currentListLength++;
         }
     }
 
     // Now find out as what to save, convert the events and save to file.
     picker.open(rv => {
-        if (rv == nsIFilePicker.returnCancel || !picker.file || !picker.file.path) {
+        if (rv == Ci.nsIFilePicker.returnCancel || !picker.file || !picker.file.path) {
             return;
         }
 
         let filterIndex = picker.filterIndex;
         if (picker.filterIndex < 0 || picker.filterIndex > contractids.length) {
             // For some reason the wrong filter was selected, assume default extension
             filterIndex = defaultCIDIndex;
         }
 
-        let exporter = Components.classes[contractids[filterIndex]]
-                                 .getService(Components.interfaces.calIExporter);
+        let exporter = Cc[contractids[filterIndex]].getService(Ci.calIExporter);
 
         let filePath = picker.file.path;
         if (!filePath.includes(".")) {
             filePath += "." + exporter.getFileTypes({})[0].defaultExtension;
         }
 
-        const nsIFile = Components.interfaces.nsIFile;
-        const nsIFileOutputStream = Components.interfaces.nsIFileOutputStream;
+        const nsIFile = Ci.nsIFile;
+        const nsIFileOutputStream = Ci.nsIFileOutputStream;
 
         let outputStream;
-        let localFileInstance = Components.classes["@mozilla.org/file/local;1"]
-                                          .createInstance(nsIFile);
+        let localFileInstance = Cc["@mozilla.org/file/local;1"].createInstance(nsIFile);
         localFileInstance.initWithPath(filePath);
 
-        outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
-                                 .createInstance(nsIFileOutputStream);
+        outputStream = Cc["@mozilla.org/network/file-output-stream;1"]
+                         .createInstance(nsIFileOutputStream);
         try {
             outputStream.init(localFileInstance,
                               MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE,
                               parseInt("0664", 8),
                               0);
 
             // XXX Do the right thing with unicode and stuff. Or, again, should the
             //     exporter handle that?
@@ -324,17 +311,17 @@ function exportEntireCalendar(aCalendar)
         onGetResult: function(aOpCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
             for (let item of aItems) {
                 itemArray.push(item);
             }
         }
     };
 
     let getItemsFromCal = function(aCal) {
-        aCal.getItems(Components.interfaces.calICalendar.ITEM_FILTER_ALL_ITEMS,
+        aCal.getItems(Ci.calICalendar.ITEM_FILTER_ALL_ITEMS,
                       0, null, null, getListener);
     };
 
     if (aCalendar) {
         getItemsFromCal(aCalendar);
     } else {
         let count = {};
         let calendars = cal.getCalendarManager().getCalendars(count);
--- a/calendar/base/content/preferences/alarms.js
+++ b/calendar/base/content/preferences/alarms.js
@@ -30,17 +30,17 @@ var gAlarmsPane = {
      * @param aFileURL    A string with a file:// url.
      * @return            The corresponding nsIFile.
      */
     convertURLToLocalFile: function(aFileURL) {
         // Convert the file url into a nsIFile
         if (aFileURL) {
             let fph = Services.io
                          .getProtocolHandler("file")
-                         .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+                         .QueryInterface(Ci.nsIFileProtocolHandler);
             return fph.getFileFromURLSpec(aFileURL);
         } else {
             return null;
         }
     },
 
     /**
      * Handler function to be called when the calendar.alarms.soundURL pref has
@@ -67,46 +67,43 @@ var gAlarmsPane = {
         document.getElementById("alarmSoundCheckbox").checked = true;
         this.readSoundLocation();
     },
 
     /**
      * Opens a filepicker to open a local sound for the alarm.
      */
     browseAlarm: function() {
-        const nsIFilePicker = Components.interfaces.nsIFilePicker;
-        let picker = Components.classes["@mozilla.org/filepicker;1"]
-                               .createInstance(nsIFilePicker);
+        let picker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
 
         let bundlePreferences = document.getElementById("bundleCalendarPreferences");
         let title = bundlePreferences.getString("Open");
         let wildmat = "*.wav";
         let label = bundlePreferences.getFormattedString("filterWav", [wildmat], 1);
 
-        picker.init(window, title, nsIFilePicker.modeOpen);
+        picker.init(window, title, Ci.nsIFilePicker.modeOpen);
         picker.appendFilter(label, wildmat);
-        picker.appendFilters(nsIFilePicker.filterAll);
+        picker.appendFilters(Ci.nsIFilePicker.filterAll);
 
         picker.open(rv => {
-            if (rv != nsIFilePicker.returnOK || !picker.file) {
+            if (rv != Ci.nsIFilePicker.returnOK || !picker.file) {
                 return;
             }
             document.getElementById("calendar.alarms.soundURL").value = picker.fileURL.spec;
             document.getElementById("alarmSoundCheckbox").checked = true;
             this.readSoundLocation();
         });
     },
 
     /**
      * Plays the alarm sound currently selected.
      */
     previewAlarm: function() {
         let soundUrl = document.getElementById("alarmSoundFileField").value;
-        let soundIfc = Components.classes["@mozilla.org/sound;1"]
-                                 .createInstance(Components.interfaces.nsISound);
+        let soundIfc = Cc["@mozilla.org/sound;1"].createInstance(Ci.nsISound);
         let url;
         try {
             soundIfc.init();
             if (soundUrl && soundUrl.length && soundUrl.length > 0) {
                 url = Services.io.newURI(soundUrl);
                 soundIfc.play(url);
             } else {
                 soundIfc.beep();
--- a/calendar/base/content/preferences/general.js
+++ b/calendar/base/content/preferences/general.js
@@ -10,18 +10,18 @@ var { cal } = ChromeUtils.import("resour
  * Global Object to hold methods for the general pref pane
  */
 var gCalendarGeneralPane = {
     /**
      * Initialize the general pref pane. Sets up dialog controls to match the
      * values set in prefs.
      */
     init: function() {
-        let formatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
-                                  .getService(Components.interfaces.calIDateTimeFormatter);
+        let formatter = Cc["@mozilla.org/calendar/datetime-formatter;1"]
+                          .getService(Ci.calIDateTimeFormatter);
 
         let dateFormattedLong = formatter.formatDateLong(cal.dtz.now());
         let dateFormattedShort = formatter.formatDateShort(cal.dtz.now());
 
         // menu items include examples of current date formats.
         document.getElementById("dateformat-long-menuitem")
                 .setAttribute("label", labelLong + ": " + dateFormattedLong);
         document.getElementById("dateformat-short-menuitem")
--- a/calendar/base/content/widgets/calendar-alarm-widget.xml
+++ b/calendar/base/content/widgets/calendar-alarm-widget.xml
@@ -87,17 +87,17 @@
                         "alarmStarts",
                         [formatter.formatDateTime(startDate)]
                     );
                 } else {
                     // If the task has no start date, then format the alarm date.
                     dateLabel.textContent = formatter.formatDateTime(this.mAlarm.alarmDate);
                 }
             } else {
-                throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+                throw Cr.NS_ERROR_ILLEGAL_VALUE;
             }
 
             // Relative date
             this.updateRelativeDateLabel();
 
             // Title, location
             titleLabel.textContent = this.mItem.title || "";
             locationDescription.textContent = this.mItem.getProperty("LOCATION") || "";
--- a/calendar/base/content/widgets/calendar-list-tree.xml
+++ b/calendar/base/content/widgets/calendar-list-tree.xml
@@ -28,17 +28,17 @@
       ]]></destructor>
 
       <field name="mAddingFromComposite">false</field>
 
       <property name="compositeCalendar">
         <getter><![CDATA[
             if (!this.mCompositeCalendar) {
                 throw Components.Exception("Calendar list has no composite calendar yet",
-                                           Components.results.NS_ERROR_NOT_INITIALIZED);
+                                           Cr.NS_ERROR_NOT_INITIALIZED);
             }
             return this.mCompositeCalendar;
         ]]></getter>
         <setter><![CDATA[
             this.mCompositeCalendar = val;
             this.mCompositeCalendar.addObserver(this.compositeObserver);
 
             // Now that we have a composite calendar, we can get all calendars
@@ -55,17 +55,17 @@
       <property name="calendars">
         <getter><![CDATA[
             return this.mCalendarList;
         ]]></getter>
         <setter><![CDATA[
             // Setting calendars externally is not wanted. This is done internally
             // in the compositeCalendar setter.
             throw Components.Exception("Seting calendars on type='full' is not supported",
-                                       Components.results.NS_ERROR_NOT_IMPLEMENTED);
+                                       Cr.NS_ERROR_NOT_IMPLEMENTED);
         ]]></setter>
       </property>
 
       <field name="calMgrObserver"><![CDATA[
         ({
             listTree: this,
             QueryInterface: ChromeUtils.generateQI([Ci.calICalendarManagerObserver]),
 
@@ -356,27 +356,26 @@
                 this.treebox.endUpdateBatch();
             }
         ]]></setter>
       </property>
 
       <property name="compositeCalendar">
         <getter><![CDATA[
             if (!this.mCompositeCalendar) {
-                this.mCompositeCalendar =
-                    Components.classes["@mozilla.org/calendar/calendar;1?type=composite"]
-                              .createInstance(Components.interfaces.calICompositeCalendar);
+                this.mCompositeCalendar = Cc["@mozilla.org/calendar/calendar;1?type=composite"]
+                                            .createInstance(Ci.calICompositeCalendar);
             }
 
             return this.mCompositeCalendar;
         ]]></getter>
         <setter><![CDATA[
             if (this.mCompositeCalendar) {
                 throw Components.Exception("A composite calendar has already been set",
-                                           Components.results.NS_ERROR_ALREADY_INITIALIZED);
+                                           Cr.NS_ERROR_ALREADY_INITIALIZED);
             }
             this.mCompositeCalendar = val;
             this.mCompositeCalendar.addObserver(this.compositeObserver);
             return val;
         ]]></setter>
       </property>
 
       <property name="sortOrder"
@@ -814,17 +813,17 @@
             if (!this.allowDrag || !dataTransfer) {
                 // If dragging is not allowed or there is no data transfer then
                 // we can't drop (i.e dropping a file on the calendar list).
                 return false;
             }
 
             let dragCalId = dataTransfer.getData("application/x-moz-calendarID");
 
-            return (aOrientation != Components.interfaces.nsITreeView.DROP_ON &&
+            return (aOrientation != Ci.nsITreeView.DROP_ON &&
                     dragCalId != null);
         ]]></body>
       </method>
 
       <method name="drop">
         <parameter name="aRow"/>
         <parameter name="aOrientation"/>
         <body><![CDATA[
--- a/calendar/base/content/widgets/calendar-widgets.xml
+++ b/calendar/base/content/widgets/calendar-widgets.xml
@@ -438,18 +438,18 @@
       <handler event="drop"><![CDATA[
           let session = cal.getDragService().getCurrentSession();
           if (!session || !session.sourceNode || !session.sourceNode.sourceObject) {
               // No source node? Not our drag.
               return;
           }
           let item = session.sourceNode.sourceObject.clone();
           this.setAttribute("dropbox", "false");
-          let transfer = Components.classes["@mozilla.org/widget/transferable;1"]
-                                   .createInstance(Components.interfaces.nsITransferable);
+          let transfer = Cc["@mozilla.org/widget/transferable;1"]
+                           .createInstance(Ci.nsITransferable);
           transfer.init(null);
 
           if (cal.item.isEvent(item)) {
               transfer.addDataFlavor("application/x-moz-cal-event");
           } else {
               transfer.addDataFlavor("application/x-moz-cal-task");
           }
 
--- a/calendar/base/modules/calExtract.jsm
+++ b/calendar/base/modules/calExtract.jsm
@@ -137,20 +137,18 @@ Extractor.prototype = {
                 if (idx == -1) {
                     Preferences.set(pref, this.fallbackLocale + "," + lastUsedLangs);
                 } else {
                     langs.splice(idx, 1);
                     Preferences.set(pref, this.fallbackLocale + "," + langs.join(","));
                 }
             }
         } else {
-            let spellclass = "@mozilla.org/spellchecker/engine;1";
-            let mozISpellCheckingEngine = Components.interfaces.mozISpellCheckingEngine;
-            let spellchecker = Components.classes[spellclass]
-                                         .getService(mozISpellCheckingEngine);
+            let spellchecker = Cc["@mozilla.org/spellchecker/engine;1"]
+                                 .getService(Ci.mozISpellCheckingEngine);
 
             let arr = {};
             let cnt = {};
             spellchecker.getDictionaryList(arr, cnt);
             let dicts = arr.value;
 
             if (dicts.length == 0) {
                 cal.LOG("[calExtract] There are no dictionaries installed and " +
@@ -984,18 +982,17 @@ Extractor.prototype = {
                 cal.LOG("[calExtract] Pattern not found: " + name);
                 return this.defPattern;
             }
 
             let vals = this.cleanPatterns(value).split("|");
             for (let idx = vals.length - 1; idx >= 0; idx--) {
                 if (vals[idx].trim() == "") {
                     vals.splice(idx, 1);
-                    Components.utils.reportError("[calExtract] Faulty extraction pattern " +
-                                                 value + " for " + name);
+                    Cu.reportError("[calExtract] Faulty extraction pattern " + value + " for " + name);
                 }
             }
 
             if (this.overrides[name] !== undefined &&
                 this.overrides[name].add !== undefined) {
                 let additions = this.overrides[name].add;
                 additions = this.cleanPatterns(additions).split("|");
                 for (let pattern in additions) {
@@ -1037,18 +1034,17 @@ Extractor.prototype = {
                 cal.LOG("[calExtract] Pattern empty: " + name);
                 return alts;
             }
 
             let vals = this.cleanPatterns(value).split("|");
             for (let idx = vals.length - 1; idx >= 0; idx--) {
                 if (vals[idx].trim() == "") {
                     vals.splice(idx, 1);
-                    Components.utils.reportError("[calExtract] Faulty extraction pattern " +
-                                                 value + " for " + name);
+                    Cu.reportError("[calExtract] Faulty extraction pattern " + value + " for " + name);
                 }
             }
 
             if (this.overrides[name] !== undefined &&
                 this.overrides[name].add !== undefined) {
                 let additions = this.overrides[name].add;
                 additions = this.cleanPatterns(additions).split("|");
                 for (let pattern in additions) {
@@ -1102,18 +1098,17 @@ Extractor.prototype = {
         while ((match = re.exec(str))) {
             i++;
             positions[parseInt(match[1], 10)] = i;
         }
 
         // correctness checking
         for (i = 1; i <= count; i++) {
             if (positions[i] === undefined) {
-                Components.utils.reportError("[calExtract] Faulty extraction pattern " + name +
-                                             ", missing parameter #" + i);
+                Cu.reportError("[calExtract] Faulty extraction pattern " + name + ", missing parameter #" + i);
             }
         }
         return positions;
     },
 
     cleanPatterns: function(pattern) {
         // remove whitespace around | if present
         let value = pattern.replace(/\s*\|\s*/g, "|");
--- a/calendar/base/modules/calRecurrenceUtils.jsm
+++ b/calendar/base/modules/calRecurrenceUtils.jsm
@@ -52,17 +52,17 @@ function recurrenceRule2String(recurrenc
 
 
     // Retrieve a valid recurrence rule from the currently
     // set recurrence info. Bail out if there's more
     // than a single rule or something other than a rule.
     recurrenceInfo = recurrenceInfo.clone();
     let rrules = splitRecurrenceRules(recurrenceInfo);
     if (rrules[0].length == 1) {
-        let rule = cal.wrapInstance(rrules[0][0], Components.interfaces.calIRecurrenceRule);
+        let rule = cal.wrapInstance(rrules[0][0], Ci.calIRecurrenceRule);
         // Currently we allow only for BYDAY, BYMONTHDAY, BYMONTH rules.
         let byparts = [
             "BYSECOND", "BYMINUTE", /* "BYDAY", */ "BYHOUR", /* "BYMONTHDAY", */
             "BYYEARDAY", "BYWEEKNO", /* "BYMONTH", */ "BYSETPOS"
         ];
 
         if (rule && !checkRecurrenceRule(rule, byparts)) {
             let dateFormatter = cal.getDateFormatter();
--- a/calendar/base/modules/calUtils.jsm
+++ b/calendar/base/modules/calUtils.jsm
@@ -5,79 +5,79 @@
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm", null);
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 
 // Usually the backend loader gets loaded via profile-after-change, but in case
 // a calendar component hooks in earlier, its very likely it will use calUtils.
 // Getting the service here will load if its not already loaded
-Components.classes["@mozilla.org/calendar/backend-loader;1"].getService();
+Cc["@mozilla.org/calendar/backend-loader;1"].getService();
 
 // The calendar console instance
 var gCalendarConsole = new ConsoleAPI({
     prefix: "Lightning",
     consoleID: "calendar",
     maxLogLevel: Preferences.get("calendar.debug.log", false) ? "all" : "warn"
 });
 
 this.EXPORTED_SYMBOLS = ["cal"];
 var cal = {
     // These functions exist to reduce boilerplate code for creating instances
     // as well as getting services and other (cached) objects.
     createEvent: _instance("@mozilla.org/calendar/event;1",
-                           Components.interfaces.calIEvent,
+                           Ci.calIEvent,
                            "icalString"),
     createTodo: _instance("@mozilla.org/calendar/todo;1",
-                          Components.interfaces.calITodo,
+                          Ci.calITodo,
                           "icalString"),
     createDateTime: _instance("@mozilla.org/calendar/datetime;1",
-                              Components.interfaces.calIDateTime,
+                              Ci.calIDateTime,
                               "icalString"),
     createDuration: _instance("@mozilla.org/calendar/duration;1",
-                              Components.interfaces.calIDuration,
+                              Ci.calIDuration,
                               "icalString"),
     createAttendee: _instance("@mozilla.org/calendar/attendee;1",
-                              Components.interfaces.calIAttendee,
+                              Ci.calIAttendee,
                               "icalString"),
     createAttachment: _instance("@mozilla.org/calendar/attachment;1",
-                                Components.interfaces.calIAttachment,
+                                Ci.calIAttachment,
                                 "icalString"),
     createAlarm: _instance("@mozilla.org/calendar/alarm;1",
-                           Components.interfaces.calIAlarm,
+                           Ci.calIAlarm,
                            "icalString"),
     createRelation: _instance("@mozilla.org/calendar/relation;1",
-                              Components.interfaces.calIRelation,
+                              Ci.calIRelation,
                               "icalString"),
     createRecurrenceDate: _instance("@mozilla.org/calendar/recurrence-date;1",
-                                    Components.interfaces.calIRecurrenceDate,
+                                    Ci.calIRecurrenceDate,
                                     "icalString"),
     createRecurrenceRule: _instance("@mozilla.org/calendar/recurrence-rule;1",
-                                    Components.interfaces.calIRecurrenceRule,
+                                    Ci.calIRecurrenceRule,
                                     "icalString"),
     createRecurrenceInfo: _instance("@mozilla.org/calendar/recurrence-info;1",
-                                    Components.interfaces.calIRecurrenceInfo,
+                                    Ci.calIRecurrenceInfo,
                                     "item"),
 
     getCalendarManager: _service("@mozilla.org/calendar/manager;1",
-                                 Components.interfaces.calICalendarManager),
+                                 Ci.calICalendarManager),
     getIcsService: _service("@mozilla.org/calendar/ics-service;1",
-                            Components.interfaces.calIICSService),
+                            Ci.calIICSService),
     getTimezoneService: _service("@mozilla.org/calendar/timezone-service;1",
-                                 Components.interfaces.calITimezoneService),
+                                 Ci.calITimezoneService),
     getCalendarSearchService: _service("@mozilla.org/calendar/calendarsearch-service;1",
-                                       Components.interfaces.calICalendarSearchProvider),
+                                       Ci.calICalendarSearchProvider),
     getFreeBusyService: _service("@mozilla.org/calendar/freebusy-service;1",
-                                 Components.interfaces.calIFreeBusyService),
+                                 Ci.calIFreeBusyService),
     getWeekInfoService: _service("@mozilla.org/calendar/weekinfo-service;1",
-                                 Components.interfaces.calIWeekInfoService),
+                                 Ci.calIWeekInfoService),
     getDateFormatter: _service("@mozilla.org/calendar/datetime-formatter;1",
-                               Components.interfaces.calIDateTimeFormatter),
+                               Ci.calIDateTimeFormatter),
     getDragService: _service("@mozilla.org/widget/dragservice;1",
-                             Components.interfaces.nsIDragService),
+                             Ci.nsIDragService),
 
     /**
      * The calendar console instance
      */
     console: gCalendarConsole,
 
     /**
      * Logs a calendar message to the console. Needs calendar.debug.log enabled to show messages.
@@ -137,20 +137,20 @@ var cal = {
      */
     ASSERT: function(aCondition, aMessage, aCritical=false) {
         if (aCondition) {
             return;
         }
 
         let string = `Assert failed: ${aMessage}\n ${cal.STACK(0, 1)}`;
         if (aCritical) {
-            let rescode = aCritical === true ? Components.results.NS_ERROR_UNEXPECTED : aCritical;
+            let rescode = aCritical === true ? Cr.NS_ERROR_UNEXPECTED : aCritical;
             throw new Components.Exception(string, rescode);
         } else {
-            Components.utils.reportError(string);
+            Cu.reportError(string);
         }
     },
 
     /**
      * Generates a QueryInterface method on the given global. To be used as follows:
      *
      *     class calThing {
      *       QueryInterface(aIID) { return cal.generateClassQI(this, aIID, [Ci.calIThing]); }
@@ -238,17 +238,17 @@ var cal = {
     },
 
     /**
      * Schedules execution of the passed function to the current thread's queue.
      */
     postPone: function(func) {
         if (this.threadingEnabled) {
             Services.tm.currentThread.dispatch({ run: func },
-                                               Components.interfaces.nsIEventTarget.DISPATCH_NORMAL);
+                                               Ci.nsIEventTarget.DISPATCH_NORMAL);
         } else {
             func();
         }
     },
 
     /**
      * Create an adapter for the given interface. If passed, methods will be
      * added to the template object, otherwise a new object will be returned.
@@ -307,18 +307,17 @@ var cal = {
     },
 
     /**
      * Make a UUID, without enclosing brackets, e.g. 0d3950fd-22e5-4508-91ba-0489bdac513f
      *
      * @return {String}         The generated UUID
      */
     getUUID: function() {
-        let uuidGen = Components.classes["@mozilla.org/uuid-generator;1"]
-                                .getService(Components.interfaces.nsIUUIDGenerator);
+        let uuidGen = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
         // generate uuids without braces to avoid problems with
         // CalDAV servers that don't support filenames with {}
         return uuidGen.generateUUID().toString().replace(/[{}]/g, "");
     },
 
     /**
      * Adds an observer listening for the topic.
      *
@@ -446,33 +445,33 @@ XPCOMUtils.defineLazyModuleGetter(cal, "
  * Returns a function that provides access to the given service.
  *
  * @param cid           The contract id to create
  * @param iid           The interface id to create with
  * @return {function}   A function that returns the given service
  */
 function _service(cid, iid) {
     return function() {
-        return Components.classes[cid].getService(iid);
+        return Cc[cid].getService(iid);
     };
 }
 
 /**
  * Returns a function that creates an instance of the given component and
  * optionally initializes it using the property name passed.
  *
  * @param cid           The contract id to create
  * @param iid           The interface id to create with
  * @param prop          The property name used for initialization
  * @return {function}   A function that creates the given instance, which takes an
  *                          initialization value.
  */
 function _instance(cid, iid, prop) {
     return function(propval) {
-        let thing = Components.classes[cid].createInstance(iid);
+        let thing = Cc[cid].createInstance(iid);
         if (propval) {
             thing[prop] = propval;
         }
         return thing;
     };
 }
 
 // will be used to clean up global objects on shutdown
--- a/calendar/base/modules/utils/calAlarmUtils.jsm
+++ b/calendar/base/modules/utils/calAlarmUtils.jsm
@@ -38,17 +38,17 @@ var calalarms = {
 
             alarmOffset[units] = Preferences.get("calendar.alarms." + type + "alarmlen", 0);
             alarmOffset.normalize();
             alarmOffset.isNegative = true;
             if (type == "todo" && !aItem.entryDate) {
                 // You can't have an alarm if the entryDate doesn't exist.
                 aItem.entryDate = cal.dtz.now();
             }
-            alarm.related = Components.interfaces.calIAlarm.ALARM_RELATED_START;
+            alarm.related = Ci.calIAlarm.ALARM_RELATED_START;
             alarm.offset = alarmOffset;
 
             // Default to a display alarm, unless the calendar doesn't support
             // it or we have no calendar yet. (Man this is hard to wrap)
             let actionValues = (aItem.calendar &&
                                  aItem.calendar.getProperty("capabilities.alarms.actionValues")) ||
                                 ["DISPLAY"];
 
--- a/calendar/base/modules/utils/calAsyncUtils.jsm
+++ b/calendar/base/modules/utils/calAsyncUtils.jsm
@@ -8,18 +8,18 @@ ChromeUtils.import("resource://gre/modul
  * Asynchronous tools for handling calendar operations
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.async namespace.
 
 this.EXPORTED_SYMBOLS = ["calasync"]; /* exported calasync */
 
-var cIOL = Components.interfaces.calIOperationListener;
-var cIC = Components.interfaces.calICalendar;
+var cIOL = Ci.calIOperationListener;
+var cIC = Ci.calICalendar;
 
 var promisifyProxyHandler = {
     promiseOperation: function(target, name, args) {
         let deferred = PromiseUtils.defer();
         let listener = calasync.promiseOperationListener(deferred);
         args.push(listener);
         target[name](...args);
         return deferred.promise;
@@ -35,17 +35,17 @@ var promisifyProxyHandler = {
             case "getItems":
                 return (...args) => this.promiseOperation(target, name, args);
             // calIOfflineStorage methods
             case "addOfflineItem":
             case "modifyOfflineItem":
             case "deleteOfflineItem":
             case "getOfflineItemFlag":
             case "resetItemOfflineFlag": {
-                let offline = target.QueryInterface(Components.interfaces.calIOfflineStorage);
+                let offline = target.QueryInterface(Ci.calIOfflineStorage);
                 return (...args) => this.promiseOperation(offline, name, args);
             }
 
             // Special getAllItems shortcut
             case "getAllItems":
                 return () => this.promiseOperation(target, "getItems", [cIC.ITEM_FILTER_ALL_ITEMS, 0, null, null]);
             default:
                 return target[name];
@@ -103,17 +103,17 @@ var calasync = {
      *     let calendar = cal.async.promisifyCalendar(aItem.calendar);
      *     return calendar.addItem(aItem);
      *   }
      */
     promiseOperationListener: function(deferred) {
         return {
             QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
             items: [],
-            itemStatus: Components.results.NS_OK,
+            itemStatus: Cr.NS_OK,
             onGetResult: function(aCalendar, aStatus, aItemType, aDetail,
                                   aCount, aItems) {
                 this.itemStatus = aStatus;
                 if (Components.isSuccessCode(aStatus)) {
                     this.items = this.items.concat(aItems);
                 } else {
                     this.itemSuccess = aStatus;
                 }
--- a/calendar/base/modules/utils/calAuthUtils.jsm
+++ b/calendar/base/modules/utils/calAuthUtils.jsm
@@ -88,17 +88,17 @@ var calauth = {
         //                    in nsIAuthInformation authInfo)
         promptAuth(aChannel, aLevel, aAuthInfo) {
             let hostRealm = {};
             hostRealm.prePath = aChannel.URI.prePath;
             hostRealm.realm = aAuthInfo.realm;
             let port = aChannel.URI.port;
             if (port == -1) {
                 let handler = Services.io.getProtocolHandler(aChannel.URI.scheme)
-                                         .QueryInterface(Components.interfaces.nsIProtocolHandler);
+                                         .QueryInterface(Ci.nsIProtocolHandler);
                 port = handler.defaultPort;
             }
             hostRealm.passwordRealm = aChannel.URI.host + ":" + port + " (" + aAuthInfo.realm + ")";
 
             let pwInfo = this.getPasswordInfo(hostRealm);
             aAuthInfo.username = pwInfo.username;
             if (pwInfo && pwInfo.found) {
                 aAuthInfo.password = pwInfo.password;
@@ -161,18 +161,18 @@ var calauth = {
                     aCallback.onAuthCancelled(aContext, true);
                 }
             };
 
             let hostKey = aChannel.URI.prePath + ":" + aAuthInfo.realm;
             gAuthCache.planForAuthInfo(hostKey);
 
             let queuePrompt = function() {
-                let asyncprompter = Components.classes["@mozilla.org/messenger/msgAsyncPrompter;1"]
-                                              .getService(Components.interfaces.nsIMsgAsyncPrompter);
+                let asyncprompter = Cc["@mozilla.org/messenger/msgAsyncPrompter;1"]
+                                      .getService(Ci.nsIMsgAsyncPrompter);
                 asyncprompter.queueAsyncAuthPrompt(hostKey, false, promptlistener);
             };
 
             self.mWindow = cal.window.getCalendarWindow();
 
             // the prompt will fail if we are too early
             if (self.mWindow.document.readyState == "complete") {
                 queuePrompt();
@@ -194,17 +194,17 @@ var calauth = {
      * @param {Boolean} aFixedUsername          Whether the user name is fixed or editable
      * @return {Boolean}                        Could a password be retrieved?
      */
     getCredentials: function(aTitle, aCalendarName, aUsername, aPassword,
                              aSavePassword, aFixedUsername) {
         if (typeof aUsername != "object" ||
             typeof aPassword != "object" ||
             typeof aSavePassword != "object") {
-            throw new Components.Exception("", Components.results.NS_ERROR_XPC_NEED_OUT_OBJECT);
+            throw new Components.Exception("", Cr.NS_ERROR_XPC_NEED_OUT_OBJECT);
         }
 
         let prompter = Services.ww.getNewPrompter(null);
 
         // Only show the save password box if we are supposed to.
         let savepassword = null;
         if (Preferences.get("signon.rememberSignons", true)) {
             savepassword = cal.l10n.getAnyString("passwordmgr", "passwordmgr", "rememberPassword");
@@ -266,45 +266,45 @@ var calauth = {
         if (!Services.logins.getLoginSavingEnabled(origin)) {
             throw new Components.Exception("Password saving is disabled for " + origin,
                                            Cr.NS_ERROR_NOT_AVAILABLE);
         }
 
         try {
             let logins = Services.logins.findLogins({}, origin, null, aRealm);
 
-            let newLoginInfo = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
-                                         .createInstance(Components.interfaces.nsILoginInfo);
+            let newLoginInfo = Cc["@mozilla.org/login-manager/loginInfo;1"]
+                                 .createInstance(Ci.nsILoginInfo);
             newLoginInfo.init(origin, null, aRealm, aUsername, aPassword, "", "");
             if (logins.length > 0) {
                 Services.logins.modifyLogin(logins[0], newLoginInfo);
             } else {
                 Services.logins.addLogin(newLoginInfo);
             }
         } catch (exc) {
             // Only show the message if its not an abort, which can happen if
             // the user canceled the master password dialog
-            cal.ASSERT(exc.result == Components.results.NS_ERROR_ABORT, exc);
+            cal.ASSERT(exc.result == Cr.NS_ERROR_ABORT, exc);
         }
     },
 
     /**
      * Helper to retrieve an entry from the password manager.
      *
      * @param {String} aUsername    The username to search
      * @param {String} aPassword    The corresponding password
      * @param {String} aOrigin      The corresponding origin
      * @param {String} aRealm       The password realm (unused on branch)
      * @return {Boolean}            True, if an entry exists in the password manager
      */
     passwordManagerGet: function(aUsername, aPassword, aOrigin, aRealm) {
         cal.ASSERT(aUsername);
 
         if (typeof aPassword != "object") {
-            throw new Components.Exception("", Components.results.NS_ERROR_XPC_NEED_OUT_OBJECT);
+            throw new Components.Exception("", Cr.NS_ERROR_XPC_NEED_OUT_OBJECT);
         }
 
         let origin = this._ensureOrigin(aOrigin);
 
         try {
             let logins = Services.logins.findLogins({}, origin, null, aRealm);
             for (let loginInfo of logins) {
                 if (loginInfo.username == aUsername) {
--- a/calendar/base/modules/utils/calDataUtils.jsm
+++ b/calendar/base/modules/utils/calDataUtils.jsm
@@ -35,17 +35,17 @@ class ListenerSet extends Set {
 
     notify(func, args=[]) {
         let currentObservers = [...this.values()];
         for (let observer of currentObservers) {
             try {
                 observer[func](...args);
             } catch (exc) {
                 let stack = exc.stack || (exc.location ? exc.location.formattedStack : null);
-                Components.utils.reportError(exc + "\nSTACK: " + stack);
+                Cu.reportError(exc + "\nSTACK: " + stack);
             }
         }
     }
 }
 
 class ObserverSet extends ListenerSet {
     constructor(iid, iterable) {
         super(iid, iterable);
@@ -100,17 +100,17 @@ class OperationGroup {
     }
 
     constructor(aCancelFunc) {
         this.mId = cal.getUUID() + "-" + OperationGroup.nextGroupId();
         this.mIsPending = true;
 
         this.mCancelFunc = aCancelFunc;
         this.mSubOperations = [];
-        this.mStatus = Components.results.NS_OK;
+        this.mStatus = Cr.NS_OK;
     }
 
     get id() { return this.mId; }
     get isPending() { return this.mIsPending; }
     get status() { return this.mStatus; }
     get isEmpty() { return this.mSubOperations.length == 0; }
 
     add(aOperation) {
@@ -130,28 +130,28 @@ class OperationGroup {
         if (this.isPending) {
             this.mIsPending = false;
             if (aStatus) {
                 this.mStatus = aStatus;
             }
         }
     }
 
-    cancel(aStatus=Components.interfaces.calIErrors.OPERATION_CANCELLED) {
+    cancel(aStatus=Ci.calIErrors.OPERATION_CANCELLED) {
         if (this.isPending) {
             this.notifyCompleted(aStatus);
             let cancelFunc = this.mCancelFunc;
             if (cancelFunc) {
                 this.mCancelFunc = null;
                 cancelFunc();
             }
             let subOperations = this.mSubOperations;
             this.mSubOperations = [];
             for (let operation of subOperations) {
-                operation.cancel(Components.interfaces.calIErrors.OPERATION_CANCELLED);
+                operation.cancel(Ci.calIErrors.OPERATION_CANCELLED);
             }
         }
     }
 
     toString() {
         return `[OperationGroup id=${this.id}]`;
     }
 }
@@ -278,22 +278,22 @@ var caldata = {
     compareObjects: function(aObject, aOtherObject, aIID) {
         // xxx todo: seems to work fine e.g. for WCAP, but I still mistrust this trickery...
         //           Anybody knows an official API that could be used for this purpose?
         //           For what reason do clients need to pass aIID since
         //           every XPCOM object has to implement nsISupports?
         //           XPCOM (like COM, like UNO, ...) defines that QueryInterface *only* needs to return
         //           the very same pointer for nsISupports during its lifetime.
         if (!aIID) {
-            aIID = Components.interfaces.nsISupports;
+            aIID = Ci.nsISupports;
         }
-        let sip1 = Components.classes["@mozilla.org/supports-interface-pointer;1"]
-                             .createInstance(Components.interfaces.nsISupportsInterfacePointer);
+        let sip1 = Cc["@mozilla.org/supports-interface-pointer;1"]
+                     .createInstance(Ci.nsISupportsInterfacePointer);
         sip1.data = aObject;
         sip1.dataIID = aIID;
 
-        let sip2 = Components.classes["@mozilla.org/supports-interface-pointer;1"]
-                             .createInstance(Components.interfaces.nsISupportsInterfacePointer);
+        let sip2 = Cc["@mozilla.org/supports-interface-pointer;1"]
+                     .createInstance(Ci.nsISupportsInterfacePointer);
         sip2.data = aOtherObject;
         sip2.dataIID = aIID;
         return sip1.data == sip2.data;
     }
 };
--- a/calendar/base/modules/utils/calDateTimeUtils.jsm
+++ b/calendar/base/modules/utils/calDateTimeUtils.jsm
@@ -114,30 +114,30 @@ var caldtz = {
      * event's start date or a task's entry date.
      */
     startDateProp: function(aItem) {
         if (cal.item.isEvent(aItem)) {
             return "startDate";
         } else if (cal.item.isToDo(aItem)) {
             return "entryDate";
         }
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     },
 
     /**
      * Returns the property name used for the end date of an item, ie either an
      * event's end date or a task's due date.
      */
     endDateProp: function(aItem) {
         if (cal.item.isEvent(aItem)) {
             return "endDate";
         } else if (cal.item.isToDo(aItem)) {
             return "dueDate";
         }
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     },
 
     /**
      * Check if the two dates are on the same day (ignoring time)
      *
      * @param date1     The left date to compare
      * @param date2     The right date to compare
      * @return          True, if dates are on the same day
--- a/calendar/base/modules/utils/calEmailUtils.jsm
+++ b/calendar/base/modules/utils/calEmailUtils.jsm
@@ -23,46 +23,46 @@ var calemail = {
      * to create a recipient list string.
      *
      * @param {String} aRecipient       The email recipients string.
      * @param {String} aSubject         The email subject.
      * @param {String} aBody            The encoded email body text.
      * @param {nsIMsgIdentity} aIdentity    The email identity to use for sending
      */
     sendTo: function(aRecipient, aSubject, aBody, aIdentity) {
-        let msgParams = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
-                                  .createInstance(Components.interfaces.nsIMsgComposeParams);
-        let composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
-                                      .createInstance(Components.interfaces.nsIMsgCompFields);
+        let msgParams = Cc["@mozilla.org/messengercompose/composeparams;1"]
+                          .createInstance(Ci.nsIMsgComposeParams);
+        let composeFields = Cc["@mozilla.org/messengercompose/composefields;1"]
+                              .createInstance(Ci.nsIMsgCompFields);
 
         composeFields.to = aRecipient;
         composeFields.subject = aSubject;
         composeFields.body = aBody;
 
-        msgParams.type = Components.interfaces.nsIMsgCompType.New;
-        msgParams.format = Components.interfaces.nsIMsgCompFormat.Default;
+        msgParams.type = Ci.nsIMsgCompType.New;
+        msgParams.format = Ci.nsIMsgCompFormat.Default;
         msgParams.composeFields = composeFields;
         msgParams.identity = aIdentity;
 
         MailServices.compose.OpenComposeWindowWithParams(null, msgParams);
     },
 
     /**
      * Iterates all email identities and calls the passed function with identity and account.
      * If the called function returns false, iteration is stopped.
      *
      * @param {Function} aFunc       The function to be called for each identity and account
      */
     iterateIdentities: function(aFunc) {
         let accounts = MailServices.accounts.accounts;
         for (let i = 0; i < accounts.length; ++i) {
-            let account = accounts.queryElementAt(i, Components.interfaces.nsIMsgAccount);
+            let account = accounts.queryElementAt(i, Ci.nsIMsgAccount);
             let identities = account.identities;
             for (let j = 0; j < identities.length; ++j) {
-                let identity = identities.queryElementAt(j, Components.interfaces.nsIMsgIdentity);
+                let identity = identities.queryElementAt(j, Ci.nsIMsgIdentity);
                 if (!aFunc(identity, account)) {
                     break;
                 }
             }
         }
     },
 
     /**
@@ -134,18 +134,18 @@ var calemail = {
 
     /**
      * Returns a basically checked recipient list - malformed elements will be removed
      *
      * @param {String} aRecipients      A comma-seperated list of e-mail addresses
      * @return {String}                 A validated comma-seperated list of e-mail addresses
      */
     validateRecipientList: function(aRecipients) {
-        let compFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
-                                   .createInstance(Components.interfaces.nsIMsgCompFields);
+        let compFields = Cc["@mozilla.org/messengercompose/composefields;1"]
+                           .createInstance(Ci.nsIMsgCompFields);
         // Resolve the list considering also configured common names
         let members = compFields.splitRecipients(aRecipients, false, {});
         let list = [];
         let prefix = "";
         for (let member of members) {
             if (prefix != "") {
                 // the previous member had no email address - this happens if a recipients CN
                 // contains a ',' or ';' (splitRecipients(..) behaves wrongly here and produces an
--- a/calendar/base/modules/utils/calItemUtils.jsm
+++ b/calendar/base/modules/utils/calItemUtils.jsm
@@ -228,27 +228,27 @@ var calitem = {
 
     /**
      * Determines whether or not the aObject is a calIEvent
      *
      * @param aObject  the object to test
      * @returns        true if the object is a calIEvent, false otherwise
      */
     isEvent: function(aObject) {
-        return cal.wrapInstance(aObject, Components.interfaces.calIEvent) != null;
+        return cal.wrapInstance(aObject, Ci.calIEvent) != null;
     },
 
     /**
      * Determines whether or not the aObject is a calITodo
      *
      * @param aObject  the object to test
      * @returns        true if the object is a calITodo, false otherwise
      */
     isToDo: function(aObject) {
-        return cal.wrapInstance(aObject, Components.interfaces.calITodo) != null;
+        return cal.wrapInstance(aObject, Ci.calITodo) != null;
     },
 
     /**
      * Checks whether the passed item fits into the demanded range.
      *
      * @param item               the item
      * @param rangeStart         (inclusive) range start or null (open range)
      * @param rangeStart         (exclusive) range end or null (open range)
@@ -537,18 +537,18 @@ var calitem = {
         }
         return newItem;
     },
 
     /**
      * Shortcut function to serialize an item (including all overridden items).
      */
     serialize: function(aItem) {
-        let serializer = Components.classes["@mozilla.org/calendar/ics-serializer;1"]
-                                   .createInstance(Components.interfaces.calIIcsSerializer);
+        let serializer = Cc["@mozilla.org/calendar/ics-serializer;1"]
+                           .createInstance(Ci.calIIcsSerializer);
         serializer.addItems([aItem], 1);
         return serializer.serializeToString();
     },
 
     /**
      * Centralized funtions for accessing prodid and version
      */
     get productId() { return "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN"; },
@@ -559,19 +559,19 @@ var calitem = {
      * ical component.  This should be used whenever you need to set the prodid
      * and version on a calIcalComponent object.
      *
      * @param aIcalComponent        The ical component to set the prodid and
      *                                version on.
      */
     setStaticProps: function(aIcalComponent) {
         // Throw for an invalid parameter
-        aIcalComponent = cal.wrapInstance(aIcalComponent, Components.interfaces.calIIcalComponent);
+        aIcalComponent = cal.wrapInstance(aIcalComponent, Ci.calIIcalComponent);
         if (!aIcalComponent) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
         // Set the prodid and version
         aIcalComponent.prodid = calitem.productId;
         aIcalComponent.version = calitem.productVersion;
     },
 
     /**
      * Search for already open item dialog.
--- a/calendar/base/modules/utils/calItipUtils.jsm
+++ b/calendar/base/modules/utils/calItipUtils.jsm
@@ -25,17 +25,17 @@ var calitip = {
      *
      * @param {calIAttendee|calIItemBase} aItem     The item or attendee to get the sequence info
      *                                                from.
      * @return {Number}                             The sequence number
      */
     getSequence: function(aItem) {
         let seq = null;
 
-        let wrappedItem = cal.wrapInstance(aItem, Components.interfaces.calIAttendee);
+        let wrappedItem = cal.wrapInstance(aItem, Ci.calIAttendee);
         if (wrappedItem) {
             seq = wrappedItem.getProperty("RECEIVED-SEQUENCE");
         } else if (aItem) {
             // Unless the below is standardized, we store the last original
             // REQUEST/PUBLISH SEQUENCE in X-MOZ-RECEIVED-SEQUENCE to test against it
             // when updates come in:
             seq = aItem.getProperty("X-MOZ-RECEIVED-SEQUENCE");
             if (seq === null) {
@@ -62,17 +62,17 @@ var calitip = {
      * see <http://tools.ietf.org/html/draft-desruisseaux-caldav-sched-04#section-7.2>.
      *
      * @param {calIAttendee|calIItemBase} aItem     The item or attendee to retrieve the stamp from
      * @return {calIDateTime}                       The timestamp for the item
      */
     getStamp: function(aItem) {
         let dtstamp = null;
 
-        let wrappedItem = cal.wrapInstance(aItem, Components.interfaces.calIAttendee);
+        let wrappedItem = cal.wrapInstance(aItem, Ci.calIAttendee);
         if (wrappedItem) {
             let stamp = wrappedItem.getProperty("RECEIVED-DTSTAMP");
             if (stamp) {
                 dtstamp = cal.createDateTime(stamp);
             }
         } else if (aItem) {
             // Unless the below is standardized, we store the last original
             // REQUEST/PUBLISH DTSTAMP in X-MOZ-RECEIVED-DTSTAMP to test against it
@@ -176,17 +176,17 @@ var calitip = {
         // Get the recipient identity and save it with the itip item.
         itipItem.identity = calitip.getMessageRecipient(aMsgHdr);
 
         // We are only called upon receipt of an invite, so ensure that isSend
         // is false.
         itipItem.isSend = false;
 
         // XXX Get these from preferences
-        itipItem.autoResponse = Components.interfaces.calIItipItem.USER;
+        itipItem.autoResponse = Ci.calIItipItem.USER;
 
         if (imipMethod && imipMethod.length != 0 && imipMethod.toLowerCase() != "nomethod") {
             itipItem.receivedMethod = imipMethod.toUpperCase();
         } else { // There is no METHOD in the content-type header (spec violation).
                  // Fall back to using the one from the itipItem's ICS.
             imipMethod = itipItem.receivedMethod;
         }
         cal.LOG("iTIP method: " + imipMethod);
@@ -194,18 +194,18 @@ var calitip = {
         let isWritableCalendar = function(aCalendar) {
             /* TODO: missing ACL check for existing items (require callback API) */
             return calitip.isSchedulingCalendar(aCalendar) &&
                    cal.acl.userCanAddItemsToCalendar(aCalendar);
         };
 
         let writableCalendars = cal.getCalendarManager().getCalendars({}).filter(isWritableCalendar);
         if (writableCalendars.length > 0) {
-            let compCal = Components.classes["@mozilla.org/calendar/calendar;1?type=composite"]
-                                    .createInstance(Components.interfaces.calICompositeCalendar);
+            let compCal = Cc["@mozilla.org/calendar/calendar;1?type=composite"]
+                            .createInstance(Ci.calICompositeCalendar);
             writableCalendars.forEach(compCal.addCalendar, compCal);
             itipItem.targetCalendar = compCal;
         }
     },
 
     /**
      * Scope: iTIP message receiver
      *
@@ -213,17 +213,17 @@ var calitip = {
      * This text is ready localized and can be displayed to the user.
      *
      * @param {Number} aStatus         The status of the processing (i.e NS_OK, an error code)
      * @param {Number} aOperationType  An operation type from calIOperationListener
      * @return {String}                The suggested text.
      */
     getCompleteText: function(aStatus, aOperationType) {
         let text = "";
-        const cIOL = Components.interfaces.calIOperationListener;
+        const cIOL = Ci.calIOperationListener;
         if (Components.isSuccessCode(aStatus)) {
             switch (aOperationType) {
                 case cIOL.ADD: text = cal.l10n.getLtnString("imipAddedItemToCal2"); break;
                 case cIOL.MODIFY: text = cal.l10n.getLtnString("imipUpdatedItem2"); break;
                 case cIOL.DELETE: text = cal.l10n.getLtnString("imipCanceledItem2"); break;
             }
         } else {
             text = cal.l10n.getLtnString("imipBarProcessingFailed", [aStatus.toString(16)]);
@@ -283,17 +283,17 @@ var calitip = {
         let data = { label: imipLabel, showItems: [], hideItems: [] };
         let separateButtons = Preferences.get("calendar.itip.separateInvitationButtons", false);
 
         let disallowedCounter = false;
         if (foundItems && foundItems.length) {
             let disallow = foundItems[0].getProperty("X-MICROSOFT-DISALLOW-COUNTER");
             disallowedCounter = disallow && disallow == "TRUE";
         }
-        if (rc == Components.interfaces.calIErrors.CAL_IS_READONLY) {
+        if (rc == Ci.calIErrors.CAL_IS_READONLY) {
             // No writable calendars, tell the user about it
             data.label = cal.l10n.getLtnString("imipBarNotWritable");
         } else if (Components.isSuccessCode(rc) && !actionFunc) {
             // This case, they clicked on an old message that has already been
             // added/updated, we want to tell them that.
             data.label = cal.l10n.getLtnString("imipBarAlreadyProcessedText");
             if (foundItems && foundItems.length) {
                 data.showItems.push("imipDetailsButton");
@@ -317,18 +317,18 @@ var calitip = {
                                 }
                             }
                         }
                     }
                 }
             } else if (itipItem.receivedMethod == "REPLY") {
                 // The item has been previously removed from the available calendars or the calendar
                 // containing the item is not available
-                let delmgr = Components.classes["@mozilla.org/calendar/deleted-items-manager;1"]
-                                       .getService(Components.interfaces.calIDeletedItems);
+                let delmgr = Cc["@mozilla.org/calendar/deleted-items-manager;1"]
+                               .getService(Ci.calIDeletedItems);
                 let delTime = null;
                 let items = itipItem.getItemList({});
                 if (items && items.length) {
                     delTime = delmgr.getDeletedDate(items[0].id);
                 }
                 if (delTime) {
                     data.label = cal.l10n.getLtnString("imipBarReplyToRecentlyRemovedItem", [delTime.toString()]);
                 } else {
@@ -450,18 +450,18 @@ var calitip = {
      * Scope: iTIP message receiver
      * Retrieves the message sender.
      *
      * @param {nsIMsgDBHdr} aMsgHdr     The message header to check.
      * @return {String}                 The email address of the intended recipient.
      */
     getMessageSender: function(aMsgHdr) {
         let author = (aMsgHdr && aMsgHdr.author) || "";
-        let compFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
-                                   .createInstance(Components.interfaces.nsIMsgCompFields);
+        let compFields = Cc["@mozilla.org/messengercompose/composefields;1"]
+                           .createInstance(Ci.nsIMsgCompFields);
         let addresses = compFields.splitRecipients(author, true, {});
         if (addresses.length != 1) {
             cal.LOG("No unique email address for lookup in message.\r\n" + cal.STACK(20));
         }
         return addresses[0] || null;
     },
 
     /**
@@ -498,27 +498,27 @@ var calitip = {
                 identity = defaultAccount.defaultIdentity;
             }
             if (!identity) {
                 // If there isn't a default identity (i.e Local Folders is your
                 // default identity), then go ahead and use the first available
                 // identity.
                 let allIdentities = actMgr.allIdentities;
                 if (allIdentities.length > 0) {
-                    identity = allIdentities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
+                    identity = allIdentities.queryElementAt(0, Ci.nsIMsgIdentity);
                 } else {
                     // If there are no identities at all, we cannot get a recipient.
                     return null;
                 }
             }
             emailMap[identity.email.toLowerCase()] = true;
         } else {
             // Build a map of usable email addresses
             for (let i = 0; i < identities.length; i++) {
-                let identity = identities.queryElementAt(i, Components.interfaces.nsIMsgIdentity);
+                let identity = identities.queryElementAt(i, Ci.nsIMsgIdentity);
                 emailMap[identity.email.toLowerCase()] = true;
             }
         }
 
         // First check the recipient list
         let toList = MailServices.headerParser.makeFromDisplayAddress(aMsgHdr.recipients || "");
         for (let recipient of toList) {
             if (recipient.email.toLowerCase() in emailMap) {
@@ -657,27 +657,27 @@ var calitip = {
             case "CANCEL":
             case "COUNTER":
             case "DECLINECOUNTER":
             case "REPLY": {
                 // Per iTIP spec (new Draft 4), multiple items in an iTIP message MUST have
                 // same ID, this simplifies our searching, we can just look for Item[0].id
                 let itemList = itipItem.getItemList({});
                 if (!itipItem.targetCalendar) {
-                    optionsFunc(itipItem, Components.interfaces.calIErrors.CAL_IS_READONLY);
+                    optionsFunc(itipItem, Ci.calIErrors.CAL_IS_READONLY);
                 } else if (itemList.length > 0) {
                     ItipItemFinderFactory.findItem(itemList[0].id, itipItem, optionsFunc);
                 } else if (optionsFunc) {
-                    optionsFunc(itipItem, Components.results.NS_OK);
+                    optionsFunc(itipItem, Cr.NS_OK);
                 }
                 break;
             }
             default: {
                 if (optionsFunc) {
-                    optionsFunc(itipItem, Components.results.NS_ERROR_NOT_IMPLEMENTED);
+                    optionsFunc(itipItem, Cr.NS_ERROR_NOT_IMPLEMENTED);
                 }
                 break;
             }
         }
     },
 
     /**
      * Scope: iTIP message sender
@@ -711,37 +711,37 @@ var calitip = {
                 }
             }
 
             if (aOriginalItem.recurrenceInfo && aItem.recurrenceInfo) {
                 // check whether the two differ only in EXDATEs
                 let clonedItem = aItem.clone();
                 let exdates = [];
                 for (let ritem of clonedItem.recurrenceInfo.getRecurrenceItems({})) {
-                    let wrappedRItem = cal.wrapInstance(ritem, Components.interfaces.calIRecurrenceDate);
+                    let wrappedRItem = cal.wrapInstance(ritem, Ci.calIRecurrenceDate);
                     if (ritem.isNegative &&
                         wrappedRItem &&
                         !aOriginalItem.recurrenceInfo.getRecurrenceItems({}).some((recitem) => {
-                            let wrappedR = cal.wrapInstance(recitem, Components.interfaces.calIRecurrenceDate);
+                            let wrappedR = cal.wrapInstance(recitem, Ci.calIRecurrenceDate);
                             return recitem.isNegative &&
                                    wrappedR &&
                                    wrappedR.date.compare(wrappedRItem.date) == 0;
                         })) {
                         exdates.push(wrappedRItem);
                     }
                 }
                 if (exdates.length > 0) {
                     // check whether really only EXDATEs have been added:
                     let recInfo = clonedItem.recurrenceInfo;
                     exdates.forEach(recInfo.deleteRecurrenceItem, recInfo);
                     if (cal.item.compareContent(clonedItem, aOriginalItem)) { // transition into "delete occurrence(s)"
                         // xxx todo: support multiple
                         aItem = aOriginalItem.recurrenceInfo.getOccurrenceFor(exdates[0].date);
                         aOriginalItem = null;
-                        aOpType = Components.interfaces.calIOperationListener.DELETE;
+                        aOpType = Ci.calIOperationListener.DELETE;
                     }
                 }
             }
         }
         // for backward compatibility, we assume USER mode if not set otherwise
         let autoResponse = { mode: Ci.calIItipItem.USER };
         if (aExtResponse && aExtResponse.hasOwnProperty("responseMode")) {
             switch (aExtResponse.responseMode) {
@@ -781,17 +781,17 @@ var calitip = {
                     invitedAttendee = invitedAttendee.clone();
                     invitedAttendee.setProperty("SENT-BY", "mailto:" + userAddresses[0]);
                 }
             }
 
             if (aItem.organizer) {
                 let origInvitedAttendee = (aOriginalItem && aOriginalItem.getAttendeeById(invitedAttendee.id));
 
-                if (aOpType == Components.interfaces.calIOperationListener.DELETE) {
+                if (aOpType == Ci.calIOperationListener.DELETE) {
                     // in case the attendee has just deleted the item, we want to send out a DECLINED REPLY:
                     origInvitedAttendee = invitedAttendee;
                     invitedAttendee = invitedAttendee.clone();
                     invitedAttendee.participationStatus = "DECLINED";
                 }
 
                 // We want to send a REPLY send if:
                 // - there has been a PARTSTAT change
@@ -845,24 +845,24 @@ var calitip = {
             return;
         }
 
         // special handling for invitation with event status cancelled
         if (aItem.getAttendees({}).length > 0 &&
             aItem.getProperty("STATUS") == "CANCELLED") {
             if (calitip.getSequence(aItem) > 0) {
                 // make sure we send a cancellation and not an request
-                aOpType = Components.interfaces.calIOperationListener.DELETE;
+                aOpType = Ci.calIOperationListener.DELETE;
             } else {
                 // don't send an invitation, if the event was newly created and has status cancelled
                 return;
             }
         }
 
-        if (aOpType == Components.interfaces.calIOperationListener.DELETE) {
+        if (aOpType == Ci.calIOperationListener.DELETE) {
             sendMessage(aItem, "CANCEL", aItem.getAttendees({}), autoResponse);
             return;
         } // else ADD, MODIFY:
 
         let originalAtt = (aOriginalItem ? aOriginalItem.getAttendees({}) : []);
         let itemAtt = aItem.getAttendees({});
         let canceledAttendees = [];
         let addedAttendees = [];
@@ -1018,18 +1018,17 @@ var calitip = {
      * itipItem.clone() instead if only a simple copy is required
      *
      * @param  {calIItipItem} aItipItem  ItipItem to derive a new one from
      * @param  {calIItemBase[]} aItems   calIEvent or calITodo items to be contained in the new itipItem
      * @param  {Object} aProps           Properties to be different in the new itipItem
      * @return {calIItipItem}            The copied and modified item
      */
     getModifiedItipItem: function(aItipItem, aItems=[], aProps={}) {
-        let itipItem = Components.classes["@mozilla.org/calendar/itip-item;1"]
-                                 .createInstance(Components.interfaces.calIItipItem);
+        let itipItem = Cc["@mozilla.org/calendar/itip-item;1"].createInstance(Ci.calIItipItem);
         let serializedItems = "";
         for (let item of aItems) {
             serializedItems += cal.item.serialize(item);
         }
         itipItem.init(serializedItems);
 
         itipItem.autoResponse = ("autoResponse" in aProps) ? aProps.autoResponse : aItipItem.autoResponse;
         itipItem.identity = ("identity" in aProps) ? aProps.identity : aItipItem.identity;
@@ -1091,33 +1090,33 @@ var calitip = {
     /**
      * Shortcut function to check whether an item is an invitation copy.
      *
      * @param {calIItemBase} aItem      The item to check for an invitation.
      * @return {Boolean}                True, if the item is an invitation.
      */
     isInvitation: function(aItem) {
         let isInvitation = false;
-        let calendar = cal.wrapInstance(aItem.calendar, Components.interfaces.calISchedulingSupport);
+        let calendar = cal.wrapInstance(aItem.calendar, Ci.calISchedulingSupport);
         if (calendar) {
             isInvitation = calendar.isInvitation(aItem);
         }
         return isInvitation;
     },
 
     /**
      * Shortcut function to check whether an item is an invitation copy and has a participation
      * status of either NEEDS-ACTION or TENTATIVE.
      *
      * @param {calIAttendee|calIItemBase} aItem     either calIAttendee or calIItemBase
      * @return {Boolean}                            True, if the attendee partstat is NEEDS-ACTION
      *                                                or TENTATIVE
      */
     isOpenInvitation: function(aItem) {
-        let wrappedItem = cal.wrapInstance(aItem, Components.interfaces.calIAttendee);
+        let wrappedItem = cal.wrapInstance(aItem, Ci.calIAttendee);
         if (!wrappedItem) {
             aItem = calitip.getInvitedAttendee(aItem);
         }
         if (aItem) {
             switch (aItem.participationStatus) {
                 case "NEEDS-ACTION":
                 case "TENTATIVE":
                     return true;
@@ -1173,17 +1172,17 @@ var calitip = {
      *                                        calendar
      * @return {?calIAttendee}              The attendee that was invited
      */
     getInvitedAttendee: function(aItem, aCalendar) {
         if (!aCalendar) {
             aCalendar = aItem.calendar;
         }
         let invitedAttendee = null;
-        let calendar = cal.wrapInstance(aCalendar, Components.interfaces.calISchedulingSupport);
+        let calendar = cal.wrapInstance(aCalendar, Ci.calISchedulingSupport);
         if (calendar) {
             invitedAttendee = calendar.getInvitedAttendee(aItem);
         }
         return invitedAttendee;
     },
 
     /**
      * Returns all attendees from given set of attendees matching based on the attendee id
@@ -1191,18 +1190,18 @@ var calitip = {
      *
      * @param {calIAttendee[]} aAttendees       An array of calIAttendee objects
      * @param {String} aEmailAddress            A string containing the email address for lookup
      * @return {calIAttendee[]}                 Returns an array of matching attendees
      */
     getAttendeesBySender: function(aAttendees, aEmailAddress) {
         let attendees = [];
         // we extract the email address to make it work also for a raw header value
-        let compFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
-                                   .createInstance(Components.interfaces.nsIMsgCompFields);
+        let compFields = Cc["@mozilla.org/messengercompose/composefields;1"]
+                           .createInstance(Ci.nsIMsgCompFields);
         let addresses = compFields.splitRecipients(aEmailAddress, true, {});
         if (addresses.length == 1) {
             let searchFor = cal.email.prependMailTo(addresses[0]);
             aAttendees.forEach(aAttendee => {
                 if ([aAttendee.id, aAttendee.getProperty("SENT-BY")].includes(searchFor)) {
                     attendees.push(aAttendee);
                 }
             });
@@ -1215,17 +1214,17 @@ var calitip = {
 
 /** local to this module file
  * Sets the received info either on the passed attendee or item object.
  *
  * @param {calIItemBase|calIAttendee} item      The item to set info on
  * @param {calIItipItem} itipItemItem           The received iTIP item
  */
 function setReceivedInfo(item, itipItemItem) {
-    let wrappedItem = cal.wrapInstance(item, Components.interfaces.calIAttendee);
+    let wrappedItem = cal.wrapInstance(item, Ci.calIAttendee);
     item.setProperty(wrappedItem ? "RECEIVED-SEQUENCE"
                                  : "X-MOZ-RECEIVED-SEQUENCE",
                                  String(calitip.getSequence(itipItemItem)));
     let dtstamp = calitip.getStamp(itipItemItem);
     if (dtstamp) {
         item.setProperty(wrappedItem ? "RECEIVED-DTSTAMP"
                                      : "X-MOZ-RECEIVED-DTSTAMP",
                                      dtstamp.getInTimezone(cal.dtz.UTC).icalString);
@@ -1373,40 +1372,39 @@ function createOrganizer(aCalendar) {
  *
  * @param {calIEvent} aItem                 item to be sent
  * @param {String} aMethod                  iTIP method
  * @param {calIAttendee[]} aRecipientsList  array of calIAttendee objects the message should be sent to
  * @param {Object} autoResponse             inout object whether the transport should ask before sending
  * @return {Boolean}                        True, if the message could be sent
  */
 function sendMessage(aItem, aMethod, aRecipientsList, autoResponse) {
-    let calendar = cal.wrapInstance(aItem.calendar, Components.interfaces.calISchedulingSupport);
+    let calendar = cal.wrapInstance(aItem.calendar, Ci.calISchedulingSupport);
     if (calendar) {
-        if (calendar.QueryInterface(Components.interfaces.calISchedulingSupport)
+        if (calendar.QueryInterface(Ci.calISchedulingSupport)
                     .canNotify(aMethod, aItem)) {
             // provider will handle that, so we return - we leave it also to the provider to
             // deal with user canceled notifications (if possible), so set the return value
             // to true as false would prevent any further notification within this cycle
             return true;
         }
     }
 
     if (aRecipientsList.length == 0) {
         return false;
     }
 
     let transport = aItem.calendar.getProperty("itip.transport");
     if (!transport) { // can only send if there's a transport for the calendar
         return false;
     }
-    transport = transport.QueryInterface(Components.interfaces.calIItipTransport);
+    transport = transport.QueryInterface(Ci.calIItipTransport);
 
     let _sendItem = function(aSendToList, aSendItem) {
-        let itipItem = Components.classes["@mozilla.org/calendar/itip-item;1"]
-                                 .createInstance(Ci.calIItipItem);
+        let itipItem = Cc["@mozilla.org/calendar/itip-item;1"].createInstance(Ci.calIItipItem);
         itipItem.init(cal.item.serialize(aSendItem));
         itipItem.responseMethod = aMethod;
         itipItem.targetCalendar = aSendItem.calendar;
         itipItem.autoResponse = autoResponse.mode;
         // we switch to AUTO for each subsequent call of _sendItem()
         autoResponse.mode = Ci.calIItipItem.AUTO;
         // XXX I don't know whether the below is used at all, since we don't use the itip processor
         itipItem.isSend = true;
@@ -1623,17 +1621,17 @@ ItipItemFinder.prototype = {
         this.processFoundItems();
     },
 
     destroy: function() {
         this._unobserveChanges();
     },
 
     processFoundItems: function() {
-        let rc = Components.results.NS_OK;
+        let rc = Cr.NS_OK;
         const method = this.mItipItem.receivedMethod.toUpperCase();
         let actionMethod = method;
         let operations = [];
 
         if (this.mFoundItems.length > 0) {
             // Save the target calendar on the itip item
             this.mItipItem.targetCalendar = this.mFoundItems[0].calendar;
             this._observeChanges(this.mItipItem.targetCalendar);
@@ -1869,17 +1867,17 @@ ItipItemFinder.prototype = {
                                     item.calendar.deleteItem(item, opListener)
                                 );
                             }
                         }
                     }
                     break;
                 }
                 default:
-                    rc = Components.results.NS_ERROR_NOT_IMPLEMENTED;
+                    rc = Cr.NS_ERROR_NOT_IMPLEMENTED;
                     break;
             }
         } else { // not found:
             cal.LOG("iTIP on " + method + ": no existing items.");
 
             // If the item was not found, observe the target calendar anyway.
             // It will likely be the composite calendar, so we should update
             // if an item was added or removed
@@ -1925,17 +1923,17 @@ ItipItemFinder.prototype = {
                         operations.push(action);
                         break;
                     }
                     case "CANCEL": // has already been processed
                     case "REPLY": // item has been previously removed from the calendar
                     case "COUNTER": // the item has been previously removed form the calendar
                         break;
                     default:
-                        rc = Components.results.NS_ERROR_NOT_IMPLEMENTED;
+                        rc = Cr.NS_ERROR_NOT_IMPLEMENTED;
                         break;
                 }
             }
         }
 
         cal.LOG("iTIP operations: " + operations.length);
         let actionFunc = null;
         if (operations.length > 0) {
--- a/calendar/base/modules/utils/calL10NUtils.jsm
+++ b/calendar/base/modules/utils/calL10NUtils.jsm
@@ -33,17 +33,17 @@ function _getString(aComponent, aBundleN
 
         if (aParams && aParams.length) {
             return props.formatStringFromName(aStringName, aParams, aParams.length);
         } else {
             return props.GetStringFromName(aStringName);
         }
     } catch (ex) {
         let msg = `Failed to read '${aStringName}' from ${propName}.`;
-        Components.utils.reportError(`${msg} Error: ${ex}`);
+        Cu.reportError(`${msg} Error: ${ex}`);
         return aStringName;
     }
 }
 _getString._bundleCache = {};
 
 /**
  * Provides locale dependent parameters for displaying calendar views
  *
@@ -143,19 +143,19 @@ var call10n = {
     },
 
     /**
      * Create a new locale collator
      *
      * @return {nsICollation}       A new locale collator
      */
     createLocaleCollator: function() {
-        return Components.classes["@mozilla.org/intl/collation-factory;1"]
-                         .getService(Components.interfaces.nsICollationFactory)
-                         .CreateCollation();
+        return Cc["@mozilla.org/intl/collation-factory;1"]
+                 .getService(Ci.nsICollationFactory)
+                 .CreateCollation();
     },
 
     /**
      * Sort an array of strings in place, according to the current locale.
      *
      * @param {String[]} aStringArray   The strings to sort
      * @return {String[]}               The sorted strings, more specifically aStringArray
      */
--- a/calendar/base/modules/utils/calProviderUtils.jsm
+++ b/calendar/base/modules/utils/calProviderUtils.jsm
@@ -36,36 +36,36 @@ var calprovider = {
      * @param {?nsIChannel} aExisting                           An existing channel to modify (optional)
      * @return {nsIChannel}                                     The prepared channel
      */
     prepHttpChannel: function(aUri, aUploadData, aContentType, aNotificationCallbacks, aExisting=null) {
         let channel = aExisting || Services.io.newChannelFromURI2(aUri,
                                                                   null,
                                                                   Services.scriptSecurityManager.getSystemPrincipal(),
                                                                   null,
-                                                                  Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                                                                  Components.interfaces.nsIContentPolicy.TYPE_OTHER);
-        let httpchannel = channel.QueryInterface(Components.interfaces.nsIHttpChannel);
+                                                                  Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                                                  Ci.nsIContentPolicy.TYPE_OTHER);
+        let httpchannel = channel.QueryInterface(Ci.nsIHttpChannel);
 
         httpchannel.setRequestHeader("Accept", "text/xml", false);
         httpchannel.setRequestHeader("Accept-Charset", "utf-8,*;q=0.1", false);
-        httpchannel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE;
+        httpchannel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
         httpchannel.notificationCallbacks = aNotificationCallbacks;
 
         if (aUploadData) {
-            httpchannel = httpchannel.QueryInterface(Components.interfaces.nsIUploadChannel);
+            httpchannel = httpchannel.QueryInterface(Ci.nsIUploadChannel);
             let stream;
-            if (aUploadData instanceof Components.interfaces.nsIInputStream) {
+            if (aUploadData instanceof Ci.nsIInputStream) {
                 // Make sure the stream is reset
-                stream = aUploadData.QueryInterface(Components.interfaces.nsISeekableStream);
-                stream.seek(Components.interfaces.nsISeekableStream.NS_SEEK_SET, 0);
+                stream = aUploadData.QueryInterface(Ci.nsISeekableStream);
+                stream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
             } else {
                 // Otherwise its something that should be a string, convert it.
-                let converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
-                                          .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+                let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                                  .createInstance(Ci.nsIScriptableUnicodeConverter);
                 converter.charset = "UTF-8";
                 stream = converter.convertToInputStream(aUploadData.toString());
             }
 
             httpchannel.setUploadStream(stream, aContentType, -1);
         }
 
         return httpchannel;
@@ -84,18 +84,17 @@ var calprovider = {
     },
 
     /**
      * Shortcut to create an nsIStreamLoader
      *
      * @return {nsIStreamLoader}        A fresh streamloader
      */
     createStreamLoader: function() {
-        return Components.classes["@mozilla.org/network/stream-loader;1"]
-                         .createInstance(Components.interfaces.nsIStreamLoader);
+        return Cc["@mozilla.org/network/stream-loader;1"].createInstance(Ci.nsIStreamLoader);
     },
 
     /**
      * Convert a byte array to a string
      *
      * @param {octet[]} aResult         The bytes to convert
      * @param {Number} aResultLength    The number of bytes
      * @param {String} aCharset         The character set of the bytes, defaults to utf-8
@@ -138,25 +137,25 @@ var calprovider = {
      */
     InterfaceRequestor_getInterface: function(aIID) {
         try {
             // Try to query the this object for the requested interface but don't
             // throw if it fails since that borks the network code.
             return this.QueryInterface(aIID);
         } catch (e) {
             // Support Auth Prompt Interfaces
-            if (aIID.equals(Components.interfaces.nsIAuthPrompt2)) {
+            if (aIID.equals(Ci.nsIAuthPrompt2)) {
                 if (!this.calAuthPrompt) {
                     this.calAuthPrompt = new cal.auth.Prompt();
                 }
                 return this.calAuthPrompt;
-            } else if (aIID.equals(Components.interfaces.nsIAuthPromptProvider) ||
-                       aIID.equals(Components.interfaces.nsIPrompt)) {
+            } else if (aIID.equals(Ci.nsIAuthPromptProvider) ||
+                       aIID.equals(Ci.nsIPrompt)) {
                 return Services.ww.getNewPrompter(null);
-            } else if (aIID.equals(Components.interfaces.nsIBadCertListener2)) {
+            } else if (aIID.equals(Ci.nsIBadCertListener2)) {
                 if (!this.badCertHandler) {
                     this.badCertHandler = new cal.provider.BadCertHandler(this);
                 }
                 return this.badCertHandler;
             } else {
                 Components.returnCode = e;
             }
         }
@@ -200,22 +199,21 @@ var calprovider = {
                     if (this.thisProvider.canRefresh &&
                         params.exceptionAdded) {
                         // Refresh the provider if the
                         // exception certificate was added
                         this.thisProvider.refresh();
                     }
                 }
             };
-            this.timer = Components.classes["@mozilla.org/timer;1"]
-                                   .createInstance(Components.interfaces.nsITimer);
+            this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
             this.timer.initWithCallback(
                 timerCallback,
                 0,
-                Components.interfaces.nsITimer.TYPE_ONE_SHOT
+                Ci.nsITimer.TYPE_ONE_SHOT
             );
             return true;
         }
     },
 
     /**
      * Freebusy interval implementation. All parameters are optional.
      *
@@ -227,65 +225,65 @@ var calprovider = {
      */
     FreeBusyInterval: class {
         QueryInterface() {
             return ChromeUtils.generateQI([Ci.calIFreeBusyInterval]);
         }
 
         constructor(aCalId, aFreeBusyType, aStart, aEnd) {
             this.calId = aCalId;
-            this.interval = Components.classes["@mozilla.org/calendar/period;1"]
-                                      .createInstance(Components.interfaces.calIPeriod);
+            this.interval = Cc["@mozilla.org/calendar/period;1"]
+                              .createInstance(Ci.calIPeriod);
             this.interval.start = aStart;
             this.interval.end = aEnd;
 
-            this.freeBusyType = aFreeBusyType || Components.interfaces.calIFreeBusyInterval.UNKNOWN;
+            this.freeBusyType = aFreeBusyType || Ci.calIFreeBusyInterval.UNKNOWN;
         }
     },
 
     /**
      * Gets the iTIP/iMIP transport if the passed calendar has configured email.
      *
      * @param {calICalendar} aCalendar      The calendar to get the transport for
      * @return {?calIItipTransport}         The email transport, or null if no identity configured
      */
     getImipTransport: function(aCalendar) {
         // assure an identity is configured for the calendar
         if (aCalendar && aCalendar.getProperty("imip.identity")) {
-            return Components.classes["@mozilla.org/calendar/itip-transport;1?type=email"]
-                             .getService(Components.interfaces.calIItipTransport);
+            return Cc["@mozilla.org/calendar/itip-transport;1?type=email"]
+                     .getService(Ci.calIItipTransport);
         }
         return null;
     },
 
     /**
      * Gets the configured identity and account of a particular calendar instance, or null.
      *
      * @param {calICalendar} aCalendar      Calendar instance
      * @param {?Object} outAccount          Optional out value for account
      * @return {nsIMsgIdentity}             The configured identity
      */
     getEmailIdentityOfCalendar: function(aCalendar, outAccount) {
-        cal.ASSERT(aCalendar, "no calendar!", Components.results.NS_ERROR_INVALID_ARG);
+        cal.ASSERT(aCalendar, "no calendar!", Cr.NS_ERROR_INVALID_ARG);
         let key = aCalendar.getProperty("imip.identity.key");
         if (key === null) { // take default account/identity:
             let findIdentity = function(account) {
                 if (account && account.identities.length) {
                     return account.defaultIdentity ||
-                           account.identities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
+                           account.identities.queryElementAt(0, Ci.nsIMsgIdentity);
                 }
                 return null;
             };
 
             let foundAccount = MailServices.accounts.defaultAccount;
             let foundIdentity = findIdentity(foundAccount);
 
             if (!foundAccount || !foundIdentity) {
                 let accounts = MailServices.accounts.accounts;
-                for (let account of fixIterator(accounts, Components.interfaces.nsIMsgAccount)) {
+                for (let account of fixIterator(accounts, Ci.nsIMsgAccount)) {
                     let identity = findIdentity(account);
 
                     if (account && identity) {
                         foundAccount = account;
                         foundIdentity = identity;
                         break;
                     }
                 }
@@ -344,21 +342,21 @@ var calprovider = {
 
     /**
      * Gets the calendar directory, defaults to <profile-dir>/calendar-data
      *
      * @return {nsIFile}        The calendar-data directory as nsIFile
      */
     getCalendarDirectory: function() {
         if (calprovider.getCalendarDirectory.mDir === undefined) {
-            let dir = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+            let dir = Services.dirsvc.get("ProfD", Ci.nsIFile);
             dir.append("calendar-data");
             if (!dir.exists()) {
                 try {
-                    dir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o700);
+                    dir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o700);
                 } catch (exc) {
                     cal.ASSERT(false, exc);
                     throw exc;
                 }
             }
             calprovider.getCalendarDirectory.mDir = dir;
         }
         return calprovider.getCalendarDirectory.mDir.clone();
@@ -383,51 +381,51 @@ var calprovider = {
                 "imip.identity.disabled": true,
                 "organizerId": true,
                 "organizerCN": true
             };
         }
 
         QueryInterface(iid) {
             return cal.generateClassQI(this, iid, [
-                Components.interfaces.calICalendar,
-                Components.interfaces.calISchedulingSupport
+                Ci.calICalendar,
+                Ci.calISchedulingSupport
             ]);
         }
 
         /**
          * Initialize the base class, this should be migrated to an ES6 constructor once all
          * subclasses are also es6 classes. Call this from the constructor.
          */
         initProviderBase() {
             this.wrappedJSObject = this;
             this.mID = null;
             this.mUri = null;
             this.mACLEntry = null;
             this.mBatchCount = 0;
             this.transientProperties = false;
-            this.mObservers = new cal.data.ObserverSet(Components.interfaces.calIObserver);
+            this.mObservers = new cal.data.ObserverSet(Ci.calIObserver);
             this.mProperties = {};
-            this.mProperties.currentStatus = Components.results.NS_OK;
+            this.mProperties.currentStatus = Cr.NS_OK;
         }
 
         /**
          * Returns the calIObservers for this calendar
          */
         get observers() {
             return this.mObservers;
         }
 
         // attribute AUTF8String id;
         get id() {
             return this.mID;
         }
         set id(aValue) {
             if (this.mID) {
-                throw Components.results.NS_ERROR_ALREADY_INITIALIZED;
+                throw Cr.NS_ERROR_ALREADY_INITIALIZED;
             }
             this.mID = aValue;
 
             let calMgr = cal.getCalendarManager();
 
             // make all properties persistent that have been set so far:
             for (let aName in this.mProperties) {
                 if (!this.constructor.mTransientProperties[aName]) {
@@ -448,20 +446,20 @@ var calprovider = {
         set name(aValue) {
             return this.setProperty("name", aValue);
         }
 
         // readonly attribute calICalendarACLManager aclManager;
         get aclManager() {
             const defaultACLProviderClass = "@mozilla.org/calendar/acl-manager;1?type=default";
             let providerClass = this.getProperty("aclManagerClass");
-            if (!providerClass || !Components.classes[providerClass]) {
+            if (!providerClass || !Cc[providerClass]) {
                 providerClass = defaultACLProviderClass;
             }
-            return Components.classes[providerClass].getService(Components.interfaces.calICalendarACLManager);
+            return Cc[providerClass].getService(Ci.calICalendarACLManager);
         }
 
         // readonly attribute calICalendarACLEntry aclEntry;
         get aclEntry() {
             return this.mACLEntry;
         }
 
         // attribute calICalendar superCalendar;
@@ -542,46 +540,46 @@ var calprovider = {
          * @param {Number} aOperationType                   The operation type component
          * @param {String} aId                              The item id
          * @param {*} aDetail                               The item detail for the listener
          * @param {String} aExtraMessage                    An extra message to pass to notifyError
          */
         notifyOperationComplete(aListener, aStatus, aOperationType, aId, aDetail, aExtraMessage) {
             this.notifyPureOperationComplete(aListener, aStatus, aOperationType, aId, aDetail);
 
-            if (aStatus == Components.interfaces.calIErrors.OPERATION_CANCELLED) {
+            if (aStatus == Ci.calIErrors.OPERATION_CANCELLED) {
                 return; // cancellation doesn't change current status, no notification
             }
             if (Components.isSuccessCode(aStatus)) {
                 this.setProperty("currentStatus", aStatus);
             } else {
-                if (aDetail instanceof Components.interfaces.nsIException) {
+                if (aDetail instanceof Ci.nsIException) {
                     this.notifyError(aDetail); // will set currentStatus
                 } else {
                     this.notifyError(aStatus, aDetail); // will set currentStatus
                 }
-                this.notifyError(aOperationType == Components.interfaces.calIOperationListener.GET
-                                 ? Components.interfaces.calIErrors.READ_FAILED
-                                 : Components.interfaces.calIErrors.MODIFICATION_FAILED,
+                this.notifyError(aOperationType == Ci.calIOperationListener.GET
+                                 ? Ci.calIErrors.READ_FAILED
+                                 : Ci.calIErrors.MODIFICATION_FAILED,
                                  aExtraMessage || "");
             }
         }
 
         /**
          * Notify observers using the onError notification with a readable error message
          *
          * @param {Number|nsIException} aErrNo      The error number from Components.results, or
          *                                            the exception which contains the error number
          * @param {?String} aMessage                The message to show for the error
          */
         notifyError(aErrNo, aMessage=null) {
-            if (aErrNo == Components.interfaces.calIErrors.OPERATION_CANCELLED) {
+            if (aErrNo == Ci.calIErrors.OPERATION_CANCELLED) {
                 return; // cancellation doesn't change current status, no notification
             }
-            if (aErrNo instanceof Components.interfaces.nsIException) {
+            if (aErrNo instanceof Ci.nsIException) {
                 if (!aMessage) {
                     aMessage = aErrNo.message;
                 }
                 aErrNo = aErrNo.result;
             }
             this.setProperty("currentStatus", aErrNo);
             this.observers.notify("onError", [this.superCalendar, aErrNo, aMessage]);
         }
@@ -611,24 +609,24 @@ var calprovider = {
                         if (calprovider.getEmailIdentityOfCalendar(this, outAccount)) {
                             ret = outAccount.value;
                         }
                         break;
                     }
                     case "organizerId": { // itip/imip default: derived out of imip.identity
                         let identity = this.getProperty("imip.identity");
                         ret = (identity
-                               ? ("mailto:" + identity.QueryInterface(Components.interfaces.nsIMsgIdentity).email)
+                               ? ("mailto:" + identity.QueryInterface(Ci.nsIMsgIdentity).email)
                                : null);
                         break;
                     }
                     case "organizerCN": { // itip/imip default: derived out of imip.identity
                         let identity = this.getProperty("imip.identity");
                         ret = (identity
-                               ? identity.QueryInterface(Components.interfaces.nsIMsgIdentity).fullName
+                               ? identity.QueryInterface(Ci.nsIMsgIdentity).fullName
                                : null);
                         break;
                     }
                 }
                 if ((ret === null) &&
                     !this.constructor.mTransientProperties[aName] &&
                     !this.transientProperties) {
                     if (this.id) {
--- a/calendar/base/modules/utils/calViewUtils.jsm
+++ b/calendar/base/modules/utils/calViewUtils.jsm
@@ -149,24 +149,24 @@ var calview = {
 
     /**
      * Gets the cached instance of the composite calendar.
      *
      * @param aWindow       The window to get the composite calendar for.
      */
     getCompositeCalendar: function(aWindow) {
         if (typeof aWindow._compositeCalendar == "undefined") {
-            let comp = aWindow._compositeCalendar = Components.classes["@mozilla.org/calendar/calendar;1?type=composite"]
-                                                              .createInstance(Components.interfaces.calICompositeCalendar);
+            let comp = aWindow._compositeCalendar = Cc["@mozilla.org/calendar/calendar;1?type=composite"]
+                                                      .createInstance(Ci.calICompositeCalendar);
             comp.prefPrefix = "calendar-main";
 
             if (typeof aWindow.gCalendarStatusFeedback != "undefined") {
                 // If we are in a window that has calendar status feedback, set
                 // up our status observer.
-                let chromeWindow = aWindow.QueryInterface(Components.interfaces.nsIDOMChromeWindow);
+                let chromeWindow = aWindow.QueryInterface(Ci.nsIDOMChromeWindow);
                 comp.setStatusObserver(aWindow.gCalendarStatusFeedback, chromeWindow);
             }
         }
         return aWindow._compositeCalendar;
     },
 
     /**
      * Hash the given string into a color from the color palette of the standard
--- a/calendar/base/src/calAlarm.js
+++ b/calendar/base/src/calAlarm.js
@@ -1,18 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 
-var ALARM_RELATED_ABSOLUTE = Components.interfaces.calIAlarm.ALARM_RELATED_ABSOLUTE;
-var ALARM_RELATED_START = Components.interfaces.calIAlarm.ALARM_RELATED_START;
-var ALARM_RELATED_END = Components.interfaces.calIAlarm.ALARM_RELATED_END;
+var ALARM_RELATED_ABSOLUTE = Ci.calIAlarm.ALARM_RELATED_ABSOLUTE;
+var ALARM_RELATED_START = Ci.calIAlarm.ALARM_RELATED_START;
+var ALARM_RELATED_END = Ci.calIAlarm.ALARM_RELATED_END;
 
 function calAlarm() {
     this.wrappedJSObject = this;
     this.mProperties = new Map();
     this.mPropertyParams = {};
     this.mAttendees = [];
     this.mAttachments = [];
 }
@@ -37,17 +37,17 @@ calAlarm.prototype = {
     mRepeat: 0,
 
     /**
      * calIAlarm
      */
 
     ensureMutable: function() {
         if (this.mImmutable) {
-            throw Components.results.NS_ERROR_OBJECT_IS_IMMUTABLE;
+            throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
         }
     },
 
     get isMutable() {
         return !this.mImmutable;
     },
 
     makeImmutable: function() {
@@ -64,17 +64,17 @@ calAlarm.prototype = {
         for (let member of objectMembers) {
             if (this[member] && this[member].isMutable) {
                 this[member].makeImmutable();
             }
         }
 
         // Properties
         for (let propval of this.mProperties.values()) {
-            if ((propval instanceof Components.interfaces.calIDateTime) && propval.isMutable) {
+            if ((propval instanceof Ci.calIDateTime) && propval.isMutable) {
                 propval.makeImmutable();
             }
         }
 
         this.mImmutable = true;
     },
 
     clone: function() {
@@ -117,17 +117,17 @@ calAlarm.prototype = {
             } else {
                 cloned[member] = this[member];
             }
         }
 
         // X-Props
         cloned.mProperties = new Map();
         for (let [name, value] of this.mProperties.entries()) {
-            if (value instanceof Components.interfaces.calIDateTime) {
+            if (value instanceof Ci.calIDateTime) {
                 value = value.clone();
             }
 
             cloned.mProperties.set(name, value);
 
             let propBucket = this.mPropertyParams[name];
             if (propBucket) {
                 let newBucket = {};
@@ -189,36 +189,36 @@ calAlarm.prototype = {
         this.ensureMutable();
         return (this.mSummary = aValue);
     },
 
     get offset() {
         return this.mOffset;
     },
     set offset(aValue) {
-        if (aValue && !(aValue instanceof Components.interfaces.calIDuration)) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+        if (aValue && !(aValue instanceof Ci.calIDuration)) {
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
         if (this.related != ALARM_RELATED_START &&
             this.related != ALARM_RELATED_END) {
-            throw Components.results.NS_ERROR_FAILURE;
+            throw Cr.NS_ERROR_FAILURE;
         }
         this.ensureMutable();
         return (this.mOffset = aValue);
     },
 
     get alarmDate() {
         return this.mAbsoluteDate;
     },
     set alarmDate(aValue) {
-        if (aValue && !(aValue instanceof Components.interfaces.calIDateTime)) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+        if (aValue && !(aValue instanceof Ci.calIDateTime)) {
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
         if (this.related != ALARM_RELATED_ABSOLUTE) {
-            throw Components.results.NS_ERROR_FAILURE;
+            throw Cr.NS_ERROR_FAILURE;
         }
         this.ensureMutable();
         return (this.mAbsoluteDate = aValue);
     },
 
     get repeat() {
         if ((this.mRepeat != 0) ^ (this.mDuration != null)) {
             return 0;
@@ -227,33 +227,33 @@ calAlarm.prototype = {
     },
     set repeat(aValue) {
         this.ensureMutable();
         if (aValue === null) {
             this.mRepeat = null;
         } else {
             this.mRepeat = parseInt(aValue, 10);
             if (isNaN(this.mRepeat)) {
-                throw Components.results.NS_ERROR_INVALID_ARG;
+                throw Cr.NS_ERROR_INVALID_ARG;
             }
         }
         return aValue;
     },
 
     get repeatOffset() {
         if ((this.mRepeat != 0) ^ (this.mDuration != null)) {
             return null;
         }
         return this.mDuration;
     },
     set repeatOffset(aValue) {
         this.ensureMutable();
         if (aValue !== null &&
-            !(aValue instanceof Components.interfaces.calIDuration)) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            !(aValue instanceof Ci.calIDuration)) {
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
         return (this.mDuration = aValue);
     },
 
     get repeatDate() {
         if (this.related != ALARM_RELATED_ABSOLUTE ||
             !this.mAbsoluteDate ||
             !this.mRepeat ||
@@ -390,17 +390,17 @@ calAlarm.prototype = {
         } else if (this.related != ALARM_RELATED_ABSOLUTE && this.mOffset) {
             triggerProp.valueAsIcalString = this.mOffset.icalString;
             if (this.related == ALARM_RELATED_END) {
                 // An alarm related to the end of the event.
                 triggerProp.setParameter("RELATED", "END");
             }
         } else {
             // No offset or absolute date is not valid.
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
+            throw Cr.NS_ERROR_NOT_INITIALIZED;
         }
         comp.addProperty(triggerProp);
 
         // Set up repeat and duration (OPTIONAL, but if one exists, the other
         // MUST also exist)
         if (this.repeat && this.repeatOffset) {
             let repeatProp = icssvc.createIcalProperty("REPEAT");
             let durationProp = icssvc.createIcalProperty("DURATION");
@@ -410,25 +410,25 @@ calAlarm.prototype = {
 
             comp.addProperty(repeatProp);
             comp.addProperty(durationProp);
         }
 
         // Set up attendees (REQUIRED for EMAIL action)
         /* TODO should we be strict here?
         if (this.action == "EMAIL" && !this.getAttendees({}).length) {
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
+            throw Cr.NS_ERROR_NOT_INITIALIZED;
         } */
         for (let attendee of this.getAttendees({})) {
             comp.addProperty(attendee.icalProperty);
         }
 
         /* TODO should we be strict here?
         if (this.action == "EMAIL" && !this.attachments.length) {
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
+            throw Cr.NS_ERROR_NOT_INITIALIZED;
         } */
 
         for (let attachment of this.getAttachments({})) {
             comp.addProperty(attachment.icalProperty);
         }
 
         // Set up summary (REQUIRED for EMAIL)
         if (this.summary || this.action == "EMAIL") {
@@ -466,17 +466,17 @@ calAlarm.prototype = {
             // Add parameters
             let propBucket = this.mPropertyParams[propName];
             if (propBucket) {
                 for (let paramName in propBucket) {
                     try {
                         icalprop.setParameter(paramName,
                                               propBucket[paramName]);
                     } catch (e) {
-                        if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
+                        if (e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
                             // Illegal values should be ignored, but we could log them if
                             // the user has enabled logging.
                             cal.LOG("Warning: Invalid alarm parameter value " + paramName + "=" + propBucket[paramName]);
                         } else {
                             throw e;
                         }
                     }
                 }
@@ -484,52 +484,52 @@ calAlarm.prototype = {
             comp.addProperty(icalprop);
         }
         return comp;
     },
     set icalComponent(aComp) {
         this.ensureMutable();
         if (!aComp || aComp.componentType != "VALARM") {
             // Invalid Component
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         let actionProp = aComp.getFirstProperty("ACTION");
         let triggerProp = aComp.getFirstProperty("TRIGGER");
         let repeatProp = aComp.getFirstProperty("REPEAT");
         let durationProp = aComp.getFirstProperty("DURATION");
         let summaryProp = aComp.getFirstProperty("SUMMARY");
         let descriptionProp = aComp.getFirstProperty("DESCRIPTION");
         let lastAckProp = aComp.getFirstProperty("X-MOZ-LASTACK");
 
         if (actionProp) {
             this.action = actionProp.value;
         } else {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         if (triggerProp) {
             if (triggerProp.getParameter("VALUE") == "DATE-TIME") {
                 this.mAbsoluteDate = triggerProp.valueAsDatetime;
                 this.related = ALARM_RELATED_ABSOLUTE;
             } else {
                 this.mOffset = cal.createDuration(triggerProp.valueAsIcalString);
 
                 let related = triggerProp.getParameter("RELATED");
                 this.related = (related == "END" ? ALARM_RELATED_END : ALARM_RELATED_START);
             }
         } else {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         if (durationProp && repeatProp) {
             this.repeatOffset = cal.createDuration(durationProp.valueAsIcalString);
             this.repeat = repeatProp.value;
         } else if (durationProp || repeatProp) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         } else {
             this.repeatOffset = null;
             this.repeat = 0;
         }
 
         // Set up attendees
         this.clearAttendees();
         for (let attendeeProp of cal.iterate.icalProperty(aComp, "ATTENDEE")) {
--- a/calendar/base/src/calAlarmMonitor.js
+++ b/calendar/base/src/calAlarmMonitor.js
@@ -14,28 +14,24 @@ function peekAlarmWindow() {
  * The alarm monitor takes care of playing the alarm sound and opening one copy
  * of the calendar-alarm-dialog. Both depend on their respective prefs to be
  * set. This monitor is only used for DISPLAY type alarms.
  */
 function calAlarmMonitor() {
     this.wrappedJSObject = this;
     this.mAlarms = [];
 
-    this.mSound = Components.classes["@mozilla.org/sound;1"]
-                            .createInstance(Components.interfaces.nsISound);
+    this.mSound = Cc["@mozilla.org/sound;1"].createInstance(Ci.nsISound);
 
     Services.obs.addObserver(this, "alarm-service-startup");
     Services.obs.addObserver(this, "alarm-service-shutdown");
 }
 
 var calAlarmMonitorClassID = Components.ID("{4b7ae030-ed79-11d9-8cd6-0800200c9a66}");
-var calAlarmMonitorInterfaces = [
-    Components.interfaces.nsIObserver,
-    Components.interfaces.calIAlarmServiceObserver
-];
+var calAlarmMonitorInterfaces = [Ci.nsIObserver, Ci.calIAlarmServiceObserver];
 calAlarmMonitor.prototype = {
     mAlarms: null,
 
     // This is a work-around for the fact that there is a delay between when
     // we call openWindow and when it appears via getMostRecentWindow.  If an
     // alarm is fired in that time-frame, it will actually end up in another window.
     mWindowOpening: null,
 
@@ -44,25 +40,25 @@ calAlarmMonitor.prototype = {
 
     classID: calAlarmMonitorClassID,
     QueryInterface: cal.generateQI(calAlarmMonitorInterfaces),
     classInfo: cal.generateCI({
         contractID: "@mozilla.org/calendar/alarm-monitor;1",
         classDescription: "Calendar Alarm Monitor",
         classID: calAlarmMonitorClassID,
         interfaces: calAlarmMonitorInterfaces,
-        flags: Components.interfaces.nsIClassInfo.SINGLETON
+        flags: Ci.nsIClassInfo.SINGLETON
     }),
 
     /**
      * nsIObserver
      */
     observe: function(aSubject, aTopic, aData) {
-        let alarmService = Components.classes["@mozilla.org/calendar/alarm-service;1"]
-                                     .getService(Components.interfaces.calIAlarmService);
+        let alarmService = Cc["@mozilla.org/calendar/alarm-service;1"]
+                             .getService(Ci.calIAlarmService);
         switch (aTopic) {
             case "alarm-service-startup":
                 alarmService.addObserver(this);
                 break;
             case "alarm-service-shutdown":
                 alarmService.removeObserver(this);
                 break;
         }
--- a/calendar/base/src/calAlarmService.js
+++ b/calendar/base/src/calAlarmService.js
@@ -9,34 +9,33 @@ ChromeUtils.import("resource://gre/modul
 
 var kHoursBetweenUpdates = 6;
 
 function nowUTC() {
     return cal.dtz.jsDateToDateTime(new Date()).getInTimezone(cal.dtz.UTC);
 }
 
 function newTimerWithCallback(aCallback, aDelay, aRepeating) {
-    let timer = Components.classes["@mozilla.org/timer;1"]
-                          .createInstance(Components.interfaces.nsITimer);
+    let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
 
     timer.initWithCallback(aCallback,
                            aDelay,
                            (aRepeating ? timer.TYPE_REPEATING_PRECISE : timer.TYPE_ONE_SHOT));
     return timer;
 }
 
 function calAlarmService() {
     this.wrappedJSObject = this;
 
     this.mLoadedCalendars = {};
     this.mTimerMap = {};
-    this.mObservers = new cal.data.ListenerSet(Components.interfaces.calIAlarmServiceObserver);
+    this.mObservers = new cal.data.ListenerSet(Ci.calIAlarmServiceObserver);
 
     this.calendarObserver = {
-        QueryInterface: ChromeUtils.generateQI([Components.interfaces.calIObserver]),
+        QueryInterface: ChromeUtils.generateQI([Ci.calIObserver]),
         alarmService: this,
 
         // calIObserver:
         onStartBatch: function() { },
         onEndBatch: function() { },
         onLoad: function(calendar) {
             // ignore any onLoad events until initial getItems() call of startup has finished:
             if (calendar && this.alarmService.mLoadedCalendars[calendar.id]) {
@@ -71,17 +70,17 @@ function calAlarmService() {
             }
         },
         onPropertyDeleting: function(aCalendar, aName) {
             this.onPropertyChanged(aCalendar, aName);
         }
     };
 
     this.calendarManagerObserver = {
-        QueryInterface: ChromeUtils.generateQI([Components.interfaces.calICalendarManagerObserver]),
+        QueryInterface: ChromeUtils.generateQI([Ci.calICalendarManagerObserver]),
         alarmService: this,
 
         onCalendarRegistered: function(aCalendar) {
             this.alarmService.observeCalendar(aCalendar);
             // initial refresh of alarms for new calendar:
             this.alarmService.initAlarms([aCalendar]);
         },
         onCalendarUnregistering: function(aCalendar) {
@@ -93,37 +92,34 @@ function calAlarmService() {
         onCalendarDeleting: function(aCalendar) {
             this.alarmService.unobserveCalendar(aCalendar);
             delete this.alarmService.mLoadedCalendars[aCalendar.id];
         }
     };
 }
 
 var calAlarmServiceClassID = Components.ID("{7a9200dd-6a64-4fff-a798-c5802186e2cc}");
-var calAlarmServiceInterfaces = [
-    Components.interfaces.calIAlarmService,
-    Components.interfaces.nsIObserver
-];
+var calAlarmServiceInterfaces = [Ci.calIAlarmService, Ci.nsIObserver];
 calAlarmService.prototype = {
     mRangeStart: null,
     mRangeEnd: null,
     mUpdateTimer: null,
     mStarted: false,
     mTimerMap: null,
     mObservers: null,
     mTimezone: null,
 
     classID: calAlarmServiceClassID,
     QueryInterface: cal.generateQI(calAlarmServiceInterfaces),
     classInfo: cal.generateCI({
         classID: calAlarmServiceClassID,
         contractID: "@mozilla.org/calendar/alarm-service;1",
         classDescription: "Calendar Alarm Service",
         interfaces: calAlarmServiceInterfaces,
-        flags: Components.interfaces.nsIClassInfo.SINGLETON
+        flags: Ci.nsIClassInfo.SINGLETON
     }),
 
     /**
      * nsIObserver
      */
     observe: function(aSubject, aTopic, aData) {
         // This will also be called on app-startup, but nothing is done yet, to
         // prevent unwanted dialogs etc. See bug 325476 and 413296
@@ -248,21 +244,21 @@ calAlarmService.prototype = {
                     // This is a subsequent search, so we got all the past alarms before
                     start = this.alarmService.mRangeEnd.clone();
                 } else {
                     // This is our first search for alarms.  We're going to look for
                     // alarms +/- 1 month from now.  If someone sets an alarm more than
                     // a month ahead of an event, or doesn't start Lightning
                     // for a month, they'll miss some, but that's a slim chance
                     start = now.clone();
-                    start.month -= Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS;
+                    start.month -= Ci.calIAlarmService.MAX_SNOOZE_MONTHS;
                     this.alarmService.mRangeStart = start.clone();
                 }
                 let until = now.clone();
-                until.month += Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS;
+                until.month += Ci.calIAlarmService.MAX_SNOOZE_MONTHS;
 
                 // We don't set timers for every future alarm, only those within 6 hours
                 let end = now.clone();
                 end.hour += kHoursBetweenUpdates;
                 this.alarmService.mRangeEnd = end.getInTimezone(cal.dtz.UTC);
 
                 this.alarmService.findAlarms(cal.getCalendarManager().getCalendars({}),
                                              start, until);
@@ -344,17 +340,17 @@ calAlarmService.prototype = {
             // Check for snooze
             let snoozeDate;
             if (aItem.parentItem == aItem) {
                 snoozeDate = aItem.getProperty("X-MOZ-SNOOZE-TIME");
             } else {
                 snoozeDate = aItem.parentItem.getProperty("X-MOZ-SNOOZE-TIME-" + aItem.recurrenceId.nativeTime);
             }
 
-            if (snoozeDate && !(snoozeDate instanceof Components.interfaces.calIDateTime)) {
+            if (snoozeDate && !(snoozeDate instanceof Ci.calIDateTime)) {
                 snoozeDate = cal.createDateTime(snoozeDate);
             }
 
             // an alarm can only be snoozed to a later time, if earlier it's from another alarm.
             if (snoozeDate && snoozeDate.compare(alarmDate) > 0) {
                 // If the alarm was snoozed, the snooze time is more important.
                 alarmDate = snoozeDate;
             }
@@ -488,30 +484,30 @@ calAlarmService.prototype = {
                 }
                 delete this.mTimerMap[calendar.id];
             }
         }
     },
 
     findAlarms: function(aCalendars, aStart, aUntil) {
         let getListener = {
-            QueryInterface: ChromeUtils.generateQI([Components.interfaces.calIOperationListener]),
+            QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
             alarmService: this,
             addRemovePromise: PromiseUtils.defer(),
             batchCount: 0,
             results: false,
             onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
                 this.addRemovePromise.promise.then((aValue) => {
                     // calendar has been loaded, so until now, onLoad events can be ignored:
                     this.alarmService.mLoadedCalendars[aCalendar.id] = true;
 
                     // notify observers that the alarms for the calendar have been loaded
                     this.alarmService.mObservers.notify("onAlarmsLoaded", [aCalendar]);
                 }, (aReason) => {
-                    Components.utils.reportError("Promise was rejected: " + aReason);
+                    Cu.reportError("Promise was rejected: " + aReason);
                     this.alarmService.mLoadedCalendars[aCalendar.id] = true;
                     this.alarmService.mObservers.notify("onAlarmsLoaded", [aCalendar]);
                 });
 
                 // if no results were returned we still need to resolve the promise
                 if (!this.results) {
                     this.addRemovePromise.resolve();
                 }
@@ -531,17 +527,17 @@ calAlarmService.prototype = {
                 }, () => {
                     if (--this.batchCount <= 0) {
                         promise.resolve();
                     }
                 });
             }
         };
 
-        const calICalendar = Components.interfaces.calICalendar;
+        const calICalendar = Ci.calICalendar;
         let filter = calICalendar.ITEM_FILTER_COMPLETED_ALL |
                      calICalendar.ITEM_FILTER_CLASS_OCCURRENCES |
                      calICalendar.ITEM_FILTER_TYPE_ALL;
 
         for (let calendar of aCalendars) {
             // assuming that suppressAlarms does not change anymore until refresh:
             if (!calendar.getProperty("suppressAlarms") &&
                 !calendar.getProperty("disabled")) {
@@ -565,18 +561,18 @@ calAlarmService.prototype = {
         }
 
         // Total refresh similar to startup.  We're going to look for
         // alarms +/- 1 month from now.  If someone sets an alarm more than
         // a month ahead of an event, or doesn't start Lightning
         // for a month, they'll miss some, but that's a slim chance
         let start = nowUTC();
         let until = start.clone();
-        start.month -= Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS;
-        until.month += Components.interfaces.calIAlarmService.MAX_SNOOZE_MONTHS;
+        start.month -= Ci.calIAlarmService.MAX_SNOOZE_MONTHS;
+        until.month += Ci.calIAlarmService.MAX_SNOOZE_MONTHS;
         this.findAlarms(aCalendars, start, until);
     },
 
     alarmFired: function(aItem, aAlarm) {
         if (!aItem.calendar.getProperty("suppressAlarms") &&
             !aItem.calendar.getProperty("disabled") &&
             aItem.getProperty("STATUS") != "CANCELLED") {
             this.mObservers.notify("onAlarm", [aItem, aAlarm]);
--- a/calendar/base/src/calApplicationUtils.js
+++ b/calendar/base/src/calApplicationUtils.js
@@ -19,25 +19,24 @@ function launchBrowser(url, event) {
         return;
     }
 
     // 0. Prevent people from trying to launch URLs such as javascript:foo();
     //    by only allowing URLs starting with http or https.
     // XXX: We likely will want to do this using nsIURLs in the future to
     //      prevent sneaky nasty escaping issues, but this is fine for now.
     if (!url.startsWith("http")) {
-        Components.utils.reportError("launchBrowser: " +
-                                     "Invalid URL provided: " + url +
-                                     " Only http:// and https:// URLs are valid.");
+        Cu.reportError("launchBrowser: Invalid URL provided: " + url +
+                       " Only http:// and https:// URLs are valid.");
         return;
     }
 
-    Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
-              .getService(Components.interfaces.nsIExternalProtocolService)
-              .loadURI(Services.io.newURI(url));
+    Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+        .getService(Ci.nsIExternalProtocolService)
+        .loadURI(Services.io.newURI(url));
 
     // Make sure that any default click handlers don't do anything, we have taken
     // care of all processing
     if (event) {
         event.stopPropagation();
         event.preventDefault();
     }
 }
--- a/calendar/base/src/calAttachment.js
+++ b/calendar/base/src/calAttachment.js
@@ -17,21 +17,21 @@ calAttachment.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.calIAttachment]),
     classID: Components.ID("{5f76b352-ab75-4c2b-82c9-9206dbbf8571}"),
 
     mData: null,
     mHashId: null,
 
     get hashId() {
         if (!this.mHashId) {
-            let cryptoHash = Components.classes["@mozilla.org/security/hash;1"]
-                                       .createInstance(Components.interfaces.nsICryptoHash);
+            let cryptoHash = Cc["@mozilla.org/security/hash;1"]
+                               .createInstance(Ci.nsICryptoHash);
 
-            let converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
-                                      .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+            let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                              .createInstance(Ci.nsIScriptableUnicodeConverter);
             converter.charset = "UTF-8";
             let data = converter.convertToByteArray(this.rawData, {});
 
             cryptoHash.init(cryptoHash.MD5);
             cryptoHash.update(data, data.length);
             this.mHashId = cryptoHash.finish(true);
         }
         return this.mHashId;
@@ -90,17 +90,17 @@ calAttachment.prototype = {
 
     get icalProperty() {
         let icalatt = cal.getIcsService().createIcalProperty("ATTACH");
 
         for (let [key, value] of this.mProperties.entries()) {
             try {
                 icalatt.setParameter(key, value);
             } catch (e) {
-                if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
+                if (e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
                     // Illegal values should be ignored, but we could log them if
                     // the user has enabled logging.
                     cal.LOG("Warning: Invalid attachment parameter value " + key + "=" + value);
                 } else {
                     throw e;
                 }
             }
         }
@@ -124,17 +124,17 @@ calAttachment.prototype = {
 
     get icalString() {
         let comp = this.icalProperty;
         return (comp ? comp.icalString : "");
     },
     set icalString(val) {
         let prop = cal.getIcsService().createIcalPropertyFromString(val);
         if (prop.propertyName != "ATTACH") {
-            throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+            throw Cr.NS_ERROR_ILLEGAL_VALUE;
         }
         this.icalProperty = prop;
         return val;
     },
 
     getParameter: function(aName) {
         return this.mProperties.get(aName);
     },
--- a/calendar/base/src/calAttendee.js
+++ b/calendar/base/src/calAttendee.js
@@ -13,17 +13,17 @@ calAttendee.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.calIAttendee]),
     classID: Components.ID("{5c8dcaa3-170c-4a73-8142-d531156f664d}"),
 
     mImmutable: false,
     get isMutable() { return !this.mImmutable; },
 
     modify: function() {
         if (this.mImmutable) {
-            throw Components.results.NS_ERROR_OBJECT_IS_IMMUTABLE;
+            throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
         }
     },
 
     makeImmutable: function() {
         this.mImmutable = true;
     },
 
     clone: function() {
@@ -90,40 +90,40 @@ calAttendee.prototype = {
         let icalatt;
         if (this.mIsOrganizer) {
             icalatt = icssvc.createIcalProperty("ORGANIZER");
         } else {
             icalatt = icssvc.createIcalProperty("ATTENDEE");
         }
 
         if (!this.id) {
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
+            throw Cr.NS_ERROR_NOT_INITIALIZED;
         }
         icalatt.valueAsIcalString = this.id;
         for (let i = 0; i < this.icalAttendeePropMap.length; i++) {
             let prop = this.icalAttendeePropMap[i];
             if (this[prop.cal]) {
                 try {
                     icalatt.setParameter(prop.ics, this[prop.cal]);
                 } catch (e) {
-                    if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
+                    if (e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
                         // Illegal values should be ignored, but we could log them if
                         // the user has enabled logging.
                         cal.LOG("Warning: Invalid attendee parameter value " + prop.ics + "=" + this[prop.cal]);
                     } else {
                         throw e;
                     }
                 }
             }
         }
         for (let [key, value] of this.mProperties.entries()) {
             try {
                 icalatt.setParameter(key, value);
             } catch (e) {
-                if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
+                if (e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
                     // Illegal values should be ignored, but we could log them if
                     // the user has enabled logging.
                     cal.LOG("Warning: Invalid attendee parameter value " + key + "=" + value);
                 } else {
                     throw e;
                 }
             }
         }
@@ -132,17 +132,17 @@ calAttendee.prototype = {
 
     get icalString() {
         let comp = this.icalProperty;
         return (comp ? comp.icalString : "");
     },
     set icalString(val) {
         let prop = cal.getIcsService().createIcalPropertyFromString(val);
         if (prop.propertyName != "ORGANIZER" && prop.propertyName != "ATTENDEE") {
-            throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+            throw Cr.NS_ERROR_ILLEGAL_VALUE;
         }
         this.icalProperty = prop;
         return val;
     },
 
     get properties() { return this.mProperties.entries(); },
 
     // The has/get/set/deleteProperty methods are case-insensitive.
--- a/calendar/base/src/calCachedCalendar.js
+++ b/calendar/base/src/calCachedCalendar.js
@@ -1,22 +1,22 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 
-var calICalendar = Components.interfaces.calICalendar;
-var cICL = Components.interfaces.calIChangeLog;
-var cIOL = Components.interfaces.calIOperationListener;
+var calICalendar = Ci.calICalendar;
+var cICL = Ci.calIChangeLog;
+var cIOL = Ci.calIOperationListener;
 
 var gNoOpListener = {
-    QueryInterface: ChromeUtils.generateQI([Components.interfaces.calIOperationListener]),
+    QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
     onGetResult: function(calendar, status, itemType, detail, count, items) {
     },
 
     onOperationComplete: function(calendar, status, opType, id, detail) {
     }
 };
 
 /**
@@ -38,29 +38,29 @@ function isUnavailableCode(result) {
         !Components.isSuccessCode(result)) {
         // This is a network error, which most likely means we should
         // retry it some time.
         return true;
     }
 
     // Other potential errors we want to retry with
     switch (result) {
-        case Components.results.NS_ERROR_NOT_AVAILABLE:
+        case Cr.NS_ERROR_NOT_AVAILABLE:
             return true;
         default:
             return false;
     }
 }
 
 function calCachedCalendarObserverHelper(home, isCachedObserver) {
     this.home = home;
     this.isCachedObserver = isCachedObserver;
 }
 calCachedCalendarObserverHelper.prototype = {
-    QueryInterface: ChromeUtils.generateQI([Components.interfaces.calIObserver]),
+    QueryInterface: ChromeUtils.generateQI([Ci.calIObserver]),
     isCachedObserver: false,
 
     onStartBatch: function() {
         this.home.mObservers.notify("onStartBatch");
     },
 
     onEndBatch: function() {
         this.home.mObservers.notify("onEndBatch");
@@ -114,39 +114,39 @@ calCachedCalendarObserverHelper.prototyp
             this.home.mObservers.notify("onPropertyDeleting", [this.home, aName]);
         }
     }
 };
 
 function calCachedCalendar(uncachedCalendar) {
     this.wrappedJSObject = this;
     this.mSyncQueue = [];
-    this.mObservers = new cal.data.ObserverSet(Components.interfaces.calIObserver);
+    this.mObservers = new cal.data.ObserverSet(Ci.calIObserver);
     uncachedCalendar.superCalendar = this;
     uncachedCalendar.addObserver(new calCachedCalendarObserverHelper(this, false));
     this.mUncachedCalendar = uncachedCalendar;
     this.setupCachedCalendar();
     if (this.supportsChangeLog) {
         uncachedCalendar.offlineStorage = this.mCachedCalendar;
     }
     this.offlineCachedItems = {};
     this.offlineCachedItemFlags = {};
 }
 calCachedCalendar.prototype = {
     /* eslint-disable mozilla/use-chromeutils-generateqi */
     QueryInterface: function(aIID) {
-        if (aIID.equals(Components.interfaces.calISchedulingSupport) &&
+        if (aIID.equals(Ci.calISchedulingSupport) &&
             this.mUncachedCalendar.QueryInterface(aIID)) {
             // check whether uncached calendar supports it:
             return this;
-        } else if (aIID.equals(Components.interfaces.calICalendar) ||
-                   aIID.equals(Components.interfaces.nsISupports)) {
+        } else if (aIID.equals(Ci.calICalendar) ||
+                   aIID.equals(Ci.nsISupports)) {
             return this;
         } else {
-            throw Components.results.NS_ERROR_NO_INTERFACE;
+            throw Cr.NS_ERROR_NO_INTERFACE;
         }
     },
     /* eslint-enable mozilla/use-chromeutils-generateqi */
 
     mCachedCalendar: null,
     mCachedObserver: null,
     mUncachedCalendar: null,
     mObservers: null,
@@ -162,42 +162,42 @@ calCachedCalendar.prototype = {
             // afterwards.
 
             let listener = {
                 onDeleteCalendar: function(aCalendar, aStatus, aDetail) {
                     self.mCachedCalendar = null;
                 }
             };
 
-            this.mCachedCalendar.QueryInterface(Components.interfaces.calICalendarProvider)
+            this.mCachedCalendar.QueryInterface(Ci.calICalendarProvider)
                                 .deleteCalendar(this.mCachedCalendar, listener);
         }
     },
 
     setupCachedCalendar: function() {
         try {
             if (this.mCachedCalendar) { // this is actually a resetupCachedCalendar:
                 // Although this doesn't really follow the spec, we know the
                 // storage calendar's deleteCalendar method is synchronous.
                 // TODO put changes into a different calendar and delete
                 // afterwards.
-                this.mCachedCalendar.QueryInterface(Components.interfaces.calICalendarProvider)
+                this.mCachedCalendar.QueryInterface(Ci.calICalendarProvider)
                                     .deleteCalendar(this.mCachedCalendar, null);
                 if (this.supportsChangeLog) {
                     // start with full sync:
                     this.mUncachedCalendar.resetLog();
                 }
             } else {
                 let calType = Preferences.get("calendar.cache.type", "storage");
                 // While technically, the above deleteCalendar should delete the
                 // whole calendar, this is nothing more than deleting all events
                 // todos and properties. Therefore the initialization can be
                 // skipped.
-                let cachedCalendar = Components.classes["@mozilla.org/calendar/calendar;1?type=" + calType]
-                                               .createInstance(Components.interfaces.calICalendar);
+                let cachedCalendar = Cc["@mozilla.org/calendar/calendar;1?type=" + calType]
+                                       .createInstance(Ci.calICalendar);
                 switch (calType) {
                     case "memory": {
                         if (this.supportsChangeLog) {
                             // start with full sync:
                             this.mUncachedCalendar.resetLog();
                         }
                         break;
                     }
@@ -217,25 +217,25 @@ calCachedCalendar.prototype = {
                 cachedCalendar.superCalendar = this;
                 if (!this.mCachedObserver) {
                     this.mCachedObserver = new calCachedCalendarObserverHelper(this, true);
                 }
                 cachedCalendar.addObserver(this.mCachedObserver);
                 this.mCachedCalendar = cachedCalendar;
             }
         } catch (exc) {
-            Components.utils.reportError(exc);
+            Cu.reportError(exc);
         }
     },
 
     getOfflineAddedItems: function(callbackFunc) {
         let self = this;
         self.offlineCachedItems = {};
         let getListener = {
-            QueryInterface: ChromeUtils.generateQI([Components.interfaces.calIOperationListener]),
+            QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
             onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
                 for (let item of aItems) {
                     self.offlineCachedItems[item.hashId] = item;
                     self.offlineCachedItemFlags[item.hashId] = cICL.OFFLINE_FLAG_CREATED_RECORD;
                 }
             },
 
             onOperationComplete: function(aCalendar, aStatus, aOpType, aId, aDetail) {
@@ -244,17 +244,17 @@ calCachedCalendar.prototype = {
         };
         this.mCachedCalendar.getItems(calICalendar.ITEM_FILTER_ALL_ITEMS | calICalendar.ITEM_FILTER_OFFLINE_CREATED,
                                       0, null, null, getListener);
     },
 
     getOfflineModifiedItems: function(callbackFunc) {
         let self = this;
         let getListener = {
-            QueryInterface: ChromeUtils.generateQI([Components.interfaces.calIOperationListener]),
+            QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
             onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
                 for (let item of aItems) {
                     self.offlineCachedItems[item.hashId] = item;
                     self.offlineCachedItemFlags[item.hashId] = cICL.OFFLINE_FLAG_MODIFIED_RECORD;
                 }
             },
 
             onOperationComplete: function(aCalendar, aStatus, aOpType, aId, aDetail) {
@@ -263,17 +263,17 @@ calCachedCalendar.prototype = {
         };
         this.mCachedCalendar.getItems(calICalendar.ITEM_FILTER_OFFLINE_MODIFIED | calICalendar.ITEM_FILTER_ALL_ITEMS,
                                       0, null, null, getListener);
     },
 
     getOfflineDeletedItems: function(callbackFunc) {
         let self = this;
         let getListener = {
-            QueryInterface: ChromeUtils.generateQI([Components.interfaces.calIOperationListener]),
+            QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
             onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
                 for (let item of aItems) {
                     self.offlineCachedItems[item.hashId] = item;
                     self.offlineCachedItemFlags[item.hashId] = cICL.OFFLINE_FLAG_DELETED_RECORD;
                 }
             },
 
             onOperationComplete: function(aCalendar, aStatus, aOpType, aId, aDetail) {
@@ -286,17 +286,17 @@ calCachedCalendar.prototype = {
                                       0, null, null, getListener);
     },
 
     mPendingSync: null,
     mSyncQueue: null,
     synchronize: function(respFunc) {
         let self = this;
         if (this.getProperty("disabled")) {
-            return emptyQueue(Components.results.NS_OK);
+            return emptyQueue(Cr.NS_OK);
         }
 
         this.mSyncQueue.push(respFunc);
         if (this.mSyncQueue.length > 1) { // don't use mPendingSync here
             cal.LOG("[calCachedCalendar] sync in action/pending.");
             return this.mPendingSync;
         }
 
@@ -313,25 +313,25 @@ calCachedCalendar.prototype = {
             queue.forEach(execResponseFunc);
             cal.LOG("[calCachedCalendar] sync queue empty.");
             let operation = self.mPendingSync;
             self.mPendingSync = null;
             return operation;
         }
 
         if (this.offline) {
-            return emptyQueue(Components.results.NS_OK);
+            return emptyQueue(Cr.NS_OK);
         }
 
         if (this.supportsChangeLog) {
             cal.LOG("[calCachedCalendar] Doing changelog based sync for calendar " + this.uri.spec);
             let opListener = {
                 onResult: function(operation, result) {
                     if (!operation || !operation.isPending) {
-                        let status = (operation ? operation.status : Components.results.NS_OK);
+                        let status = (operation ? operation.status : Cr.NS_OK);
                         if (!Components.isSuccessCode(status)) {
                             cal.ERROR("[calCachedCalendar] replay action failed: " +
                                       (operation ? operation.id : "<unknown>") + ", uri=" +
                                       self.uri.spec + ", result=" +
                                       result + ", operation=" + operation);
                         }
                         cal.LOG("[calCachedCalendar] replayChangesOn finished.");
                         emptyQueue(status);
@@ -339,17 +339,17 @@ calCachedCalendar.prototype = {
                 }
             };
             this.mPendingSync = this.mUncachedCalendar.replayChangesOn(opListener);
             return this.mPendingSync;
         }
 
         cal.LOG("[calCachedCalendar] Doing full sync for calendar " + this.uri.spec);
         let completeListener = {
-            QueryInterface: ChromeUtils.generateQI([Components.interfaces.calIOperationListener]),
+            QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
             modifiedTimes: {},
             hasRenewedCalendar: false,
             getsCompleted: 0,
             getsReceived: 0,
             opCompleted: false,
 
             onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
                 if (Components.isSuccessCode(aStatus)) {
@@ -437,17 +437,17 @@ calCachedCalendar.prototype = {
                 } else {
                     self.playbackOfflineItems(() => self.mCachedObserver.onLoad(self.mCachedCalendar));
                     emptyQueue(aStatus);
                 }
             }
         };
 
         this.getOfflineAddedItems(() => {
-            this.mPendingSync = this.mUncachedCalendar.getItems(Components.interfaces.calICalendar.ITEM_FILTER_ALL_ITEMS,
+            this.mPendingSync = this.mUncachedCalendar.getItems(Ci.calICalendar.ITEM_FILTER_ALL_ITEMS,
                                                                     0, null, null, completeListener);
         });
         return this.mPendingSync;
     },
 
     onOfflineStatusChanged: function(aNewState) {
         if (aNewState) {
             // Going offline: (XXX get items before going offline?) => we may ask the user to stay online a bit longer
@@ -476,17 +476,17 @@ calCachedCalendar.prototype = {
      * @param aPlaybackType     (optional) The starting operation type. This function will be
      *                          called recursively through playback operations in the order of
      *                          add, modify, delete. By default playback will start with the add
      *                          operation. Valid values for this parameter are defined as
      *                          OFFLINE_FLAG_XXX constants in the calIChangeLog interface.
      */
     playbackOfflineItems: function(aCallback, aPlaybackType) {
         let self = this;
-        let storage = this.mCachedCalendar.QueryInterface(Components.interfaces.calIOfflineStorage);
+        let storage = this.mCachedCalendar.QueryInterface(Ci.calIOfflineStorage);
 
         let resetListener = gNoOpListener;
         let itemQueue = [];
         let debugOp;
         let nextCallback;
         let uncachedOp;
         let listenerOp;
         let filter;
@@ -590,17 +590,17 @@ calCachedCalendar.prototype = {
     set superCalendar(val) {
         return (this.mSuperCalendar = val);
     },
 
     get offline() {
         return Services.io.offline;
     },
     get supportsChangeLog() {
-        return (cal.wrapInstance(this.mUncachedCalendar, Components.interfaces.calIChangeLog) != null);
+        return (cal.wrapInstance(this.mUncachedCalendar, Ci.calIChangeLog) != null);
     },
 
     get canRefresh() { // enable triggering sync using the reload button
         return true;
     },
 
     getProperty: function(aName) {
         switch (aName) {
@@ -688,17 +688,17 @@ calCachedCalendar.prototype = {
     adoptOfflineItem: function(item, listener) {
         let self = this;
         let opListener = {
             onGetResult: function(calendar, status, itemType, detail, count, items) {
                 cal.ASSERT(false, "unexpected!");
             },
             onOperationComplete: function(calendar, status, opType, id, detail) {
                 if (Components.isSuccessCode(status)) {
-                    let storage = self.mCachedCalendar.QueryInterface(Components.interfaces.calIOfflineStorage);
+                    let storage = self.mCachedCalendar.QueryInterface(Ci.calIOfflineStorage);
                     storage.addOfflineItem(detail, listener);
                 } else if (listener) {
                     listener.onOperationComplete(self, status, opType, id, detail);
                 }
             }
         };
         this.mCachedCalendar.adoptItem(item, opListener);
     },
@@ -766,17 +766,17 @@ calCachedCalendar.prototype = {
         let opListener = {
             onGetResult: function(calendar, status, itemType, detail, count, items) {
                 cal.ASSERT(false, "unexpected!");
             },
             onOperationComplete: function(calendar, status, opType, id, detail) {
                 if (Components.isSuccessCode(status)) {
                     // Modify the offline item in the storage, passing the
                     // listener will make sure its notified
-                    let storage = self.mCachedCalendar.QueryInterface(Components.interfaces.calIOfflineStorage);
+                    let storage = self.mCachedCalendar.QueryInterface(Ci.calIOfflineStorage);
                     storage.modifyOfflineItem(detail, listener);
                 } else if (listener) {
                     // If there was not a success, then we need to notify the
                     // listener ourselves
                     listener.onOperationComplete(self, status, opType, id, detail);
                 }
             }
         };
@@ -823,17 +823,17 @@ calCachedCalendar.prototype = {
                     cal.LOG("[calCachedCalendar] Calendar " + calendar.name + " is unavailable, deleting item offline");
                     self.deleteOfflineItem(item, listener);
                 } else if (Components.isSuccessCode(status)) {
                     // On success, delete the item from the cache
                     self.mCachedCalendar.deleteItem(item, listener);
 
                     // Also, remove any meta data associated with the item
                     try {
-                        let storage = self.mCachedCalendar.QueryInterface(Components.interfaces.calISyncWriteCalendar);
+                        let storage = self.mCachedCalendar.QueryInterface(Ci.calISyncWriteCalendar);
                         storage.deleteMetaData(item.id);
                     } catch (e) {
                         cal.LOG("[calCachedCalendar] Offline storage doesn't support metadata");
                     }
                 } else if (listener) {
                     // This happens on error, forward the error through the listener
                     listener.onOperationComplete(self, status, opType, id, detail);
                 }
@@ -846,17 +846,17 @@ calCachedCalendar.prototype = {
         } else {
             // Otherwise, get the item flags, the listener will further
             // process the item.
             this.mCachedCalendar.getItemOfflineFlag(item, flagListener);
         }
     },
     deleteOfflineItem: function(item, listener) {
         /* We do not delete the item from the cache, as we will need it when reconciling the cache content and the server content. */
-        let storage = this.mCachedCalendar.QueryInterface(Components.interfaces.calIOfflineStorage);
+        let storage = this.mCachedCalendar.QueryInterface(Ci.calIOfflineStorage);
         storage.deleteOfflineItem(item, listener);
     }
 };
 (function() {
     function defineForwards(proto, targetName, functions, getters, gettersAndSetters) {
         function defineForwardGetter(attr) {
             proto.__defineGetter__(attr, function() { return this[targetName][attr]; });
         }
--- a/calendar/base/src/calCalendarManager.js
+++ b/calendar/base/src/calCalendarManager.js
@@ -9,35 +9,31 @@ var { cal } = ChromeUtils.import("resour
 
 var REGISTRY_BRANCH = "calendar.registry.";
 var DB_SCHEMA_VERSION = 10;
 var MAX_INT = Math.pow(2, 31) - 1;
 var MIN_INT = -MAX_INT;
 
 function calCalendarManager() {
     this.wrappedJSObject = this;
-    this.mObservers = new cal.data.ListenerSet(Components.interfaces.calICalendarManagerObserver);
-    this.mCalendarObservers = new cal.data.ListenerSet(Components.interfaces.calIObserver);
+    this.mObservers = new cal.data.ListenerSet(Ci.calICalendarManagerObserver);
+    this.mCalendarObservers = new cal.data.ListenerSet(Ci.calIObserver);
 }
 
 var calCalendarManagerClassID = Components.ID("{f42585e7-e736-4600-985d-9624c1c51992}");
-var calCalendarManagerInterfaces = [
-    Components.interfaces.calICalendarManager,
-    Components.interfaces.calIStartupService,
-    Components.interfaces.nsIObserver,
-];
+var calCalendarManagerInterfaces = [Ci.calICalendarManager, Ci.calIStartupService, Ci.nsIObserver];
 calCalendarManager.prototype = {
     classID: calCalendarManagerClassID,
     QueryInterface: cal.generateQI(calCalendarManagerInterfaces),
     classInfo: cal.generateCI({
         classID: calCalendarManagerClassID,
         contractID: "@mozilla.org/calendar/manager;1",
         classDescription: "Calendar Manager",
         interfaces: calCalendarManagerInterfaces,
-        flags: Components.interfaces.nsIClassInfo.SINGLETON
+        flags: Ci.nsIClassInfo.SINGLETON
     }),
 
     get networkCalendarCount() { return this.mNetworkCalendarCount; },
     get readOnlyCalendarCount() { return this.mReadonlyCalendarCount; },
     get calendarCount() { return this.mCalendarCount; },
 
     // calIStartupService:
     startup: function(aCompleteListener) {
@@ -54,17 +50,17 @@ calCalendarManager.prototype = {
         Services.obs.addObserver(this, "http-on-modify-request");
 
         // We only add the observer if the pref is set and only check for the
         // pref on startup to avoid checking for every http request
         if (Preferences.get("calendar.network.multirealm", false)) {
             Services.obs.addObserver(this, "http-on-examine-response");
         }
 
-        aCompleteListener.onResult(null, Components.results.NS_OK);
+        aCompleteListener.onResult(null, Cr.NS_OK);
     },
 
     shutdown: function(aCompleteListener) {
         for (let id in this.mCache) {
             let calendar = this.mCache[id];
             calendar.removeObserver(this.mCalObservers[calendar.id]);
         }
 
@@ -76,17 +72,17 @@ calCalendarManager.prototype = {
 
         // Remove the observer if the pref is set. This might fail when the
         // user flips the pref, but we assume he is going to restart anyway
         // afterwards.
         if (Preferences.get("calendar.network.multirealm", false)) {
             Services.obs.removeObserver(this, "http-on-examine-response");
         }
 
-        aCompleteListener.onResult(null, Components.results.NS_OK);
+        aCompleteListener.onResult(null, Cr.NS_OK);
     },
 
 
     setupOfflineObservers: function() {
         Services.obs.addObserver(this, "network:offline-status-changed");
     },
 
     cleanupOfflineObservers: function() {
@@ -110,68 +106,68 @@ calCalendarManager.prototype = {
                     if (calendar instanceof calCachedCalendar) {
                         calendar.onOfflineStatusChanged(aData == "offline");
                     }
                 }
                 break;
             }
             case "http-on-examine-response": {
                 try {
-                    let channel = aSubject.QueryInterface(Components.interfaces.nsIHttpChannel);
+                    let channel = aSubject.QueryInterface(Ci.nsIHttpChannel);
                     if (channel.notificationCallbacks) {
                         // We use the notification callbacks to get the calendar interface,
                         // which likely works for our requests since getInterface is called
                         // from the calendar provider context.
                         let authHeader = channel.getResponseHeader("WWW-Authenticate");
                         let calendar = channel.notificationCallbacks
-                                              .getInterface(Components.interfaces.calICalendar);
+                                              .getInterface(Ci.calICalendar);
                         if (calendar && !calendar.getProperty("capabilities.realmrewrite.disabled")) {
                             // The provider may choose to explicitly disable the
                             // rewriting, for example if all calendars on a
                             // domain have the same credentials
                             let escapedName = calendar.name.replace(/\\/g, "\\\\")
                                                            .replace(/"/g, '\\"');
                             authHeader = appendToRealm(authHeader, "(" + escapedName + ")");
                             channel.setResponseHeader("WWW-Authenticate", authHeader, false);
                         }
                     }
                 } catch (e) {
-                    if (e.result != Components.results.NS_NOINTERFACE &&
-                        e.result != Components.results.NS_ERROR_NOT_AVAILABLE) {
+                    if (e.result != Cr.NS_NOINTERFACE &&
+                        e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
                         throw e;
                     }
                     // Possible reasons we got here:
                     // - Its not a http channel (wtf? Oh well)
                     // - The owner is not a calICalendar (looks like its not our deal)
                     // - The WWW-Authenticate header is missing (thats ok)
                 }
                 break;
             }
             case "http-on-modify-request": {
                 // Unfortunately, the ability to do this with a general pref has
                 // been removed. Calendar servers might still want to know what
                 // client is used for access, so add our UA String to each
                 // request.
-                let httpChannel = aSubject.QueryInterface(Components.interfaces.nsIHttpChannel);
+                let httpChannel = aSubject.QueryInterface(Ci.nsIHttpChannel);
                 try {
                     // NOTE: For some reason, this observer call doesn't have
                     // the "cal" namespace defined
                     let userAgent = httpChannel.getRequestHeader("User-Agent");
                     let calUAString = Preferences.get("calendar.useragent.extra", "").trim();
 
                     // Don't add an empty string or an already included token.
                     if (calUAString && !userAgent.includes(calUAString)) {
                         // User-Agent is not a mergeable header. We need to
                         // merge the user agent ourselves.
                         httpChannel.setRequestHeader("User-Agent",
                                                      userAgent + " " + calUAString,
                                                      false);
                     }
                 } catch (e) {
-                    if (e.result != Components.results.NS_ERROR_NOT_AVAILABLE) {
+                    if (e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
                         throw e;
                     }
                     // We swallow this error since it means the User Agent
                     // header is not set. We don't want to force it to be set.
                 }
                 break;
             }
         }
@@ -311,21 +307,21 @@ calCalendarManager.prototype = {
             flushPrefs();
         } finally {
             selectPrefs.reset();
             selectCalendars.reset();
         }
     },
 
     checkAndMigrateDB: function() {
-        let storageSdb = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+        let storageSdb = Services.dirsvc.get("ProfD", Ci.nsIFile);
         storageSdb.append("storage.sdb");
         let db = Services.storage.openDatabase(storageSdb);
 
-        db.defaultTransactionType = Components.interfaces.mozIStorageConnection.TRANSACTION_EXCLUSIVE;
+        db.defaultTransactionType = Ci.mozIStorageConnection.TRANSACTION_EXCLUSIVE;
         db.beginTransaction();
         try {
             if (db.tableExists("cal_calendars_prefs")) {
                 // Check if we need to upgrade:
                 let version = this.getSchemaVersion(db);
                 if (version < DB_SCHEMA_VERSION) {
                     this.upgradeDB(version, db);
                 }
@@ -382,17 +378,17 @@ calCalendarManager.prototype = {
                 // This is the only place to leave this function gracefully.
                 return version;
             }
         } catch (e) {
             if (stmt) {
                 stmt.reset();
             }
             cal.ERROR("++++++++++++ calMgrGetSchemaVersion() error: " + db.lastErrorString);
-            Components.utils.reportError("Error getting calendar schema version! DB Error: " + db.lastErrorString);
+            Cu.reportError("Error getting calendar schema version! DB Error: " + db.lastErrorString);
             throw e;
         }
 
         throw table + " SELECT returned no results";
     },
 
     //
     // / DB migration code ends here
@@ -421,60 +417,59 @@ calCalendarManager.prototype = {
                             null, // No second button text
                             null, // No third button text
                             null, // No checkbox
                             { value: false }); // Unnecessary checkbox state
 
         // Disable Lightning
         AddonManager.getAddonByID("{e2fda1a4-762b-4020-b5ad-a41df1933103}", (aAddon) => {
             aAddon.userDisabled = true;
-            Services.startup.quit(Components.interfaces.nsIAppStartup.eRestart |
-                Components.interfaces.nsIAppStartup.eForceQuit);
+            Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eForceQuit);
         });
     },
 
     /**
      * calICalendarManager interface
      */
     createCalendar: function(type, uri) {
         try {
-            if (!Components.classes["@mozilla.org/calendar/calendar;1?type=" + type]) {
+            if (!Cc["@mozilla.org/calendar/calendar;1?type=" + type]) {
                 // Don't notify the user with an extra dialog if the provider
                 // interface is missing.
                 return null;
             }
-            let calendar = Components.classes["@mozilla.org/calendar/calendar;1?type=" + type]
-                                     .createInstance(Components.interfaces.calICalendar);
+            let calendar = Cc["@mozilla.org/calendar/calendar;1?type=" + type]
+                             .createInstance(Ci.calICalendar);
             calendar.uri = uri;
             return calendar;
         } catch (ex) {
             let rc = ex;
             let uiMessage = ex;
-            if (ex instanceof Components.interfaces.nsIException) {
+            if (ex instanceof Ci.nsIException) {
                 rc = ex.result;
                 uiMessage = ex.message;
             }
             switch (rc) {
-                case Components.interfaces.calIErrors.STORAGE_UNKNOWN_SCHEMA_ERROR:
+                case Ci.calIErrors.STORAGE_UNKNOWN_SCHEMA_ERROR:
                     // For now we alert and quit on schema errors like we've done before:
                     this.alertAndQuit();
                     return null;
-                case Components.interfaces.calIErrors.STORAGE_UNKNOWN_TIMEZONES_ERROR:
+                case Ci.calIErrors.STORAGE_UNKNOWN_TIMEZONES_ERROR:
                     uiMessage = cal.l10n.getCalString("unknownTimezonesError", [uri.spec]);
                     break;
                 default:
                     uiMessage = cal.l10n.getCalString("unableToCreateProvider", [uri.spec]);
                     break;
             }
             // Log the original exception via error console to provide more debug info
             cal.ERROR(ex);
 
             // Log the possibly translated message via the UI.
-            let paramBlock = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
-                                       .createInstance(Components.interfaces.nsIDialogParamBlock);
+            let paramBlock = Cc["@mozilla.org/embedcomp/dialogparam;1"]
+                               .createInstance(Ci.nsIDialogParamBlock);
             paramBlock.SetNumberStrings(3);
             paramBlock.SetString(0, uiMessage);
             paramBlock.SetString(1, "0x" + rc.toString(0x10));
             paramBlock.SetString(2, ex);
             Services.ww.openWindow(null,
                                    "chrome://calendar/content/calendar-error-prompt.xul",
                                    "_blank",
                                    "chrome,dialog=yes,alwaysRaised=yes",
@@ -541,24 +536,23 @@ calCalendarManager.prototype = {
         if (refreshInterval === null) {
             // Default to 30 minutes, in case the value is missing
             refreshInterval = 30;
         }
 
         this.clearRefreshTimer(aCalendar);
 
         if (refreshInterval > 0) {
-            this.mRefreshTimer[aCalendar.id] =
-                Components.classes["@mozilla.org/timer;1"]
-                          .createInstance(Components.interfaces.nsITimer);
+            this.mRefreshTimer[aCalendar.id] = Cc["@mozilla.org/timer;1"]
+                                                 .createInstance(Ci.nsITimer);
 
             this.mRefreshTimer[aCalendar.id]
                 .initWithCallback(new timerCallback(aCalendar),
                                   refreshInterval * 60000,
-                                  Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
+                                  Ci.nsITimer.TYPE_REPEATING_SLACK);
         }
     },
 
     clearRefreshTimer: function(aCalendar) {
         if (aCalendar.id in this.mRefreshTimer &&
             this.mRefreshTimer[aCalendar.id]) {
             this.mRefreshTimer[aCalendar.id].cancel();
             delete this.mRefreshTimer[aCalendar.id];
@@ -589,17 +583,17 @@ calCalendarManager.prototype = {
             this.mNetworkCalendarCount--;
         }
         this.mCalendarCount--;
 
         this.clearRefreshTimer(calendar);
     },
 
     removeCalendar: function(calendar, mode=0) {
-        const cICM = Components.interfaces.calICalendarManager;
+        const cICM = Ci.calICalendarManager;
 
         let removeModes = new Set(calendar.getProperty("capabilities.removeModes") || ["unsubscribe"]);
         if (!removeModes.has("unsubscribe") && !removeModes.has("delete")) {
             // Removing is not allowed
             return;
         }
 
         if ((mode & cICM.REMOVE_NO_UNREGISTER) && this.mCache &&
@@ -610,17 +604,17 @@ calCalendarManager.prototype = {
         }
 
         // This observer notification needs to be fired for both unsubscribe
         // and delete, we don't differ this at the moment.
         this.notifyObservers("onCalendarDeleting", [calendar]);
 
         // For deleting, we also call the deleteCalendar method from the provider.
         if (removeModes.has("delete") && (mode & cICM.REMOVE_NO_DELETE) == 0) {
-            let wrappedCalendar = cal.wrapInstance(calendar, Components.interfaces.calICalendarProvider);
+            let wrappedCalendar = cal.wrapInstance(calendar, Ci.calICalendarProvider);
             if (!wrappedCalendar) {
                 throw new Components.Exception("Calendar is missing a provider implementation for delete");
             }
 
             wrappedCalendar.deleteCalendar(calendar, null);
         }
     },
 
@@ -791,18 +785,18 @@ function calMgrCalendarObserver(calendar
 }
 
 calMgrCalendarObserver.prototype = {
     calendar: null,
     storedReadOnly: null,
     calMgr: null,
 
     QueryInterface: ChromeUtils.generateQI([
-        Components.interfaces.nsIWindowMediatorListener,
-        Components.interfaces.calIObserver
+        Ci.nsIWindowMediatorListener,
+        Ci.calIObserver
     ]),
 
     // calIObserver:
     onStartBatch: function() { return this.calMgr.notifyCalendarObservers("onStartBatch", arguments); },
     onEndBatch: function() { return this.calMgr.notifyCalendarObservers("onEndBatch", arguments); },
     onLoad: function(calendar) { return this.calMgr.notifyCalendarObservers("onLoad", arguments); },
     onAddItem: function(aItem) { return this.calMgr.notifyCalendarObservers("onAddItem", arguments); },
     onModifyItem: function(aNewItem, aOldItem) { return this.calMgr.notifyCalendarObservers("onModifyItem", arguments); },
@@ -831,17 +825,17 @@ calMgrCalendarObserver.prototype = {
                 if (!aValue && aCalendar.canRefresh) {
                     aCalendar.refresh();
                 }
                 break;
         }
     },
 
     changeCalendarCache: function(aCalendar, aName, aValue, aOldValue) {
-        const cICM = Components.interfaces.calICalendarManager;
+        const cICM = Ci.calICalendarManager;
         aOldValue = aOldValue || false;
         aValue = aValue || false;
 
         // hack for bug 1182264 to deal with calendars, which have set cache.enabled, but in fact do
         // not support caching (like storage calendars) - this also prevents enabling cache again
         if (aCalendar.getProperty("cache.supported") === false) {
             if (aCalendar.getProperty("cache.enabled") === true) {
                 aCalendar.deleteProperty("cache.enabled");
@@ -898,18 +892,18 @@ calMgrCalendarObserver.prototype = {
     },
 
     onPropertyDeleting: function(aCalendar, aName) {
         this.onPropertyChanged(aCalendar, aName, false, true);
     },
 
     // Error announcer specific functions
     announceError: function(aCalendar, aErrNo, aMessage) {
-        let paramBlock = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
-                                   .createInstance(Components.interfaces.nsIDialogParamBlock);
+        let paramBlock = Cc["@mozilla.org/embedcomp/dialogparam;1"]
+                           .createInstance(Ci.nsIDialogParamBlock);
         let props = Services.strings.createBundle("chrome://calendar/locale/calendar.properties");
         let errMsg;
         paramBlock.SetNumberStrings(3);
         if (!this.storedReadOnly && this.calendar.readOnly) {
             // Major errors change the calendar to readOnly
             errMsg = props.formatStringFromName("readOnlyMode", [this.calendar.name], 1);
         } else if (!this.storedReadOnly && !this.calendar.readOnly) {
             // Minor errors don't, but still tell the user something went wrong
@@ -917,17 +911,17 @@ calMgrCalendarObserver.prototype = {
         } else {
             // The calendar was already in readOnly mode, but still tell the user
             errMsg = props.formatStringFromName("stillReadOnlyError", [this.calendar.name], 1);
         }
 
         // When possible, change the error number into its name, to
         // make it slightly more readable.
         let errCode = "0x" + aErrNo.toString(16);
-        const calIErrors = Components.interfaces.calIErrors;
+        const calIErrors = Ci.calIErrors;
         // Check if it is worth enumerating all the error codes.
         if (aErrNo & calIErrors.ERROR_BASE) {
             for (let err in calIErrors) {
                 if (calIErrors[err] == aErrNo) {
                     errCode = err;
                 }
             }
         }
@@ -959,17 +953,17 @@ calMgrCalendarObserver.prototype = {
         this.storedReadOnly = this.calendar.readOnly;
         let errorCode = cal.l10n.getCalString("errorCode", [errCode]);
         let errorDescription = cal.l10n.getCalString("errorDescription", [message]);
         let summary = errMsg + " " + errorCode + ". " + errorDescription;
 
         // Log warnings in error console.
         // Report serious errors in both error console and in prompt window.
         if (aErrNo == calIErrors.MODIFICATION_FAILED) {
-            Components.utils.reportError(summary);
+            Cu.reportError(summary);
             this.announceParamBlock(paramBlock);
         } else {
             cal.WARN(summary);
         }
     },
 
     announceParamBlock: function(paramBlock) {
         function awaitLoad(event) {
@@ -980,17 +974,17 @@ calMgrCalendarObserver.prototype = {
             // remove paramBlock and unload listener.
             try {
                 // remove the message that has been shown from
                 // the list of all announced messages.
                 this.announcedMessages = this.announcedMessages.filter((msg) => {
                     return !equalMessage(msg, paramBlock);
                 });
             } catch (e) {
-                Components.utils.reportError(e);
+                Cu.reportError(e);
             }
         };
 
         // silently don't do anything if this message already has been
         // announced without being acknowledged.
         if (this.announcedMessages.some(equalMessage.bind(null, paramBlock))) {
             return;
         }
--- a/calendar/base/src/calCalendarSearchService.js
+++ b/calendar/base/src/calCalendarSearchService.js
@@ -45,53 +45,53 @@ calCalendarSearchListener.prototype = {
 };
 
 function calCalendarSearchService() {
     this.wrappedJSObject = this;
     this.mProviders = new Set();
 }
 var calCalendarSearchServiceClassID = Components.ID("{f5f743cd-8997-428e-bc1b-644e73f61203}");
 var calCalendarSearchServiceInterfaces = [
-    Components.interfaces.calICalendarSearchProvider,
-    Components.interfaces.calICalendarSearchService
+    Ci.calICalendarSearchProvider,
+    Ci.calICalendarSearchService
 ];
 calCalendarSearchService.prototype = {
     mProviders: null,
 
     classID: calCalendarSearchServiceClassID,
     QueryInterface: cal.generateQI(calCalendarSearchServiceInterfaces),
     classInfo: cal.generateCI({
         classID: calCalendarSearchServiceClassID,
         contractID: "@mozilla.org/calendar/calendarsearch-service;1",
         classDescription: "Calendar Search Service",
         interfaces: calCalendarSearchServiceInterfaces,
-        flags: Components.interfaces.nsIClassInfo.SINGLETON
+        flags: Ci.nsIClassInfo.SINGLETON
     }),
 
     // calICalendarSearchProvider:
     searchForCalendars: function(aString, aHints, aMaxResults, aListener) {
         let groupListener = new calCalendarSearchListener(this.mProviders.size, aListener);
         for (let provider of this.mProviders.values()) {
             try {
                 groupListener.opGroup.add(provider.searchForCalendars(aString,
                                                                       aHints,
                                                                       aMaxResults,
                                                                       groupListener));
             } catch (exc) {
-                Components.utils.reportError(exc);
+                Cu.reportError(exc);
                 groupListener.onResult(null, []); // dummy to adopt mNumOperations
             }
         }
         return groupListener.opGroup;
     },
 
     // calICalendarSearchService:
     getProviders: function(out_aCount) {
         out_aCount.value = this.mProviders.size;
         return [...this.mProviders];
     },
     addProvider: function(aProvider) {
-        this.mProviders.add(aProvider.QueryInterface(Components.interfaces.calICalendarSearchProvider));
+        this.mProviders.add(aProvider.QueryInterface(Ci.calICalendarSearchProvider));
     },
     removeProvider: function(aProvider) {
-        this.mProviders.delete(aProvider.QueryInterface(Components.interfaces.calICalendarSearchProvider));
+        this.mProviders.delete(aProvider.QueryInterface(Ci.calICalendarSearchProvider));
     }
 };
--- a/calendar/base/src/calDefaultACLManager.js
+++ b/calendar/base/src/calDefaultACLManager.js
@@ -22,18 +22,18 @@ calDefaultACLManager.prototype = {
         if (!(calUri in this.mCalendarEntries)) {
             this.mCalendarEntries[calUri] = new calDefaultCalendarACLEntry(this, aCalendar);
         }
 
         return this.mCalendarEntries[calUri];
     },
     getCalendarEntry: function(aCalendar, aListener) {
         let entry = this._getCalendarEntryCached(aCalendar);
-        aListener.onOperationComplete(aCalendar, Components.results.NS_OK,
-                                      Components.interfaces.calIOperationListener.GET,
+        aListener.onOperationComplete(aCalendar, Cr.NS_OK,
+                                      Ci.calIOperationListener.GET,
                                       null,
                                       entry);
     },
     getItemEntry: function(aItem) {
         let calEntry = this._getCalendarEntryCached(aItem.calendar);
         return new calDefaultItemACLEntry(calEntry);
     },
 
--- a/calendar/base/src/calDeletedItems.js
+++ b/calendar/base/src/calDeletedItems.js
@@ -20,30 +20,30 @@ function calDeletedItems() {
         handleResult: function() {},
         handleError: function() {},
         handleCompletion: function() {},
     };
 }
 
 var calDeletedItemsClassID = Components.ID("{8e6799af-e7e9-4e6c-9a82-a2413e86d8c3}");
 var calDeletedItemsInterfaces = [
-    Components.interfaces.calIDeletedItems,
-    Components.interfaces.nsIObserver,
-    Components.interfaces.calIObserver
+    Ci.calIDeletedItems,
+    Ci.nsIObserver,
+    Ci.calIObserver
 ];
 calDeletedItems.prototype = {
 
     classID: calDeletedItemsClassID,
     QueryInterface: cal.generateQI(calDeletedItemsInterfaces),
     classInfo: cal.generateCI({
         classID: calDeletedItemsClassID,
         contractID: "@mozilla.org/calendar/deleted-items-manager;1",
         classDescription: "Database containing information about deleted items",
         interfaces: calDeletedItemsInterfaces,
-        flags: Components.interfaces.nsIClassInfo.SINGLETON
+        flags: Ci.nsIClassInfo.SINGLETON
     }),
 
     DB_SCHEMA_VERSION: 1,
     STALE_TIME: 30 * 24 * 60 * 60 / 1000, /* 30 days */
 
     // To make the tests more failsafe, we have an internal notifier function.
     // As the deleted items store is just meant to be a hint, this should not
     // be used in real code.
--- a/calendar/base/src/calEvent.js
+++ b/calendar/base/src/calEvent.js
@@ -13,19 +13,19 @@ function calEvent() {
     this.eventPromotedProps = {
         DTSTART: true,
         DTEND: true,
         __proto__: this.itemBasePromotedProps
     };
 }
 var calEventClassID = Components.ID("{974339d5-ab86-4491-aaaf-2b2ca177c12b}");
 var calEventInterfaces = [
-    Components.interfaces.calIItemBase,
-    Components.interfaces.calIEvent,
-    Components.interfaces.calIInternalShallowCopy
+    Ci.calIItemBase,
+    Ci.calIEvent,
+    Ci.calIInternalShallowCopy
 ];
 calEvent.prototype = {
     __proto__: calItemBase.prototype,
 
     classID: calEventClassID,
     QueryInterface: cal.generateQI(calEventInterfaces),
     classInfo: cal.generateCI({
         classID: calEventClassID,
@@ -102,17 +102,17 @@ calEvent.prototype = {
                     let icalprop = icssvc.createIcalProperty(name);
                     icalprop.value = value;
                     let propBucket = this.mPropertyParams[name];
                     if (propBucket) {
                         for (let paramName in propBucket) {
                             try {
                                 icalprop.setParameter(paramName, propBucket[paramName]);
                             } catch (e) {
-                                if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
+                                if (e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
                                     // Illegal values should be ignored, but we could log them if
                                     // the user has enabled logging.
                                     cal.LOG("Warning: Invalid event parameter value " + paramName + "=" + propBucket[paramName]);
                                 } else {
                                     throw e;
                                 }
                             }
                         }
@@ -128,17 +128,17 @@ calEvent.prototype = {
 
     eventPromotedProps: null,
 
     set icalComponent(event) {
         this.modify();
         if (event.componentType != "VEVENT") {
             event = event.getFirstSubcomponent("VEVENT");
             if (!event) {
-                throw Components.results.NS_ERROR_INVALID_ARG;
+                throw Cr.NS_ERROR_INVALID_ARG;
             }
         }
 
         this.mEndDate = undefined;
         this.setItemBaseFromICS(event);
         this.mapPropsFromICS(event, this.icsEventPropMap);
 
         this.importUnpromotedProperties(event, this.eventPromotedProps);
--- a/calendar/base/src/calFreeBusyService.js
+++ b/calendar/base/src/calFreeBusyService.js
@@ -33,17 +33,17 @@ calFreeBusyListener.prototype = {
     onResult: function(aOperation, aResult) {
         if (this.mFinalListener) {
             if (!aOperation || !aOperation.isPending) {
                 --this.mNumOperations;
                 if (this.mNumOperations == 0) {
                     this.opGroup.notifyCompleted();
                 }
             }
-            let opStatus = aOperation ? aOperation.status : Components.results.NS_OK;
+            let opStatus = aOperation ? aOperation.status : Cr.NS_OK;
             if (Components.isSuccessCode(opStatus) &&
                 aResult && Array.isArray(aResult)) {
                 this.notifyResult(aResult);
             } else {
                 this.notifyResult([]);
             }
         }
     }
@@ -69,14 +69,14 @@ calFreeBusyService.prototype = {
                                                           groupListener);
             groupListener.opGroup.add(operation);
         }
         return groupListener.opGroup;
     },
 
     // calIFreeBusyService:
     addProvider: function(aProvider) {
-        this.mProviders.add(aProvider.QueryInterface(Components.interfaces.calIFreeBusyProvider));
+        this.mProviders.add(aProvider.QueryInterface(Ci.calIFreeBusyProvider));
     },
     removeProvider: function(aProvider) {
-        this.mProviders.delete(aProvider.QueryInterface(Components.interfaces.calIFreeBusyProvider));
+        this.mProviders.delete(aProvider.QueryInterface(Ci.calIFreeBusyProvider));
     }
 };
--- a/calendar/base/src/calIcsParser.js
+++ b/calendar/base/src/calIcsParser.js
@@ -70,49 +70,49 @@ calIcsParser.prototype = {
                     parent.setProperty("DTSTART", item.recurrenceId);
                     parent.setProperty("X-MOZ-FAKED-MASTER", "1"); // this tag might be useful in the future
                     parent.recurrenceInfo = cal.createRecurrenceInfo(parent);
                     fakedParents[item.id] = true;
                     state.uid2parent[item.id] = parent;
                     state.items.push(parent);
                 }
                 if (item.id in fakedParents) {
-                    let rdate = Components.classes["@mozilla.org/calendar/recurrence-date;1"]
-                                          .createInstance(Components.interfaces.calIRecurrenceDate);
+                    let rdate = Cc["@mozilla.org/calendar/recurrence-date;1"]
+                                  .createInstance(Ci.calIRecurrenceDate);
                     rdate.date = item.recurrenceId;
                     parent.recurrenceInfo.appendRecurrenceItem(rdate);
                     // we'll keep the parentless-API until we switch over using itip-process for import (e.g. in dnd code)
                     self.mParentlessItems.push(item);
                 }
 
                 parent.recurrenceInfo.modifyException(item, true);
             }
 
             if (Object.keys(state.tzErrors).length > 0) {
                 // Use an alert rather than a prompt because problems may appear in
                 // remote subscribed calendars the user cannot change.
-                if (Components.classes["@mozilla.org/alerts-service;1"]) {
-                    let notifier = Components.classes["@mozilla.org/alerts-service;1"]
-                                             .getService(Components.interfaces.nsIAlertsService);
+                if (Cc["@mozilla.org/alerts-service;1"]) {
+                    let notifier = Cc["@mozilla.org/alerts-service;1"]
+                                     .getService(Ci.nsIAlertsService);
                     let title = cal.l10n.getCalString("TimezoneErrorsAlertTitle");
                     let text = cal.l10n.getCalString("TimezoneErrorsSeeConsole");
                     try {
                         notifier.showAlertNotification("", title, text, false, null, null, title);
                     } catch (e) {
                         // The notifier may not be available, e.g. on xpcshell tests
                     }
                 }
             }
 
             // We are done, push the items to the parser and notify the listener
             self.mItems = self.mItems.concat(state.items);
             self.mComponents = self.mComponents.concat(state.extraComponents);
 
             if (aAsyncParsing) {
-                aAsyncParsing.onParsingComplete(Components.results.NS_OK, self);
+                aAsyncParsing.onParsingComplete(Cr.NS_OK, self);
             }
         });
     },
 
     parseString: function(aICSString, aTzProvider, aAsyncParsing) {
         if (aAsyncParsing) {
             let self = this;
 
@@ -289,17 +289,17 @@ parserState.prototype = {
                 self.checkCompletion();
             }
         };
 
         this.threadCount++;
         if (this.listener) {
             // If we have a listener, we are doing this asynchronously. Go ahead
             // and use the thread manager to dispatch the above runner
-            Services.tm.currentThread.dispatch(runner, Components.interfaces.nsIEventTarget.DISPATCH_NORMAL);
+            Services.tm.currentThread.dispatch(runner, Ci.nsIEventTarget.DISPATCH_NORMAL);
         } else {
             // No listener means synchonous. Just run the runner instead
             runner.run();
         }
     },
 
     /**
      * Checks if the processing of all events has completed. If a join function
--- a/calendar/base/src/calIcsSerializer.js
+++ b/calendar/base/src/calIcsSerializer.js
@@ -38,18 +38,18 @@ calIcsSerializer.prototype = {
         return calComp.serializeToICSStream();
     },
 
     serializeToStream: function(aStream) {
         let str = this.serializeToString();
 
         // Convert the javascript string to an array of bytes, using the
         // UTF8 encoder
-        let convStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
-                                   .createInstance(Components.interfaces.nsIConverterOutputStream);
+        let convStream = Cc["@mozilla.org/intl/converter-output-stream;1"]
+                           .createInstance(Ci.nsIConverterOutputStream);
         convStream.init(aStream, "UTF-8");
 
         convStream.writeString(str);
         convStream.close();
     },
 
     getIcalComponent: function() {
         let calComp = cal.getIcsService().createIcalComponent("VCALENDAR");
--- a/calendar/base/src/calItemBase.js
+++ b/calendar/base/src/calItemBase.js
@@ -120,17 +120,17 @@ calItemBase.prototype = {
     },
 
     // attribute calIItemBase parentItem;
     get parentItem() {
         return this.mParentItem || this;
     },
     set parentItem(value) {
         if (this.mImmutable) {
-            throw Components.results.NS_ERROR_OBJECT_IS_IMMUTABLE;
+            throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
         }
         return (this.mParentItem = cal.unwrapInstance(value));
     },
 
     /**
      * Initializes the base item to be an item proxy. Used by inheriting
      * objects createProxy() method.
      *
@@ -160,17 +160,17 @@ calItemBase.prototype = {
 
     /**
      * This function should be called by all members that modify the item. It
      * checks if the item is immutable and throws accordingly, and sets the
      * mDirty property.
      */
     modify: function() {
         if (this.mImmutable) {
-            throw Components.results.NS_ERROR_OBJECT_IS_IMMUTABLE;
+            throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
         }
         this.mDirty = true;
     },
 
     /**
      * Makes sure the item is not dirty. If the item is dirty, properties like
      * LAST-MODIFIED and DTSTAMP are set to now.
      */
@@ -202,17 +202,17 @@ calItemBase.prototype = {
         }
         if (this.mAttendees) {
             for (let att of this.mAttendees) {
                 att.makeImmutable();
             }
         }
 
         for (let propValue of this.mProperties.values()) {
-            if (propValue instanceof Components.interfaces.calIDateTime &&
+            if (propValue instanceof Ci.calIDateTime &&
                 propValue.isMutable) {
                 propValue.makeImmutable();
             }
         }
 
         if (this.mAlarms) {
             for (let alarm of this.mAlarms) {
                 alarm.makeImmutable();
@@ -267,17 +267,17 @@ calItemBase.prototype = {
 
         cloned.mAttendees = [];
         for (let att of this.getAttendees({})) {
             cloned.mAttendees.push(att.clone());
         }
 
         cloned.mProperties = new Map();
         for (let [name, value] of this.mProperties.entries()) {
-            if (value instanceof Components.interfaces.calIDateTime) {
+            if (value instanceof Ci.calIDateTime) {
                 value = value.clone();
             }
 
             cloned.mProperties.set(name, value);
 
             let propBucket = this.mPropertyParams[name];
             if (propBucket) {
                 let newBucket = {};
@@ -575,17 +575,17 @@ calItemBase.prototype = {
             return [];
         }
     },
 
     // void removeAttachment(in calIAttachment attachment);
     removeAttachment: function(aAttachment) {
         this.modify();
         for (let attIndex in this.mAttachments) {
-            if (cal.data.compareObjects(this.mAttachments[attIndex], aAttachment, Components.interfaces.calIAttachment)) {
+            if (cal.data.compareObjects(this.mAttachments[attIndex], aAttachment, Ci.calIAttachment)) {
                 this.modify();
                 this.mAttachments.splice(attIndex, 1);
                 break;
             }
         }
     },
 
     // void addAttachment(in calIAttachment attachment);
@@ -651,17 +651,17 @@ calItemBase.prototype = {
         if (!this.mCalendar && (this.parentItem != this)) {
             return this.parentItem.calendar;
         } else {
             return this.mCalendar;
         }
     },
     set calendar(calendar) {
         if (this.mImmutable) {
-            throw Components.results.NS_ERROR_OBJECT_IS_IMMUTABLE;
+            throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
         }
         this.mHashId = null; // recompute hashId
         this.mCalendar = calendar;
     },
 
     // attribute calIAttendee organizer;
     get organizer() {
         if (this.mIsProxy && (this.mOrganizer === undefined)) {
@@ -694,20 +694,20 @@ calItemBase.prototype = {
     //                    [array, size_is(aCount)] in wstring aCategories);
     setCategories: function(aCount, aCategories) {
         this.modify();
         this.mCategories = aCategories.concat([]);
     },
 
     // attribute AUTF8String icalString;
     get icalString() {
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     },
     set icalString(str) {
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     },
 
     /**
      * The map of promoted properties is a list of those properties that are
      * represented directly by getters/setters.
      * All of these property names must be in upper case isPropertyPromoted to
      * function correctly. The has/get/set/deleteProperty interfaces
      * are case-insensitive, but these are not.
@@ -753,17 +753,17 @@ calItemBase.prototype = {
      *
      * @param icalcomp      The calIIcalComponent to read from.
      * @param propmap       The property map to walk through.
      */
     mapPropsFromICS: function(icalcomp, propmap) {
         for (let i = 0; i < propmap.length; i++) {
             let prop = propmap[i];
             let val = icalcomp[prop.ics];
-            if (val != null && val != Components.interfaces.calIIcalComponent.INVALID_VALUE) {
+            if (val != null && val != Ci.calIIcalComponent.INVALID_VALUE) {
                 this.setProperty(prop.cal, val);
             }
         }
     },
 
     /**
      * Walks through the propmap and sets all properties on the given icalcomp
      * from the properties set on this item.
@@ -771,17 +771,17 @@ calItemBase.prototype = {
      *
      * @param icalcomp      The calIIcalComponent to write to.
      * @param propmap       The property map to walk through.
      */
     mapPropsToICS: function(icalcomp, propmap) {
         for (let i = 0; i < propmap.length; i++) {
             let prop = propmap[i];
             let val = this.getProperty(prop.cal);
-            if (val != null && val != Components.interfaces.calIIcalComponent.INVALID_VALUE) {
+            if (val != null && val != Ci.calIIcalComponent.INVALID_VALUE) {
                 icalcomp[prop.ics] = val;
             }
         }
     },
 
 
     /**
      * Reads an ical component and sets up the base item's properties to match
@@ -908,20 +908,20 @@ calItemBase.prototype = {
 
     // boolean isPropertyPromoted(in AString name);
     isPropertyPromoted: function(name) {
         return this.itemBasePromotedProps[name.toUpperCase()];
     },
 
     // attribute calIIcalComponent icalComponent;
     get icalComponent() {
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     },
     set icalComponent(val) {
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     },
 
     // attribute PRUint32 generation;
     get generation() {
         let gen = this.getProperty("X-MOZ-GENERATION");
         return (gen ? parseInt(gen, 10) : 0);
     },
     set generation(aValue) {
@@ -981,17 +981,17 @@ calItemBase.prototype = {
             lastAck.value = alarmLastAck.icalString;
             icalcomp.addProperty(lastAck);
         }
     },
 
     // void getAlarms(out PRUint32 count, [array, size_is(count), retval] out calIAlarm aAlarms);
     getAlarms: function(aCount) {
         if (typeof aCount != "object") {
-            throw Components.results.NS_ERROR_XPC_NEED_OUT_OBJECT;
+            throw Cr.NS_ERROR_XPC_NEED_OUT_OBJECT;
         }
 
         if (!this.mAlarms && this.mIsProxy) {
             this.mAlarms = this.mParentItem.getAlarms(aCount);
         }
         if (this.mAlarms) {
             aCount.value = this.mAlarms.length;
             return this.mAlarms.concat([]); // clone
@@ -1010,31 +1010,31 @@ calItemBase.prototype = {
      *                            errors.
      */
     addAlarm: function(aAlarm, aDoNotValidate) {
         if (!aDoNotValidate) {
             try {
                 // Trigger the icalComponent getter to make sure the alarm is valid.
                 aAlarm.icalComponent; // eslint-disable-line no-unused-expressions
             } catch (e) {
-                throw Components.results.NS_ERROR_INVALID_ARG;
+                throw Cr.NS_ERROR_INVALID_ARG;
             }
         }
 
         this.modify();
         this.mAlarms = this.getAlarms({});
         this.mAlarms.push(aAlarm);
     },
 
     // void deleteAlarm(in calIAlarm aAlarm);
     deleteAlarm: function(aAlarm) {
         this.modify();
         this.mAlarms = this.getAlarms({});
         for (let i = 0; i < this.mAlarms.length; i++) {
-            if (cal.data.compareObjects(this.mAlarms[i], aAlarm, Components.interfaces.calIAlarm)) {
+            if (cal.data.compareObjects(this.mAlarms[i], aAlarm, Ci.calIAlarm)) {
                 this.mAlarms.splice(i, 1);
                 break;
             }
         }
     },
 
     // void clearAlarms();
     clearAlarms: function() {
--- a/calendar/base/src/calItipItem.js
+++ b/calendar/base/src/calItipItem.js
@@ -39,17 +39,17 @@ calItipItem.prototype = {
     },
     set receivedMethod(aMethod) {
         return (this.mReceivedMethod = aMethod.toUpperCase());
     },
 
     mResponseMethod: "REPLY",
     get responseMethod() {
         if (!this.mIsInitialized) {
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
+            throw Cr.NS_ERROR_NOT_INITIALIZED;
         }
         return this.mResponseMethod;
     },
     set responseMethod(aMethod) {
         return (this.mResponseMethod = aMethod.toUpperCase());
     },
 
     mAutoResponse: null,
@@ -82,18 +82,17 @@ calItipItem.prototype = {
     },
     set localStatus(aValue) {
         return (this.mLocalStatus = aValue);
     },
 
     mItemList: {},
 
     init: function(aIcalString) {
-        let parser = Components.classes["@mozilla.org/calendar/ics-parser;1"]
-                               .createInstance(Components.interfaces.calIIcsParser);
+        let parser = Cc["@mozilla.org/calendar/ics-parser;1"].createInstance(Ci.calIIcsParser);
         parser.parseString(aIcalString, null);
 
         // - User specific alarms as well as X-MOZ- properties are irrelevant w.r.t. iTIP messages,
         //   should not be sent out and should not be relevant for incoming messages
         // - faked master items
         // so clean them out:
 
         function cleanItem(item) {
@@ -179,17 +178,17 @@ calItipItem.prototype = {
     },
 
     /**
      * This returns both the array and the number of items. An easy way to
      * call it is: let itemArray = itipItem.getItemList({ });
      */
     getItemList: function(itemCountRef) {
         if (!this.mIsInitialized) {
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
+            throw Cr.NS_ERROR_NOT_INITIALIZED;
         }
         itemCountRef.value = this.mItemList.length;
         return this.mItemList;
     },
 
     /**
      * Note that this code forces the user to respond to all items in the same
      * way, which is a current limitation of the spec.
--- a/calendar/base/src/calProtocolHandler.js
+++ b/calendar/base/src/calProtocolHandler.js
@@ -15,23 +15,21 @@ function calProtocolHandler(scheme) {
     this.wrappedJSObject = this;
 }
 
 calProtocolHandler.prototype = {
     get defaultPort() { return this.mHttpProtocol.defaultPort; },
     get protocolFlags() { return this.mHttpProtocol.protocolFlags; },
 
     newURI: function(aSpec, anOriginalCharset, aBaseURI) {
-        return Components.classes["@mozilla.org/network/standard-url-mutator;1"]
-                         .createInstance(Components.interfaces.nsIStandardURLMutator)
-                         .init(Components.interfaces.nsIStandardURL.URLTYPE_STANDARD,
-                               this.mHttpProtocol.defaultPort,
-                               aSpec, anOriginalCharset, aBaseURI)
-                         .finalize()
-                         .QueryInterface(Components.interfaces.nsIStandardURL);
+        return Cc["@mozilla.org/network/standard-url-mutator;1"]
+            .createInstance(Ci.nsIStandardURLMutator)
+            .init(Ci.nsIStandardURL.URLTYPE_STANDARD, this.mHttpProtocol.defaultPort, aSpec, anOriginalCharset, aBaseURI)
+            .finalize()
+            .QueryInterface(Ci.nsIStandardURL);
     },
 
     newChannel: function(aUri) {
         return this.newChannel2(aUri, null);
     },
 
     newChannel2: function(aUri, aLoadInfo) {
         let uri = aUri.mutate().setScheme(this.mHttpProtocol.scheme).finalize();
@@ -39,18 +37,18 @@ calProtocolHandler.prototype = {
         let channel;
         if (aLoadInfo) {
             channel = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo);
         } else {
             channel = Services.io.newChannelFromURI2(uri,
                                                      null,
                                                      Services.scriptSecurityManager.getSystemPrincipal(),
                                                      null,
-                                                     Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                                                     Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+                                                     Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                                     Ci.nsIContentPolicy.TYPE_OTHER);
         }
         channel.originalURI = aUri;
         return channel;
     },
 
     // We are not overriding any special ports
     allowPort: function(aPort, aScheme) { return false; }
 };
--- a/calendar/base/src/calRecurrenceDate.js
+++ b/calendar/base/src/calRecurrenceDate.js
@@ -4,20 +4,17 @@
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 
 function calRecurrenceDate() {
     this.wrappedJSObject = this;
 }
 
 var calRecurrenceDateClassID = Components.ID("{806b6423-3aaa-4b26-afa3-de60563e9cec}");
-var calRecurrenceDateInterfaces = [
-    Components.interfaces.calIRecurrenceItem,
-    Components.interfaces.calIRecurrenceDate
-];
+var calRecurrenceDateInterfaces = [Ci.calIRecurrenceItem, Ci.calIRecurrenceDate];
 calRecurrenceDate.prototype = {
     isMutable: true,
 
     mIsNegative: false,
     mDate: null,
 
     classID: calRecurrenceDateClassID,
     QueryInterface: cal.generateQI(calRecurrenceDateInterfaces),
@@ -29,17 +26,17 @@ calRecurrenceDate.prototype = {
     }),
 
     makeImmutable: function() {
         this.isMutable = false;
     },
 
     ensureMutable: function() {
         if (!this.isMutable) {
-            throw Components.results.NS_ERROR_OBJECT_IS_MUTABLE;
+            throw Cr.NS_ERROR_OBJECT_IS_MUTABLE;
         }
     },
 
     clone: function() {
         let other = new calRecurrenceDate();
         other.mDate = (this.mDate ? this.mDate.clone() : null);
         other.mIsNegative = this.mIsNegative;
         return other;
@@ -82,34 +79,33 @@ calRecurrenceDate.prototype = {
     get icalString() {
         let comp = this.icalProperty;
         return (comp ? comp.icalString : "");
     },
     set icalString(val) {
         let prop = cal.getIcsService().createIcalPropertyFromString(val);
         let propName = prop.propertyName;
         if (propName != "RDATE" && propName != "EXDATE") {
-            throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+            throw Cr.NS_ERROR_ILLEGAL_VALUE;
         }
 
         this.icalProperty = prop;
         return val;
     },
 
     get icalProperty() {
         let prop = cal.getIcsService().createIcalProperty(this.mIsNegative ? "EXDATE" : "RDATE");
         prop.valueAsDatetime = this.mDate;
         return prop;
     },
     set icalProperty(prop) {
         if (prop.propertyName == "RDATE") {
             this.mIsNegative = false;
             if (prop.getParameter("VALUE") == "PERIOD") {
-                let period = Components.classes["@mozilla.org/calendar/period;1"]
-                                       .createInstance(Components.interfaces.calIPeriod);
+                let period = Cc["@mozilla.org/calendar/period;1"].createInstance(Ci.calIPeriod);
                 period.icalString = prop.valueAsIcalString;
                 this.mDate = period.start;
             } else {
                 this.mDate = prop.valueAsDatetime;
             }
         } else if (prop.propertyName == "EXDATE") {
             this.mIsNegative = true;
             this.mDate = prop.valueAsDatetime;
--- a/calendar/base/src/calRecurrenceInfo.js
+++ b/calendar/base/src/calRecurrenceInfo.js
@@ -32,22 +32,22 @@ calRecurrenceInfo.prototype = {
     mNegativeRules: null,
     mExceptionMap: null,
 
     /**
      * Helpers
      */
     ensureBaseItem: function() {
         if (!this.mBaseItem) {
-            throw Components.results.NS_ERROR_NOT_INITIALIZED;
+            throw Cr.NS_ERROR_NOT_INITIALIZED;
         }
     },
     ensureMutable: function() {
         if (this.mImmutable) {
-            throw Components.results.NS_ERROR_OBJECT_IS_IMMUTABLE;
+            throw Cr.NS_ERROR_OBJECT_IS_IMMUTABLE;
         }
     },
     ensureSortedRecurrenceRules: function() {
         if (!this.mPositiveRules || !this.mNegativeRules) {
             this.mPositiveRules = [];
             this.mNegativeRules = [];
             for (let ritem of this.mRecurrenceItems) {
                 if (ritem.isNegative) {
@@ -156,17 +156,17 @@ calRecurrenceInfo.prototype = {
 
         return this.mRecurrenceItems.length;
     },
 
     getRecurrenceItemAt: function(aIndex) {
         this.ensureBaseItem();
 
         if (aIndex < 0 || aIndex >= this.mRecurrenceItems.length) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         return this.mRecurrenceItems[aIndex];
     },
 
     appendRecurrenceItem: function(aItem) {
         this.ensureBaseItem();
         this.ensureMutable();
@@ -180,52 +180,52 @@ calRecurrenceInfo.prototype = {
         }
     },
 
     deleteRecurrenceItemAt: function(aIndex) {
         this.ensureBaseItem();
         this.ensureMutable();
 
         if (aIndex < 0 || aIndex >= this.mRecurrenceItems.length) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         if (this.mRecurrenceItems[aIndex].isNegative) {
             this.mNegativeRules = null;
         } else {
             this.mPositiveRules = null;
         }
 
         this.mRecurrenceItems.splice(aIndex, 1);
     },
 
     deleteRecurrenceItem: function(aItem) {
         // Because xpcom objects can be wrapped in various ways, testing for
         // mere == sometimes returns false even when it should be true.  Use
         // the interface pointer returned by sip to avoid that problem.
-        let sip1 = Components.classes["@mozilla.org/supports-interface-pointer;1"]
-                            .createInstance(Components.interfaces.nsISupportsInterfacePointer);
+        let sip1 = Cc["@mozilla.org/supports-interface-pointer;1"]
+                     .createInstance(Ci.nsISupportsInterfacePointer);
         sip1.data = aItem;
-        sip1.dataIID = Components.interfaces.calIRecurrenceItem;
+        sip1.dataIID = Ci.calIRecurrenceItem;
 
         let pos;
         if ((pos = this.mRecurrenceItems.indexOf(sip1.data)) > -1) {
             this.deleteRecurrenceItemAt(pos);
         } else {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
     },
 
     insertRecurrenceItemAt: function(aItem, aIndex) {
         this.ensureBaseItem();
         this.ensureMutable();
         this.ensureSortedRecurrenceRules();
 
         if (aIndex < 0 || aIndex > this.mRecurrenceItems.length) {
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         if (aItem.isNegative) {
             this.mNegativeRules.push(aItem);
         } else {
             this.mPositiveRules.push(aItem);
         }
 
@@ -288,18 +288,18 @@ calRecurrenceInfo.prototype = {
             // Go through all positive rules and get the next recurrence id
             // according to that rule. If for all rules the rid is "invalid",
             // (i.e an EXDATE removed it, or an exception moved it somewhere
             // else), then get the respective next rid.
             //
             // If in a loop at least one rid is valid (i.e not an exception, not
             // an exdate, is after aTime), then remember the lowest one.
             for (let i = 0; i < this.mPositiveRules.length; i++) {
-                let rDateInstance = cal.wrapInstance(this.mPositiveRules[i], Components.interfaces.calIRecurrenceDate);
-                let rRuleInstance = cal.wrapInstance(this.mPositiveRules[i], Components.interfaces.calIRecurrenceRule);
+                let rDateInstance = cal.wrapInstance(this.mPositiveRules[i], Ci.calIRecurrenceDate);
+                let rRuleInstance = cal.wrapInstance(this.mPositiveRules[i], Ci.calIRecurrenceRule);
                 if (rDateInstance) {
                     // RDATEs are special. there is only one date in this rule,
                     // so no need to search anything.
                     let rdate = rDateInstance.date;
                     if (!nextOccurrences[i] && rdate.compare(aTime) > 0) {
                         // The RDATE falls into range, save it.
                         nextOccurrences[i] = rdate;
                     } else {
@@ -598,41 +598,41 @@ calRecurrenceInfo.prototype = {
         }
         return proxy;
     },
 
     removeOccurrenceAt: function(aRecurrenceId) {
         this.ensureBaseItem();
         this.ensureMutable();
 
-        let rdate = Components.classes["@mozilla.org/calendar/recurrence-date;1"]
-                              .createInstance(Components.interfaces.calIRecurrenceDate);
+        let rdate = Cc["@mozilla.org/calendar/recurrence-date;1"]
+                      .createInstance(Ci.calIRecurrenceDate);
         rdate.isNegative = true;
         rdate.date = aRecurrenceId.clone();
 
         this.removeExceptionFor(rdate.date);
 
         this.appendRecurrenceItem(rdate);
     },
 
     restoreOccurrenceAt: function(aRecurrenceId) {
         this.ensureBaseItem();
         this.ensureMutable();
         this.ensureSortedRecurrenceRules();
 
         for (let i = 0; i < this.mRecurrenceItems.length; i++) {
-            let rdate = cal.wrapInstance(this.mRecurrenceItems[i], Components.interfaces.calIRecurrenceDate);
+            let rdate = cal.wrapInstance(this.mRecurrenceItems[i], Ci.calIRecurrenceDate);
             if (rdate) {
                 if (rdate.isNegative && rdate.date.compare(aRecurrenceId) == 0) {
                     return this.deleteRecurrenceItemAt(i);
                 }
             }
         }
 
-        throw Components.results.NS_ERROR_INVALID_ARG;
+        throw Cr.NS_ERROR_INVALID_ARG;
     },
 
     //
     // exceptions
     //
 
     //
     // Some notes:
@@ -665,22 +665,22 @@ calRecurrenceInfo.prototype = {
     modifyException: function(anItem, aTakeOverOwnership) {
         this.ensureBaseItem();
 
         anItem = cal.unwrapInstance(anItem);
 
         if (anItem.parentItem.calendar != this.mBaseItem.calendar &&
             anItem.parentItem.id != this.mBaseItem.id) {
             cal.ERROR("recurrenceInfo::addException: item parentItem != this.mBaseItem (calendar/id)!");
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         if (anItem.recurrenceId == null) {
             cal.ERROR("recurrenceInfo::addException: item with null recurrenceId!");
-            throw Components.results.NS_ERROR_INVALID_ARG;
+            throw Cr.NS_ERROR_INVALID_ARG;
         }
 
         let itemtoadd;
         if (aTakeOverOwnership && anItem.isMutable) {
             itemtoadd = anItem;
             itemtoadd.parentItem = this.mBaseItem;
         } else {
             itemtoadd = anItem.cloneShallow(this.mBaseItem);
@@ -734,21 +734,21 @@ calRecurrenceInfo.prototype = {
         }
 
         // convert both dates to UTC since subtractDate is not timezone aware.
         let timeDiff = aNewStartTime.getInTimezone(cal.dtz.UTC).subtractDate(aOldStartTime.getInTimezone(cal.dtz.UTC));
 
         let rdates = {};
 
         // take RDATE's and EXDATE's into account.
-        const kCalIRecurrenceDate = Components.interfaces.calIRecurrenceDate;
+        const kCalIRecurrenceDate = Ci.calIRecurrenceDate;
         let ritems = this.getRecurrenceItems({});
         for (let ritem of ritems) {
             let rDateInstance = cal.wrapInstance(ritem, kCalIRecurrenceDate);
-            let rRuleInstance = cal.wrapInstance(ritem, Components.interfaces.calIRecurrenceRule);
+            let rRuleInstance = cal.wrapInstance(ritem, Ci.calIRecurrenceRule);
             if (rDateInstance) {
                 ritem = rDateInstance;
                 let date = ritem.date;
                 date.addDuration(timeDiff);
                 if (!ritem.isNegative) {
                     rdates[getRidKey(date)] = date;
                 }
                 ritem.date = date;
--- a/calendar/base/src/calRelation.js
+++ b/calendar/base/src/calRelation.js
@@ -49,17 +49,17 @@ calRelation.prototype = {
         if (this.mType) {
             icalatt.setParameter("RELTYPE", this.mType);
         }
 
         for (let [key, value] of this.mProperties.entries()) {
             try {
                 icalatt.setParameter(key, value);
             } catch (e) {
-                if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
+                if (e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
                     // Illegal values should be ignored, but we could log them if
                     // the user has enabled logging.
                     cal.LOG("Warning: Invalid relation property value " + key + "=" + value);
                 } else {
                     throw e;
                 }
             }
         }
@@ -86,17 +86,17 @@ calRelation.prototype = {
 
     get icalString() {
         let comp = this.icalProperty;
         return (comp ? comp.icalString : "");
     },
     set icalString(val) {
         let prop = cal.getIcsService().createIcalPropertyFromString(val);
         if (prop.propertyName != "RELATED-TO") {
-            throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+            throw Cr.NS_ERROR_ILLEGAL_VALUE;
         }
         this.icalProperty = prop;
         return val;
     },
 
     getParameter: function(aName) {
         return this.mProperties.get(aName);
     },
--- a/calendar/base/src/calSleepMonitor.js
+++ b/calendar/base/src/calSleepMonitor.js
@@ -26,18 +26,18 @@ calSleepMonitor.prototype = {
             cal.LOG("[calSleepMonitor] Sleep cycle detected, notifying observers.");
             Services.obs.notifyObservers(null, "wake_notification");
         }
         this.expected = now + this.interval;
     },
     start: function() {
         this.stop();
         this.expected = Date.now() + this.interval;
-        this.timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
-        this.timer.initWithCallback(this.callback.bind(this), this.interval, Components.interfaces.nsITimer.TYPE_REPEATING_PRECISE);
+        this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+        this.timer.initWithCallback(this.callback.bind(this), this.interval, Ci.nsITimer.TYPE_REPEATING_PRECISE);
     },
     stop: function() {
         if (this.timer) {
             this.timer.cancel();
             this.timer = null;
         }
     },
 
--- a/calendar/base/src/calStartupService.js
+++ b/calendar/base/src/calStartupService.js
@@ -49,51 +49,51 @@ calStartupService.prototype = {
     /**
      * Gets the startup order of services. This is an array of service objects
      * that should be called in order at startup.
      *
      * @return      The startup order as an array.
      */
     getStartupOrder: function() {
         let self = this;
-        let tzService = Components.classes["@mozilla.org/calendar/timezone-service;1"]
-                                  .getService(Components.interfaces.calITimezoneService);
-        let calMgr = Components.classes["@mozilla.org/calendar/manager;1"]
-                               .getService(Components.interfaces.calICalendarManager);
+        let tzService = Cc["@mozilla.org/calendar/timezone-service;1"]
+                          .getService(Ci.calITimezoneService);
+        let calMgr = Cc["@mozilla.org/calendar/manager;1"]
+                       .getService(Ci.calICalendarManager);
 
         // Localization service
         let locales = {
             startup: function(aCompleteListener) {
                 let packaged = Services.locale.packagedLocales;
                 let fileSrc = new FileSource(
                     "calendar", packaged,
                     "resource://calendar/chrome/calendar-{locale}/locale/{locale}/"
                 );
                 L10nRegistry.registerSource(fileSrc);
-                aCompleteListener.onResult(null, Components.results.NS_OK);
+                aCompleteListener.onResult(null, Cr.NS_OK);
             },
             shutdown: function(aCompleteListener) {
-                aCompleteListener.onResult(null, Components.results.NS_OK);
+                aCompleteListener.onResult(null, Cr.NS_OK);
             }
         };
 
         // Notification object
         let notify = {
             startup: function(aCompleteListener) {
                 self.started = true;
                 Services.obs.notifyObservers(null, "calendar-startup-done");
-                aCompleteListener.onResult(null, Components.results.NS_OK);
+                aCompleteListener.onResult(null, Cr.NS_OK);
             },
             shutdown: function(aCompleteListener) {
                 // Argh, it would have all been so pretty! Since we just reverse
                 // the array, the shutdown notification would happen before the
                 // other shutdown calls. For lack of pretty code, I'm
                 // leaving this out! Users can still listen to xpcom-shutdown.
                 self.started = false;
-                aCompleteListener.onResult(null, Components.results.NS_OK);
+                aCompleteListener.onResult(null, Cr.NS_OK);
             }
         };
 
         // We need to spin up the timezone service before the calendar manager
         // to ensure we have the timezones initialized. Make sure "notify" is
         // last in this array!
         return [locales, tzService, calMgr, notify];
     },
--- a/calendar/base/src/calTimezoneService.js
+++ b/calendar/base/src/calTimezoneService.js
@@ -19,49 +19,49 @@ calStringEnumerator.prototype = {
     [Symbol.iterator]: function() {
         return this.mStringArray.values();
     },
     hasMore: function() {
         return (this.mIndex < this.mStringArray.length);
     },
     getNext: function() {
         if (!this.hasMore()) {
-            throw Components.results.NS_ERROR_UNEXPECTED;
+            throw Cr.NS_ERROR_UNEXPECTED;
         }
         return this.mStringArray[this.mIndex++];
     }
 };
 
 function calTimezoneService() {
     this.wrappedJSObject = this;
 
     this.mZones = new Map();
 
     ICAL.TimezoneService = this.wrappedJSObject;
 }
 var calTimezoneServiceClassID = Components.ID("{e736f2bd-7640-4715-ab35-887dc866c587}");
 var calTimezoneServiceInterfaces = [
-    Components.interfaces.calITimezoneService,
-    Components.interfaces.calITimezoneProvider,
-    Components.interfaces.calIStartupService
+    Ci.calITimezoneService,
+    Ci.calITimezoneProvider,
+    Ci.calIStartupService
 ];
 calTimezoneService.prototype = {
     mDefaultTimezone: null,
     mHasSetupObservers: false,
     mVersion: null,
     mZones: null,
 
     classID: calTimezoneServiceClassID,
     QueryInterface: cal.generateQI(calTimezoneServiceInterfaces),
     classInfo: cal.generateCI({
         classID: calTimezoneServiceClassID,
         contractID: "@mozilla.org/calendar/timezone-service;1",
         classDescription: "Calendar Timezone Service",
         interfaces: calTimezoneServiceInterfaces,
-        flags: Components.interfaces.nsIClassInfo.SINGLETON
+        flags: Ci.nsIClassInfo.SINGLETON
     }),
 
     // ical.js TimezoneService methods
     has: function(id) { return this.getTimezone(id) != null; },
     get: function(id) {
         return id ? unwrapSingle(ICAL.Timezone, this.getTimezone(id)) : null;
     },
     remove: function() {},
@@ -73,18 +73,18 @@ calTimezoneService.prototype = {
             cal.LOG("[calTimezoneService] Loading " + aURL);
 
             return new Promise((resolve, reject) => {
                 let uri = Services.io.newURI(aURL);
                 let channel = Services.io.newChannelFromURI2(uri,
                                                              null,
                                                              Services.scriptSecurityManager.getSystemPrincipal(),
                                                              null,
-                                                             Components.interfaces.nsILoadInfo.SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS,
-                                                             Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+                                                             Ci.nsILoadInfo.SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS,
+                                                             Ci.nsIContentPolicy.TYPE_OTHER);
 
                 NetUtil.asyncFetch(channel, (inputStream, status) => {
                     if (!Components.isSuccessCode(status)) {
                         reject(status);
                         return;
                     }
 
                     try {
@@ -96,17 +96,17 @@ calTimezoneService.prototype = {
                     }
                 });
             });
         }
 
         let resNamespace = "calendar";
         // Check for presence of the calendar timezones add-on.
         let resProtocol = Services.io.getProtocolHandler("resource")
-                                  .QueryInterface(Components.interfaces.nsIResProtocolHandler);
+                                  .QueryInterface(Ci.nsIResProtocolHandler);
         if (resProtocol.hasSubstitution("calendar-timezones")) {
             resNamespace = "calendar-timezones";
         }
 
         fetchJSON("resource://" + resNamespace + "/timezones/zones.json").then((tzData) => {
             for (let tzid of Object.keys(tzData.aliases)) {
                 let data = tzData.aliases[tzid];
                 if (typeof data == "object" && data !== null) {
@@ -126,29 +126,29 @@ calTimezoneService.prototype = {
             let bundleURL = "chrome://" + resNamespace + "/locale/timezones.properties";
             this.stringBundle = ICAL.Timezone.cal_tz_bundle = Services.strings.createBundle(bundleURL);
 
             // Make sure UTC and floating are cached by calling their getters
             this.UTC; // eslint-disable-line no-unused-expressions
             this.floating; // eslint-disable-line no-unused-expressions
         }).then(() => {
             if (aCompleteListener) {
-                aCompleteListener.onResult(null, Components.results.NS_OK);
+                aCompleteListener.onResult(null, Cr.NS_OK);
             }
         }, (error) => {
             // We have to give up. Show an error and fail hard!
             let msg = cal.l10n.getCalString("missingCalendarTimezonesError");
             cal.ERROR(msg);
             cal.showError(msg);
         });
     },
 
     shutdown: function(aCompleteListener) {
         Services.prefs.removeObserver("calendar.timezone.local", this);
-        aCompleteListener.onResult(null, Components.results.NS_OK);
+        aCompleteListener.onResult(null, Cr.NS_OK);
     },
 
     get UTC() {
         if (!this.mZones.has("UTC")) {
             let utc;
             if (Preferences.get("calendar.icaljs", false)) {
                 utc = new calICALJSTimezone(ICAL.Timezone.utcTimezone);
             } else {
@@ -501,72 +501,70 @@ function guessSystemTimezone() {
                 }
             }
         }
         // no such period found
         return null;
     }
 
     function environmentVariableValue(varName) {
-        let envSvc = Components.classes["@mozilla.org/process/environment;1"]
-                                .getService(Components.interfaces.nsIEnvironment);
+        let envSvc = Cc["@mozilla.org/process/environment;1"]
+                       .getService(Ci.nsIEnvironment);
         let value = envSvc.get(varName);
         if (!value || !value.match(tzRegex)) {
             return "";
         }
         return varName + "=" + value;
     }
 
     function symbolicLinkTarget(filepath) {
         try {
-            let file = Components.classes["@mozilla.org/file/local;1"]
-                                 .createInstance(Components.interfaces.nsIFile);
+            let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
             file.initWithPath(filepath);
-            file.QueryInterface(Components.interfaces.nsIFile);
+            file.QueryInterface(Ci.nsIFile);
             if (!file.exists() || !file.isSymlink() || !file.target.match(tzRegex)) {
                 return "";
             }
 
             return filepath + " -> " + file.target;
         } catch (ex) {
-            Components.utils.reportError(filepath + ": " + ex);
+            Cu.reportError(filepath + ": " + ex);
             return "";
         }
     }
 
     function fileFirstZoneLineString(filepath) {
         // return first line of file that matches tzRegex (ZoneInfo id),
         // or "" if no file or no matching line.
         try {
-            let file = Components.classes["@mozilla.org/file/local;1"]
-                                 .createInstance(Components.interfaces.nsIFile);
+            let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
             file.initWithPath(filepath);
-            file.QueryInterface(Components.interfaces.nsIFile);
+            file.QueryInterface(Ci.nsIFile);
             if (!file.exists()) {
                 return "";
             }
-            let fileInstream = Components.classes["@mozilla.org/network/file-input-stream;1"]
-                                         .createInstance(Components.interfaces.nsIFileInputStream);
+            let fileInstream = Cc["@mozilla.org/network/file-input-stream;1"]
+                                 .createInstance(Ci.nsIFileInputStream);
             const PR_RDONLY = 0x1;
             fileInstream.init(file, PR_RDONLY, 0, 0);
-            fileInstream.QueryInterface(Components.interfaces.nsILineInputStream);
+            fileInstream.QueryInterface(Ci.nsILineInputStream);
             try {
                 let line = {}, hasMore = true, MAXLINES = 10;
                 for (let i = 0; hasMore && i < MAXLINES; i++) {
                     hasMore = fileInstream.readLine(line);
                     if (line.value && line.value.match(tzRegex)) {
                         return filepath + ": " + line.value;
                     }
                 }
                 return ""; // not found
             } finally {
                 fileInstream.close();
             }
         } catch (ex) {
-            Components.utils.reportError(filepath + ": " + ex);
+            Cu.reportError(filepath + ": " + ex);
             return "";
         }
     }
 
     function weekday(icsDate, timezone) {
         let calDate = cal.createDateTime(icsDate);
         calDate.timezone = timezone;
         return cal.dtz.dateTimeToJsDate(calDate).toLocaleString(undefined, { weekday: "short" });
@@ -579,22 +577,22 @@ function guessSystemTimezone() {
     let probableTZSource = null;
 
     const calProperties = Services.strings.createBundle("chrome://calendar/locale/calendar.properties");
 
     // First, try to detect operating system timezone.
     let zoneInfoIdFromOSUserTimeZone = null;
     let osUserTimeZone = null;
     try {
-        let handler = Components.classes["@mozilla.org/network/protocol;1?name=http"]
-                                .getService(Components.interfaces.nsIHttpProtocolHandler);
+        let handler = Cc["@mozilla.org/network/protocol;1?name=http"]
+                        .getService(Ci.nsIHttpProtocolHandler);
 
         if (handler.oscpu.match(/^Windows/)) {
-            let wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
-                                .createInstance(Components.interfaces.nsIWindowsRegKey);
+            let wrk = Cc["@mozilla.org/windows-registry-key;1"]
+                        .createInstance(Ci.nsIWindowsRegKey);
             wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
                      "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation",
                      wrk.ACCESS_READ);
             if (wrk.hasValue("TimeZoneKeyName")) {
                 // Windows Vista and later have this key.
                 // Clear trailing garbage on this key, see bug 1129712.
                 osUserTimeZone = wrk.readStringValue("TimeZoneKeyName").split("\0")[0];
             } else {
@@ -689,17 +687,17 @@ function guessSystemTimezone() {
                     // exact match
                     return tzId;
             }
         }
     } catch (ex) {
         // zoneInfo id given was not recognized by our ZoneInfo database
         let errParams = [zoneInfoIdFromOSUserTimeZone || osUserTimeZone];
         let errMsg = calProperties.formatStringFromName("SkippingOSTimezone", errParams, 1);
-        Components.utils.reportError(errMsg + " " + ex);
+        Cu.reportError(errMsg + " " + ex);
     }
 
     // Second, give priority to "likelyTimezone"s if provided by locale.
     try {
         // The likelyTimezone property is a comma-separated list of
         // ZoneInfo timezone ids.
         const bundleTZString =
             calProperties.GetStringFromName("likelyTimezone");
@@ -720,21 +718,21 @@ function guessSystemTimezone() {
                         }
                         break;
                     case 3:
                         return tzId;
                 }
             } catch (ex) {
                 let errMsg = calProperties.formatStringFromName(
                     "SkippingLocaleTimezone", [bareTZId], 1);
-                Components.utils.reportError(errMsg + " " + ex);
+                Cu.reportError(errMsg + " " + ex);
             }
         }
     } catch (ex) { // Oh well, this didn't work, next option...
-        Components.utils.reportError(ex);
+        Cu.reportError(ex);
     }
 
     // Third, try all known timezones.
     const tzIDs = tzSvc.timezoneIds;
     while (tzIDs.hasMore()) {
         let tzId = tzIDs.getNext();
         try {
             let score = checkTZ(tzId);
@@ -747,17 +745,17 @@ function guessSystemTimezone() {
                         probableTZSource = calProperties.GetStringFromName("TZFromKnownTimezones");
                     }
                     break;
                 case 3:
                     return tzId;
             }
         } catch (ex) { // bug if ics service doesn't recognize own tzid!
             let msg = "ics-service doesn't recognize own tzid: " + tzId + "\n" + ex;
-            Components.utils.reportError(msg);
+            Cu.reportError(msg);
         }
     }
 
     // If reach here, there were no score=3 matches, so Warn in console.
     try {
         switch (probableTZScore) {
             case 0: {
                 cal.WARN(calProperties.GetStringFromName("warningUsingFloatingTZNoMatch"));
@@ -800,17 +798,17 @@ function guessSystemTimezone() {
                                      (daylightTZOffset ? "/" + daylightTZOffset : "");
                 let warningMsg = calProperties.formatStringFromName("WarningUsingGuessedTZ",
                                   [tzId, offsetString, warningDetail, probableTZSource], 4);
                 cal.WARN(warningMsg);
                 break;
             }
         }
     } catch (ex) { // don't abort if error occurs warning user
-        Components.utils.reportError(ex);
+        Cu.reportError(ex);
     }
 
     // return the guessed timezone
     return probableTZId;
 }
 
 this.NSGetFactory = (cid) => {
     Services.scriptloader.loadSubScript("resource://calendar/calendar-js/calTimezone.js", this);
--- a/calendar/base/src/calTodo.js
+++ b/calendar/base/src/calTodo.js
@@ -16,19 +16,19 @@ function calTodo() {
         DUE: true,
         COMPLETED: true,
         __proto__: this.itemBasePromotedProps
     };
 }
 
 var calTodoClassID = Components.ID("{7af51168-6abe-4a31-984d-6f8a3989212d}");
 var calTodoInterfaces = [
-    Components.interfaces.calIItemBase,
-    Components.interfaces.calITodo,
-    Components.interfaces.calIInternalShallowCopy
+    Ci.calIItemBase,
+    Ci.calITodo,
+    Ci.calIInternalShallowCopy
 ];
 calTodo.prototype = {
     __proto__: calItemBase.prototype,
 
     classID: calTodoClassID,
     QueryInterface: cal.generateQI(calTodoInterfaces),
     classInfo: cal.generateCI({
         classID: calTodoClassID,
@@ -140,17 +140,17 @@ calTodo.prototype = {
                     let icalprop = icssvc.createIcalProperty(name);
                     icalprop.value = value;
                     let propBucket = this.mPropertyParams[name];
                     if (propBucket) {
                         for (let paramName in propBucket) {
                             try {
                                 icalprop.setParameter(paramName, propBucket[paramName]);
                             } catch (e) {
-                                if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE) {
+                                if (e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
                                     // Illegal values should be ignored, but we could log them if
                                     // the user has enabled logging.
                                     cal.LOG("Warning: Invalid todo parameter value " + paramName + "=" + propBucket[paramName]);
                                 } else {
                                     throw e;
                                 }
                             }
                         }
@@ -166,17 +166,17 @@ calTodo.prototype = {
 
     todoPromotedProps: null,
 
     set icalComponent(todo) {
         this.modify();
         if (todo.componentType != "VTODO") {
             todo = todo.getFirstSubcomponent("VTODO");
             if (!todo) {
-                throw Components.results.NS_ERROR_INVALID_ARG;
+                throw Cr.NS_ERROR_INVALID_ARG;
             }
         }
 
         this.mDueDate = undefined;
         this.setItemBaseFromICS(todo);
         this.mapPropsFromICS(todo, this.icsEventPropMap);
 
         this.importUnpromotedProperties(todo, this.todoPromotedProps);
--- a/calendar/base/src/calTransactionManager.js
+++ b/calendar/base/src/calTransactionManager.js
@@ -72,18 +72,18 @@ function calTransaction(aAction, aItem, 
     this.mCalendar = aCalendar;
     this.mOldItem = aOldItem;
     this.mListener = aListener;
     this.mExtResponse = aExtResponse;
 }
 
 var calTransactionClassID = Components.ID("{fcb54c82-2fb9-42cb-bf44-1e197a55e520}");
 var calTransactionInterfaces = [
-    Components.interfaces.nsITransaction,
-    Components.interfaces.calIOperationListener
+    Ci.nsITransaction,
+    Ci.calIOperationListener
 ];
 calTransaction.prototype = {
     classID: calTransactionClassID,
     QueryInterface: ChromeUtils.generateQI(calTransactionInterfaces),
 
     mAction: null,
     mCalendar: null,
     mItem: null,
@@ -95,18 +95,18 @@ calTransaction.prototype = {
 
     onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
         if (Components.isSuccessCode(aStatus)) {
             cal.itip.checkAndSend(aOperationType,
                                   aDetail,
                                   this.mIsDoTransaction ? this.mOldItem : this.mItem,
                                   this.mExtResponse);
 
-            if (aOperationType == Components.interfaces.calIOperationListener.ADD ||
-                aOperationType == Components.interfaces.calIOperationListener.MODIFY) {
+            if (aOperationType == Ci.calIOperationListener.ADD ||
+                aOperationType == Ci.calIOperationListener.MODIFY) {
                 if (this.mIsDoTransaction) {
                     this.mItem = aDetail;
                 } else {
                     this.mOldItem = aDetail;
                 }
             }
         }
         if (this.mListener) {
@@ -154,18 +154,17 @@ calTransaction.prototype = {
                     this.mOldCalendar = this.mOldItem.calendar;
                     this.mCalendar.addItem(this.mItem, addListener);
                 }
                 break;
             case "delete":
                 this.mCalendar.deleteItem(this.mItem, this);
                 break;
             default:
-                throw new Components.Exception("Invalid action specified",
-                                               Components.results.NS_ERROR_ILLEGAL_VALUE);
+                throw new Components.Exception("Invalid action specified", Cr.NS_ERROR_ILLEGAL_VALUE);
         }
     },
 
     undoTransaction: function() {
         this.mIsDoTransaction = false;
         switch (this.mAction) {
             case "add":
                 this.mCalendar.deleteItem(this.mItem, this);
@@ -178,18 +177,17 @@ calTransaction.prototype = {
                     this.mCalendar.deleteItem(this.mItem, this);
                     this.mOldCalendar.addItem(this.mOldItem, this);
                 }
                 break;
             case "delete":
                 this.mCalendar.addItem(this.mItem, this);
                 break;
             default:
-                throw new Components.Exception("Invalid action specified",
-                                               Components.results.NS_ERROR_ILLEGAL_VALUE);
+                throw new Components.Exception("Invalid action specified", Cr.NS_ERROR_ILLEGAL_VALUE);
         }
     },
 
     redoTransaction: function() {
         this.doTransaction();
     },
 
     isTransient: false,
--- a/calendar/import-export/calHtmlExport.js
+++ b/calendar/import-export/calHtmlExport.js
@@ -93,14 +93,14 @@ calHtmlExporter.prototype = {
 
             itemContainer.appendChild(itemNode);
         }
 
         let templates = document.getElementById("templates");
         templates.remove();
 
         // Convert the javascript string to an array of bytes, using the utf8 encoder
-        let convStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
-                                   .createInstance(Components.interfaces.nsIConverterOutputStream);
+        let convStream = Cc["@mozilla.org/intl/converter-output-stream;1"]
+                           .createInstance(Ci.nsIConverterOutputStream);
         convStream.init(aStream, "UTF-8");
         convStream.writeString(cal.xml.serializeDOM(document));
     }
 };
--- a/calendar/import-export/calIcsImportExport.js
+++ b/calendar/import-export/calIcsImportExport.js
@@ -26,18 +26,18 @@ function calIcsImporter() {
 
 calIcsImporter.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.calIImporter]),
     classID: Components.ID("{1e3e33dc-445a-49de-b2b6-15b2a050bb9d}"),
 
     getFileTypes: getIcsFileTypes,
 
     importFromStream: function(aStream, aCount) {
-        let parser = Components.classes["@mozilla.org/calendar/ics-parser;1"]
-                               .createInstance(Components.interfaces.calIIcsParser);
+        let parser = Cc["@mozilla.org/calendar/ics-parser;1"]
+                       .createInstance(Ci.calIIcsParser);
         parser.parseFromStream(aStream, null);
         return parser.getItems(aCount);
     }
 };
 
 // Exporter
 function calIcsExporter() {
     this.wrappedJSObject = this;
@@ -45,14 +45,14 @@ function calIcsExporter() {
 
 calIcsExporter.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.calIExporter]),
     classID: Components.ID("{a6a524ce-adff-4a0f-bb7d-d1aaad4adc60}"),
 
     getFileTypes: getIcsFileTypes,
 
     exportToStream: function(aStream, aCount, aItems) {
-        let serializer = Components.classes["@mozilla.org/calendar/ics-serializer;1"]
-                                   .createInstance(Components.interfaces.calIIcsSerializer);
+        let serializer = Cc["@mozilla.org/calendar/ics-serializer;1"]
+                           .createInstance(Ci.calIIcsSerializer);
         serializer.addItems(aItems, aItems.length);
         serializer.serializeToStream(aStream);
     }
 };
--- a/calendar/import-export/calListFormatter.js
+++ b/calendar/import-export/calListFormatter.js
@@ -13,13 +13,13 @@ function calListFormatter() {
 
 calListFormatter.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.calIPrintFormatter]),
     classID: Components.ID("{9ae04413-fee3-45b9-8bbb-1eb39a4cbd1b}"),
 
     get name() { return cal.l10n.getCalString("formatListName"); },
 
     formatToHtml: function(aStream, aStart, aEnd, aCount, aItems, aTitle) {
-        let htmlexporter = Components.classes["@mozilla.org/calendar/export;1?type=htmllist"]
-                                     .createInstance(Components.interfaces.calIExporter);
+        let htmlexporter = Cc["@mozilla.org/calendar/export;1?type=htmllist"]
+                             .createInstance(Ci.calIExporter);
         htmlexporter.exportToStream(aStream, aCount, aItems, aTitle);
     }
 };
--- a/calendar/import-export/calMonthGridPrinter.js
+++ b/calendar/import-export/calMonthGridPrinter.js
@@ -83,18 +83,18 @@ calMonthPrinter.prototype = {
         }
 
         // Remove templates from HTML, no longer needed
         let templates = document.getElementById("templates");
         templates.remove();
 
         // Stream out the resulting HTML
         let html = cal.xml.serializeDOM(document);
-        let convStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
-                                   .createInstance(Components.interfaces.nsIConverterOutputStream);
+        let convStream = Cc["@mozilla.org/intl/converter-output-stream;1"]
+                           .createInstance(Ci.nsIConverterOutputStream);
         convStream.init(aStream, "UTF-8");
         convStream.writeString(html);
     },
 
     normalizeStartDate: function(aStart) {
         // Make sure the start date is really a date.
         let startDate = aStart.clone();
         startDate.isDate = true;
--- a/calendar/import-export/calOutlookCSVImportExport.js
+++ b/calendar/import-export/calOutlookCSVImportExport.js
@@ -110,18 +110,18 @@ calOutlookCSVImporter.prototype = {
      *
      * The rest of the lines are events, one event per line, with fields in the
      * order descibed by the first line.   All non-empty values must be quoted.
      *
      * Returns: an array of parsed calendarEvents.
      *   If the parse is cancelled, a zero length array is returned.
      */
     importFromStream: function(aStream, aCount) {
-        let scriptableInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"]
-                                              .createInstance(Components.interfaces.nsIScriptableInputStream);
+        let scriptableInputStream = Cc["@mozilla.org/scriptableinputstream;1"]
+                                      .createInstance(Ci.nsIScriptableInputStream);
         scriptableInputStream.init(aStream);
         let str = scriptableInputStream.read(-1);
 
         // parse header line of quoted comma separated column names.
         let trimEndQuotesRegExp = /^"(.*)"$/m;
         let trimResults = trimEndQuotesRegExp.exec(str);
         let header = trimResults && trimResults[1].split(/","/);
         if (header == null) {
@@ -463,17 +463,17 @@ calOutlookCSVExporter.prototype = {
             line.push(txtString(cal.category.arrayToString(item.getCategories({})))); // xxx todo: what's the correct way to encode ',' in csv?, how are multi-values expressed?
             line.push(txtString(item.getProperty("DESCRIPTION")));
             line.push(txtString(item.getProperty("LOCATION")));
             line.push(item.privacy == "PRIVATE" ? localeEn.valueTrue : localeEn.valueFalse);
 
             line = line.map(value => `"${String(value).replace(/"/g, '""')}"`);
             str = line.join(",") + exportLineEnding;
 
-            let converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
-                                      .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+            let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                              .createInstance(Ci.nsIScriptableUnicodeConverter);
             converter.charset = "UTF-8";
             str = converter.ConvertFromUnicode(str);
 
             aStream.write(str, str.length);
         }
     }
 };
--- a/calendar/import-export/calWeekPrinter.js
+++ b/calendar/import-export/calWeekPrinter.js
@@ -70,18 +70,18 @@ calWeekPrinter.prototype = {
         }
 
         // Remove templates from HTML, no longer needed
         let templates = document.getElementById("templates");
         templates.remove();
 
         // Stream out the resulting HTML
         let html = cal.xml.serializeDOM(document);
-        let convStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
-                                   .createInstance(Components.interfaces.nsIConverterOutputStream);
+        let convStream = Cc["@mozilla.org/intl/converter-output-stream;1"]
+                           .createInstance(Ci.nsIConverterOutputStream);
         convStream.init(aStream, "UTF-8");
         convStream.writeString(html);
     },
 
     setupWeek: function(document, startOfWeek, dayTable) {
         const weekdayMap = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
 
         let weekTemplate = document.getElementById("week-template");
--- a/calendar/itip/calItipEmailTransport.js
+++ b/calendar/itip/calItipEmailTransport.js
@@ -236,23 +236,23 @@ calItipEmailTransport.prototype = {
                 };
                 let toMap = aToList.map(cbEmail).filter(value => value.length);
                 if (toMap.length < aToList.length) {
                     // at least one invalid recipient, so we skip sending for this message
                     return false;
                 }
                 let toList = toMap.join(", ");
                 let composeUtils = Cc["@mozilla.org/messengercompose/computils;1"]
-                                   .createInstance(Ci.nsIMsgCompUtils);
+                                     .createInstance(Ci.nsIMsgCompUtils);
                 let messageId = composeUtils.msgGenerateMessageId(identity);
                 let mailFile = this._createTempImipFile(toList, aSubject, aBody, aItipItem, identity, messageId);
                 if (mailFile) {
                     // compose fields for message: from/to etc need to be specified both here and in the file
                     let composeFields = Cc["@mozilla.org/messengercompose/composefields;1"]
-                                        .createInstance(Ci.nsIMsgCompFields);
+                                          .createInstance(Ci.nsIMsgCompFields);
                     composeFields.characterSet = "UTF-8";
                     composeFields.to = toList;
                     let mailfrom = (identity.fullName.length ? identity.fullName + " <" + identity.email + ">" : identity.email);
                     composeFields.from = (cal.email.validateRecipientList(mailfrom) == mailfrom ? mailfrom : identity.email);
                     composeFields.replyTo = identity.replyTo;
                     composeFields.organization = identity.organization;
                     composeFields.messageId = messageId;
                     let validRecipients;
@@ -269,18 +269,17 @@ calItipEmailTransport.prototype = {
                             composeFields.bcc = validRecipients;
                         }
                     }
 
                     // xxx todo: add send/progress UI, maybe recycle
                     //           "@mozilla.org/messengercompose/composesendlistener;1"
                     //           and/or "chrome://messenger/content/messengercompose/sendProgress.xul"
                     // i.e. bug 432662
-                    let msgSend = Cc["@mozilla.org/messengercompose/send;1"]
-                                  .createInstance(Ci.nsIMsgSend);
+                    let msgSend = Cc["@mozilla.org/messengercompose/send;1"].createInstance(Ci.nsIMsgSend);
                     msgSend.sendMessageFile(identity,
                                             account.key,
                                             composeFields,
                                             mailFile,
                                             true,  // deleteSendFileOnCompletion
                                             false, // digest_p
                                             (Services.io.offline ? Ci.nsIMsgSend.nsMsgQueueForLater
                                                     : Ci.nsIMsgSend.nsMsgDeliverNow),
@@ -307,17 +306,17 @@ calItipEmailTransport.prototype = {
         }
         return false;
     },
 
     _createTempImipFile: function(aToList, aSubject, aBody, aItipItem, aIdentity, aMessageId) {
         try {
             let itemList = aItipItem.getItemList({});
             let serializer = Cc["@mozilla.org/calendar/ics-serializer;1"]
-                             .createInstance(Ci.calIIcsSerializer);
+                               .createInstance(Ci.calIIcsSerializer);
             serializer.addItems(itemList, itemList.length);
             let methodProp = cal.getIcsService().createIcalProperty("METHOD");
             methodProp.value = aItipItem.responseMethod;
             serializer.addProperty(methodProp);
             let calText = serializer.serializeToString();
             let utf8CalText = ltn.invitation.encodeUTF8(calText);
 
             // Home-grown mail composition; I'd love to use nsIMimeEmitter, but it's not clear to me whether
@@ -355,17 +354,17 @@ calItipEmailTransport.prototype = {
             cal.LOG("mail text:\n" + mailText);
 
             let tempFile = Services.dirsvc.get("TmpD", Ci.nsIFile);
             tempFile.append("itipTemp");
             tempFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE,
                                   parseInt("0600", 8));
 
             let outputStream = Cc["@mozilla.org/network/file-output-stream;1"]
-                               .createInstance(Ci.nsIFileOutputStream);
+                                 .createInstance(Ci.nsIFileOutputStream);
             // Let's write the file - constants from file-utils.js
             const MODE_WRONLY = 0x02;
             const MODE_CREATE = 0x08;
             const MODE_TRUNCATE = 0x20;
             outputStream.init(tempFile,
                               MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE,
                               parseInt("0600", 8),
                               0);
--- a/calendar/lightning/components/calItipProtocolHandler.js
+++ b/calendar/lightning/components/calItipProtocolHandler.js
@@ -6,17 +6,17 @@ ChromeUtils.import("resource://gre/modul
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 
 var ITIP_HANDLER_MIMETYPE = "application/x-itip-internal";
 var ITIP_HANDLER_PROTOCOL = "moz-cal-handle-itip";
 var NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001;
 
 
 function NYI() {
-    throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
 }
 
 function ItipChannel(URI) {
     this.wrappedJSObject = this;
     this.URI = this.originalURI = URI;
 }
 ItipChannel.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]),
@@ -34,17 +34,17 @@ ItipChannel.prototype = {
     asyncOpen: function(observer, ctxt) {
         observer.onStartRequest(this, ctxt);
     },
     asyncRead: function(listener, ctxt) {
         return listener.onStartRequest(this, ctxt);
     },
 
     isPending: function() { return true; },
-    status: Components.results.NS_OK,
+    status: Cr.NS_OK,
     cancel: function(status) { this.status = status; },
     suspend: NYI,
     resume: NYI,
 };
 
 function ItipProtocolHandler() {
     this.wrappedJSObject = this;
 }
@@ -52,21 +52,20 @@ ItipProtocolHandler.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolHandler]),
     classID: Components.ID("{6e957006-b4ce-11d9-b053-001124736B74}"),
 
     protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE | Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
     allowPort: () => false,
     isSecure: false,
     newURI: function(spec, charSet, baseURI) {
         dump("Creating new URI for " + spec + "\n");
-        return Components.classes["@mozilla.org/network/standard-url-mutator;1"]
-                         .createInstance(Ci.nsIStandardURLMutator)
-                         .init(Ci.nsIStandardURL.URLTYPE_STANDARD, 0,
-                               spec, charSet, baseURI)
-                         .finalize();
+        return Cc["@mozilla.org/network/standard-url-mutator;1"]
+                 .createInstance(Ci.nsIStandardURLMutator)
+                 .init(Ci.nsIStandardURL.URLTYPE_STANDARD, 0, spec, charSet, baseURI)
+                 .finalize();
     },
 
     newChannel: function(URI) {
         return this.newChannel2(URI, null);
     },
 
     newChannel2: function(URI, aLoadInfo) {
         dump("Creating new ItipChannel for " + URI + "\n");
--- a/calendar/lightning/components/lightningTextCalendarConverter.js
+++ b/calendar/lightning/components/lightningTextCalendarConverter.js
@@ -13,18 +13,17 @@ function ltnMimeConverter() {
 
 ltnMimeConverter.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleMimeConverter]),
     classID: Components.ID("{c70acb08-464e-4e55-899d-b2c84c5409fa}"),
 
     uri: null,
 
     convertToHTML: function(contentType, data) {
-        let parser = Components.classes["@mozilla.org/calendar/ics-parser;1"]
-                               .createInstance(Components.interfaces.calIIcsParser);
+        let parser = Cc["@mozilla.org/calendar/ics-parser;1"].createInstance(Ci.calIIcsParser);
         parser.parseString(data);
         let event = null;
         for (let item of parser.getItems({})) {
             if (cal.item.isEvent(item)) {
                 if (item.hasProperty("X-MOZ-FAKED-MASTER")) {
                     // if it's a faked master, take any overridden item to get a real occurrence:
                     let exc = item.recurrenceInfo.getExceptionFor(item.startDate);
                     cal.ASSERT(exc, "unexpected!");
@@ -39,25 +38,24 @@ ltnMimeConverter.prototype = {
         if (!event) {
             return "";
         }
 
         let itipItem = null;
         let msgOverlay = "";
         let msgWindow = null;
 
-        itipItem = Components.classes["@mozilla.org/calendar/itip-item;1"]
-                             .createInstance(Components.interfaces.calIItipItem);
+        itipItem = Cc["@mozilla.org/calendar/itip-item;1"].createInstance(Ci.calIItipItem);
         itipItem.init(data);
 
         // this.uri is the message URL that we are processing.
         // We use it to get the nsMsgHeaderSink to store the calItipItem.
         if (this.uri) {
             try {
-                let msgUrl = this.uri.QueryInterface(Components.interfaces.nsIMsgMailNewsUrl);
+                let msgUrl = this.uri.QueryInterface(Ci.nsIMsgMailNewsUrl);
                 msgWindow = msgUrl.msgWindow;
                 itipItem.sender = msgUrl.mimeHeaders.extractHeader("From", false);
             } catch (exc) {
                 // msgWindow is optional in some scenarios
                 // (e.g. gloda in action, throws NS_ERROR_INVALID_POINTER then)
             }
         }
 
--- a/calendar/lightning/content/imip-bar.js
+++ b/calendar/lightning/content/imip-bar.js
@@ -82,18 +82,17 @@ var ltnImipBar = {
     observe: function(subject, topic, state) {
         if (topic == "onItipItemCreation") {
             let itipItem = null;
             let msgOverlay = null;
             try {
                 if (!subject) {
                     let sinkProps = msgWindow.msgHeaderSink.properties;
                     // This property was set by lightningTextCalendarConverter.js
-                    itipItem = sinkProps.getPropertyAsInterface("itipItem",
-                                                                Components.interfaces.calIItipItem);
+                    itipItem = sinkProps.getPropertyAsInterface("itipItem", Ci.calIItipItem);
                     msgOverlay = sinkProps.getPropertyAsAUTF8String("msgOverlay");
                 }
             } catch (e) {
                 // This will throw on every message viewed that doesn't have the
                 // itipItem property set on it. So we eat the errors and move on.
 
                 // XXX TODO: Only swallow the errors we need to. Throw all others.
             }
@@ -210,22 +209,20 @@ var ltnImipBar = {
         // We need this to determine whether this is an outgoing or incoming message because
         // Thunderbird doesn't provide a distinct flag on message level to do so. Relying on
         // folder flags only may lead to false positives.
         let isOutgoing = function(aMsgHdr) {
             if (!aMsgHdr) {
                 return false;
             }
             let author = aMsgHdr.mime2DecodedAuthor;
-            let isSentFolder = aMsgHdr.folder && aMsgHdr.folder.flags &
-                               Components.interfaces.nsMsgFolderFlags.SentMail;
+            let isSentFolder = aMsgHdr.folder && aMsgHdr.folder.flags & Ci.nsMsgFolderFlags.SentMail;
             if (author && isSentFolder) {
                 let accounts = MailServices.accounts;
-                for (let identity of fixIterator(accounts.allIdentities,
-                                                 Components.interfaces.nsIMsgIdentity)) {
+                for (let identity of fixIterator(accounts.allIdentities, Ci.nsIMsgIdentity)) {
                     if (author.includes(identity.email) && !identity.fccReplyFollowsParent) {
                         return true;
                     }
                 }
             }
             return false;
         };
 
@@ -381,17 +378,17 @@ var ltnImipBar = {
                     },
                     onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
                     }
                 };
 
                 try {
                     aActionFunc(opListener, aParticipantStatus, aExtResponse);
                 } catch (exc) {
-                    Components.utils.reportError(exc);
+                    Cu.reportError(exc);
                 }
                 return true;
             }
             return false;
         }
 
         if (aParticipantStatus == null) {
             aParticipantStatus = "";
@@ -454,25 +451,25 @@ var ltnImipBar = {
                     null,
                     counterProposal
                 );
             }
         } else {
             let response;
             if (aResponse) {
                 if (aResponse == "AUTO" || aResponse == "NONE" || aResponse == "USER") {
-                    response = { responseMode: Components.interfaces.calIItipItem[aResponse] };
+                    response = { responseMode: Ci.calIItipItem[aResponse] };
                 }
                 // Open an extended response dialog to enable the user to add a comment, make a
                 // counterproposal, delegate the event or interact in another way.
                 // Instead of a dialog, this might be implemented as a separate container inside the
                 // imip-overlay as proposed in bug 458578
             }
-            let delmgr = Components.classes["@mozilla.org/calendar/deleted-items-manager;1"]
-                                   .getService(Components.interfaces.calIDeletedItems);
+            let delmgr = Cc["@mozilla.org/calendar/deleted-items-manager;1"]
+                           .getService(Ci.calIDeletedItems);
             let items = ltnImipBar.itipItem.getItemList({});
             if (items && items.length) {
                 let delTime = delmgr.getDeletedDate(items[0].id);
                 let dialogText = cal.l10n.getLtnString("confirmProcessInvitation");
                 let dialogTitle = cal.l10n.getLtnString("confirmProcessInvitationTitle");
                 if (delTime && !Services.prompt.confirm(window, dialogTitle, dialogText)) {
                     return false;
                 }
--- a/calendar/lightning/content/lightning-item-iframe.js
+++ b/calendar/lightning/content/lightning-item-iframe.js
@@ -64,18 +64,17 @@ var gConfig = {
 //   - gTimezoneEnabled
 //   - gShowLink
 
 var eventDialogQuitObserver = {
     observe: function(aSubject, aTopic, aData) {
         // Check whether or not we want to veto the quit request (unless another
         // observer already did.
         if (aTopic == "quit-application-requested" &&
-            (aSubject instanceof Components.interfaces.nsISupportsPRBool) &&
-            !aSubject.data) {
+            (aSubject instanceof Ci.nsISupportsPRBool) && !aSubject.data) {
             aSubject.data = !onCancel();
         }
     }
 };
 
 var eventDialogCalendarObserver = {
     target: null,
     isObserving: false,
@@ -83,17 +82,17 @@ var eventDialogCalendarObserver = {
     onModifyItem: function(aNewItem, aOldItem) {
         if (this.isObserving && "calendarItem" in window &&
             window.calendarItem && window.calendarItem.id == aOldItem.id) {
             let doUpdate = true;
 
             // The item has been modified outside the dialog. We only need to
             // prompt if there have been local changes also.
             if (isItemChanged()) {
-                let promptService = Components.interfaces.nsIPromptService;
+                let promptService = Ci.nsIPromptService;
                 let promptTitle = cal.l10n.getCalString("modifyConflictPromptTitle");
                 let promptMessage = cal.l10n.getCalString("modifyConflictPromptMessage");
                 let promptButton1 = cal.l10n.getCalString("modifyConflictPromptButton1");
                 let promptButton2 = cal.l10n.getCalString("modifyConflictPromptButton2");
                 let flags = promptService.BUTTON_TITLE_IS_STRING *
                             promptService.BUTTON_POS_0 +
                             promptService.BUTTON_TITLE_IS_STRING *
                             promptService.BUTTON_POS_1;
@@ -155,17 +154,17 @@ var eventDialogCalendarObserver = {
  * Checks if the given calendar supports notifying attendees. The item is needed
  * since calendars may support notifications for only some types of items.
  *
  * @param {calICalendar} aCalendar  The calendar to check
  * @param {calIItemBase} aItem      The item to check support for
  */
 function canNotifyAttendees(aCalendar, aItem) {
     try {
-        let calendar = aCalendar.QueryInterface(Components.interfaces.calISchedulingSupport);
+        let calendar = aCalendar.QueryInterface(Ci.calISchedulingSupport);
         return (calendar.canNotify("REQUEST", aItem) && calendar.canNotify("CANCEL", aItem));
     } catch (exc) {
         return false;
     }
 }
 
 /**
  * Sends an asynchronous message to the parent context that contains the
@@ -458,17 +457,17 @@ function onCommandCancel() {
         return true;
     }
 
     if (gInTab && gTabInfoObject) {
         // Switch to the tab that the prompt refers to.
         gTabmail.switchToTab(gTabInfoObject);
     }
 
-    let promptService = Components.interfaces.nsIPromptService;
+    let promptService = Ci.nsIPromptService;
 
     let promptTitle = cal.l10n.getCalString(
         cal.item.isEvent(window.calendarItem) ? "askSaveTitleEvent" : "askSaveTitleTask"
     );
     let promptMessage = cal.l10n.getCalString(
         cal.item.isEvent(window.calendarItem) ? "askSaveMessageEvent" : "askSaveMessageTask"
     );
 
@@ -1380,17 +1379,17 @@ function getRepeatTypeAndUntilDate(aItem
         for (let ritem of ritems) {
             if (ritem.isNegative) {
                 exceptions.push(ritem);
             } else {
                 rules.push(ritem);
             }
         }
         if (rules.length == 1) {
-            let rule = cal.wrapInstance(rules[0], Components.interfaces.calIRecurrenceRule);
+            let rule = cal.wrapInstance(rules[0], Ci.calIRecurrenceRule);
             if (rule) {
                 switch (rule.type) {
                     case "DAILY": {
                         let byparts = [
                             "BYSECOND", "BYMINUTE", "BYHOUR", "BYMONTHDAY",
                             "BYYEARDAY", "BYWEEKNO", "BYMONTH", "BYSETPOS"
                         ];
                         if (!checkRecurrenceRule(rule, byparts)) {
@@ -1663,17 +1662,17 @@ function untilDateCompensation(aItem) {
  */
 function updateTitle() {
     let strName;
     if (cal.item.isEvent(window.calendarItem)) {
         strName = (window.mode == "new" ? "newEventDialog" : "editEventDialog");
     } else if (cal.item.isToDo(window.calendarItem)) {
         strName = (window.mode == "new" ? "newTaskDialog" : "editTaskDialog");
     } else {
-        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     }
     let newTitle = cal.l10n.getCalString(strName) + ": " + getElementValue("item-title");
     sendMessage({ command: "updateTitle", argument: newTitle });
 }
 
 /**
  * Update the disabled status of the accept button. The button is enabled if all
  * parts of the dialog have options selected that make sense.
@@ -2125,41 +2124,39 @@ function attachFileByAccountKey(aAccount
  *
  * @param cloudProvider     If set, the cloud provider will be used for attaching
  */
 function attachFile(cloudProvider) {
     if (!cloudProvider) {
         cal.ERROR("[calendar-event-dialog] Could not attach file without cloud provider" + cal.STACK(10));
     }
 
-    const nsIFilePicker = Components.interfaces.nsIFilePicker;
-    let filePicker = Components.classes["@mozilla.org/filepicker;1"]
-                               .createInstance(nsIFilePicker);
+    let filePicker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     filePicker.init(window,
                     cal.l10n.getString("calendar-event-dialog", "selectAFile"),
-                    nsIFilePicker.modeOpenMultiple);
+                    Ci.nsIFilePicker.modeOpenMultiple);
 
     // Check for the last directory
     let lastDir = lastDirectory();
     if (lastDir) {
         filePicker.displayDirectory = lastDir;
     }
 
     filePicker.open(rv => {
-        if (rv != nsIFilePicker.returnOK || !filePicker.files) {
+        if (rv != Ci.nsIFilePicker.returnOK || !filePicker.files) {
             return;
         }
         let files = filePicker.files;
 
         // Create the attachment
         while (files.hasMoreElements()) {
-            let file = files.getNext().QueryInterface(Components.interfaces.nsIFile);
+            let file = files.getNext().QueryInterface(Ci.nsIFile);
 
             let fileHandler = Services.io.getProtocolHandler("file")
-                                         .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+                                         .QueryInterface(Ci.nsIFileProtocolHandler);
             let uriSpec = fileHandler.getURLSpecFromFile(file);
 
             if (!(uriSpec in gAttachMap)) {
                 // If the attachment hasn't been added, then set the last display
                 // directory.
                 lastDirectory(uriSpec);
 
                 // ... and add the attachment.
@@ -2182,18 +2179,18 @@ function attachFile(cloudProvider) {
  *                                 returned. If null, the last chosen directory
  *                                 will be returned.
  * @return            The last directory that was set with this function.
  */
 function lastDirectory(aFileUri) {
     if (aFileUri) {
         // Act similar to a setter, save the passed uri.
         let uri = Services.io.newURI(aFileUri);
-        let file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;
-        lastDirectory.mValue = file.parent.QueryInterface(Components.interfaces.nsIFile);
+        let file = uri.QueryInterface(Ci.nsIFileURL).file;
+        lastDirectory.mValue = file.parent.QueryInterface(Ci.nsIFile);
     }
 
     // In any case, return the value
     return (lastDirectory.mValue === undefined ? null : lastDirectory.mValue);
 }
 
 /**
  * Turns an url into a string that can be used in UI.
@@ -2218,17 +2215,17 @@ function makePrettyName(aUri) {
  * Asynchronously uploads the given attachment to the cloud provider, updating
  * the passed listItem as things progress.
  *
  * @param attachment        A calIAttachment to upload
  * @param cloudProvider     The clould provider to upload to
  * @param listItem          The listitem in attachment-link listbox to update.
  */
 function uploadCloudAttachment(attachment, cloudProvider, listItem) {
-    let file = attachment.uri.QueryInterface(Components.interfaces.nsIFileURL).file;
+    let file = attachment.uri.QueryInterface(Ci.nsIFileURL).file;
     listItem.attachLocalFile = file;
     listItem.attachCloudProvider = cloudProvider;
     cloudProvider.uploadFile(file, {
         onStartRequest: function() {
             listItem.setAttribute("image", "chrome://global/skin/icons/loading.png");
         },
 
         onStopRequest: function(aRequest, aContext, aStatusCode) {
@@ -2406,32 +2403,32 @@ function deleteAllAttachments() {
  * Opens the selected attachment using the external protocol service.
  * @see nsIExternalProtocolService
  */
 function openAttachment() {
     // Only one file has to be selected and we don't handle base64 files at all
     let documentLink = document.getElementById("attachment-link");
     if (documentLink.selectedItem) {
         let attURI = documentLink.selectedItem.attachment.uri;
-        let externalLoader = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
-                                       .getService(Components.interfaces.nsIExternalProtocolService);
+        let externalLoader = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+                               .getService(Ci.nsIExternalProtocolService);
         // TODO There should be a nicer dialog
         externalLoader.loadURI(attURI);
     }
 }
 
 /**
  * Copies the link location of the first selected attachment to the clipboard
  */
 function copyAttachment() {
     let documentLink = document.getElementById("attachment-link");
     if (documentLink.selectedItem) {
         let attURI = documentLink.selectedItem.attachment.uri.spec;
-        let clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
-                                  .getService(Components.interfaces.nsIClipboardHelper);
+        let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+                          .getService(Ci.nsIClipboardHelper);
         clipboard.copyString(attURI);
     }
 }
 
 /**
  * Handler function to handle pressing keys in the attachment listbox.
  *
  * @param aEvent     The DOM event caused by the key press.
@@ -3166,18 +3163,18 @@ function onCommandSave(aIsClosing) {
             // this triggers the update of the imipbar in case this is a rescheduling case
             if (window.counterProposal && window.counterProposal.onReschedule) {
                 window.counterProposal.onReschedule();
             }
         },
         onGetResult: function() {}
     };
     let resp = document.getElementById("notify-attendees-checkbox").checked
-             ? Components.interfaces.calIItipItem.AUTO
-             : Components.interfaces.calIItipItem.NONE;
+             ? Ci.calIItipItem.AUTO
+             : Ci.calIItipItem.NONE;
     let extResponse = { responseMode: resp };
     window.onAcceptCallback(item, calendar, originalItem, listener, extResponse);
 }
 
 /**
  * This function is called when the user chooses to delete an Item
  * from the Event/Task dialog
  *
@@ -3660,17 +3657,17 @@ function showOrHideItemURL(aShow, aUrl) 
             handler = Services.io.getProtocolHandler(uri.scheme);
         } catch (e) {
             // No protocol handler for the given protocol, or invalid uri
             // hideOrShow(false);
             return false;
         }
         // Only show if its either an internal protcol handler, or its external
         // and there is an external app for the scheme
-        handler = cal.wrapInstance(handler, Components.interfaces.nsIExternalProtocolHandler);
+        handler = cal.wrapInstance(handler, Ci.nsIExternalProtocolHandler);
         return !handler || handler.externalAppExistsForScheme(uri.scheme);
     } else {
         // Hide if there is no url, or the menuitem was chosen so that the url
         // should be hidden.
         return false;
     }
 }
 
--- a/calendar/lightning/content/lightning-item-panel.js
+++ b/calendar/lightning/content/lightning-item-panel.js
@@ -457,18 +457,18 @@ function openNewTask() {
 /**
  * Open a new Thunderbird compose window.
  */
 function openNewMessage() {
     MailServices.compose.OpenComposeWindow(
         null,
         null,
         null,
-        Components.interfaces.nsIMsgCompType.New,
-        Components.interfaces.nsIMsgCompFormat.Default,
+        Ci.nsIMsgCompType.New,
+        Ci.nsIMsgCompFormat.Default,
         null,
         null
     );
 }
 
 /**
  * Open a new addressbook window
  */
--- a/calendar/lightning/content/lightning-migration.xul
+++ b/calendar/lightning/content/lightning-migration.xul
@@ -17,18 +17,17 @@
 [
 ]>
 
 <overlay id="ltnMigrationOverlay"
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     <script type="application/javascript" src="chrome://calendar/content/calendar-migration-dialog.js"/>
     <script type="application/javascript"><![CDATA[
         function checkOld() {
-            var calMgr = Components.classes["@mozilla.org/calendar/manager;1"]
-                                   .getService(Components.interfaces.calICalendarManager);
+            var calMgr = Cc["@mozilla.org/calendar/manager;1"].getService(Ci.calICalendarManager);
             var cals = calMgr.getCalendars({});
             if (!cals.length) {
                 // There are no calendars, so we are running for the first time
                 gDataMigrator.checkAndMigrate();
             }
         }
         window.addEventListener("load", checkOld, { capture: false, once: true });
     ]]></script>
--- a/calendar/lightning/content/lightning-utils.js
+++ b/calendar/lightning/content/lightning-utils.js
@@ -44,23 +44,23 @@ function ltnInitMailIdentitiesRow() {
 
     addMenuItem(menuPopup, cal.l10n.getLtnString("imipNoIdentity"), "none");
     let identities;
     if (gCalendar && gCalendar.aclEntry && gCalendar.aclEntry.hasAccessControl) {
         identities = gCalendar.aclEntry.getOwnerIdentities({});
     } else {
         identities = MailServices.accounts.allIdentities;
     }
-    for (let identity of fixIterator(identities, Components.interfaces.nsIMsgIdentity)) {
+    for (let identity of fixIterator(identities, Ci.nsIMsgIdentity)) {
         addMenuItem(menuPopup, identity.identityName, identity.key);
     }
     try {
         let sel = gCalendar.getProperty("imip.identity");
         if (sel) {
-            sel = sel.QueryInterface(Components.interfaces.nsIMsgIdentity);
+            sel = sel.QueryInterface(Ci.nsIMsgIdentity);
         }
         menuListSelectItem("email-identity-menulist", sel ? sel.key : "none");
     } catch (exc) {
         // Don't select anything if the identity can't be found
     }
 }
 
 /**
--- a/calendar/lightning/content/messenger-overlay-sidebar.js
+++ b/calendar/lightning/content/messenger-overlay-sidebar.js
@@ -208,17 +208,17 @@ var calendarItemTabType = {
 
         // Generate and set the tab title.
         let strName;
         if (aTab.mode.type == "calendarEvent") {
             strName = aArgs.calendarEvent.title ? "editEventDialog" : "newEventDialog";
         } else if (aTab.mode.type == "calendarTask") {
             strName = aArgs.calendarEvent.title ? "editTaskDialog" : "newTaskDialog";
         } else {
-            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+            throw Cr.NS_ERROR_NOT_IMPLEMENTED;
         }
         // name is "New Event", "Edit Task", etc.
         let name = cal.l10n.getCalString(strName);
         aTab.title = name + ": " + (aArgs.calendarEvent.title || name);
 
         // allowTabClose prevents the tab from being closed until we ask
         // the user if they want to save any unsaved changes.
         aTab.allowTabClose = false;
@@ -774,17 +774,17 @@ function moveEventToolbox(aDestination) 
 }
 
 /**
  * Checks if Lightning's binary component was successfully loaded.
  */
 function checkCalendarBinaryComponent() {
     // Don't even get started if we are running ical.js or the binary component
     // was successfully loaded.
-    if ("@mozilla.org/calendar/datetime;1" in Components.classes ||
+    if ("@mozilla.org/calendar/datetime;1" in Cc ||
         Preferences.get("calendar.icaljs", false)) {
         return;
     }
 
     const THUNDERBIRD_GUID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
     const SEAMONKEY_GUID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
     const LIGHTNING_GUID = "{e2fda1a4-762b-4020-b5ad-a41df1933103}";
 
--- a/calendar/lightning/modules/ltnInvitationUtils.jsm
+++ b/calendar/lightning/modules/ltnInvitationUtils.jsm
@@ -81,43 +81,42 @@ ltn.invitation = {
      * @param  {calItipItem}  aItipItem  The itip item, which containes aEvent.
      * @return {DOM}                     The html representation of aEvent.
      */
     createInvitationOverlay: function(aEvent, aItipItem) {
         // Creates HTML using the Node strings in the properties file
         let doc = cal.xml.parseFile("chrome://lightning/content/lightning-invitation.xhtml");
         let formatter = cal.getDateFormatter();
 
-        let linkConverter = Components.classes["@mozilla.org/txttohtmlconv;1"]
-                                      .getService(Components.interfaces.mozITXTToHTMLConv);
+        let linkConverter = Cc["@mozilla.org/txttohtmlconv;1"].getService(Ci.mozITXTToHTMLConv);
 
         let field = function(aField, aContentText, aConvert) {
             let descr = doc.getElementById("imipHtml-" + aField + "-descr");
             if (descr) {
                 let labelText = cal.l10n.getLtnString("imipHtml." + aField);
                 descr.textContent = labelText;
             }
 
             if (aContentText) {
                 let content = doc.getElementById("imipHtml-" + aField + "-content");
                 doc.getElementById("imipHtml-" + aField + "-row").hidden = false;
                 if (aConvert) {
                     // we convert special characters first to not mix up html conversion
-                    let mode = Components.interfaces.mozITXTToHTMLConv.kEntities;
+                    let mode = Ci.mozITXTToHTMLConv.kEntities;
                     let contentText = linkConverter.scanTXT(aContentText, mode);
                     try {
                         // kGlyphSubstitution may lead to unexpected results when used in scanHTML
-                        mode = Components.interfaces.mozITXTToHTMLConv.kStructPhrase +
-                               Components.interfaces.mozITXTToHTMLConv.kGlyphSubstitution +
-                               Components.interfaces.mozITXTToHTMLConv.kURLs;
+                        mode = Ci.mozITXTToHTMLConv.kStructPhrase +
+                               Ci.mozITXTToHTMLConv.kGlyphSubstitution +
+                               Ci.mozITXTToHTMLConv.kURLs;
                         // eslint-disable-next-line no-unsanitized/property
                         content.innerHTML = linkConverter.scanHTML(contentText, mode);
                     } catch (e) {
-                        mode = Components.interfaces.mozITXTToHTMLConv.kStructPhrase +
-                               Components.interfaces.mozITXTToHTMLConv.kURLs;
+                        mode = Ci.mozITXTToHTMLConv.kStructPhrase +
+                               Ci.mozITXTToHTMLConv.kURLs;
                         // eslint-disable-next-line no-unsanitized/property
                         content.innerHTML = linkConverter.scanHTML(contentText, mode);
                     }
                 } else {
                     content.textContent = aContentText;
                 }
             }
         };
@@ -149,17 +148,17 @@ ltn.invitation = {
             let modifiedOccurrences = [];
 
             let dateComptor = function(a, b) {
                 return a.startDate.compare(b.startDate);
             };
 
             // Show removed instances
             for (let exc of aEvent.recurrenceInfo.getRecurrenceItems({})) {
-                if (exc instanceof Components.interfaces.calIRecurrenceDate) {
+                if (exc instanceof Ci.calIRecurrenceDate) {
                     if (exc.isNegative) {
                         // This is an EXDATE
                         let excDate = exc.date.getInTimezone(kDefaultTimezone);
                         formattedExDates.push(formatter.formatDateTime(excDate));
                     } else {
                         // This is an RDATE, close enough to a modified occurrence
                         let excItem = aEvent.recurrenceInfo.getOccurrenceFor(exc.date);
                         cal.data.binaryInsert(modifiedOccurrences, excItem, dateComptor, true);
@@ -491,18 +490,18 @@ ltn.invitation = {
 
     /**
      * Converts a given unicode text
      * @param  {String} aCharset   target character set
      * @param  {String} aSrc       unicode text to convert
      * @return {String}            the converted string
      */
     convertFromUnicode: function(aCharset, aSrc) {
-        let unicodeConverter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
-                                         .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+        let unicodeConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+                                 .createInstance(Ci.nsIScriptableUnicodeConverter);
         unicodeConverter.charset = aCharset;
         return unicodeConverter.ConvertFromUnicode(aSrc);
     },
 
     /**
      * Converts a header to a mime encoded header
      * @param  {String}  aHeader   a header to encode
      * @param  {boolean} aIsEmail  if enabled, only the CN but not the email address gets
@@ -510,19 +509,17 @@ ltn.invitation = {
      * @return {String}            the encoded string
      */
     encodeMimeHeader: function(aHeader, aIsEmail = false) {
         let fieldNameLen = aHeader.indexOf(": ") + 2;
         return MailServices.mimeConverter
                            .encodeMimePartIIStr_UTF8(aHeader,
                                                      aIsEmail,
                                                      fieldNameLen,
-                                                     Components.interfaces
-                                                               .nsIMimeConverter
-                                                               .MIME_ENCODED_WORD_SIZE);
+                                                     Ci.nsIMimeConverter.MIME_ENCODED_WORD_SIZE);
     },
 
     /**
      * Parses a counterproposal to extract differences to the existing event
      * @param  {calIEvent|calITodo} aProposedItem  The counterproposal
      * @param  {calIEvent|calITodo} aExistingItem  The item to compare with
      * @return {JSObject}                          Objcet of result and differences of parsing
      * @return {String} JsObject.result.type       Parsing result: OK|OLDVERSION|ERROR|NODIFF
--- a/calendar/providers/caldav/calDavCalendar.js
+++ b/calendar/providers/caldav/calDavCalendar.js
@@ -18,17 +18,17 @@ var { cal } = ChromeUtils.import("resour
 var xmlHeader = '<?xml version="1.0" encoding="UTF-8"?>\n';
 
 var davNS = "DAV:";
 var caldavNS = "urn:ietf:params:xml:ns:caldav";
 var calservNS = "http://calendarserver.org/ns/";
 var MIME_TEXT_CALENDAR = "text/calendar; charset=utf-8";
 var MIME_TEXT_XML = "text/xml; charset=utf-8";
 
-var cIOL = Components.interfaces.calIOperationListener;
+var cIOL = Ci.calIOperationListener;
 
 function caldavNSResolver(prefix) {
     /* eslint-disable id-length */
     const namespaces = {
         D: davNS,
         C: caldavNS,
         CS: calservNS
     };
@@ -67,42 +67,36 @@ function calDavCalendar() {
     this.mProposedCtag = null;
 
     // By default, support both events and todos.
     this.mGenerallySupportedItemTypes = ["VEVENT", "VTODO"];
     this.mSupportedItemTypes = this.mGenerallySupportedItemTypes.slice(0);
     this.mACLProperties = {};
 }
 
-// some shorthand
-var calICalendar = Components.interfaces.calICalendar;
-var calIErrors = Components.interfaces.calIErrors;
-var calIFreeBusyInterval = Components.interfaces.calIFreeBusyInterval;
-var calICalDavCalendar = Components.interfaces.calICalDavCalendar;
-
 // used in checking calendar URI for (Cal)DAV-ness
 var kDavResourceTypeNone = 0;
 var kDavResourceTypeCollection = 1;
 var kDavResourceTypeCalendar = 2;
 
 // used for etag checking
 var CALDAV_MODIFY_ITEM = "modify";
 var CALDAV_DELETE_ITEM = "delete";
 
 var calDavCalendarClassID = Components.ID("{a35fc6ea-3d92-11d9-89f9-00045ace3b8d}");
 var calDavCalendarInterfaces = [
-    Components.interfaces.calICalendarProvider,
-    Components.interfaces.nsIInterfaceRequestor,
-    Components.interfaces.calIFreeBusyProvider,
-    Components.interfaces.nsIChannelEventSink,
-    Components.interfaces.calIItipTransport,
-    Components.interfaces.calISchedulingSupport,
-    Components.interfaces.calICalendar,
-    Components.interfaces.calIChangeLog,
-    calICalDavCalendar,
+    Ci.calICalendarProvider,
+    Ci.nsIInterfaceRequestor,
+    Ci.calIFreeBusyProvider,
+    Ci.nsIChannelEventSink,
+    Ci.calIItipTransport,
+    Ci.calISchedulingSupport,
+    Ci.calICalendar,
+    Ci.calIChangeLog,
+    Ci.calICalDavCalendar,
 ];
 calDavCalendar.prototype = {
     __proto__: cal.provider.BaseClass.prototype,
     classID: calDavCalendarClassID,
     QueryInterface: cal.generateQI(calDavCalendarInterfaces),
     classInfo: cal.generateCI({
         classID: calDavCalendarClassID,
         contractID: "@mozilla.org/calendar/calendar;1?type=caldav",
@@ -126,19 +120,18 @@ calDavCalendar.prototype = {
 
     mLastRedirectStatus: null,
 
     ensureTargetCalendar: function() {
         if (!this.isCached && !this.mOfflineStorage) {
             // If this is a cached calendar, the actual cache is taken care of
             // by the calCachedCalendar facade. In any other case, we use a
             // memory calendar to cache things.
-            this.mOfflineStorage = Components
-                                   .classes["@mozilla.org/calendar/calendar;1?type=memory"]
-                                   .createInstance(Components.interfaces.calISyncWriteCalendar);
+            this.mOfflineStorage = Cc["@mozilla.org/calendar/calendar;1?type=memory"]
+                                     .createInstance(Ci.calISyncWriteCalendar);
 
             this.mOfflineStorage.superCalendar = this;
             this.mObserver = new calDavObserver(this);
             this.mOfflineStorage.addObserver(this.mObserver);
             this.mOfflineStorage.setProperty("relaxedMode", true);
         }
     },
 
@@ -282,17 +275,17 @@ calDavCalendar.prototype = {
                 if (refreshNeeded) {
                     // reseting the cached ctag forces an item refresh when
                     // safeRefresh is called later
                     self.mCtag = null;
                     self.mProposedCtag = null;
                 }
             }
         };
-        this.mOfflineStorage.getItems(calICalendar.ITEM_FILTER_ALL_ITEMS,
+        this.mOfflineStorage.getItems(Ci.calICalendar.ITEM_FILTER_ALL_ITEMS,
                                       0, null, null, getMetaListener);
     },
 
     fetchCachedMetaData: function() {
         cal.LOG("CalDAV: Retrieving server info from cache for " + this.name);
         let cacheIds = {};
         let cacheValues = {};
         this.mOfflineStorage.getAllMetaData({}, cacheIds, cacheValues);
@@ -306,17 +299,17 @@ calDavCalendar.prototype = {
                 this.mCtag = itemData;
                 this.mProposedCtag = null;
                 this.mOfflineStorage.deleteMetaData("ctag");
             } else if (itemId == "webdav-sync-token") {
                 this.mWebdavSyncToken = itemData;
                 this.mOfflineStorage.deleteMetaData("sync-token");
             } else if (itemId == "calendar-properties") {
                 this.restoreCalendarProperties(itemData);
-                this.setProperty("currentStatus", Components.results.NS_OK);
+                this.setProperty("currentStatus", Cr.NS_OK);
                 if (this.mHaveScheduling || this.hasAutoScheduling || this.hasFreeBusy) {
                     cal.getFreeBusyService().addProvider(this);
                 }
             } else {
                 let itemDataArray = itemData.split("\u001A");
                 let etag = itemDataArray[0];
                 let resourcePath = itemDataArray[1];
                 let isInboxItem = itemDataArray[2];
@@ -335,17 +328,17 @@ calDavCalendar.prototype = {
             }
         }
 
         this.ensureMetaData();
     },
 
     sendHttpRequest: function(aUri, aUploadData, aContentType, aExisting, aSetupChannelFunc, aFailureFunc, aUseStreamLoader=true) {
         function oauthCheck(nextMethod, loaderOrRequest /* either the nsIStreamLoader or nsIRequestObserver parameters */) {
-            let request = (loaderOrRequest.request || loaderOrRequest).QueryInterface(Components.interfaces.nsIHttpChannel);
+            let request = (loaderOrRequest.request || loaderOrRequest).QueryInterface(Ci.nsIHttpChannel);
             let error = false;
             try {
                 let wwwauth = request.getResponseHeader("WWW-Authenticate");
                 if (wwwauth.startsWith("Bearer") && wwwauth.includes("error=")) {
                     // An OAuth error occurred, we need to reauthenticate.
                     error = true;
                 }
             } catch (e) {
@@ -562,17 +555,17 @@ calDavCalendar.prototype = {
                 if (this.calendarUserAddress) {
                     return this.calendarUserAddress;
                 } // else use configured email identity
                 break;
             case "organizerCN":
                 return null; // xxx todo
             case "itip.transport":
                 if (this.hasAutoScheduling || this.hasScheduling) {
-                    return this.QueryInterface(Components.interfaces.calIItipTransport);
+                    return this.QueryInterface(Ci.calIItipTransport);
                 } // else use outbound email-based iTIP (from cal.provider.BaseClass)
                 break;
             case "capabilities.tasks.supported":
                 return this.supportedItemTypes.includes("VTODO");
             case "capabilities.events.supported":
                 return this.supportedItemTypes.includes("VEVENT");
             case "capabilities.autoschedule.supported":
                 return this.hasAutoScheduling;
@@ -631,40 +624,40 @@ calDavCalendar.prototype = {
             let method = pure ? "notifyPureOperationComplete" : "notifyOperationComplete";
             this[method](aListener, status, cIOL.ADD, aItem.id, detail);
         };
         if (aItem.id == null && aItem.isMutable) {
             aItem.id = cal.getUUID();
         }
 
         if (aItem.id == null) {
-            notifyListener(Components.results.NS_ERROR_FAILURE,
+            notifyListener(Cr.NS_ERROR_FAILURE,
                            "Can't set ID on non-mutable item to addItem");
             return;
         }
 
         if (!cal.item.isItemSupported(aItem, this)) {
-            notifyListener(Components.results.NS_ERROR_FAILURE,
+            notifyListener(Cr.NS_ERROR_FAILURE,
                            "Server does not support item type");
             return;
         }
 
         let parentItem = aItem.parentItem;
         parentItem.calendar = this.superCalendar;
 
         let locationPath = this.getItemLocationPath(parentItem);
         let itemUri = this.makeUri(locationPath);
         cal.LOG("CalDAV: itemUri.spec = " + itemUri.spec);
 
         let self = this;
         let serializedItem = this.getSerializedItem(aItem);
         let addListener = {
             onStreamComplete: function(aLoader, aContext, aStatus, aResultLength, aResult) {
-                let request = aLoader.request.QueryInterface(Components.interfaces.nsIHttpChannel);
-                let listenerStatus = Components.results.NS_OK;
+                let request = aLoader.request.QueryInterface(Ci.nsIHttpChannel);
+                let listenerStatus = Cr.NS_OK;
                 let listenerDetail = parentItem;
                 let responseStatus;
                 try {
                     responseStatus = request.responseStatus;
 
                     if (self.verboseLogging()) {
                         let str = new TextDecoder().decode(Uint8Array.from(aResult));
                         cal.LOG("CalDAV: recv: " + (str || ""));
@@ -691,46 +684,46 @@ calDavCalendar.prototype = {
 
                     // Some CalDAV servers will modify items on PUT (add X-props,
                     // for instance) so we'd best re-fetch in order to know
                     // the current state of the item
                     // Observers will be notified in getUpdatedItem()
                     self.getUpdatedItem(parentItem, aListener);
                     return;
                 } else if (responseStatus >= 500 && responseStatus <= 510) {
-                    listenerStatus = Components.results.NS_ERROR_NOT_AVAILABLE;
+                    listenerStatus = Cr.NS_ERROR_NOT_AVAILABLE;
                     listenerDetail = "Server Replied with " + responseStatus;
                 } else if (responseStatus) {
                     // There is a response status, but we haven't handled it yet. Any
                     // error occurring here should consider being handled!
                     cal.ERROR("CalDAV: Unexpected status adding item to " +
                               self.name + ": " + responseStatus + "\n" +
                               serializedItem);
 
-                    listenerStatus = Components.results.NS_ERROR_FAILURE;
+                    listenerStatus = Cr.NS_ERROR_FAILURE;
                     listenerDetail = "Server Replied with " + responseStatus;
                 }
 
                 // Still need to visually notify for uncached calendars.
                 if (!self.isCached && !Components.isSuccessCode(listenerStatus)) {
-                    self.reportDavError(calIErrors.DAV_PUT_ERROR, listenerStatus, listenerDetail);
+                    self.reportDavError(Ci.calIErrors.DAV_PUT_ERROR, listenerStatus, listenerDetail);
                 }
 
                 // Finally, notify listener.
                 notifyListener(listenerStatus, listenerDetail, true);
             }
         };
 
         this.sendHttpRequest(itemUri, serializedItem, MIME_TEXT_CALENDAR, null, (channel) => {
             if (!aIgnoreEtag) {
                 channel.setRequestHeader("If-None-Match", "*", false);
             }
             return addListener;
         }, () => {
-            notifyListener(Components.results.NS_ERROR_NOT_AVAILABLE,
+            notifyListener(Cr.NS_ERROR_NOT_AVAILABLE,
                            "Error preparing http channel");
         });
     },
 
     /**
      * modifyItem(); required by calICalendar.idl
      * we actually use doModifyItem()
      *
@@ -750,17 +743,17 @@ calDavCalendar.prototype = {
      * @param aIgnoreEtag ignore item etag
      */
     doModifyItem: function(aNewItem, aOldItem, aListener, aIgnoreEtag) {
         let notifyListener = (status, detail, pure=false) => {
             let method = pure ? "notifyPureOperationComplete" : "notifyOperationComplete";
             this[method](aListener, status, cIOL.MODIFY, aNewItem.id, detail);
         };
         if (aNewItem.id == null) {
-            notifyListener(Components.results.NS_ERROR_FAILURE,
+            notifyListener(Cr.NS_ERROR_FAILURE,
                            "ID for modifyItem doesn't exist or is null");
             return;
         }
 
         let wasInboxItem = this.mItemInfoCache[aNewItem.id].isInboxItem;
 
         let newItem_ = aNewItem;
         aNewItem = aNewItem.parentItem.clone();
@@ -772,18 +765,18 @@ calDavCalendar.prototype = {
         let eventUri = this.makeUri(this.mItemInfoCache[aNewItem.id].locationPath);
 
         let self = this;
 
         let modifiedItemICS = this.getSerializedItem(aNewItem);
 
         let modListener = {
             onStreamComplete: function(aLoader, aContext, aStatus, aResultLength, aResult) {
-                let request = aLoader.request.QueryInterface(Components.interfaces.nsIHttpChannel);
-                let listenerStatus = Components.results.NS_OK;
+                let request = aLoader.request.QueryInterface(Ci.nsIHttpChannel);
+                let listenerStatus = Cr.NS_OK;
                 let listenerDetail = aNewItem;
                 let responseStatus;
                 try {
                     responseStatus = request.responseStatus;
 
                     if (self.verboseLogging()) {
                         let str = new TextDecoder().decode(Uint8Array.from(aResult));
                         cal.LOG("CalDAV: recv: " + (str || ""));
@@ -813,47 +806,47 @@ calDavCalendar.prototype = {
                     }
                     return;
                 } else if (responseStatus == 412 || responseStatus == 409) {
                     // promptOverwrite will ask the user and then re-request
                     self.promptOverwrite(CALDAV_MODIFY_ITEM, aNewItem,
                                          aListener, aOldItem);
                     return;
                 } else if (responseStatus >= 500 && responseStatus <= 510) {
-                    listenerStatus = Components.results.NS_ERROR_NOT_AVAILABLE;
+                    listenerStatus = Cr.NS_ERROR_NOT_AVAILABLE;
                     listenerDetail = "Server Replied with " + responseStatus;
                 } else if (responseStatus) {
                     // There is a response status, but we haven't handled it yet. Any
                     // error occurring here should consider being handled!
                     cal.ERROR("CalDAV: Unexpected status modifying item to " +
                               self.name + ": " + responseStatus + "\n" +
                               modifiedItemICS);
 
-                    listenerStatus = Components.results.NS_ERROR_FAILURE;
+                    listenerStatus = Cr.NS_ERROR_FAILURE;
                     listenerDetail = "Server Replied with " + responseStatus;
                 }
 
                 // Still need to visually notify for uncached calendars.
                 if (!self.isCached && !Components.isSuccessCode(listenerStatus)) {
-                    self.reportDavError(calIErrors.DAV_PUT_ERROR, listenerStatus, listenerDetail);
+                    self.reportDavError(Ci.calIErrors.DAV_PUT_ERROR, listenerStatus, listenerDetail);
                 }
 
                 notifyListener(listenerStatus, listenerDetail, true);
             }
         };
 
         this.sendHttpRequest(eventUri, modifiedItemICS, MIME_TEXT_CALENDAR, null, (channel) => {
             if (!aIgnoreEtag) {
                 channel.setRequestHeader("If-Match",
                                          this.mItemInfoCache[aNewItem.id].etag,
                                          false);
             }
             return modListener;
         }, () => {
-            notifyListener(Components.results.NS_ERROR_NOT_AVAILABLE,
+            notifyListener(Cr.NS_ERROR_NOT_AVAILABLE,
                            "Error preparing http channel");
         });
     },
 
     /**
      * deleteItem(); required by calICalendar.idl
      * the actual deletion is done in doDeleteItem()
      *
@@ -875,43 +868,43 @@ calDavCalendar.prototype = {
      * */
     doDeleteItem: function(aItem, aListener, aIgnoreEtag, aFromInbox, aUri) {
         let notifyListener = (status, detail, pure=false) => {
             let method = pure ? "notifyPureOperationComplete" : "notifyOperationComplete";
             this[method](aListener, status, cIOL.DELETE, aItem.id, detail);
         };
 
         if (aItem.id == null) {
-            notifyListener(Components.results.NS_ERROR_FAILURE,
+            notifyListener(Cr.NS_ERROR_FAILURE,
                            "ID doesn't exist for deleteItem");
             return;
         }
 
         let eventUri;
         if (aUri) {
             eventUri = aUri;
         } else if (aFromInbox || this.mItemInfoCache[aItem.id].isInboxItem) {
             eventUri = this.makeUri(this.mItemInfoCache[aItem.id].locationPath, this.mInboxUrl);
         } else {
             eventUri = this.makeUri(this.mItemInfoCache[aItem.id].locationPath);
         }
 
         if (eventUri.pathQueryRef == this.calendarUri.pathQueryRef) {
-            notifyListener(Components.results.NS_ERROR_FAILURE,
+            notifyListener(Cr.NS_ERROR_FAILURE,
                            "eventUri and calendarUri paths are the same, " +
                            "will not go on to delete entire calendar");
             return;
         }
 
         let self = this;
 
         let delListener = {
             onStreamComplete: function(aLoader, aContext, aStatus, aResultLength, aResult) {
-                let request = aLoader.request.QueryInterface(Components.interfaces.nsIHttpChannel);
-                let listenerStatus = Components.results.NS_OK;
+                let request = aLoader.request.QueryInterface(Ci.nsIHttpChannel);
+                let listenerStatus = Cr.NS_OK;
                 let listenerDetail = aItem;
                 let responseStatus;
                 try {
                     responseStatus = request.responseStatus;
 
                     if (self.verboseLogging()) {
                         let str = new TextDecoder().decode(Uint8Array.from(aResult));
                         cal.LOG("CalDAV: recv: " + (str || ""));
@@ -942,46 +935,46 @@ calDavCalendar.prototype = {
                     }
                 } else if (responseStatus == 412 || responseStatus == 409) {
                     // item has either been modified or deleted by someone else check to see which
                     cal.LOG("CalDAV: Item has been modified on server, checking if it has been deleted");
                     self.sendHttpRequest(eventUri, null, null, null, (channel) => {
                         channel.requestMethod = "HEAD";
                         return delListener2;
                     }, () => {
-                        notifyListener(Components.results.NS_ERROR_NOT_AVAILABLE,
+                        notifyListener(Cr.NS_ERROR_NOT_AVAILABLE,
                                        "Error preparing http channel");
                     });
                     return;
                 } else if (responseStatus >= 500 && responseStatus <= 510) {
-                    listenerStatus = Components.results.NS_ERROR_NOT_AVAILABLE;
+                    listenerStatus = Cr.NS_ERROR_NOT_AVAILABLE;
                     listenerDetail = "Server Replied with " + responseStatus;
                 } else if (responseStatus) {
                     cal.ERROR("CalDAV: Unexpected status deleting item from " +
                               self.name + ": " + responseStatus + "\n" +
                               "uri: " + eventUri.spec);
 
-                    listenerStatus = Components.results.NS_ERROR_FAILURE;
+                    listenerStatus = Cr.NS_ERROR_FAILURE;
                     listenerDetail = "Server Replied with " + responseStatus;
                 }
 
                 // Still need to visually notify for uncached calendars.
                 if (!self.isCached && !Components.isSuccessCode(listenerStatus)) {
-                    self.reportDavError(calIErrors.DAV_REMOVE_ERROR, listenerStatus, listenerDetail);
+                    self.reportDavError(Ci.calIErrors.DAV_REMOVE_ERROR, listenerStatus, listenerDetail);
                 }
 
                 // Finally, notify listener.
                 notifyListener(listenerStatus, listenerDetail);
             }
         };
 
         let delListener2 = {
             onStreamComplete: function(aLoader, aContext, aStatus, aResultLength, aResult) {
-                let request = aLoader.request.QueryInterface(Components.interfaces.nsIHttpChannel);
-                let listenerStatus = Components.results.NS_OK;
+                let request = aLoader.request.QueryInterface(Ci.nsIHttpChannel);
+                let listenerStatus = Cr.NS_OK;
                 let listenerDetail = aItem;
                 let responseStatus;
                 try {
                     responseStatus = request.responseStatus;
 
                     if (self.verboseLogging()) {
                         let str = new TextDecoder().decode(Uint8Array.from(aResult));
                         cal.LOG("CalDAV: recv: " + (str || ""));
@@ -991,17 +984,17 @@ calDavCalendar.prototype = {
                     listenerDetail = "Request Failed: " + ex.message;
                     cal.LOG("CalDAV: Request error during add: " + ex);
                 }
 
                 if (responseStatus == 404) {
                     // Nothing to do (except notify the listener below)
                     // Someone else has already deleted it
                 } else if (responseStatus >= 500 && responseStatus <= 510) {
-                    listenerStatus = Components.results.NS_ERROR_NOT_AVAILABLE;
+                    listenerStatus = Cr.NS_ERROR_NOT_AVAILABLE;
                     listenerDetail = "Server Replied with " + responseStatus;
                 } else if (responseStatus) {
                     // The item still exists. We need to ask the user if he
                     // really wants to delete the item. Remember, we only
                     // made this request since the actual delete gave 409/412
                     self.promptOverwrite(CALDAV_DELETE_ITEM, aItem, aListener, null);
                     return;
                 }
@@ -1019,32 +1012,32 @@ calDavCalendar.prototype = {
             if (!aIgnoreEtag) {
                 let etag = this.mItemInfoCache[aItem.id].etag;
                 cal.LOG("CalDAV: Will only delete if matches etag " + etag);
                 channel.setRequestHeader("If-Match", etag, false);
             }
             channel.requestMethod = "DELETE";
             return delListener;
         }, () => {
-            notifyListener(Components.results.NS_ERROR_NOT_AVAILABLE,
+            notifyListener(Cr.NS_ERROR_NOT_AVAILABLE,
                            "Error preparing http channel");
         });
     },
 
     /**
      * Add an item to the target calendar
      *
      * @param path      Item path MUST NOT BE ENCODED
      * @param calData   iCalendar string representation of the item
      * @param aUri      Base URI of the request
      * @param aListener Listener
      */
     addTargetCalendarItem: function(path, calData, aUri, etag, aListener) {
-        let parser = Components.classes["@mozilla.org/calendar/ics-parser;1"]
-                               .createInstance(Components.interfaces.calIIcsParser);
+        let parser = Cc["@mozilla.org/calendar/ics-parser;1"]
+                       .createInstance(Ci.calIIcsParser);
         // aUri.pathQueryRef may contain double slashes whereas path does not
         // this confuses our counting, so remove multiple successive slashes
         let strippedUriPath = aUri.pathQueryRef.replace(/\/{2,}/g, "/");
         let uriPathComponentLength = strippedUriPath.split("/").length;
         try {
             parser.parseString(calData);
         } catch (e) {
             // Warn and continue.
@@ -1115,23 +1108,23 @@ calDavCalendar.prototype = {
             // If we have a listener, then the caller will take care of adding the item
             // Otherwise, we have to do it ourself
             // XXX This is quite fragile, but saves us a double modify/add
 
             if (aListener) {
                 // In the cached case, notifying operation complete will add the item to the cache
                 if (this.mItemInfoCache[item.id].isNew) {
                     this.notifyOperationComplete(aListener,
-                                                 Components.results.NS_OK,
+                                                 Cr.NS_OK,
                                                  cIOL.ADD,
                                                  item.id,
                                                  item);
                 } else {
                     this.notifyOperationComplete(aListener,
-                                                 Components.results.NS_OK,
+                                                 Cr.NS_OK,
                                                  cIOL.MODIFY,
                                                  item.id,
                                                  item);
                 }
             } else {
                 // No listener, we'll have to add it ourselves
                 needsAddModify = true;
             }
@@ -1182,18 +1175,17 @@ calDavCalendar.prototype = {
      */