Bug 1436490 - Move more data related functions into calDataUtils.jsm - automatic changes. r=MakeMyDay
authorPhilipp Kewisch <mozilla@kewis.ch>
Sat, 03 Feb 2018 22:34:07 +0100
changeset 31100 afe12c1075598ecdaf16e2d8d17393e496b7ae8b
parent 31099 e2c686325a54c7ac2d0546085784392d2cea47e0
child 31101 3de68de8bf72c03fefe20521619c0a78c07b07a5
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersMakeMyDay
bugs1436490
Bug 1436490 - Move more data related functions into calDataUtils.jsm - automatic changes. r=MakeMyDay MozReview-Commit-ID: CNbYWbaDrLj
calendar/base/content/calendar-month-view.xml
calendar/base/content/calendar-multiday-view.xml
calendar/base/content/dialogs/calendar-alarm-dialog.js
calendar/base/content/dialogs/calendar-event-dialog-attendees.js
calendar/base/content/widgets/calendar-widgets.xml
calendar/base/modules/calHashedArray.jsm
calendar/base/modules/calItemUtils.jsm
calendar/base/modules/calPrintUtils.jsm
calendar/base/src/calItemBase.js
calendar/base/src/calRecurrenceInfo.js
calendar/import-export/calMonthGridPrinter.js
calendar/import-export/calWeekPrinter.js
calendar/lightning/content/lightning-item-iframe.js
calendar/lightning/modules/ltnInvitationUtils.jsm
calendar/providers/wcap/calWcapCalendarItems.js
calendar/test/unit/test_recur.js
calendar/test/unit/test_utils.js
--- a/calendar/base/content/calendar-month-view.xml
+++ b/calendar/base/content/calendar-month-view.xml
@@ -241,17 +241,17 @@
 
             let box = createXULElement("calendar-month-day-box-item");
             let context = this.getAttribute("item-context") ||
                           this.getAttribute("context");
             box.setAttribute("context", context);
             box.setAttribute("calendar-uri", aItem.calendar.uri.spec);
             box.setAttribute("calendar-id", aItem.calendar.id);
 
-            cal.binaryInsertNode(this, box, aItem, cal.view.compareItems, false);
+            cal.data.binaryInsertNode(this, box, aItem, cal.view.compareItems, false);
 
             box.calendarView = this.calendarView;
             box.item = aItem;
             box.parentBox = this;
             box.occurrence = aItem;
 
             this.mItemHash[aItem.hashId] = box;
             return box;
