Bug 1609760 - Stop assigning properties to the global `this` in calendar/ JSMs (port bug 1608278). r=pmorris DONTBUILD
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sun, 26 Apr 2020 13:59:10 +0300
changeset 38049 518552b4540d077ee41dd8b4c29d3b2488fb4f95
parent 38048 f94827e5dd8e16bf8d9a04314c040cbf92ad1cd0
child 38050 446dd720023b51fa656102a0b227b4a19bc8f784
push id2595
push userclokep@gmail.com
push dateMon, 04 May 2020 19:02:04 +0000
treeherdercomm-beta@f53913797371 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspmorris
bugs1609760, 1608278
Bug 1609760 - Stop assigning properties to the global `this` in calendar/ JSMs (port bug 1608278). r=pmorris DONTBUILD cp ../.gitignore .rgignore && rg -l -g '*.jsm' '' calendar | jscodeshift --stdin --transform ~/Code/jsm-rewrites/no-this-property-assign.js (Script from https://github.com/bgrins/jsm-rewrites/blob/d2bbd6c459294b65955442e45b5a7f5dba11e639/no-this-property-assign.js)
calendar/base/modules/Ical.jsm
calendar/base/modules/calCalendarDeactivator.jsm
calendar/base/modules/calExtract.jsm
calendar/base/modules/calRecurrenceUtils.jsm
calendar/base/modules/calUtils.jsm
calendar/base/modules/utils/calACLUtils.jsm
calendar/base/modules/utils/calAlarmUtils.jsm
calendar/base/modules/utils/calAsyncUtils.jsm
calendar/base/modules/utils/calAuthUtils.jsm
calendar/base/modules/utils/calCategoryUtils.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/calIteratorUtils.jsm
calendar/base/modules/utils/calItipUtils.jsm
calendar/base/modules/utils/calL10NUtils.jsm
calendar/base/modules/utils/calPrintUtils.jsm
calendar/base/modules/utils/calProviderUtils.jsm
calendar/base/modules/utils/calUnifinderUtils.jsm
calendar/base/modules/utils/calViewUtils.jsm
calendar/base/modules/utils/calWindowUtils.jsm
calendar/base/modules/utils/calXMLUtils.jsm
calendar/lightning/modules/ltnInvitationUtils.jsm
calendar/providers/caldav/modules/CalDavRequest.jsm
calendar/providers/caldav/modules/CalDavRequestHandlers.jsm
calendar/providers/caldav/modules/CalDavSession.jsm
calendar/providers/caldav/modules/CalDavUtils.jsm
calendar/providers/storage/calStorageHelpers.jsm
calendar/test/modules/CalendarUtils.jsm
calendar/test/modules/ItemEditingHelpers.jsm
--- a/calendar/base/modules/Ical.jsm
+++ b/calendar/base/modules/Ical.jsm
@@ -39,25 +39,26 @@ function unwrapSingle(type, val) {
 
 // -- start ical.js --
 
 /* 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/.
  * Portions Copyright (C) Philipp Kewisch, 2011-2015 */
 
+var ICAL;
 
 /* istanbul ignore next */
 /* jshint ignore:start */
 if (typeof module === 'object') {
   // CommonJS, where exports may be different each time.
   ICAL = module.exports;
 } else if (typeof ICAL !== 'object') {/* istanbul ignore next */
   /** @ignore */
-  this.ICAL = {};
+  ICAL = {};
 }
 /* jshint ignore:end */
 
 
 /**
  * The number of characters before iCalendar line folding should occur
  * @type {Number}
  * @default 75
--- a/calendar/base/modules/calCalendarDeactivator.jsm
+++ b/calendar/base/modules/calCalendarDeactivator.jsm
@@ -1,13 +1,13 @@
 /* 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/. */
 
-this.EXPORTED_SYMBOLS = ["calendarDeactivator"];
+const EXPORTED_SYMBOLS = ["calendarDeactivator"];
 
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 
 var l10n = new Localization(["calendar/calendar-widgets.ftl"], true);
 
 /**
  * Handles deactivation of calendar UI and background processes/services (such
--- a/calendar/base/modules/calExtract.jsm
+++ b/calendar/base/modules/calExtract.jsm
@@ -1,13 +1,13 @@
 /* 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/. */
 
-this.EXPORTED_SYMBOLS = ["Extractor"];
+const EXPORTED_SYMBOLS = ["Extractor"];
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * Initializes extraction
  *
  * @param fallbackLocale  locale to use when others are not found or
  *                            detection is disabled
--- a/calendar/base/modules/calRecurrenceUtils.jsm
+++ b/calendar/base/modules/calRecurrenceUtils.jsm
@@ -4,17 +4,17 @@
 
 /* exported recurrenceRule2String, splitRecurrenceRules, checkRecurrenceRule
  *          countOccurrences
  */
 
 var { PluralForm } = ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "recurrenceRule2String",
   "splitRecurrenceRules",
   "checkRecurrenceRule",
   "countOccurrences",
 ];
 
 /**
  * This function takes the recurrence info passed as argument and creates a
--- a/calendar/base/modules/calUtils.jsm
+++ b/calendar/base/modules/calUtils.jsm
@@ -18,17 +18,17 @@ var gCalendarConsole = new ConsoleAPI({
   maxLogLevel: Services.prefs.getBoolPref("calendar.debug.log", false) ? "all" : "warn",
 });
 
 // Cache services to avoid calling getService over and over again. The cache is
 // a separate object to avoid polluting `cal`, and is defined here since a call
 // to `_service` will require it to already exist.
 var gServiceCache = {};
 
-this.EXPORTED_SYMBOLS = ["cal"];
+const 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", Ci.calIEvent, "icalString"),
   createTodo: _instance("@mozilla.org/calendar/todo;1", Ci.calITodo, "icalString"),
   createDateTime: _instance("@mozilla.org/calendar/datetime;1", Ci.calIDateTime, "icalString"),
   createDuration: _instance("@mozilla.org/calendar/duration;1", Ci.calIDuration, "icalString"),
   createAttendee: _instance("@mozilla.org/calendar/attendee;1", Ci.calIAttendee, "icalString"),
--- a/calendar/base/modules/utils/calACLUtils.jsm
+++ b/calendar/base/modules/utils/calACLUtils.jsm
@@ -6,17 +6,17 @@ var { Services } = ChromeUtils.import("r
 
 /*
  * Helpers for permission checks and other ACL features
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.acl namespace.
 
-this.EXPORTED_SYMBOLS = ["calacl"]; /* exported calacl */
+const EXPORTED_SYMBOLS = ["calacl"]; /* exported calacl */
 
 var calacl = {
   /**
    * Check if the specified calendar is writable. This is the case when it is
    * not marked readOnly, we are not offline, or we are offline and the
    * calendar is local.
    *
    * @param aCalendar     The calendar to check
--- a/calendar/base/modules/utils/calAlarmUtils.jsm
+++ b/calendar/base/modules/utils/calAlarmUtils.jsm
@@ -8,17 +8,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Helpers for manipulating calendar alarms
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.alarm namespace.
 
-this.EXPORTED_SYMBOLS = ["calalarms"]; /* exported calalarms */
+const EXPORTED_SYMBOLS = ["calalarms"]; /* exported calalarms */
 
 var calalarms = {
   /**
    * Read default alarm settings from user preferences and apply them to the
    * event/todo passed in. The item's calendar should be set to ensure the
    * correct alarm type is set.
    *
    * @param aItem     The item to apply the default alarm values to.
--- a/calendar/base/modules/utils/calAsyncUtils.jsm
+++ b/calendar/base/modules/utils/calAsyncUtils.jsm
@@ -6,17 +6,17 @@ var { PromiseUtils } = ChromeUtils.impor
 
 /*
  * 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 */
+const EXPORTED_SYMBOLS = ["calasync"]; /* exported calasync */
 
 var cIOL = Ci.calIOperationListener;
 var cIC = Ci.calICalendar;
 
 var promisifyProxyHandler = {
   promiseOperation(target, name, args) {
     let deferred = PromiseUtils.defer();
     let listener = calasync.promiseOperationListener(deferred);
--- a/calendar/base/modules/utils/calAuthUtils.jsm
+++ b/calendar/base/modules/utils/calAuthUtils.jsm
@@ -8,17 +8,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Authentication tools and prompts, mostly for providers
  */
 
 // NOTE: This module should not be loaded directly, it is available when including
 // calUtils.jsm under the cal.auth namespace.
 
-this.EXPORTED_SYMBOLS = ["calauth"]; /* exported calauth */
+const EXPORTED_SYMBOLS = ["calauth"]; /* exported calauth */
 
 /**
  * The userContextId of nsIHttpChannel is currently implemented as a uint32, so
  * the ContainerMap defined below must not return Ids greater then the allowed
  * range of a uint32.
  */
 const MAX_CONTAINER_ID = Math.pow(2, 32) - 1;
 
--- a/calendar/base/modules/utils/calCategoryUtils.jsm
+++ b/calendar/base/modules/utils/calCategoryUtils.jsm
@@ -8,17 +8,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Helpers for reading and writing calendar categories
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.category namespace.
 
-this.EXPORTED_SYMBOLS = ["calcategory"]; /* exported calcategory */
+const EXPORTED_SYMBOLS = ["calcategory"]; /* exported calcategory */
 
 var calcategory = {
   /**
    * Sets up the default categories from the localized string
    *
    * @return      The default set of categories as a comma separated string.
    */
   setupDefaultCategories() {
--- a/calendar/base/modules/utils/calDataUtils.jsm
+++ b/calendar/base/modules/utils/calDataUtils.jsm
@@ -6,17 +6,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Data structures and algorithms used within the codebase
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.data namespace.
 
-this.EXPORTED_SYMBOLS = ["caldata"]; /* exported caldata */
+const EXPORTED_SYMBOLS = ["caldata"]; /* exported caldata */
 
 class ListenerSet extends Set {
   constructor(iid, iterable) {
     super(iterable);
     this.mIID = iid;
   }
 
   add(item) {
--- a/calendar/base/modules/utils/calDateTimeUtils.jsm
+++ b/calendar/base/modules/utils/calDateTimeUtils.jsm
@@ -8,17 +8,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Date, time and timezone related functions
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.dtz namespace.
 
-this.EXPORTED_SYMBOLS = ["caldtz"]; /* exported caldtz */
+const EXPORTED_SYMBOLS = ["caldtz"]; /* exported caldtz */
 
 var caldtz = {
   /**
    * Shortcut to the timezone service's defaultTimezone
    */
   get defaultTimezone() {
     return cal.getTimezoneService().defaultTimezone;
   },
--- a/calendar/base/modules/utils/calEmailUtils.jsm
+++ b/calendar/base/modules/utils/calEmailUtils.jsm
@@ -8,17 +8,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Functions for processing email addresses and sending email
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.email namespace.
 
-this.EXPORTED_SYMBOLS = ["calemail"]; /* exported calemail */
+const EXPORTED_SYMBOLS = ["calemail"]; /* exported calemail */
 
 var calemail = {
   /**
    * Convenience function to open the compose window pre-filled with the information from the
    * parameters. These parameters are mostly raw header fields, see #createRecipientList function
    * to create a recipient list string.
    *
    * @param {String} aRecipient       The email recipients string.
--- a/calendar/base/modules/utils/calItemUtils.jsm
+++ b/calendar/base/modules/utils/calItemUtils.jsm
@@ -8,17 +8,17 @@ var { cal } = ChromeUtils.import("resour
 
 /*
  * Calendar item related functions
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.item namespace.
 
-this.EXPORTED_SYMBOLS = ["calitem"];
+const EXPORTED_SYMBOLS = ["calitem"];
 
 var calitem = {
   ItemDiff: (function() {
     /**
      * Given two sets of items, find out which items were added, changed or
      * removed.
      *
      * The general flow is to first use load/load1 methods to load the engine with
--- a/calendar/base/modules/utils/calIteratorUtils.jsm
+++ b/calendar/base/modules/utils/calIteratorUtils.jsm
@@ -8,17 +8,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Iterators for various data structures
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.iterate namespace.
 
-this.EXPORTED_SYMBOLS = ["caliterate"]; /* exported caliterate */
+const EXPORTED_SYMBOLS = ["caliterate"]; /* exported caliterate */
 
 var caliterate = {
   /**
    * Iterates an array of items, i.e. the passed item including all
    * overridden instances of a recurring series.
    *
    * @param {calIItemBase[]} items        array of items to iterate
    * @yields {calIItemBase}
--- a/calendar/base/modules/utils/calItipUtils.jsm
+++ b/calendar/base/modules/utils/calItipUtils.jsm
@@ -12,17 +12,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Scheduling and iTIP helper code
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.itip namespace.
 
-this.EXPORTED_SYMBOLS = ["calitip"]; /* exported calitip */
+const EXPORTED_SYMBOLS = ["calitip"]; /* exported calitip */
 
 var calitip = {
   /**
    * Gets the sequence/revision number, either of the passed item or the last received one of an
    * attendee; see <http://tools.ietf.org/html/draft-desruisseaux-caldav-sched-04#section-7.1>.
    *
    * @param {calIAttendee|calIItemBase} aItem     The item or attendee to get the sequence info
    *                                                from.
--- a/calendar/base/modules/utils/calL10NUtils.jsm
+++ b/calendar/base/modules/utils/calL10NUtils.jsm
@@ -6,17 +6,17 @@ var { Services } = ChromeUtils.import("r
 
 /*
  * Localization and locale functions
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.l10n namespace.
 
-this.EXPORTED_SYMBOLS = ["call10n"]; /* exported call10n */
+const EXPORTED_SYMBOLS = ["call10n"]; /* exported call10n */
 
 /**
  * Gets the value of a string in a .properties file.
  *
  * @param {String} aComponent       Stringbundle component name
  * @param {String} aBundleName      The name of the properties file
  * @param {String} aStringName      The name of the string within the properties file
  * @param {String[]} aParams        (optional) Parameters to format the string
--- a/calendar/base/modules/utils/calPrintUtils.jsm
+++ b/calendar/base/modules/utils/calPrintUtils.jsm
@@ -6,17 +6,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Helpers for printing and print preparation
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.print namespace.
 
-this.EXPORTED_SYMBOLS = ["calprint"]; /* exported calprint */
+const EXPORTED_SYMBOLS = ["calprint"]; /* exported calprint */
 
 var calprint = {
   /**
    * Returns a simple key in the format YYYY-MM-DD for use in the table of
    * dates to day boxes
    *
    * @param dt    The date to translate
    * @return      YYYY-MM-DD
--- a/calendar/base/modules/utils/calProviderUtils.jsm
+++ b/calendar/base/modules/utils/calProviderUtils.jsm
@@ -9,17 +9,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Helpers and base class for calendar providers
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.provider namespace.
 
-this.EXPORTED_SYMBOLS = ["calprovider"]; /* exported calprovider */
+const EXPORTED_SYMBOLS = ["calprovider"]; /* exported calprovider */
 
 var calprovider = {
   /**
    * Prepare HTTP channel with standard request headers and upload data/content-type if needed.
    *
    * @param {nsIURI} aUri                                     Channel Uri, will only be used for a
    *                                                            new channel.
    * @param {nsIInputStream|String} aUploadData               Data to be uploaded, if any. This
--- a/calendar/base/modules/utils/calUnifinderUtils.jsm
+++ b/calendar/base/modules/utils/calUnifinderUtils.jsm
@@ -6,17 +6,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * Helpers for the unifinder
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.unifinder namespace.
 
-this.EXPORTED_SYMBOLS = ["calunifinder"]; /* exported calunifinder */
+const EXPORTED_SYMBOLS = ["calunifinder"]; /* exported calunifinder */
 
 var calunifinder = {
   /**
    * Retrieves the value that is used for comparison for the item with the given
    * property.
    *
    * @param {calIItemBaes} aItem      The item to retrieve the sort key for
    * @param {String} aKey             The property name that should be sorted
--- a/calendar/base/modules/utils/calViewUtils.jsm
+++ b/calendar/base/modules/utils/calViewUtils.jsm
@@ -8,17 +8,17 @@ ChromeUtils.defineModuleGetter(this, "ca
 
 /*
  * View and DOM related helper functions
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.view namespace.
 
-this.EXPORTED_SYMBOLS = ["calview"]; /* exported calview */
+const EXPORTED_SYMBOLS = ["calview"]; /* exported calview */
 
 var calview = {
   /**
    * Checks if the mousepointer of an event resides over a XULBox during an event
    *
    * @param aMouseEvent   The event eg. a 'mouseout' or 'mousedown' event
    * @param aXULBox       The xul element
    * @return              true or false depending on whether the mouse pointer
--- a/calendar/base/modules/utils/calWindowUtils.jsm
+++ b/calendar/base/modules/utils/calWindowUtils.jsm
@@ -7,17 +7,17 @@ var { Services } = ChromeUtils.import("r
 
 /*
  * Calendar window helpers, e.g. to open our dialogs
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.window namespace.
 
-this.EXPORTED_SYMBOLS = ["calwindow"]; /* exported calwindow */
+const EXPORTED_SYMBOLS = ["calwindow"]; /* exported calwindow */
 
 var calwindow = {
   /**
    * Opens the Create Calendar wizard
    *
    * @param aWindow    the window to open the dialog on, or null for the main calendar window
    * @param aCallback  a function to be performed after calendar creation
    */
--- a/calendar/base/modules/utils/calXMLUtils.jsm
+++ b/calendar/base/modules/utils/calXMLUtils.jsm
@@ -4,17 +4,17 @@
 
 /*
  * Helper functions for parsing and serializing XML
  */
 
 // NOTE: This module should not be loaded directly, it is available when
 // including calUtils.jsm under the cal.xml namespace.
 
-this.EXPORTED_SYMBOLS = ["calxml"]; /* exported calxml */
+const EXPORTED_SYMBOLS = ["calxml"]; /* exported calxml */
 
 var calxml = {
   /**
    * Evaluate an XPath query for the given node. Be careful with the return value
    * here, as it may be:
    *
    * - null, if there are no results
    * - a number, string or boolean value
--- a/calendar/lightning/modules/ltnInvitationUtils.jsm
+++ b/calendar/lightning/modules/ltnInvitationUtils.jsm
@@ -4,17 +4,17 @@
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { recurrenceRule2String } = ChromeUtils.import(
   "resource:///modules/calendar/calRecurrenceUtils.jsm"
 );
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
 
-this.EXPORTED_SYMBOLS = ["ltn"]; /* exported ltn */
+const EXPORTED_SYMBOLS = ["ltn"]; /* exported ltn */
 var ltn = {};
 
 ltn.invitation = {
   /**
    * Returns a header title for an ITIP item depending on the response method
    * @param  {calItipItem}     aItipItem  the itip item to check
    * @return {String}          the header title
    */
--- a/calendar/providers/caldav/modules/CalDavRequest.jsm
+++ b/calendar/providers/caldav/modules/CalDavRequest.jsm
@@ -9,17 +9,17 @@ var { CalDavTagsToXmlns, CalDavNsUnresol
 );
 
 var { CalDavSession } = ChromeUtils.import("resource:///modules/caldav/CalDavSession.jsm");
 
 /* exported CalDavGenericRequest, CalDavLegacySAXRequest, CalDavItemRequest,
             CalDavDeleteItemRequest, CalDavPropfindRequest, CalDavHeaderRequest,
             CalDavPrincipalPropertySearchRequest, CalDavOutboxRequest, CalDavFreeBusyRequest */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "CalDavGenericRequest",
   "CalDavLegacySAXRequest",
   "CalDavItemRequest",
   "CalDavDeleteItemRequest",
   "CalDavPropfindRequest",
   "CalDavHeaderRequest",
   "CalDavPrincipalPropertySearchRequest",
   "CalDavOutboxRequest",
--- a/calendar/providers/caldav/modules/CalDavRequestHandlers.jsm
+++ b/calendar/providers/caldav/modules/CalDavRequestHandlers.jsm
@@ -5,17 +5,17 @@
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
 
 var { CalDavLegacySAXRequest } = ChromeUtils.import("resource:///modules/caldav/CalDavRequest.jsm");
 
 /* exported CalDavEtagsHandler, CalDavWebDavSyncHandler, CalDavMultigetSyncHandler */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "CalDavEtagsHandler",
   "CalDavWebDavSyncHandler",
   "CalDavMultigetSyncHandler",
 ];
 
 const XML_HEADER = '<?xml version="1.0" encoding="UTF-8"?>\n';
 const MIME_TEXT_XML = "text/xml; charset=utf-8";
 
--- a/calendar/providers/caldav/modules/CalDavSession.jsm
+++ b/calendar/providers/caldav/modules/CalDavSession.jsm
@@ -7,17 +7,17 @@ var { setTimeout } = ChromeUtils.import(
 var { OAuth2 } = ChromeUtils.import("resource:///modules/OAuth2.jsm");
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 
 /**
  * Session and authentication tools for the caldav provider
  */
 
-this.EXPORTED_SYMBOLS = ["CalDavSession"]; /* exported CalDavSession */
+const EXPORTED_SYMBOLS = ["CalDavSession"]; /* exported CalDavSession */
 
 const OAUTH_GRACE_TIME = 30 * 1000;
 
 /**
  * Authentication provider for Google's OAuth.
  */
 class CalDavGoogleOAuth extends OAuth2 {
   /**
--- a/calendar/providers/caldav/modules/CalDavUtils.jsm
+++ b/calendar/providers/caldav/modules/CalDavUtils.jsm
@@ -5,17 +5,17 @@
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 
 /**
  * Various utility functions for the caldav provider
  */
 
 /* exported CalDavXmlns, CalDavTagsToXmlns, CalDavNsUnresolver, CalDavNsResolver, CalDavXPath,
  *          CalDavXPathFirst */
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "CalDavXmlns",
   "CalDavTagsToXmlns",
   "CalDavNsUnresolver",
   "CalDavNsResolver",
   "CalDavXPath",
   "CalDavXPathFirst",
 ];
 
--- a/calendar/providers/storage/calStorageHelpers.jsm
+++ b/calendar/providers/storage/calStorageHelpers.jsm
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 
 /* exported CAL_ITEM_FLAG, getInUtcOrKeepFloating, dateToText, textToDate,
  *          calStorageTimezone, getTimezone, newDateTime
  */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "CAL_ITEM_FLAG",
   "getInUtcOrKeepFloating",
   "dateToText",
   "textToDate",
   "calStorageTimezone",
   "getTimezone",
   "newDateTime",
 ];
--- a/calendar/test/modules/CalendarUtils.jsm
+++ b/calendar/test/modules/CalendarUtils.jsm
@@ -1,13 +1,13 @@
 /* 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/. */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "SHORT_SLEEP",
   "MID_SLEEP",
   "TIMEOUT_MODAL_DIALOG",
   "CALENDARNAME",
   "CALENDAR_PANEL",
   "VIEWDECK",
   "DAY_VIEW",
   "WEEK_VIEW",
--- a/calendar/test/modules/ItemEditingHelpers.jsm
+++ b/calendar/test/modules/ItemEditingHelpers.jsm
@@ -1,13 +1,13 @@
 /* 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/. */
 
-this.EXPORTED_SYMBOLS = [
+const EXPORTED_SYMBOLS = [
   "CATEGORY_LIST",
   "REPEAT_DETAILS",
   "EVENT_TABPANELS",
   "DESCRIPTION_TEXTBOX",
   "ATTENDEES_ROW",
   "PERCENT_COMPLETE_INPUT",
   "DATE_INPUT",
   "TIME_INPUT",