Bug 1579020 - Remove WCAP provider. r=darktrojan
authorPhilipp Kewisch <mozilla@kewis.ch>
Thu, 05 Dec 2019 11:55:21 +0200
changeset 37699 cf982e0a8b1ba0e45b3f2de6084ed9eb799e74c1
parent 37698 98d3639a346e8049888368e789e56c58f6273153
child 37700 d68773e96e3e57ea5525ebee96ad97d9f373f76e
push id397
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:16:13 +0000
reviewersdarktrojan
bugs1579020
Bug 1579020 - Remove WCAP provider. r=darktrojan
calendar/base/modules/utils/calDataUtils.jsm
calendar/base/public/calIErrors.idl
calendar/locales/en-US/chrome/calendar/calendar.dtd
calendar/locales/en-US/chrome/calendar/providers/wcap/wcap.properties
calendar/locales/jar.mn
calendar/providers/moz.build
calendar/providers/wcap/calWcapCalendar.js
calendar/providers/wcap/calWcapCalendarItems.js
calendar/providers/wcap/calWcapCalendarModule.js
calendar/providers/wcap/calWcapCalendarModule.manifest
calendar/providers/wcap/calWcapErrors.js
calendar/providers/wcap/calWcapRequest.js
calendar/providers/wcap/calWcapSession.js
calendar/providers/wcap/calWcapUtils.js
calendar/providers/wcap/moz.build
calendar/providers/wcap/public/calIWcapCalendar.idl
calendar/providers/wcap/public/calIWcapErrors.idl
calendar/providers/wcap/public/calIWcapSession.idl
calendar/providers/wcap/public/moz.build
calendar/resources/content/calendarCreation.xul
calendar/test/modules/CalendarUtils.jsm
--- a/calendar/base/modules/utils/calDataUtils.jsm
+++ b/calendar/base/modules/utils/calDataUtils.jsm
@@ -292,17 +292,17 @@ var caldata = {
    * Use to compare two objects which are not of type calIItemBase, in order
    * to avoid the js-wrapping issues mentioned above.
    *
    * @param aObject        first object to be compared
    * @param aOtherObject   second object to be compared
    * @param aIID           IID to use in comparison, undefined/null defaults to nsISupports
    */
   compareObjects: function(aObject, aOtherObject, aIID) {
-    // xxx todo: seems to work fine e.g. for WCAP, but I still mistrust this trickery...
+    // xxx todo: seems to work fine, 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 = Ci.nsISupports;
     }
--- a/calendar/base/public/calIErrors.idl
+++ b/calendar/base/public/calIErrors.idl
@@ -92,21 +92,21 @@ interface calIErrors : nsISupports
   const unsigned long ICS_PARSE = ICS_ERROR_BASE + 5;
   const unsigned long ICS_INTERNAL = ICS_ERROR_BASE + 6;
   const unsigned long ICS_FILE = ICS_ERROR_BASE + 7;
   const unsigned long ICS_USAGE = ICS_ERROR_BASE + 8;
   const unsigned long ICS_UNIMPLEMENTED = ICS_ERROR_BASE + 9;
   const unsigned long ICS_UNKNOWN = ICS_ERROR_BASE + 10;
 
   /**
-   * WCAP specific errors, defined in
-   * calendar/providers/wcap/public/calIWcapErrors.idl
-   * Range claimed is [ERROR_BASE + 0x200, ERROR_BASE + 0x300)
+   * Range for former WCAP provider. This could be re-used now in theory, but
+   * you might as well just add to the end.
+   * Range previously claimed is [ERROR_BASE + 0x200, ERROR_BASE + 0x300)
    */
-  const unsigned long WCAP_ERROR_BASE = ERROR_BASE + 0x200;
+  const unsigned long EX_WCAP_ERROR_BASE = ERROR_BASE + 0x200;
 
   /**
    * (Cal)DAV specific errors
    * Range is [ERROR_BASE + 0x301, ERROR_BASE + 0x399]
    */
   const unsigned long DAV_ERROR_BASE = ERROR_BASE + 0x301;
   const unsigned long DAV_NOT_DAV = DAV_ERROR_BASE +  0;
   const unsigned long DAV_DAV_NOT_CALDAV = DAV_ERROR_BASE + 1;
--- a/calendar/locales/en-US/chrome/calendar/calendar.dtd
+++ b/calendar/locales/en-US/chrome/calendar/calendar.dtd
@@ -348,17 +348,16 @@
 <!-- Calendar Server Dialog -->
 <!ENTITY calendar.server.dialog.title.edit          "Edit Calendar">
 <!ENTITY calendar.server.dialog.name.label          "Calendar Name:">
 
 <!-- Calendar Properties -->
 <!ENTITY calendarproperties.color.label                    "Color:">
 <!ENTITY calendarproperties.webdav.label                   "iCalendar (ICS)">
 <!ENTITY calendarproperties.caldav.label                   "CalDAV">
-<!ENTITY calendarproperties.wcap.label                     "Sun Java System Calendar Server (WCAP)">
 <!ENTITY calendarproperties.format.label                   "Format:">
 <!ENTITY calendarproperties.location.label                 "Location:">
 <!ENTITY calendarproperties.refreshInterval.label          "Refresh Calendar:">
 <!ENTITY calendarproperties.refreshInterval.manual.label   "Manually">
 <!ENTITY calendarproperties.name.label                     "Name:">
 <!ENTITY calendarproperties.readonly.label                 "Read Only">
 <!ENTITY calendarproperties.firealarms.label               "Show Reminders">
 <!ENTITY calendarproperties.cache3.label                   "Offline Support">
deleted file mode 100644
--- a/calendar/locales/en-US/chrome/calendar/providers/wcap/wcap.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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/.
-
-# args: host
-accessingServerFailedError.text=Cannot access server %1$S!
-loginFailed.text=Login failed or invalid session Id.
-accessDenied.text=The user is denied access.
-
-# args: host
-noHttpsConfirmation.text=Insecure login on %1$S!\nContinue?
-noHttpsConfirmation.check.text=Don't ask again.
-noHttpsConfirmation.label=Warning!
-
-# args: host, prodId, serverVersion, wcapVersion
-insufficientWcapVersionConfirmation.text=Server %1$S (%2$S, v%3$S, WCAP v%4$S) doesn't support a sufficient WCAP version! The required version is at least 3.0.0.\nContinue?
-insufficientWcapVersionConfirmation.label=Insufficient WCAP version!
-
-loginDialog.label=Calendar Server Password Required
-
-privateItem.title.text=Private
-confidentialItem.title.text=Confidential
-busyItem.title.text=Busy
--- a/calendar/locales/jar.mn
+++ b/calendar/locales/jar.mn
@@ -27,16 +27,15 @@ calendar-@AB_CD@.jar:
     migration.dtd                                (%chrome/calendar/migration.dtd)
     migration.properties                         (%chrome/calendar/migration.properties)
     preferences/alarms.dtd                       (%chrome/calendar/preferences/alarms.dtd)
     preferences/categories.dtd                   (%chrome/calendar/preferences/categories.dtd)
     preferences/general.dtd                      (%chrome/calendar/preferences/general.dtd)
     preferences/preferences.dtd                  (%chrome/calendar/preferences/preferences.dtd)
     preferences/views.dtd                        (%chrome/calendar/preferences/views.dtd)
     provider-uninstall.dtd                       (%chrome/calendar/provider-uninstall.dtd)
-    wcap.properties                              (%chrome/calendar/providers/wcap/wcap.properties)
     timezones.properties                         (%chrome/calendar/timezones.properties)
 
 lightning-@AB_CD@.jar:
 % locale lightning @AB_CD@ %
     lightning-toolbar.dtd                        (%chrome/lightning/lightning-toolbar.dtd)
     lightning.dtd                                (%chrome/lightning/lightning.dtd)
     lightning.properties                         (%chrome/lightning/lightning.properties)
--- a/calendar/providers/moz.build
+++ b/calendar/providers/moz.build
@@ -4,11 +4,9 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += [
     'caldav',
     'composite',
     'ics',
     'memory',
     'storage',
-    'wcap',
 ]
-
deleted file mode 100644
--- a/calendar/providers/wcap/calWcapCalendar.js
+++ /dev/null
@@ -1,387 +0,0 @@
-/* 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/. */
-
-/* import-globals-from calWcapCalendarModule.js */
-
-var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
-
-/**
- * The calendar provider class for WCAP calendars. Usually instantiated through
- * the calendar manager, but may also be created by the wcap session, hence the
- * following optional parameters.
- *
- * @param session       (optional) The calWcapSession for this calendar
- * @param calProps      (optional) The XML node containing the WCAP calendar properties
- */
-function calWcapCalendar(session, calProps) {
-  this.initProviderBase();
-  this.m_session = session;
-  this.m_calProps = calProps;
-}
-var calWcapCalendarClassID = Components.ID("{cf4d93e5-af79-451a-95f3-109055b32ef0}");
-var calWcapCalendarInterfaces = [
-  calIWcapCalendar,
-  calICalendar,
-  Ci.calISchedulingSupport,
-  Ci.calIChangeLog,
-  Ci.calICalendarProvider,
-];
-calWcapCalendar.prototype = {
-  __proto__: cal.provider.BaseClass.prototype,
-  classID: calWcapCalendarClassID,
-  QueryInterface: cal.generateQI(calWcapCalendarInterfaces),
-  classInfo: cal.generateCI({
-    classID: calWcapCalendarClassID,
-    contractID: "@mozilla.org/calendar/calendar;1?type=wcap",
-    classDescription: "Sun Java System Calendar Server WCAP Provider",
-    interfaces: calWcapCalendarInterfaces,
-  }),
-
-  toString: function() {
-    let str = this.session.toString();
-    if (this.m_calId) {
-      str += ", calId=" + this.calId;
-    } else {
-      str += ", default calendar";
-    }
-    return str;
-  },
-
-  notifyError_: function(err, msg, context) {
-    let rc = getResultCode(err);
-    switch (rc) {
-      case calIWcapErrors.WCAP_COMPONENT_NOT_FOUND:
-      case NS_ERROR_OFFLINE:
-        return;
-      default:
-        msg = errorToString(err);
-        log("error: " + msg, context);
-        break;
-    }
-    this.__proto__.__proto__.notifyError.apply(
-      this,
-      err instanceof Ci.nsIException
-        ? [err.result, err.message]
-        : [isNaN(err) ? Cr.NS_ERROR_FAILURE : err, msg]
-    );
-  },
-  notifyError: function(err, msg) {
-    this.notifyError_(err, msg, this);
-  },
-
-  // calICalendarProvider:
-  get prefChromeOverlay() {
-    return null;
-  },
-  // displayName attribute already part of calIWcapCalendar
-  createCalendar: function(name, url, listener) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-  deleteCalendar: function(calendar, listener) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-  getCalendar: function(url) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-
-  // calICalendar:
-  get name() {
-    let name = this.getProperty("name");
-    if (!name) {
-      name = this.displayName;
-    }
-    return name;
-  },
-  set name(aValue) {
-    return this.setProperty("name", aValue);
-  },
-
-  get type() {
-    return "wcap";
-  },
-
-  m_uri: null,
-  get uri() {
-    return this.m_uri;
-  },
-  set uri(thatUri) {
-    this.m_uri = thatUri;
-    let path = thatUri.pathQueryRef;
-    let qmPos = path.indexOf("?");
-    if (qmPos != -1) {
-      let pos = path.indexOf("?calid=", qmPos);
-      if (pos != -1) {
-        let start = pos + "?calid=".length;
-        let end = path.indexOf("&", start);
-        this.m_calId = decodeURIComponent(path.substring(start, end == -1 ? path.length : end));
-      }
-    }
-    return this.uri;
-  },
-
-  getProperty: function(aName) {
-    switch (aName) {
-      case "cache.supported":
-        return true;
-      case "timezones.provider":
-        return this.m_session && this.session.isLoggedIn ? this.session : null;
-      case "organizerId":
-        return this.ownerId;
-      case "organizerCN":
-        return this.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME");
-      case "itip.disableRevisionChecks":
-        return true;
-      case "capabilities.timezones.floating.supported":
-      case "capabilities.timezones.UTC.supported":
-      case "capabilities.attachments.supported":
-      case "capabilities.alarms.popup.supported":
-        // CS cannot store X-props reliably
-        // (thus writing X-MOZ stamps etc is not possible).
-        // Popup alarms not available no matter what; wtf.
-        return false;
-      case "capabilities.alarms.actionValues":
-        return ["EMAIL"];
-      case "capabilities.alarms.maxCount":
-        return 1;
-    }
-
-    let value = this.__proto__.__proto__.getProperty.apply(this, arguments);
-    switch (aName) {
-      case "readOnly":
-        if (value === null) {
-          // tweak readOnly default to true for non-owned calendars,
-          // all secondary calendars to readOnly unless we're logged in
-          value =
-            this.m_session && this.session.isLoggedIn
-              ? !this.isOwnedCalendar
-              : !this.isDefaultCalendar;
-        }
-        break;
-      case "calendar-main-in-composite":
-        if (value === null && !this.isDefaultCalendar) {
-          // tweak in-composite to false for secondary calendars:
-          value = false;
-        }
-        break;
-    }
-    return value;
-  },
-
-  setProperty: function(aName, aValue) {
-    switch (aName) {
-      case "disabled":
-        if (this.isDefaultCalendar) {
-          // disabling/enabling the default calendar will enable/disable all calendars
-          // belonging to the same session:
-          for (let calendar of this.session.getRegisteredCalendars()) {
-            if (!calendar.isDefaultCalendar) {
-              calendar.setProperty("disabled", aValue);
-            }
-          }
-        }
-      // falls through
-      default:
-        this.__proto__.__proto__.setProperty.apply(this, arguments);
-        break;
-    }
-  },
-
-  notifyObservers: function(func, args) {
-    if (g_bShutdown) {
-      return;
-    }
-    this.observers.notify(func, args);
-  },
-
-  // xxx todo: batch currently not used
-  startBatch: function() {
-    this.notifyObservers("onStartBatch");
-  },
-  endBatch: function() {
-    this.notifyObservers("onEndBatch");
-  },
-
-  get canRefresh() {
-    return true;
-  },
-  refresh: function() {
-    log("refresh.", this);
-    // invalidate cached results:
-    delete this.m_cachedResults;
-    // notify about refreshed calendar:
-    this.notifyObservers("onLoad", [this]);
-  },
-
-  issueNetworkRequest: function(
-    request,
-    respFunc,
-    dataConvFunc,
-    wcapCommand,
-    params,
-    accessRights
-  ) {
-    let self = this;
-    // - bootstrap problem: no cal_props, no access check, no default calId
-    // - assure being logged in, thus the default cal_props are available
-    // - every subscribed calendar will come along with cal_props
-    return this.session.getSessionId(request, (err, sessionId) => {
-      try {
-        if (err) {
-          throw err;
-        }
-        self.assureAccess(accessRights);
-        params += "&calid=" + encodeURIComponent(self.calId);
-        self.session.issueNetworkRequest(request, respFunc, dataConvFunc, wcapCommand, params);
-      } catch (exc) {
-        request.execSubRespFunc(respFunc, exc);
-      }
-    });
-  },
-
-  // calIWcapCalendar:
-
-  m_session: null,
-  get session() {
-    if (!this.m_session) {
-      this.m_session = getWcapSessionFor(this);
-    }
-    return this.m_session;
-  },
-
-  m_calId: null,
-  get calId() {
-    return this.m_calId || this.session.defaultCalId;
-  },
-
-  get ownerId() {
-    let owner = this.getCalendarProperties("X-NSCP-CALPROPS-PRIMARY-OWNER");
-    if (owner.length == 0) {
-      let calId = this.calId;
-      log("cannot determine primary owner of calendar " + calId, this);
-      // fallback to calId prefix:
-      let nColon = calId.indexOf(":");
-      if (nColon >= 0) {
-        calId = calId.substring(0, nColon);
-      }
-      return calId;
-    }
-    return owner[0];
-  },
-
-  get description() {
-    let descr = this.getCalendarProperties("X-NSCP-CALPROPS-DESCRIPTION");
-    if (descr.length == 0) {
-      // fallback to display name:
-      return this.displayName;
-    }
-    return descr[0];
-  },
-
-  get displayName() {
-    let displayName = this.getCalendarProperties("X-NSCP-CALPROPS-NAME");
-    if (displayName.length == 0) {
-      // fallback to common name:
-      displayName = this.getCalendarProperties("X-S1CS-CALPROPS-COMMON-NAME");
-      if (displayName.length == 0) {
-        displayName = [this.calId];
-      }
-    }
-    return displayName[0];
-  },
-
-  get isOwnedCalendar() {
-    if (this.isDefaultCalendar) {
-      return true; // default calendar is owned
-    }
-    return this.ownerId == this.session.userId;
-  },
-
-  get isDefaultCalendar() {
-    return !this.m_calId;
-  },
-
-  m_calProps: null,
-  getCalendarProperties: function(propName) {
-    if (!this.m_calProps) {
-      log("soft error: no calprops available, most possibly not logged in.", this);
-    }
-    let ret = filterXmlNodes(propName, this.m_calProps);
-    return ret;
-  },
-
-  get defaultTimezone() {
-    let tzid = this.getCalendarProperties("X-NSCP-CALPROPS-TZID");
-    if (tzid.length > 0) {
-      // first try server-configured tz:
-      return tzid[0];
-    } else {
-      logWarning("defaultTimezone: cannot get X-NSCP-CALPROPS-TZID!", this);
-      // try to use local one if supported:
-      tzid = cal.getTimezoneService().defaultTimezone.tzid;
-      return this.session.getTimezone(tzid) ? tzid : "UTC";
-    }
-  },
-
-  getAlignedTzid: function(timezone) {
-    let tzid = timezone.tzid;
-    // check whether it is one cs supports:
-    if (timezone.isFloating || !this.session.getTimezone(tzid)) {
-      log("not a supported timezone: " + tzid);
-      // bug 435436:
-      // xxx todo: we could further on search for a matching region,
-      //           e.g. CET (in TZNAME), but for now stick to
-      //           user's default if not supported directly
-      let ret = this.defaultTimezone;
-      // use calendar's default:
-      log(tzid + " not supported, falling back to default: " + ret, this);
-      return ret;
-    }
-    return tzid;
-  },
-
-  checkAccess: function(accessControlBits) {
-    // xxx todo: take real acl into account
-    // for now, optimistically assuming that everybody has full access, server will check:
-    let granted = calIWcapCalendar.AC_FULL;
-    if (this.getProperty("readOnly")) {
-      granted &= ~(calIWcapCalendar.AC_COMP_WRITE | calIWcapCalendar.AC_PROP_WRITE);
-    }
-    // check whether every bit fits:
-    return (accessControlBits & granted) == accessControlBits;
-  },
-
-  assureAccess: function(accessControlBits) {
-    if (
-      !this.checkAccess(
-        accessControlBits & (calIWcapCalendar.AC_COMP_WRITE | calIWcapCalendar.AC_PROP_WRITE)
-      )
-    ) {
-      // throw different error code for read-only:
-      throw new Components.Exception(
-        errorToString(calIErrors.CAL_IS_READONLY),
-        calIErrors.CAL_IS_READONLY
-      );
-    }
-    if (!this.checkAccess(accessControlBits)) {
-      throw new Components.Exception(
-        errorToString(calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR),
-        calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR
-      );
-      // xxx todo: throwing different error here, no
-      //           calIErrors.CAL_IS_READONLY anymore
-    }
-  },
-
-  defineAccessControl: function(userId, accessControlBits) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-
-  resetAccessControl: function(userId) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-
-  getAccessControlDefinitions: function(out_count, out_users, out_accessControlBits) {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-};
deleted file mode 100644
--- a/calendar/providers/wcap/calWcapCalendarItems.js
+++ /dev/null
@@ -1,1559 +0,0 @@
-/* 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/. */
-
-/* import-globals-from calWcapCalendarModule.js */
-
-var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
-
-calWcapCalendar.prototype.encodeAttendee = function(att) {
-  if (LOG_LEVEL > 2) {
-    log("attendee.icalProperty.icalString=" + att.icalProperty.icalString, this);
-  }
-  function encodeAttr(val, attr, params) {
-    if (val && val.length > 0) {
-      if (params.length > 0) {
-        params += "^";
-      }
-      if (attr) {
-        params += attr + "=";
-      }
-      params += encodeURIComponent(val);
-    }
-    return params;
-  }
-  let params = encodeAttr(att.rsvp, "RSVP", "");
-  params = encodeAttr(att.participationStatus, "PARTSTAT", params);
-  params = encodeAttr(att.role, "ROLE", params);
-  let commonName = att.commonName;
-  if (commonName) {
-    params = encodeAttr(commonName.replace(/[;:]/g, " "), "CN", params); // remove ';' and ':' from CN
-  }
-  return encodeAttr(att.id, null, params);
-};
-
-calWcapCalendar.prototype.getRecurrenceParams = function(
-  item,
-  out_rrules,
-  out_rdates,
-  out_exrules,
-  out_exdates
-) {
-  // recurrences:
-  out_rrules.value = [];
-  out_rdates.value = [];
-  out_exrules.value = [];
-  out_exdates.value = [];
-  if (item.recurrenceInfo) {
-    let rItems = item.recurrenceInfo.getRecurrenceItems({});
-    for (let rItem of rItems) {
-      let isNeg = rItem.isNegative;
-      let rRuleInstance = cal.wrapInstance(rItem, Ci.calIRecurrenceRule);
-      let rDateInstance = cal.wrapInstance(rItem, Ci.calIRecurrenceDate);
-      if (rRuleInstance) {
-        let rule = '"' + encodeURIComponent(rRuleInstance.icalProperty.valueAsIcalString) + '"';
-        if (isNeg) {
-          out_exrules.value.push(rule);
-        } else {
-          out_rrules.value.push(rule);
-        }
-      } else if (rDateInstance) {
-        // cs does not accept DATEs here:
-        if (isNeg) {
-          out_exdates.value.push(getIcalUTC(cal.dtz.ensureDateTime(rDateInstance.date)));
-        } else {
-          out_rdates.value.push(getIcalUTC(cal.dtz.ensureDateTime(rDateInstance.date)));
-        }
-      } else {
-        this.notifyError(
-          NS_ERROR_UNEXPECTED,
-          "don't know how to handle this recurrence item: " + rItem.valueAsIcalString
-        );
-      }
-    }
-  }
-};
-
-function sameStringSet(list, list_) {
-  return list.length == list_.length && list.every(x => list_.some(y => x == y));
-}
-
-calWcapCalendar.prototype.encodeRecurrenceParams = function(item, oldItem, excludeExdates) {
-  let rrules = {};
-  let rdates = {};
-  let exrules = {};
-  let exdates = {};
-  this.getRecurrenceParams(item, rrules, rdates, exrules, exdates);
-  if (oldItem) {
-    // actually only write changes if an old item has been changed, because
-    // cs recreates the whole series if a rule has changed.
-    // xxx todo: one problem is left when a master only holds EXDATEs,
-    //           and effectively no item is present anymore.
-    //           cs seems not to clean up automatically, but it does when
-    //           when deleting an occurrence {id, rec-id}!
-    //           So this still leaves the question open why deleteOccurrence
-    //           does not directly call deleteItem rather than modifyItem,
-    //           which leads to a much cleaner usage.
-    //           I assume this mimic has been chosen for easier undo/redo
-    //           support (Undo would then have to distinguish whether
-    //           it has previously deleted an occurrence or ordinary item:
-    //            - entering an exception again
-    //            - or adding an item)
-    //           Currently it can just modifyItem(newItem/oldItem) back.
-    let rrules_ = {};
-    let rdates_ = {};
-    let exrules_ = {};
-    let exdates_ = {};
-    this.getRecurrenceParams(oldItem, rrules_, rdates_, exrules_, exdates_);
-
-    if (sameStringSet(rrules.value, rrules_.value)) {
-      rrules.value = null; // don't write
-    }
-    if (sameStringSet(rdates.value, rdates_.value)) {
-      rdates.value = null; // don't write
-    }
-    if (sameStringSet(exrules.value, exrules.value)) {
-      exrules.value = null; // don't write
-    }
-    if (excludeExdates || sameStringSet(exdates.value, exdates_.value)) {
-      exdates.value = null; // don't write
-    }
-  }
-
-  let ret = "";
-  if (rrules.value) {
-    ret += "&rrules=" + rrules.value.join(";");
-  }
-  if (rdates.value) {
-    ret += "&rdates=" + rdates.value.join(";");
-  }
-  if (exrules.value) {
-    ret += "&exrules=" + exrules.value.join(";");
-  }
-  if (!excludeExdates && exdates.value) {
-    ret += "&exdates=" + exdates.value.join(";");
-  }
-  return ret;
-  // xxx todo:
-  // rchange=1: expand recurrences,
-  // or whether to replace the rrule, ambiguous documentation!!!
-  // check with store(with no uid) upon adoptItem() which behaves strange
-  // if rchange=0 is set!
-};
-
-calWcapCalendar.prototype.getAlarmParams = function(item) {
-  let params = null;
-  // xxx TODO ALARMSUPPORT check if WCAP supports multiple alarms
-  let alarms = item.getAlarms().filter(x => x.action == "EMAIL");
-  let alarm = alarms.length > 0 && alarms[0];
-
-  if (alarm) {
-    let alarmStart = cal.alarms.calculateAlarmOffset(item, alarm);
-    if (alarm.related == alarm.ALARM_RELATED_END) {
-      // cs does not support explicit RELATED=END when
-      // both start|entry and end|due are written
-      let dur = item.duration;
-      if (dur) {
-        // both given
-        alarmStart = alarmStart.clone();
-        alarmStart.addDuration(dur);
-      } // else only end|due is set, alarm makes little sense though
-    }
-
-    let emails = "";
-    if (item.hasProperty("alarmEmailAddress")) {
-      emails = encodeURIComponent(item.getProperty("alarmEmailAddress"));
-    } else {
-      emails = this.session
-        .getDefaultAlarmEmails({})
-        .map(encodeURIComponent)
-        .join(";");
-    }
-    if (emails.length > 0) {
-      params = "&alarmStart=" + alarmStart.icalString;
-      params += "&alarmEmails=" + emails;
-    }
-    // else popup
-  }
-  if (!params) {
-    // clear popup, email alarm:
-    params = "&alarmStart=&alarmPopup=&alarmEmails=";
-  }
-  return params;
-};
-
-// why ever, X-S1CS-EMAIL is unsupported though documented
-// for get_calprops... WTF.
-function getCalId(att) {
-  return att ? att.getProperty("X-S1CS-CALID") : null;
-}
-
-function getAttendeeByCalId(atts, calId) {
-  for (let att of atts) {
-    if (getCalId(att) == calId) {
-      return att;
-    }
-  }
-  return null;
-}
-
-calWcapCalendar.prototype.isInvitation = function(item) {
-  if (!this.session.isLoggedIn) {
-    return false; // don't know
-  }
-  let calId = this.calId;
-  let orgCalId = getCalId(item.organizer);
-  if (!orgCalId || orgCalId == calId) {
-    return false;
-  }
-  return this.getInvitedAttendee(item) != null;
-};
-
-calWcapCalendar.prototype.getInvitedAttendee = function(item) {
-  let att = getAttendeeByCalId(item.getAttendees(), this.calId);
-  if (!att) {
-    // try to find mail address
-    let prefMail = this.session.getUserPreferences("X-NSCP-WCAP-PREF-mail");
-    if (prefMail.length > 0 && prefMail[0].length > 0) {
-      att = item.getAttendeeById("mailto:" + prefMail[0]);
-    }
-  }
-  return att;
-};
-
-calWcapCalendar.prototype.canNotify = function(method, item) {
-  if (!this.session.isLoggedIn) {
-    return false;
-  }
-  let calId = this.calId;
-  switch (method) {
-    case "REQUEST":
-    case "CANCEL":
-      // when creating new items, mind that organizer's id
-      return (
-        !item.organizer || // might yet not be set
-        item.organizer.id == calId || // or is set to raw calId
-        getCalId(item.organizer) == calId
-      );
-    case "REPLY": // only if we we're invited from cs, and find matching X-S1CS-CALID:
-      return getAttendeeByCalId(item.getAttendees(), calId) != null;
-    default:
-      return false;
-  }
-};
-
-function equalDatetimes(one, two) {
-  return (!one && !two) || (one && two && one.isDate == two.isDate && one.compare(two) == 0);
-}
-
-function identicalDatetimes(one, two) {
-  return (
-    (!one && !two) ||
-    (equalDatetimes(one, two) && cal.data.compareObjects(one.timezone, two.timezone))
-  );
-}
-
-// @return null if nothing has changed else value to be written
-function diffProperty(newItem, oldItem, propName) {
-  let val = newItem.getProperty(propName);
-  let oldVal = oldItem ? oldItem.getProperty(propName) : null;
-  if (val === null) {
-    // force being set when - no old item, eg when adding new item
-    //                      - property is to be deleted
-    if (!oldItem || oldVal) {
-      val = "";
-    }
-  } else {
-    val = val.replace(/(\r\n)|\n/g, "\r\n");
-    if (oldVal) {
-      oldVal = oldVal.replace(/(\r\n)|\n/g, "\r\n");
-    }
-    if (val == oldVal) {
-      val = null;
-    }
-  }
-  return val;
-}
-
-/* eslint-disable no-unused-vars */
-var METHOD_PUBLISH = 1;
-var METHOD_REQUEST = 2;
-var METHOD_REPLY = 4;
-var METHOD_CANCEL = 8;
-var METHOD_UPDATE = 256;
-/* eslint-enable no-unused-vars */
-
-calWcapCalendar.prototype.storeItem = function(bAddItem, item, oldItem, request) {
-  function getOrgId(orgItem) {
-    return orgItem && orgItem.organizer && orgItem.organizer.id ? orgItem.organizer.id : null;
-  }
-  function encodeCategories(cats) {
-    cats = cats.concat([]);
-    cats.sort();
-    return cats.join(";");
-  }
-  function getPrivacy(pitem) {
-    return pitem.privacy && pitem.privacy != "" ? pitem.privacy : "PUBLIC";
-  }
-
-  let encodeAttendees = atts => {
-    function attendeeSort(one, two) {
-      one = one.id;
-      two = two.id;
-      if (one == two) {
-        return 0;
-      }
-      return one < two ? -1 : 1;
-    }
-    atts = atts.concat([]);
-    atts.sort(attendeeSort);
-    return atts.map(this.encodeAttendee, this).join(";");
-  };
-
-  let getAttachments = attitem => {
-    let ret;
-    let attachments = attitem.attachments;
-    if (attachments) {
-      let strings = [];
-      for (let att of attachments) {
-        let wrappedAtt = cal.wrapInstance(att, Ci.calIAttachment);
-        if (typeof att == "string") {
-          strings.push(encodeURIComponent(att));
-        } else if (wrappedAtt && wrappedAtt.uri) {
-          strings.push(encodeURIComponent(wrappedAtt.uri.spec));
-        } else {
-          // xxx todo
-          logError("only URLs supported as attachment, not: " + att, this);
-        }
-      }
-      strings.sort();
-      ret = strings.join(";");
-    }
-    return ret || "";
-  };
-
-  let bIsEvent = cal.item.isEvent(item);
-  let bIsParent = isParent(item);
-
-  let method = METHOD_PUBLISH;
-  let bNoSmtpNotify = false;
-  let params = "";
-
-  let calId = this.calId;
-  if (!bAddItem && this.isInvitation(item)) {
-    // REPLY
-    method = METHOD_REPLY;
-    let att = getAttendeeByCalId(item.getAttendees(), calId);
-    if (att) {
-      log("attendee: " + att.icalProperty.icalString, this);
-      let oldAtt = null;
-      if (oldItem) {
-        oldAtt = getAttendeeByCalId(oldItem.getAttendees(), calId);
-      }
-      if (!oldAtt || att.participationStatus != oldAtt.participationStatus) {
-        // REPLY first for just this calendar:
-        params +=
-          "&attendees=PARTSTAT=" + att.participationStatus + "^" + encodeURIComponent(att.id);
-      }
-    }
-  } else {
-    // PUBLISH, REQUEST
-    // workarounds for server bugs concerning recurrences/exceptions:
-    // - if first occurrence is an exception
-    //   and an EXDATE for that occurrence ought to be written,
-    //   then the master item's data is replaced with that EXDATEd exception. WTF.
-    // - if start/end date is being written on master, the previously EXDATEd
-    //   exception overwrites master, why ever.
-    // So in these cases: write all data of master.
-
-    let bIsAllDay = false;
-    let dtstart, dtend;
-    if (bIsEvent) {
-      dtstart = item.startDate;
-      dtend = item.endDate;
-      bIsAllDay = dtstart.isDate && dtend.isDate;
-      if (
-        !oldItem ||
-        !identicalDatetimes(dtstart, oldItem.startDate) ||
-        !identicalDatetimes(dtend, oldItem.endDate)
-      ) {
-        params += "&dtstart=" + getIcalUTC(dtstart); // timezone will be set with tzid param
-        params += "&dtend=" + getIcalUTC(dtend);
-        params += bIsAllDay ? "&isAllDay=1" : "&isAllDay=0";
-
-        if (bIsParent && item.recurrenceInfo) {
-          oldItem = null; // recurrence/exceptions hack: write whole master
-        }
-      }
-    } else {
-      // calITodo
-      // xxx todo: dtstart is mandatory for cs, so if this is
-      //           undefined, assume an allDay todo???
-      dtstart = item.entryDate;
-      dtend = item.dueDate;
-
-      // cs bug: enforce DUE (set to DTSTART) if alarm is set
-      if (!dtend && item.getAlarms().length) {
-        dtend = dtstart;
-      }
-
-      bIsAllDay = dtstart && dtstart.isDate;
-      if (
-        !oldItem ||
-        !identicalDatetimes(dtstart, oldItem.entryDate) ||
-        !identicalDatetimes(dtend, oldItem.dueDate)
-      ) {
-        params += "&dtstart=" + getIcalUTC(dtstart); // timezone will be set with tzid param
-        params += "&due=" + getIcalUTC(dtend); // timezone will be set with tzid param
-        params += bIsAllDay ? "&isAllDay=1" : "&isAllDay=0";
-
-        if (bIsParent && item.recurrenceInfo) {
-          oldItem = null; // recurrence/exceptions hack: write whole master
-        }
-      }
-    }
-    if (bIsParent) {
-      let recParams = this.encodeRecurrenceParams(item, oldItem, !bAddItem /* exclude EXDATEs */);
-      if (recParams.length > 0) {
-        oldItem = null; // recurrence/exceptions hack: write whole master
-        params += recParams;
-      }
-    }
-
-    let orgCalId = getCalId(item.organizer);
-    if (!orgCalId) {
-      // new events yet don't have X-S1CS-CALID set on ORGANIZER or this is outbound iTIP
-      let orgId = getOrgId(item);
-      if (!orgId || orgId.toLowerCase().replace(/^mailto:/, "") == this.ownerId.toLowerCase()) {
-        orgCalId = calId; // own event
-      } // else outbound
-    }
-
-    let attendees = item.getAttendees();
-    if (attendees.length > 0) {
-      // xxx todo: why ever, X-S1CS-EMAIL is unsupported though documented for calprops... WTF.
-      let attParam = encodeAttendees(attendees);
-      if (!oldItem || attParam != encodeAttendees(oldItem.getAttendees())) {
-        params += "&attendees=" + attParam;
-      }
-
-      if (orgCalId == calId) {
-        method = METHOD_REQUEST;
-      } else {
-        method = METHOD_UPDATE;
-        bNoSmtpNotify = true;
-      }
-    } else if (oldItem && oldItem.getAttendees().length > 0) {
-      // else using just PUBLISH
-      params += "&attendees="; // clear attendees
-    }
-
-    if (orgCalId) {
-      if (!oldItem || orgCalId != getCalId(oldItem.organizer)) {
-        params += "&orgCalid=" + encodeURIComponent(orgCalId);
-      }
-    } else {
-      // might be a copy of an iTIP invitation:
-      let orgEmail = getOrgId(item);
-      if (!oldItem || getOrgId(oldItem) != orgEmail) {
-        params += "&orgEmail=" + encodeURIComponent(orgEmail);
-      }
-    }
-
-    let val = item.title;
-    if (!oldItem || val != oldItem.title) {
-      params += "&summary=" + encodeURIComponent(val);
-    }
-
-    let categories = item.getCategories();
-    let catParam = encodeCategories(categories);
-    if (!oldItem || catParam != encodeCategories(oldItem.getCategories())) {
-      params += "&categories=" + catParam;
-    }
-
-    val = diffProperty(item, oldItem, "DESCRIPTION");
-    if (val !== null) {
-      params += "&desc=" + encodeURIComponent(val);
-    }
-    val = diffProperty(item, oldItem, "LOCATION");
-    if (val !== null) {
-      params += "&location=" + encodeURIComponent(val);
-    }
-    val = diffProperty(item, oldItem, "URL");
-    if (val !== null) {
-      params += "&icsUrl=" + encodeURIComponent(val);
-    }
-    // xxx todo: default prio is 0 (5 in sjs cs)
-    val = item.priority;
-    if (!oldItem || val != oldItem.priority) {
-      params += "&priority=" + encodeURIComponent(val);
-    }
-
-    let icsClass = getPrivacy(item);
-    if (!oldItem || icsClass != getPrivacy(oldItem)) {
-      params += "&icsClass=" + icsClass;
-    }
-
-    if (!oldItem || item.status != oldItem.status) {
-      switch (item.status) {
-        case "CONFIRMED":
-          params += "&status=0";
-          break;
-        case "CANCELLED":
-          params += "&status=1";
-          break;
-        case "TENTATIVE":
-          params += "&status=2";
-          break;
-        case "NEEDS-ACTION":
-          params += "&status=3";
-          break;
-        case "COMPLETED":
-          params += "&status=4";
-          break;
-        case "IN-PROCESS":
-          params += "&status=5";
-          break;
-        case "DRAFT":
-          params += "&status=6";
-          break;
-        case "FINAL":
-          params += "&status=7";
-          break;
-        default:
-          // reset to default
-          params += bIsEvent ? "&status=0" : "&status=3";
-          break;
-      }
-    }
-
-    val = diffProperty(item, oldItem, "TRANSP");
-    if (val !== null) {
-      switch (val) {
-        case "TRANSPARENT":
-          params += "&transparent=1";
-          break;
-        case "OPAQUE":
-          params += "&transparent=0";
-          break;
-        default:
-          params += "&transparent=" + (icsClass == "PRIVATE" || bIsAllDay ? "1" : "0");
-          break;
-      }
-    }
-
-    if (!bIsEvent) {
-      if (!oldItem || item.percentComplete != oldItem.percentComplete) {
-        params += "&percent=" + item.percentComplete.toString(10);
-      }
-      if (!oldItem || !equalDatetimes(item.completedDate, oldItem.completedDate)) {
-        params += "&completed=" + getIcalUTC(item.completedDate);
-      }
-    }
-
-    // attachment urls:
-    val = getAttachments(item);
-    if (!oldItem || val != getAttachments(oldItem)) {
-      params += "&attachments=" + val;
-    }
-  } // PUBLISH, REQUEST
-
-  let alarmParams = this.getAlarmParams(item);
-  if (!oldItem || this.getAlarmParams(oldItem) != alarmParams) {
-    if (method == METHOD_REQUEST && params.length == 0) {
-      // assure no email notifications about this change:
-      bNoSmtpNotify = true;
-    }
-    params += alarmParams;
-  }
-
-  if (params.length == 0) {
-    log("no change at all.", this);
-    if (LOG_LEVEL > 2) {
-      log("old item:\n" + oldItem.icalString + "\n\nnew item:\n" + item.icalString, this);
-    }
-    request.execRespFunc(null, item);
-  } else {
-    // cs does not support separate timezones for start and end, just pick one for tzid param:
-    let someDate = item.startDate || item.entryDate || item.dueDate;
-    if (someDate && !someDate.timezone.isUTC) {
-      params += "&tzid=" + encodeURIComponent(this.getAlignedTzid(someDate.timezone));
-    }
-
-    if (item.id) {
-      params += "&uid=" + encodeURIComponent(item.id);
-    }
-
-    // be picky about create/modify, if possible:
-    // WCAP_STORE_TYPE_CREATE, WCAP_STORE_TYPE_MODIFY
-    if (bAddItem) {
-      params += "&storetype=1";
-    } else if (oldItem) {
-      params += "&storetype=2";
-    } // else we don't know exactly, so don't check
-
-    if (bIsParent) {
-      params += "&mod=4"; // THIS AND ALL INSTANCES
-    } else {
-      params += "&mod=1&rid=" + getIcalUTC(cal.dtz.ensureDateTime(item.recurrenceId)); // THIS INSTANCE
-    }
-
-    params += "&method=" + method;
-    if (bNoSmtpNotify) {
-      params += "&smtp=0&smtpNotify=0&notify=0";
-    }
-    params += "&replace=1"; // (update) don't append to any lists
-    params += "&fetch=1&relativealarm=1&compressed=1&recurring=1";
-    params += "&emailorcalid=1&fmt-out=text%2Fcalendar";
-
-    let netRespFunc = (err, icalRootComp) => {
-      if (err) {
-        throw err;
-      }
-      let items = this.parseItems(
-        icalRootComp,
-        calICalendar.ITEM_FILTER_ALL_ITEMS,
-        0,
-        null,
-        null,
-        true /* bLeaveMutable */
-      );
-      if (items.length != 1) {
-        this.notifyError(NS_ERROR_UNEXPECTED, "unexpected number of items: " + items.length);
-      }
-      let newItem = items[0];
-      this.tunnelXProps(newItem, item);
-      newItem.makeImmutable();
-      // invalidate cached results:
-      delete this.m_cachedResults;
-      // xxx todo: may log request status
-      request.execRespFunc(null, newItem);
-    };
-    this.issueNetworkRequest(
-      request,
-      netRespFunc,
-      stringToIcal,
-      bIsEvent ? "storeevents" : "storetodos",
-      params,
-      calIWcapCalendar.AC_COMP_READ | calIWcapCalendar.AC_COMP_WRITE
-    );
-  }
-};
-
-calWcapCalendar.prototype.tunnelXProps = function(destItem, srcItem) {
-  // xxx todo: temp workaround for bug in calItemBase.js
-  if (!isParent(srcItem)) {
-    return;
-  }
-  // tunnel alarm X-MOZ-SNOOZE only if alarm is still set:
-  // TODO ALARMSUPPORT still needed when showing alarms as EMAIL for wcap?
-  let hasAlarms = destItem.getAlarms().length;
-  for (let [name, value] of srcItem.properties) {
-    try {
-      if (name.startsWith("X-MOZ-")) {
-        switch (name) {
-          // keep snooze stamps for occurrences only and if alarm is still set:
-          case "X-MOZ-SNOOZE-TIME":
-            if (!hasAlarms) {
-              break; // alarm has been reset
-            }
-          // falls through
-          default:
-            if (LOG_LEVEL > 1) {
-              log("tunneling " + name + "=" + value, this);
-            }
-            destItem.setProperty(name, value);
-            break;
-        }
-      }
-    } catch (exc) {
-      logError(exc, this);
-    }
-  }
-};
-
-calWcapCalendar.prototype.adoptItem = function(item, listener) {
-  let request = new calWcapRequest((oprequest, err, newItem) => {
-    this.notifyOperationComplete(
-      listener,
-      getResultCode(err),
-      calIOperationListener.ADD,
-      err ? item.id : newItem.id,
-      err ? err : newItem
-    );
-    if (!err && this == this.superCalendar) {
-      this.notifyObservers("onAddItem", [newItem]);
-    }
-  }, log("adoptItem() call: " + item.title, this));
-
-  try {
-    this.storeItem(true /* bAddItem */, item, null, request);
-  } catch (exc) {
-    request.execRespFunc(exc);
-  }
-  return request;
-};
-
-calWcapCalendar.prototype.addItem = function(item, listener) {
-  this.adoptItem(item.clone(), listener);
-};
-
-calWcapCalendar.prototype.modifyItem = function(newItem, oldItem, listener) {
-  let request = new calWcapRequest((oprequest, err, item) => {
-    this.notifyOperationComplete(
-      listener,
-      getResultCode(err),
-      calIOperationListener.MODIFY,
-      newItem.id,
-      err ? err : item
-    );
-    if (!err && this == this.superCalendar) {
-      this.notifyObservers("onModifyItem", [item, oldItem]);
-    }
-  }, log("modifyItem() call: " + newItem.id, this));
-
-  try {
-    if (!newItem.id) {
-      throw new Components.Exception("new item has no id!");
-    }
-    let oldItem_ = oldItem;
-    if (isParent(newItem)) {
-      // Due to a cs bug, EXDATEs cannot be passed with store, thus make a two-step delete then store.
-      // First check if EXDATEs are passed or have been modified:
-      let exdates = {};
-      this.getRecurrenceParams(newItem, {}, {}, {}, exdates);
-      if (oldItem) {
-        let exdates_ = {};
-        this.getRecurrenceParams(oldItem_, {}, {}, {}, exdates_);
-        // only use added elements
-        exdates.value = exdates.value.filter(elem => !exdates_.value.some(elem_ => elem_ == elem));
-      } // else in case no oldItem is passed, nevertheless try to delete the EXDATEs
-      if (exdates.value.length > 0) {
-        let params = "&uid=";
-        // all deletes on the same item:
-        for (let i = exdates.value.length - 1; i >= 0; i--) {
-          params += encodeURIComponent(newItem.id);
-          if (i > 0) {
-            params += ";";
-          }
-        }
-        params += "&mod=1&rid=" + exdates.value.join(";");
-
-        let orgCalId = getCalId(newItem.organizer);
-        if (!orgCalId || orgCalId != this.calId) {
-          // item does not belong to this user, so don't notify:
-          params += "&smtp=0&smtpNotify=0&notify=0";
-        }
-        params += "&fmt-out=text%2Fxml";
-
-        request.lockPending();
-        this.issueNetworkRequest(
-          request,
-          (err, xml) => {
-            try {
-              // ignore any error and continue storing the item:
-              if (LOG_LEVEL > 0) {
-                log(
-                  "modifyItem EXDATEs: " + (xml ? getWcapRequestStatusString(xml) : "failed!"),
-                  this
-                );
-              }
-              // invalidate cached results:
-              delete this.m_cachedResults;
-              this.storeItem(false /* bAddItem */, newItem, oldItem_, request);
-            } finally {
-              request.unlockPending();
-            }
-          },
-          stringToXml,
-          cal.item.isEvent(newItem) ? "deleteevents_by_id" : "deletetodos_by_id",
-          params,
-          calIWcapCalendar.AC_COMP_WRITE
-        );
-        return request;
-      }
-    } else if (
-      oldItem &&
-      !oldItem.parentItem.recurrenceInfo.getExceptionFor(newItem.recurrenceId)
-    ) {
-      // pass null for oldItem when creating new exceptions, write whole item:
-      oldItem_ = null;
-    }
-    this.storeItem(false /* bAddItem */, newItem, oldItem_, request);
-  } catch (exc) {
-    request.execRespFunc(exc);
-  }
-  return request;
-};
-
-calWcapCalendar.prototype.deleteItem = function(item, listener) {
-  let request = new calWcapRequest((oprequest, err) => {
-    // xxx todo: need to notify about each deleted item if multiple?
-    this.notifyOperationComplete(
-      listener,
-      getResultCode(err),
-      calIOperationListener.DELETE,
-      item.id,
-      err ? err : item
-    );
-    if (!err && this == this.superCalendar) {
-      this.notifyObservers("onDeleteItem", [item]);
-    }
-  }, log("deleteItem() call: " + item.id, this));
-
-  try {
-    if (!item.id) {
-      throw new Components.Exception("no item id!");
-    }
-    let params = "&uid=" + encodeURIComponent(item.id);
-    if (isParent(item)) {
-      // delete THIS AND ALL:
-      params += "&mod=4&rid=0";
-    } else {
-      // delete THIS INSTANCE:
-      // cs does not accept DATE here:
-      params += "&mod=1&rid=" + getIcalUTC(cal.dtz.ensureDateTime(item.recurrenceId));
-    }
-
-    let orgCalId = getCalId(item.organizer);
-    if (!orgCalId || orgCalId != this.calId) {
-      // item does not belong to this user, so don't notify:
-      params += "&smtp=0&smtpNotify=0&notify=0";
-    }
-
-    params += "&fmt-out=text%2Fxml";
-
-    this.issueNetworkRequest(
-      request,
-      (err, xml) => {
-        if (err) {
-          throw err;
-        }
-        // invalidate cached results:
-        delete this.m_cachedResults;
-        if (LOG_LEVEL > 0) {
-          log("deleteItem(): " + getWcapRequestStatusString(xml), this);
-        }
-      },
-      stringToXml,
-      cal.item.isEvent(item) ? "deleteevents_by_id" : "deletetodos_by_id",
-      params,
-      calIWcapCalendar.AC_COMP_WRITE
-    );
-  } catch (exc) {
-    request.execRespFunc(exc);
-  }
-  return request;
-};
-
-calWcapCalendar.prototype.patchTimezone = function(subComp, attr, xpropOrTz) {
-  let date = subComp[attr];
-  // if TZID parameter present (all-day items), it takes precedence:
-  if (date && (date.timezone.isUTC || date.timezone.isFloating)) {
-    if (LOG_LEVEL > 2) {
-      log(attr + " is " + date, this);
-    }
-    let timezone;
-    if (typeof xpropOrTz == "string") {
-      let tzid = subComp.getFirstProperty(xpropOrTz);
-      if (tzid) {
-        timezone = this.session.getTimezone(tzid.value);
-        cal.ASSERT(timezone, "timezone not found: " + tzid);
-      }
-    } else {
-      timezone = xpropOrTz;
-    }
-    if (timezone) {
-      if (LOG_LEVEL > 2) {
-        log(
-          "patching " + xpropOrTz + ": from " + date + " to " + date.getInTimezone(timezone),
-          this
-        );
-      }
-      date = date.getInTimezone(timezone);
-      subComp[attr] = date;
-    }
-  }
-  return date;
-};
-
-calWcapCalendar.prototype.parseItems = function(
-  icalRootComp,
-  itemFilter,
-  maxResults,
-  rangeStart,
-  rangeEnd,
-  bLeaveMutable
-) {
-  let items = [];
-  let unexpandedItems = [];
-  let uid2parent = {};
-  let excItems = [];
-  let fakedParents = {};
-
-  let componentType = "ANY";
-  switch (itemFilter & calICalendar.ITEM_FILTER_TYPE_ALL) {
-    case calICalendar.ITEM_FILTER_TYPE_TODO:
-      componentType = "VTODO";
-      break;
-    case calICalendar.ITEM_FILTER_TYPE_EVENT:
-      componentType = "VEVENT";
-      break;
-  }
-
-  let recurrenceBound = this.session.recurrenceBound;
-
-  for (let subComp of cal.iterate.icalComponent(icalRootComp, componentType)) {
-    let organizer = subComp.getFirstProperty("ORGANIZER");
-    if (organizer && organizer.getParameter("SENT-BY")) {
-      // has SENT-BY
-      // &emailorcalid=1 sets wrong email, workaround setting calid...
-      let id = organizer.getParameter("X-S1CS-CALID");
-      if (id) {
-        organizer.value = id;
-      }
-    }
-
-    let dtstart = this.patchTimezone(subComp, "startTime", "X-NSCP-DTSTART-TZID");
-
-    let item = null;
-    switch (subComp.componentType) {
-      case "VEVENT": {
-        this.patchTimezone(subComp, "endTime", dtstart ? dtstart.timezone : "X-NSCP-DTEND-TZID");
-        item = cal.createEvent();
-        item.icalComponent = subComp;
-        break;
-      }
-      case "VTODO": {
-        this.patchTimezone(subComp, "dueTime", dtstart ? dtstart.timezone : "X-NSCP-DUE-TZID");
-        item = cal.createTodo();
-        item.icalComponent = subComp;
-        switch (itemFilter & calICalendar.ITEM_FILTER_COMPLETED_ALL) {
-          case calICalendar.ITEM_FILTER_COMPLETED_YES:
-            if (!item.isCompleted) {
-              item = null;
-            }
-            break;
-          case calICalendar.ITEM_FILTER_COMPLETED_NO:
-            if (item.isCompleted) {
-              item = null;
-            }
-            break;
-        }
-        break;
-      }
-    }
-    if (item) {
-      if (!item.title) {
-        // assumed to look at a subscribed calendar,
-        // so patch title for private items:
-        switch (item.privacy) {
-          case "PRIVATE":
-            item.title = g_privateItemTitle;
-            break;
-          case "CONFIDENTIAL":
-            item.title = g_confidentialItemTitle;
-            break;
-        }
-      }
-
-      item.calendar = this.superCalendar;
-      let rid = item.recurrenceId;
-      if (rid) {
-        rid = rid.getInTimezone(dtstart.timezone);
-        item.recurrenceId = rid;
-        if (LOG_LEVEL > 1) {
-          log(
-            "exception item: " + item.title + "\nrid=" + getIcalUTC(rid) + "\nitem.id=" + item.id,
-            this
-          );
-        }
-        excItems.push(item);
-      } else if (item.recurrenceInfo) {
-        unexpandedItems.push(item);
-        uid2parent[item.id] = item;
-      } else if (
-        (maxResults == 0 || items.length < maxResults) &&
-        cal.item.checkIfInRange(item, rangeStart, rangeEnd)
-      ) {
-        if (LOG_LEVEL > 2) {
-          log("item: " + item.title + "\n" + item.icalString, this);
-        }
-        if (!bLeaveMutable) {
-          item.makeImmutable();
-        }
-        items.push(item);
-      }
-    }
-  }
-
-  // tag "exceptions", i.e. items with rid:
-  for (let item of excItems) {
-    let parent = uid2parent[item.id];
-
-    if (!parent) {
-      // a parentless one, fake a master and override it's occurrence
-      parent = cal.item.isEvent(item) ? cal.createEvent() : cal.createTodo();
-      parent.id = item.id;
-      parent.calendar = this.superCalendar;
-      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;
-      uid2parent[item.id] = parent;
-      items.push(parent);
-    }
-    if (item.id in fakedParents) {
-      let rdate = Cc["@mozilla.org/calendar/recurrence-date;1"].createInstance(
-        Ci.calIRecurrenceDate
-      );
-      rdate.date = item.recurrenceId;
-      parent.recurrenceInfo.appendRecurrenceItem(rdate);
-    }
-
-    let recStartDate = parent.recurrenceStartDate;
-    if (recStartDate && recStartDate.isDate && !item.recurrenceId.isDate) {
-      // cs ought to return proper all-day RECURRENCE-ID!
-      // get into startDate's timezone before cutting:
-      let rid = item.recurrenceId.getInTimezone(recStartDate.timezone);
-      rid.isDate = true;
-      item.recurrenceId = rid;
-    }
-
-    parent.recurrenceInfo.modifyException(item, true);
-  }
-
-  if (itemFilter & calICalendar.ITEM_FILTER_CLASS_OCCURRENCES) {
-    for (let item of unexpandedItems) {
-      if (maxResults != 0 && items.length >= maxResults) {
-        break;
-      }
-
-      let recStartDate = item.recurrenceStartDate;
-      if (recStartDate && !recStartDate.isDate) {
-        recStartDate = null;
-      }
-      let recItems = item.recurrenceInfo.getRecurrenceItems({});
-      for (let recItem of recItems) {
-        // cs bug: workaround missing COUNT
-        let rRuleInstance = cal.wrapInstance(recItem, Ci.calIRecurrenceRule);
-        let rDateInstance = cal.wrapInstance(recItem, Ci.calIRecurrenceDate);
-        if (rRuleInstance) {
-          recItem = rRuleInstance;
-          if (!recItem.isFinite && !recItem.isNegative) {
-            recItem.count = recurrenceBound;
-          }
-        } else if (recStartDate && rDateInstance) {
-          // cs bug: always uses DATE-TIME even though the master item is all-day DATE:
-          //         get into startDate's timezone before cutting:
-          recItem = rDateInstance;
-          let date = recItem.date.getInTimezone(recStartDate.timezone);
-          date.isDate = true;
-          recItem.date = date;
-        }
-      }
-
-      if (!bLeaveMutable) {
-        item.makeImmutable();
-      }
-      let occurrences = item.recurrenceInfo.getOccurrences(
-        rangeStart,
-        rangeEnd,
-        maxResults == 0 ? 0 : maxResults - items.length,
-        {}
-      );
-      if (LOG_LEVEL > 1) {
-        log(
-          "item: " + item.title + " has " + occurrences.length.toString() + " occurrences.",
-          this
-        );
-        if (LOG_LEVEL > 2) {
-          log("master item: " + item.title + "\n" + item.icalString, this);
-          for (let occ of occurrences) {
-            log("item: " + occ.title + "\n" + occ.icalString, this);
-          }
-        }
-      }
-      // only proxies returned:
-      items = items.concat(occurrences);
-    }
-  } else {
-    if (maxResults != 0 && items.length + unexpandedItems.length > maxResults) {
-      unexpandedItems.length = maxResults - items.length;
-    }
-    if (!bLeaveMutable) {
-      for (let item of unexpandedItems) {
-        item.makeImmutable();
-      }
-    }
-    if (LOG_LEVEL > 2) {
-      for (let item of unexpandedItems) {
-        log("item: " + item.title + "\n" + item.icalString, this);
-      }
-    }
-    items = items.concat(unexpandedItems);
-  }
-
-  if (LOG_LEVEL > 1) {
-    log("parseItems(): returning " + items.length + " items", this);
-  }
-  return items;
-};
-
-calWcapCalendar.prototype.getItem = function(id, listener) {
-  let request = new calWcapRequest((oprequest, err, item) => {
-    if (
-      checkErrorCode(err, calIWcapErrors.WCAP_FETCH_EVENTS_BY_ID_FAILED) ||
-      checkErrorCode(err, calIWcapErrors.WCAP_COMPONENT_NOT_FOUND)
-    ) {
-      // querying by id is a valid use case, even if no item is returned:
-      err = NS_OK;
-    }
-    this.notifyOperationComplete(
-      listener,
-      getResultCode(err),
-      calIOperationListener.GET,
-      item ? item.id : null,
-      err || item
-    );
-  }, log("getItem() call: id=" + id, this));
-
-  try {
-    if (!id) {
-      throw new Components.Exception("no item id!");
-    }
-    let params = "&relativealarm=1&compressed=1&recurring=1";
-    params += "&emailorcalid=1&fmt-out=text%2Fcalendar&uid=";
-    params += encodeURIComponent(id);
-
-    // most common: try events first
-    this.issueNetworkRequest(
-      request,
-      (err, eventRootComp) => {
-        let notifyResult = rootComp => {
-          let items = this.parseItems(rootComp, calICalendar.ITEM_FILTER_ALL_ITEMS, 0, null, null);
-          if (items.length < 1) {
-            throw new Components.Exception("no such item!");
-          }
-          if (items.length > 1) {
-            this.notifyError(NS_ERROR_UNEXPECTED, "unexpected number of items: " + items.length);
-          }
-          if (listener) {
-            listener.onGetResult(
-              this.superCalendar,
-              NS_OK,
-              calIItemBase,
-              log("getItem(): success. id=" + id, this),
-              items
-            );
-          }
-          request.execRespFunc(null, items[0]);
-        };
-        if (err) {
-          if (
-            !checkErrorCode(err, calIWcapErrors.WCAP_FETCH_EVENTS_BY_ID_FAILED) &&
-            !checkErrorCode(err, calIWcapErrors.WCAP_COMPONENT_NOT_FOUND)
-          ) {
-            throw err;
-          }
-          // try todos:
-          this.issueNetworkRequest(
-            request,
-            (fetcherr, todoRootComp) => {
-              if (fetcherr) {
-                throw fetcherr;
-              }
-              notifyResult(todoRootComp);
-            },
-            stringToIcal,
-            "fetchtodos_by_id",
-            params,
-            calIWcapCalendar.AC_COMP_READ
-          );
-        } else {
-          notifyResult(eventRootComp);
-        }
-      },
-      stringToIcal,
-      "fetchevents_by_id",
-      params,
-      calIWcapCalendar.AC_COMP_READ
-    );
-  } catch (exc) {
-    request.execRespFunc(exc);
-  }
-  return request;
-};
-
-function getItemFilterParams(itemFilter) {
-  let params = "";
-  switch (itemFilter & calICalendar.ITEM_FILTER_TYPE_ALL) {
-    case calICalendar.ITEM_FILTER_TYPE_TODO:
-      params += "&component-type=todo";
-      break;
-    case calICalendar.ITEM_FILTER_TYPE_EVENT:
-      params += "&component-type=event";
-      break;
-  }
-
-  let compstate = "";
-  //     if (itemFilter & calIWcapCalendar.ITEM_FILTER_REPLY_DECLINED)
-  //         compstate += ";REPLY-DECLINED";
-  //     if (itemFilter & calIWcapCalendar.ITEM_FILTER_REPLY_ACCEPTED)
-  //         compstate += ";REPLY-ACCEPTED";
-  //     if (itemFilter & calIWcapCalendar.ITEM_FILTER_REQUEST_COMPLETED)
-  //         compstate += ";REQUEST-COMPLETED";
-  if (itemFilter & calICalendar.ITEM_FILTER_REQUEST_NEEDS_ACTION) {
-    compstate += ";REQUEST-NEEDS-ACTION";
-  }
-  //     if (itemFilter & calIWcapCalendar.ITEM_FILTER_REQUEST_NEEDSNOACTION) {
-  //         compstate += ";REQUEST-NEEDSNOACTION";
-  //     }
-  //     if (itemFilter & calIWcapCalendar.ITEM_FILTER_REQUEST_PENDING)
-  //         compstate += ";REQUEST-PENDING";
-  //     if (itemFilter & calIWcapCalendar.ITEM_FILTER_REQUEST_WAITFORREPLY)
-  //         compstate += ";REQUEST-WAITFORREPLY";
-  if (compstate.length > 0) {
-    params += "&compstate=" + compstate.substr(1);
-  }
-  return params;
-}
-
-calWcapCalendar.prototype.getItems = function(
-  itemFilter,
-  maxResults,
-  rangeStart,
-  rangeEnd,
-  listener
-) {
-  rangeStart = cal.dtz.ensureDateTime(rangeStart);
-  rangeEnd = cal.dtz.ensureDateTime(rangeEnd);
-  let zRangeStart = getIcalUTC(rangeStart);
-  let zRangeEnd = getIcalUTC(rangeEnd);
-
-  let request = new calWcapRequest((oprequest, err, data) => {
-    log("getItems() complete: " + errorToString(err), this);
-    this.notifyOperationComplete(
-      listener,
-      getResultCode(err),
-      calIOperationListener.GET,
-      null,
-      err
-    );
-  }, log("getItems():\n\titemFilter=0x" + itemFilter.toString(0x10) + ",\n\tmaxResults=" + maxResults + ",\n\trangeStart=" + zRangeStart + ",\n\trangeEnd=" + zRangeEnd, this));
-
-  if (this.aboutToBeUnregistered) {
-    // limiting the amount of network traffic while unregistering
-    log("being unregistered, no results.", this);
-    request.execRespFunc(null, []);
-    return request;
-  }
-
-  // m_cachedResults holds the last data retrieval. This is especially useful when
-  // switching on multiple subcriptions: the composite calendar multiplexes getItems()
-  // calls to all composited calendars over and over again, most often on the same
-  // date range (as the user usually looks at the same view).
-  // This will most likely vanish when a better caching is implemented in the views,
-  // or WCAP local storage caching has sufficient performance.
-  // The cached results will be invalidated after 2 minutes to reflect incoming invitations.
-  if (CACHE_LAST_RESULTS > 0 && this.m_cachedResults) {
-    for (let entry of this.m_cachedResults) {
-      if (
-        itemFilter == entry.itemFilter &&
-        equalDatetimes(rangeStart, entry.rangeStart) &&
-        equalDatetimes(rangeEnd, entry.rangeEnd)
-      ) {
-        log("reusing last getItems() cached data.", this);
-        if (listener) {
-          listener.onGetResult(
-            this.superCalendar,
-            NS_OK,
-            calIItemBase,
-            "getItems()",
-            entry.results
-          );
-        }
-        request.execRespFunc(null, entry.results);
-        return request;
-      }
-    }
-  }
-
-  try {
-    let params = "&relativealarm=1&compressed=1&recurring=1&emailorcalid=1&fmt-out=text%2Fcalendar";
-    // setting component-type, compstate filters:
-    params += getItemFilterParams(itemFilter);
-    if (maxResults > 0) {
-      params += "&maxResults=" + maxResults;
-    }
-    params += "&dtstart=" + zRangeStart;
-    params += "&dtend=" + zRangeEnd;
-
-    this.issueNetworkRequest(
-      request,
-      (err, icalRootComp) => {
-        if (err) {
-          if (checkErrorCode(err, calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR)) {
-            // try free-busy times:
-            if (
-              listener &&
-              itemFilter & calICalendar.ITEM_FILTER_TYPE_EVENT &&
-              rangeStart &&
-              rangeEnd
-            ) {
-              let freeBusyListener = {
-                // calIGenericOperationListener:
-                onResult: function(oprequest, result) {
-                  if (!Components.isSuccessCode(oprequest.status)) {
-                    throw oprequest.status;
-                  }
-                  let items = [];
-                  for (let entry of result) {
-                    let item = cal.createEvent();
-                    item.id = g_busyPhantomItemUuidPrefix + getIcalUTC(entry.interval.start);
-                    item.calendar = this.superCalendar;
-                    item.title = g_busyItemTitle;
-                    item.startDate = entry.interval.start;
-                    item.endDate = entry.interval.end;
-                    item.makeImmutable();
-                    items.push(item);
-                  }
-                  listener.onGetResult(
-                    this.superCalendar,
-                    NS_OK,
-                    calIItemBase,
-                    "getItems()/free-busy",
-                    items
-                  );
-                }.bind(this),
-              };
-              request.attachSubRequest(
-                this.session.getFreeBusyIntervals(
-                  this.calId,
-                  rangeStart,
-                  rangeEnd,
-                  calIFreeBusyInterval.BUSY_ALL,
-                  freeBusyListener
-                )
-              );
-            }
-          } else {
-            throw err;
-          }
-        } else if (listener) {
-          let items = this.parseItems(icalRootComp, itemFilter, maxResults, rangeStart, rangeEnd);
-
-          if (CACHE_LAST_RESULTS > 0) {
-            // auto invalidate after X minutes:
-            if (!this.m_cachedResultsTimer) {
-              let callback = {
-                notify: function(timer) {
-                  if (!this.m_cachedResults) {
-                    return;
-                  }
-                  let now = new Date().getTime();
-                  // sort out old entries:
-                  let entries = [];
-                  for (let i = 0; i < this.m_cachedResults.length; ++i) {
-                    let entry = this.m_cachedResults[i];
-                    if (now - entry.stamp < CACHE_LAST_RESULTS_INVALIDATE * 1000) {
-                      entries.push(entry);
-                    } else {
-                      log(
-                        "invalidating cached entry:\n\trangeStart=" +
-                          getIcalUTC(entry.rangeStart) +
-                          "\n\trangeEnd=" +
-                          getIcalUTC(entry.rangeEnd),
-                        this
-                      );
-                    }
-                  }
-                  this.m_cachedResults = entries;
-                }.bind(this),
-              };
-              // sort out freq:
-              let freq = Math.min(
-                20, // default: 20secs
-                Math.max(1, CACHE_LAST_RESULTS_INVALIDATE)
-              );
-              log("cached results sort out timer freq: " + freq, this);
-              this.m_cachedResultsTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-              this.m_cachedResultsTimer.initWithCallback(
-                callback,
-                freq * 1000,
-                Ci.nsITimer.TYPE_REPEATING_SLACK
-              );
-            }
-            if (!this.m_cachedResults) {
-              this.m_cachedResults = [];
-            }
-            let cacheEntry = {
-              stamp: new Date().getTime(),
-              itemFilter: itemFilter,
-              rangeStart: rangeStart ? rangeStart.clone() : null,
-              rangeEnd: rangeEnd ? rangeEnd.clone() : null,
-              results: items,
-            };
-            this.m_cachedResults.unshift(cacheEntry);
-            if (this.m_cachedResults.length > CACHE_LAST_RESULTS) {
-              this.m_cachedResults.length = CACHE_LAST_RESULTS;
-            }
-          }
-
-          listener.onGetResult(this.superCalendar, NS_OK, calIItemBase, "getItems()", items);
-        }
-      },
-      stringToIcal,
-      "fetchcomponents_by_range",
-      params,
-      calIWcapCalendar.AC_COMP_READ
-    );
-  } catch (exc) {
-    request.execRespFunc(exc);
-  }
-  return request;
-};
-
-calWcapCalendar.prototype.offlineStorage = null;
-
-calWcapCalendar.prototype.resetLog = function() {
-  this.deleteProperty("replay.last_stamp");
-};
-
-calWcapCalendar.prototype.replayChangesOn = function(listener) {
-  let itemFilter = calICalendar.ITEM_FILTER_ALL_ITEMS;
-  let dtFrom = getDatetimeFromIcalString(this.getProperty("replay.last_stamp"));
-  let now = getTime(); // new stamp for this sync
-
-  let request_ = new calWcapRequest((request, err) => {
-    if (err) {
-      logError("error replaying changes: " + errorToString(err));
-      this.notifyError(err);
-    } else {
-      log("replay succeeded.", this);
-      this.setProperty("replay.last_stamp", getIcalUTC(now));
-      log("new replay stamp: " + getIcalUTC(now), this);
-    }
-    if (listener) {
-      listener.onResult(request, null);
-    }
-  }, log("replayChangesOn():\n\titemFilter=0x" + itemFilter.toString(0x10) + "\n\tdtFrom=" + getIcalUTC(dtFrom), this));
-
-  try {
-    let writeListener = {
-      QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
-      onGetResult: function(calendar, status, itemType, detail, items) {},
-      onOperationComplete: function(aCalendar, status, opType, id, detail) {
-        if (!Components.isSuccessCode(status)) {
-          request.execRespFunc(status); // any error on writing breaks whole operation
-        }
-      },
-    };
-    let request = new calWcapRequest((err, data) => {
-      let modifiedIds = {};
-      for (let item of request.m_modifiedItems) {
-        let dtCreated = item.getProperty("CREATED");
-        let bAdd = !dtCreated || !dtFrom || dtCreated.compare(dtFrom) >= 0;
-        modifiedIds[item.id] = true;
-        if (bAdd) {
-          log("replayChangesOn(): new item " + item.id, this);
-          if (this.offlineStorage) {
-            this.offlineStorage.addItem(item, writeListener);
-          }
-        } else {
-          log("replayChangesOn(): modified item " + item.id, this);
-          if (this.offlineStorage) {
-            this.modifyItem(item, null, writeListener);
-          }
-        }
-      }
-      for (let item of request.m_deletedItems) {
-        // don't delete anything that has been touched by lastmods:
-        if (modifiedIds[item.id]) {
-          log("replayChangesOn(): skipping deletion of " + item.id, this);
-        } else if (isParent(item)) {
-          log("replayChangesOn(): deleted item " + item.id, this);
-          if (this.offlineStorage) {
-            this.offlineStorage.deleteItem(item, writeListener);
-          }
-        } else {
-          // modify parent instead of
-          // straight-forward deleteItem(). WTF.
-          let parent = item.parentItem.clone();
-          parent.recurrenceInfo.removeOccurrenceAt(item.recurrenceId);
-          log("replayChangesOn(): modified parent " + parent.id, this);
-          if (this.offlineStorage) {
-            this.offlineStorage.modifyItem(parent, item, writeListener);
-          }
-        }
-      }
-    }, "replayChangesOn() netFinishedRespFunc");
-    request_.attachSubRequest(request);
-
-    // assure being logged in to calc server times:
-    this.session.getSessionId(request, (err, sessionId) => {
-      try {
-        if (err) {
-          throw err;
-        }
-        let params =
-          "&relativealarm=1&compressed=1&recurring=1&emailorcalid=1&fmt-out=text%2Fcalendar";
-        if (dtFrom) {
-          dtFrom = this.session.getServerTime(dtFrom);
-        }
-        params += "&dtstart=" + getIcalUTC(dtFrom);
-        params += "&dtend=" + getIcalUTC(this.session.getServerTime(now));
-
-        log("replayChangesOn(): getting last modifications...", this);
-        this.issueNetworkRequest(
-          request,
-          (fetcherr, icalRootComp) => {
-            if (fetcherr) {
-              throw fetcherr;
-            }
-            request.m_modifiedItems = this.parseItems(
-              icalRootComp,
-              calICalendar.ITEM_FILTER_ALL_ITEMS,
-              0,
-              null,
-              null
-            );
-          },
-          stringToIcal,
-          "fetchcomponents_by_lastmod",
-          params + getItemFilterParams(itemFilter),
-          calIWcapCalendar.AC_COMP_READ
-        );
-
-        log("replayChangesOn(): getting deleted items...", this);
-        this.issueNetworkRequest(
-          request,
-          (fetcherr, icalRootComp) => {
-            if (fetcherr) {
-              throw fetcherr;
-            }
-            request.m_deletedItems = this.parseItems(
-              icalRootComp,
-              calICalendar.ITEM_FILTER_ALL_ITEMS,
-              0,
-              null,
-              null
-            );
-          },
-          stringToIcal,
-          "fetch_deletedcomponents",
-          params +
-            getItemFilterParams(
-              itemFilter & calICalendar.ITEM_FILTER_TYPE_ALL // only component types
-            ),
-          calIWcapCalendar.AC_COMP_READ
-        );
-      } catch (exc) {
-        request.execRespFunc(exc);
-      }
-    });
-  } catch (exc) {
-    request_.execRespFunc(exc);
-  }
-  return request_;
-};
deleted file mode 100644
--- a/calendar/providers/wcap/calWcapCalendarModule.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/* 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 NS_OK, NS_ERROR_UNEXPECTED, nsIException, calIWcapSession,
- *          calIWcapCalendar, calIWcapErrors, calICalendar, calIItemBase,
- *          calIOperationListener, calIFreeBusyProvider, calIFreeBusyInterval,
- *          calICalendarSearchProvider, calIErrors, g_privateItemTitle,
- *          g_confidentialItemTitle, g_busyItemTitle,
- *          g_busyPhantomItemUuidPrefix, CACHE_LAST_RESULTS,
- *          CACHE_LAST_RESULTS_INVALIDATE, LOG_LEVEL
- */
-
-/* import-globals-from calWcapUtils.js */
-/* import-globals-from calWcapErrors.js */
-/* import-globals-from calWcapRequest.js */
-/* import-globals-from calWcapSession.js */
-/* import-globals-from calWcapCalendar.js */
-/* import-globals-from calWcapCalendarItems.js */
-
-var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-var { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-//
-// init code for globals, prefs:
-//
-
-// constants:
-var NS_OK = Cr.NS_OK;
-var NS_ERROR_UNEXPECTED = Cr.NS_ERROR_UNEXPECTED;
-var nsIException = Ci.nsIException;
-var calIWcapSession = Ci.calIWcapSession;
-var calIWcapCalendar = Ci.calIWcapCalendar;
-var calIWcapErrors = Ci.calIWcapErrors;
-var calICalendar = Ci.calICalendar;
-var calIItemBase = Ci.calIItemBase;
-var calIOperationListener = Ci.calIOperationListener;
-var calIFreeBusyProvider = Ci.calIFreeBusyProvider;
-var calIFreeBusyInterval = Ci.calIFreeBusyInterval;
-var calICalendarSearchProvider = Ci.calICalendarSearchProvider;
-var calIErrors = Ci.calIErrors;
-
-// some string resources:
-var g_privateItemTitle;
-var g_confidentialItemTitle;
-var g_busyItemTitle;
-var g_busyPhantomItemUuidPrefix;
-
-// global preferences:
-
-// caching the last data retrievals:
-var CACHE_LAST_RESULTS = 4;
-// timer secs for invalidation:
-var CACHE_LAST_RESULTS_INVALIDATE = 120;
-
-// logging:
-var LOG_LEVEL = 0;
-
-function initWcapProvider() {
-  try {
-    initLogging();
-
-    // some string resources:
-    g_privateItemTitle = getWcapString("privateItem.title.text");
-    g_confidentialItemTitle = getWcapString("confidentialItem.title.text");
-    g_busyItemTitle = getWcapString("busyItem.title.text");
-    g_busyPhantomItemUuidPrefix = "PHANTOM_uuid_" + cal.getUUID();
-
-    CACHE_LAST_RESULTS = Services.prefs.getIntPref("calendar.wcap.cache_last_results", 4);
-    CACHE_LAST_RESULTS_INVALIDATE = Services.prefs.getIntPref(
-      "calendar.wcap.cache_last_results_invalidate",
-      120
-    );
-  } catch (exc) {
-    logError(exc, "error in init sequence");
-  }
-}
-
-/** Module Registration */
-this.NSGetFactory = cid => {
-  let scriptLoadOrder = [
-    "resource://calendar/calendar-js/calWcapUtils.js",
-    "resource://calendar/calendar-js/calWcapErrors.js",
-    "resource://calendar/calendar-js/calWcapRequest.js",
-    "resource://calendar/calendar-js/calWcapSession.js",
-    "resource://calendar/calendar-js/calWcapCalendar.js",
-    "resource://calendar/calendar-js/calWcapCalendarItems.js",
-  ];
-
-  for (let script of scriptLoadOrder) {
-    Services.scriptloader.loadSubScript(script, this);
-  }
-
-  initWcapProvider();
-
-  let components = [calWcapCalendar, calWcapNetworkRequest, calWcapSession];
-  this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
-  return this.NSGetFactory(cid);
-};
deleted file mode 100644
--- a/calendar/providers/wcap/calWcapCalendarModule.manifest
+++ /dev/null
@@ -1,8 +0,0 @@
-component {cf4d93e5-af79-451a-95f3-109055b32ef0} calWcapCalendarModule.js
-contract @mozilla.org/calendar/calendar;1?type=wcap {cf4d93e5-af79-451a-95f3-109055b32ef0}
-
-component {cbf803fd-4469-4999-ae39-367af1c7b077} calWcapCalendarModule.js
-contract @mozilla.org/calendar/wcap/session;1 {cbf803fd-4469-4999-ae39-367af1c7b077}
-
-component {e3c62b37-83cf-41ec-9872-0af9f952430a} calWcapCalendarModule.js
-contract @mozilla.org/calendar/wcap/network-request;1 {e3c62b37-83cf-41ec-9872-0af9f952430a}
deleted file mode 100644
--- a/calendar/providers/wcap/calWcapErrors.js
+++ /dev/null
@@ -1,501 +0,0 @@
-/* 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 checkErrorCode, checkWcapXmlErrno, checkWcapIcalErrno,
- *          errorToString
- */
-
-/* import-globals-from calWcapCalendarModule.js */
-
-var NS_ERROR_INVALID_ARG = Cr.NS_ERROR_INVALID_ARG;
-
-//
-// Common netwerk errors:
-//
-var NS_ERROR_MODULE_BASE_OFFSET = 0x45;
-var NS_ERROR_MODULE_NETWORK = 6;
-
-function generateFailure(module, code) {
-  // 1<<31 generates negative number, so use literal, don't use logical operators:
-  return 0x80000000 + ((module + NS_ERROR_MODULE_BASE_OFFSET) << 16) + code;
-}
-
-function generateNetFailure(code) {
-  return generateFailure(NS_ERROR_MODULE_NETWORK, code);
-}
-
-function getResultCode(err) {
-  if (err === undefined || err === null) {
-    return NS_OK;
-  }
-  if (isNaN(err)) {
-    return err instanceof nsIException ? err.result : Cr.NS_ERROR_FAILURE;
-  }
-  return err;
-}
-
-function getErrorModule(err) {
-  let rc = getResultCode(err);
-  return ((rc >>> 16) & 0x7fff) - NS_ERROR_MODULE_BASE_OFFSET;
-}
-
-function checkErrorCode(err, rcBits, maskBits) {
-  if (!maskBits) {
-    maskBits = 0;
-  }
-  let rc = getResultCode(err);
-  return (rc ^ rcBits) >>> maskBits == 0;
-}
-
-// Cannot perform operation, because user is offline.
-// The following error codes have been adopted from
-// xpcom/base/nsError.h
-// and ought to be defined in IDL. xxx todo
-
-// The requested action could not be completed while the networking
-// is in the offline state.
-var NS_ERROR_OFFLINE = generateNetFailure(16);
-
-var NS_BINDING_FAILED = generateNetFailure(1);
-var NS_BINDING_ABORTED = generateNetFailure(2);
-var NS_BINDING_REDIRECTED = generateNetFailure(3);
-var NS_BINDING_RETARGETED = generateNetFailure(4);
-
-var g_nsNetErrorCodes = [
-  NS_BINDING_FAILED,
-  "The async request failed for some unknown reason.",
-  NS_BINDING_ABORTED,
-  "The async request failed because it was aborted by some user action.",
-  NS_BINDING_REDIRECTED,
-  "The async request has been redirected to a different async request.",
-  NS_BINDING_RETARGETED,
-  "The async request has been retargeted to a different handler.",
-  /* NS_ERROR_MALFORMED_URI */ generateNetFailure(10),
-  "The URI is malformed.",
-  /* NS_ERROR_UNKNOWN_PROTOCOL */ generateNetFailure(18),
-  "The URI scheme corresponds to an unknown protocol handler.",
-  /* NS_ERROR_CONNECTION_REFUSED */ generateNetFailure(13),
-  "The connection attempt failed, for example, because no server was listening at specified host:port.",
-  /* NS_ERROR_PROXY_CONNECTION_REFUSED */ generateNetFailure(72),
-  "The connection attempt to a proxy failed.",
-  /* NS_ERROR_NET_TIMEOUT */ generateNetFailure(14),
-  "The connection was lost due to a timeout error.",
-  NS_ERROR_OFFLINE,
-  "The requested action could not be completed while the networking library is in the offline state.",
-  /* NS_ERROR_PORT_ACCESS_NOT_ALLOWED */ generateNetFailure(19),
-  "The requested action was prohibited because it would have caused the networking library to establish a connection to an unsafe or otherwise banned port.",
-  /* NS_ERROR_NET_RESET */ generateNetFailure(20),
-  "The connection was established, but no data was ever received.",
-  /* NS_ERROR_NET_INTERRUPT */ generateNetFailure(71),
-  "The connection was established, but the data transfer was interrupted.",
-  /* NS_ERROR_NOT_RESUMABLE */ generateNetFailure(25),
-  "This request is not resumable, but it was tried to resume it, or to request resume-specific data.",
-  /* NS_ERROR_ENTITY_CHANGED */ generateNetFailure(32),
-  "It was attempted to resume the request, but the entity has changed in the meantime.",
-  /* NS_ERROR_REDIRECT_LOOP */ generateNetFailure(31),
-  "The request failed as a result of a detected redirection loop.",
-  /* NS_ERROR_UNKNOWN_HOST */ generateNetFailure(30),
-  "The lookup of a hostname failed. This generally refers to the hostname from the URL being loaded.",
-  /* NS_ERROR_UNKNOWN_PROXY_HOST */ generateNetFailure(42),
-  "The lookup of a proxy hostname failed.",
-  /* NS_ERROR_UNKNOWN_SOCKET_TYPE */ generateNetFailure(51),
-  "The specified socket type does not exist.",
-  /* NS_ERROR_SOCKET_CREATE_FAILED */ generateNetFailure(52),
-  "The specified socket type could not be created.",
-];
-
-function netErrorToString(rc) {
-  if (!isNaN(rc) && getErrorModule(rc) == NS_ERROR_MODULE_NETWORK) {
-    let i = 0;
-    while (i < g_nsNetErrorCodes.length) {
-      // however rc is kept unsigned, our generated code signed,
-      // so == won't work here:
-      if ((g_nsNetErrorCodes[i] ^ rc) == 0) {
-        return g_nsNetErrorCodes[i + 1];
-      }
-      i += 2;
-    }
-  }
-  throw new Components.Exception(
-    "No known network error code: " + rc.toString(0x10),
-    NS_ERROR_INVALID_ARG
-  );
-}
-
-//
-// WCAP error handling helpers
-//
-
-var g_wcapErrorCodes = [
-  /* -1 */ NS_OK,
-  "Logout successful.",
-  /*  0 */ NS_OK,
-  "Command successful.",
-  /*  1 */ calIWcapErrors.WCAP_LOGIN_FAILED,
-  getWcapString("loginFailed.text"),
-  /*  2 */ calIWcapErrors.WCAP_LOGIN_OK_DEFAULT_CALENDAR_NOT_FOUND,
-  "login.wcap was successful, but the default calendar for this user was not found. A new default calendar set to the userid was created.",
-  /*  3 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /*  4 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /*  5 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /*  6 */ calIWcapErrors.WCAP_DELETE_EVENTS_BY_ID_FAILED,
-  "WCAP_DELETE_EVENTS_BY_ID_FAILED",
-  /*  7 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /*  8 */ calIWcapErrors.WCAP_SETCALPROPS_FAILED,
-  "WCAP_SETCALPROPS_FAILED",
-  /*  9 */ calIWcapErrors.WCAP_FETCH_EVENTS_BY_ID_FAILED,
-  "WCAP_FETCH_EVENTS_BY_ID_FAILED",
-  /* 10 */ calIWcapErrors.WCAP_CREATECALENDAR_FAILED,
-  "WCAP_CREATECALENDAR_FAILED",
-  /* 11 */ calIWcapErrors.WCAP_DELETECALENDAR_FAILED,
-  "WCAP_DELETECALENDAR_FAILED",
-  /* 12 */ calIWcapErrors.WCAP_ADDLINK_FAILED,
-  "WCAP_ADDLINK_FAILED",
-  /* 13 */ calIWcapErrors.WCAP_FETCHBYDATERANGE_FAILED,
-  "WCAP_FETCHBYDATERANGE_FAILED",
-  /* 14 */ calIWcapErrors.WCAP_STOREEVENTS_FAILED,
-  "WCAP_STOREEVENTS_FAILED",
-  /* 15 */ calIWcapErrors.WCAP_STORETODOS_FAILED,
-  "WCAP_STORETODOS_FAILED",
-  /* 16 */ calIWcapErrors.WCAP_DELETE_TODOS_BY_ID_FAILED,
-  "WCAP_DELETE_TODOS_BY_ID_FAILED",
-  /* 17 */ calIWcapErrors.WCAP_FETCH_TODOS_BY_ID_FAILED,
-  "WCAP_FETCH_TODOS_BY_ID_FAILED",
-  /* 18 */ calIWcapErrors.WCAP_FETCHCOMPONENTS_FAILED_BAD_TZID,
-  "Command failed to find correct tzid. Applies to fetchcomponents_by_range.wcap, fetchevents_by_id.wcap, fetchtodos_by_id.wcap.",
-  /* 19 */ calIWcapErrors.WCAP_SEARCH_CALPROPS_FAILED,
-  "WCAP_SEARCH_CALPROPS_FAILED",
-  /* 20 */ calIWcapErrors.WCAP_GET_CALPROPS_FAILED,
-  "WCAP_GET_CALPROPS_FAILED",
-  /* 21 */ calIWcapErrors.WCAP_DELETECOMPONENTS_BY_RANGE_FAILED,
-  "WCAP_DELETECOMPONENTS_BY_RANGE_FAILED",
-  /* 22 */ calIWcapErrors.WCAP_DELETEEVENTS_BY_RANGE_FAILED,
-  "WCAP_DELETEEVENTS_BY_RANGE_FAILED",
-  /* 23 */ calIWcapErrors.WCAP_DELETETODOS_BY_RANGE_FAILED,
-  "WCAP_DELETETODOS_BY_RANGE_FAILED",
-  /* 24 */ calIWcapErrors.WCAP_GET_ALL_TIMEZONES_FAILED,
-  "WCAP_GET_ALL_TIMEZONES_FAILED",
-  /* 25 */ calIWcapErrors.WCAP_CREATECALENDAR_ALREADY_EXISTS_FAILED,
-  "The command createcalendar.wcap failed. A calendar with that name already exists in the database.",
-  /* 26 */ calIWcapErrors.WCAP_SET_USERPREFS_FAILED,
-  "WCAP_SET_USERPREFS_FAILED",
-  /* 27 */ calIWcapErrors.WCAP_CHANGE_PASSWORD_FAILED,
-  "WCAP_CHANGE_PASSWORD_FAILED",
-  /* 28 */ calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR,
-  getWcapString("accessDenied.text"),
-  /* 29 */ calIWcapErrors.WCAP_CALENDAR_DOES_NOT_EXIST,
-  "Command failed. The requested calendar does not exist in the database.",
-  /* 30 */ calIWcapErrors.WCAP_ILLEGAL_CALID_NAME,
-  "createcalendar.wcap failed. Invalid calid passed in.",
-  /* 31 */ calIWcapErrors.WCAP_CANNOT_MODIFY_LINKED_EVENTS,
-  "storeevents.wcap failed. The event to modify was a linked event.",
-  /* 32 */ calIWcapErrors.WCAP_CANNOT_MODIFY_LINKED_TODOS,
-  "storetodos.wcap failed. The todo to modify was a linked todo.",
-  /* 33 */ calIWcapErrors.WCAP_CANNOT_SENT_EMAIL,
-  "Command failed. Email notification failed. Usually caused by the server not being properly configured to send email. This can occur in storeevents.wcap, storetodos.wcap, deleteevents_by_id.wcap, deletetodos_by_id.wcap.",
-  /* 34 */ calIWcapErrors.WCAP_CALENDAR_DISABLED,
-  "Command failed. The calendar is disabled in the database.",
-  /* 35 */ calIWcapErrors.WCAP_WRITE_IMPORT_FAILED,
-  "Import failed when writing files to the server.",
-  /* 36 */ calIWcapErrors.WCAP_FETCH_BY_LAST_MODIFIED_FAILED,
-  "WCAP_FETCH_BY_LAST_MODIFIED_FAILED",
-  /* 37 */ calIWcapErrors.WCAP_CAPI_NOT_SUPPORTED,
-  "Failed trying to read from unsupported format calendar data.",
-  /* 38 */ calIWcapErrors.WCAP_CALID_NOT_SPECIFIED,
-  "Calendar ID was not specified.",
-  /* 39 */ calIWcapErrors.WCAP_GET_FREEBUSY_FAILED,
-  "WCAP_GET_FREEBUSY_FAILED",
-  /* 40 */ calIWcapErrors.WCAP_STORE_FAILED_DOUBLE_BOOKED,
-  "If double booking is not allowed in this calendar, storeevents.wcap fails with this error when attempting to store an event in a time slot that was already filled.",
-  /* 41 */ calIWcapErrors.WCAP_FETCH_BY_ALARM_RANGE_FAILED,
-  "WCAP_FETCH_BY_ALARM_RANGE_FAILED",
-  /* 42 */ calIWcapErrors.WCAP_FETCH_BY_ATTENDEE_ERROR_FAILED,
-  "WCAP_FETCH_BY_ATTENDEE_ERROR_FAILED",
-  /* 43 */ calIWcapErrors.WCAP_ATTENDEE_GROUP_EXPANSION_CLIPPED,
-  "An LDAP group being expanded was too large and exceeded the maximum number allowed in an expansion. The expansion stopped at the specified maximum limit. The maximum limit defaults to 200. To change the maximum limit, set the server configuration preference calstore.group.attendee.maxsize.",
-  /* 44 */ calIWcapErrors.WCAP_USERPREFS_ACCESS_DENIED,
-  "Either the server does not allow this administrator access to get or modify user preferences, or the requester is not an administrator.",
-  /* 45 */ calIWcapErrors.WCAP_NOT_ALLOWED_TO_REQUEST_PUBLISH,
-  "The requester was not an organizer of the event, and, therefore, is not allowed to edit the component using the PUBLISH or REQUEST method.",
-  /* 46 */ calIWcapErrors.WCAP_INSUFFICIENT_PARAMETERS,
-  "The caller tried to invoke verifyevents_by_ids.wcap, or verifytodos_by_ids.wcap with insufficient arguments (mismatched number of uid's and rid's).",
-  /* 47 */ calIWcapErrors.WCAP_MUSTBEOWNER_OPERATION,
-  "The user needs to be an owner or co-owner of the calendar in questions to complete this operation. (Probably related to private or confidential component.)",
-  /* 48 */ calIWcapErrors.WCAP_DWP_CONNECTION_FAILED,
-  "GSE scheduling engine failed to make connection to DWP.",
-  /* 49 */ calIWcapErrors.WCAP_DWP_MAX_CONNECTION_REACHED,
-  "Reached the maximum number of connections. When some of the connections are freed, users can successfully connect. Same as error 11001.",
-  /* 50 */ calIWcapErrors.WCAP_DWP_CANNOT_RESOLVE_CALENDAR,
-  "Front end can't resolve to a particular back end. Same as error 11002.",
-  /* 51 */ calIWcapErrors.WCAP_DWP_BAD_DATA,
-  "Generic response. Check all DWP servers. One might be down. Same as error 11003.",
-  /* 52 */ calIWcapErrors.WCAP_BAD_COMMAND,
-  "The command sent in was not recognized. This is an internal only error code. It should not appear in the error logs.",
-  /* 53 */ calIWcapErrors.WCAP_NOT_FOUND,
-  "Returned for all errors from a write to the Berkeley DB. This is an internal only error code. It should not appear in the error logs.",
-  /* 54 */ calIWcapErrors.WCAP_WRITE_IMPORT_CANT_EXPAND_CALID,
-  "Can't expand calid when importing file.",
-  /* 55 */ calIWcapErrors.WCAP_GETTIME_FAILED,
-  "Get server time failed.",
-  /* 56 */ calIWcapErrors.WCAP_FETCH_DELETEDCOMPONENTS_FAILED,
-  "fetch_deletedcomponents.wcap failed.",
-  /* 57 */ calIWcapErrors.WCAP_FETCH_DELETEDCOMPONENTS_PARTIAL_RESULT,
-  "Success but partial result.",
-  /* 58 */ calIWcapErrors.WCAP_WCAP_NO_SUCH_FORMAT,
-  "Returned in any of the commands when supplied fmt-out is not a supported format.",
-  /* 59 */ calIWcapErrors.WCAP_COMPONENT_NOT_FOUND,
-  "Returned when a fetch or delete is attempted that does not exist.",
-  /* 60 */ calIWcapErrors.WCAP_BAD_ARGUMENTS,
-  "Currently used when attendee or organizer specified does not have a valid email address.",
-  /* 61 */ calIWcapErrors.WCAP_GET_USERPREFS_FAILED,
-  "get_userprefs.wcap failed. The following error conditions returns error code 61: LDAP access denied, no results found, LDAP limit exceeded, LDAP connection failed.",
-  /* 62 */ calIWcapErrors.WCAP_WCAP_MODIFY_NO_EVENT,
-  "storeevents.wcap issued with storetype set to 2 (WCAP_STORE_TYPE_MODIFY) and the event doesn't exist.",
-  /* 63 */ calIWcapErrors.WCAP_WCAP_CREATE_EXISTS,
-  "storeevents.wcap issued with storetype set to 1 (WCAP_STORE_TYPE_CREATE) and the event already exists.",
-  /* 64 */ calIWcapErrors.WCAP_WCAP_MODIFY_CANT_MAKE_COPY,
-  "storevents.wcap issued and copy of event failed during processing.",
-  /* 65 */ calIWcapErrors.WCAP_STORE_FAILED_RECUR_SKIP,
-  "One instance of a recurring event skips over another.",
-  /* 66 */ calIWcapErrors.WCAP_STORE_FAILED_RECUR_SAMEDAY,
-  "Two instances of a recurring event can't occur on the same day.",
-  /* 67 */ calIWcapErrors.WCAP_BAD_ORG_ARGUMENTS,
-  'Bad organizer arguments. orgCalid or orgEmail must be passed if any other "org" parameter is sent. That is, orgUID can\'t be sent alone on a storeevents.wcap or a storetodos.wcao command if it is trying about to "create" the event or task. Note, if no "org" information is passed, the organizer defaults to the calid being passed with the command.',
-  /* 68 */ calIWcapErrors.WCAP_STORE_FAILED_RECUR_PRIVACY,
-  "Error returned if you try to change the privacy or transparency of a single instance in a recurring series.",
-  /* 69 */ calIWcapErrors.WCAP_LDAP_ERROR,
-  "For get_calprops.wcap, when there is an error is getting LDAP derived token values (X-S1CS-CALPROPS-FB-INCLUDE, X-S1CS-CALPROPS-COMMON-NAME).",
-  /* 70 */ calIWcapErrors.WCAP_GET_INVITE_COUNT_FAILED,
-  "Error in getting invite count (for get_calprops.wcap and fetchcomponents_by_range.wcap commands).",
-  /* 71 */ calIWcapErrors.WCAP_LIST_FAILED,
-  "list.wcap failed.",
-  /* 72 */ calIWcapErrors.WCAP_LIST_SUBSCRIBED_FAILED,
-  "list_subscribed.wcap failed.",
-  /* 73 */ calIWcapErrors.WCAP_SUBSCRIBE_FAILED,
-  "subscribe.wcap failed.",
-  /* 74 */ calIWcapErrors.WCAP_UNSUBSCRIBE_FAILED,
-  "unsubscribe.wcap failed.",
-  /* 75 */ calIWcapErrors.WCAP_ANONYMOUS_NOT_ALLOWED,
-  "Command cannot be executed as anonymous. Used only for list.wcap, list_subscribed.wcap, subscribe.wcap, and unsubscribe.wcap commands.",
-  /* 76 */ calIWcapErrors.WCAP_ACCESS_DENIED,
-  "Generated if a non-administrator user tries to read or set the calendar-owned list or the calendar-subscribed list of some other user, or if the option is not turned on in the server.",
-  /* 77 */ calIWcapErrors.WCAP_BAD_IMPORT_ARGUMENTS,
-  "Incorrect parameter received by import.wcap.",
-  /* 78 */ calIWcapErrors.WCAP_READONLY_DATABASE,
-  "Database is in read-only mode (returned for all attempts to write to the database).",
-  /* 79 */ calIWcapErrors.WCAP_ATTENDEE_NOT_ALLOWED_TO_REQUEST_ON_MODIFY,
-  "Attendee is not allowed to modify an event with method=request.",
-  /* 80 */ calIWcapErrors.WCAP_TRANSP_RESOURCE_NOT_ALLOWED,
-  "Resources do not permit the transparency parameter.",
-  /* 81 */ calIWcapErrors.WCAP_RECURRING_COMPONENT_NOT_FOUND,
-  "Recurring component not found. Only happens when recurring=1 is passed in by fetch commands. This code is returned if part of the recurring series (either the master or an exception) is missing.",
-  /* new by WCAP 4.0: */
-  /* 82 */ calIWcapErrors.WCAP_BAD_MIME_TYPE,
-  "The mime headers supplied while storing the attachment using storeevents.wcap/storetodos.wcap is malformatted.",
-  /* 83 */ calIWcapErrors.WCAP_MISSING_BOUNDARY,
-  "While supplying attachments to the storeveents/storetodos commands the mime boundary was not found.",
-  /* 84 */ calIWcapErrors.WCAP_INVALID_ATTACHMENT,
-  "The attachment supplied to be stored on the server is malformatted.",
-  /* 85 */ calIWcapErrors.WCAP_ATTACH_DELETE_SUCCESS,
-  "All the attachments requested to be deleted from the server by supplying deleteattach were deleted successsfully.",
-  /* 86 */ calIWcapErrors.WCAP_ATTACH_DELETE_PARTIAL,
-  "Of All attachments requested to be deleted from the server by supplying deleteattach , only few were deleted successfully.",
-  /* 87 */ calIWcapErrors.WCAP_ATTACHMENT_NOT_FOUND,
-  "The attachent requested to be fetched or deleted from the server was not found.",
-  /* / new by WCAP 4.0 */
-  /* 88 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 89 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 90 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 91 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 92 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 93 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 94 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 95 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 96 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 97 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 98 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 99 */ NS_ERROR_INVALID_ARG,
-  "No WCAP error code.",
-  /* 11000 */ calIWcapErrors.WCAP_CDWP_ERR_MAX_CONNECTION_REACHED,
-  "Maximum connections to back-end database reached. As connections are freed up, users can connect to the back-end.",
-  /* 11001 */ calIWcapErrors.WCAP_CDWP_ERR_CANNOT_CONNECT,
-  "Cannot connect to back-end server. Back-end machine might be down or DWP server is not up and running.",
-  /* 11002 */ calIWcapErrors.WCAP_CDWP_ERR_CANNOT_RESOLVE_CALENDAR,
-  "Front-end can't resolve calendar to a particular back-end server.",
-  /* 11003 */ calIWcapErrors.WCAP_CDWP_ERR_BAD_DATA,
-  "Bad data received from DWP connection. This is a generic formatting error. Check all DWP servers. One might be down.",
-  /* 11004 */ calIWcapErrors.WCAP_CDWP_ERR_DWPHOST_CTX_DOES_NOT_EXIST,
-  "For the back-end host, context doesn't exist in the context table.",
-  /* 11005 */ calIWcapErrors.WCAP_CDWP_ERR_HOSTNAME_NOT_RESOLVABLE,
-  "DNS or NIS files, or hostname resolver is not set up properly or machine does not exist.",
-  /* 11006 */ calIWcapErrors.WCAP_CDWP_ERR_NO_DATA,
-  "No data was received from reading the calendar properties from the DWP connection.",
-  /* 11007 */ calIWcapErrors.WCAP_CDWP_ERR_AUTH_FAILED,
-  "DWP authentication failed.",
-  /* 11008 */ calIWcapErrors.WCAP_CDWP_ERR_CHECKVERSION_FAILED,
-  "DWP version check failed.",
-];
-
-function wcapErrorToString(rc) {
-  if (isNaN(rc)) {
-    throw new Components.Exception(
-      "No known WCAP error code: " + rc.toString(0x10),
-      NS_ERROR_INVALID_ARG
-    );
-  }
-  if (rc == calIWcapErrors.WCAP_NO_ERRNO) {
-    return "No WCAP errno (missing X-NSCP-WCAP-ERRNO).";
-  }
-
-  let index = rc - calIWcapErrors.WCAP_ERROR_BASE + 1;
-  if (index >= 1 && index <= 108 && g_wcapErrorCodes[index * 2] != NS_ERROR_INVALID_ARG) {
-    return g_wcapErrorCodes[index * 2 + 1];
-  }
-  throw new Components.Exception(
-    "No known WCAP error code: " + rc.toString(0x10),
-    NS_ERROR_INVALID_ARG
-  );
-}
-
-function getWcapErrorCode(errno) {
-  if (errno == -5000) {
-    // semantically same error
-    errno = 59;
-  }
-  let index = -1;
-  if (errno >= -1 && errno <= 81) {
-    index = errno + 1;
-  } else if (errno >= 11000 && errno <= 11008) {
-    index = errno - 11000 + 100 + 1;
-  }
-  if (index >= 0 && g_wcapErrorCodes[index * 2] != NS_ERROR_INVALID_ARG) {
-    return g_wcapErrorCodes[index * 2];
-  }
-  throw new Components.Exception("No known WCAP error no: " + errno, NS_ERROR_INVALID_ARG);
-}
-
-function getWcapXmlErrno(xml) {
-  let elem = xml.getElementsByTagName("X-NSCP-WCAP-ERRNO");
-  if (elem) {
-    elem = elem.item(0);
-    if (elem) {
-      return parseInt(elem.textContent, 10);
-    }
-  }
-  // some commands just respond with an empty calendar, no errno. WTF.
-  // assume success:
-  return undefined;
-}
-
-function getWcapIcalErrno(icalRootComp) {
-  let prop = icalRootComp.getFirstProperty("X-NSCP-WCAP-ERRNO");
-  if (prop) {
-    return parseInt(prop.value, 10);
-  }
-  // some commands just respond with an empty calendar, no errno. WTF.
-  // assume success:
-  return undefined;
-}
-
-function checkWcapErrno(errno, expectedErrno) {
-  if (expectedErrno === undefined) {
-    expectedErrno = 0; // i.e. Command successful.
-  }
-  if (errno !== undefined && errno != expectedErrno) {
-    let rc = getWcapErrorCode(errno);
-    throw new Components.Exception(wcapErrorToString(rc), rc);
-  }
-}
-
-function checkWcapXmlErrno(xml, expectedErrno) {
-  checkWcapErrno(getWcapXmlErrno(xml), expectedErrno);
-}
-
-function checkWcapIcalErrno(icalRootComp, expectedErrno) {
-  checkWcapErrno(getWcapIcalErrno(icalRootComp), expectedErrno);
-}
-
-function errorToString(err) {
-  if (err) {
-    if (typeof err == "string") {
-      return err;
-    }
-    if (err instanceof Error) {
-      return err.message;
-    }
-    if (err instanceof nsIException) {
-      return err.toString(); // xxx todo: or just message?
-    }
-    if (isNaN(err)) {
-      return "[" + err + "] unknown error.";
-    }
-  }
-  // numeric codes:
-  switch (err) {
-    case undefined:
-    case null:
-    case NS_OK:
-      return "NS_OK";
-    case NS_ERROR_INVALID_ARG:
-      return "NS_ERROR_INVALID_ARG";
-    case Cr.NS_ERROR_NO_INTERFACE:
-      return "NS_ERROR_NO_INTERFACE";
-    case Cr.NS_ERROR_NOT_IMPLEMENTED:
-      return "NS_ERROR_NOT_IMPLEMENTED";
-    case Cr.NS_ERROR_NOT_AVAILABLE:
-      return "NS_ERROR_NOT_AVAILABLE";
-    case Cr.NS_ERROR_FAILURE:
-      return "NS_ERROR_FAILURE";
-    case Cr.NS_ERROR_BASE:
-      return "NS_ERROR_BASE";
-    case Cr.NS_ERROR_NOT_INITIALIZED:
-      return "NS_ERROR_NOT_INITIALIZED";
-    case Cr.NS_ERROR_ALREADY_INITIALIZED:
-      return "NS_ERROR_ALREADY_INITIALIZED";
-    case Cr.NS_ERROR_NULL_POINTER:
-      return "NS_ERROR_NULL_POINTER";
-    case Cr.NS_ERROR_ABORT:
-      return "NS_ERROR_ABORT";
-    case Cr.NS_ERROR_UNEXPECTED:
-      return "NS_ERROR_UNEXPECTED";
-    case Cr.NS_ERROR_OUT_OF_MEMORY:
-      return "NS_ERROR_OUT_OF_MEMORY";
-    case Cr.NS_ERROR_ILLEGAL_VALUE:
-      return "NS_ERROR_ILLEGAL_VALUE";
-    default:
-      // probe for WCAP error:
-      try {
-        return wcapErrorToString(err);
-      } catch (exc) {
-        // probe for netwerk error:
-        try {
-          return netErrorToString(err);
-        } catch (exc2) {
-          if (err & calIErrors.ERROR_BASE) {
-            for (let err_ in calIErrors) {
-              if (calIErrors[err_] == err) {
-                return err_;
-              }
-            }
-          }
-          return "[0x" + err.toString(0x10) + "] unknown error.";
-        }
-      }
-  }
-}
deleted file mode 100644
--- a/calendar/providers/wcap/calWcapRequest.js
+++ /dev/null
@@ -1,459 +0,0 @@
-/* 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/. */
-
-/**
-   A request object is used to track an async action.
-   While the action is running, isPending is true.
-   Functions issuing an async action usually take a response function along
-   with their parameters, typically named respFunc.
-   That function is called *after* the action has ended (i.e. isPending of the
-   issued action/request is false when called, status remains stable).
-   The response function gets the ended request as first parameter to check
-   whether the request has been successful and get its data.
-   The request function itself may return either
-   - a further calIOperation request object, i.e. an async continuation
-   - some data (incl null/undefined) which is the result of the async function,
-     indicating that there is no further continuation
-*/
-
-/* exported issueNetworkRequest, getWcapRequestStatusString, stringToIcal, stringToXml */
-
-/* import-globals-from calWcapCalendarModule.js */
-
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
-
-function generateRequestId() {
-  if (!generateRequestId.mRequestPrefix) {
-    generateRequestId.mRequestPrefix = cal.getUUID() + "-";
-    generateRequestId.mRequestId = 0;
-  }
-  ++generateRequestId.mRequestId;
-  return generateRequestId.mRequestPrefix + generateRequestId.mRequestId;
-}
-
-function calWcapRequest(respFunc, logContext) {
-  this.wrappedJSObject = this;
-  this.m_logContext = logContext;
-  this.m_id = generateRequestId();
-  this.m_isPending = true;
-  this.m_status = NS_OK;
-  this.m_respFunc = respFunc;
-  this.m_attachedRequests = [];
-}
-calWcapRequest.prototype = {
-  m_logContext: null,
-  m_parentRequest: null,
-  m_id: 0,
-  m_isPending: true,
-  m_status: NS_OK,
-  m_respFunc: null,
-  m_attachedRequests: null,
-  m_locked: false,
-
-  get parentRequest() {
-    return this.m_parentRequest;
-  },
-  set parentRequest(req) {
-    if (this.parentRequest) {
-      logError("already has parent!", this);
-    }
-    this.detachFromParent(); // detach without error
-    return (this.m_parentRequest = req);
-  },
-
-  /** The following locking is necessary when scheduling multiple async
-        requests; one cannot be sure that e.g. the first completes quickly
-        and responds the whole parent request when detaching.
-    */
-  lockPending: function() {
-    this.m_locked = true;
-  },
-  unlockPending: function() {
-    if (this.m_locked) {
-      this.m_locked = false;
-      // assures that respFunc is executed:
-      if (this.m_attachedRequests.length == 0) {
-        this.execRespFunc();
-      }
-    }
-  },
-
-  toString: function() {
-    let ret =
-      "calWcapRequest id=" +
-      this.id +
-      ", parent-id=" +
-      (this.parentRequest ? this.parentRequest.id : "<none>") +
-      " (" +
-      this.m_logContext +
-      ")";
-    if (LOG_LEVEL > 2 && this.m_attachedRequests.length > 0) {
-      ret += "\nattached requests:";
-      for (let req of this.m_attachedRequests) {
-        ret += "\n#" + req.id + "\t" + req;
-      }
-    }
-    ret += ", isPending=" + this.isPending;
-    ret += ", status=" + errorToString(this.status);
-    return ret;
-  },
-
-  attachSubRequest: function(req) {
-    if (req) {
-      if (this.m_attachedRequests.some(req_ => req.id == req_.id)) {
-        logError("request already attached: " + req.id, this);
-      } else if (req.isPending) {
-        this.m_attachedRequests.push(req);
-        req.parentRequest = this;
-        log("attachSubRequest()", this);
-      } else if (!this.m_locked && this.m_attachedRequests.length == 0) {
-        this.execRespFunc(req.status);
-      }
-    }
-  },
-
-  detachSubRequest: function(req, err) {
-    this.m_attachedRequests = this.m_attachedRequests.filter(req_ => req.id != req_.id);
-    if (err) {
-      // first failing sub request stops parent request:
-      this.execRespFunc(err);
-    } else if (!this.m_locked && this.m_attachedRequests.length == 0) {
-      // assures that respFunc is executed after all sub requests have been completed:
-      this.execRespFunc();
-    }
-  },
-
-  cancelAllSubRequests: function(status) {
-    let attachedRequests = this.m_attachedRequests;
-    this.m_attachedRequests = [];
-    attachedRequests.forEach(req => req.cancel(null));
-  },
-
-  detachFromParent: function(err) {
-    let parentRequest = this.m_parentRequest;
-    if (parentRequest) {
-      this.m_parentRequest = null;
-      parentRequest.detachSubRequest(this, err);
-    }
-  },
-
-  execRespFunc: function(err, data) {
-    if (this.isPending) {
-      this.m_isPending = false;
-      if (err) {
-        this.m_status = err;
-      }
-      this.cancelAllSubRequests();
-      let respFunc = this.m_respFunc;
-      if (respFunc) {
-        this.m_respFunc = null; // call once only
-        if (LOG_LEVEL > 2) {
-          log("response exec: " + errorToString(err), this);
-        }
-        try {
-          respFunc(this, err, data);
-        } catch (exc) {
-          this.m_status = exc;
-          // don't pump into error console, may be handled:
-          log("error: " + errorToString(exc), this);
-        }
-      }
-      this.detachFromParent(this.m_status);
-    }
-  },
-
-  execSubRespFunc: function(func, err, data) {
-    try {
-      func(err, data);
-    } catch (exc) {
-      this.execRespFunc(exc);
-    }
-  },
-
-  // calIOperation:
-  get id() {
-    return this.m_id;
-  },
-  get isPending() {
-    return this.m_isPending;
-  },
-  get status() {
-    return this.m_status === null ? NS_OK : this.m_status;
-  },
-
-  cancel: function(status) {
-    if (!status) {
-      status = calIErrors.OPERATION_CANCELLED;
-    }
-    this.execRespFunc(status);
-  },
-};
-
-function calWcapNetworkRequest(url, respFunc, bLogging) {
-  this.wrappedJSObject = this;
-  this.m_id = generateRequestId();
-  this.m_url = url;
-  this.m_respFunc = respFunc;
-  this.m_bLogging = bLogging === undefined ? true : bLogging;
-}
-var calWcapNetworkRequestClassID = Components.ID("{e3c62b37-83cf-41ec-9872-0af9f952430a}");
-var calWcapNetworkRequestInterfaces = [
-  Ci.nsIInterfaceRequestor,
-  Ci.nsIChannelEventSink,
-  Ci.calIOperation,
-];
-calWcapNetworkRequest.prototype = {
-  m_id: 0,
-  m_url: null,
-  m_loader: null,
-  m_respFunc: null,
-  m_bLogging: false,
-
-  classID: calWcapNetworkRequestClassID,
-  QueryInterface: cal.generateQI(calWcapNetworkRequestInterfaces),
-  classInfo: cal.generateCI({
-    classID: calWcapNetworkRequestClassID,
-    contractID: "@mozilla.org/calendar/wcap/network-request;1",
-    classDescription: "Sun Java System Calendar Server WCAP Network Request",
-    interfaces: calWcapNetworkRequestInterfaces,
-  }),
-
-  /**
-   * @see nsIInterfaceRequestor
-   * @see calProviderUtils.jsm
-   */
-  getInterface: cal.provider.InterfaceRequestor_getInterface,
-
-  /**
-   * prepareChannel
-   * Prepares the passed channel to match this objects properties
-   *
-   * @param aChannel    The Channel to be prepared
-   */
-  prepareChannel: function(aChannel) {
-    // No caching
-    aChannel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
-    aChannel = aChannel.QueryInterface(Ci.nsIHttpChannel);
-    aChannel.requestMethod = "GET";
-  },
-
-  /**
-   * @see nsIChannelEventSink
-   */
-  asyncOnChannelRedirect: function(aOldChannel, aNewChannel, aFlags, aCallback) {
-    // all we need to do to the new channel is the basic preparation
-    this.prepareChannel(aNewChannel);
-    aCallback.onRedirectVerifyCallback(Cr.NS_OK);
-  },
-
-  onStreamComplete: function(aLoader, aContext, aStatus, aResultLength, aResult) {
-    this.m_loader = null;
-
-    if (LOG_LEVEL > 0 && this.m_bLogging) {
-      log("status: " + errorToString(aStatus), this);
-    }
-    if (aStatus != Cr.NS_OK) {
-      this.execRespFunc(aStatus);
-      return;
-    }
-
-    let httpChannel = aLoader.request.QueryInterface(Ci.nsIHttpChannel);
-    let encoding = httpChannel.contentCharset || "utf-8";
-    let result = aResultLength ? new TextDecoder(encoding).decode(Uint8Array.from(aResult)) : "";
-
-    if (LOG_LEVEL > 2 && this.m_bLogging) {
-      log("contentCharset = " + encoding + "\nrequest result:\n" + result, this);
-    }
-    switch (httpChannel.responseStatus / 100) {
-      case 2 /* 2xx codes */:
-        // Everything worked out, we are done
-        this.execRespFunc(aStatus, result);
-        break;
-      default: {
-        // Something else went wrong
-        let error =
-          "A request Error Occurred. Status Code: " +
-          httpChannel.responseStatus +
-          " " +
-          httpChannel.responseStatusText +
-          " Body: " +
-          result;
-        this.execRespFunc(Components.Exception(error, NS_BINDING_FAILED));
-        break;
-      }
-    }
-  },
-
-  toString: function() {
-    let ret =
-      "calWcapNetworkRequest id=" +
-      this.id +
-      ", parent-id=" +
-      (this.parentRequest ? this.parentRequest.id : "<none>");
-    if (this.m_bLogging) {
-      ret += " (" + this.m_url + ")";
-    }
-    ret += ", isPending=" + this.isPending;
-    ret += ", status=" + errorToString(this.status);
-    return ret;
-  },
-
-  m_parentRequest: null,
-  get parentRequest() {
-    return this.m_parentRequest;
-  },
-  set parentRequest(req) {
-    if (this.parentRequest) {
-      logError("already has parent!", this);
-    }
-    this.detachFromParent(); // detach without error
-    return (this.m_parentRequest = req);
-  },
-
-  // calIOperation:
-  get id() {
-    return this.m_id;
-  },
-
-  m_isPending: true,
-  get isPending() {
-    return this.m_isPending;
-  },
-
-  get status() {
-    return this.request ? this.request.status : NS_OK;
-  },
-
-  detachFromParent: function(err) {
-    let parentRequest = this.m_parentRequest;
-    if (parentRequest) {
-      this.m_parentRequest = null;
-      parentRequest.detachSubRequest(this, err);
-    }
-  },
-
-  get request() {
-    return this.m_loader ? this.m_loader.channel : null;
-  },
-
-  cancel: function(status) {
-    if (!status) {
-      status = calIErrors.OPERATION_CANCELLED;
-    }
-    this.execRespFunc(status);
-    // xxx todo: check whether this works on redirected channels!
-    let request = this.request;
-    if (request && request.isPending()) {
-      log("canceling netwerk request...", this);
-      request.cancel(NS_BINDING_FAILED);
-      this.m_loader = null;
-    }
-  },
-
-  execRespFunc: function(err, str) {
-    if (this.isPending) {
-      this.m_isPending = false;
-      let respFunc = this.m_respFunc;
-      if (respFunc) {
-        this.m_respFunc = null; // call once only
-        if (LOG_LEVEL > 2 && this.m_bLogging) {
-          log("response exec: " + errorToString(err), this);
-        }
-        try {
-          respFunc(err, str);
-          err = null; // may have been handled
-        } catch (exc) {
-          // don't pump into error console, may be handled:
-          log("error: " + errorToString(exc), this);
-          err = exc;
-        }
-      }
-      this.detachFromParent(err);
-    }
-  },
-
-  execSubRespFunc: function(func, err, data) {
-    try {
-      func(err, data);
-    } catch (exc) {
-      this.execRespFunc(exc);
-    }
-  },
-};
-
-function issueNetworkRequest(parentRequest, respFunc, url, bLogging) {
-  let netRequest = new calWcapNetworkRequest(url, respFunc, bLogging);
-  if (parentRequest) {
-    parentRequest.attachSubRequest(netRequest);
-  }
-  try {
-    let uri = Services.io.newURI(url);
-    let channel = Services.io.newChannelFromURI(
-      uri,
-      null,
-      Services.scriptSecurityManager.getSystemPrincipal(),
-      null,
-      Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-      Ci.nsIContentPolicy.TYPE_OTHER
-    );
-    netRequest.prepareChannel(channel);
-    channel = channel.QueryInterface(Ci.nsIHttpChannel);
-    channel.redirectionLimit = 3;
-    channel.notificationCallbacks = netRequest;
-    let loader = cal.provider.createStreamLoader();
-    netRequest.m_loader = loader;
-
-    log("opening channel.", netRequest);
-    loader.init(netRequest);
-    channel.asyncOpen(loader);
-  } catch (exc) {
-    netRequest.execRespFunc(exc);
-  }
-}
-
-function getWcapRequestStatusString(xml) {
-  let str = "request status: ";
-  let items = xml.getElementsByTagName("RSTATUS");
-  if (items != null && items.length > 0) {
-    str += items.item(0).textContent;
-  } else {
-    str += "none";
-  }
-  return str;
-}
-
-function stringToIcal(session, data, expectedErrno) {
-  if (!data || data.length == 0) {
-    // assuming time-out; WTF.
-    throw new Components.Exception(
-      errorToString(calIWcapErrors.WCAP_LOGIN_FAILED),
-      calIWcapErrors.WCAP_LOGIN_FAILED
-    );
-  }
-  let icalRootComp;
-  try {
-    icalRootComp = cal
-      .getIcsService()
-      .parseICS(data, session /* implements calITimezoneProvider */);
-  } catch (exc) {
-    // map into more useful error string:
-    throw new Components.Exception("error parsing ical data!", calIErrors.ICS_PARSE);
-  }
-  checkWcapIcalErrno(icalRootComp, expectedErrno);
-  return icalRootComp;
-}
-
-function stringToXml(session, data, expectedErrno) {
-  if (!data || data.length == 0) {
-    // assuming time-out
-    throw new Components.Exception(
-      errorToString(calIWcapErrors.WCAP_LOGIN_FAILED),
-      calIWcapErrors.WCAP_LOGIN_FAILED
-    );
-  }
-  let xml = getDomParser().parseFromString(data, "text/xml");
-  checkWcapXmlErrno(xml, expectedErrno);
-  return xml;
-}
deleted file mode 100644
--- a/calendar/providers/wcap/calWcapSession.js
+++ /dev/null
@@ -1,1284 +0,0 @@
-/* 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 getWcapSessionFor */
-
-/* import-globals-from calWcapCalendarModule.js */
-
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
-
-function calWcapTimezone(tzProvider, tzid_, component_) {
-  this.wrappedJSObject = this;
-  this.provider = tzProvider;
-  this.icalComponent = component_;
-  this.tzid = tzid_;
-  this.isUTC = false;
-  this.isFloating = false;
-  this.latitude = null;
-  this.longitude = null;
-}
-calWcapTimezone.prototype = {
-  get displayName() {
-    if (this.mDisplayName === undefined) {
-      // used l10n'ed display name if available:
-      let timezone = cal.getTimezoneService().getTimezone(this.tzid);
-      this.mDisplayName = timezone ? timezone.displayName : this.tzid;
-    }
-    return this.mDisplayName;
-  },
-  toString: function() {
-    return this.icalComponent.toString();
-  },
-};
-
-function splitUriParams(uri) {
-  let spec = uri.spec;
-  let qmPos = spec.indexOf("?");
-  return qmPos == -1 ? [spec, ""] : [spec.substring(0, qmPos), spec.substring(qmPos)];
-}
-
-function getWcapSessionFor(calendar, uri) {
-  let contextId = calendar.getProperty("shared_context");
-  if (!contextId) {
-    contextId = cal.getUUID();
-    calendar.setProperty("shared_context", contextId);
-  }
-
-  if (!getWcapSessionFor.m_sessions) {
-    getWcapSessionFor.m_sessions = {};
-  }
-  let session = getWcapSessionFor.m_sessions[contextId];
-
-  if (!session) {
-    session = new calWcapSession(contextId);
-    getWcapSessionFor.m_sessions[contextId] = session;
-
-    let defaultCal = null;
-    let registeredCalendars = session.getRegisteredCalendars();
-    for (let regCal of registeredCalendars) {
-      if (regCal.isDefaultCalendar) {
-        defaultCal = regCal;
-        break;
-      }
-    }
-
-    if (defaultCal) {
-      session.defaultCalendar = defaultCal;
-      // eslint-disable-next-line array-bracket-spacing
-      let [defaultSpec] = splitUriParams(defaultCal.uri);
-      session.uri = Services.io.newURI(defaultSpec);
-      session.credentials.userId = defaultCal.getProperty("user_id");
-      log("default calendar found.", defaultCal);
-
-      // check and fix changing urls (autoconf) of subscribed calendars here:
-      for (let regCal of registeredCalendars) {
-        if (!regCal.isDefaultCalendar) {
-          let [spec, params] = splitUriParams(regCal.uri);
-          if (spec != defaultSpec) {
-            log("fixing url of subscribed calendar: " + regCal.calId, session);
-            let caluri = regCal.uri
-              .mutate()
-              .setSpec(defaultSpec + params)
-              .finalize();
-            regCal.uri = caluri;
-            regCal.setProperty("uri", caluri.spec);
-          }
-        }
-      }
-    } else {
-      // no default calendar found, dump all subscribed calendars:
-      registeredCalendars.forEach(
-        cal.getCalendarManager().unregisterCalendar,
-        cal.getCalendarManager()
-      );
-    }
-  }
-  return session;
-}
-
-function calWcapSession(contextId) {
-  this.wrappedJSObject = this;
-  this.m_contextId = contextId;
-  this.m_loginQueue = [];
-
-  // listen for shutdown, being logged out:
-  Services.obs.addObserver(this, "quit-application");
-  cal.getCalendarManager().addObserver(this);
-}
-var calWcapSessionClassID = Components.ID("{cbf803fd-4469-4999-ae39-367af1c7b077}");
-var calWcapSessionInterfaces = [
-  calIWcapSession,
-  calIFreeBusyProvider,
-  calICalendarSearchProvider,
-  Ci.calITimezoneProvider,
-  Ci.calICalendarManagerObserver,
-];
-calWcapSession.prototype = {
-  classID: calWcapSessionClassID,
-  QueryInterface: cal.generateQI(calWcapSessionInterfaces),
-  classInfo: cal.generateCI({
-    classID: calWcapSessionClassID,
-    contractID: "@mozilla.org/calendar/wcap/session;1",
-    classDescription: "Sun Java System Calendar Server WCAP Session",
-    interfaces: calWcapSessionInterfaces,
-  }),
-
-  toString: function(msg) {
-    let str =
-      "context-id: " + this.m_contextId + ", uri: " + (this.uri ? this.uri.spec : "unknown");
-    if (this.credentials.userId) {
-      str += ", userId=" + this.credentials.userId;
-    }
-    if (!this.m_sessionId) {
-      str += Services.io.offline ? ", offline" : ", not logged in";
-    }
-    return str;
-  },
-  notifyError: function(err) {
-    if (this.defaultCalendar) {
-      this.defaultCalendar.notifyError_(err, null, this);
-    } else {
-      logError("no default calendar!", this);
-      logError(err, this);
-    }
-  },
-
-  // calITimezoneProvider:
-  m_serverTimezones: null,
-  get timezoneIds() {
-    let tzids = [];
-    for (let tzid in this.m_serverTimezones) {
-      tzids.push(tzid);
-    }
-    return {
-      // nsIUTF8StringEnumerator:
-      m_index: 0,
-      [Symbol.iterator]: function() {
-        return tzids.values();
-      },
-      getNext: function() {
-        if (this.m_index >= tzids) {
-          cal.ASSERT(false, "calWcapSession::timezoneIds enumerator!");
-          throw Cr.NS_ERROR_UNEXPECTED;
-        }
-        return tzids[this.m_index++];
-      },
-      hasMore: function() {
-        return this.m_index < tzids.length;
-      },
-    };
-  },
-  getTimezone: function(tzid) {
-    switch (tzid) {
-      case "floating":
-        return cal.dtz.floating;
-      case "UTC":
-        return cal.dtz.UTC;
-      default:
-        if (this.m_serverTimezones) {
-          return this.m_serverTimezones[tzid];
-        }
-        return null;
-    }
-  },
-
-  m_serverTimeDiff: null,
-  getServerTime: function(localTime) {
-    if (this.m_serverTimeDiff === null) {
-      throw new Components.Exception("early run into getServerTime()!", Cr.NS_ERROR_NOT_AVAILABLE);
-    }
-    let ret = localTime ? localTime.clone() : getTime();
-    ret.addDuration(this.m_serverTimeDiff);
-    return ret;
-  },
-
-  m_sessionId: null,
-  m_loginQueue: null,
-  m_loginLock: false,
-
-  getSessionId: function(request, respFunc, timedOutSessionId) {
-    if (Services.io.offline) {
-      log("in offline mode.", this);
-      respFunc(new Components.Exception(errorToString(NS_ERROR_OFFLINE), NS_ERROR_OFFLINE));
-      return;
-    }
-
-    log("login queue lock: " + this.m_loginLock + ", length: " + this.m_loginQueue.length, this);
-
-    if (this.m_loginLock) {
-      this.m_loginQueue.push(respFunc);
-      log("login queue: " + this.m_loginQueue.length);
-    } else {
-      if (this.m_sessionId && this.m_sessionId != timedOutSessionId) {
-        respFunc(null, this.m_sessionId);
-        return;
-      }
-
-      this.m_loginLock = true;
-      log("locked login queue.", this);
-      this.m_sessionId = null; // invalidate for relogin
-
-      if (timedOutSessionId) {
-        log("reconnecting due to session timeout...", this);
-        cal.getFreeBusyService().removeProvider(this);
-        cal.getCalendarSearchService().removeProvider(this);
-      }
-
-      this.getSessionId_(
-        null, // don't couple to parent request parent may be cancelled
-        (err, sessionId) => {
-          log("getSessionId_resp_(): " + sessionId, this);
-          if (!err) {
-            this.m_sessionId = sessionId;
-            cal.getFreeBusyService().addProvider(this);
-            cal.getCalendarSearchService().addProvider(this);
-          }
-
-          let queue = this.m_loginQueue;
-          this.m_loginLock = false;
-          this.m_loginQueue = [];
-          log("unlocked login queue.", this);
-
-          let getSessionId_exec = func => {
-            try {
-              func(err, sessionId);
-            } catch (exc) {
-              // unexpected
-              this.notifyError(exc);
-            }
-          };
-          // answer first request:
-          getSessionId_exec(respFunc);
-          // and any remaining:
-          queue.forEach(getSessionId_exec);
-        }
-      );
-    }
-  },
-
-  // this is a server limit for recurrencies; default is 60
-  recurrenceBound: 60,
-
-  getSessionId_: function(request, respFunc) {
-    this.checkServerVersion(
-      request,
-      // probe whether server is accessible and responds:
-      err => {
-        if (err) {
-          respFunc(err);
-          return;
-        }
-        // lookup password manager, then try login or prompt/login:
-        log("attempting to get a session id for " + this.sessionUri.spec, this);
-
-        if (!this.sessionUri.schemeIs("https") && !confirmInsecureLogin(this.sessionUri)) {
-          log("user rejected insecure login on " + this.sessionUri.spec, this);
-          respFunc(
-            new Components.Exception(
-              errorToString(calIWcapErrors.WCAP_LOGIN_FAILED),
-              calIWcapErrors.WCAP_LOGIN_FAILED
-            )
-          );
-          return;
-        }
-
-        let outUser = { value: this.credentials.userId };
-        let outPW = { value: this.credentials.pw };
-        let outSavePW = { value: false };
-
-        if (outUser.value && !outPW.value) {
-          // lookup pw manager
-          log("looking in pw db for: " + this.uri.spec, this);
-          cal.auth.passwordManagerGet(outUser.value, outPW, this.uri.spec, "wcap login");
-        }
-
-        let promptAndLoginLoop_resp = (loginerr, sessionId) => {
-          if (checkErrorCode(loginerr, calIWcapErrors.WCAP_LOGIN_FAILED)) {
-            log("prompting for [user/]pw...", this);
-            if (
-              cal.auth.getCredentials(
-                getWcapString("loginDialog.label"),
-                this.sessionUri.hostPort,
-                outUser,
-                outPW,
-                outSavePW,
-                this.credentials.userId != null
-              )
-            ) {
-              this.login(request, promptAndLoginLoop_resp, outUser.value, outPW.value);
-            } else {
-              log("login prompt cancelled.", this);
-              this.defaultCalendar.setProperty("disabled", true);
-              this.defaultCalendar.setProperty("auto-enabled", true);
-              respFunc(
-                new Components.Exception(
-                  errorToString(calIWcapErrors.WCAP_LOGIN_FAILED),
-                  calIWcapErrors.WCAP_LOGIN_FAILED
-                )
-              );
-            }
-          } else if (loginerr) {
-            respFunc(loginerr);
-          } else {
-            if (outSavePW.value) {
-              // so try to remove old pw from db first:
-              try {
-                cal.auth.passwordManagerSave(
-                  outUser.value,
-                  outPW.value,
-                  this.uri.spec,
-                  "wcap login"
-                );
-              } catch (e) {
-                // User might have cancelled the master password prompt, or password saving
-                // could be disabled. That is ok, throw for everything else.
-                if (e.result != Cr.NS_ERROR_ABORT && e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
-                  throw e;
-                }
-              }
-            }
-            this.credentials.userId = outUser.value;
-            this.credentials.pw = outPW.value; // eslint-disable-line id-length
-            this.setupSession(sessionId, request, setuperr => respFunc(setuperr, sessionId));
-          }
-        };
-
-        if (outPW.value) {
-          this.login(request, promptAndLoginLoop_resp, outUser.value, outPW.value);
-        } else {
-          promptAndLoginLoop_resp(calIWcapErrors.WCAP_LOGIN_FAILED);
-        }
-      }
-    );
-  },
-
-  login: function(request, respFunc, user, password) {
-    issueNetworkRequest(
-      request,
-      (err, str) => {
-        let sessionId;
-        try {
-          if (err) {
-            throw err;
-          }
-          // currently, xml parsing at an early stage during
-          // process startup does not work reliably, so use
-          // libical parsing for now:
-          let icalRootComp = stringToIcal(this, str);
-          let prop = icalRootComp.getFirstProperty("X-NSCP-WCAP-SESSION-ID");
-          if (!prop) {
-            throw new Components.Exception("missing X-NSCP-WCAP-SESSION-ID in\n" + str);
-          }
-          sessionId = prop.value;
-          prop = icalRootComp.getFirstProperty("X-NSCP-RECURRENCE-BOUND");
-          if (prop) {
-            let val = parseInt(prop.value, 10);
-            if (!isNaN(val)) {
-              this.recurrenceBound = val;
-              log("X-NSCP-RECURRENCE-BOUND:" + this.recurrenceBound);
-            }
-          }
-          log("login succeeded: " + sessionId, this);
-        } catch (exc) {
-          err = exc;
-          if (checkErrorCode(err, calIWcapErrors.WCAP_LOGIN_FAILED)) {
-            log("error: " + errorToString(exc), this); // log login failure
-          } else if (getErrorModule(err) == NS_ERROR_MODULE_NETWORK) {
-            // server seems unavailable:
-            err = new Components.Exception(
-              getWcapString("accessingServerFailedError.text", [this.sessionUri.hostPort]),
-              exc
-            );
-          }
-        }
-        respFunc(err, sessionId);
-      },
-      this.sessionUri.spec +
-        "login.wcap?fmt-out=text%2Fcalendar&user=" +
-        encodeURIComponent(user) +
-        "&password=" +
-        encodeURIComponent(password),
-      false /* no logging */
-    );
-  },
-
-  logout: function(listener) {
-    let request = new calWcapRequest((oprequest, err) => {
-      if (err) {
-        logError(err, this);
-      } else {
-        log("logout succeeded.", this);
-      }
-      if (listener) {
-        listener.onResult(oprequest, null);
-      }
-    }, log("logout", this));
-
-    let url = null;
-    if (this.m_sessionId) {
-      log("attempting to log out...", this);
-      // although io service's offline flag is already
-      // set BEFORE notification
-      // (about to go offline, nsIOService.cpp).
-      // WTF.
-      url = this.sessionUri.spec + "logout.wcap?fmt-out=text%2Fxml&id=" + this.m_sessionId;
-      this.m_sessionId = null;
-      cal.getFreeBusyService().removeProvider(this);
-      cal.getCalendarSearchService().removeProvider(this);
-    }
-    this.m_credentials = null;
-
-    if (url) {
-      issueNetworkRequest(
-        request,
-        (err, str) => {
-          if (err) {
-            throw err;
-          }
-          stringToXml(this, str, -1 /* logout successful */);
-        },
-        url
-      );
-    } else {
-      request.execRespFunc();
-    }
-    return request;
-  },
-
-  checkServerVersion: function(request, respFunc) {
-    // currently, xml parsing at an early stage during process startup
-    // does not work reliably, so use libical:
-    issueNetworkRequest(
-      request,
-      (err, str) => {
-        try {
-          let icalRootComp;
-          if (!err) {
-            try {
-              icalRootComp = stringToIcal(this, str);
-            } catch (exc) {
-              err = exc;
-            }
-          }
-          if (err) {
-            if (checkErrorCode(err, calIErrors.OPERATION_CANCELLED)) {
-              throw err;
-            } else {
-              // soft error; request denied etc.
-              // map into localized message:
-              throw new Components.Exception(
-                getWcapString("accessingServerFailedError.text", [this.sessionUri.hostPort]),
-                calIWcapErrors.WCAP_LOGIN_FAILED
-              );
-            }
-          }
-          let prop = icalRootComp.getFirstProperty("X-NSCP-WCAPVERSION");
-          if (!prop) {
-            throw new Components.Exception("missing X-NSCP-WCAPVERSION!");
-          }
-          let wcapVersion = parseInt(prop.value, 10);
-          if (wcapVersion < 3) {
-            let strVers = prop.value;
-            let vars = [this.sessionUri.hostPort];
-            prop = icalRootComp.getFirstProperty("PRODID");
-            vars.push(prop ? prop.value : "<unknown>");
-            prop = icalRootComp.getFirstProperty("X-NSCP-SERVERVERSION");
-            vars.push(prop ? prop.value : "<unknown>");
-            vars.push(strVers);
-
-            let prompt = Services.ww.getNewPrompter(null);
-            let labelText = getWcapString("insufficientWcapVersionConfirmation.label");
-            if (
-              !prompt.confirm(
-                labelText,
-                getWcapString("insufficientWcapVersionConfirmation.text", vars)
-              )
-            ) {
-              throw new Components.Exception(labelText, calIWcapErrors.WCAP_LOGIN_FAILED);
-            }
-          }
-        } catch (exc) {
-          err = exc;
-        }
-        respFunc(err);
-      },
-      this.sessionUri.spec + "version.wcap?fmt-out=text%2Fcalendar"
-    );
-  },
-
-  setupSession: function(sessionId, request_, respFunc) {
-    let request = new calWcapRequest((oprequest, err) => {
-      log("setupSession_resp finished: " + errorToString(err), this);
-      respFunc(err);
-    }, log("setupSession", this));
-    if (request_) {
-      request_.attachSubRequest(request);
-    }
-
-    request.lockPending();
-    try {
-      this.issueNetworkRequest_(
-        request,
-        (err, data) => {
-          if (err) {
-            throw err;
-          }
-          this.credentials.userPrefs = data;
-          log("installed user prefs.", this);
-
-          // get calprops for all registered calendars:
-          let cals = this.getRegisteredCalendars(true);
-
-          let calprops_resp = null;
-          let defaultCal = this.defaultCalendar;
-          if (
-            defaultCal &&
-            cals[defaultCal.calId] && // default calendar is registered
-            getPref("calendar.wcap.subscriptions", true) &&
-            !defaultCal.getProperty("subscriptions_registered")
-          ) {
-            let hasSubscriptions = false;
-            // post register subscribed calendars:
-            let list = this.getUserPreferences("X-NSCP-WCAP-PREF-icsSubscribed");
-            for (let item of list) {
-              let itemparts = item.split(",");
-              // ',', '$' are not encoded. ',' can be handled here. WTF.
-              for (let part of itemparts) {
-                let dollar = part.indexOf("$");
-                if (dollar >= 0) {
-                  let calId = part.substring(0, dollar);
-                  if (calId != this.defaultCalId) {
-                    cals[calId] = null;
-                    hasSubscriptions = true;
-                  }
-                }
-              }
-            }
-
-            if (hasSubscriptions) {
-              calprops_resp = aCalendar => {
-                if (aCalendar.isDefaultCalendar) {
-                  // tweak name:
-                  aCalendar.setProperty("name", aCalendar.displayName);
-                } else {
-                  log("registering subscribed calendar: " + aCalendar.calId, this);
-                  cal.getCalendarManager().registerCalendar(aCalendar);
-                }
-              };
-              // do only once:
-              defaultCal.setProperty("subscriptions_registered", true);
-            }
-          }
-
-          if (!defaultCal.getProperty("user_id")) {
-            // nail once:
-            defaultCal.setProperty("user_id", this.credentials.userId);
-          }
-
-          if (getPref("calendar.wcap.no_get_calprops", false)) {
-            // hack around the get/search calprops mess:
-            this.installCalProps_search_calprops(calprops_resp, sessionId, cals, request);
-          } else {
-            this.installCalProps_get_calprops(calprops_resp, sessionId, cals, request);
-          }
-        },
-        stringToXml,
-        "get_userprefs",
-        "&fmt-out=text%2Fxml&userid=" + encodeURIComponent(this.credentials.userId),
-        sessionId
-      );
-      this.installServerTimeDiff(sessionId, request);
-      this.installServerTimezones(sessionId, request);
-    } finally {
-      request.unlockPending();
-    }
-  },
-
-  installCalProps_get_calprops: function(respFunc, sessionId, cals, request) {
-    let calprops_resp = (err, data) => {
-      if (err) {
-        throw err;
-      }
-      // string to xml converter func without WCAP errno check:
-      if (!data || data.length == 0) {
-        // assuming time-out
-        throw new Components.Exception(
-          errorToString(calIWcapErrors.WCAP_LOGIN_FAILED),
-          calIWcapErrors.WCAP_LOGIN_FAILED
-        );
-      }
-      let xml = getDomParser().parseFromString(data, "text/xml");
-      let nodeList = xml.getElementsByTagName("iCal");
-      for (let i = 0; i < nodeList.length; ++i) {
-        try {
-          let node = nodeList.item(i);
-          checkWcapXmlErrno(node);
-          let calid = filterXmlNodes("X-NSCP-CALPROPS-RELATIVE-CALID", node);
-          if (calid.length > 0) {
-            let calId = calid[0];
-            let calendar = cals[calId];
-            if (calendar === null) {
-              calendar = new calWcapCalendar(this);
-              let newPath = this.uri.pathQueryRef + "?calid=" + encodeURIComponent(calId);
-              calendar.uri = this.uri
-                .mutate()
-                .setPathQueryRef(newPath)
-                .finalize();
-            }
-            if (calendar) {
-              calendar.m_calProps = node;
-              if (respFunc) {
-                respFunc(calendar);
-              }
-            }
-          }
-        } catch (exc) {
-          // ignore but log any errors on subscribed calendars:
-          logError(exc, this);
-        }
-      }
-    };
-
-    let calidParam = "";
-    for (let calId in cals) {
-      if (calidParam.length > 0) {
-        calidParam += ";";
-      }
-      calidParam += encodeURIComponent(calId);
-    }
-    this.issueNetworkRequest_(
-      request,
-      calprops_resp,
-      null,
-      "get_calprops",
-      "&fmt-out=text%2Fxml&calid=" + calidParam,
-      sessionId
-    );
-  },
-
-  installCalProps_search_calprops: function(respFunc, sessionId, cals, request) {
-    let retrievedCals = {};
-    let issuedSearchRequests = {};
-    for (let calId in cals) {
-      if (!retrievedCals[calId]) {
-        let listener = {
-          onResult: function(oprequest, result) {
-            try {
-              if (!Components.isSuccessCode(oprequest.status)) {
-                throw oprequest.status;
-              }
-              if (result.length < 1) {
-                throw Cr.NS_ERROR_UNEXPECTED;
-              }
-              for (let calendar of result) {
-                // user may have dangling users referred in his subscription list, so
-                // retrieve each by each, don't break:
-                try {
-                  let thisCalId = calendar.calId;
-                  if (cals[thisCalId] !== undefined && !retrievedCals[thisCalId]) {
-                    retrievedCals[thisCalId] = calendar;
-                    if (respFunc) {
-                      respFunc(calendar);
-                    }
-                  }
-                } catch (exc) {
-                  // ignore but log any errors on subscribed calendars:
-                  logError(exc, this);
-                }
-              }
-            } catch (exc) {
-              // ignore but log any errors on subscribed calendars:
-              logError(exc, this);
-            }
-          },
-        };
-
-        let colon = calId.indexOf(":");
-        if (colon >= 0) {
-          // searching for secondary calendars doesn't work. WTF.
-          calId = calId.substring(0, colon);
-        }
-        if (!issuedSearchRequests[calId]) {
-          issuedSearchRequests[calId] = true;
-          this.searchForCalendars(calId, calICalendarSearchProvider.HINT_EXACT_MATCH, 20, listener);
-        }
-      }
-    }
-  },
-
-  installServerTimeDiff: function(sessionId, request) {
-    this.issueNetworkRequest_(
-      request,
-      (err, data) => {
-        if (err) {
-          throw err;
-        }
-        // xxx todo: think about
-        // assure that locally calculated server time is smaller
-        // than the current (real) server time:
-        let localTime = getTime();
-        let serverTime = getDatetimeFromIcalProp(data.getFirstProperty("X-NSCP-WCAPTIME"));
-        this.m_serverTimeDiff = serverTime.subtractDate(localTime);
-        log("server time diff is: " + this.m_serverTimeDiff, this);
-      },
-      stringToIcal,
-      "gettime",
-      "&fmt-out=text%2Fcalendar",
-      sessionId
-    );
-  },
-
-  installServerTimezones: function(sessionId, request) {
-    this.m_serverTimezones = {};
-    this.issueNetworkRequest_(
-      request,
-      (err, data) => {
-        if (err) {
-          throw err;
-        }
-        for (let subComp of cal.iterate.icalComponent(data, "VTIMEZONE")) {
-          try {
-            let tzid = subComp.getFirstProperty("TZID").value;
-            this.m_serverTimezones[tzid] = new calWcapTimezone(this, tzid, subComp);
-          } catch (exc) {
-            // ignore but errors:
-            logError(exc, this);
-          }
-        }
-        log("installed timezones.", this);
-      },
-      stringToIcal,
-      "get_all_timezones",
-      "&fmt-out=text%2Fcalendar",
-      sessionId
-    );
-  },
-
-  getCommandUrl: function(wcapCommand, params, sessionId) {
-    let url = this.sessionUri.spec;
-    url += wcapCommand + ".wcap?appid=mozilla-calendar&id=";
-    url += sessionId;
-    url += params;
-    return url;
-  },
-
-  issueNetworkRequest: function(request, respFunc, dataConvFunc, wcapCommand, params) {
-    let getSessionId_resp = (err, sessionId) => {
-      if (err) {
-        request.execSubRespFunc(respFunc, err);
-      } else {
-        // else have session uri and id:
-        this.issueNetworkRequest_(
-          request,
-          (loginerr, data) => {
-            // timeout?
-            if (checkErrorCode(loginerr, calIWcapErrors.WCAP_LOGIN_FAILED)) {
-              // try again:
-              this.getSessionId(
-                request,
-                getSessionId_resp,
-                sessionId /* (old) timed-out session */
-              );
-              return;
-            }
-            request.execSubRespFunc(respFunc, loginerr, data);
-          },
-          dataConvFunc,
-          wcapCommand,
-          params,
-          sessionId
-        );
-      }
-    };
-    this.getSessionId(request, getSessionId_resp);
-  },
-
-  issueNetworkRequest_: function(request, respFunc, dataConvFunc, wcapCommand, params, sessionId) {
-    let url = this.getCommandUrl(wcapCommand, params, sessionId);
-    issueNetworkRequest(
-      request,
-      (err, str) => {
-        let data;
-        if (!err) {
-          try {
-            if (dataConvFunc) {
-              data = dataConvFunc(this, str);
-            } else {
-              data = str;
-            }
-          } catch (exc) {
-            err = exc;
-          }
-        }
-        request.execSubRespFunc(respFunc, err, data);
-      },
-      url
-    );
-  },
-
-  m_credentials: null,
-  get credentials() {
-    if (!this.m_credentials) {
-      this.m_credentials = {};
-    }
-    return this.m_credentials;
-  },
-
-  // calIWcapSession:
-
-  m_contextId: null,
-  m_uri: null,
-  m_sessionUri: null,
-  get uri() {
-    return this.m_uri;
-  },
-  get sessionUri() {
-    return this.m_sessionUri;
-  },
-  set uri(thatUri) {
-    this.m_uri = thatUri;
-    this.m_sessionUri = thatUri
-      .mutate()
-      .setUserPass("")
-      .finalize();
-  },
-
-  get userId() {
-    return this.credentials.userId;
-  },
-
-  get defaultCalId() {
-    let list = this.getUserPreferences("X-NSCP-WCAP-PREF-icsCalendar");
-    let id = null;
-    for (let item of list) {
-      if (item.length > 0) {
-        id = item;
-        break;
-      }
-    }
-    return id ? id : this.credentials.userId;
-  },
-
-  get isLoggedIn() {
-    return this.m_sessionId != null;
-  },
-
-  defaultCalendar: null,
-
-  belongsTo: function(calendar) {
-    try {
-      // xxx todo hack to get the unwrapped wcap calendar instance:
-      calendar = calendar.getProperty("cache.uncachedCalendar").QueryInterface(calIWcapCalendar)
-        .wrappedJSObject;
-      if (calendar && calendar.session.m_contextId == this.m_contextId) {
-        return calendar;
-      }
-    } catch (exc) {
-      // Fall through to the return statement below in case the uncached
-      // calendar can't be retrieved.
-    }
-    return null;
-  },
-
-  getRegisteredCalendars: function(asAssocObj) {
-    let registeredCalendars = asAssocObj ? {} : [];
-    let cals = cal.getCalendarManager().getCalendars();
-    for (let calendar of cals) {
-      calendar = this.belongsTo(calendar);
-      if (calendar) {
-        if (asAssocObj) {
-          registeredCalendars[calendar.calId] = calendar;
-        } else {
-          registeredCalendars.push(calendar);
-        }
-      }
-    }
-    return registeredCalendars;
-  },
-
-  getUserPreferences: function(prefName) {
-    let prefs = filterXmlNodes(prefName, this.credentials.userPrefs);
-    return prefs;
-  },
-
-  get defaultAlarmStart() {
-    let alarmStart = null;
-    let alarmStartPref = this.getUserPreferences("X-NSCP-WCAP-PREF-ceDefaultAlarmStart");
-    if (alarmStartPref.length > 0 && alarmStartPref[0].length > 0) {
-      // workarounding cs duration bug, missing "T":
-      let dur = alarmStartPref[0].replace(/(^P)(\d+[HMS]$)/, "$1T$2");
-      alarmStart = cal.createDuration(dur);
-      alarmStart.isNegative = !alarmStart.isNegative;
-    }
-    return alarmStart;
-  },
-
-  getDefaultAlarmEmails: function(out_count) {
-    let ret = [];
-    let alarmEmails = this.getUserPreferences("X-NSCP-WCAP-PREF-ceDefaultAlarmEmail");
-    if (alarmEmails.length > 0 && alarmEmails[0].length > 0) {
-      for (let email of alarmEmails) {
-        ret = ret.concat(email.split(/[;,]/).map(mail => mail.trim()));
-      }
-    }
-    out_count.value = ret.length;
-    return ret;
-  },
-
-  // calICalendarSearchProvider:
-  searchForCalendars: function(searchString, hints, maxResults, listener) {
-    let request = new calWcapRequest((oprequest, err, data) => {
-      if (err && !checkErrorCode(err, calIErrors.OPERATION_CANCELLED)) {
-        this.notifyError(err);
-      }
-      if (listener) {
-        listener.onResult(oprequest, data);
-      }
-    }, log("searchForCalendars, searchString=" + searchString, this));
-
-    try {
-      let registeredCalendars = this.getRegisteredCalendars(true);
-
-      let params = "&fmt-out=text%2Fxml&search-string=" + encodeURIComponent(searchString);
-      if (maxResults > 0) {
-        params += "&maxResults=" + maxResults;
-      }
-      params +=
-        "&name=1&calid=1&primaryOwner=1&searchOpts=" +
-        (hints & calICalendarSearchProvider.HINT_EXACT_MATCH ? "3" : "0");
-
-      this.issueNetworkRequest(
-        request,
-        (err, data) => {
-          if (err) {
-            throw err;
-          }
-          // string to xml converter func without WCAP errno check:
-          if (!data || data.length == 0) {
-            // assuming time-out
-            throw new Components.Exception(
-              errorToString(calIWcapErrors.WCAP_LOGIN_FAILED),
-              calIWcapErrors.WCAP_LOGIN_FAILED
-            );
-          }
-          let xml = getDomParser().parseFromString(data, "text/xml");
-          let ret = [];
-          let nodeList = xml.getElementsByTagName("iCal");
-          for (let i = 0; i < nodeList.length; ++i) {
-            let node = nodeList.item(i);
-            try {
-              checkWcapXmlErrno(node);
-              let calIdNodes = filterXmlNodes("X-NSCP-CALPROPS-RELATIVE-CALID", node);
-              if (calIdNodes.length > 0) {
-                let calId = calIdNodes[0];
-                let calendar = registeredCalendars[calId];
-                if (calendar) {
-                  calendar.m_calProps = node; // update calprops
-                } else {
-                  calendar = new calWcapCalendar(this, node);
-                  let newPath = this.uri.pathQueryRef + "?calid=" + encodeURIComponent(calId);
-                  calendar.uri = this.uri
-                    .mutate()
-                    .setPathQueryRef(newPath)
-                    .finalize();
-                }
-                ret.push(calendar);
-              }
-            } catch (exc) {
-              switch (getResultCode(exc)) {
-                case calIWcapErrors.WCAP_NO_ERRNO: // workaround
-                case calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR:
-                  log("searchForCalendars_netResp() ignored error: " + errorToString(exc), this);
-                  break;
-                default:
-                  this.notifyError(exc);
-                  break;
-              }
-            }
-          }
-          log("search done. number of found calendars: " + ret.length, this);
-          request.execRespFunc(null, ret);
-        },
-        null,
-        "search_calprops",
-        params
-      );
-    } catch (exc) {
-      request.execRespFunc(exc);
-    }
-    return request;
-  },
-
-  // calIFreeBusyProvider:
-  getFreeBusyIntervals: function(calId, rangeStart, rangeEnd, busyTypes, listener) {
-    rangeStart = cal.dtz.ensureDateTime(rangeStart);
-    rangeEnd = cal.dtz.ensureDateTime(rangeEnd);
-    let zRangeStart = getIcalUTC(rangeStart);
-    let zRangeEnd = getIcalUTC(rangeEnd);
-
-    let request = new calWcapRequest((oprequest, err, data) => {
-      let rc = getResultCode(err);
-      switch (rc) {
-        case calIWcapErrors.WCAP_NO_ERRNO: // workaround
-        case calIWcapErrors.WCAP_ACCESS_DENIED_TO_CALENDAR:
-        case calIWcapErrors.WCAP_CALENDAR_DOES_NOT_EXIST:
-          log("getFreeBusyIntervals_resp() error: " + errorToString(err), this);
-          break;
-        default:
-          if (!Components.isSuccessCode(rc)) {
-            this.notifyError(err);
-          }
-          break;
-      }
-      if (listener) {
-        listener.onResult(oprequest, data);
-      }
-    }, log("getFreeBusyIntervals():\n\tcalId=" + calId + "\n\trangeStart=" + zRangeStart + ",\n\trangeEnd=" + zRangeEnd, this));
-
-    // cannot use stringToXml here, because cs 6.3 returns plain nothing
-    // on invalid user freebusy requests. WTF.
-    let stringToXml_ = function(session, data) {
-      if (!data || data.length == 0) {
-        // assuming invalid user
-        throw new Components.Exception(
-          errorToString(calIWcapErrors.WCAP_CALENDAR_DOES_NOT_EXIST),
-          calIWcapErrors.WCAP_CALENDAR_DOES_NOT_EXIST
-        );
-      }
-      return stringToXml(session, data);
-    };
-
-    try {
-      let params = "&calid=" + encodeURIComponent(calId);
-      params += "&busyonly=" + (busyTypes & calIFreeBusyInterval.FREE ? "0" : "1");
-      params += "&dtstart=" + zRangeStart;
-      params += "&dtend=" + zRangeEnd;
-      params += "&fmt-out=text%2Fxml";
-
-      this.issueNetworkRequest(
-        request,
-        (err, xml) => {
-          if (err) {
-            throw err;
-          }
-          if (LOG_LEVEL > 0) {
-            log("getFreeBusyIntervals net_resp(): " + getWcapRequestStatusString(xml), this);
-          }
-          if (listener) {
-            let ret = [];
-            let nodeList = xml.getElementsByTagName("FB");
-
-            let fbTypeMap = {};
-            fbTypeMap.FREE = calIFreeBusyInterval.FREE;
-            fbTypeMap.BUSY = calIFreeBusyInterval.BUSY;
-            fbTypeMap["BUSY-UNAVAILABLE"] = calIFreeBusyInterval.BUSY_UNAVAILABLE;
-            fbTypeMap["BUSY-TENTATIVE"] = calIFreeBusyInterval.BUSY_TENTATIVE;
-
-            for (let i = 0; i < nodeList.length; ++i) {
-              let node = nodeList.item(i);
-              let fbType = fbTypeMap[node.attributes.getNamedItem("FBTYPE").nodeValue];
-              if (!fbType || fbType & busyTypes) {
-                if (!fbType) {
-                  fbType = calIFreeBusyInterval.UNKNOWN;
-                }
-                let str = node.textContent;
-                let slash = str.indexOf("/");
-                let start = getDatetimeFromIcalString(str.substr(0, slash));
-                let end = getDatetimeFromIcalString(str.substr(slash + 1));
-
-                ret.push(new cal.provider.FreeBusyInterval(calId, fbType, start, end));
-              }
-            }
-            request.execRespFunc(null, ret);
-          }
-        },
-        stringToXml_,
-        "get_freebusy",
-        params
-      );
-    } catch (exc) {
-      request.execRespFunc(exc);
-    }
-    return request;
-  },
-
-  // nsIObserver:
-  observe: function(subject, topic, data) {
-    log("observing: " + topic + ", data: " + data, this);
-    if (topic == "quit-application") {
-      g_bShutdown = true;
-      this.logout(null);
-      // xxx todo: valid upon notification?
-      cal.getCalendarManager().removeObserver(this);
-      Services.obs.removeObserver(this, "quit-application");
-    }
-  },
-
-  // calICalendarManagerObserver:
-
-  // called after the calendar is registered
-  onCalendarRegistered: function(aCalendar) {
-    function assureDefault(pref, val) {
-      if (aCalendar.getProperty(pref) === null) {
-        aCalendar.setProperty(pref, val);
-      }
-    }
-
-    try {
-      // make sure the calendar belongs to this session:
-      if (this.belongsTo(aCalendar)) {
-        assureDefault("shared_context", this.m_contextId);
-        assureDefault("name", aCalendar.name);
-
-        const s_colors = [
-          "#FFCCCC",
-          "#FFCC99",
-          "#FFFF99",
-          "#FFFFCC",
-          "#99FF99",
-          "#99FFFF",
-          "#CCFFFF",
-          "#CCCCFF",
-          "#FFCCFF",
-          "#FF6666",
-          "#FF9966",
-          "#FFFF66",
-          "#FFFF33",
-          "#66FF99",
-          "#33FFFF",
-          "#66FFFF",
-          "#9999FF",
-          "#FF99FF",
-          "#FF0000",
-          "#FF9900",
-          "#FFCC66",
-          "#FFFF00",
-          "#33FF33",
-          "#66CCCC",
-          "#33CCFF",
-          "#6666CC",
-          "#CC66CC",
-          "#CC0000",
-          "#FF6600",
-          "#FFCC33",
-          "#FFCC00",
-          "#33CC00",
-          "#00CCCC",
-          "#3366FF",
-          "#6633FF",
-          "#CC33CC",
-          "#990000",
-          "#CC6600",
-          "#CC9933",
-          "#999900",
-          "#009900",
-          "#339999",
-          "#3333FF",
-          "#6600CC",
-          "#993399",
-          "#660000",
-          "#993300",
-          "#996633",
-          "#666600",
-          "#006600",
-          "#336666",
-          "#000099",
-          "#333399",
-          "#663366",
-          "#330000",
-          "#663300",
-          "#663333",
-          "#333300",
-          "#003300",
-          "#003333",
-          "#000066",
-          "#330099",
-          "#330033",
-        ];
-        assureDefault("color", s_colors[new Date().getUTCMilliseconds() % s_colors.length]);
-      }
-    } catch (exc) {
-      // never break the listener chain
-      this.notifyError(exc);
-    }
-  },
-
-  // called before the unregister actually takes place
-  onCalendarUnregistering: function(aCalendar) {
-    try {
-      // make sure the calendar belongs to this session and is the default calendar,
-      // then remove all subscribed calendars:
-      aCalendar = this.belongsTo(aCalendar);
-      if (aCalendar && aCalendar.isDefaultCalendar) {
-        cal.getFreeBusyService().removeProvider(this);
-        cal.getCalendarSearchService().removeProvider(this);
-        let registeredCalendars = this.getRegisteredCalendars();
-        for (let regCal of registeredCalendars) {
-          try {
-            if (!regCal.isDefaultCalendar) {
-              cal.getCalendarManager().unregisterCalendar(regCal);
-            }
-          } catch (exc) {
-            this.notifyError(exc);
-          }
-        }
-      }
-    } catch (exc) {
-      // never break the listener chain
-      this.notifyError(exc);
-    }
-  },
-
-  // called before the delete actually takes place
-  onCalendarDeleting: function(aCalendar) {},
-};
-
-function confirmInsecureLogin(uri) {
-  if (!confirmInsecureLogin.m_confirmedHttpLogins) {
-    confirmInsecureLogin.m_confirmedHttpLogins = {};
-    let confirmedHttpLogins = getPref("calendar.wcap.confirmed_http_logins", "");
-    let tuples = confirmedHttpLogins.split(",");
-    for (let tuple of tuples) {
-      let part = tuple.split(":");
-      confirmInsecureLogin.m_confirmedHttpLogins[part[0]] = part[1];
-    }
-  }
-
-  let bConfirmed = false;
-
-  let host = uri.hostPort;
-  let encodedHost = encodeURIComponent(host);
-  let confirmedEntry = confirmInsecureLogin.m_confirmedHttpLogins[encodedHost];
-  if (confirmedEntry) {
-    bConfirmed = confirmedEntry == "1";
-  } else {
-    let prompt = Services.ww.getNewPrompter(null);
-    let out_dontAskAgain = { value: false };
-    bConfirmed = prompt.confirmCheck(
-      getWcapString("noHttpsConfirmation.label"),
-      getWcapString("noHttpsConfirmation.text", [host]),
-      getWcapString("noHttpsConfirmation.check.text"),
-      out_dontAskAgain
-    );
-
-    if (out_dontAskAgain.value) {
-      // save decision for all running calendars and
-      // all future confirmations:
-      let newConfirmedLogins = getPref("calendar.wcap.confirmed_http_logins", "");
-      if (newConfirmedLogins.length > 0) {
-        newConfirmedLogins += ",";
-      }
-      confirmedEntry = bConfirmed ? "1" : "0";
-      newConfirmedLogins += encodedHost + ":" + confirmedEntry;
-      Services.prefs.setStringPref("calendar.wcap.confirmed_http_logins", newConfirmedLogins);
-      getPref("calendar.wcap.confirmed_http_logins"); // log written entry
-      confirmInsecureLogin.m_confirmedHttpLogins[encodedHost] = confirmedEntry;
-    }
-  }
-
-  log("returned: " + bConfirmed, "confirmInsecureLogin(" + host + ")");
-  return bConfirmed;
-}
deleted file mode 100644
--- a/calendar/providers/wcap/calWcapUtils.js
+++ /dev/null
@@ -1,242 +0,0 @@
-/* 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 getCalendarSearchService, getDomParser, isParent, filterXmlNodes,
- *          getIcalUTC, getDatetimeFromIcalProp, getWcapString
- */
-
-/* import-globals-from calWcapCalendarModule.js */
-
-var { Preferences } = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
-
-var g_bShutdown = false;
-
-function initLogging() {
-  initLogging.mLogTimezone = cal.dtz.defaultTimezone;
-  if (initLogging.mLogFilestream) {
-    try {
-      initLogging.mLogFilestream.close();
-    } catch (exc) {
-      cal.ASSERT(false, exc);
-    }
-    initLogging.mLogFilestream = null;
-  }
-
-  LOG_LEVEL = getPref("calendar.wcap.log_level", 0);
-  if (LOG_LEVEL < 1 && getPref("calendar.debug.log", false)) {
-    LOG_LEVEL = 1; // at least basic logging when calendar.debug.log is set
-  }
-
-  if (LOG_LEVEL > 0) {
-    let logFileName = getPref("calendar.wcap.log_file", null);
-    if (logFileName) {
-      try {
-        // set up file:
-        let logFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
-        logFile.initWithPath(logFileName);
-        // create output stream:
-        let logFileStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(
-          Ci.nsIFileOutputStream
-        );
-        logFileStream.init(
-          logFile,
-          0x02 /* PR_WRONLY */ |
-          0x08 /* PR_CREATE_FILE */ |
-            (getPref("calendar.wcap.log_file_append", false)
-              ? 0x10 /* PR_APPEND */
-              : 0x20) /* PR_TRUNCATE */,
-          parseInt("0700", 8) /* read, write, execute/search by owner */,
-          0 /* unused */
-        );
-        initLogging.mLogFilestream = logFileStream;
-      } catch (exc) {
-        logError(exc, "init logging");
-      }
-    }
-    log(
-      "################################# NEW WCAP LOG #################################",
-      "init logging"
-    );
-    logWarning(
-      "WCAP logging enabled! level=" +
-        LOG_LEVEL +
-        (initLogging.mLogFilestream ? ", file=" + logFileName : "")
-    );
-  }
-  if (!initLogging.mLogPrefObserver) {
-    initLogging.mLogPrefObserver = {
-      // nsIObserver:
-      observe: function(subject, topic, data) {
-        if (topic == "nsPref:changed") {
-          switch (data) {
-            case "calendar.wcap.log_level":
-            case "calendar.wcap.log_file":
-            case "calendar.debug.log":
-              initLogging();
-              break;
-          }
-        }
-      },
-    };
-    Services.prefs.addObserver("calendar.wcap.log_level", initLogging.mLogPrefObserver);
-    Services.prefs.addObserver("calendar.wcap.log_file", initLogging.mLogPrefObserver);
-    Services.prefs.addObserver("calendar.debug.log", initLogging.mLogPrefObserver);
-
-    let appObserver = {
-      // nsIObserver:
-      observe: function(subject, topic, data) {
-        if (topic == "quit-application") {
-          Services.prefs.removeObserver("calendar.", initLogging.mLogPrefObserver);
-        }
-      },
-    };
-    Services.obs.addObserver(appObserver, "quit-application");
-  }
-}
-
-function log(msg, context, bForce) {
-  if (bForce || LOG_LEVEL > 0) {
-    let ret = "";
-    if (context) {
-      ret += "[" + context + "]";
-    }
-    if (ret.length > 0) {
-      ret += "\n";
-    }
-    ret += msg;
-    let now = getTime();
-    if (now && initLogging.mLogTimezone) {
-      now = now.getInTimezone(initLogging.mLogTimezone);
-    }
-    let str = "### WCAP log entry: " + now + "\n" + ret;
-    Services.console.logStringMessage(str);
-    str = "\n" + str + "\n";
-    dump(str);
-    if (initLogging.mLogFilestream) {
-      try {
-        // xxx todo?
-        // assuming ANSI chars here, for logging sufficient:
-        initLogging.mLogFilestream.write(str, str.length);
-      } catch (exc) {
-        // catching any io errors here:
-        let err = "error writing log file: " + errorToString(exc);
-        Cu.reportError(exc);
-        Services.console.logStringMessage(err);
-        dump(err + "\n\n");
-      }
-    }
-    return ret;
-  } else {
-    return msg;
-  }
-}
-
-function logWarning(err, context) {
-  let msg = errorToString(err);
-  let scriptError = Cc["@mozilla.org/scripterror;1"].createInstance(Ci.nsIScriptError);
-  scriptError.init(
-    log("warning: " + msg, context, true),
-    null,
-    null,
-    0,
-    0,
-    Ci.nsIScriptError.warningFlag,
-    "component javascript"
-  );
-  Services.console.logMessage(scriptError);
-  return msg;
-}
-
-function logError(err, context) {
-  let msg = errorToString(err);
-  Cu.reportError(log("error: " + msg + "\nstack:\n" + cal.STACK(10), context, true));
-  return msg;
-}
-
-// late-inited service accessors:
-
-function getCalendarSearchService() {
-  if (!getCalendarSearchService.m_obj) {
-    getCalendarSearchService.m_obj = Cc[
-      "@mozilla.org/calendar/calendarsearch-service;1"
-    ].getService(Ci.calICalendarSearchService);
-  }
-  return getCalendarSearchService.m_obj;
-}
-
-function getDomParser() {
-  if (!getDomParser.m_obj) {
-    getDomParser.m_obj = new DOMParser();
-  }
-  return getDomParser.m_obj;
-}
-
-function isParent(item) {
-  if (item.id != item.parentItem.id) {
-    throw new Components.Exception("proxy has different id than its parent!");
-  }
-  return !item.recurrenceId;
-}
-
-function filterXmlNodes(name, rootNode) {
-  let ret = [];
-  if (rootNode) {
-    let nodeList = rootNode.getElementsByTagName(name);
-    for (let i = 0; i < nodeList.length; ++i) {
-      let node = nodeList.item(i);
-      ret.push(node.textContent.trim());
-    }
-  }
-  return ret;
-}
-
-function getTime() {
-  if (g_bShutdown) {
-    return null;
-  }
-  return cal.dtz.jsDateToDateTime(new Date());
-}
-
-function getIcalUTC(date) {
-  if (!date || !date.isValid) {
-    return "0";
-  } else {
-    let dtz = date.timezone;
-    if (dtz.isUTC || dtz.isFloating) {
-      return date.icalString;
-    } else {
-      return date.getInTimezone(cal.dtz.UTC).icalString;
-    }
-  }
-}
-
-function getDatetimeFromIcalString(val) {
-  if (!val || val.length == 0 || val == "0") {
-    return null;
-  }
-  // assuming timezone is known:
-  let date = cal.createDateTime();
-  date.icalString = val;
-  return date;
-}
-
-function getDatetimeFromIcalProp(prop) {
-  if (!prop) {
-    return null;
-  }
-  return getDatetimeFromIcalString(prop.valueAsIcalString);
-}
-
-function getPref(prefName, defaultValue) {
-  let ret = Preferences.get(prefName, defaultValue);
-  log(ret, "getPref(): prefName=" + prefName);
-  return ret;
-}
-
-function getWcapString(aStringName, aParams) {
-  return cal.l10n.getString("wcap", aStringName, aParams);
-}
deleted file mode 100644
--- a/calendar/providers/wcap/moz.build
+++ /dev/null
@@ -1,23 +0,0 @@
-# vim: set filetype=python:
-# 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/.
-
-DIRS += ['public']
-
-EXTRA_COMPONENTS += [
-    'calWcapCalendarModule.js',
-    'calWcapCalendarModule.manifest',
-]
-
-FINAL_TARGET_FILES['calendar-js'] += [
-    'calWcapCalendar.js',
-    'calWcapCalendarItems.js',
-    'calWcapErrors.js',
-    'calWcapRequest.js',
-    'calWcapSession.js',
-    'calWcapUtils.js',
-]
-
-with Files('**'):
-    BUG_COMPONENT = ('Calendar', 'Provider: WCAP')
deleted file mode 100644
--- a/calendar/providers/wcap/public/calIWcapCalendar.idl
+++ /dev/null
@@ -1,281 +0,0 @@
-/* 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/. */
-
-#include "calICalendar.idl"
-interface calIDateTime;
-interface calIWcapSession;
-
-/** Adds WCAP specific capabilities to calICalendar.
- */
-[scriptable, uuid(21A189DF-6C92-41f6-9E2B-1929EF25CAEE)]
-interface calIWcapCalendar : calICalendar
-{
-    /**
-     * User session this calendar instance belongs to.
-     */
-    readonly attribute calIWcapSession session;
-
-    /**
-     * Current calId the calendar instance acts on; defaults to userId.
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    readonly attribute string calId;
-
-    /**
-     * UserId of primary owner of this calendar instance.
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    readonly attribute string ownerId;
-
-    /**
-     * Determines whether this calendar instance is the user's default calendar.
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    readonly attribute boolean isDefaultCalendar;
-
-    /**
-     * Whether the currently selected calendar belongs to user.
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    readonly attribute boolean isOwnedCalendar;
-
-    /**
-     * Calendar description.
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    readonly attribute string description;
-
-    /**
-     * Calendar display name.
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    readonly attribute string displayName;
-
-    /**
-     * Gets this calendar's (calId) default timezone.
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    readonly attribute string defaultTimezone;
-
-    /**
-     * Gets calendar properties.
-     *
-     * @param propName property name (e.g. X-S1CS-CALPROPS-COMMON-NAME)
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    Array<AString> getCalendarProperties(in string propName);
-
-    /* xxx todo: additional filters sensible for calICalendar, too?
-                 claiming bits 24-30 for now.
-
-                 Those bits are somehow handled special now:
-                 If at least one of the below is set, then
-                 that filter bit(s) are active.
-                 If none of the below is set, then those compstate
-                 filters are not taken into account at all.
-                 So there is no need to OR all of the below together
-                 (ITEM_FILTER_ALL_ITEMS does not cover these bits) if you
-                 don't care about the REQUEST/REPLY states.
-
-       xxx todo: ITEM_FILTER_CLASS_OCCURRENCES is not filter, rename?
-    */
-
-    /* xxx todo: limit to currently needed ones: NEEDS-ACTION */
-
-//     /**
-//      * Scope: getItems only
-//      * Whether getItems should only return items that have alarms set for the
-//      * specified range.
-//      */
-//     const unsigned long ITEM_FILTER_BY_ALARM_RANGE = 1 << 23;
-
-//     /**
-//      * Scope: Attendee
-//      * The event or todo is an invitation from another
-//      * user and the current user has declined the invitation.
-//      */
-//     const unsigned long ITEM_FILTER_REPLY_DECLINED = 1 << 24;
-
-//     /**
-//      * Scope: Attendee
-//      * The event or todo is an invitation from another
-//      * user and the current user has accepted the invitation.
-//      */
-//     const unsigned long ITEM_FILTER_REPLY_ACCEPTED = 1 << 25;
-
-//     /**
-//      * Scope: Organizer
-//      * The event or todo is an invitation from the current
-//      * user to other invitees, and all invitees have replied.
-//      */
-//     const unsigned long ITEM_FILTER_REQUEST_COMPLETED = 1 << 26;
-
-//     /**
-//      * Scope: Attendee
-//      * The event or todo is an invitation from another
-//      * user and the current user has not replied to it yet.
-//      */
-//     const unsigned long ITEM_FILTER_REQUEST_NEEDS_ACTION = 1 << 27;
-
-//     /**
-//      * Scope: Attendee
-//      * The event or todo is an invitation from another
-//      * user and the current user is not required to reply.
-//      */
-//     const unsigned long ITEM_FILTER_REQUEST_NEEDSNOACTION  = 1 << 28;
-
-//     /**
-//      * Scope: Organizer
-//      * The event or todo is an invitation from the current
-//      * user to other invitees, and is currently in the
-//      * process of sending out invitations.
-//      */
-//     const unsigned long ITEM_FILTER_REQUEST_PENDING = 1 << 29;
-
-//     /**
-//      * Scope: Organizer
-//      * The event or todo is an invitation from the current
-//      * user to other invitees, and is currently awaiting.
-//      */
-//     const unsigned long ITEM_FILTER_REQUEST_WAITFORREPLY = 1 << 30;
-
-    /* xxx todo:
-       separate out into another interface and leave only an attribute
-
-       readonly attribute calIWcapAccessControl accessControl;
-
-       here?
-       This would bloat client code somehow like
-
-       if (cal.accessControl &&
-           cal.accessControl.check(calIAccessControl.AC_COMP_WRITE))
-           cal.deleteItem(item, listener);
-
-       but makes it easier for provider implementors not implementing the
-       whole stuff...
-
-       Right now, the below are similar to *nix fs rights, i.e. "write" includes
-       "add", "delete" and "modify".
-       Does it make sense to separate "add" and "delete" out of "write"?
-    */
-
-    /**
-     * Whether it is allowed or denied to get availability information
-     * (i.e. free-busy times).
-     */
-    const unsigned long AC_FREEBUSY = 1 << 0;
-
-    /**
-     * Whether it is allowed or denied to invite a calendar's
-     * owner placing an invitation into the calendar.
-     */
-    const unsigned long AC_SCHEDULE = 1 << 1;
-
-    /**
-     * Whether it is allowed or denied to read components.
-     */
-    const unsigned long AC_COMP_READ = 1 << 2;
-
-    /**
-     * Whether it is allowed or denied to add, modify or delete components.
-     */
-    const unsigned long AC_COMP_WRITE = 1 << 3;
-
-    /**
-     * Whether it is allowed or denied to read properties.
-     */
-    const unsigned long AC_PROP_READ = 1 << 4;
-
-    /**
-     * Whether it is allowed or denied to add, modify or delete properties.
-     */
-    const unsigned long AC_PROP_WRITE = 1 << 5;
-
-    /**
-     * Full access, includes all of the above.
-     */
-    const unsigned long AC_FULL = (AC_FREEBUSY    |
-                                   AC_SCHEDULE    |
-                                   AC_COMP_READ   |
-                                   AC_COMP_WRITE  |
-                                   AC_PROP_READ   |
-                                   AC_PROP_WRITE);
-
-    /**
-     * Checks whether the currently logged in user can perform the specified
-     * actions. Clients should check these bits before performing operations
-     * on a calendar instance, e.g.
-     *
-     * if (cal.checkAccess(calIWcapCalendar.AC_COMP_WRITE))
-     *     cal.deleteItem(item, listener);
-     *
-     * or
-     *
-     * if (cal.checkAccess(calIWcapCalendar.AC_PROP_WRITE))
-     *     cal.name = newName;
-     *
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     * @param accessControlBits access control bits (above AC_ definitions)
-     * @return true if access is granted, false otherwise
-     */
-    boolean checkAccess(in unsigned long accessControlBits);
-
-//     /**
-//      * Defines granted and denied permissions for a specific user or
-//      * user domain. Specific user entries precede over domain entries.
-//      *
-//      * Examples:
-//      * a) Allow all users availability and read access,
-//      *    but jdoe only availability access:
-//      *    defineAccessControl("@", AC_FREEBUSY | AC_COMP_READ);
-//      *    defineAccessControl("jdoe", AC_FREEBUSY);
-//      *
-//      * b) Restrict jdoe to have no access:
-//      *    defineAccessControl("jdoe", 0);
-//      *
-//      * Follow-up definition calls for the same user will overwrite previous
-//      * definitions.
-//      *
-//      * @param userId user that is affected by the access control bits
-//      *               WCAP specific:
-//      *                    - @ stands in for everybody
-//      *                    xxx todo: change the above
-//      * @param accessControlBits access control bits (above AC_ definitions)
-//      * @param listener called when access control bits have been updated
-//      * @return optional object to track operation
-//      */
-//     calIOperation defineAccessControl(
-//         in string userId, in unsigned long accessControlBits,
-//         in calIGenericOperationListener listener);
-
-//     /**
-//      * To reset a user's access control definition to the default ones
-//      * that everybody is granted.
-//      * In case the user has no specific access control definition,
-//      * Cr.NS_ERROR_INVALID_ARG is thrown.
-//      *
-//      * @param userId user id
-//      * @param listener called when access control bits have been updated
-//      * @return optional object to track operation
-//      */
-//     calIOperation resetAccessControl(
-//         in string userId,
-//         in calIGenericOperationListener listener);
-
-//     /**
-//      * Gets the set of access control definitions (including "everybody").
-//      * Both out arrays have the same length.
-//      *
-//      * @param count length of returned arrays
-//      * @param users users ids
-//      * @param accessControlBits access control bits
-//      * @param listener called with xxx todo
-//      * @return optional object to track operation
-//      */
-//     calIOperation getAccessControlDefinitions(
-//         out unsigned long count,
-//         [array, size_is(count)] out string users,
-//         [array, size_is(count)] out unsigned long accessControlBits );
-};
-
deleted file mode 100644
--- a/calendar/providers/wcap/public/calIWcapErrors.idl
+++ /dev/null
@@ -1,204 +0,0 @@
-/* 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/. */
-
-#include "calIErrors.idl"
-
-/** WCAP error codes.
- */
-[scriptable, uuid(2ADC008C-A7A6-4f9a-91C8-A99742B68F3D)]
-interface calIWcapErrors : calIErrors
-{
-    const unsigned long WCAP_NO_ERRNO = WCAP_ERROR_BASE + 0;
-
-    /* errno: */
-    /*  1 */ const unsigned long WCAP_LOGIN_FAILED =
-                 WCAP_ERROR_BASE + 1;
-    /*  2 */ const unsigned long WCAP_LOGIN_OK_DEFAULT_CALENDAR_NOT_FOUND =
-                 WCAP_ERROR_BASE + 2;
-    /*  6 */ const unsigned long WCAP_DELETE_EVENTS_BY_ID_FAILED =
-                 WCAP_ERROR_BASE + 6;
-    /*  8 */ const unsigned long WCAP_SETCALPROPS_FAILED =
-                 WCAP_ERROR_BASE + 8;
-    /*  9 */ const unsigned long WCAP_FETCH_EVENTS_BY_ID_FAILED =
-                 WCAP_ERROR_BASE + 9;
-    /* 10 */ const unsigned long WCAP_CREATECALENDAR_FAILED =
-                 WCAP_ERROR_BASE + 10;
-    /* 11 */ const unsigned long WCAP_DELETECALENDAR_FAILED =
-                 WCAP_ERROR_BASE + 11;
-    /* 12 */ const unsigned long WCAP_ADDLINK_FAILED =
-                 WCAP_ERROR_BASE + 12;
-    /* 13 */ const unsigned long WCAP_FETCHBYDATERANGE_FAILED =
-                 WCAP_ERROR_BASE + 13;
-    /* 14 */ const unsigned long WCAP_STOREEVENTS_FAILED =
-                 WCAP_ERROR_BASE + 14;
-    /* 15 */ const unsigned long WCAP_STORETODOS_FAILED =
-                 WCAP_ERROR_BASE + 15;
-    /* 16 */ const unsigned long WCAP_DELETE_TODOS_BY_ID_FAILED =
-                 WCAP_ERROR_BASE + 16;
-    /* 17 */ const unsigned long WCAP_FETCH_TODOS_BY_ID_FAILED =
-                 WCAP_ERROR_BASE + 17;
-    /* 18 */ const unsigned long WCAP_FETCHCOMPONENTS_FAILED_BAD_TZID =
-                 WCAP_ERROR_BASE + 18;
-    /* 19 */ const unsigned long WCAP_SEARCH_CALPROPS_FAILED =
-                 WCAP_ERROR_BASE + 19;
-    /* 20 */ const unsigned long WCAP_GET_CALPROPS_FAILED =
-                 WCAP_ERROR_BASE + 20;
-    /* 21 */ const unsigned long WCAP_DELETECOMPONENTS_BY_RANGE_FAILED =
-                 WCAP_ERROR_BASE + 21;
-    /* 22 */ const unsigned long WCAP_DELETEEVENTS_BY_RANGE_FAILED =
-                 WCAP_ERROR_BASE + 22;
-    /* 23 */ const unsigned long WCAP_DELETETODOS_BY_RANGE_FAILED =
-                 WCAP_ERROR_BASE + 23;
-    /* 24 */ const unsigned long WCAP_GET_ALL_TIMEZONES_FAILED =
-                 WCAP_ERROR_BASE + 24;
-    /* 25 */ const unsigned long WCAP_CREATECALENDAR_ALREADY_EXISTS_FAILED =
-                 WCAP_ERROR_BASE + 25;
-    /* 26 */ const unsigned long WCAP_SET_USERPREFS_FAILED =
-                 WCAP_ERROR_BASE + 26;
-    /* 27 */ const unsigned long WCAP_CHANGE_PASSWORD_FAILED =
-                 WCAP_ERROR_BASE + 27;
-    /* 28 */ const unsigned long WCAP_ACCESS_DENIED_TO_CALENDAR =
-                 WCAP_ERROR_BASE + 28;
-    /* 29 */ const unsigned long WCAP_CALENDAR_DOES_NOT_EXIST =
-                 WCAP_ERROR_BASE + 29;
-    /* 30 */ const unsigned long WCAP_ILLEGAL_CALID_NAME =
-                 WCAP_ERROR_BASE + 30;
-    /* 31 */ const unsigned long WCAP_CANNOT_MODIFY_LINKED_EVENTS =
-                 WCAP_ERROR_BASE + 31;
-    /* 32 */ const unsigned long WCAP_CANNOT_MODIFY_LINKED_TODOS =
-                 WCAP_ERROR_BASE + 32;
-    /* 33 */ const unsigned long WCAP_CANNOT_SENT_EMAIL =
-                 WCAP_ERROR_BASE + 33;
-    /* 34 */ const unsigned long WCAP_CALENDAR_DISABLED =
-                 WCAP_ERROR_BASE + 34;
-    /* 35 */ const unsigned long WCAP_WRITE_IMPORT_FAILED =
-                 WCAP_ERROR_BASE + 35;
-    /* 36 */ const unsigned long WCAP_FETCH_BY_LAST_MODIFIED_FAILED =
-                 WCAP_ERROR_BASE + 36;
-    /* 37 */ const unsigned long WCAP_CAPI_NOT_SUPPORTED =
-                 WCAP_ERROR_BASE + 37;
-    /* 38 */ const unsigned long WCAP_CALID_NOT_SPECIFIED =
-                 WCAP_ERROR_BASE + 38;
-    /* 39 */ const unsigned long WCAP_GET_FREEBUSY_FAILED =
-                 WCAP_ERROR_BASE + 39;
-    /* 40 */ const unsigned long WCAP_STORE_FAILED_DOUBLE_BOOKED =
-                 WCAP_ERROR_BASE + 40;
-    /* 41 */ const unsigned long WCAP_FETCH_BY_ALARM_RANGE_FAILED =
-                 WCAP_ERROR_BASE + 41;
-    /* 42 */ const unsigned long WCAP_FETCH_BY_ATTENDEE_ERROR_FAILED =
-                 WCAP_ERROR_BASE + 42;
-    /* 43 */ const unsigned long WCAP_ATTENDEE_GROUP_EXPANSION_CLIPPED =
-                 WCAP_ERROR_BASE + 43;
-    /* 44 */ const unsigned long WCAP_USERPREFS_ACCESS_DENIED =
-                 WCAP_ERROR_BASE + 44;
-    /* 45 */ const unsigned long WCAP_NOT_ALLOWED_TO_REQUEST_PUBLISH =
-                 WCAP_ERROR_BASE + 45;
-    /* 46 */ const unsigned long WCAP_INSUFFICIENT_PARAMETERS =
-                 WCAP_ERROR_BASE + 46;
-    /* 47 */ const unsigned long WCAP_MUSTBEOWNER_OPERATION =
-                 WCAP_ERROR_BASE + 47;
-    /* 48 */ const unsigned long WCAP_DWP_CONNECTION_FAILED =
-                 WCAP_ERROR_BASE + 48;
-    /* 49 */ const unsigned long WCAP_DWP_MAX_CONNECTION_REACHED =
-                 WCAP_ERROR_BASE + 49;
-    /* 50 */ const unsigned long WCAP_DWP_CANNOT_RESOLVE_CALENDAR =
-                 WCAP_ERROR_BASE + 50;
-    /* 51 */ const unsigned long WCAP_DWP_BAD_DATA =
-                 WCAP_ERROR_BASE + 51;
-    /* 52 */ const unsigned long WCAP_BAD_COMMAND =
-                 WCAP_ERROR_BASE + 52;
-    /* 53 */ const unsigned long WCAP_NOT_FOUND =
-                 WCAP_ERROR_BASE + 53;
-    /* 54 */ const unsigned long WCAP_WRITE_IMPORT_CANT_EXPAND_CALID =
-                 WCAP_ERROR_BASE + 54;
-    /* 55 */ const unsigned long WCAP_GETTIME_FAILED =
-                 WCAP_ERROR_BASE + 55;
-    /* 56 */ const unsigned long WCAP_FETCH_DELETEDCOMPONENTS_FAILED =
-                 WCAP_ERROR_BASE + 56;
-    /* 57 */ const unsigned long WCAP_FETCH_DELETEDCOMPONENTS_PARTIAL_RESULT =
-                 WCAP_ERROR_BASE + 57;
-    /* 58 */ const unsigned long WCAP_WCAP_NO_SUCH_FORMAT =
-                 WCAP_ERROR_BASE + 58;
-    /* 59 */ const unsigned long WCAP_COMPONENT_NOT_FOUND =
-                 WCAP_ERROR_BASE + 59;
-    /* 60 */ const unsigned long WCAP_BAD_ARGUMENTS =
-                 WCAP_ERROR_BASE + 60;
-    /* 61 */ const unsigned long WCAP_GET_USERPREFS_FAILED =
-                 WCAP_ERROR_BASE + 61;
-    /* 62 */ const unsigned long WCAP_WCAP_MODIFY_NO_EVENT =
-                 WCAP_ERROR_BASE + 62;
-    /* 63 */ const unsigned long WCAP_WCAP_CREATE_EXISTS =
-                 WCAP_ERROR_BASE + 63;
-    /* 64 */ const unsigned long WCAP_WCAP_MODIFY_CANT_MAKE_COPY =
-                 WCAP_ERROR_BASE + 64;
-    /* 65 */ const unsigned long WCAP_STORE_FAILED_RECUR_SKIP =
-                 WCAP_ERROR_BASE + 65;
-    /* 66 */ const unsigned long WCAP_STORE_FAILED_RECUR_SAMEDAY =
-                 WCAP_ERROR_BASE + 66;
-    /* 67 */ const unsigned long WCAP_BAD_ORG_ARGUMENTS =
-                 WCAP_ERROR_BASE + 67;
-    /* 68 */ const unsigned long WCAP_STORE_FAILED_RECUR_PRIVACY =
-                 WCAP_ERROR_BASE + 68;
-    /* 69 */ const unsigned long WCAP_LDAP_ERROR =
-                 WCAP_ERROR_BASE + 69;
-    /* 70 */ const unsigned long WCAP_GET_INVITE_COUNT_FAILED =
-                 WCAP_ERROR_BASE + 70;
-    /* 71 */ const unsigned long WCAP_LIST_FAILED =
-                 WCAP_ERROR_BASE + 71;
-    /* 72 */ const unsigned long WCAP_LIST_SUBSCRIBED_FAILED =
-                 WCAP_ERROR_BASE + 72;
-    /* 73 */ const unsigned long WCAP_SUBSCRIBE_FAILED =
-                 WCAP_ERROR_BASE + 73;
-    /* 74 */ const unsigned long WCAP_UNSUBSCRIBE_FAILED =
-                 WCAP_ERROR_BASE + 74;
-    /* 75 */ const unsigned long WCAP_ANONYMOUS_NOT_ALLOWED =
-                 WCAP_ERROR_BASE + 75;
-    /* 76 */ const unsigned long WCAP_ACCESS_DENIED =
-                 WCAP_ERROR_BASE + 76;
-    /* 77 */ const unsigned long WCAP_BAD_IMPORT_ARGUMENTS =
-                 WCAP_ERROR_BASE + 77;
-    /* 78 */ const unsigned long WCAP_READONLY_DATABASE =
-                 WCAP_ERROR_BASE + 78;
-    /* 79 */ const unsigned long WCAP_ATTENDEE_NOT_ALLOWED_TO_REQUEST_ON_MODIFY=
-                 WCAP_ERROR_BASE + 79;
-    /* 80 */ const unsigned long WCAP_TRANSP_RESOURCE_NOT_ALLOWED =
-                 WCAP_ERROR_BASE + 80;
-    /* 81 */ const unsigned long WCAP_RECURRING_COMPONENT_NOT_FOUND =
-                 WCAP_ERROR_BASE + 81;
-
-    /* new by WCAP 4.0: */
-    /* 82 */ const unsigned long WCAP_BAD_MIME_TYPE =
-                 WCAP_ERROR_BASE + 82;
-    /* 83 */ const unsigned long WCAP_MISSING_BOUNDARY =
-                 WCAP_ERROR_BASE + 83;
-    /* 84 */ const unsigned long WCAP_INVALID_ATTACHMENT =
-                 WCAP_ERROR_BASE + 84;
-    /* 85 */ const unsigned long WCAP_ATTACH_DELETE_SUCCESS =
-                 WCAP_ERROR_BASE + 85;
-    /* 86 */ const unsigned long WCAP_ATTACH_DELETE_PARTIAL =
-                 WCAP_ERROR_BASE + 86;
-    /* 87 */ const unsigned long WCAP_ATTACHMENT_NOT_FOUND =
-                 WCAP_ERROR_BASE + 87;
-    /* / new by WCAP 4.0 */
-
-    /* 11000 */ const unsigned long WCAP_CDWP_ERR_MAX_CONNECTION_REACHED =
-                    WCAP_ERROR_BASE + 100;
-    /* 11001 */ const unsigned long WCAP_CDWP_ERR_CANNOT_CONNECT =
-                    WCAP_ERROR_BASE + 101;
-    /* 11002 */ const unsigned long WCAP_CDWP_ERR_CANNOT_RESOLVE_CALENDAR =
-                    WCAP_ERROR_BASE + 102;
-    /* 11003 */ const unsigned long WCAP_CDWP_ERR_BAD_DATA =
-                    WCAP_ERROR_BASE + 103;
-    /* 11004 */ const unsigned long WCAP_CDWP_ERR_DWPHOST_CTX_DOES_NOT_EXIST =
-                    WCAP_ERROR_BASE + 104;
-    /* 11005 */ const unsigned long WCAP_CDWP_ERR_HOSTNAME_NOT_RESOLVABLE =
-                    WCAP_ERROR_BASE + 105;
-    /* 11006 */ const unsigned long WCAP_CDWP_ERR_NO_DATA =
-                    WCAP_ERROR_BASE + 106;
-    /* 11007 */ const unsigned long WCAP_CDWP_ERR_AUTH_FAILED =
-                    WCAP_ERROR_BASE + 107;
-    /* 11008 */ const unsigned long WCAP_CDWP_ERR_CHECKVERSION_FAILED =
-                    WCAP_ERROR_BASE + 108;
-};
-
deleted file mode 100755
--- a/calendar/providers/wcap/public/calIWcapSession.idl
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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/. */
-
-#include "nsISupports.idl"
-
-interface calIWcapCalendar;
-interface nsIURI;
-
-
-/**
- * WCAP session.
- */
-[scriptable, uuid(477B4534-C297-40a1-ADF2-5A7E2A81816A)]
-interface calIWcapSession : nsISupports
-{
-    /**
-     * Setting this URI causes the session to logged out and disconnected.
-     */
-    attribute nsIURI uri;
-
-    /**
-     * User that has established this session.
-     * @exception NS_ERROR_NOT_AVAILABLE if not logged in
-     */
-    readonly attribute string userId;
-
-    /**
-     * Determines whether the user is currently logged in.
-     * Does _not_ check whether the user's ticket has timed out!
-     */
-    readonly attribute boolean isLoggedIn;
-
-    /**
-     * Gets the default calendar instance of this session.
-     */
-    readonly attribute calIWcapCalendar defaultCalendar;
-};
-
deleted file mode 100644
--- a/calendar/providers/wcap/public/moz.build
+++ /dev/null
@@ -1,13 +0,0 @@
-# vim: set filetype=python:
-# 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/.
-
-XPIDL_SOURCES += [
-    'calIWcapCalendar.idl',
-    'calIWcapErrors.idl',
-    'calIWcapSession.idl',
-]
-
-XPIDL_MODULE = 'wcap'
-
--- a/calendar/resources/content/calendarCreation.xul
+++ b/calendar/resources/content/calendarCreation.xul
@@ -53,17 +53,16 @@
         <html:tr>
           <html:th valign="top">
             <label value="&calendarproperties.format.label;" control="calendar-format"/>
           </html:th>
           <html:td>
             <radiogroup id="calendar-format" onselect="onSelectProvider(this.value)">
               <radio value="ics" label="&calendarproperties.webdav.label;" selected="true" />
               <radio value="caldav" label="&calendarproperties.caldav.label;"/>
-              <radio id="wcap-radio" value="wcap" label="&calendarproperties.wcap.label;"/>
             </radiogroup>
           </html:td>
         </html:tr>
         <html:tr id="calendar-username-row">
           <html:th>
             <label id="calendar-username-label"
                    value="&locationpage.username.label;"
                    control="calendar-username"/>
--- a/calendar/test/modules/CalendarUtils.jsm
+++ b/calendar/test/modules/CalendarUtils.jsm
@@ -518,17 +518,17 @@ function createCalendar(controller, name
 /**
  * Handles the "Create New Calendar" Wizard.
  *
  * @param wizard            wizard dialog controller
  * @param name              calendar name
  * @param data              (optional) dataset object
  *                              showReminders - False to disable reminders.
  *                              eMail - id of eMail account
- *                              network.format - ics/caldav/wcap
+ *                              network.format - ics/caldav
  *                              network.location - URI (undefined for local ICS)
  *                              network.offline - False to disable cache.
  */
 function handleNewCalendarWizard(wizard, name, data = undefined) {
   let { lookup: wizardlookup, eid: wizardId } = helpersForController(wizard);
   let dlgButton = btn => wizard.window.document.querySelector("wizard").getButton(btn);
   if (data == undefined) {
     data = {};