--- a/calendar/base/content/calendar-multiday-view.xml
+++ b/calendar/base/content/calendar-multiday-view.xml
@@ -328,17 +328,17 @@
 
       <property name="date">
         <getter><![CDATA[
             return this.mDate;
         ]]></getter>
         <setter><![CDATA[
             this.mDate = val;
 
-            if (!cal.compareObjects(val.timezone, this.mTimezone)) {
+            if (!cal.data.compareObjects(val.timezone, this.mTimezone)) {
                 this.mTimezone = val.timezone;
                 if (!this.mLayoutBatchCount) {
                     this.recalculateStartEndMinutes();
                 }
             }
 
             return val;
         ]]></setter>
@@ -516,21 +516,21 @@
            minutes of the whole occurrence (which could span multiple days)
            relative to the time 0:00 of the day in this column -->
       <method name="getStartEndMinutesForOccurrence">
         <parameter name="aOccurrence"/>
         <body><![CDATA[
             let stdate = aOccurrence.startDate || aOccurrence.entryDate || aOccurrence.dueDate;
             let enddate = aOccurrence.endDate || aOccurrence.dueDate || aOccurrence.entryDate;
 
-            if (!cal.compareObjects(stdate.timezone, this.mTimezone)) {
+            if (!cal.data.compareObjects(stdate.timezone, this.mTimezone)) {
                 stdate = stdate.getInTimezone(this.mTimezone);
             }
 
-            if (!cal.compareObjects(enddate.timezone, this.mTimezone)) {
+            if (!cal.data.compareObjects(enddate.timezone, this.mTimezone)) {
                 enddate = enddate.getInTimezone(this.mTimezone);
             }
 
             let startHour = stdate.hour;
             let startMinute = stdate.minute;
             let endHour = enddate.hour;
             let endMinute = enddate.minute;
 
--- a/calendar/base/content/dialogs/calendar-alarm-dialog.js
+++ b/calendar/base/content/dialogs/calendar-alarm-dialog.js
@@ -271,17 +271,17 @@ function widgetAlarmComptor(aItem, aWidg
  * @param aItem       The calendar item to add a widget for.
  * @param aAlarm      The alarm to add a widget for.
  */
 function addWidgetFor(aItem, aAlarm) {
     let widget = document.createElement("calendar-alarm-widget");
     let alarmRichlist = document.getElementById("alarm-richlist");
 
     // Add widgets sorted by start date ascending
-    cal.binaryInsertNode(alarmRichlist, widget, aItem, widgetAlarmComptor, false);
+    cal.data.binaryInsertNode(alarmRichlist, widget, aItem, widgetAlarmComptor, false);
 
     widget.item = aItem;
     widget.alarm = aAlarm;
     widget.addEventListener("snooze", onSnoozeAlarm);
     widget.addEventListener("dismiss", onDismissAlarm);
     widget.addEventListener("itemdetails", onItemDetails);
 
     setupTitle();
--- a/calendar/base/content/dialogs/calendar-event-dialog-attendees.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog-attendees.js
@@ -249,17 +249,17 @@ function updateDateTime() {
             document.getElementById("all-day")
                 .setAttribute("checked", "true");
         }
 
         // In the case where the timezones are different but
         // the timezone of the endtime is "UTC", we convert
         // the endtime into the timezone of the starttime.
         if (startTime && endTime) {
-            if (!cal.compareObjects(startTime.timezone, endTime.timezone)) {
+            if (!cal.data.compareObjects(startTime.timezone, endTime.timezone)) {
                 if (endTime.timezone.isUTC) {
                     endTime = endTime.getInTimezone(startTime.timezone);
                 }
             }
         }
 
         // Before feeding the date/time value into the control we need
         // to set the timezone to 'floating' in order to avoid the
@@ -302,17 +302,17 @@ function updateDateTime() {
 function updateTimezone() {
     gIgnoreUpdate = true;
 
     if (gDisplayTimezone) {
         let startTimezone = gStartTimezone;
         let endTimezone = gEndTimezone;
         let equalTimezones = false;
         if (startTimezone && endTimezone &&
-            (cal.compareObjects(startTimezone, endTimezone) || endTimezone.isUTC)) {
+            (cal.data.compareObjects(startTimezone, endTimezone) || endTimezone.isUTC)) {
             equalTimezones = true;
         }
 
         let tzStart = document.getElementById("timezone-starttime");
         let tzEnd = document.getElementById("timezone-endtime");
         if (startTimezone) {
             tzStart.removeAttribute("collapsed");
             tzStart.value = startTimezone.displayName || startTimezone.tzid;
@@ -388,17 +388,17 @@ function updateEndTime() {
     let kDefaultTimezone = cal.dtz.defaultTimezone;
 
     gStartDate = cal.dtz.jsDateToDateTime(startWidget.value,
                                   gDisplayTimezone ? gStartTimezone : cal.dtz.defaultTimezone);
 
     let timezone = gEndTimezone;
     if (timezone.isUTC &&
         gStartDate &&
-        !cal.compareObjects(gStartTimezone, gEndTimezone)) {
+        !cal.data.compareObjects(gStartTimezone, gEndTimezone)) {
         timezone = gStartTimezone;
     }
     gEndDate = cal.dtz.jsDateToDateTime(endWidget.value,
                                     gDisplayTimezone ? timezone : kDefaultTimezone);
 
     let allDayElement = document.getElementById("all-day");
     let allDay = allDayElement.getAttribute("checked") == "true";
     if (allDay) {
@@ -442,17 +442,17 @@ function editStartTimezone() {
 
     let self = this;
     let args = {};
     args.calendar = window.arguments[0].calendar;
     args.time = gStartDate.getInTimezone(gStartTimezone);
     args.onOk = function(datetime) {
         let equalTimezones = false;
         if (gStartTimezone && gEndTimezone &&
-            cal.compareObjects(gStartTimezone, gEndTimezone)) {
+            cal.data.compareObjects(gStartTimezone, gEndTimezone)) {
             equalTimezones = true;
         }
         gStartTimezone = datetime.timezone;
         if (equalTimezones) {
             gEndTimezone = datetime.timezone;
         }
         self.propagateDateTime();
     };
@@ -476,17 +476,17 @@ function editEndTimezone() {
     }
 
     let self = this;
     let args = {};
     args.calendar = window.arguments[0].calendar;
     args.time = gEndTime.getInTimezone(gEndTimezone);
     args.onOk = function(datetime) {
         if (gStartTimezone && gEndTimezone &&
-            cal.compareObjects(gStartTimezone, gEndTimezone)) {
+            cal.data.compareObjects(gStartTimezone, gEndTimezone)) {
             gStartTimezone = datetime.timezone;
         }
         gEndTimezone = datetime.timezone;
         self.propagateDateTime();
     };
 
     // Open the dialog modally
     openDialog(
--- a/calendar/base/content/widgets/calendar-widgets.xml
+++ b/calendar/base/content/widgets/calendar-widgets.xml
@@ -126,17 +126,17 @@
       </method>
 
       <method name="insertCategory">
         <parameter name="category" />
         <parameter name="categories" />
         <parameter name="categoryListbox" />
         <parameter name="compare" />
         <body><![CDATA[
-            let newIndex = cal.binaryInsert(categories, category, compare, true);
+            let newIndex = cal.data.binaryInsert(categories, category, compare, true);
             let item = categoryListbox.childNodes[Math.min(newIndex, categoryListbox.childNodes.length - 1)];
 
             if (!item || item.getAttribute("value") != category) {
                 // The item doesn't exist, insert it at the correct spot.
                 item = categoryListbox.insertItemAt(newIndex, category, category);
 
                 if (this.maxCount != 1) {
                     item.setAttribute("type", "checkbox");
--- a/calendar/base/modules/calHashedArray.jsm
+++ b/calendar/base/modules/calHashedArray.jsm
@@ -228,33 +228,33 @@ cal.SortedHashedArray = function(compara
 };
 
 cal.SortedHashedArray.prototype = {
     __proto__: cal.HashedArray.prototype,
 
     mCompFunc: null,
 
     addItem: function(item) {
-        let newIndex = cal.binaryInsert(this.mArray, item, this.mCompFunc, false);
+        let newIndex = cal.data.binaryInsert(this.mArray, item, this.mCompFunc, false);
         this.reindex(newIndex);
         return newIndex;
     },
 
     modifyItem: function(item) {
         let hashId = this.hashAccessor(item);
         if (hashId in this.mHash) {
             let cmp = this.mCompFunc(item, this.mArray[this.mHash[hashId]]);
             if (cmp == 0) {
                 // The item will be at the same index, we just need to replace it
                 this.mArray[this.mHash[hashId]] = item;
                 return this.mHash[hashId];
             } else {
                 let oldIndex = this.mHash[hashId];
 
-                let newIndex = cal.binaryInsert(this.mArray, item, this.mCompFunc, false);
+                let newIndex = cal.data.binaryInsert(this.mArray, item, this.mCompFunc, false);
                 this.mArray.splice(oldIndex, 1);
                 this.reindex(oldIndex, newIndex);
                 return newIndex;
             }
         } else {
             return this.addItem(item);
         }
     }
--- a/calendar/base/modules/calItemUtils.jsm
+++ b/calendar/base/modules/calItemUtils.jsm
@@ -301,49 +301,49 @@ var calitem = {
     setItemProperty: function(item, propertyName, aValue, aCapability) {
         let isSupported = item.calendar.getProperty("capabilities." + aCapability + ".supported") !== false;
         let value = aCapability && !isSupported ? null : aValue;
 
         switch (propertyName) {
             case "startDate":
                 if ((value.isDate && !item.startDate.isDate) ||
                     (!value.isDate && item.startDate.isDate) ||
-                    !cal.compareObjects(value.timezone, item.startDate.timezone) ||
+                    !cal.data.compareObjects(value.timezone, item.startDate.timezone) ||
                     value.compare(item.startDate) != 0) {
                     item.startDate = value;
                 }
                 break;
             case "endDate":
                 if ((value.isDate && !item.endDate.isDate) ||
                     (!value.isDate && item.endDate.isDate) ||
-                    !cal.compareObjects(value.timezone, item.endDate.timezone) ||
+                    !cal.data.compareObjects(value.timezone, item.endDate.timezone) ||
                     value.compare(item.endDate) != 0) {
                     item.endDate = value;
                 }
                 break;
             case "entryDate":
                 if (value == item.entryDate) {
                     break;
                 }
                 if ((value && !item.entryDate) ||
                     (!value && item.entryDate) ||
                     value.isDate != item.entryDate.isDate ||
-                    !cal.compareObjects(value.timezone, item.entryDate.timezone) ||
+                    !cal.data.compareObjects(value.timezone, item.entryDate.timezone) ||
                     value.compare(item.entryDate) != 0) {
                     item.entryDate = value;
                 }
                 break;
             case "dueDate":
                 if (value == item.dueDate) {
                     break;
                 }
                 if ((value && !item.dueDate) ||
                     (!value && item.dueDate) ||
                     value.isDate != item.dueDate.isDate ||
-                    !cal.compareObjects(value.timezone, item.dueDate.timezone) ||
+                    !cal.data.compareObjects(value.timezone, item.dueDate.timezone) ||
                     value.compare(item.dueDate) != 0) {
                     item.dueDate = value;
                 }
                 break;
             case "isCompleted":
                 if (value != item.isCompleted) {
                     item.isCompleted = value;
                 }
--- a/calendar/base/modules/calPrintUtils.jsm
+++ b/calendar/base/modules/calPrintUtils.jsm
@@ -104,17 +104,17 @@ cal.print = {
         }
 
         // Fill in calendar color
         itemNode.querySelector(".calendar-color-box")
                 .setAttribute("calendar-id", cal.view.formatStringForCSSRule(item.calendar.id));
         cal.print.insertCalendarRules(document, item.calendar);
 
         // Add it to the day container in the right order
-        cal.binaryInsertNode(dayContainer, itemNode, item, cal.view.compareItems);
+        cal.data.binaryInsertNode(dayContainer, itemNode, item, cal.view.compareItems);
     },
 
     /**
      * Serializes the given item by setting marked nodes to the item's
      * content. Should be used for tasks with no start and due date. Has
      * some expectations about the DOM document (in CSS-selector-speak),
      * all following nodes MUST exist.
      *
@@ -143,17 +143,17 @@ cal.print = {
         // Fill in details of the task
         if (item.isCompleted) {
             taskNode.querySelector(".task-checkbox").setAttribute("checked", "checked");
         }
 
         taskNode.querySelector(".task-title").textContent = item.title;
 
         let collator = cal.createLocaleCollator();
-        cal.binaryInsertNode(taskContainer, taskNode, item, (a, b) => collator.compareString(0, a, b), node => node.item.title);
+        cal.data.binaryInsertNode(taskContainer, taskNode, item, (a, b) => collator.compareString(0, a, b), node => node.item.title);
     },
 
     /**
      * Get time interval string for the given item. Returns an empty string for all-day items.
      *
      * @param aItem     The item providing the interval
      * @return          The string describing the interval
      */
--- a/calendar/base/src/calItemBase.js
+++ b/calendar/base/src/calItemBase.js
@@ -575,17 +575,17 @@ calItemBase.prototype = {
             return [];
         }
     },
 
     // void removeAttachment(in calIAttachment attachment);
     removeAttachment: function(aAttachment) {
         this.modify();
         for (let attIndex in this.mAttachments) {
-            if (cal.compareObjects(this.mAttachments[attIndex], aAttachment, Components.interfaces.calIAttachment)) {
+            if (cal.data.compareObjects(this.mAttachments[attIndex], aAttachment, Components.interfaces.calIAttachment)) {
                 this.modify();
                 this.mAttachments.splice(attIndex, 1);
                 break;
             }
         }
     },
 
     // void addAttachment(in calIAttachment attachment);
@@ -1024,17 +1024,17 @@ calItemBase.prototype = {
         this.mAlarms.push(aAlarm);
     },
 
     // void deleteAlarm(in calIAlarm aAlarm);
     deleteAlarm: function(aAlarm) {
         this.modify();
         this.mAlarms = this.getAlarms({});
         for (let i = 0; i < this.mAlarms.length; i++) {
-            if (cal.compareObjects(this.mAlarms[i], aAlarm, Components.interfaces.calIAlarm)) {
+            if (cal.data.compareObjects(this.mAlarms[i], aAlarm, Components.interfaces.calIAlarm)) {
                 this.mAlarms.splice(i, 1);
                 break;
             }
         }
     },
 
     // void clearAlarms();
     clearAlarms: function() {
--- a/calendar/base/src/calRecurrenceInfo.js
+++ b/calendar/base/src/calRecurrenceInfo.js
@@ -457,27 +457,27 @@ calRecurrenceInfo.prototype = {
         // toss in exceptions first. Save a map of all exceptions ids, so we
         // don't add the wrong occurrences later on.
         let occurrenceMap = {};
         for (let ex in this.mExceptionMap) {
             let item = this.mExceptionMap[ex];
             let occDate = cal.item.checkIfInRange(item, aRangeStart, aRangeEnd, true);
             occurrenceMap[ex] = true;
             if (occDate) {
-                cal.binaryInsert(dates, { id: item.recurrenceId, rstart: occDate }, ridDateSortComptor);
+                cal.data.binaryInsert(dates, { id: item.recurrenceId, rstart: occDate }, ridDateSortComptor);
             }
         }
 
         // DTSTART/DUE is always part of the (positive) expanded set:
         // DTSTART always equals RECURRENCE-ID for items expanded from RRULE
         let baseOccDate = cal.item.checkIfInRange(this.mBaseItem, aRangeStart, aRangeEnd, true);
         let baseOccDateKey = getRidKey(baseOccDate);
         if (baseOccDate && !occurrenceMap[baseOccDateKey]) {
             occurrenceMap[baseOccDateKey] = true;
-            cal.binaryInsert(dates, { id: baseOccDate, rstart: baseOccDate }, ridDateSortComptor);
+            cal.data.binaryInsert(dates, { id: baseOccDate, rstart: baseOccDate }, ridDateSortComptor);
         }
 
         // if both range start and end are specified, we ask for all of the occurrences,
         // to make sure we catch all possible exceptions.  If aRangeEnd isn't specified,
         // then we have to ask for aMaxCount, and hope for the best.
         let maxCount;
         if (rangeStart && rangeEnd) {
             maxCount = 0;
@@ -516,17 +516,17 @@ calRecurrenceInfo.prototype = {
                 let dateKey = getRidKey(date);
                 if (occurrenceMap[dateKey]) {
                     // Don't add occurrences twice (i.e exception was
                     // already added before)
                     continue;
                 }
                 // TODO if cur_dates[] is also sorted, then this binary
                 // search could be optimized further
-                cal.binaryInsert(dates, { id: date, rstart: date }, ridDateSortComptor);
+                cal.data.binaryInsert(dates, { id: date, rstart: date }, ridDateSortComptor);
                 occurrenceMap[dateKey] = true;
             }
         }
 
         // Apply negative rules
         for (let ritem of this.mNegativeRules) {
             let cur_dates = ritem.getOccurrences(startDate,
                                                  searchStart,
--- a/calendar/import-export/calMonthGridPrinter.js
+++ b/calendar/import-export/calMonthGridPrinter.js
@@ -177,17 +177,17 @@ calMonthPrinter.prototype = {
             this.setupWeek(document, weekContainer, weekStart, mainMonth, dayTable);
         }
 
         // Now insert the month into the page container, sorting by date (and therefore by month)
         function compareDates(a, b) {
             return !a || !b ? -1 : a.compare(b);
         }
 
-        cal.binaryInsertNode(monthContainer, currentMonth, currentMonth.item, compareDates);
+        cal.data.binaryInsertNode(monthContainer, currentMonth, currentMonth.item, compareDates);
     },
 
     setupWeek: function(document, weekContainer, startOfWeek, mainMonth, dayTable) {
         const weekdayMap = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
         let weekTemplate = document.getElementById("week-template");
 
         // Clone the template week and make sure it doesn't have an id
         let currentWeek = weekTemplate.cloneNode(true);
--- a/calendar/import-export/calWeekPrinter.js
+++ b/calendar/import-export/calWeekPrinter.js
@@ -130,11 +130,11 @@ calWeekPrinter.prototype = {
             }
         }
 
         // Now insert the week into the week container, sorting by date (and therefore week number)
         function compareDates(a, b) {
             return !a || !b ? -1 : a.compare(b);
         }
 
-        cal.binaryInsertNode(weekContainer, currentPage, currentPage.item, compareDates);
+        cal.data.binaryInsertNode(weekContainer, currentPage, currentPage.item, compareDates);
     }
 };
--- a/calendar/lightning/content/lightning-item-iframe.js
+++ b/calendar/lightning/content/lightning-item-iframe.js
@@ -1027,17 +1027,17 @@ function dateTimeControls2State(aStartDa
             // Change the End date in order to keep the duration.
             gEndTime = gStartTime.clone();
             if (gItemDuration) {
                 gEndTime.addDuration(gItemDuration);
             }
         } else {
             let timezone = gEndTimezone;
             if (timezone.isUTC) {
-                if (gStartTime && !cal.compareObjects(gStartTimezone, gEndTimezone)) {
+                if (gStartTime && !cal.data.compareObjects(gStartTimezone, gEndTimezone)) {
                     timezone = gStartTimezone;
                 }
             }
             if (gTimezonesEnabled || allDay) {
                 gEndTime = cal.dtz.jsDateToDateTime(getElementValue(endWidgetId), timezone);
                 gEndTime = gEndTime.getInTimezone(kDefaultTimezone);
             } else {
                 gEndTime = cal.dtz.jsDateToDateTime(getElementValue(endWidgetId), kDefaultTimezone);
@@ -1568,17 +1568,17 @@ function updateAccept() {
             cal.dtz.jsDateToDateTime(getElementValue("todo-duedate")) : null;
     }
 
     if (startDate && endDate) {
         if (gTimezonesEnabled) {
             let startTimezone = gStartTimezone;
             let endTimezone = gEndTimezone;
             if (endTimezone.isUTC) {
-                if (!cal.compareObjects(gStartTimezone, gEndTimezone)) {
+                if (!cal.data.compareObjects(gStartTimezone, gEndTimezone)) {
                     endTimezone = gStartTimezone;
                 }
             }
 
             startDate = startDate.getInTimezone(kDefaultTimezone);
             endDate = endDate.getInTimezone(kDefaultTimezone);
 
             startDate.timezone = startTimezone;
@@ -3251,17 +3251,17 @@ function updateDateTime() {
             let endTime = gEndTime.getInTimezone(gEndTimezone);
 
             setElementValue("event-all-day", startTime.isDate, "checked");
 
             // In the case where the timezones are different but
             // the timezone of the endtime is "UTC", we convert
             // the endtime into the timezone of the starttime.
             if (startTime && endTime) {
-                if (!cal.compareObjects(startTime.timezone, endTime.timezone)) {
+                if (!cal.data.compareObjects(startTime.timezone, endTime.timezone)) {
                     if (endTime.timezone.isUTC) {
                         endTime = endTime.getInTimezone(startTime.timezone);
                     }
                 }
             }
 
             // before feeding the date/time value into the control we need
             // to set the timezone to 'floating' in order to avoid the
--- a/calendar/lightning/modules/ltnInvitationUtils.jsm
+++ b/calendar/lightning/modules/ltnInvitationUtils.jsm
@@ -158,17 +158,17 @@ ltn.invitation = {
             for (let exc of aEvent.recurrenceInfo.getRecurrenceItems({})) {
                 if (exc instanceof Components.interfaces.calIRecurrenceDate) {
                     if (exc.isNegative) {
                         // This is an EXDATE
                         formattedExDates.push(formatter.formatDateTime(exc.date));
                     } else {
                         // This is an RDATE, close enough to a modified occurrence
                         let excItem = aEvent.recurrenceInfo.getOccurrenceFor(exc.date);
-                        cal.binaryInsert(modifiedOccurrences, excItem, dateComptor, true);
+                        cal.data.binaryInsert(modifiedOccurrences, excItem, dateComptor, true);
                     }
                 }
             }
             if (formattedExDates.length > 0) {
                 field("canceledOccurrences", formattedExDates.join("\n"));
             }
 
             // Show modified occurrences
@@ -176,17 +176,17 @@ ltn.invitation = {
                 let exc = aEvent.recurrenceInfo.getExceptionFor(recurrenceId);
                 let excLocation = exc.getProperty("LOCATION");
 
                 // Only show modified occurrence if start, duration or location
                 // has changed.
                 if (exc.startDate.compare(exc.recurrenceId) != 0 ||
                     exc.duration.compare(aEvent.duration) != 0 ||
                     excLocation != aEvent.getProperty("LOCATION")) {
-                    cal.binaryInsert(modifiedOccurrences, exc, dateComptor, true);
+                    cal.data.binaryInsert(modifiedOccurrences, exc, dateComptor, true);
                 }
             }
 
             let stringifyOcc = function(occ) {
                 let formattedExc = formatter.formatItemInterval(occ);
                 let occLocation = occ.getProperty("LOCATION");
                 if (occLocation != aEvent.getProperty("LOCATION")) {
                     let location = ltn.getString("lightning", "imipHtml.newLocation", [occLocation]);
--- a/calendar/providers/wcap/calWcapCalendarItems.js
+++ b/calendar/providers/wcap/calWcapCalendarItems.js
@@ -233,17 +233,17 @@ function equalDatetimes(one, two) {
             (one && two &&
              one.isDate == two.isDate &&
              one.compare(two) == 0);
 }
 
 function identicalDatetimes(one, two) {
     return (!one && !two) ||
             (equalDatetimes(one, two) &&
-             cal.compareObjects(one.timezone, two.timezone));
+             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
--- a/calendar/test/unit/test_recur.js
+++ b/calendar/test/unit/test_recur.js
@@ -541,17 +541,17 @@ function test_clone(event) {
 function test_interface() {
     let item = makeEvent("DTSTART:20020402T114500Z\n" +
                          "DTEND:20020402T124500Z\n" +
                          "RRULE:FREQ=WEEKLY;COUNT=6;BYDAY=TU,WE\r\n" +
                          "EXDATE:20020403T114500Z\r\n" +
                          "RDATE:20020401T114500Z\r\n");
 
     let rinfo = item.recurrenceInfo;
-    ok(cal.compareObjects(rinfo.item, item, Components.interfaces.calIEvent));
+    ok(cal.data.compareObjects(rinfo.item, item, Components.interfaces.calIEvent));
 
     // getRecurrenceItems
     let ritems = rinfo.getRecurrenceItems({});
     equal(ritems.length, 3);
 
     let checkritems = new Map(ritems.map(ritem => [ritem.icalProperty.propertyName, ritem.icalProperty]));
     let rparts = new Map(checkritems.get("RRULE").value.split(";").map(value => value.split("=", 2)));
     equal(rparts.size, 3);
@@ -591,40 +591,40 @@ function test_interface() {
     rinfo.clearRecurrenceItems();
     equal(0, rinfo.countRecurrenceItems());
 
     // appendRecurrenceItems / getRecurrenceItemAt / insertRecurrenceItemAt
     rinfo.appendRecurrenceItem(ritems[0]);
     rinfo.appendRecurrenceItem(ritems[1]);
     rinfo.insertRecurrenceItemAt(ritems[2], 0);
 
-    ok(cal.compareObjects(ritems[2],
+    ok(cal.data.compareObjects(ritems[2],
                           rinfo.getRecurrenceItemAt(0),
                           Components.interfaces.calIRecurrenceItem));
-    ok(cal.compareObjects(ritems[0],
+    ok(cal.data.compareObjects(ritems[0],
                           rinfo.getRecurrenceItemAt(1),
                           Components.interfaces.calIRecurrenceItem));
-    ok(cal.compareObjects(ritems[1],
+    ok(cal.data.compareObjects(ritems[1],
                           rinfo.getRecurrenceItemAt(2),
                           Components.interfaces.calIRecurrenceItem));
 
 
     // deleteRecurrenceItem
     rinfo.deleteRecurrenceItem(ritems[0]);
     ok(!item.icalString.includes("RRULE"));
 
     // deleteRecurrenceItemAt
     rinfo.deleteRecurrenceItemAt(1);
     itemString = item.icalString;
     ok(!itemString.includes("EXDATE"));
     ok(itemString.includes("RDATE"));
 
     // insertRecurrenceItemAt with exdate
     rinfo.insertRecurrenceItemAt(ritems[1], 1);
-    ok(cal.compareObjects(ritems[1],
+    ok(cal.data.compareObjects(ritems[1],
                           rinfo.getRecurrenceItemAt(1),
                           Components.interfaces.calIRecurrenceItem));
     rinfo.deleteRecurrenceItem(ritems[1]);
 
     // isFinite = true
     ok(rinfo.isFinite);
     rinfo.appendRecurrenceItem(ritems[0]);
     ok(rinfo.isFinite);
--- a/calendar/test/unit/test_utils.js
+++ b/calendar/test/unit/test_utils.js
@@ -177,16 +177,16 @@ function test_sameDay() {
     ok(cal.dtz.sameDay(createDate("20120101"), createDate("20120101T120000")));
     ok(cal.dtz.sameDay(createDate("20120101"), createDate("20120101")));
     ok(!cal.dtz.sameDay(createDate("20120101"), createDate("20120102")));
     ok(!cal.dtz.sameDay(createDate("20120101T120000"), createDate("20120102T120000")));
 }
 
 function test_binarySearch() {
     let arr = [2, 5, 7, 9, 20, 27, 34, 39, 41, 53, 62];
-    equal(cal.binarySearch(arr, 27), 5); // Center
-    equal(cal.binarySearch(arr, 2), 0); // Left most
-    equal(cal.binarySearch(arr, 62), 11); // Right most
+    equal(cal.data.binarySearch(arr, 27), 5); // Center
+    equal(cal.data.binarySearch(arr, 2), 0); // Left most
+    equal(cal.data.binarySearch(arr, 62), 11); // Right most
 
-    equal(cal.binarySearch([5], 5), 1); // One element found
-    equal(cal.binarySearch([1], 0), 0); // One element insert left
-    equal(cal.binarySearch([1], 2), 1); // One element insert right
+    equal(cal.data.binarySearch([5], 5), 1); // One element found
+    equal(cal.data.binarySearch([1], 0), 0); // One element insert left
+    equal(cal.data.binarySearch([1], 2), 1); // One element insert right
 }